@opengis/admin 0.2.0 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -44,9 +44,9 @@ Arguments: `+Array.prototype.slice.call(i).join("")+`
44
44
  `+new Error().stack),n=!1}return e.apply(this,arguments)},e)}var Jx={};function Qx(t,e){ht.deprecationHandler!=null&&ht.deprecationHandler(t,e),Jx[t]||(Kx(e),Jx[t]=!0)}ht.suppressDeprecationWarnings=!1,ht.deprecationHandler=null;function Xo(t){return typeof Function<"u"&&t instanceof Function||Object.prototype.toString.call(t)==="[object Function]"}function vI(t){var e,n;for(n in t)bn(t,n)&&(e=t[n],Xo(e)?this[n]=e:this["_"+n]=e);this._config=t,this._dayOfMonthOrdinalParseLenient=new RegExp((this._dayOfMonthOrdinalParse.source||this._ordinalParse.source)+"|"+/\d{1,2}/.source)}function Og(t,e){var n=la({},t),i;for(i in e)bn(e,i)&&(dl(t[i])&&dl(e[i])?(n[i]={},la(n[i],t[i]),la(n[i],e[i])):e[i]!=null?n[i]=e[i]:delete n[i]);for(i in t)bn(t,i)&&!bn(e,i)&&dl(t[i])&&(n[i]=la({},n[i]));return n}function Bg(t){t!=null&&this.set(t)}var zg;Object.keys?zg=Object.keys:zg=function(t){var e,n=[];for(e in t)bn(t,e)&&n.push(e);return n};var wI={sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"};function kI(t,e,n){var i=this._calendar[t]||this._calendar.sameElse;return Xo(i)?i.call(e,n):i}function Ko(t,e,n){var i=""+Math.abs(t),r=e-i.length,a=t>=0;return(a?n?"+":"":"-")+Math.pow(10,Math.max(0,r)).toString().substr(1)+i}var Ng=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,xp=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,Rg={},gc={};function It(t,e,n,i){var r=i;typeof i=="string"&&(r=function(){return this[i]()}),t&&(gc[t]=r),e&&(gc[e[0]]=function(){return Ko(r.apply(this,arguments),e[1],e[2])}),n&&(gc[n]=function(){return this.localeData().ordinal(r.apply(this,arguments),t)})}function SI(t){return t.match(/\[[\s\S]/)?t.replace(/^\[|\]$/g,""):t.replace(/\\/g,"")}function EI(t){var e=t.match(Ng),n,i;for(n=0,i=e.length;n<i;n++)gc[e[n]]?e[n]=gc[e[n]]:e[n]=SI(e[n]);return function(r){var a="",u;for(u=0;u<i;u++)a+=Xo(e[u])?e[u].call(r,t):e[u];return a}}function vp(t,e){return t.isValid()?(e=e1(e,t.localeData()),Rg[e]=Rg[e]||EI(e),Rg[e](t)):t.localeData().invalidDate()}function e1(t,e){var n=5;function i(r){return e.longDateFormat(r)||r}for(xp.lastIndex=0;n>=0&&xp.test(t);)t=t.replace(xp,i),xp.lastIndex=0,n-=1;return t}var CI={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"};function TI(t){var e=this._longDateFormat[t],n=this._longDateFormat[t.toUpperCase()];return e||!n?e:(this._longDateFormat[t]=n.match(Ng).map(function(i){return i==="MMMM"||i==="MM"||i==="DD"||i==="dddd"?i.slice(1):i}).join(""),this._longDateFormat[t])}var MI="Invalid date";function AI(){return this._invalidDate}var II="%d",PI=/\d{1,2}/;function DI(t){return this._ordinal.replace("%d",t)}var OI={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",w:"a week",ww:"%d weeks",M:"a month",MM:"%d months",y:"a year",yy:"%d years"};function BI(t,e,n,i){var r=this._relativeTime[n];return Xo(r)?r(t,e,n,i):r.replace(/%d/i,t)}function zI(t,e){var n=this._relativeTime[t>0?"future":"past"];return Xo(n)?n(e):n.replace(/%s/i,e)}var t1={D:"date",dates:"date",date:"date",d:"day",days:"day",day:"day",e:"weekday",weekdays:"weekday",weekday:"weekday",E:"isoWeekday",isoweekdays:"isoWeekday",isoweekday:"isoWeekday",DDD:"dayOfYear",dayofyears:"dayOfYear",dayofyear:"dayOfYear",h:"hour",hours:"hour",hour:"hour",ms:"millisecond",milliseconds:"millisecond",millisecond:"millisecond",m:"minute",minutes:"minute",minute:"minute",M:"month",months:"month",month:"month",Q:"quarter",quarters:"quarter",quarter:"quarter",s:"second",seconds:"second",second:"second",gg:"weekYear",weekyears:"weekYear",weekyear:"weekYear",GG:"isoWeekYear",isoweekyears:"isoWeekYear",isoweekyear:"isoWeekYear",w:"week",weeks:"week",week:"week",W:"isoWeek",isoweeks:"isoWeek",isoweek:"isoWeek",y:"year",years:"year",year:"year"};function ho(t){return typeof t=="string"?t1[t]||t1[t.toLowerCase()]:void 0}function Lg(t){var e={},n,i;for(i in t)bn(t,i)&&(n=ho(i),n&&(e[n]=t[i]));return e}var NI={date:9,day:11,weekday:11,isoWeekday:11,dayOfYear:4,hour:13,millisecond:16,minute:14,month:8,quarter:7,second:15,weekYear:1,isoWeekYear:1,week:5,isoWeek:5,year:1};function RI(t){var e=[],n;for(n in t)bn(t,n)&&e.push({unit:n,priority:NI[n]});return e.sort(function(i,r){return i.priority-r.priority}),e}var n1=/\d/,Wr=/\d\d/,i1=/\d{3}/,Vg=/\d{4}/,wp=/[+-]?\d{6}/,Wn=/\d\d?/,r1=/\d\d\d\d?/,o1=/\d\d\d\d\d\d?/,kp=/\d{1,3}/,Fg=/\d{1,4}/,Sp=/[+-]?\d{1,6}/,yc=/\d+/,Ep=/[+-]?\d+/,LI=/Z|[+-]\d\d:?\d\d/gi,Cp=/Z|[+-]\d\d(?::?\d\d)?/gi,VI=/[+-]?\d+(\.\d{1,3})?/,sh=/[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i,_c=/^[1-9]\d?/,$g=/^([1-9]\d|\d)/,Tp;Tp={};function _t(t,e,n){Tp[t]=Xo(e)?e:function(i,r){return i&&n?n:e}}function FI(t,e){return bn(Tp,t)?Tp[t](e._strict,e._locale):new RegExp($I(t))}function $I(t){return ks(t.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(e,n,i,r,a){return n||i||r||a}))}function ks(t){return t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}function po(t){return t<0?Math.ceil(t)||0:Math.floor(t)}function cn(t){var e=+t,n=0;return e!==0&&isFinite(e)&&(n=po(e)),n}var jg={};function zn(t,e){var n,i=e,r;for(typeof t=="string"&&(t=[t]),ws(e)&&(i=function(a,u){u[e]=cn(a)}),r=t.length,n=0;n<r;n++)jg[t[n]]=i}function ah(t,e){zn(t,function(n,i,r,a){r._w=r._w||{},e(n,r._w,r,a)})}function jI(t,e,n){e!=null&&bn(jg,t)&&jg[t](e,n._a,n,t)}function Mp(t){return t%4===0&&t%100!==0||t%400===0}var Ki=0,Ss=1,Jo=2,bi=3,Ro=4,Es=5,pl=6,UI=7,HI=8;It("Y",0,0,function(){var t=this.year();return t<=9999?Ko(t,4):"+"+t}),It(0,["YY",2],0,function(){return this.year()%100}),It(0,["YYYY",4],0,"year"),It(0,["YYYYY",5],0,"year"),It(0,["YYYYYY",6,!0],0,"year"),_t("Y",Ep),_t("YY",Wn,Wr),_t("YYYY",Fg,Vg),_t("YYYYY",Sp,wp),_t("YYYYYY",Sp,wp),zn(["YYYYY","YYYYYY"],Ki),zn("YYYY",function(t,e){e[Ki]=t.length===2?ht.parseTwoDigitYear(t):cn(t)}),zn("YY",function(t,e){e[Ki]=ht.parseTwoDigitYear(t)}),zn("Y",function(t,e){e[Ki]=parseInt(t,10)});function lh(t){return Mp(t)?366:365}ht.parseTwoDigitYear=function(t){return cn(t)+(cn(t)>68?1900:2e3)};var s1=bc("FullYear",!0);function qI(){return Mp(this.year())}function bc(t,e){return function(n){return n!=null?(a1(this,t,n),ht.updateOffset(this,e),this):ch(this,t)}}function ch(t,e){if(!t.isValid())return NaN;var n=t._d,i=t._isUTC;switch(e){case"Milliseconds":return i?n.getUTCMilliseconds():n.getMilliseconds();case"Seconds":return i?n.getUTCSeconds():n.getSeconds();case"Minutes":return i?n.getUTCMinutes():n.getMinutes();case"Hours":return i?n.getUTCHours():n.getHours();case"Date":return i?n.getUTCDate():n.getDate();case"Day":return i?n.getUTCDay():n.getDay();case"Month":return i?n.getUTCMonth():n.getMonth();case"FullYear":return i?n.getUTCFullYear():n.getFullYear();default:return NaN}}function a1(t,e,n){var i,r,a,u,l;if(!(!t.isValid()||isNaN(n))){switch(i=t._d,r=t._isUTC,e){case"Milliseconds":return void(r?i.setUTCMilliseconds(n):i.setMilliseconds(n));case"Seconds":return void(r?i.setUTCSeconds(n):i.setSeconds(n));case"Minutes":return void(r?i.setUTCMinutes(n):i.setMinutes(n));case"Hours":return void(r?i.setUTCHours(n):i.setHours(n));case"Date":return void(r?i.setUTCDate(n):i.setDate(n));case"FullYear":break;default:return}a=n,u=t.month(),l=t.date(),l=l===29&&u===1&&!Mp(a)?28:l,r?i.setUTCFullYear(a,u,l):i.setFullYear(a,u,l)}}function WI(t){return t=ho(t),Xo(this[t])?this[t]():this}function GI(t,e){if(typeof t=="object"){t=Lg(t);var n=RI(t),i,r=n.length;for(i=0;i<r;i++)this[n[i].unit](t[n[i].unit])}else if(t=ho(t),Xo(this[t]))return this[t](e);return this}function ZI(t,e){return(t%e+e)%e}var li;Array.prototype.indexOf?li=Array.prototype.indexOf:li=function(t){var e;for(e=0;e<this.length;++e)if(this[e]===t)return e;return-1};function Ug(t,e){if(isNaN(t)||isNaN(e))return NaN;var n=ZI(e,12);return t+=(e-n)/12,n===1?Mp(t)?29:28:31-n%7%2}It("M",["MM",2],"Mo",function(){return this.month()+1}),It("MMM",0,0,function(t){return this.localeData().monthsShort(this,t)}),It("MMMM",0,0,function(t){return this.localeData().months(this,t)}),_t("M",Wn,_c),_t("MM",Wn,Wr),_t("MMM",function(t,e){return e.monthsShortRegex(t)}),_t("MMMM",function(t,e){return e.monthsRegex(t)}),zn(["M","MM"],function(t,e){e[Ss]=cn(t)-1}),zn(["MMM","MMMM"],function(t,e,n,i){var r=n._locale.monthsParse(t,i,n._strict);r!=null?e[Ss]=r:Yt(n).invalidMonth=t});var YI="January_February_March_April_May_June_July_August_September_October_November_December".split("_"),l1="Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),c1=/D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/,XI=sh,KI=sh;function JI(t,e){return t?zo(this._months)?this._months[t.month()]:this._months[(this._months.isFormat||c1).test(e)?"format":"standalone"][t.month()]:zo(this._months)?this._months:this._months.standalone}function QI(t,e){return t?zo(this._monthsShort)?this._monthsShort[t.month()]:this._monthsShort[c1.test(e)?"format":"standalone"][t.month()]:zo(this._monthsShort)?this._monthsShort:this._monthsShort.standalone}function eP(t,e,n){var i,r,a,u=t.toLocaleLowerCase();if(!this._monthsParse)for(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[],i=0;i<12;++i)a=Yo([2e3,i]),this._shortMonthsParse[i]=this.monthsShort(a,"").toLocaleLowerCase(),this._longMonthsParse[i]=this.months(a,"").toLocaleLowerCase();return n?e==="MMM"?(r=li.call(this._shortMonthsParse,u),r!==-1?r:null):(r=li.call(this._longMonthsParse,u),r!==-1?r:null):e==="MMM"?(r=li.call(this._shortMonthsParse,u),r!==-1?r:(r=li.call(this._longMonthsParse,u),r!==-1?r:null)):(r=li.call(this._longMonthsParse,u),r!==-1?r:(r=li.call(this._shortMonthsParse,u),r!==-1?r:null))}function tP(t,e,n){var i,r,a;if(this._monthsParseExact)return eP.call(this,t,e,n);for(this._monthsParse||(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[]),i=0;i<12;i++){if(r=Yo([2e3,i]),n&&!this._longMonthsParse[i]&&(this._longMonthsParse[i]=new RegExp("^"+this.months(r,"").replace(".","")+"$","i"),this._shortMonthsParse[i]=new RegExp("^"+this.monthsShort(r,"").replace(".","")+"$","i")),!n&&!this._monthsParse[i]&&(a="^"+this.months(r,"")+"|^"+this.monthsShort(r,""),this._monthsParse[i]=new RegExp(a.replace(".",""),"i")),n&&e==="MMMM"&&this._longMonthsParse[i].test(t))return i;if(n&&e==="MMM"&&this._shortMonthsParse[i].test(t))return i;if(!n&&this._monthsParse[i].test(t))return i}}function u1(t,e){if(!t.isValid())return t;if(typeof e=="string"){if(/^\d+$/.test(e))e=cn(e);else if(e=t.localeData().monthsParse(e),!ws(e))return t}var n=e,i=t.date();return i=i<29?i:Math.min(i,Ug(t.year(),n)),t._isUTC?t._d.setUTCMonth(n,i):t._d.setMonth(n,i),t}function h1(t){return t!=null?(u1(this,t),ht.updateOffset(this,!0),this):ch(this,"Month")}function nP(){return Ug(this.year(),this.month())}function iP(t){return this._monthsParseExact?(bn(this,"_monthsRegex")||d1.call(this),t?this._monthsShortStrictRegex:this._monthsShortRegex):(bn(this,"_monthsShortRegex")||(this._monthsShortRegex=XI),this._monthsShortStrictRegex&&t?this._monthsShortStrictRegex:this._monthsShortRegex)}function rP(t){return this._monthsParseExact?(bn(this,"_monthsRegex")||d1.call(this),t?this._monthsStrictRegex:this._monthsRegex):(bn(this,"_monthsRegex")||(this._monthsRegex=KI),this._monthsStrictRegex&&t?this._monthsStrictRegex:this._monthsRegex)}function d1(){function t(g,b){return b.length-g.length}var e=[],n=[],i=[],r,a,u,l;for(r=0;r<12;r++)a=Yo([2e3,r]),u=ks(this.monthsShort(a,"")),l=ks(this.months(a,"")),e.push(u),n.push(l),i.push(l),i.push(u);e.sort(t),n.sort(t),i.sort(t),this._monthsRegex=new RegExp("^("+i.join("|")+")","i"),this._monthsShortRegex=this._monthsRegex,this._monthsStrictRegex=new RegExp("^("+n.join("|")+")","i"),this._monthsShortStrictRegex=new RegExp("^("+e.join("|")+")","i")}function oP(t,e,n,i,r,a,u){var l;return t<100&&t>=0?(l=new Date(t+400,e,n,i,r,a,u),isFinite(l.getFullYear())&&l.setFullYear(t)):l=new Date(t,e,n,i,r,a,u),l}function uh(t){var e,n;return t<100&&t>=0?(n=Array.prototype.slice.call(arguments),n[0]=t+400,e=new Date(Date.UTC.apply(null,n)),isFinite(e.getUTCFullYear())&&e.setUTCFullYear(t)):e=new Date(Date.UTC.apply(null,arguments)),e}function Ap(t,e,n){var i=7+e-n,r=(7+uh(t,0,i).getUTCDay()-e)%7;return-r+i-1}function p1(t,e,n,i,r){var a=(7+n-i)%7,u=Ap(t,i,r),l=1+7*(e-1)+a+u,g,b;return l<=0?(g=t-1,b=lh(g)+l):l>lh(t)?(g=t+1,b=l-lh(t)):(g=t,b=l),{year:g,dayOfYear:b}}function hh(t,e,n){var i=Ap(t.year(),e,n),r=Math.floor((t.dayOfYear()-i-1)/7)+1,a,u;return r<1?(u=t.year()-1,a=r+Cs(u,e,n)):r>Cs(t.year(),e,n)?(a=r-Cs(t.year(),e,n),u=t.year()+1):(u=t.year(),a=r),{week:a,year:u}}function Cs(t,e,n){var i=Ap(t,e,n),r=Ap(t+1,e,n);return(lh(t)-i+r)/7}It("w",["ww",2],"wo","week"),It("W",["WW",2],"Wo","isoWeek"),_t("w",Wn,_c),_t("ww",Wn,Wr),_t("W",Wn,_c),_t("WW",Wn,Wr),ah(["w","ww","W","WW"],function(t,e,n,i){e[i.substr(0,1)]=cn(t)});function sP(t){return hh(t,this._week.dow,this._week.doy).week}var aP={dow:0,doy:6};function lP(){return this._week.dow}function cP(){return this._week.doy}function uP(t){var e=this.localeData().week(this);return t==null?e:this.add((t-e)*7,"d")}function hP(t){var e=hh(this,1,4).week;return t==null?e:this.add((t-e)*7,"d")}It("d",0,"do","day"),It("dd",0,0,function(t){return this.localeData().weekdaysMin(this,t)}),It("ddd",0,0,function(t){return this.localeData().weekdaysShort(this,t)}),It("dddd",0,0,function(t){return this.localeData().weekdays(this,t)}),It("e",0,0,"weekday"),It("E",0,0,"isoWeekday"),_t("d",Wn),_t("e",Wn),_t("E",Wn),_t("dd",function(t,e){return e.weekdaysMinRegex(t)}),_t("ddd",function(t,e){return e.weekdaysShortRegex(t)}),_t("dddd",function(t,e){return e.weekdaysRegex(t)}),ah(["dd","ddd","dddd"],function(t,e,n,i){var r=n._locale.weekdaysParse(t,i,n._strict);r!=null?e.d=r:Yt(n).invalidWeekday=t}),ah(["d","e","E"],function(t,e,n,i){e[i]=cn(t)});function dP(t,e){return typeof t!="string"?t:isNaN(t)?(t=e.weekdaysParse(t),typeof t=="number"?t:null):parseInt(t,10)}function pP(t,e){return typeof t=="string"?e.weekdaysParse(t)%7||7:isNaN(t)?null:t}function Hg(t,e){return t.slice(e,7).concat(t.slice(0,e))}var fP="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),f1="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),mP="Su_Mo_Tu_We_Th_Fr_Sa".split("_"),gP=sh,yP=sh,_P=sh;function bP(t,e){var n=zo(this._weekdays)?this._weekdays:this._weekdays[t&&t!==!0&&this._weekdays.isFormat.test(e)?"format":"standalone"];return t===!0?Hg(n,this._week.dow):t?n[t.day()]:n}function xP(t){return t===!0?Hg(this._weekdaysShort,this._week.dow):t?this._weekdaysShort[t.day()]:this._weekdaysShort}function vP(t){return t===!0?Hg(this._weekdaysMin,this._week.dow):t?this._weekdaysMin[t.day()]:this._weekdaysMin}function wP(t,e,n){var i,r,a,u=t.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],i=0;i<7;++i)a=Yo([2e3,1]).day(i),this._minWeekdaysParse[i]=this.weekdaysMin(a,"").toLocaleLowerCase(),this._shortWeekdaysParse[i]=this.weekdaysShort(a,"").toLocaleLowerCase(),this._weekdaysParse[i]=this.weekdays(a,"").toLocaleLowerCase();return n?e==="dddd"?(r=li.call(this._weekdaysParse,u),r!==-1?r:null):e==="ddd"?(r=li.call(this._shortWeekdaysParse,u),r!==-1?r:null):(r=li.call(this._minWeekdaysParse,u),r!==-1?r:null):e==="dddd"?(r=li.call(this._weekdaysParse,u),r!==-1||(r=li.call(this._shortWeekdaysParse,u),r!==-1)?r:(r=li.call(this._minWeekdaysParse,u),r!==-1?r:null)):e==="ddd"?(r=li.call(this._shortWeekdaysParse,u),r!==-1||(r=li.call(this._weekdaysParse,u),r!==-1)?r:(r=li.call(this._minWeekdaysParse,u),r!==-1?r:null)):(r=li.call(this._minWeekdaysParse,u),r!==-1||(r=li.call(this._weekdaysParse,u),r!==-1)?r:(r=li.call(this._shortWeekdaysParse,u),r!==-1?r:null))}function kP(t,e,n){var i,r,a;if(this._weekdaysParseExact)return wP.call(this,t,e,n);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),i=0;i<7;i++){if(r=Yo([2e3,1]).day(i),n&&!this._fullWeekdaysParse[i]&&(this._fullWeekdaysParse[i]=new RegExp("^"+this.weekdays(r,"").replace(".","\\.?")+"$","i"),this._shortWeekdaysParse[i]=new RegExp("^"+this.weekdaysShort(r,"").replace(".","\\.?")+"$","i"),this._minWeekdaysParse[i]=new RegExp("^"+this.weekdaysMin(r,"").replace(".","\\.?")+"$","i")),this._weekdaysParse[i]||(a="^"+this.weekdays(r,"")+"|^"+this.weekdaysShort(r,"")+"|^"+this.weekdaysMin(r,""),this._weekdaysParse[i]=new RegExp(a.replace(".",""),"i")),n&&e==="dddd"&&this._fullWeekdaysParse[i].test(t))return i;if(n&&e==="ddd"&&this._shortWeekdaysParse[i].test(t))return i;if(n&&e==="dd"&&this._minWeekdaysParse[i].test(t))return i;if(!n&&this._weekdaysParse[i].test(t))return i}}function SP(t){if(!this.isValid())return t!=null?this:NaN;var e=ch(this,"Day");return t!=null?(t=dP(t,this.localeData()),this.add(t-e,"d")):e}function EP(t){if(!this.isValid())return t!=null?this:NaN;var e=(this.day()+7-this.localeData()._week.dow)%7;return t==null?e:this.add(t-e,"d")}function CP(t){if(!this.isValid())return t!=null?this:NaN;if(t!=null){var e=pP(t,this.localeData());return this.day(this.day()%7?e:e-7)}else return this.day()||7}function TP(t){return this._weekdaysParseExact?(bn(this,"_weekdaysRegex")||qg.call(this),t?this._weekdaysStrictRegex:this._weekdaysRegex):(bn(this,"_weekdaysRegex")||(this._weekdaysRegex=gP),this._weekdaysStrictRegex&&t?this._weekdaysStrictRegex:this._weekdaysRegex)}function MP(t){return this._weekdaysParseExact?(bn(this,"_weekdaysRegex")||qg.call(this),t?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):(bn(this,"_weekdaysShortRegex")||(this._weekdaysShortRegex=yP),this._weekdaysShortStrictRegex&&t?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)}function AP(t){return this._weekdaysParseExact?(bn(this,"_weekdaysRegex")||qg.call(this),t?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):(bn(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=_P),this._weekdaysMinStrictRegex&&t?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)}function qg(){function t(w,E){return E.length-w.length}var e=[],n=[],i=[],r=[],a,u,l,g,b;for(a=0;a<7;a++)u=Yo([2e3,1]).day(a),l=ks(this.weekdaysMin(u,"")),g=ks(this.weekdaysShort(u,"")),b=ks(this.weekdays(u,"")),e.push(l),n.push(g),i.push(b),r.push(l),r.push(g),r.push(b);e.sort(t),n.sort(t),i.sort(t),r.sort(t),this._weekdaysRegex=new RegExp("^("+r.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+i.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+n.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+e.join("|")+")","i")}function Wg(){return this.hours()%12||12}function IP(){return this.hours()||24}It("H",["HH",2],0,"hour"),It("h",["hh",2],0,Wg),It("k",["kk",2],0,IP),It("hmm",0,0,function(){return""+Wg.apply(this)+Ko(this.minutes(),2)}),It("hmmss",0,0,function(){return""+Wg.apply(this)+Ko(this.minutes(),2)+Ko(this.seconds(),2)}),It("Hmm",0,0,function(){return""+this.hours()+Ko(this.minutes(),2)}),It("Hmmss",0,0,function(){return""+this.hours()+Ko(this.minutes(),2)+Ko(this.seconds(),2)});function m1(t,e){It(t,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),e)})}m1("a",!0),m1("A",!1);function g1(t,e){return e._meridiemParse}_t("a",g1),_t("A",g1),_t("H",Wn,$g),_t("h",Wn,_c),_t("k",Wn,_c),_t("HH",Wn,Wr),_t("hh",Wn,Wr),_t("kk",Wn,Wr),_t("hmm",r1),_t("hmmss",o1),_t("Hmm",r1),_t("Hmmss",o1),zn(["H","HH"],bi),zn(["k","kk"],function(t,e,n){var i=cn(t);e[bi]=i===24?0:i}),zn(["a","A"],function(t,e,n){n._isPm=n._locale.isPM(t),n._meridiem=t}),zn(["h","hh"],function(t,e,n){e[bi]=cn(t),Yt(n).bigHour=!0}),zn("hmm",function(t,e,n){var i=t.length-2;e[bi]=cn(t.substr(0,i)),e[Ro]=cn(t.substr(i)),Yt(n).bigHour=!0}),zn("hmmss",function(t,e,n){var i=t.length-4,r=t.length-2;e[bi]=cn(t.substr(0,i)),e[Ro]=cn(t.substr(i,2)),e[Es]=cn(t.substr(r)),Yt(n).bigHour=!0}),zn("Hmm",function(t,e,n){var i=t.length-2;e[bi]=cn(t.substr(0,i)),e[Ro]=cn(t.substr(i))}),zn("Hmmss",function(t,e,n){var i=t.length-4,r=t.length-2;e[bi]=cn(t.substr(0,i)),e[Ro]=cn(t.substr(i,2)),e[Es]=cn(t.substr(r))});function PP(t){return(t+"").toLowerCase().charAt(0)==="p"}var DP=/[ap]\.?m?\.?/i,OP=bc("Hours",!0);function BP(t,e,n){return t>11?n?"pm":"PM":n?"am":"AM"}var y1={calendar:wI,longDateFormat:CI,invalidDate:MI,ordinal:II,dayOfMonthOrdinalParse:PI,relativeTime:OI,months:YI,monthsShort:l1,week:aP,weekdays:fP,weekdaysMin:mP,weekdaysShort:f1,meridiemParse:DP},Xn={},dh={},ph;function zP(t,e){var n,i=Math.min(t.length,e.length);for(n=0;n<i;n+=1)if(t[n]!==e[n])return n;return i}function _1(t){return t&&t.toLowerCase().replace("_","-")}function NP(t){for(var e=0,n,i,r,a;e<t.length;){for(a=_1(t[e]).split("-"),n=a.length,i=_1(t[e+1]),i=i?i.split("-"):null;n>0;){if(r=Ip(a.slice(0,n).join("-")),r)return r;if(i&&i.length>=n&&zP(a,i)>=n-1)break;n--}e++}return ph}function RP(t){return!!(t&&t.match("^[^/\\\\]*$"))}function Ip(t){var e=null,n;if(Xn[t]===void 0&&typeof module<"u"&&module&&module.exports&&RP(t))try{e=ph._abbr,n=require,n("./locale/"+t),ca(e)}catch{Xn[t]=null}return Xn[t]}function ca(t,e){var n;return t&&(Er(e)?n=Ts(t):n=Gg(t,e),n?ph=n:typeof console<"u"&&console.warn&&console.warn("Locale "+t+" not found. Did you forget to load it?")),ph._abbr}function Gg(t,e){if(e!==null){var n,i=y1;if(e.abbr=t,Xn[t]!=null)Qx("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."),i=Xn[t]._config;else if(e.parentLocale!=null)if(Xn[e.parentLocale]!=null)i=Xn[e.parentLocale]._config;else if(n=Ip(e.parentLocale),n!=null)i=n._config;else return dh[e.parentLocale]||(dh[e.parentLocale]=[]),dh[e.parentLocale].push({name:t,config:e}),null;return Xn[t]=new Bg(Og(i,e)),dh[t]&&dh[t].forEach(function(r){Gg(r.name,r.config)}),ca(t),Xn[t]}else return delete Xn[t],null}function LP(t,e){if(e!=null){var n,i,r=y1;Xn[t]!=null&&Xn[t].parentLocale!=null?Xn[t].set(Og(Xn[t]._config,e)):(i=Ip(t),i!=null&&(r=i._config),e=Og(r,e),i==null&&(e.abbr=t),n=new Bg(e),n.parentLocale=Xn[t],Xn[t]=n),ca(t)}else Xn[t]!=null&&(Xn[t].parentLocale!=null?(Xn[t]=Xn[t].parentLocale,t===ca()&&ca(t)):Xn[t]!=null&&delete Xn[t]);return Xn[t]}function Ts(t){var e;if(t&&t._locale&&t._locale._abbr&&(t=t._locale._abbr),!t)return ph;if(!zo(t)){if(e=Ip(t),e)return e;t=[t]}return NP(t)}function VP(){return zg(Xn)}function Zg(t){var e,n=t._a;return n&&Yt(t).overflow===-2&&(e=n[Ss]<0||n[Ss]>11?Ss:n[Jo]<1||n[Jo]>Ug(n[Ki],n[Ss])?Jo:n[bi]<0||n[bi]>24||n[bi]===24&&(n[Ro]!==0||n[Es]!==0||n[pl]!==0)?bi:n[Ro]<0||n[Ro]>59?Ro:n[Es]<0||n[Es]>59?Es:n[pl]<0||n[pl]>999?pl:-1,Yt(t)._overflowDayOfYear&&(e<Ki||e>Jo)&&(e=Jo),Yt(t)._overflowWeeks&&e===-1&&(e=UI),Yt(t)._overflowWeekday&&e===-1&&(e=HI),Yt(t).overflow=e),t}var FP=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,$P=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d|))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,jP=/Z|[+-]\d\d(?::?\d\d)?/,Pp=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,!1],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,!1],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/],["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,!1],["YYYYDDD",/\d{7}/],["YYYYMM",/\d{6}/,!1],["YYYY",/\d{4}/,!1]],Yg=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]],UP=/^\/?Date\((-?\d+)/i,HP=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/,qP={UT:0,GMT:0,EDT:-4*60,EST:-5*60,CDT:-5*60,CST:-6*60,MDT:-6*60,MST:-7*60,PDT:-7*60,PST:-8*60};function b1(t){var e,n,i=t._i,r=FP.exec(i)||$P.exec(i),a,u,l,g,b=Pp.length,w=Yg.length;if(r){for(Yt(t).iso=!0,e=0,n=b;e<n;e++)if(Pp[e][1].exec(r[1])){u=Pp[e][0],a=Pp[e][2]!==!1;break}if(u==null){t._isValid=!1;return}if(r[3]){for(e=0,n=w;e<n;e++)if(Yg[e][1].exec(r[3])){l=(r[2]||" ")+Yg[e][0];break}if(l==null){t._isValid=!1;return}}if(!a&&l!=null){t._isValid=!1;return}if(r[4])if(jP.exec(r[4]))g="Z";else{t._isValid=!1;return}t._f=u+(l||"")+(g||""),Kg(t)}else t._isValid=!1}function WP(t,e,n,i,r,a){var u=[GP(t),l1.indexOf(e),parseInt(n,10),parseInt(i,10),parseInt(r,10)];return a&&u.push(parseInt(a,10)),u}function GP(t){var e=parseInt(t,10);return e<=49?2e3+e:e<=999?1900+e:e}function ZP(t){return t.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").replace(/^\s\s*/,"").replace(/\s\s*$/,"")}function YP(t,e,n){if(t){var i=f1.indexOf(t),r=new Date(e[0],e[1],e[2]).getDay();if(i!==r)return Yt(n).weekdayMismatch=!0,n._isValid=!1,!1}return!0}function XP(t,e,n){if(t)return qP[t];if(e)return 0;var i=parseInt(n,10),r=i%100,a=(i-r)/100;return a*60+r}function x1(t){var e=HP.exec(ZP(t._i)),n;if(e){if(n=WP(e[4],e[3],e[2],e[5],e[6],e[7]),!YP(e[1],n,t))return;t._a=n,t._tzm=XP(e[8],e[9],e[10]),t._d=uh.apply(null,t._a),t._d.setUTCMinutes(t._d.getUTCMinutes()-t._tzm),Yt(t).rfc2822=!0}else t._isValid=!1}function KP(t){var e=UP.exec(t._i);if(e!==null){t._d=new Date(+e[1]);return}if(b1(t),t._isValid===!1)delete t._isValid;else return;if(x1(t),t._isValid===!1)delete t._isValid;else return;t._strict?t._isValid=!1:ht.createFromInputFallback(t)}ht.createFromInputFallback=uo("value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are discouraged. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.",function(t){t._d=new Date(t._i+(t._useUTC?" UTC":""))});function xc(t,e,n){return t??e??n}function JP(t){var e=new Date(ht.now());return t._useUTC?[e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()]:[e.getFullYear(),e.getMonth(),e.getDate()]}function Xg(t){var e,n,i=[],r,a,u;if(!t._d){for(r=JP(t),t._w&&t._a[Jo]==null&&t._a[Ss]==null&&QP(t),t._dayOfYear!=null&&(u=xc(t._a[Ki],r[Ki]),(t._dayOfYear>lh(u)||t._dayOfYear===0)&&(Yt(t)._overflowDayOfYear=!0),n=uh(u,0,t._dayOfYear),t._a[Ss]=n.getUTCMonth(),t._a[Jo]=n.getUTCDate()),e=0;e<3&&t._a[e]==null;++e)t._a[e]=i[e]=r[e];for(;e<7;e++)t._a[e]=i[e]=t._a[e]==null?e===2?1:0:t._a[e];t._a[bi]===24&&t._a[Ro]===0&&t._a[Es]===0&&t._a[pl]===0&&(t._nextDay=!0,t._a[bi]=0),t._d=(t._useUTC?uh:oP).apply(null,i),a=t._useUTC?t._d.getUTCDay():t._d.getDay(),t._tzm!=null&&t._d.setUTCMinutes(t._d.getUTCMinutes()-t._tzm),t._nextDay&&(t._a[bi]=24),t._w&&typeof t._w.d<"u"&&t._w.d!==a&&(Yt(t).weekdayMismatch=!0)}}function QP(t){var e,n,i,r,a,u,l,g,b;e=t._w,e.GG!=null||e.W!=null||e.E!=null?(a=1,u=4,n=xc(e.GG,t._a[Ki],hh(Gn(),1,4).year),i=xc(e.W,1),r=xc(e.E,1),(r<1||r>7)&&(g=!0)):(a=t._locale._week.dow,u=t._locale._week.doy,b=hh(Gn(),a,u),n=xc(e.gg,t._a[Ki],b.year),i=xc(e.w,b.week),e.d!=null?(r=e.d,(r<0||r>6)&&(g=!0)):e.e!=null?(r=e.e+a,(e.e<0||e.e>6)&&(g=!0)):r=a),i<1||i>Cs(n,a,u)?Yt(t)._overflowWeeks=!0:g!=null?Yt(t)._overflowWeekday=!0:(l=p1(n,i,r,a,u),t._a[Ki]=l.year,t._dayOfYear=l.dayOfYear)}ht.ISO_8601=function(){},ht.RFC_2822=function(){};function Kg(t){if(t._f===ht.ISO_8601){b1(t);return}if(t._f===ht.RFC_2822){x1(t);return}t._a=[],Yt(t).empty=!0;var e=""+t._i,n,i,r,a,u,l=e.length,g=0,b,w;for(r=e1(t._f,t._locale).match(Ng)||[],w=r.length,n=0;n<w;n++)a=r[n],i=(e.match(FI(a,t))||[])[0],i&&(u=e.substr(0,e.indexOf(i)),u.length>0&&Yt(t).unusedInput.push(u),e=e.slice(e.indexOf(i)+i.length),g+=i.length),gc[a]?(i?Yt(t).empty=!1:Yt(t).unusedTokens.push(a),jI(a,i,t)):t._strict&&!i&&Yt(t).unusedTokens.push(a);Yt(t).charsLeftOver=l-g,e.length>0&&Yt(t).unusedInput.push(e),t._a[bi]<=12&&Yt(t).bigHour===!0&&t._a[bi]>0&&(Yt(t).bigHour=void 0),Yt(t).parsedDateParts=t._a.slice(0),Yt(t).meridiem=t._meridiem,t._a[bi]=eD(t._locale,t._a[bi],t._meridiem),b=Yt(t).era,b!==null&&(t._a[Ki]=t._locale.erasConvertYear(b,t._a[Ki])),Xg(t),Zg(t)}function eD(t,e,n){var i;return n==null?e:t.meridiemHour!=null?t.meridiemHour(e,n):(t.isPM!=null&&(i=t.isPM(n),i&&e<12&&(e+=12),!i&&e===12&&(e=0)),e)}function tD(t){var e,n,i,r,a,u,l=!1,g=t._f.length;if(g===0){Yt(t).invalidFormat=!0,t._d=new Date(NaN);return}for(r=0;r<g;r++)a=0,u=!1,e=Dg({},t),t._useUTC!=null&&(e._useUTC=t._useUTC),e._f=t._f[r],Kg(e),Ig(e)&&(u=!0),a+=Yt(e).charsLeftOver,a+=Yt(e).unusedTokens.length*10,Yt(e).score=a,l?a<i&&(i=a,n=e):(i==null||a<i||u)&&(i=a,n=e,u&&(l=!0));la(t,n||e)}function nD(t){if(!t._d){var e=Lg(t._i),n=e.day===void 0?e.date:e.day;t._a=Yx([e.year,e.month,n,e.hour,e.minute,e.second,e.millisecond],function(i){return i&&parseInt(i,10)}),Xg(t)}}function iD(t){var e=new oh(Zg(v1(t)));return e._nextDay&&(e.add(1,"d"),e._nextDay=void 0),e}function v1(t){var e=t._i,n=t._f;return t._locale=t._locale||Ts(t._l),e===null||n===void 0&&e===""?bp({nullInput:!0}):(typeof e=="string"&&(t._i=e=t._locale.preparse(e)),No(e)?new oh(Zg(e)):(rh(e)?t._d=e:zo(n)?tD(t):n?Kg(t):rD(t),Ig(t)||(t._d=null),t))}function rD(t){var e=t._i;Er(e)?t._d=new Date(ht.now()):rh(e)?t._d=new Date(e.valueOf()):typeof e=="string"?KP(t):zo(e)?(t._a=Yx(e.slice(0),function(n){return parseInt(n,10)}),Xg(t)):dl(e)?nD(t):ws(e)?t._d=new Date(e):ht.createFromInputFallback(t)}function w1(t,e,n,i,r){var a={};return(e===!0||e===!1)&&(i=e,e=void 0),(n===!0||n===!1)&&(i=n,n=void 0),(dl(t)&&Mg(t)||zo(t)&&t.length===0)&&(t=void 0),a._isAMomentObject=!0,a._useUTC=a._isUTC=r,a._l=n,a._i=t,a._f=e,a._strict=i,iD(a)}function Gn(t,e,n,i){return w1(t,e,n,i,!1)}var oD=uo("moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var t=Gn.apply(null,arguments);return this.isValid()&&t.isValid()?t<this?this:t:bp()}),sD=uo("moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var t=Gn.apply(null,arguments);return this.isValid()&&t.isValid()?t>this?this:t:bp()});function k1(t,e){var n,i;if(e.length===1&&zo(e[0])&&(e=e[0]),!e.length)return Gn();for(n=e[0],i=1;i<e.length;++i)(!e[i].isValid()||e[i][t](n))&&(n=e[i]);return n}function aD(){var t=[].slice.call(arguments,0);return k1("isBefore",t)}function lD(){var t=[].slice.call(arguments,0);return k1("isAfter",t)}var cD=function(){return Date.now?Date.now():+new Date},fh=["year","quarter","month","week","day","hour","minute","second","millisecond"];function uD(t){var e,n=!1,i,r=fh.length;for(e in t)if(bn(t,e)&&!(li.call(fh,e)!==-1&&(t[e]==null||!isNaN(t[e]))))return!1;for(i=0;i<r;++i)if(t[fh[i]]){if(n)return!1;parseFloat(t[fh[i]])!==cn(t[fh[i]])&&(n=!0)}return!0}function hD(){return this._isValid}function dD(){return Lo(NaN)}function Dp(t){var e=Lg(t),n=e.year||0,i=e.quarter||0,r=e.month||0,a=e.week||e.isoWeek||0,u=e.day||0,l=e.hour||0,g=e.minute||0,b=e.second||0,w=e.millisecond||0;this._isValid=uD(e),this._milliseconds=+w+b*1e3+g*6e4+l*1e3*60*60,this._days=+u+a*7,this._months=+r+i*3+n*12,this._data={},this._locale=Ts(),this._bubble()}function Op(t){return t instanceof Dp}function Jg(t){return t<0?Math.round(-1*t)*-1:Math.round(t)}function pD(t,e,n){var i=Math.min(t.length,e.length),r=Math.abs(t.length-e.length),a=0,u;for(u=0;u<i;u++)cn(t[u])!==cn(e[u])&&a++;return a+r}function S1(t,e){It(t,0,0,function(){var n=this.utcOffset(),i="+";return n<0&&(n=-n,i="-"),i+Ko(~~(n/60),2)+e+Ko(~~n%60,2)})}S1("Z",":"),S1("ZZ",""),_t("Z",Cp),_t("ZZ",Cp),zn(["Z","ZZ"],function(t,e,n){n._useUTC=!0,n._tzm=Qg(Cp,t)});var fD=/([\+\-]|\d\d)/gi;function Qg(t,e){var n=(e||"").match(t),i,r,a;return n===null?null:(i=n[n.length-1]||[],r=(i+"").match(fD)||["-",0,0],a=+(r[1]*60)+cn(r[2]),a===0?0:r[0]==="+"?a:-a)}function ey(t,e){var n,i;return e._isUTC?(n=e.clone(),i=(No(t)||rh(t)?t.valueOf():Gn(t).valueOf())-n.valueOf(),n._d.setTime(n._d.valueOf()+i),ht.updateOffset(n,!1),n):Gn(t).local()}function ty(t){return-Math.round(t._d.getTimezoneOffset())}ht.updateOffset=function(){};function mD(t,e,n){var i=this._offset||0,r;if(!this.isValid())return t!=null?this:NaN;if(t!=null){if(typeof t=="string"){if(t=Qg(Cp,t),t===null)return this}else Math.abs(t)<16&&!n&&(t=t*60);return!this._isUTC&&e&&(r=ty(this)),this._offset=t,this._isUTC=!0,r!=null&&this.add(r,"m"),i!==t&&(!e||this._changeInProgress?M1(this,Lo(t-i,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,ht.updateOffset(this,!0),this._changeInProgress=null)),this}else return this._isUTC?i:ty(this)}function gD(t,e){return t!=null?(typeof t!="string"&&(t=-t),this.utcOffset(t,e),this):-this.utcOffset()}function yD(t){return this.utcOffset(0,t)}function _D(t){return this._isUTC&&(this.utcOffset(0,t),this._isUTC=!1,t&&this.subtract(ty(this),"m")),this}function bD(){if(this._tzm!=null)this.utcOffset(this._tzm,!1,!0);else if(typeof this._i=="string"){var t=Qg(LI,this._i);t!=null?this.utcOffset(t):this.utcOffset(0,!0)}return this}function xD(t){return this.isValid()?(t=t?Gn(t).utcOffset():0,(this.utcOffset()-t)%60===0):!1}function vD(){return this.utcOffset()>this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()}function wD(){if(!Er(this._isDSTShifted))return this._isDSTShifted;var t={},e;return Dg(t,this),t=v1(t),t._a?(e=t._isUTC?Yo(t._a):Gn(t._a),this._isDSTShifted=this.isValid()&&pD(t._a,e.toArray())>0):this._isDSTShifted=!1,this._isDSTShifted}function kD(){return this.isValid()?!this._isUTC:!1}function SD(){return this.isValid()?this._isUTC:!1}function E1(){return this.isValid()?this._isUTC&&this._offset===0:!1}var ED=/^(-|\+)?(?:(\d*)[. ])?(\d+):(\d+)(?::(\d+)(\.\d*)?)?$/,CD=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;function Lo(t,e){var n=t,i=null,r,a,u;return Op(t)?n={ms:t._milliseconds,d:t._days,M:t._months}:ws(t)||!isNaN(+t)?(n={},e?n[e]=+t:n.milliseconds=+t):(i=ED.exec(t))?(r=i[1]==="-"?-1:1,n={y:0,d:cn(i[Jo])*r,h:cn(i[bi])*r,m:cn(i[Ro])*r,s:cn(i[Es])*r,ms:cn(Jg(i[pl]*1e3))*r}):(i=CD.exec(t))?(r=i[1]==="-"?-1:1,n={y:fl(i[2],r),M:fl(i[3],r),w:fl(i[4],r),d:fl(i[5],r),h:fl(i[6],r),m:fl(i[7],r),s:fl(i[8],r)}):n==null?n={}:typeof n=="object"&&("from"in n||"to"in n)&&(u=TD(Gn(n.from),Gn(n.to)),n={},n.ms=u.milliseconds,n.M=u.months),a=new Dp(n),Op(t)&&bn(t,"_locale")&&(a._locale=t._locale),Op(t)&&bn(t,"_isValid")&&(a._isValid=t._isValid),a}Lo.fn=Dp.prototype,Lo.invalid=dD;function fl(t,e){var n=t&&parseFloat(t.replace(",","."));return(isNaN(n)?0:n)*e}function C1(t,e){var n={};return n.months=e.month()-t.month()+(e.year()-t.year())*12,t.clone().add(n.months,"M").isAfter(e)&&--n.months,n.milliseconds=+e-+t.clone().add(n.months,"M"),n}function TD(t,e){var n;return t.isValid()&&e.isValid()?(e=ey(e,t),t.isBefore(e)?n=C1(t,e):(n=C1(e,t),n.milliseconds=-n.milliseconds,n.months=-n.months),n):{milliseconds:0,months:0}}function T1(t,e){return function(n,i){var r,a;return i!==null&&!isNaN(+i)&&(Qx(e,"moment()."+e+"(period, number) is deprecated. Please use moment()."+e+"(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info."),a=n,n=i,i=a),r=Lo(n,i),M1(this,r,t),this}}function M1(t,e,n,i){var r=e._milliseconds,a=Jg(e._days),u=Jg(e._months);t.isValid()&&(i=i??!0,u&&u1(t,ch(t,"Month")+u*n),a&&a1(t,"Date",ch(t,"Date")+a*n),r&&t._d.setTime(t._d.valueOf()+r*n),i&&ht.updateOffset(t,a||u))}var MD=T1(1,"add"),AD=T1(-1,"subtract");function A1(t){return typeof t=="string"||t instanceof String}function ID(t){return No(t)||rh(t)||A1(t)||ws(t)||DD(t)||PD(t)||t===null||t===void 0}function PD(t){var e=dl(t)&&!Mg(t),n=!1,i=["years","year","y","months","month","M","days","day","d","dates","date","D","hours","hour","h","minutes","minute","m","seconds","second","s","milliseconds","millisecond","ms"],r,a,u=i.length;for(r=0;r<u;r+=1)a=i[r],n=n||bn(t,a);return e&&n}function DD(t){var e=zo(t),n=!1;return e&&(n=t.filter(function(i){return!ws(i)&&A1(t)}).length===0),e&&n}function OD(t){var e=dl(t)&&!Mg(t),n=!1,i=["sameDay","nextDay","lastDay","nextWeek","lastWeek","sameElse"],r,a;for(r=0;r<i.length;r+=1)a=i[r],n=n||bn(t,a);return e&&n}function BD(t,e){var n=t.diff(e,"days",!0);return n<-6?"sameElse":n<-1?"lastWeek":n<0?"lastDay":n<1?"sameDay":n<2?"nextDay":n<7?"nextWeek":"sameElse"}function zD(t,e){arguments.length===1&&(arguments[0]?ID(arguments[0])?(t=arguments[0],e=void 0):OD(arguments[0])&&(e=arguments[0],t=void 0):(t=void 0,e=void 0));var n=t||Gn(),i=ey(n,this).startOf("day"),r=ht.calendarFormat(this,i)||"sameElse",a=e&&(Xo(e[r])?e[r].call(this,n):e[r]);return this.format(a||this.localeData().calendar(r,this,Gn(n)))}function ND(){return new oh(this)}function RD(t,e){var n=No(t)?t:Gn(t);return this.isValid()&&n.isValid()?(e=ho(e)||"millisecond",e==="millisecond"?this.valueOf()>n.valueOf():n.valueOf()<this.clone().startOf(e).valueOf()):!1}function LD(t,e){var n=No(t)?t:Gn(t);return this.isValid()&&n.isValid()?(e=ho(e)||"millisecond",e==="millisecond"?this.valueOf()<n.valueOf():this.clone().endOf(e).valueOf()<n.valueOf()):!1}function VD(t,e,n,i){var r=No(t)?t:Gn(t),a=No(e)?e:Gn(e);return this.isValid()&&r.isValid()&&a.isValid()?(i=i||"()",(i[0]==="("?this.isAfter(r,n):!this.isBefore(r,n))&&(i[1]===")"?this.isBefore(a,n):!this.isAfter(a,n))):!1}function FD(t,e){var n=No(t)?t:Gn(t),i;return this.isValid()&&n.isValid()?(e=ho(e)||"millisecond",e==="millisecond"?this.valueOf()===n.valueOf():(i=n.valueOf(),this.clone().startOf(e).valueOf()<=i&&i<=this.clone().endOf(e).valueOf())):!1}function $D(t,e){return this.isSame(t,e)||this.isAfter(t,e)}function jD(t,e){return this.isSame(t,e)||this.isBefore(t,e)}function UD(t,e,n){var i,r,a;if(!this.isValid())return NaN;if(i=ey(t,this),!i.isValid())return NaN;switch(r=(i.utcOffset()-this.utcOffset())*6e4,e=ho(e),e){case"year":a=Bp(this,i)/12;break;case"month":a=Bp(this,i);break;case"quarter":a=Bp(this,i)/3;break;case"second":a=(this-i)/1e3;break;case"minute":a=(this-i)/6e4;break;case"hour":a=(this-i)/36e5;break;case"day":a=(this-i-r)/864e5;break;case"week":a=(this-i-r)/6048e5;break;default:a=this-i}return n?a:po(a)}function Bp(t,e){if(t.date()<e.date())return-Bp(e,t);var n=(e.year()-t.year())*12+(e.month()-t.month()),i=t.clone().add(n,"months"),r,a;return e-i<0?(r=t.clone().add(n-1,"months"),a=(e-i)/(i-r)):(r=t.clone().add(n+1,"months"),a=(e-i)/(r-i)),-(n+a)||0}ht.defaultFormat="YYYY-MM-DDTHH:mm:ssZ",ht.defaultFormatUtc="YYYY-MM-DDTHH:mm:ss[Z]";function HD(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")}function qD(t){if(!this.isValid())return null;var e=t!==!0,n=e?this.clone().utc():this;return n.year()<0||n.year()>9999?vp(n,e?"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYYYY-MM-DD[T]HH:mm:ss.SSSZ"):Xo(Date.prototype.toISOString)?e?this.toDate().toISOString():new Date(this.valueOf()+this.utcOffset()*60*1e3).toISOString().replace("Z",vp(n,"Z")):vp(n,e?"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYY-MM-DD[T]HH:mm:ss.SSSZ")}function WD(){if(!this.isValid())return"moment.invalid(/* "+this._i+" */)";var t="moment",e="",n,i,r,a;return this.isLocal()||(t=this.utcOffset()===0?"moment.utc":"moment.parseZone",e="Z"),n="["+t+'("]',i=0<=this.year()&&this.year()<=9999?"YYYY":"YYYYYY",r="-MM-DD[T]HH:mm:ss.SSS",a=e+'[")]',this.format(n+i+r+a)}function GD(t){t||(t=this.isUtc()?ht.defaultFormatUtc:ht.defaultFormat);var e=vp(this,t);return this.localeData().postformat(e)}function ZD(t,e){return this.isValid()&&(No(t)&&t.isValid()||Gn(t).isValid())?Lo({to:this,from:t}).locale(this.locale()).humanize(!e):this.localeData().invalidDate()}function YD(t){return this.from(Gn(),t)}function XD(t,e){return this.isValid()&&(No(t)&&t.isValid()||Gn(t).isValid())?Lo({from:this,to:t}).locale(this.locale()).humanize(!e):this.localeData().invalidDate()}function KD(t){return this.to(Gn(),t)}function I1(t){var e;return t===void 0?this._locale._abbr:(e=Ts(t),e!=null&&(this._locale=e),this)}var P1=uo("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(t){return t===void 0?this.localeData():this.locale(t)});function D1(){return this._locale}var zp=1e3,vc=60*zp,Np=60*vc,O1=(365*400+97)*24*Np;function wc(t,e){return(t%e+e)%e}function B1(t,e,n){return t<100&&t>=0?new Date(t+400,e,n)-O1:new Date(t,e,n).valueOf()}function z1(t,e,n){return t<100&&t>=0?Date.UTC(t+400,e,n)-O1:Date.UTC(t,e,n)}function JD(t){var e,n;if(t=ho(t),t===void 0||t==="millisecond"||!this.isValid())return this;switch(n=this._isUTC?z1:B1,t){case"year":e=n(this.year(),0,1);break;case"quarter":e=n(this.year(),this.month()-this.month()%3,1);break;case"month":e=n(this.year(),this.month(),1);break;case"week":e=n(this.year(),this.month(),this.date()-this.weekday());break;case"isoWeek":e=n(this.year(),this.month(),this.date()-(this.isoWeekday()-1));break;case"day":case"date":e=n(this.year(),this.month(),this.date());break;case"hour":e=this._d.valueOf(),e-=wc(e+(this._isUTC?0:this.utcOffset()*vc),Np);break;case"minute":e=this._d.valueOf(),e-=wc(e,vc);break;case"second":e=this._d.valueOf(),e-=wc(e,zp);break}return this._d.setTime(e),ht.updateOffset(this,!0),this}function QD(t){var e,n;if(t=ho(t),t===void 0||t==="millisecond"||!this.isValid())return this;switch(n=this._isUTC?z1:B1,t){case"year":e=n(this.year()+1,0,1)-1;break;case"quarter":e=n(this.year(),this.month()-this.month()%3+3,1)-1;break;case"month":e=n(this.year(),this.month()+1,1)-1;break;case"week":e=n(this.year(),this.month(),this.date()-this.weekday()+7)-1;break;case"isoWeek":e=n(this.year(),this.month(),this.date()-(this.isoWeekday()-1)+7)-1;break;case"day":case"date":e=n(this.year(),this.month(),this.date()+1)-1;break;case"hour":e=this._d.valueOf(),e+=Np-wc(e+(this._isUTC?0:this.utcOffset()*vc),Np)-1;break;case"minute":e=this._d.valueOf(),e+=vc-wc(e,vc)-1;break;case"second":e=this._d.valueOf(),e+=zp-wc(e,zp)-1;break}return this._d.setTime(e),ht.updateOffset(this,!0),this}function eO(){return this._d.valueOf()-(this._offset||0)*6e4}function tO(){return Math.floor(this.valueOf()/1e3)}function nO(){return new Date(this.valueOf())}function iO(){var t=this;return[t.year(),t.month(),t.date(),t.hour(),t.minute(),t.second(),t.millisecond()]}function rO(){var t=this;return{years:t.year(),months:t.month(),date:t.date(),hours:t.hours(),minutes:t.minutes(),seconds:t.seconds(),milliseconds:t.milliseconds()}}function oO(){return this.isValid()?this.toISOString():null}function sO(){return Ig(this)}function aO(){return la({},Yt(this))}function lO(){return Yt(this).overflow}function cO(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}}It("N",0,0,"eraAbbr"),It("NN",0,0,"eraAbbr"),It("NNN",0,0,"eraAbbr"),It("NNNN",0,0,"eraName"),It("NNNNN",0,0,"eraNarrow"),It("y",["y",1],"yo","eraYear"),It("y",["yy",2],0,"eraYear"),It("y",["yyy",3],0,"eraYear"),It("y",["yyyy",4],0,"eraYear"),_t("N",ny),_t("NN",ny),_t("NNN",ny),_t("NNNN",xO),_t("NNNNN",vO),zn(["N","NN","NNN","NNNN","NNNNN"],function(t,e,n,i){var r=n._locale.erasParse(t,i,n._strict);r?Yt(n).era=r:Yt(n).invalidEra=t}),_t("y",yc),_t("yy",yc),_t("yyy",yc),_t("yyyy",yc),_t("yo",wO),zn(["y","yy","yyy","yyyy"],Ki),zn(["yo"],function(t,e,n,i){var r;n._locale._eraYearOrdinalRegex&&(r=t.match(n._locale._eraYearOrdinalRegex)),n._locale.eraYearOrdinalParse?e[Ki]=n._locale.eraYearOrdinalParse(t,r):e[Ki]=parseInt(t,10)});function uO(t,e){var n,i,r,a=this._eras||Ts("en")._eras;for(n=0,i=a.length;n<i;++n){switch(typeof a[n].since){case"string":r=ht(a[n].since).startOf("day"),a[n].since=r.valueOf();break}switch(typeof a[n].until){case"undefined":a[n].until=1/0;break;case"string":r=ht(a[n].until).startOf("day").valueOf(),a[n].until=r.valueOf();break}}return a}function hO(t,e,n){var i,r,a=this.eras(),u,l,g;for(t=t.toUpperCase(),i=0,r=a.length;i<r;++i)if(u=a[i].name.toUpperCase(),l=a[i].abbr.toUpperCase(),g=a[i].narrow.toUpperCase(),n)switch(e){case"N":case"NN":case"NNN":if(l===t)return a[i];break;case"NNNN":if(u===t)return a[i];break;case"NNNNN":if(g===t)return a[i];break}else if([u,l,g].indexOf(t)>=0)return a[i]}function dO(t,e){var n=t.since<=t.until?1:-1;return e===void 0?ht(t.since).year():ht(t.since).year()+(e-t.offset)*n}function pO(){var t,e,n,i=this.localeData().eras();for(t=0,e=i.length;t<e;++t)if(n=this.clone().startOf("day").valueOf(),i[t].since<=n&&n<=i[t].until||i[t].until<=n&&n<=i[t].since)return i[t].name;return""}function fO(){var t,e,n,i=this.localeData().eras();for(t=0,e=i.length;t<e;++t)if(n=this.clone().startOf("day").valueOf(),i[t].since<=n&&n<=i[t].until||i[t].until<=n&&n<=i[t].since)return i[t].narrow;return""}function mO(){var t,e,n,i=this.localeData().eras();for(t=0,e=i.length;t<e;++t)if(n=this.clone().startOf("day").valueOf(),i[t].since<=n&&n<=i[t].until||i[t].until<=n&&n<=i[t].since)return i[t].abbr;return""}function gO(){var t,e,n,i,r=this.localeData().eras();for(t=0,e=r.length;t<e;++t)if(n=r[t].since<=r[t].until?1:-1,i=this.clone().startOf("day").valueOf(),r[t].since<=i&&i<=r[t].until||r[t].until<=i&&i<=r[t].since)return(this.year()-ht(r[t].since).year())*n+r[t].offset;return this.year()}function yO(t){return bn(this,"_erasNameRegex")||iy.call(this),t?this._erasNameRegex:this._erasRegex}function _O(t){return bn(this,"_erasAbbrRegex")||iy.call(this),t?this._erasAbbrRegex:this._erasRegex}function bO(t){return bn(this,"_erasNarrowRegex")||iy.call(this),t?this._erasNarrowRegex:this._erasRegex}function ny(t,e){return e.erasAbbrRegex(t)}function xO(t,e){return e.erasNameRegex(t)}function vO(t,e){return e.erasNarrowRegex(t)}function wO(t,e){return e._eraYearOrdinalRegex||yc}function iy(){var t=[],e=[],n=[],i=[],r,a,u,l,g,b=this.eras();for(r=0,a=b.length;r<a;++r)u=ks(b[r].name),l=ks(b[r].abbr),g=ks(b[r].narrow),e.push(u),t.push(l),n.push(g),i.push(u),i.push(l),i.push(g);this._erasRegex=new RegExp("^("+i.join("|")+")","i"),this._erasNameRegex=new RegExp("^("+e.join("|")+")","i"),this._erasAbbrRegex=new RegExp("^("+t.join("|")+")","i"),this._erasNarrowRegex=new RegExp("^("+n.join("|")+")","i")}It(0,["gg",2],0,function(){return this.weekYear()%100}),It(0,["GG",2],0,function(){return this.isoWeekYear()%100});function Rp(t,e){It(0,[t,t.length],0,e)}Rp("gggg","weekYear"),Rp("ggggg","weekYear"),Rp("GGGG","isoWeekYear"),Rp("GGGGG","isoWeekYear"),_t("G",Ep),_t("g",Ep),_t("GG",Wn,Wr),_t("gg",Wn,Wr),_t("GGGG",Fg,Vg),_t("gggg",Fg,Vg),_t("GGGGG",Sp,wp),_t("ggggg",Sp,wp),ah(["gggg","ggggg","GGGG","GGGGG"],function(t,e,n,i){e[i.substr(0,2)]=cn(t)}),ah(["gg","GG"],function(t,e,n,i){e[i]=ht.parseTwoDigitYear(t)});function kO(t){return N1.call(this,t,this.week(),this.weekday()+this.localeData()._week.dow,this.localeData()._week.dow,this.localeData()._week.doy)}function SO(t){return N1.call(this,t,this.isoWeek(),this.isoWeekday(),1,4)}function EO(){return Cs(this.year(),1,4)}function CO(){return Cs(this.isoWeekYear(),1,4)}function TO(){var t=this.localeData()._week;return Cs(this.year(),t.dow,t.doy)}function MO(){var t=this.localeData()._week;return Cs(this.weekYear(),t.dow,t.doy)}function N1(t,e,n,i,r){var a;return t==null?hh(this,i,r).year:(a=Cs(t,i,r),e>a&&(e=a),AO.call(this,t,e,n,i,r))}function AO(t,e,n,i,r){var a=p1(t,e,n,i,r),u=uh(a.year,0,a.dayOfYear);return this.year(u.getUTCFullYear()),this.month(u.getUTCMonth()),this.date(u.getUTCDate()),this}It("Q",0,"Qo","quarter"),_t("Q",n1),zn("Q",function(t,e){e[Ss]=(cn(t)-1)*3});function IO(t){return t==null?Math.ceil((this.month()+1)/3):this.month((t-1)*3+this.month()%3)}It("D",["DD",2],"Do","date"),_t("D",Wn,_c),_t("DD",Wn,Wr),_t("Do",function(t,e){return t?e._dayOfMonthOrdinalParse||e._ordinalParse:e._dayOfMonthOrdinalParseLenient}),zn(["D","DD"],Jo),zn("Do",function(t,e){e[Jo]=cn(t.match(Wn)[0])});var R1=bc("Date",!0);It("DDD",["DDDD",3],"DDDo","dayOfYear"),_t("DDD",kp),_t("DDDD",i1),zn(["DDD","DDDD"],function(t,e,n){n._dayOfYear=cn(t)});function PO(t){var e=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return t==null?e:this.add(t-e,"d")}It("m",["mm",2],0,"minute"),_t("m",Wn,$g),_t("mm",Wn,Wr),zn(["m","mm"],Ro);var DO=bc("Minutes",!1);It("s",["ss",2],0,"second"),_t("s",Wn,$g),_t("ss",Wn,Wr),zn(["s","ss"],Es);var OO=bc("Seconds",!1);It("S",0,0,function(){return~~(this.millisecond()/100)}),It(0,["SS",2],0,function(){return~~(this.millisecond()/10)}),It(0,["SSS",3],0,"millisecond"),It(0,["SSSS",4],0,function(){return this.millisecond()*10}),It(0,["SSSSS",5],0,function(){return this.millisecond()*100}),It(0,["SSSSSS",6],0,function(){return this.millisecond()*1e3}),It(0,["SSSSSSS",7],0,function(){return this.millisecond()*1e4}),It(0,["SSSSSSSS",8],0,function(){return this.millisecond()*1e5}),It(0,["SSSSSSSSS",9],0,function(){return this.millisecond()*1e6}),_t("S",kp,n1),_t("SS",kp,Wr),_t("SSS",kp,i1);var ua,L1;for(ua="SSSS";ua.length<=9;ua+="S")_t(ua,yc);function BO(t,e){e[pl]=cn(("0."+t)*1e3)}for(ua="S";ua.length<=9;ua+="S")zn(ua,BO);L1=bc("Milliseconds",!1),It("z",0,0,"zoneAbbr"),It("zz",0,0,"zoneName");function zO(){return this._isUTC?"UTC":""}function NO(){return this._isUTC?"Coordinated Universal Time":""}var qe=oh.prototype;qe.add=MD,qe.calendar=zD,qe.clone=ND,qe.diff=UD,qe.endOf=QD,qe.format=GD,qe.from=ZD,qe.fromNow=YD,qe.to=XD,qe.toNow=KD,qe.get=WI,qe.invalidAt=lO,qe.isAfter=RD,qe.isBefore=LD,qe.isBetween=VD,qe.isSame=FD,qe.isSameOrAfter=$D,qe.isSameOrBefore=jD,qe.isValid=sO,qe.lang=P1,qe.locale=I1,qe.localeData=D1,qe.max=sD,qe.min=oD,qe.parsingFlags=aO,qe.set=GI,qe.startOf=JD,qe.subtract=AD,qe.toArray=iO,qe.toObject=rO,qe.toDate=nO,qe.toISOString=qD,qe.inspect=WD,typeof Symbol<"u"&&Symbol.for!=null&&(qe[Symbol.for("nodejs.util.inspect.custom")]=function(){return"Moment<"+this.format()+">"}),qe.toJSON=oO,qe.toString=HD,qe.unix=tO,qe.valueOf=eO,qe.creationData=cO,qe.eraName=pO,qe.eraNarrow=fO,qe.eraAbbr=mO,qe.eraYear=gO,qe.year=s1,qe.isLeapYear=qI,qe.weekYear=kO,qe.isoWeekYear=SO,qe.quarter=qe.quarters=IO,qe.month=h1,qe.daysInMonth=nP,qe.week=qe.weeks=uP,qe.isoWeek=qe.isoWeeks=hP,qe.weeksInYear=TO,qe.weeksInWeekYear=MO,qe.isoWeeksInYear=EO,qe.isoWeeksInISOWeekYear=CO,qe.date=R1,qe.day=qe.days=SP,qe.weekday=EP,qe.isoWeekday=CP,qe.dayOfYear=PO,qe.hour=qe.hours=OP,qe.minute=qe.minutes=DO,qe.second=qe.seconds=OO,qe.millisecond=qe.milliseconds=L1,qe.utcOffset=mD,qe.utc=yD,qe.local=_D,qe.parseZone=bD,qe.hasAlignedHourOffset=xD,qe.isDST=vD,qe.isLocal=kD,qe.isUtcOffset=SD,qe.isUtc=E1,qe.isUTC=E1,qe.zoneAbbr=zO,qe.zoneName=NO,qe.dates=uo("dates accessor is deprecated. Use date instead.",R1),qe.months=uo("months accessor is deprecated. Use month instead",h1),qe.years=uo("years accessor is deprecated. Use year instead",s1),qe.zone=uo("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",gD),qe.isDSTShifted=uo("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",wD);function RO(t){return Gn(t*1e3)}function LO(){return Gn.apply(null,arguments).parseZone()}function V1(t){return t}var xn=Bg.prototype;xn.calendar=kI,xn.longDateFormat=TI,xn.invalidDate=AI,xn.ordinal=DI,xn.preparse=V1,xn.postformat=V1,xn.relativeTime=BI,xn.pastFuture=zI,xn.set=vI,xn.eras=uO,xn.erasParse=hO,xn.erasConvertYear=dO,xn.erasAbbrRegex=_O,xn.erasNameRegex=yO,xn.erasNarrowRegex=bO,xn.months=JI,xn.monthsShort=QI,xn.monthsParse=tP,xn.monthsRegex=rP,xn.monthsShortRegex=iP,xn.week=sP,xn.firstDayOfYear=cP,xn.firstDayOfWeek=lP,xn.weekdays=bP,xn.weekdaysMin=vP,xn.weekdaysShort=xP,xn.weekdaysParse=kP,xn.weekdaysRegex=TP,xn.weekdaysShortRegex=MP,xn.weekdaysMinRegex=AP,xn.isPM=PP,xn.meridiem=BP;function Lp(t,e,n,i){var r=Ts(),a=Yo().set(i,e);return r[n](a,t)}function F1(t,e,n){if(ws(t)&&(e=t,t=void 0),t=t||"",e!=null)return Lp(t,e,n,"month");var i,r=[];for(i=0;i<12;i++)r[i]=Lp(t,i,n,"month");return r}function ry(t,e,n,i){typeof t=="boolean"?(ws(e)&&(n=e,e=void 0),e=e||""):(e=t,n=e,t=!1,ws(e)&&(n=e,e=void 0),e=e||"");var r=Ts(),a=t?r._week.dow:0,u,l=[];if(n!=null)return Lp(e,(n+a)%7,i,"day");for(u=0;u<7;u++)l[u]=Lp(e,(u+a)%7,i,"day");return l}function VO(t,e){return F1(t,e,"months")}function FO(t,e){return F1(t,e,"monthsShort")}function $O(t,e,n){return ry(t,e,n,"weekdays")}function jO(t,e,n){return ry(t,e,n,"weekdaysShort")}function UO(t,e,n){return ry(t,e,n,"weekdaysMin")}ca("en",{eras:[{since:"0001-01-01",until:1/0,offset:1,name:"Anno Domini",narrow:"AD",abbr:"AD"},{since:"0000-12-31",until:-1/0,offset:1,name:"Before Christ",narrow:"BC",abbr:"BC"}],dayOfMonthOrdinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(t){var e=t%10,n=cn(t%100/10)===1?"th":e===1?"st":e===2?"nd":e===3?"rd":"th";return t+n}}),ht.lang=uo("moment.lang is deprecated. Use moment.locale instead.",ca),ht.langData=uo("moment.langData is deprecated. Use moment.localeData instead.",Ts);var Ms=Math.abs;function HO(){var t=this._data;return this._milliseconds=Ms(this._milliseconds),this._days=Ms(this._days),this._months=Ms(this._months),t.milliseconds=Ms(t.milliseconds),t.seconds=Ms(t.seconds),t.minutes=Ms(t.minutes),t.hours=Ms(t.hours),t.months=Ms(t.months),t.years=Ms(t.years),this}function $1(t,e,n,i){var r=Lo(e,n);return t._milliseconds+=i*r._milliseconds,t._days+=i*r._days,t._months+=i*r._months,t._bubble()}function qO(t,e){return $1(this,t,e,1)}function WO(t,e){return $1(this,t,e,-1)}function j1(t){return t<0?Math.floor(t):Math.ceil(t)}function GO(){var t=this._milliseconds,e=this._days,n=this._months,i=this._data,r,a,u,l,g;return t>=0&&e>=0&&n>=0||t<=0&&e<=0&&n<=0||(t+=j1(oy(n)+e)*864e5,e=0,n=0),i.milliseconds=t%1e3,r=po(t/1e3),i.seconds=r%60,a=po(r/60),i.minutes=a%60,u=po(a/60),i.hours=u%24,e+=po(u/24),g=po(U1(e)),n+=g,e-=j1(oy(g)),l=po(n/12),n%=12,i.days=e,i.months=n,i.years=l,this}function U1(t){return t*4800/146097}function oy(t){return t*146097/4800}function ZO(t){if(!this.isValid())return NaN;var e,n,i=this._milliseconds;if(t=ho(t),t==="month"||t==="quarter"||t==="year")switch(e=this._days+i/864e5,n=this._months+U1(e),t){case"month":return n;case"quarter":return n/3;case"year":return n/12}else switch(e=this._days+Math.round(oy(this._months)),t){case"week":return e/7+i/6048e5;case"day":return e+i/864e5;case"hour":return e*24+i/36e5;case"minute":return e*1440+i/6e4;case"second":return e*86400+i/1e3;case"millisecond":return Math.floor(e*864e5)+i;default:throw new Error("Unknown unit "+t)}}function As(t){return function(){return this.as(t)}}var H1=As("ms"),YO=As("s"),XO=As("m"),KO=As("h"),JO=As("d"),QO=As("w"),eB=As("M"),tB=As("Q"),nB=As("y"),iB=H1;function rB(){return Lo(this)}function oB(t){return t=ho(t),this.isValid()?this[t+"s"]():NaN}function ml(t){return function(){return this.isValid()?this._data[t]:NaN}}var sB=ml("milliseconds"),aB=ml("seconds"),lB=ml("minutes"),cB=ml("hours"),uB=ml("days"),hB=ml("months"),dB=ml("years");function pB(){return po(this.days()/7)}var Is=Math.round,kc={ss:44,s:45,m:45,h:22,d:26,w:null,M:11};function fB(t,e,n,i,r){return r.relativeTime(e||1,!!n,t,i)}function mB(t,e,n,i){var r=Lo(t).abs(),a=Is(r.as("s")),u=Is(r.as("m")),l=Is(r.as("h")),g=Is(r.as("d")),b=Is(r.as("M")),w=Is(r.as("w")),E=Is(r.as("y")),C=a<=n.ss&&["s",a]||a<n.s&&["ss",a]||u<=1&&["m"]||u<n.m&&["mm",u]||l<=1&&["h"]||l<n.h&&["hh",l]||g<=1&&["d"]||g<n.d&&["dd",g];return n.w!=null&&(C=C||w<=1&&["w"]||w<n.w&&["ww",w]),C=C||b<=1&&["M"]||b<n.M&&["MM",b]||E<=1&&["y"]||["yy",E],C[2]=e,C[3]=+t>0,C[4]=i,fB.apply(null,C)}function gB(t){return t===void 0?Is:typeof t=="function"?(Is=t,!0):!1}function yB(t,e){return kc[t]===void 0?!1:e===void 0?kc[t]:(kc[t]=e,t==="s"&&(kc.ss=e-1),!0)}function _B(t,e){if(!this.isValid())return this.localeData().invalidDate();var n=!1,i=kc,r,a;return typeof t=="object"&&(e=t,t=!1),typeof t=="boolean"&&(n=t),typeof e=="object"&&(i=Object.assign({},kc,e),e.s!=null&&e.ss==null&&(i.ss=e.s-1)),r=this.localeData(),a=mB(this,!n,i,r),n&&(a=r.pastFuture(+this,a)),r.postformat(a)}var sy=Math.abs;function Sc(t){return(t>0)-(t<0)||+t}function Vp(){if(!this.isValid())return this.localeData().invalidDate();var t=sy(this._milliseconds)/1e3,e=sy(this._days),n=sy(this._months),i,r,a,u,l=this.asSeconds(),g,b,w,E;return l?(i=po(t/60),r=po(i/60),t%=60,i%=60,a=po(n/12),n%=12,u=t?t.toFixed(3).replace(/\.?0+$/,""):"",g=l<0?"-":"",b=Sc(this._months)!==Sc(l)?"-":"",w=Sc(this._days)!==Sc(l)?"-":"",E=Sc(this._milliseconds)!==Sc(l)?"-":"",g+"P"+(a?b+a+"Y":"")+(n?b+n+"M":"")+(e?w+e+"D":"")+(r||i||t?"T":"")+(r?E+r+"H":"")+(i?E+i+"M":"")+(t?E+u+"S":"")):"P0D"}var mn=Dp.prototype;mn.isValid=hD,mn.abs=HO,mn.add=qO,mn.subtract=WO,mn.as=ZO,mn.asMilliseconds=H1,mn.asSeconds=YO,mn.asMinutes=XO,mn.asHours=KO,mn.asDays=JO,mn.asWeeks=QO,mn.asMonths=eB,mn.asQuarters=tB,mn.asYears=nB,mn.valueOf=iB,mn._bubble=GO,mn.clone=rB,mn.get=oB,mn.milliseconds=sB,mn.seconds=aB,mn.minutes=lB,mn.hours=cB,mn.days=uB,mn.weeks=pB,mn.months=hB,mn.years=dB,mn.humanize=_B,mn.toISOString=Vp,mn.toString=Vp,mn.toJSON=Vp,mn.locale=I1,mn.localeData=D1,mn.toIsoString=uo("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",Vp),mn.lang=P1,It("X",0,0,"unix"),It("x",0,0,"valueOf"),_t("x",Ep),_t("X",VI),zn("X",function(t,e,n){n._d=new Date(parseFloat(t)*1e3)}),zn("x",function(t,e,n){n._d=new Date(cn(t))});//! moment.js
45
45
  ht.version="2.30.1",bI(Gn),ht.fn=qe,ht.min=aD,ht.max=lD,ht.now=cD,ht.utc=Yo,ht.unix=RO,ht.months=VO,ht.isDate=rh,ht.locale=ca,ht.invalid=bp,ht.duration=Lo,ht.isMoment=No,ht.weekdays=$O,ht.parseZone=LO,ht.localeData=Ts,ht.isDuration=Op,ht.monthsShort=FO,ht.weekdaysMin=UO,ht.defineLocale=Gg,ht.updateLocale=LP,ht.locales=VP,ht.weekdaysShort=jO,ht.normalizeUnits=ho,ht.relativeTimeRounding=gB,ht.relativeTimeThreshold=yB,ht.calendarFormat=BD,ht.prototype=qe,ht.HTML5_FMT={DATETIME_LOCAL:"YYYY-MM-DDTHH:mm",DATETIME_LOCAL_SECONDS:"YYYY-MM-DDTHH:mm:ss",DATETIME_LOCAL_MS:"YYYY-MM-DDTHH:mm:ss.SSS",DATE:"YYYY-MM-DD",TIME:"HH:mm",TIME_SECONDS:"HH:mm:ss",TIME_MS:"HH:mm:ss.SSS",WEEK:"GGGG-[W]WW",MONTH:"YYYY-MM"};const bB={props:{data:Object,name:String,table:String,edit:{type:null,default:()=>!1},value:null,column:Object},computed:{dateValue(){var t;if(!((t=this.data)!=null&&t[this.name]))return"-";try{const e=ht(this.data[this.name],"YYYY-MM-DD");return new Date(e).toLocaleDateString("uk-UA",{day:"2-digit",month:"long",year:"numeric"})}catch{return this.value}}},methods:{async changeData(t){var e,n;try{const i=await it.get(`/api/table/${this.table}/${(e=this.data)==null?void 0:e.id}`);await it.put(`/api/table/${(n=i==null?void 0:i.data)==null?void 0:n.token}`,{...i==null?void 0:i.data,[this.name]:t}),await this.$emit("update-table")}catch(i){console.log(i)}}}},xB={class:"underline whitespace-nowrap decoration-dashed"},vB={key:1,class:"whitespace-nowrap"};function wB(t,e,n,i,r,a){var l;const u=f.resolveComponent("VsInlineEdit");return n.edit?(f.openBlock(),f.createBlock(u,{key:0,"model-value":((l=n.data)==null?void 0:l[n.name])||null,component:"vs-datepicker",onUpdateValue:a.changeData},{default:f.withCtx(()=>[f.createElementVNode("div",xB,f.toDisplayString(a.dateValue),1)]),_:1},8,["model-value","onUpdateValue"])):(f.openBlock(),f.createElementBlock("div",vB,f.toDisplayString(a.dateValue),1))}const ay=je(bB,[["render",wB]]),kB=f.defineComponent({name:"VsNumberValue",props:{data:{type:Object},name:String},computed:{formattedValue(){try{return new Intl.NumberFormat("ua",{notation:"compact"}).format(this.data[this.name])}catch(t){return console.error("Formatting error:",t.message),this.value}}}}),SB={class:"block w-full pr-[10px] text-left"};function EB(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("span",SB,f.toDisplayString(t.formattedValue),1)}const q1=je(kB,[["render",EB]]),CB={class:"text-start"},W1={__name:"vs-format-slot",props:{column:Object,data:Object,table:String,data:Object,name:String,value:null},setup(t){var i,r,a,u,l;const{asyncTemplateSlot:e}=(l=(u=(a=(r=(i=f.getCurrentInstance())==null?void 0:i.appContext)==null?void 0:r.app)==null?void 0:a.config)==null?void 0:u.globalProperties)==null?void 0:l.utils,n=["data","column","table","name","value"];return e(t.name,t.column.slot.content,n),(g,b)=>(f.openBlock(),f.createElementBlock("div",CB,[(f.openBlock(),f.createBlock(f.resolveDynamicComponent(t.name),{column:t.column,table:t.table,name:t.name,data:t.data,value:t.value},null,8,["column","table","name","data","value"]))]))}},TB={"table-format-text":yp,"table-format-select":Wx,"table-format-badge":Hx,"table-format-swetch":_p,"table-format-check":_p,"table-format-html":yp,"table-format-tags":Gx,"table-format-date":ay,"table-format-number":q1,"table-format-slot":W1};function G1(t,e,n){if(t!==null)for(var i,r,a,u,l,g,b,w=0,E=0,C,P=t.type,D=P==="FeatureCollection",R=P==="Feature",$=D?t.features.length:1,W=0;W<$;W++){b=D?t.features[W].geometry:R?t.geometry:t,C=b?b.type==="GeometryCollection":!1,l=C?b.geometries.length:1;for(var te=0;te<l;te++){var G=0,Q=0;if(u=C?b.geometries[te]:b,u!==null){g=u.coordinates;var Ie=u.type;switch(w=0,Ie){case null:break;case"Point":if(e(g,E,W,G,Q)===!1)return!1;E++,G++;break;case"LineString":case"MultiPoint":for(i=0;i<g.length;i++){if(e(g[i],E,W,G,Q)===!1)return!1;E++,Ie==="MultiPoint"&&G++}Ie==="LineString"&&G++;break;case"Polygon":case"MultiLineString":for(i=0;i<g.length;i++){for(r=0;r<g[i].length-w;r++){if(e(g[i][r],E,W,G,Q)===!1)return!1;E++}Ie==="MultiLineString"&&G++,Ie==="Polygon"&&Q++}Ie==="Polygon"&&G++;break;case"MultiPolygon":for(i=0;i<g.length;i++){for(Q=0,r=0;r<g[i].length;r++){for(a=0;a<g[i][r].length-w;a++){if(e(g[i][r][a],E,W,G,Q)===!1)return!1;E++}Q++}G++}break;case"GeometryCollection":for(i=0;i<u.geometries.length;i++)if(G1(u.geometries[i],e)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function MB(t,e={}){if(t.bbox!=null&&e.recompute!==!0)return t.bbox;const n=[1/0,1/0,-1/0,-1/0];return G1(t,i=>{n[0]>i[0]&&(n[0]=i[0]),n[1]>i[1]&&(n[1]=i[1]),n[2]<i[0]&&(n[2]=i[0]),n[3]<i[1]&&(n[3]=i[1])}),n}var AB=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function IB(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function PB(t,e,n={}){const i={type:"Feature"};return(n.id===0||n.id)&&(i.id=n.id),n.bbox&&(i.bbox=n.bbox),i.properties={},i.geometry=t,i}function Z1(t,e={}){const n={type:"FeatureCollection"};return e.id&&(n.id=e.id),e.bbox&&(n.bbox=e.bbox),n.features=t,n}var Y1={exports:{}};/**
46
46
  * MapLibre GL JS
47
- * @license 3-Clause BSD. Full text of license: https://github.com/maplibre/maplibre-gl-js/blob/v4.7.1/LICENSE.txt
47
+ * @license 3-Clause BSD. Full text of license: https://github.com/maplibre/maplibre-gl-js/blob/v4.7.0/LICENSE.txt
48
48
  */(function(t,e){(function(n,i){t.exports=i()})(AB,function(){var n={},i={};function r(u,l,g){if(i[u]=g,u==="index"){var b="var sharedModule = {}; ("+i.shared+")(sharedModule); ("+i.worker+")(sharedModule);",w={};return i.shared(w),i.index(n,w),typeof window<"u"&&n.setWorkerUrl(window.URL.createObjectURL(new Blob([b],{type:"text/javascript"}))),n}}r("shared",["exports"],function(u){function l(c,s,h,p){return new(h||(h=Promise))(function(_,k){function S(B){try{A(p.next(B))}catch(z){k(z)}}function T(B){try{A(p.throw(B))}catch(z){k(z)}}function A(B){var z;B.done?_(B.value):(z=B.value,z instanceof h?z:new h(function(L){L(z)})).then(S,T)}A((p=p.apply(c,s||[])).next())})}function g(c){return c&&c.__esModule&&Object.prototype.hasOwnProperty.call(c,"default")?c.default:c}typeof SuppressedError=="function"&&SuppressedError;var b=w;function w(c,s){this.x=c,this.y=s}w.prototype={clone:function(){return new w(this.x,this.y)},add:function(c){return this.clone()._add(c)},sub:function(c){return this.clone()._sub(c)},multByPoint:function(c){return this.clone()._multByPoint(c)},divByPoint:function(c){return this.clone()._divByPoint(c)},mult:function(c){return this.clone()._mult(c)},div:function(c){return this.clone()._div(c)},rotate:function(c){return this.clone()._rotate(c)},rotateAround:function(c,s){return this.clone()._rotateAround(c,s)},matMult:function(c){return this.clone()._matMult(c)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(c){return this.x===c.x&&this.y===c.y},dist:function(c){return Math.sqrt(this.distSqr(c))},distSqr:function(c){var s=c.x-this.x,h=c.y-this.y;return s*s+h*h},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(c){return Math.atan2(this.y-c.y,this.x-c.x)},angleWith:function(c){return this.angleWithSep(c.x,c.y)},angleWithSep:function(c,s){return Math.atan2(this.x*s-this.y*c,this.x*c+this.y*s)},_matMult:function(c){var s=c[2]*this.x+c[3]*this.y;return this.x=c[0]*this.x+c[1]*this.y,this.y=s,this},_add:function(c){return this.x+=c.x,this.y+=c.y,this},_sub:function(c){return this.x-=c.x,this.y-=c.y,this},_mult:function(c){return this.x*=c,this.y*=c,this},_div:function(c){return this.x/=c,this.y/=c,this},_multByPoint:function(c){return this.x*=c.x,this.y*=c.y,this},_divByPoint:function(c){return this.x/=c.x,this.y/=c.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var c=this.y;return this.y=this.x,this.x=-c,this},_rotate:function(c){var s=Math.cos(c),h=Math.sin(c),p=h*this.x+s*this.y;return this.x=s*this.x-h*this.y,this.y=p,this},_rotateAround:function(c,s){var h=Math.cos(c),p=Math.sin(c),_=s.y+p*(this.x-s.x)+h*(this.y-s.y);return this.x=s.x+h*(this.x-s.x)-p*(this.y-s.y),this.y=_,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},w.convert=function(c){return c instanceof w?c:Array.isArray(c)?new w(c[0],c[1]):c};var E=g(b),C=P;function P(c,s,h,p){this.cx=3*c,this.bx=3*(h-c)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*s,this.by=3*(p-s)-this.cy,this.ay=1-this.cy-this.by,this.p1x=c,this.p1y=s,this.p2x=h,this.p2y=p}P.prototype={sampleCurveX:function(c){return((this.ax*c+this.bx)*c+this.cx)*c},sampleCurveY:function(c){return((this.ay*c+this.by)*c+this.cy)*c},sampleCurveDerivativeX:function(c){return(3*this.ax*c+2*this.bx)*c+this.cx},solveCurveX:function(c,s){if(s===void 0&&(s=1e-6),c<0)return 0;if(c>1)return 1;for(var h=c,p=0;p<8;p++){var _=this.sampleCurveX(h)-c;if(Math.abs(_)<s)return h;var k=this.sampleCurveDerivativeX(h);if(Math.abs(k)<1e-6)break;h-=_/k}var S=0,T=1;for(h=c,p=0;p<20&&(_=this.sampleCurveX(h),!(Math.abs(_-c)<s));p++)c>_?S=h:T=h,h=.5*(T-S)+S;return h},solve:function(c,s){return this.sampleCurveY(this.solveCurveX(c,s))}};var D=g(C);let R,$;function W(){return R==null&&(R=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),R}function te(){if($==null&&($=!1,W())){const s=new OffscreenCanvas(5,5).getContext("2d",{willReadFrequently:!0});if(s){for(let p=0;p<5*5;p++){const _=4*p;s.fillStyle=`rgb(${_},${_+1},${_+2})`,s.fillRect(p%5,Math.floor(p/5),1,1)}const h=s.getImageData(0,0,5,5).data;for(let p=0;p<5*5*4;p++)if(p%4!=3&&h[p]!==p){$=!0;break}}}return $||!1}function G(c,s,h,p){const _=new D(c,s,h,p);return k=>_.solve(k)}const Q=G(.25,.1,.25,1);function Ie(c,s,h){return Math.min(h,Math.max(s,c))}function ve(c,s,h){const p=h-s,_=((c-s)%p+p)%p+s;return _===s?h:_}function Se(c,...s){for(const h of s)for(const p in h)c[p]=h[p];return c}let Ne=1;function Ae(c,s,h){const p={};for(const _ in c)p[_]=s.call(this,c[_],_,c);return p}function $e(c,s,h){const p={};for(const _ in c)s.call(this,c[_],_,c)&&(p[_]=c[_]);return p}function Xe(c){return Array.isArray(c)?c.map(Xe):typeof c=="object"&&c?Ae(c,Xe):c}const Pt={};function ot(c){Pt[c]||(typeof console<"u"&&console.warn(c),Pt[c]=!0)}function Tt(c,s,h){return(h.y-c.y)*(s.x-c.x)>(s.y-c.y)*(h.x-c.x)}function Nt(c){return typeof WorkerGlobalScope<"u"&&c!==void 0&&c instanceof WorkerGlobalScope}let Vt=null;function Ft(c){return typeof ImageBitmap<"u"&&c instanceof ImageBitmap}const Ht="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";function Cn(c,s,h,p,_){return l(this,void 0,void 0,function*(){if(typeof VideoFrame>"u")throw new Error("VideoFrame not supported");const k=new VideoFrame(c,{timestamp:0});try{const S=k==null?void 0:k.format;if(!S||!S.startsWith("BGR")&&!S.startsWith("RGB"))throw new Error(`Unrecognized format ${S}`);const T=S.startsWith("BGR"),A=new Uint8ClampedArray(p*_*4);if(yield k.copyTo(A,function(B,z,L,j,q){const Y=4*Math.max(-z,0),K=(Math.max(0,L)-L)*j*4+Y,re=4*j,ae=Math.max(0,z),be=Math.max(0,L);return{rect:{x:ae,y:be,width:Math.min(B.width,z+j)-ae,height:Math.min(B.height,L+q)-be},layout:[{offset:K,stride:re}]}}(c,s,h,p,_)),T)for(let B=0;B<A.length;B+=4){const z=A[B];A[B]=A[B+2],A[B+2]=z}return A}finally{k.close()}})}let dn,vn;const pn="AbortError";function ti(){return new Error(pn)}const Nn={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};function Pn(c){return Nn.REGISTERED_PROTOCOLS[c.substring(0,c.indexOf("://"))]}const Rn="global-dispatcher";class Ce extends Error{constructor(s,h,p,_){super(`AJAXError: ${h} (${s}): ${p}`),this.status=s,this.statusText=h,this.url=p,this.body=_}}const He=()=>Nt(self)?self.worker&&self.worker.referrer:(window.location.protocol==="blob:"?window.parent:window).location.href,De=function(c,s){if(/:\/\//.test(c.url)&&!/^https?:|^file:/.test(c.url)){const p=Pn(c.url);if(p)return p(c,s);if(Nt(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:c,targetMapId:Rn},s)}if(!(/^file:/.test(h=c.url)||/^file:/.test(He())&&!/^\w+:/.test(h))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return function(p,_){return l(this,void 0,void 0,function*(){const k=new Request(p.url,{method:p.method||"GET",body:p.body,credentials:p.credentials,headers:p.headers,cache:p.cache,referrer:He(),signal:_.signal});p.type!=="json"||k.headers.has("Accept")||k.headers.set("Accept","application/json");const S=yield fetch(k);if(!S.ok){const B=yield S.blob();throw new Ce(S.status,S.statusText,p.url,B)}let T;T=p.type==="arrayBuffer"||p.type==="image"?S.arrayBuffer():p.type==="json"?S.json():S.text();const A=yield T;if(_.signal.aborted)throw ti();return{data:A,cacheControl:S.headers.get("Cache-Control"),expires:S.headers.get("Expires")}})}(c,s);if(Nt(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:c,mustQueue:!0,targetMapId:Rn},s)}var h;return function(p,_){return new Promise((k,S)=>{var T;const A=new XMLHttpRequest;A.open(p.method||"GET",p.url,!0),p.type!=="arrayBuffer"&&p.type!=="image"||(A.responseType="arraybuffer");for(const B in p.headers)A.setRequestHeader(B,p.headers[B]);p.type==="json"&&(A.responseType="text",!((T=p.headers)===null||T===void 0)&&T.Accept||A.setRequestHeader("Accept","application/json")),A.withCredentials=p.credentials==="include",A.onerror=()=>{S(new Error(A.statusText))},A.onload=()=>{if(!_.signal.aborted)if((A.status>=200&&A.status<300||A.status===0)&&A.response!==null){let B=A.response;if(p.type==="json")try{B=JSON.parse(A.response)}catch(z){return void S(z)}k({data:B,cacheControl:A.getResponseHeader("Cache-Control"),expires:A.getResponseHeader("Expires")})}else{const B=new Blob([A.response],{type:A.getResponseHeader("Content-Type")});S(new Ce(A.status,A.statusText,p.url,B))}},_.signal.addEventListener("abort",()=>{A.abort(),S(ti())}),A.send(p.body)})}(c,s)};function ct(c){if(!c||c.indexOf("://")<=0||c.indexOf("data:image/")===0||c.indexOf("blob:")===0)return!0;const s=new URL(c),h=window.location;return s.protocol===h.protocol&&s.host===h.host}function Rt(c,s,h){h[c]&&h[c].indexOf(s)!==-1||(h[c]=h[c]||[],h[c].push(s))}function Qt(c,s,h){if(h&&h[c]){const p=h[c].indexOf(s);p!==-1&&h[c].splice(p,1)}}class At{constructor(s,h={}){Se(this,h),this.type=s}}class Mt extends At{constructor(s,h={}){super("error",Se({error:s},h))}}class rn{on(s,h){return this._listeners=this._listeners||{},Rt(s,h,this._listeners),this}off(s,h){return Qt(s,h,this._listeners),Qt(s,h,this._oneTimeListeners),this}once(s,h){return h?(this._oneTimeListeners=this._oneTimeListeners||{},Rt(s,h,this._oneTimeListeners),this):new Promise(p=>this.once(s,p))}fire(s,h){typeof s=="string"&&(s=new At(s,h||{}));const p=s.type;if(this.listens(p)){s.target=this;const _=this._listeners&&this._listeners[p]?this._listeners[p].slice():[];for(const T of _)T.call(this,s);const k=this._oneTimeListeners&&this._oneTimeListeners[p]?this._oneTimeListeners[p].slice():[];for(const T of k)Qt(p,T,this._oneTimeListeners),T.call(this,s);const S=this._eventedParent;S&&(Se(s,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),S.fire(s))}else s instanceof Mt&&console.error(s.error);return this}listens(s){return this._listeners&&this._listeners[s]&&this._listeners[s].length>0||this._oneTimeListeners&&this._oneTimeListeners[s]&&this._oneTimeListeners[s].length>0||this._eventedParent&&this._eventedParent.listens(s)}setEventedParent(s,h){return this._eventedParent=s,this._eventedParentData=h,this}}var we={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},light:{type:"light"},sky:{type:"sky"},projection:{type:"projection"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},glyphs:{type:"string"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},sources:{"*":{type:"source"}},source:["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],source_vector:{type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster:{type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster_dem:{type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{},custom:{}},default:"mapbox"},redFactor:{type:"number",default:1},blueFactor:{type:"number",default:1},greenFactor:{type:"number",default:1},baseShift:{type:"number",default:0},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{required:!0,type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"*"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},source_video:{type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},source_image:{type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},layer:{id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},layout:["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_fill:{"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_circle:{"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_symbol:{"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image",{"!":"icon-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"padding",default:[2],units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},"viewport-glyph":{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-variable-anchor-offset":{type:"variableAnchorOffsetCollection",requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field",{"!":"text-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},filter:{type:"array",value:"*"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:{type:"array",minimum:0,maximum:24,value:["number","color"],length:2},expression:{type:"array",value:"*",minimum:1},light:{anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},sky:{"sky-color":{type:"color","property-type":"data-constant",default:"#88C6FC",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-ground-blend":{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-fog-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"sky-horizon-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"atmosphere-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},terrain:{source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},projection:{type:{type:"enum",default:"mercator",values:{mercator:{},globe:{}}}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_background"],paint_fill:{"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:{"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},paint_circle:{"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},paint_heatmap:{"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_symbol:{"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,overridable:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_raster:{"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_hillshade:{"hillshade-illumination-direction":{type:"number",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"color",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_background:{"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},transition:{duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},"property-type":{"data-driven":{type:"property-type"},"cross-faded":{type:"property-type"},"cross-faded-data-driven":{type:"property-type"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}},promoteId:{"*":{type:"string"}}};const yn=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function pr(c,s){const h={};for(const p in c)p!=="ref"&&(h[p]=c[p]);return yn.forEach(p=>{p in s&&(h[p]=s[p])}),h}function qt(c,s){if(Array.isArray(c)){if(!Array.isArray(s)||c.length!==s.length)return!1;for(let h=0;h<c.length;h++)if(!qt(c[h],s[h]))return!1;return!0}if(typeof c=="object"&&c!==null&&s!==null){if(typeof s!="object"||Object.keys(c).length!==Object.keys(s).length)return!1;for(const h in c)if(!qt(c[h],s[h]))return!1;return!0}return c===s}function sn(c,s){c.push(s)}function ui(c,s,h){sn(h,{command:"addSource",args:[c,s[c]]})}function Hi(c,s,h){sn(s,{command:"removeSource",args:[c]}),h[c]=!0}function xi(c,s,h,p){Hi(c,h,p),ui(c,s,h)}function Or(c,s,h){let p;for(p in c[h])if(Object.prototype.hasOwnProperty.call(c[h],p)&&p!=="data"&&!qt(c[h][p],s[h][p]))return!1;for(p in s[h])if(Object.prototype.hasOwnProperty.call(s[h],p)&&p!=="data"&&!qt(c[h][p],s[h][p]))return!1;return!0}function vi(c,s,h,p,_,k){c=c||{},s=s||{};for(const S in c)Object.prototype.hasOwnProperty.call(c,S)&&(qt(c[S],s[S])||h.push({command:k,args:[p,S,s[S],_]}));for(const S in s)Object.prototype.hasOwnProperty.call(s,S)&&!Object.prototype.hasOwnProperty.call(c,S)&&(qt(c[S],s[S])||h.push({command:k,args:[p,S,s[S],_]}))}function Eo(c){return c.id}function Co(c,s){return c[s.id]=s,c}class Ve{constructor(s,h,p,_){this.message=(s?`${s}: `:"")+p,_&&(this.identifier=_),h!=null&&h.__line__&&(this.line=h.__line__)}}function Br(c,...s){for(const h of s)for(const p in h)c[p]=h[p];return c}class wi extends Error{constructor(s,h){super(h),this.message=h,this.key=s}}class zr{constructor(s,h=[]){this.parent=s,this.bindings={};for(const[p,_]of h)this.bindings[p]=_}concat(s){return new zr(this,s)}get(s){if(this.bindings[s])return this.bindings[s];if(this.parent)return this.parent.get(s);throw new Error(`${s} not found in scope.`)}has(s){return!!this.bindings[s]||!!this.parent&&this.parent.has(s)}}const To={kind:"null"},Ze={kind:"number"},ke={kind:"string"},Re={kind:"boolean"},vt={kind:"color"},Wt={kind:"object"},et={kind:"value"},Ln={kind:"collator"},Kn={kind:"formatted"},qi={kind:"padding"},fr={kind:"resolvedImage"},se={kind:"variableAnchorOffsetCollection"};function H(c,s){return{kind:"array",itemType:c,N:s}}function U(c){if(c.kind==="array"){const s=U(c.itemType);return typeof c.N=="number"?`array<${s}, ${c.N}>`:c.itemType.kind==="value"?"array":`array<${s}>`}return c.kind}const X=[To,Ze,ke,Re,vt,Kn,Wt,H(et),qi,fr,se];function ie(c,s){if(s.kind==="error")return null;if(c.kind==="array"){if(s.kind==="array"&&(s.N===0&&s.itemType.kind==="value"||!ie(c.itemType,s.itemType))&&(typeof c.N!="number"||c.N===s.N))return null}else{if(c.kind===s.kind)return null;if(c.kind==="value"){for(const h of X)if(!ie(h,s))return null}}return`Expected ${U(c)} but found ${U(s)} instead.`}function de(c,s){return s.some(h=>h.kind===c.kind)}function fe(c,s){return s.some(h=>h==="null"?c===null:h==="array"?Array.isArray(c):h==="object"?c&&!Array.isArray(c)&&typeof c=="object":h===typeof c)}function _e(c,s){return c.kind==="array"&&s.kind==="array"?c.itemType.kind===s.itemType.kind&&typeof c.N=="number":c.kind===s.kind}const ue=.96422,Me=.82521,ze=4/29,Ee=6/29,We=3*Ee*Ee,xt=Ee*Ee*Ee,kt=Math.PI/180,an=180/Math.PI;function Lt(c){return(c%=360)<0&&(c+=360),c}function ln([c,s,h,p]){let _,k;const S=oi((.2225045*(c=Kt(c))+.7168786*(s=Kt(s))+.0606169*(h=Kt(h)))/1);c===s&&s===h?_=k=S:(_=oi((.4360747*c+.3850649*s+.1430804*h)/ue),k=oi((.0139322*c+.0971045*s+.7141733*h)/Me));const T=116*S-16;return[T<0?0:T,500*(_-S),200*(S-k),p]}function Kt(c){return c<=.04045?c/12.92:Math.pow((c+.055)/1.055,2.4)}function oi(c){return c>xt?Math.pow(c,1/3):c/We+ze}function Zn([c,s,h,p]){let _=(c+16)/116,k=isNaN(s)?_:_+s/500,S=isNaN(h)?_:_-h/200;return _=1*wn(_),k=ue*wn(k),S=Me*wn(S),[Ut(3.1338561*k-1.6168667*_-.4906146*S),Ut(-.9787684*k+1.9161415*_+.033454*S),Ut(.0719453*k-.2289914*_+1.4052427*S),p]}function Ut(c){return(c=c<=.00304?12.92*c:1.055*Math.pow(c,1/2.4)-.055)<0?0:c>1?1:c}function wn(c){return c>Ee?c*c*c:We*(c-ze)}function qn(c){return parseInt(c.padEnd(2,c),16)/255}function mi(c,s){return ki(s?c/100:c,0,1)}function ki(c,s,h){return Math.min(Math.max(s,c),h)}function Wi(c){return!c.some(Number.isNaN)}const Aa={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};class kn{constructor(s,h,p,_=1,k=!0){this.r=s,this.g=h,this.b=p,this.a=_,k||(this.r*=_,this.g*=_,this.b*=_,_||this.overwriteGetter("rgb",[s,h,p,_]))}static parse(s){if(s instanceof kn)return s;if(typeof s!="string")return;const h=function(p){if((p=p.toLowerCase().trim())==="transparent")return[0,0,0,0];const _=Aa[p];if(_){const[S,T,A]=_;return[S/255,T/255,A/255,1]}if(p.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(p)){const S=p.length<6?1:2;let T=1;return[qn(p.slice(T,T+=S)),qn(p.slice(T,T+=S)),qn(p.slice(T,T+=S)),qn(p.slice(T,T+S)||"ff")]}if(p.startsWith("rgb")){const S=p.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(S){const[T,A,B,z,L,j,q,Y,K,re,ae,be]=S,pe=[z||" ",q||" ",re].join("");if(pe===" "||pe===" /"||pe===",,"||pe===",,,"){const ye=[B,j,K].join(""),Te=ye==="%%%"?100:ye===""?255:0;if(Te){const Le=[ki(+A/Te,0,1),ki(+L/Te,0,1),ki(+Y/Te,0,1),ae?mi(+ae,be):1];if(Wi(Le))return Le}}return}}const k=p.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(k){const[S,T,A,B,z,L,j,q,Y]=k,K=[A||" ",z||" ",j].join("");if(K===" "||K===" /"||K===",,"||K===",,,"){const re=[+T,ki(+B,0,100),ki(+L,0,100),q?mi(+q,Y):1];if(Wi(re))return function([ae,be,pe,ye]){function Te(Le){const rt=(Le+ae/30)%12,St=be*Math.min(pe,1-pe);return pe-St*Math.max(-1,Math.min(rt-3,9-rt,1))}return ae=Lt(ae),be/=100,pe/=100,[Te(0),Te(8),Te(4),ye]}(re)}}}(s);return h?new kn(...h,!1):void 0}get rgb(){const{r:s,g:h,b:p,a:_}=this,k=_||1/0;return this.overwriteGetter("rgb",[s/k,h/k,p/k,_])}get hcl(){return this.overwriteGetter("hcl",function(s){const[h,p,_,k]=ln(s),S=Math.sqrt(p*p+_*_);return[Math.round(1e4*S)?Lt(Math.atan2(_,p)*an):NaN,S,h,k]}(this.rgb))}get lab(){return this.overwriteGetter("lab",ln(this.rgb))}overwriteGetter(s,h){return Object.defineProperty(this,s,{value:h}),h}toString(){const[s,h,p,_]=this.rgb;return`rgba(${[s,h,p].map(k=>Math.round(255*k)).join(",")},${_})`}}kn.black=new kn(0,0,0,1),kn.white=new kn(1,1,1,1),kn.transparent=new kn(0,0,0,0),kn.red=new kn(1,0,0,1);class Xh{constructor(s,h,p){this.sensitivity=s?h?"variant":"case":h?"accent":"base",this.locale=p,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(s,h){return this.collator.compare(s,h)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class Kh{constructor(s,h,p,_,k){this.text=s,this.image=h,this.scale=p,this.fontStack=_,this.textColor=k}}class mr{constructor(s){this.sections=s}static fromString(s){return new mr([new Kh(s,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some(s=>s.text.length!==0||s.image&&s.image.name.length!==0)}static factory(s){return s instanceof mr?s:mr.fromString(s)}toString(){return this.sections.length===0?"":this.sections.map(s=>s.text).join("")}}class gr{constructor(s){this.values=s.slice()}static parse(s){if(s instanceof gr)return s;if(typeof s=="number")return new gr([s,s,s,s]);if(Array.isArray(s)&&!(s.length<1||s.length>4)){for(const h of s)if(typeof h!="number")return;switch(s.length){case 1:s=[s[0],s[0],s[0],s[0]];break;case 2:s=[s[0],s[1],s[0],s[1]];break;case 3:s=[s[0],s[1],s[2],s[1]]}return new gr(s)}}toString(){return JSON.stringify(this.values)}}const r_=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class Nr{constructor(s){this.values=s.slice()}static parse(s){if(s instanceof Nr)return s;if(Array.isArray(s)&&!(s.length<1)&&s.length%2==0){for(let h=0;h<s.length;h+=2){const p=s[h],_=s[h+1];if(typeof p!="string"||!r_.has(p)||!Array.isArray(_)||_.length!==2||typeof _[0]!="number"||typeof _[1]!="number")return}return new Nr(s)}}toString(){return JSON.stringify(this.values)}}class yr{constructor(s){this.name=s.name,this.available=s.available}toString(){return this.name}static fromString(s){return s?new yr({name:s,available:!1}):null}}function Ia(c,s,h,p){return typeof c=="number"&&c>=0&&c<=255&&typeof s=="number"&&s>=0&&s<=255&&typeof h=="number"&&h>=0&&h<=255?p===void 0||typeof p=="number"&&p>=0&&p<=1?null:`Invalid rgba value [${[c,s,h,p].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof p=="number"?[c,s,h,p]:[c,s,h]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function Fs(c){if(c===null||typeof c=="string"||typeof c=="boolean"||typeof c=="number"||c instanceof kn||c instanceof Xh||c instanceof mr||c instanceof gr||c instanceof Nr||c instanceof yr)return!0;if(Array.isArray(c)){for(const s of c)if(!Fs(s))return!1;return!0}if(typeof c=="object"){for(const s in c)if(!Fs(c[s]))return!1;return!0}return!1}function si(c){if(c===null)return To;if(typeof c=="string")return ke;if(typeof c=="boolean")return Re;if(typeof c=="number")return Ze;if(c instanceof kn)return vt;if(c instanceof Xh)return Ln;if(c instanceof mr)return Kn;if(c instanceof gr)return qi;if(c instanceof Nr)return se;if(c instanceof yr)return fr;if(Array.isArray(c)){const s=c.length;let h;for(const p of c){const _=si(p);if(h){if(h===_)continue;h=et;break}h=_}return H(h||et,s)}return Wt}function Ll(c){const s=typeof c;return c===null?"":s==="string"||s==="number"||s==="boolean"?String(c):c instanceof kn||c instanceof mr||c instanceof gr||c instanceof Nr||c instanceof yr?c.toString():JSON.stringify(c)}class Jr{constructor(s,h){this.type=s,this.value=h}static parse(s,h){if(s.length!==2)return h.error(`'literal' expression requires exactly one argument, but found ${s.length-1} instead.`);if(!Fs(s[1]))return h.error("invalid value");const p=s[1];let _=si(p);const k=h.expectedType;return _.kind!=="array"||_.N!==0||!k||k.kind!=="array"||typeof k.N=="number"&&k.N!==0||(_=k),new Jr(_,p)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}class ni{constructor(s){this.name="ExpressionEvaluationError",this.message=s}toJSON(){return this.message}}const tu={string:ke,number:Ze,boolean:Re,object:Wt};class Qr{constructor(s,h){this.type=s,this.args=h}static parse(s,h){if(s.length<2)return h.error("Expected at least one argument.");let p,_=1;const k=s[0];if(k==="array"){let T,A;if(s.length>2){const B=s[1];if(typeof B!="string"||!(B in tu)||B==="object")return h.error('The item type argument of "array" must be one of string, number, boolean',1);T=tu[B],_++}else T=et;if(s.length>3){if(s[2]!==null&&(typeof s[2]!="number"||s[2]<0||s[2]!==Math.floor(s[2])))return h.error('The length argument to "array" must be a positive integer literal',2);A=s[2],_++}p=H(T,A)}else{if(!tu[k])throw new Error(`Types doesn't contain name = ${k}`);p=tu[k]}const S=[];for(;_<s.length;_++){const T=h.parse(s[_],_,et);if(!T)return null;S.push(T)}return new Qr(p,S)}evaluate(s){for(let h=0;h<this.args.length;h++){const p=this.args[h].evaluate(s);if(!ie(this.type,si(p)))return p;if(h===this.args.length-1)throw new ni(`Expected value to be of type ${U(this.type)}, but found ${U(si(p))} instead.`)}throw new Error}eachChild(s){this.args.forEach(s)}outputDefined(){return this.args.every(s=>s.outputDefined())}}const Jh={"to-boolean":Re,"to-color":vt,"to-number":Ze,"to-string":ke};class eo{constructor(s,h){this.type=s,this.args=h}static parse(s,h){if(s.length<2)return h.error("Expected at least one argument.");const p=s[0];if(!Jh[p])throw new Error(`Can't parse ${p} as it is not part of the known types`);if((p==="to-boolean"||p==="to-string")&&s.length!==2)return h.error("Expected one argument.");const _=Jh[p],k=[];for(let S=1;S<s.length;S++){const T=h.parse(s[S],S,et);if(!T)return null;k.push(T)}return new eo(_,k)}evaluate(s){switch(this.type.kind){case"boolean":return!!this.args[0].evaluate(s);case"color":{let h,p;for(const _ of this.args){if(h=_.evaluate(s),p=null,h instanceof kn)return h;if(typeof h=="string"){const k=s.parseColor(h);if(k)return k}else if(Array.isArray(h)&&(p=h.length<3||h.length>4?`Invalid rbga value ${JSON.stringify(h)}: expected an array containing either three or four numeric values.`:Ia(h[0],h[1],h[2],h[3]),!p))return new kn(h[0]/255,h[1]/255,h[2]/255,h[3])}throw new ni(p||`Could not parse color from value '${typeof h=="string"?h:JSON.stringify(h)}'`)}case"padding":{let h;for(const p of this.args){h=p.evaluate(s);const _=gr.parse(h);if(_)return _}throw new ni(`Could not parse padding from value '${typeof h=="string"?h:JSON.stringify(h)}'`)}case"variableAnchorOffsetCollection":{let h;for(const p of this.args){h=p.evaluate(s);const _=Nr.parse(h);if(_)return _}throw new ni(`Could not parse variableAnchorOffsetCollection from value '${typeof h=="string"?h:JSON.stringify(h)}'`)}case"number":{let h=null;for(const p of this.args){if(h=p.evaluate(s),h===null)return 0;const _=Number(h);if(!isNaN(_))return _}throw new ni(`Could not convert ${JSON.stringify(h)} to number.`)}case"formatted":return mr.fromString(Ll(this.args[0].evaluate(s)));case"resolvedImage":return yr.fromString(Ll(this.args[0].evaluate(s)));default:return Ll(this.args[0].evaluate(s))}}eachChild(s){this.args.forEach(s)}outputDefined(){return this.args.every(s=>s.outputDefined())}}const o_=["Unknown","Point","LineString","Polygon"];class nu{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},this.availableImages=null,this.canonical=null}id(){return this.feature&&"id"in this.feature?this.feature.id:null}geometryType(){return this.feature?typeof this.feature.type=="number"?o_[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}parseColor(s){let h=this._parseColorCache[s];return h||(h=this._parseColorCache[s]=kn.parse(s)),h}}class $s{constructor(s,h,p=[],_,k=new zr,S=[]){this.registry=s,this.path=p,this.key=p.map(T=>`[${T}]`).join(""),this.scope=k,this.errors=S,this.expectedType=_,this._isConstant=h}parse(s,h,p,_,k={}){return h?this.concat(h,p,_)._parse(s,k):this._parse(s,k)}_parse(s,h){function p(_,k,S){return S==="assert"?new Qr(k,[_]):S==="coerce"?new eo(k,[_]):_}if(s!==null&&typeof s!="string"&&typeof s!="boolean"&&typeof s!="number"||(s=["literal",s]),Array.isArray(s)){if(s.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const _=s[0];if(typeof _!="string")return this.error(`Expression name must be a string, but found ${typeof _} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const k=this.registry[_];if(k){let S=k.parse(s,this);if(!S)return null;if(this.expectedType){const T=this.expectedType,A=S.type;if(T.kind!=="string"&&T.kind!=="number"&&T.kind!=="boolean"&&T.kind!=="object"&&T.kind!=="array"||A.kind!=="value")if(T.kind!=="color"&&T.kind!=="formatted"&&T.kind!=="resolvedImage"||A.kind!=="value"&&A.kind!=="string")if(T.kind!=="padding"||A.kind!=="value"&&A.kind!=="number"&&A.kind!=="array")if(T.kind!=="variableAnchorOffsetCollection"||A.kind!=="value"&&A.kind!=="array"){if(this.checkSubtype(T,A))return null}else S=p(S,T,h.typeAnnotation||"coerce");else S=p(S,T,h.typeAnnotation||"coerce");else S=p(S,T,h.typeAnnotation||"coerce");else S=p(S,T,h.typeAnnotation||"assert")}if(!(S instanceof Jr)&&S.type.kind!=="resolvedImage"&&this._isConstant(S)){const T=new nu;try{S=new Jr(S.type,S.evaluate(T))}catch(A){return this.error(A.message),null}}return S}return this.error(`Unknown expression "${_}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(s===void 0?"'undefined' value invalid. Use null instead.":typeof s=="object"?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof s} instead.`)}concat(s,h,p){const _=typeof s=="number"?this.path.concat(s):this.path,k=p?this.scope.concat(p):this.scope;return new $s(this.registry,this._isConstant,_,h||null,k,this.errors)}error(s,...h){const p=`${this.key}${h.map(_=>`[${_}]`).join("")}`;this.errors.push(new wi(p,s))}checkSubtype(s,h){const p=ie(s,h);return p&&this.error(p),p}}class ds{constructor(s,h){this.type=h.type,this.bindings=[].concat(s),this.result=h}evaluate(s){return this.result.evaluate(s)}eachChild(s){for(const h of this.bindings)s(h[1]);s(this.result)}static parse(s,h){if(s.length<4)return h.error(`Expected at least 3 arguments, but found ${s.length-1} instead.`);const p=[];for(let k=1;k<s.length-1;k+=2){const S=s[k];if(typeof S!="string")return h.error(`Expected string, but found ${typeof S} instead.`,k);if(/[^a-zA-Z0-9_]/.test(S))return h.error("Variable names must contain only alphanumeric characters or '_'.",k);const T=h.parse(s[k+1],k+1);if(!T)return null;p.push([S,T])}const _=h.parse(s[s.length-1],s.length-1,h.expectedType,p);return _?new ds(p,_):null}outputDefined(){return this.result.outputDefined()}}class fn{constructor(s,h){this.type=h.type,this.name=s,this.boundExpression=h}static parse(s,h){if(s.length!==2||typeof s[1]!="string")return h.error("'var' expression requires exactly one string literal argument.");const p=s[1];return h.scope.has(p)?new fn(p,h.scope.get(p)):h.error(`Unknown variable "${p}". Make sure "${p}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(s){return this.boundExpression.evaluate(s)}eachChild(){}outputDefined(){return!1}}class Qh{constructor(s,h,p){this.type=s,this.index=h,this.input=p}static parse(s,h){if(s.length!==3)return h.error(`Expected 2 arguments, but found ${s.length-1} instead.`);const p=h.parse(s[1],1,Ze),_=h.parse(s[2],2,H(h.expectedType||et));return p&&_?new Qh(_.type.itemType,p,_):null}evaluate(s){const h=this.index.evaluate(s),p=this.input.evaluate(s);if(h<0)throw new ni(`Array index out of bounds: ${h} < 0.`);if(h>=p.length)throw new ni(`Array index out of bounds: ${h} > ${p.length-1}.`);if(h!==Math.floor(h))throw new ni(`Array index must be an integer, but found ${h} instead.`);return p[h]}eachChild(s){s(this.index),s(this.input)}outputDefined(){return!1}}class ed{constructor(s,h){this.type=Re,this.needle=s,this.haystack=h}static parse(s,h){if(s.length!==3)return h.error(`Expected 2 arguments, but found ${s.length-1} instead.`);const p=h.parse(s[1],1,et),_=h.parse(s[2],2,et);return p&&_?de(p.type,[Re,ke,Ze,To,et])?new ed(p,_):h.error(`Expected first argument to be of type boolean, string, number or null, but found ${U(p.type)} instead`):null}evaluate(s){const h=this.needle.evaluate(s),p=this.haystack.evaluate(s);if(!p)return!1;if(!fe(h,["boolean","string","number","null"]))throw new ni(`Expected first argument to be of type boolean, string, number or null, but found ${U(si(h))} instead.`);if(!fe(p,["string","array"]))throw new ni(`Expected second argument to be of type array or string, but found ${U(si(p))} instead.`);return p.indexOf(h)>=0}eachChild(s){s(this.needle),s(this.haystack)}outputDefined(){return!0}}class Pa{constructor(s,h,p){this.type=Ze,this.needle=s,this.haystack=h,this.fromIndex=p}static parse(s,h){if(s.length<=2||s.length>=5)return h.error(`Expected 3 or 4 arguments, but found ${s.length-1} instead.`);const p=h.parse(s[1],1,et),_=h.parse(s[2],2,et);if(!p||!_)return null;if(!de(p.type,[Re,ke,Ze,To,et]))return h.error(`Expected first argument to be of type boolean, string, number or null, but found ${U(p.type)} instead`);if(s.length===4){const k=h.parse(s[3],3,Ze);return k?new Pa(p,_,k):null}return new Pa(p,_)}evaluate(s){const h=this.needle.evaluate(s),p=this.haystack.evaluate(s);if(!fe(h,["boolean","string","number","null"]))throw new ni(`Expected first argument to be of type boolean, string, number or null, but found ${U(si(h))} instead.`);let _;if(this.fromIndex&&(_=this.fromIndex.evaluate(s)),fe(p,["string"])){const k=p.indexOf(h,_);return k===-1?-1:[...p.slice(0,k)].length}if(fe(p,["array"]))return p.indexOf(h,_);throw new ni(`Expected second argument to be of type array or string, but found ${U(si(p))} instead.`)}eachChild(s){s(this.needle),s(this.haystack),this.fromIndex&&s(this.fromIndex)}outputDefined(){return!1}}class td{constructor(s,h,p,_,k,S){this.inputType=s,this.type=h,this.input=p,this.cases=_,this.outputs=k,this.otherwise=S}static parse(s,h){if(s.length<5)return h.error(`Expected at least 4 arguments, but found only ${s.length-1}.`);if(s.length%2!=1)return h.error("Expected an even number of arguments.");let p,_;h.expectedType&&h.expectedType.kind!=="value"&&(_=h.expectedType);const k={},S=[];for(let B=2;B<s.length-1;B+=2){let z=s[B];const L=s[B+1];Array.isArray(z)||(z=[z]);const j=h.concat(B);if(z.length===0)return j.error("Expected at least one branch label.");for(const Y of z){if(typeof Y!="number"&&typeof Y!="string")return j.error("Branch labels must be numbers or strings.");if(typeof Y=="number"&&Math.abs(Y)>Number.MAX_SAFE_INTEGER)return j.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof Y=="number"&&Math.floor(Y)!==Y)return j.error("Numeric branch labels must be integer values.");if(p){if(j.checkSubtype(p,si(Y)))return null}else p=si(Y);if(k[String(Y)]!==void 0)return j.error("Branch labels must be unique.");k[String(Y)]=S.length}const q=h.parse(L,B,_);if(!q)return null;_=_||q.type,S.push(q)}const T=h.parse(s[1],1,et);if(!T)return null;const A=h.parse(s[s.length-1],s.length-1,_);return A?T.type.kind!=="value"&&h.concat(1).checkSubtype(p,T.type)?null:new td(p,_,T,k,S,A):null}evaluate(s){const h=this.input.evaluate(s);return(si(h)===this.inputType&&this.outputs[this.cases[h]]||this.otherwise).evaluate(s)}eachChild(s){s(this.input),this.outputs.forEach(s),s(this.otherwise)}outputDefined(){return this.outputs.every(s=>s.outputDefined())&&this.otherwise.outputDefined()}}class iu{constructor(s,h,p){this.type=s,this.branches=h,this.otherwise=p}static parse(s,h){if(s.length<4)return h.error(`Expected at least 3 arguments, but found only ${s.length-1}.`);if(s.length%2!=0)return h.error("Expected an odd number of arguments.");let p;h.expectedType&&h.expectedType.kind!=="value"&&(p=h.expectedType);const _=[];for(let S=1;S<s.length-1;S+=2){const T=h.parse(s[S],S,Re);if(!T)return null;const A=h.parse(s[S+1],S+1,p);if(!A)return null;_.push([T,A]),p=p||A.type}const k=h.parse(s[s.length-1],s.length-1,p);if(!k)return null;if(!p)throw new Error("Can't infer output type");return new iu(p,_,k)}evaluate(s){for(const[h,p]of this.branches)if(h.evaluate(s))return p.evaluate(s);return this.otherwise.evaluate(s)}eachChild(s){for(const[h,p]of this.branches)s(h),s(p);s(this.otherwise)}outputDefined(){return this.branches.every(([s,h])=>h.outputDefined())&&this.otherwise.outputDefined()}}class Vl{constructor(s,h,p,_){this.type=s,this.input=h,this.beginIndex=p,this.endIndex=_}static parse(s,h){if(s.length<=2||s.length>=5)return h.error(`Expected 3 or 4 arguments, but found ${s.length-1} instead.`);const p=h.parse(s[1],1,et),_=h.parse(s[2],2,Ze);if(!p||!_)return null;if(!de(p.type,[H(et),ke,et]))return h.error(`Expected first argument to be of type array or string, but found ${U(p.type)} instead`);if(s.length===4){const k=h.parse(s[3],3,Ze);return k?new Vl(p.type,p,_,k):null}return new Vl(p.type,p,_)}evaluate(s){const h=this.input.evaluate(s),p=this.beginIndex.evaluate(s);let _;if(this.endIndex&&(_=this.endIndex.evaluate(s)),fe(h,["string"]))return[...h].slice(p,_).join("");if(fe(h,["array"]))return h.slice(p,_);throw new ni(`Expected first argument to be of type array or string, but found ${U(si(h))} instead.`)}eachChild(s){s(this.input),s(this.beginIndex),this.endIndex&&s(this.endIndex)}outputDefined(){return!1}}function ru(c,s){const h=c.length-1;let p,_,k=0,S=h,T=0;for(;k<=S;)if(T=Math.floor((k+S)/2),p=c[T],_=c[T+1],p<=s){if(T===h||s<_)return T;k=T+1}else{if(!(p>s))throw new ni("Input is not a number.");S=T-1}return 0}class Da{constructor(s,h,p){this.type=s,this.input=h,this.labels=[],this.outputs=[];for(const[_,k]of p)this.labels.push(_),this.outputs.push(k)}static parse(s,h){if(s.length-1<4)return h.error(`Expected at least 4 arguments, but found only ${s.length-1}.`);if((s.length-1)%2!=0)return h.error("Expected an even number of arguments.");const p=h.parse(s[1],1,Ze);if(!p)return null;const _=[];let k=null;h.expectedType&&h.expectedType.kind!=="value"&&(k=h.expectedType);for(let S=1;S<s.length;S+=2){const T=S===1?-1/0:s[S],A=s[S+1],B=S,z=S+1;if(typeof T!="number")return h.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',B);if(_.length&&_[_.length-1][0]>=T)return h.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',B);const L=h.parse(A,z,k);if(!L)return null;k=k||L.type,_.push([T,L])}return new Da(k,p,_)}evaluate(s){const h=this.labels,p=this.outputs;if(h.length===1)return p[0].evaluate(s);const _=this.input.evaluate(s);if(_<=h[0])return p[0].evaluate(s);const k=h.length;return _>=h[k-1]?p[k-1].evaluate(s):p[ru(h,_)].evaluate(s)}eachChild(s){s(this.input);for(const h of this.outputs)s(h)}outputDefined(){return this.outputs.every(s=>s.outputDefined())}}function Jf(c){return c&&c.__esModule&&Object.prototype.hasOwnProperty.call(c,"default")?c.default:c}var s_=Qf;function Qf(c,s,h,p){this.cx=3*c,this.bx=3*(h-c)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*s,this.by=3*(p-s)-this.cy,this.ay=1-this.cy-this.by,this.p1x=c,this.p1y=s,this.p2x=h,this.p2y=p}Qf.prototype={sampleCurveX:function(c){return((this.ax*c+this.bx)*c+this.cx)*c},sampleCurveY:function(c){return((this.ay*c+this.by)*c+this.cy)*c},sampleCurveDerivativeX:function(c){return(3*this.ax*c+2*this.bx)*c+this.cx},solveCurveX:function(c,s){if(s===void 0&&(s=1e-6),c<0)return 0;if(c>1)return 1;for(var h=c,p=0;p<8;p++){var _=this.sampleCurveX(h)-c;if(Math.abs(_)<s)return h;var k=this.sampleCurveDerivativeX(h);if(Math.abs(k)<1e-6)break;h-=_/k}var S=0,T=1;for(h=c,p=0;p<20&&(_=this.sampleCurveX(h),!(Math.abs(_-c)<s));p++)c>_?S=h:T=h,h=.5*(T-S)+S;return h},solve:function(c,s){return this.sampleCurveY(this.solveCurveX(c,s))}};var a_=Jf(s_);function js(c,s,h){return c+h*(s-c)}function Fl(c,s,h){return c.map((p,_)=>js(p,s[_],h))}const nr={number:js,color:function(c,s,h,p="rgb"){switch(p){case"rgb":{const[_,k,S,T]=Fl(c.rgb,s.rgb,h);return new kn(_,k,S,T,!1)}case"hcl":{const[_,k,S,T]=c.hcl,[A,B,z,L]=s.hcl;let j,q;if(isNaN(_)||isNaN(A))isNaN(_)?isNaN(A)?j=NaN:(j=A,S!==1&&S!==0||(q=B)):(j=_,z!==1&&z!==0||(q=k));else{let be=A-_;A>_&&be>180?be-=360:A<_&&_-A>180&&(be+=360),j=_+h*be}const[Y,K,re,ae]=function([be,pe,ye,Te]){return be=isNaN(be)?0:be*kt,Zn([ye,Math.cos(be)*pe,Math.sin(be)*pe,Te])}([j,q??js(k,B,h),js(S,z,h),js(T,L,h)]);return new kn(Y,K,re,ae,!1)}case"lab":{const[_,k,S,T]=Zn(Fl(c.lab,s.lab,h));return new kn(_,k,S,T,!1)}}},array:Fl,padding:function(c,s,h){return new gr(Fl(c.values,s.values,h))},variableAnchorOffsetCollection:function(c,s,h){const p=c.values,_=s.values;if(p.length!==_.length)throw new ni(`Cannot interpolate values of different length. from: ${c.toString()}, to: ${s.toString()}`);const k=[];for(let S=0;S<p.length;S+=2){if(p[S]!==_[S])throw new ni(`Cannot interpolate values containing mismatched anchors. from[${S}]: ${p[S]}, to[${S}]: ${_[S]}`);k.push(p[S]);const[T,A]=p[S+1],[B,z]=_[S+1];k.push([js(T,B,h),js(A,z,h)])}return new Nr(k)}};class ir{constructor(s,h,p,_,k){this.type=s,this.operator=h,this.interpolation=p,this.input=_,this.labels=[],this.outputs=[];for(const[S,T]of k)this.labels.push(S),this.outputs.push(T)}static interpolationFactor(s,h,p,_){let k=0;if(s.name==="exponential")k=ou(h,s.base,p,_);else if(s.name==="linear")k=ou(h,1,p,_);else if(s.name==="cubic-bezier"){const S=s.controlPoints;k=new a_(S[0],S[1],S[2],S[3]).solve(ou(h,1,p,_))}return k}static parse(s,h){let[p,_,k,...S]=s;if(!Array.isArray(_)||_.length===0)return h.error("Expected an interpolation type expression.",1);if(_[0]==="linear")_={name:"linear"};else if(_[0]==="exponential"){const B=_[1];if(typeof B!="number")return h.error("Exponential interpolation requires a numeric base.",1,1);_={name:"exponential",base:B}}else{if(_[0]!=="cubic-bezier")return h.error(`Unknown interpolation type ${String(_[0])}`,1,0);{const B=_.slice(1);if(B.length!==4||B.some(z=>typeof z!="number"||z<0||z>1))return h.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);_={name:"cubic-bezier",controlPoints:B}}}if(s.length-1<4)return h.error(`Expected at least 4 arguments, but found only ${s.length-1}.`);if((s.length-1)%2!=0)return h.error("Expected an even number of arguments.");if(k=h.parse(k,2,Ze),!k)return null;const T=[];let A=null;p==="interpolate-hcl"||p==="interpolate-lab"?A=vt:h.expectedType&&h.expectedType.kind!=="value"&&(A=h.expectedType);for(let B=0;B<S.length;B+=2){const z=S[B],L=S[B+1],j=B+3,q=B+4;if(typeof z!="number")return h.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',j);if(T.length&&T[T.length-1][0]>=z)return h.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',j);const Y=h.parse(L,q,A);if(!Y)return null;A=A||Y.type,T.push([z,Y])}return _e(A,Ze)||_e(A,vt)||_e(A,qi)||_e(A,se)||_e(A,H(Ze))?new ir(A,p,_,k,T):h.error(`Type ${U(A)} is not interpolatable.`)}evaluate(s){const h=this.labels,p=this.outputs;if(h.length===1)return p[0].evaluate(s);const _=this.input.evaluate(s);if(_<=h[0])return p[0].evaluate(s);const k=h.length;if(_>=h[k-1])return p[k-1].evaluate(s);const S=ru(h,_),T=ir.interpolationFactor(this.interpolation,_,h[S],h[S+1]),A=p[S].evaluate(s),B=p[S+1].evaluate(s);switch(this.operator){case"interpolate":return nr[this.type.kind](A,B,T);case"interpolate-hcl":return nr.color(A,B,T,"hcl");case"interpolate-lab":return nr.color(A,B,T,"lab")}}eachChild(s){s(this.input);for(const h of this.outputs)s(h)}outputDefined(){return this.outputs.every(s=>s.outputDefined())}}function ou(c,s,h,p){const _=p-h,k=c-h;return _===0?0:s===1?k/_:(Math.pow(s,k)-1)/(Math.pow(s,_)-1)}class su{constructor(s,h){this.type=s,this.args=h}static parse(s,h){if(s.length<2)return h.error("Expectected at least one argument.");let p=null;const _=h.expectedType;_&&_.kind!=="value"&&(p=_);const k=[];for(const T of s.slice(1)){const A=h.parse(T,1+k.length,p,void 0,{typeAnnotation:"omit"});if(!A)return null;p=p||A.type,k.push(A)}if(!p)throw new Error("No output type");const S=_&&k.some(T=>ie(_,T.type));return new su(S?et:p,k)}evaluate(s){let h,p=null,_=0;for(const k of this.args)if(_++,p=k.evaluate(s),p&&p instanceof yr&&!p.available&&(h||(h=p.name),p=null,_===this.args.length&&(p=h)),p!==null)break;return p}eachChild(s){this.args.forEach(s)}outputDefined(){return this.args.every(s=>s.outputDefined())}}function au(c,s){return c==="=="||c==="!="?s.kind==="boolean"||s.kind==="string"||s.kind==="number"||s.kind==="null"||s.kind==="value":s.kind==="string"||s.kind==="number"||s.kind==="value"}function em(c,s,h,p){return p.compare(s,h)===0}function Oa(c,s,h){const p=c!=="=="&&c!=="!=";return class MC{constructor(k,S,T){this.type=Re,this.lhs=k,this.rhs=S,this.collator=T,this.hasUntypedArgument=k.type.kind==="value"||S.type.kind==="value"}static parse(k,S){if(k.length!==3&&k.length!==4)return S.error("Expected two or three arguments.");const T=k[0];let A=S.parse(k[1],1,et);if(!A)return null;if(!au(T,A.type))return S.concat(1).error(`"${T}" comparisons are not supported for type '${U(A.type)}'.`);let B=S.parse(k[2],2,et);if(!B)return null;if(!au(T,B.type))return S.concat(2).error(`"${T}" comparisons are not supported for type '${U(B.type)}'.`);if(A.type.kind!==B.type.kind&&A.type.kind!=="value"&&B.type.kind!=="value")return S.error(`Cannot compare types '${U(A.type)}' and '${U(B.type)}'.`);p&&(A.type.kind==="value"&&B.type.kind!=="value"?A=new Qr(B.type,[A]):A.type.kind!=="value"&&B.type.kind==="value"&&(B=new Qr(A.type,[B])));let z=null;if(k.length===4){if(A.type.kind!=="string"&&B.type.kind!=="string"&&A.type.kind!=="value"&&B.type.kind!=="value")return S.error("Cannot use collator to compare non-string types.");if(z=S.parse(k[3],3,Ln),!z)return null}return new MC(A,B,z)}evaluate(k){const S=this.lhs.evaluate(k),T=this.rhs.evaluate(k);if(p&&this.hasUntypedArgument){const A=si(S),B=si(T);if(A.kind!==B.kind||A.kind!=="string"&&A.kind!=="number")throw new ni(`Expected arguments for "${c}" to be (string, string) or (number, number), but found (${A.kind}, ${B.kind}) instead.`)}if(this.collator&&!p&&this.hasUntypedArgument){const A=si(S),B=si(T);if(A.kind!=="string"||B.kind!=="string")return s(k,S,T)}return this.collator?h(k,S,T,this.collator.evaluate(k)):s(k,S,T)}eachChild(k){k(this.lhs),k(this.rhs),this.collator&&k(this.collator)}outputDefined(){return!0}}}const l_=Oa("==",function(c,s,h){return s===h},em),tm=Oa("!=",function(c,s,h){return s!==h},function(c,s,h,p){return!em(0,s,h,p)}),nm=Oa("<",function(c,s,h){return s<h},function(c,s,h,p){return p.compare(s,h)<0}),c_=Oa(">",function(c,s,h){return s>h},function(c,s,h,p){return p.compare(s,h)>0}),u_=Oa("<=",function(c,s,h){return s<=h},function(c,s,h,p){return p.compare(s,h)<=0}),im=Oa(">=",function(c,s,h){return s>=h},function(c,s,h,p){return p.compare(s,h)>=0});class $l{constructor(s,h,p){this.type=Ln,this.locale=p,this.caseSensitive=s,this.diacriticSensitive=h}static parse(s,h){if(s.length!==2)return h.error("Expected one argument.");const p=s[1];if(typeof p!="object"||Array.isArray(p))return h.error("Collator options argument must be an object.");const _=h.parse(p["case-sensitive"]!==void 0&&p["case-sensitive"],1,Re);if(!_)return null;const k=h.parse(p["diacritic-sensitive"]!==void 0&&p["diacritic-sensitive"],1,Re);if(!k)return null;let S=null;return p.locale&&(S=h.parse(p.locale,1,ke),!S)?null:new $l(_,k,S)}evaluate(s){return new Xh(this.caseSensitive.evaluate(s),this.diacriticSensitive.evaluate(s),this.locale?this.locale.evaluate(s):null)}eachChild(s){s(this.caseSensitive),s(this.diacriticSensitive),this.locale&&s(this.locale)}outputDefined(){return!1}}class nd{constructor(s,h,p,_,k){this.type=ke,this.number=s,this.locale=h,this.currency=p,this.minFractionDigits=_,this.maxFractionDigits=k}static parse(s,h){if(s.length!==3)return h.error("Expected two arguments.");const p=h.parse(s[1],1,Ze);if(!p)return null;const _=s[2];if(typeof _!="object"||Array.isArray(_))return h.error("NumberFormat options argument must be an object.");let k=null;if(_.locale&&(k=h.parse(_.locale,1,ke),!k))return null;let S=null;if(_.currency&&(S=h.parse(_.currency,1,ke),!S))return null;let T=null;if(_["min-fraction-digits"]&&(T=h.parse(_["min-fraction-digits"],1,Ze),!T))return null;let A=null;return _["max-fraction-digits"]&&(A=h.parse(_["max-fraction-digits"],1,Ze),!A)?null:new nd(p,k,S,T,A)}evaluate(s){return new Intl.NumberFormat(this.locale?this.locale.evaluate(s):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(s):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(s):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(s):void 0}).format(this.number.evaluate(s))}eachChild(s){s(this.number),this.locale&&s(this.locale),this.currency&&s(this.currency),this.minFractionDigits&&s(this.minFractionDigits),this.maxFractionDigits&&s(this.maxFractionDigits)}outputDefined(){return!1}}class lu{constructor(s){this.type=Kn,this.sections=s}static parse(s,h){if(s.length<2)return h.error("Expected at least one argument.");const p=s[1];if(!Array.isArray(p)&&typeof p=="object")return h.error("First argument must be an image or text section.");const _=[];let k=!1;for(let S=1;S<=s.length-1;++S){const T=s[S];if(k&&typeof T=="object"&&!Array.isArray(T)){k=!1;let A=null;if(T["font-scale"]&&(A=h.parse(T["font-scale"],1,Ze),!A))return null;let B=null;if(T["text-font"]&&(B=h.parse(T["text-font"],1,H(ke)),!B))return null;let z=null;if(T["text-color"]&&(z=h.parse(T["text-color"],1,vt),!z))return null;const L=_[_.length-1];L.scale=A,L.font=B,L.textColor=z}else{const A=h.parse(s[S],1,et);if(!A)return null;const B=A.type.kind;if(B!=="string"&&B!=="value"&&B!=="null"&&B!=="resolvedImage")return h.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");k=!0,_.push({content:A,scale:null,font:null,textColor:null})}}return new lu(_)}evaluate(s){return new mr(this.sections.map(h=>{const p=h.content.evaluate(s);return si(p)===fr?new Kh("",p,null,null,null):new Kh(Ll(p),null,h.scale?h.scale.evaluate(s):null,h.font?h.font.evaluate(s).join(","):null,h.textColor?h.textColor.evaluate(s):null)}))}eachChild(s){for(const h of this.sections)s(h.content),h.scale&&s(h.scale),h.font&&s(h.font),h.textColor&&s(h.textColor)}outputDefined(){return!1}}class id{constructor(s){this.type=fr,this.input=s}static parse(s,h){if(s.length!==2)return h.error("Expected two arguments.");const p=h.parse(s[1],1,ke);return p?new id(p):h.error("No image name provided.")}evaluate(s){const h=this.input.evaluate(s),p=yr.fromString(h);return p&&s.availableImages&&(p.available=s.availableImages.indexOf(h)>-1),p}eachChild(s){s(this.input)}outputDefined(){return!1}}class rd{constructor(s){this.type=Ze,this.input=s}static parse(s,h){if(s.length!==2)return h.error(`Expected 1 argument, but found ${s.length-1} instead.`);const p=h.parse(s[1],1);return p?p.type.kind!=="array"&&p.type.kind!=="string"&&p.type.kind!=="value"?h.error(`Expected argument of type string or array, but found ${U(p.type)} instead.`):new rd(p):null}evaluate(s){const h=this.input.evaluate(s);if(typeof h=="string")return[...h].length;if(Array.isArray(h))return h.length;throw new ni(`Expected value to be of type string or array, but found ${U(si(h))} instead.`)}eachChild(s){s(this.input)}outputDefined(){return!1}}const Mo=8192;function h_(c,s){const h=(180+c[0])/360,p=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+c[1]*Math.PI/360)))/360,_=Math.pow(2,s.z);return[Math.round(h*_*Mo),Math.round(p*_*Mo)]}function od(c,s){const h=Math.pow(2,s.z);return[(_=(c[0]/Mo+s.x)/h,360*_-180),(p=(c[1]/Mo+s.y)/h,360/Math.PI*Math.atan(Math.exp((180-360*p)*Math.PI/180))-90)];var p,_}function Us(c,s){c[0]=Math.min(c[0],s[0]),c[1]=Math.min(c[1],s[1]),c[2]=Math.max(c[2],s[0]),c[3]=Math.max(c[3],s[1])}function ps(c,s){return!(c[0]<=s[0]||c[2]>=s[2]||c[1]<=s[1]||c[3]>=s[3])}function _n(c,s,h){const p=c[0]-s[0],_=c[1]-s[1],k=c[0]-h[0],S=c[1]-h[1];return p*S-k*_==0&&p*k<=0&&_*S<=0}function cu(c,s,h,p){return(_=[p[0]-h[0],p[1]-h[1]])[0]*(k=[s[0]-c[0],s[1]-c[1]])[1]-_[1]*k[0]!=0&&!(!om(c,s,h,p)||!om(h,p,c,s));var _,k}function d_(c,s,h){for(const p of h)for(let _=0;_<p.length-1;++_)if(cu(c,s,p[_],p[_+1]))return!0;return!1}function Ba(c,s,h=!1){let p=!1;for(const T of s)for(let A=0;A<T.length-1;A++){if(_n(c,T[A],T[A+1]))return h;(k=T[A])[1]>(_=c)[1]!=(S=T[A+1])[1]>_[1]&&_[0]<(S[0]-k[0])*(_[1]-k[1])/(S[1]-k[1])+k[0]&&(p=!p)}var _,k,S;return p}function p_(c,s){for(const h of s)if(Ba(c,h))return!0;return!1}function rm(c,s){for(const h of c)if(!Ba(h,s))return!1;for(let h=0;h<c.length-1;++h)if(d_(c[h],c[h+1],s))return!1;return!0}function f_(c,s){for(const h of s)if(rm(c,h))return!0;return!1}function om(c,s,h,p){const _=p[0]-h[0],k=p[1]-h[1],S=(c[0]-h[0])*k-_*(c[1]-h[1]),T=(s[0]-h[0])*k-_*(s[1]-h[1]);return S>0&&T<0||S<0&&T>0}function sd(c,s,h){const p=[];for(let _=0;_<c.length;_++){const k=[];for(let S=0;S<c[_].length;S++){const T=h_(c[_][S],h);Us(s,T),k.push(T)}p.push(k)}return p}function sm(c,s,h){const p=[];for(let _=0;_<c.length;_++){const k=sd(c[_],s,h);p.push(k)}return p}function am(c,s,h,p){if(c[0]<h[0]||c[0]>h[2]){const _=.5*p;let k=c[0]-h[0]>_?-p:h[0]-c[0]>_?p:0;k===0&&(k=c[0]-h[2]>_?-p:h[2]-c[0]>_?p:0),c[0]+=k}Us(s,c)}function lm(c,s,h,p){const _=Math.pow(2,p.z)*Mo,k=[p.x*Mo,p.y*Mo],S=[];for(const T of c)for(const A of T){const B=[A.x+k[0],A.y+k[1]];am(B,s,h,_),S.push(B)}return S}function cm(c,s,h,p){const _=Math.pow(2,p.z)*Mo,k=[p.x*Mo,p.y*Mo],S=[];for(const A of c){const B=[];for(const z of A){const L=[z.x+k[0],z.y+k[1]];Us(s,L),B.push(L)}S.push(B)}if(s[2]-s[0]<=_/2){(T=s)[0]=T[1]=1/0,T[2]=T[3]=-1/0;for(const A of S)for(const B of A)am(B,s,h,_)}var T;return S}class Hs{constructor(s,h){this.type=Re,this.geojson=s,this.geometries=h}static parse(s,h){if(s.length!==2)return h.error(`'within' expression requires exactly one argument, but found ${s.length-1} instead.`);if(Fs(s[1])){const p=s[1];if(p.type==="FeatureCollection"){const _=[];for(const k of p.features){const{type:S,coordinates:T}=k.geometry;S==="Polygon"&&_.push(T),S==="MultiPolygon"&&_.push(...T)}if(_.length)return new Hs(p,{type:"MultiPolygon",coordinates:_})}else if(p.type==="Feature"){const _=p.geometry.type;if(_==="Polygon"||_==="MultiPolygon")return new Hs(p,p.geometry)}else if(p.type==="Polygon"||p.type==="MultiPolygon")return new Hs(p,p)}return h.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(s){if(s.geometry()!=null&&s.canonicalID()!=null){if(s.geometryType()==="Point")return function(h,p){const _=[1/0,1/0,-1/0,-1/0],k=[1/0,1/0,-1/0,-1/0],S=h.canonicalID();if(p.type==="Polygon"){const T=sd(p.coordinates,k,S),A=lm(h.geometry(),_,k,S);if(!ps(_,k))return!1;for(const B of A)if(!Ba(B,T))return!1}if(p.type==="MultiPolygon"){const T=sm(p.coordinates,k,S),A=lm(h.geometry(),_,k,S);if(!ps(_,k))return!1;for(const B of A)if(!p_(B,T))return!1}return!0}(s,this.geometries);if(s.geometryType()==="LineString")return function(h,p){const _=[1/0,1/0,-1/0,-1/0],k=[1/0,1/0,-1/0,-1/0],S=h.canonicalID();if(p.type==="Polygon"){const T=sd(p.coordinates,k,S),A=cm(h.geometry(),_,k,S);if(!ps(_,k))return!1;for(const B of A)if(!rm(B,T))return!1}if(p.type==="MultiPolygon"){const T=sm(p.coordinates,k,S),A=cm(h.geometry(),_,k,S);if(!ps(_,k))return!1;for(const B of A)if(!f_(B,T))return!1}return!0}(s,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}let um=class{constructor(c=[],s=(h,p)=>h<p?-1:h>p?1:0){if(this.data=c,this.length=this.data.length,this.compare=s,this.length>0)for(let h=(this.length>>1)-1;h>=0;h--)this._down(h)}push(c){this.data.push(c),this._up(this.length++)}pop(){if(this.length===0)return;const c=this.data[0],s=this.data.pop();return--this.length>0&&(this.data[0]=s,this._down(0)),c}peek(){return this.data[0]}_up(c){const{data:s,compare:h}=this,p=s[c];for(;c>0;){const _=c-1>>1,k=s[_];if(h(p,k)>=0)break;s[c]=k,c=_}s[c]=p}_down(c){const{data:s,compare:h}=this,p=this.length>>1,_=s[c];for(;c<p;){let k=1+(c<<1);const S=k+1;if(S<this.length&&h(s[S],s[k])<0&&(k=S),h(s[k],_)>=0)break;s[c]=s[k],c=k}s[c]=_}};function m_(c,s,h,p,_){hm(c,s,h,p||c.length-1,_||g_)}function hm(c,s,h,p,_){for(;p>h;){if(p-h>600){var k=p-h+1,S=s-h+1,T=Math.log(k),A=.5*Math.exp(2*T/3),B=.5*Math.sqrt(T*A*(k-A)/k)*(S-k/2<0?-1:1);hm(c,s,Math.max(h,Math.floor(s-S*A/k+B)),Math.min(p,Math.floor(s+(k-S)*A/k+B)),_)}var z=c[s],L=h,j=p;for(jl(c,h,s),_(c[p],z)>0&&jl(c,h,p);L<j;){for(jl(c,L,j),L++,j--;_(c[L],z)<0;)L++;for(;_(c[j],z)>0;)j--}_(c[h],z)===0?jl(c,h,j):jl(c,++j,p),j<=s&&(h=j+1),s<=j&&(p=j-1)}}function jl(c,s,h){var p=c[s];c[s]=c[h],c[h]=p}function g_(c,s){return c<s?-1:c>s?1:0}function uu(c,s){if(c.length<=1)return[c];const h=[];let p,_;for(const k of c){const S=__(k);S!==0&&(k.area=Math.abs(S),_===void 0&&(_=S<0),_===S<0?(p&&h.push(p),p=[k]):p.push(k))}if(p&&h.push(p),s>1)for(let k=0;k<h.length;k++)h[k].length<=s||(m_(h[k],s,1,h[k].length-1,y_),h[k]=h[k].slice(0,s));return h}function y_(c,s){return s.area-c.area}function __(c){let s=0;for(let h,p,_=0,k=c.length,S=k-1;_<k;S=_++)h=c[_],p=c[S],s+=(p.x-h.x)*(h.y+p.y);return s}const dm=1/298.257223563,pm=dm*(2-dm),fm=Math.PI/180;class ad{constructor(s){const h=6378.137*fm*1e3,p=Math.cos(s*fm),_=1/(1-pm*(1-p*p)),k=Math.sqrt(_);this.kx=h*k*p,this.ky=h*k*_*(1-pm)}distance(s,h){const p=this.wrap(s[0]-h[0])*this.kx,_=(s[1]-h[1])*this.ky;return Math.sqrt(p*p+_*_)}pointOnLine(s,h){let p,_,k,S,T=1/0;for(let A=0;A<s.length-1;A++){let B=s[A][0],z=s[A][1],L=this.wrap(s[A+1][0]-B)*this.kx,j=(s[A+1][1]-z)*this.ky,q=0;L===0&&j===0||(q=(this.wrap(h[0]-B)*this.kx*L+(h[1]-z)*this.ky*j)/(L*L+j*j),q>1?(B=s[A+1][0],z=s[A+1][1]):q>0&&(B+=L/this.kx*q,z+=j/this.ky*q)),L=this.wrap(h[0]-B)*this.kx,j=(h[1]-z)*this.ky;const Y=L*L+j*j;Y<T&&(T=Y,p=B,_=z,k=A,S=q)}return{point:[p,_],index:k,t:Math.max(0,Math.min(1,S))}}wrap(s){for(;s<-180;)s+=360;for(;s>180;)s-=360;return s}}function mm(c,s){return s[0]-c[0]}function hu(c){return c[1]-c[0]+1}function Ho(c,s){return c[1]>=c[0]&&c[1]<s}function ld(c,s){if(c[0]>c[1])return[null,null];const h=hu(c);if(s){if(h===2)return[c,null];const _=Math.floor(h/2);return[[c[0],c[0]+_],[c[0]+_,c[1]]]}if(h===1)return[c,null];const p=Math.floor(h/2)-1;return[[c[0],c[0]+p],[c[0]+p+1,c[1]]]}function cd(c,s){if(!Ho(s,c.length))return[1/0,1/0,-1/0,-1/0];const h=[1/0,1/0,-1/0,-1/0];for(let p=s[0];p<=s[1];++p)Us(h,c[p]);return h}function ud(c){const s=[1/0,1/0,-1/0,-1/0];for(const h of c)for(const p of h)Us(s,p);return s}function du(c){return c[0]!==-1/0&&c[1]!==-1/0&&c[2]!==1/0&&c[3]!==1/0}function hd(c,s,h){if(!du(c)||!du(s))return NaN;let p=0,_=0;return c[2]<s[0]&&(p=s[0]-c[2]),c[0]>s[2]&&(p=c[0]-s[2]),c[1]>s[3]&&(_=c[1]-s[3]),c[3]<s[1]&&(_=s[1]-c[3]),h.distance([0,0],[p,_])}function qs(c,s,h){const p=h.pointOnLine(s,c);return h.distance(c,p.point)}function dd(c,s,h,p,_){const k=Math.min(qs(c,[h,p],_),qs(s,[h,p],_)),S=Math.min(qs(h,[c,s],_),qs(p,[c,s],_));return Math.min(k,S)}function b_(c,s,h,p,_){if(!Ho(s,c.length)||!Ho(p,h.length))return 1/0;let k=1/0;for(let S=s[0];S<s[1];++S){const T=c[S],A=c[S+1];for(let B=p[0];B<p[1];++B){const z=h[B],L=h[B+1];if(cu(T,A,z,L))return 0;k=Math.min(k,dd(T,A,z,L,_))}}return k}function Jn(c,s,h,p,_){if(!Ho(s,c.length)||!Ho(p,h.length))return NaN;let k=1/0;for(let S=s[0];S<=s[1];++S)for(let T=p[0];T<=p[1];++T)if(k=Math.min(k,_.distance(c[S],h[T])),k===0)return k;return k}function x_(c,s,h){if(Ba(c,s,!0))return 0;let p=1/0;for(const _ of s){const k=_[0],S=_[_.length-1];if(k!==S&&(p=Math.min(p,qs(c,[S,k],h)),p===0))return p;const T=h.pointOnLine(_,c);if(p=Math.min(p,h.distance(c,T.point)),p===0)return p}return p}function Gt(c,s,h,p){if(!Ho(s,c.length))return NaN;for(let k=s[0];k<=s[1];++k)if(Ba(c[k],h,!0))return 0;let _=1/0;for(let k=s[0];k<s[1];++k){const S=c[k],T=c[k+1];for(const A of h)for(let B=0,z=A.length,L=z-1;B<z;L=B++){const j=A[L],q=A[B];if(cu(S,T,j,q))return 0;_=Math.min(_,dd(S,T,j,q,p))}}return _}function pu(c,s){for(const h of c)for(const p of h)if(Ba(p,s,!0))return!0;return!1}function On(c,s,h,p=1/0){const _=ud(c),k=ud(s);if(p!==1/0&&hd(_,k,h)>=p)return p;if(ps(_,k)){if(pu(c,s))return 0}else if(pu(s,c))return 0;let S=1/0;for(const T of c)for(let A=0,B=T.length,z=B-1;A<B;z=A++){const L=T[z],j=T[A];for(const q of s)for(let Y=0,K=q.length,re=K-1;Y<K;re=Y++){const ae=q[re],be=q[Y];if(cu(L,j,ae,be))return 0;S=Math.min(S,dd(L,j,ae,be,h))}}return S}function Tn(c,s,h,p,_,k){if(!k)return;const S=hd(cd(p,k),_,h);S<s&&c.push([S,k,[0,0]])}function Ws(c,s,h,p,_,k,S){if(!k||!S)return;const T=hd(cd(p,k),cd(_,S),h);T<s&&c.push([T,k,S])}function Ul(c,s,h,p,_=1/0){let k=Math.min(p.distance(c[0],h[0][0]),_);if(k===0)return k;const S=new um([[0,[0,c.length-1],[0,0]]],mm),T=ud(h);for(;S.length>0;){const A=S.pop();if(A[0]>=k)continue;const B=A[1],z=s?50:100;if(hu(B)<=z){if(!Ho(B,c.length))return NaN;if(s){const L=Gt(c,B,h,p);if(isNaN(L)||L===0)return L;k=Math.min(k,L)}else for(let L=B[0];L<=B[1];++L){const j=x_(c[L],h,p);if(k=Math.min(k,j),k===0)return 0}}else{const L=ld(B,s);Tn(S,k,p,c,T,L[0]),Tn(S,k,p,c,T,L[1])}}return k}function Hl(c,s,h,p,_,k=1/0){let S=Math.min(k,_.distance(c[0],h[0]));if(S===0)return S;const T=new um([[0,[0,c.length-1],[0,h.length-1]]],mm);for(;T.length>0;){const A=T.pop();if(A[0]>=S)continue;const B=A[1],z=A[2],L=s?50:100,j=p?50:100;if(hu(B)<=L&&hu(z)<=j){if(!Ho(B,c.length)&&Ho(z,h.length))return NaN;let q;if(s&&p)q=b_(c,B,h,z,_),S=Math.min(S,q);else if(s&&!p){const Y=c.slice(B[0],B[1]+1);for(let K=z[0];K<=z[1];++K)if(q=qs(h[K],Y,_),S=Math.min(S,q),S===0)return S}else if(!s&&p){const Y=h.slice(z[0],z[1]+1);for(let K=B[0];K<=B[1];++K)if(q=qs(c[K],Y,_),S=Math.min(S,q),S===0)return S}else q=Jn(c,B,h,z,_),S=Math.min(S,q)}else{const q=ld(B,s),Y=ld(z,p);Ws(T,S,_,c,h,q[0],Y[0]),Ws(T,S,_,c,h,q[0],Y[1]),Ws(T,S,_,c,h,q[1],Y[0]),Ws(T,S,_,c,h,q[1],Y[1])}}return S}function pd(c){return c.type==="MultiPolygon"?c.coordinates.map(s=>({type:"Polygon",coordinates:s})):c.type==="MultiLineString"?c.coordinates.map(s=>({type:"LineString",coordinates:s})):c.type==="MultiPoint"?c.coordinates.map(s=>({type:"Point",coordinates:s})):[c]}class Gs{constructor(s,h){this.type=Ze,this.geojson=s,this.geometries=h}static parse(s,h){if(s.length!==2)return h.error(`'distance' expression requires exactly one argument, but found ${s.length-1} instead.`);if(Fs(s[1])){const p=s[1];if(p.type==="FeatureCollection")return new Gs(p,p.features.map(_=>pd(_.geometry)).flat());if(p.type==="Feature")return new Gs(p,pd(p.geometry));if("type"in p&&"coordinates"in p)return new Gs(p,pd(p))}return h.error("'distance' expression requires valid geojson object that contains polygon geometry type.")}evaluate(s){if(s.geometry()!=null&&s.canonicalID()!=null){if(s.geometryType()==="Point")return function(h,p){const _=h.geometry(),k=_.flat().map(A=>od([A.x,A.y],h.canonical));if(_.length===0)return NaN;const S=new ad(k[0][1]);let T=1/0;for(const A of p){switch(A.type){case"Point":T=Math.min(T,Hl(k,!1,[A.coordinates],!1,S,T));break;case"LineString":T=Math.min(T,Hl(k,!1,A.coordinates,!0,S,T));break;case"Polygon":T=Math.min(T,Ul(k,!1,A.coordinates,S,T))}if(T===0)return T}return T}(s,this.geometries);if(s.geometryType()==="LineString")return function(h,p){const _=h.geometry(),k=_.flat().map(A=>od([A.x,A.y],h.canonical));if(_.length===0)return NaN;const S=new ad(k[0][1]);let T=1/0;for(const A of p){switch(A.type){case"Point":T=Math.min(T,Hl(k,!0,[A.coordinates],!1,S,T));break;case"LineString":T=Math.min(T,Hl(k,!0,A.coordinates,!0,S,T));break;case"Polygon":T=Math.min(T,Ul(k,!0,A.coordinates,S,T))}if(T===0)return T}return T}(s,this.geometries);if(s.geometryType()==="Polygon")return function(h,p){const _=h.geometry();if(_.length===0||_[0].length===0)return NaN;const k=uu(_,0).map(A=>A.map(B=>B.map(z=>od([z.x,z.y],h.canonical)))),S=new ad(k[0][0][0][1]);let T=1/0;for(const A of p)for(const B of k){switch(A.type){case"Point":T=Math.min(T,Ul([A.coordinates],!1,B,S,T));break;case"LineString":T=Math.min(T,Ul(A.coordinates,!0,B,S,T));break;case"Polygon":T=Math.min(T,On(B,A.coordinates,S,T))}if(T===0)return T}return T}(s,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}}const za={"==":l_,"!=":tm,">":c_,"<":nm,">=":im,"<=":u_,array:Qr,at:Qh,boolean:Qr,case:iu,coalesce:su,collator:$l,format:lu,image:id,in:ed,"index-of":Pa,interpolate:ir,"interpolate-hcl":ir,"interpolate-lab":ir,length:rd,let:ds,literal:Jr,match:td,number:Qr,"number-format":nd,object:Qr,slice:Vl,step:Da,string:Qr,"to-boolean":eo,"to-color":eo,"to-number":eo,"to-string":eo,var:fn,within:Hs,distance:Gs};class Rr{constructor(s,h,p,_){this.name=s,this.type=h,this._evaluate=p,this.args=_}evaluate(s){return this._evaluate(s,this.args)}eachChild(s){this.args.forEach(s)}outputDefined(){return!1}static parse(s,h){const p=s[0],_=Rr.definitions[p];if(!_)return h.error(`Unknown expression "${p}". If you wanted a literal array, use ["literal", [...]].`,0);const k=Array.isArray(_)?_[0]:_.type,S=Array.isArray(_)?[[_[1],_[2]]]:_.overloads,T=S.filter(([B])=>!Array.isArray(B)||B.length===s.length-1);let A=null;for(const[B,z]of T){A=new $s(h.registry,ql,h.path,null,h.scope);const L=[];let j=!1;for(let q=1;q<s.length;q++){const Y=s[q],K=Array.isArray(B)?B[q-1]:B.type,re=A.parse(Y,1+L.length,K);if(!re){j=!0;break}L.push(re)}if(!j)if(Array.isArray(B)&&B.length!==L.length)A.error(`Expected ${B.length} arguments, but found ${L.length} instead.`);else{for(let q=0;q<L.length;q++){const Y=Array.isArray(B)?B[q]:B.type,K=L[q];A.concat(q+1).checkSubtype(Y,K.type)}if(A.errors.length===0)return new Rr(p,k,z,L)}}if(T.length===1)h.errors.push(...A.errors);else{const B=(T.length?T:S).map(([L])=>{return j=L,Array.isArray(j)?`(${j.map(U).join(", ")})`:`(${U(j.type)}...)`;var j}).join(" | "),z=[];for(let L=1;L<s.length;L++){const j=h.parse(s[L],1+z.length);if(!j)return null;z.push(U(j.type))}h.error(`Expected arguments of type ${B}, but found (${z.join(", ")}) instead.`)}return null}static register(s,h){Rr.definitions=h;for(const p in h)s[p]=Rr}}function fd(c,[s,h,p,_]){s=s.evaluate(c),h=h.evaluate(c),p=p.evaluate(c);const k=_?_.evaluate(c):1,S=Ia(s,h,p,k);if(S)throw new ni(S);return new kn(s/255,h/255,p/255,k,!1)}function md(c,s){return c in s}function gd(c,s){const h=s[c];return h===void 0?null:h}function Zs(c){return{type:c}}function ql(c){if(c instanceof fn)return ql(c.boundExpression);if(c instanceof Rr&&c.name==="error"||c instanceof $l||c instanceof Hs||c instanceof Gs)return!1;const s=c instanceof eo||c instanceof Qr;let h=!0;return c.eachChild(p=>{h=s?h&&ql(p):h&&p instanceof Jr}),!!h&&Wl(c)&&Gl(c,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}function Wl(c){if(c instanceof Rr&&(c.name==="get"&&c.args.length===1||c.name==="feature-state"||c.name==="has"&&c.args.length===1||c.name==="properties"||c.name==="geometry-type"||c.name==="id"||/^filter-/.test(c.name))||c instanceof Hs||c instanceof Gs)return!1;let s=!0;return c.eachChild(h=>{s&&!Wl(h)&&(s=!1)}),s}function Na(c){if(c instanceof Rr&&c.name==="feature-state")return!1;let s=!0;return c.eachChild(h=>{s&&!Na(h)&&(s=!1)}),s}function Gl(c,s){if(c instanceof Rr&&s.indexOf(c.name)>=0)return!1;let h=!0;return c.eachChild(p=>{h&&!Gl(p,s)&&(h=!1)}),h}function fu(c){return{result:"success",value:c}}function Ra(c){return{result:"error",value:c}}function La(c){return c["property-type"]==="data-driven"||c["property-type"]==="cross-faded-data-driven"}function gm(c){return!!c.expression&&c.expression.parameters.indexOf("zoom")>-1}function yd(c){return!!c.expression&&c.expression.interpolated}function un(c){return c instanceof Number?"number":c instanceof String?"string":c instanceof Boolean?"boolean":Array.isArray(c)?"array":c===null?"null":typeof c}function mu(c){return typeof c=="object"&&c!==null&&!Array.isArray(c)}function v_(c){return c}function ym(c,s){const h=s.type==="color",p=c.stops&&typeof c.stops[0][0]=="object",_=p||!(p||c.property!==void 0),k=c.type||(yd(s)?"exponential":"interval");if(h||s.type==="padding"){const z=h?kn.parse:gr.parse;(c=Br({},c)).stops&&(c.stops=c.stops.map(L=>[L[0],z(L[1])])),c.default=z(c.default?c.default:s.default)}if(c.colorSpace&&(S=c.colorSpace)!=="rgb"&&S!=="hcl"&&S!=="lab")throw new Error(`Unknown color space: "${c.colorSpace}"`);var S;let T,A,B;if(k==="exponential")T=bm;else if(k==="interval")T=gu;else if(k==="categorical"){T=_m,A=Object.create(null);for(const z of c.stops)A[z[0]]=z[1];B=typeof c.stops[0][0]}else{if(k!=="identity")throw new Error(`Unknown function type "${k}"`);T=xm}if(p){const z={},L=[];for(let Y=0;Y<c.stops.length;Y++){const K=c.stops[Y],re=K[0].zoom;z[re]===void 0&&(z[re]={zoom:re,type:c.type,property:c.property,default:c.default,stops:[]},L.push(re)),z[re].stops.push([K[0].value,K[1]])}const j=[];for(const Y of L)j.push([z[Y].zoom,ym(z[Y],s)]);const q={name:"linear"};return{kind:"composite",interpolationType:q,interpolationFactor:ir.interpolationFactor.bind(void 0,q),zoomStops:j.map(Y=>Y[0]),evaluate:({zoom:Y},K)=>bm({stops:j,base:c.base},s,Y).evaluate(Y,K)}}if(_){const z=k==="exponential"?{name:"exponential",base:c.base!==void 0?c.base:1}:null;return{kind:"camera",interpolationType:z,interpolationFactor:ir.interpolationFactor.bind(void 0,z),zoomStops:c.stops.map(L=>L[0]),evaluate:({zoom:L})=>T(c,s,L,A,B)}}return{kind:"source",evaluate(z,L){const j=L&&L.properties?L.properties[c.property]:void 0;return j===void 0?Va(c.default,s.default):T(c,s,j,A,B)}}}function Va(c,s,h){return c!==void 0?c:s!==void 0?s:h!==void 0?h:void 0}function _m(c,s,h,p,_){return Va(typeof h===_?p[h]:void 0,c.default,s.default)}function gu(c,s,h){if(un(h)!=="number")return Va(c.default,s.default);const p=c.stops.length;if(p===1||h<=c.stops[0][0])return c.stops[0][1];if(h>=c.stops[p-1][0])return c.stops[p-1][1];const _=ru(c.stops.map(k=>k[0]),h);return c.stops[_][1]}function bm(c,s,h){const p=c.base!==void 0?c.base:1;if(un(h)!=="number")return Va(c.default,s.default);const _=c.stops.length;if(_===1||h<=c.stops[0][0])return c.stops[0][1];if(h>=c.stops[_-1][0])return c.stops[_-1][1];const k=ru(c.stops.map(z=>z[0]),h),S=function(z,L,j,q){const Y=q-j,K=z-j;return Y===0?0:L===1?K/Y:(Math.pow(L,K)-1)/(Math.pow(L,Y)-1)}(h,p,c.stops[k][0],c.stops[k+1][0]),T=c.stops[k][1],A=c.stops[k+1][1],B=nr[s.type]||v_;return typeof T.evaluate=="function"?{evaluate(...z){const L=T.evaluate.apply(void 0,z),j=A.evaluate.apply(void 0,z);if(L!==void 0&&j!==void 0)return B(L,j,S,c.colorSpace)}}:B(T,A,S,c.colorSpace)}function xm(c,s,h){switch(s.type){case"color":h=kn.parse(h);break;case"formatted":h=mr.fromString(h.toString());break;case"resolvedImage":h=yr.fromString(h.toString());break;case"padding":h=gr.parse(h);break;default:un(h)===s.type||s.type==="enum"&&s.values[h]||(h=void 0)}return Va(h,c.default,s.default)}Rr.register(za,{error:[{kind:"error"},[ke],(c,[s])=>{throw new ni(s.evaluate(c))}],typeof:[ke,[et],(c,[s])=>U(si(s.evaluate(c)))],"to-rgba":[H(Ze,4),[vt],(c,[s])=>{const[h,p,_,k]=s.evaluate(c).rgb;return[255*h,255*p,255*_,k]}],rgb:[vt,[Ze,Ze,Ze],fd],rgba:[vt,[Ze,Ze,Ze,Ze],fd],has:{type:Re,overloads:[[[ke],(c,[s])=>md(s.evaluate(c),c.properties())],[[ke,Wt],(c,[s,h])=>md(s.evaluate(c),h.evaluate(c))]]},get:{type:et,overloads:[[[ke],(c,[s])=>gd(s.evaluate(c),c.properties())],[[ke,Wt],(c,[s,h])=>gd(s.evaluate(c),h.evaluate(c))]]},"feature-state":[et,[ke],(c,[s])=>gd(s.evaluate(c),c.featureState||{})],properties:[Wt,[],c=>c.properties()],"geometry-type":[ke,[],c=>c.geometryType()],id:[et,[],c=>c.id()],zoom:[Ze,[],c=>c.globals.zoom],"heatmap-density":[Ze,[],c=>c.globals.heatmapDensity||0],"line-progress":[Ze,[],c=>c.globals.lineProgress||0],accumulated:[et,[],c=>c.globals.accumulated===void 0?null:c.globals.accumulated],"+":[Ze,Zs(Ze),(c,s)=>{let h=0;for(const p of s)h+=p.evaluate(c);return h}],"*":[Ze,Zs(Ze),(c,s)=>{let h=1;for(const p of s)h*=p.evaluate(c);return h}],"-":{type:Ze,overloads:[[[Ze,Ze],(c,[s,h])=>s.evaluate(c)-h.evaluate(c)],[[Ze],(c,[s])=>-s.evaluate(c)]]},"/":[Ze,[Ze,Ze],(c,[s,h])=>s.evaluate(c)/h.evaluate(c)],"%":[Ze,[Ze,Ze],(c,[s,h])=>s.evaluate(c)%h.evaluate(c)],ln2:[Ze,[],()=>Math.LN2],pi:[Ze,[],()=>Math.PI],e:[Ze,[],()=>Math.E],"^":[Ze,[Ze,Ze],(c,[s,h])=>Math.pow(s.evaluate(c),h.evaluate(c))],sqrt:[Ze,[Ze],(c,[s])=>Math.sqrt(s.evaluate(c))],log10:[Ze,[Ze],(c,[s])=>Math.log(s.evaluate(c))/Math.LN10],ln:[Ze,[Ze],(c,[s])=>Math.log(s.evaluate(c))],log2:[Ze,[Ze],(c,[s])=>Math.log(s.evaluate(c))/Math.LN2],sin:[Ze,[Ze],(c,[s])=>Math.sin(s.evaluate(c))],cos:[Ze,[Ze],(c,[s])=>Math.cos(s.evaluate(c))],tan:[Ze,[Ze],(c,[s])=>Math.tan(s.evaluate(c))],asin:[Ze,[Ze],(c,[s])=>Math.asin(s.evaluate(c))],acos:[Ze,[Ze],(c,[s])=>Math.acos(s.evaluate(c))],atan:[Ze,[Ze],(c,[s])=>Math.atan(s.evaluate(c))],min:[Ze,Zs(Ze),(c,s)=>Math.min(...s.map(h=>h.evaluate(c)))],max:[Ze,Zs(Ze),(c,s)=>Math.max(...s.map(h=>h.evaluate(c)))],abs:[Ze,[Ze],(c,[s])=>Math.abs(s.evaluate(c))],round:[Ze,[Ze],(c,[s])=>{const h=s.evaluate(c);return h<0?-Math.round(-h):Math.round(h)}],floor:[Ze,[Ze],(c,[s])=>Math.floor(s.evaluate(c))],ceil:[Ze,[Ze],(c,[s])=>Math.ceil(s.evaluate(c))],"filter-==":[Re,[ke,et],(c,[s,h])=>c.properties()[s.value]===h.value],"filter-id-==":[Re,[et],(c,[s])=>c.id()===s.value],"filter-type-==":[Re,[ke],(c,[s])=>c.geometryType()===s.value],"filter-<":[Re,[ke,et],(c,[s,h])=>{const p=c.properties()[s.value],_=h.value;return typeof p==typeof _&&p<_}],"filter-id-<":[Re,[et],(c,[s])=>{const h=c.id(),p=s.value;return typeof h==typeof p&&h<p}],"filter->":[Re,[ke,et],(c,[s,h])=>{const p=c.properties()[s.value],_=h.value;return typeof p==typeof _&&p>_}],"filter-id->":[Re,[et],(c,[s])=>{const h=c.id(),p=s.value;return typeof h==typeof p&&h>p}],"filter-<=":[Re,[ke,et],(c,[s,h])=>{const p=c.properties()[s.value],_=h.value;return typeof p==typeof _&&p<=_}],"filter-id-<=":[Re,[et],(c,[s])=>{const h=c.id(),p=s.value;return typeof h==typeof p&&h<=p}],"filter->=":[Re,[ke,et],(c,[s,h])=>{const p=c.properties()[s.value],_=h.value;return typeof p==typeof _&&p>=_}],"filter-id->=":[Re,[et],(c,[s])=>{const h=c.id(),p=s.value;return typeof h==typeof p&&h>=p}],"filter-has":[Re,[et],(c,[s])=>s.value in c.properties()],"filter-has-id":[Re,[],c=>c.id()!==null&&c.id()!==void 0],"filter-type-in":[Re,[H(ke)],(c,[s])=>s.value.indexOf(c.geometryType())>=0],"filter-id-in":[Re,[H(et)],(c,[s])=>s.value.indexOf(c.id())>=0],"filter-in-small":[Re,[ke,H(et)],(c,[s,h])=>h.value.indexOf(c.properties()[s.value])>=0],"filter-in-large":[Re,[ke,H(et)],(c,[s,h])=>function(p,_,k,S){for(;k<=S;){const T=k+S>>1;if(_[T]===p)return!0;_[T]>p?S=T-1:k=T+1}return!1}(c.properties()[s.value],h.value,0,h.value.length-1)],all:{type:Re,overloads:[[[Re,Re],(c,[s,h])=>s.evaluate(c)&&h.evaluate(c)],[Zs(Re),(c,s)=>{for(const h of s)if(!h.evaluate(c))return!1;return!0}]]},any:{type:Re,overloads:[[[Re,Re],(c,[s,h])=>s.evaluate(c)||h.evaluate(c)],[Zs(Re),(c,s)=>{for(const h of s)if(h.evaluate(c))return!0;return!1}]]},"!":[Re,[Re],(c,[s])=>!s.evaluate(c)],"is-supported-script":[Re,[ke],(c,[s])=>{const h=c.globals&&c.globals.isSupportedScript;return!h||h(s.evaluate(c))}],upcase:[ke,[ke],(c,[s])=>s.evaluate(c).toUpperCase()],downcase:[ke,[ke],(c,[s])=>s.evaluate(c).toLowerCase()],concat:[ke,Zs(et),(c,s)=>s.map(h=>Ll(h.evaluate(c))).join("")],"resolved-locale":[ke,[Ln],(c,[s])=>s.evaluate(c).resolvedLocale()]});class yu{constructor(s,h){var p;this.expression=s,this._warningHistory={},this._evaluator=new nu,this._defaultValue=h?(p=h).type==="color"&&mu(p.default)?new kn(0,0,0,0):p.type==="color"?kn.parse(p.default)||null:p.type==="padding"?gr.parse(p.default)||null:p.type==="variableAnchorOffsetCollection"?Nr.parse(p.default)||null:p.default===void 0?null:p.default:null,this._enumValues=h&&h.type==="enum"?h.values:null}evaluateWithoutErrorHandling(s,h,p,_,k,S){return this._evaluator.globals=s,this._evaluator.feature=h,this._evaluator.featureState=p,this._evaluator.canonical=_,this._evaluator.availableImages=k||null,this._evaluator.formattedSection=S,this.expression.evaluate(this._evaluator)}evaluate(s,h,p,_,k,S){this._evaluator.globals=s,this._evaluator.feature=h||null,this._evaluator.featureState=p||null,this._evaluator.canonical=_,this._evaluator.availableImages=k||null,this._evaluator.formattedSection=S||null;try{const T=this.expression.evaluate(this._evaluator);if(T==null||typeof T=="number"&&T!=T)return this._defaultValue;if(this._enumValues&&!(T in this._enumValues))throw new ni(`Expected value to be one of ${Object.keys(this._enumValues).map(A=>JSON.stringify(A)).join(", ")}, but found ${JSON.stringify(T)} instead.`);return T}catch(T){return this._warningHistory[T.message]||(this._warningHistory[T.message]=!0,typeof console<"u"&&console.warn(T.message)),this._defaultValue}}}function _u(c){return Array.isArray(c)&&c.length>0&&typeof c[0]=="string"&&c[0]in za}function Fa(c,s){const h=new $s(za,ql,[],s?function(_){const k={color:vt,string:ke,number:Ze,enum:ke,boolean:Re,formatted:Kn,padding:qi,resolvedImage:fr,variableAnchorOffsetCollection:se};return _.type==="array"?H(k[_.value]||et,_.length):k[_.type]}(s):void 0),p=h.parse(c,void 0,void 0,void 0,s&&s.type==="string"?{typeAnnotation:"coerce"}:void 0);return p?fu(new yu(p,s)):Ra(h.errors)}class $a{constructor(s,h){this.kind=s,this._styleExpression=h,this.isStateDependent=s!=="constant"&&!Na(h.expression)}evaluateWithoutErrorHandling(s,h,p,_,k,S){return this._styleExpression.evaluateWithoutErrorHandling(s,h,p,_,k,S)}evaluate(s,h,p,_,k,S){return this._styleExpression.evaluate(s,h,p,_,k,S)}}class ja{constructor(s,h,p,_){this.kind=s,this.zoomStops=p,this._styleExpression=h,this.isStateDependent=s!=="camera"&&!Na(h.expression),this.interpolationType=_}evaluateWithoutErrorHandling(s,h,p,_,k,S){return this._styleExpression.evaluateWithoutErrorHandling(s,h,p,_,k,S)}evaluate(s,h,p,_,k,S){return this._styleExpression.evaluate(s,h,p,_,k,S)}interpolationFactor(s,h,p){return this.interpolationType?ir.interpolationFactor(this.interpolationType,s,h,p):0}}function _d(c,s){const h=Fa(c,s);if(h.result==="error")return h;const p=h.value.expression,_=Wl(p);if(!_&&!La(s))return Ra([new wi("","data expressions not supported")]);const k=Gl(p,["zoom"]);if(!k&&!gm(s))return Ra([new wi("","zoom expressions not supported")]);const S=Zl(p);return S||k?S instanceof wi?Ra([S]):S instanceof ir&&!yd(s)?Ra([new wi("",'"interpolate" expressions cannot be used with this property')]):fu(S?new ja(_?"camera":"composite",h.value,S.labels,S instanceof ir?S.interpolation:void 0):new $a(_?"constant":"source",h.value)):Ra([new wi("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class Ua{constructor(s,h){this._parameters=s,this._specification=h,Br(this,ym(this._parameters,this._specification))}static deserialize(s){return new Ua(s._parameters,s._specification)}static serialize(s){return{_parameters:s._parameters,_specification:s._specification}}}function Zl(c){let s=null;if(c instanceof ds)s=Zl(c.result);else if(c instanceof su){for(const h of c.args)if(s=Zl(h),s)break}else(c instanceof Da||c instanceof ir)&&c.input instanceof Rr&&c.input.name==="zoom"&&(s=c);return s instanceof wi||c.eachChild(h=>{const p=Zl(h);p instanceof wi?s=p:!s&&p?s=new wi("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):s&&p&&s!==p&&(s=new wi("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),s}function bu(c){if(c===!0||c===!1)return!0;if(!Array.isArray(c)||c.length===0)return!1;switch(c[0]){case"has":return c.length>=2&&c[1]!=="$id"&&c[1]!=="$type";case"in":return c.length>=3&&(typeof c[1]!="string"||Array.isArray(c[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return c.length!==3||Array.isArray(c[1])||Array.isArray(c[2]);case"any":case"all":for(const s of c.slice(1))if(!bu(s)&&typeof s!="boolean")return!1;return!0;default:return!0}}const xu={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function bd(c){if(c==null)return{filter:()=>!0,needGeometry:!1};bu(c)||(c=vu(c));const s=Fa(c,xu);if(s.result==="error")throw new Error(s.value.map(h=>`${h.key}: ${h.message}`).join(", "));return{filter:(h,p,_)=>s.value.evaluate(h,p,{},_),needGeometry:vm(c)}}function w_(c,s){return c<s?-1:c>s?1:0}function vm(c){if(!Array.isArray(c))return!1;if(c[0]==="within"||c[0]==="distance")return!0;for(let s=1;s<c.length;s++)if(vm(c[s]))return!0;return!1}function vu(c){if(!c)return!0;const s=c[0];return c.length<=1?s!=="any":s==="=="?xd(c[1],c[2],"=="):s==="!="?Di(xd(c[1],c[2],"==")):s==="<"||s===">"||s==="<="||s===">="?xd(c[1],c[2],s):s==="any"?(h=c.slice(1),["any"].concat(h.map(vu))):s==="all"?["all"].concat(c.slice(1).map(vu)):s==="none"?["all"].concat(c.slice(1).map(vu).map(Di)):s==="in"?Yl(c[1],c.slice(2)):s==="!in"?Di(Yl(c[1],c.slice(2))):s==="has"?Xl(c[1]):s!=="!has"||Di(Xl(c[1]));var h}function xd(c,s,h){switch(c){case"$type":return[`filter-type-${h}`,s];case"$id":return[`filter-id-${h}`,s];default:return[`filter-${h}`,c,s]}}function Yl(c,s){if(s.length===0)return!1;switch(c){case"$type":return["filter-type-in",["literal",s]];case"$id":return["filter-id-in",["literal",s]];default:return s.length>200&&!s.some(h=>typeof h!=typeof s[0])?["filter-in-large",c,["literal",s.sort(w_)]]:["filter-in-small",c,["literal",s]]}}function Xl(c){switch(c){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",c]}}function Di(c){return["!",c]}function Ys(c){const s=typeof c;if(s==="number"||s==="boolean"||s==="string"||c==null)return JSON.stringify(c);if(Array.isArray(c)){let _="[";for(const k of c)_+=`${Ys(k)},`;return`${_}]`}const h=Object.keys(c).sort();let p="{";for(let _=0;_<h.length;_++)p+=`${JSON.stringify(h[_])}:${Ys(c[h[_]])},`;return`${p}}`}function wm(c){let s="";for(const h of yn)s+=`/${Ys(c[h])}`;return s}function km(c){const s=c.value;return s?[new Ve(c.key,s,"constants have been deprecated as of v8")]:[]}function Qn(c){return c instanceof Number||c instanceof String||c instanceof Boolean?c.valueOf():c}function to(c){if(Array.isArray(c))return c.map(to);if(c instanceof Object&&!(c instanceof Number||c instanceof String||c instanceof Boolean)){const s={};for(const h in c)s[h]=to(c[h]);return s}return Qn(c)}function _r(c){const s=c.key,h=c.value,p=c.valueSpec||{},_=c.objectElementValidators||{},k=c.style,S=c.styleSpec,T=c.validateSpec;let A=[];const B=un(h);if(B!=="object")return[new Ve(s,h,`object expected, ${B} found`)];for(const z in h){const L=z.split(".")[0],j=p[L]||p["*"];let q;if(_[L])q=_[L];else if(p[L])q=T;else if(_["*"])q=_["*"];else{if(!p["*"]){A.push(new Ve(s,h[z],`unknown property "${z}"`));continue}q=T}A=A.concat(q({key:(s&&`${s}.`)+z,value:h[z],valueSpec:j,style:k,styleSpec:S,object:h,objectKey:z,validateSpec:T},h))}for(const z in p)_[z]||p[z].required&&p[z].default===void 0&&h[z]===void 0&&A.push(new Ve(s,h,`missing required property "${z}"`));return A}function Kl(c){const s=c.value,h=c.valueSpec,p=c.style,_=c.styleSpec,k=c.key,S=c.arrayElementValidator||c.validateSpec;if(un(s)!=="array")return[new Ve(k,s,`array expected, ${un(s)} found`)];if(h.length&&s.length!==h.length)return[new Ve(k,s,`array length ${h.length} expected, length ${s.length} found`)];if(h["min-length"]&&s.length<h["min-length"])return[new Ve(k,s,`array length at least ${h["min-length"]} expected, length ${s.length} found`)];let T={type:h.value,values:h.values};_.$version<7&&(T.function=h.function),un(h.value)==="object"&&(T=h.value);let A=[];for(let B=0;B<s.length;B++)A=A.concat(S({array:s,arrayIndex:B,value:s[B],valueSpec:T,validateSpec:c.validateSpec,style:p,styleSpec:_,key:`${k}[${B}]`}));return A}function vd(c){const s=c.key,h=c.value,p=c.valueSpec;let _=un(h);return _==="number"&&h!=h&&(_="NaN"),_!=="number"?[new Ve(s,h,`number expected, ${_} found`)]:"minimum"in p&&h<p.minimum?[new Ve(s,h,`${h} is less than the minimum value ${p.minimum}`)]:"maximum"in p&&h>p.maximum?[new Ve(s,h,`${h} is greater than the maximum value ${p.maximum}`)]:[]}function wu(c){const s=c.valueSpec,h=Qn(c.value.type);let p,_,k,S={};const T=h!=="categorical"&&c.value.property===void 0,A=!T,B=un(c.value.stops)==="array"&&un(c.value.stops[0])==="array"&&un(c.value.stops[0][0])==="object",z=_r({key:c.key,value:c.value,valueSpec:c.styleSpec.function,validateSpec:c.validateSpec,style:c.style,styleSpec:c.styleSpec,objectElementValidators:{stops:function(q){if(h==="identity")return[new Ve(q.key,q.value,'identity function may not have a "stops" property')];let Y=[];const K=q.value;return Y=Y.concat(Kl({key:q.key,value:K,valueSpec:q.valueSpec,validateSpec:q.validateSpec,style:q.style,styleSpec:q.styleSpec,arrayElementValidator:L})),un(K)==="array"&&K.length===0&&Y.push(new Ve(q.key,K,"array must have at least one stop")),Y},default:function(q){return q.validateSpec({key:q.key,value:q.value,valueSpec:s,validateSpec:q.validateSpec,style:q.style,styleSpec:q.styleSpec})}}});return h==="identity"&&T&&z.push(new Ve(c.key,c.value,'missing required property "property"')),h==="identity"||c.value.stops||z.push(new Ve(c.key,c.value,'missing required property "stops"')),h==="exponential"&&c.valueSpec.expression&&!yd(c.valueSpec)&&z.push(new Ve(c.key,c.value,"exponential functions not supported")),c.styleSpec.$version>=8&&(A&&!La(c.valueSpec)?z.push(new Ve(c.key,c.value,"property functions not supported")):T&&!gm(c.valueSpec)&&z.push(new Ve(c.key,c.value,"zoom functions not supported"))),h!=="categorical"&&!B||c.value.property!==void 0||z.push(new Ve(c.key,c.value,'"property" property is required')),z;function L(q){let Y=[];const K=q.value,re=q.key;if(un(K)!=="array")return[new Ve(re,K,`array expected, ${un(K)} found`)];if(K.length!==2)return[new Ve(re,K,`array length 2 expected, length ${K.length} found`)];if(B){if(un(K[0])!=="object")return[new Ve(re,K,`object expected, ${un(K[0])} found`)];if(K[0].zoom===void 0)return[new Ve(re,K,"object stop key must have zoom")];if(K[0].value===void 0)return[new Ve(re,K,"object stop key must have value")];if(k&&k>Qn(K[0].zoom))return[new Ve(re,K[0].zoom,"stop zoom values must appear in ascending order")];Qn(K[0].zoom)!==k&&(k=Qn(K[0].zoom),_=void 0,S={}),Y=Y.concat(_r({key:`${re}[0]`,value:K[0],valueSpec:{zoom:{}},validateSpec:q.validateSpec,style:q.style,styleSpec:q.styleSpec,objectElementValidators:{zoom:vd,value:j}}))}else Y=Y.concat(j({key:`${re}[0]`,value:K[0],valueSpec:{},validateSpec:q.validateSpec,style:q.style,styleSpec:q.styleSpec},K));return _u(to(K[1]))?Y.concat([new Ve(`${re}[1]`,K[1],"expressions are not allowed in function stops.")]):Y.concat(q.validateSpec({key:`${re}[1]`,value:K[1],valueSpec:s,validateSpec:q.validateSpec,style:q.style,styleSpec:q.styleSpec}))}function j(q,Y){const K=un(q.value),re=Qn(q.value),ae=q.value!==null?q.value:Y;if(p){if(K!==p)return[new Ve(q.key,ae,`${K} stop domain type must match previous stop domain type ${p}`)]}else p=K;if(K!=="number"&&K!=="string"&&K!=="boolean")return[new Ve(q.key,ae,"stop domain value must be a number, string, or boolean")];if(K!=="number"&&h!=="categorical"){let be=`number expected, ${K} found`;return La(s)&&h===void 0&&(be+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new Ve(q.key,ae,be)]}return h!=="categorical"||K!=="number"||isFinite(re)&&Math.floor(re)===re?h!=="categorical"&&K==="number"&&_!==void 0&&re<_?[new Ve(q.key,ae,"stop domain values must appear in ascending order")]:(_=re,h==="categorical"&&re in S?[new Ve(q.key,ae,"stop domain values must be unique")]:(S[re]=!0,[])):[new Ve(q.key,ae,`integer expected, found ${re}`)]}}function Ha(c){const s=(c.expressionContext==="property"?_d:Fa)(to(c.value),c.valueSpec);if(s.result==="error")return s.value.map(p=>new Ve(`${c.key}${p.key}`,c.value,p.message));const h=s.value.expression||s.value._styleExpression.expression;if(c.expressionContext==="property"&&c.propertyKey==="text-font"&&!h.outputDefined())return[new Ve(c.key,c.value,`Invalid data expression for "${c.propertyKey}". Output values must be contained as literals within the expression.`)];if(c.expressionContext==="property"&&c.propertyType==="layout"&&!Na(h))return[new Ve(c.key,c.value,'"feature-state" data expressions are not supported with layout properties.')];if(c.expressionContext==="filter"&&!Na(h))return[new Ve(c.key,c.value,'"feature-state" data expressions are not supported with filters.')];if(c.expressionContext&&c.expressionContext.indexOf("cluster")===0){if(!Gl(h,["zoom","feature-state"]))return[new Ve(c.key,c.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(c.expressionContext==="cluster-initial"&&!Wl(h))return[new Ve(c.key,c.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function qo(c){const s=c.key,h=c.value,p=c.valueSpec,_=[];return Array.isArray(p.values)?p.values.indexOf(Qn(h))===-1&&_.push(new Ve(s,h,`expected one of [${p.values.join(", ")}], ${JSON.stringify(h)} found`)):Object.keys(p.values).indexOf(Qn(h))===-1&&_.push(new Ve(s,h,`expected one of [${Object.keys(p.values).join(", ")}], ${JSON.stringify(h)} found`)),_}function wd(c){return bu(to(c.value))?Ha(Br({},c,{expressionContext:"filter",valueSpec:{value:"boolean"}})):ku(c)}function ku(c){const s=c.value,h=c.key;if(un(s)!=="array")return[new Ve(h,s,`array expected, ${un(s)} found`)];const p=c.styleSpec;let _,k=[];if(s.length<1)return[new Ve(h,s,"filter array must have at least 1 element")];switch(k=k.concat(qo({key:`${h}[0]`,value:s[0],valueSpec:p.filter_operator,style:c.style,styleSpec:c.styleSpec})),Qn(s[0])){case"<":case"<=":case">":case">=":s.length>=2&&Qn(s[1])==="$type"&&k.push(new Ve(h,s,`"$type" cannot be use with operator "${s[0]}"`));case"==":case"!=":s.length!==3&&k.push(new Ve(h,s,`filter array for operator "${s[0]}" must have 3 elements`));case"in":case"!in":s.length>=2&&(_=un(s[1]),_!=="string"&&k.push(new Ve(`${h}[1]`,s[1],`string expected, ${_} found`)));for(let S=2;S<s.length;S++)_=un(s[S]),Qn(s[1])==="$type"?k=k.concat(qo({key:`${h}[${S}]`,value:s[S],valueSpec:p.geometry_type,style:c.style,styleSpec:c.styleSpec})):_!=="string"&&_!=="number"&&_!=="boolean"&&k.push(new Ve(`${h}[${S}]`,s[S],`string, number, or boolean expected, ${_} found`));break;case"any":case"all":case"none":for(let S=1;S<s.length;S++)k=k.concat(ku({key:`${h}[${S}]`,value:s[S],style:c.style,styleSpec:c.styleSpec}));break;case"has":case"!has":_=un(s[1]),s.length!==2?k.push(new Ve(h,s,`filter array for "${s[0]}" operator must have 2 elements`)):_!=="string"&&k.push(new Ve(`${h}[1]`,s[1],`string expected, ${_} found`))}return k}function kd(c,s){const h=c.key,p=c.validateSpec,_=c.style,k=c.styleSpec,S=c.value,T=c.objectKey,A=k[`${s}_${c.layerType}`];if(!A)return[];const B=T.match(/^(.*)-transition$/);if(s==="paint"&&B&&A[B[1]]&&A[B[1]].transition)return p({key:h,value:S,valueSpec:k.transition,style:_,styleSpec:k});const z=c.valueSpec||A[T];if(!z)return[new Ve(h,S,`unknown property "${T}"`)];let L;if(un(S)==="string"&&La(z)&&!z.tokens&&(L=/^{([^}]+)}$/.exec(S)))return[new Ve(h,S,`"${T}" does not support interpolation syntax
49
- Use an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(L[1])} }\`.`)];const j=[];return c.layerType==="symbol"&&(T==="text-field"&&_&&!_.glyphs&&j.push(new Ve(h,S,'use of "text-field" requires a style "glyphs" property')),T==="text-font"&&mu(to(S))&&Qn(S.type)==="identity"&&j.push(new Ve(h,S,'"text-font" does not support identity functions'))),j.concat(p({key:c.key,value:S,valueSpec:z,style:_,styleSpec:k,expressionContext:"property",propertyType:s,propertyKey:T}))}function Su(c){return kd(c,"paint")}function Sd(c){return kd(c,"layout")}function Ed(c){let s=[];const h=c.value,p=c.key,_=c.style,k=c.styleSpec;h.type||h.ref||s.push(new Ve(p,h,'either "type" or "ref" is required'));let S=Qn(h.type);const T=Qn(h.ref);if(h.id){const A=Qn(h.id);for(let B=0;B<c.arrayIndex;B++){const z=_.layers[B];Qn(z.id)===A&&s.push(new Ve(p,h.id,`duplicate layer id "${h.id}", previously used at line ${z.id.__line__}`))}}if("ref"in h){let A;["type","source","source-layer","filter","layout"].forEach(B=>{B in h&&s.push(new Ve(p,h[B],`"${B}" is prohibited for ref layers`))}),_.layers.forEach(B=>{Qn(B.id)===T&&(A=B)}),A?A.ref?s.push(new Ve(p,h.ref,"ref cannot reference another ref layer")):S=Qn(A.type):s.push(new Ve(p,h.ref,`ref layer "${T}" not found`))}else if(S!=="background")if(h.source){const A=_.sources&&_.sources[h.source],B=A&&Qn(A.type);A?B==="vector"&&S==="raster"?s.push(new Ve(p,h.source,`layer "${h.id}" requires a raster source`)):B!=="raster-dem"&&S==="hillshade"?s.push(new Ve(p,h.source,`layer "${h.id}" requires a raster-dem source`)):B==="raster"&&S!=="raster"?s.push(new Ve(p,h.source,`layer "${h.id}" requires a vector source`)):B!=="vector"||h["source-layer"]?B==="raster-dem"&&S!=="hillshade"?s.push(new Ve(p,h.source,"raster-dem source can only be used with layer type 'hillshade'.")):S!=="line"||!h.paint||!h.paint["line-gradient"]||B==="geojson"&&A.lineMetrics||s.push(new Ve(p,h,`layer "${h.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):s.push(new Ve(p,h,`layer "${h.id}" must specify a "source-layer"`)):s.push(new Ve(p,h.source,`source "${h.source}" not found`))}else s.push(new Ve(p,h,'missing required property "source"'));return s=s.concat(_r({key:p,value:h,valueSpec:k.layer,style:c.style,styleSpec:c.styleSpec,validateSpec:c.validateSpec,objectElementValidators:{"*":()=>[],type:()=>c.validateSpec({key:`${p}.type`,value:h.type,valueSpec:k.layer.type,style:c.style,styleSpec:c.styleSpec,validateSpec:c.validateSpec,object:h,objectKey:"type"}),filter:wd,layout:A=>_r({layer:h,key:A.key,value:A.value,style:A.style,styleSpec:A.styleSpec,validateSpec:A.validateSpec,objectElementValidators:{"*":B=>Sd(Br({layerType:S},B))}}),paint:A=>_r({layer:h,key:A.key,value:A.value,style:A.style,styleSpec:A.styleSpec,validateSpec:A.validateSpec,objectElementValidators:{"*":B=>Su(Br({layerType:S},B))}})}})),s}function Xs(c){const s=c.value,h=c.key,p=un(s);return p!=="string"?[new Ve(h,s,`string expected, ${p} found`)]:[]}const Eu={promoteId:function({key:c,value:s}){if(un(s)==="string")return Xs({key:c,value:s});{const h=[];for(const p in s)h.push(...Xs({key:`${c}.${p}`,value:s[p]}));return h}}};function Jl(c){const s=c.value,h=c.key,p=c.styleSpec,_=c.style,k=c.validateSpec;if(!s.type)return[new Ve(h,s,'"type" is required')];const S=Qn(s.type);let T;switch(S){case"vector":case"raster":return T=_r({key:h,value:s,valueSpec:p[`source_${S.replace("-","_")}`],style:c.style,styleSpec:p,objectElementValidators:Eu,validateSpec:k}),T;case"raster-dem":return T=function(A){var B;const z=(B=A.sourceName)!==null&&B!==void 0?B:"",L=A.value,j=A.styleSpec,q=j.source_raster_dem,Y=A.style;let K=[];const re=un(L);if(L===void 0)return K;if(re!=="object")return K.push(new Ve("source_raster_dem",L,`object expected, ${re} found`)),K;const ae=Qn(L.encoding)==="custom",be=["redFactor","greenFactor","blueFactor","baseShift"],pe=A.value.encoding?`"${A.value.encoding}"`:"Default";for(const ye in L)!ae&&be.includes(ye)?K.push(new Ve(ye,L[ye],`In "${z}": "${ye}" is only valid when "encoding" is set to "custom". ${pe} encoding found`)):q[ye]?K=K.concat(A.validateSpec({key:ye,value:L[ye],valueSpec:q[ye],validateSpec:A.validateSpec,style:Y,styleSpec:j})):K.push(new Ve(ye,L[ye],`unknown property "${ye}"`));return K}({sourceName:h,value:s,style:c.style,styleSpec:p,validateSpec:k}),T;case"geojson":if(T=_r({key:h,value:s,valueSpec:p.source_geojson,style:_,styleSpec:p,validateSpec:k,objectElementValidators:Eu}),s.cluster)for(const A in s.clusterProperties){const[B,z]=s.clusterProperties[A],L=typeof B=="string"?[B,["accumulated"],["get",A]]:B;T.push(...Ha({key:`${h}.${A}.map`,value:z,validateSpec:k,expressionContext:"cluster-map"})),T.push(...Ha({key:`${h}.${A}.reduce`,value:L,validateSpec:k,expressionContext:"cluster-reduce"}))}return T;case"video":return _r({key:h,value:s,valueSpec:p.source_video,style:_,validateSpec:k,styleSpec:p});case"image":return _r({key:h,value:s,valueSpec:p.source_image,style:_,validateSpec:k,styleSpec:p});case"canvas":return[new Ve(h,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return qo({key:`${h}.type`,value:s.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:_,validateSpec:k,styleSpec:p})}}function Cd(c){const s=c.value,h=c.styleSpec,p=h.light,_=c.style;let k=[];const S=un(s);if(s===void 0)return k;if(S!=="object")return k=k.concat([new Ve("light",s,`object expected, ${S} found`)]),k;for(const T in s){const A=T.match(/^(.*)-transition$/);k=k.concat(A&&p[A[1]]&&p[A[1]].transition?c.validateSpec({key:T,value:s[T],valueSpec:h.transition,validateSpec:c.validateSpec,style:_,styleSpec:h}):p[T]?c.validateSpec({key:T,value:s[T],valueSpec:p[T],validateSpec:c.validateSpec,style:_,styleSpec:h}):[new Ve(T,s[T],`unknown property "${T}"`)])}return k}function Td(c){const s=c.value,h=c.styleSpec,p=h.sky,_=c.style,k=un(s);if(s===void 0)return[];if(k!=="object")return[new Ve("sky",s,`object expected, ${k} found`)];let S=[];for(const T in s)S=S.concat(p[T]?c.validateSpec({key:T,value:s[T],valueSpec:p[T],style:_,styleSpec:h}):[new Ve(T,s[T],`unknown property "${T}"`)]);return S}function Md(c){const s=c.value,h=c.styleSpec,p=h.terrain,_=c.style;let k=[];const S=un(s);if(s===void 0)return k;if(S!=="object")return k=k.concat([new Ve("terrain",s,`object expected, ${S} found`)]),k;for(const T in s)k=k.concat(p[T]?c.validateSpec({key:T,value:s[T],valueSpec:p[T],validateSpec:c.validateSpec,style:_,styleSpec:h}):[new Ve(T,s[T],`unknown property "${T}"`)]);return k}function Ad(c){let s=[];const h=c.value,p=c.key;if(Array.isArray(h)){const _=[],k=[];for(const S in h)h[S].id&&_.includes(h[S].id)&&s.push(new Ve(p,h,`all the sprites' ids must be unique, but ${h[S].id} is duplicated`)),_.push(h[S].id),h[S].url&&k.includes(h[S].url)&&s.push(new Ve(p,h,`all the sprites' URLs must be unique, but ${h[S].url} is duplicated`)),k.push(h[S].url),s=s.concat(_r({key:`${p}[${S}]`,value:h[S],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:c.validateSpec}));return s}return Xs({key:p,value:h})}const Cu={"*":()=>[],array:Kl,boolean:function(c){const s=c.value,h=c.key,p=un(s);return p!=="boolean"?[new Ve(h,s,`boolean expected, ${p} found`)]:[]},number:vd,color:function(c){const s=c.key,h=c.value,p=un(h);return p!=="string"?[new Ve(s,h,`color expected, ${p} found`)]:kn.parse(String(h))?[]:[new Ve(s,h,`color expected, "${h}" found`)]},constants:km,enum:qo,filter:wd,function:wu,layer:Ed,object:_r,source:Jl,light:Cd,sky:Td,terrain:Md,projection:function(c){const s=c.value,h=c.styleSpec,p=h.projection,_=c.style,k=un(s);if(s===void 0)return[];if(k!=="object")return[new Ve("projection",s,`object expected, ${k} found`)];let S=[];for(const T in s)S=S.concat(p[T]?c.validateSpec({key:T,value:s[T],valueSpec:p[T],style:_,styleSpec:h}):[new Ve(T,s[T],`unknown property "${T}"`)]);return S},string:Xs,formatted:function(c){return Xs(c).length===0?[]:Ha(c)},resolvedImage:function(c){return Xs(c).length===0?[]:Ha(c)},padding:function(c){const s=c.key,h=c.value;if(un(h)==="array"){if(h.length<1||h.length>4)return[new Ve(s,h,`padding requires 1 to 4 values; ${h.length} values found`)];const p={type:"number"};let _=[];for(let k=0;k<h.length;k++)_=_.concat(c.validateSpec({key:`${s}[${k}]`,value:h[k],validateSpec:c.validateSpec,valueSpec:p}));return _}return vd({key:s,value:h,valueSpec:{}})},variableAnchorOffsetCollection:function(c){const s=c.key,h=c.value,p=un(h),_=c.styleSpec;if(p!=="array"||h.length<1||h.length%2!=0)return[new Ve(s,h,"variableAnchorOffsetCollection requires a non-empty array of even length")];let k=[];for(let S=0;S<h.length;S+=2)k=k.concat(qo({key:`${s}[${S}]`,value:h[S],valueSpec:_.layout_symbol["text-anchor"]})),k=k.concat(Kl({key:`${s}[${S+1}]`,value:h[S+1],valueSpec:{length:2,value:"number"},validateSpec:c.validateSpec,style:c.style,styleSpec:_}));return k},sprite:Ad};function qa(c){const s=c.value,h=c.valueSpec,p=c.styleSpec;return c.validateSpec=qa,h.expression&&mu(Qn(s))?wu(c):h.expression&&_u(to(s))?Ha(c):h.type&&Cu[h.type]?Cu[h.type](c):_r(Br({},c,{valueSpec:h.type?p[h.type]:h}))}function Sm(c){const s=c.value,h=c.key,p=Xs(c);return p.length||(s.indexOf("{fontstack}")===-1&&p.push(new Ve(h,s,'"glyphs" url must include a "{fontstack}" token')),s.indexOf("{range}")===-1&&p.push(new Ve(h,s,'"glyphs" url must include a "{range}" token'))),p}function Lr(c,s=we){let h=[];return h=h.concat(qa({key:"",value:c,valueSpec:s.$root,styleSpec:s,style:c,validateSpec:qa,objectElementValidators:{glyphs:Sm,"*":()=>[]}})),c.constants&&(h=h.concat(km({key:"constants",value:c.constants,style:c,styleSpec:s,validateSpec:qa}))),Id(h)}function Ao(c){return function(s){return c({...s,validateSpec:qa})}}function Id(c){return[].concat(c).sort((s,h)=>s.line-h.line)}function no(c){return function(...s){return Id(c.apply(this,s))}}Lr.source=no(Ao(Jl)),Lr.sprite=no(Ao(Ad)),Lr.glyphs=no(Ao(Sm)),Lr.light=no(Ao(Cd)),Lr.sky=no(Ao(Td)),Lr.terrain=no(Ao(Md)),Lr.layer=no(Ao(Ed)),Lr.filter=no(Ao(wd)),Lr.paintProperty=no(Ao(Su)),Lr.layoutProperty=no(Ao(Sd));const Ks=Lr,k_=Ks.light,S_=Ks.sky,Em=Ks.paintProperty,Cm=Ks.layoutProperty;function Pd(c,s){let h=!1;if(s&&s.length)for(const p of s)c.fire(new Mt(new Error(p.message))),h=!0;return h}class Wa{constructor(s,h,p){const _=this.cells=[];if(s instanceof ArrayBuffer){this.arrayBuffer=s;const S=new Int32Array(this.arrayBuffer);s=S[0],this.d=(h=S[1])+2*(p=S[2]);for(let A=0;A<this.d*this.d;A++){const B=S[3+A],z=S[3+A+1];_.push(B===z?null:S.subarray(B,z))}const T=S[3+_.length+1];this.keys=S.subarray(S[3+_.length],T),this.bboxes=S.subarray(T),this.insert=this._insertReadonly}else{this.d=h+2*p;for(let S=0;S<this.d*this.d;S++)_.push([]);this.keys=[],this.bboxes=[]}this.n=h,this.extent=s,this.padding=p,this.scale=h/s,this.uid=0;const k=p/h*s;this.min=-k,this.max=s+k}insert(s,h,p,_,k){this._forEachCell(h,p,_,k,this._insertCell,this.uid++,void 0,void 0),this.keys.push(s),this.bboxes.push(h),this.bboxes.push(p),this.bboxes.push(_),this.bboxes.push(k)}_insertReadonly(){throw new Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(s,h,p,_,k,S){this.cells[k].push(S)}query(s,h,p,_,k){const S=this.min,T=this.max;if(s<=S&&h<=S&&T<=p&&T<=_&&!k)return Array.prototype.slice.call(this.keys);{const A=[];return this._forEachCell(s,h,p,_,this._queryCell,A,{},k),A}}_queryCell(s,h,p,_,k,S,T,A){const B=this.cells[k];if(B!==null){const z=this.keys,L=this.bboxes;for(let j=0;j<B.length;j++){const q=B[j];if(T[q]===void 0){const Y=4*q;(A?A(L[Y+0],L[Y+1],L[Y+2],L[Y+3]):s<=L[Y+2]&&h<=L[Y+3]&&p>=L[Y+0]&&_>=L[Y+1])?(T[q]=!0,S.push(z[q])):T[q]=!1}}}}_forEachCell(s,h,p,_,k,S,T,A){const B=this._convertToCellCoord(s),z=this._convertToCellCoord(h),L=this._convertToCellCoord(p),j=this._convertToCellCoord(_);for(let q=B;q<=L;q++)for(let Y=z;Y<=j;Y++){const K=this.d*Y+q;if((!A||A(this._convertFromCellCoord(q),this._convertFromCellCoord(Y),this._convertFromCellCoord(q+1),this._convertFromCellCoord(Y+1)))&&k.call(this,s,h,p,_,K,S,T,A))return}}_convertFromCellCoord(s){return(s-this.padding)/this.scale}_convertToCellCoord(s){return Math.max(0,Math.min(this.d-1,Math.floor(s*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;const s=this.cells,h=3+this.cells.length+1+1;let p=0;for(let S=0;S<this.cells.length;S++)p+=this.cells[S].length;const _=new Int32Array(h+p+this.keys.length+this.bboxes.length);_[0]=this.extent,_[1]=this.n,_[2]=this.padding;let k=h;for(let S=0;S<s.length;S++){const T=s[S];_[3+S]=k,_.set(T,k),k+=T.length}return _[3+s.length]=k,_.set(this.keys,k),k+=this.keys.length,_[3+s.length+1]=k,_.set(this.bboxes,k),k+=this.bboxes.length,_.buffer}static serialize(s,h){const p=s.toArrayBuffer();return h&&h.push(p),{buffer:p}}static deserialize(s){return new Wa(s.buffer)}}const Vr={};function ut(c,s,h={}){if(Vr[c])throw new Error(`${c} is already registered.`);Object.defineProperty(s,"_classRegistryKey",{value:c,writeable:!1}),Vr[c]={klass:s,omit:h.omit||[],shallow:h.shallow||[]}}ut("Object",Object),ut("TransferableGridIndex",Wa),ut("Color",kn),ut("Error",Error),ut("AJAXError",Ce),ut("ResolvedImage",yr),ut("StylePropertyFunction",Ua),ut("StyleExpression",yu,{omit:["_evaluator"]}),ut("ZoomDependentExpression",ja),ut("ZoomConstantExpression",$a),ut("CompoundExpression",Rr,{omit:["_evaluate"]});for(const c in za)za[c]._classRegistryKey||ut(`Expression_${c}`,za[c]);function Tu(c){return c&&typeof ArrayBuffer<"u"&&(c instanceof ArrayBuffer||c.constructor&&c.constructor.name==="ArrayBuffer")}function Dd(c){return c.$name||c.constructor._classRegistryKey}function Tm(c){return!function(s){if(s===null||typeof s!="object")return!1;const h=Dd(s);return!(!h||h==="Object")}(c)&&(c==null||typeof c=="boolean"||typeof c=="number"||typeof c=="string"||c instanceof Boolean||c instanceof Number||c instanceof String||c instanceof Date||c instanceof RegExp||c instanceof Blob||c instanceof Error||Tu(c)||Ft(c)||ArrayBuffer.isView(c)||c instanceof ImageData)}function Ga(c,s){if(Tm(c))return(Tu(c)||Ft(c))&&s&&s.push(c),ArrayBuffer.isView(c)&&s&&s.push(c.buffer),c instanceof ImageData&&s&&s.push(c.data.buffer),c;if(Array.isArray(c)){const k=[];for(const S of c)k.push(Ga(S,s));return k}if(typeof c!="object")throw new Error("can't serialize object of type "+typeof c);const h=Dd(c);if(!h)throw new Error(`can't serialize object of unregistered class ${c.constructor.name}`);if(!Vr[h])throw new Error(`${h} is not registered.`);const{klass:p}=Vr[h],_=p.serialize?p.serialize(c,s):{};if(p.serialize){if(s&&_===s[s.length-1])throw new Error("statically serialized object won't survive transfer of $name property")}else{for(const k in c){if(!c.hasOwnProperty(k)||Vr[h].omit.indexOf(k)>=0)continue;const S=c[k];_[k]=Vr[h].shallow.indexOf(k)>=0?S:Ga(S,s)}c instanceof Error&&(_.message=c.message)}if(_.$name)throw new Error("$name property is reserved for worker serialization logic.");return h!=="Object"&&(_.$name=h),_}function Za(c){if(Tm(c))return c;if(Array.isArray(c))return c.map(Za);if(typeof c!="object")throw new Error("can't deserialize object of type "+typeof c);const s=Dd(c)||"Object";if(!Vr[s])throw new Error(`can't deserialize unregistered class ${s}`);const{klass:h}=Vr[s];if(!h)throw new Error(`can't deserialize unregistered class ${s}`);if(h.deserialize)return h.deserialize(c);const p=Object.create(h.prototype);for(const _ of Object.keys(c)){if(_==="$name")continue;const k=c[_];p[_]=Vr[s].shallow.indexOf(_)>=0?k:Za(k)}return p}class Od{constructor(){this.first=!0}update(s,h){const p=Math.floor(s);return this.first?(this.first=!1,this.lastIntegerZoom=p,this.lastIntegerZoomTime=0,this.lastZoom=s,this.lastFloorZoom=p,!0):(this.lastFloorZoom>p?(this.lastIntegerZoom=p+1,this.lastIntegerZoomTime=h):this.lastFloorZoom<p&&(this.lastIntegerZoom=p,this.lastIntegerZoomTime=h),s!==this.lastZoom&&(this.lastZoom=s,this.lastFloorZoom=p,!0))}}const en={"Latin-1 Supplement":c=>c>=128&&c<=255,"Hangul Jamo":c=>c>=4352&&c<=4607,Khmer:c=>c>=6016&&c<=6143,"General Punctuation":c=>c>=8192&&c<=8303,"Letterlike Symbols":c=>c>=8448&&c<=8527,"Number Forms":c=>c>=8528&&c<=8591,"Miscellaneous Technical":c=>c>=8960&&c<=9215,"Control Pictures":c=>c>=9216&&c<=9279,"Optical Character Recognition":c=>c>=9280&&c<=9311,"Enclosed Alphanumerics":c=>c>=9312&&c<=9471,"Geometric Shapes":c=>c>=9632&&c<=9727,"Miscellaneous Symbols":c=>c>=9728&&c<=9983,"Miscellaneous Symbols and Arrows":c=>c>=11008&&c<=11263,"Ideographic Description Characters":c=>c>=12272&&c<=12287,"CJK Symbols and Punctuation":c=>c>=12288&&c<=12351,Katakana:c=>c>=12448&&c<=12543,Kanbun:c=>c>=12688&&c<=12703,"CJK Strokes":c=>c>=12736&&c<=12783,"Enclosed CJK Letters and Months":c=>c>=12800&&c<=13055,"CJK Compatibility":c=>c>=13056&&c<=13311,"Yijing Hexagram Symbols":c=>c>=19904&&c<=19967,"Private Use Area":c=>c>=57344&&c<=63743,"Vertical Forms":c=>c>=65040&&c<=65055,"CJK Compatibility Forms":c=>c>=65072&&c<=65103,"Small Form Variants":c=>c>=65104&&c<=65135,"Halfwidth and Fullwidth Forms":c=>c>=65280&&c<=65519};function Bd(c){for(const s of c)if(Nd(s.charCodeAt(0)))return!0;return!1}function E_(c){for(const s of c)if(!Ya(s.charCodeAt(0)))return!1;return!0}function zd(c){const s=c.map(h=>{try{return new RegExp(`\\p{sc=${h}}`,"u").source}catch{return null}}).filter(h=>h);return new RegExp(s.join("|"),"u")}const C_=zd(["Arab","Dupl","Mong","Ougr","Syrc"]);function Ya(c){return!C_.test(String.fromCodePoint(c))}const Mm=zd(["Bopo","Hani","Hira","Kana","Kits","Nshu","Tang","Yiii"]);function Nd(c){return!(c!==746&&c!==747&&(c<4352||!(en["CJK Compatibility Forms"](c)&&!(c>=65097&&c<=65103)||en["CJK Compatibility"](c)||en["CJK Strokes"](c)||!(!en["CJK Symbols and Punctuation"](c)||c>=12296&&c<=12305||c>=12308&&c<=12319||c===12336)||en["Enclosed CJK Letters and Months"](c)||en["Ideographic Description Characters"](c)||en.Kanbun(c)||en.Katakana(c)&&c!==12540||!(!en["Halfwidth and Fullwidth Forms"](c)||c===65288||c===65289||c===65293||c>=65306&&c<=65310||c===65339||c===65341||c===65343||c>=65371&&c<=65503||c===65507||c>=65512&&c<=65519)||!(!en["Small Form Variants"](c)||c>=65112&&c<=65118||c>=65123&&c<=65126)||en["Vertical Forms"](c)||en["Yijing Hexagram Symbols"](c)||new RegExp("\\p{sc=Cans}","u").test(String.fromCodePoint(c))||new RegExp("\\p{sc=Hang}","u").test(String.fromCodePoint(c))||Mm.test(String.fromCodePoint(c)))))}function Am(c){return!(Nd(c)||function(s){return!!(en["Latin-1 Supplement"](s)&&(s===167||s===169||s===174||s===177||s===188||s===189||s===190||s===215||s===247)||en["General Punctuation"](s)&&(s===8214||s===8224||s===8225||s===8240||s===8241||s===8251||s===8252||s===8258||s===8263||s===8264||s===8265||s===8273)||en["Letterlike Symbols"](s)||en["Number Forms"](s)||en["Miscellaneous Technical"](s)&&(s>=8960&&s<=8967||s>=8972&&s<=8991||s>=8996&&s<=9e3||s===9003||s>=9085&&s<=9114||s>=9150&&s<=9165||s===9167||s>=9169&&s<=9179||s>=9186&&s<=9215)||en["Control Pictures"](s)&&s!==9251||en["Optical Character Recognition"](s)||en["Enclosed Alphanumerics"](s)||en["Geometric Shapes"](s)||en["Miscellaneous Symbols"](s)&&!(s>=9754&&s<=9759)||en["Miscellaneous Symbols and Arrows"](s)&&(s>=11026&&s<=11055||s>=11088&&s<=11097||s>=11192&&s<=11243)||en["CJK Symbols and Punctuation"](s)||en.Katakana(s)||en["Private Use Area"](s)||en["CJK Compatibility Forms"](s)||en["Small Form Variants"](s)||en["Halfwidth and Fullwidth Forms"](s)||s===8734||s===8756||s===8757||s>=9984&&s<=10087||s>=10102&&s<=10131||s===65532||s===65533)}(c))}const T_=zd(["Adlm","Arab","Armi","Avst","Chrs","Cprt","Egyp","Elym","Gara","Hatr","Hebr","Hung","Khar","Lydi","Mand","Mani","Mend","Merc","Mero","Narb","Nbat","Nkoo","Orkh","Palm","Phli","Phlp","Phnx","Prti","Rohg","Samr","Sarb","Sogo","Syrc","Thaa","Todr","Yezi"]);function Rd(c){return T_.test(String.fromCodePoint(c))}function M_(c,s){return!(!s&&Rd(c)||c>=2304&&c<=3583||c>=3840&&c<=4255||en.Khmer(c))}function A_(c){for(const s of c)if(Rd(s.charCodeAt(0)))return!0;return!1}const br=new class{constructor(){this.applyArabicShaping=null,this.processBidirectionalText=null,this.processStyledBidirectionalText=null,this.pluginStatus="unavailable",this.pluginURL=null}setState(c){this.pluginStatus=c.pluginStatus,this.pluginURL=c.pluginURL}getState(){return{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}}setMethods(c){this.applyArabicShaping=c.applyArabicShaping,this.processBidirectionalText=c.processBidirectionalText,this.processStyledBidirectionalText=c.processStyledBidirectionalText}isParsed(){return this.applyArabicShaping!=null&&this.processBidirectionalText!=null&&this.processStyledBidirectionalText!=null}getPluginURL(){return this.pluginURL}getRTLTextPluginStatus(){return this.pluginStatus}};class Vn{constructor(s,h){this.zoom=s,h?(this.now=h.now,this.fadeDuration=h.fadeDuration,this.zoomHistory=h.zoomHistory,this.transition=h.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new Od,this.transition={})}isSupportedScript(s){return function(h,p){for(const _ of h)if(!M_(_.charCodeAt(0),p))return!1;return!0}(s,br.getRTLTextPluginStatus()==="loaded")}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){const s=this.zoom,h=s-Math.floor(s),p=this.crossFadingFactor();return s>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:h+(1-h)*p}:{fromScale:.5,toScale:1,t:1-(1-p)*h}}}class Xa{constructor(s,h){this.property=s,this.value=h,this.expression=function(p,_){if(mu(p))return new Ua(p,_);if(_u(p)){const k=_d(p,_);if(k.result==="error")throw new Error(k.value.map(S=>`${S.key}: ${S.message}`).join(", "));return k.value}{let k=p;return _.type==="color"&&typeof p=="string"?k=kn.parse(p):_.type!=="padding"||typeof p!="number"&&!Array.isArray(p)?_.type==="variableAnchorOffsetCollection"&&Array.isArray(p)&&(k=Nr.parse(p)):k=gr.parse(p),{kind:"constant",evaluate:()=>k}}}(h===void 0?s.specification.default:h,s.specification)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(s,h,p){return this.property.possiblyEvaluate(this,s,h,p)}}class Mu{constructor(s){this.property=s,this.value=new Xa(s,void 0)}transitioned(s,h){return new Im(this.property,this.value,h,Se({},s.transition,this.transition),s.now)}untransitioned(){return new Im(this.property,this.value,null,{},0)}}class Au{constructor(s){this._properties=s,this._values=Object.create(s.defaultTransitionablePropertyValues)}getValue(s){return Xe(this._values[s].value.value)}setValue(s,h){Object.prototype.hasOwnProperty.call(this._values,s)||(this._values[s]=new Mu(this._values[s].property)),this._values[s].value=new Xa(this._values[s].property,h===null?void 0:Xe(h))}getTransition(s){return Xe(this._values[s].transition)}setTransition(s,h){Object.prototype.hasOwnProperty.call(this._values,s)||(this._values[s]=new Mu(this._values[s].property)),this._values[s].transition=Xe(h)||void 0}serialize(){const s={};for(const h of Object.keys(this._values)){const p=this.getValue(h);p!==void 0&&(s[h]=p);const _=this.getTransition(h);_!==void 0&&(s[`${h}-transition`]=_)}return s}transitioned(s,h){const p=new Ql(this._properties);for(const _ of Object.keys(this._values))p._values[_]=this._values[_].transitioned(s,h._values[_]);return p}untransitioned(){const s=new Ql(this._properties);for(const h of Object.keys(this._values))s._values[h]=this._values[h].untransitioned();return s}}class Im{constructor(s,h,p,_,k){this.property=s,this.value=h,this.begin=k+_.delay||0,this.end=this.begin+_.duration||0,s.specification.transition&&(_.delay||_.duration)&&(this.prior=p)}possiblyEvaluate(s,h,p){const _=s.now||0,k=this.value.possiblyEvaluate(s,h,p),S=this.prior;if(S){if(_>this.end)return this.prior=null,k;if(this.value.isDataDriven())return this.prior=null,k;if(_<this.begin)return S.possiblyEvaluate(s,h,p);{const T=(_-this.begin)/(this.end-this.begin);return this.property.interpolate(S.possiblyEvaluate(s,h,p),k,function(A){if(A<=0)return 0;if(A>=1)return 1;const B=A*A,z=B*A;return 4*(A<.5?z:3*(A-B)+z-.75)}(T))}}return k}}class Ql{constructor(s){this._properties=s,this._values=Object.create(s.defaultTransitioningPropertyValues)}possiblyEvaluate(s,h,p){const _=new tc(this._properties);for(const k of Object.keys(this._values))_._values[k]=this._values[k].possiblyEvaluate(s,h,p);return _}hasTransition(){for(const s of Object.keys(this._values))if(this._values[s].prior)return!0;return!1}}class ec{constructor(s){this._properties=s,this._values=Object.create(s.defaultPropertyValues)}hasValue(s){return this._values[s].value!==void 0}getValue(s){return Xe(this._values[s].value)}setValue(s,h){this._values[s]=new Xa(this._values[s].property,h===null?void 0:Xe(h))}serialize(){const s={};for(const h of Object.keys(this._values)){const p=this.getValue(h);p!==void 0&&(s[h]=p)}return s}possiblyEvaluate(s,h,p){const _=new tc(this._properties);for(const k of Object.keys(this._values))_._values[k]=this._values[k].possiblyEvaluate(s,h,p);return _}}class Io{constructor(s,h,p){this.property=s,this.value=h,this.parameters=p}isConstant(){return this.value.kind==="constant"}constantOr(s){return this.value.kind==="constant"?this.value.value:s}evaluate(s,h,p,_){return this.property.evaluate(this.value,this.parameters,s,h,p,_)}}class tc{constructor(s){this._properties=s,this._values=Object.create(s.defaultPossiblyEvaluatedValues)}get(s){return this._values[s]}}class ft{constructor(s){this.specification=s}possiblyEvaluate(s,h){if(s.isDataDriven())throw new Error("Value should not be data driven");return s.expression.evaluate(h)}interpolate(s,h,p){const _=nr[this.specification.type];return _?_(s,h,p):s}}class Et{constructor(s,h){this.specification=s,this.overrides=h}possiblyEvaluate(s,h,p,_){return new Io(this,s.expression.kind==="constant"||s.expression.kind==="camera"?{kind:"constant",value:s.expression.evaluate(h,null,{},p,_)}:s.expression,h)}interpolate(s,h,p){if(s.value.kind!=="constant"||h.value.kind!=="constant")return s;if(s.value.value===void 0||h.value.value===void 0)return new Io(this,{kind:"constant",value:void 0},s.parameters);const _=nr[this.specification.type];if(_){const k=_(s.value.value,h.value.value,p);return new Io(this,{kind:"constant",value:k},s.parameters)}return s}evaluate(s,h,p,_,k,S){return s.kind==="constant"?s.value:s.evaluate(h,p,_,k,S)}}class Iu extends Et{possiblyEvaluate(s,h,p,_){if(s.value===void 0)return new Io(this,{kind:"constant",value:void 0},h);if(s.expression.kind==="constant"){const k=s.expression.evaluate(h,null,{},p,_),S=s.property.specification.type==="resolvedImage"&&typeof k!="string"?k.name:k,T=this._calculate(S,S,S,h);return new Io(this,{kind:"constant",value:T},h)}if(s.expression.kind==="camera"){const k=this._calculate(s.expression.evaluate({zoom:h.zoom-1}),s.expression.evaluate({zoom:h.zoom}),s.expression.evaluate({zoom:h.zoom+1}),h);return new Io(this,{kind:"constant",value:k},h)}return new Io(this,s.expression,h)}evaluate(s,h,p,_,k,S){if(s.kind==="source"){const T=s.evaluate(h,p,_,k,S);return this._calculate(T,T,T,h)}return s.kind==="composite"?this._calculate(s.evaluate({zoom:Math.floor(h.zoom)-1},p,_),s.evaluate({zoom:Math.floor(h.zoom)},p,_),s.evaluate({zoom:Math.floor(h.zoom)+1},p,_),h):s.value}_calculate(s,h,p,_){return _.zoom>_.zoomHistory.lastIntegerZoom?{from:s,to:h}:{from:p,to:h}}interpolate(s){return s}}class Pu{constructor(s){this.specification=s}possiblyEvaluate(s,h,p,_){if(s.value!==void 0){if(s.expression.kind==="constant"){const k=s.expression.evaluate(h,null,{},p,_);return this._calculate(k,k,k,h)}return this._calculate(s.expression.evaluate(new Vn(Math.floor(h.zoom-1),h)),s.expression.evaluate(new Vn(Math.floor(h.zoom),h)),s.expression.evaluate(new Vn(Math.floor(h.zoom+1),h)),h)}}_calculate(s,h,p,_){return _.zoom>_.zoomHistory.lastIntegerZoom?{from:s,to:h}:{from:p,to:h}}interpolate(s){return s}}class Ld{constructor(s){this.specification=s}possiblyEvaluate(s,h,p,_){return!!s.expression.evaluate(h,null,{},p,_)}interpolate(){return!1}}class v{constructor(s){this.properties=s,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const h in s){const p=s[h];p.specification.overridable&&this.overridableProperties.push(h);const _=this.defaultPropertyValues[h]=new Xa(p,void 0),k=this.defaultTransitionablePropertyValues[h]=new Mu(p);this.defaultTransitioningPropertyValues[h]=k.untransitioned(),this.defaultPossiblyEvaluatedValues[h]=_.possiblyEvaluate({})}}}ut("DataDrivenProperty",Et),ut("DataConstantProperty",ft),ut("CrossFadedDataDrivenProperty",Iu),ut("CrossFadedProperty",Pu),ut("ColorRampProperty",Ld);const o="-transition";class d extends rn{constructor(s,h){if(super(),this.id=s.id,this.type=s.type,this._featureFilter={filter:()=>!0,needGeometry:!1},s.type!=="custom"&&(this.metadata=s.metadata,this.minzoom=s.minzoom,this.maxzoom=s.maxzoom,s.type!=="background"&&(this.source=s.source,this.sourceLayer=s["source-layer"],this.filter=s.filter),h.layout&&(this._unevaluatedLayout=new ec(h.layout)),h.paint)){this._transitionablePaint=new Au(h.paint);for(const p in s.paint)this.setPaintProperty(p,s.paint[p],{validate:!1});for(const p in s.layout)this.setLayoutProperty(p,s.layout[p],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new tc(h.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(s){return s==="visibility"?this.visibility:this._unevaluatedLayout.getValue(s)}setLayoutProperty(s,h,p={}){h!=null&&this._validate(Cm,`layers.${this.id}.layout.${s}`,s,h,p)||(s!=="visibility"?this._unevaluatedLayout.setValue(s,h):this.visibility=h)}getPaintProperty(s){return s.endsWith(o)?this._transitionablePaint.getTransition(s.slice(0,-11)):this._transitionablePaint.getValue(s)}setPaintProperty(s,h,p={}){if(h!=null&&this._validate(Em,`layers.${this.id}.paint.${s}`,s,h,p))return!1;if(s.endsWith(o))return this._transitionablePaint.setTransition(s.slice(0,-11),h||void 0),!1;{const _=this._transitionablePaint._values[s],k=_.property.specification["property-type"]==="cross-faded-data-driven",S=_.value.isDataDriven(),T=_.value;this._transitionablePaint.setValue(s,h),this._handleSpecialPaintPropertyUpdate(s);const A=this._transitionablePaint._values[s].value;return A.isDataDriven()||S||k||this._handleOverridablePaintPropertyUpdate(s,T,A)}}_handleSpecialPaintPropertyUpdate(s){}_handleOverridablePaintPropertyUpdate(s,h,p){return!1}isHidden(s){return!!(this.minzoom&&s<this.minzoom)||!!(this.maxzoom&&s>=this.maxzoom)||this.visibility==="none"}updateTransitions(s){this._transitioningPaint=this._transitionablePaint.transitioned(s,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(s,h){s.getCrossfadeParameters&&(this._crossfadeParameters=s.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(s,void 0,h)),this.paint=this._transitioningPaint.possiblyEvaluate(s,void 0,h)}serialize(){const s={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.visibility&&(s.layout=s.layout||{},s.layout.visibility=this.visibility),$e(s,(h,p)=>!(h===void 0||p==="layout"&&!Object.keys(h).length||p==="paint"&&!Object.keys(h).length))}_validate(s,h,p,_,k={}){return(!k||k.validate!==!1)&&Pd(this,s.call(Ks,{key:h,layerType:this.type,objectKey:p,value:_,styleSpec:we,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const s in this.paint._values){const h=this.paint.get(s);if(h instanceof Io&&La(h.property.specification)&&(h.value.kind==="source"||h.value.kind==="composite")&&h.value.isStateDependent)return!0}return!1}}const m={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class y{constructor(s,h){this._structArray=s,this._pos1=h*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class x{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(s,h){return s._trim(),h&&(s.isTransferred=!0,h.push(s.arrayBuffer)),{length:s.length,arrayBuffer:s.arrayBuffer}}static deserialize(s){const h=Object.create(this.prototype);return h.arrayBuffer=s.arrayBuffer,h.length=s.length,h.capacity=s.arrayBuffer.byteLength/h.bytesPerElement,h._refreshViews(),h}_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(s){this.reserve(s),this.length=s}reserve(s){if(s>this.capacity){this.capacity=Math.max(s,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const h=this.uint8;this._refreshViews(),h&&this.uint8.set(h)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function M(c,s=1){let h=0,p=0;return{members:c.map(_=>{const k=m[_.type].BYTES_PER_ELEMENT,S=h=I(h,Math.max(s,k)),T=_.components||1;return p=Math.max(p,k),h+=k*T,{name:_.name,type:_.type,components:T,offset:S}}),size:I(h,Math.max(p,s)),alignment:s}}function I(c,s){return Math.ceil(c/s)*s}class O extends x{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(s,h){const p=this.length;return this.resize(p+1),this.emplace(p,s,h)}emplace(s,h,p){const _=2*s;return this.int16[_+0]=h,this.int16[_+1]=p,s}}O.prototype.bytesPerElement=4,ut("StructArrayLayout2i4",O);class N extends x{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(s,h,p){const _=this.length;return this.resize(_+1),this.emplace(_,s,h,p)}emplace(s,h,p,_){const k=3*s;return this.int16[k+0]=h,this.int16[k+1]=p,this.int16[k+2]=_,s}}N.prototype.bytesPerElement=6,ut("StructArrayLayout3i6",N);class V extends x{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(s,h,p,_){const k=this.length;return this.resize(k+1),this.emplace(k,s,h,p,_)}emplace(s,h,p,_,k){const S=4*s;return this.int16[S+0]=h,this.int16[S+1]=p,this.int16[S+2]=_,this.int16[S+3]=k,s}}V.prototype.bytesPerElement=8,ut("StructArrayLayout4i8",V);class F extends x{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(s,h,p,_,k,S){const T=this.length;return this.resize(T+1),this.emplace(T,s,h,p,_,k,S)}emplace(s,h,p,_,k,S,T){const A=6*s;return this.int16[A+0]=h,this.int16[A+1]=p,this.int16[A+2]=_,this.int16[A+3]=k,this.int16[A+4]=S,this.int16[A+5]=T,s}}F.prototype.bytesPerElement=12,ut("StructArrayLayout2i4i12",F);class Z extends x{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(s,h,p,_,k,S){const T=this.length;return this.resize(T+1),this.emplace(T,s,h,p,_,k,S)}emplace(s,h,p,_,k,S,T){const A=4*s,B=8*s;return this.int16[A+0]=h,this.int16[A+1]=p,this.uint8[B+4]=_,this.uint8[B+5]=k,this.uint8[B+6]=S,this.uint8[B+7]=T,s}}Z.prototype.bytesPerElement=8,ut("StructArrayLayout2i4ub8",Z);class J extends x{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(s,h){const p=this.length;return this.resize(p+1),this.emplace(p,s,h)}emplace(s,h,p){const _=2*s;return this.float32[_+0]=h,this.float32[_+1]=p,s}}J.prototype.bytesPerElement=8,ut("StructArrayLayout2f8",J);class ee extends x{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(s,h,p,_,k,S,T,A,B,z){const L=this.length;return this.resize(L+1),this.emplace(L,s,h,p,_,k,S,T,A,B,z)}emplace(s,h,p,_,k,S,T,A,B,z,L){const j=10*s;return this.uint16[j+0]=h,this.uint16[j+1]=p,this.uint16[j+2]=_,this.uint16[j+3]=k,this.uint16[j+4]=S,this.uint16[j+5]=T,this.uint16[j+6]=A,this.uint16[j+7]=B,this.uint16[j+8]=z,this.uint16[j+9]=L,s}}ee.prototype.bytesPerElement=20,ut("StructArrayLayout10ui20",ee);class oe extends x{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(s,h,p,_,k,S,T,A,B,z,L,j){const q=this.length;return this.resize(q+1),this.emplace(q,s,h,p,_,k,S,T,A,B,z,L,j)}emplace(s,h,p,_,k,S,T,A,B,z,L,j,q){const Y=12*s;return this.int16[Y+0]=h,this.int16[Y+1]=p,this.int16[Y+2]=_,this.int16[Y+3]=k,this.uint16[Y+4]=S,this.uint16[Y+5]=T,this.uint16[Y+6]=A,this.uint16[Y+7]=B,this.int16[Y+8]=z,this.int16[Y+9]=L,this.int16[Y+10]=j,this.int16[Y+11]=q,s}}oe.prototype.bytesPerElement=24,ut("StructArrayLayout4i4ui4i24",oe);class le extends x{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(s,h,p){const _=this.length;return this.resize(_+1),this.emplace(_,s,h,p)}emplace(s,h,p,_){const k=3*s;return this.float32[k+0]=h,this.float32[k+1]=p,this.float32[k+2]=_,s}}le.prototype.bytesPerElement=12,ut("StructArrayLayout3f12",le);class ce extends x{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(s){const h=this.length;return this.resize(h+1),this.emplace(h,s)}emplace(s,h){return this.uint32[1*s+0]=h,s}}ce.prototype.bytesPerElement=4,ut("StructArrayLayout1ul4",ce);class he extends x{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(s,h,p,_,k,S,T,A,B){const z=this.length;return this.resize(z+1),this.emplace(z,s,h,p,_,k,S,T,A,B)}emplace(s,h,p,_,k,S,T,A,B,z){const L=10*s,j=5*s;return this.int16[L+0]=h,this.int16[L+1]=p,this.int16[L+2]=_,this.int16[L+3]=k,this.int16[L+4]=S,this.int16[L+5]=T,this.uint32[j+3]=A,this.uint16[L+8]=B,this.uint16[L+9]=z,s}}he.prototype.bytesPerElement=20,ut("StructArrayLayout6i1ul2ui20",he);class ne extends x{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(s,h,p,_,k,S){const T=this.length;return this.resize(T+1),this.emplace(T,s,h,p,_,k,S)}emplace(s,h,p,_,k,S,T){const A=6*s;return this.int16[A+0]=h,this.int16[A+1]=p,this.int16[A+2]=_,this.int16[A+3]=k,this.int16[A+4]=S,this.int16[A+5]=T,s}}ne.prototype.bytesPerElement=12,ut("StructArrayLayout2i2i2i12",ne);class me extends x{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(s,h,p,_,k){const S=this.length;return this.resize(S+1),this.emplace(S,s,h,p,_,k)}emplace(s,h,p,_,k,S){const T=4*s,A=8*s;return this.float32[T+0]=h,this.float32[T+1]=p,this.float32[T+2]=_,this.int16[A+6]=k,this.int16[A+7]=S,s}}me.prototype.bytesPerElement=16,ut("StructArrayLayout2f1f2i16",me);class ge extends x{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(s,h,p,_,k,S){const T=this.length;return this.resize(T+1),this.emplace(T,s,h,p,_,k,S)}emplace(s,h,p,_,k,S,T){const A=16*s,B=4*s,z=8*s;return this.uint8[A+0]=h,this.uint8[A+1]=p,this.float32[B+1]=_,this.float32[B+2]=k,this.int16[z+6]=S,this.int16[z+7]=T,s}}ge.prototype.bytesPerElement=16,ut("StructArrayLayout2ub2f2i16",ge);class xe extends x{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(s,h,p){const _=this.length;return this.resize(_+1),this.emplace(_,s,h,p)}emplace(s,h,p,_){const k=3*s;return this.uint16[k+0]=h,this.uint16[k+1]=p,this.uint16[k+2]=_,s}}xe.prototype.bytesPerElement=6,ut("StructArrayLayout3ui6",xe);class Be extends x{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(s,h,p,_,k,S,T,A,B,z,L,j,q,Y,K,re,ae){const be=this.length;return this.resize(be+1),this.emplace(be,s,h,p,_,k,S,T,A,B,z,L,j,q,Y,K,re,ae)}emplace(s,h,p,_,k,S,T,A,B,z,L,j,q,Y,K,re,ae,be){const pe=24*s,ye=12*s,Te=48*s;return this.int16[pe+0]=h,this.int16[pe+1]=p,this.uint16[pe+2]=_,this.uint16[pe+3]=k,this.uint32[ye+2]=S,this.uint32[ye+3]=T,this.uint32[ye+4]=A,this.uint16[pe+10]=B,this.uint16[pe+11]=z,this.uint16[pe+12]=L,this.float32[ye+7]=j,this.float32[ye+8]=q,this.uint8[Te+36]=Y,this.uint8[Te+37]=K,this.uint8[Te+38]=re,this.uint32[ye+10]=ae,this.int16[pe+22]=be,s}}Be.prototype.bytesPerElement=48,ut("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",Be);class Fe extends x{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(s,h,p,_,k,S,T,A,B,z,L,j,q,Y,K,re,ae,be,pe,ye,Te,Le,rt,St,tt,Je,yt,dt){const at=this.length;return this.resize(at+1),this.emplace(at,s,h,p,_,k,S,T,A,B,z,L,j,q,Y,K,re,ae,be,pe,ye,Te,Le,rt,St,tt,Je,yt,dt)}emplace(s,h,p,_,k,S,T,A,B,z,L,j,q,Y,K,re,ae,be,pe,ye,Te,Le,rt,St,tt,Je,yt,dt,at){const Oe=32*s,bt=16*s;return this.int16[Oe+0]=h,this.int16[Oe+1]=p,this.int16[Oe+2]=_,this.int16[Oe+3]=k,this.int16[Oe+4]=S,this.int16[Oe+5]=T,this.int16[Oe+6]=A,this.int16[Oe+7]=B,this.uint16[Oe+8]=z,this.uint16[Oe+9]=L,this.uint16[Oe+10]=j,this.uint16[Oe+11]=q,this.uint16[Oe+12]=Y,this.uint16[Oe+13]=K,this.uint16[Oe+14]=re,this.uint16[Oe+15]=ae,this.uint16[Oe+16]=be,this.uint16[Oe+17]=pe,this.uint16[Oe+18]=ye,this.uint16[Oe+19]=Te,this.uint16[Oe+20]=Le,this.uint16[Oe+21]=rt,this.uint16[Oe+22]=St,this.uint32[bt+12]=tt,this.float32[bt+13]=Je,this.float32[bt+14]=yt,this.uint16[Oe+30]=dt,this.uint16[Oe+31]=at,s}}Fe.prototype.bytesPerElement=64,ut("StructArrayLayout8i15ui1ul2f2ui64",Fe);class Qe extends x{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(s){const h=this.length;return this.resize(h+1),this.emplace(h,s)}emplace(s,h){return this.float32[1*s+0]=h,s}}Qe.prototype.bytesPerElement=4,ut("StructArrayLayout1f4",Qe);class st extends x{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(s,h,p){const _=this.length;return this.resize(_+1),this.emplace(_,s,h,p)}emplace(s,h,p,_){const k=3*s;return this.uint16[6*s+0]=h,this.float32[k+1]=p,this.float32[k+2]=_,s}}st.prototype.bytesPerElement=12,ut("StructArrayLayout1ui2f12",st);class Ye extends x{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(s,h,p){const _=this.length;return this.resize(_+1),this.emplace(_,s,h,p)}emplace(s,h,p,_){const k=4*s;return this.uint32[2*s+0]=h,this.uint16[k+2]=p,this.uint16[k+3]=_,s}}Ye.prototype.bytesPerElement=8,ut("StructArrayLayout1ul2ui8",Ye);class Ge extends x{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(s,h){const p=this.length;return this.resize(p+1),this.emplace(p,s,h)}emplace(s,h,p){const _=2*s;return this.uint16[_+0]=h,this.uint16[_+1]=p,s}}Ge.prototype.bytesPerElement=4,ut("StructArrayLayout2ui4",Ge);class mt extends x{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(s){const h=this.length;return this.resize(h+1),this.emplace(h,s)}emplace(s,h){return this.uint16[1*s+0]=h,s}}mt.prototype.bytesPerElement=2,ut("StructArrayLayout1ui2",mt);class Bt extends x{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(s,h,p,_){const k=this.length;return this.resize(k+1),this.emplace(k,s,h,p,_)}emplace(s,h,p,_,k){const S=4*s;return this.float32[S+0]=h,this.float32[S+1]=p,this.float32[S+2]=_,this.float32[S+3]=k,s}}Bt.prototype.bytesPerElement=16,ut("StructArrayLayout4f16",Bt);class Ke extends y{get anchorPointX(){return this._structArray.int16[this._pos2+0]}get anchorPointY(){return this._structArray.int16[this._pos2+1]}get x1(){return this._structArray.int16[this._pos2+2]}get y1(){return this._structArray.int16[this._pos2+3]}get x2(){return this._structArray.int16[this._pos2+4]}get y2(){return this._structArray.int16[this._pos2+5]}get featureIndex(){return this._structArray.uint32[this._pos4+3]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+8]}get bucketIndex(){return this._structArray.uint16[this._pos2+9]}get anchorPoint(){return new E(this.anchorPointX,this.anchorPointY)}}Ke.prototype.size=20;class nt extends he{get(s){return new Ke(this,s)}}ut("CollisionBoxArray",nt);class Dt extends y{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+2]}get numGlyphs(){return this._structArray.uint16[this._pos2+3]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+2]}get lineStartIndex(){return this._structArray.uint32[this._pos4+3]}get lineLength(){return this._structArray.uint32[this._pos4+4]}get segment(){return this._structArray.uint16[this._pos2+10]}get lowerSize(){return this._structArray.uint16[this._pos2+11]}get upperSize(){return this._structArray.uint16[this._pos2+12]}get lineOffsetX(){return this._structArray.float32[this._pos4+7]}get lineOffsetY(){return this._structArray.float32[this._pos4+8]}get writingMode(){return this._structArray.uint8[this._pos1+36]}get placedOrientation(){return this._structArray.uint8[this._pos1+37]}set placedOrientation(s){this._structArray.uint8[this._pos1+37]=s}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(s){this._structArray.uint8[this._pos1+38]=s}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(s){this._structArray.uint32[this._pos4+10]=s}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}}Dt.prototype.size=48;class Fn extends Be{get(s){return new Dt(this,s)}}ut("PlacedSymbolArray",Fn);class $t extends y{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+2]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+3]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+4]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+5]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+6]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+7]}get key(){return this._structArray.uint16[this._pos2+8]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+9]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+10]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+11]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+12]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+13]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+14]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+15]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+16]}get featureIndex(){return this._structArray.uint16[this._pos2+17]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+18]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+19]}get numIconVertices(){return this._structArray.uint16[this._pos2+20]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+21]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+22]}get crossTileID(){return this._structArray.uint32[this._pos4+12]}set crossTileID(s){this._structArray.uint32[this._pos4+12]=s}get textBoxScale(){return this._structArray.float32[this._pos4+13]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+14]}get textAnchorOffsetStartIndex(){return this._structArray.uint16[this._pos2+30]}get textAnchorOffsetEndIndex(){return this._structArray.uint16[this._pos2+31]}}$t.prototype.size=64;class Jt extends Fe{get(s){return new $t(this,s)}}ut("SymbolInstanceArray",Jt);class $n extends Qe{getoffsetX(s){return this.float32[1*s+0]}}ut("GlyphOffsetArray",$n);class Oi extends N{getx(s){return this.int16[3*s+0]}gety(s){return this.int16[3*s+1]}gettileUnitDistanceFromAnchor(s){return this.int16[3*s+2]}}ut("SymbolLineVertexArray",Oi);class io extends y{get textAnchor(){return this._structArray.uint16[this._pos2+0]}get textOffset0(){return this._structArray.float32[this._pos4+1]}get textOffset1(){return this._structArray.float32[this._pos4+2]}}io.prototype.size=12;class jn extends st{get(s){return new io(this,s)}}ut("TextAnchorOffsetArray",jn);class rr extends y{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]}}rr.prototype.size=8;class Gi extends Ye{get(s){return new rr(this,s)}}ut("FeatureIndexArray",Gi);class Bi extends O{}class Zi extends O{}class Po extends O{}class Ka extends F{}class Du extends Z{}class Ja extends J{}class Fr extends ee{}class Ou extends oe{}class Vd extends le{}class $r extends ce{}class jr extends ne{}class fs extends ge{}class ro extends xe{}class Si extends Ge{}const zi=M([{name:"a_pos",components:2,type:"Int16"}],4),{members:xr}=zi;class tn{constructor(s=[]){this.segments=s}prepareSegment(s,h,p,_){let k=this.segments[this.segments.length-1];return s>tn.MAX_VERTEX_ARRAY_LENGTH&&ot(`Max vertices per segment is ${tn.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${s}`),(!k||k.vertexLength+s>tn.MAX_VERTEX_ARRAY_LENGTH||k.sortKey!==_)&&(k={vertexOffset:h.length,primitiveOffset:p.length,vertexLength:0,primitiveLength:0},_!==void 0&&(k.sortKey=_),this.segments.push(k)),k}get(){return this.segments}destroy(){for(const s of this.segments)for(const h in s.vaos)s.vaos[h].destroy()}static simpleSegment(s,h,p,_){return new tn([{vertexOffset:s,primitiveOffset:h,vertexLength:p,primitiveLength:_,vaos:{},sortKey:0}])}}function Js(c,s){return 256*(c=Ie(Math.floor(c),0,255))+Ie(Math.floor(s),0,255)}tn.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,ut("SegmentVector",tn);const Qa=M([{name:"a_pattern_from",components:4,type:"Uint16"},{name:"a_pattern_to",components:4,type:"Uint16"},{name:"a_pixel_ratio_from",components:1,type:"Uint16"},{name:"a_pixel_ratio_to",components:1,type:"Uint16"}]);var el={exports:{}},Pm={exports:{}};Pm.exports=function(c,s){var h,p,_,k,S,T,A,B;for(p=c.length-(h=3&c.length),_=s,S=3432918353,T=461845907,B=0;B<p;)A=255&c.charCodeAt(B)|(255&c.charCodeAt(++B))<<8|(255&c.charCodeAt(++B))<<16|(255&c.charCodeAt(++B))<<24,++B,_=27492+(65535&(k=5*(65535&(_=(_^=A=(65535&(A=(A=(65535&A)*S+(((A>>>16)*S&65535)<<16)&4294967295)<<15|A>>>17))*T+(((A>>>16)*T&65535)<<16)&4294967295)<<13|_>>>19))+((5*(_>>>16)&65535)<<16)&4294967295))+((58964+(k>>>16)&65535)<<16);switch(A=0,h){case 3:A^=(255&c.charCodeAt(B+2))<<16;case 2:A^=(255&c.charCodeAt(B+1))<<8;case 1:_^=A=(65535&(A=(A=(65535&(A^=255&c.charCodeAt(B)))*S+(((A>>>16)*S&65535)<<16)&4294967295)<<15|A>>>17))*T+(((A>>>16)*T&65535)<<16)&4294967295}return _^=c.length,_=2246822507*(65535&(_^=_>>>16))+((2246822507*(_>>>16)&65535)<<16)&4294967295,_=3266489909*(65535&(_^=_>>>13))+((3266489909*(_>>>16)&65535)<<16)&4294967295,(_^=_>>>16)>>>0};var I_=Pm.exports,Dm={exports:{}};Dm.exports=function(c,s){for(var h,p=c.length,_=s^p,k=0;p>=4;)h=1540483477*(65535&(h=255&c.charCodeAt(k)|(255&c.charCodeAt(++k))<<8|(255&c.charCodeAt(++k))<<16|(255&c.charCodeAt(++k))<<24))+((1540483477*(h>>>16)&65535)<<16),_=1540483477*(65535&_)+((1540483477*(_>>>16)&65535)<<16)^(h=1540483477*(65535&(h^=h>>>24))+((1540483477*(h>>>16)&65535)<<16)),p-=4,++k;switch(p){case 3:_^=(255&c.charCodeAt(k+2))<<16;case 2:_^=(255&c.charCodeAt(k+1))<<8;case 1:_=1540483477*(65535&(_^=255&c.charCodeAt(k)))+((1540483477*(_>>>16)&65535)<<16)}return _=1540483477*(65535&(_^=_>>>13))+((1540483477*(_>>>16)&65535)<<16),(_^=_>>>15)>>>0};var ms=I_,Om=Dm.exports;el.exports=ms,el.exports.murmur3=ms,el.exports.murmur2=Om;var Bu=g(el.exports);class nc{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(s,h,p,_){this.ids.push(zu(s)),this.positions.push(h,p,_)}getPositions(s){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");const h=zu(s);let p=0,_=this.ids.length-1;for(;p<_;){const S=p+_>>1;this.ids[S]>=h?_=S:p=S+1}const k=[];for(;this.ids[p]===h;)k.push({index:this.positions[3*p],start:this.positions[3*p+1],end:this.positions[3*p+2]}),p++;return k}static serialize(s,h){const p=new Float64Array(s.ids),_=new Uint32Array(s.positions);return Nu(p,_,0,p.length-1),h&&h.push(p.buffer,_.buffer),{ids:p,positions:_}}static deserialize(s){const h=new nc;return h.ids=s.ids,h.positions=s.positions,h.indexed=!0,h}}function zu(c){const s=+c;return!isNaN(s)&&s<=Number.MAX_SAFE_INTEGER?s:Bu(String(c))}function Nu(c,s,h,p){for(;h<p;){const _=c[h+p>>1];let k=h-1,S=p+1;for(;;){do k++;while(c[k]<_);do S--;while(c[S]>_);if(k>=S)break;tl(c,k,S),tl(s,3*k,3*S),tl(s,3*k+1,3*S+1),tl(s,3*k+2,3*S+2)}S-h<p-S?(Nu(c,s,h,S),h=S+1):(Nu(c,s,S+1,p),p=S)}}function tl(c,s,h){const p=c[s];c[s]=c[h],c[h]=p}ut("FeaturePositionMap",nc);class ic{constructor(s,h){this.gl=s.gl,this.location=h}}class Bm extends ic{constructor(s,h){super(s,h),this.current=0}set(s){this.current!==s&&(this.current=s,this.gl.uniform1f(this.location,s))}}class qS extends ic{constructor(s,h){super(s,h),this.current=[0,0,0,0]}set(s){s[0]===this.current[0]&&s[1]===this.current[1]&&s[2]===this.current[2]&&s[3]===this.current[3]||(this.current=s,this.gl.uniform4f(this.location,s[0],s[1],s[2],s[3]))}}class WS extends ic{constructor(s,h){super(s,h),this.current=kn.transparent}set(s){s.r===this.current.r&&s.g===this.current.g&&s.b===this.current.b&&s.a===this.current.a||(this.current=s,this.gl.uniform4f(this.location,s.r,s.g,s.b,s.a))}}const eW=new Float32Array(16);function P_(c){return[Js(255*c.r,255*c.g),Js(255*c.b,255*c.a)]}class Fd{constructor(s,h,p){this.value=s,this.uniformNames=h.map(_=>`u_${_}`),this.type=p}setUniform(s,h,p){s.set(p.constantOr(this.value))}getBinding(s,h,p){return this.type==="color"?new WS(s,h):new Bm(s,h)}}class Ru{constructor(s,h){this.uniformNames=h.map(p=>`u_${p}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(s,h){this.pixelRatioFrom=h.pixelRatio,this.pixelRatioTo=s.pixelRatio,this.patternFrom=h.tlbr,this.patternTo=s.tlbr}setUniform(s,h,p,_){const k=_==="u_pattern_to"?this.patternTo:_==="u_pattern_from"?this.patternFrom:_==="u_pixel_ratio_to"?this.pixelRatioTo:_==="u_pixel_ratio_from"?this.pixelRatioFrom:null;k&&s.set(k)}getBinding(s,h,p){return p.substr(0,9)==="u_pattern"?new qS(s,h):new Bm(s,h)}}class Qs{constructor(s,h,p,_){this.expression=s,this.type=p,this.maxValue=0,this.paintVertexAttributes=h.map(k=>({name:`a_${k}`,type:"Float32",components:p==="color"?2:1,offset:0})),this.paintVertexArray=new _}populatePaintArray(s,h,p,_,k){const S=this.paintVertexArray.length,T=this.expression.evaluate(new Vn(0),h,{},_,[],k);this.paintVertexArray.resize(s),this._setPaintValue(S,s,T)}updatePaintArray(s,h,p,_){const k=this.expression.evaluate({zoom:0},p,_);this._setPaintValue(s,h,k)}_setPaintValue(s,h,p){if(this.type==="color"){const _=P_(p);for(let k=s;k<h;k++)this.paintVertexArray.emplace(k,_[0],_[1])}else{for(let _=s;_<h;_++)this.paintVertexArray.emplace(_,p);this.maxValue=Math.max(this.maxValue,Math.abs(p))}}upload(s){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=s.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class Wo{constructor(s,h,p,_,k,S){this.expression=s,this.uniformNames=h.map(T=>`u_${T}_t`),this.type=p,this.useIntegerZoom=_,this.zoom=k,this.maxValue=0,this.paintVertexAttributes=h.map(T=>({name:`a_${T}`,type:"Float32",components:p==="color"?4:2,offset:0})),this.paintVertexArray=new S}populatePaintArray(s,h,p,_,k){const S=this.expression.evaluate(new Vn(this.zoom),h,{},_,[],k),T=this.expression.evaluate(new Vn(this.zoom+1),h,{},_,[],k),A=this.paintVertexArray.length;this.paintVertexArray.resize(s),this._setPaintValue(A,s,S,T)}updatePaintArray(s,h,p,_){const k=this.expression.evaluate({zoom:this.zoom},p,_),S=this.expression.evaluate({zoom:this.zoom+1},p,_);this._setPaintValue(s,h,k,S)}_setPaintValue(s,h,p,_){if(this.type==="color"){const k=P_(p),S=P_(_);for(let T=s;T<h;T++)this.paintVertexArray.emplace(T,k[0],k[1],S[0],S[1])}else{for(let k=s;k<h;k++)this.paintVertexArray.emplace(k,p,_);this.maxValue=Math.max(this.maxValue,Math.abs(p),Math.abs(_))}}upload(s){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=s.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(s,h){const p=this.useIntegerZoom?Math.floor(h.zoom):h.zoom,_=Ie(this.expression.interpolationFactor(p,this.zoom,this.zoom+1),0,1);s.set(_)}getBinding(s,h,p){return new Bm(s,h)}}class nl{constructor(s,h,p,_,k,S){this.expression=s,this.type=h,this.useIntegerZoom=p,this.zoom=_,this.layerId=S,this.zoomInPaintVertexArray=new k,this.zoomOutPaintVertexArray=new k}populatePaintArray(s,h,p){const _=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(s),this.zoomOutPaintVertexArray.resize(s),this._setPaintValues(_,s,h.patterns&&h.patterns[this.layerId],p)}updatePaintArray(s,h,p,_,k){this._setPaintValues(s,h,p.patterns&&p.patterns[this.layerId],k)}_setPaintValues(s,h,p,_){if(!_||!p)return;const{min:k,mid:S,max:T}=p,A=_[k],B=_[S],z=_[T];if(A&&B&&z)for(let L=s;L<h;L++)this.zoomInPaintVertexArray.emplace(L,B.tl[0],B.tl[1],B.br[0],B.br[1],A.tl[0],A.tl[1],A.br[0],A.br[1],B.pixelRatio,A.pixelRatio),this.zoomOutPaintVertexArray.emplace(L,B.tl[0],B.tl[1],B.br[0],B.br[1],z.tl[0],z.tl[1],z.br[0],z.br[1],B.pixelRatio,z.pixelRatio)}upload(s){this.zoomInPaintVertexArray&&this.zoomInPaintVertexArray.arrayBuffer&&this.zoomOutPaintVertexArray&&this.zoomOutPaintVertexArray.arrayBuffer&&(this.zoomInPaintVertexBuffer=s.createVertexBuffer(this.zoomInPaintVertexArray,Qa.members,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=s.createVertexBuffer(this.zoomOutPaintVertexArray,Qa.members,this.expression.isStateDependent))}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}}class GS{constructor(s,h,p){this.binders={},this._buffers=[];const _=[];for(const k in s.paint._values){if(!p(k))continue;const S=s.paint.get(k);if(!(S instanceof Io&&La(S.property.specification)))continue;const T=tW(k,s.type),A=S.value,B=S.property.specification.type,z=S.property.useIntegerZoom,L=S.property.specification["property-type"],j=L==="cross-faded"||L==="cross-faded-data-driven";if(A.kind==="constant")this.binders[k]=j?new Ru(A.value,T):new Fd(A.value,T,B),_.push(`/u_${k}`);else if(A.kind==="source"||j){const q=ZS(k,B,"source");this.binders[k]=j?new nl(A,B,z,h,q,s.id):new Qs(A,T,B,q),_.push(`/a_${k}`)}else{const q=ZS(k,B,"composite");this.binders[k]=new Wo(A,T,B,z,h,q),_.push(`/z_${k}`)}}this.cacheKey=_.sort().join("")}getMaxValue(s){const h=this.binders[s];return h instanceof Qs||h instanceof Wo?h.maxValue:0}populatePaintArrays(s,h,p,_,k){for(const S in this.binders){const T=this.binders[S];(T instanceof Qs||T instanceof Wo||T instanceof nl)&&T.populatePaintArray(s,h,p,_,k)}}setConstantPatternPositions(s,h){for(const p in this.binders){const _=this.binders[p];_ instanceof Ru&&_.setConstantPatternPositions(s,h)}}updatePaintArrays(s,h,p,_,k){let S=!1;for(const T in s){const A=h.getPositions(T);for(const B of A){const z=p.feature(B.index);for(const L in this.binders){const j=this.binders[L];if((j instanceof Qs||j instanceof Wo||j instanceof nl)&&j.expression.isStateDependent===!0){const q=_.paint.get(L);j.expression=q.value,j.updatePaintArray(B.start,B.end,z,s[T],k),S=!0}}}}return S}defines(){const s=[];for(const h in this.binders){const p=this.binders[h];(p instanceof Fd||p instanceof Ru)&&s.push(...p.uniformNames.map(_=>`#define HAS_UNIFORM_${_}`))}return s}getBinderAttributes(){const s=[];for(const h in this.binders){const p=this.binders[h];if(p instanceof Qs||p instanceof Wo)for(let _=0;_<p.paintVertexAttributes.length;_++)s.push(p.paintVertexAttributes[_].name);else if(p instanceof nl)for(let _=0;_<Qa.members.length;_++)s.push(Qa.members[_].name)}return s}getBinderUniforms(){const s=[];for(const h in this.binders){const p=this.binders[h];if(p instanceof Fd||p instanceof Ru||p instanceof Wo)for(const _ of p.uniformNames)s.push(_)}return s}getPaintVertexBuffers(){return this._buffers}getUniforms(s,h){const p=[];for(const _ in this.binders){const k=this.binders[_];if(k instanceof Fd||k instanceof Ru||k instanceof Wo){for(const S of k.uniformNames)if(h[S]){const T=k.getBinding(s,h[S],S);p.push({name:S,property:_,binding:T})}}}return p}setUniforms(s,h,p,_){for(const{name:k,property:S,binding:T}of h)this.binders[S].setUniform(T,_,p.get(S),k)}updatePaintBuffers(s){this._buffers=[];for(const h in this.binders){const p=this.binders[h];if(s&&p instanceof nl){const _=s.fromScale===2?p.zoomInPaintVertexBuffer:p.zoomOutPaintVertexBuffer;_&&this._buffers.push(_)}else(p instanceof Qs||p instanceof Wo)&&p.paintVertexBuffer&&this._buffers.push(p.paintVertexBuffer)}}upload(s){for(const h in this.binders){const p=this.binders[h];(p instanceof Qs||p instanceof Wo||p instanceof nl)&&p.upload(s)}this.updatePaintBuffers()}destroy(){for(const s in this.binders){const h=this.binders[s];(h instanceof Qs||h instanceof Wo||h instanceof nl)&&h.destroy()}}}class rc{constructor(s,h,p=()=>!0){this.programConfigurations={};for(const _ of s)this.programConfigurations[_.id]=new GS(_,h,p);this.needsUpload=!1,this._featureMap=new nc,this._bufferOffset=0}populatePaintArrays(s,h,p,_,k,S){for(const T in this.programConfigurations)this.programConfigurations[T].populatePaintArrays(s,h,_,k,S);h.id!==void 0&&this._featureMap.add(h.id,p,this._bufferOffset,s),this._bufferOffset=s,this.needsUpload=!0}updatePaintArrays(s,h,p,_){for(const k of p)this.needsUpload=this.programConfigurations[k.id].updatePaintArrays(s,this._featureMap,h,k,_)||this.needsUpload}get(s){return this.programConfigurations[s]}upload(s){if(this.needsUpload){for(const h in this.programConfigurations)this.programConfigurations[h].upload(s);this.needsUpload=!1}}destroy(){for(const s in this.programConfigurations)this.programConfigurations[s].destroy()}}function tW(c,s){return{"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"line-gap-width":["gapwidth"],"line-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-extrusion-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"]}[c]||[c.replace(`${s}-`,"").replace(/-/g,"_")]}function ZS(c,s,h){const p={color:{source:J,composite:Bt},number:{source:Qe,composite:J}},_=function(k){return{"line-pattern":{source:Fr,composite:Fr},"fill-pattern":{source:Fr,composite:Fr},"fill-extrusion-pattern":{source:Fr,composite:Fr}}[k]}(c);return _&&_[h]||p[s][h]}ut("ConstantBinder",Fd),ut("CrossFadedConstantBinder",Ru),ut("SourceExpressionBinder",Qs),ut("CrossFadedCompositeBinder",nl),ut("CompositeExpressionBinder",Wo),ut("ProgramConfiguration",GS,{omit:["_buffers"]}),ut("ProgramConfigurationSet",rc);const ai=8192,D_=Math.pow(2,14)-1,YS=-D_-1;function oc(c){const s=ai/c.extent,h=c.loadGeometry();for(let p=0;p<h.length;p++){const _=h[p];for(let k=0;k<_.length;k++){const S=_[k],T=Math.round(S.x*s),A=Math.round(S.y*s);S.x=Ie(T,YS,D_),S.y=Ie(A,YS,D_),(T<S.x||T>S.x+1||A<S.y||A>S.y+1)&&ot("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return h}function sc(c,s){return{type:c.type,id:c.id,properties:c.properties,geometry:s?oc(c):[]}}function zm(c,s,h,p,_){c.emplaceBack(2*s+(p+1)/2,2*h+(_+1)/2)}class O_{constructor(s){this.zoom=s.zoom,this.overscaling=s.overscaling,this.layers=s.layers,this.layerIds=this.layers.map(h=>h.id),this.index=s.index,this.hasPattern=!1,this.layoutVertexArray=new Zi,this.indexArray=new ro,this.segments=new tn,this.programConfigurations=new rc(s.layers,s.zoom),this.stateDependentLayerIds=this.layers.filter(h=>h.isStateDependent()).map(h=>h.id)}populate(s,h,p){const _=this.layers[0],k=[];let S=null,T=!1;_.type==="circle"&&(S=_.layout.get("circle-sort-key"),T=!S.isConstant());for(const{feature:A,id:B,index:z,sourceLayerIndex:L}of s){const j=this.layers[0]._featureFilter.needGeometry,q=sc(A,j);if(!this.layers[0]._featureFilter.filter(new Vn(this.zoom),q,p))continue;const Y=T?S.evaluate(q,{},p):void 0,K={id:B,properties:A.properties,type:A.type,sourceLayerIndex:L,index:z,geometry:j?q.geometry:oc(A),patterns:{},sortKey:Y};k.push(K)}T&&k.sort((A,B)=>A.sortKey-B.sortKey);for(const A of k){const{geometry:B,index:z,sourceLayerIndex:L}=A,j=s[z].feature;this.addFeature(A,B,z,p),h.featureIndex.insert(j,B,z,L,this.index)}}update(s,h,p){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(s,h,this.stateDependentLayers,p)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(s){this.uploaded||(this.layoutVertexBuffer=s.createVertexBuffer(this.layoutVertexArray,xr),this.indexBuffer=s.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(s),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(s,h,p,_){for(const k of h)for(const S of k){const T=S.x,A=S.y;if(T<0||T>=ai||A<0||A>=ai)continue;const B=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,s.sortKey),z=B.vertexLength;zm(this.layoutVertexArray,T,A,-1,-1),zm(this.layoutVertexArray,T,A,1,-1),zm(this.layoutVertexArray,T,A,1,1),zm(this.layoutVertexArray,T,A,-1,1),this.indexArray.emplaceBack(z,z+1,z+2),this.indexArray.emplaceBack(z,z+3,z+2),B.vertexLength+=4,B.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,s,p,{},_)}}function XS(c,s){for(let h=0;h<c.length;h++)if(Lu(s,c[h]))return!0;for(let h=0;h<s.length;h++)if(Lu(c,s[h]))return!0;return!!B_(c,s)}function nW(c,s,h){return!!Lu(c,s)||!!z_(s,c,h)}function KS(c,s){if(c.length===1)return QS(s,c[0]);for(let h=0;h<s.length;h++){const p=s[h];for(let _=0;_<p.length;_++)if(Lu(c,p[_]))return!0}for(let h=0;h<c.length;h++)if(QS(s,c[h]))return!0;for(let h=0;h<s.length;h++)if(B_(c,s[h]))return!0;return!1}function iW(c,s,h){if(c.length>1){if(B_(c,s))return!0;for(let p=0;p<s.length;p++)if(z_(s[p],c,h))return!0}for(let p=0;p<c.length;p++)if(z_(c[p],s,h))return!0;return!1}function B_(c,s){if(c.length===0||s.length===0)return!1;for(let h=0;h<c.length-1;h++){const p=c[h],_=c[h+1];for(let k=0;k<s.length-1;k++)if(rW(p,_,s[k],s[k+1]))return!0}return!1}function rW(c,s,h,p){return Tt(c,h,p)!==Tt(s,h,p)&&Tt(c,s,h)!==Tt(c,s,p)}function z_(c,s,h){const p=h*h;if(s.length===1)return c.distSqr(s[0])<p;for(let _=1;_<s.length;_++)if(JS(c,s[_-1],s[_])<p)return!0;return!1}function JS(c,s,h){const p=s.distSqr(h);if(p===0)return c.distSqr(s);const _=((c.x-s.x)*(h.x-s.x)+(c.y-s.y)*(h.y-s.y))/p;return c.distSqr(_<0?s:_>1?h:h.sub(s)._mult(_)._add(s))}function QS(c,s){let h,p,_,k=!1;for(let S=0;S<c.length;S++){h=c[S];for(let T=0,A=h.length-1;T<h.length;A=T++)p=h[T],_=h[A],p.y>s.y!=_.y>s.y&&s.x<(_.x-p.x)*(s.y-p.y)/(_.y-p.y)+p.x&&(k=!k)}return k}function Lu(c,s){let h=!1;for(let p=0,_=c.length-1;p<c.length;_=p++){const k=c[p],S=c[_];k.y>s.y!=S.y>s.y&&s.x<(S.x-k.x)*(s.y-k.y)/(S.y-k.y)+k.x&&(h=!h)}return h}function oW(c,s,h){const p=h[0],_=h[2];if(c.x<p.x&&s.x<p.x||c.x>_.x&&s.x>_.x||c.y<p.y&&s.y<p.y||c.y>_.y&&s.y>_.y)return!1;const k=Tt(c,s,h[0]);return k!==Tt(c,s,h[1])||k!==Tt(c,s,h[2])||k!==Tt(c,s,h[3])}function $d(c,s,h){const p=s.paint.get(c).value;return p.kind==="constant"?p.value:h.programConfigurations.get(s.id).getMaxValue(c)}function Nm(c){return Math.sqrt(c[0]*c[0]+c[1]*c[1])}function Rm(c,s,h,p,_){if(!s[0]&&!s[1])return c;const k=E.convert(s)._mult(_);h==="viewport"&&k._rotate(-p);const S=[];for(let T=0;T<c.length;T++)S.push(c[T].sub(k));return S}let eE,tE;ut("CircleBucket",O_,{omit:["layers"]});var sW={get paint(){return tE=tE||new v({"circle-radius":new Et(we.paint_circle["circle-radius"]),"circle-color":new Et(we.paint_circle["circle-color"]),"circle-blur":new Et(we.paint_circle["circle-blur"]),"circle-opacity":new Et(we.paint_circle["circle-opacity"]),"circle-translate":new ft(we.paint_circle["circle-translate"]),"circle-translate-anchor":new ft(we.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new ft(we.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new ft(we.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new Et(we.paint_circle["circle-stroke-width"]),"circle-stroke-color":new Et(we.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new Et(we.paint_circle["circle-stroke-opacity"])})},get layout(){return eE=eE||new v({"circle-sort-key":new Et(we.layout_circle["circle-sort-key"])})}},or=1e-6,Vu=typeof Float32Array<"u"?Float32Array:Array;function N_(c){return c[0]=1,c[1]=0,c[2]=0,c[3]=0,c[4]=0,c[5]=1,c[6]=0,c[7]=0,c[8]=0,c[9]=0,c[10]=1,c[11]=0,c[12]=0,c[13]=0,c[14]=0,c[15]=1,c}function nE(c,s,h){var p=s[0],_=s[1],k=s[2],S=s[3],T=s[4],A=s[5],B=s[6],z=s[7],L=s[8],j=s[9],q=s[10],Y=s[11],K=s[12],re=s[13],ae=s[14],be=s[15],pe=h[0],ye=h[1],Te=h[2],Le=h[3];return c[0]=pe*p+ye*T+Te*L+Le*K,c[1]=pe*_+ye*A+Te*j+Le*re,c[2]=pe*k+ye*B+Te*q+Le*ae,c[3]=pe*S+ye*z+Te*Y+Le*be,c[4]=(pe=h[4])*p+(ye=h[5])*T+(Te=h[6])*L+(Le=h[7])*K,c[5]=pe*_+ye*A+Te*j+Le*re,c[6]=pe*k+ye*B+Te*q+Le*ae,c[7]=pe*S+ye*z+Te*Y+Le*be,c[8]=(pe=h[8])*p+(ye=h[9])*T+(Te=h[10])*L+(Le=h[11])*K,c[9]=pe*_+ye*A+Te*j+Le*re,c[10]=pe*k+ye*B+Te*q+Le*ae,c[11]=pe*S+ye*z+Te*Y+Le*be,c[12]=(pe=h[12])*p+(ye=h[13])*T+(Te=h[14])*L+(Le=h[15])*K,c[13]=pe*_+ye*A+Te*j+Le*re,c[14]=pe*k+ye*B+Te*q+Le*ae,c[15]=pe*S+ye*z+Te*Y+Le*be,c}Math.hypot||(Math.hypot=function(){for(var c=0,s=arguments.length;s--;)c+=arguments[s]*arguments[s];return Math.sqrt(c)});var jd,aW=nE;function Lm(c,s,h){var p=s[0],_=s[1],k=s[2],S=s[3];return c[0]=h[0]*p+h[4]*_+h[8]*k+h[12]*S,c[1]=h[1]*p+h[5]*_+h[9]*k+h[13]*S,c[2]=h[2]*p+h[6]*_+h[10]*k+h[14]*S,c[3]=h[3]*p+h[7]*_+h[11]*k+h[15]*S,c}jd=new Vu(4),Vu!=Float32Array&&(jd[0]=0,jd[1]=0,jd[2]=0,jd[3]=0);class lW extends d{constructor(s){super(s,sW)}createBucket(s){return new O_(s)}queryRadius(s){const h=s;return $d("circle-radius",this,h)+$d("circle-stroke-width",this,h)+Nm(this.paint.get("circle-translate"))}queryIntersectsFeature(s,h,p,_,k,S,T,A){const B=Rm(s,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),S.angle,T),z=this.paint.get("circle-radius").evaluate(h,p)+this.paint.get("circle-stroke-width").evaluate(h,p),L=this.paint.get("circle-pitch-alignment")==="map",j=L?B:function(Y,K){return Y.map(re=>iE(re,K))}(B,A),q=L?z*T:z;for(const Y of _)for(const K of Y){const re=L?K:iE(K,A);let ae=q;const be=Lm([],[K.x,K.y,0,1],A);if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?ae*=be[3]/S.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(ae*=S.cameraToCenterDistance/be[3]),nW(j,re,ae))return!0}return!1}}function iE(c,s){const h=Lm([],[c.x,c.y,0,1],s);return new E(h[0]/h[3],h[1]/h[3])}class rE extends O_{}let oE;ut("HeatmapBucket",rE,{omit:["layers"]});var cW={get paint(){return oE=oE||new v({"heatmap-radius":new Et(we.paint_heatmap["heatmap-radius"]),"heatmap-weight":new Et(we.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new ft(we.paint_heatmap["heatmap-intensity"]),"heatmap-color":new Ld(we.paint_heatmap["heatmap-color"]),"heatmap-opacity":new ft(we.paint_heatmap["heatmap-opacity"])})}};function R_(c,{width:s,height:h},p,_){if(_){if(_ instanceof Uint8ClampedArray)_=new Uint8Array(_.buffer);else if(_.length!==s*h*p)throw new RangeError(`mismatched image size. expected: ${_.length} but got: ${s*h*p}`)}else _=new Uint8Array(s*h*p);return c.width=s,c.height=h,c.data=_,c}function sE(c,{width:s,height:h},p){if(s===c.width&&h===c.height)return;const _=R_({},{width:s,height:h},p);L_(c,_,{x:0,y:0},{x:0,y:0},{width:Math.min(c.width,s),height:Math.min(c.height,h)},p),c.width=s,c.height=h,c.data=_.data}function L_(c,s,h,p,_,k){if(_.width===0||_.height===0)return s;if(_.width>c.width||_.height>c.height||h.x>c.width-_.width||h.y>c.height-_.height)throw new RangeError("out of range source coordinates for image copy");if(_.width>s.width||_.height>s.height||p.x>s.width-_.width||p.y>s.height-_.height)throw new RangeError("out of range destination coordinates for image copy");const S=c.data,T=s.data;if(S===T)throw new Error("srcData equals dstData, so image is already copied");for(let A=0;A<_.height;A++){const B=((h.y+A)*c.width+h.x)*k,z=((p.y+A)*s.width+p.x)*k;for(let L=0;L<_.width*k;L++)T[z+L]=S[B+L]}return s}class Ud{constructor(s,h){R_(this,s,1,h)}resize(s){sE(this,s,1)}clone(){return new Ud({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(s,h,p,_,k){L_(s,h,p,_,k,1)}}class oo{constructor(s,h){R_(this,s,4,h)}resize(s){sE(this,s,4)}replace(s,h){h?this.data.set(s):this.data=s instanceof Uint8ClampedArray?new Uint8Array(s.buffer):s}clone(){return new oo({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(s,h,p,_,k){L_(s,h,p,_,k,4)}}function aE(c){const s={},h=c.resolution||256,p=c.clips?c.clips.length:1,_=c.image||new oo({width:h,height:p});if(Math.log(h)/Math.LN2%1!=0)throw new Error(`width is not a power of 2 - ${h}`);const k=(S,T,A)=>{s[c.evaluationKey]=A;const B=c.expression.evaluate(s);_.data[S+T+0]=Math.floor(255*B.r/B.a),_.data[S+T+1]=Math.floor(255*B.g/B.a),_.data[S+T+2]=Math.floor(255*B.b/B.a),_.data[S+T+3]=Math.floor(255*B.a)};if(c.clips)for(let S=0,T=0;S<p;++S,T+=4*h)for(let A=0,B=0;A<h;A++,B+=4){const z=A/(h-1),{start:L,end:j}=c.clips[S];k(T,B,L*(1-z)+j*z)}else for(let S=0,T=0;S<h;S++,T+=4)k(0,T,S/(h-1));return _}ut("AlphaImage",Ud),ut("RGBAImage",oo);const V_="big-fb";class uW extends d{createBucket(s){return new rE(s)}constructor(s){super(s,cW),this.heatmapFbos=new Map,this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(s){s==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=aE({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbos.has(V_)&&this.heatmapFbos.delete(V_)}queryRadius(){return 0}queryIntersectsFeature(){return!1}hasOffscreenPass(){return this.paint.get("heatmap-opacity")!==0&&this.visibility!=="none"}}let lE;var hW={get paint(){return lE=lE||new v({"hillshade-illumination-direction":new ft(we.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new ft(we.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new ft(we.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new ft(we.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new ft(we.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new ft(we.paint_hillshade["hillshade-accent-color"])})}};class dW extends d{constructor(s){super(s,hW)}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&this.visibility!=="none"}}const pW=M([{name:"a_pos",components:2,type:"Int16"}],4),{members:fW}=pW;function cE(c,s,h=2){const p=s&&s.length,_=p?s[0]*h:c.length;let k=uE(c,0,_,h,!0);const S=[];if(!k||k.next===k.prev)return S;let T,A,B;if(p&&(k=function(z,L,j,q){const Y=[];for(let K=0,re=L.length;K<re;K++){const ae=uE(z,L[K]*q,K<re-1?L[K+1]*q:z.length,q,!1);ae===ae.next&&(ae.steiner=!0),Y.push(wW(ae))}Y.sort(bW);for(let K=0;K<Y.length;K++)j=xW(Y[K],j);return j}(c,s,k,h)),c.length>80*h){T=1/0,A=1/0;let z=-1/0,L=-1/0;for(let j=h;j<_;j+=h){const q=c[j],Y=c[j+1];q<T&&(T=q),Y<A&&(A=Y),q>z&&(z=q),Y>L&&(L=Y)}B=Math.max(z-T,L-A),B=B!==0?32767/B:0}return Hd(k,S,h,T,A,B,0),S}function uE(c,s,h,p,_){let k;if(_===function(S,T,A,B){let z=0;for(let L=T,j=A-B;L<A;L+=B)z+=(S[j]-S[L])*(S[L+1]+S[j+1]),j=L;return z}(c,s,h,p)>0)for(let S=s;S<h;S+=p)k=pE(S/p|0,c[S],c[S+1],k);else for(let S=h-p;S>=s;S-=p)k=pE(S/p|0,c[S],c[S+1],k);return k&&Vm(k,k.next)&&(Wd(k),k=k.next),k}function ac(c,s){if(!c)return c;s||(s=c);let h,p=c;do if(h=!1,p.steiner||!Vm(p,p.next)&&ii(p.prev,p,p.next)!==0)p=p.next;else{if(Wd(p),p=s=p.prev,p===p.next)break;h=!0}while(h||p!==s);return s}function Hd(c,s,h,p,_,k,S){if(!c)return;!S&&k&&function(A,B,z,L){let j=A;do j.z===0&&(j.z=F_(j.x,j.y,B,z,L)),j.prevZ=j.prev,j.nextZ=j.next,j=j.next;while(j!==A);j.prevZ.nextZ=null,j.prevZ=null,function(q){let Y,K=1;do{let re,ae=q;q=null;let be=null;for(Y=0;ae;){Y++;let pe=ae,ye=0;for(let Le=0;Le<K&&(ye++,pe=pe.nextZ,pe);Le++);let Te=K;for(;ye>0||Te>0&&pe;)ye!==0&&(Te===0||!pe||ae.z<=pe.z)?(re=ae,ae=ae.nextZ,ye--):(re=pe,pe=pe.nextZ,Te--),be?be.nextZ=re:q=re,re.prevZ=be,be=re;ae=pe}be.nextZ=null,K*=2}while(Y>1)}(j)}(c,p,_,k);let T=c;for(;c.prev!==c.next;){const A=c.prev,B=c.next;if(k?gW(c,p,_,k):mW(c))s.push(A.i,c.i,B.i),Wd(c),c=B.next,T=B.next;else if((c=B)===T){S?S===1?Hd(c=yW(ac(c),s),s,h,p,_,k,2):S===2&&_W(c,s,h,p,_,k):Hd(ac(c),s,h,p,_,k,1);break}}}function mW(c){const s=c.prev,h=c,p=c.next;if(ii(s,h,p)>=0)return!1;const _=s.x,k=h.x,S=p.x,T=s.y,A=h.y,B=p.y,z=_<k?_<S?_:S:k<S?k:S,L=T<A?T<B?T:B:A<B?A:B,j=_>k?_>S?_:S:k>S?k:S,q=T>A?T>B?T:B:A>B?A:B;let Y=p.next;for(;Y!==s;){if(Y.x>=z&&Y.x<=j&&Y.y>=L&&Y.y<=q&&Fu(_,T,k,A,S,B,Y.x,Y.y)&&ii(Y.prev,Y,Y.next)>=0)return!1;Y=Y.next}return!0}function gW(c,s,h,p){const _=c.prev,k=c,S=c.next;if(ii(_,k,S)>=0)return!1;const T=_.x,A=k.x,B=S.x,z=_.y,L=k.y,j=S.y,q=T<A?T<B?T:B:A<B?A:B,Y=z<L?z<j?z:j:L<j?L:j,K=T>A?T>B?T:B:A>B?A:B,re=z>L?z>j?z:j:L>j?L:j,ae=F_(q,Y,s,h,p),be=F_(K,re,s,h,p);let pe=c.prevZ,ye=c.nextZ;for(;pe&&pe.z>=ae&&ye&&ye.z<=be;){if(pe.x>=q&&pe.x<=K&&pe.y>=Y&&pe.y<=re&&pe!==_&&pe!==S&&Fu(T,z,A,L,B,j,pe.x,pe.y)&&ii(pe.prev,pe,pe.next)>=0||(pe=pe.prevZ,ye.x>=q&&ye.x<=K&&ye.y>=Y&&ye.y<=re&&ye!==_&&ye!==S&&Fu(T,z,A,L,B,j,ye.x,ye.y)&&ii(ye.prev,ye,ye.next)>=0))return!1;ye=ye.nextZ}for(;pe&&pe.z>=ae;){if(pe.x>=q&&pe.x<=K&&pe.y>=Y&&pe.y<=re&&pe!==_&&pe!==S&&Fu(T,z,A,L,B,j,pe.x,pe.y)&&ii(pe.prev,pe,pe.next)>=0)return!1;pe=pe.prevZ}for(;ye&&ye.z<=be;){if(ye.x>=q&&ye.x<=K&&ye.y>=Y&&ye.y<=re&&ye!==_&&ye!==S&&Fu(T,z,A,L,B,j,ye.x,ye.y)&&ii(ye.prev,ye,ye.next)>=0)return!1;ye=ye.nextZ}return!0}function yW(c,s){let h=c;do{const p=h.prev,_=h.next.next;!Vm(p,_)&&hE(p,h,h.next,_)&&qd(p,_)&&qd(_,p)&&(s.push(p.i,h.i,_.i),Wd(h),Wd(h.next),h=c=_),h=h.next}while(h!==c);return ac(h)}function _W(c,s,h,p,_,k){let S=c;do{let T=S.next.next;for(;T!==S.prev;){if(S.i!==T.i&&kW(S,T)){let A=dE(S,T);return S=ac(S,S.next),A=ac(A,A.next),Hd(S,s,h,p,_,k,0),void Hd(A,s,h,p,_,k,0)}T=T.next}S=S.next}while(S!==c)}function bW(c,s){return c.x-s.x}function xW(c,s){const h=function(_,k){let S=k;const T=_.x,A=_.y;let B,z=-1/0;do{if(A<=S.y&&A>=S.next.y&&S.next.y!==S.y){const K=S.x+(A-S.y)*(S.next.x-S.x)/(S.next.y-S.y);if(K<=T&&K>z&&(z=K,B=S.x<S.next.x?S:S.next,K===T))return B}S=S.next}while(S!==k);if(!B)return null;const L=B,j=B.x,q=B.y;let Y=1/0;S=B;do{if(T>=S.x&&S.x>=j&&T!==S.x&&Fu(A<q?T:z,A,j,q,A<q?z:T,A,S.x,S.y)){const K=Math.abs(A-S.y)/(T-S.x);qd(S,_)&&(K<Y||K===Y&&(S.x>B.x||S.x===B.x&&vW(B,S)))&&(B=S,Y=K)}S=S.next}while(S!==L);return B}(c,s);if(!h)return s;const p=dE(h,c);return ac(p,p.next),ac(h,h.next)}function vW(c,s){return ii(c.prev,c,s.prev)<0&&ii(s.next,c,c.next)<0}function F_(c,s,h,p,_){return(c=1431655765&((c=858993459&((c=252645135&((c=16711935&((c=(c-h)*_|0)|c<<8))|c<<4))|c<<2))|c<<1))|(s=1431655765&((s=858993459&((s=252645135&((s=16711935&((s=(s-p)*_|0)|s<<8))|s<<4))|s<<2))|s<<1))<<1}function wW(c){let s=c,h=c;do(s.x<h.x||s.x===h.x&&s.y<h.y)&&(h=s),s=s.next;while(s!==c);return h}function Fu(c,s,h,p,_,k,S,T){return(_-S)*(s-T)>=(c-S)*(k-T)&&(c-S)*(p-T)>=(h-S)*(s-T)&&(h-S)*(k-T)>=(_-S)*(p-T)}function kW(c,s){return c.next.i!==s.i&&c.prev.i!==s.i&&!function(h,p){let _=h;do{if(_.i!==h.i&&_.next.i!==h.i&&_.i!==p.i&&_.next.i!==p.i&&hE(_,_.next,h,p))return!0;_=_.next}while(_!==h);return!1}(c,s)&&(qd(c,s)&&qd(s,c)&&function(h,p){let _=h,k=!1;const S=(h.x+p.x)/2,T=(h.y+p.y)/2;do _.y>T!=_.next.y>T&&_.next.y!==_.y&&S<(_.next.x-_.x)*(T-_.y)/(_.next.y-_.y)+_.x&&(k=!k),_=_.next;while(_!==h);return k}(c,s)&&(ii(c.prev,c,s.prev)||ii(c,s.prev,s))||Vm(c,s)&&ii(c.prev,c,c.next)>0&&ii(s.prev,s,s.next)>0)}function ii(c,s,h){return(s.y-c.y)*(h.x-s.x)-(s.x-c.x)*(h.y-s.y)}function Vm(c,s){return c.x===s.x&&c.y===s.y}function hE(c,s,h,p){const _=$m(ii(c,s,h)),k=$m(ii(c,s,p)),S=$m(ii(h,p,c)),T=$m(ii(h,p,s));return _!==k&&S!==T||!(_!==0||!Fm(c,h,s))||!(k!==0||!Fm(c,p,s))||!(S!==0||!Fm(h,c,p))||!(T!==0||!Fm(h,s,p))}function Fm(c,s,h){return s.x<=Math.max(c.x,h.x)&&s.x>=Math.min(c.x,h.x)&&s.y<=Math.max(c.y,h.y)&&s.y>=Math.min(c.y,h.y)}function $m(c){return c>0?1:c<0?-1:0}function qd(c,s){return ii(c.prev,c,c.next)<0?ii(c,s,c.next)>=0&&ii(c,c.prev,s)>=0:ii(c,s,c.prev)<0||ii(c,c.next,s)<0}function dE(c,s){const h=$_(c.i,c.x,c.y),p=$_(s.i,s.x,s.y),_=c.next,k=s.prev;return c.next=s,s.prev=c,h.next=_,_.prev=h,p.next=h,h.prev=p,k.next=p,p.prev=k,p}function pE(c,s,h,p){const _=$_(c,s,h);return p?(_.next=p.next,_.prev=p,p.next.prev=_,p.next=_):(_.prev=_,_.next=_),_}function Wd(c){c.next.prev=c.prev,c.prev.next=c.next,c.prevZ&&(c.prevZ.nextZ=c.nextZ),c.nextZ&&(c.nextZ.prevZ=c.prevZ)}function $_(c,s,h){return{i:c,x:s,y:h,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function j_(c,s,h){const p=h.patternDependencies;let _=!1;for(const k of s){const S=k.paint.get(`${c}-pattern`);S.isConstant()||(_=!0);const T=S.constantOr(null);T&&(_=!0,p[T.to]=!0,p[T.from]=!0)}return _}function U_(c,s,h,p,_){const k=_.patternDependencies;for(const S of s){const T=S.paint.get(`${c}-pattern`).value;if(T.kind!=="constant"){let A=T.evaluate({zoom:p-1},h,{},_.availableImages),B=T.evaluate({zoom:p},h,{},_.availableImages),z=T.evaluate({zoom:p+1},h,{},_.availableImages);A=A&&A.name?A.name:A,B=B&&B.name?B.name:B,z=z&&z.name?z.name:z,k[A]=!0,k[B]=!0,k[z]=!0,h.patterns[S.id]={min:A,mid:B,max:z}}}return h}class H_{constructor(s){this.zoom=s.zoom,this.overscaling=s.overscaling,this.layers=s.layers,this.layerIds=this.layers.map(h=>h.id),this.index=s.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new Po,this.indexArray=new ro,this.indexArray2=new Si,this.programConfigurations=new rc(s.layers,s.zoom),this.segments=new tn,this.segments2=new tn,this.stateDependentLayerIds=this.layers.filter(h=>h.isStateDependent()).map(h=>h.id)}populate(s,h,p){this.hasPattern=j_("fill",this.layers,h);const _=this.layers[0].layout.get("fill-sort-key"),k=!_.isConstant(),S=[];for(const{feature:T,id:A,index:B,sourceLayerIndex:z}of s){const L=this.layers[0]._featureFilter.needGeometry,j=sc(T,L);if(!this.layers[0]._featureFilter.filter(new Vn(this.zoom),j,p))continue;const q=k?_.evaluate(j,{},p,h.availableImages):void 0,Y={id:A,properties:T.properties,type:T.type,sourceLayerIndex:z,index:B,geometry:L?j.geometry:oc(T),patterns:{},sortKey:q};S.push(Y)}k&&S.sort((T,A)=>T.sortKey-A.sortKey);for(const T of S){const{geometry:A,index:B,sourceLayerIndex:z}=T;if(this.hasPattern){const L=U_("fill",this.layers,T,this.zoom,h);this.patternFeatures.push(L)}else this.addFeature(T,A,B,p,{});h.featureIndex.insert(s[B].feature,A,B,z,this.index)}}update(s,h,p){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(s,h,this.stateDependentLayers,p)}addFeatures(s,h,p){for(const _ of this.patternFeatures)this.addFeature(_,_.geometry,_.index,h,p)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(s){this.uploaded||(this.layoutVertexBuffer=s.createVertexBuffer(this.layoutVertexArray,fW),this.indexBuffer=s.createIndexBuffer(this.indexArray),this.indexBuffer2=s.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(s),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy())}addFeature(s,h,p,_,k){for(const S of uu(h,500)){let T=0;for(const q of S)T+=q.length;const A=this.segments.prepareSegment(T,this.layoutVertexArray,this.indexArray),B=A.vertexLength,z=[],L=[];for(const q of S){if(q.length===0)continue;q!==S[0]&&L.push(z.length/2);const Y=this.segments2.prepareSegment(q.length,this.layoutVertexArray,this.indexArray2),K=Y.vertexLength;this.layoutVertexArray.emplaceBack(q[0].x,q[0].y),this.indexArray2.emplaceBack(K+q.length-1,K),z.push(q[0].x),z.push(q[0].y);for(let re=1;re<q.length;re++)this.layoutVertexArray.emplaceBack(q[re].x,q[re].y),this.indexArray2.emplaceBack(K+re-1,K+re),z.push(q[re].x),z.push(q[re].y);Y.vertexLength+=q.length,Y.primitiveLength+=q.length}const j=cE(z,L);for(let q=0;q<j.length;q+=3)this.indexArray.emplaceBack(B+j[q],B+j[q+1],B+j[q+2]);A.vertexLength+=T,A.primitiveLength+=j.length/3}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,s,p,k,_)}}let fE,mE;ut("FillBucket",H_,{omit:["layers","patternFeatures"]});var SW={get paint(){return mE=mE||new v({"fill-antialias":new ft(we.paint_fill["fill-antialias"]),"fill-opacity":new Et(we.paint_fill["fill-opacity"]),"fill-color":new Et(we.paint_fill["fill-color"]),"fill-outline-color":new Et(we.paint_fill["fill-outline-color"]),"fill-translate":new ft(we.paint_fill["fill-translate"]),"fill-translate-anchor":new ft(we.paint_fill["fill-translate-anchor"]),"fill-pattern":new Iu(we.paint_fill["fill-pattern"])})},get layout(){return fE=fE||new v({"fill-sort-key":new Et(we.layout_fill["fill-sort-key"])})}};class EW extends d{constructor(s){super(s,SW)}recalculate(s,h){super.recalculate(s,h);const p=this.paint._values["fill-outline-color"];p.value.kind==="constant"&&p.value.value===void 0&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(s){return new H_(s)}queryRadius(){return Nm(this.paint.get("fill-translate"))}queryIntersectsFeature(s,h,p,_,k,S,T){return KS(Rm(s,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),S.angle,T),_)}isTileClipped(){return!0}}const CW=M([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),TW=M([{name:"a_centroid",components:2,type:"Int16"}],4),{members:MW}=CW;var il={},AW=b,gE=$u;function $u(c,s,h,p,_){this.properties={},this.extent=h,this.type=0,this._pbf=c,this._geometry=-1,this._keys=p,this._values=_,c.readFields(IW,this,s)}function IW(c,s,h){c==1?s.id=h.readVarint():c==2?function(p,_){for(var k=p.readVarint()+p.pos;p.pos<k;){var S=_._keys[p.readVarint()],T=_._values[p.readVarint()];_.properties[S]=T}}(h,s):c==3?s.type=h.readVarint():c==4&&(s._geometry=h.pos)}function PW(c){for(var s,h,p=0,_=0,k=c.length,S=k-1;_<k;S=_++)p+=((h=c[S]).x-(s=c[_]).x)*(s.y+h.y);return p}$u.types=["Unknown","Point","LineString","Polygon"],$u.prototype.loadGeometry=function(){var c=this._pbf;c.pos=this._geometry;for(var s,h=c.readVarint()+c.pos,p=1,_=0,k=0,S=0,T=[];c.pos<h;){if(_<=0){var A=c.readVarint();p=7&A,_=A>>3}if(_--,p===1||p===2)k+=c.readSVarint(),S+=c.readSVarint(),p===1&&(s&&T.push(s),s=[]),s.push(new AW(k,S));else{if(p!==7)throw new Error("unknown command "+p);s&&s.push(s[0].clone())}}return s&&T.push(s),T},$u.prototype.bbox=function(){var c=this._pbf;c.pos=this._geometry;for(var s=c.readVarint()+c.pos,h=1,p=0,_=0,k=0,S=1/0,T=-1/0,A=1/0,B=-1/0;c.pos<s;){if(p<=0){var z=c.readVarint();h=7&z,p=z>>3}if(p--,h===1||h===2)(_+=c.readSVarint())<S&&(S=_),_>T&&(T=_),(k+=c.readSVarint())<A&&(A=k),k>B&&(B=k);else if(h!==7)throw new Error("unknown command "+h)}return[S,A,T,B]},$u.prototype.toGeoJSON=function(c,s,h){var p,_,k=this.extent*Math.pow(2,h),S=this.extent*c,T=this.extent*s,A=this.loadGeometry(),B=$u.types[this.type];function z(q){for(var Y=0;Y<q.length;Y++){var K=q[Y];q[Y]=[360*(K.x+S)/k-180,360/Math.PI*Math.atan(Math.exp((180-360*(K.y+T)/k)*Math.PI/180))-90]}}switch(this.type){case 1:var L=[];for(p=0;p<A.length;p++)L[p]=A[p][0];z(A=L);break;case 2:for(p=0;p<A.length;p++)z(A[p]);break;case 3:for(A=function(q){var Y=q.length;if(Y<=1)return[q];for(var K,re,ae=[],be=0;be<Y;be++){var pe=PW(q[be]);pe!==0&&(re===void 0&&(re=pe<0),re===pe<0?(K&&ae.push(K),K=[q[be]]):K.push(q[be]))}return K&&ae.push(K),ae}(A),p=0;p<A.length;p++)for(_=0;_<A[p].length;_++)z(A[p][_])}A.length===1?A=A[0]:B="Multi"+B;var j={type:"Feature",geometry:{type:B,coordinates:A},properties:this.properties};return"id"in this&&(j.id=this.id),j};var DW=gE,yE=_E;function _E(c,s){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=c,this._keys=[],this._values=[],this._features=[],c.readFields(OW,this,s),this.length=this._features.length}function OW(c,s,h){c===15?s.version=h.readVarint():c===1?s.name=h.readString():c===5?s.extent=h.readVarint():c===2?s._features.push(h.pos):c===3?s._keys.push(h.readString()):c===4&&s._values.push(function(p){for(var _=null,k=p.readVarint()+p.pos;p.pos<k;){var S=p.readVarint()>>3;_=S===1?p.readString():S===2?p.readFloat():S===3?p.readDouble():S===4?p.readVarint64():S===5?p.readVarint():S===6?p.readSVarint():S===7?p.readBoolean():null}return _}(h))}_E.prototype.feature=function(c){if(c<0||c>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[c];var s=this._pbf.readVarint()+this._pbf.pos;return new DW(this._pbf,s,this.extent,this._keys,this._values)};var BW=yE;function zW(c,s,h){if(c===3){var p=new BW(h,h.readVarint()+h.pos);p.length&&(s[p.name]=p)}}il.VectorTile=function(c,s){this.layers=c.readFields(zW,{},s)},il.VectorTileFeature=gE,il.VectorTileLayer=yE;const NW=il.VectorTileFeature.types,q_=Math.pow(2,13);function Gd(c,s,h,p,_,k,S,T){c.emplaceBack(s,h,2*Math.floor(p*q_)+S,_*q_*2,k*q_*2,Math.round(T))}class W_{constructor(s){this.zoom=s.zoom,this.overscaling=s.overscaling,this.layers=s.layers,this.layerIds=this.layers.map(h=>h.id),this.index=s.index,this.hasPattern=!1,this.layoutVertexArray=new Ka,this.centroidVertexArray=new Bi,this.indexArray=new ro,this.programConfigurations=new rc(s.layers,s.zoom),this.segments=new tn,this.stateDependentLayerIds=this.layers.filter(h=>h.isStateDependent()).map(h=>h.id)}populate(s,h,p){this.features=[],this.hasPattern=j_("fill-extrusion",this.layers,h);for(const{feature:_,id:k,index:S,sourceLayerIndex:T}of s){const A=this.layers[0]._featureFilter.needGeometry,B=sc(_,A);if(!this.layers[0]._featureFilter.filter(new Vn(this.zoom),B,p))continue;const z={id:k,sourceLayerIndex:T,index:S,geometry:A?B.geometry:oc(_),properties:_.properties,type:_.type,patterns:{}};this.hasPattern?this.features.push(U_("fill-extrusion",this.layers,z,this.zoom,h)):this.addFeature(z,z.geometry,S,p,{}),h.featureIndex.insert(_,z.geometry,S,T,this.index,!0)}}addFeatures(s,h,p){for(const _ of this.features){const{geometry:k}=_;this.addFeature(_,k,_.index,h,p)}}update(s,h,p){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(s,h,this.stateDependentLayers,p)}isEmpty(){return this.layoutVertexArray.length===0&&this.centroidVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(s){this.uploaded||(this.layoutVertexBuffer=s.createVertexBuffer(this.layoutVertexArray,MW),this.centroidVertexBuffer=s.createVertexBuffer(this.centroidVertexArray,TW.members,!0),this.indexBuffer=s.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(s),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(s,h,p,_,k){for(const S of uu(h,500)){const T={x:0,y:0,vertexCount:0};let A=0;for(const Y of S)A+=Y.length;let B=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(const Y of S){if(Y.length===0||LW(Y))continue;let K=0;for(let re=0;re<Y.length;re++){const ae=Y[re];if(re>=1){const be=Y[re-1];if(!RW(ae,be)){B.vertexLength+4>tn.MAX_VERTEX_ARRAY_LENGTH&&(B=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const pe=ae.sub(be)._perp()._unit(),ye=be.dist(ae);K+ye>32768&&(K=0),Gd(this.layoutVertexArray,ae.x,ae.y,pe.x,pe.y,0,0,K),Gd(this.layoutVertexArray,ae.x,ae.y,pe.x,pe.y,0,1,K),T.x+=2*ae.x,T.y+=2*ae.y,T.vertexCount+=2,K+=ye,Gd(this.layoutVertexArray,be.x,be.y,pe.x,pe.y,0,0,K),Gd(this.layoutVertexArray,be.x,be.y,pe.x,pe.y,0,1,K),T.x+=2*be.x,T.y+=2*be.y,T.vertexCount+=2;const Te=B.vertexLength;this.indexArray.emplaceBack(Te,Te+2,Te+1),this.indexArray.emplaceBack(Te+1,Te+2,Te+3),B.vertexLength+=4,B.primitiveLength+=2}}}}if(B.vertexLength+A>tn.MAX_VERTEX_ARRAY_LENGTH&&(B=this.segments.prepareSegment(A,this.layoutVertexArray,this.indexArray)),NW[s.type]!=="Polygon")continue;const z=[],L=[],j=B.vertexLength;for(const Y of S)if(Y.length!==0){Y!==S[0]&&L.push(z.length/2);for(let K=0;K<Y.length;K++){const re=Y[K];Gd(this.layoutVertexArray,re.x,re.y,0,0,1,1,0),T.x+=re.x,T.y+=re.y,T.vertexCount+=1,z.push(re.x),z.push(re.y)}}const q=cE(z,L);for(let Y=0;Y<q.length;Y+=3)this.indexArray.emplaceBack(j+q[Y],j+q[Y+2],j+q[Y+1]);B.primitiveLength+=q.length/3,B.vertexLength+=A;for(let Y=0;Y<T.vertexCount;Y++){const K=Math.floor(T.x/T.vertexCount),re=Math.floor(T.y/T.vertexCount);this.centroidVertexArray.emplaceBack(K,re)}}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,s,p,k,_)}}function RW(c,s){return c.x===s.x&&(c.x<0||c.x>ai)||c.y===s.y&&(c.y<0||c.y>ai)}function LW(c){return c.every(s=>s.x<0)||c.every(s=>s.x>ai)||c.every(s=>s.y<0)||c.every(s=>s.y>ai)}let bE;ut("FillExtrusionBucket",W_,{omit:["layers","features"]});var VW={get paint(){return bE=bE||new v({"fill-extrusion-opacity":new ft(we["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new Et(we["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new ft(we["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new ft(we["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new Iu(we["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new Et(we["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new Et(we["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new ft(we["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};class FW extends d{constructor(s){super(s,VW)}createBucket(s){return new W_(s)}queryRadius(){return Nm(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(s,h,p,_,k,S,T,A){const B=Rm(s,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),S.angle,T),z=this.paint.get("fill-extrusion-height").evaluate(h,p),L=this.paint.get("fill-extrusion-base").evaluate(h,p),j=function(Y,K,re,ae){const be=[];for(const pe of Y){const ye=[pe.x,pe.y,0,1];Lm(ye,ye,K),be.push(new E(ye[0]/ye[3],ye[1]/ye[3]))}return be}(B,A),q=function(Y,K,re,ae){const be=[],pe=[],ye=ae[8]*K,Te=ae[9]*K,Le=ae[10]*K,rt=ae[11]*K,St=ae[8]*re,tt=ae[9]*re,Je=ae[10]*re,yt=ae[11]*re;for(const dt of Y){const at=[],Oe=[];for(const bt of dt){const gt=bt.x,Ot=bt.y,Dn=ae[0]*gt+ae[4]*Ot+ae[12],An=ae[1]*gt+ae[5]*Ot+ae[13],gi=ae[2]*gt+ae[6]*Ot+ae[14],Do=ae[3]*gt+ae[7]*Ot+ae[15],Ri=gi+Le,yi=Do+rt,sr=Dn+St,ar=An+tt,lr=gi+Je,ei=Do+yt,_i=new E((Dn+ye)/yi,(An+Te)/yi);_i.z=Ri/yi,at.push(_i);const Yi=new E(sr/ei,ar/ei);Yi.z=lr/ei,Oe.push(Yi)}be.push(at),pe.push(Oe)}return[be,pe]}(_,L,z,A);return function(Y,K,re){let ae=1/0;KS(re,K)&&(ae=xE(re,K[0]));for(let be=0;be<K.length;be++){const pe=K[be],ye=Y[be];for(let Te=0;Te<pe.length-1;Te++){const Le=pe[Te],rt=[Le,pe[Te+1],ye[Te+1],ye[Te],Le];XS(re,rt)&&(ae=Math.min(ae,xE(re,rt)))}}return ae!==1/0&&ae}(q[0],q[1],j)}}function Zd(c,s){return c.x*s.x+c.y*s.y}function xE(c,s){if(c.length===1){let h=0;const p=s[h++];let _;for(;!_||p.equals(_);)if(_=s[h++],!_)return 1/0;for(;h<s.length;h++){const k=s[h],S=c[0],T=_.sub(p),A=k.sub(p),B=S.sub(p),z=Zd(T,T),L=Zd(T,A),j=Zd(A,A),q=Zd(B,T),Y=Zd(B,A),K=z*j-L*L,re=(j*q-L*Y)/K,ae=(z*Y-L*q)/K,be=p.z*(1-re-ae)+_.z*re+k.z*ae;if(isFinite(be))return be}return 1/0}{let h=1/0;for(const p of s)h=Math.min(h,p.z);return h}}const $W=M([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:jW}=$W,UW=M([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:HW}=UW,qW=il.VectorTileFeature.types,WW=Math.cos(Math.PI/180*37.5),vE=Math.pow(2,14)/.5;class G_{constructor(s){this.zoom=s.zoom,this.overscaling=s.overscaling,this.layers=s.layers,this.layerIds=this.layers.map(h=>h.id),this.index=s.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(h=>{this.gradients[h.id]={}}),this.layoutVertexArray=new Du,this.layoutVertexArray2=new Ja,this.indexArray=new ro,this.programConfigurations=new rc(s.layers,s.zoom),this.segments=new tn,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(h=>h.isStateDependent()).map(h=>h.id)}populate(s,h,p){this.hasPattern=j_("line",this.layers,h);const _=this.layers[0].layout.get("line-sort-key"),k=!_.isConstant(),S=[];for(const{feature:T,id:A,index:B,sourceLayerIndex:z}of s){const L=this.layers[0]._featureFilter.needGeometry,j=sc(T,L);if(!this.layers[0]._featureFilter.filter(new Vn(this.zoom),j,p))continue;const q=k?_.evaluate(j,{},p):void 0,Y={id:A,properties:T.properties,type:T.type,sourceLayerIndex:z,index:B,geometry:L?j.geometry:oc(T),patterns:{},sortKey:q};S.push(Y)}k&&S.sort((T,A)=>T.sortKey-A.sortKey);for(const T of S){const{geometry:A,index:B,sourceLayerIndex:z}=T;if(this.hasPattern){const L=U_("line",this.layers,T,this.zoom,h);this.patternFeatures.push(L)}else this.addFeature(T,A,B,p,{});h.featureIndex.insert(s[B].feature,A,B,z,this.index)}}update(s,h,p){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(s,h,this.stateDependentLayers,p)}addFeatures(s,h,p){for(const _ of this.patternFeatures)this.addFeature(_,_.geometry,_.index,h,p)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(s){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=s.createVertexBuffer(this.layoutVertexArray2,HW)),this.layoutVertexBuffer=s.createVertexBuffer(this.layoutVertexArray,jW),this.indexBuffer=s.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(s),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(s){if(s.properties&&Object.prototype.hasOwnProperty.call(s.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(s.properties,"mapbox_clip_end"))return{start:+s.properties.mapbox_clip_start,end:+s.properties.mapbox_clip_end}}addFeature(s,h,p,_,k){const S=this.layers[0].layout,T=S.get("line-join").evaluate(s,{}),A=S.get("line-cap"),B=S.get("line-miter-limit"),z=S.get("line-round-limit");this.lineClips=this.lineFeatureClips(s);for(const L of h)this.addLine(L,s,T,A,B,z);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,s,p,k,_)}addLine(s,h,p,_,k,S){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let ae=0;ae<s.length-1;ae++)this.totalDistance+=s[ae].dist(s[ae+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}const T=qW[h.type]==="Polygon";let A=s.length;for(;A>=2&&s[A-1].equals(s[A-2]);)A--;let B=0;for(;B<A-1&&s[B].equals(s[B+1]);)B++;if(A<(T?3:2))return;p==="bevel"&&(k=1.05);const z=this.overscaling<=16?15*ai/(512*this.overscaling):0,L=this.segments.prepareSegment(10*A,this.layoutVertexArray,this.indexArray);let j,q,Y,K,re;this.e1=this.e2=-1,T&&(j=s[A-2],re=s[B].sub(j)._unit()._perp());for(let ae=B;ae<A;ae++){if(Y=ae===A-1?T?s[B+1]:void 0:s[ae+1],Y&&s[ae].equals(Y))continue;re&&(K=re),j&&(q=j),j=s[ae],re=Y?Y.sub(j)._unit()._perp():K,K=K||re;let be=K.add(re);be.x===0&&be.y===0||be._unit();const pe=K.x*re.x+K.y*re.y,ye=be.x*re.x+be.y*re.y,Te=ye!==0?1/ye:1/0,Le=2*Math.sqrt(2-2*ye),rt=ye<WW&&q&&Y,St=K.x*re.y-K.y*re.x>0;if(rt&&ae>B){const yt=j.dist(q);if(yt>2*z){const dt=j.sub(j.sub(q)._mult(z/yt)._round());this.updateDistance(q,dt),this.addCurrentVertex(dt,K,0,0,L),q=dt}}const tt=q&&Y;let Je=tt?p:T?"butt":_;if(tt&&Je==="round"&&(Te<S?Je="miter":Te<=2&&(Je="fakeround")),Je==="miter"&&Te>k&&(Je="bevel"),Je==="bevel"&&(Te>2&&(Je="flipbevel"),Te<k&&(Je="miter")),q&&this.updateDistance(q,j),Je==="miter")be._mult(Te),this.addCurrentVertex(j,be,0,0,L);else if(Je==="flipbevel"){if(Te>100)be=re.mult(-1);else{const yt=Te*K.add(re).mag()/K.sub(re).mag();be._perp()._mult(yt*(St?-1:1))}this.addCurrentVertex(j,be,0,0,L),this.addCurrentVertex(j,be.mult(-1),0,0,L)}else if(Je==="bevel"||Je==="fakeround"){const yt=-Math.sqrt(Te*Te-1),dt=St?yt:0,at=St?0:yt;if(q&&this.addCurrentVertex(j,K,dt,at,L),Je==="fakeround"){const Oe=Math.round(180*Le/Math.PI/20);for(let bt=1;bt<Oe;bt++){let gt=bt/Oe;if(gt!==.5){const Dn=gt-.5;gt+=gt*Dn*(gt-1)*((1.0904+pe*(pe*(3.55645-1.43519*pe)-3.2452))*Dn*Dn+(.848013+pe*(.215638*pe-1.06021)))}const Ot=re.sub(K)._mult(gt)._add(K)._unit()._mult(St?-1:1);this.addHalfVertex(j,Ot.x,Ot.y,!1,St,0,L)}}Y&&this.addCurrentVertex(j,re,-dt,-at,L)}else if(Je==="butt")this.addCurrentVertex(j,be,0,0,L);else if(Je==="square"){const yt=q?1:-1;this.addCurrentVertex(j,be,yt,yt,L)}else Je==="round"&&(q&&(this.addCurrentVertex(j,K,0,0,L),this.addCurrentVertex(j,K,1,1,L,!0)),Y&&(this.addCurrentVertex(j,re,-1,-1,L,!0),this.addCurrentVertex(j,re,0,0,L)));if(rt&&ae<A-1){const yt=j.dist(Y);if(yt>2*z){const dt=j.add(Y.sub(j)._mult(z/yt)._round());this.updateDistance(j,dt),this.addCurrentVertex(dt,re,0,0,L),j=dt}}}}addCurrentVertex(s,h,p,_,k,S=!1){const T=h.y*_-h.x,A=-h.y-h.x*_;this.addHalfVertex(s,h.x+h.y*p,h.y-h.x*p,S,!1,p,k),this.addHalfVertex(s,T,A,S,!0,-_,k),this.distance>vE/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(s,h,p,_,k,S))}addHalfVertex({x:s,y:h},p,_,k,S,T,A){const B=.5*(this.lineClips?this.scaledDistance*(vE-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((s<<1)+(k?1:0),(h<<1)+(S?1:0),Math.round(63*p)+128,Math.round(63*_)+128,1+(T===0?0:T<0?-1:1)|(63&B)<<2,B>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);const z=A.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,z),A.primitiveLength++),S?this.e2=z:this.e1=z}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(s,h){this.distance+=s.dist(h),this.updateScaledDistance()}}let wE,kE;ut("LineBucket",G_,{omit:["layers","patternFeatures"]});var SE={get paint(){return kE=kE||new v({"line-opacity":new Et(we.paint_line["line-opacity"]),"line-color":new Et(we.paint_line["line-color"]),"line-translate":new ft(we.paint_line["line-translate"]),"line-translate-anchor":new ft(we.paint_line["line-translate-anchor"]),"line-width":new Et(we.paint_line["line-width"]),"line-gap-width":new Et(we.paint_line["line-gap-width"]),"line-offset":new Et(we.paint_line["line-offset"]),"line-blur":new Et(we.paint_line["line-blur"]),"line-dasharray":new Pu(we.paint_line["line-dasharray"]),"line-pattern":new Iu(we.paint_line["line-pattern"]),"line-gradient":new Ld(we.paint_line["line-gradient"])})},get layout(){return wE=wE||new v({"line-cap":new ft(we.layout_line["line-cap"]),"line-join":new Et(we.layout_line["line-join"]),"line-miter-limit":new ft(we.layout_line["line-miter-limit"]),"line-round-limit":new ft(we.layout_line["line-round-limit"]),"line-sort-key":new Et(we.layout_line["line-sort-key"])})}};class GW extends Et{possiblyEvaluate(s,h){return h=new Vn(Math.floor(h.zoom),{now:h.now,fadeDuration:h.fadeDuration,zoomHistory:h.zoomHistory,transition:h.transition}),super.possiblyEvaluate(s,h)}evaluate(s,h,p,_){return h=Se({},h,{zoom:Math.floor(h.zoom)}),super.evaluate(s,h,p,_)}}let jm;class ZW extends d{constructor(s){super(s,SE),this.gradientVersion=0,jm||(jm=new GW(SE.paint.properties["line-width"].specification),jm.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(s){if(s==="line-gradient"){const h=this.gradientExpression();this.stepInterpolant=!!function(p){return p._styleExpression!==void 0}(h)&&h._styleExpression.expression instanceof Da,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(s,h){super.recalculate(s,h),this.paint._values["line-floorwidth"]=jm.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,s)}createBucket(s){return new G_(s)}queryRadius(s){const h=s,p=EE($d("line-width",this,h),$d("line-gap-width",this,h)),_=$d("line-offset",this,h);return p/2+Math.abs(_)+Nm(this.paint.get("line-translate"))}queryIntersectsFeature(s,h,p,_,k,S,T){const A=Rm(s,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),S.angle,T),B=T/2*EE(this.paint.get("line-width").evaluate(h,p),this.paint.get("line-gap-width").evaluate(h,p)),z=this.paint.get("line-offset").evaluate(h,p);return z&&(_=function(L,j){const q=[];for(let Y=0;Y<L.length;Y++){const K=L[Y],re=[];for(let ae=0;ae<K.length;ae++){const be=K[ae-1],pe=K[ae],ye=K[ae+1],Te=ae===0?new E(0,0):pe.sub(be)._unit()._perp(),Le=ae===K.length-1?new E(0,0):ye.sub(pe)._unit()._perp(),rt=Te._add(Le)._unit(),St=rt.x*Le.x+rt.y*Le.y;St!==0&&rt._mult(1/St),re.push(rt._mult(j)._add(pe))}q.push(re)}return q}(_,z*T)),function(L,j,q){for(let Y=0;Y<j.length;Y++){const K=j[Y];if(L.length>=3){for(let re=0;re<K.length;re++)if(Lu(L,K[re]))return!0}if(iW(L,K,q))return!0}return!1}(A,_,B)}isTileClipped(){return!0}}function EE(c,s){return s>0?s+2*c:c}const YW=M([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),XW=M([{name:"a_projected_pos",components:3,type:"Float32"}],4);M([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const KW=M([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_box_real",components:2,type:"Int16"}]);M([{type:"Int16",name:"anchorPointX"},{type:"Int16",name:"anchorPointY"},{type:"Int16",name:"x1"},{type:"Int16",name:"y1"},{type:"Int16",name:"x2"},{type:"Int16",name:"y2"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]);const CE=M([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),JW=M([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function QW(c,s,h){return c.sections.forEach(p=>{p.text=function(_,k,S){const T=k.layout.get("text-transform").evaluate(S,{});return T==="uppercase"?_=_.toLocaleUpperCase():T==="lowercase"&&(_=_.toLocaleLowerCase()),br.applyArabicShaping&&(_=br.applyArabicShaping(_)),_}(p.text,s,h)}),c}M([{name:"triangle",components:3,type:"Uint16"}]),M([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Uint16",name:"glyphStartIndex"},{type:"Uint16",name:"numGlyphs"},{type:"Uint32",name:"vertexStartIndex"},{type:"Uint32",name:"lineStartIndex"},{type:"Uint32",name:"lineLength"},{type:"Uint16",name:"segment"},{type:"Uint16",name:"lowerSize"},{type:"Uint16",name:"upperSize"},{type:"Float32",name:"lineOffsetX"},{type:"Float32",name:"lineOffsetY"},{type:"Uint8",name:"writingMode"},{type:"Uint8",name:"placedOrientation"},{type:"Uint8",name:"hidden"},{type:"Uint32",name:"crossTileID"},{type:"Int16",name:"associatedIconIndex"}]),M([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Int16",name:"rightJustifiedTextSymbolIndex"},{type:"Int16",name:"centerJustifiedTextSymbolIndex"},{type:"Int16",name:"leftJustifiedTextSymbolIndex"},{type:"Int16",name:"verticalPlacedTextSymbolIndex"},{type:"Int16",name:"placedIconSymbolIndex"},{type:"Int16",name:"verticalPlacedIconSymbolIndex"},{type:"Uint16",name:"key"},{type:"Uint16",name:"textBoxStartIndex"},{type:"Uint16",name:"textBoxEndIndex"},{type:"Uint16",name:"verticalTextBoxStartIndex"},{type:"Uint16",name:"verticalTextBoxEndIndex"},{type:"Uint16",name:"iconBoxStartIndex"},{type:"Uint16",name:"iconBoxEndIndex"},{type:"Uint16",name:"verticalIconBoxStartIndex"},{type:"Uint16",name:"verticalIconBoxEndIndex"},{type:"Uint16",name:"featureIndex"},{type:"Uint16",name:"numHorizontalGlyphVertices"},{type:"Uint16",name:"numVerticalGlyphVertices"},{type:"Uint16",name:"numIconVertices"},{type:"Uint16",name:"numVerticalIconVertices"},{type:"Uint16",name:"useRuntimeCollisionCircles"},{type:"Uint32",name:"crossTileID"},{type:"Float32",name:"textBoxScale"},{type:"Float32",name:"collisionCircleDiameter"},{type:"Uint16",name:"textAnchorOffsetStartIndex"},{type:"Uint16",name:"textAnchorOffsetEndIndex"}]),M([{type:"Float32",name:"offsetX"}]),M([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),M([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);const Yd={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};var hi=24,TE=Mn,ME=function(c,s,h,p,_){var k,S,T=8*_-p-1,A=(1<<T)-1,B=A>>1,z=-7,L=_-1,j=-1,q=c[s+L];for(L+=j,k=q&(1<<-z)-1,q>>=-z,z+=T;z>0;k=256*k+c[s+L],L+=j,z-=8);for(S=k&(1<<-z)-1,k>>=-z,z+=p;z>0;S=256*S+c[s+L],L+=j,z-=8);if(k===0)k=1-B;else{if(k===A)return S?NaN:1/0*(q?-1:1);S+=Math.pow(2,p),k-=B}return(q?-1:1)*S*Math.pow(2,k-p)},AE=function(c,s,h,p,_,k){var S,T,A,B=8*k-_-1,z=(1<<B)-1,L=z>>1,j=_===23?Math.pow(2,-24)-Math.pow(2,-77):0,q=0,Y=1,K=s<0||s===0&&1/s<0?1:0;for(s=Math.abs(s),isNaN(s)||s===1/0?(T=isNaN(s)?1:0,S=z):(S=Math.floor(Math.log(s)/Math.LN2),s*(A=Math.pow(2,-S))<1&&(S--,A*=2),(s+=S+L>=1?j/A:j*Math.pow(2,1-L))*A>=2&&(S++,A/=2),S+L>=z?(T=0,S=z):S+L>=1?(T=(s*A-1)*Math.pow(2,_),S+=L):(T=s*Math.pow(2,L-1)*Math.pow(2,_),S=0));_>=8;c[h+q]=255&T,q+=Y,T/=256,_-=8);for(S=S<<_|T,B+=_;B>0;c[h+q]=255&S,q+=Y,S/=256,B-=8);c[h+q-Y]|=128*K};function Mn(c){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(c)?c:new Uint8Array(c||0),this.pos=0,this.type=0,this.length=this.buf.length}Mn.Varint=0,Mn.Fixed64=1,Mn.Bytes=2,Mn.Fixed32=5;var Z_=4294967296,IE=1/Z_,PE=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");function ea(c){return c.type===Mn.Bytes?c.readVarint()+c.pos:c.pos+1}function ju(c,s,h){return h?4294967296*s+(c>>>0):4294967296*(s>>>0)+(c>>>0)}function DE(c,s,h){var p=s<=16383?1:s<=2097151?2:s<=268435455?3:Math.floor(Math.log(s)/(7*Math.LN2));h.realloc(p);for(var _=h.pos-1;_>=c;_--)h.buf[_+p]=h.buf[_]}function eG(c,s){for(var h=0;h<c.length;h++)s.writeVarint(c[h])}function tG(c,s){for(var h=0;h<c.length;h++)s.writeSVarint(c[h])}function nG(c,s){for(var h=0;h<c.length;h++)s.writeFloat(c[h])}function iG(c,s){for(var h=0;h<c.length;h++)s.writeDouble(c[h])}function rG(c,s){for(var h=0;h<c.length;h++)s.writeBoolean(c[h])}function oG(c,s){for(var h=0;h<c.length;h++)s.writeFixed32(c[h])}function sG(c,s){for(var h=0;h<c.length;h++)s.writeSFixed32(c[h])}function aG(c,s){for(var h=0;h<c.length;h++)s.writeFixed64(c[h])}function lG(c,s){for(var h=0;h<c.length;h++)s.writeSFixed64(c[h])}function Um(c,s){return(c[s]|c[s+1]<<8|c[s+2]<<16)+16777216*c[s+3]}function Uu(c,s,h){c[h]=s,c[h+1]=s>>>8,c[h+2]=s>>>16,c[h+3]=s>>>24}function OE(c,s){return(c[s]|c[s+1]<<8|c[s+2]<<16)+(c[s+3]<<24)}Mn.prototype={destroy:function(){this.buf=null},readFields:function(c,s,h){for(h=h||this.length;this.pos<h;){var p=this.readVarint(),_=p>>3,k=this.pos;this.type=7&p,c(_,s,this),this.pos===k&&this.skip(p)}return s},readMessage:function(c,s){return this.readFields(c,s,this.readVarint()+this.pos)},readFixed32:function(){var c=Um(this.buf,this.pos);return this.pos+=4,c},readSFixed32:function(){var c=OE(this.buf,this.pos);return this.pos+=4,c},readFixed64:function(){var c=Um(this.buf,this.pos)+Um(this.buf,this.pos+4)*Z_;return this.pos+=8,c},readSFixed64:function(){var c=Um(this.buf,this.pos)+OE(this.buf,this.pos+4)*Z_;return this.pos+=8,c},readFloat:function(){var c=ME(this.buf,this.pos,!0,23,4);return this.pos+=4,c},readDouble:function(){var c=ME(this.buf,this.pos,!0,52,8);return this.pos+=8,c},readVarint:function(c){var s,h,p=this.buf;return s=127&(h=p[this.pos++]),h<128?s:(s|=(127&(h=p[this.pos++]))<<7,h<128?s:(s|=(127&(h=p[this.pos++]))<<14,h<128?s:(s|=(127&(h=p[this.pos++]))<<21,h<128?s:function(_,k,S){var T,A,B=S.buf;if(T=(112&(A=B[S.pos++]))>>4,A<128||(T|=(127&(A=B[S.pos++]))<<3,A<128)||(T|=(127&(A=B[S.pos++]))<<10,A<128)||(T|=(127&(A=B[S.pos++]))<<17,A<128)||(T|=(127&(A=B[S.pos++]))<<24,A<128)||(T|=(1&(A=B[S.pos++]))<<31,A<128))return ju(_,T,k);throw new Error("Expected varint not more than 10 bytes")}(s|=(15&(h=p[this.pos]))<<28,c,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var c=this.readVarint();return c%2==1?(c+1)/-2:c/2},readBoolean:function(){return!!this.readVarint()},readString:function(){var c=this.readVarint()+this.pos,s=this.pos;return this.pos=c,c-s>=12&&PE?function(h,p,_){return PE.decode(h.subarray(p,_))}(this.buf,s,c):function(h,p,_){for(var k="",S=p;S<_;){var T,A,B,z=h[S],L=null,j=z>239?4:z>223?3:z>191?2:1;if(S+j>_)break;j===1?z<128&&(L=z):j===2?(192&(T=h[S+1]))==128&&(L=(31&z)<<6|63&T)<=127&&(L=null):j===3?(A=h[S+2],(192&(T=h[S+1]))==128&&(192&A)==128&&((L=(15&z)<<12|(63&T)<<6|63&A)<=2047||L>=55296&&L<=57343)&&(L=null)):j===4&&(A=h[S+2],B=h[S+3],(192&(T=h[S+1]))==128&&(192&A)==128&&(192&B)==128&&((L=(15&z)<<18|(63&T)<<12|(63&A)<<6|63&B)<=65535||L>=1114112)&&(L=null)),L===null?(L=65533,j=1):L>65535&&(L-=65536,k+=String.fromCharCode(L>>>10&1023|55296),L=56320|1023&L),k+=String.fromCharCode(L),S+=j}return k}(this.buf,s,c)},readBytes:function(){var c=this.readVarint()+this.pos,s=this.buf.subarray(this.pos,c);return this.pos=c,s},readPackedVarint:function(c,s){if(this.type!==Mn.Bytes)return c.push(this.readVarint(s));var h=ea(this);for(c=c||[];this.pos<h;)c.push(this.readVarint(s));return c},readPackedSVarint:function(c){if(this.type!==Mn.Bytes)return c.push(this.readSVarint());var s=ea(this);for(c=c||[];this.pos<s;)c.push(this.readSVarint());return c},readPackedBoolean:function(c){if(this.type!==Mn.Bytes)return c.push(this.readBoolean());var s=ea(this);for(c=c||[];this.pos<s;)c.push(this.readBoolean());return c},readPackedFloat:function(c){if(this.type!==Mn.Bytes)return c.push(this.readFloat());var s=ea(this);for(c=c||[];this.pos<s;)c.push(this.readFloat());return c},readPackedDouble:function(c){if(this.type!==Mn.Bytes)return c.push(this.readDouble());var s=ea(this);for(c=c||[];this.pos<s;)c.push(this.readDouble());return c},readPackedFixed32:function(c){if(this.type!==Mn.Bytes)return c.push(this.readFixed32());var s=ea(this);for(c=c||[];this.pos<s;)c.push(this.readFixed32());return c},readPackedSFixed32:function(c){if(this.type!==Mn.Bytes)return c.push(this.readSFixed32());var s=ea(this);for(c=c||[];this.pos<s;)c.push(this.readSFixed32());return c},readPackedFixed64:function(c){if(this.type!==Mn.Bytes)return c.push(this.readFixed64());var s=ea(this);for(c=c||[];this.pos<s;)c.push(this.readFixed64());return c},readPackedSFixed64:function(c){if(this.type!==Mn.Bytes)return c.push(this.readSFixed64());var s=ea(this);for(c=c||[];this.pos<s;)c.push(this.readSFixed64());return c},skip:function(c){var s=7&c;if(s===Mn.Varint)for(;this.buf[this.pos++]>127;);else if(s===Mn.Bytes)this.pos=this.readVarint()+this.pos;else if(s===Mn.Fixed32)this.pos+=4;else{if(s!==Mn.Fixed64)throw new Error("Unimplemented type: "+s);this.pos+=8}},writeTag:function(c,s){this.writeVarint(c<<3|s)},realloc:function(c){for(var s=this.length||16;s<this.pos+c;)s*=2;if(s!==this.length){var h=new Uint8Array(s);h.set(this.buf),this.buf=h,this.length=s}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(c){this.realloc(4),Uu(this.buf,c,this.pos),this.pos+=4},writeSFixed32:function(c){this.realloc(4),Uu(this.buf,c,this.pos),this.pos+=4},writeFixed64:function(c){this.realloc(8),Uu(this.buf,-1&c,this.pos),Uu(this.buf,Math.floor(c*IE),this.pos+4),this.pos+=8},writeSFixed64:function(c){this.realloc(8),Uu(this.buf,-1&c,this.pos),Uu(this.buf,Math.floor(c*IE),this.pos+4),this.pos+=8},writeVarint:function(c){(c=+c||0)>268435455||c<0?function(s,h){var p,_;if(s>=0?(p=s%4294967296|0,_=s/4294967296|0):(_=~(-s/4294967296),4294967295^(p=~(-s%4294967296))?p=p+1|0:(p=0,_=_+1|0)),s>=18446744073709552e3||s<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");h.realloc(10),function(k,S,T){T.buf[T.pos++]=127&k|128,k>>>=7,T.buf[T.pos++]=127&k|128,k>>>=7,T.buf[T.pos++]=127&k|128,k>>>=7,T.buf[T.pos++]=127&k|128,T.buf[T.pos]=127&(k>>>=7)}(p,0,h),function(k,S){var T=(7&k)<<4;S.buf[S.pos++]|=T|((k>>>=3)?128:0),k&&(S.buf[S.pos++]=127&k|((k>>>=7)?128:0),k&&(S.buf[S.pos++]=127&k|((k>>>=7)?128:0),k&&(S.buf[S.pos++]=127&k|((k>>>=7)?128:0),k&&(S.buf[S.pos++]=127&k|((k>>>=7)?128:0),k&&(S.buf[S.pos++]=127&k)))))}(_,h)}(c,this):(this.realloc(4),this.buf[this.pos++]=127&c|(c>127?128:0),c<=127||(this.buf[this.pos++]=127&(c>>>=7)|(c>127?128:0),c<=127||(this.buf[this.pos++]=127&(c>>>=7)|(c>127?128:0),c<=127||(this.buf[this.pos++]=c>>>7&127))))},writeSVarint:function(c){this.writeVarint(c<0?2*-c-1:2*c)},writeBoolean:function(c){this.writeVarint(!!c)},writeString:function(c){c=String(c),this.realloc(4*c.length),this.pos++;var s=this.pos;this.pos=function(p,_,k){for(var S,T,A=0;A<_.length;A++){if((S=_.charCodeAt(A))>55295&&S<57344){if(!T){S>56319||A+1===_.length?(p[k++]=239,p[k++]=191,p[k++]=189):T=S;continue}if(S<56320){p[k++]=239,p[k++]=191,p[k++]=189,T=S;continue}S=T-55296<<10|S-56320|65536,T=null}else T&&(p[k++]=239,p[k++]=191,p[k++]=189,T=null);S<128?p[k++]=S:(S<2048?p[k++]=S>>6|192:(S<65536?p[k++]=S>>12|224:(p[k++]=S>>18|240,p[k++]=S>>12&63|128),p[k++]=S>>6&63|128),p[k++]=63&S|128)}return k}(this.buf,c,this.pos);var h=this.pos-s;h>=128&&DE(s,h,this),this.pos=s-1,this.writeVarint(h),this.pos+=h},writeFloat:function(c){this.realloc(4),AE(this.buf,c,this.pos,!0,23,4),this.pos+=4},writeDouble:function(c){this.realloc(8),AE(this.buf,c,this.pos,!0,52,8),this.pos+=8},writeBytes:function(c){var s=c.length;this.writeVarint(s),this.realloc(s);for(var h=0;h<s;h++)this.buf[this.pos++]=c[h]},writeRawMessage:function(c,s){this.pos++;var h=this.pos;c(s,this);var p=this.pos-h;p>=128&&DE(h,p,this),this.pos=h-1,this.writeVarint(p),this.pos+=p},writeMessage:function(c,s,h){this.writeTag(c,Mn.Bytes),this.writeRawMessage(s,h)},writePackedVarint:function(c,s){s.length&&this.writeMessage(c,eG,s)},writePackedSVarint:function(c,s){s.length&&this.writeMessage(c,tG,s)},writePackedBoolean:function(c,s){s.length&&this.writeMessage(c,rG,s)},writePackedFloat:function(c,s){s.length&&this.writeMessage(c,nG,s)},writePackedDouble:function(c,s){s.length&&this.writeMessage(c,iG,s)},writePackedFixed32:function(c,s){s.length&&this.writeMessage(c,oG,s)},writePackedSFixed32:function(c,s){s.length&&this.writeMessage(c,sG,s)},writePackedFixed64:function(c,s){s.length&&this.writeMessage(c,aG,s)},writePackedSFixed64:function(c,s){s.length&&this.writeMessage(c,lG,s)},writeBytesField:function(c,s){this.writeTag(c,Mn.Bytes),this.writeBytes(s)},writeFixed32Field:function(c,s){this.writeTag(c,Mn.Fixed32),this.writeFixed32(s)},writeSFixed32Field:function(c,s){this.writeTag(c,Mn.Fixed32),this.writeSFixed32(s)},writeFixed64Field:function(c,s){this.writeTag(c,Mn.Fixed64),this.writeFixed64(s)},writeSFixed64Field:function(c,s){this.writeTag(c,Mn.Fixed64),this.writeSFixed64(s)},writeVarintField:function(c,s){this.writeTag(c,Mn.Varint),this.writeVarint(s)},writeSVarintField:function(c,s){this.writeTag(c,Mn.Varint),this.writeSVarint(s)},writeStringField:function(c,s){this.writeTag(c,Mn.Bytes),this.writeString(s)},writeFloatField:function(c,s){this.writeTag(c,Mn.Fixed32),this.writeFloat(s)},writeDoubleField:function(c,s){this.writeTag(c,Mn.Fixed64),this.writeDouble(s)},writeBooleanField:function(c,s){this.writeVarintField(c,!!s)}};var Y_=g(TE);const X_=3;function cG(c,s,h){c===1&&h.readMessage(uG,s)}function uG(c,s,h){if(c===3){const{id:p,bitmap:_,width:k,height:S,left:T,top:A,advance:B}=h.readMessage(hG,{});s.push({id:p,bitmap:new Ud({width:k+2*X_,height:S+2*X_},_),metrics:{width:k,height:S,left:T,top:A,advance:B}})}}function hG(c,s,h){c===1?s.id=h.readVarint():c===2?s.bitmap=h.readBytes():c===3?s.width=h.readVarint():c===4?s.height=h.readVarint():c===5?s.left=h.readSVarint():c===6?s.top=h.readSVarint():c===7&&(s.advance=h.readVarint())}const BE=X_;function zE(c){let s=0,h=0;for(const S of c)s+=S.w*S.h,h=Math.max(h,S.w);c.sort((S,T)=>T.h-S.h);const p=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(s/.95)),h),h:1/0}];let _=0,k=0;for(const S of c)for(let T=p.length-1;T>=0;T--){const A=p[T];if(!(S.w>A.w||S.h>A.h)){if(S.x=A.x,S.y=A.y,k=Math.max(k,S.y+S.h),_=Math.max(_,S.x+S.w),S.w===A.w&&S.h===A.h){const B=p.pop();T<p.length&&(p[T]=B)}else S.h===A.h?(A.x+=S.w,A.w-=S.w):S.w===A.w?(A.y+=S.h,A.h-=S.h):(p.push({x:A.x+S.w,y:A.y,w:A.w-S.w,h:S.h}),A.y+=S.h,A.h-=S.h);break}}return{w:_,h:k,fill:s/(_*k)||0}}const vr=1;class K_{constructor(s,{pixelRatio:h,version:p,stretchX:_,stretchY:k,content:S,textFitWidth:T,textFitHeight:A}){this.paddedRect=s,this.pixelRatio=h,this.stretchX=_,this.stretchY=k,this.content=S,this.version=p,this.textFitWidth=T,this.textFitHeight=A}get tl(){return[this.paddedRect.x+vr,this.paddedRect.y+vr]}get br(){return[this.paddedRect.x+this.paddedRect.w-vr,this.paddedRect.y+this.paddedRect.h-vr]}get tlbr(){return this.tl.concat(this.br)}get displaySize(){return[(this.paddedRect.w-2*vr)/this.pixelRatio,(this.paddedRect.h-2*vr)/this.pixelRatio]}}class NE{constructor(s,h){const p={},_={};this.haveRenderCallbacks=[];const k=[];this.addImages(s,p,k),this.addImages(h,_,k);const{w:S,h:T}=zE(k),A=new oo({width:S||1,height:T||1});for(const B in s){const z=s[B],L=p[B].paddedRect;oo.copy(z.data,A,{x:0,y:0},{x:L.x+vr,y:L.y+vr},z.data)}for(const B in h){const z=h[B],L=_[B].paddedRect,j=L.x+vr,q=L.y+vr,Y=z.data.width,K=z.data.height;oo.copy(z.data,A,{x:0,y:0},{x:j,y:q},z.data),oo.copy(z.data,A,{x:0,y:K-1},{x:j,y:q-1},{width:Y,height:1}),oo.copy(z.data,A,{x:0,y:0},{x:j,y:q+K},{width:Y,height:1}),oo.copy(z.data,A,{x:Y-1,y:0},{x:j-1,y:q},{width:1,height:K}),oo.copy(z.data,A,{x:0,y:0},{x:j+Y,y:q},{width:1,height:K})}this.image=A,this.iconPositions=p,this.patternPositions=_}addImages(s,h,p){for(const _ in s){const k=s[_],S={x:0,y:0,w:k.data.width+2*vr,h:k.data.height+2*vr};p.push(S),h[_]=new K_(S,k),k.hasRenderCallback&&this.haveRenderCallbacks.push(_)}}patchUpdatedImages(s,h){s.dispatchRenderCallbacks(this.haveRenderCallbacks);for(const p in s.updatedImages)this.patchUpdatedImage(this.iconPositions[p],s.getImage(p),h),this.patchUpdatedImage(this.patternPositions[p],s.getImage(p),h)}patchUpdatedImage(s,h,p){if(!s||!h||s.version===h.version)return;s.version=h.version;const[_,k]=s.tl;p.update(h.data,void 0,{x:_,y:k})}}var rl;ut("ImagePosition",K_),ut("ImageAtlas",NE),u.ah=void 0,(rl=u.ah||(u.ah={}))[rl.none=0]="none",rl[rl.horizontal=1]="horizontal",rl[rl.vertical=2]="vertical",rl[rl.horizontalOnly=3]="horizontalOnly";const Xd=-17;class Kd{constructor(){this.scale=1,this.fontStack="",this.imageName=null}static forText(s,h){const p=new Kd;return p.scale=s||1,p.fontStack=h,p}static forImage(s){const h=new Kd;return h.imageName=s,h}}class Hu{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(s,h){const p=new Hu;for(let _=0;_<s.sections.length;_++){const k=s.sections[_];k.image?p.addImageSection(k):p.addTextSection(k,h)}return p}length(){return this.text.length}getSection(s){return this.sections[this.sectionIndex[s]]}getSectionIndex(s){return this.sectionIndex[s]}getCharCode(s){return this.text.charCodeAt(s)}verticalizePunctuation(){this.text=function(s){let h="";for(let p=0;p<s.length;p++){const _=s.charCodeAt(p+1)||null,k=s.charCodeAt(p-1)||null;h+=_&&Am(_)&&!Yd[s[p+1]]||k&&Am(k)&&!Yd[s[p-1]]||!Yd[s[p]]?s[p]:Yd[s[p]]}return h}(this.text)}trim(){let s=0;for(let p=0;p<this.text.length&&qm[this.text.charCodeAt(p)];p++)s++;let h=this.text.length;for(let p=this.text.length-1;p>=0&&p>=s&&qm[this.text.charCodeAt(p)];p--)h--;this.text=this.text.substring(s,h),this.sectionIndex=this.sectionIndex.slice(s,h)}substring(s,h){const p=new Hu;return p.text=this.text.substring(s,h),p.sectionIndex=this.sectionIndex.slice(s,h),p.sections=this.sections,p}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((s,h)=>Math.max(s,this.sections[h].scale),0)}addTextSection(s,h){this.text+=s.text,this.sections.push(Kd.forText(s.scale,s.fontStack||h));const p=this.sections.length-1;for(let _=0;_<s.text.length;++_)this.sectionIndex.push(p)}addImageSection(s){const h=s.image?s.image.name:"";if(h.length===0)return void ot("Can't add FormattedSection with an empty image.");const p=this.getNextImageSectionCharCode();p?(this.text+=String.fromCharCode(p),this.sections.push(Kd.forImage(h)),this.sectionIndex.push(this.sections.length-1)):ot("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function Hm(c,s,h,p,_,k,S,T,A,B,z,L,j,q,Y){const K=Hu.fromFeature(c,_);let re;L===u.ah.vertical&&K.verticalizePunctuation();const{processBidirectionalText:ae,processStyledBidirectionalText:be}=br;if(ae&&K.sections.length===1){re=[];const Te=ae(K.toString(),J_(K,B,k,s,p,q));for(const Le of Te){const rt=new Hu;rt.text=Le,rt.sections=K.sections;for(let St=0;St<Le.length;St++)rt.sectionIndex.push(0);re.push(rt)}}else if(be){re=[];const Te=be(K.text,K.sectionIndex,J_(K,B,k,s,p,q));for(const Le of Te){const rt=new Hu;rt.text=Le[0],rt.sectionIndex=Le[1],rt.sections=K.sections,re.push(rt)}}else re=function(Te,Le){const rt=[],St=Te.text;let tt=0;for(const Je of Le)rt.push(Te.substring(tt,Je)),tt=Je;return tt<St.length&&rt.push(Te.substring(tt,St.length)),rt}(K,J_(K,B,k,s,p,q));const pe=[],ye={positionedLines:pe,text:K.toString(),top:z[1],bottom:z[1],left:z[0],right:z[0],writingMode:L,iconsInText:!1,verticalizable:!1};return function(Te,Le,rt,St,tt,Je,yt,dt,at,Oe,bt,gt){let Ot=0,Dn=Xd,An=0,gi=0;const Do=dt==="right"?1:dt==="left"?0:.5;let Ri=0;for(const ei of tt){ei.trim();const _i=ei.getMaxScale(),Yi=(_i-1)*hi,Li={positionedGlyphs:[],lineOffset:0};Te.positionedLines[Ri]=Li;const cr=Li.positionedGlyphs;let Vi=0;if(!ei.length()){Dn+=Je,++Ri;continue}for(let wr=0;wr<ei.length();wr++){const hn=ei.getSection(wr),Bn=ei.getSectionIndex(wr),Un=ei.getCharCode(wr);let Ur=0,Yn=null,Zu=null,ys=null,_s=hi;const Oo=!(at===u.ah.horizontal||!bt&&!Nd(Un)||bt&&(qm[Un]||(yi=Un,new RegExp("\\p{sc=Arab}","u").test(String.fromCodePoint(yi)))));if(hn.imageName){const lo=St[hn.imageName];if(!lo)continue;ys=hn.imageName,Te.iconsInText=Te.iconsInText||!0,Zu=lo.paddedRect;const Ei=lo.displaySize;hn.scale=hn.scale*hi/gt,Yn={width:Ei[0],height:Ei[1],left:vr,top:-BE,advance:Oo?Ei[1]:Ei[0]},Ur=Yi+(hi-Ei[1]*hn.scale),_s=Yn.advance;const ta=Oo?Ei[0]*hn.scale-hi*_i:Ei[1]*hn.scale-hi*_i;ta>0&&ta>Vi&&(Vi=ta)}else{const lo=rt[hn.fontStack],Ei=lo&&lo[Un];if(Ei&&Ei.rect)Zu=Ei.rect,Yn=Ei.metrics;else{const ta=Le[hn.fontStack],ip=ta&&ta[Un];if(!ip)continue;Yn=ip.metrics}Ur=(_i-hn.scale)*hi}Oo?(Te.verticalizable=!0,cr.push({glyph:Un,imageName:ys,x:Ot,y:Dn+Ur,vertical:Oo,scale:hn.scale,fontStack:hn.fontStack,sectionIndex:Bn,metrics:Yn,rect:Zu}),Ot+=_s*hn.scale+Oe):(cr.push({glyph:Un,imageName:ys,x:Ot,y:Dn+Ur,vertical:Oo,scale:hn.scale,fontStack:hn.fontStack,sectionIndex:Bn,metrics:Yn,rect:Zu}),Ot+=Yn.advance*hn.scale+Oe)}cr.length!==0&&(An=Math.max(Ot-Oe,An),mG(cr,0,cr.length-1,Do,Vi)),Ot=0;const ao=Je*_i+Vi;Li.lineOffset=Math.max(Vi,Yi),Dn+=ao,gi=Math.max(ao,gi),++Ri}var yi;const sr=Dn-Xd,{horizontalAlign:ar,verticalAlign:lr}=Q_(yt);(function(ei,_i,Yi,Li,cr,Vi,ao,wr,hn){const Bn=(_i-Yi)*cr;let Un=0;Un=Vi!==ao?-wr*Li-Xd:(-Li*hn+.5)*ao;for(const Ur of ei)for(const Yn of Ur.positionedGlyphs)Yn.x+=Bn,Yn.y+=Un})(Te.positionedLines,Do,ar,lr,An,gi,Je,sr,tt.length),Te.top+=-lr*sr,Te.bottom=Te.top+sr,Te.left+=-ar*An,Te.right=Te.left+An}(ye,s,h,p,re,S,T,A,L,B,j,Y),!function(Te){for(const Le of Te)if(Le.positionedGlyphs.length!==0)return!1;return!0}(pe)&&ye}const qm={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},dG={10:!0,32:!0,38:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0},pG={40:!0};function RE(c,s,h,p,_,k){if(s.imageName){const S=p[s.imageName];return S?S.displaySize[0]*s.scale*hi/k+_:0}{const S=h[s.fontStack],T=S&&S[c];return T?T.metrics.advance*s.scale+_:0}}function LE(c,s,h,p){const _=Math.pow(c-s,2);return p?c<s?_/2:2*_:_+Math.abs(h)*h}function fG(c,s,h){let p=0;return c===10&&(p-=1e4),h&&(p+=150),c!==40&&c!==65288||(p+=50),s!==41&&s!==65289||(p+=50),p}function VE(c,s,h,p,_,k){let S=null,T=LE(s,h,_,k);for(const A of p){const B=LE(s-A.x,h,_,k)+A.badness;B<=T&&(S=A,T=B)}return{index:c,x:s,priorBreak:S,badness:T}}function FE(c){return c?FE(c.priorBreak).concat(c.index):[]}function J_(c,s,h,p,_,k){if(!c)return[];const S=[],T=function(L,j,q,Y,K,re){let ae=0;for(let be=0;be<L.length();be++){const pe=L.getSection(be);ae+=RE(L.getCharCode(be),pe,Y,K,j,re)}return ae/Math.max(1,Math.ceil(ae/q))}(c,s,h,p,_,k),A=c.text.indexOf("​")>=0;let B=0;for(let L=0;L<c.length();L++){const j=c.getSection(L),q=c.getCharCode(L);if(qm[q]||(B+=RE(q,j,p,_,s,k)),L<c.length()-1){const Y=!((z=q)<11904)&&(!!en["CJK Compatibility Forms"](z)||!!en["CJK Compatibility"](z)||!!en["CJK Strokes"](z)||!!en["CJK Symbols and Punctuation"](z)||!!en["Enclosed CJK Letters and Months"](z)||!!en["Halfwidth and Fullwidth Forms"](z)||!!en["Ideographic Description Characters"](z)||!!en["Vertical Forms"](z)||Mm.test(String.fromCodePoint(z)));(dG[q]||Y||j.imageName||L!==c.length()-2&&pG[c.getCharCode(L+1)])&&S.push(VE(L+1,B,T,S,fG(q,c.getCharCode(L+1),Y&&A),!1))}}var z;return FE(VE(c.length(),B,T,S,0,!0))}function Q_(c){let s=.5,h=.5;switch(c){case"right":case"top-right":case"bottom-right":s=1;break;case"left":case"top-left":case"bottom-left":s=0}switch(c){case"bottom":case"bottom-right":case"bottom-left":h=1;break;case"top":case"top-right":case"top-left":h=0}return{horizontalAlign:s,verticalAlign:h}}function mG(c,s,h,p,_){if(!p&&!_)return;const k=c[h],S=(c[h].x+k.metrics.advance*k.scale)*p;for(let T=s;T<=h;T++)c[T].x-=S,c[T].y+=_}function gG(c,s,h){const{horizontalAlign:p,verticalAlign:_}=Q_(h),k=s[0]-c.displaySize[0]*p,S=s[1]-c.displaySize[1]*_;return{image:c,top:S,bottom:S+c.displaySize[1],left:k,right:k+c.displaySize[0]}}function $E(c){var s,h;let p=c.left,_=c.top,k=c.right-p,S=c.bottom-_;const T=(s=c.image.textFitWidth)!==null&&s!==void 0?s:"stretchOrShrink",A=(h=c.image.textFitHeight)!==null&&h!==void 0?h:"stretchOrShrink",B=(c.image.content[2]-c.image.content[0])/(c.image.content[3]-c.image.content[1]);if(A==="proportional"){if(T==="stretchOnly"&&k/S<B||T==="proportional"){const z=Math.ceil(S*B);p*=z/k,k=z}}else if(T==="proportional"&&A==="stretchOnly"&&B!==0&&k/S>B){const z=Math.ceil(k/B);_*=z/S,S=z}return{x1:p,y1:_,x2:p+k,y2:_+S}}function jE(c,s,h,p,_,k){const S=c.image;let T;if(S.content){const re=S.content,ae=S.pixelRatio||1;T=[re[0]/ae,re[1]/ae,S.displaySize[0]-re[2]/ae,S.displaySize[1]-re[3]/ae]}const A=s.left*k,B=s.right*k;let z,L,j,q;h==="width"||h==="both"?(q=_[0]+A-p[3],L=_[0]+B+p[1]):(q=_[0]+(A+B-S.displaySize[0])/2,L=q+S.displaySize[0]);const Y=s.top*k,K=s.bottom*k;return h==="height"||h==="both"?(z=_[1]+Y-p[0],j=_[1]+K+p[2]):(z=_[1]+(Y+K-S.displaySize[1])/2,j=z+S.displaySize[1]),{image:S,top:z,right:L,bottom:j,left:q,collisionPadding:T}}const Jd=255,gs=128,ol=Jd*gs;function UE(c,s){const{expression:h}=s;if(h.kind==="constant")return{kind:"constant",layoutSize:h.evaluate(new Vn(c+1))};if(h.kind==="source")return{kind:"source"};{const{zoomStops:p,interpolationType:_}=h;let k=0;for(;k<p.length&&p[k]<=c;)k++;k=Math.max(0,k-1);let S=k;for(;S<p.length&&p[S]<c+1;)S++;S=Math.min(p.length-1,S);const T=p[k],A=p[S];return h.kind==="composite"?{kind:"composite",minZoom:T,maxZoom:A,interpolationType:_}:{kind:"camera",minZoom:T,maxZoom:A,minSize:h.evaluate(new Vn(T)),maxSize:h.evaluate(new Vn(A)),interpolationType:_}}}function eb(c,s,h){let p="never";const _=c.get(s);return _?p=_:c.get(h)&&(p="always"),p}const yG=il.VectorTileFeature.types,_G=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function Wm(c,s,h,p,_,k,S,T,A,B,z,L,j){const q=T?Math.min(ol,Math.round(T[0])):0,Y=T?Math.min(ol,Math.round(T[1])):0;c.emplaceBack(s,h,Math.round(32*p),Math.round(32*_),k,S,(q<<1)+(A?1:0),Y,16*B,16*z,256*L,256*j)}function tb(c,s,h){c.emplaceBack(s.x,s.y,h),c.emplaceBack(s.x,s.y,h),c.emplaceBack(s.x,s.y,h),c.emplaceBack(s.x,s.y,h)}function bG(c){for(const s of c.sections)if(A_(s.text))return!0;return!1}class nb{constructor(s){this.layoutVertexArray=new Ou,this.indexArray=new ro,this.programConfigurations=s,this.segments=new tn,this.dynamicLayoutVertexArray=new Vd,this.opacityVertexArray=new $r,this.hasVisibleVertices=!1,this.placedSymbolArray=new Fn}isEmpty(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0}upload(s,h,p,_){this.isEmpty()||(p&&(this.layoutVertexBuffer=s.createVertexBuffer(this.layoutVertexArray,YW.members),this.indexBuffer=s.createIndexBuffer(this.indexArray,h),this.dynamicLayoutVertexBuffer=s.createVertexBuffer(this.dynamicLayoutVertexArray,XW.members,!0),this.opacityVertexBuffer=s.createVertexBuffer(this.opacityVertexArray,_G,!0),this.opacityVertexBuffer.itemSize=1),(p||_)&&this.programConfigurations.upload(s))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy())}}ut("SymbolBuffers",nb);class ib{constructor(s,h,p){this.layoutVertexArray=new s,this.layoutAttributes=h,this.indexArray=new p,this.segments=new tn,this.collisionVertexArray=new fs}upload(s){this.layoutVertexBuffer=s.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=s.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=s.createVertexBuffer(this.collisionVertexArray,KW.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}}ut("CollisionBuffers",ib);class qu{constructor(s){this.collisionBoxArray=s.collisionBoxArray,this.zoom=s.zoom,this.overscaling=s.overscaling,this.layers=s.layers,this.layerIds=this.layers.map(S=>S.id),this.index=s.index,this.pixelRatio=s.pixelRatio,this.sourceLayerIndex=s.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=N_([]),this.placementViewportMatrix=N_([]);const h=this.layers[0]._unevaluatedLayout._values;this.textSizeData=UE(this.zoom,h["text-size"]),this.iconSizeData=UE(this.zoom,h["icon-size"]);const p=this.layers[0].layout,_=p.get("symbol-sort-key"),k=p.get("symbol-z-order");this.canOverlap=eb(p,"text-overlap","text-allow-overlap")!=="never"||eb(p,"icon-overlap","icon-allow-overlap")!=="never"||p.get("text-ignore-placement")||p.get("icon-ignore-placement"),this.sortFeaturesByKey=k!=="viewport-y"&&!_.isConstant(),this.sortFeaturesByY=(k==="viewport-y"||k==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,p.get("symbol-placement")==="point"&&(this.writingModes=p.get("text-writing-mode").map(S=>u.ah[S])),this.stateDependentLayerIds=this.layers.filter(S=>S.isStateDependent()).map(S=>S.id),this.sourceID=s.sourceID}createArrays(){this.text=new nb(new rc(this.layers,this.zoom,s=>/^text/.test(s))),this.icon=new nb(new rc(this.layers,this.zoom,s=>/^icon/.test(s))),this.glyphOffsetArray=new $n,this.lineVertexArray=new Oi,this.symbolInstances=new Jt,this.textAnchorOffsets=new jn}calculateGlyphDependencies(s,h,p,_,k){for(let S=0;S<s.length;S++)if(h[s.charCodeAt(S)]=!0,(p||_)&&k){const T=Yd[s.charAt(S)];T&&(h[T.charCodeAt(0)]=!0)}}populate(s,h,p){const _=this.layers[0],k=_.layout,S=k.get("text-font"),T=k.get("text-field"),A=k.get("icon-image"),B=(T.value.kind!=="constant"||T.value.value instanceof mr&&!T.value.value.isEmpty()||T.value.value.toString().length>0)&&(S.value.kind!=="constant"||S.value.value.length>0),z=A.value.kind!=="constant"||!!A.value.value||Object.keys(A.parameters).length>0,L=k.get("symbol-sort-key");if(this.features=[],!B&&!z)return;const j=h.iconDependencies,q=h.glyphDependencies,Y=h.availableImages,K=new Vn(this.zoom);for(const{feature:re,id:ae,index:be,sourceLayerIndex:pe}of s){const ye=_._featureFilter.needGeometry,Te=sc(re,ye);if(!_._featureFilter.filter(K,Te,p))continue;let Le,rt;if(ye||(Te.geometry=oc(re)),B){const tt=_.getValueAndResolveTokens("text-field",Te,p,Y),Je=mr.factory(tt),yt=this.hasRTLText=this.hasRTLText||bG(Je);(!yt||br.getRTLTextPluginStatus()==="unavailable"||yt&&br.isParsed())&&(Le=QW(Je,_,Te))}if(z){const tt=_.getValueAndResolveTokens("icon-image",Te,p,Y);rt=tt instanceof yr?tt:yr.fromString(tt)}if(!Le&&!rt)continue;const St=this.sortFeaturesByKey?L.evaluate(Te,{},p):void 0;if(this.features.push({id:ae,text:Le,icon:rt,index:be,sourceLayerIndex:pe,geometry:Te.geometry,properties:re.properties,type:yG[re.type],sortKey:St}),rt&&(j[rt.name]=!0),Le){const tt=S.evaluate(Te,{},p).join(","),Je=k.get("text-rotation-alignment")!=="viewport"&&k.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(u.ah.vertical)>=0;for(const yt of Le.sections)if(yt.image)j[yt.image.name]=!0;else{const dt=Bd(Le.toString()),at=yt.fontStack||tt,Oe=q[at]=q[at]||{};this.calculateGlyphDependencies(yt.text,Oe,Je,this.allowVerticalPlacement,dt)}}}k.get("symbol-placement")==="line"&&(this.features=function(re){const ae={},be={},pe=[];let ye=0;function Te(tt){pe.push(re[tt]),ye++}function Le(tt,Je,yt){const dt=be[tt];return delete be[tt],be[Je]=dt,pe[dt].geometry[0].pop(),pe[dt].geometry[0]=pe[dt].geometry[0].concat(yt[0]),dt}function rt(tt,Je,yt){const dt=ae[Je];return delete ae[Je],ae[tt]=dt,pe[dt].geometry[0].shift(),pe[dt].geometry[0]=yt[0].concat(pe[dt].geometry[0]),dt}function St(tt,Je,yt){const dt=yt?Je[0][Je[0].length-1]:Je[0][0];return`${tt}:${dt.x}:${dt.y}`}for(let tt=0;tt<re.length;tt++){const Je=re[tt],yt=Je.geometry,dt=Je.text?Je.text.toString():null;if(!dt){Te(tt);continue}const at=St(dt,yt),Oe=St(dt,yt,!0);if(at in be&&Oe in ae&&be[at]!==ae[Oe]){const bt=rt(at,Oe,yt),gt=Le(at,Oe,pe[bt].geometry);delete ae[at],delete be[Oe],be[St(dt,pe[gt].geometry,!0)]=gt,pe[bt].geometry=null}else at in be?Le(at,Oe,yt):Oe in ae?rt(at,Oe,yt):(Te(tt),ae[at]=ye-1,be[Oe]=ye-1)}return pe.filter(tt=>tt.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((re,ae)=>re.sortKey-ae.sortKey)}update(s,h,p){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(s,h,this.layers,p),this.icon.programConfigurations.updatePaintArrays(s,h,this.layers,p))}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(s){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(s),this.iconCollisionBox.upload(s)),this.text.upload(s,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(s,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(s,h){const p=this.lineVertexArray.length;if(s.segment!==void 0){let _=s.dist(h[s.segment+1]),k=s.dist(h[s.segment]);const S={};for(let T=s.segment+1;T<h.length;T++)S[T]={x:h[T].x,y:h[T].y,tileUnitDistanceFromAnchor:_},T<h.length-1&&(_+=h[T+1].dist(h[T]));for(let T=s.segment||0;T>=0;T--)S[T]={x:h[T].x,y:h[T].y,tileUnitDistanceFromAnchor:k},T>0&&(k+=h[T-1].dist(h[T]));for(let T=0;T<h.length;T++){const A=S[T];this.lineVertexArray.emplaceBack(A.x,A.y,A.tileUnitDistanceFromAnchor)}}return{lineStartIndex:p,lineLength:this.lineVertexArray.length-p}}addSymbols(s,h,p,_,k,S,T,A,B,z,L,j){const q=s.indexArray,Y=s.layoutVertexArray,K=s.segments.prepareSegment(4*h.length,Y,q,this.canOverlap?S.sortKey:void 0),re=this.glyphOffsetArray.length,ae=K.vertexLength,be=this.allowVerticalPlacement&&T===u.ah.vertical?Math.PI/2:0,pe=S.text&&S.text.sections;for(let ye=0;ye<h.length;ye++){const{tl:Te,tr:Le,bl:rt,br:St,tex:tt,pixelOffsetTL:Je,pixelOffsetBR:yt,minFontScaleX:dt,minFontScaleY:at,glyphOffset:Oe,isSDF:bt,sectionIndex:gt}=h[ye],Ot=K.vertexLength,Dn=Oe[1];Wm(Y,A.x,A.y,Te.x,Dn+Te.y,tt.x,tt.y,p,bt,Je.x,Je.y,dt,at),Wm(Y,A.x,A.y,Le.x,Dn+Le.y,tt.x+tt.w,tt.y,p,bt,yt.x,Je.y,dt,at),Wm(Y,A.x,A.y,rt.x,Dn+rt.y,tt.x,tt.y+tt.h,p,bt,Je.x,yt.y,dt,at),Wm(Y,A.x,A.y,St.x,Dn+St.y,tt.x+tt.w,tt.y+tt.h,p,bt,yt.x,yt.y,dt,at),tb(s.dynamicLayoutVertexArray,A,be),q.emplaceBack(Ot,Ot+1,Ot+2),q.emplaceBack(Ot+1,Ot+2,Ot+3),K.vertexLength+=4,K.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(Oe[0]),ye!==h.length-1&&gt===h[ye+1].sectionIndex||s.programConfigurations.populatePaintArrays(Y.length,S,S.index,{},j,pe&&pe[gt])}s.placedSymbolArray.emplaceBack(A.x,A.y,re,this.glyphOffsetArray.length-re,ae,B,z,A.segment,p?p[0]:0,p?p[1]:0,_[0],_[1],T,0,!1,0,L)}_addCollisionDebugVertex(s,h,p,_,k,S){return h.emplaceBack(0,0),s.emplaceBack(p.x,p.y,_,k,Math.round(S.x),Math.round(S.y))}addCollisionDebugVertices(s,h,p,_,k,S,T){const A=k.segments.prepareSegment(4,k.layoutVertexArray,k.indexArray),B=A.vertexLength,z=k.layoutVertexArray,L=k.collisionVertexArray,j=T.anchorX,q=T.anchorY;this._addCollisionDebugVertex(z,L,S,j,q,new E(s,h)),this._addCollisionDebugVertex(z,L,S,j,q,new E(p,h)),this._addCollisionDebugVertex(z,L,S,j,q,new E(p,_)),this._addCollisionDebugVertex(z,L,S,j,q,new E(s,_)),A.vertexLength+=4;const Y=k.indexArray;Y.emplaceBack(B,B+1),Y.emplaceBack(B+1,B+2),Y.emplaceBack(B+2,B+3),Y.emplaceBack(B+3,B),A.primitiveLength+=4}addDebugCollisionBoxes(s,h,p,_){for(let k=s;k<h;k++){const S=this.collisionBoxArray.get(k);this.addCollisionDebugVertices(S.x1,S.y1,S.x2,S.y2,_?this.textCollisionBox:this.iconCollisionBox,S.anchorPoint,p)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new ib(jr,CE.members,Si),this.iconCollisionBox=new ib(jr,CE.members,Si);for(let s=0;s<this.symbolInstances.length;s++){const h=this.symbolInstances.get(s);this.addDebugCollisionBoxes(h.textBoxStartIndex,h.textBoxEndIndex,h,!0),this.addDebugCollisionBoxes(h.verticalTextBoxStartIndex,h.verticalTextBoxEndIndex,h,!0),this.addDebugCollisionBoxes(h.iconBoxStartIndex,h.iconBoxEndIndex,h,!1),this.addDebugCollisionBoxes(h.verticalIconBoxStartIndex,h.verticalIconBoxEndIndex,h,!1)}}_deserializeCollisionBoxesForSymbol(s,h,p,_,k,S,T,A,B){const z={};for(let L=h;L<p;L++){const j=s.get(L);z.textBox={x1:j.x1,y1:j.y1,x2:j.x2,y2:j.y2,anchorPointX:j.anchorPointX,anchorPointY:j.anchorPointY},z.textFeatureIndex=j.featureIndex;break}for(let L=_;L<k;L++){const j=s.get(L);z.verticalTextBox={x1:j.x1,y1:j.y1,x2:j.x2,y2:j.y2,anchorPointX:j.anchorPointX,anchorPointY:j.anchorPointY},z.verticalTextFeatureIndex=j.featureIndex;break}for(let L=S;L<T;L++){const j=s.get(L);z.iconBox={x1:j.x1,y1:j.y1,x2:j.x2,y2:j.y2,anchorPointX:j.anchorPointX,anchorPointY:j.anchorPointY},z.iconFeatureIndex=j.featureIndex;break}for(let L=A;L<B;L++){const j=s.get(L);z.verticalIconBox={x1:j.x1,y1:j.y1,x2:j.x2,y2:j.y2,anchorPointX:j.anchorPointX,anchorPointY:j.anchorPointY},z.verticalIconFeatureIndex=j.featureIndex;break}return z}deserializeCollisionBoxes(s){this.collisionArrays=[];for(let h=0;h<this.symbolInstances.length;h++){const p=this.symbolInstances.get(h);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(s,p.textBoxStartIndex,p.textBoxEndIndex,p.verticalTextBoxStartIndex,p.verticalTextBoxEndIndex,p.iconBoxStartIndex,p.iconBoxEndIndex,p.verticalIconBoxStartIndex,p.verticalIconBoxEndIndex))}}hasTextData(){return this.text.segments.get().length>0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}addIndicesForPlacedSymbol(s,h){const p=s.placedSymbolArray.get(h),_=p.vertexStartIndex+4*p.numGlyphs;for(let k=p.vertexStartIndex;k<_;k+=4)s.indexArray.emplaceBack(k,k+1,k+2),s.indexArray.emplaceBack(k+1,k+2,k+3)}getSortedSymbolIndexes(s){if(this.sortedAngle===s&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;const h=Math.sin(s),p=Math.cos(s),_=[],k=[],S=[];for(let T=0;T<this.symbolInstances.length;++T){S.push(T);const A=this.symbolInstances.get(T);_.push(0|Math.round(h*A.anchorX+p*A.anchorY)),k.push(A.featureIndex)}return S.sort((T,A)=>_[T]-_[A]||k[A]-k[T]),S}addToSortKeyRanges(s,h){const p=this.sortKeyRanges[this.sortKeyRanges.length-1];p&&p.sortKey===h?p.symbolInstanceEnd=s+1:this.sortKeyRanges.push({sortKey:h,symbolInstanceStart:s,symbolInstanceEnd:s+1})}sortFeatures(s){if(this.sortFeaturesByY&&this.sortedAngle!==s&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(s),this.sortedAngle=s,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const h of this.symbolInstanceIndexes){const p=this.symbolInstances.get(h);this.featureSortOrder.push(p.featureIndex),[p.rightJustifiedTextSymbolIndex,p.centerJustifiedTextSymbolIndex,p.leftJustifiedTextSymbolIndex].forEach((_,k,S)=>{_>=0&&S.indexOf(_)===k&&this.addIndicesForPlacedSymbol(this.text,_)}),p.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,p.verticalPlacedTextSymbolIndex),p.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,p.placedIconSymbolIndex),p.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,p.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}let HE,qE;ut("SymbolBucket",qu,{omit:["layers","collisionBoxArray","features","compareText"]}),qu.MAX_GLYPHS=65535,qu.addDynamicAttributes=tb;var rb={get paint(){return qE=qE||new v({"icon-opacity":new Et(we.paint_symbol["icon-opacity"]),"icon-color":new Et(we.paint_symbol["icon-color"]),"icon-halo-color":new Et(we.paint_symbol["icon-halo-color"]),"icon-halo-width":new Et(we.paint_symbol["icon-halo-width"]),"icon-halo-blur":new Et(we.paint_symbol["icon-halo-blur"]),"icon-translate":new ft(we.paint_symbol["icon-translate"]),"icon-translate-anchor":new ft(we.paint_symbol["icon-translate-anchor"]),"text-opacity":new Et(we.paint_symbol["text-opacity"]),"text-color":new Et(we.paint_symbol["text-color"],{runtimeType:vt,getOverride:c=>c.textColor,hasOverride:c=>!!c.textColor}),"text-halo-color":new Et(we.paint_symbol["text-halo-color"]),"text-halo-width":new Et(we.paint_symbol["text-halo-width"]),"text-halo-blur":new Et(we.paint_symbol["text-halo-blur"]),"text-translate":new ft(we.paint_symbol["text-translate"]),"text-translate-anchor":new ft(we.paint_symbol["text-translate-anchor"])})},get layout(){return HE=HE||new v({"symbol-placement":new ft(we.layout_symbol["symbol-placement"]),"symbol-spacing":new ft(we.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new ft(we.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new Et(we.layout_symbol["symbol-sort-key"]),"symbol-z-order":new ft(we.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new ft(we.layout_symbol["icon-allow-overlap"]),"icon-overlap":new ft(we.layout_symbol["icon-overlap"]),"icon-ignore-placement":new ft(we.layout_symbol["icon-ignore-placement"]),"icon-optional":new ft(we.layout_symbol["icon-optional"]),"icon-rotation-alignment":new ft(we.layout_symbol["icon-rotation-alignment"]),"icon-size":new Et(we.layout_symbol["icon-size"]),"icon-text-fit":new ft(we.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new ft(we.layout_symbol["icon-text-fit-padding"]),"icon-image":new Et(we.layout_symbol["icon-image"]),"icon-rotate":new Et(we.layout_symbol["icon-rotate"]),"icon-padding":new Et(we.layout_symbol["icon-padding"]),"icon-keep-upright":new ft(we.layout_symbol["icon-keep-upright"]),"icon-offset":new Et(we.layout_symbol["icon-offset"]),"icon-anchor":new Et(we.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new ft(we.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new ft(we.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new ft(we.layout_symbol["text-rotation-alignment"]),"text-field":new Et(we.layout_symbol["text-field"]),"text-font":new Et(we.layout_symbol["text-font"]),"text-size":new Et(we.layout_symbol["text-size"]),"text-max-width":new Et(we.layout_symbol["text-max-width"]),"text-line-height":new ft(we.layout_symbol["text-line-height"]),"text-letter-spacing":new Et(we.layout_symbol["text-letter-spacing"]),"text-justify":new Et(we.layout_symbol["text-justify"]),"text-radial-offset":new Et(we.layout_symbol["text-radial-offset"]),"text-variable-anchor":new ft(we.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new Et(we.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new Et(we.layout_symbol["text-anchor"]),"text-max-angle":new ft(we.layout_symbol["text-max-angle"]),"text-writing-mode":new ft(we.layout_symbol["text-writing-mode"]),"text-rotate":new Et(we.layout_symbol["text-rotate"]),"text-padding":new ft(we.layout_symbol["text-padding"]),"text-keep-upright":new ft(we.layout_symbol["text-keep-upright"]),"text-transform":new Et(we.layout_symbol["text-transform"]),"text-offset":new Et(we.layout_symbol["text-offset"]),"text-allow-overlap":new ft(we.layout_symbol["text-allow-overlap"]),"text-overlap":new ft(we.layout_symbol["text-overlap"]),"text-ignore-placement":new ft(we.layout_symbol["text-ignore-placement"]),"text-optional":new ft(we.layout_symbol["text-optional"])})}};class WE{constructor(s){if(s.property.overrides===void 0)throw new Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=s.property.overrides?s.property.overrides.runtimeType:To,this.defaultValue=s}evaluate(s){if(s.formattedSection){const h=this.defaultValue.property.overrides;if(h&&h.hasOverride(s.formattedSection))return h.getOverride(s.formattedSection)}return s.feature&&s.featureState?this.defaultValue.evaluate(s.feature,s.featureState):this.defaultValue.property.specification.default}eachChild(s){this.defaultValue.isConstant()||s(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}ut("FormatSectionOverride",WE,{omit:["defaultValue"]});class Gm extends d{constructor(s){super(s,rb)}recalculate(s,h){if(super.recalculate(s,h),this.layout.get("icon-rotation-alignment")==="auto"&&(this.layout._values["icon-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-rotation-alignment")==="auto"&&(this.layout._values["text-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-pitch-alignment")==="auto"&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")==="map"?"map":"viewport"),this.layout.get("icon-pitch-alignment")==="auto"&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment")),this.layout.get("symbol-placement")==="point"){const p=this.layout.get("text-writing-mode");if(p){const _=[];for(const k of p)_.indexOf(k)<0&&_.push(k);this.layout._values["text-writing-mode"]=_}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(s,h,p,_){const k=this.layout.get(s).evaluate(h,{},p,_),S=this._unevaluatedLayout._values[s];return S.isDataDriven()||_u(S.value)||!k?k:function(T,A){return A.replace(/{([^{}]+)}/g,(B,z)=>T&&z in T?String(T[z]):"")}(h.properties,k)}createBucket(s){return new qu(s)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const s of rb.paint.overridableProperties){if(!Gm.hasPaintOverride(this.layout,s))continue;const h=this.paint.get(s),p=new WE(h),_=new yu(p,h.property.specification);let k=null;k=h.value.kind==="constant"||h.value.kind==="source"?new $a("source",_):new ja("composite",_,h.value.zoomStops),this.paint._values[s]=new Io(h.property,k,h.parameters)}}_handleOverridablePaintPropertyUpdate(s,h,p){return!(!this.layout||h.isDataDriven()||p.isDataDriven())&&Gm.hasPaintOverride(this.layout,s)}static hasPaintOverride(s,h){const p=s.get("text-field"),_=rb.paint.properties[h];let k=!1;const S=T=>{for(const A of T)if(_.overrides&&_.overrides.hasOverride(A))return void(k=!0)};if(p.value.kind==="constant"&&p.value.value instanceof mr)S(p.value.value.sections);else if(p.value.kind==="source"){const T=B=>{k||(B instanceof Jr&&si(B.value)===Kn?S(B.value.sections):B instanceof lu?S(B.sections):B.eachChild(T))},A=p.value;A._styleExpression&&T(A._styleExpression.expression)}return k}}let GE;var xG={get paint(){return GE=GE||new v({"background-color":new ft(we.paint_background["background-color"]),"background-pattern":new Pu(we.paint_background["background-pattern"]),"background-opacity":new ft(we.paint_background["background-opacity"])})}};class vG extends d{constructor(s){super(s,xG)}}let ZE;var wG={get paint(){return ZE=ZE||new v({"raster-opacity":new ft(we.paint_raster["raster-opacity"]),"raster-hue-rotate":new ft(we.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new ft(we.paint_raster["raster-brightness-min"]),"raster-brightness-max":new ft(we.paint_raster["raster-brightness-max"]),"raster-saturation":new ft(we.paint_raster["raster-saturation"]),"raster-contrast":new ft(we.paint_raster["raster-contrast"]),"raster-resampling":new ft(we.paint_raster["raster-resampling"]),"raster-fade-duration":new ft(we.paint_raster["raster-fade-duration"])})}};class kG extends d{constructor(s){super(s,wG)}}class SG extends d{constructor(s){super(s,{}),this.onAdd=h=>{this.implementation.onAdd&&this.implementation.onAdd(h,h.painter.context.gl)},this.onRemove=h=>{this.implementation.onRemove&&this.implementation.onRemove(h,h.painter.context.gl)},this.implementation=s}is3D(){return this.implementation.renderingMode==="3d"}hasOffscreenPass(){return this.implementation.prerender!==void 0}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){throw new Error("Custom layers cannot be serialized")}}class EG{constructor(s){this._methodToThrottle=s,this._triggered=!1,typeof MessageChannel<"u"&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._methodToThrottle()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(()=>{this._triggered=!1,this._methodToThrottle()},0))}remove(){delete this._channel,this._methodToThrottle=()=>{}}}const ob=63710088e-1;class sl{constructor(s,h){if(isNaN(s)||isNaN(h))throw new Error(`Invalid LngLat object: (${s}, ${h})`);if(this.lng=+s,this.lat=+h,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new sl(ve(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(s){const h=Math.PI/180,p=this.lat*h,_=s.lat*h,k=Math.sin(p)*Math.sin(_)+Math.cos(p)*Math.cos(_)*Math.cos((s.lng-this.lng)*h);return ob*Math.acos(Math.min(k,1))}static convert(s){if(s instanceof sl)return s;if(Array.isArray(s)&&(s.length===2||s.length===3))return new sl(Number(s[0]),Number(s[1]));if(!Array.isArray(s)&&typeof s=="object"&&s!==null)return new sl(Number("lng"in s?s.lng:s.lon),Number(s.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]")}}const YE=2*Math.PI*ob;function XE(c){return YE*Math.cos(c*Math.PI/180)}function KE(c){return(180+c)/360}function JE(c){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+c*Math.PI/360)))/360}function QE(c,s){return c/XE(s)}function sb(c){return 360/Math.PI*Math.atan(Math.exp((180-360*c)*Math.PI/180))-90}class Qd{constructor(s,h,p=0){this.x=+s,this.y=+h,this.z=+p}static fromLngLat(s,h=0){const p=sl.convert(s);return new Qd(KE(p.lng),JE(p.lat),QE(h,p.lat))}toLngLat(){return new sl(360*this.x-180,sb(this.y))}toAltitude(){return this.z*XE(sb(this.y))}meterInMercatorCoordinateUnits(){return 1/YE*(s=sb(this.y),1/Math.cos(s*Math.PI/180));var s}}function eC(c,s,h){var p=2*Math.PI*6378137/256/Math.pow(2,h);return[c*p-2*Math.PI*6378137/2,s*p-2*Math.PI*6378137/2]}class ab{constructor(s,h,p){if(!function(_,k,S){return!(_<0||_>25||S<0||S>=Math.pow(2,_)||k<0||k>=Math.pow(2,_))}(s,h,p))throw new Error(`x=${h}, y=${p}, z=${s} outside of bounds. 0<=x<${Math.pow(2,s)}, 0<=y<${Math.pow(2,s)} 0<=z<=25 `);this.z=s,this.x=h,this.y=p,this.key=ep(0,s,s,h,p)}equals(s){return this.z===s.z&&this.x===s.x&&this.y===s.y}url(s,h,p){const _=(S=this.y,T=this.z,A=eC(256*(k=this.x),256*(S=Math.pow(2,T)-S-1),T),B=eC(256*(k+1),256*(S+1),T),A[0]+","+A[1]+","+B[0]+","+B[1]);var k,S,T,A,B;const z=function(L,j,q){let Y,K="";for(let re=L;re>0;re--)Y=1<<re-1,K+=(j&Y?1:0)+(q&Y?2:0);return K}(this.z,this.x,this.y);return s[(this.x+this.y)%s.length].replace(/{prefix}/g,(this.x%16).toString(16)+(this.y%16).toString(16)).replace(/{z}/g,String(this.z)).replace(/{x}/g,String(this.x)).replace(/{y}/g,String(p==="tms"?Math.pow(2,this.z)-this.y-1:this.y)).replace(/{ratio}/g,h>1?"@2x":"").replace(/{quadkey}/g,z).replace(/{bbox-epsg-3857}/g,_)}isChildOf(s){const h=this.z-s.z;return h>0&&s.x===this.x>>h&&s.y===this.y>>h}getTilePoint(s){const h=Math.pow(2,this.z);return new E((s.x*h-this.x)*ai,(s.y*h-this.y)*ai)}toString(){return`${this.z}/${this.x}/${this.y}`}}class tC{constructor(s,h){this.wrap=s,this.canonical=h,this.key=ep(s,h.z,h.z,h.x,h.y)}}class so{constructor(s,h,p,_,k){if(s<p)throw new Error(`overscaledZ should be >= z; overscaledZ = ${s}; z = ${p}`);this.overscaledZ=s,this.wrap=h,this.canonical=new ab(p,+_,+k),this.key=ep(h,s,p,_,k)}clone(){return new so(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(s){return this.overscaledZ===s.overscaledZ&&this.wrap===s.wrap&&this.canonical.equals(s.canonical)}scaledTo(s){if(s>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${s}; overscaledZ = ${this.overscaledZ}`);const h=this.canonical.z-s;return s>this.canonical.z?new so(s,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new so(s,this.wrap,s,this.canonical.x>>h,this.canonical.y>>h)}calculateScaledKey(s,h){if(s>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${s}; overscaledZ = ${this.overscaledZ}`);const p=this.canonical.z-s;return s>this.canonical.z?ep(this.wrap*+h,s,this.canonical.z,this.canonical.x,this.canonical.y):ep(this.wrap*+h,s,s,this.canonical.x>>p,this.canonical.y>>p)}isChildOf(s){if(s.wrap!==this.wrap)return!1;const h=this.canonical.z-s.canonical.z;return s.overscaledZ===0||s.overscaledZ<this.overscaledZ&&s.canonical.x===this.canonical.x>>h&&s.canonical.y===this.canonical.y>>h}children(s){if(this.overscaledZ>=s)return[new so(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const h=this.canonical.z+1,p=2*this.canonical.x,_=2*this.canonical.y;return[new so(h,this.wrap,h,p,_),new so(h,this.wrap,h,p+1,_),new so(h,this.wrap,h,p,_+1),new so(h,this.wrap,h,p+1,_+1)]}isLessThan(s){return this.wrap<s.wrap||!(this.wrap>s.wrap)&&(this.overscaledZ<s.overscaledZ||!(this.overscaledZ>s.overscaledZ)&&(this.canonical.x<s.canonical.x||!(this.canonical.x>s.canonical.x)&&this.canonical.y<s.canonical.y))}wrapped(){return new so(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(s){return new so(this.overscaledZ,s,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return Math.pow(2,this.overscaledZ-this.canonical.z)}toUnwrapped(){return new tC(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(s){return this.canonical.getTilePoint(new Qd(s.x-this.wrap,s.y))}}function ep(c,s,h,p,_){(c*=2)<0&&(c=-1*c-1);const k=1<<h;return(k*k*c+k*_+p).toString(36)+h.toString(36)+s.toString(36)}ut("CanonicalTileID",ab),ut("OverscaledTileID",so,{omit:["posMatrix"]});class nC{constructor(s,h,p,_=1,k=1,S=1,T=0){if(this.uid=s,h.height!==h.width)throw new RangeError("DEM tiles must be square");if(p&&!["mapbox","terrarium","custom"].includes(p))return void ot(`"${p}" is not a valid encoding type. Valid types include "mapbox", "terrarium" and "custom".`);this.stride=h.height;const A=this.dim=h.height-2;switch(this.data=new Uint32Array(h.data.buffer),p){case"terrarium":this.redFactor=256,this.greenFactor=1,this.blueFactor=1/256,this.baseShift=32768;break;case"custom":this.redFactor=_,this.greenFactor=k,this.blueFactor=S,this.baseShift=T;break;default:this.redFactor=6553.6,this.greenFactor=25.6,this.blueFactor=.1,this.baseShift=1e4}for(let B=0;B<A;B++)this.data[this._idx(-1,B)]=this.data[this._idx(0,B)],this.data[this._idx(A,B)]=this.data[this._idx(A-1,B)],this.data[this._idx(B,-1)]=this.data[this._idx(B,0)],this.data[this._idx(B,A)]=this.data[this._idx(B,A-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(A,-1)]=this.data[this._idx(A-1,0)],this.data[this._idx(-1,A)]=this.data[this._idx(0,A-1)],this.data[this._idx(A,A)]=this.data[this._idx(A-1,A-1)],this.min=Number.MAX_SAFE_INTEGER,this.max=Number.MIN_SAFE_INTEGER;for(let B=0;B<A;B++)for(let z=0;z<A;z++){const L=this.get(B,z);L>this.max&&(this.max=L),L<this.min&&(this.min=L)}}get(s,h){const p=new Uint8Array(this.data.buffer),_=4*this._idx(s,h);return this.unpack(p[_],p[_+1],p[_+2])}getUnpackVector(){return[this.redFactor,this.greenFactor,this.blueFactor,this.baseShift]}_idx(s,h){if(s<-1||s>=this.dim+1||h<-1||h>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(h+1)*this.stride+(s+1)}unpack(s,h,p){return s*this.redFactor+h*this.greenFactor+p*this.blueFactor-this.baseShift}getPixels(){return new oo({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(s,h,p){if(this.dim!==s.dim)throw new Error("dem dimension mismatch");let _=h*this.dim,k=h*this.dim+this.dim,S=p*this.dim,T=p*this.dim+this.dim;switch(h){case-1:_=k-1;break;case 1:k=_+1}switch(p){case-1:S=T-1;break;case 1:T=S+1}const A=-h*this.dim,B=-p*this.dim;for(let z=S;z<T;z++)for(let L=_;L<k;L++)this.data[this._idx(L,z)]=s.data[this._idx(L+A,z+B)]}}ut("DEMData",nC);class iC{constructor(s){this._stringToNumber={},this._numberToString=[];for(let h=0;h<s.length;h++){const p=s[h];this._stringToNumber[p]=h,this._numberToString[h]=p}}encode(s){return this._stringToNumber[s]}decode(s){if(s>=this._numberToString.length)throw new Error(`Out of bounds. Index requested n=${s} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[s]}}class rC{constructor(s,h,p,_,k){this.type="Feature",this._vectorTileFeature=s,s._z=h,s._x=p,s._y=_,this.properties=s.properties,this.id=k}get geometry(){return this._geometry===void 0&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry}set geometry(s){this._geometry=s}toJSON(){const s={geometry:this.geometry};for(const h in this)h!=="_geometry"&&h!=="_vectorTileFeature"&&(s[h]=this[h]);return s}}class oC{constructor(s,h){this.tileID=s,this.x=s.canonical.x,this.y=s.canonical.y,this.z=s.canonical.z,this.grid=new Wa(ai,16,0),this.grid3D=new Wa(ai,16,0),this.featureIndexArray=new Gi,this.promoteId=h}insert(s,h,p,_,k,S){const T=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(p,_,k);const A=S?this.grid3D:this.grid;for(let B=0;B<h.length;B++){const z=h[B],L=[1/0,1/0,-1/0,-1/0];for(let j=0;j<z.length;j++){const q=z[j];L[0]=Math.min(L[0],q.x),L[1]=Math.min(L[1],q.y),L[2]=Math.max(L[2],q.x),L[3]=Math.max(L[3],q.y)}L[0]<ai&&L[1]<ai&&L[2]>=0&&L[3]>=0&&A.insert(T,L[0],L[1],L[2],L[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new il.VectorTile(new Y_(this.rawTileData)).layers,this.sourceLayerCoder=new iC(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(s,h,p,_){this.loadVTLayers();const k=s.params||{},S=ai/s.tileSize/s.scale,T=bd(k.filter),A=s.queryGeometry,B=s.queryPadding*S,z=aC(A),L=this.grid.query(z.minX-B,z.minY-B,z.maxX+B,z.maxY+B),j=aC(s.cameraQueryGeometry),q=this.grid3D.query(j.minX-B,j.minY-B,j.maxX+B,j.maxY+B,(re,ae,be,pe)=>function(ye,Te,Le,rt,St){for(const Je of ye)if(Te<=Je.x&&Le<=Je.y&&rt>=Je.x&&St>=Je.y)return!0;const tt=[new E(Te,Le),new E(Te,St),new E(rt,St),new E(rt,Le)];if(ye.length>2){for(const Je of tt)if(Lu(ye,Je))return!0}for(let Je=0;Je<ye.length-1;Je++)if(oW(ye[Je],ye[Je+1],tt))return!0;return!1}(s.cameraQueryGeometry,re-B,ae-B,be+B,pe+B));for(const re of q)L.push(re);L.sort(CG);const Y={};let K;for(let re=0;re<L.length;re++){const ae=L[re];if(ae===K)continue;K=ae;const be=this.featureIndexArray.get(ae);let pe=null;this.loadMatchingFeature(Y,be.bucketIndex,be.sourceLayerIndex,be.featureIndex,T,k.layers,k.availableImages,h,p,_,(ye,Te,Le)=>(pe||(pe=oc(ye)),Te.queryIntersectsFeature(A,ye,Le,pe,this.z,s.transform,S,s.pixelPosMatrix)))}return Y}loadMatchingFeature(s,h,p,_,k,S,T,A,B,z,L){const j=this.bucketLayerIDs[h];if(S&&!function(re,ae){for(let be=0;be<re.length;be++)if(ae.indexOf(re[be])>=0)return!0;return!1}(S,j))return;const q=this.sourceLayerCoder.decode(p),Y=this.vtLayers[q].feature(_);if(k.needGeometry){const re=sc(Y,!0);if(!k.filter(new Vn(this.tileID.overscaledZ),re,this.tileID.canonical))return}else if(!k.filter(new Vn(this.tileID.overscaledZ),Y))return;const K=this.getId(Y,q);for(let re=0;re<j.length;re++){const ae=j[re];if(S&&S.indexOf(ae)<0)continue;const be=A[ae];if(!be)continue;let pe={};K&&z&&(pe=z.getState(be.sourceLayer||"_geojsonTileLayer",K));const ye=Se({},B[ae]);ye.paint=sC(ye.paint,be.paint,Y,pe,T),ye.layout=sC(ye.layout,be.layout,Y,pe,T);const Te=!L||L(Y,be,pe);if(!Te)continue;const Le=new rC(Y,this.z,this.x,this.y,K);Le.layer=ye;let rt=s[ae];rt===void 0&&(rt=s[ae]=[]),rt.push({featureIndex:_,feature:Le,intersectionZ:Te})}}lookupSymbolFeatures(s,h,p,_,k,S,T,A){const B={};this.loadVTLayers();const z=bd(k);for(const L of s)this.loadMatchingFeature(B,p,_,L,z,S,T,A,h);return B}hasLayer(s){for(const h of this.bucketLayerIDs)for(const p of h)if(s===p)return!0;return!1}getId(s,h){let p=s.id;return this.promoteId&&(p=s.properties[typeof this.promoteId=="string"?this.promoteId:this.promoteId[h]],typeof p=="boolean"&&(p=Number(p))),p}}function sC(c,s,h,p,_){return Ae(c,(k,S)=>{const T=s instanceof tc?s.get(S):null;return T&&T.evaluate?T.evaluate(h,p,_):T})}function aC(c){let s=1/0,h=1/0,p=-1/0,_=-1/0;for(const k of c)s=Math.min(s,k.x),h=Math.min(h,k.y),p=Math.max(p,k.x),_=Math.max(_,k.y);return{minX:s,minY:h,maxX:p,maxY:_}}function CG(c,s){return s-c}function lC(c,s,h,p,_){const k=[];for(let S=0;S<c.length;S++){const T=c[S];let A;for(let B=0;B<T.length-1;B++){let z=T[B],L=T[B+1];z.x<s&&L.x<s||(z.x<s?z=new E(s,z.y+(s-z.x)/(L.x-z.x)*(L.y-z.y))._round():L.x<s&&(L=new E(s,z.y+(s-z.x)/(L.x-z.x)*(L.y-z.y))._round()),z.y<h&&L.y<h||(z.y<h?z=new E(z.x+(h-z.y)/(L.y-z.y)*(L.x-z.x),h)._round():L.y<h&&(L=new E(z.x+(h-z.y)/(L.y-z.y)*(L.x-z.x),h)._round()),z.x>=p&&L.x>=p||(z.x>=p?z=new E(p,z.y+(p-z.x)/(L.x-z.x)*(L.y-z.y))._round():L.x>=p&&(L=new E(p,z.y+(p-z.x)/(L.x-z.x)*(L.y-z.y))._round()),z.y>=_&&L.y>=_||(z.y>=_?z=new E(z.x+(_-z.y)/(L.y-z.y)*(L.x-z.x),_)._round():L.y>=_&&(L=new E(z.x+(_-z.y)/(L.y-z.y)*(L.x-z.x),_)._round()),A&&z.equals(A[A.length-1])||(A=[z],k.push(A)),A.push(L)))))}}return k}ut("FeatureIndex",oC,{omit:["rawTileData","sourceLayerCoder"]});class al extends E{constructor(s,h,p,_){super(s,h),this.angle=p,_!==void 0&&(this.segment=_)}clone(){return new al(this.x,this.y,this.angle,this.segment)}}function cC(c,s,h,p,_){if(s.segment===void 0||h===0)return!0;let k=s,S=s.segment+1,T=0;for(;T>-h/2;){if(S--,S<0)return!1;T-=c[S].dist(k),k=c[S]}T+=c[S].dist(c[S+1]),S++;const A=[];let B=0;for(;T<h/2;){const z=c[S],L=c[S+1];if(!L)return!1;let j=c[S-1].angleTo(z)-z.angleTo(L);for(j=Math.abs((j+3*Math.PI)%(2*Math.PI)-Math.PI),A.push({distance:T,angleDelta:j}),B+=j;T-A[0].distance>p;)B-=A.shift().angleDelta;if(B>_)return!1;S++,T+=z.dist(L)}return!0}function uC(c){let s=0;for(let h=0;h<c.length-1;h++)s+=c[h].dist(c[h+1]);return s}function hC(c,s,h){return c?.6*s*h:0}function dC(c,s){return Math.max(c?c.right-c.left:0,s?s.right-s.left:0)}function TG(c,s,h,p,_,k){const S=hC(h,_,k),T=dC(h,p)*k;let A=0;const B=uC(c)/2;for(let z=0;z<c.length-1;z++){const L=c[z],j=c[z+1],q=L.dist(j);if(A+q>B){const Y=(B-A)/q,K=nr.number(L.x,j.x,Y),re=nr.number(L.y,j.y,Y),ae=new al(K,re,j.angleTo(L),z);return ae._round(),!S||cC(c,ae,T,S,s)?ae:void 0}A+=q}}function MG(c,s,h,p,_,k,S,T,A){const B=hC(p,k,S),z=dC(p,_),L=z*S,j=c[0].x===0||c[0].x===A||c[0].y===0||c[0].y===A;return s-L<s/4&&(s=L+s/4),pC(c,j?s/2*T%s:(z/2+2*k)*S*T%s,s,B,h,L,j,!1,A)}function pC(c,s,h,p,_,k,S,T,A){const B=k/2,z=uC(c);let L=0,j=s-h,q=[];for(let Y=0;Y<c.length-1;Y++){const K=c[Y],re=c[Y+1],ae=K.dist(re),be=re.angleTo(K);for(;j+h<L+ae;){j+=h;const pe=(j-L)/ae,ye=nr.number(K.x,re.x,pe),Te=nr.number(K.y,re.y,pe);if(ye>=0&&ye<A&&Te>=0&&Te<A&&j-B>=0&&j+B<=z){const Le=new al(ye,Te,be,Y);Le._round(),p&&!cC(c,Le,k,p,_)||q.push(Le)}}L+=ae}return T||q.length||S||(q=pC(c,L/2,h,p,_,k,S,!0,A)),q}ut("Anchor",al);const Wu=vr;function fC(c,s,h,p){const _=[],k=c.image,S=k.pixelRatio,T=k.paddedRect.w-2*Wu,A=k.paddedRect.h-2*Wu;let B={x1:c.left,y1:c.top,x2:c.right,y2:c.bottom};const z=k.stretchX||[[0,T]],L=k.stretchY||[[0,A]],j=(Oe,bt)=>Oe+bt[1]-bt[0],q=z.reduce(j,0),Y=L.reduce(j,0),K=T-q,re=A-Y;let ae=0,be=q,pe=0,ye=Y,Te=0,Le=K,rt=0,St=re;if(k.content&&p){const Oe=k.content,bt=Oe[2]-Oe[0],gt=Oe[3]-Oe[1];(k.textFitWidth||k.textFitHeight)&&(B=$E(c)),ae=Zm(z,0,Oe[0]),pe=Zm(L,0,Oe[1]),be=Zm(z,Oe[0],Oe[2]),ye=Zm(L,Oe[1],Oe[3]),Te=Oe[0]-ae,rt=Oe[1]-pe,Le=bt-be,St=gt-ye}const tt=B.x1,Je=B.y1,yt=B.x2-tt,dt=B.y2-Je,at=(Oe,bt,gt,Ot)=>{const Dn=Ym(Oe.stretch-ae,be,yt,tt),An=Xm(Oe.fixed-Te,Le,Oe.stretch,q),gi=Ym(bt.stretch-pe,ye,dt,Je),Do=Xm(bt.fixed-rt,St,bt.stretch,Y),Ri=Ym(gt.stretch-ae,be,yt,tt),yi=Xm(gt.fixed-Te,Le,gt.stretch,q),sr=Ym(Ot.stretch-pe,ye,dt,Je),ar=Xm(Ot.fixed-rt,St,Ot.stretch,Y),lr=new E(Dn,gi),ei=new E(Ri,gi),_i=new E(Ri,sr),Yi=new E(Dn,sr),Li=new E(An/S,Do/S),cr=new E(yi/S,ar/S),Vi=s*Math.PI/180;if(Vi){const hn=Math.sin(Vi),Bn=Math.cos(Vi),Un=[Bn,-hn,hn,Bn];lr._matMult(Un),ei._matMult(Un),Yi._matMult(Un),_i._matMult(Un)}const ao=Oe.stretch+Oe.fixed,wr=bt.stretch+bt.fixed;return{tl:lr,tr:ei,bl:Yi,br:_i,tex:{x:k.paddedRect.x+Wu+ao,y:k.paddedRect.y+Wu+wr,w:gt.stretch+gt.fixed-ao,h:Ot.stretch+Ot.fixed-wr},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:Li,pixelOffsetBR:cr,minFontScaleX:Le/S/yt,minFontScaleY:St/S/dt,isSDF:h}};if(p&&(k.stretchX||k.stretchY)){const Oe=mC(z,K,q),bt=mC(L,re,Y);for(let gt=0;gt<Oe.length-1;gt++){const Ot=Oe[gt],Dn=Oe[gt+1];for(let An=0;An<bt.length-1;An++)_.push(at(Ot,bt[An],Dn,bt[An+1]))}}else _.push(at({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:T+1},{fixed:0,stretch:A+1}));return _}function Zm(c,s,h){let p=0;for(const _ of c)p+=Math.max(s,Math.min(h,_[1]))-Math.max(s,Math.min(h,_[0]));return p}function mC(c,s,h){const p=[{fixed:-Wu,stretch:0}];for(const[_,k]of c){const S=p[p.length-1];p.push({fixed:_-S.stretch,stretch:S.stretch}),p.push({fixed:_-S.stretch,stretch:S.stretch+(k-_)})}return p.push({fixed:s+Wu,stretch:h}),p}function Ym(c,s,h,p){return c/s*h+p}function Xm(c,s,h,p){return c-s*h/p}class Km{constructor(s,h,p,_,k,S,T,A,B,z){var L;if(this.boxStartIndex=s.length,B){let j=S.top,q=S.bottom;const Y=S.collisionPadding;Y&&(j-=Y[1],q+=Y[3]);let K=q-j;K>0&&(K=Math.max(10,K),this.circleDiameter=K)}else{const j=!((L=S.image)===null||L===void 0)&&L.content&&(S.image.textFitWidth||S.image.textFitHeight)?$E(S):{x1:S.left,y1:S.top,x2:S.right,y2:S.bottom};j.y1=j.y1*T-A[0],j.y2=j.y2*T+A[2],j.x1=j.x1*T-A[3],j.x2=j.x2*T+A[1];const q=S.collisionPadding;if(q&&(j.x1-=q[0]*T,j.y1-=q[1]*T,j.x2+=q[2]*T,j.y2+=q[3]*T),z){const Y=new E(j.x1,j.y1),K=new E(j.x2,j.y1),re=new E(j.x1,j.y2),ae=new E(j.x2,j.y2),be=z*Math.PI/180;Y._rotate(be),K._rotate(be),re._rotate(be),ae._rotate(be),j.x1=Math.min(Y.x,K.x,re.x,ae.x),j.x2=Math.max(Y.x,K.x,re.x,ae.x),j.y1=Math.min(Y.y,K.y,re.y,ae.y),j.y2=Math.max(Y.y,K.y,re.y,ae.y)}s.emplaceBack(h.x,h.y,j.x1,j.y1,j.x2,j.y2,p,_,k)}this.boxEndIndex=s.length}}class AG{constructor(s=[],h=(p,_)=>p<_?-1:p>_?1:0){if(this.data=s,this.length=this.data.length,this.compare=h,this.length>0)for(let p=(this.length>>1)-1;p>=0;p--)this._down(p)}push(s){this.data.push(s),this._up(this.length++)}pop(){if(this.length===0)return;const s=this.data[0],h=this.data.pop();return--this.length>0&&(this.data[0]=h,this._down(0)),s}peek(){return this.data[0]}_up(s){const{data:h,compare:p}=this,_=h[s];for(;s>0;){const k=s-1>>1,S=h[k];if(p(_,S)>=0)break;h[s]=S,s=k}h[s]=_}_down(s){const{data:h,compare:p}=this,_=this.length>>1,k=h[s];for(;s<_;){let S=1+(s<<1);const T=S+1;if(T<this.length&&p(h[T],h[S])<0&&(S=T),p(h[S],k)>=0)break;h[s]=h[S],s=S}h[s]=k}}function IG(c,s=1,h=!1){let p=1/0,_=1/0,k=-1/0,S=-1/0;const T=c[0];for(let q=0;q<T.length;q++){const Y=T[q];(!q||Y.x<p)&&(p=Y.x),(!q||Y.y<_)&&(_=Y.y),(!q||Y.x>k)&&(k=Y.x),(!q||Y.y>S)&&(S=Y.y)}const A=Math.min(k-p,S-_);let B=A/2;const z=new AG([],PG);if(A===0)return new E(p,_);for(let q=p;q<k;q+=A)for(let Y=_;Y<S;Y+=A)z.push(new Gu(q+B,Y+B,B,c));let L=function(q){let Y=0,K=0,re=0;const ae=q[0];for(let be=0,pe=ae.length,ye=pe-1;be<pe;ye=be++){const Te=ae[be],Le=ae[ye],rt=Te.x*Le.y-Le.x*Te.y;K+=(Te.x+Le.x)*rt,re+=(Te.y+Le.y)*rt,Y+=3*rt}return new Gu(K/Y,re/Y,0,q)}(c),j=z.length;for(;z.length;){const q=z.pop();(q.d>L.d||!L.d)&&(L=q,h&&console.log("found best %d after %d probes",Math.round(1e4*q.d)/1e4,j)),q.max-L.d<=s||(B=q.h/2,z.push(new Gu(q.p.x-B,q.p.y-B,B,c)),z.push(new Gu(q.p.x+B,q.p.y-B,B,c)),z.push(new Gu(q.p.x-B,q.p.y+B,B,c)),z.push(new Gu(q.p.x+B,q.p.y+B,B,c)),j+=4)}return h&&(console.log(`num probes: ${j}`),console.log(`best distance: ${L.d}`)),L.p}function PG(c,s){return s.max-c.max}function Gu(c,s,h,p){this.p=new E(c,s),this.h=h,this.d=function(_,k){let S=!1,T=1/0;for(let A=0;A<k.length;A++){const B=k[A];for(let z=0,L=B.length,j=L-1;z<L;j=z++){const q=B[z],Y=B[j];q.y>_.y!=Y.y>_.y&&_.x<(Y.x-q.x)*(_.y-q.y)/(Y.y-q.y)+q.x&&(S=!S),T=Math.min(T,JS(_,q,Y))}}return(S?1:-1)*Math.sqrt(T)}(this.p,p),this.max=this.d+this.h*Math.SQRT2}var Ni;u.aq=void 0,(Ni=u.aq||(u.aq={}))[Ni.center=1]="center",Ni[Ni.left=2]="left",Ni[Ni.right=3]="right",Ni[Ni.top=4]="top",Ni[Ni.bottom=5]="bottom",Ni[Ni["top-left"]=6]="top-left",Ni[Ni["top-right"]=7]="top-right",Ni[Ni["bottom-left"]=8]="bottom-left",Ni[Ni["bottom-right"]=9]="bottom-right";const ll=7,lb=Number.POSITIVE_INFINITY;function gC(c,s){return s[1]!==lb?function(h,p,_){let k=0,S=0;switch(p=Math.abs(p),_=Math.abs(_),h){case"top-right":case"top-left":case"top":S=_-ll;break;case"bottom-right":case"bottom-left":case"bottom":S=-_+ll}switch(h){case"top-right":case"bottom-right":case"right":k=-p;break;case"top-left":case"bottom-left":case"left":k=p}return[k,S]}(c,s[0],s[1]):function(h,p){let _=0,k=0;p<0&&(p=0);const S=p/Math.SQRT2;switch(h){case"top-right":case"top-left":k=S-ll;break;case"bottom-right":case"bottom-left":k=-S+ll;break;case"bottom":k=-p+ll;break;case"top":k=p-ll}switch(h){case"top-right":case"bottom-right":_=-S;break;case"top-left":case"bottom-left":_=S;break;case"left":_=p;break;case"right":_=-p}return[_,k]}(c,s[0])}function yC(c,s,h){var p;const _=c.layout,k=(p=_.get("text-variable-anchor-offset"))===null||p===void 0?void 0:p.evaluate(s,{},h);if(k){const T=k.values,A=[];for(let B=0;B<T.length;B+=2){const z=A[B]=T[B],L=T[B+1].map(j=>j*hi);z.startsWith("top")?L[1]-=ll:z.startsWith("bottom")&&(L[1]+=ll),A[B+1]=L}return new Nr(A)}const S=_.get("text-variable-anchor");if(S){let T;T=c._unevaluatedLayout.getValue("text-radial-offset")!==void 0?[_.get("text-radial-offset").evaluate(s,{},h)*hi,lb]:_.get("text-offset").evaluate(s,{},h).map(B=>B*hi);const A=[];for(const B of S)A.push(B,gC(B,T));return new Nr(A)}return null}function cb(c){switch(c){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function DG(c,s,h,p,_,k,S,T,A,B,z){let L=k.textMaxSize.evaluate(s,{});L===void 0&&(L=S);const j=c.layers[0].layout,q=j.get("icon-offset").evaluate(s,{},z),Y=bC(h.horizontal),K=S/24,re=c.tilePixelRatio*K,ae=c.tilePixelRatio*L/24,be=c.tilePixelRatio*T,pe=c.tilePixelRatio*j.get("symbol-spacing"),ye=j.get("text-padding")*c.tilePixelRatio,Te=function(Oe,bt,gt,Ot=1){const Dn=Oe.get("icon-padding").evaluate(bt,{},gt),An=Dn&&Dn.values;return[An[0]*Ot,An[1]*Ot,An[2]*Ot,An[3]*Ot]}(j,s,z,c.tilePixelRatio),Le=j.get("text-max-angle")/180*Math.PI,rt=j.get("text-rotation-alignment")!=="viewport"&&j.get("symbol-placement")!=="point",St=j.get("icon-rotation-alignment")==="map"&&j.get("symbol-placement")!=="point",tt=j.get("symbol-placement"),Je=pe/2,yt=j.get("icon-text-fit");let dt;p&&yt!=="none"&&(c.allowVerticalPlacement&&h.vertical&&(dt=jE(p,h.vertical,yt,j.get("icon-text-fit-padding"),q,K)),Y&&(p=jE(p,Y,yt,j.get("icon-text-fit-padding"),q,K)));const at=(Oe,bt)=>{bt.x<0||bt.x>=ai||bt.y<0||bt.y>=ai||function(gt,Ot,Dn,An,gi,Do,Ri,yi,sr,ar,lr,ei,_i,Yi,Li,cr,Vi,ao,wr,hn,Bn,Un,Ur,Yn,Zu){const ys=gt.addToLineVertexArray(Ot,Dn);let _s,Oo,lo,Ei,ta=0,ip=0,kC=0,SC=0,yb=-1,_b=-1;const na={};let EC=Bu("");if(gt.allowVerticalPlacement&&An.vertical){const Xi=yi.layout.get("text-rotate").evaluate(Bn,{},Yn)+90;lo=new Km(sr,Ot,ar,lr,ei,An.vertical,_i,Yi,Li,Xi),Ri&&(Ei=new Km(sr,Ot,ar,lr,ei,Ri,Vi,ao,Li,Xi))}if(gi){const Xi=yi.layout.get("icon-rotate").evaluate(Bn,{}),co=yi.layout.get("icon-text-fit")!=="none",lc=fC(gi,Xi,Ur,co),Zo=Ri?fC(Ri,Xi,Ur,co):void 0;Oo=new Km(sr,Ot,ar,lr,ei,gi,Vi,ao,!1,Xi),ta=4*lc.length;const cc=gt.iconSizeData;let bs=null;cc.kind==="source"?(bs=[gs*yi.layout.get("icon-size").evaluate(Bn,{})],bs[0]>ol&&ot(`${gt.layerIds[0]}: Value for "icon-size" is >= ${Jd}. Reduce your "icon-size".`)):cc.kind==="composite"&&(bs=[gs*Un.compositeIconSizes[0].evaluate(Bn,{},Yn),gs*Un.compositeIconSizes[1].evaluate(Bn,{},Yn)],(bs[0]>ol||bs[1]>ol)&&ot(`${gt.layerIds[0]}: Value for "icon-size" is >= ${Jd}. Reduce your "icon-size".`)),gt.addSymbols(gt.icon,lc,bs,hn,wr,Bn,u.ah.none,Ot,ys.lineStartIndex,ys.lineLength,-1,Yn),yb=gt.icon.placedSymbolArray.length-1,Zo&&(ip=4*Zo.length,gt.addSymbols(gt.icon,Zo,bs,hn,wr,Bn,u.ah.vertical,Ot,ys.lineStartIndex,ys.lineLength,-1,Yn),_b=gt.icon.placedSymbolArray.length-1)}const CC=Object.keys(An.horizontal);for(const Xi of CC){const co=An.horizontal[Xi];if(!_s){EC=Bu(co.text);const Zo=yi.layout.get("text-rotate").evaluate(Bn,{},Yn);_s=new Km(sr,Ot,ar,lr,ei,co,_i,Yi,Li,Zo)}const lc=co.positionedLines.length===1;if(kC+=_C(gt,Ot,co,Do,yi,Li,Bn,cr,ys,An.vertical?u.ah.horizontal:u.ah.horizontalOnly,lc?CC:[Xi],na,yb,Un,Yn),lc)break}An.vertical&&(SC+=_C(gt,Ot,An.vertical,Do,yi,Li,Bn,cr,ys,u.ah.vertical,["vertical"],na,_b,Un,Yn));const zG=_s?_s.boxStartIndex:gt.collisionBoxArray.length,NG=_s?_s.boxEndIndex:gt.collisionBoxArray.length,RG=lo?lo.boxStartIndex:gt.collisionBoxArray.length,LG=lo?lo.boxEndIndex:gt.collisionBoxArray.length,VG=Oo?Oo.boxStartIndex:gt.collisionBoxArray.length,FG=Oo?Oo.boxEndIndex:gt.collisionBoxArray.length,$G=Ei?Ei.boxStartIndex:gt.collisionBoxArray.length,jG=Ei?Ei.boxEndIndex:gt.collisionBoxArray.length;let Go=-1;const Qm=(Xi,co)=>Xi&&Xi.circleDiameter?Math.max(Xi.circleDiameter,co):co;Go=Qm(_s,Go),Go=Qm(lo,Go),Go=Qm(Oo,Go),Go=Qm(Ei,Go);const TC=Go>-1?1:0;TC&&(Go*=Zu/hi),gt.glyphOffsetArray.length>=qu.MAX_GLYPHS&&ot("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),Bn.sortKey!==void 0&&gt.addToSortKeyRanges(gt.symbolInstances.length,Bn.sortKey);const UG=yC(yi,Bn,Yn),[HG,qG]=function(Xi,co){const lc=Xi.length,Zo=co==null?void 0:co.values;if((Zo==null?void 0:Zo.length)>0)for(let cc=0;cc<Zo.length;cc+=2){const bs=Zo[cc+1];Xi.emplaceBack(u.aq[Zo[cc]],bs[0],bs[1])}return[lc,Xi.length]}(gt.textAnchorOffsets,UG);gt.symbolInstances.emplaceBack(Ot.x,Ot.y,na.right>=0?na.right:-1,na.center>=0?na.center:-1,na.left>=0?na.left:-1,na.vertical||-1,yb,_b,EC,zG,NG,RG,LG,VG,FG,$G,jG,ar,kC,SC,ta,ip,TC,0,_i,Go,HG,qG)}(c,bt,Oe,h,p,_,dt,c.layers[0],c.collisionBoxArray,s.index,s.sourceLayerIndex,c.index,re,[ye,ye,ye,ye],rt,A,be,Te,St,q,s,k,B,z,S)};if(tt==="line")for(const Oe of lC(s.geometry,0,0,ai,ai)){const bt=MG(Oe,pe,Le,h.vertical||Y,p,24,ae,c.overscaling,ai);for(const gt of bt)Y&&OG(c,Y.text,Je,gt)||at(Oe,gt)}else if(tt==="line-center"){for(const Oe of s.geometry)if(Oe.length>1){const bt=TG(Oe,Le,h.vertical||Y,p,24,ae);bt&&at(Oe,bt)}}else if(s.type==="Polygon")for(const Oe of uu(s.geometry,0)){const bt=IG(Oe,16);at(Oe[0],new al(bt.x,bt.y,0))}else if(s.type==="LineString")for(const Oe of s.geometry)at(Oe,new al(Oe[0].x,Oe[0].y,0));else if(s.type==="Point")for(const Oe of s.geometry)for(const bt of Oe)at([bt],new al(bt.x,bt.y,0))}function _C(c,s,h,p,_,k,S,T,A,B,z,L,j,q,Y){const K=function(be,pe,ye,Te,Le,rt,St,tt){const Je=Te.layout.get("text-rotate").evaluate(rt,{})*Math.PI/180,yt=[];for(const dt of pe.positionedLines)for(const at of dt.positionedGlyphs){if(!at.rect)continue;const Oe=at.rect||{};let bt=BE+1,gt=!0,Ot=1,Dn=0;const An=(Le||tt)&&at.vertical,gi=at.metrics.advance*at.scale/2;if(tt&&pe.verticalizable&&(Dn=dt.lineOffset/2-(at.imageName?-(hi-at.metrics.width*at.scale)/2:(at.scale-1)*hi)),at.imageName){const hn=St[at.imageName];gt=hn.sdf,Ot=hn.pixelRatio,bt=vr/Ot}const Do=Le?[at.x+gi,at.y]:[0,0];let Ri=Le?[0,0]:[at.x+gi+ye[0],at.y+ye[1]-Dn],yi=[0,0];An&&(yi=Ri,Ri=[0,0]);const sr=at.metrics.isDoubleResolution?2:1,ar=(at.metrics.left-bt)*at.scale-gi+Ri[0],lr=(-at.metrics.top-bt)*at.scale+Ri[1],ei=ar+Oe.w/sr*at.scale/Ot,_i=lr+Oe.h/sr*at.scale/Ot,Yi=new E(ar,lr),Li=new E(ei,lr),cr=new E(ar,_i),Vi=new E(ei,_i);if(An){const hn=new E(-gi,gi-Xd),Bn=-Math.PI/2,Un=hi/2-gi,Ur=new E(5-Xd-Un,-(at.imageName?Un:0)),Yn=new E(...yi);Yi._rotateAround(Bn,hn)._add(Ur)._add(Yn),Li._rotateAround(Bn,hn)._add(Ur)._add(Yn),cr._rotateAround(Bn,hn)._add(Ur)._add(Yn),Vi._rotateAround(Bn,hn)._add(Ur)._add(Yn)}if(Je){const hn=Math.sin(Je),Bn=Math.cos(Je),Un=[Bn,-hn,hn,Bn];Yi._matMult(Un),Li._matMult(Un),cr._matMult(Un),Vi._matMult(Un)}const ao=new E(0,0),wr=new E(0,0);yt.push({tl:Yi,tr:Li,bl:cr,br:Vi,tex:Oe,writingMode:pe.writingMode,glyphOffset:Do,sectionIndex:at.sectionIndex,isSDF:gt,pixelOffsetTL:ao,pixelOffsetBR:wr,minFontScaleX:0,minFontScaleY:0})}return yt}(0,h,T,_,k,S,p,c.allowVerticalPlacement),re=c.textSizeData;let ae=null;re.kind==="source"?(ae=[gs*_.layout.get("text-size").evaluate(S,{})],ae[0]>ol&&ot(`${c.layerIds[0]}: Value for "text-size" is >= ${Jd}. Reduce your "text-size".`)):re.kind==="composite"&&(ae=[gs*q.compositeTextSizes[0].evaluate(S,{},Y),gs*q.compositeTextSizes[1].evaluate(S,{},Y)],(ae[0]>ol||ae[1]>ol)&&ot(`${c.layerIds[0]}: Value for "text-size" is >= ${Jd}. Reduce your "text-size".`)),c.addSymbols(c.text,K,ae,T,k,S,B,s,A.lineStartIndex,A.lineLength,j,Y);for(const be of z)L[be]=c.text.placedSymbolArray.length-1;return 4*K.length}function bC(c){for(const s in c)return c[s];return null}function OG(c,s,h,p){const _=c.compareText;if(s in _){const k=_[s];for(let S=k.length-1;S>=0;S--)if(p.dist(k[S])<h)return!0}else _[s]=[];return _[s].push(p),!1}const xC=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class ub{static from(s){if(!(s instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[h,p]=new Uint8Array(s,0,2);if(h!==219)throw new Error("Data does not appear to be in a KDBush format.");const _=p>>4;if(_!==1)throw new Error(`Got v${_} data when expected v1.`);const k=xC[15&p];if(!k)throw new Error("Unrecognized array type.");const[S]=new Uint16Array(s,2,1),[T]=new Uint32Array(s,4,1);return new ub(T,S,k,s)}constructor(s,h=64,p=Float64Array,_){if(isNaN(s)||s<0)throw new Error(`Unpexpected numItems value: ${s}.`);this.numItems=+s,this.nodeSize=Math.min(Math.max(+h,2),65535),this.ArrayType=p,this.IndexArrayType=s<65536?Uint16Array:Uint32Array;const k=xC.indexOf(this.ArrayType),S=2*s*this.ArrayType.BYTES_PER_ELEMENT,T=s*this.IndexArrayType.BYTES_PER_ELEMENT,A=(8-T%8)%8;if(k<0)throw new Error(`Unexpected typed array class: ${p}.`);_&&_ instanceof ArrayBuffer?(this.data=_,this.ids=new this.IndexArrayType(this.data,8,s),this.coords=new this.ArrayType(this.data,8+T+A,2*s),this._pos=2*s,this._finished=!0):(this.data=new ArrayBuffer(8+S+T+A),this.ids=new this.IndexArrayType(this.data,8,s),this.coords=new this.ArrayType(this.data,8+T+A,2*s),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+k]),new Uint16Array(this.data,2,1)[0]=h,new Uint32Array(this.data,4,1)[0]=s)}add(s,h){const p=this._pos>>1;return this.ids[p]=p,this.coords[this._pos++]=s,this.coords[this._pos++]=h,p}finish(){const s=this._pos>>1;if(s!==this.numItems)throw new Error(`Added ${s} items when expected ${this.numItems}.`);return hb(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(s,h,p,_){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:k,coords:S,nodeSize:T}=this,A=[0,k.length-1,0],B=[];for(;A.length;){const z=A.pop()||0,L=A.pop()||0,j=A.pop()||0;if(L-j<=T){for(let re=j;re<=L;re++){const ae=S[2*re],be=S[2*re+1];ae>=s&&ae<=p&&be>=h&&be<=_&&B.push(k[re])}continue}const q=j+L>>1,Y=S[2*q],K=S[2*q+1];Y>=s&&Y<=p&&K>=h&&K<=_&&B.push(k[q]),(z===0?s<=Y:h<=K)&&(A.push(j),A.push(q-1),A.push(1-z)),(z===0?p>=Y:_>=K)&&(A.push(q+1),A.push(L),A.push(1-z))}return B}within(s,h,p){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:_,coords:k,nodeSize:S}=this,T=[0,_.length-1,0],A=[],B=p*p;for(;T.length;){const z=T.pop()||0,L=T.pop()||0,j=T.pop()||0;if(L-j<=S){for(let re=j;re<=L;re++)wC(k[2*re],k[2*re+1],s,h)<=B&&A.push(_[re]);continue}const q=j+L>>1,Y=k[2*q],K=k[2*q+1];wC(Y,K,s,h)<=B&&A.push(_[q]),(z===0?s-p<=Y:h-p<=K)&&(T.push(j),T.push(q-1),T.push(1-z)),(z===0?s+p>=Y:h+p>=K)&&(T.push(q+1),T.push(L),T.push(1-z))}return A}}function hb(c,s,h,p,_,k){if(_-p<=h)return;const S=p+_>>1;vC(c,s,S,p,_,k),hb(c,s,h,p,S-1,1-k),hb(c,s,h,S+1,_,1-k)}function vC(c,s,h,p,_,k){for(;_>p;){if(_-p>600){const B=_-p+1,z=h-p+1,L=Math.log(B),j=.5*Math.exp(2*L/3),q=.5*Math.sqrt(L*j*(B-j)/B)*(z-B/2<0?-1:1);vC(c,s,h,Math.max(p,Math.floor(h-z*j/B+q)),Math.min(_,Math.floor(h+(B-z)*j/B+q)),k)}const S=s[2*h+k];let T=p,A=_;for(tp(c,s,p,h),s[2*_+k]>S&&tp(c,s,p,_);T<A;){for(tp(c,s,T,A),T++,A--;s[2*T+k]<S;)T++;for(;s[2*A+k]>S;)A--}s[2*p+k]===S?tp(c,s,p,A):(A++,tp(c,s,A,_)),A<=h&&(p=A+1),h<=A&&(_=A-1)}}function tp(c,s,h,p){db(c,h,p),db(s,2*h,2*p),db(s,2*h+1,2*p+1)}function db(c,s,h){const p=c[s];c[s]=c[h],c[h]=p}function wC(c,s,h,p){const _=c-h,k=s-p;return _*_+k*k}var pb;u.bg=void 0,(pb=u.bg||(u.bg={})).create="create",pb.load="load",pb.fullLoad="fullLoad";let Jm=null,np=[];const fb=1e3/60,mb="loadTime",gb="fullLoadTime",BG={mark(c){performance.mark(c)},frame(c){const s=c;Jm!=null&&np.push(s-Jm),Jm=s},clearMetrics(){Jm=null,np=[],performance.clearMeasures(mb),performance.clearMeasures(gb);for(const c in u.bg)performance.clearMarks(u.bg[c])},getPerformanceMetrics(){performance.measure(mb,u.bg.create,u.bg.load),performance.measure(gb,u.bg.create,u.bg.fullLoad);const c=performance.getEntriesByName(mb)[0].duration,s=performance.getEntriesByName(gb)[0].duration,h=np.length,p=1/(np.reduce((k,S)=>k+S,0)/h/1e3),_=np.filter(k=>k>fb).reduce((k,S)=>k+(S-fb)/fb,0);return{loadTime:c,fullLoadTime:s,fps:p,percentDroppedFrames:_/(h+_)*100,totalFrames:h}}};u.$=class extends V{},u.A=Vu,u.B=S_,u.C=function(c){if(Vt==null){const s=c.navigator?c.navigator.userAgent:null;Vt=!!c.safari||!(!s||!(/\b(iPad|iPhone|iPod)\b/.test(s)||s.match("Safari")&&!s.match("Chrome")))}return Vt},u.D=ft,u.E=rn,u.F=class{constructor(c,s){this.target=c,this.mapId=s,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new EG(()=>this.process()),this.subscription=function(h,p,_,k){return h.addEventListener(p,_,!1),{unsubscribe:()=>{h.removeEventListener(p,_,!1)}}}(this.target,"message",h=>this.receive(h)),this.globalScope=Nt(self)?c:window}registerMessageHandler(c,s){this.messageHandlers[c]=s}sendAsync(c,s){return new Promise((h,p)=>{const _=Math.round(1e18*Math.random()).toString(36).substring(0,10);this.resolveRejects[_]={resolve:h,reject:p},s&&s.signal.addEventListener("abort",()=>{delete this.resolveRejects[_];const T={id:_,type:"<cancel>",origin:location.origin,targetMapId:c.targetMapId,sourceMapId:this.mapId};this.target.postMessage(T)},{once:!0});const k=[],S=Object.assign(Object.assign({},c),{id:_,sourceMapId:this.mapId,origin:location.origin,data:Ga(c.data,k)});this.target.postMessage(S,{transfer:k})})}receive(c){const s=c.data,h=s.id;if(!(s.origin!=="file://"&&location.origin!=="file://"&&s.origin!=="resource://android"&&location.origin!=="resource://android"&&s.origin!==location.origin||s.targetMapId&&this.mapId!==s.targetMapId)){if(s.type==="<cancel>"){delete this.tasks[h];const p=this.abortControllers[h];return delete this.abortControllers[h],void(p&&p.abort())}if(Nt(self)||s.mustQueue)return this.tasks[h]=s,this.taskQueue.push(h),void this.invoker.trigger();this.processTask(h,s)}}process(){if(this.taskQueue.length===0)return;const c=this.taskQueue.shift(),s=this.tasks[c];delete this.tasks[c],this.taskQueue.length>0&&this.invoker.trigger(),s&&this.processTask(c,s)}processTask(c,s){return l(this,void 0,void 0,function*(){if(s.type==="<response>"){const _=this.resolveRejects[c];return delete this.resolveRejects[c],_?void(s.error?_.reject(Za(s.error)):_.resolve(Za(s.data))):void 0}if(!this.messageHandlers[s.type])return void this.completeTask(c,new Error(`Could not find a registered handler for ${s.type}, map ID: ${this.mapId}, available handlers: ${Object.keys(this.messageHandlers).join(", ")}`));const h=Za(s.data),p=new AbortController;this.abortControllers[c]=p;try{const _=yield this.messageHandlers[s.type](s.sourceMapId,h,p);this.completeTask(c,null,_)}catch(_){this.completeTask(c,_)}})}completeTask(c,s,h){const p=[];delete this.abortControllers[c];const _={id:c,type:"<response>",sourceMapId:this.mapId,origin:location.origin,error:s?Ga(s):null,data:Ga(h,p)};this.target.postMessage(_,{transfer:p})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}},u.G=Rn,u.H=function(){var c=new Vu(16);return Vu!=Float32Array&&(c[1]=0,c[2]=0,c[3]=0,c[4]=0,c[6]=0,c[7]=0,c[8]=0,c[9]=0,c[11]=0,c[12]=0,c[13]=0,c[14]=0),c[0]=1,c[5]=1,c[10]=1,c[15]=1,c},u.I=K_,u.J=function(c,s,h){var p,_,k,S,T,A,B,z,L,j,q,Y,K=h[0],re=h[1],ae=h[2];return s===c?(c[12]=s[0]*K+s[4]*re+s[8]*ae+s[12],c[13]=s[1]*K+s[5]*re+s[9]*ae+s[13],c[14]=s[2]*K+s[6]*re+s[10]*ae+s[14],c[15]=s[3]*K+s[7]*re+s[11]*ae+s[15]):(_=s[1],k=s[2],S=s[3],T=s[4],A=s[5],B=s[6],z=s[7],L=s[8],j=s[9],q=s[10],Y=s[11],c[0]=p=s[0],c[1]=_,c[2]=k,c[3]=S,c[4]=T,c[5]=A,c[6]=B,c[7]=z,c[8]=L,c[9]=j,c[10]=q,c[11]=Y,c[12]=p*K+T*re+L*ae+s[12],c[13]=_*K+A*re+j*ae+s[13],c[14]=k*K+B*re+q*ae+s[14],c[15]=S*K+z*re+Y*ae+s[15]),c},u.K=function(c,s,h){var p=h[0],_=h[1],k=h[2];return c[0]=s[0]*p,c[1]=s[1]*p,c[2]=s[2]*p,c[3]=s[3]*p,c[4]=s[4]*_,c[5]=s[5]*_,c[6]=s[6]*_,c[7]=s[7]*_,c[8]=s[8]*k,c[9]=s[9]*k,c[10]=s[10]*k,c[11]=s[11]*k,c[12]=s[12],c[13]=s[13],c[14]=s[14],c[15]=s[15],c},u.L=nE,u.M=function(c,s){const h={};for(let p=0;p<s.length;p++){const _=s[p];_ in c&&(h[_]=c[_])}return h},u.N=sl,u.O=KE,u.P=E,u.Q=JE,u.R=oo,u.S=so,u.T=Au,u.U=W,u.V=te,u.W=Cn,u.X=ai,u.Y=M,u.Z=Qd,u._=l,u.a=Nn,u.a$=function(c,s){var h=c[0],p=c[1],_=c[2],k=c[3],S=c[4],T=c[5],A=c[6],B=c[7],z=c[8],L=c[9],j=c[10],q=c[11],Y=c[12],K=c[13],re=c[14],ae=c[15],be=s[0],pe=s[1],ye=s[2],Te=s[3],Le=s[4],rt=s[5],St=s[6],tt=s[7],Je=s[8],yt=s[9],dt=s[10],at=s[11],Oe=s[12],bt=s[13],gt=s[14],Ot=s[15];return Math.abs(h-be)<=or*Math.max(1,Math.abs(h),Math.abs(be))&&Math.abs(p-pe)<=or*Math.max(1,Math.abs(p),Math.abs(pe))&&Math.abs(_-ye)<=or*Math.max(1,Math.abs(_),Math.abs(ye))&&Math.abs(k-Te)<=or*Math.max(1,Math.abs(k),Math.abs(Te))&&Math.abs(S-Le)<=or*Math.max(1,Math.abs(S),Math.abs(Le))&&Math.abs(T-rt)<=or*Math.max(1,Math.abs(T),Math.abs(rt))&&Math.abs(A-St)<=or*Math.max(1,Math.abs(A),Math.abs(St))&&Math.abs(B-tt)<=or*Math.max(1,Math.abs(B),Math.abs(tt))&&Math.abs(z-Je)<=or*Math.max(1,Math.abs(z),Math.abs(Je))&&Math.abs(L-yt)<=or*Math.max(1,Math.abs(L),Math.abs(yt))&&Math.abs(j-dt)<=or*Math.max(1,Math.abs(j),Math.abs(dt))&&Math.abs(q-at)<=or*Math.max(1,Math.abs(q),Math.abs(at))&&Math.abs(Y-Oe)<=or*Math.max(1,Math.abs(Y),Math.abs(Oe))&&Math.abs(K-bt)<=or*Math.max(1,Math.abs(K),Math.abs(bt))&&Math.abs(re-gt)<=or*Math.max(1,Math.abs(re),Math.abs(gt))&&Math.abs(ae-Ot)<=or*Math.max(1,Math.abs(ae),Math.abs(Ot))},u.a0=tn,u.a1=ab,u.a2=Ve,u.a3=c=>{const s=window.document.createElement("video");return s.muted=!0,new Promise(h=>{s.onloadstart=()=>{h(s)};for(const p of c){const _=window.document.createElement("source");ct(p)||(s.crossOrigin="Anonymous"),_.src=p,s.appendChild(_)}})},u.a4=function(){return Ne++},u.a5=nt,u.a6=qu,u.a7=bd,u.a8=sc,u.a9=rC,u.aA=function(c){if(c.type==="custom")return new SG(c);switch(c.type){case"background":return new vG(c);case"circle":return new lW(c);case"fill":return new EW(c);case"fill-extrusion":return new FW(c);case"heatmap":return new uW(c);case"hillshade":return new dW(c);case"line":return new ZW(c);case"raster":return new kG(c);case"symbol":return new Gm(c)}},u.aB=Xe,u.aC=function(c,s){if(!c)return[{command:"setStyle",args:[s]}];let h=[];try{if(!qt(c.version,s.version))return[{command:"setStyle",args:[s]}];qt(c.center,s.center)||h.push({command:"setCenter",args:[s.center]}),qt(c.zoom,s.zoom)||h.push({command:"setZoom",args:[s.zoom]}),qt(c.bearing,s.bearing)||h.push({command:"setBearing",args:[s.bearing]}),qt(c.pitch,s.pitch)||h.push({command:"setPitch",args:[s.pitch]}),qt(c.sprite,s.sprite)||h.push({command:"setSprite",args:[s.sprite]}),qt(c.glyphs,s.glyphs)||h.push({command:"setGlyphs",args:[s.glyphs]}),qt(c.transition,s.transition)||h.push({command:"setTransition",args:[s.transition]}),qt(c.light,s.light)||h.push({command:"setLight",args:[s.light]}),qt(c.terrain,s.terrain)||h.push({command:"setTerrain",args:[s.terrain]}),qt(c.sky,s.sky)||h.push({command:"setSky",args:[s.sky]}),qt(c.projection,s.projection)||h.push({command:"setProjection",args:[s.projection]});const p={},_=[];(function(S,T,A,B){let z;for(z in T=T||{},S=S||{})Object.prototype.hasOwnProperty.call(S,z)&&(Object.prototype.hasOwnProperty.call(T,z)||Hi(z,A,B));for(z in T)Object.prototype.hasOwnProperty.call(T,z)&&(Object.prototype.hasOwnProperty.call(S,z)?qt(S[z],T[z])||(S[z].type==="geojson"&&T[z].type==="geojson"&&Or(S,T,z)?sn(A,{command:"setGeoJSONSourceData",args:[z,T[z].data]}):xi(z,T,A,B)):ui(z,T,A))})(c.sources,s.sources,_,p);const k=[];c.layers&&c.layers.forEach(S=>{"source"in S&&p[S.source]?h.push({command:"removeLayer",args:[S.id]}):k.push(S)}),h=h.concat(_),function(S,T,A){T=T||[];const B=(S=S||[]).map(Eo),z=T.map(Eo),L=S.reduce(Co,{}),j=T.reduce(Co,{}),q=B.slice(),Y=Object.create(null);let K,re,ae,be,pe;for(let ye=0,Te=0;ye<B.length;ye++)K=B[ye],Object.prototype.hasOwnProperty.call(j,K)?Te++:(sn(A,{command:"removeLayer",args:[K]}),q.splice(q.indexOf(K,Te),1));for(let ye=0,Te=0;ye<z.length;ye++)K=z[z.length-1-ye],q[q.length-1-ye]!==K&&(Object.prototype.hasOwnProperty.call(L,K)?(sn(A,{command:"removeLayer",args:[K]}),q.splice(q.lastIndexOf(K,q.length-Te),1)):Te++,be=q[q.length-ye],sn(A,{command:"addLayer",args:[j[K],be]}),q.splice(q.length-ye,0,K),Y[K]=!0);for(let ye=0;ye<z.length;ye++)if(K=z[ye],re=L[K],ae=j[K],!Y[K]&&!qt(re,ae))if(qt(re.source,ae.source)&&qt(re["source-layer"],ae["source-layer"])&&qt(re.type,ae.type)){for(pe in vi(re.layout,ae.layout,A,K,null,"setLayoutProperty"),vi(re.paint,ae.paint,A,K,null,"setPaintProperty"),qt(re.filter,ae.filter)||sn(A,{command:"setFilter",args:[K,ae.filter]}),qt(re.minzoom,ae.minzoom)&&qt(re.maxzoom,ae.maxzoom)||sn(A,{command:"setLayerZoomRange",args:[K,ae.minzoom,ae.maxzoom]}),re)Object.prototype.hasOwnProperty.call(re,pe)&&pe!=="layout"&&pe!=="paint"&&pe!=="filter"&&pe!=="metadata"&&pe!=="minzoom"&&pe!=="maxzoom"&&(pe.indexOf("paint.")===0?vi(re[pe],ae[pe],A,K,pe.slice(6),"setPaintProperty"):qt(re[pe],ae[pe])||sn(A,{command:"setLayerProperty",args:[K,pe,ae[pe]]}));for(pe in ae)Object.prototype.hasOwnProperty.call(ae,pe)&&!Object.prototype.hasOwnProperty.call(re,pe)&&pe!=="layout"&&pe!=="paint"&&pe!=="filter"&&pe!=="metadata"&&pe!=="minzoom"&&pe!=="maxzoom"&&(pe.indexOf("paint.")===0?vi(re[pe],ae[pe],A,K,pe.slice(6),"setPaintProperty"):qt(re[pe],ae[pe])||sn(A,{command:"setLayerProperty",args:[K,pe,ae[pe]]}))}else sn(A,{command:"removeLayer",args:[K]}),be=q[q.lastIndexOf(K)+1],sn(A,{command:"addLayer",args:[ae,be]})}(k,s.layers,h)}catch(p){console.warn("Unable to compute style diff:",p),h=[{command:"setStyle",args:[s]}]}return h},u.aD=function(c){const s=[],h=c.id;return h===void 0&&s.push({message:`layers.${h}: missing required property "id"`}),c.render===void 0&&s.push({message:`layers.${h}: missing required method "render"`}),c.renderingMode&&c.renderingMode!=="2d"&&c.renderingMode!=="3d"&&s.push({message:`layers.${h}: property "renderingMode" must be either "2d" or "3d"`}),s},u.aE=function c(s,h){if(Array.isArray(s)){if(!Array.isArray(h)||s.length!==h.length)return!1;for(let p=0;p<s.length;p++)if(!c(s[p],h[p]))return!1;return!0}if(typeof s=="object"&&s!==null&&h!==null){if(typeof h!="object"||Object.keys(s).length!==Object.keys(h).length)return!1;for(const p in s)if(!c(s[p],h[p]))return!1;return!0}return s===h},u.aF=Ae,u.aG=$e,u.aH=class extends ic{constructor(c,s){super(c,s),this.current=0}set(c){this.current!==c&&(this.current=c,this.gl.uniform1i(this.location,c))}},u.aI=Bm,u.aJ=class extends ic{constructor(c,s){super(c,s),this.current=eW}set(c){if(c[12]!==this.current[12]||c[0]!==this.current[0])return this.current=c,void this.gl.uniformMatrix4fv(this.location,!1,c);for(let s=1;s<16;s++)if(c[s]!==this.current[s]){this.current=c,this.gl.uniformMatrix4fv(this.location,!1,c);break}}},u.aK=qS,u.aL=WS,u.aM=kn,u.aN=class extends ic{constructor(c,s){super(c,s),this.current=[0,0,0]}set(c){c[0]===this.current[0]&&c[1]===this.current[1]&&c[2]===this.current[2]||(this.current=c,this.gl.uniform3f(this.location,c[0],c[1],c[2]))}},u.aO=class extends ic{constructor(c,s){super(c,s),this.current=[0,0]}set(c){c[0]===this.current[0]&&c[1]===this.current[1]||(this.current=c,this.gl.uniform2f(this.location,c[0],c[1]))}},u.aP=function(c,s,h,p,_,k,S){var T=1/(s-h),A=1/(p-_),B=1/(k-S);return c[0]=-2*T,c[1]=0,c[2]=0,c[3]=0,c[4]=0,c[5]=-2*A,c[6]=0,c[7]=0,c[8]=0,c[9]=0,c[10]=2*B,c[11]=0,c[12]=(s+h)*T,c[13]=(_+p)*A,c[14]=(S+k)*B,c[15]=1,c},u.aQ=aW,u.aR=class extends me{},u.aS=JW,u.aT=class extends xe{},u.aU=V_,u.aV=function(c){return c<=1?1:Math.pow(2,Math.ceil(Math.log(c)/Math.LN2))},u.aW=aE,u.aX=Bi,u.aY=ro,u.aZ=class extends mt{},u.a_=function(c,s){return c[0]===s[0]&&c[1]===s[1]&&c[2]===s[2]&&c[3]===s[3]&&c[4]===s[4]&&c[5]===s[5]&&c[6]===s[6]&&c[7]===s[7]&&c[8]===s[8]&&c[9]===s[9]&&c[10]===s[10]&&c[11]===s[11]&&c[12]===s[12]&&c[13]===s[13]&&c[14]===s[14]&&c[15]===s[15]},u.aa=function(c){const s={};if(c.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(h,p,_,k)=>{const S=_||k;return s[p]=!S||S.toLowerCase(),""}),s["max-age"]){const h=parseInt(s["max-age"],10);isNaN(h)?delete s["max-age"]:s["max-age"]=h}return s},u.ab=function(c,s){const h=[];for(const p in c)p in s||h.push(p);return h},u.ac=Ie,u.ad=function(c,s,h){var p=Math.sin(h),_=Math.cos(h),k=s[0],S=s[1],T=s[2],A=s[3],B=s[4],z=s[5],L=s[6],j=s[7];return s!==c&&(c[8]=s[8],c[9]=s[9],c[10]=s[10],c[11]=s[11],c[12]=s[12],c[13]=s[13],c[14]=s[14],c[15]=s[15]),c[0]=k*_+B*p,c[1]=S*_+z*p,c[2]=T*_+L*p,c[3]=A*_+j*p,c[4]=B*_-k*p,c[5]=z*_-S*p,c[6]=L*_-T*p,c[7]=j*_-A*p,c},u.ae=function(c){var s=new Vu(16);return s[0]=c[0],s[1]=c[1],s[2]=c[2],s[3]=c[3],s[4]=c[4],s[5]=c[5],s[6]=c[6],s[7]=c[7],s[8]=c[8],s[9]=c[9],s[10]=c[10],s[11]=c[11],s[12]=c[12],s[13]=c[13],s[14]=c[14],s[15]=c[15],s},u.af=Lm,u.ag=function(c,s){let h=0,p=0;if(c.kind==="constant")p=c.layoutSize;else if(c.kind!=="source"){const{interpolationType:_,minZoom:k,maxZoom:S}=c,T=_?Ie(ir.interpolationFactor(_,s,k,S),0,1):0;c.kind==="camera"?p=nr.number(c.minSize,c.maxSize,T):h=T}return{uSizeT:h,uSize:p}},u.ai=function(c,{uSize:s,uSizeT:h},{lowerSize:p,upperSize:_}){return c.kind==="source"?p/gs:c.kind==="composite"?nr.number(p/gs,_/gs,h):s},u.aj=tb,u.ak=function(c,s,h,p){const _=s.y-c.y,k=s.x-c.x,S=p.y-h.y,T=p.x-h.x,A=S*k-T*_;if(A===0)return null;const B=(T*(c.y-h.y)-S*(c.x-h.x))/A;return new E(c.x+B*k,c.y+B*_)},u.al=lC,u.am=XS,u.an=N_,u.ao=function(c){let s=1/0,h=1/0,p=-1/0,_=-1/0;for(const k of c)s=Math.min(s,k.x),h=Math.min(h,k.y),p=Math.max(p,k.x),_=Math.max(_,k.y);return[s,h,p,_]},u.ap=hi,u.ar=eb,u.as=function(c,s){var h=s[0],p=s[1],_=s[2],k=s[3],S=s[4],T=s[5],A=s[6],B=s[7],z=s[8],L=s[9],j=s[10],q=s[11],Y=s[12],K=s[13],re=s[14],ae=s[15],be=h*T-p*S,pe=h*A-_*S,ye=h*B-k*S,Te=p*A-_*T,Le=p*B-k*T,rt=_*B-k*A,St=z*K-L*Y,tt=z*re-j*Y,Je=z*ae-q*Y,yt=L*re-j*K,dt=L*ae-q*K,at=j*ae-q*re,Oe=be*at-pe*dt+ye*yt+Te*Je-Le*tt+rt*St;return Oe?(c[0]=(T*at-A*dt+B*yt)*(Oe=1/Oe),c[1]=(_*dt-p*at-k*yt)*Oe,c[2]=(K*rt-re*Le+ae*Te)*Oe,c[3]=(j*Le-L*rt-q*Te)*Oe,c[4]=(A*Je-S*at-B*tt)*Oe,c[5]=(h*at-_*Je+k*tt)*Oe,c[6]=(re*ye-Y*rt-ae*pe)*Oe,c[7]=(z*rt-j*ye+q*pe)*Oe,c[8]=(S*dt-T*Je+B*St)*Oe,c[9]=(p*Je-h*dt-k*St)*Oe,c[10]=(Y*Le-K*ye+ae*be)*Oe,c[11]=(L*ye-z*Le-q*be)*Oe,c[12]=(T*tt-S*yt-A*St)*Oe,c[13]=(h*yt-p*tt+_*St)*Oe,c[14]=(K*pe-Y*Te-re*be)*Oe,c[15]=(z*Te-L*pe+j*be)*Oe,c):null},u.at=cb,u.au=Q_,u.av=ub,u.aw=function(){const c={},s=we.$version;for(const h in we.$root){const p=we.$root[h];if(p.required){let _=null;_=h==="version"?s:p.type==="array"?[]:{},_!=null&&(c[h]=_)}}return c},u.ax=Od,u.ay=He,u.az=function(c){c=c.slice();const s=Object.create(null);for(let h=0;h<c.length;h++)s[c[h].id]=c[h];for(let h=0;h<c.length;h++)"ref"in c[h]&&(c[h]=pr(c[h],s[c[h].ref]));return c},u.b=Ft,u.b0=function(c,s){return c[0]=s[0],c[1]=s[1],c[2]=s[2],c[3]=s[3],c[4]=s[4],c[5]=s[5],c[6]=s[6],c[7]=s[7],c[8]=s[8],c[9]=s[9],c[10]=s[10],c[11]=s[11],c[12]=s[12],c[13]=s[13],c[14]=s[14],c[15]=s[15],c},u.b1=function(c,s,h){return c[0]=s[0]*h[0],c[1]=s[1]*h[1],c[2]=s[2]*h[2],c[3]=s[3]*h[3],c},u.b2=function(c,s){return c[0]*s[0]+c[1]*s[1]+c[2]*s[2]+c[3]*s[3]},u.b3=ve,u.b4=tC,u.b5=QE,u.b6=function(c,s,h,p,_){var k,S=1/Math.tan(s/2);return c[0]=S/h,c[1]=0,c[2]=0,c[3]=0,c[4]=0,c[5]=S,c[6]=0,c[7]=0,c[8]=0,c[9]=0,c[11]=-1,c[12]=0,c[13]=0,c[15]=0,_!=null&&_!==1/0?(c[10]=(_+p)*(k=1/(p-_)),c[14]=2*_*p*k):(c[10]=-1,c[14]=-2*p),c},u.b7=function(c,s,h){var p=Math.sin(h),_=Math.cos(h),k=s[4],S=s[5],T=s[6],A=s[7],B=s[8],z=s[9],L=s[10],j=s[11];return s!==c&&(c[0]=s[0],c[1]=s[1],c[2]=s[2],c[3]=s[3],c[12]=s[12],c[13]=s[13],c[14]=s[14],c[15]=s[15]),c[4]=k*_+B*p,c[5]=S*_+z*p,c[6]=T*_+L*p,c[7]=A*_+j*p,c[8]=B*_-k*p,c[9]=z*_-S*p,c[10]=L*_-T*p,c[11]=j*_-A*p,c},u.b8=G,u.b9=Q,u.bA=TE,u.bB=function(c){return c.message===pn},u.bC=Fa,u.bD=br,u.ba=function(c){return c*Math.PI/180},u.bb=function(c,s){const{x:h,y:p}=Qd.fromLngLat(s);return!(c<0||c>25||p<0||p>=1||h<0||h>=1)},u.bc=function(c,s){return c[0]=s[0],c[1]=0,c[2]=0,c[3]=0,c[4]=0,c[5]=s[1],c[6]=0,c[7]=0,c[8]=0,c[9]=0,c[10]=s[2],c[11]=0,c[12]=0,c[13]=0,c[14]=0,c[15]=1,c},u.bd=class extends N{},u.be=ob,u.bf=BG,u.bh=Ce,u.bi=function(c,s){Nn.REGISTERED_PROTOCOLS[c]=s},u.bj=function(c){delete Nn.REGISTERED_PROTOCOLS[c]},u.bk=function(c,s){const h={};for(let _=0;_<c.length;_++){const k=s&&s[c[_].id]||wm(c[_]);s&&(s[c[_].id]=k);let S=h[k];S||(S=h[k]=[]),S.push(c[_])}const p=[];for(const _ in h)p.push(h[_]);return p},u.bl=ut,u.bm=iC,u.bn=oC,u.bo=NE,u.bp=function(c){c.bucket.createArrays(),c.bucket.tilePixelRatio=ai/(512*c.bucket.overscaling),c.bucket.compareText={},c.bucket.iconsNeedLinear=!1;const s=c.bucket.layers[0],h=s.layout,p=s._unevaluatedLayout._values,_={layoutIconSize:p["icon-size"].possiblyEvaluate(new Vn(c.bucket.zoom+1),c.canonical),layoutTextSize:p["text-size"].possiblyEvaluate(new Vn(c.bucket.zoom+1),c.canonical),textMaxSize:p["text-size"].possiblyEvaluate(new Vn(18))};if(c.bucket.textSizeData.kind==="composite"){const{minZoom:B,maxZoom:z}=c.bucket.textSizeData;_.compositeTextSizes=[p["text-size"].possiblyEvaluate(new Vn(B),c.canonical),p["text-size"].possiblyEvaluate(new Vn(z),c.canonical)]}if(c.bucket.iconSizeData.kind==="composite"){const{minZoom:B,maxZoom:z}=c.bucket.iconSizeData;_.compositeIconSizes=[p["icon-size"].possiblyEvaluate(new Vn(B),c.canonical),p["icon-size"].possiblyEvaluate(new Vn(z),c.canonical)]}const k=h.get("text-line-height")*hi,S=h.get("text-rotation-alignment")!=="viewport"&&h.get("symbol-placement")!=="point",T=h.get("text-keep-upright"),A=h.get("text-size");for(const B of c.bucket.features){const z=h.get("text-font").evaluate(B,{},c.canonical).join(","),L=A.evaluate(B,{},c.canonical),j=_.layoutTextSize.evaluate(B,{},c.canonical),q=_.layoutIconSize.evaluate(B,{},c.canonical),Y={horizontal:{},vertical:void 0},K=B.text;let re,ae=[0,0];if(K){const ye=K.toString(),Te=h.get("text-letter-spacing").evaluate(B,{},c.canonical)*hi,Le=E_(ye)?Te:0,rt=h.get("text-anchor").evaluate(B,{},c.canonical),St=yC(s,B,c.canonical);if(!St){const dt=h.get("text-radial-offset").evaluate(B,{},c.canonical);ae=dt?gC(rt,[dt*hi,lb]):h.get("text-offset").evaluate(B,{},c.canonical).map(at=>at*hi)}let tt=S?"center":h.get("text-justify").evaluate(B,{},c.canonical);const Je=h.get("symbol-placement")==="point"?h.get("text-max-width").evaluate(B,{},c.canonical)*hi:1/0,yt=()=>{c.bucket.allowVerticalPlacement&&Bd(ye)&&(Y.vertical=Hm(K,c.glyphMap,c.glyphPositions,c.imagePositions,z,Je,k,rt,"left",Le,ae,u.ah.vertical,!0,j,L))};if(!S&&St){const dt=new Set;if(tt==="auto")for(let Oe=0;Oe<St.values.length;Oe+=2)dt.add(cb(St.values[Oe]));else dt.add(tt);let at=!1;for(const Oe of dt)if(!Y.horizontal[Oe])if(at)Y.horizontal[Oe]=Y.horizontal[0];else{const bt=Hm(K,c.glyphMap,c.glyphPositions,c.imagePositions,z,Je,k,"center",Oe,Le,ae,u.ah.horizontal,!1,j,L);bt&&(Y.horizontal[Oe]=bt,at=bt.positionedLines.length===1)}yt()}else{tt==="auto"&&(tt=cb(rt));const dt=Hm(K,c.glyphMap,c.glyphPositions,c.imagePositions,z,Je,k,rt,tt,Le,ae,u.ah.horizontal,!1,j,L);dt&&(Y.horizontal[tt]=dt),yt(),Bd(ye)&&S&&T&&(Y.vertical=Hm(K,c.glyphMap,c.glyphPositions,c.imagePositions,z,Je,k,rt,tt,Le,ae,u.ah.vertical,!1,j,L))}}let be=!1;if(B.icon&&B.icon.name){const ye=c.imageMap[B.icon.name];ye&&(re=gG(c.imagePositions[B.icon.name],h.get("icon-offset").evaluate(B,{},c.canonical),h.get("icon-anchor").evaluate(B,{},c.canonical)),be=!!ye.sdf,c.bucket.sdfIcons===void 0?c.bucket.sdfIcons=be:c.bucket.sdfIcons!==be&&ot("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(ye.pixelRatio!==c.bucket.pixelRatio||h.get("icon-rotate").constantOr(1)!==0)&&(c.bucket.iconsNeedLinear=!0))}const pe=bC(Y.horizontal)||Y.vertical;c.bucket.iconsInText=!!pe&&pe.iconsInText,(pe||re)&&DG(c.bucket,B,Y,re,c.imageMap,_,j,q,ae,be,c.canonical)}c.showCollisionBoxes&&c.bucket.generateCollisionDebugBuffers()},u.bq=G_,u.br=H_,u.bs=W_,u.bt=il,u.bu=Y_,u.bv=class{constructor(c){this._marks={start:[c.url,"start"].join("#"),end:[c.url,"end"].join("#"),measure:c.url.toString()},performance.mark(this._marks.start)}finish(){performance.mark(this._marks.end);let c=performance.getEntriesByName(this._marks.measure);return c.length===0&&(performance.measure(this._marks.measure,this._marks.start,this._marks.end),c=performance.getEntriesByName(this._marks.measure),performance.clearMarks(this._marks.start),performance.clearMarks(this._marks.end),performance.clearMeasures(this._marks.measure)),c}},u.bw=function(c,s,h,p,_){return l(this,void 0,void 0,function*(){if(te())try{return yield Cn(c,s,h,p,_)}catch{}return function(k,S,T,A,B){const z=k.width,L=k.height;dn&&vn||(dn=new OffscreenCanvas(z,L),vn=dn.getContext("2d",{willReadFrequently:!0})),dn.width=z,dn.height=L,vn.drawImage(k,0,0,z,L);const j=vn.getImageData(S,T,A,B);return vn.clearRect(0,0,z,L),j.data}(c,s,h,p,_)})},u.bx=nC,u.by=g,u.bz=b,u.c=ti,u.d=c=>l(void 0,void 0,void 0,function*(){if(c.byteLength===0)return createImageBitmap(new ImageData(1,1));const s=new Blob([new Uint8Array(c)],{type:"image/png"});try{return createImageBitmap(s)}catch(h){throw new Error(`Could not load image because of ${h.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`)}}),u.e=Se,u.f=c=>new Promise((s,h)=>{const p=new Image;p.onload=()=>{s(p),URL.revokeObjectURL(p.src),p.onload=null,window.requestAnimationFrame(()=>{p.src=Ht})},p.onerror=()=>h(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 _=new Blob([new Uint8Array(c)],{type:"image/png"});p.src=c.byteLength?URL.createObjectURL(_):Ht}),u.g=Pn,u.h=(c,s)=>De(Se(c,{type:"json"}),s),u.i=Nt,u.j=Mt,u.k=At,u.l=(c,s)=>De(Se(c,{type:"arrayBuffer"}),s),u.m=De,u.n=function(c){return new Y_(c).readFields(cG,[])},u.o=Ud,u.p=zE,u.q=v,u.r=k_,u.s=ct,u.t=Pd,u.u=Ks,u.v=we,u.w=ot,u.x=function([c,s,h]){return s+=90,s*=Math.PI/180,h*=Math.PI/180,{x:c*Math.cos(s)*Math.sin(h),y:c*Math.sin(s)*Math.sin(h),z:c*Math.cos(h)}},u.y=nr,u.z=Vn}),r("worker",["./shared"],function(u){class l{constructor(H){this.keyCache={},H&&this.replace(H)}replace(H){this._layerConfigs={},this._layers={},this.update(H,[])}update(H,U){for(const ie of H){this._layerConfigs[ie.id]=ie;const de=this._layers[ie.id]=u.aA(ie);de._featureFilter=u.a7(de.filter),this.keyCache[ie.id]&&delete this.keyCache[ie.id]}for(const ie of U)delete this.keyCache[ie],delete this._layerConfigs[ie],delete this._layers[ie];this.familiesBySource={};const X=u.bk(Object.values(this._layerConfigs),this.keyCache);for(const ie of X){const de=ie.map(Ee=>this._layers[Ee.id]),fe=de[0];if(fe.visibility==="none")continue;const _e=fe.source||"";let ue=this.familiesBySource[_e];ue||(ue=this.familiesBySource[_e]={});const Me=fe.sourceLayer||"_geojsonTileLayer";let ze=ue[Me];ze||(ze=ue[Me]=[]),ze.push(de)}}}class g{constructor(H){const U={},X=[];for(const _e in H){const ue=H[_e],Me=U[_e]={};for(const ze in ue){const Ee=ue[+ze];if(!Ee||Ee.bitmap.width===0||Ee.bitmap.height===0)continue;const We={x:0,y:0,w:Ee.bitmap.width+2,h:Ee.bitmap.height+2};X.push(We),Me[ze]={rect:We,metrics:Ee.metrics}}}const{w:ie,h:de}=u.p(X),fe=new u.o({width:ie||1,height:de||1});for(const _e in H){const ue=H[_e];for(const Me in ue){const ze=ue[+Me];if(!ze||ze.bitmap.width===0||ze.bitmap.height===0)continue;const Ee=U[_e][Me].rect;u.o.copy(ze.bitmap,fe,{x:0,y:0},{x:Ee.x+1,y:Ee.y+1},ze.bitmap)}}this.image=fe,this.positions=U}}u.bl("GlyphAtlas",g);class b{constructor(H){this.tileID=new u.S(H.tileID.overscaledZ,H.tileID.wrap,H.tileID.canonical.z,H.tileID.canonical.x,H.tileID.canonical.y),this.uid=H.uid,this.zoom=H.zoom,this.pixelRatio=H.pixelRatio,this.tileSize=H.tileSize,this.source=H.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=H.showCollisionBoxes,this.collectResourceTiming=!!H.collectResourceTiming,this.returnDependencies=!!H.returnDependencies,this.promoteId=H.promoteId,this.inFlightDependencies=[]}parse(H,U,X,ie){return u._(this,void 0,void 0,function*(){this.status="parsing",this.data=H,this.collisionBoxArray=new u.a5;const de=new u.bm(Object.keys(H.layers).sort()),fe=new u.bn(this.tileID,this.promoteId);fe.bucketLayerIDs=[];const _e={},ue={featureIndex:fe,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:X},Me=U.familiesBySource[this.source];for(const Ut in Me){const wn=H.layers[Ut];if(!wn)continue;wn.version===1&&u.w(`Vector tile source "${this.source}" layer "${Ut}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const qn=de.encode(Ut),mi=[];for(let ki=0;ki<wn.length;ki++){const Wi=wn.feature(ki),Aa=fe.getId(Wi,Ut);mi.push({feature:Wi,id:Aa,index:ki,sourceLayerIndex:qn})}for(const ki of Me[Ut]){const Wi=ki[0];Wi.source!==this.source&&u.w(`layer.source = ${Wi.source} does not equal this.source = ${this.source}`),Wi.minzoom&&this.zoom<Math.floor(Wi.minzoom)||Wi.maxzoom&&this.zoom>=Wi.maxzoom||Wi.visibility!=="none"&&(w(ki,this.zoom,X),(_e[Wi.id]=Wi.createBucket({index:fe.bucketLayerIDs.length,layers:ki,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:qn,sourceID:this.source})).populate(mi,ue,this.tileID.canonical),fe.bucketLayerIDs.push(ki.map(Aa=>Aa.id)))}}const ze=u.aF(ue.glyphDependencies,Ut=>Object.keys(Ut).map(Number));this.inFlightDependencies.forEach(Ut=>Ut==null?void 0:Ut.abort()),this.inFlightDependencies=[];let Ee=Promise.resolve({});if(Object.keys(ze).length){const Ut=new AbortController;this.inFlightDependencies.push(Ut),Ee=ie.sendAsync({type:"GG",data:{stacks:ze,source:this.source,tileID:this.tileID,type:"glyphs"}},Ut)}const We=Object.keys(ue.iconDependencies);let xt=Promise.resolve({});if(We.length){const Ut=new AbortController;this.inFlightDependencies.push(Ut),xt=ie.sendAsync({type:"GI",data:{icons:We,source:this.source,tileID:this.tileID,type:"icons"}},Ut)}const kt=Object.keys(ue.patternDependencies);let an=Promise.resolve({});if(kt.length){const Ut=new AbortController;this.inFlightDependencies.push(Ut),an=ie.sendAsync({type:"GI",data:{icons:kt,source:this.source,tileID:this.tileID,type:"patterns"}},Ut)}const[Lt,ln,Kt]=yield Promise.all([Ee,xt,an]),oi=new g(Lt),Zn=new u.bo(ln,Kt);for(const Ut in _e){const wn=_e[Ut];wn instanceof u.a6?(w(wn.layers,this.zoom,X),u.bp({bucket:wn,glyphMap:Lt,glyphPositions:oi.positions,imageMap:ln,imagePositions:Zn.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical})):wn.hasPattern&&(wn instanceof u.bq||wn instanceof u.br||wn instanceof u.bs)&&(w(wn.layers,this.zoom,X),wn.addFeatures(ue,this.tileID.canonical,Zn.patternPositions))}return this.status="done",{buckets:Object.values(_e).filter(Ut=>!Ut.isEmpty()),featureIndex:fe,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:oi.image,imageAtlas:Zn,glyphMap:this.returnDependencies?Lt:null,iconMap:this.returnDependencies?ln:null,glyphPositions:this.returnDependencies?oi.positions:null}})}}function w(se,H,U){const X=new u.z(H);for(const ie of se)ie.recalculate(X,U)}class E{constructor(H,U,X){this.actor=H,this.layerIndex=U,this.availableImages=X,this.fetching={},this.loading={},this.loaded={}}loadVectorTile(H,U){return u._(this,void 0,void 0,function*(){const X=yield u.l(H.request,U);try{return{vectorTile:new u.bt.VectorTile(new u.bu(X.data)),rawData:X.data,cacheControl:X.cacheControl,expires:X.expires}}catch(ie){const de=new Uint8Array(X.data);let fe=`Unable to parse the tile at ${H.request.url}, `;throw fe+=de[0]===31&&de[1]===139?"please make sure the data is not gzipped and that you have configured the relevant header in the server":`got error: ${ie.message}`,new Error(fe)}})}loadTile(H){return u._(this,void 0,void 0,function*(){const U=H.uid,X=!!(H&&H.request&&H.request.collectResourceTiming)&&new u.bv(H.request),ie=new b(H);this.loading[U]=ie;const de=new AbortController;ie.abort=de;try{const fe=yield this.loadVectorTile(H,de);if(delete this.loading[U],!fe)return null;const _e=fe.rawData,ue={};fe.expires&&(ue.expires=fe.expires),fe.cacheControl&&(ue.cacheControl=fe.cacheControl);const Me={};if(X){const Ee=X.finish();Ee&&(Me.resourceTiming=JSON.parse(JSON.stringify(Ee)))}ie.vectorTile=fe.vectorTile;const ze=ie.parse(fe.vectorTile,this.layerIndex,this.availableImages,this.actor);this.loaded[U]=ie,this.fetching[U]={rawTileData:_e,cacheControl:ue,resourceTiming:Me};try{const Ee=yield ze;return u.e({rawTileData:_e.slice(0)},Ee,ue,Me)}finally{delete this.fetching[U]}}catch(fe){throw delete this.loading[U],ie.status="done",this.loaded[U]=ie,fe}})}reloadTile(H){return u._(this,void 0,void 0,function*(){const U=H.uid;if(!this.loaded||!this.loaded[U])throw new Error("Should not be trying to reload a tile that was never loaded or has been removed");const X=this.loaded[U];if(X.showCollisionBoxes=H.showCollisionBoxes,X.status==="parsing"){const ie=yield X.parse(X.vectorTile,this.layerIndex,this.availableImages,this.actor);let de;if(this.fetching[U]){const{rawTileData:fe,cacheControl:_e,resourceTiming:ue}=this.fetching[U];delete this.fetching[U],de=u.e({rawTileData:fe.slice(0)},ie,_e,ue)}else de=ie;return de}if(X.status==="done"&&X.vectorTile)return X.parse(X.vectorTile,this.layerIndex,this.availableImages,this.actor)})}abortTile(H){return u._(this,void 0,void 0,function*(){const U=this.loading,X=H.uid;U&&U[X]&&U[X].abort&&(U[X].abort.abort(),delete U[X])})}removeTile(H){return u._(this,void 0,void 0,function*(){this.loaded&&this.loaded[H.uid]&&delete this.loaded[H.uid]})}}class C{constructor(){this.loaded={}}loadTile(H){return u._(this,void 0,void 0,function*(){const{uid:U,encoding:X,rawImageData:ie,redFactor:de,greenFactor:fe,blueFactor:_e,baseShift:ue}=H,Me=ie.width+2,ze=ie.height+2,Ee=u.b(ie)?new u.R({width:Me,height:ze},yield u.bw(ie,-1,-1,Me,ze)):ie,We=new u.bx(U,Ee,X,de,fe,_e,ue);return this.loaded=this.loaded||{},this.loaded[U]=We,We})}removeTile(H){const U=this.loaded,X=H.uid;U&&U[X]&&delete U[X]}}function P(se,H){if(se.length!==0){D(se[0],H);for(var U=1;U<se.length;U++)D(se[U],!H)}}function D(se,H){for(var U=0,X=0,ie=0,de=se.length,fe=de-1;ie<de;fe=ie++){var _e=(se[ie][0]-se[fe][0])*(se[fe][1]+se[ie][1]),ue=U+_e;X+=Math.abs(U)>=Math.abs(_e)?U-ue+_e:_e-ue+U,U=ue}U+X>=0!=!!H&&se.reverse()}var R=u.by(function se(H,U){var X,ie=H&&H.type;if(ie==="FeatureCollection")for(X=0;X<H.features.length;X++)se(H.features[X],U);else if(ie==="GeometryCollection")for(X=0;X<H.geometries.length;X++)se(H.geometries[X],U);else if(ie==="Feature")se(H.geometry,U);else if(ie==="Polygon")P(H.coordinates,U);else if(ie==="MultiPolygon")for(X=0;X<H.coordinates.length;X++)P(H.coordinates[X],U);return H});const $=u.bt.VectorTileFeature.prototype.toGeoJSON;var W={exports:{}},te=u.bz,G=u.bt.VectorTileFeature,Q=Ie;function Ie(se,H){this.options=H||{},this.features=se,this.length=se.length}function ve(se,H){this.id=typeof se.id=="number"?se.id:void 0,this.type=se.type,this.rawGeometry=se.type===1?[se.geometry]:se.geometry,this.properties=se.tags,this.extent=H||4096}Ie.prototype.feature=function(se){return new ve(this.features[se],this.options.extent)},ve.prototype.loadGeometry=function(){var se=this.rawGeometry;this.geometry=[];for(var H=0;H<se.length;H++){for(var U=se[H],X=[],ie=0;ie<U.length;ie++)X.push(new te(U[ie][0],U[ie][1]));this.geometry.push(X)}return this.geometry},ve.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var se=this.geometry,H=1/0,U=-1/0,X=1/0,ie=-1/0,de=0;de<se.length;de++)for(var fe=se[de],_e=0;_e<fe.length;_e++){var ue=fe[_e];H=Math.min(H,ue.x),U=Math.max(U,ue.x),X=Math.min(X,ue.y),ie=Math.max(ie,ue.y)}return[H,X,U,ie]},ve.prototype.toGeoJSON=G.prototype.toGeoJSON;var Se=u.bA,Ne=Q;function Ae(se){var H=new Se;return function(U,X){for(var ie in U.layers)X.writeMessage(3,$e,U.layers[ie])}(se,H),H.finish()}function $e(se,H){var U;H.writeVarintField(15,se.version||1),H.writeStringField(1,se.name||""),H.writeVarintField(5,se.extent||4096);var X={keys:[],values:[],keycache:{},valuecache:{}};for(U=0;U<se.length;U++)X.feature=se.feature(U),H.writeMessage(2,Xe,X);var ie=X.keys;for(U=0;U<ie.length;U++)H.writeStringField(3,ie[U]);var de=X.values;for(U=0;U<de.length;U++)H.writeMessage(4,Vt,de[U])}function Xe(se,H){var U=se.feature;U.id!==void 0&&H.writeVarintField(1,U.id),H.writeMessage(2,Pt,se),H.writeVarintField(3,U.type),H.writeMessage(4,Nt,U)}function Pt(se,H){var U=se.feature,X=se.keys,ie=se.values,de=se.keycache,fe=se.valuecache;for(var _e in U.properties){var ue=U.properties[_e],Me=de[_e];if(ue!==null){Me===void 0&&(X.push(_e),de[_e]=Me=X.length-1),H.writeVarint(Me);var ze=typeof ue;ze!=="string"&&ze!=="boolean"&&ze!=="number"&&(ue=JSON.stringify(ue));var Ee=ze+":"+ue,We=fe[Ee];We===void 0&&(ie.push(ue),fe[Ee]=We=ie.length-1),H.writeVarint(We)}}}function ot(se,H){return(H<<3)+(7&se)}function Tt(se){return se<<1^se>>31}function Nt(se,H){for(var U=se.loadGeometry(),X=se.type,ie=0,de=0,fe=U.length,_e=0;_e<fe;_e++){var ue=U[_e],Me=1;X===1&&(Me=ue.length),H.writeVarint(ot(1,Me));for(var ze=X===3?ue.length-1:ue.length,Ee=0;Ee<ze;Ee++){Ee===1&&X!==1&&H.writeVarint(ot(2,ze-1));var We=ue[Ee].x-ie,xt=ue[Ee].y-de;H.writeVarint(Tt(We)),H.writeVarint(Tt(xt)),ie+=We,de+=xt}X===3&&H.writeVarint(ot(7,1))}}function Vt(se,H){var U=typeof se;U==="string"?H.writeStringField(1,se):U==="boolean"?H.writeBooleanField(7,se):U==="number"&&(se%1!=0?H.writeDoubleField(3,se):se<0?H.writeSVarintField(6,se):H.writeVarintField(5,se))}W.exports=Ae,W.exports.fromVectorTileJs=Ae,W.exports.fromGeojsonVt=function(se,H){H=H||{};var U={};for(var X in se)U[X]=new Ne(se[X].features,H),U[X].name=X,U[X].version=H.version,U[X].extent=H.extent;return Ae({layers:U})},W.exports.GeoJSONWrapper=Ne;var Ft=u.by(W.exports);const Ht={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:se=>se},Cn=Math.fround||(dn=new Float32Array(1),se=>(dn[0]=+se,dn[0]));var dn;const vn=3,pn=5,ti=6;class Nn{constructor(H){this.options=Object.assign(Object.create(Ht),H),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(H){const{log:U,minZoom:X,maxZoom:ie}=this.options;U&&console.time("total time");const de=`prepare ${H.length} points`;U&&console.time(de),this.points=H;const fe=[];for(let ue=0;ue<H.length;ue++){const Me=H[ue];if(!Me.geometry)continue;const[ze,Ee]=Me.geometry.coordinates,We=Cn(Ce(ze)),xt=Cn(He(Ee));fe.push(We,xt,1/0,ue,-1,1),this.options.reduce&&fe.push(0)}let _e=this.trees[ie+1]=this._createTree(fe);U&&console.timeEnd(de);for(let ue=ie;ue>=X;ue--){const Me=+Date.now();_e=this.trees[ue]=this._createTree(this._cluster(_e,ue)),U&&console.log("z%d: %d clusters in %dms",ue,_e.numItems,+Date.now()-Me)}return U&&console.timeEnd("total time"),this}getClusters(H,U){let X=((H[0]+180)%360+360)%360-180;const ie=Math.max(-90,Math.min(90,H[1]));let de=H[2]===180?180:((H[2]+180)%360+360)%360-180;const fe=Math.max(-90,Math.min(90,H[3]));if(H[2]-H[0]>=360)X=-180,de=180;else if(X>de){const Ee=this.getClusters([X,ie,180,fe],U),We=this.getClusters([-180,ie,de,fe],U);return Ee.concat(We)}const _e=this.trees[this._limitZoom(U)],ue=_e.range(Ce(X),He(fe),Ce(de),He(ie)),Me=_e.data,ze=[];for(const Ee of ue){const We=this.stride*Ee;ze.push(Me[We+pn]>1?Pn(Me,We,this.clusterProps):this.points[Me[We+vn]])}return ze}getChildren(H){const U=this._getOriginId(H),X=this._getOriginZoom(H),ie="No cluster with the specified id.",de=this.trees[X];if(!de)throw new Error(ie);const fe=de.data;if(U*this.stride>=fe.length)throw new Error(ie);const _e=this.options.radius/(this.options.extent*Math.pow(2,X-1)),ue=de.within(fe[U*this.stride],fe[U*this.stride+1],_e),Me=[];for(const ze of ue){const Ee=ze*this.stride;fe[Ee+4]===H&&Me.push(fe[Ee+pn]>1?Pn(fe,Ee,this.clusterProps):this.points[fe[Ee+vn]])}if(Me.length===0)throw new Error(ie);return Me}getLeaves(H,U,X){const ie=[];return this._appendLeaves(ie,H,U=U||10,X=X||0,0),ie}getTile(H,U,X){const ie=this.trees[this._limitZoom(H)],de=Math.pow(2,H),{extent:fe,radius:_e}=this.options,ue=_e/fe,Me=(X-ue)/de,ze=(X+1+ue)/de,Ee={features:[]};return this._addTileFeatures(ie.range((U-ue)/de,Me,(U+1+ue)/de,ze),ie.data,U,X,de,Ee),U===0&&this._addTileFeatures(ie.range(1-ue/de,Me,1,ze),ie.data,de,X,de,Ee),U===de-1&&this._addTileFeatures(ie.range(0,Me,ue/de,ze),ie.data,-1,X,de,Ee),Ee.features.length?Ee:null}getClusterExpansionZoom(H){let U=this._getOriginZoom(H)-1;for(;U<=this.options.maxZoom;){const X=this.getChildren(H);if(U++,X.length!==1)break;H=X[0].properties.cluster_id}return U}_appendLeaves(H,U,X,ie,de){const fe=this.getChildren(U);for(const _e of fe){const ue=_e.properties;if(ue&&ue.cluster?de+ue.point_count<=ie?de+=ue.point_count:de=this._appendLeaves(H,ue.cluster_id,X,ie,de):de<ie?de++:H.push(_e),H.length===X)break}return de}_createTree(H){const U=new u.av(H.length/this.stride|0,this.options.nodeSize,Float32Array);for(let X=0;X<H.length;X+=this.stride)U.add(H[X],H[X+1]);return U.finish(),U.data=H,U}_addTileFeatures(H,U,X,ie,de,fe){for(const _e of H){const ue=_e*this.stride,Me=U[ue+pn]>1;let ze,Ee,We;if(Me)ze=Rn(U,ue,this.clusterProps),Ee=U[ue],We=U[ue+1];else{const an=this.points[U[ue+vn]];ze=an.properties;const[Lt,ln]=an.geometry.coordinates;Ee=Ce(Lt),We=He(ln)}const xt={type:1,geometry:[[Math.round(this.options.extent*(Ee*de-X)),Math.round(this.options.extent*(We*de-ie))]],tags:ze};let kt;kt=Me||this.options.generateId?U[ue+vn]:this.points[U[ue+vn]].id,kt!==void 0&&(xt.id=kt),fe.features.push(xt)}}_limitZoom(H){return Math.max(this.options.minZoom,Math.min(Math.floor(+H),this.options.maxZoom+1))}_cluster(H,U){const{radius:X,extent:ie,reduce:de,minPoints:fe}=this.options,_e=X/(ie*Math.pow(2,U)),ue=H.data,Me=[],ze=this.stride;for(let Ee=0;Ee<ue.length;Ee+=ze){if(ue[Ee+2]<=U)continue;ue[Ee+2]=U;const We=ue[Ee],xt=ue[Ee+1],kt=H.within(ue[Ee],ue[Ee+1],_e),an=ue[Ee+pn];let Lt=an;for(const ln of kt){const Kt=ln*ze;ue[Kt+2]>U&&(Lt+=ue[Kt+pn])}if(Lt>an&&Lt>=fe){let ln,Kt=We*an,oi=xt*an,Zn=-1;const Ut=((Ee/ze|0)<<5)+(U+1)+this.points.length;for(const wn of kt){const qn=wn*ze;if(ue[qn+2]<=U)continue;ue[qn+2]=U;const mi=ue[qn+pn];Kt+=ue[qn]*mi,oi+=ue[qn+1]*mi,ue[qn+4]=Ut,de&&(ln||(ln=this._map(ue,Ee,!0),Zn=this.clusterProps.length,this.clusterProps.push(ln)),de(ln,this._map(ue,qn)))}ue[Ee+4]=Ut,Me.push(Kt/Lt,oi/Lt,1/0,Ut,-1,Lt),de&&Me.push(Zn)}else{for(let ln=0;ln<ze;ln++)Me.push(ue[Ee+ln]);if(Lt>1)for(const ln of kt){const Kt=ln*ze;if(!(ue[Kt+2]<=U)){ue[Kt+2]=U;for(let oi=0;oi<ze;oi++)Me.push(ue[Kt+oi])}}}}return Me}_getOriginId(H){return H-this.points.length>>5}_getOriginZoom(H){return(H-this.points.length)%32}_map(H,U,X){if(H[U+pn]>1){const fe=this.clusterProps[H[U+ti]];return X?Object.assign({},fe):fe}const ie=this.points[H[U+vn]].properties,de=this.options.map(ie);return X&&de===ie?Object.assign({},de):de}}function Pn(se,H,U){return{type:"Feature",id:se[H+vn],properties:Rn(se,H,U),geometry:{type:"Point",coordinates:[(X=se[H],360*(X-.5)),De(se[H+1])]}};var X}function Rn(se,H,U){const X=se[H+pn],ie=X>=1e4?`${Math.round(X/1e3)}k`:X>=1e3?Math.round(X/100)/10+"k":X,de=se[H+ti],fe=de===-1?{}:Object.assign({},U[de]);return Object.assign(fe,{cluster:!0,cluster_id:se[H+vn],point_count:X,point_count_abbreviated:ie})}function Ce(se){return se/360+.5}function He(se){const H=Math.sin(se*Math.PI/180),U=.5-.25*Math.log((1+H)/(1-H))/Math.PI;return U<0?0:U>1?1:U}function De(se){const H=(180-360*se)*Math.PI/180;return 360*Math.atan(Math.exp(H))/Math.PI-90}function ct(se,H,U,X){let ie=X;const de=H+(U-H>>1);let fe,_e=U-H;const ue=se[H],Me=se[H+1],ze=se[U],Ee=se[U+1];for(let We=H+3;We<U;We+=3){const xt=Rt(se[We],se[We+1],ue,Me,ze,Ee);if(xt>ie)fe=We,ie=xt;else if(xt===ie){const kt=Math.abs(We-de);kt<_e&&(fe=We,_e=kt)}}ie>X&&(fe-H>3&&ct(se,H,fe,X),se[fe+2]=ie,U-fe>3&&ct(se,fe,U,X))}function Rt(se,H,U,X,ie,de){let fe=ie-U,_e=de-X;if(fe!==0||_e!==0){const ue=((se-U)*fe+(H-X)*_e)/(fe*fe+_e*_e);ue>1?(U=ie,X=de):ue>0&&(U+=fe*ue,X+=_e*ue)}return fe=se-U,_e=H-X,fe*fe+_e*_e}function Qt(se,H,U,X){const ie={id:se??null,type:H,geometry:U,tags:X,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if(H==="Point"||H==="MultiPoint"||H==="LineString")At(ie,U);else if(H==="Polygon")At(ie,U[0]);else if(H==="MultiLineString")for(const de of U)At(ie,de);else if(H==="MultiPolygon")for(const de of U)At(ie,de[0]);return ie}function At(se,H){for(let U=0;U<H.length;U+=3)se.minX=Math.min(se.minX,H[U]),se.minY=Math.min(se.minY,H[U+1]),se.maxX=Math.max(se.maxX,H[U]),se.maxY=Math.max(se.maxY,H[U+1])}function Mt(se,H,U,X){if(!H.geometry)return;const ie=H.geometry.coordinates;if(ie&&ie.length===0)return;const de=H.geometry.type,fe=Math.pow(U.tolerance/((1<<U.maxZoom)*U.extent),2);let _e=[],ue=H.id;if(U.promoteId?ue=H.properties[U.promoteId]:U.generateId&&(ue=X||0),de==="Point")rn(ie,_e);else if(de==="MultiPoint")for(const Me of ie)rn(Me,_e);else if(de==="LineString")we(ie,_e,fe,!1);else if(de==="MultiLineString"){if(U.lineMetrics){for(const Me of ie)_e=[],we(Me,_e,fe,!1),se.push(Qt(ue,"LineString",_e,H.properties));return}yn(ie,_e,fe,!1)}else if(de==="Polygon")yn(ie,_e,fe,!0);else{if(de!=="MultiPolygon"){if(de==="GeometryCollection"){for(const Me of H.geometry.geometries)Mt(se,{id:ue,geometry:Me,properties:H.properties},U,X);return}throw new Error("Input data is not a valid GeoJSON object.")}for(const Me of ie){const ze=[];yn(Me,ze,fe,!0),_e.push(ze)}}se.push(Qt(ue,de,_e,H.properties))}function rn(se,H){H.push(pr(se[0]),qt(se[1]),0)}function we(se,H,U,X){let ie,de,fe=0;for(let ue=0;ue<se.length;ue++){const Me=pr(se[ue][0]),ze=qt(se[ue][1]);H.push(Me,ze,0),ue>0&&(fe+=X?(ie*ze-Me*de)/2:Math.sqrt(Math.pow(Me-ie,2)+Math.pow(ze-de,2))),ie=Me,de=ze}const _e=H.length-3;H[2]=1,ct(H,0,_e,U),H[_e+2]=1,H.size=Math.abs(fe),H.start=0,H.end=H.size}function yn(se,H,U,X){for(let ie=0;ie<se.length;ie++){const de=[];we(se[ie],de,U,X),H.push(de)}}function pr(se){return se/360+.5}function qt(se){const H=Math.sin(se*Math.PI/180),U=.5-.25*Math.log((1+H)/(1-H))/Math.PI;return U<0?0:U>1?1:U}function sn(se,H,U,X,ie,de,fe,_e){if(X/=H,de>=(U/=H)&&fe<X)return se;if(fe<U||de>=X)return null;const ue=[];for(const Me of se){const ze=Me.geometry;let Ee=Me.type;const We=ie===0?Me.minX:Me.minY,xt=ie===0?Me.maxX:Me.maxY;if(We>=U&&xt<X){ue.push(Me);continue}if(xt<U||We>=X)continue;let kt=[];if(Ee==="Point"||Ee==="MultiPoint")ui(ze,kt,U,X,ie);else if(Ee==="LineString")Hi(ze,kt,U,X,ie,!1,_e.lineMetrics);else if(Ee==="MultiLineString")Or(ze,kt,U,X,ie,!1);else if(Ee==="Polygon")Or(ze,kt,U,X,ie,!0);else if(Ee==="MultiPolygon")for(const an of ze){const Lt=[];Or(an,Lt,U,X,ie,!0),Lt.length&&kt.push(Lt)}if(kt.length){if(_e.lineMetrics&&Ee==="LineString"){for(const an of kt)ue.push(Qt(Me.id,Ee,an,Me.tags));continue}Ee!=="LineString"&&Ee!=="MultiLineString"||(kt.length===1?(Ee="LineString",kt=kt[0]):Ee="MultiLineString"),Ee!=="Point"&&Ee!=="MultiPoint"||(Ee=kt.length===3?"Point":"MultiPoint"),ue.push(Qt(Me.id,Ee,kt,Me.tags))}}return ue.length?ue:null}function ui(se,H,U,X,ie){for(let de=0;de<se.length;de+=3){const fe=se[de+ie];fe>=U&&fe<=X&&vi(H,se[de],se[de+1],se[de+2])}}function Hi(se,H,U,X,ie,de,fe){let _e=xi(se);const ue=ie===0?Eo:Co;let Me,ze,Ee=se.start;for(let Lt=0;Lt<se.length-3;Lt+=3){const ln=se[Lt],Kt=se[Lt+1],oi=se[Lt+2],Zn=se[Lt+3],Ut=se[Lt+4],wn=ie===0?ln:Kt,qn=ie===0?Zn:Ut;let mi=!1;fe&&(Me=Math.sqrt(Math.pow(ln-Zn,2)+Math.pow(Kt-Ut,2))),wn<U?qn>U&&(ze=ue(_e,ln,Kt,Zn,Ut,U),fe&&(_e.start=Ee+Me*ze)):wn>X?qn<X&&(ze=ue(_e,ln,Kt,Zn,Ut,X),fe&&(_e.start=Ee+Me*ze)):vi(_e,ln,Kt,oi),qn<U&&wn>=U&&(ze=ue(_e,ln,Kt,Zn,Ut,U),mi=!0),qn>X&&wn<=X&&(ze=ue(_e,ln,Kt,Zn,Ut,X),mi=!0),!de&&mi&&(fe&&(_e.end=Ee+Me*ze),H.push(_e),_e=xi(se)),fe&&(Ee+=Me)}let We=se.length-3;const xt=se[We],kt=se[We+1],an=ie===0?xt:kt;an>=U&&an<=X&&vi(_e,xt,kt,se[We+2]),We=_e.length-3,de&&We>=3&&(_e[We]!==_e[0]||_e[We+1]!==_e[1])&&vi(_e,_e[0],_e[1],_e[2]),_e.length&&H.push(_e)}function xi(se){const H=[];return H.size=se.size,H.start=se.start,H.end=se.end,H}function Or(se,H,U,X,ie,de){for(const fe of se)Hi(fe,H,U,X,ie,de,!1)}function vi(se,H,U,X){se.push(H,U,X)}function Eo(se,H,U,X,ie,de){const fe=(de-H)/(X-H);return vi(se,de,U+(ie-U)*fe,1),fe}function Co(se,H,U,X,ie,de){const fe=(de-U)/(ie-U);return vi(se,H+(X-H)*fe,de,1),fe}function Ve(se,H){const U=[];for(let X=0;X<se.length;X++){const ie=se[X],de=ie.type;let fe;if(de==="Point"||de==="MultiPoint"||de==="LineString")fe=Br(ie.geometry,H);else if(de==="MultiLineString"||de==="Polygon"){fe=[];for(const _e of ie.geometry)fe.push(Br(_e,H))}else if(de==="MultiPolygon"){fe=[];for(const _e of ie.geometry){const ue=[];for(const Me of _e)ue.push(Br(Me,H));fe.push(ue)}}U.push(Qt(ie.id,de,fe,ie.tags))}return U}function Br(se,H){const U=[];U.size=se.size,se.start!==void 0&&(U.start=se.start,U.end=se.end);for(let X=0;X<se.length;X+=3)U.push(se[X]+H,se[X+1],se[X+2]);return U}function wi(se,H){if(se.transformed)return se;const U=1<<se.z,X=se.x,ie=se.y;for(const de of se.features){const fe=de.geometry,_e=de.type;if(de.geometry=[],_e===1)for(let ue=0;ue<fe.length;ue+=2)de.geometry.push(zr(fe[ue],fe[ue+1],H,U,X,ie));else for(let ue=0;ue<fe.length;ue++){const Me=[];for(let ze=0;ze<fe[ue].length;ze+=2)Me.push(zr(fe[ue][ze],fe[ue][ze+1],H,U,X,ie));de.geometry.push(Me)}}return se.transformed=!0,se}function zr(se,H,U,X,ie,de){return[Math.round(U*(se*X-ie)),Math.round(U*(H*X-de))]}function To(se,H,U,X,ie){const de=H===ie.maxZoom?0:ie.tolerance/((1<<H)*ie.extent),fe={features:[],numPoints:0,numSimplified:0,numFeatures:se.length,source:null,x:U,y:X,z:H,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0};for(const _e of se)Ze(fe,_e,de,ie);return fe}function Ze(se,H,U,X){const ie=H.geometry,de=H.type,fe=[];if(se.minX=Math.min(se.minX,H.minX),se.minY=Math.min(se.minY,H.minY),se.maxX=Math.max(se.maxX,H.maxX),se.maxY=Math.max(se.maxY,H.maxY),de==="Point"||de==="MultiPoint")for(let _e=0;_e<ie.length;_e+=3)fe.push(ie[_e],ie[_e+1]),se.numPoints++,se.numSimplified++;else if(de==="LineString")ke(fe,ie,se,U,!1,!1);else if(de==="MultiLineString"||de==="Polygon")for(let _e=0;_e<ie.length;_e++)ke(fe,ie[_e],se,U,de==="Polygon",_e===0);else if(de==="MultiPolygon")for(let _e=0;_e<ie.length;_e++){const ue=ie[_e];for(let Me=0;Me<ue.length;Me++)ke(fe,ue[Me],se,U,!0,Me===0)}if(fe.length){let _e=H.tags||null;if(de==="LineString"&&X.lineMetrics){_e={};for(const Me in H.tags)_e[Me]=H.tags[Me];_e.mapbox_clip_start=ie.start/ie.size,_e.mapbox_clip_end=ie.end/ie.size}const ue={geometry:fe,type:de==="Polygon"||de==="MultiPolygon"?3:de==="LineString"||de==="MultiLineString"?2:1,tags:_e};H.id!==null&&(ue.id=H.id),se.features.push(ue)}}function ke(se,H,U,X,ie,de){const fe=X*X;if(X>0&&H.size<(ie?fe:X))return void(U.numPoints+=H.length/3);const _e=[];for(let ue=0;ue<H.length;ue+=3)(X===0||H[ue+2]>fe)&&(U.numSimplified++,_e.push(H[ue],H[ue+1])),U.numPoints++;ie&&function(ue,Me){let ze=0;for(let Ee=0,We=ue.length,xt=We-2;Ee<We;xt=Ee,Ee+=2)ze+=(ue[Ee]-ue[xt])*(ue[Ee+1]+ue[xt+1]);if(ze>0===Me)for(let Ee=0,We=ue.length;Ee<We/2;Ee+=2){const xt=ue[Ee],kt=ue[Ee+1];ue[Ee]=ue[We-2-Ee],ue[Ee+1]=ue[We-1-Ee],ue[We-2-Ee]=xt,ue[We-1-Ee]=kt}}(_e,de),se.push(_e)}const Re={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0};class vt{constructor(H,U){const X=(U=this.options=function(de,fe){for(const _e in fe)de[_e]=fe[_e];return de}(Object.create(Re),U)).debug;if(X&&console.time("preprocess data"),U.maxZoom<0||U.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(U.promoteId&&U.generateId)throw new Error("promoteId and generateId cannot be used together.");let ie=function(de,fe){const _e=[];if(de.type==="FeatureCollection")for(let ue=0;ue<de.features.length;ue++)Mt(_e,de.features[ue],fe,ue);else Mt(_e,de.type==="Feature"?de:{geometry:de},fe);return _e}(H,U);this.tiles={},this.tileCoords=[],X&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",U.indexMaxZoom,U.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),ie=function(de,fe){const _e=fe.buffer/fe.extent;let ue=de;const Me=sn(de,1,-1-_e,_e,0,-1,2,fe),ze=sn(de,1,1-_e,2+_e,0,-1,2,fe);return(Me||ze)&&(ue=sn(de,1,-_e,1+_e,0,-1,2,fe)||[],Me&&(ue=Ve(Me,1).concat(ue)),ze&&(ue=ue.concat(Ve(ze,-1)))),ue}(ie,U),ie.length&&this.splitTile(ie,0,0,0),X&&(ie.length&&console.log("features: %d, points: %d",this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd("generate tiles"),console.log("tiles generated:",this.total,JSON.stringify(this.stats)))}splitTile(H,U,X,ie,de,fe,_e){const ue=[H,U,X,ie],Me=this.options,ze=Me.debug;for(;ue.length;){ie=ue.pop(),X=ue.pop(),U=ue.pop(),H=ue.pop();const Ee=1<<U,We=Wt(U,X,ie);let xt=this.tiles[We];if(!xt&&(ze>1&&console.time("creation"),xt=this.tiles[We]=To(H,U,X,ie,Me),this.tileCoords.push({z:U,x:X,y:ie}),ze)){ze>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",U,X,ie,xt.numFeatures,xt.numPoints,xt.numSimplified),console.timeEnd("creation"));const mi=`z${U}`;this.stats[mi]=(this.stats[mi]||0)+1,this.total++}if(xt.source=H,de==null){if(U===Me.indexMaxZoom||xt.numPoints<=Me.indexMaxPoints)continue}else{if(U===Me.maxZoom||U===de)continue;if(de!=null){const mi=de-U;if(X!==fe>>mi||ie!==_e>>mi)continue}}if(xt.source=null,H.length===0)continue;ze>1&&console.time("clipping");const kt=.5*Me.buffer/Me.extent,an=.5-kt,Lt=.5+kt,ln=1+kt;let Kt=null,oi=null,Zn=null,Ut=null,wn=sn(H,Ee,X-kt,X+Lt,0,xt.minX,xt.maxX,Me),qn=sn(H,Ee,X+an,X+ln,0,xt.minX,xt.maxX,Me);H=null,wn&&(Kt=sn(wn,Ee,ie-kt,ie+Lt,1,xt.minY,xt.maxY,Me),oi=sn(wn,Ee,ie+an,ie+ln,1,xt.minY,xt.maxY,Me),wn=null),qn&&(Zn=sn(qn,Ee,ie-kt,ie+Lt,1,xt.minY,xt.maxY,Me),Ut=sn(qn,Ee,ie+an,ie+ln,1,xt.minY,xt.maxY,Me),qn=null),ze>1&&console.timeEnd("clipping"),ue.push(Kt||[],U+1,2*X,2*ie),ue.push(oi||[],U+1,2*X,2*ie+1),ue.push(Zn||[],U+1,2*X+1,2*ie),ue.push(Ut||[],U+1,2*X+1,2*ie+1)}}getTile(H,U,X){H=+H,U=+U,X=+X;const ie=this.options,{extent:de,debug:fe}=ie;if(H<0||H>24)return null;const _e=1<<H,ue=Wt(H,U=U+_e&_e-1,X);if(this.tiles[ue])return wi(this.tiles[ue],de);fe>1&&console.log("drilling down to z%d-%d-%d",H,U,X);let Me,ze=H,Ee=U,We=X;for(;!Me&&ze>0;)ze--,Ee>>=1,We>>=1,Me=this.tiles[Wt(ze,Ee,We)];return Me&&Me.source?(fe>1&&(console.log("found parent tile z%d-%d-%d",ze,Ee,We),console.time("drilling down")),this.splitTile(Me.source,ze,Ee,We,H,U,X),fe>1&&console.timeEnd("drilling down"),this.tiles[ue]?wi(this.tiles[ue],de):null):null}}function Wt(se,H,U){return 32*((1<<se)*U+H)+se}function et(se,H){return H?se.properties[H]:se.id}function Ln(se,H){if(se==null)return!0;if(se.type==="Feature")return et(se,H)!=null;if(se.type==="FeatureCollection"){const U=new Set;for(const X of se.features){const ie=et(X,H);if(ie==null||U.has(ie))return!1;U.add(ie)}return!0}return!1}function Kn(se,H){const U=new Map;if(se!=null)if(se.type==="Feature")U.set(et(se,H),se);else for(const X of se.features)U.set(et(X,H),X);return U}class qi extends E{constructor(){super(...arguments),this._dataUpdateable=new Map}loadVectorTile(H,U){return u._(this,void 0,void 0,function*(){const X=H.tileID.canonical;if(!this._geoJSONIndex)throw new Error("Unable to parse the data into a cluster or geojson");const ie=this._geoJSONIndex.getTile(X.z,X.x,X.y);if(!ie)return null;const de=new class{constructor(_e){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=u.X,this.length=_e.length,this._features=_e}feature(_e){return new class{constructor(ue){this._feature=ue,this.extent=u.X,this.type=ue.type,this.properties=ue.tags,"id"in ue&&!isNaN(ue.id)&&(this.id=parseInt(ue.id,10))}loadGeometry(){if(this._feature.type===1){const ue=[];for(const Me of this._feature.geometry)ue.push([new u.P(Me[0],Me[1])]);return ue}{const ue=[];for(const Me of this._feature.geometry){const ze=[];for(const Ee of Me)ze.push(new u.P(Ee[0],Ee[1]));ue.push(ze)}return ue}}toGeoJSON(ue,Me,ze){return $.call(this,ue,Me,ze)}}(this._features[_e])}}(ie.features);let fe=Ft(de);return fe.byteOffset===0&&fe.byteLength===fe.buffer.byteLength||(fe=new Uint8Array(fe)),{vectorTile:de,rawData:fe.buffer}})}loadData(H){return u._(this,void 0,void 0,function*(){var U;(U=this._pendingRequest)===null||U===void 0||U.abort();const X=!!(H&&H.request&&H.request.collectResourceTiming)&&new u.bv(H.request);this._pendingRequest=new AbortController;try{this._pendingData=this.loadAndProcessGeoJSON(H,this._pendingRequest),this._geoJSONIndex=H.cluster?new Nn(function({superclusterOptions:fe,clusterProperties:_e}){if(!_e||!fe)return fe;const ue={},Me={},ze={accumulated:null,zoom:0},Ee={properties:null},We=Object.keys(_e);for(const xt of We){const[kt,an]=_e[xt],Lt=u.bC(an),ln=u.bC(typeof kt=="string"?[kt,["accumulated"],["get",xt]]:kt);ue[xt]=Lt.value,Me[xt]=ln.value}return fe.map=xt=>{Ee.properties=xt;const kt={};for(const an of We)kt[an]=ue[an].evaluate(ze,Ee);return kt},fe.reduce=(xt,kt)=>{Ee.properties=kt;for(const an of We)ze.accumulated=xt[an],xt[an]=Me[an].evaluate(ze,Ee)},fe}(H)).load((yield this._pendingData).features):(ie=yield this._pendingData,new vt(ie,H.geojsonVtOptions)),this.loaded={};const de={};if(X){const fe=X.finish();fe&&(de.resourceTiming={},de.resourceTiming[H.source]=JSON.parse(JSON.stringify(fe)))}return de}catch(de){if(delete this._pendingRequest,u.bB(de))return{abandoned:!0};throw de}var ie})}getData(){return u._(this,void 0,void 0,function*(){return this._pendingData})}reloadTile(H){const U=this.loaded;return U&&U[H.uid]?super.reloadTile(H):this.loadTile(H)}loadAndProcessGeoJSON(H,U){return u._(this,void 0,void 0,function*(){let X=yield this.loadGeoJSON(H,U);if(delete this._pendingRequest,typeof X!="object")throw new Error(`Input data given to '${H.source}' is not a valid GeoJSON object.`);if(R(X,!0),H.filter){const ie=u.bC(H.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(ie.result==="error")throw new Error(ie.value.map(fe=>`${fe.key}: ${fe.message}`).join(", "));X={type:"FeatureCollection",features:X.features.filter(fe=>ie.value.evaluate({zoom:0},fe))}}return X})}loadGeoJSON(H,U){return u._(this,void 0,void 0,function*(){const{promoteId:X}=H;if(H.request){const ie=yield u.h(H.request,U);return this._dataUpdateable=Ln(ie.data,X)?Kn(ie.data,X):void 0,ie.data}if(typeof H.data=="string")try{const ie=JSON.parse(H.data);return this._dataUpdateable=Ln(ie,X)?Kn(ie,X):void 0,ie}catch{throw new Error(`Input data given to '${H.source}' is not a valid GeoJSON object.`)}if(!H.dataDiff)throw new Error(`Input data given to '${H.source}' is not a valid GeoJSON object.`);if(!this._dataUpdateable)throw new Error(`Cannot update existing geojson data in ${H.source}`);return function(ie,de,fe){var _e,ue,Me,ze;if(de.removeAll&&ie.clear(),de.remove)for(const Ee of de.remove)ie.delete(Ee);if(de.add)for(const Ee of de.add){const We=et(Ee,fe);We!=null&&ie.set(We,Ee)}if(de.update)for(const Ee of de.update){let We=ie.get(Ee.id);if(We==null)continue;const xt=!Ee.removeAllProperties&&(((_e=Ee.removeProperties)===null||_e===void 0?void 0:_e.length)>0||((ue=Ee.addOrUpdateProperties)===null||ue===void 0?void 0:ue.length)>0);if((Ee.newGeometry||Ee.removeAllProperties||xt)&&(We=Object.assign({},We),ie.set(Ee.id,We),xt&&(We.properties=Object.assign({},We.properties))),Ee.newGeometry&&(We.geometry=Ee.newGeometry),Ee.removeAllProperties)We.properties={};else if(((Me=Ee.removeProperties)===null||Me===void 0?void 0:Me.length)>0)for(const kt of Ee.removeProperties)Object.prototype.hasOwnProperty.call(We.properties,kt)&&delete We.properties[kt];if(((ze=Ee.addOrUpdateProperties)===null||ze===void 0?void 0:ze.length)>0)for(const{key:kt,value:an}of Ee.addOrUpdateProperties)We.properties[kt]=an}}(this._dataUpdateable,H.dataDiff,X),{type:"FeatureCollection",features:Array.from(this._dataUpdateable.values())}})}removeSource(H){return u._(this,void 0,void 0,function*(){this._pendingRequest&&this._pendingRequest.abort()})}getClusterExpansionZoom(H){return this._geoJSONIndex.getClusterExpansionZoom(H.clusterId)}getClusterChildren(H){return this._geoJSONIndex.getChildren(H.clusterId)}getClusterLeaves(H){return this._geoJSONIndex.getLeaves(H.clusterId,H.limit,H.offset)}}class fr{constructor(H){this.self=H,this.actor=new u.F(H),this.layerIndexes={},this.availableImages={},this.workerSources={},this.demWorkerSources={},this.externalWorkerSourceTypes={},this.self.registerWorkerSource=(U,X)=>{if(this.externalWorkerSourceTypes[U])throw new Error(`Worker source with name "${U}" already registered.`);this.externalWorkerSourceTypes[U]=X},this.self.addProtocol=u.bi,this.self.removeProtocol=u.bj,this.self.registerRTLTextPlugin=U=>{if(u.bD.isParsed())throw new Error("RTL text plugin already registered.");u.bD.setMethods(U)},this.actor.registerMessageHandler("LDT",(U,X)=>this._getDEMWorkerSource(U,X.source).loadTile(X)),this.actor.registerMessageHandler("RDT",(U,X)=>u._(this,void 0,void 0,function*(){this._getDEMWorkerSource(U,X.source).removeTile(X)})),this.actor.registerMessageHandler("GCEZ",(U,X)=>u._(this,void 0,void 0,function*(){return this._getWorkerSource(U,X.type,X.source).getClusterExpansionZoom(X)})),this.actor.registerMessageHandler("GCC",(U,X)=>u._(this,void 0,void 0,function*(){return this._getWorkerSource(U,X.type,X.source).getClusterChildren(X)})),this.actor.registerMessageHandler("GCL",(U,X)=>u._(this,void 0,void 0,function*(){return this._getWorkerSource(U,X.type,X.source).getClusterLeaves(X)})),this.actor.registerMessageHandler("LD",(U,X)=>this._getWorkerSource(U,X.type,X.source).loadData(X)),this.actor.registerMessageHandler("GD",(U,X)=>this._getWorkerSource(U,X.type,X.source).getData()),this.actor.registerMessageHandler("LT",(U,X)=>this._getWorkerSource(U,X.type,X.source).loadTile(X)),this.actor.registerMessageHandler("RT",(U,X)=>this._getWorkerSource(U,X.type,X.source).reloadTile(X)),this.actor.registerMessageHandler("AT",(U,X)=>this._getWorkerSource(U,X.type,X.source).abortTile(X)),this.actor.registerMessageHandler("RMT",(U,X)=>this._getWorkerSource(U,X.type,X.source).removeTile(X)),this.actor.registerMessageHandler("RS",(U,X)=>u._(this,void 0,void 0,function*(){if(!this.workerSources[U]||!this.workerSources[U][X.type]||!this.workerSources[U][X.type][X.source])return;const ie=this.workerSources[U][X.type][X.source];delete this.workerSources[U][X.type][X.source],ie.removeSource!==void 0&&ie.removeSource(X)})),this.actor.registerMessageHandler("RM",U=>u._(this,void 0,void 0,function*(){delete this.layerIndexes[U],delete this.availableImages[U],delete this.workerSources[U],delete this.demWorkerSources[U]})),this.actor.registerMessageHandler("SR",(U,X)=>u._(this,void 0,void 0,function*(){this.referrer=X})),this.actor.registerMessageHandler("SRPS",(U,X)=>this._syncRTLPluginState(U,X)),this.actor.registerMessageHandler("IS",(U,X)=>u._(this,void 0,void 0,function*(){this.self.importScripts(X)})),this.actor.registerMessageHandler("SI",(U,X)=>this._setImages(U,X)),this.actor.registerMessageHandler("UL",(U,X)=>u._(this,void 0,void 0,function*(){this._getLayerIndex(U).update(X.layers,X.removedIds)})),this.actor.registerMessageHandler("SL",(U,X)=>u._(this,void 0,void 0,function*(){this._getLayerIndex(U).replace(X)}))}_setImages(H,U){return u._(this,void 0,void 0,function*(){this.availableImages[H]=U;for(const X in this.workerSources[H]){const ie=this.workerSources[H][X];for(const de in ie)ie[de].availableImages=U}})}_syncRTLPluginState(H,U){return u._(this,void 0,void 0,function*(){if(u.bD.isParsed())return u.bD.getState();if(U.pluginStatus!=="loading")return u.bD.setState(U),U;const X=U.pluginURL;if(this.self.importScripts(X),u.bD.isParsed()){const ie={pluginStatus:"loaded",pluginURL:X};return u.bD.setState(ie),ie}throw u.bD.setState({pluginStatus:"error",pluginURL:""}),new Error(`RTL Text Plugin failed to import scripts from ${X}`)})}_getAvailableImages(H){let U=this.availableImages[H];return U||(U=[]),U}_getLayerIndex(H){let U=this.layerIndexes[H];return U||(U=this.layerIndexes[H]=new l),U}_getWorkerSource(H,U,X){if(this.workerSources[H]||(this.workerSources[H]={}),this.workerSources[H][U]||(this.workerSources[H][U]={}),!this.workerSources[H][U][X]){const ie={sendAsync:(de,fe)=>(de.targetMapId=H,this.actor.sendAsync(de,fe))};switch(U){case"vector":this.workerSources[H][U][X]=new E(ie,this._getLayerIndex(H),this._getAvailableImages(H));break;case"geojson":this.workerSources[H][U][X]=new qi(ie,this._getLayerIndex(H),this._getAvailableImages(H));break;default:this.workerSources[H][U][X]=new this.externalWorkerSourceTypes[U](ie,this._getLayerIndex(H),this._getAvailableImages(H))}}return this.workerSources[H][U][X]}_getDEMWorkerSource(H,U){return this.demWorkerSources[H]||(this.demWorkerSources[H]={}),this.demWorkerSources[H][U]||(this.demWorkerSources[H][U]=new C),this.demWorkerSources[H][U]}}return u.i(self)&&(self.worker=new fr(self)),fr}),r("index",["exports","./shared"],function(u,l){var g="4.7.1";let b,w;const E={now:typeof performance<"u"&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),frameAsync:v=>new Promise((o,d)=>{const m=requestAnimationFrame(o);v.signal.addEventListener("abort",()=>{cancelAnimationFrame(m),d(l.c())})}),getImageData(v,o=0){return this.getImageCanvasContext(v).getImageData(-o,-o,v.width+2*o,v.height+2*o)},getImageCanvasContext(v){const o=window.document.createElement("canvas"),d=o.getContext("2d",{willReadFrequently:!0});if(!d)throw new Error("failed to create canvas 2d context");return o.width=v.width,o.height=v.height,d.drawImage(v,0,0,v.width,v.height),d},resolveURL:v=>(b||(b=document.createElement("a")),b.href=v,b.href),hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(w==null&&(w=matchMedia("(prefers-reduced-motion: reduce)")),w.matches)}};class C{static testProp(o){if(!C.docStyle)return o[0];for(let d=0;d<o.length;d++)if(o[d]in C.docStyle)return o[d];return o[0]}static create(o,d,m){const y=window.document.createElement(o);return d!==void 0&&(y.className=d),m&&m.appendChild(y),y}static createNS(o,d){return window.document.createElementNS(o,d)}static disableDrag(){C.docStyle&&C.selectProp&&(C.userSelect=C.docStyle[C.selectProp],C.docStyle[C.selectProp]="none")}static enableDrag(){C.docStyle&&C.selectProp&&(C.docStyle[C.selectProp]=C.userSelect)}static setTransform(o,d){o.style[C.transformProp]=d}static addEventListener(o,d,m,y={}){o.addEventListener(d,m,"passive"in y?y:y.capture)}static removeEventListener(o,d,m,y={}){o.removeEventListener(d,m,"passive"in y?y:y.capture)}static suppressClickInternal(o){o.preventDefault(),o.stopPropagation(),window.removeEventListener("click",C.suppressClickInternal,!0)}static suppressClick(){window.addEventListener("click",C.suppressClickInternal,!0),window.setTimeout(()=>{window.removeEventListener("click",C.suppressClickInternal,!0)},0)}static getScale(o){const d=o.getBoundingClientRect();return{x:d.width/o.offsetWidth||1,y:d.height/o.offsetHeight||1,boundingClientRect:d}}static getPoint(o,d,m){const y=d.boundingClientRect;return new l.P((m.clientX-y.left)/d.x-o.clientLeft,(m.clientY-y.top)/d.y-o.clientTop)}static mousePos(o,d){const m=C.getScale(o);return C.getPoint(o,m,d)}static touchPos(o,d){const m=[],y=C.getScale(o);for(let x=0;x<d.length;x++)m.push(C.getPoint(o,y,d[x]));return m}static mouseButton(o){return o.button}static remove(o){o.parentNode&&o.parentNode.removeChild(o)}}C.docStyle=typeof window<"u"&&window.document&&window.document.documentElement.style,C.selectProp=C.testProp(["userSelect","MozUserSelect","WebkitUserSelect","msUserSelect"]),C.transformProp=C.testProp(["transform","WebkitTransform"]);const P={supported:!1,testSupport:function(v){!$&&R&&(W?te(v):D=v)}};let D,R,$=!1,W=!1;function te(v){const o=v.createTexture();v.bindTexture(v.TEXTURE_2D,o);try{if(v.texImage2D(v.TEXTURE_2D,0,v.RGBA,v.RGBA,v.UNSIGNED_BYTE,R),v.isContextLost())return;P.supported=!0}catch{}v.deleteTexture(o),$=!0}var G;typeof document<"u"&&(R=document.createElement("img"),R.onload=()=>{D&&te(D),D=null,W=!0},R.onerror=()=>{$=!0,D=null},R.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA="),function(v){let o,d,m,y;v.resetRequestQueue=()=>{o=[],d=0,m=0,y={}},v.addThrottleControl=O=>{const N=m++;return y[N]=O,N},v.removeThrottleControl=O=>{delete y[O],M()},v.getImage=(O,N,V=!0)=>new Promise((F,Z)=>{P.supported&&(O.headers||(O.headers={}),O.headers.accept="image/webp,*/*"),l.e(O,{type:"image"}),o.push({abortController:N,requestParameters:O,supportImageRefresh:V,state:"queued",onError:J=>{Z(J)},onSuccess:J=>{F(J)}}),M()});const x=O=>l._(this,void 0,void 0,function*(){O.state="running";const{requestParameters:N,supportImageRefresh:V,onError:F,onSuccess:Z,abortController:J}=O,ee=V===!1&&!l.i(self)&&!l.g(N.url)&&(!N.headers||Object.keys(N.headers).reduce((ce,he)=>ce&&he==="accept",!0));d++;const oe=ee?I(N,J):l.m(N,J);try{const ce=yield oe;delete O.abortController,O.state="completed",ce.data instanceof HTMLImageElement||l.b(ce.data)?Z(ce):ce.data&&Z({data:yield(le=ce.data,typeof createImageBitmap=="function"?l.d(le):l.f(le)),cacheControl:ce.cacheControl,expires:ce.expires})}catch(ce){delete O.abortController,F(ce)}finally{d--,M()}var le}),M=()=>{const O=(()=>{for(const N of Object.keys(y))if(y[N]())return!0;return!1})()?l.a.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:l.a.MAX_PARALLEL_IMAGE_REQUESTS;for(let N=d;N<O&&o.length>0;N++){const V=o.shift();V.abortController.signal.aborted?N--:x(V)}},I=(O,N)=>new Promise((V,F)=>{const Z=new Image,J=O.url,ee=O.credentials;ee&&ee==="include"?Z.crossOrigin="use-credentials":(ee&&ee==="same-origin"||!l.s(J))&&(Z.crossOrigin="anonymous"),N.signal.addEventListener("abort",()=>{Z.src="",F(l.c())}),Z.fetchPriority="high",Z.onload=()=>{Z.onerror=Z.onload=null,V({data:Z})},Z.onerror=()=>{Z.onerror=Z.onload=null,N.signal.aborted||F(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."))},Z.src=J})}(G||(G={})),G.resetRequestQueue();class Q{constructor(o){this._transformRequestFn=o}transformRequest(o,d){return this._transformRequestFn&&this._transformRequestFn(o,d)||{url:o}}setTransformRequest(o){this._transformRequestFn=o}}function Ie(v){var o=new l.A(3);return o[0]=v[0],o[1]=v[1],o[2]=v[2],o}var ve,Se=function(v,o,d){return v[0]=o[0]-d[0],v[1]=o[1]-d[1],v[2]=o[2]-d[2],v};ve=new l.A(3),l.A!=Float32Array&&(ve[0]=0,ve[1]=0,ve[2]=0);var Ne=function(v){var o=v[0],d=v[1];return o*o+d*d};function Ae(v){const o=[];if(typeof v=="string")o.push({id:"default",url:v});else if(v&&v.length>0){const d=[];for(const{id:m,url:y}of v){const x=`${m}${y}`;d.indexOf(x)===-1&&(d.push(x),o.push({id:m,url:y}))}}return o}function $e(v,o,d){const m=v.split("?");return m[0]+=`${o}${d}`,m.join("?")}(function(){var v=new l.A(2);l.A!=Float32Array&&(v[0]=0,v[1]=0)})();class Xe{constructor(o,d,m,y){this.context=o,this.format=m,this.texture=o.gl.createTexture(),this.update(d,y)}update(o,d,m){const{width:y,height:x}=o,M=!(this.size&&this.size[0]===y&&this.size[1]===x||m),{context:I}=this,{gl:O}=I;if(this.useMipmap=!!(d&&d.useMipmap),O.bindTexture(O.TEXTURE_2D,this.texture),I.pixelStoreUnpackFlipY.set(!1),I.pixelStoreUnpack.set(1),I.pixelStoreUnpackPremultiplyAlpha.set(this.format===O.RGBA&&(!d||d.premultiply!==!1)),M)this.size=[y,x],o instanceof HTMLImageElement||o instanceof HTMLCanvasElement||o instanceof HTMLVideoElement||o instanceof ImageData||l.b(o)?O.texImage2D(O.TEXTURE_2D,0,this.format,this.format,O.UNSIGNED_BYTE,o):O.texImage2D(O.TEXTURE_2D,0,this.format,y,x,0,this.format,O.UNSIGNED_BYTE,o.data);else{const{x:N,y:V}=m||{x:0,y:0};o instanceof HTMLImageElement||o instanceof HTMLCanvasElement||o instanceof HTMLVideoElement||o instanceof ImageData||l.b(o)?O.texSubImage2D(O.TEXTURE_2D,0,N,V,O.RGBA,O.UNSIGNED_BYTE,o):O.texSubImage2D(O.TEXTURE_2D,0,N,V,y,x,O.RGBA,O.UNSIGNED_BYTE,o.data)}this.useMipmap&&this.isSizePowerOfTwo()&&O.generateMipmap(O.TEXTURE_2D)}bind(o,d,m){const{context:y}=this,{gl:x}=y;x.bindTexture(x.TEXTURE_2D,this.texture),m!==x.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(m=x.LINEAR),o!==this.filter&&(x.texParameteri(x.TEXTURE_2D,x.TEXTURE_MAG_FILTER,o),x.texParameteri(x.TEXTURE_2D,x.TEXTURE_MIN_FILTER,m||o),this.filter=o),d!==this.wrap&&(x.texParameteri(x.TEXTURE_2D,x.TEXTURE_WRAP_S,d),x.texParameteri(x.TEXTURE_2D,x.TEXTURE_WRAP_T,d),this.wrap=d)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){const{gl:o}=this.context;o.deleteTexture(this.texture),this.texture=null}}function Pt(v){const{userImage:o}=v;return!!(o&&o.render&&o.render())&&(v.data.replace(new Uint8Array(o.data.buffer)),!0)}class ot extends l.E{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new l.R({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(o){if(this.loaded!==o&&(this.loaded=o,o)){for(const{ids:d,promiseResolve:m}of this.requestors)m(this._getImagesForIds(d));this.requestors=[]}}getImage(o){const d=this.images[o];if(d&&!d.data&&d.spriteData){const m=d.spriteData;d.data=new l.R({width:m.width,height:m.height},m.context.getImageData(m.x,m.y,m.width,m.height).data),d.spriteData=null}return d}addImage(o,d){if(this.images[o])throw new Error(`Image id ${o} already exist, use updateImage instead`);this._validate(o,d)&&(this.images[o]=d)}_validate(o,d){let m=!0;const y=d.data||d.spriteData;return this._validateStretch(d.stretchX,y&&y.width)||(this.fire(new l.j(new Error(`Image "${o}" has invalid "stretchX" value`))),m=!1),this._validateStretch(d.stretchY,y&&y.height)||(this.fire(new l.j(new Error(`Image "${o}" has invalid "stretchY" value`))),m=!1),this._validateContent(d.content,d)||(this.fire(new l.j(new Error(`Image "${o}" has invalid "content" value`))),m=!1),m}_validateStretch(o,d){if(!o)return!0;let m=0;for(const y of o){if(y[0]<m||y[1]<y[0]||d<y[1])return!1;m=y[1]}return!0}_validateContent(o,d){if(!o)return!0;if(o.length!==4)return!1;const m=d.spriteData,y=m&&m.width||d.data.width,x=m&&m.height||d.data.height;return!(o[0]<0||y<o[0]||o[1]<0||x<o[1]||o[2]<0||y<o[2]||o[3]<0||x<o[3]||o[2]<o[0]||o[3]<o[1])}updateImage(o,d,m=!0){const y=this.getImage(o);if(m&&(y.data.width!==d.data.width||y.data.height!==d.data.height))throw new Error(`size mismatch between old image (${y.data.width}x${y.data.height}) and new image (${d.data.width}x${d.data.height}).`);d.version=y.version+1,this.images[o]=d,this.updatedImages[o]=!0}removeImage(o){const d=this.images[o];delete this.images[o],delete this.patterns[o],d.userImage&&d.userImage.onRemove&&d.userImage.onRemove()}listImages(){return Object.keys(this.images)}getImages(o){return new Promise((d,m)=>{let y=!0;if(!this.isLoaded())for(const x of o)this.images[x]||(y=!1);this.isLoaded()||y?d(this._getImagesForIds(o)):this.requestors.push({ids:o,promiseResolve:d})})}_getImagesForIds(o){const d={};for(const m of o){let y=this.getImage(m);y||(this.fire(new l.k("styleimagemissing",{id:m})),y=this.getImage(m)),y?d[m]={data:y.data.clone(),pixelRatio:y.pixelRatio,sdf:y.sdf,version:y.version,stretchX:y.stretchX,stretchY:y.stretchY,content:y.content,textFitWidth:y.textFitWidth,textFitHeight:y.textFitHeight,hasRenderCallback:!!(y.userImage&&y.userImage.render)}:l.w(`Image "${m}" 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.`)}return d}getPixelSize(){const{width:o,height:d}=this.atlasImage;return{width:o,height:d}}getPattern(o){const d=this.patterns[o],m=this.getImage(o);if(!m)return null;if(d&&d.position.version===m.version)return d.position;if(d)d.position.version=m.version;else{const y={w:m.data.width+2,h:m.data.height+2,x:0,y:0},x=new l.I(y,m);this.patterns[o]={bin:y,position:x}}return this._updatePatternAtlas(),this.patterns[o].position}bind(o){const d=o.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new Xe(o,this.atlasImage,d.RGBA),this.atlasTexture.bind(d.LINEAR,d.CLAMP_TO_EDGE)}_updatePatternAtlas(){const o=[];for(const x in this.patterns)o.push(this.patterns[x].bin);const{w:d,h:m}=l.p(o),y=this.atlasImage;y.resize({width:d||1,height:m||1});for(const x in this.patterns){const{bin:M}=this.patterns[x],I=M.x+1,O=M.y+1,N=this.getImage(x).data,V=N.width,F=N.height;l.R.copy(N,y,{x:0,y:0},{x:I,y:O},{width:V,height:F}),l.R.copy(N,y,{x:0,y:F-1},{x:I,y:O-1},{width:V,height:1}),l.R.copy(N,y,{x:0,y:0},{x:I,y:O+F},{width:V,height:1}),l.R.copy(N,y,{x:V-1,y:0},{x:I-1,y:O},{width:1,height:F}),l.R.copy(N,y,{x:0,y:0},{x:I+V,y:O},{width:1,height:F})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(o){for(const d of o){if(this.callbackDispatchedThisFrame[d])continue;this.callbackDispatchedThisFrame[d]=!0;const m=this.getImage(d);m||l.w(`Image with ID: "${d}" was not found`),Pt(m)&&this.updateImage(d,m)}}}const Tt=1e20;function Nt(v,o,d,m,y,x,M,I,O){for(let N=o;N<o+m;N++)Vt(v,d*x+N,x,y,M,I,O);for(let N=d;N<d+y;N++)Vt(v,N*x+o,1,m,M,I,O)}function Vt(v,o,d,m,y,x,M){x[0]=0,M[0]=-Tt,M[1]=Tt,y[0]=v[o];for(let I=1,O=0,N=0;I<m;I++){y[I]=v[o+I*d];const V=I*I;do{const F=x[O];N=(y[I]-y[F]+V-F*F)/(I-F)/2}while(N<=M[O]&&--O>-1);O++,x[O]=I,M[O]=N,M[O+1]=Tt}for(let I=0,O=0;I<m;I++){for(;M[O+1]<I;)O++;const N=x[O],V=I-N;v[o+I*d]=y[N]+V*V}}class Ft{constructor(o,d){this.requestManager=o,this.localIdeographFontFamily=d,this.entries={}}setURL(o){this.url=o}getGlyphs(o){return l._(this,void 0,void 0,function*(){const d=[];for(const x in o)for(const M of o[x])d.push(this._getAndCacheGlyphsPromise(x,M));const m=yield Promise.all(d),y={};for(const{stack:x,id:M,glyph:I}of m)y[x]||(y[x]={}),y[x][M]=I&&{id:I.id,bitmap:I.bitmap.clone(),metrics:I.metrics};return y})}_getAndCacheGlyphsPromise(o,d){return l._(this,void 0,void 0,function*(){let m=this.entries[o];m||(m=this.entries[o]={glyphs:{},requests:{},ranges:{}});let y=m.glyphs[d];if(y!==void 0)return{stack:o,id:d,glyph:y};if(y=this._tinySDF(m,o,d),y)return m.glyphs[d]=y,{stack:o,id:d,glyph:y};const x=Math.floor(d/256);if(256*x>65535)throw new Error("glyphs > 65535 not supported");if(m.ranges[x])return{stack:o,id:d,glyph:y};if(!this.url)throw new Error("glyphsUrl is not set");if(!m.requests[x]){const I=Ft.loadGlyphRange(o,x,this.url,this.requestManager);m.requests[x]=I}const M=yield m.requests[x];for(const I in M)this._doesCharSupportLocalGlyph(+I)||(m.glyphs[+I]=M[+I]);return m.ranges[x]=!0,{stack:o,id:d,glyph:M[d]||null}})}_doesCharSupportLocalGlyph(o){return!!this.localIdeographFontFamily&&new RegExp("\\p{Ideo}|\\p{sc=Hang}|\\p{sc=Hira}|\\p{sc=Kana}","u").test(String.fromCodePoint(o))}_tinySDF(o,d,m){const y=this.localIdeographFontFamily;if(!y||!this._doesCharSupportLocalGlyph(m))return;let x=o.tinySDF;if(!x){let I="400";/bold/i.test(d)?I="900":/medium/i.test(d)?I="500":/light/i.test(d)&&(I="200"),x=o.tinySDF=new Ft.TinySDF({fontSize:48,buffer:6,radius:16,cutoff:.25,fontFamily:y,fontWeight:I})}const M=x.draw(String.fromCharCode(m));return{id:m,bitmap:new l.o({width:M.width||60,height:M.height||60},M.data),metrics:{width:M.glyphWidth/2||24,height:M.glyphHeight/2||24,left:M.glyphLeft/2+.5||0,top:M.glyphTop/2-27.5||-8,advance:M.glyphAdvance/2||24,isDoubleResolution:!0}}}}Ft.loadGlyphRange=function(v,o,d,m){return l._(this,void 0,void 0,function*(){const y=256*o,x=y+255,M=m.transformRequest(d.replace("{fontstack}",v).replace("{range}",`${y}-${x}`),"Glyphs"),I=yield l.l(M,new AbortController);if(!I||!I.data)throw new Error(`Could not load glyph range. range: ${o}, ${y}-${x}`);const O={};for(const N of l.n(I.data))O[N.id]=N;return O})},Ft.TinySDF=class{constructor({fontSize:v=24,buffer:o=3,radius:d=8,cutoff:m=.25,fontFamily:y="sans-serif",fontWeight:x="normal",fontStyle:M="normal"}={}){this.buffer=o,this.cutoff=m,this.radius=d;const I=this.size=v+4*o,O=this._createCanvas(I),N=this.ctx=O.getContext("2d",{willReadFrequently:!0});N.font=`${M} ${x} ${v}px ${y}`,N.textBaseline="alphabetic",N.textAlign="left",N.fillStyle="black",this.gridOuter=new Float64Array(I*I),this.gridInner=new Float64Array(I*I),this.f=new Float64Array(I),this.z=new Float64Array(I+1),this.v=new Uint16Array(I)}_createCanvas(v){const o=document.createElement("canvas");return o.width=o.height=v,o}draw(v){const{width:o,actualBoundingBoxAscent:d,actualBoundingBoxDescent:m,actualBoundingBoxLeft:y,actualBoundingBoxRight:x}=this.ctx.measureText(v),M=Math.ceil(d),I=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(x-y))),O=Math.min(this.size-this.buffer,M+Math.ceil(m)),N=I+2*this.buffer,V=O+2*this.buffer,F=Math.max(N*V,0),Z=new Uint8ClampedArray(F),J={data:Z,width:N,height:V,glyphWidth:I,glyphHeight:O,glyphTop:M,glyphLeft:0,glyphAdvance:o};if(I===0||O===0)return J;const{ctx:ee,buffer:oe,gridInner:le,gridOuter:ce}=this;ee.clearRect(oe,oe,I,O),ee.fillText(v,oe,oe+M);const he=ee.getImageData(oe,oe,I,O);ce.fill(Tt,0,F),le.fill(0,0,F);for(let ne=0;ne<O;ne++)for(let me=0;me<I;me++){const ge=he.data[4*(ne*I+me)+3]/255;if(ge===0)continue;const xe=(ne+oe)*N+me+oe;if(ge===1)ce[xe]=0,le[xe]=Tt;else{const Be=.5-ge;ce[xe]=Be>0?Be*Be:0,le[xe]=Be<0?Be*Be:0}}Nt(ce,0,0,N,V,N,this.f,this.v,this.z),Nt(le,oe,oe,I,O,N,this.f,this.v,this.z);for(let ne=0;ne<F;ne++){const me=Math.sqrt(ce[ne])-Math.sqrt(le[ne]);Z[ne]=Math.round(255-255*(me/this.radius+this.cutoff))}return J}};class Ht{constructor(){this.specification=l.v.light.position}possiblyEvaluate(o,d){return l.x(o.expression.evaluate(d))}interpolate(o,d,m){return{x:l.y.number(o.x,d.x,m),y:l.y.number(o.y,d.y,m),z:l.y.number(o.z,d.z,m)}}}let Cn;class dn extends l.E{constructor(o){super(),Cn=Cn||new l.q({anchor:new l.D(l.v.light.anchor),position:new Ht,color:new l.D(l.v.light.color),intensity:new l.D(l.v.light.intensity)}),this._transitionable=new l.T(Cn),this.setLight(o),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(o,d={}){if(!this._validate(l.r,o,d))for(const m in o){const y=o[m];m.endsWith("-transition")?this._transitionable.setTransition(m.slice(0,-11),y):this._transitionable.setValue(m,y)}}updateTransitions(o){this._transitioning=this._transitionable.transitioned(o,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(o){this.properties=this._transitioning.possiblyEvaluate(o)}_validate(o,d,m){return(!m||m.validate!==!1)&&l.t(this,o.call(l.u,{value:d,style:{glyphs:!0,sprite:!0},styleSpec:l.v}))}}const vn=new l.q({"sky-color":new l.D(l.v.sky["sky-color"]),"horizon-color":new l.D(l.v.sky["horizon-color"]),"fog-color":new l.D(l.v.sky["fog-color"]),"fog-ground-blend":new l.D(l.v.sky["fog-ground-blend"]),"horizon-fog-blend":new l.D(l.v.sky["horizon-fog-blend"]),"sky-horizon-blend":new l.D(l.v.sky["sky-horizon-blend"]),"atmosphere-blend":new l.D(l.v.sky["atmosphere-blend"])});class pn extends l.E{constructor(o){super(),this._transitionable=new l.T(vn),this.setSky(o),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new l.z(0))}setSky(o,d={}){if(!this._validate(l.B,o,d)){o||(o={"sky-color":"transparent","horizon-color":"transparent","fog-color":"transparent","fog-ground-blend":1,"atmosphere-blend":0});for(const m in o){const y=o[m];m.endsWith("-transition")?this._transitionable.setTransition(m.slice(0,-11),y):this._transitionable.setValue(m,y)}}}getSky(){return this._transitionable.serialize()}updateTransitions(o){this._transitioning=this._transitionable.transitioned(o,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(o){this.properties=this._transitioning.possiblyEvaluate(o)}_validate(o,d,m={}){return(m==null?void 0:m.validate)!==!1&&l.t(this,o.call(l.u,l.e({value:d,style:{glyphs:!0,sprite:!0},styleSpec:l.v})))}calculateFogBlendOpacity(o){return o<60?0:o<70?(o-60)/10:1}}class ti{constructor(o,d){this.width=o,this.height=d,this.nextRow=0,this.data=new Uint8Array(this.width*this.height),this.dashEntry={}}getDash(o,d){const m=o.join(",")+String(d);return this.dashEntry[m]||(this.dashEntry[m]=this.addDash(o,d)),this.dashEntry[m]}getDashRanges(o,d,m){const y=[];let x=o.length%2==1?-o[o.length-1]*m:0,M=o[0]*m,I=!0;y.push({left:x,right:M,isDash:I,zeroLength:o[0]===0});let O=o[0];for(let N=1;N<o.length;N++){I=!I;const V=o[N];x=O*m,O+=V,M=O*m,y.push({left:x,right:M,isDash:I,zeroLength:V===0})}return y}addRoundDash(o,d,m){const y=d/2;for(let x=-m;x<=m;x++){const M=this.width*(this.nextRow+m+x);let I=0,O=o[I];for(let N=0;N<this.width;N++){N/O.right>1&&(O=o[++I]);const V=Math.abs(N-O.left),F=Math.abs(N-O.right),Z=Math.min(V,F);let J;const ee=x/m*(y+1);if(O.isDash){const oe=y-Math.abs(ee);J=Math.sqrt(Z*Z+oe*oe)}else J=y-Math.sqrt(Z*Z+ee*ee);this.data[M+N]=Math.max(0,Math.min(255,J+128))}}}addRegularDash(o){for(let I=o.length-1;I>=0;--I){const O=o[I],N=o[I+1];O.zeroLength?o.splice(I,1):N&&N.isDash===O.isDash&&(N.left=O.left,o.splice(I,1))}const d=o[0],m=o[o.length-1];d.isDash===m.isDash&&(d.left=m.left-this.width,m.right=d.right+this.width);const y=this.width*this.nextRow;let x=0,M=o[x];for(let I=0;I<this.width;I++){I/M.right>1&&(M=o[++x]);const O=Math.abs(I-M.left),N=Math.abs(I-M.right),V=Math.min(O,N);this.data[y+I]=Math.max(0,Math.min(255,(M.isDash?V:-V)+128))}}addDash(o,d){const m=d?7:0,y=2*m+1;if(this.nextRow+y>this.height)return l.w("LineAtlas out of space"),null;let x=0;for(let I=0;I<o.length;I++)x+=o[I];if(x!==0){const I=this.width/x,O=this.getDashRanges(o,this.width,I);d?this.addRoundDash(O,I,m):this.addRegularDash(O)}const M={y:(this.nextRow+m+.5)/this.height,height:2*m/this.height,width:x};return this.nextRow+=y,this.dirty=!0,M}bind(o){const d=o.gl;this.texture?(d.bindTexture(d.TEXTURE_2D,this.texture),this.dirty&&(this.dirty=!1,d.texSubImage2D(d.TEXTURE_2D,0,0,0,this.width,this.height,d.ALPHA,d.UNSIGNED_BYTE,this.data))):(this.texture=d.createTexture(),d.bindTexture(d.TEXTURE_2D,this.texture),d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_S,d.REPEAT),d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_T,d.REPEAT),d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MIN_FILTER,d.LINEAR),d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MAG_FILTER,d.LINEAR),d.texImage2D(d.TEXTURE_2D,0,d.ALPHA,this.width,this.height,0,d.ALPHA,d.UNSIGNED_BYTE,this.data))}}const Nn="maplibre_preloaded_worker_pool";class Pn{constructor(){this.active={}}acquire(o){if(!this.workers)for(this.workers=[];this.workers.length<Pn.workerCount;)this.workers.push(new Worker(l.a.WORKER_URL));return this.active[o]=!0,this.workers.slice()}release(o){delete this.active[o],this.numActive()===0&&(this.workers.forEach(d=>{d.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[Nn]}numActive(){return Object.keys(this.active).length}}const Rn=Math.floor(E.hardwareConcurrency/2);let Ce,He;function De(){return Ce||(Ce=new Pn),Ce}Pn.workerCount=l.C(globalThis)?Math.max(Math.min(Rn,3),1):1;class ct{constructor(o,d){this.workerPool=o,this.actors=[],this.currentActor=0,this.id=d;const m=this.workerPool.acquire(d);for(let y=0;y<m.length;y++){const x=new l.F(m[y],d);x.name=`Worker ${y}`,this.actors.push(x)}if(!this.actors.length)throw new Error("No actors found")}broadcast(o,d){const m=[];for(const y of this.actors)m.push(y.sendAsync({type:o,data:d}));return Promise.all(m)}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(o=!0){this.actors.forEach(d=>{d.remove()}),this.actors=[],o&&this.workerPool.release(this.id)}registerMessageHandler(o,d){for(const m of this.actors)m.registerMessageHandler(o,d)}}function Rt(){return He||(He=new ct(De(),l.G),He.registerMessageHandler("GR",(v,o,d)=>l.m(o,d))),He}function Qt(v,o){const d=l.H();return l.J(d,d,[1,1,0]),l.K(d,d,[.5*v.width,.5*v.height,1]),l.L(d,d,v.calculatePosMatrix(o.toUnwrapped()))}function At(v,o,d,m,y,x){const M=function(F,Z,J){if(F)for(const ee of F){const oe=Z[ee];if(oe&&oe.source===J&&oe.type==="fill-extrusion")return!0}else for(const ee in Z){const oe=Z[ee];if(oe.source===J&&oe.type==="fill-extrusion")return!0}return!1}(y&&y.layers,o,v.id),I=x.maxPitchScaleFactor(),O=v.tilesIn(m,I,M);O.sort(Mt);const N=[];for(const F of O)N.push({wrappedTileID:F.tileID.wrapped().key,queryResults:F.tile.queryRenderedFeatures(o,d,v._state,F.queryGeometry,F.cameraQueryGeometry,F.scale,y,x,I,Qt(v.transform,F.tileID))});const V=function(F){const Z={},J={};for(const ee of F){const oe=ee.queryResults,le=ee.wrappedTileID,ce=J[le]=J[le]||{};for(const he in oe){const ne=oe[he],me=ce[he]=ce[he]||{},ge=Z[he]=Z[he]||[];for(const xe of ne)me[xe.featureIndex]||(me[xe.featureIndex]=!0,ge.push(xe))}}return Z}(N);for(const F in V)V[F].forEach(Z=>{const J=Z.feature,ee=v.getFeatureState(J.layer["source-layer"],J.id);J.source=J.layer.source,J.layer["source-layer"]&&(J.sourceLayer=J.layer["source-layer"]),J.state=ee});return V}function Mt(v,o){const d=v.tileID,m=o.tileID;return d.overscaledZ-m.overscaledZ||d.canonical.y-m.canonical.y||d.wrap-m.wrap||d.canonical.x-m.canonical.x}function rn(v,o,d){return l._(this,void 0,void 0,function*(){let m=v;if(v.url?m=(yield l.h(o.transformRequest(v.url,"Source"),d)).data:yield E.frameAsync(d),!m)return null;const y=l.M(l.e(m,v),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);return"vector_layers"in m&&m.vector_layers&&(y.vectorLayerIds=m.vector_layers.map(x=>x.id)),y})}class we{constructor(o,d){o&&(d?this.setSouthWest(o).setNorthEast(d):Array.isArray(o)&&(o.length===4?this.setSouthWest([o[0],o[1]]).setNorthEast([o[2],o[3]]):this.setSouthWest(o[0]).setNorthEast(o[1])))}setNorthEast(o){return this._ne=o instanceof l.N?new l.N(o.lng,o.lat):l.N.convert(o),this}setSouthWest(o){return this._sw=o instanceof l.N?new l.N(o.lng,o.lat):l.N.convert(o),this}extend(o){const d=this._sw,m=this._ne;let y,x;if(o instanceof l.N)y=o,x=o;else{if(!(o instanceof we))return Array.isArray(o)?o.length===4||o.every(Array.isArray)?this.extend(we.convert(o)):this.extend(l.N.convert(o)):o&&("lng"in o||"lon"in o)&&"lat"in o?this.extend(l.N.convert(o)):this;if(y=o._sw,x=o._ne,!y||!x)return this}return d||m?(d.lng=Math.min(y.lng,d.lng),d.lat=Math.min(y.lat,d.lat),m.lng=Math.max(x.lng,m.lng),m.lat=Math.max(x.lat,m.lat)):(this._sw=new l.N(y.lng,y.lat),this._ne=new l.N(x.lng,x.lat)),this}getCenter(){return new l.N((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 l.N(this.getWest(),this.getNorth())}getSouthEast(){return new l.N(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(o){const{lng:d,lat:m}=l.N.convert(o);let y=this._sw.lng<=d&&d<=this._ne.lng;return this._sw.lng>this._ne.lng&&(y=this._sw.lng>=d&&d>=this._ne.lng),this._sw.lat<=m&&m<=this._ne.lat&&y}static convert(o){return o instanceof we?o:o&&new we(o)}static fromLngLat(o,d=0){const m=360*d/40075017,y=m/Math.cos(Math.PI/180*o.lat);return new we(new l.N(o.lng-y,o.lat-m),new l.N(o.lng+y,o.lat+m))}adjustAntiMeridian(){const o=new l.N(this._sw.lng,this._sw.lat),d=new l.N(this._ne.lng,this._ne.lat);return new we(o,o.lng>d.lng?new l.N(d.lng+360,d.lat):d)}}class yn{constructor(o,d,m){this.bounds=we.convert(this.validateBounds(o)),this.minzoom=d||0,this.maxzoom=m||24}validateBounds(o){return Array.isArray(o)&&o.length===4?[Math.max(-180,o[0]),Math.max(-90,o[1]),Math.min(180,o[2]),Math.min(90,o[3])]:[-180,-90,180,90]}contains(o){const d=Math.pow(2,o.z),m=Math.floor(l.O(this.bounds.getWest())*d),y=Math.floor(l.Q(this.bounds.getNorth())*d),x=Math.ceil(l.O(this.bounds.getEast())*d),M=Math.ceil(l.Q(this.bounds.getSouth())*d);return o.x>=m&&o.x<x&&o.y>=y&&o.y<M}}class pr extends l.E{constructor(o,d,m,y){if(super(),this.id=o,this.dispatcher=m,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,l.e(this,l.M(d,["url","scheme","tileSize","promoteId"])),this._options=l.e({type:"vector"},d),this._collectResourceTiming=d.collectResourceTiming,this.tileSize!==512)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(y)}load(){return l._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new l.k("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{const o=yield rn(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,this.map.style.sourceCaches[this.id].clearTiles(),o&&(l.e(this,o),o.bounds&&(this.tileBounds=new yn(o.bounds,this.minzoom,this.maxzoom)),this.fire(new l.k("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new l.k("data",{dataType:"source",sourceDataType:"content"})))}catch(o){this._tileJSONRequest=null,this.fire(new l.j(o))}})}loaded(){return this._loaded}hasTile(o){return!this.tileBounds||this.tileBounds.contains(o.canonical)}onAdd(o){this.map=o,this.load()}setSourceProperty(o){this._tileJSONRequest&&this._tileJSONRequest.abort(),o(),this.load()}setTiles(o){return this.setSourceProperty(()=>{this._options.tiles=o}),this}setUrl(o){return this.setSourceProperty(()=>{this.url=o,this._options.url=o}),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}serialize(){return l.e({},this._options)}loadTile(o){return l._(this,void 0,void 0,function*(){const d=o.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),m={request:this.map._requestManager.transformRequest(d,"Tile"),uid:o.uid,tileID:o.tileID,zoom:o.tileID.overscaledZ,tileSize:this.tileSize*o.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};m.request.collectResourceTiming=this._collectResourceTiming;let y="RT";if(o.actor&&o.state!=="expired"){if(o.state==="loading")return new Promise((x,M)=>{o.reloadPromise={resolve:x,reject:M}})}else o.actor=this.dispatcher.getActor(),y="LT";o.abortController=new AbortController;try{const x=yield o.actor.sendAsync({type:y,data:m},o.abortController);if(delete o.abortController,o.aborted)return;this._afterTileLoadWorkerResponse(o,x)}catch(x){if(delete o.abortController,o.aborted)return;if(x&&x.status!==404)throw x;this._afterTileLoadWorkerResponse(o,null)}})}_afterTileLoadWorkerResponse(o,d){if(d&&d.resourceTiming&&(o.resourceTiming=d.resourceTiming),d&&this.map._refreshExpiredTiles&&o.setExpiryData(d),o.loadVectorData(d,this.map.painter),o.reloadPromise){const m=o.reloadPromise;o.reloadPromise=null,this.loadTile(o).then(m.resolve).catch(m.reject)}}abortTile(o){return l._(this,void 0,void 0,function*(){o.abortController&&(o.abortController.abort(),delete o.abortController),o.actor&&(yield o.actor.sendAsync({type:"AT",data:{uid:o.uid,type:this.type,source:this.id}}))})}unloadTile(o){return l._(this,void 0,void 0,function*(){o.unloadVectorData(),o.actor&&(yield o.actor.sendAsync({type:"RMT",data:{uid:o.uid,type:this.type,source:this.id}}))})}hasTransition(){return!1}}class qt extends l.E{constructor(o,d,m,y){super(),this.id=o,this.dispatcher=m,this.setEventedParent(y),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=l.e({type:"raster"},d),l.e(this,l.M(d,["url","scheme","tileSize"]))}load(){return l._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new l.k("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{const o=yield rn(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,o&&(l.e(this,o),o.bounds&&(this.tileBounds=new yn(o.bounds,this.minzoom,this.maxzoom)),this.fire(new l.k("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new l.k("data",{dataType:"source",sourceDataType:"content"})))}catch(o){this._tileJSONRequest=null,this.fire(new l.j(o))}})}loaded(){return this._loaded}onAdd(o){this.map=o,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}setSourceProperty(o){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null),o(),this.load()}setTiles(o){return this.setSourceProperty(()=>{this._options.tiles=o}),this}setUrl(o){return this.setSourceProperty(()=>{this.url=o,this._options.url=o}),this}serialize(){return l.e({},this._options)}hasTile(o){return!this.tileBounds||this.tileBounds.contains(o.canonical)}loadTile(o){return l._(this,void 0,void 0,function*(){const d=o.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);o.abortController=new AbortController;try{const m=yield G.getImage(this.map._requestManager.transformRequest(d,"Tile"),o.abortController,this.map._refreshExpiredTiles);if(delete o.abortController,o.aborted)return void(o.state="unloaded");if(m&&m.data){this.map._refreshExpiredTiles&&m.cacheControl&&m.expires&&o.setExpiryData({cacheControl:m.cacheControl,expires:m.expires});const y=this.map.painter.context,x=y.gl,M=m.data;o.texture=this.map.painter.getTileTexture(M.width),o.texture?o.texture.update(M,{useMipmap:!0}):(o.texture=new Xe(y,M,x.RGBA,{useMipmap:!0}),o.texture.bind(x.LINEAR,x.CLAMP_TO_EDGE,x.LINEAR_MIPMAP_NEAREST)),o.state="loaded"}}catch(m){if(delete o.abortController,o.aborted)o.state="unloaded";else if(m)throw o.state="errored",m}})}abortTile(o){return l._(this,void 0,void 0,function*(){o.abortController&&(o.abortController.abort(),delete o.abortController)})}unloadTile(o){return l._(this,void 0,void 0,function*(){o.texture&&this.map.painter.saveTileTexture(o.texture)})}hasTransition(){return!1}}class sn extends qt{constructor(o,d,m,y){super(o,d,m,y),this.type="raster-dem",this.maxzoom=22,this._options=l.e({type:"raster-dem"},d),this.encoding=d.encoding||"mapbox",this.redFactor=d.redFactor,this.greenFactor=d.greenFactor,this.blueFactor=d.blueFactor,this.baseShift=d.baseShift}loadTile(o){return l._(this,void 0,void 0,function*(){const d=o.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),m=this.map._requestManager.transformRequest(d,"Tile");o.neighboringTiles=this._getNeighboringTiles(o.tileID),o.abortController=new AbortController;try{const y=yield G.getImage(m,o.abortController,this.map._refreshExpiredTiles);if(delete o.abortController,o.aborted)return void(o.state="unloaded");if(y&&y.data){const x=y.data;this.map._refreshExpiredTiles&&y.cacheControl&&y.expires&&o.setExpiryData({cacheControl:y.cacheControl,expires:y.expires});const M=l.b(x)&&l.U()?x:yield this.readImageNow(x),I={type:this.type,uid:o.uid,source:this.id,rawImageData:M,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};if(!o.actor||o.state==="expired"){o.actor=this.dispatcher.getActor();const O=yield o.actor.sendAsync({type:"LDT",data:I});o.dem=O,o.needsHillshadePrepare=!0,o.needsTerrainPrepare=!0,o.state="loaded"}}}catch(y){if(delete o.abortController,o.aborted)o.state="unloaded";else if(y)throw o.state="errored",y}})}readImageNow(o){return l._(this,void 0,void 0,function*(){if(typeof VideoFrame<"u"&&l.V()){const d=o.width+2,m=o.height+2;try{return new l.R({width:d,height:m},yield l.W(o,-1,-1,d,m))}catch{}}return E.getImageData(o,1)})}_getNeighboringTiles(o){const d=o.canonical,m=Math.pow(2,d.z),y=(d.x-1+m)%m,x=d.x===0?o.wrap-1:o.wrap,M=(d.x+1+m)%m,I=d.x+1===m?o.wrap+1:o.wrap,O={};return O[new l.S(o.overscaledZ,x,d.z,y,d.y).key]={backfilled:!1},O[new l.S(o.overscaledZ,I,d.z,M,d.y).key]={backfilled:!1},d.y>0&&(O[new l.S(o.overscaledZ,x,d.z,y,d.y-1).key]={backfilled:!1},O[new l.S(o.overscaledZ,o.wrap,d.z,d.x,d.y-1).key]={backfilled:!1},O[new l.S(o.overscaledZ,I,d.z,M,d.y-1).key]={backfilled:!1}),d.y+1<m&&(O[new l.S(o.overscaledZ,x,d.z,y,d.y+1).key]={backfilled:!1},O[new l.S(o.overscaledZ,o.wrap,d.z,d.x,d.y+1).key]={backfilled:!1},O[new l.S(o.overscaledZ,I,d.z,M,d.y+1).key]={backfilled:!1}),O}unloadTile(o){return l._(this,void 0,void 0,function*(){o.demTexture&&this.map.painter.saveTileTexture(o.demTexture),o.fbo&&(o.fbo.destroy(),delete o.fbo),o.dem&&delete o.dem,delete o.neighboringTiles,o.state="unloaded",o.actor&&(yield o.actor.sendAsync({type:"RDT",data:{type:this.type,uid:o.uid,source:this.id}}))})}}class ui extends l.E{constructor(o,d,m,y){super(),this.id=o,this.type="geojson",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._removed=!1,this._pendingLoads=0,this.actor=m.getActor(),this.setEventedParent(y),this._data=d.data,this._options=l.e({},d),this._collectResourceTiming=d.collectResourceTiming,d.maxzoom!==void 0&&(this.maxzoom=d.maxzoom),d.type&&(this.type=d.type),d.attribution&&(this.attribution=d.attribution),this.promoteId=d.promoteId;const x=l.X/this.tileSize;d.clusterMaxZoom!==void 0&&this.maxzoom<=d.clusterMaxZoom&&l.w(`The maxzoom value "${this.maxzoom}" is expected to be greater than the clusterMaxZoom value "${d.clusterMaxZoom}".`),this.workerOptions=l.e({source:this.id,cluster:d.cluster||!1,geojsonVtOptions:{buffer:(d.buffer!==void 0?d.buffer:128)*x,tolerance:(d.tolerance!==void 0?d.tolerance:.375)*x,extent:l.X,maxZoom:this.maxzoom,lineMetrics:d.lineMetrics||!1,generateId:d.generateId||!1},superclusterOptions:{maxZoom:d.clusterMaxZoom!==void 0?d.clusterMaxZoom:this.maxzoom-1,minPoints:Math.max(2,d.clusterMinPoints||2),extent:l.X,radius:(d.clusterRadius||50)*x,log:!1,generateId:d.generateId||!1},clusterProperties:d.clusterProperties,filter:d.filter},d.workerOptions),typeof this.promoteId=="string"&&(this.workerOptions.promoteId=this.promoteId)}load(){return l._(this,void 0,void 0,function*(){yield this._updateWorkerData()})}onAdd(o){this.map=o,this.load()}setData(o){return this._data=o,this._updateWorkerData(),this}updateData(o){return this._updateWorkerData(o),this}getData(){return l._(this,void 0,void 0,function*(){const o=l.e({type:this.type},this.workerOptions);return this.actor.sendAsync({type:"GD",data:o})})}setClusterOptions(o){return this.workerOptions.cluster=o.cluster,o&&(o.clusterRadius!==void 0&&(this.workerOptions.superclusterOptions.radius=o.clusterRadius),o.clusterMaxZoom!==void 0&&(this.workerOptions.superclusterOptions.maxZoom=o.clusterMaxZoom)),this._updateWorkerData(),this}getClusterExpansionZoom(o){return this.actor.sendAsync({type:"GCEZ",data:{type:this.type,clusterId:o,source:this.id}})}getClusterChildren(o){return this.actor.sendAsync({type:"GCC",data:{type:this.type,clusterId:o,source:this.id}})}getClusterLeaves(o,d,m){return this.actor.sendAsync({type:"GCL",data:{type:this.type,source:this.id,clusterId:o,limit:d,offset:m}})}_updateWorkerData(o){return l._(this,void 0,void 0,function*(){const d=l.e({type:this.type},this.workerOptions);o?d.dataDiff=o:typeof this._data=="string"?(d.request=this.map._requestManager.transformRequest(E.resolveURL(this._data),"Source"),d.request.collectResourceTiming=this._collectResourceTiming):d.data=JSON.stringify(this._data),this._pendingLoads++,this.fire(new l.k("dataloading",{dataType:"source"}));try{const m=yield this.actor.sendAsync({type:"LD",data:d});if(this._pendingLoads--,this._removed||m.abandoned)return void this.fire(new l.k("dataabort",{dataType:"source"}));let y=null;m.resourceTiming&&m.resourceTiming[this.id]&&(y=m.resourceTiming[this.id].slice(0));const x={dataType:"source"};this._collectResourceTiming&&y&&y.length>0&&l.e(x,{resourceTiming:y}),this.fire(new l.k("data",Object.assign(Object.assign({},x),{sourceDataType:"metadata"}))),this.fire(new l.k("data",Object.assign(Object.assign({},x),{sourceDataType:"content"})))}catch(m){if(this._pendingLoads--,this._removed)return void this.fire(new l.k("dataabort",{dataType:"source"}));this.fire(new l.j(m))}})}loaded(){return this._pendingLoads===0}loadTile(o){return l._(this,void 0,void 0,function*(){const d=o.actor?"RT":"LT";o.actor=this.actor;const m={type:this.type,uid:o.uid,tileID:o.tileID,zoom:o.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};o.abortController=new AbortController;const y=yield this.actor.sendAsync({type:d,data:m},o.abortController);delete o.abortController,o.unloadVectorData(),o.aborted||o.loadVectorData(y,this.map.painter,d==="RT")})}abortTile(o){return l._(this,void 0,void 0,function*(){o.abortController&&(o.abortController.abort(),delete o.abortController),o.aborted=!0})}unloadTile(o){return l._(this,void 0,void 0,function*(){o.unloadVectorData(),yield this.actor.sendAsync({type:"RMT",data:{uid:o.uid,type:this.type,source:this.id}})})}onRemove(){this._removed=!0,this.actor.sendAsync({type:"RS",data:{type:this.type,source:this.id}})}serialize(){return l.e({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}}var Hi=l.Y([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class xi extends l.E{constructor(o,d,m,y){super(),this.id=o,this.dispatcher=m,this.coordinates=d.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(y),this.options=d}load(o){return l._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new l.k("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=new AbortController;try{const d=yield G.getImage(this.map._requestManager.transformRequest(this.url,"Image"),this._request);this._request=null,this._loaded=!0,d&&d.data&&(this.image=d.data,o&&(this.coordinates=o),this._finishLoading())}catch(d){this._request=null,this._loaded=!0,this.fire(new l.j(d))}})}loaded(){return this._loaded}updateImage(o){return o.url?(this._request&&(this._request.abort(),this._request=null),this.options.url=o.url,this.load(o.coordinates).finally(()=>{this.texture=null}),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new l.k("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(o){this.map=o,this.load()}onRemove(){this._request&&(this._request.abort(),this._request=null)}setCoordinates(o){this.coordinates=o;const d=o.map(l.Z.fromLngLat);this.tileID=function(y){let x=1/0,M=1/0,I=-1/0,O=-1/0;for(const Z of y)x=Math.min(x,Z.x),M=Math.min(M,Z.y),I=Math.max(I,Z.x),O=Math.max(O,Z.y);const N=Math.max(I-x,O-M),V=Math.max(0,Math.floor(-Math.log(N)/Math.LN2)),F=Math.pow(2,V);return new l.a1(V,Math.floor((x+I)/2*F),Math.floor((M+O)/2*F))}(d),this.minzoom=this.maxzoom=this.tileID.z;const m=d.map(y=>this.tileID.getTilePoint(y)._round());return this._boundsArray=new l.$,this._boundsArray.emplaceBack(m[0].x,m[0].y,0,0),this._boundsArray.emplaceBack(m[1].x,m[1].y,l.X,0),this._boundsArray.emplaceBack(m[3].x,m[3].y,0,l.X),this._boundsArray.emplaceBack(m[2].x,m[2].y,l.X,l.X),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this.fire(new l.k("data",{dataType:"source",sourceDataType:"content"})),this}prepare(){if(Object.keys(this.tiles).length===0||!this.image)return;const o=this.map.painter.context,d=o.gl;this.boundsBuffer||(this.boundsBuffer=o.createVertexBuffer(this._boundsArray,Hi.members)),this.boundsSegments||(this.boundsSegments=l.a0.simpleSegment(0,0,4,2)),this.texture||(this.texture=new Xe(o,this.image,d.RGBA),this.texture.bind(d.LINEAR,d.CLAMP_TO_EDGE));let m=!1;for(const y in this.tiles){const x=this.tiles[y];x.state!=="loaded"&&(x.state="loaded",x.texture=this.texture,m=!0)}m&&this.fire(new l.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}loadTile(o){return l._(this,void 0,void 0,function*(){this.tileID&&this.tileID.equals(o.tileID.canonical)?(this.tiles[String(o.tileID.wrap)]=o,o.buckets={}):o.state="errored"})}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}}class Or extends xi{constructor(o,d,m,y){super(o,d,m,y),this.roundZoom=!0,this.type="video",this.options=d}load(){return l._(this,void 0,void 0,function*(){this._loaded=!1;const o=this.options;this.urls=[];for(const d of o.urls)this.urls.push(this.map._requestManager.transformRequest(d,"Source").url);try{const d=yield l.a3(this.urls);if(this._loaded=!0,!d)return;this.video=d,this.video.loop=!0,this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading()}catch(d){this.fire(new l.j(d))}})}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(o){if(this.video){const d=this.video.seekable;o<d.start(0)||o>d.end(0)?this.fire(new l.j(new l.a2(`sources.${this.id}`,null,`Playback for this video can be set only between the ${d.start(0)} and ${d.end(0)}-second mark.`))):this.video.currentTime=o}}getVideo(){return this.video}onAdd(o){this.map||(this.map=o,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}prepare(){if(Object.keys(this.tiles).length===0||this.video.readyState<2)return;const o=this.map.painter.context,d=o.gl;this.boundsBuffer||(this.boundsBuffer=o.createVertexBuffer(this._boundsArray,Hi.members)),this.boundsSegments||(this.boundsSegments=l.a0.simpleSegment(0,0,4,2)),this.texture?this.video.paused||(this.texture.bind(d.LINEAR,d.CLAMP_TO_EDGE),d.texSubImage2D(d.TEXTURE_2D,0,0,0,d.RGBA,d.UNSIGNED_BYTE,this.video)):(this.texture=new Xe(o,this.video,d.RGBA),this.texture.bind(d.LINEAR,d.CLAMP_TO_EDGE));let m=!1;for(const y in this.tiles){const x=this.tiles[y];x.state!=="loaded"&&(x.state="loaded",x.texture=this.texture,m=!0)}m&&this.fire(new l.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}}class vi extends xi{constructor(o,d,m,y){super(o,d,m,y),d.coordinates?Array.isArray(d.coordinates)&&d.coordinates.length===4&&!d.coordinates.some(x=>!Array.isArray(x)||x.length!==2||x.some(M=>typeof M!="number"))||this.fire(new l.j(new l.a2(`sources.${o}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new l.j(new l.a2(`sources.${o}`,null,'missing required property "coordinates"'))),d.animate&&typeof d.animate!="boolean"&&this.fire(new l.j(new l.a2(`sources.${o}`,null,'optional "animate" property must be a boolean value'))),d.canvas?typeof d.canvas=="string"||d.canvas instanceof HTMLCanvasElement||this.fire(new l.j(new l.a2(`sources.${o}`,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 l.j(new l.a2(`sources.${o}`,null,'missing required property "canvas"'))),this.options=d,this.animate=d.animate===void 0||d.animate}load(){return l._(this,void 0,void 0,function*(){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 l.j(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(o){this.map=o,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let o=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,o=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,o=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;const d=this.map.painter.context,m=d.gl;this.boundsBuffer||(this.boundsBuffer=d.createVertexBuffer(this._boundsArray,Hi.members)),this.boundsSegments||(this.boundsSegments=l.a0.simpleSegment(0,0,4,2)),this.texture?(o||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new Xe(d,this.canvas,m.RGBA,{premultiply:!0});let y=!1;for(const x in this.tiles){const M=this.tiles[x];M.state!=="loaded"&&(M.state="loaded",M.texture=this.texture,y=!0)}y&&this.fire(new l.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const o of[this.canvas.width,this.canvas.height])if(isNaN(o)||o<=0)return!0;return!1}}const Eo={},Co=v=>{switch(v){case"geojson":return ui;case"image":return xi;case"raster":return qt;case"raster-dem":return sn;case"vector":return pr;case"video":return Or;case"canvas":return vi}return Eo[v]},Ve="RTLPluginLoaded";class Br extends l.E{constructor(){super(...arguments),this.status="unavailable",this.url=null,this.dispatcher=Rt()}_syncState(o){return this.status=o,this.dispatcher.broadcast("SRPS",{pluginStatus:o,pluginURL:this.url}).catch(d=>{throw this.status="error",d})}getRTLTextPluginStatus(){return this.status}clearRTLTextPlugin(){this.status="unavailable",this.url=null}setRTLTextPlugin(o){return l._(this,arguments,void 0,function*(d,m=!1){if(this.url)throw new Error("setRTLTextPlugin cannot be called multiple times.");if(this.url=E.resolveURL(d),!this.url)throw new Error(`requested url ${d} is invalid`);if(this.status==="unavailable"){if(!m)return this._requestImport();this.status="deferred",this._syncState(this.status)}else if(this.status==="requested")return this._requestImport()})}_requestImport(){return l._(this,void 0,void 0,function*(){yield this._syncState("loading"),this.status="loaded",this.fire(new l.k(Ve))})}lazyLoad(){this.status==="unavailable"?this.status="requested":this.status==="deferred"&&this._requestImport()}}let wi=null;function zr(){return wi||(wi=new Br),wi}class To{constructor(o,d){this.timeAdded=0,this.fadeEndTime=0,this.tileID=o,this.uid=l.a4(),this.uses=0,this.tileSize=d,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.rtt=[],this.rttCoords={},this.expiredRequestCount=0,this.state="loading"}registerFadeDuration(o){const d=o+this.timeAdded;d<this.fadeEndTime||(this.fadeEndTime=d)}wasRequested(){return this.state==="errored"||this.state==="loaded"||this.state==="reloading"}clearTextures(o){this.demTexture&&o.saveTileTexture(this.demTexture),this.demTexture=null}loadVectorData(o,d,m){if(this.hasData()&&this.unloadVectorData(),this.state="loaded",o){o.featureIndex&&(this.latestFeatureIndex=o.featureIndex,o.rawTileData?(this.latestRawTileData=o.rawTileData,this.latestFeatureIndex.rawTileData=o.rawTileData):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData)),this.collisionBoxArray=o.collisionBoxArray,this.buckets=function(y,x){const M={};if(!x)return M;for(const I of y){const O=I.layerIds.map(N=>x.getLayer(N)).filter(Boolean);if(O.length!==0){I.layers=O,I.stateDependentLayerIds&&(I.stateDependentLayers=I.stateDependentLayerIds.map(N=>O.filter(V=>V.id===N)[0]));for(const N of O)M[N.id]=I}}return M}(o.buckets,d.style),this.hasSymbolBuckets=!1;for(const y in this.buckets){const x=this.buckets[y];if(x instanceof l.a6){if(this.hasSymbolBuckets=!0,!m)break;x.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const y in this.buckets){const x=this.buckets[y];if(x instanceof l.a6&&x.hasRTLText){this.hasRTLText=!0,zr().lazyLoad();break}}this.queryPadding=0;for(const y in this.buckets){const x=this.buckets[y];this.queryPadding=Math.max(this.queryPadding,d.style.getLayer(y).queryRadius(x))}o.imageAtlas&&(this.imageAtlas=o.imageAtlas),o.glyphAtlasImage&&(this.glyphAtlasImage=o.glyphAtlasImage)}else this.collisionBoxArray=new l.a5}unloadVectorData(){for(const o in this.buckets)this.buckets[o].destroy();this.buckets={},this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.imageAtlas&&(this.imageAtlas=null),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.latestFeatureIndex=null,this.state="unloaded"}getBucket(o){return this.buckets[o.id]}upload(o){for(const m in this.buckets){const y=this.buckets[m];y.uploadPending()&&y.upload(o)}const d=o.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new Xe(o,this.imageAtlas.image,d.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new Xe(o,this.glyphAtlasImage,d.ALPHA),this.glyphAtlasImage=null)}prepare(o){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(o,this.imageAtlasTexture)}queryRenderedFeatures(o,d,m,y,x,M,I,O,N,V){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:y,cameraQueryGeometry:x,scale:M,tileSize:this.tileSize,pixelPosMatrix:V,transform:O,params:I,queryPadding:this.queryPadding*N},o,d,m):{}}querySourceFeatures(o,d){const m=this.latestFeatureIndex;if(!m||!m.rawTileData)return;const y=m.loadVTLayers(),x=d&&d.sourceLayer?d.sourceLayer:"",M=y._geojsonTileLayer||y[x];if(!M)return;const I=l.a7(d&&d.filter),{z:O,x:N,y:V}=this.tileID.canonical,F={z:O,x:N,y:V};for(let Z=0;Z<M.length;Z++){const J=M.feature(Z);if(I.needGeometry){const le=l.a8(J,!0);if(!I.filter(new l.z(this.tileID.overscaledZ),le,this.tileID.canonical))continue}else if(!I.filter(new l.z(this.tileID.overscaledZ),J))continue;const ee=m.getId(J,x),oe=new l.a9(J,O,N,V,ee);oe.tile=F,o.push(oe)}}hasData(){return this.state==="loaded"||this.state==="reloading"||this.state==="expired"}patternsLoaded(){return this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length}setExpiryData(o){const d=this.expirationTime;if(o.cacheControl){const m=l.aa(o.cacheControl);m["max-age"]&&(this.expirationTime=Date.now()+1e3*m["max-age"])}else o.expires&&(this.expirationTime=new Date(o.expires).getTime());if(this.expirationTime){const m=Date.now();let y=!1;if(this.expirationTime>m)y=!1;else if(d)if(this.expirationTime<d)y=!0;else{const x=this.expirationTime-d;x?this.expirationTime=m+Math.max(x,3e4):y=!0}else y=!0;y?(this.expiredRequestCount++,this.state="expired"):this.expiredRequestCount=0}}getExpiryTimeout(){if(this.expirationTime)return this.expiredRequestCount?1e3*(1<<Math.min(this.expiredRequestCount-1,31)):Math.min(this.expirationTime-new Date().getTime(),Math.pow(2,31)-1)}setFeatureState(o,d){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData||Object.keys(o).length===0)return;const m=this.latestFeatureIndex.loadVTLayers();for(const y in this.buckets){if(!d.style.hasLayer(y))continue;const x=this.buckets[y],M=x.layers[0].sourceLayer||"_geojsonTileLayer",I=m[M],O=o[M];if(!I||!O||Object.keys(O).length===0)continue;x.update(O,I,this.imageAtlas&&this.imageAtlas.patternPositions||{});const N=d&&d.style&&d.style.getLayer(y);N&&(this.queryPadding=Math.max(this.queryPadding,N.queryRadius(x)))}}holdingForFade(){return this.symbolFadeHoldUntil!==void 0}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<E.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0}setHoldDuration(o){this.symbolFadeHoldUntil=E.now()+o}setDependencies(o,d){const m={};for(const y of d)m[y]=!0;this.dependencies[o]=m}hasDependency(o,d){for(const m of o){const y=this.dependencies[m];if(y){for(const x of d)if(y[x])return!0}}return!1}}class Ze{constructor(o,d){this.max=o,this.onRemove=d,this.reset()}reset(){for(const o in this.data)for(const d of this.data[o])d.timeout&&clearTimeout(d.timeout),this.onRemove(d.value);return this.data={},this.order=[],this}add(o,d,m){const y=o.wrapped().key;this.data[y]===void 0&&(this.data[y]=[]);const x={value:d,timeout:void 0};if(m!==void 0&&(x.timeout=setTimeout(()=>{this.remove(o,x)},m)),this.data[y].push(x),this.order.push(y),this.order.length>this.max){const M=this._getAndRemoveByKey(this.order[0]);M&&this.onRemove(M)}return this}has(o){return o.wrapped().key in this.data}getAndRemove(o){return this.has(o)?this._getAndRemoveByKey(o.wrapped().key):null}_getAndRemoveByKey(o){const d=this.data[o].shift();return d.timeout&&clearTimeout(d.timeout),this.data[o].length===0&&delete this.data[o],this.order.splice(this.order.indexOf(o),1),d.value}getByKey(o){const d=this.data[o];return d?d[0].value:null}get(o){return this.has(o)?this.data[o.wrapped().key][0].value:null}remove(o,d){if(!this.has(o))return this;const m=o.wrapped().key,y=d===void 0?0:this.data[m].indexOf(d),x=this.data[m][y];return this.data[m].splice(y,1),x.timeout&&clearTimeout(x.timeout),this.data[m].length===0&&delete this.data[m],this.onRemove(x.value),this.order.splice(this.order.indexOf(m),1),this}setMaxSize(o){for(this.max=o;this.order.length>this.max;){const d=this._getAndRemoveByKey(this.order[0]);d&&this.onRemove(d)}return this}filter(o){const d=[];for(const m in this.data)for(const y of this.data[m])o(y.value)||d.push(y);for(const m of d)this.remove(m.value.tileID,m)}}class ke{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(o,d,m){const y=String(d);if(this.stateChanges[o]=this.stateChanges[o]||{},this.stateChanges[o][y]=this.stateChanges[o][y]||{},l.e(this.stateChanges[o][y],m),this.deletedStates[o]===null){this.deletedStates[o]={};for(const x in this.state[o])x!==y&&(this.deletedStates[o][x]=null)}else if(this.deletedStates[o]&&this.deletedStates[o][y]===null){this.deletedStates[o][y]={};for(const x in this.state[o][y])m[x]||(this.deletedStates[o][y][x]=null)}else for(const x in m)this.deletedStates[o]&&this.deletedStates[o][y]&&this.deletedStates[o][y][x]===null&&delete this.deletedStates[o][y][x]}removeFeatureState(o,d,m){if(this.deletedStates[o]===null)return;const y=String(d);if(this.deletedStates[o]=this.deletedStates[o]||{},m&&d!==void 0)this.deletedStates[o][y]!==null&&(this.deletedStates[o][y]=this.deletedStates[o][y]||{},this.deletedStates[o][y][m]=null);else if(d!==void 0)if(this.stateChanges[o]&&this.stateChanges[o][y])for(m in this.deletedStates[o][y]={},this.stateChanges[o][y])this.deletedStates[o][y][m]=null;else this.deletedStates[o][y]=null;else this.deletedStates[o]=null}getState(o,d){const m=String(d),y=l.e({},(this.state[o]||{})[m],(this.stateChanges[o]||{})[m]);if(this.deletedStates[o]===null)return{};if(this.deletedStates[o]){const x=this.deletedStates[o][d];if(x===null)return{};for(const M in x)delete y[M]}return y}initializeTileState(o,d){o.setFeatureState(this.state,d)}coalesceChanges(o,d){const m={};for(const y in this.stateChanges){this.state[y]=this.state[y]||{};const x={};for(const M in this.stateChanges[y])this.state[y][M]||(this.state[y][M]={}),l.e(this.state[y][M],this.stateChanges[y][M]),x[M]=this.state[y][M];m[y]=x}for(const y in this.deletedStates){this.state[y]=this.state[y]||{};const x={};if(this.deletedStates[y]===null)for(const M in this.state[y])x[M]={},this.state[y][M]={};else for(const M in this.deletedStates[y]){if(this.deletedStates[y][M]===null)this.state[y][M]={};else for(const I of Object.keys(this.deletedStates[y][M]))delete this.state[y][M][I];x[M]=this.state[y][M]}m[y]=m[y]||{},l.e(m[y],x)}if(this.stateChanges={},this.deletedStates={},Object.keys(m).length!==0)for(const y in o)o[y].setFeatureState(m,d)}}class Re extends l.E{constructor(o,d,m){super(),this.id=o,this.dispatcher=m,this.on("data",y=>this._dataHandler(y)),this.on("dataloading",()=>{this._sourceErrored=!1}),this.on("error",()=>{this._sourceErrored=this._source.loaded()}),this._source=((y,x,M,I)=>{const O=new(Co(x.type))(y,x,M,I);if(O.id!==y)throw new Error(`Expected Source id to be ${y} instead of ${O.id}`);return O})(o,d,m,this),this._tiles={},this._cache=new Ze(0,y=>this._unloadTile(y)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new ke,this._didEmitContent=!1,this._updated=!1}onAdd(o){this.map=o,this._maxTileCacheSize=o?o._maxTileCacheSize:null,this._maxTileCacheZoomLevels=o?o._maxTileCacheZoomLevels:null,this._source&&this._source.onAdd&&this._source.onAdd(o)}onRemove(o){this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(o)}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;if(!(this.used===void 0&&this.usedForTerrain===void 0||this.used||this.usedForTerrain))return!0;if(!this._updated)return!1;for(const o in this._tiles){const d=this._tiles[o];if(d.state!=="loaded"&&d.state!=="errored")return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const o=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,o&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}_loadTile(o,d,m){return l._(this,void 0,void 0,function*(){try{yield this._source.loadTile(o),this._tileLoaded(o,d,m)}catch(y){o.state="errored",y.status!==404?this._source.fire(new l.j(y,{tile:o})):this.update(this.transform,this.terrain)}})}_unloadTile(o){this._source.unloadTile&&this._source.unloadTile(o)}_abortTile(o){this._source.abortTile&&this._source.abortTile(o),this._source.fire(new l.k("dataabort",{tile:o,coord:o.tileID,dataType:"source"}))}serialize(){return this._source.serialize()}prepare(o){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const d in this._tiles){const m=this._tiles[d];m.upload(o),m.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map(o=>o.tileID).sort(vt).map(o=>o.key)}getRenderableIds(o){const d=[];for(const m in this._tiles)this._isIdRenderable(m,o)&&d.push(this._tiles[m]);return o?d.sort((m,y)=>{const x=m.tileID,M=y.tileID,I=new l.P(x.canonical.x,x.canonical.y)._rotate(this.transform.angle),O=new l.P(M.canonical.x,M.canonical.y)._rotate(this.transform.angle);return x.overscaledZ-M.overscaledZ||O.y-I.y||O.x-I.x}).map(m=>m.tileID.key):d.map(m=>m.tileID).sort(vt).map(m=>m.key)}hasRenderableParent(o){const d=this.findLoadedParent(o,0);return!!d&&this._isIdRenderable(d.tileID.key)}_isIdRenderable(o,d){return this._tiles[o]&&this._tiles[o].hasData()&&!this._coveredTiles[o]&&(d||!this._tiles[o].holdingForFade())}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const o in this._tiles)this._tiles[o].state!=="errored"&&this._reloadTile(o,"reloading")}}_reloadTile(o,d){return l._(this,void 0,void 0,function*(){const m=this._tiles[o];m&&(m.state!=="loading"&&(m.state=d),yield this._loadTile(m,o,d))})}_tileLoaded(o,d,m){o.timeAdded=E.now(),m==="expired"&&(o.refreshedUponExpiration=!0),this._setTileReloadTimer(d,o),this.getSource().type==="raster-dem"&&o.dem&&this._backfillDEM(o),this._state.initializeTileState(o,this.map?this.map.painter:null),o.aborted||this._source.fire(new l.k("data",{dataType:"source",tile:o,coord:o.tileID}))}_backfillDEM(o){const d=this.getRenderableIds();for(let y=0;y<d.length;y++){const x=d[y];if(o.neighboringTiles&&o.neighboringTiles[x]){const M=this.getTileByID(x);m(o,M),m(M,o)}}function m(y,x){y.needsHillshadePrepare=!0,y.needsTerrainPrepare=!0;let M=x.tileID.canonical.x-y.tileID.canonical.x;const I=x.tileID.canonical.y-y.tileID.canonical.y,O=Math.pow(2,y.tileID.canonical.z),N=x.tileID.key;M===0&&I===0||Math.abs(I)>1||(Math.abs(M)>1&&(Math.abs(M+O)===1?M+=O:Math.abs(M-O)===1&&(M-=O)),x.dem&&y.dem&&(y.dem.backfillBorder(x.dem,M,I),y.neighboringTiles&&y.neighboringTiles[N]&&(y.neighboringTiles[N].backfilled=!0)))}}getTile(o){return this.getTileByID(o.key)}getTileByID(o){return this._tiles[o]}_retainLoadedChildren(o,d,m,y){for(const x in this._tiles){let M=this._tiles[x];if(y[x]||!M.hasData()||M.tileID.overscaledZ<=d||M.tileID.overscaledZ>m)continue;let I=M.tileID;for(;M&&M.tileID.overscaledZ>d+1;){const N=M.tileID.scaledTo(M.tileID.overscaledZ-1);M=this._tiles[N.key],M&&M.hasData()&&(I=N)}let O=I;for(;O.overscaledZ>d;)if(O=O.scaledTo(O.overscaledZ-1),o[O.key]){y[I.key]=I;break}}}findLoadedParent(o,d){if(o.key in this._loadedParentTiles){const m=this._loadedParentTiles[o.key];return m&&m.tileID.overscaledZ>=d?m:null}for(let m=o.overscaledZ-1;m>=d;m--){const y=o.scaledTo(m),x=this._getLoadedTile(y);if(x)return x}}findLoadedSibling(o){return this._getLoadedTile(o)}_getLoadedTile(o){const d=this._tiles[o.key];return d&&d.hasData()?d:this._cache.getByKey(o.wrapped().key)}updateCacheSize(o){const d=Math.ceil(o.width/this._source.tileSize)+1,m=Math.ceil(o.height/this._source.tileSize)+1,y=Math.floor(d*m*(this._maxTileCacheZoomLevels===null?l.a.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),x=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,y):y;this._cache.setMaxSize(x)}handleWrapJump(o){const d=Math.round((o-(this._prevLng===void 0?o:this._prevLng))/360);if(this._prevLng=o,d){const m={};for(const y in this._tiles){const x=this._tiles[y];x.tileID=x.tileID.unwrapTo(x.tileID.wrap+d),m[x.tileID.key]=x}this._tiles=m;for(const y in this._timers)clearTimeout(this._timers[y]),delete this._timers[y];for(const y in this._tiles)this._setTileReloadTimer(y,this._tiles[y])}}_updateCoveredAndRetainedTiles(o,d,m,y,x,M){const I={},O={},N=Object.keys(o),V=E.now();for(const F of N){const Z=o[F],J=this._tiles[F];if(!J||J.fadeEndTime!==0&&J.fadeEndTime<=V)continue;const ee=this.findLoadedParent(Z,d),oe=this.findLoadedSibling(Z),le=ee||oe||null;le&&(this._addTile(le.tileID),I[le.tileID.key]=le.tileID),O[F]=Z}this._retainLoadedChildren(O,y,m,o);for(const F in I)o[F]||(this._coveredTiles[F]=!0,o[F]=I[F]);if(M){const F={},Z={};for(const J of x)this._tiles[J.key].hasData()?F[J.key]=J:Z[J.key]=J;for(const J in Z){const ee=Z[J].children(this._source.maxzoom);this._tiles[ee[0].key]&&this._tiles[ee[1].key]&&this._tiles[ee[2].key]&&this._tiles[ee[3].key]&&(F[ee[0].key]=o[ee[0].key]=ee[0],F[ee[1].key]=o[ee[1].key]=ee[1],F[ee[2].key]=o[ee[2].key]=ee[2],F[ee[3].key]=o[ee[3].key]=ee[3],delete Z[J])}for(const J in Z){const ee=Z[J],oe=this.findLoadedParent(ee,this._source.minzoom),le=this.findLoadedSibling(ee),ce=oe||le||null;if(ce){F[ce.tileID.key]=o[ce.tileID.key]=ce.tileID;for(const he in F)F[he].isChildOf(ce.tileID)&&delete F[he]}}for(const J in this._tiles)F[J]||(this._coveredTiles[J]=!0)}}update(o,d){if(!this._sourceLoaded||this._paused)return;let m;this.transform=o,this.terrain=d,this.updateCacheSize(o),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?m=o.getVisibleUnwrappedCoordinates(this._source.tileID).map(V=>new l.S(V.canonical.z,V.wrap,V.canonical.z,V.canonical.x,V.canonical.y)):(m=o.coveringTiles({tileSize:this.usedForTerrain?this.tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:!this.usedForTerrain&&this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled,terrain:d}),this._source.hasTile&&(m=m.filter(V=>this._source.hasTile(V)))):m=[];const y=o.coveringZoomLevel(this._source),x=Math.max(y-Re.maxOverzooming,this._source.minzoom),M=Math.max(y+Re.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){const V={};for(const F of m)if(F.canonical.z>this._source.minzoom){const Z=F.scaledTo(F.canonical.z-1);V[Z.key]=Z;const J=F.scaledTo(Math.max(this._source.minzoom,Math.min(F.canonical.z,5)));V[J.key]=J}m=m.concat(Object.values(V))}const I=m.length===0&&!this._updated&&this._didEmitContent;this._updated=!0,I&&this.fire(new l.k("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));const O=this._updateRetainedTiles(m,y);Wt(this._source.type)&&this._updateCoveredAndRetainedTiles(O,x,M,y,m,d);for(const V in O)this._tiles[V].clearFadeHold();const N=l.ab(this._tiles,O);for(const V of N){const F=this._tiles[V];F.hasSymbolBuckets&&!F.holdingForFade()?F.setHoldDuration(this.map._fadeDuration):F.hasSymbolBuckets&&!F.symbolFadeFinished()||this._removeTile(V)}this._updateLoadedParentTileCache(),this._updateLoadedSiblingTileCache()}releaseSymbolFadeTiles(){for(const o in this._tiles)this._tiles[o].holdingForFade()&&this._removeTile(o)}_updateRetainedTiles(o,d){var m;const y={},x={},M=Math.max(d-Re.maxOverzooming,this._source.minzoom),I=Math.max(d+Re.maxUnderzooming,this._source.minzoom),O={};for(const N of o){const V=this._addTile(N);y[N.key]=N,V.hasData()||d<this._source.maxzoom&&(O[N.key]=N)}this._retainLoadedChildren(O,d,I,y);for(const N of o){let V=this._tiles[N.key];if(V.hasData())continue;if(d+1>this._source.maxzoom){const Z=N.children(this._source.maxzoom)[0],J=this.getTile(Z);if(J&&J.hasData()){y[Z.key]=Z;continue}}else{const Z=N.children(this._source.maxzoom);if(y[Z[0].key]&&y[Z[1].key]&&y[Z[2].key]&&y[Z[3].key])continue}let F=V.wasRequested();for(let Z=N.overscaledZ-1;Z>=M;--Z){const J=N.scaledTo(Z);if(x[J.key])break;if(x[J.key]=!0,V=this.getTile(J),!V&&F&&(V=this._addTile(J)),V){const ee=V.hasData();if((ee||!(!((m=this.map)===null||m===void 0)&&m.cancelPendingTileRequestsWhileZooming)||F)&&(y[J.key]=J),F=V.wasRequested(),ee)break}}}return y}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const o in this._tiles){const d=[];let m,y=this._tiles[o].tileID;for(;y.overscaledZ>0;){if(y.key in this._loadedParentTiles){m=this._loadedParentTiles[y.key];break}d.push(y.key);const x=y.scaledTo(y.overscaledZ-1);if(m=this._getLoadedTile(x),m)break;y=x}for(const x of d)this._loadedParentTiles[x]=m}}_updateLoadedSiblingTileCache(){this._loadedSiblingTiles={};for(const o in this._tiles){const d=this._tiles[o].tileID,m=this._getLoadedTile(d);this._loadedSiblingTiles[d.key]=m}}_addTile(o){let d=this._tiles[o.key];if(d)return d;d=this._cache.getAndRemove(o),d&&(this._setTileReloadTimer(o.key,d),d.tileID=o,this._state.initializeTileState(d,this.map?this.map.painter:null),this._cacheTimers[o.key]&&(clearTimeout(this._cacheTimers[o.key]),delete this._cacheTimers[o.key],this._setTileReloadTimer(o.key,d)));const m=d;return d||(d=new To(o,this._source.tileSize*o.overscaleFactor()),this._loadTile(d,o.key,d.state)),d.uses++,this._tiles[o.key]=d,m||this._source.fire(new l.k("dataloading",{tile:d,coord:d.tileID,dataType:"source"})),d}_setTileReloadTimer(o,d){o in this._timers&&(clearTimeout(this._timers[o]),delete this._timers[o]);const m=d.getExpiryTimeout();m&&(this._timers[o]=setTimeout(()=>{this._reloadTile(o,"expired"),delete this._timers[o]},m))}_removeTile(o){const d=this._tiles[o];d&&(d.uses--,delete this._tiles[o],this._timers[o]&&(clearTimeout(this._timers[o]),delete this._timers[o]),d.uses>0||(d.hasData()&&d.state!=="reloading"?this._cache.add(d.tileID,d,d.getExpiryTimeout()):(d.aborted=!0,this._abortTile(d),this._unloadTile(d))))}_dataHandler(o){const d=o.sourceDataType;o.dataType==="source"&&d==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&o.dataType==="source"&&d==="content"&&(this.reload(),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0)}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const o in this._tiles)this._removeTile(o);this._cache.reset()}tilesIn(o,d,m){const y=[],x=this.transform;if(!x)return y;const M=m?x.getCameraQueryGeometry(o):o,I=o.map(ee=>x.pointCoordinate(ee,this.terrain)),O=M.map(ee=>x.pointCoordinate(ee,this.terrain)),N=this.getIds();let V=1/0,F=1/0,Z=-1/0,J=-1/0;for(const ee of O)V=Math.min(V,ee.x),F=Math.min(F,ee.y),Z=Math.max(Z,ee.x),J=Math.max(J,ee.y);for(let ee=0;ee<N.length;ee++){const oe=this._tiles[N[ee]];if(oe.holdingForFade())continue;const le=oe.tileID,ce=Math.pow(2,x.zoom-oe.tileID.overscaledZ),he=d*oe.queryPadding*l.X/oe.tileSize/ce,ne=[le.getTilePoint(new l.Z(V,F)),le.getTilePoint(new l.Z(Z,J))];if(ne[0].x-he<l.X&&ne[0].y-he<l.X&&ne[1].x+he>=0&&ne[1].y+he>=0){const me=I.map(xe=>le.getTilePoint(xe)),ge=O.map(xe=>le.getTilePoint(xe));y.push({tile:oe,tileID:le,queryGeometry:me,cameraQueryGeometry:ge,scale:ce})}}return y}getVisibleCoordinates(o){const d=this.getRenderableIds(o).map(m=>this._tiles[m].tileID);for(const m of d)m.posMatrix=this.transform.calculatePosMatrix(m.toUnwrapped());return d}hasTransition(){if(this._source.hasTransition())return!0;if(Wt(this._source.type)){const o=E.now();for(const d in this._tiles)if(this._tiles[d].fadeEndTime>=o)return!0}return!1}setFeatureState(o,d,m){this._state.updateState(o=o||"_geojsonTileLayer",d,m)}removeFeatureState(o,d,m){this._state.removeFeatureState(o=o||"_geojsonTileLayer",d,m)}getFeatureState(o,d){return this._state.getState(o=o||"_geojsonTileLayer",d)}setDependencies(o,d,m){const y=this._tiles[o];y&&y.setDependencies(d,m)}reloadTilesForDependencies(o,d){for(const m in this._tiles)this._tiles[m].hasDependency(o,d)&&this._reloadTile(m,"reloading");this._cache.filter(m=>!m.hasDependency(o,d))}}function vt(v,o){const d=Math.abs(2*v.wrap)-+(v.wrap<0),m=Math.abs(2*o.wrap)-+(o.wrap<0);return v.overscaledZ-o.overscaledZ||m-d||o.canonical.y-v.canonical.y||o.canonical.x-v.canonical.x}function Wt(v){return v==="raster"||v==="image"||v==="video"}Re.maxOverzooming=10,Re.maxUnderzooming=3;class et{constructor(o,d){this.reset(o,d)}reset(o,d){this.points=o||[],this._distances=[0];for(let m=1;m<this.points.length;m++)this._distances[m]=this._distances[m-1]+this.points[m].dist(this.points[m-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(d||0,.5*this.length),this.paddedLength=this.length-2*this.padding}lerp(o){if(this.points.length===1)return this.points[0];o=l.ac(o,0,1);let d=1,m=this._distances[d];const y=o*this.paddedLength+this.padding;for(;m<y&&d<this._distances.length;)m=this._distances[++d];const x=d-1,M=this._distances[x],I=m-M,O=I>0?(y-M)/I:0;return this.points[x].mult(1-O).add(this.points[d].mult(O))}}function Ln(v,o){let d=!0;return v==="always"||v!=="never"&&o!=="never"||(d=!1),d}class Kn{constructor(o,d,m){const y=this.boxCells=[],x=this.circleCells=[];this.xCellCount=Math.ceil(o/m),this.yCellCount=Math.ceil(d/m);for(let M=0;M<this.xCellCount*this.yCellCount;M++)y.push([]),x.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=o,this.height=d,this.xScale=this.xCellCount/o,this.yScale=this.yCellCount/d,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(o,d,m,y,x){this._forEachCell(d,m,y,x,this._insertBoxCell,this.boxUid++),this.boxKeys.push(o),this.bboxes.push(d),this.bboxes.push(m),this.bboxes.push(y),this.bboxes.push(x)}insertCircle(o,d,m,y){this._forEachCell(d-y,m-y,d+y,m+y,this._insertCircleCell,this.circleUid++),this.circleKeys.push(o),this.circles.push(d),this.circles.push(m),this.circles.push(y)}_insertBoxCell(o,d,m,y,x,M){this.boxCells[x].push(M)}_insertCircleCell(o,d,m,y,x,M){this.circleCells[x].push(M)}_query(o,d,m,y,x,M,I){if(m<0||o>this.width||y<0||d>this.height)return[];const O=[];if(o<=0&&d<=0&&this.width<=m&&this.height<=y){if(x)return[{key:null,x1:o,y1:d,x2:m,y2:y}];for(let N=0;N<this.boxKeys.length;N++)O.push({key:this.boxKeys[N],x1:this.bboxes[4*N],y1:this.bboxes[4*N+1],x2:this.bboxes[4*N+2],y2:this.bboxes[4*N+3]});for(let N=0;N<this.circleKeys.length;N++){const V=this.circles[3*N],F=this.circles[3*N+1],Z=this.circles[3*N+2];O.push({key:this.circleKeys[N],x1:V-Z,y1:F-Z,x2:V+Z,y2:F+Z})}}else this._forEachCell(o,d,m,y,this._queryCell,O,{hitTest:x,overlapMode:M,seenUids:{box:{},circle:{}}},I);return O}query(o,d,m,y){return this._query(o,d,m,y,!1,null)}hitTest(o,d,m,y,x,M){return this._query(o,d,m,y,!0,x,M).length>0}hitTestCircle(o,d,m,y,x){const M=o-m,I=o+m,O=d-m,N=d+m;if(I<0||M>this.width||N<0||O>this.height)return!1;const V=[];return this._forEachCell(M,O,I,N,this._queryCellCircle,V,{hitTest:!0,overlapMode:y,circle:{x:o,y:d,radius:m},seenUids:{box:{},circle:{}}},x),V.length>0}_queryCell(o,d,m,y,x,M,I,O){const{seenUids:N,hitTest:V,overlapMode:F}=I,Z=this.boxCells[x];if(Z!==null){const ee=this.bboxes;for(const oe of Z)if(!N.box[oe]){N.box[oe]=!0;const le=4*oe,ce=this.boxKeys[oe];if(o<=ee[le+2]&&d<=ee[le+3]&&m>=ee[le+0]&&y>=ee[le+1]&&(!O||O(ce))&&(!V||!Ln(F,ce.overlapMode))&&(M.push({key:ce,x1:ee[le],y1:ee[le+1],x2:ee[le+2],y2:ee[le+3]}),V))return!0}}const J=this.circleCells[x];if(J!==null){const ee=this.circles;for(const oe of J)if(!N.circle[oe]){N.circle[oe]=!0;const le=3*oe,ce=this.circleKeys[oe];if(this._circleAndRectCollide(ee[le],ee[le+1],ee[le+2],o,d,m,y)&&(!O||O(ce))&&(!V||!Ln(F,ce.overlapMode))){const he=ee[le],ne=ee[le+1],me=ee[le+2];if(M.push({key:ce,x1:he-me,y1:ne-me,x2:he+me,y2:ne+me}),V)return!0}}}return!1}_queryCellCircle(o,d,m,y,x,M,I,O){const{circle:N,seenUids:V,overlapMode:F}=I,Z=this.boxCells[x];if(Z!==null){const ee=this.bboxes;for(const oe of Z)if(!V.box[oe]){V.box[oe]=!0;const le=4*oe,ce=this.boxKeys[oe];if(this._circleAndRectCollide(N.x,N.y,N.radius,ee[le+0],ee[le+1],ee[le+2],ee[le+3])&&(!O||O(ce))&&!Ln(F,ce.overlapMode))return M.push(!0),!0}}const J=this.circleCells[x];if(J!==null){const ee=this.circles;for(const oe of J)if(!V.circle[oe]){V.circle[oe]=!0;const le=3*oe,ce=this.circleKeys[oe];if(this._circlesCollide(ee[le],ee[le+1],ee[le+2],N.x,N.y,N.radius)&&(!O||O(ce))&&!Ln(F,ce.overlapMode))return M.push(!0),!0}}}_forEachCell(o,d,m,y,x,M,I,O){const N=this._convertToXCellCoord(o),V=this._convertToYCellCoord(d),F=this._convertToXCellCoord(m),Z=this._convertToYCellCoord(y);for(let J=N;J<=F;J++)for(let ee=V;ee<=Z;ee++)if(x.call(this,o,d,m,y,this.xCellCount*ee+J,M,I,O))return}_convertToXCellCoord(o){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(o*this.xScale)))}_convertToYCellCoord(o){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(o*this.yScale)))}_circlesCollide(o,d,m,y,x,M){const I=y-o,O=x-d,N=m+M;return N*N>I*I+O*O}_circleAndRectCollide(o,d,m,y,x,M,I){const O=(M-y)/2,N=Math.abs(o-(y+O));if(N>O+m)return!1;const V=(I-x)/2,F=Math.abs(d-(x+V));if(F>V+m)return!1;if(N<=O||F<=V)return!0;const Z=N-O,J=F-V;return Z*Z+J*J<=m*m}}function qi(v,o,d,m,y){const x=l.H();return o?(l.K(x,x,[1/y,1/y,1]),d||l.ad(x,x,m.angle)):l.L(x,m.labelPlaneMatrix,v),x}function fr(v,o,d,m,y){if(o){const x=l.ae(v);return l.K(x,x,[y,y,1]),d||l.ad(x,x,-m.angle),x}return m.glCoordMatrix}function se(v,o,d,m){let y;m?(y=[v,o,m(v,o),1],l.af(y,y,d)):(y=[v,o,0,1],an(y,y,d));const x=y[3];return{point:new l.P(y[0]/x,y[1]/x),signedDistanceFromCamera:x,isOccluded:!1}}function H(v,o){return .5+v/o*.5}function U(v,o){return v.x>=-o[0]&&v.x<=o[0]&&v.y>=-o[1]&&v.y<=o[1]}function X(v,o,d,m,y,x,M,I,O,N,V,F,Z,J,ee){const oe=m?v.textSizeData:v.iconSizeData,le=l.ag(oe,d.transform.zoom),ce=[256/d.width*2+1,256/d.height*2+1],he=m?v.text.dynamicLayoutVertexArray:v.icon.dynamicLayoutVertexArray;he.clear();const ne=v.lineVertexArray,me=m?v.text.placedSymbolArray:v.icon.placedSymbolArray,ge=d.transform.width/d.transform.height;let xe=!1;for(let Be=0;Be<me.length;Be++){const Fe=me.get(Be);if(Fe.hidden||Fe.writingMode===l.ah.vertical&&!xe){kt(Fe.numGlyphs,he);continue}xe=!1;const Qe=se(Fe.anchorX,Fe.anchorY,o,ee);if(!U(Qe.point,ce)){kt(Fe.numGlyphs,he);continue}const st=H(d.transform.cameraToCenterDistance,Qe.signedDistanceFromCamera),Ye=l.ai(oe,le,Fe),Ge=M?Ye/st:Ye*st,mt={getElevation:ee,labelPlaneMatrix:y,lineVertexArray:ne,pitchWithMap:M,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},projection:N,tileAnchorPoint:new l.P(Fe.anchorX,Fe.anchorY),unwrappedTileID:V,width:F,height:Z,translation:J},Bt=fe(mt,Fe,Ge,!1,I,o,x,v.glyphOffsetArray,he,ge,O);xe=Bt.useVertical,(Bt.notEnoughRoom||xe||Bt.needsFlipping&&fe(mt,Fe,Ge,!0,I,o,x,v.glyphOffsetArray,he,ge,O).notEnoughRoom)&&kt(Fe.numGlyphs,he)}m?v.text.dynamicLayoutVertexBuffer.updateData(he):v.icon.dynamicLayoutVertexBuffer.updateData(he)}function ie(v,o,d,m,y,x,M,I){const O=x.glyphStartIndex+x.numGlyphs,N=x.lineStartIndex,V=x.lineStartIndex+x.lineLength,F=o.getoffsetX(x.glyphStartIndex),Z=o.getoffsetX(O-1),J=We(v*F,d,m,y,x.segment,N,V,I,M);if(!J)return null;const ee=We(v*Z,d,m,y,x.segment,N,V,I,M);return ee?I.projectionCache.anyProjectionOccluded?null:{first:J,last:ee}:null}function de(v,o,d,m){return v===l.ah.horizontal&&Math.abs(d.y-o.y)>Math.abs(d.x-o.x)*m?{useVertical:!0}:(v===l.ah.vertical?o.y<d.y:o.x>d.x)?{needsFlipping:!0}:null}function fe(v,o,d,m,y,x,M,I,O,N,V){const F=d/24,Z=o.lineOffsetX*F,J=o.lineOffsetY*F;let ee;if(o.numGlyphs>1){const oe=o.glyphStartIndex+o.numGlyphs,le=o.lineStartIndex,ce=o.lineStartIndex+o.lineLength,he=ie(F,I,Z,J,m,o,V,v);if(!he)return{notEnoughRoom:!0};const ne=se(he.first.point.x,he.first.point.y,M,v.getElevation).point,me=se(he.last.point.x,he.last.point.y,M,v.getElevation).point;if(y&&!m){const ge=de(o.writingMode,ne,me,N);if(ge)return ge}ee=[he.first];for(let ge=o.glyphStartIndex+1;ge<oe-1;ge++)ee.push(We(F*I.getoffsetX(ge),Z,J,m,o.segment,le,ce,v,V));ee.push(he.last)}else{if(y&&!m){const le=se(v.tileAnchorPoint.x,v.tileAnchorPoint.y,x,v.getElevation).point,ce=o.lineStartIndex+o.segment+1,he=new l.P(v.lineVertexArray.getx(ce),v.lineVertexArray.gety(ce)),ne=se(he.x,he.y,x,v.getElevation),me=ne.signedDistanceFromCamera>0?ne.point:function(xe,Be,Fe,Qe,st,Ye){return _e(xe,Be,Fe,1,st,Ye)}(v.tileAnchorPoint,he,le,0,x,v),ge=de(o.writingMode,le,me,N);if(ge)return ge}const oe=We(F*I.getoffsetX(o.glyphStartIndex),Z,J,m,o.segment,o.lineStartIndex,o.lineStartIndex+o.lineLength,v,V);if(!oe||v.projectionCache.anyProjectionOccluded)return{notEnoughRoom:!0};ee=[oe]}for(const oe of ee)l.aj(O,oe.point,oe.angle);return{}}function _e(v,o,d,m,y,x){const M=v.add(v.sub(o)._unit()),I=y!==void 0?se(M.x,M.y,y,x.getElevation).point:Me(M.x,M.y,x).point,O=d.sub(I);return d.add(O._mult(m/O.mag()))}function ue(v,o,d){const m=o.projectionCache;if(m.projections[v])return m.projections[v];const y=new l.P(o.lineVertexArray.getx(v),o.lineVertexArray.gety(v)),x=Me(y.x,y.y,o);if(x.signedDistanceFromCamera>0)return m.projections[v]=x.point,m.anyProjectionOccluded=m.anyProjectionOccluded||x.isOccluded,x.point;const M=v-d.direction;return function(I,O,N,V,F){return _e(I,O,N,V,void 0,F)}(d.distanceFromAnchor===0?o.tileAnchorPoint:new l.P(o.lineVertexArray.getx(M),o.lineVertexArray.gety(M)),y,d.previousVertex,d.absOffsetX-d.distanceFromAnchor+1,o)}function Me(v,o,d){const m=v+d.translation[0],y=o+d.translation[1];let x;return!d.pitchWithMap&&d.projection.useSpecialProjectionForSymbols?(x=d.projection.projectTileCoordinates(m,y,d.unwrappedTileID,d.getElevation),x.point.x=(.5*x.point.x+.5)*d.width,x.point.y=(.5*-x.point.y+.5)*d.height):(x=se(m,y,d.labelPlaneMatrix,d.getElevation),x.isOccluded=!1),x}function ze(v,o,d){return v._unit()._perp()._mult(o*d)}function Ee(v,o,d,m,y,x,M,I,O){if(I.projectionCache.offsets[v])return I.projectionCache.offsets[v];const N=d.add(o);if(v+O.direction<m||v+O.direction>=y)return I.projectionCache.offsets[v]=N,N;const V=ue(v+O.direction,I,O),F=ze(V.sub(d),M,O.direction),Z=d.add(F),J=V.add(F);return I.projectionCache.offsets[v]=l.ak(x,N,Z,J)||N,I.projectionCache.offsets[v]}function We(v,o,d,m,y,x,M,I,O){const N=m?v-o:v+o;let V=N>0?1:-1,F=0;m&&(V*=-1,F=Math.PI),V<0&&(F+=Math.PI);let Z,J=V>0?x+y:x+y+1;I.projectionCache.cachedAnchorPoint?Z=I.projectionCache.cachedAnchorPoint:(Z=Me(I.tileAnchorPoint.x,I.tileAnchorPoint.y,I).point,I.projectionCache.cachedAnchorPoint=Z);let ee,oe,le=Z,ce=Z,he=0,ne=0;const me=Math.abs(N),ge=[];let xe;for(;he+ne<=me;){if(J+=V,J<x||J>=M)return null;he+=ne,ce=le,oe=ee;const Qe={absOffsetX:me,direction:V,distanceFromAnchor:he,previousVertex:ce};if(le=ue(J,I,Qe),d===0)ge.push(ce),xe=le.sub(ce);else{let st;const Ye=le.sub(ce);st=Ye.mag()===0?ze(ue(J+V,I,Qe).sub(le),d,V):ze(Ye,d,V),oe||(oe=ce.add(st)),ee=Ee(J,st,le,x,M,oe,d,I,Qe),ge.push(oe),xe=ee.sub(oe)}ne=xe.mag()}const Be=xe._mult((me-he)/ne)._add(oe||ce),Fe=F+Math.atan2(le.y-ce.y,le.x-ce.x);return ge.push(Be),{point:Be,angle:O?Fe:0,path:ge}}const xt=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function kt(v,o){for(let d=0;d<v;d++){const m=o.length;o.resize(m+4),o.float32.set(xt,3*m)}}function an(v,o,d){const m=o[0],y=o[1];return v[0]=d[0]*m+d[4]*y+d[12],v[1]=d[1]*m+d[5]*y+d[13],v[3]=d[3]*m+d[7]*y+d[15],v}const Lt=100;class ln{constructor(o,d,m=new Kn(o.width+200,o.height+200,25),y=new Kn(o.width+200,o.height+200,25)){this.transform=o,this.mapProjection=d,this.grid=m,this.ignoredGrid=y,this.pitchFactor=Math.cos(o._pitch)*o.cameraToCenterDistance,this.screenRightBoundary=o.width+Lt,this.screenBottomBoundary=o.height+Lt,this.gridRightBoundary=o.width+200,this.gridBottomBoundary=o.height+200,this.perspectiveRatioCutoff=.6}placeCollisionBox(o,d,m,y,x,M,I,O,N,V,F){const Z=o.anchorPointX+O[0],J=o.anchorPointY+O[1],ee=this.projectAndGetPerspectiveRatio(y,Z,J,x,V),oe=m*ee.perspectiveRatio;let le;if(M||I)le=this._projectCollisionBox(o,oe,y,x,M,I,O,ee,V,F);else{const ge=ee.point.x+(F?F.x*oe:0),xe=ee.point.y+(F?F.y*oe:0);le={allPointsOccluded:!1,box:[ge+o.x1*oe,xe+o.y1*oe,ge+o.x2*oe,xe+o.y2*oe]}}const[ce,he,ne,me]=le.box;return this.mapProjection.useSpecialProjectionForSymbols&&(M?le.allPointsOccluded:this.mapProjection.isOccluded(Z,J,x))||ee.perspectiveRatio<this.perspectiveRatioCutoff||!this.isInsideGrid(ce,he,ne,me)||d!=="always"&&this.grid.hitTest(ce,he,ne,me,d,N)?{box:[ce,he,ne,me],placeable:!1,offscreen:!1}:{box:[ce,he,ne,me],placeable:!0,offscreen:this.isOffscreen(ce,he,ne,me)}}placeCollisionCircles(o,d,m,y,x,M,I,O,N,V,F,Z,J,ee,oe,le){const ce=[],he=new l.P(d.anchorX,d.anchorY),ne=this.getPerspectiveRatio(M,he.x,he.y,I,le),me=(F?x/ne:x*ne)/l.ap,ge={getElevation:le,labelPlaneMatrix:O,lineVertexArray:m,pitchWithMap:F,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},projection:this.mapProjection,tileAnchorPoint:he,unwrappedTileID:I,width:this.transform.width,height:this.transform.height,translation:oe},xe=ie(me,y,d.lineOffsetX*me,d.lineOffsetY*me,!1,d,!1,ge);let Be=!1,Fe=!1,Qe=!0;if(xe){const st=.5*J*ne+ee,Ye=new l.P(-100,-100),Ge=new l.P(this.screenRightBoundary,this.screenBottomBoundary),mt=new et,Bt=xe.first,Ke=xe.last;let nt=[];for(let $t=Bt.path.length-1;$t>=1;$t--)nt.push(Bt.path[$t]);for(let $t=1;$t<Ke.path.length;$t++)nt.push(Ke.path[$t]);const Dt=2.5*st;if(N){const $t=this.projectPathToScreenSpace(nt,ge,N);nt=$t.some(Jt=>Jt.signedDistanceFromCamera<=0)?[]:$t.map(Jt=>Jt.point)}let Fn=[];if(nt.length>0){const $t=nt[0].clone(),Jt=nt[0].clone();for(let $n=1;$n<nt.length;$n++)$t.x=Math.min($t.x,nt[$n].x),$t.y=Math.min($t.y,nt[$n].y),Jt.x=Math.max(Jt.x,nt[$n].x),Jt.y=Math.max(Jt.y,nt[$n].y);Fn=$t.x>=Ye.x&&Jt.x<=Ge.x&&$t.y>=Ye.y&&Jt.y<=Ge.y?[nt]:Jt.x<Ye.x||$t.x>Ge.x||Jt.y<Ye.y||$t.y>Ge.y?[]:l.al([nt],Ye.x,Ye.y,Ge.x,Ge.y)}for(const $t of Fn){mt.reset($t,.25*st);let Jt=0;Jt=mt.length<=.5*st?1:Math.ceil(mt.paddedLength/Dt)+1;for(let $n=0;$n<Jt;$n++){const Oi=$n/Math.max(Jt-1,1),io=mt.lerp(Oi),jn=io.x+Lt,rr=io.y+Lt;ce.push(jn,rr,st,0);const Gi=jn-st,Bi=rr-st,Zi=jn+st,Po=rr+st;if(Qe=Qe&&this.isOffscreen(Gi,Bi,Zi,Po),Fe=Fe||this.isInsideGrid(Gi,Bi,Zi,Po),o!=="always"&&this.grid.hitTestCircle(jn,rr,st,o,Z)&&(Be=!0,!V))return{circles:[],offscreen:!1,collisionDetected:Be}}}}return{circles:!V&&Be||!Fe||ne<this.perspectiveRatioCutoff?[]:ce,offscreen:Qe,collisionDetected:Be}}projectPathToScreenSpace(o,d,m){return o.map(y=>se(y.x,y.y,m,d.getElevation))}queryRenderedSymbols(o){if(o.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};const d=[];let m=1/0,y=1/0,x=-1/0,M=-1/0;for(const V of o){const F=new l.P(V.x+Lt,V.y+Lt);m=Math.min(m,F.x),y=Math.min(y,F.y),x=Math.max(x,F.x),M=Math.max(M,F.y),d.push(F)}const I=this.grid.query(m,y,x,M).concat(this.ignoredGrid.query(m,y,x,M)),O={},N={};for(const V of I){const F=V.key;if(O[F.bucketInstanceId]===void 0&&(O[F.bucketInstanceId]={}),O[F.bucketInstanceId][F.featureIndex])continue;const Z=[new l.P(V.x1,V.y1),new l.P(V.x2,V.y1),new l.P(V.x2,V.y2),new l.P(V.x1,V.y2)];l.am(d,Z)&&(O[F.bucketInstanceId][F.featureIndex]=!0,N[F.bucketInstanceId]===void 0&&(N[F.bucketInstanceId]=[]),N[F.bucketInstanceId].push(F.featureIndex))}return N}insertCollisionBox(o,d,m,y,x,M){(m?this.ignoredGrid:this.grid).insert({bucketInstanceId:y,featureIndex:x,collisionGroupID:M,overlapMode:d},o[0],o[1],o[2],o[3])}insertCollisionCircles(o,d,m,y,x,M){const I=m?this.ignoredGrid:this.grid,O={bucketInstanceId:y,featureIndex:x,collisionGroupID:M,overlapMode:d};for(let N=0;N<o.length;N+=4)I.insertCircle(O,o[N],o[N+1],o[N+2])}projectAndGetPerspectiveRatio(o,d,m,y,x){let M;x?(M=[d,m,x(d,m),1],l.af(M,M,o)):(M=[d,m,0,1],an(M,M,o));const I=M[3];return{point:new l.P((M[0]/I+1)/2*this.transform.width+Lt,(-M[1]/I+1)/2*this.transform.height+Lt),perspectiveRatio:.5+this.transform.cameraToCenterDistance/I*.5,isOccluded:!1,signedDistanceFromCamera:I}}getPerspectiveRatio(o,d,m,y,x){const M=this.mapProjection.useSpecialProjectionForSymbols?this.mapProjection.projectTileCoordinates(d,m,y,x):se(d,m,o,x);return .5+this.transform.cameraToCenterDistance/M.signedDistanceFromCamera*.5}isOffscreen(o,d,m,y){return m<Lt||o>=this.screenRightBoundary||y<Lt||d>this.screenBottomBoundary}isInsideGrid(o,d,m,y){return m>=0&&o<this.gridRightBoundary&&y>=0&&d<this.gridBottomBoundary}getViewportMatrix(){const o=l.an([]);return l.J(o,o,[-100,-100,0]),o}_projectCollisionBox(o,d,m,y,x,M,I,O,N,V){let F=new l.P(1,0),Z=new l.P(0,1);const J=new l.P(o.anchorPointX+I[0],o.anchorPointY+I[1]);if(M&&!x){const Qe=this.projectAndGetPerspectiveRatio(m,J.x+1,J.y,y,N).point.sub(O.point).unit(),st=Math.atan(Qe.y/Qe.x)+(Qe.x<0?Math.PI:0),Ye=Math.sin(st),Ge=Math.cos(st);F=new l.P(Ge,Ye),Z=new l.P(-Ye,Ge)}else if(!M&&x){const Qe=-this.transform.angle,st=Math.sin(Qe),Ye=Math.cos(Qe);F=new l.P(Ye,st),Z=new l.P(-st,Ye)}let ee=O.point,oe=d;if(x){ee=J;const Qe=this.transform.zoom-Math.floor(this.transform.zoom);oe=Math.pow(2,-Qe),oe*=this.mapProjection.getPitchedTextCorrection(this.transform,J,y),V||(oe*=l.ac(.5+O.signedDistanceFromCamera/this.transform.cameraToCenterDistance*.5,0,4))}V&&(ee=ee.add(F.mult(V.x*oe)).add(Z.mult(V.y*oe)));const le=o.x1*oe,ce=o.x2*oe,he=(le+ce)/2,ne=o.y1*oe,me=o.y2*oe,ge=(ne+me)/2,xe=[{offsetX:le,offsetY:ne},{offsetX:he,offsetY:ne},{offsetX:ce,offsetY:ne},{offsetX:ce,offsetY:ge},{offsetX:ce,offsetY:me},{offsetX:he,offsetY:me},{offsetX:le,offsetY:me},{offsetX:le,offsetY:ge}];let Be=[];for(const{offsetX:Qe,offsetY:st}of xe)Be.push(new l.P(ee.x+F.x*Qe+Z.x*st,ee.y+F.y*Qe+Z.y*st));let Fe=!1;if(x){const Qe=Be.map(st=>this.projectAndGetPerspectiveRatio(m,st.x,st.y,y,N));Fe=Qe.some(st=>!st.isOccluded),Be=Qe.map(st=>st.point)}else Fe=!0;return{box:l.ao(Be),allPointsOccluded:!Fe}}}function Kt(v,o,d){return o*(l.X/(v.tileSize*Math.pow(2,d-v.tileID.overscaledZ)))}class oi{constructor(o,d,m,y){this.opacity=o?Math.max(0,Math.min(1,o.opacity+(o.placed?d:-d))):y&&m?1:0,this.placed=m}isHidden(){return this.opacity===0&&!this.placed}}class Zn{constructor(o,d,m,y,x){this.text=new oi(o?o.text:null,d,m,x),this.icon=new oi(o?o.icon:null,d,y,x)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class Ut{constructor(o,d,m){this.text=o,this.icon=d,this.skipFade=m}}class wn{constructor(){this.invProjMatrix=l.H(),this.viewportMatrix=l.H(),this.circles=[]}}class qn{constructor(o,d,m,y,x){this.bucketInstanceId=o,this.featureIndex=d,this.sourceLayerIndex=m,this.bucketIndex=y,this.tileID=x}}class mi{constructor(o){this.crossSourceCollisions=o,this.maxGroupID=0,this.collisionGroups={}}get(o){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[o]){const d=++this.maxGroupID;this.collisionGroups[o]={ID:d,predicate:m=>m.collisionGroupID===d}}return this.collisionGroups[o]}}function ki(v,o,d,m,y){const{horizontalAlign:x,verticalAlign:M}=l.au(v);return new l.P(-(x-.5)*o+m[0]*y,-(M-.5)*d+m[1]*y)}class Wi{constructor(o,d,m,y,x,M){this.transform=o.clone(),this.terrain=m,this.collisionIndex=new ln(this.transform,d),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=y,this.retainedQueryData={},this.collisionGroups=new mi(x),this.collisionCircleArrays={},this.collisionBoxArrays=new Map,this.prevPlacement=M,M&&(M.prevPlacement=void 0),this.placedOrientations={}}_getTerrainElevationFunc(o){const d=this.terrain;return d?(m,y)=>d.getElevation(o,m,y):null}getBucketParts(o,d,m,y){const x=m.getBucket(d),M=m.latestFeatureIndex;if(!x||!M||d.id!==x.layerIds[0])return;const I=m.collisionBoxArray,O=x.layers[0].layout,N=x.layers[0].paint,V=Math.pow(2,this.transform.zoom-m.tileID.overscaledZ),F=m.tileSize/l.X,Z=m.tileID.toUnwrapped(),J=this.transform.calculatePosMatrix(Z),ee=O.get("text-pitch-alignment")==="map",oe=O.get("text-rotation-alignment")==="map",le=Kt(m,1,this.transform.zoom),ce=this.collisionIndex.mapProjection.translatePosition(this.transform,m,N.get("text-translate"),N.get("text-translate-anchor")),he=this.collisionIndex.mapProjection.translatePosition(this.transform,m,N.get("icon-translate"),N.get("icon-translate-anchor")),ne=qi(J,ee,oe,this.transform,le);let me=null;if(ee){const xe=fr(J,ee,oe,this.transform,le);me=l.L([],this.transform.labelPlaneMatrix,xe)}this.retainedQueryData[x.bucketInstanceId]=new qn(x.bucketInstanceId,M,x.sourceLayerIndex,x.index,m.tileID);const ge={bucket:x,layout:O,translationText:ce,translationIcon:he,posMatrix:J,unwrappedTileID:Z,textLabelPlaneMatrix:ne,labelToScreenMatrix:me,scale:V,textPixelRatio:F,holdingForFade:m.holdingForFade(),collisionBoxArray:I,partiallyEvaluatedTextSize:l.ag(x.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(x.sourceID)};if(y)for(const xe of x.sortKeyRanges){const{sortKey:Be,symbolInstanceStart:Fe,symbolInstanceEnd:Qe}=xe;o.push({sortKey:Be,symbolInstanceStart:Fe,symbolInstanceEnd:Qe,parameters:ge})}else o.push({symbolInstanceStart:0,symbolInstanceEnd:x.symbolInstances.length,parameters:ge})}attemptAnchorPlacement(o,d,m,y,x,M,I,O,N,V,F,Z,J,ee,oe,le,ce,he,ne){const me=l.aq[o.textAnchor],ge=[o.textOffset0,o.textOffset1],xe=ki(me,m,y,ge,x),Be=this.collisionIndex.placeCollisionBox(d,Z,O,N,V,I,M,le,F.predicate,ne,xe);if((!he||this.collisionIndex.placeCollisionBox(he,Z,O,N,V,I,M,ce,F.predicate,ne,xe).placeable)&&Be.placeable){let Fe;if(this.prevPlacement&&this.prevPlacement.variableOffsets[J.crossTileID]&&this.prevPlacement.placements[J.crossTileID]&&this.prevPlacement.placements[J.crossTileID].text&&(Fe=this.prevPlacement.variableOffsets[J.crossTileID].anchor),J.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[J.crossTileID]={textOffset:ge,width:m,height:y,anchor:me,textBoxScale:x,prevAnchor:Fe},this.markUsedJustification(ee,me,J,oe),ee.allowVerticalPlacement&&(this.markUsedOrientation(ee,oe,J),this.placedOrientations[J.crossTileID]=oe),{shift:xe,placedGlyphBoxes:Be}}}placeLayerBucketPart(o,d,m){const{bucket:y,layout:x,translationText:M,translationIcon:I,posMatrix:O,unwrappedTileID:N,textLabelPlaneMatrix:V,labelToScreenMatrix:F,textPixelRatio:Z,holdingForFade:J,collisionBoxArray:ee,partiallyEvaluatedTextSize:oe,collisionGroup:le}=o.parameters,ce=x.get("text-optional"),he=x.get("icon-optional"),ne=l.ar(x,"text-overlap","text-allow-overlap"),me=ne==="always",ge=l.ar(x,"icon-overlap","icon-allow-overlap"),xe=ge==="always",Be=x.get("text-rotation-alignment")==="map",Fe=x.get("text-pitch-alignment")==="map",Qe=x.get("icon-text-fit")!=="none",st=x.get("symbol-z-order")==="viewport-y",Ye=me&&(xe||!y.hasIconData()||he),Ge=xe&&(me||!y.hasTextData()||ce);!y.collisionArrays&&ee&&y.deserializeCollisionBoxes(ee);const mt=this._getTerrainElevationFunc(this.retainedQueryData[y.bucketInstanceId].tileID),Bt=(Ke,nt,Dt)=>{var Fn,$t;if(d[Ke.crossTileID])return;if(J)return void(this.placements[Ke.crossTileID]=new Ut(!1,!1,!1));let Jt=!1,$n=!1,Oi=!0,io=null,jn={box:null,placeable:!1,offscreen:null},rr={box:null,placeable:!1,offscreen:null},Gi=null,Bi=null,Zi=null,Po=0,Ka=0,Du=0;nt.textFeatureIndex?Po=nt.textFeatureIndex:Ke.useRuntimeCollisionCircles&&(Po=Ke.featureIndex),nt.verticalTextFeatureIndex&&(Ka=nt.verticalTextFeatureIndex);const Ja=nt.textBox;if(Ja){const $r=Si=>{let zi=l.ah.horizontal;if(y.allowVerticalPlacement&&!Si&&this.prevPlacement){const xr=this.prevPlacement.placedOrientations[Ke.crossTileID];xr&&(this.placedOrientations[Ke.crossTileID]=xr,zi=xr,this.markUsedOrientation(y,zi,Ke))}return zi},jr=(Si,zi)=>{if(y.allowVerticalPlacement&&Ke.numVerticalGlyphVertices>0&&nt.verticalTextBox){for(const xr of y.writingModes)if(xr===l.ah.vertical?(jn=zi(),rr=jn):jn=Si(),jn&&jn.placeable)break}else jn=Si()},fs=Ke.textAnchorOffsetStartIndex,ro=Ke.textAnchorOffsetEndIndex;if(ro===fs){const Si=(zi,xr)=>{const tn=this.collisionIndex.placeCollisionBox(zi,ne,Z,O,N,Fe,Be,M,le.predicate,mt);return tn&&tn.placeable&&(this.markUsedOrientation(y,xr,Ke),this.placedOrientations[Ke.crossTileID]=xr),tn};jr(()=>Si(Ja,l.ah.horizontal),()=>{const zi=nt.verticalTextBox;return y.allowVerticalPlacement&&Ke.numVerticalGlyphVertices>0&&zi?Si(zi,l.ah.vertical):{box:null,offscreen:null}}),$r(jn&&jn.placeable)}else{let Si=l.aq[($t=(Fn=this.prevPlacement)===null||Fn===void 0?void 0:Fn.variableOffsets[Ke.crossTileID])===null||$t===void 0?void 0:$t.anchor];const zi=(tn,Js,Qa)=>{const el=tn.x2-tn.x1,Pm=tn.y2-tn.y1,I_=Ke.textBoxScale,Dm=Qe&&ge==="never"?Js:null;let ms=null,Om=ne==="never"?1:2,Bu="never";Si&&Om++;for(let nc=0;nc<Om;nc++){for(let zu=fs;zu<ro;zu++){const Nu=y.textAnchorOffsets.get(zu);if(Si&&Nu.textAnchor!==Si)continue;const tl=this.attemptAnchorPlacement(Nu,tn,el,Pm,I_,Be,Fe,Z,O,N,le,Bu,Ke,y,Qa,M,I,Dm,mt);if(tl&&(ms=tl.placedGlyphBoxes,ms&&ms.placeable))return Jt=!0,io=tl.shift,ms}Si?Si=null:Bu=ne}return m&&!ms&&(ms={box:this.collisionIndex.placeCollisionBox(Ja,"always",Z,O,N,Fe,Be,M,le.predicate,mt,new l.P(0,0)).box,offscreen:!1,placeable:!1}),ms};jr(()=>zi(Ja,nt.iconBox,l.ah.horizontal),()=>{const tn=nt.verticalTextBox;return y.allowVerticalPlacement&&(!jn||!jn.placeable)&&Ke.numVerticalGlyphVertices>0&&tn?zi(tn,nt.verticalIconBox,l.ah.vertical):{box:null,occluded:!0,offscreen:null}}),jn&&(Jt=jn.placeable,Oi=jn.offscreen);const xr=$r(jn&&jn.placeable);if(!Jt&&this.prevPlacement){const tn=this.prevPlacement.variableOffsets[Ke.crossTileID];tn&&(this.variableOffsets[Ke.crossTileID]=tn,this.markUsedJustification(y,tn.anchor,Ke,xr))}}}if(Gi=jn,Jt=Gi&&Gi.placeable,Oi=Gi&&Gi.offscreen,Ke.useRuntimeCollisionCircles){const $r=y.text.placedSymbolArray.get(Ke.centerJustifiedTextSymbolIndex),jr=l.ai(y.textSizeData,oe,$r),fs=x.get("text-padding");Bi=this.collisionIndex.placeCollisionCircles(ne,$r,y.lineVertexArray,y.glyphOffsetArray,jr,O,N,V,F,m,Fe,le.predicate,Ke.collisionCircleDiameter,fs,M,mt),Bi.circles.length&&Bi.collisionDetected&&!m&&l.w("Collisions detected, but collision boxes are not shown"),Jt=me||Bi.circles.length>0&&!Bi.collisionDetected,Oi=Oi&&Bi.offscreen}if(nt.iconFeatureIndex&&(Du=nt.iconFeatureIndex),nt.iconBox){const $r=jr=>this.collisionIndex.placeCollisionBox(jr,ge,Z,O,N,Fe,Be,I,le.predicate,mt,Qe&&io?io:void 0);rr&&rr.placeable&&nt.verticalIconBox?(Zi=$r(nt.verticalIconBox),$n=Zi.placeable):(Zi=$r(nt.iconBox),$n=Zi.placeable),Oi=Oi&&Zi.offscreen}const Fr=ce||Ke.numHorizontalGlyphVertices===0&&Ke.numVerticalGlyphVertices===0,Ou=he||Ke.numIconVertices===0;Fr||Ou?Ou?Fr||($n=$n&&Jt):Jt=$n&&Jt:$n=Jt=$n&&Jt;const Vd=$n&&Zi.placeable;if(Jt&&Gi.placeable&&this.collisionIndex.insertCollisionBox(Gi.box,ne,x.get("text-ignore-placement"),y.bucketInstanceId,rr&&rr.placeable&&Ka?Ka:Po,le.ID),Vd&&this.collisionIndex.insertCollisionBox(Zi.box,ge,x.get("icon-ignore-placement"),y.bucketInstanceId,Du,le.ID),Bi&&Jt&&this.collisionIndex.insertCollisionCircles(Bi.circles,ne,x.get("text-ignore-placement"),y.bucketInstanceId,Po,le.ID),m&&this.storeCollisionData(y.bucketInstanceId,Dt,nt,Gi,Zi,Bi),Ke.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");if(y.bucketInstanceId===0)throw new Error("bucket.bucketInstanceId can't be 0");this.placements[Ke.crossTileID]=new Ut(Jt||Ye,$n||Ge,Oi||y.justReloaded),d[Ke.crossTileID]=!0};if(st){if(o.symbolInstanceStart!==0)throw new Error("bucket.bucketInstanceId should be 0");const Ke=y.getSortedSymbolIndexes(this.transform.angle);for(let nt=Ke.length-1;nt>=0;--nt){const Dt=Ke[nt];Bt(y.symbolInstances.get(Dt),y.collisionArrays[Dt],Dt)}}else for(let Ke=o.symbolInstanceStart;Ke<o.symbolInstanceEnd;Ke++)Bt(y.symbolInstances.get(Ke),y.collisionArrays[Ke],Ke);if(m&&y.bucketInstanceId in this.collisionCircleArrays){const Ke=this.collisionCircleArrays[y.bucketInstanceId];l.as(Ke.invProjMatrix,O),Ke.viewportMatrix=this.collisionIndex.getViewportMatrix()}y.justReloaded=!1}storeCollisionData(o,d,m,y,x,M){if(m.textBox||m.iconBox){let I,O;this.collisionBoxArrays.has(o)?I=this.collisionBoxArrays.get(o):(I=new Map,this.collisionBoxArrays.set(o,I)),I.has(d)?O=I.get(d):(O={text:null,icon:null},I.set(d,O)),m.textBox&&(O.text=y.box),m.iconBox&&(O.icon=x.box)}if(M){let I=this.collisionCircleArrays[o];I===void 0&&(I=this.collisionCircleArrays[o]=new wn);for(let O=0;O<M.circles.length;O+=4)I.circles.push(M.circles[O+0]),I.circles.push(M.circles[O+1]),I.circles.push(M.circles[O+2]),I.circles.push(M.collisionDetected?1:0)}}markUsedJustification(o,d,m,y){let x;x=y===l.ah.vertical?m.verticalPlacedTextSymbolIndex:{left:m.leftJustifiedTextSymbolIndex,center:m.centerJustifiedTextSymbolIndex,right:m.rightJustifiedTextSymbolIndex}[l.at(d)];const M=[m.leftJustifiedTextSymbolIndex,m.centerJustifiedTextSymbolIndex,m.rightJustifiedTextSymbolIndex,m.verticalPlacedTextSymbolIndex];for(const I of M)I>=0&&(o.text.placedSymbolArray.get(I).crossTileID=x>=0&&I!==x?0:m.crossTileID)}markUsedOrientation(o,d,m){const y=d===l.ah.horizontal||d===l.ah.horizontalOnly?d:0,x=d===l.ah.vertical?d:0,M=[m.leftJustifiedTextSymbolIndex,m.centerJustifiedTextSymbolIndex,m.rightJustifiedTextSymbolIndex];for(const I of M)o.text.placedSymbolArray.get(I).placedOrientation=y;m.verticalPlacedTextSymbolIndex&&(o.text.placedSymbolArray.get(m.verticalPlacedTextSymbolIndex).placedOrientation=x)}commit(o){this.commitTime=o,this.zoomAtLastRecencyCheck=this.transform.zoom;const d=this.prevPlacement;let m=!1;this.prevZoomAdjustment=d?d.zoomAdjustment(this.transform.zoom):0;const y=d?d.symbolFadeChange(o):1,x=d?d.opacities:{},M=d?d.variableOffsets:{},I=d?d.placedOrientations:{};for(const O in this.placements){const N=this.placements[O],V=x[O];V?(this.opacities[O]=new Zn(V,y,N.text,N.icon),m=m||N.text!==V.text.placed||N.icon!==V.icon.placed):(this.opacities[O]=new Zn(null,y,N.text,N.icon,N.skipFade),m=m||N.text||N.icon)}for(const O in x){const N=x[O];if(!this.opacities[O]){const V=new Zn(N,y,!1,!1);V.isHidden()||(this.opacities[O]=V,m=m||N.text.placed||N.icon.placed)}}for(const O in M)this.variableOffsets[O]||!this.opacities[O]||this.opacities[O].isHidden()||(this.variableOffsets[O]=M[O]);for(const O in I)this.placedOrientations[O]||!this.opacities[O]||this.opacities[O].isHidden()||(this.placedOrientations[O]=I[O]);if(d&&d.lastPlacementChangeTime===void 0)throw new Error("Last placement time for previous placement is not defined");m?this.lastPlacementChangeTime=o:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=d?d.lastPlacementChangeTime:o)}updateLayerOpacities(o,d){const m={};for(const y of d){const x=y.getBucket(o);x&&y.latestFeatureIndex&&o.id===x.layerIds[0]&&this.updateBucketOpacities(x,y.tileID,m,y.collisionBoxArray)}}updateBucketOpacities(o,d,m,y){o.hasTextData()&&(o.text.opacityVertexArray.clear(),o.text.hasVisibleVertices=!1),o.hasIconData()&&(o.icon.opacityVertexArray.clear(),o.icon.hasVisibleVertices=!1),o.hasIconCollisionBoxData()&&o.iconCollisionBox.collisionVertexArray.clear(),o.hasTextCollisionBoxData()&&o.textCollisionBox.collisionVertexArray.clear();const x=o.layers[0],M=x.layout,I=new Zn(null,0,!1,!1,!0),O=M.get("text-allow-overlap"),N=M.get("icon-allow-overlap"),V=x._unevaluatedLayout.hasValue("text-variable-anchor")||x._unevaluatedLayout.hasValue("text-variable-anchor-offset"),F=M.get("text-rotation-alignment")==="map",Z=M.get("text-pitch-alignment")==="map",J=M.get("icon-text-fit")!=="none",ee=new Zn(null,0,O&&(N||!o.hasIconData()||M.get("icon-optional")),N&&(O||!o.hasTextData()||M.get("text-optional")),!0);!o.collisionArrays&&y&&(o.hasIconCollisionBoxData()||o.hasTextCollisionBoxData())&&o.deserializeCollisionBoxes(y);const oe=(ce,he,ne)=>{for(let me=0;me<he/4;me++)ce.opacityVertexArray.emplaceBack(ne);ce.hasVisibleVertices=ce.hasVisibleVertices||ne!==Ia},le=this.collisionBoxArrays.get(o.bucketInstanceId);for(let ce=0;ce<o.symbolInstances.length;ce++){const he=o.symbolInstances.get(ce),{numHorizontalGlyphVertices:ne,numVerticalGlyphVertices:me,crossTileID:ge}=he;let xe=this.opacities[ge];m[ge]?xe=I:xe||(xe=ee,this.opacities[ge]=xe),m[ge]=!0;const Be=he.numIconVertices>0,Fe=this.placedOrientations[he.crossTileID],Qe=Fe===l.ah.vertical,st=Fe===l.ah.horizontal||Fe===l.ah.horizontalOnly;if(ne>0||me>0){const Ge=yr(xe.text);oe(o.text,ne,Qe?Ia:Ge),oe(o.text,me,st?Ia:Ge);const mt=xe.text.isHidden();[he.rightJustifiedTextSymbolIndex,he.centerJustifiedTextSymbolIndex,he.leftJustifiedTextSymbolIndex].forEach(nt=>{nt>=0&&(o.text.placedSymbolArray.get(nt).hidden=mt||Qe?1:0)}),he.verticalPlacedTextSymbolIndex>=0&&(o.text.placedSymbolArray.get(he.verticalPlacedTextSymbolIndex).hidden=mt||st?1:0);const Bt=this.variableOffsets[he.crossTileID];Bt&&this.markUsedJustification(o,Bt.anchor,he,Fe);const Ke=this.placedOrientations[he.crossTileID];Ke&&(this.markUsedJustification(o,"left",he,Ke),this.markUsedOrientation(o,Ke,he))}if(Be){const Ge=yr(xe.icon),mt=!(J&&he.verticalPlacedIconSymbolIndex&&Qe);he.placedIconSymbolIndex>=0&&(oe(o.icon,he.numIconVertices,mt?Ge:Ia),o.icon.placedSymbolArray.get(he.placedIconSymbolIndex).hidden=xe.icon.isHidden()),he.verticalPlacedIconSymbolIndex>=0&&(oe(o.icon,he.numVerticalIconVertices,mt?Ia:Ge),o.icon.placedSymbolArray.get(he.verticalPlacedIconSymbolIndex).hidden=xe.icon.isHidden())}const Ye=le&&le.has(ce)?le.get(ce):{text:null,icon:null};if(o.hasIconCollisionBoxData()||o.hasTextCollisionBoxData()){const Ge=o.collisionArrays[ce];if(Ge){let mt=new l.P(0,0);if(Ge.textBox||Ge.verticalTextBox){let Bt=!0;if(V){const Ke=this.variableOffsets[ge];Ke?(mt=ki(Ke.anchor,Ke.width,Ke.height,Ke.textOffset,Ke.textBoxScale),F&&mt._rotate(Z?this.transform.angle:-this.transform.angle)):Bt=!1}if(Ge.textBox||Ge.verticalTextBox){let Ke;Ge.textBox&&(Ke=Qe),Ge.verticalTextBox&&(Ke=st),Aa(o.textCollisionBox.collisionVertexArray,xe.text.placed,!Bt||Ke,Ye.text,mt.x,mt.y)}}if(Ge.iconBox||Ge.verticalIconBox){const Bt=!!(!st&&Ge.verticalIconBox);let Ke;Ge.iconBox&&(Ke=Bt),Ge.verticalIconBox&&(Ke=!Bt),Aa(o.iconCollisionBox.collisionVertexArray,xe.icon.placed,Ke,Ye.icon,J?mt.x:0,J?mt.y:0)}}}}if(o.sortFeatures(this.transform.angle),this.retainedQueryData[o.bucketInstanceId]&&(this.retainedQueryData[o.bucketInstanceId].featureSortOrder=o.featureSortOrder),o.hasTextData()&&o.text.opacityVertexBuffer&&o.text.opacityVertexBuffer.updateData(o.text.opacityVertexArray),o.hasIconData()&&o.icon.opacityVertexBuffer&&o.icon.opacityVertexBuffer.updateData(o.icon.opacityVertexArray),o.hasIconCollisionBoxData()&&o.iconCollisionBox.collisionVertexBuffer&&o.iconCollisionBox.collisionVertexBuffer.updateData(o.iconCollisionBox.collisionVertexArray),o.hasTextCollisionBoxData()&&o.textCollisionBox.collisionVertexBuffer&&o.textCollisionBox.collisionVertexBuffer.updateData(o.textCollisionBox.collisionVertexArray),o.text.opacityVertexArray.length!==o.text.layoutVertexArray.length/4)throw new Error(`bucket.text.opacityVertexArray.length (= ${o.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${o.text.layoutVertexArray.length}) / 4`);if(o.icon.opacityVertexArray.length!==o.icon.layoutVertexArray.length/4)throw new Error(`bucket.icon.opacityVertexArray.length (= ${o.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${o.icon.layoutVertexArray.length}) / 4`);if(o.bucketInstanceId in this.collisionCircleArrays){const ce=this.collisionCircleArrays[o.bucketInstanceId];o.placementInvProjMatrix=ce.invProjMatrix,o.placementViewportMatrix=ce.viewportMatrix,o.collisionCircleArray=ce.circles,delete this.collisionCircleArrays[o.bucketInstanceId]}}symbolFadeChange(o){return this.fadeDuration===0?1:(o-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(o){return Math.max(0,(this.transform.zoom-o)/1.5)}hasTransitions(o){return this.stale||o-this.lastPlacementChangeTime<this.fadeDuration}stillRecent(o,d){const m=this.zoomAtLastRecencyCheck===d?1-this.zoomAdjustment(d):1;return this.zoomAtLastRecencyCheck=d,this.commitTime+this.fadeDuration*m>o}setStale(){this.stale=!0}}function Aa(v,o,d,m,y,x){m&&m.length!==0||(m=[0,0,0,0]);const M=m[0]-Lt,I=m[1]-Lt,O=m[2]-Lt,N=m[3]-Lt;v.emplaceBack(o?1:0,d?1:0,y||0,x||0,M,I),v.emplaceBack(o?1:0,d?1:0,y||0,x||0,O,I),v.emplaceBack(o?1:0,d?1:0,y||0,x||0,O,N),v.emplaceBack(o?1:0,d?1:0,y||0,x||0,M,N)}const kn=Math.pow(2,25),Xh=Math.pow(2,24),Kh=Math.pow(2,17),mr=Math.pow(2,16),gr=Math.pow(2,9),r_=Math.pow(2,8),Nr=Math.pow(2,1);function yr(v){if(v.opacity===0&&!v.placed)return 0;if(v.opacity===1&&v.placed)return 4294967295;const o=v.placed?1:0,d=Math.floor(127*v.opacity);return d*kn+o*Xh+d*Kh+o*mr+d*gr+o*r_+d*Nr+o}const Ia=0;function Fs(){return{isOccluded:(v,o,d)=>!1,getPitchedTextCorrection:(v,o,d)=>1,get useSpecialProjectionForSymbols(){return!1},projectTileCoordinates(v,o,d,m){throw new Error("Not implemented.")},translatePosition:(v,o,d,m)=>function(y,x,M,I,O=!1){if(!M[0]&&!M[1])return[0,0];const N=O?I==="map"?y.angle:0:I==="viewport"?-y.angle:0;if(N){const V=Math.sin(N),F=Math.cos(N);M=[M[0]*F-M[1]*V,M[0]*V+M[1]*F]}return[O?M[0]:Kt(x,M[0],y.zoom),O?M[1]:Kt(x,M[1],y.zoom)]}(v,o,d,m),getCircleRadiusCorrection:v=>1}}class si{constructor(o){this._sortAcrossTiles=o.layout.get("symbol-z-order")!=="viewport-y"&&!o.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(o,d,m,y,x){const M=this._bucketParts;for(;this._currentTileIndex<o.length;)if(d.getBucketParts(M,y,o[this._currentTileIndex],this._sortAcrossTiles),this._currentTileIndex++,x())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,M.sort((I,O)=>I.sortKey-O.sortKey));this._currentPartIndex<M.length;)if(d.placeLayerBucketPart(M[this._currentPartIndex],this._seenCrossTileIDs,m),this._currentPartIndex++,x())return!0;return!1}}class Ll{constructor(o,d,m,y,x,M,I,O){this.placement=new Wi(o,Fs(),d,M,I,O),this._currentPlacementIndex=m.length-1,this._forceFullPlacement=y,this._showCollisionBoxes=x,this._done=!1}isDone(){return this._done}continuePlacement(o,d,m){const y=E.now(),x=()=>!this._forceFullPlacement&&E.now()-y>2;for(;this._currentPlacementIndex>=0;){const M=d[o[this._currentPlacementIndex]],I=this.placement.collisionIndex.transform.zoom;if(M.type==="symbol"&&(!M.minzoom||M.minzoom<=I)&&(!M.maxzoom||M.maxzoom>I)){if(this._inProgressLayer||(this._inProgressLayer=new si(M)),this._inProgressLayer.continuePlacement(m[M.source],this.placement,this._showCollisionBoxes,M,x))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(o){return this.placement.commit(o),this.placement}}const Jr=512/l.X/2;class ni{constructor(o,d,m){this.tileID=o,this.bucketInstanceId=m,this._symbolsByKey={};const y=new Map;for(let x=0;x<d.length;x++){const M=d.get(x),I=M.key,O=y.get(I);O?O.push(M):y.set(I,[M])}for(const[x,M]of y){const I={positions:M.map(O=>({x:Math.floor(O.anchorX*Jr),y:Math.floor(O.anchorY*Jr)})),crossTileIDs:M.map(O=>O.crossTileID)};if(I.positions.length>128){const O=new l.av(I.positions.length,16,Uint16Array);for(const{x:N,y:V}of I.positions)O.add(N,V);O.finish(),delete I.positions,I.index=O}this._symbolsByKey[x]=I}}getScaledCoordinates(o,d){const{x:m,y,z:x}=this.tileID.canonical,{x:M,y:I,z:O}=d.canonical,N=Jr/Math.pow(2,O-x),V=(I*l.X+o.anchorY)*N,F=y*l.X*Jr;return{x:Math.floor((M*l.X+o.anchorX)*N-m*l.X*Jr),y:Math.floor(V-F)}}findMatches(o,d,m){const y=this.tileID.canonical.z<d.canonical.z?1:Math.pow(2,this.tileID.canonical.z-d.canonical.z);for(let x=0;x<o.length;x++){const M=o.get(x);if(M.crossTileID)continue;const I=this._symbolsByKey[M.key];if(!I)continue;const O=this.getScaledCoordinates(M,d);if(I.index){const N=I.index.range(O.x-y,O.y-y,O.x+y,O.y+y).sort();for(const V of N){const F=I.crossTileIDs[V];if(!m[F]){m[F]=!0,M.crossTileID=F;break}}}else if(I.positions)for(let N=0;N<I.positions.length;N++){const V=I.positions[N],F=I.crossTileIDs[N];if(Math.abs(V.x-O.x)<=y&&Math.abs(V.y-O.y)<=y&&!m[F]){m[F]=!0,M.crossTileID=F;break}}}}getCrossTileIDsLists(){return Object.values(this._symbolsByKey).map(({crossTileIDs:o})=>o)}}class tu{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class Qr{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(o){const d=Math.round((o-this.lng)/360);if(d!==0)for(const m in this.indexes){const y=this.indexes[m],x={};for(const M in y){const I=y[M];I.tileID=I.tileID.unwrapTo(I.tileID.wrap+d),x[I.tileID.key]=I}this.indexes[m]=x}this.lng=o}addBucket(o,d,m){if(this.indexes[o.overscaledZ]&&this.indexes[o.overscaledZ][o.key]){if(this.indexes[o.overscaledZ][o.key].bucketInstanceId===d.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(o.overscaledZ,this.indexes[o.overscaledZ][o.key])}for(let x=0;x<d.symbolInstances.length;x++)d.symbolInstances.get(x).crossTileID=0;this.usedCrossTileIDs[o.overscaledZ]||(this.usedCrossTileIDs[o.overscaledZ]={});const y=this.usedCrossTileIDs[o.overscaledZ];for(const x in this.indexes){const M=this.indexes[x];if(Number(x)>o.overscaledZ)for(const I in M){const O=M[I];O.tileID.isChildOf(o)&&O.findMatches(d.symbolInstances,o,y)}else{const I=M[o.scaledTo(Number(x)).key];I&&I.findMatches(d.symbolInstances,o,y)}}for(let x=0;x<d.symbolInstances.length;x++){const M=d.symbolInstances.get(x);M.crossTileID||(M.crossTileID=m.generate(),y[M.crossTileID]=!0)}return this.indexes[o.overscaledZ]===void 0&&(this.indexes[o.overscaledZ]={}),this.indexes[o.overscaledZ][o.key]=new ni(o,d.symbolInstances,d.bucketInstanceId),!0}removeBucketCrossTileIDs(o,d){for(const m of d.getCrossTileIDsLists())for(const y of m)delete this.usedCrossTileIDs[o][y]}removeStaleBuckets(o){let d=!1;for(const m in this.indexes){const y=this.indexes[m];for(const x in y)o[y[x].bucketInstanceId]||(this.removeBucketCrossTileIDs(m,y[x]),delete y[x],d=!0)}return d}}class Jh{constructor(){this.layerIndexes={},this.crossTileIDs=new tu,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(o,d,m){let y=this.layerIndexes[o.id];y===void 0&&(y=this.layerIndexes[o.id]=new Qr);let x=!1;const M={};y.handleWrapJump(m);for(const I of d){const O=I.getBucket(o);O&&o.id===O.layerIds[0]&&(O.bucketInstanceId||(O.bucketInstanceId=++this.maxBucketInstanceId),y.addBucket(I.tileID,O,this.crossTileIDs)&&(x=!0),M[O.bucketInstanceId]=!0)}return y.removeStaleBuckets(M)&&(x=!0),x}pruneUnusedLayers(o){const d={};o.forEach(m=>{d[m]=!0});for(const m in this.layerIndexes)d[m]||delete this.layerIndexes[m]}}const eo=(v,o)=>l.t(v,o&&o.filter(d=>d.identifier!=="source.canvas")),o_=l.aw();class nu extends l.E{constructor(o,d={}){super(),this._rtlPluginLoaded=()=>{for(const m in this.sourceCaches){const y=this.sourceCaches[m].getSource().type;y!=="vector"&&y!=="geojson"||this.sourceCaches[m].reload()}},this.map=o,this.dispatcher=new ct(De(),o._getMapId()),this.dispatcher.registerMessageHandler("GG",(m,y)=>this.getGlyphs(m,y)),this.dispatcher.registerMessageHandler("GI",(m,y)=>this.getImages(m,y)),this.imageManager=new ot,this.imageManager.setEventedParent(this),this.glyphManager=new Ft(o._requestManager,d.localIdeographFontFamily),this.lineAtlas=new ti(256,512),this.crossTileSymbolIndex=new Jh,this._spritesImagesIds={},this._layers={},this._order=[],this.sourceCaches={},this.zoomHistory=new l.ax,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast("SR",l.ay()),zr().on(Ve,this._rtlPluginLoaded),this.on("data",m=>{if(m.dataType!=="source"||m.sourceDataType!=="metadata")return;const y=this.sourceCaches[m.sourceId];if(!y)return;const x=y.getSource();if(x&&x.vectorLayerIds)for(const M in this._layers){const I=this._layers[M];I.source===x.id&&this._validateLayer(I)}})}loadURL(o,d={},m){this.fire(new l.k("dataloading",{dataType:"style"})),d.validate=typeof d.validate!="boolean"||d.validate;const y=this.map._requestManager.transformRequest(o,"Style");this._loadStyleRequest=new AbortController;const x=this._loadStyleRequest;l.h(y,this._loadStyleRequest).then(M=>{this._loadStyleRequest=null,this._load(M.data,d,m)}).catch(M=>{this._loadStyleRequest=null,M&&!x.signal.aborted&&this.fire(new l.j(M))})}loadJSON(o,d={},m){this.fire(new l.k("dataloading",{dataType:"style"})),this._frameRequest=new AbortController,E.frameAsync(this._frameRequest).then(()=>{this._frameRequest=null,d.validate=d.validate!==!1,this._load(o,d,m)}).catch(()=>{})}loadEmpty(){this.fire(new l.k("dataloading",{dataType:"style"})),this._load(o_,{validate:!1})}_load(o,d,m){var y;const x=d.transformStyle?d.transformStyle(m,o):o;if(!d.validate||!eo(this,l.u(x))){this._loaded=!0,this.stylesheet=x;for(const M in x.sources)this.addSource(M,x.sources[M],{validate:!1});x.sprite?this._loadSprite(x.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(x.glyphs),this._createLayers(),this.light=new dn(this.stylesheet.light),this.sky=new pn(this.stylesheet.sky),this.map.setTerrain((y=this.stylesheet.terrain)!==null&&y!==void 0?y:null),this.fire(new l.k("data",{dataType:"style"})),this.fire(new l.k("style.load"))}}_createLayers(){const o=l.az(this.stylesheet.layers);this.dispatcher.broadcast("SL",o),this._order=o.map(d=>d.id),this._layers={},this._serializedLayers=null;for(const d of o){const m=l.aA(d);m.setEventedParent(this,{layer:{id:d.id}}),this._layers[d.id]=m}}_loadSprite(o,d=!1,m=void 0){let y;this.imageManager.setLoaded(!1),this._spriteRequest=new AbortController,function(x,M,I,O){return l._(this,void 0,void 0,function*(){const N=Ae(x),V=I>1?"@2x":"",F={},Z={};for(const{id:J,url:ee}of N){const oe=M.transformRequest($e(ee,V,".json"),"SpriteJSON");F[J]=l.h(oe,O);const le=M.transformRequest($e(ee,V,".png"),"SpriteImage");Z[J]=G.getImage(le,O)}return yield Promise.all([...Object.values(F),...Object.values(Z)]),function(J,ee){return l._(this,void 0,void 0,function*(){const oe={};for(const le in J){oe[le]={};const ce=E.getImageCanvasContext((yield ee[le]).data),he=(yield J[le]).data;for(const ne in he){const{width:me,height:ge,x:xe,y:Be,sdf:Fe,pixelRatio:Qe,stretchX:st,stretchY:Ye,content:Ge,textFitWidth:mt,textFitHeight:Bt}=he[ne];oe[le][ne]={data:null,pixelRatio:Qe,sdf:Fe,stretchX:st,stretchY:Ye,content:Ge,textFitWidth:mt,textFitHeight:Bt,spriteData:{width:me,height:ge,x:xe,y:Be,context:ce}}}}return oe})}(F,Z)})}(o,this.map._requestManager,this.map.getPixelRatio(),this._spriteRequest).then(x=>{if(this._spriteRequest=null,x)for(const M in x){this._spritesImagesIds[M]=[];const I=this._spritesImagesIds[M]?this._spritesImagesIds[M].filter(O=>!(O in x)):[];for(const O of I)this.imageManager.removeImage(O),this._changedImages[O]=!0;for(const O in x[M]){const N=M==="default"?O:`${M}:${O}`;this._spritesImagesIds[M].push(N),N in this.imageManager.images?this.imageManager.updateImage(N,x[M][O],!1):this.imageManager.addImage(N,x[M][O]),d&&(this._changedImages[N]=!0)}}}).catch(x=>{this._spriteRequest=null,y=x,this.fire(new l.j(y))}).finally(()=>{this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),d&&(this._changed=!0),this.dispatcher.broadcast("SI",this._availableImages),this.fire(new l.k("data",{dataType:"style"})),m&&m(y)})}_unloadSprite(){for(const o of Object.values(this._spritesImagesIds).flat())this.imageManager.removeImage(o),this._changedImages[o]=!0;this._spritesImagesIds={},this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new l.k("data",{dataType:"style"}))}_validateLayer(o){const d=this.sourceCaches[o.source];if(!d)return;const m=o.sourceLayer;if(!m)return;const y=d.getSource();(y.type==="geojson"||y.vectorLayerIds&&y.vectorLayerIds.indexOf(m)===-1)&&this.fire(new l.j(new Error(`Source layer "${m}" does not exist on source "${y.id}" as specified by style layer "${o.id}".`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(const o in this.sourceCaches)if(!this.sourceCaches[o].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeByIds(o,d=!1){const m=this._serializedAllLayers();if(!o||o.length===0)return Object.values(d?l.aB(m):m);const y=[];for(const x of o)if(m[x]){const M=d?l.aB(m[x]):m[x];y.push(M)}return y}_serializedAllLayers(){let o=this._serializedLayers;if(o)return o;o=this._serializedLayers={};const d=Object.keys(this._layers);for(const m of d){const y=this._layers[m];y.type!=="custom"&&(o[m]=y.serialize())}return o}hasTransitions(){if(this.light&&this.light.hasTransition()||this.sky&&this.sky.hasTransition())return!0;for(const o in this.sourceCaches)if(this.sourceCaches[o].hasTransition())return!0;for(const o in this._layers)if(this._layers[o].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading.")}update(o){if(!this._loaded)return;const d=this._changed;if(d){const y=Object.keys(this._updatedLayers),x=Object.keys(this._removedLayers);(y.length||x.length)&&this._updateWorkerLayers(y,x);for(const M in this._updatedSources){const I=this._updatedSources[M];if(I==="reload")this._reloadSource(M);else{if(I!=="clear")throw new Error(`Invalid action ${I}`);this._clearSource(M)}}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(const M in this._updatedPaintProps)this._layers[M].updateTransitions(o);this.light.updateTransitions(o),this.sky.updateTransitions(o),this._resetUpdates()}const m={};for(const y in this.sourceCaches){const x=this.sourceCaches[y];m[y]=x.used,x.used=!1}for(const y of this._order){const x=this._layers[y];x.recalculate(o,this._availableImages),!x.isHidden(o.zoom)&&x.source&&(this.sourceCaches[x.source].used=!0)}for(const y in m){const x=this.sourceCaches[y];!!m[y]!=!!x.used&&x.fire(new l.k("data",{sourceDataType:"visibility",dataType:"source",sourceId:y}))}this.light.recalculate(o),this.sky.recalculate(o),this.z=o.zoom,d&&this.fire(new l.k("data",{dataType:"style"}))}_updateTilesForChangedImages(){const o=Object.keys(this._changedImages);if(o.length){for(const d in this.sourceCaches)this.sourceCaches[d].reloadTilesForDependencies(["icons","patterns"],o);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(const o in this.sourceCaches)this.sourceCaches[o].reloadTilesForDependencies(["glyphs"],[""]);this._glyphsDidChange=!1}}_updateWorkerLayers(o,d){this.dispatcher.broadcast("UL",{layers:this._serializeByIds(o,!1),removedIds:d})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(o,d={}){var m;this._checkLoaded();const y=this.serialize();if(o=d.transformStyle?d.transformStyle(y,o):o,((m=d.validate)===null||m===void 0||m)&&eo(this,l.u(o)))return!1;(o=l.aB(o)).layers=l.az(o.layers);const x=l.aC(y,o),M=this._getOperationsToPerform(x);if(M.unimplemented.length>0)throw new Error(`Unimplemented: ${M.unimplemented.join(", ")}.`);if(M.operations.length===0)return!1;for(const I of M.operations)I();return this.stylesheet=o,this._serializedLayers=null,!0}_getOperationsToPerform(o){const d=[],m=[];for(const y of o)switch(y.command){case"setCenter":case"setZoom":case"setBearing":case"setPitch":continue;case"addLayer":d.push(()=>this.addLayer.apply(this,y.args));break;case"removeLayer":d.push(()=>this.removeLayer.apply(this,y.args));break;case"setPaintProperty":d.push(()=>this.setPaintProperty.apply(this,y.args));break;case"setLayoutProperty":d.push(()=>this.setLayoutProperty.apply(this,y.args));break;case"setFilter":d.push(()=>this.setFilter.apply(this,y.args));break;case"addSource":d.push(()=>this.addSource.apply(this,y.args));break;case"removeSource":d.push(()=>this.removeSource.apply(this,y.args));break;case"setLayerZoomRange":d.push(()=>this.setLayerZoomRange.apply(this,y.args));break;case"setLight":d.push(()=>this.setLight.apply(this,y.args));break;case"setGeoJSONSourceData":d.push(()=>this.setGeoJSONSourceData.apply(this,y.args));break;case"setGlyphs":d.push(()=>this.setGlyphs.apply(this,y.args));break;case"setSprite":d.push(()=>this.setSprite.apply(this,y.args));break;case"setSky":d.push(()=>this.setSky.apply(this,y.args));break;case"setTerrain":d.push(()=>this.map.setTerrain.apply(this,y.args));break;case"setTransition":d.push(()=>{});break;default:m.push(y.command)}return{operations:d,unimplemented:m}}addImage(o,d){if(this.getImage(o))return this.fire(new l.j(new Error(`An image named "${o}" already exists.`)));this.imageManager.addImage(o,d),this._afterImageUpdated(o)}updateImage(o,d){this.imageManager.updateImage(o,d)}getImage(o){return this.imageManager.getImage(o)}removeImage(o){if(!this.getImage(o))return this.fire(new l.j(new Error(`An image named "${o}" does not exist.`)));this.imageManager.removeImage(o),this._afterImageUpdated(o)}_afterImageUpdated(o){this._availableImages=this.imageManager.listImages(),this._changedImages[o]=!0,this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new l.k("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(o,d,m={}){if(this._checkLoaded(),this.sourceCaches[o]!==void 0)throw new Error(`Source "${o}" already exists.`);if(!d.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(d).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(d.type)>=0&&this._validate(l.u.source,`sources.${o}`,d,null,m))return;this.map&&this.map._collectResourceTiming&&(d.collectResourceTiming=!0);const y=this.sourceCaches[o]=new Re(o,d,this.dispatcher);y.style=this,y.setEventedParent(this,()=>({isSourceLoaded:y.loaded(),source:y.serialize(),sourceId:o})),y.onAdd(this.map),this._changed=!0}removeSource(o){if(this._checkLoaded(),this.sourceCaches[o]===void 0)throw new Error("There is no source with this ID");for(const m in this._layers)if(this._layers[m].source===o)return this.fire(new l.j(new Error(`Source "${o}" cannot be removed while layer "${m}" is using it.`)));const d=this.sourceCaches[o];delete this.sourceCaches[o],delete this._updatedSources[o],d.fire(new l.k("data",{sourceDataType:"metadata",dataType:"source",sourceId:o})),d.setEventedParent(null),d.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(o,d){if(this._checkLoaded(),this.sourceCaches[o]===void 0)throw new Error(`There is no source with this ID=${o}`);const m=this.sourceCaches[o].getSource();if(m.type!=="geojson")throw new Error(`geojsonSource.type is ${m.type}, which is !== 'geojson`);m.setData(d),this._changed=!0}getSource(o){return this.sourceCaches[o]&&this.sourceCaches[o].getSource()}addLayer(o,d,m={}){this._checkLoaded();const y=o.id;if(this.getLayer(y))return void this.fire(new l.j(new Error(`Layer "${y}" already exists on this map.`)));let x;if(o.type==="custom"){if(eo(this,l.aD(o)))return;x=l.aA(o)}else{if("source"in o&&typeof o.source=="object"&&(this.addSource(y,o.source),o=l.aB(o),o=l.e(o,{source:y})),this._validate(l.u.layer,`layers.${y}`,o,{arrayIndex:-1},m))return;x=l.aA(o),this._validateLayer(x),x.setEventedParent(this,{layer:{id:y}})}const M=d?this._order.indexOf(d):this._order.length;if(d&&M===-1)this.fire(new l.j(new Error(`Cannot add layer "${y}" before non-existing layer "${d}".`)));else{if(this._order.splice(M,0,y),this._layerOrderChanged=!0,this._layers[y]=x,this._removedLayers[y]&&x.source&&x.type!=="custom"){const I=this._removedLayers[y];delete this._removedLayers[y],I.type!==x.type?this._updatedSources[x.source]="clear":(this._updatedSources[x.source]="reload",this.sourceCaches[x.source].pause())}this._updateLayer(x),x.onAdd&&x.onAdd(this.map)}}moveLayer(o,d){if(this._checkLoaded(),this._changed=!0,!this._layers[o])return void this.fire(new l.j(new Error(`The layer '${o}' does not exist in the map's style and cannot be moved.`)));if(o===d)return;const m=this._order.indexOf(o);this._order.splice(m,1);const y=d?this._order.indexOf(d):this._order.length;d&&y===-1?this.fire(new l.j(new Error(`Cannot move layer "${o}" before non-existing layer "${d}".`))):(this._order.splice(y,0,o),this._layerOrderChanged=!0)}removeLayer(o){this._checkLoaded();const d=this._layers[o];if(!d)return void this.fire(new l.j(new Error(`Cannot remove non-existing layer "${o}".`)));d.setEventedParent(null);const m=this._order.indexOf(o);this._order.splice(m,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[o]=d,delete this._layers[o],this._serializedLayers&&delete this._serializedLayers[o],delete this._updatedLayers[o],delete this._updatedPaintProps[o],d.onRemove&&d.onRemove(this.map)}getLayer(o){return this._layers[o]}getLayersOrder(){return[...this._order]}hasLayer(o){return o in this._layers}setLayerZoomRange(o,d,m){this._checkLoaded();const y=this.getLayer(o);y?y.minzoom===d&&y.maxzoom===m||(d!=null&&(y.minzoom=d),m!=null&&(y.maxzoom=m),this._updateLayer(y)):this.fire(new l.j(new Error(`Cannot set the zoom range of non-existing layer "${o}".`)))}setFilter(o,d,m={}){this._checkLoaded();const y=this.getLayer(o);if(y){if(!l.aE(y.filter,d))return d==null?(y.filter=void 0,void this._updateLayer(y)):void(this._validate(l.u.filter,`layers.${y.id}.filter`,d,null,m)||(y.filter=l.aB(d),this._updateLayer(y)))}else this.fire(new l.j(new Error(`Cannot filter non-existing layer "${o}".`)))}getFilter(o){return l.aB(this.getLayer(o).filter)}setLayoutProperty(o,d,m,y={}){this._checkLoaded();const x=this.getLayer(o);x?l.aE(x.getLayoutProperty(d),m)||(x.setLayoutProperty(d,m,y),this._updateLayer(x)):this.fire(new l.j(new Error(`Cannot style non-existing layer "${o}".`)))}getLayoutProperty(o,d){const m=this.getLayer(o);if(m)return m.getLayoutProperty(d);this.fire(new l.j(new Error(`Cannot get style of non-existing layer "${o}".`)))}setPaintProperty(o,d,m,y={}){this._checkLoaded();const x=this.getLayer(o);x?l.aE(x.getPaintProperty(d),m)||(x.setPaintProperty(d,m,y)&&this._updateLayer(x),this._changed=!0,this._updatedPaintProps[o]=!0,this._serializedLayers=null):this.fire(new l.j(new Error(`Cannot style non-existing layer "${o}".`)))}getPaintProperty(o,d){return this.getLayer(o).getPaintProperty(d)}setFeatureState(o,d){this._checkLoaded();const m=o.source,y=o.sourceLayer,x=this.sourceCaches[m];if(x===void 0)return void this.fire(new l.j(new Error(`The source '${m}' does not exist in the map's style.`)));const M=x.getSource().type;M==="geojson"&&y?this.fire(new l.j(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):M!=="vector"||y?(o.id===void 0&&this.fire(new l.j(new Error("The feature id parameter must be provided."))),x.setFeatureState(y,o.id,d)):this.fire(new l.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(o,d){this._checkLoaded();const m=o.source,y=this.sourceCaches[m];if(y===void 0)return void this.fire(new l.j(new Error(`The source '${m}' does not exist in the map's style.`)));const x=y.getSource().type,M=x==="vector"?o.sourceLayer:void 0;x!=="vector"||M?d&&typeof o.id!="string"&&typeof o.id!="number"?this.fire(new l.j(new Error("A feature id is required to remove its specific state property."))):y.removeFeatureState(M,o.id,d):this.fire(new l.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(o){this._checkLoaded();const d=o.source,m=o.sourceLayer,y=this.sourceCaches[d];if(y!==void 0)return y.getSource().type!=="vector"||m?(o.id===void 0&&this.fire(new l.j(new Error("The feature id parameter must be provided."))),y.getFeatureState(m,o.id)):void this.fire(new l.j(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new l.j(new Error(`The source '${d}' does not exist in the map's style.`)))}getTransition(){return l.e({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){if(!this._loaded)return;const o=l.aF(this.sourceCaches,x=>x.serialize()),d=this._serializeByIds(this._order,!0),m=this.map.getTerrain()||void 0,y=this.stylesheet;return l.aG({version:y.version,name:y.name,metadata:y.metadata,light:y.light,sky:y.sky,center:y.center,zoom:y.zoom,bearing:y.bearing,pitch:y.pitch,sprite:y.sprite,glyphs:y.glyphs,transition:y.transition,sources:o,layers:d,terrain:m},x=>x!==void 0)}_updateLayer(o){this._updatedLayers[o.id]=!0,o.source&&!this._updatedSources[o.source]&&this.sourceCaches[o.source].getSource().type!=="raster"&&(this._updatedSources[o.source]="reload",this.sourceCaches[o.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(o){const d=M=>this._layers[M].type==="fill-extrusion",m={},y=[];for(let M=this._order.length-1;M>=0;M--){const I=this._order[M];if(d(I)){m[I]=M;for(const O of o){const N=O[I];if(N)for(const V of N)y.push(V)}}}y.sort((M,I)=>I.intersectionZ-M.intersectionZ);const x=[];for(let M=this._order.length-1;M>=0;M--){const I=this._order[M];if(d(I))for(let O=y.length-1;O>=0;O--){const N=y[O].feature;if(m[N.layer.id]<M)break;x.push(N),y.pop()}else for(const O of o){const N=O[I];if(N)for(const V of N)x.push(V.feature)}}return x}queryRenderedFeatures(o,d,m){d&&d.filter&&this._validate(l.u.filter,"queryRenderedFeatures.filter",d.filter,null,d);const y={};if(d&&d.layers){if(!Array.isArray(d.layers))return this.fire(new l.j(new Error("parameters.layers must be an Array."))),[];for(const I of d.layers){const O=this._layers[I];if(!O)return this.fire(new l.j(new Error(`The layer '${I}' does not exist in the map's style and cannot be queried for features.`))),[];y[O.source]=!0}}const x=[];d.availableImages=this._availableImages;const M=this._serializedAllLayers();for(const I in this.sourceCaches)d.layers&&!y[I]||x.push(At(this.sourceCaches[I],this._layers,M,o,d,m));return this.placement&&x.push(function(I,O,N,V,F,Z,J){const ee={},oe=Z.queryRenderedSymbols(V),le=[];for(const ce of Object.keys(oe).map(Number))le.push(J[ce]);le.sort(Mt);for(const ce of le){const he=ce.featureIndex.lookupSymbolFeatures(oe[ce.bucketInstanceId],O,ce.bucketIndex,ce.sourceLayerIndex,F.filter,F.layers,F.availableImages,I);for(const ne in he){const me=ee[ne]=ee[ne]||[],ge=he[ne];ge.sort((xe,Be)=>{const Fe=ce.featureSortOrder;if(Fe){const Qe=Fe.indexOf(xe.featureIndex);return Fe.indexOf(Be.featureIndex)-Qe}return Be.featureIndex-xe.featureIndex});for(const xe of ge)me.push(xe)}}for(const ce in ee)ee[ce].forEach(he=>{const ne=he.feature,me=N[I[ce].source].getFeatureState(ne.layer["source-layer"],ne.id);ne.source=ne.layer.source,ne.layer["source-layer"]&&(ne.sourceLayer=ne.layer["source-layer"]),ne.state=me});return ee}(this._layers,M,this.sourceCaches,o,d,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(x)}querySourceFeatures(o,d){d&&d.filter&&this._validate(l.u.filter,"querySourceFeatures.filter",d.filter,null,d);const m=this.sourceCaches[o];return m?function(y,x){const M=y.getRenderableIds().map(N=>y.getTileByID(N)),I=[],O={};for(let N=0;N<M.length;N++){const V=M[N],F=V.tileID.canonical.key;O[F]||(O[F]=!0,V.querySourceFeatures(I,x))}return I}(m,d):[]}getLight(){return this.light.getLight()}setLight(o,d={}){this._checkLoaded();const m=this.light.getLight();let y=!1;for(const M in o)if(!l.aE(o[M],m[M])){y=!0;break}if(!y)return;const x={now:E.now(),transition:l.e({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(o,d),this.light.updateTransitions(x)}getSky(){var o;return(o=this.stylesheet)===null||o===void 0?void 0:o.sky}setSky(o,d={}){const m=this.getSky();let y=!1;if(!o&&!m)return;if(o&&!m)y=!0;else if(!o&&m)y=!0;else for(const M in o)if(!l.aE(o[M],m[M])){y=!0;break}if(!y)return;const x={now:E.now(),transition:l.e({duration:300,delay:0},this.stylesheet.transition)};this.stylesheet.sky=o,this.sky.setSky(o,d),this.sky.updateTransitions(x)}_validate(o,d,m,y,x={}){return(!x||x.validate!==!1)&&eo(this,o.call(l.u,l.e({key:d,style:this.serialize(),value:m,styleSpec:l.v},y)))}_remove(o=!0){this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._loadStyleRequest&&(this._loadStyleRequest.abort(),this._loadStyleRequest=null),this._spriteRequest&&(this._spriteRequest.abort(),this._spriteRequest=null),zr().off(Ve,this._rtlPluginLoaded);for(const d in this._layers)this._layers[d].setEventedParent(null);for(const d in this.sourceCaches){const m=this.sourceCaches[d];m.setEventedParent(null),m.onRemove(this.map)}this.imageManager.setEventedParent(null),this.setEventedParent(null),o&&this.dispatcher.broadcast("RM",void 0),this.dispatcher.remove(o)}_clearSource(o){this.sourceCaches[o].clearTiles()}_reloadSource(o){this.sourceCaches[o].resume(),this.sourceCaches[o].reload()}_updateSources(o){for(const d in this.sourceCaches)this.sourceCaches[d].update(o,this.map.terrain)}_generateCollisionBoxes(){for(const o in this.sourceCaches)this._reloadSource(o)}_updatePlacement(o,d,m,y,x=!1){let M=!1,I=!1;const O={};for(const N of this._order){const V=this._layers[N];if(V.type!=="symbol")continue;if(!O[V.source]){const Z=this.sourceCaches[V.source];O[V.source]=Z.getRenderableIds(!0).map(J=>Z.getTileByID(J)).sort((J,ee)=>ee.tileID.overscaledZ-J.tileID.overscaledZ||(J.tileID.isLessThan(ee.tileID)?-1:1))}const F=this.crossTileSymbolIndex.addLayer(V,O[V.source],o.center.lng);M=M||F}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((x=x||this._layerOrderChanged||m===0)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(E.now(),o.zoom))&&(this.pauseablePlacement=new Ll(o,this.map.terrain,this._order,x,d,m,y,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,O),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(E.now()),I=!0),M&&this.pauseablePlacement.placement.setStale()),I||M)for(const N of this._order){const V=this._layers[N];V.type==="symbol"&&this.placement.updateLayerOpacities(V,O[V.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(E.now())}_releaseSymbolFadeTiles(){for(const o in this.sourceCaches)this.sourceCaches[o].releaseSymbolFadeTiles()}getImages(o,d){return l._(this,void 0,void 0,function*(){const m=yield this.imageManager.getImages(d.icons);this._updateTilesForChangedImages();const y=this.sourceCaches[d.source];return y&&y.setDependencies(d.tileID.key,d.type,d.icons),m})}getGlyphs(o,d){return l._(this,void 0,void 0,function*(){const m=yield this.glyphManager.getGlyphs(d.stacks),y=this.sourceCaches[d.source];return y&&y.setDependencies(d.tileID.key,d.type,[""]),m})}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(o,d={}){this._checkLoaded(),o&&this._validate(l.u.glyphs,"glyphs",o,null,d)||(this._glyphsDidChange=!0,this.stylesheet.glyphs=o,this.glyphManager.entries={},this.glyphManager.setURL(o))}addSprite(o,d,m={},y){this._checkLoaded();const x=[{id:o,url:d}],M=[...Ae(this.stylesheet.sprite),...x];this._validate(l.u.sprite,"sprite",M,null,m)||(this.stylesheet.sprite=M,this._loadSprite(x,!0,y))}removeSprite(o){this._checkLoaded();const d=Ae(this.stylesheet.sprite);if(d.find(m=>m.id===o)){if(this._spritesImagesIds[o])for(const m of this._spritesImagesIds[o])this.imageManager.removeImage(m),this._changedImages[m]=!0;d.splice(d.findIndex(m=>m.id===o),1),this.stylesheet.sprite=d.length>0?d:void 0,delete this._spritesImagesIds[o],this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new l.k("data",{dataType:"style"}))}else this.fire(new l.j(new Error(`Sprite "${o}" doesn't exists on this map.`)))}getSprite(){return Ae(this.stylesheet.sprite)}setSprite(o,d={},m){this._checkLoaded(),o&&this._validate(l.u.sprite,"sprite",o,null,d)||(this.stylesheet.sprite=o,o?this._loadSprite(o,!0,m):(this._unloadSprite(),m&&m(null)))}}var $s=l.Y([{name:"a_pos",type:"Int16",components:2}]);const ds={prelude:fn(`#ifdef GL_ES
49
+ Use an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(L[1])} }\`.`)];const j=[];return c.layerType==="symbol"&&(T==="text-field"&&_&&!_.glyphs&&j.push(new Ve(h,S,'use of "text-field" requires a style "glyphs" property')),T==="text-font"&&mu(to(S))&&Qn(S.type)==="identity"&&j.push(new Ve(h,S,'"text-font" does not support identity functions'))),j.concat(p({key:c.key,value:S,valueSpec:z,style:_,styleSpec:k,expressionContext:"property",propertyType:s,propertyKey:T}))}function Su(c){return kd(c,"paint")}function Sd(c){return kd(c,"layout")}function Ed(c){let s=[];const h=c.value,p=c.key,_=c.style,k=c.styleSpec;h.type||h.ref||s.push(new Ve(p,h,'either "type" or "ref" is required'));let S=Qn(h.type);const T=Qn(h.ref);if(h.id){const A=Qn(h.id);for(let B=0;B<c.arrayIndex;B++){const z=_.layers[B];Qn(z.id)===A&&s.push(new Ve(p,h.id,`duplicate layer id "${h.id}", previously used at line ${z.id.__line__}`))}}if("ref"in h){let A;["type","source","source-layer","filter","layout"].forEach(B=>{B in h&&s.push(new Ve(p,h[B],`"${B}" is prohibited for ref layers`))}),_.layers.forEach(B=>{Qn(B.id)===T&&(A=B)}),A?A.ref?s.push(new Ve(p,h.ref,"ref cannot reference another ref layer")):S=Qn(A.type):s.push(new Ve(p,h.ref,`ref layer "${T}" not found`))}else if(S!=="background")if(h.source){const A=_.sources&&_.sources[h.source],B=A&&Qn(A.type);A?B==="vector"&&S==="raster"?s.push(new Ve(p,h.source,`layer "${h.id}" requires a raster source`)):B!=="raster-dem"&&S==="hillshade"?s.push(new Ve(p,h.source,`layer "${h.id}" requires a raster-dem source`)):B==="raster"&&S!=="raster"?s.push(new Ve(p,h.source,`layer "${h.id}" requires a vector source`)):B!=="vector"||h["source-layer"]?B==="raster-dem"&&S!=="hillshade"?s.push(new Ve(p,h.source,"raster-dem source can only be used with layer type 'hillshade'.")):S!=="line"||!h.paint||!h.paint["line-gradient"]||B==="geojson"&&A.lineMetrics||s.push(new Ve(p,h,`layer "${h.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):s.push(new Ve(p,h,`layer "${h.id}" must specify a "source-layer"`)):s.push(new Ve(p,h.source,`source "${h.source}" not found`))}else s.push(new Ve(p,h,'missing required property "source"'));return s=s.concat(_r({key:p,value:h,valueSpec:k.layer,style:c.style,styleSpec:c.styleSpec,validateSpec:c.validateSpec,objectElementValidators:{"*":()=>[],type:()=>c.validateSpec({key:`${p}.type`,value:h.type,valueSpec:k.layer.type,style:c.style,styleSpec:c.styleSpec,validateSpec:c.validateSpec,object:h,objectKey:"type"}),filter:wd,layout:A=>_r({layer:h,key:A.key,value:A.value,style:A.style,styleSpec:A.styleSpec,validateSpec:A.validateSpec,objectElementValidators:{"*":B=>Sd(Br({layerType:S},B))}}),paint:A=>_r({layer:h,key:A.key,value:A.value,style:A.style,styleSpec:A.styleSpec,validateSpec:A.validateSpec,objectElementValidators:{"*":B=>Su(Br({layerType:S},B))}})}})),s}function Xs(c){const s=c.value,h=c.key,p=un(s);return p!=="string"?[new Ve(h,s,`string expected, ${p} found`)]:[]}const Eu={promoteId:function({key:c,value:s}){if(un(s)==="string")return Xs({key:c,value:s});{const h=[];for(const p in s)h.push(...Xs({key:`${c}.${p}`,value:s[p]}));return h}}};function Jl(c){const s=c.value,h=c.key,p=c.styleSpec,_=c.style,k=c.validateSpec;if(!s.type)return[new Ve(h,s,'"type" is required')];const S=Qn(s.type);let T;switch(S){case"vector":case"raster":return T=_r({key:h,value:s,valueSpec:p[`source_${S.replace("-","_")}`],style:c.style,styleSpec:p,objectElementValidators:Eu,validateSpec:k}),T;case"raster-dem":return T=function(A){var B;const z=(B=A.sourceName)!==null&&B!==void 0?B:"",L=A.value,j=A.styleSpec,q=j.source_raster_dem,Y=A.style;let K=[];const re=un(L);if(L===void 0)return K;if(re!=="object")return K.push(new Ve("source_raster_dem",L,`object expected, ${re} found`)),K;const ae=Qn(L.encoding)==="custom",be=["redFactor","greenFactor","blueFactor","baseShift"],pe=A.value.encoding?`"${A.value.encoding}"`:"Default";for(const ye in L)!ae&&be.includes(ye)?K.push(new Ve(ye,L[ye],`In "${z}": "${ye}" is only valid when "encoding" is set to "custom". ${pe} encoding found`)):q[ye]?K=K.concat(A.validateSpec({key:ye,value:L[ye],valueSpec:q[ye],validateSpec:A.validateSpec,style:Y,styleSpec:j})):K.push(new Ve(ye,L[ye],`unknown property "${ye}"`));return K}({sourceName:h,value:s,style:c.style,styleSpec:p,validateSpec:k}),T;case"geojson":if(T=_r({key:h,value:s,valueSpec:p.source_geojson,style:_,styleSpec:p,validateSpec:k,objectElementValidators:Eu}),s.cluster)for(const A in s.clusterProperties){const[B,z]=s.clusterProperties[A],L=typeof B=="string"?[B,["accumulated"],["get",A]]:B;T.push(...Ha({key:`${h}.${A}.map`,value:z,validateSpec:k,expressionContext:"cluster-map"})),T.push(...Ha({key:`${h}.${A}.reduce`,value:L,validateSpec:k,expressionContext:"cluster-reduce"}))}return T;case"video":return _r({key:h,value:s,valueSpec:p.source_video,style:_,validateSpec:k,styleSpec:p});case"image":return _r({key:h,value:s,valueSpec:p.source_image,style:_,validateSpec:k,styleSpec:p});case"canvas":return[new Ve(h,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return qo({key:`${h}.type`,value:s.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:_,validateSpec:k,styleSpec:p})}}function Cd(c){const s=c.value,h=c.styleSpec,p=h.light,_=c.style;let k=[];const S=un(s);if(s===void 0)return k;if(S!=="object")return k=k.concat([new Ve("light",s,`object expected, ${S} found`)]),k;for(const T in s){const A=T.match(/^(.*)-transition$/);k=k.concat(A&&p[A[1]]&&p[A[1]].transition?c.validateSpec({key:T,value:s[T],valueSpec:h.transition,validateSpec:c.validateSpec,style:_,styleSpec:h}):p[T]?c.validateSpec({key:T,value:s[T],valueSpec:p[T],validateSpec:c.validateSpec,style:_,styleSpec:h}):[new Ve(T,s[T],`unknown property "${T}"`)])}return k}function Td(c){const s=c.value,h=c.styleSpec,p=h.sky,_=c.style,k=un(s);if(s===void 0)return[];if(k!=="object")return[new Ve("sky",s,`object expected, ${k} found`)];let S=[];for(const T in s)S=S.concat(p[T]?c.validateSpec({key:T,value:s[T],valueSpec:p[T],style:_,styleSpec:h}):[new Ve(T,s[T],`unknown property "${T}"`)]);return S}function Md(c){const s=c.value,h=c.styleSpec,p=h.terrain,_=c.style;let k=[];const S=un(s);if(s===void 0)return k;if(S!=="object")return k=k.concat([new Ve("terrain",s,`object expected, ${S} found`)]),k;for(const T in s)k=k.concat(p[T]?c.validateSpec({key:T,value:s[T],valueSpec:p[T],validateSpec:c.validateSpec,style:_,styleSpec:h}):[new Ve(T,s[T],`unknown property "${T}"`)]);return k}function Ad(c){let s=[];const h=c.value,p=c.key;if(Array.isArray(h)){const _=[],k=[];for(const S in h)h[S].id&&_.includes(h[S].id)&&s.push(new Ve(p,h,`all the sprites' ids must be unique, but ${h[S].id} is duplicated`)),_.push(h[S].id),h[S].url&&k.includes(h[S].url)&&s.push(new Ve(p,h,`all the sprites' URLs must be unique, but ${h[S].url} is duplicated`)),k.push(h[S].url),s=s.concat(_r({key:`${p}[${S}]`,value:h[S],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:c.validateSpec}));return s}return Xs({key:p,value:h})}const Cu={"*":()=>[],array:Kl,boolean:function(c){const s=c.value,h=c.key,p=un(s);return p!=="boolean"?[new Ve(h,s,`boolean expected, ${p} found`)]:[]},number:vd,color:function(c){const s=c.key,h=c.value,p=un(h);return p!=="string"?[new Ve(s,h,`color expected, ${p} found`)]:kn.parse(String(h))?[]:[new Ve(s,h,`color expected, "${h}" found`)]},constants:km,enum:qo,filter:wd,function:wu,layer:Ed,object:_r,source:Jl,light:Cd,sky:Td,terrain:Md,projection:function(c){const s=c.value,h=c.styleSpec,p=h.projection,_=c.style,k=un(s);if(s===void 0)return[];if(k!=="object")return[new Ve("projection",s,`object expected, ${k} found`)];let S=[];for(const T in s)S=S.concat(p[T]?c.validateSpec({key:T,value:s[T],valueSpec:p[T],style:_,styleSpec:h}):[new Ve(T,s[T],`unknown property "${T}"`)]);return S},string:Xs,formatted:function(c){return Xs(c).length===0?[]:Ha(c)},resolvedImage:function(c){return Xs(c).length===0?[]:Ha(c)},padding:function(c){const s=c.key,h=c.value;if(un(h)==="array"){if(h.length<1||h.length>4)return[new Ve(s,h,`padding requires 1 to 4 values; ${h.length} values found`)];const p={type:"number"};let _=[];for(let k=0;k<h.length;k++)_=_.concat(c.validateSpec({key:`${s}[${k}]`,value:h[k],validateSpec:c.validateSpec,valueSpec:p}));return _}return vd({key:s,value:h,valueSpec:{}})},variableAnchorOffsetCollection:function(c){const s=c.key,h=c.value,p=un(h),_=c.styleSpec;if(p!=="array"||h.length<1||h.length%2!=0)return[new Ve(s,h,"variableAnchorOffsetCollection requires a non-empty array of even length")];let k=[];for(let S=0;S<h.length;S+=2)k=k.concat(qo({key:`${s}[${S}]`,value:h[S],valueSpec:_.layout_symbol["text-anchor"]})),k=k.concat(Kl({key:`${s}[${S+1}]`,value:h[S+1],valueSpec:{length:2,value:"number"},validateSpec:c.validateSpec,style:c.style,styleSpec:_}));return k},sprite:Ad};function qa(c){const s=c.value,h=c.valueSpec,p=c.styleSpec;return c.validateSpec=qa,h.expression&&mu(Qn(s))?wu(c):h.expression&&_u(to(s))?Ha(c):h.type&&Cu[h.type]?Cu[h.type](c):_r(Br({},c,{valueSpec:h.type?p[h.type]:h}))}function Sm(c){const s=c.value,h=c.key,p=Xs(c);return p.length||(s.indexOf("{fontstack}")===-1&&p.push(new Ve(h,s,'"glyphs" url must include a "{fontstack}" token')),s.indexOf("{range}")===-1&&p.push(new Ve(h,s,'"glyphs" url must include a "{range}" token'))),p}function Lr(c,s=we){let h=[];return h=h.concat(qa({key:"",value:c,valueSpec:s.$root,styleSpec:s,style:c,validateSpec:qa,objectElementValidators:{glyphs:Sm,"*":()=>[]}})),c.constants&&(h=h.concat(km({key:"constants",value:c.constants,style:c,styleSpec:s,validateSpec:qa}))),Id(h)}function Ao(c){return function(s){return c({...s,validateSpec:qa})}}function Id(c){return[].concat(c).sort((s,h)=>s.line-h.line)}function no(c){return function(...s){return Id(c.apply(this,s))}}Lr.source=no(Ao(Jl)),Lr.sprite=no(Ao(Ad)),Lr.glyphs=no(Ao(Sm)),Lr.light=no(Ao(Cd)),Lr.sky=no(Ao(Td)),Lr.terrain=no(Ao(Md)),Lr.layer=no(Ao(Ed)),Lr.filter=no(Ao(wd)),Lr.paintProperty=no(Ao(Su)),Lr.layoutProperty=no(Ao(Sd));const Ks=Lr,k_=Ks.light,S_=Ks.sky,Em=Ks.paintProperty,Cm=Ks.layoutProperty;function Pd(c,s){let h=!1;if(s&&s.length)for(const p of s)c.fire(new Mt(new Error(p.message))),h=!0;return h}class Wa{constructor(s,h,p){const _=this.cells=[];if(s instanceof ArrayBuffer){this.arrayBuffer=s;const S=new Int32Array(this.arrayBuffer);s=S[0],this.d=(h=S[1])+2*(p=S[2]);for(let A=0;A<this.d*this.d;A++){const B=S[3+A],z=S[3+A+1];_.push(B===z?null:S.subarray(B,z))}const T=S[3+_.length+1];this.keys=S.subarray(S[3+_.length],T),this.bboxes=S.subarray(T),this.insert=this._insertReadonly}else{this.d=h+2*p;for(let S=0;S<this.d*this.d;S++)_.push([]);this.keys=[],this.bboxes=[]}this.n=h,this.extent=s,this.padding=p,this.scale=h/s,this.uid=0;const k=p/h*s;this.min=-k,this.max=s+k}insert(s,h,p,_,k){this._forEachCell(h,p,_,k,this._insertCell,this.uid++,void 0,void 0),this.keys.push(s),this.bboxes.push(h),this.bboxes.push(p),this.bboxes.push(_),this.bboxes.push(k)}_insertReadonly(){throw new Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(s,h,p,_,k,S){this.cells[k].push(S)}query(s,h,p,_,k){const S=this.min,T=this.max;if(s<=S&&h<=S&&T<=p&&T<=_&&!k)return Array.prototype.slice.call(this.keys);{const A=[];return this._forEachCell(s,h,p,_,this._queryCell,A,{},k),A}}_queryCell(s,h,p,_,k,S,T,A){const B=this.cells[k];if(B!==null){const z=this.keys,L=this.bboxes;for(let j=0;j<B.length;j++){const q=B[j];if(T[q]===void 0){const Y=4*q;(A?A(L[Y+0],L[Y+1],L[Y+2],L[Y+3]):s<=L[Y+2]&&h<=L[Y+3]&&p>=L[Y+0]&&_>=L[Y+1])?(T[q]=!0,S.push(z[q])):T[q]=!1}}}}_forEachCell(s,h,p,_,k,S,T,A){const B=this._convertToCellCoord(s),z=this._convertToCellCoord(h),L=this._convertToCellCoord(p),j=this._convertToCellCoord(_);for(let q=B;q<=L;q++)for(let Y=z;Y<=j;Y++){const K=this.d*Y+q;if((!A||A(this._convertFromCellCoord(q),this._convertFromCellCoord(Y),this._convertFromCellCoord(q+1),this._convertFromCellCoord(Y+1)))&&k.call(this,s,h,p,_,K,S,T,A))return}}_convertFromCellCoord(s){return(s-this.padding)/this.scale}_convertToCellCoord(s){return Math.max(0,Math.min(this.d-1,Math.floor(s*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;const s=this.cells,h=3+this.cells.length+1+1;let p=0;for(let S=0;S<this.cells.length;S++)p+=this.cells[S].length;const _=new Int32Array(h+p+this.keys.length+this.bboxes.length);_[0]=this.extent,_[1]=this.n,_[2]=this.padding;let k=h;for(let S=0;S<s.length;S++){const T=s[S];_[3+S]=k,_.set(T,k),k+=T.length}return _[3+s.length]=k,_.set(this.keys,k),k+=this.keys.length,_[3+s.length+1]=k,_.set(this.bboxes,k),k+=this.bboxes.length,_.buffer}static serialize(s,h){const p=s.toArrayBuffer();return h&&h.push(p),{buffer:p}}static deserialize(s){return new Wa(s.buffer)}}const Vr={};function ut(c,s,h={}){if(Vr[c])throw new Error(`${c} is already registered.`);Object.defineProperty(s,"_classRegistryKey",{value:c,writeable:!1}),Vr[c]={klass:s,omit:h.omit||[],shallow:h.shallow||[]}}ut("Object",Object),ut("TransferableGridIndex",Wa),ut("Color",kn),ut("Error",Error),ut("AJAXError",Ce),ut("ResolvedImage",yr),ut("StylePropertyFunction",Ua),ut("StyleExpression",yu,{omit:["_evaluator"]}),ut("ZoomDependentExpression",ja),ut("ZoomConstantExpression",$a),ut("CompoundExpression",Rr,{omit:["_evaluate"]});for(const c in za)za[c]._classRegistryKey||ut(`Expression_${c}`,za[c]);function Tu(c){return c&&typeof ArrayBuffer<"u"&&(c instanceof ArrayBuffer||c.constructor&&c.constructor.name==="ArrayBuffer")}function Dd(c){return c.$name||c.constructor._classRegistryKey}function Tm(c){return!function(s){if(s===null||typeof s!="object")return!1;const h=Dd(s);return!(!h||h==="Object")}(c)&&(c==null||typeof c=="boolean"||typeof c=="number"||typeof c=="string"||c instanceof Boolean||c instanceof Number||c instanceof String||c instanceof Date||c instanceof RegExp||c instanceof Blob||c instanceof Error||Tu(c)||Ft(c)||ArrayBuffer.isView(c)||c instanceof ImageData)}function Ga(c,s){if(Tm(c))return(Tu(c)||Ft(c))&&s&&s.push(c),ArrayBuffer.isView(c)&&s&&s.push(c.buffer),c instanceof ImageData&&s&&s.push(c.data.buffer),c;if(Array.isArray(c)){const k=[];for(const S of c)k.push(Ga(S,s));return k}if(typeof c!="object")throw new Error("can't serialize object of type "+typeof c);const h=Dd(c);if(!h)throw new Error(`can't serialize object of unregistered class ${c.constructor.name}`);if(!Vr[h])throw new Error(`${h} is not registered.`);const{klass:p}=Vr[h],_=p.serialize?p.serialize(c,s):{};if(p.serialize){if(s&&_===s[s.length-1])throw new Error("statically serialized object won't survive transfer of $name property")}else{for(const k in c){if(!c.hasOwnProperty(k)||Vr[h].omit.indexOf(k)>=0)continue;const S=c[k];_[k]=Vr[h].shallow.indexOf(k)>=0?S:Ga(S,s)}c instanceof Error&&(_.message=c.message)}if(_.$name)throw new Error("$name property is reserved for worker serialization logic.");return h!=="Object"&&(_.$name=h),_}function Za(c){if(Tm(c))return c;if(Array.isArray(c))return c.map(Za);if(typeof c!="object")throw new Error("can't deserialize object of type "+typeof c);const s=Dd(c)||"Object";if(!Vr[s])throw new Error(`can't deserialize unregistered class ${s}`);const{klass:h}=Vr[s];if(!h)throw new Error(`can't deserialize unregistered class ${s}`);if(h.deserialize)return h.deserialize(c);const p=Object.create(h.prototype);for(const _ of Object.keys(c)){if(_==="$name")continue;const k=c[_];p[_]=Vr[s].shallow.indexOf(_)>=0?k:Za(k)}return p}class Od{constructor(){this.first=!0}update(s,h){const p=Math.floor(s);return this.first?(this.first=!1,this.lastIntegerZoom=p,this.lastIntegerZoomTime=0,this.lastZoom=s,this.lastFloorZoom=p,!0):(this.lastFloorZoom>p?(this.lastIntegerZoom=p+1,this.lastIntegerZoomTime=h):this.lastFloorZoom<p&&(this.lastIntegerZoom=p,this.lastIntegerZoomTime=h),s!==this.lastZoom&&(this.lastZoom=s,this.lastFloorZoom=p,!0))}}const en={"Latin-1 Supplement":c=>c>=128&&c<=255,"Hangul Jamo":c=>c>=4352&&c<=4607,Khmer:c=>c>=6016&&c<=6143,"General Punctuation":c=>c>=8192&&c<=8303,"Letterlike Symbols":c=>c>=8448&&c<=8527,"Number Forms":c=>c>=8528&&c<=8591,"Miscellaneous Technical":c=>c>=8960&&c<=9215,"Control Pictures":c=>c>=9216&&c<=9279,"Optical Character Recognition":c=>c>=9280&&c<=9311,"Enclosed Alphanumerics":c=>c>=9312&&c<=9471,"Geometric Shapes":c=>c>=9632&&c<=9727,"Miscellaneous Symbols":c=>c>=9728&&c<=9983,"Miscellaneous Symbols and Arrows":c=>c>=11008&&c<=11263,"Ideographic Description Characters":c=>c>=12272&&c<=12287,"CJK Symbols and Punctuation":c=>c>=12288&&c<=12351,Katakana:c=>c>=12448&&c<=12543,Kanbun:c=>c>=12688&&c<=12703,"CJK Strokes":c=>c>=12736&&c<=12783,"Enclosed CJK Letters and Months":c=>c>=12800&&c<=13055,"CJK Compatibility":c=>c>=13056&&c<=13311,"Yijing Hexagram Symbols":c=>c>=19904&&c<=19967,"Private Use Area":c=>c>=57344&&c<=63743,"Vertical Forms":c=>c>=65040&&c<=65055,"CJK Compatibility Forms":c=>c>=65072&&c<=65103,"Small Form Variants":c=>c>=65104&&c<=65135,"Halfwidth and Fullwidth Forms":c=>c>=65280&&c<=65519};function Bd(c){for(const s of c)if(Nd(s.charCodeAt(0)))return!0;return!1}function E_(c){for(const s of c)if(!Ya(s.charCodeAt(0)))return!1;return!0}function zd(c){const s=c.map(h=>{try{return new RegExp(`\\p{sc=${h}}`,"u").source}catch{return null}}).filter(h=>h);return new RegExp(s.join("|"),"u")}const C_=zd(["Arab","Dupl","Mong","Ougr","Syrc"]);function Ya(c){return!C_.test(String.fromCodePoint(c))}const Mm=zd(["Bopo","Hani","Hira","Kana","Kits","Nshu","Tang","Yiii"]);function Nd(c){return!(c!==746&&c!==747&&(c<4352||!(en["CJK Compatibility Forms"](c)&&!(c>=65097&&c<=65103)||en["CJK Compatibility"](c)||en["CJK Strokes"](c)||!(!en["CJK Symbols and Punctuation"](c)||c>=12296&&c<=12305||c>=12308&&c<=12319||c===12336)||en["Enclosed CJK Letters and Months"](c)||en["Ideographic Description Characters"](c)||en.Kanbun(c)||en.Katakana(c)&&c!==12540||!(!en["Halfwidth and Fullwidth Forms"](c)||c===65288||c===65289||c===65293||c>=65306&&c<=65310||c===65339||c===65341||c===65343||c>=65371&&c<=65503||c===65507||c>=65512&&c<=65519)||!(!en["Small Form Variants"](c)||c>=65112&&c<=65118||c>=65123&&c<=65126)||en["Vertical Forms"](c)||en["Yijing Hexagram Symbols"](c)||new RegExp("\\p{sc=Cans}","u").test(String.fromCodePoint(c))||new RegExp("\\p{sc=Hang}","u").test(String.fromCodePoint(c))||Mm.test(String.fromCodePoint(c)))))}function Am(c){return!(Nd(c)||function(s){return!!(en["Latin-1 Supplement"](s)&&(s===167||s===169||s===174||s===177||s===188||s===189||s===190||s===215||s===247)||en["General Punctuation"](s)&&(s===8214||s===8224||s===8225||s===8240||s===8241||s===8251||s===8252||s===8258||s===8263||s===8264||s===8265||s===8273)||en["Letterlike Symbols"](s)||en["Number Forms"](s)||en["Miscellaneous Technical"](s)&&(s>=8960&&s<=8967||s>=8972&&s<=8991||s>=8996&&s<=9e3||s===9003||s>=9085&&s<=9114||s>=9150&&s<=9165||s===9167||s>=9169&&s<=9179||s>=9186&&s<=9215)||en["Control Pictures"](s)&&s!==9251||en["Optical Character Recognition"](s)||en["Enclosed Alphanumerics"](s)||en["Geometric Shapes"](s)||en["Miscellaneous Symbols"](s)&&!(s>=9754&&s<=9759)||en["Miscellaneous Symbols and Arrows"](s)&&(s>=11026&&s<=11055||s>=11088&&s<=11097||s>=11192&&s<=11243)||en["CJK Symbols and Punctuation"](s)||en.Katakana(s)||en["Private Use Area"](s)||en["CJK Compatibility Forms"](s)||en["Small Form Variants"](s)||en["Halfwidth and Fullwidth Forms"](s)||s===8734||s===8756||s===8757||s>=9984&&s<=10087||s>=10102&&s<=10131||s===65532||s===65533)}(c))}const T_=zd(["Adlm","Arab","Armi","Avst","Chrs","Cprt","Egyp","Elym","Gara","Hatr","Hebr","Hung","Khar","Lydi","Mand","Mani","Mend","Merc","Mero","Narb","Nbat","Nkoo","Orkh","Palm","Phli","Phlp","Phnx","Prti","Rohg","Samr","Sarb","Sogo","Syrc","Thaa","Todr","Yezi"]);function Rd(c){return T_.test(String.fromCodePoint(c))}function M_(c,s){return!(!s&&Rd(c)||c>=2304&&c<=3583||c>=3840&&c<=4255||en.Khmer(c))}function A_(c){for(const s of c)if(Rd(s.charCodeAt(0)))return!0;return!1}const br=new class{constructor(){this.applyArabicShaping=null,this.processBidirectionalText=null,this.processStyledBidirectionalText=null,this.pluginStatus="unavailable",this.pluginURL=null}setState(c){this.pluginStatus=c.pluginStatus,this.pluginURL=c.pluginURL}getState(){return{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}}setMethods(c){this.applyArabicShaping=c.applyArabicShaping,this.processBidirectionalText=c.processBidirectionalText,this.processStyledBidirectionalText=c.processStyledBidirectionalText}isParsed(){return this.applyArabicShaping!=null&&this.processBidirectionalText!=null&&this.processStyledBidirectionalText!=null}getPluginURL(){return this.pluginURL}getRTLTextPluginStatus(){return this.pluginStatus}};class Vn{constructor(s,h){this.zoom=s,h?(this.now=h.now,this.fadeDuration=h.fadeDuration,this.zoomHistory=h.zoomHistory,this.transition=h.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new Od,this.transition={})}isSupportedScript(s){return function(h,p){for(const _ of h)if(!M_(_.charCodeAt(0),p))return!1;return!0}(s,br.getRTLTextPluginStatus()==="loaded")}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){const s=this.zoom,h=s-Math.floor(s),p=this.crossFadingFactor();return s>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:h+(1-h)*p}:{fromScale:.5,toScale:1,t:1-(1-p)*h}}}class Xa{constructor(s,h){this.property=s,this.value=h,this.expression=function(p,_){if(mu(p))return new Ua(p,_);if(_u(p)){const k=_d(p,_);if(k.result==="error")throw new Error(k.value.map(S=>`${S.key}: ${S.message}`).join(", "));return k.value}{let k=p;return _.type==="color"&&typeof p=="string"?k=kn.parse(p):_.type!=="padding"||typeof p!="number"&&!Array.isArray(p)?_.type==="variableAnchorOffsetCollection"&&Array.isArray(p)&&(k=Nr.parse(p)):k=gr.parse(p),{kind:"constant",evaluate:()=>k}}}(h===void 0?s.specification.default:h,s.specification)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(s,h,p){return this.property.possiblyEvaluate(this,s,h,p)}}class Mu{constructor(s){this.property=s,this.value=new Xa(s,void 0)}transitioned(s,h){return new Im(this.property,this.value,h,Se({},s.transition,this.transition),s.now)}untransitioned(){return new Im(this.property,this.value,null,{},0)}}class Au{constructor(s){this._properties=s,this._values=Object.create(s.defaultTransitionablePropertyValues)}getValue(s){return Xe(this._values[s].value.value)}setValue(s,h){Object.prototype.hasOwnProperty.call(this._values,s)||(this._values[s]=new Mu(this._values[s].property)),this._values[s].value=new Xa(this._values[s].property,h===null?void 0:Xe(h))}getTransition(s){return Xe(this._values[s].transition)}setTransition(s,h){Object.prototype.hasOwnProperty.call(this._values,s)||(this._values[s]=new Mu(this._values[s].property)),this._values[s].transition=Xe(h)||void 0}serialize(){const s={};for(const h of Object.keys(this._values)){const p=this.getValue(h);p!==void 0&&(s[h]=p);const _=this.getTransition(h);_!==void 0&&(s[`${h}-transition`]=_)}return s}transitioned(s,h){const p=new Ql(this._properties);for(const _ of Object.keys(this._values))p._values[_]=this._values[_].transitioned(s,h._values[_]);return p}untransitioned(){const s=new Ql(this._properties);for(const h of Object.keys(this._values))s._values[h]=this._values[h].untransitioned();return s}}class Im{constructor(s,h,p,_,k){this.property=s,this.value=h,this.begin=k+_.delay||0,this.end=this.begin+_.duration||0,s.specification.transition&&(_.delay||_.duration)&&(this.prior=p)}possiblyEvaluate(s,h,p){const _=s.now||0,k=this.value.possiblyEvaluate(s,h,p),S=this.prior;if(S){if(_>this.end)return this.prior=null,k;if(this.value.isDataDriven())return this.prior=null,k;if(_<this.begin)return S.possiblyEvaluate(s,h,p);{const T=(_-this.begin)/(this.end-this.begin);return this.property.interpolate(S.possiblyEvaluate(s,h,p),k,function(A){if(A<=0)return 0;if(A>=1)return 1;const B=A*A,z=B*A;return 4*(A<.5?z:3*(A-B)+z-.75)}(T))}}return k}}class Ql{constructor(s){this._properties=s,this._values=Object.create(s.defaultTransitioningPropertyValues)}possiblyEvaluate(s,h,p){const _=new tc(this._properties);for(const k of Object.keys(this._values))_._values[k]=this._values[k].possiblyEvaluate(s,h,p);return _}hasTransition(){for(const s of Object.keys(this._values))if(this._values[s].prior)return!0;return!1}}class ec{constructor(s){this._properties=s,this._values=Object.create(s.defaultPropertyValues)}hasValue(s){return this._values[s].value!==void 0}getValue(s){return Xe(this._values[s].value)}setValue(s,h){this._values[s]=new Xa(this._values[s].property,h===null?void 0:Xe(h))}serialize(){const s={};for(const h of Object.keys(this._values)){const p=this.getValue(h);p!==void 0&&(s[h]=p)}return s}possiblyEvaluate(s,h,p){const _=new tc(this._properties);for(const k of Object.keys(this._values))_._values[k]=this._values[k].possiblyEvaluate(s,h,p);return _}}class Io{constructor(s,h,p){this.property=s,this.value=h,this.parameters=p}isConstant(){return this.value.kind==="constant"}constantOr(s){return this.value.kind==="constant"?this.value.value:s}evaluate(s,h,p,_){return this.property.evaluate(this.value,this.parameters,s,h,p,_)}}class tc{constructor(s){this._properties=s,this._values=Object.create(s.defaultPossiblyEvaluatedValues)}get(s){return this._values[s]}}class ft{constructor(s){this.specification=s}possiblyEvaluate(s,h){if(s.isDataDriven())throw new Error("Value should not be data driven");return s.expression.evaluate(h)}interpolate(s,h,p){const _=nr[this.specification.type];return _?_(s,h,p):s}}class Et{constructor(s,h){this.specification=s,this.overrides=h}possiblyEvaluate(s,h,p,_){return new Io(this,s.expression.kind==="constant"||s.expression.kind==="camera"?{kind:"constant",value:s.expression.evaluate(h,null,{},p,_)}:s.expression,h)}interpolate(s,h,p){if(s.value.kind!=="constant"||h.value.kind!=="constant")return s;if(s.value.value===void 0||h.value.value===void 0)return new Io(this,{kind:"constant",value:void 0},s.parameters);const _=nr[this.specification.type];if(_){const k=_(s.value.value,h.value.value,p);return new Io(this,{kind:"constant",value:k},s.parameters)}return s}evaluate(s,h,p,_,k,S){return s.kind==="constant"?s.value:s.evaluate(h,p,_,k,S)}}class Iu extends Et{possiblyEvaluate(s,h,p,_){if(s.value===void 0)return new Io(this,{kind:"constant",value:void 0},h);if(s.expression.kind==="constant"){const k=s.expression.evaluate(h,null,{},p,_),S=s.property.specification.type==="resolvedImage"&&typeof k!="string"?k.name:k,T=this._calculate(S,S,S,h);return new Io(this,{kind:"constant",value:T},h)}if(s.expression.kind==="camera"){const k=this._calculate(s.expression.evaluate({zoom:h.zoom-1}),s.expression.evaluate({zoom:h.zoom}),s.expression.evaluate({zoom:h.zoom+1}),h);return new Io(this,{kind:"constant",value:k},h)}return new Io(this,s.expression,h)}evaluate(s,h,p,_,k,S){if(s.kind==="source"){const T=s.evaluate(h,p,_,k,S);return this._calculate(T,T,T,h)}return s.kind==="composite"?this._calculate(s.evaluate({zoom:Math.floor(h.zoom)-1},p,_),s.evaluate({zoom:Math.floor(h.zoom)},p,_),s.evaluate({zoom:Math.floor(h.zoom)+1},p,_),h):s.value}_calculate(s,h,p,_){return _.zoom>_.zoomHistory.lastIntegerZoom?{from:s,to:h}:{from:p,to:h}}interpolate(s){return s}}class Pu{constructor(s){this.specification=s}possiblyEvaluate(s,h,p,_){if(s.value!==void 0){if(s.expression.kind==="constant"){const k=s.expression.evaluate(h,null,{},p,_);return this._calculate(k,k,k,h)}return this._calculate(s.expression.evaluate(new Vn(Math.floor(h.zoom-1),h)),s.expression.evaluate(new Vn(Math.floor(h.zoom),h)),s.expression.evaluate(new Vn(Math.floor(h.zoom+1),h)),h)}}_calculate(s,h,p,_){return _.zoom>_.zoomHistory.lastIntegerZoom?{from:s,to:h}:{from:p,to:h}}interpolate(s){return s}}class Ld{constructor(s){this.specification=s}possiblyEvaluate(s,h,p,_){return!!s.expression.evaluate(h,null,{},p,_)}interpolate(){return!1}}class v{constructor(s){this.properties=s,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const h in s){const p=s[h];p.specification.overridable&&this.overridableProperties.push(h);const _=this.defaultPropertyValues[h]=new Xa(p,void 0),k=this.defaultTransitionablePropertyValues[h]=new Mu(p);this.defaultTransitioningPropertyValues[h]=k.untransitioned(),this.defaultPossiblyEvaluatedValues[h]=_.possiblyEvaluate({})}}}ut("DataDrivenProperty",Et),ut("DataConstantProperty",ft),ut("CrossFadedDataDrivenProperty",Iu),ut("CrossFadedProperty",Pu),ut("ColorRampProperty",Ld);const o="-transition";class d extends rn{constructor(s,h){if(super(),this.id=s.id,this.type=s.type,this._featureFilter={filter:()=>!0,needGeometry:!1},s.type!=="custom"&&(this.metadata=s.metadata,this.minzoom=s.minzoom,this.maxzoom=s.maxzoom,s.type!=="background"&&(this.source=s.source,this.sourceLayer=s["source-layer"],this.filter=s.filter),h.layout&&(this._unevaluatedLayout=new ec(h.layout)),h.paint)){this._transitionablePaint=new Au(h.paint);for(const p in s.paint)this.setPaintProperty(p,s.paint[p],{validate:!1});for(const p in s.layout)this.setLayoutProperty(p,s.layout[p],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new tc(h.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(s){return s==="visibility"?this.visibility:this._unevaluatedLayout.getValue(s)}setLayoutProperty(s,h,p={}){h!=null&&this._validate(Cm,`layers.${this.id}.layout.${s}`,s,h,p)||(s!=="visibility"?this._unevaluatedLayout.setValue(s,h):this.visibility=h)}getPaintProperty(s){return s.endsWith(o)?this._transitionablePaint.getTransition(s.slice(0,-11)):this._transitionablePaint.getValue(s)}setPaintProperty(s,h,p={}){if(h!=null&&this._validate(Em,`layers.${this.id}.paint.${s}`,s,h,p))return!1;if(s.endsWith(o))return this._transitionablePaint.setTransition(s.slice(0,-11),h||void 0),!1;{const _=this._transitionablePaint._values[s],k=_.property.specification["property-type"]==="cross-faded-data-driven",S=_.value.isDataDriven(),T=_.value;this._transitionablePaint.setValue(s,h),this._handleSpecialPaintPropertyUpdate(s);const A=this._transitionablePaint._values[s].value;return A.isDataDriven()||S||k||this._handleOverridablePaintPropertyUpdate(s,T,A)}}_handleSpecialPaintPropertyUpdate(s){}_handleOverridablePaintPropertyUpdate(s,h,p){return!1}isHidden(s){return!!(this.minzoom&&s<this.minzoom)||!!(this.maxzoom&&s>=this.maxzoom)||this.visibility==="none"}updateTransitions(s){this._transitioningPaint=this._transitionablePaint.transitioned(s,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(s,h){s.getCrossfadeParameters&&(this._crossfadeParameters=s.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(s,void 0,h)),this.paint=this._transitioningPaint.possiblyEvaluate(s,void 0,h)}serialize(){const s={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.visibility&&(s.layout=s.layout||{},s.layout.visibility=this.visibility),$e(s,(h,p)=>!(h===void 0||p==="layout"&&!Object.keys(h).length||p==="paint"&&!Object.keys(h).length))}_validate(s,h,p,_,k={}){return(!k||k.validate!==!1)&&Pd(this,s.call(Ks,{key:h,layerType:this.type,objectKey:p,value:_,styleSpec:we,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const s in this.paint._values){const h=this.paint.get(s);if(h instanceof Io&&La(h.property.specification)&&(h.value.kind==="source"||h.value.kind==="composite")&&h.value.isStateDependent)return!0}return!1}}const m={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class y{constructor(s,h){this._structArray=s,this._pos1=h*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class x{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(s,h){return s._trim(),h&&(s.isTransferred=!0,h.push(s.arrayBuffer)),{length:s.length,arrayBuffer:s.arrayBuffer}}static deserialize(s){const h=Object.create(this.prototype);return h.arrayBuffer=s.arrayBuffer,h.length=s.length,h.capacity=s.arrayBuffer.byteLength/h.bytesPerElement,h._refreshViews(),h}_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(s){this.reserve(s),this.length=s}reserve(s){if(s>this.capacity){this.capacity=Math.max(s,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const h=this.uint8;this._refreshViews(),h&&this.uint8.set(h)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function M(c,s=1){let h=0,p=0;return{members:c.map(_=>{const k=m[_.type].BYTES_PER_ELEMENT,S=h=I(h,Math.max(s,k)),T=_.components||1;return p=Math.max(p,k),h+=k*T,{name:_.name,type:_.type,components:T,offset:S}}),size:I(h,Math.max(p,s)),alignment:s}}function I(c,s){return Math.ceil(c/s)*s}class O extends x{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(s,h){const p=this.length;return this.resize(p+1),this.emplace(p,s,h)}emplace(s,h,p){const _=2*s;return this.int16[_+0]=h,this.int16[_+1]=p,s}}O.prototype.bytesPerElement=4,ut("StructArrayLayout2i4",O);class N extends x{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(s,h,p){const _=this.length;return this.resize(_+1),this.emplace(_,s,h,p)}emplace(s,h,p,_){const k=3*s;return this.int16[k+0]=h,this.int16[k+1]=p,this.int16[k+2]=_,s}}N.prototype.bytesPerElement=6,ut("StructArrayLayout3i6",N);class V extends x{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(s,h,p,_){const k=this.length;return this.resize(k+1),this.emplace(k,s,h,p,_)}emplace(s,h,p,_,k){const S=4*s;return this.int16[S+0]=h,this.int16[S+1]=p,this.int16[S+2]=_,this.int16[S+3]=k,s}}V.prototype.bytesPerElement=8,ut("StructArrayLayout4i8",V);class F extends x{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(s,h,p,_,k,S){const T=this.length;return this.resize(T+1),this.emplace(T,s,h,p,_,k,S)}emplace(s,h,p,_,k,S,T){const A=6*s;return this.int16[A+0]=h,this.int16[A+1]=p,this.int16[A+2]=_,this.int16[A+3]=k,this.int16[A+4]=S,this.int16[A+5]=T,s}}F.prototype.bytesPerElement=12,ut("StructArrayLayout2i4i12",F);class Z extends x{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(s,h,p,_,k,S){const T=this.length;return this.resize(T+1),this.emplace(T,s,h,p,_,k,S)}emplace(s,h,p,_,k,S,T){const A=4*s,B=8*s;return this.int16[A+0]=h,this.int16[A+1]=p,this.uint8[B+4]=_,this.uint8[B+5]=k,this.uint8[B+6]=S,this.uint8[B+7]=T,s}}Z.prototype.bytesPerElement=8,ut("StructArrayLayout2i4ub8",Z);class J extends x{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(s,h){const p=this.length;return this.resize(p+1),this.emplace(p,s,h)}emplace(s,h,p){const _=2*s;return this.float32[_+0]=h,this.float32[_+1]=p,s}}J.prototype.bytesPerElement=8,ut("StructArrayLayout2f8",J);class ee extends x{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(s,h,p,_,k,S,T,A,B,z){const L=this.length;return this.resize(L+1),this.emplace(L,s,h,p,_,k,S,T,A,B,z)}emplace(s,h,p,_,k,S,T,A,B,z,L){const j=10*s;return this.uint16[j+0]=h,this.uint16[j+1]=p,this.uint16[j+2]=_,this.uint16[j+3]=k,this.uint16[j+4]=S,this.uint16[j+5]=T,this.uint16[j+6]=A,this.uint16[j+7]=B,this.uint16[j+8]=z,this.uint16[j+9]=L,s}}ee.prototype.bytesPerElement=20,ut("StructArrayLayout10ui20",ee);class oe extends x{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(s,h,p,_,k,S,T,A,B,z,L,j){const q=this.length;return this.resize(q+1),this.emplace(q,s,h,p,_,k,S,T,A,B,z,L,j)}emplace(s,h,p,_,k,S,T,A,B,z,L,j,q){const Y=12*s;return this.int16[Y+0]=h,this.int16[Y+1]=p,this.int16[Y+2]=_,this.int16[Y+3]=k,this.uint16[Y+4]=S,this.uint16[Y+5]=T,this.uint16[Y+6]=A,this.uint16[Y+7]=B,this.int16[Y+8]=z,this.int16[Y+9]=L,this.int16[Y+10]=j,this.int16[Y+11]=q,s}}oe.prototype.bytesPerElement=24,ut("StructArrayLayout4i4ui4i24",oe);class le extends x{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(s,h,p){const _=this.length;return this.resize(_+1),this.emplace(_,s,h,p)}emplace(s,h,p,_){const k=3*s;return this.float32[k+0]=h,this.float32[k+1]=p,this.float32[k+2]=_,s}}le.prototype.bytesPerElement=12,ut("StructArrayLayout3f12",le);class ce extends x{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(s){const h=this.length;return this.resize(h+1),this.emplace(h,s)}emplace(s,h){return this.uint32[1*s+0]=h,s}}ce.prototype.bytesPerElement=4,ut("StructArrayLayout1ul4",ce);class he extends x{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(s,h,p,_,k,S,T,A,B){const z=this.length;return this.resize(z+1),this.emplace(z,s,h,p,_,k,S,T,A,B)}emplace(s,h,p,_,k,S,T,A,B,z){const L=10*s,j=5*s;return this.int16[L+0]=h,this.int16[L+1]=p,this.int16[L+2]=_,this.int16[L+3]=k,this.int16[L+4]=S,this.int16[L+5]=T,this.uint32[j+3]=A,this.uint16[L+8]=B,this.uint16[L+9]=z,s}}he.prototype.bytesPerElement=20,ut("StructArrayLayout6i1ul2ui20",he);class ne extends x{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(s,h,p,_,k,S){const T=this.length;return this.resize(T+1),this.emplace(T,s,h,p,_,k,S)}emplace(s,h,p,_,k,S,T){const A=6*s;return this.int16[A+0]=h,this.int16[A+1]=p,this.int16[A+2]=_,this.int16[A+3]=k,this.int16[A+4]=S,this.int16[A+5]=T,s}}ne.prototype.bytesPerElement=12,ut("StructArrayLayout2i2i2i12",ne);class me extends x{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(s,h,p,_,k){const S=this.length;return this.resize(S+1),this.emplace(S,s,h,p,_,k)}emplace(s,h,p,_,k,S){const T=4*s,A=8*s;return this.float32[T+0]=h,this.float32[T+1]=p,this.float32[T+2]=_,this.int16[A+6]=k,this.int16[A+7]=S,s}}me.prototype.bytesPerElement=16,ut("StructArrayLayout2f1f2i16",me);class ge extends x{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(s,h,p,_,k,S){const T=this.length;return this.resize(T+1),this.emplace(T,s,h,p,_,k,S)}emplace(s,h,p,_,k,S,T){const A=16*s,B=4*s,z=8*s;return this.uint8[A+0]=h,this.uint8[A+1]=p,this.float32[B+1]=_,this.float32[B+2]=k,this.int16[z+6]=S,this.int16[z+7]=T,s}}ge.prototype.bytesPerElement=16,ut("StructArrayLayout2ub2f2i16",ge);class xe extends x{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(s,h,p){const _=this.length;return this.resize(_+1),this.emplace(_,s,h,p)}emplace(s,h,p,_){const k=3*s;return this.uint16[k+0]=h,this.uint16[k+1]=p,this.uint16[k+2]=_,s}}xe.prototype.bytesPerElement=6,ut("StructArrayLayout3ui6",xe);class Be extends x{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(s,h,p,_,k,S,T,A,B,z,L,j,q,Y,K,re,ae){const be=this.length;return this.resize(be+1),this.emplace(be,s,h,p,_,k,S,T,A,B,z,L,j,q,Y,K,re,ae)}emplace(s,h,p,_,k,S,T,A,B,z,L,j,q,Y,K,re,ae,be){const pe=24*s,ye=12*s,Te=48*s;return this.int16[pe+0]=h,this.int16[pe+1]=p,this.uint16[pe+2]=_,this.uint16[pe+3]=k,this.uint32[ye+2]=S,this.uint32[ye+3]=T,this.uint32[ye+4]=A,this.uint16[pe+10]=B,this.uint16[pe+11]=z,this.uint16[pe+12]=L,this.float32[ye+7]=j,this.float32[ye+8]=q,this.uint8[Te+36]=Y,this.uint8[Te+37]=K,this.uint8[Te+38]=re,this.uint32[ye+10]=ae,this.int16[pe+22]=be,s}}Be.prototype.bytesPerElement=48,ut("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",Be);class Fe extends x{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(s,h,p,_,k,S,T,A,B,z,L,j,q,Y,K,re,ae,be,pe,ye,Te,Le,rt,St,tt,Je,yt,dt){const at=this.length;return this.resize(at+1),this.emplace(at,s,h,p,_,k,S,T,A,B,z,L,j,q,Y,K,re,ae,be,pe,ye,Te,Le,rt,St,tt,Je,yt,dt)}emplace(s,h,p,_,k,S,T,A,B,z,L,j,q,Y,K,re,ae,be,pe,ye,Te,Le,rt,St,tt,Je,yt,dt,at){const Oe=32*s,bt=16*s;return this.int16[Oe+0]=h,this.int16[Oe+1]=p,this.int16[Oe+2]=_,this.int16[Oe+3]=k,this.int16[Oe+4]=S,this.int16[Oe+5]=T,this.int16[Oe+6]=A,this.int16[Oe+7]=B,this.uint16[Oe+8]=z,this.uint16[Oe+9]=L,this.uint16[Oe+10]=j,this.uint16[Oe+11]=q,this.uint16[Oe+12]=Y,this.uint16[Oe+13]=K,this.uint16[Oe+14]=re,this.uint16[Oe+15]=ae,this.uint16[Oe+16]=be,this.uint16[Oe+17]=pe,this.uint16[Oe+18]=ye,this.uint16[Oe+19]=Te,this.uint16[Oe+20]=Le,this.uint16[Oe+21]=rt,this.uint16[Oe+22]=St,this.uint32[bt+12]=tt,this.float32[bt+13]=Je,this.float32[bt+14]=yt,this.uint16[Oe+30]=dt,this.uint16[Oe+31]=at,s}}Fe.prototype.bytesPerElement=64,ut("StructArrayLayout8i15ui1ul2f2ui64",Fe);class Qe extends x{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(s){const h=this.length;return this.resize(h+1),this.emplace(h,s)}emplace(s,h){return this.float32[1*s+0]=h,s}}Qe.prototype.bytesPerElement=4,ut("StructArrayLayout1f4",Qe);class st extends x{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(s,h,p){const _=this.length;return this.resize(_+1),this.emplace(_,s,h,p)}emplace(s,h,p,_){const k=3*s;return this.uint16[6*s+0]=h,this.float32[k+1]=p,this.float32[k+2]=_,s}}st.prototype.bytesPerElement=12,ut("StructArrayLayout1ui2f12",st);class Ye extends x{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(s,h,p){const _=this.length;return this.resize(_+1),this.emplace(_,s,h,p)}emplace(s,h,p,_){const k=4*s;return this.uint32[2*s+0]=h,this.uint16[k+2]=p,this.uint16[k+3]=_,s}}Ye.prototype.bytesPerElement=8,ut("StructArrayLayout1ul2ui8",Ye);class Ge extends x{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(s,h){const p=this.length;return this.resize(p+1),this.emplace(p,s,h)}emplace(s,h,p){const _=2*s;return this.uint16[_+0]=h,this.uint16[_+1]=p,s}}Ge.prototype.bytesPerElement=4,ut("StructArrayLayout2ui4",Ge);class mt extends x{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(s){const h=this.length;return this.resize(h+1),this.emplace(h,s)}emplace(s,h){return this.uint16[1*s+0]=h,s}}mt.prototype.bytesPerElement=2,ut("StructArrayLayout1ui2",mt);class Bt extends x{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(s,h,p,_){const k=this.length;return this.resize(k+1),this.emplace(k,s,h,p,_)}emplace(s,h,p,_,k){const S=4*s;return this.float32[S+0]=h,this.float32[S+1]=p,this.float32[S+2]=_,this.float32[S+3]=k,s}}Bt.prototype.bytesPerElement=16,ut("StructArrayLayout4f16",Bt);class Ke extends y{get anchorPointX(){return this._structArray.int16[this._pos2+0]}get anchorPointY(){return this._structArray.int16[this._pos2+1]}get x1(){return this._structArray.int16[this._pos2+2]}get y1(){return this._structArray.int16[this._pos2+3]}get x2(){return this._structArray.int16[this._pos2+4]}get y2(){return this._structArray.int16[this._pos2+5]}get featureIndex(){return this._structArray.uint32[this._pos4+3]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+8]}get bucketIndex(){return this._structArray.uint16[this._pos2+9]}get anchorPoint(){return new E(this.anchorPointX,this.anchorPointY)}}Ke.prototype.size=20;class nt extends he{get(s){return new Ke(this,s)}}ut("CollisionBoxArray",nt);class Dt extends y{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+2]}get numGlyphs(){return this._structArray.uint16[this._pos2+3]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+2]}get lineStartIndex(){return this._structArray.uint32[this._pos4+3]}get lineLength(){return this._structArray.uint32[this._pos4+4]}get segment(){return this._structArray.uint16[this._pos2+10]}get lowerSize(){return this._structArray.uint16[this._pos2+11]}get upperSize(){return this._structArray.uint16[this._pos2+12]}get lineOffsetX(){return this._structArray.float32[this._pos4+7]}get lineOffsetY(){return this._structArray.float32[this._pos4+8]}get writingMode(){return this._structArray.uint8[this._pos1+36]}get placedOrientation(){return this._structArray.uint8[this._pos1+37]}set placedOrientation(s){this._structArray.uint8[this._pos1+37]=s}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(s){this._structArray.uint8[this._pos1+38]=s}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(s){this._structArray.uint32[this._pos4+10]=s}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}}Dt.prototype.size=48;class Fn extends Be{get(s){return new Dt(this,s)}}ut("PlacedSymbolArray",Fn);class $t extends y{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+2]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+3]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+4]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+5]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+6]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+7]}get key(){return this._structArray.uint16[this._pos2+8]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+9]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+10]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+11]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+12]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+13]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+14]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+15]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+16]}get featureIndex(){return this._structArray.uint16[this._pos2+17]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+18]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+19]}get numIconVertices(){return this._structArray.uint16[this._pos2+20]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+21]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+22]}get crossTileID(){return this._structArray.uint32[this._pos4+12]}set crossTileID(s){this._structArray.uint32[this._pos4+12]=s}get textBoxScale(){return this._structArray.float32[this._pos4+13]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+14]}get textAnchorOffsetStartIndex(){return this._structArray.uint16[this._pos2+30]}get textAnchorOffsetEndIndex(){return this._structArray.uint16[this._pos2+31]}}$t.prototype.size=64;class Jt extends Fe{get(s){return new $t(this,s)}}ut("SymbolInstanceArray",Jt);class $n extends Qe{getoffsetX(s){return this.float32[1*s+0]}}ut("GlyphOffsetArray",$n);class Oi extends N{getx(s){return this.int16[3*s+0]}gety(s){return this.int16[3*s+1]}gettileUnitDistanceFromAnchor(s){return this.int16[3*s+2]}}ut("SymbolLineVertexArray",Oi);class io extends y{get textAnchor(){return this._structArray.uint16[this._pos2+0]}get textOffset0(){return this._structArray.float32[this._pos4+1]}get textOffset1(){return this._structArray.float32[this._pos4+2]}}io.prototype.size=12;class jn extends st{get(s){return new io(this,s)}}ut("TextAnchorOffsetArray",jn);class rr extends y{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]}}rr.prototype.size=8;class Gi extends Ye{get(s){return new rr(this,s)}}ut("FeatureIndexArray",Gi);class Bi extends O{}class Zi extends O{}class Po extends O{}class Ka extends F{}class Du extends Z{}class Ja extends J{}class Fr extends ee{}class Ou extends oe{}class Vd extends le{}class $r extends ce{}class jr extends ne{}class fs extends ge{}class ro extends xe{}class Si extends Ge{}const zi=M([{name:"a_pos",components:2,type:"Int16"}],4),{members:xr}=zi;class tn{constructor(s=[]){this.segments=s}prepareSegment(s,h,p,_){let k=this.segments[this.segments.length-1];return s>tn.MAX_VERTEX_ARRAY_LENGTH&&ot(`Max vertices per segment is ${tn.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${s}`),(!k||k.vertexLength+s>tn.MAX_VERTEX_ARRAY_LENGTH||k.sortKey!==_)&&(k={vertexOffset:h.length,primitiveOffset:p.length,vertexLength:0,primitiveLength:0},_!==void 0&&(k.sortKey=_),this.segments.push(k)),k}get(){return this.segments}destroy(){for(const s of this.segments)for(const h in s.vaos)s.vaos[h].destroy()}static simpleSegment(s,h,p,_){return new tn([{vertexOffset:s,primitiveOffset:h,vertexLength:p,primitiveLength:_,vaos:{},sortKey:0}])}}function Js(c,s){return 256*(c=Ie(Math.floor(c),0,255))+Ie(Math.floor(s),0,255)}tn.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,ut("SegmentVector",tn);const Qa=M([{name:"a_pattern_from",components:4,type:"Uint16"},{name:"a_pattern_to",components:4,type:"Uint16"},{name:"a_pixel_ratio_from",components:1,type:"Uint16"},{name:"a_pixel_ratio_to",components:1,type:"Uint16"}]);var el={exports:{}},Pm={exports:{}};Pm.exports=function(c,s){var h,p,_,k,S,T,A,B;for(p=c.length-(h=3&c.length),_=s,S=3432918353,T=461845907,B=0;B<p;)A=255&c.charCodeAt(B)|(255&c.charCodeAt(++B))<<8|(255&c.charCodeAt(++B))<<16|(255&c.charCodeAt(++B))<<24,++B,_=27492+(65535&(k=5*(65535&(_=(_^=A=(65535&(A=(A=(65535&A)*S+(((A>>>16)*S&65535)<<16)&4294967295)<<15|A>>>17))*T+(((A>>>16)*T&65535)<<16)&4294967295)<<13|_>>>19))+((5*(_>>>16)&65535)<<16)&4294967295))+((58964+(k>>>16)&65535)<<16);switch(A=0,h){case 3:A^=(255&c.charCodeAt(B+2))<<16;case 2:A^=(255&c.charCodeAt(B+1))<<8;case 1:_^=A=(65535&(A=(A=(65535&(A^=255&c.charCodeAt(B)))*S+(((A>>>16)*S&65535)<<16)&4294967295)<<15|A>>>17))*T+(((A>>>16)*T&65535)<<16)&4294967295}return _^=c.length,_=2246822507*(65535&(_^=_>>>16))+((2246822507*(_>>>16)&65535)<<16)&4294967295,_=3266489909*(65535&(_^=_>>>13))+((3266489909*(_>>>16)&65535)<<16)&4294967295,(_^=_>>>16)>>>0};var I_=Pm.exports,Dm={exports:{}};Dm.exports=function(c,s){for(var h,p=c.length,_=s^p,k=0;p>=4;)h=1540483477*(65535&(h=255&c.charCodeAt(k)|(255&c.charCodeAt(++k))<<8|(255&c.charCodeAt(++k))<<16|(255&c.charCodeAt(++k))<<24))+((1540483477*(h>>>16)&65535)<<16),_=1540483477*(65535&_)+((1540483477*(_>>>16)&65535)<<16)^(h=1540483477*(65535&(h^=h>>>24))+((1540483477*(h>>>16)&65535)<<16)),p-=4,++k;switch(p){case 3:_^=(255&c.charCodeAt(k+2))<<16;case 2:_^=(255&c.charCodeAt(k+1))<<8;case 1:_=1540483477*(65535&(_^=255&c.charCodeAt(k)))+((1540483477*(_>>>16)&65535)<<16)}return _=1540483477*(65535&(_^=_>>>13))+((1540483477*(_>>>16)&65535)<<16),(_^=_>>>15)>>>0};var ms=I_,Om=Dm.exports;el.exports=ms,el.exports.murmur3=ms,el.exports.murmur2=Om;var Bu=g(el.exports);class nc{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(s,h,p,_){this.ids.push(zu(s)),this.positions.push(h,p,_)}getPositions(s){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");const h=zu(s);let p=0,_=this.ids.length-1;for(;p<_;){const S=p+_>>1;this.ids[S]>=h?_=S:p=S+1}const k=[];for(;this.ids[p]===h;)k.push({index:this.positions[3*p],start:this.positions[3*p+1],end:this.positions[3*p+2]}),p++;return k}static serialize(s,h){const p=new Float64Array(s.ids),_=new Uint32Array(s.positions);return Nu(p,_,0,p.length-1),h&&h.push(p.buffer,_.buffer),{ids:p,positions:_}}static deserialize(s){const h=new nc;return h.ids=s.ids,h.positions=s.positions,h.indexed=!0,h}}function zu(c){const s=+c;return!isNaN(s)&&s<=Number.MAX_SAFE_INTEGER?s:Bu(String(c))}function Nu(c,s,h,p){for(;h<p;){const _=c[h+p>>1];let k=h-1,S=p+1;for(;;){do k++;while(c[k]<_);do S--;while(c[S]>_);if(k>=S)break;tl(c,k,S),tl(s,3*k,3*S),tl(s,3*k+1,3*S+1),tl(s,3*k+2,3*S+2)}S-h<p-S?(Nu(c,s,h,S),h=S+1):(Nu(c,s,S+1,p),p=S)}}function tl(c,s,h){const p=c[s];c[s]=c[h],c[h]=p}ut("FeaturePositionMap",nc);class ic{constructor(s,h){this.gl=s.gl,this.location=h}}class Bm extends ic{constructor(s,h){super(s,h),this.current=0}set(s){this.current!==s&&(this.current=s,this.gl.uniform1f(this.location,s))}}class qS extends ic{constructor(s,h){super(s,h),this.current=[0,0,0,0]}set(s){s[0]===this.current[0]&&s[1]===this.current[1]&&s[2]===this.current[2]&&s[3]===this.current[3]||(this.current=s,this.gl.uniform4f(this.location,s[0],s[1],s[2],s[3]))}}class WS extends ic{constructor(s,h){super(s,h),this.current=kn.transparent}set(s){s.r===this.current.r&&s.g===this.current.g&&s.b===this.current.b&&s.a===this.current.a||(this.current=s,this.gl.uniform4f(this.location,s.r,s.g,s.b,s.a))}}const eW=new Float32Array(16);function P_(c){return[Js(255*c.r,255*c.g),Js(255*c.b,255*c.a)]}class Fd{constructor(s,h,p){this.value=s,this.uniformNames=h.map(_=>`u_${_}`),this.type=p}setUniform(s,h,p){s.set(p.constantOr(this.value))}getBinding(s,h,p){return this.type==="color"?new WS(s,h):new Bm(s,h)}}class Ru{constructor(s,h){this.uniformNames=h.map(p=>`u_${p}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(s,h){this.pixelRatioFrom=h.pixelRatio,this.pixelRatioTo=s.pixelRatio,this.patternFrom=h.tlbr,this.patternTo=s.tlbr}setUniform(s,h,p,_){const k=_==="u_pattern_to"?this.patternTo:_==="u_pattern_from"?this.patternFrom:_==="u_pixel_ratio_to"?this.pixelRatioTo:_==="u_pixel_ratio_from"?this.pixelRatioFrom:null;k&&s.set(k)}getBinding(s,h,p){return p.substr(0,9)==="u_pattern"?new qS(s,h):new Bm(s,h)}}class Qs{constructor(s,h,p,_){this.expression=s,this.type=p,this.maxValue=0,this.paintVertexAttributes=h.map(k=>({name:`a_${k}`,type:"Float32",components:p==="color"?2:1,offset:0})),this.paintVertexArray=new _}populatePaintArray(s,h,p,_,k){const S=this.paintVertexArray.length,T=this.expression.evaluate(new Vn(0),h,{},_,[],k);this.paintVertexArray.resize(s),this._setPaintValue(S,s,T)}updatePaintArray(s,h,p,_){const k=this.expression.evaluate({zoom:0},p,_);this._setPaintValue(s,h,k)}_setPaintValue(s,h,p){if(this.type==="color"){const _=P_(p);for(let k=s;k<h;k++)this.paintVertexArray.emplace(k,_[0],_[1])}else{for(let _=s;_<h;_++)this.paintVertexArray.emplace(_,p);this.maxValue=Math.max(this.maxValue,Math.abs(p))}}upload(s){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=s.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class Wo{constructor(s,h,p,_,k,S){this.expression=s,this.uniformNames=h.map(T=>`u_${T}_t`),this.type=p,this.useIntegerZoom=_,this.zoom=k,this.maxValue=0,this.paintVertexAttributes=h.map(T=>({name:`a_${T}`,type:"Float32",components:p==="color"?4:2,offset:0})),this.paintVertexArray=new S}populatePaintArray(s,h,p,_,k){const S=this.expression.evaluate(new Vn(this.zoom),h,{},_,[],k),T=this.expression.evaluate(new Vn(this.zoom+1),h,{},_,[],k),A=this.paintVertexArray.length;this.paintVertexArray.resize(s),this._setPaintValue(A,s,S,T)}updatePaintArray(s,h,p,_){const k=this.expression.evaluate({zoom:this.zoom},p,_),S=this.expression.evaluate({zoom:this.zoom+1},p,_);this._setPaintValue(s,h,k,S)}_setPaintValue(s,h,p,_){if(this.type==="color"){const k=P_(p),S=P_(_);for(let T=s;T<h;T++)this.paintVertexArray.emplace(T,k[0],k[1],S[0],S[1])}else{for(let k=s;k<h;k++)this.paintVertexArray.emplace(k,p,_);this.maxValue=Math.max(this.maxValue,Math.abs(p),Math.abs(_))}}upload(s){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=s.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(s,h){const p=this.useIntegerZoom?Math.floor(h.zoom):h.zoom,_=Ie(this.expression.interpolationFactor(p,this.zoom,this.zoom+1),0,1);s.set(_)}getBinding(s,h,p){return new Bm(s,h)}}class nl{constructor(s,h,p,_,k,S){this.expression=s,this.type=h,this.useIntegerZoom=p,this.zoom=_,this.layerId=S,this.zoomInPaintVertexArray=new k,this.zoomOutPaintVertexArray=new k}populatePaintArray(s,h,p){const _=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(s),this.zoomOutPaintVertexArray.resize(s),this._setPaintValues(_,s,h.patterns&&h.patterns[this.layerId],p)}updatePaintArray(s,h,p,_,k){this._setPaintValues(s,h,p.patterns&&p.patterns[this.layerId],k)}_setPaintValues(s,h,p,_){if(!_||!p)return;const{min:k,mid:S,max:T}=p,A=_[k],B=_[S],z=_[T];if(A&&B&&z)for(let L=s;L<h;L++)this.zoomInPaintVertexArray.emplace(L,B.tl[0],B.tl[1],B.br[0],B.br[1],A.tl[0],A.tl[1],A.br[0],A.br[1],B.pixelRatio,A.pixelRatio),this.zoomOutPaintVertexArray.emplace(L,B.tl[0],B.tl[1],B.br[0],B.br[1],z.tl[0],z.tl[1],z.br[0],z.br[1],B.pixelRatio,z.pixelRatio)}upload(s){this.zoomInPaintVertexArray&&this.zoomInPaintVertexArray.arrayBuffer&&this.zoomOutPaintVertexArray&&this.zoomOutPaintVertexArray.arrayBuffer&&(this.zoomInPaintVertexBuffer=s.createVertexBuffer(this.zoomInPaintVertexArray,Qa.members,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=s.createVertexBuffer(this.zoomOutPaintVertexArray,Qa.members,this.expression.isStateDependent))}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}}class GS{constructor(s,h,p){this.binders={},this._buffers=[];const _=[];for(const k in s.paint._values){if(!p(k))continue;const S=s.paint.get(k);if(!(S instanceof Io&&La(S.property.specification)))continue;const T=tW(k,s.type),A=S.value,B=S.property.specification.type,z=S.property.useIntegerZoom,L=S.property.specification["property-type"],j=L==="cross-faded"||L==="cross-faded-data-driven";if(A.kind==="constant")this.binders[k]=j?new Ru(A.value,T):new Fd(A.value,T,B),_.push(`/u_${k}`);else if(A.kind==="source"||j){const q=ZS(k,B,"source");this.binders[k]=j?new nl(A,B,z,h,q,s.id):new Qs(A,T,B,q),_.push(`/a_${k}`)}else{const q=ZS(k,B,"composite");this.binders[k]=new Wo(A,T,B,z,h,q),_.push(`/z_${k}`)}}this.cacheKey=_.sort().join("")}getMaxValue(s){const h=this.binders[s];return h instanceof Qs||h instanceof Wo?h.maxValue:0}populatePaintArrays(s,h,p,_,k){for(const S in this.binders){const T=this.binders[S];(T instanceof Qs||T instanceof Wo||T instanceof nl)&&T.populatePaintArray(s,h,p,_,k)}}setConstantPatternPositions(s,h){for(const p in this.binders){const _=this.binders[p];_ instanceof Ru&&_.setConstantPatternPositions(s,h)}}updatePaintArrays(s,h,p,_,k){let S=!1;for(const T in s){const A=h.getPositions(T);for(const B of A){const z=p.feature(B.index);for(const L in this.binders){const j=this.binders[L];if((j instanceof Qs||j instanceof Wo||j instanceof nl)&&j.expression.isStateDependent===!0){const q=_.paint.get(L);j.expression=q.value,j.updatePaintArray(B.start,B.end,z,s[T],k),S=!0}}}}return S}defines(){const s=[];for(const h in this.binders){const p=this.binders[h];(p instanceof Fd||p instanceof Ru)&&s.push(...p.uniformNames.map(_=>`#define HAS_UNIFORM_${_}`))}return s}getBinderAttributes(){const s=[];for(const h in this.binders){const p=this.binders[h];if(p instanceof Qs||p instanceof Wo)for(let _=0;_<p.paintVertexAttributes.length;_++)s.push(p.paintVertexAttributes[_].name);else if(p instanceof nl)for(let _=0;_<Qa.members.length;_++)s.push(Qa.members[_].name)}return s}getBinderUniforms(){const s=[];for(const h in this.binders){const p=this.binders[h];if(p instanceof Fd||p instanceof Ru||p instanceof Wo)for(const _ of p.uniformNames)s.push(_)}return s}getPaintVertexBuffers(){return this._buffers}getUniforms(s,h){const p=[];for(const _ in this.binders){const k=this.binders[_];if(k instanceof Fd||k instanceof Ru||k instanceof Wo){for(const S of k.uniformNames)if(h[S]){const T=k.getBinding(s,h[S],S);p.push({name:S,property:_,binding:T})}}}return p}setUniforms(s,h,p,_){for(const{name:k,property:S,binding:T}of h)this.binders[S].setUniform(T,_,p.get(S),k)}updatePaintBuffers(s){this._buffers=[];for(const h in this.binders){const p=this.binders[h];if(s&&p instanceof nl){const _=s.fromScale===2?p.zoomInPaintVertexBuffer:p.zoomOutPaintVertexBuffer;_&&this._buffers.push(_)}else(p instanceof Qs||p instanceof Wo)&&p.paintVertexBuffer&&this._buffers.push(p.paintVertexBuffer)}}upload(s){for(const h in this.binders){const p=this.binders[h];(p instanceof Qs||p instanceof Wo||p instanceof nl)&&p.upload(s)}this.updatePaintBuffers()}destroy(){for(const s in this.binders){const h=this.binders[s];(h instanceof Qs||h instanceof Wo||h instanceof nl)&&h.destroy()}}}class rc{constructor(s,h,p=()=>!0){this.programConfigurations={};for(const _ of s)this.programConfigurations[_.id]=new GS(_,h,p);this.needsUpload=!1,this._featureMap=new nc,this._bufferOffset=0}populatePaintArrays(s,h,p,_,k,S){for(const T in this.programConfigurations)this.programConfigurations[T].populatePaintArrays(s,h,_,k,S);h.id!==void 0&&this._featureMap.add(h.id,p,this._bufferOffset,s),this._bufferOffset=s,this.needsUpload=!0}updatePaintArrays(s,h,p,_){for(const k of p)this.needsUpload=this.programConfigurations[k.id].updatePaintArrays(s,this._featureMap,h,k,_)||this.needsUpload}get(s){return this.programConfigurations[s]}upload(s){if(this.needsUpload){for(const h in this.programConfigurations)this.programConfigurations[h].upload(s);this.needsUpload=!1}}destroy(){for(const s in this.programConfigurations)this.programConfigurations[s].destroy()}}function tW(c,s){return{"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"line-gap-width":["gapwidth"],"line-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-extrusion-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"]}[c]||[c.replace(`${s}-`,"").replace(/-/g,"_")]}function ZS(c,s,h){const p={color:{source:J,composite:Bt},number:{source:Qe,composite:J}},_=function(k){return{"line-pattern":{source:Fr,composite:Fr},"fill-pattern":{source:Fr,composite:Fr},"fill-extrusion-pattern":{source:Fr,composite:Fr}}[k]}(c);return _&&_[h]||p[s][h]}ut("ConstantBinder",Fd),ut("CrossFadedConstantBinder",Ru),ut("SourceExpressionBinder",Qs),ut("CrossFadedCompositeBinder",nl),ut("CompositeExpressionBinder",Wo),ut("ProgramConfiguration",GS,{omit:["_buffers"]}),ut("ProgramConfigurationSet",rc);const ai=8192,D_=Math.pow(2,14)-1,YS=-D_-1;function oc(c){const s=ai/c.extent,h=c.loadGeometry();for(let p=0;p<h.length;p++){const _=h[p];for(let k=0;k<_.length;k++){const S=_[k],T=Math.round(S.x*s),A=Math.round(S.y*s);S.x=Ie(T,YS,D_),S.y=Ie(A,YS,D_),(T<S.x||T>S.x+1||A<S.y||A>S.y+1)&&ot("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return h}function sc(c,s){return{type:c.type,id:c.id,properties:c.properties,geometry:s?oc(c):[]}}function zm(c,s,h,p,_){c.emplaceBack(2*s+(p+1)/2,2*h+(_+1)/2)}class O_{constructor(s){this.zoom=s.zoom,this.overscaling=s.overscaling,this.layers=s.layers,this.layerIds=this.layers.map(h=>h.id),this.index=s.index,this.hasPattern=!1,this.layoutVertexArray=new Zi,this.indexArray=new ro,this.segments=new tn,this.programConfigurations=new rc(s.layers,s.zoom),this.stateDependentLayerIds=this.layers.filter(h=>h.isStateDependent()).map(h=>h.id)}populate(s,h,p){const _=this.layers[0],k=[];let S=null,T=!1;_.type==="circle"&&(S=_.layout.get("circle-sort-key"),T=!S.isConstant());for(const{feature:A,id:B,index:z,sourceLayerIndex:L}of s){const j=this.layers[0]._featureFilter.needGeometry,q=sc(A,j);if(!this.layers[0]._featureFilter.filter(new Vn(this.zoom),q,p))continue;const Y=T?S.evaluate(q,{},p):void 0,K={id:B,properties:A.properties,type:A.type,sourceLayerIndex:L,index:z,geometry:j?q.geometry:oc(A),patterns:{},sortKey:Y};k.push(K)}T&&k.sort((A,B)=>A.sortKey-B.sortKey);for(const A of k){const{geometry:B,index:z,sourceLayerIndex:L}=A,j=s[z].feature;this.addFeature(A,B,z,p),h.featureIndex.insert(j,B,z,L,this.index)}}update(s,h,p){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(s,h,this.stateDependentLayers,p)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(s){this.uploaded||(this.layoutVertexBuffer=s.createVertexBuffer(this.layoutVertexArray,xr),this.indexBuffer=s.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(s),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(s,h,p,_){for(const k of h)for(const S of k){const T=S.x,A=S.y;if(T<0||T>=ai||A<0||A>=ai)continue;const B=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,s.sortKey),z=B.vertexLength;zm(this.layoutVertexArray,T,A,-1,-1),zm(this.layoutVertexArray,T,A,1,-1),zm(this.layoutVertexArray,T,A,1,1),zm(this.layoutVertexArray,T,A,-1,1),this.indexArray.emplaceBack(z,z+1,z+2),this.indexArray.emplaceBack(z,z+3,z+2),B.vertexLength+=4,B.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,s,p,{},_)}}function XS(c,s){for(let h=0;h<c.length;h++)if(Lu(s,c[h]))return!0;for(let h=0;h<s.length;h++)if(Lu(c,s[h]))return!0;return!!B_(c,s)}function nW(c,s,h){return!!Lu(c,s)||!!z_(s,c,h)}function KS(c,s){if(c.length===1)return QS(s,c[0]);for(let h=0;h<s.length;h++){const p=s[h];for(let _=0;_<p.length;_++)if(Lu(c,p[_]))return!0}for(let h=0;h<c.length;h++)if(QS(s,c[h]))return!0;for(let h=0;h<s.length;h++)if(B_(c,s[h]))return!0;return!1}function iW(c,s,h){if(c.length>1){if(B_(c,s))return!0;for(let p=0;p<s.length;p++)if(z_(s[p],c,h))return!0}for(let p=0;p<c.length;p++)if(z_(c[p],s,h))return!0;return!1}function B_(c,s){if(c.length===0||s.length===0)return!1;for(let h=0;h<c.length-1;h++){const p=c[h],_=c[h+1];for(let k=0;k<s.length-1;k++)if(rW(p,_,s[k],s[k+1]))return!0}return!1}function rW(c,s,h,p){return Tt(c,h,p)!==Tt(s,h,p)&&Tt(c,s,h)!==Tt(c,s,p)}function z_(c,s,h){const p=h*h;if(s.length===1)return c.distSqr(s[0])<p;for(let _=1;_<s.length;_++)if(JS(c,s[_-1],s[_])<p)return!0;return!1}function JS(c,s,h){const p=s.distSqr(h);if(p===0)return c.distSqr(s);const _=((c.x-s.x)*(h.x-s.x)+(c.y-s.y)*(h.y-s.y))/p;return c.distSqr(_<0?s:_>1?h:h.sub(s)._mult(_)._add(s))}function QS(c,s){let h,p,_,k=!1;for(let S=0;S<c.length;S++){h=c[S];for(let T=0,A=h.length-1;T<h.length;A=T++)p=h[T],_=h[A],p.y>s.y!=_.y>s.y&&s.x<(_.x-p.x)*(s.y-p.y)/(_.y-p.y)+p.x&&(k=!k)}return k}function Lu(c,s){let h=!1;for(let p=0,_=c.length-1;p<c.length;_=p++){const k=c[p],S=c[_];k.y>s.y!=S.y>s.y&&s.x<(S.x-k.x)*(s.y-k.y)/(S.y-k.y)+k.x&&(h=!h)}return h}function oW(c,s,h){const p=h[0],_=h[2];if(c.x<p.x&&s.x<p.x||c.x>_.x&&s.x>_.x||c.y<p.y&&s.y<p.y||c.y>_.y&&s.y>_.y)return!1;const k=Tt(c,s,h[0]);return k!==Tt(c,s,h[1])||k!==Tt(c,s,h[2])||k!==Tt(c,s,h[3])}function $d(c,s,h){const p=s.paint.get(c).value;return p.kind==="constant"?p.value:h.programConfigurations.get(s.id).getMaxValue(c)}function Nm(c){return Math.sqrt(c[0]*c[0]+c[1]*c[1])}function Rm(c,s,h,p,_){if(!s[0]&&!s[1])return c;const k=E.convert(s)._mult(_);h==="viewport"&&k._rotate(-p);const S=[];for(let T=0;T<c.length;T++)S.push(c[T].sub(k));return S}let eE,tE;ut("CircleBucket",O_,{omit:["layers"]});var sW={get paint(){return tE=tE||new v({"circle-radius":new Et(we.paint_circle["circle-radius"]),"circle-color":new Et(we.paint_circle["circle-color"]),"circle-blur":new Et(we.paint_circle["circle-blur"]),"circle-opacity":new Et(we.paint_circle["circle-opacity"]),"circle-translate":new ft(we.paint_circle["circle-translate"]),"circle-translate-anchor":new ft(we.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new ft(we.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new ft(we.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new Et(we.paint_circle["circle-stroke-width"]),"circle-stroke-color":new Et(we.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new Et(we.paint_circle["circle-stroke-opacity"])})},get layout(){return eE=eE||new v({"circle-sort-key":new Et(we.layout_circle["circle-sort-key"])})}},or=1e-6,Vu=typeof Float32Array<"u"?Float32Array:Array;function N_(c){return c[0]=1,c[1]=0,c[2]=0,c[3]=0,c[4]=0,c[5]=1,c[6]=0,c[7]=0,c[8]=0,c[9]=0,c[10]=1,c[11]=0,c[12]=0,c[13]=0,c[14]=0,c[15]=1,c}function nE(c,s,h){var p=s[0],_=s[1],k=s[2],S=s[3],T=s[4],A=s[5],B=s[6],z=s[7],L=s[8],j=s[9],q=s[10],Y=s[11],K=s[12],re=s[13],ae=s[14],be=s[15],pe=h[0],ye=h[1],Te=h[2],Le=h[3];return c[0]=pe*p+ye*T+Te*L+Le*K,c[1]=pe*_+ye*A+Te*j+Le*re,c[2]=pe*k+ye*B+Te*q+Le*ae,c[3]=pe*S+ye*z+Te*Y+Le*be,c[4]=(pe=h[4])*p+(ye=h[5])*T+(Te=h[6])*L+(Le=h[7])*K,c[5]=pe*_+ye*A+Te*j+Le*re,c[6]=pe*k+ye*B+Te*q+Le*ae,c[7]=pe*S+ye*z+Te*Y+Le*be,c[8]=(pe=h[8])*p+(ye=h[9])*T+(Te=h[10])*L+(Le=h[11])*K,c[9]=pe*_+ye*A+Te*j+Le*re,c[10]=pe*k+ye*B+Te*q+Le*ae,c[11]=pe*S+ye*z+Te*Y+Le*be,c[12]=(pe=h[12])*p+(ye=h[13])*T+(Te=h[14])*L+(Le=h[15])*K,c[13]=pe*_+ye*A+Te*j+Le*re,c[14]=pe*k+ye*B+Te*q+Le*ae,c[15]=pe*S+ye*z+Te*Y+Le*be,c}Math.hypot||(Math.hypot=function(){for(var c=0,s=arguments.length;s--;)c+=arguments[s]*arguments[s];return Math.sqrt(c)});var jd,aW=nE;function Lm(c,s,h){var p=s[0],_=s[1],k=s[2],S=s[3];return c[0]=h[0]*p+h[4]*_+h[8]*k+h[12]*S,c[1]=h[1]*p+h[5]*_+h[9]*k+h[13]*S,c[2]=h[2]*p+h[6]*_+h[10]*k+h[14]*S,c[3]=h[3]*p+h[7]*_+h[11]*k+h[15]*S,c}jd=new Vu(4),Vu!=Float32Array&&(jd[0]=0,jd[1]=0,jd[2]=0,jd[3]=0);class lW extends d{constructor(s){super(s,sW)}createBucket(s){return new O_(s)}queryRadius(s){const h=s;return $d("circle-radius",this,h)+$d("circle-stroke-width",this,h)+Nm(this.paint.get("circle-translate"))}queryIntersectsFeature(s,h,p,_,k,S,T,A){const B=Rm(s,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),S.angle,T),z=this.paint.get("circle-radius").evaluate(h,p)+this.paint.get("circle-stroke-width").evaluate(h,p),L=this.paint.get("circle-pitch-alignment")==="map",j=L?B:function(Y,K){return Y.map(re=>iE(re,K))}(B,A),q=L?z*T:z;for(const Y of _)for(const K of Y){const re=L?K:iE(K,A);let ae=q;const be=Lm([],[K.x,K.y,0,1],A);if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?ae*=be[3]/S.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(ae*=S.cameraToCenterDistance/be[3]),nW(j,re,ae))return!0}return!1}}function iE(c,s){const h=Lm([],[c.x,c.y,0,1],s);return new E(h[0]/h[3],h[1]/h[3])}class rE extends O_{}let oE;ut("HeatmapBucket",rE,{omit:["layers"]});var cW={get paint(){return oE=oE||new v({"heatmap-radius":new Et(we.paint_heatmap["heatmap-radius"]),"heatmap-weight":new Et(we.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new ft(we.paint_heatmap["heatmap-intensity"]),"heatmap-color":new Ld(we.paint_heatmap["heatmap-color"]),"heatmap-opacity":new ft(we.paint_heatmap["heatmap-opacity"])})}};function R_(c,{width:s,height:h},p,_){if(_){if(_ instanceof Uint8ClampedArray)_=new Uint8Array(_.buffer);else if(_.length!==s*h*p)throw new RangeError(`mismatched image size. expected: ${_.length} but got: ${s*h*p}`)}else _=new Uint8Array(s*h*p);return c.width=s,c.height=h,c.data=_,c}function sE(c,{width:s,height:h},p){if(s===c.width&&h===c.height)return;const _=R_({},{width:s,height:h},p);L_(c,_,{x:0,y:0},{x:0,y:0},{width:Math.min(c.width,s),height:Math.min(c.height,h)},p),c.width=s,c.height=h,c.data=_.data}function L_(c,s,h,p,_,k){if(_.width===0||_.height===0)return s;if(_.width>c.width||_.height>c.height||h.x>c.width-_.width||h.y>c.height-_.height)throw new RangeError("out of range source coordinates for image copy");if(_.width>s.width||_.height>s.height||p.x>s.width-_.width||p.y>s.height-_.height)throw new RangeError("out of range destination coordinates for image copy");const S=c.data,T=s.data;if(S===T)throw new Error("srcData equals dstData, so image is already copied");for(let A=0;A<_.height;A++){const B=((h.y+A)*c.width+h.x)*k,z=((p.y+A)*s.width+p.x)*k;for(let L=0;L<_.width*k;L++)T[z+L]=S[B+L]}return s}class Ud{constructor(s,h){R_(this,s,1,h)}resize(s){sE(this,s,1)}clone(){return new Ud({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(s,h,p,_,k){L_(s,h,p,_,k,1)}}class oo{constructor(s,h){R_(this,s,4,h)}resize(s){sE(this,s,4)}replace(s,h){h?this.data.set(s):this.data=s instanceof Uint8ClampedArray?new Uint8Array(s.buffer):s}clone(){return new oo({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(s,h,p,_,k){L_(s,h,p,_,k,4)}}function aE(c){const s={},h=c.resolution||256,p=c.clips?c.clips.length:1,_=c.image||new oo({width:h,height:p});if(Math.log(h)/Math.LN2%1!=0)throw new Error(`width is not a power of 2 - ${h}`);const k=(S,T,A)=>{s[c.evaluationKey]=A;const B=c.expression.evaluate(s);_.data[S+T+0]=Math.floor(255*B.r/B.a),_.data[S+T+1]=Math.floor(255*B.g/B.a),_.data[S+T+2]=Math.floor(255*B.b/B.a),_.data[S+T+3]=Math.floor(255*B.a)};if(c.clips)for(let S=0,T=0;S<p;++S,T+=4*h)for(let A=0,B=0;A<h;A++,B+=4){const z=A/(h-1),{start:L,end:j}=c.clips[S];k(T,B,L*(1-z)+j*z)}else for(let S=0,T=0;S<h;S++,T+=4)k(0,T,S/(h-1));return _}ut("AlphaImage",Ud),ut("RGBAImage",oo);const V_="big-fb";class uW extends d{createBucket(s){return new rE(s)}constructor(s){super(s,cW),this.heatmapFbos=new Map,this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(s){s==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=aE({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbos.has(V_)&&this.heatmapFbos.delete(V_)}queryRadius(){return 0}queryIntersectsFeature(){return!1}hasOffscreenPass(){return this.paint.get("heatmap-opacity")!==0&&this.visibility!=="none"}}let lE;var hW={get paint(){return lE=lE||new v({"hillshade-illumination-direction":new ft(we.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new ft(we.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new ft(we.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new ft(we.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new ft(we.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new ft(we.paint_hillshade["hillshade-accent-color"])})}};class dW extends d{constructor(s){super(s,hW)}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&this.visibility!=="none"}}const pW=M([{name:"a_pos",components:2,type:"Int16"}],4),{members:fW}=pW;function cE(c,s,h=2){const p=s&&s.length,_=p?s[0]*h:c.length;let k=uE(c,0,_,h,!0);const S=[];if(!k||k.next===k.prev)return S;let T,A,B;if(p&&(k=function(z,L,j,q){const Y=[];for(let K=0,re=L.length;K<re;K++){const ae=uE(z,L[K]*q,K<re-1?L[K+1]*q:z.length,q,!1);ae===ae.next&&(ae.steiner=!0),Y.push(wW(ae))}Y.sort(bW);for(let K=0;K<Y.length;K++)j=xW(Y[K],j);return j}(c,s,k,h)),c.length>80*h){T=1/0,A=1/0;let z=-1/0,L=-1/0;for(let j=h;j<_;j+=h){const q=c[j],Y=c[j+1];q<T&&(T=q),Y<A&&(A=Y),q>z&&(z=q),Y>L&&(L=Y)}B=Math.max(z-T,L-A),B=B!==0?32767/B:0}return Hd(k,S,h,T,A,B,0),S}function uE(c,s,h,p,_){let k;if(_===function(S,T,A,B){let z=0;for(let L=T,j=A-B;L<A;L+=B)z+=(S[j]-S[L])*(S[L+1]+S[j+1]),j=L;return z}(c,s,h,p)>0)for(let S=s;S<h;S+=p)k=pE(S/p|0,c[S],c[S+1],k);else for(let S=h-p;S>=s;S-=p)k=pE(S/p|0,c[S],c[S+1],k);return k&&Vm(k,k.next)&&(Wd(k),k=k.next),k}function ac(c,s){if(!c)return c;s||(s=c);let h,p=c;do if(h=!1,p.steiner||!Vm(p,p.next)&&ii(p.prev,p,p.next)!==0)p=p.next;else{if(Wd(p),p=s=p.prev,p===p.next)break;h=!0}while(h||p!==s);return s}function Hd(c,s,h,p,_,k,S){if(!c)return;!S&&k&&function(A,B,z,L){let j=A;do j.z===0&&(j.z=F_(j.x,j.y,B,z,L)),j.prevZ=j.prev,j.nextZ=j.next,j=j.next;while(j!==A);j.prevZ.nextZ=null,j.prevZ=null,function(q){let Y,K=1;do{let re,ae=q;q=null;let be=null;for(Y=0;ae;){Y++;let pe=ae,ye=0;for(let Le=0;Le<K&&(ye++,pe=pe.nextZ,pe);Le++);let Te=K;for(;ye>0||Te>0&&pe;)ye!==0&&(Te===0||!pe||ae.z<=pe.z)?(re=ae,ae=ae.nextZ,ye--):(re=pe,pe=pe.nextZ,Te--),be?be.nextZ=re:q=re,re.prevZ=be,be=re;ae=pe}be.nextZ=null,K*=2}while(Y>1)}(j)}(c,p,_,k);let T=c;for(;c.prev!==c.next;){const A=c.prev,B=c.next;if(k?gW(c,p,_,k):mW(c))s.push(A.i,c.i,B.i),Wd(c),c=B.next,T=B.next;else if((c=B)===T){S?S===1?Hd(c=yW(ac(c),s),s,h,p,_,k,2):S===2&&_W(c,s,h,p,_,k):Hd(ac(c),s,h,p,_,k,1);break}}}function mW(c){const s=c.prev,h=c,p=c.next;if(ii(s,h,p)>=0)return!1;const _=s.x,k=h.x,S=p.x,T=s.y,A=h.y,B=p.y,z=_<k?_<S?_:S:k<S?k:S,L=T<A?T<B?T:B:A<B?A:B,j=_>k?_>S?_:S:k>S?k:S,q=T>A?T>B?T:B:A>B?A:B;let Y=p.next;for(;Y!==s;){if(Y.x>=z&&Y.x<=j&&Y.y>=L&&Y.y<=q&&Fu(_,T,k,A,S,B,Y.x,Y.y)&&ii(Y.prev,Y,Y.next)>=0)return!1;Y=Y.next}return!0}function gW(c,s,h,p){const _=c.prev,k=c,S=c.next;if(ii(_,k,S)>=0)return!1;const T=_.x,A=k.x,B=S.x,z=_.y,L=k.y,j=S.y,q=T<A?T<B?T:B:A<B?A:B,Y=z<L?z<j?z:j:L<j?L:j,K=T>A?T>B?T:B:A>B?A:B,re=z>L?z>j?z:j:L>j?L:j,ae=F_(q,Y,s,h,p),be=F_(K,re,s,h,p);let pe=c.prevZ,ye=c.nextZ;for(;pe&&pe.z>=ae&&ye&&ye.z<=be;){if(pe.x>=q&&pe.x<=K&&pe.y>=Y&&pe.y<=re&&pe!==_&&pe!==S&&Fu(T,z,A,L,B,j,pe.x,pe.y)&&ii(pe.prev,pe,pe.next)>=0||(pe=pe.prevZ,ye.x>=q&&ye.x<=K&&ye.y>=Y&&ye.y<=re&&ye!==_&&ye!==S&&Fu(T,z,A,L,B,j,ye.x,ye.y)&&ii(ye.prev,ye,ye.next)>=0))return!1;ye=ye.nextZ}for(;pe&&pe.z>=ae;){if(pe.x>=q&&pe.x<=K&&pe.y>=Y&&pe.y<=re&&pe!==_&&pe!==S&&Fu(T,z,A,L,B,j,pe.x,pe.y)&&ii(pe.prev,pe,pe.next)>=0)return!1;pe=pe.prevZ}for(;ye&&ye.z<=be;){if(ye.x>=q&&ye.x<=K&&ye.y>=Y&&ye.y<=re&&ye!==_&&ye!==S&&Fu(T,z,A,L,B,j,ye.x,ye.y)&&ii(ye.prev,ye,ye.next)>=0)return!1;ye=ye.nextZ}return!0}function yW(c,s){let h=c;do{const p=h.prev,_=h.next.next;!Vm(p,_)&&hE(p,h,h.next,_)&&qd(p,_)&&qd(_,p)&&(s.push(p.i,h.i,_.i),Wd(h),Wd(h.next),h=c=_),h=h.next}while(h!==c);return ac(h)}function _W(c,s,h,p,_,k){let S=c;do{let T=S.next.next;for(;T!==S.prev;){if(S.i!==T.i&&kW(S,T)){let A=dE(S,T);return S=ac(S,S.next),A=ac(A,A.next),Hd(S,s,h,p,_,k,0),void Hd(A,s,h,p,_,k,0)}T=T.next}S=S.next}while(S!==c)}function bW(c,s){return c.x-s.x}function xW(c,s){const h=function(_,k){let S=k;const T=_.x,A=_.y;let B,z=-1/0;do{if(A<=S.y&&A>=S.next.y&&S.next.y!==S.y){const K=S.x+(A-S.y)*(S.next.x-S.x)/(S.next.y-S.y);if(K<=T&&K>z&&(z=K,B=S.x<S.next.x?S:S.next,K===T))return B}S=S.next}while(S!==k);if(!B)return null;const L=B,j=B.x,q=B.y;let Y=1/0;S=B;do{if(T>=S.x&&S.x>=j&&T!==S.x&&Fu(A<q?T:z,A,j,q,A<q?z:T,A,S.x,S.y)){const K=Math.abs(A-S.y)/(T-S.x);qd(S,_)&&(K<Y||K===Y&&(S.x>B.x||S.x===B.x&&vW(B,S)))&&(B=S,Y=K)}S=S.next}while(S!==L);return B}(c,s);if(!h)return s;const p=dE(h,c);return ac(p,p.next),ac(h,h.next)}function vW(c,s){return ii(c.prev,c,s.prev)<0&&ii(s.next,c,c.next)<0}function F_(c,s,h,p,_){return(c=1431655765&((c=858993459&((c=252645135&((c=16711935&((c=(c-h)*_|0)|c<<8))|c<<4))|c<<2))|c<<1))|(s=1431655765&((s=858993459&((s=252645135&((s=16711935&((s=(s-p)*_|0)|s<<8))|s<<4))|s<<2))|s<<1))<<1}function wW(c){let s=c,h=c;do(s.x<h.x||s.x===h.x&&s.y<h.y)&&(h=s),s=s.next;while(s!==c);return h}function Fu(c,s,h,p,_,k,S,T){return(_-S)*(s-T)>=(c-S)*(k-T)&&(c-S)*(p-T)>=(h-S)*(s-T)&&(h-S)*(k-T)>=(_-S)*(p-T)}function kW(c,s){return c.next.i!==s.i&&c.prev.i!==s.i&&!function(h,p){let _=h;do{if(_.i!==h.i&&_.next.i!==h.i&&_.i!==p.i&&_.next.i!==p.i&&hE(_,_.next,h,p))return!0;_=_.next}while(_!==h);return!1}(c,s)&&(qd(c,s)&&qd(s,c)&&function(h,p){let _=h,k=!1;const S=(h.x+p.x)/2,T=(h.y+p.y)/2;do _.y>T!=_.next.y>T&&_.next.y!==_.y&&S<(_.next.x-_.x)*(T-_.y)/(_.next.y-_.y)+_.x&&(k=!k),_=_.next;while(_!==h);return k}(c,s)&&(ii(c.prev,c,s.prev)||ii(c,s.prev,s))||Vm(c,s)&&ii(c.prev,c,c.next)>0&&ii(s.prev,s,s.next)>0)}function ii(c,s,h){return(s.y-c.y)*(h.x-s.x)-(s.x-c.x)*(h.y-s.y)}function Vm(c,s){return c.x===s.x&&c.y===s.y}function hE(c,s,h,p){const _=$m(ii(c,s,h)),k=$m(ii(c,s,p)),S=$m(ii(h,p,c)),T=$m(ii(h,p,s));return _!==k&&S!==T||!(_!==0||!Fm(c,h,s))||!(k!==0||!Fm(c,p,s))||!(S!==0||!Fm(h,c,p))||!(T!==0||!Fm(h,s,p))}function Fm(c,s,h){return s.x<=Math.max(c.x,h.x)&&s.x>=Math.min(c.x,h.x)&&s.y<=Math.max(c.y,h.y)&&s.y>=Math.min(c.y,h.y)}function $m(c){return c>0?1:c<0?-1:0}function qd(c,s){return ii(c.prev,c,c.next)<0?ii(c,s,c.next)>=0&&ii(c,c.prev,s)>=0:ii(c,s,c.prev)<0||ii(c,c.next,s)<0}function dE(c,s){const h=$_(c.i,c.x,c.y),p=$_(s.i,s.x,s.y),_=c.next,k=s.prev;return c.next=s,s.prev=c,h.next=_,_.prev=h,p.next=h,h.prev=p,k.next=p,p.prev=k,p}function pE(c,s,h,p){const _=$_(c,s,h);return p?(_.next=p.next,_.prev=p,p.next.prev=_,p.next=_):(_.prev=_,_.next=_),_}function Wd(c){c.next.prev=c.prev,c.prev.next=c.next,c.prevZ&&(c.prevZ.nextZ=c.nextZ),c.nextZ&&(c.nextZ.prevZ=c.prevZ)}function $_(c,s,h){return{i:c,x:s,y:h,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function j_(c,s,h){const p=h.patternDependencies;let _=!1;for(const k of s){const S=k.paint.get(`${c}-pattern`);S.isConstant()||(_=!0);const T=S.constantOr(null);T&&(_=!0,p[T.to]=!0,p[T.from]=!0)}return _}function U_(c,s,h,p,_){const k=_.patternDependencies;for(const S of s){const T=S.paint.get(`${c}-pattern`).value;if(T.kind!=="constant"){let A=T.evaluate({zoom:p-1},h,{},_.availableImages),B=T.evaluate({zoom:p},h,{},_.availableImages),z=T.evaluate({zoom:p+1},h,{},_.availableImages);A=A&&A.name?A.name:A,B=B&&B.name?B.name:B,z=z&&z.name?z.name:z,k[A]=!0,k[B]=!0,k[z]=!0,h.patterns[S.id]={min:A,mid:B,max:z}}}return h}class H_{constructor(s){this.zoom=s.zoom,this.overscaling=s.overscaling,this.layers=s.layers,this.layerIds=this.layers.map(h=>h.id),this.index=s.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new Po,this.indexArray=new ro,this.indexArray2=new Si,this.programConfigurations=new rc(s.layers,s.zoom),this.segments=new tn,this.segments2=new tn,this.stateDependentLayerIds=this.layers.filter(h=>h.isStateDependent()).map(h=>h.id)}populate(s,h,p){this.hasPattern=j_("fill",this.layers,h);const _=this.layers[0].layout.get("fill-sort-key"),k=!_.isConstant(),S=[];for(const{feature:T,id:A,index:B,sourceLayerIndex:z}of s){const L=this.layers[0]._featureFilter.needGeometry,j=sc(T,L);if(!this.layers[0]._featureFilter.filter(new Vn(this.zoom),j,p))continue;const q=k?_.evaluate(j,{},p,h.availableImages):void 0,Y={id:A,properties:T.properties,type:T.type,sourceLayerIndex:z,index:B,geometry:L?j.geometry:oc(T),patterns:{},sortKey:q};S.push(Y)}k&&S.sort((T,A)=>T.sortKey-A.sortKey);for(const T of S){const{geometry:A,index:B,sourceLayerIndex:z}=T;if(this.hasPattern){const L=U_("fill",this.layers,T,this.zoom,h);this.patternFeatures.push(L)}else this.addFeature(T,A,B,p,{});h.featureIndex.insert(s[B].feature,A,B,z,this.index)}}update(s,h,p){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(s,h,this.stateDependentLayers,p)}addFeatures(s,h,p){for(const _ of this.patternFeatures)this.addFeature(_,_.geometry,_.index,h,p)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(s){this.uploaded||(this.layoutVertexBuffer=s.createVertexBuffer(this.layoutVertexArray,fW),this.indexBuffer=s.createIndexBuffer(this.indexArray),this.indexBuffer2=s.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(s),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy())}addFeature(s,h,p,_,k){for(const S of uu(h,500)){let T=0;for(const q of S)T+=q.length;const A=this.segments.prepareSegment(T,this.layoutVertexArray,this.indexArray),B=A.vertexLength,z=[],L=[];for(const q of S){if(q.length===0)continue;q!==S[0]&&L.push(z.length/2);const Y=this.segments2.prepareSegment(q.length,this.layoutVertexArray,this.indexArray2),K=Y.vertexLength;this.layoutVertexArray.emplaceBack(q[0].x,q[0].y),this.indexArray2.emplaceBack(K+q.length-1,K),z.push(q[0].x),z.push(q[0].y);for(let re=1;re<q.length;re++)this.layoutVertexArray.emplaceBack(q[re].x,q[re].y),this.indexArray2.emplaceBack(K+re-1,K+re),z.push(q[re].x),z.push(q[re].y);Y.vertexLength+=q.length,Y.primitiveLength+=q.length}const j=cE(z,L);for(let q=0;q<j.length;q+=3)this.indexArray.emplaceBack(B+j[q],B+j[q+1],B+j[q+2]);A.vertexLength+=T,A.primitiveLength+=j.length/3}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,s,p,k,_)}}let fE,mE;ut("FillBucket",H_,{omit:["layers","patternFeatures"]});var SW={get paint(){return mE=mE||new v({"fill-antialias":new ft(we.paint_fill["fill-antialias"]),"fill-opacity":new Et(we.paint_fill["fill-opacity"]),"fill-color":new Et(we.paint_fill["fill-color"]),"fill-outline-color":new Et(we.paint_fill["fill-outline-color"]),"fill-translate":new ft(we.paint_fill["fill-translate"]),"fill-translate-anchor":new ft(we.paint_fill["fill-translate-anchor"]),"fill-pattern":new Iu(we.paint_fill["fill-pattern"])})},get layout(){return fE=fE||new v({"fill-sort-key":new Et(we.layout_fill["fill-sort-key"])})}};class EW extends d{constructor(s){super(s,SW)}recalculate(s,h){super.recalculate(s,h);const p=this.paint._values["fill-outline-color"];p.value.kind==="constant"&&p.value.value===void 0&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(s){return new H_(s)}queryRadius(){return Nm(this.paint.get("fill-translate"))}queryIntersectsFeature(s,h,p,_,k,S,T){return KS(Rm(s,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),S.angle,T),_)}isTileClipped(){return!0}}const CW=M([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),TW=M([{name:"a_centroid",components:2,type:"Int16"}],4),{members:MW}=CW;var il={},AW=b,gE=$u;function $u(c,s,h,p,_){this.properties={},this.extent=h,this.type=0,this._pbf=c,this._geometry=-1,this._keys=p,this._values=_,c.readFields(IW,this,s)}function IW(c,s,h){c==1?s.id=h.readVarint():c==2?function(p,_){for(var k=p.readVarint()+p.pos;p.pos<k;){var S=_._keys[p.readVarint()],T=_._values[p.readVarint()];_.properties[S]=T}}(h,s):c==3?s.type=h.readVarint():c==4&&(s._geometry=h.pos)}function PW(c){for(var s,h,p=0,_=0,k=c.length,S=k-1;_<k;S=_++)p+=((h=c[S]).x-(s=c[_]).x)*(s.y+h.y);return p}$u.types=["Unknown","Point","LineString","Polygon"],$u.prototype.loadGeometry=function(){var c=this._pbf;c.pos=this._geometry;for(var s,h=c.readVarint()+c.pos,p=1,_=0,k=0,S=0,T=[];c.pos<h;){if(_<=0){var A=c.readVarint();p=7&A,_=A>>3}if(_--,p===1||p===2)k+=c.readSVarint(),S+=c.readSVarint(),p===1&&(s&&T.push(s),s=[]),s.push(new AW(k,S));else{if(p!==7)throw new Error("unknown command "+p);s&&s.push(s[0].clone())}}return s&&T.push(s),T},$u.prototype.bbox=function(){var c=this._pbf;c.pos=this._geometry;for(var s=c.readVarint()+c.pos,h=1,p=0,_=0,k=0,S=1/0,T=-1/0,A=1/0,B=-1/0;c.pos<s;){if(p<=0){var z=c.readVarint();h=7&z,p=z>>3}if(p--,h===1||h===2)(_+=c.readSVarint())<S&&(S=_),_>T&&(T=_),(k+=c.readSVarint())<A&&(A=k),k>B&&(B=k);else if(h!==7)throw new Error("unknown command "+h)}return[S,A,T,B]},$u.prototype.toGeoJSON=function(c,s,h){var p,_,k=this.extent*Math.pow(2,h),S=this.extent*c,T=this.extent*s,A=this.loadGeometry(),B=$u.types[this.type];function z(q){for(var Y=0;Y<q.length;Y++){var K=q[Y];q[Y]=[360*(K.x+S)/k-180,360/Math.PI*Math.atan(Math.exp((180-360*(K.y+T)/k)*Math.PI/180))-90]}}switch(this.type){case 1:var L=[];for(p=0;p<A.length;p++)L[p]=A[p][0];z(A=L);break;case 2:for(p=0;p<A.length;p++)z(A[p]);break;case 3:for(A=function(q){var Y=q.length;if(Y<=1)return[q];for(var K,re,ae=[],be=0;be<Y;be++){var pe=PW(q[be]);pe!==0&&(re===void 0&&(re=pe<0),re===pe<0?(K&&ae.push(K),K=[q[be]]):K.push(q[be]))}return K&&ae.push(K),ae}(A),p=0;p<A.length;p++)for(_=0;_<A[p].length;_++)z(A[p][_])}A.length===1?A=A[0]:B="Multi"+B;var j={type:"Feature",geometry:{type:B,coordinates:A},properties:this.properties};return"id"in this&&(j.id=this.id),j};var DW=gE,yE=_E;function _E(c,s){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=c,this._keys=[],this._values=[],this._features=[],c.readFields(OW,this,s),this.length=this._features.length}function OW(c,s,h){c===15?s.version=h.readVarint():c===1?s.name=h.readString():c===5?s.extent=h.readVarint():c===2?s._features.push(h.pos):c===3?s._keys.push(h.readString()):c===4&&s._values.push(function(p){for(var _=null,k=p.readVarint()+p.pos;p.pos<k;){var S=p.readVarint()>>3;_=S===1?p.readString():S===2?p.readFloat():S===3?p.readDouble():S===4?p.readVarint64():S===5?p.readVarint():S===6?p.readSVarint():S===7?p.readBoolean():null}return _}(h))}_E.prototype.feature=function(c){if(c<0||c>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[c];var s=this._pbf.readVarint()+this._pbf.pos;return new DW(this._pbf,s,this.extent,this._keys,this._values)};var BW=yE;function zW(c,s,h){if(c===3){var p=new BW(h,h.readVarint()+h.pos);p.length&&(s[p.name]=p)}}il.VectorTile=function(c,s){this.layers=c.readFields(zW,{},s)},il.VectorTileFeature=gE,il.VectorTileLayer=yE;const NW=il.VectorTileFeature.types,q_=Math.pow(2,13);function Gd(c,s,h,p,_,k,S,T){c.emplaceBack(s,h,2*Math.floor(p*q_)+S,_*q_*2,k*q_*2,Math.round(T))}class W_{constructor(s){this.zoom=s.zoom,this.overscaling=s.overscaling,this.layers=s.layers,this.layerIds=this.layers.map(h=>h.id),this.index=s.index,this.hasPattern=!1,this.layoutVertexArray=new Ka,this.centroidVertexArray=new Bi,this.indexArray=new ro,this.programConfigurations=new rc(s.layers,s.zoom),this.segments=new tn,this.stateDependentLayerIds=this.layers.filter(h=>h.isStateDependent()).map(h=>h.id)}populate(s,h,p){this.features=[],this.hasPattern=j_("fill-extrusion",this.layers,h);for(const{feature:_,id:k,index:S,sourceLayerIndex:T}of s){const A=this.layers[0]._featureFilter.needGeometry,B=sc(_,A);if(!this.layers[0]._featureFilter.filter(new Vn(this.zoom),B,p))continue;const z={id:k,sourceLayerIndex:T,index:S,geometry:A?B.geometry:oc(_),properties:_.properties,type:_.type,patterns:{}};this.hasPattern?this.features.push(U_("fill-extrusion",this.layers,z,this.zoom,h)):this.addFeature(z,z.geometry,S,p,{}),h.featureIndex.insert(_,z.geometry,S,T,this.index,!0)}}addFeatures(s,h,p){for(const _ of this.features){const{geometry:k}=_;this.addFeature(_,k,_.index,h,p)}}update(s,h,p){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(s,h,this.stateDependentLayers,p)}isEmpty(){return this.layoutVertexArray.length===0&&this.centroidVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(s){this.uploaded||(this.layoutVertexBuffer=s.createVertexBuffer(this.layoutVertexArray,MW),this.centroidVertexBuffer=s.createVertexBuffer(this.centroidVertexArray,TW.members,!0),this.indexBuffer=s.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(s),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(s,h,p,_,k){for(const S of uu(h,500)){const T={x:0,y:0,vertexCount:0};let A=0;for(const Y of S)A+=Y.length;let B=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(const Y of S){if(Y.length===0||LW(Y))continue;let K=0;for(let re=0;re<Y.length;re++){const ae=Y[re];if(re>=1){const be=Y[re-1];if(!RW(ae,be)){B.vertexLength+4>tn.MAX_VERTEX_ARRAY_LENGTH&&(B=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const pe=ae.sub(be)._perp()._unit(),ye=be.dist(ae);K+ye>32768&&(K=0),Gd(this.layoutVertexArray,ae.x,ae.y,pe.x,pe.y,0,0,K),Gd(this.layoutVertexArray,ae.x,ae.y,pe.x,pe.y,0,1,K),T.x+=2*ae.x,T.y+=2*ae.y,T.vertexCount+=2,K+=ye,Gd(this.layoutVertexArray,be.x,be.y,pe.x,pe.y,0,0,K),Gd(this.layoutVertexArray,be.x,be.y,pe.x,pe.y,0,1,K),T.x+=2*be.x,T.y+=2*be.y,T.vertexCount+=2;const Te=B.vertexLength;this.indexArray.emplaceBack(Te,Te+2,Te+1),this.indexArray.emplaceBack(Te+1,Te+2,Te+3),B.vertexLength+=4,B.primitiveLength+=2}}}}if(B.vertexLength+A>tn.MAX_VERTEX_ARRAY_LENGTH&&(B=this.segments.prepareSegment(A,this.layoutVertexArray,this.indexArray)),NW[s.type]!=="Polygon")continue;const z=[],L=[],j=B.vertexLength;for(const Y of S)if(Y.length!==0){Y!==S[0]&&L.push(z.length/2);for(let K=0;K<Y.length;K++){const re=Y[K];Gd(this.layoutVertexArray,re.x,re.y,0,0,1,1,0),T.x+=re.x,T.y+=re.y,T.vertexCount+=1,z.push(re.x),z.push(re.y)}}const q=cE(z,L);for(let Y=0;Y<q.length;Y+=3)this.indexArray.emplaceBack(j+q[Y],j+q[Y+2],j+q[Y+1]);B.primitiveLength+=q.length/3,B.vertexLength+=A;for(let Y=0;Y<T.vertexCount;Y++){const K=Math.floor(T.x/T.vertexCount),re=Math.floor(T.y/T.vertexCount);this.centroidVertexArray.emplaceBack(K,re)}}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,s,p,k,_)}}function RW(c,s){return c.x===s.x&&(c.x<0||c.x>ai)||c.y===s.y&&(c.y<0||c.y>ai)}function LW(c){return c.every(s=>s.x<0)||c.every(s=>s.x>ai)||c.every(s=>s.y<0)||c.every(s=>s.y>ai)}let bE;ut("FillExtrusionBucket",W_,{omit:["layers","features"]});var VW={get paint(){return bE=bE||new v({"fill-extrusion-opacity":new ft(we["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new Et(we["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new ft(we["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new ft(we["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new Iu(we["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new Et(we["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new Et(we["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new ft(we["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};class FW extends d{constructor(s){super(s,VW)}createBucket(s){return new W_(s)}queryRadius(){return Nm(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(s,h,p,_,k,S,T,A){const B=Rm(s,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),S.angle,T),z=this.paint.get("fill-extrusion-height").evaluate(h,p),L=this.paint.get("fill-extrusion-base").evaluate(h,p),j=function(Y,K,re,ae){const be=[];for(const pe of Y){const ye=[pe.x,pe.y,0,1];Lm(ye,ye,K),be.push(new E(ye[0]/ye[3],ye[1]/ye[3]))}return be}(B,A),q=function(Y,K,re,ae){const be=[],pe=[],ye=ae[8]*K,Te=ae[9]*K,Le=ae[10]*K,rt=ae[11]*K,St=ae[8]*re,tt=ae[9]*re,Je=ae[10]*re,yt=ae[11]*re;for(const dt of Y){const at=[],Oe=[];for(const bt of dt){const gt=bt.x,Ot=bt.y,Dn=ae[0]*gt+ae[4]*Ot+ae[12],An=ae[1]*gt+ae[5]*Ot+ae[13],gi=ae[2]*gt+ae[6]*Ot+ae[14],Do=ae[3]*gt+ae[7]*Ot+ae[15],Ri=gi+Le,yi=Do+rt,sr=Dn+St,ar=An+tt,lr=gi+Je,ei=Do+yt,_i=new E((Dn+ye)/yi,(An+Te)/yi);_i.z=Ri/yi,at.push(_i);const Yi=new E(sr/ei,ar/ei);Yi.z=lr/ei,Oe.push(Yi)}be.push(at),pe.push(Oe)}return[be,pe]}(_,L,z,A);return function(Y,K,re){let ae=1/0;KS(re,K)&&(ae=xE(re,K[0]));for(let be=0;be<K.length;be++){const pe=K[be],ye=Y[be];for(let Te=0;Te<pe.length-1;Te++){const Le=pe[Te],rt=[Le,pe[Te+1],ye[Te+1],ye[Te],Le];XS(re,rt)&&(ae=Math.min(ae,xE(re,rt)))}}return ae!==1/0&&ae}(q[0],q[1],j)}}function Zd(c,s){return c.x*s.x+c.y*s.y}function xE(c,s){if(c.length===1){let h=0;const p=s[h++];let _;for(;!_||p.equals(_);)if(_=s[h++],!_)return 1/0;for(;h<s.length;h++){const k=s[h],S=c[0],T=_.sub(p),A=k.sub(p),B=S.sub(p),z=Zd(T,T),L=Zd(T,A),j=Zd(A,A),q=Zd(B,T),Y=Zd(B,A),K=z*j-L*L,re=(j*q-L*Y)/K,ae=(z*Y-L*q)/K,be=p.z*(1-re-ae)+_.z*re+k.z*ae;if(isFinite(be))return be}return 1/0}{let h=1/0;for(const p of s)h=Math.min(h,p.z);return h}}const $W=M([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:jW}=$W,UW=M([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:HW}=UW,qW=il.VectorTileFeature.types,WW=Math.cos(Math.PI/180*37.5),vE=Math.pow(2,14)/.5;class G_{constructor(s){this.zoom=s.zoom,this.overscaling=s.overscaling,this.layers=s.layers,this.layerIds=this.layers.map(h=>h.id),this.index=s.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(h=>{this.gradients[h.id]={}}),this.layoutVertexArray=new Du,this.layoutVertexArray2=new Ja,this.indexArray=new ro,this.programConfigurations=new rc(s.layers,s.zoom),this.segments=new tn,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(h=>h.isStateDependent()).map(h=>h.id)}populate(s,h,p){this.hasPattern=j_("line",this.layers,h);const _=this.layers[0].layout.get("line-sort-key"),k=!_.isConstant(),S=[];for(const{feature:T,id:A,index:B,sourceLayerIndex:z}of s){const L=this.layers[0]._featureFilter.needGeometry,j=sc(T,L);if(!this.layers[0]._featureFilter.filter(new Vn(this.zoom),j,p))continue;const q=k?_.evaluate(j,{},p):void 0,Y={id:A,properties:T.properties,type:T.type,sourceLayerIndex:z,index:B,geometry:L?j.geometry:oc(T),patterns:{},sortKey:q};S.push(Y)}k&&S.sort((T,A)=>T.sortKey-A.sortKey);for(const T of S){const{geometry:A,index:B,sourceLayerIndex:z}=T;if(this.hasPattern){const L=U_("line",this.layers,T,this.zoom,h);this.patternFeatures.push(L)}else this.addFeature(T,A,B,p,{});h.featureIndex.insert(s[B].feature,A,B,z,this.index)}}update(s,h,p){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(s,h,this.stateDependentLayers,p)}addFeatures(s,h,p){for(const _ of this.patternFeatures)this.addFeature(_,_.geometry,_.index,h,p)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(s){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=s.createVertexBuffer(this.layoutVertexArray2,HW)),this.layoutVertexBuffer=s.createVertexBuffer(this.layoutVertexArray,jW),this.indexBuffer=s.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(s),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(s){if(s.properties&&Object.prototype.hasOwnProperty.call(s.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(s.properties,"mapbox_clip_end"))return{start:+s.properties.mapbox_clip_start,end:+s.properties.mapbox_clip_end}}addFeature(s,h,p,_,k){const S=this.layers[0].layout,T=S.get("line-join").evaluate(s,{}),A=S.get("line-cap"),B=S.get("line-miter-limit"),z=S.get("line-round-limit");this.lineClips=this.lineFeatureClips(s);for(const L of h)this.addLine(L,s,T,A,B,z);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,s,p,k,_)}addLine(s,h,p,_,k,S){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let ae=0;ae<s.length-1;ae++)this.totalDistance+=s[ae].dist(s[ae+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}const T=qW[h.type]==="Polygon";let A=s.length;for(;A>=2&&s[A-1].equals(s[A-2]);)A--;let B=0;for(;B<A-1&&s[B].equals(s[B+1]);)B++;if(A<(T?3:2))return;p==="bevel"&&(k=1.05);const z=this.overscaling<=16?15*ai/(512*this.overscaling):0,L=this.segments.prepareSegment(10*A,this.layoutVertexArray,this.indexArray);let j,q,Y,K,re;this.e1=this.e2=-1,T&&(j=s[A-2],re=s[B].sub(j)._unit()._perp());for(let ae=B;ae<A;ae++){if(Y=ae===A-1?T?s[B+1]:void 0:s[ae+1],Y&&s[ae].equals(Y))continue;re&&(K=re),j&&(q=j),j=s[ae],re=Y?Y.sub(j)._unit()._perp():K,K=K||re;let be=K.add(re);be.x===0&&be.y===0||be._unit();const pe=K.x*re.x+K.y*re.y,ye=be.x*re.x+be.y*re.y,Te=ye!==0?1/ye:1/0,Le=2*Math.sqrt(2-2*ye),rt=ye<WW&&q&&Y,St=K.x*re.y-K.y*re.x>0;if(rt&&ae>B){const yt=j.dist(q);if(yt>2*z){const dt=j.sub(j.sub(q)._mult(z/yt)._round());this.updateDistance(q,dt),this.addCurrentVertex(dt,K,0,0,L),q=dt}}const tt=q&&Y;let Je=tt?p:T?"butt":_;if(tt&&Je==="round"&&(Te<S?Je="miter":Te<=2&&(Je="fakeround")),Je==="miter"&&Te>k&&(Je="bevel"),Je==="bevel"&&(Te>2&&(Je="flipbevel"),Te<k&&(Je="miter")),q&&this.updateDistance(q,j),Je==="miter")be._mult(Te),this.addCurrentVertex(j,be,0,0,L);else if(Je==="flipbevel"){if(Te>100)be=re.mult(-1);else{const yt=Te*K.add(re).mag()/K.sub(re).mag();be._perp()._mult(yt*(St?-1:1))}this.addCurrentVertex(j,be,0,0,L),this.addCurrentVertex(j,be.mult(-1),0,0,L)}else if(Je==="bevel"||Je==="fakeround"){const yt=-Math.sqrt(Te*Te-1),dt=St?yt:0,at=St?0:yt;if(q&&this.addCurrentVertex(j,K,dt,at,L),Je==="fakeround"){const Oe=Math.round(180*Le/Math.PI/20);for(let bt=1;bt<Oe;bt++){let gt=bt/Oe;if(gt!==.5){const Dn=gt-.5;gt+=gt*Dn*(gt-1)*((1.0904+pe*(pe*(3.55645-1.43519*pe)-3.2452))*Dn*Dn+(.848013+pe*(.215638*pe-1.06021)))}const Ot=re.sub(K)._mult(gt)._add(K)._unit()._mult(St?-1:1);this.addHalfVertex(j,Ot.x,Ot.y,!1,St,0,L)}}Y&&this.addCurrentVertex(j,re,-dt,-at,L)}else if(Je==="butt")this.addCurrentVertex(j,be,0,0,L);else if(Je==="square"){const yt=q?1:-1;this.addCurrentVertex(j,be,yt,yt,L)}else Je==="round"&&(q&&(this.addCurrentVertex(j,K,0,0,L),this.addCurrentVertex(j,K,1,1,L,!0)),Y&&(this.addCurrentVertex(j,re,-1,-1,L,!0),this.addCurrentVertex(j,re,0,0,L)));if(rt&&ae<A-1){const yt=j.dist(Y);if(yt>2*z){const dt=j.add(Y.sub(j)._mult(z/yt)._round());this.updateDistance(j,dt),this.addCurrentVertex(dt,re,0,0,L),j=dt}}}}addCurrentVertex(s,h,p,_,k,S=!1){const T=h.y*_-h.x,A=-h.y-h.x*_;this.addHalfVertex(s,h.x+h.y*p,h.y-h.x*p,S,!1,p,k),this.addHalfVertex(s,T,A,S,!0,-_,k),this.distance>vE/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(s,h,p,_,k,S))}addHalfVertex({x:s,y:h},p,_,k,S,T,A){const B=.5*(this.lineClips?this.scaledDistance*(vE-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((s<<1)+(k?1:0),(h<<1)+(S?1:0),Math.round(63*p)+128,Math.round(63*_)+128,1+(T===0?0:T<0?-1:1)|(63&B)<<2,B>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);const z=A.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,z),A.primitiveLength++),S?this.e2=z:this.e1=z}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(s,h){this.distance+=s.dist(h),this.updateScaledDistance()}}let wE,kE;ut("LineBucket",G_,{omit:["layers","patternFeatures"]});var SE={get paint(){return kE=kE||new v({"line-opacity":new Et(we.paint_line["line-opacity"]),"line-color":new Et(we.paint_line["line-color"]),"line-translate":new ft(we.paint_line["line-translate"]),"line-translate-anchor":new ft(we.paint_line["line-translate-anchor"]),"line-width":new Et(we.paint_line["line-width"]),"line-gap-width":new Et(we.paint_line["line-gap-width"]),"line-offset":new Et(we.paint_line["line-offset"]),"line-blur":new Et(we.paint_line["line-blur"]),"line-dasharray":new Pu(we.paint_line["line-dasharray"]),"line-pattern":new Iu(we.paint_line["line-pattern"]),"line-gradient":new Ld(we.paint_line["line-gradient"])})},get layout(){return wE=wE||new v({"line-cap":new ft(we.layout_line["line-cap"]),"line-join":new Et(we.layout_line["line-join"]),"line-miter-limit":new ft(we.layout_line["line-miter-limit"]),"line-round-limit":new ft(we.layout_line["line-round-limit"]),"line-sort-key":new Et(we.layout_line["line-sort-key"])})}};class GW extends Et{possiblyEvaluate(s,h){return h=new Vn(Math.floor(h.zoom),{now:h.now,fadeDuration:h.fadeDuration,zoomHistory:h.zoomHistory,transition:h.transition}),super.possiblyEvaluate(s,h)}evaluate(s,h,p,_){return h=Se({},h,{zoom:Math.floor(h.zoom)}),super.evaluate(s,h,p,_)}}let jm;class ZW extends d{constructor(s){super(s,SE),this.gradientVersion=0,jm||(jm=new GW(SE.paint.properties["line-width"].specification),jm.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(s){if(s==="line-gradient"){const h=this.gradientExpression();this.stepInterpolant=!!function(p){return p._styleExpression!==void 0}(h)&&h._styleExpression.expression instanceof Da,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(s,h){super.recalculate(s,h),this.paint._values["line-floorwidth"]=jm.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,s)}createBucket(s){return new G_(s)}queryRadius(s){const h=s,p=EE($d("line-width",this,h),$d("line-gap-width",this,h)),_=$d("line-offset",this,h);return p/2+Math.abs(_)+Nm(this.paint.get("line-translate"))}queryIntersectsFeature(s,h,p,_,k,S,T){const A=Rm(s,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),S.angle,T),B=T/2*EE(this.paint.get("line-width").evaluate(h,p),this.paint.get("line-gap-width").evaluate(h,p)),z=this.paint.get("line-offset").evaluate(h,p);return z&&(_=function(L,j){const q=[];for(let Y=0;Y<L.length;Y++){const K=L[Y],re=[];for(let ae=0;ae<K.length;ae++){const be=K[ae-1],pe=K[ae],ye=K[ae+1],Te=ae===0?new E(0,0):pe.sub(be)._unit()._perp(),Le=ae===K.length-1?new E(0,0):ye.sub(pe)._unit()._perp(),rt=Te._add(Le)._unit(),St=rt.x*Le.x+rt.y*Le.y;St!==0&&rt._mult(1/St),re.push(rt._mult(j)._add(pe))}q.push(re)}return q}(_,z*T)),function(L,j,q){for(let Y=0;Y<j.length;Y++){const K=j[Y];if(L.length>=3){for(let re=0;re<K.length;re++)if(Lu(L,K[re]))return!0}if(iW(L,K,q))return!0}return!1}(A,_,B)}isTileClipped(){return!0}}function EE(c,s){return s>0?s+2*c:c}const YW=M([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),XW=M([{name:"a_projected_pos",components:3,type:"Float32"}],4);M([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const KW=M([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_box_real",components:2,type:"Int16"}]);M([{type:"Int16",name:"anchorPointX"},{type:"Int16",name:"anchorPointY"},{type:"Int16",name:"x1"},{type:"Int16",name:"y1"},{type:"Int16",name:"x2"},{type:"Int16",name:"y2"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]);const CE=M([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),JW=M([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function QW(c,s,h){return c.sections.forEach(p=>{p.text=function(_,k,S){const T=k.layout.get("text-transform").evaluate(S,{});return T==="uppercase"?_=_.toLocaleUpperCase():T==="lowercase"&&(_=_.toLocaleLowerCase()),br.applyArabicShaping&&(_=br.applyArabicShaping(_)),_}(p.text,s,h)}),c}M([{name:"triangle",components:3,type:"Uint16"}]),M([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Uint16",name:"glyphStartIndex"},{type:"Uint16",name:"numGlyphs"},{type:"Uint32",name:"vertexStartIndex"},{type:"Uint32",name:"lineStartIndex"},{type:"Uint32",name:"lineLength"},{type:"Uint16",name:"segment"},{type:"Uint16",name:"lowerSize"},{type:"Uint16",name:"upperSize"},{type:"Float32",name:"lineOffsetX"},{type:"Float32",name:"lineOffsetY"},{type:"Uint8",name:"writingMode"},{type:"Uint8",name:"placedOrientation"},{type:"Uint8",name:"hidden"},{type:"Uint32",name:"crossTileID"},{type:"Int16",name:"associatedIconIndex"}]),M([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Int16",name:"rightJustifiedTextSymbolIndex"},{type:"Int16",name:"centerJustifiedTextSymbolIndex"},{type:"Int16",name:"leftJustifiedTextSymbolIndex"},{type:"Int16",name:"verticalPlacedTextSymbolIndex"},{type:"Int16",name:"placedIconSymbolIndex"},{type:"Int16",name:"verticalPlacedIconSymbolIndex"},{type:"Uint16",name:"key"},{type:"Uint16",name:"textBoxStartIndex"},{type:"Uint16",name:"textBoxEndIndex"},{type:"Uint16",name:"verticalTextBoxStartIndex"},{type:"Uint16",name:"verticalTextBoxEndIndex"},{type:"Uint16",name:"iconBoxStartIndex"},{type:"Uint16",name:"iconBoxEndIndex"},{type:"Uint16",name:"verticalIconBoxStartIndex"},{type:"Uint16",name:"verticalIconBoxEndIndex"},{type:"Uint16",name:"featureIndex"},{type:"Uint16",name:"numHorizontalGlyphVertices"},{type:"Uint16",name:"numVerticalGlyphVertices"},{type:"Uint16",name:"numIconVertices"},{type:"Uint16",name:"numVerticalIconVertices"},{type:"Uint16",name:"useRuntimeCollisionCircles"},{type:"Uint32",name:"crossTileID"},{type:"Float32",name:"textBoxScale"},{type:"Float32",name:"collisionCircleDiameter"},{type:"Uint16",name:"textAnchorOffsetStartIndex"},{type:"Uint16",name:"textAnchorOffsetEndIndex"}]),M([{type:"Float32",name:"offsetX"}]),M([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),M([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);const Yd={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};var hi=24,TE=Mn,ME=function(c,s,h,p,_){var k,S,T=8*_-p-1,A=(1<<T)-1,B=A>>1,z=-7,L=_-1,j=-1,q=c[s+L];for(L+=j,k=q&(1<<-z)-1,q>>=-z,z+=T;z>0;k=256*k+c[s+L],L+=j,z-=8);for(S=k&(1<<-z)-1,k>>=-z,z+=p;z>0;S=256*S+c[s+L],L+=j,z-=8);if(k===0)k=1-B;else{if(k===A)return S?NaN:1/0*(q?-1:1);S+=Math.pow(2,p),k-=B}return(q?-1:1)*S*Math.pow(2,k-p)},AE=function(c,s,h,p,_,k){var S,T,A,B=8*k-_-1,z=(1<<B)-1,L=z>>1,j=_===23?Math.pow(2,-24)-Math.pow(2,-77):0,q=0,Y=1,K=s<0||s===0&&1/s<0?1:0;for(s=Math.abs(s),isNaN(s)||s===1/0?(T=isNaN(s)?1:0,S=z):(S=Math.floor(Math.log(s)/Math.LN2),s*(A=Math.pow(2,-S))<1&&(S--,A*=2),(s+=S+L>=1?j/A:j*Math.pow(2,1-L))*A>=2&&(S++,A/=2),S+L>=z?(T=0,S=z):S+L>=1?(T=(s*A-1)*Math.pow(2,_),S+=L):(T=s*Math.pow(2,L-1)*Math.pow(2,_),S=0));_>=8;c[h+q]=255&T,q+=Y,T/=256,_-=8);for(S=S<<_|T,B+=_;B>0;c[h+q]=255&S,q+=Y,S/=256,B-=8);c[h+q-Y]|=128*K};function Mn(c){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(c)?c:new Uint8Array(c||0),this.pos=0,this.type=0,this.length=this.buf.length}Mn.Varint=0,Mn.Fixed64=1,Mn.Bytes=2,Mn.Fixed32=5;var Z_=4294967296,IE=1/Z_,PE=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");function ea(c){return c.type===Mn.Bytes?c.readVarint()+c.pos:c.pos+1}function ju(c,s,h){return h?4294967296*s+(c>>>0):4294967296*(s>>>0)+(c>>>0)}function DE(c,s,h){var p=s<=16383?1:s<=2097151?2:s<=268435455?3:Math.floor(Math.log(s)/(7*Math.LN2));h.realloc(p);for(var _=h.pos-1;_>=c;_--)h.buf[_+p]=h.buf[_]}function eG(c,s){for(var h=0;h<c.length;h++)s.writeVarint(c[h])}function tG(c,s){for(var h=0;h<c.length;h++)s.writeSVarint(c[h])}function nG(c,s){for(var h=0;h<c.length;h++)s.writeFloat(c[h])}function iG(c,s){for(var h=0;h<c.length;h++)s.writeDouble(c[h])}function rG(c,s){for(var h=0;h<c.length;h++)s.writeBoolean(c[h])}function oG(c,s){for(var h=0;h<c.length;h++)s.writeFixed32(c[h])}function sG(c,s){for(var h=0;h<c.length;h++)s.writeSFixed32(c[h])}function aG(c,s){for(var h=0;h<c.length;h++)s.writeFixed64(c[h])}function lG(c,s){for(var h=0;h<c.length;h++)s.writeSFixed64(c[h])}function Um(c,s){return(c[s]|c[s+1]<<8|c[s+2]<<16)+16777216*c[s+3]}function Uu(c,s,h){c[h]=s,c[h+1]=s>>>8,c[h+2]=s>>>16,c[h+3]=s>>>24}function OE(c,s){return(c[s]|c[s+1]<<8|c[s+2]<<16)+(c[s+3]<<24)}Mn.prototype={destroy:function(){this.buf=null},readFields:function(c,s,h){for(h=h||this.length;this.pos<h;){var p=this.readVarint(),_=p>>3,k=this.pos;this.type=7&p,c(_,s,this),this.pos===k&&this.skip(p)}return s},readMessage:function(c,s){return this.readFields(c,s,this.readVarint()+this.pos)},readFixed32:function(){var c=Um(this.buf,this.pos);return this.pos+=4,c},readSFixed32:function(){var c=OE(this.buf,this.pos);return this.pos+=4,c},readFixed64:function(){var c=Um(this.buf,this.pos)+Um(this.buf,this.pos+4)*Z_;return this.pos+=8,c},readSFixed64:function(){var c=Um(this.buf,this.pos)+OE(this.buf,this.pos+4)*Z_;return this.pos+=8,c},readFloat:function(){var c=ME(this.buf,this.pos,!0,23,4);return this.pos+=4,c},readDouble:function(){var c=ME(this.buf,this.pos,!0,52,8);return this.pos+=8,c},readVarint:function(c){var s,h,p=this.buf;return s=127&(h=p[this.pos++]),h<128?s:(s|=(127&(h=p[this.pos++]))<<7,h<128?s:(s|=(127&(h=p[this.pos++]))<<14,h<128?s:(s|=(127&(h=p[this.pos++]))<<21,h<128?s:function(_,k,S){var T,A,B=S.buf;if(T=(112&(A=B[S.pos++]))>>4,A<128||(T|=(127&(A=B[S.pos++]))<<3,A<128)||(T|=(127&(A=B[S.pos++]))<<10,A<128)||(T|=(127&(A=B[S.pos++]))<<17,A<128)||(T|=(127&(A=B[S.pos++]))<<24,A<128)||(T|=(1&(A=B[S.pos++]))<<31,A<128))return ju(_,T,k);throw new Error("Expected varint not more than 10 bytes")}(s|=(15&(h=p[this.pos]))<<28,c,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var c=this.readVarint();return c%2==1?(c+1)/-2:c/2},readBoolean:function(){return!!this.readVarint()},readString:function(){var c=this.readVarint()+this.pos,s=this.pos;return this.pos=c,c-s>=12&&PE?function(h,p,_){return PE.decode(h.subarray(p,_))}(this.buf,s,c):function(h,p,_){for(var k="",S=p;S<_;){var T,A,B,z=h[S],L=null,j=z>239?4:z>223?3:z>191?2:1;if(S+j>_)break;j===1?z<128&&(L=z):j===2?(192&(T=h[S+1]))==128&&(L=(31&z)<<6|63&T)<=127&&(L=null):j===3?(A=h[S+2],(192&(T=h[S+1]))==128&&(192&A)==128&&((L=(15&z)<<12|(63&T)<<6|63&A)<=2047||L>=55296&&L<=57343)&&(L=null)):j===4&&(A=h[S+2],B=h[S+3],(192&(T=h[S+1]))==128&&(192&A)==128&&(192&B)==128&&((L=(15&z)<<18|(63&T)<<12|(63&A)<<6|63&B)<=65535||L>=1114112)&&(L=null)),L===null?(L=65533,j=1):L>65535&&(L-=65536,k+=String.fromCharCode(L>>>10&1023|55296),L=56320|1023&L),k+=String.fromCharCode(L),S+=j}return k}(this.buf,s,c)},readBytes:function(){var c=this.readVarint()+this.pos,s=this.buf.subarray(this.pos,c);return this.pos=c,s},readPackedVarint:function(c,s){if(this.type!==Mn.Bytes)return c.push(this.readVarint(s));var h=ea(this);for(c=c||[];this.pos<h;)c.push(this.readVarint(s));return c},readPackedSVarint:function(c){if(this.type!==Mn.Bytes)return c.push(this.readSVarint());var s=ea(this);for(c=c||[];this.pos<s;)c.push(this.readSVarint());return c},readPackedBoolean:function(c){if(this.type!==Mn.Bytes)return c.push(this.readBoolean());var s=ea(this);for(c=c||[];this.pos<s;)c.push(this.readBoolean());return c},readPackedFloat:function(c){if(this.type!==Mn.Bytes)return c.push(this.readFloat());var s=ea(this);for(c=c||[];this.pos<s;)c.push(this.readFloat());return c},readPackedDouble:function(c){if(this.type!==Mn.Bytes)return c.push(this.readDouble());var s=ea(this);for(c=c||[];this.pos<s;)c.push(this.readDouble());return c},readPackedFixed32:function(c){if(this.type!==Mn.Bytes)return c.push(this.readFixed32());var s=ea(this);for(c=c||[];this.pos<s;)c.push(this.readFixed32());return c},readPackedSFixed32:function(c){if(this.type!==Mn.Bytes)return c.push(this.readSFixed32());var s=ea(this);for(c=c||[];this.pos<s;)c.push(this.readSFixed32());return c},readPackedFixed64:function(c){if(this.type!==Mn.Bytes)return c.push(this.readFixed64());var s=ea(this);for(c=c||[];this.pos<s;)c.push(this.readFixed64());return c},readPackedSFixed64:function(c){if(this.type!==Mn.Bytes)return c.push(this.readSFixed64());var s=ea(this);for(c=c||[];this.pos<s;)c.push(this.readSFixed64());return c},skip:function(c){var s=7&c;if(s===Mn.Varint)for(;this.buf[this.pos++]>127;);else if(s===Mn.Bytes)this.pos=this.readVarint()+this.pos;else if(s===Mn.Fixed32)this.pos+=4;else{if(s!==Mn.Fixed64)throw new Error("Unimplemented type: "+s);this.pos+=8}},writeTag:function(c,s){this.writeVarint(c<<3|s)},realloc:function(c){for(var s=this.length||16;s<this.pos+c;)s*=2;if(s!==this.length){var h=new Uint8Array(s);h.set(this.buf),this.buf=h,this.length=s}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(c){this.realloc(4),Uu(this.buf,c,this.pos),this.pos+=4},writeSFixed32:function(c){this.realloc(4),Uu(this.buf,c,this.pos),this.pos+=4},writeFixed64:function(c){this.realloc(8),Uu(this.buf,-1&c,this.pos),Uu(this.buf,Math.floor(c*IE),this.pos+4),this.pos+=8},writeSFixed64:function(c){this.realloc(8),Uu(this.buf,-1&c,this.pos),Uu(this.buf,Math.floor(c*IE),this.pos+4),this.pos+=8},writeVarint:function(c){(c=+c||0)>268435455||c<0?function(s,h){var p,_;if(s>=0?(p=s%4294967296|0,_=s/4294967296|0):(_=~(-s/4294967296),4294967295^(p=~(-s%4294967296))?p=p+1|0:(p=0,_=_+1|0)),s>=18446744073709552e3||s<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");h.realloc(10),function(k,S,T){T.buf[T.pos++]=127&k|128,k>>>=7,T.buf[T.pos++]=127&k|128,k>>>=7,T.buf[T.pos++]=127&k|128,k>>>=7,T.buf[T.pos++]=127&k|128,T.buf[T.pos]=127&(k>>>=7)}(p,0,h),function(k,S){var T=(7&k)<<4;S.buf[S.pos++]|=T|((k>>>=3)?128:0),k&&(S.buf[S.pos++]=127&k|((k>>>=7)?128:0),k&&(S.buf[S.pos++]=127&k|((k>>>=7)?128:0),k&&(S.buf[S.pos++]=127&k|((k>>>=7)?128:0),k&&(S.buf[S.pos++]=127&k|((k>>>=7)?128:0),k&&(S.buf[S.pos++]=127&k)))))}(_,h)}(c,this):(this.realloc(4),this.buf[this.pos++]=127&c|(c>127?128:0),c<=127||(this.buf[this.pos++]=127&(c>>>=7)|(c>127?128:0),c<=127||(this.buf[this.pos++]=127&(c>>>=7)|(c>127?128:0),c<=127||(this.buf[this.pos++]=c>>>7&127))))},writeSVarint:function(c){this.writeVarint(c<0?2*-c-1:2*c)},writeBoolean:function(c){this.writeVarint(!!c)},writeString:function(c){c=String(c),this.realloc(4*c.length),this.pos++;var s=this.pos;this.pos=function(p,_,k){for(var S,T,A=0;A<_.length;A++){if((S=_.charCodeAt(A))>55295&&S<57344){if(!T){S>56319||A+1===_.length?(p[k++]=239,p[k++]=191,p[k++]=189):T=S;continue}if(S<56320){p[k++]=239,p[k++]=191,p[k++]=189,T=S;continue}S=T-55296<<10|S-56320|65536,T=null}else T&&(p[k++]=239,p[k++]=191,p[k++]=189,T=null);S<128?p[k++]=S:(S<2048?p[k++]=S>>6|192:(S<65536?p[k++]=S>>12|224:(p[k++]=S>>18|240,p[k++]=S>>12&63|128),p[k++]=S>>6&63|128),p[k++]=63&S|128)}return k}(this.buf,c,this.pos);var h=this.pos-s;h>=128&&DE(s,h,this),this.pos=s-1,this.writeVarint(h),this.pos+=h},writeFloat:function(c){this.realloc(4),AE(this.buf,c,this.pos,!0,23,4),this.pos+=4},writeDouble:function(c){this.realloc(8),AE(this.buf,c,this.pos,!0,52,8),this.pos+=8},writeBytes:function(c){var s=c.length;this.writeVarint(s),this.realloc(s);for(var h=0;h<s;h++)this.buf[this.pos++]=c[h]},writeRawMessage:function(c,s){this.pos++;var h=this.pos;c(s,this);var p=this.pos-h;p>=128&&DE(h,p,this),this.pos=h-1,this.writeVarint(p),this.pos+=p},writeMessage:function(c,s,h){this.writeTag(c,Mn.Bytes),this.writeRawMessage(s,h)},writePackedVarint:function(c,s){s.length&&this.writeMessage(c,eG,s)},writePackedSVarint:function(c,s){s.length&&this.writeMessage(c,tG,s)},writePackedBoolean:function(c,s){s.length&&this.writeMessage(c,rG,s)},writePackedFloat:function(c,s){s.length&&this.writeMessage(c,nG,s)},writePackedDouble:function(c,s){s.length&&this.writeMessage(c,iG,s)},writePackedFixed32:function(c,s){s.length&&this.writeMessage(c,oG,s)},writePackedSFixed32:function(c,s){s.length&&this.writeMessage(c,sG,s)},writePackedFixed64:function(c,s){s.length&&this.writeMessage(c,aG,s)},writePackedSFixed64:function(c,s){s.length&&this.writeMessage(c,lG,s)},writeBytesField:function(c,s){this.writeTag(c,Mn.Bytes),this.writeBytes(s)},writeFixed32Field:function(c,s){this.writeTag(c,Mn.Fixed32),this.writeFixed32(s)},writeSFixed32Field:function(c,s){this.writeTag(c,Mn.Fixed32),this.writeSFixed32(s)},writeFixed64Field:function(c,s){this.writeTag(c,Mn.Fixed64),this.writeFixed64(s)},writeSFixed64Field:function(c,s){this.writeTag(c,Mn.Fixed64),this.writeSFixed64(s)},writeVarintField:function(c,s){this.writeTag(c,Mn.Varint),this.writeVarint(s)},writeSVarintField:function(c,s){this.writeTag(c,Mn.Varint),this.writeSVarint(s)},writeStringField:function(c,s){this.writeTag(c,Mn.Bytes),this.writeString(s)},writeFloatField:function(c,s){this.writeTag(c,Mn.Fixed32),this.writeFloat(s)},writeDoubleField:function(c,s){this.writeTag(c,Mn.Fixed64),this.writeDouble(s)},writeBooleanField:function(c,s){this.writeVarintField(c,!!s)}};var Y_=g(TE);const X_=3;function cG(c,s,h){c===1&&h.readMessage(uG,s)}function uG(c,s,h){if(c===3){const{id:p,bitmap:_,width:k,height:S,left:T,top:A,advance:B}=h.readMessage(hG,{});s.push({id:p,bitmap:new Ud({width:k+2*X_,height:S+2*X_},_),metrics:{width:k,height:S,left:T,top:A,advance:B}})}}function hG(c,s,h){c===1?s.id=h.readVarint():c===2?s.bitmap=h.readBytes():c===3?s.width=h.readVarint():c===4?s.height=h.readVarint():c===5?s.left=h.readSVarint():c===6?s.top=h.readSVarint():c===7&&(s.advance=h.readVarint())}const BE=X_;function zE(c){let s=0,h=0;for(const S of c)s+=S.w*S.h,h=Math.max(h,S.w);c.sort((S,T)=>T.h-S.h);const p=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(s/.95)),h),h:1/0}];let _=0,k=0;for(const S of c)for(let T=p.length-1;T>=0;T--){const A=p[T];if(!(S.w>A.w||S.h>A.h)){if(S.x=A.x,S.y=A.y,k=Math.max(k,S.y+S.h),_=Math.max(_,S.x+S.w),S.w===A.w&&S.h===A.h){const B=p.pop();T<p.length&&(p[T]=B)}else S.h===A.h?(A.x+=S.w,A.w-=S.w):S.w===A.w?(A.y+=S.h,A.h-=S.h):(p.push({x:A.x+S.w,y:A.y,w:A.w-S.w,h:S.h}),A.y+=S.h,A.h-=S.h);break}}return{w:_,h:k,fill:s/(_*k)||0}}const vr=1;class K_{constructor(s,{pixelRatio:h,version:p,stretchX:_,stretchY:k,content:S,textFitWidth:T,textFitHeight:A}){this.paddedRect=s,this.pixelRatio=h,this.stretchX=_,this.stretchY=k,this.content=S,this.version=p,this.textFitWidth=T,this.textFitHeight=A}get tl(){return[this.paddedRect.x+vr,this.paddedRect.y+vr]}get br(){return[this.paddedRect.x+this.paddedRect.w-vr,this.paddedRect.y+this.paddedRect.h-vr]}get tlbr(){return this.tl.concat(this.br)}get displaySize(){return[(this.paddedRect.w-2*vr)/this.pixelRatio,(this.paddedRect.h-2*vr)/this.pixelRatio]}}class NE{constructor(s,h){const p={},_={};this.haveRenderCallbacks=[];const k=[];this.addImages(s,p,k),this.addImages(h,_,k);const{w:S,h:T}=zE(k),A=new oo({width:S||1,height:T||1});for(const B in s){const z=s[B],L=p[B].paddedRect;oo.copy(z.data,A,{x:0,y:0},{x:L.x+vr,y:L.y+vr},z.data)}for(const B in h){const z=h[B],L=_[B].paddedRect,j=L.x+vr,q=L.y+vr,Y=z.data.width,K=z.data.height;oo.copy(z.data,A,{x:0,y:0},{x:j,y:q},z.data),oo.copy(z.data,A,{x:0,y:K-1},{x:j,y:q-1},{width:Y,height:1}),oo.copy(z.data,A,{x:0,y:0},{x:j,y:q+K},{width:Y,height:1}),oo.copy(z.data,A,{x:Y-1,y:0},{x:j-1,y:q},{width:1,height:K}),oo.copy(z.data,A,{x:0,y:0},{x:j+Y,y:q},{width:1,height:K})}this.image=A,this.iconPositions=p,this.patternPositions=_}addImages(s,h,p){for(const _ in s){const k=s[_],S={x:0,y:0,w:k.data.width+2*vr,h:k.data.height+2*vr};p.push(S),h[_]=new K_(S,k),k.hasRenderCallback&&this.haveRenderCallbacks.push(_)}}patchUpdatedImages(s,h){s.dispatchRenderCallbacks(this.haveRenderCallbacks);for(const p in s.updatedImages)this.patchUpdatedImage(this.iconPositions[p],s.getImage(p),h),this.patchUpdatedImage(this.patternPositions[p],s.getImage(p),h)}patchUpdatedImage(s,h,p){if(!s||!h||s.version===h.version)return;s.version=h.version;const[_,k]=s.tl;p.update(h.data,void 0,{x:_,y:k})}}var rl;ut("ImagePosition",K_),ut("ImageAtlas",NE),u.ah=void 0,(rl=u.ah||(u.ah={}))[rl.none=0]="none",rl[rl.horizontal=1]="horizontal",rl[rl.vertical=2]="vertical",rl[rl.horizontalOnly=3]="horizontalOnly";const Xd=-17;class Kd{constructor(){this.scale=1,this.fontStack="",this.imageName=null}static forText(s,h){const p=new Kd;return p.scale=s||1,p.fontStack=h,p}static forImage(s){const h=new Kd;return h.imageName=s,h}}class Hu{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(s,h){const p=new Hu;for(let _=0;_<s.sections.length;_++){const k=s.sections[_];k.image?p.addImageSection(k):p.addTextSection(k,h)}return p}length(){return this.text.length}getSection(s){return this.sections[this.sectionIndex[s]]}getSectionIndex(s){return this.sectionIndex[s]}getCharCode(s){return this.text.charCodeAt(s)}verticalizePunctuation(){this.text=function(s){let h="";for(let p=0;p<s.length;p++){const _=s.charCodeAt(p+1)||null,k=s.charCodeAt(p-1)||null;h+=_&&Am(_)&&!Yd[s[p+1]]||k&&Am(k)&&!Yd[s[p-1]]||!Yd[s[p]]?s[p]:Yd[s[p]]}return h}(this.text)}trim(){let s=0;for(let p=0;p<this.text.length&&qm[this.text.charCodeAt(p)];p++)s++;let h=this.text.length;for(let p=this.text.length-1;p>=0&&p>=s&&qm[this.text.charCodeAt(p)];p--)h--;this.text=this.text.substring(s,h),this.sectionIndex=this.sectionIndex.slice(s,h)}substring(s,h){const p=new Hu;return p.text=this.text.substring(s,h),p.sectionIndex=this.sectionIndex.slice(s,h),p.sections=this.sections,p}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((s,h)=>Math.max(s,this.sections[h].scale),0)}addTextSection(s,h){this.text+=s.text,this.sections.push(Kd.forText(s.scale,s.fontStack||h));const p=this.sections.length-1;for(let _=0;_<s.text.length;++_)this.sectionIndex.push(p)}addImageSection(s){const h=s.image?s.image.name:"";if(h.length===0)return void ot("Can't add FormattedSection with an empty image.");const p=this.getNextImageSectionCharCode();p?(this.text+=String.fromCharCode(p),this.sections.push(Kd.forImage(h)),this.sectionIndex.push(this.sections.length-1)):ot("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function Hm(c,s,h,p,_,k,S,T,A,B,z,L,j,q,Y){const K=Hu.fromFeature(c,_);let re;L===u.ah.vertical&&K.verticalizePunctuation();const{processBidirectionalText:ae,processStyledBidirectionalText:be}=br;if(ae&&K.sections.length===1){re=[];const Te=ae(K.toString(),J_(K,B,k,s,p,q));for(const Le of Te){const rt=new Hu;rt.text=Le,rt.sections=K.sections;for(let St=0;St<Le.length;St++)rt.sectionIndex.push(0);re.push(rt)}}else if(be){re=[];const Te=be(K.text,K.sectionIndex,J_(K,B,k,s,p,q));for(const Le of Te){const rt=new Hu;rt.text=Le[0],rt.sectionIndex=Le[1],rt.sections=K.sections,re.push(rt)}}else re=function(Te,Le){const rt=[],St=Te.text;let tt=0;for(const Je of Le)rt.push(Te.substring(tt,Je)),tt=Je;return tt<St.length&&rt.push(Te.substring(tt,St.length)),rt}(K,J_(K,B,k,s,p,q));const pe=[],ye={positionedLines:pe,text:K.toString(),top:z[1],bottom:z[1],left:z[0],right:z[0],writingMode:L,iconsInText:!1,verticalizable:!1};return function(Te,Le,rt,St,tt,Je,yt,dt,at,Oe,bt,gt){let Ot=0,Dn=Xd,An=0,gi=0;const Do=dt==="right"?1:dt==="left"?0:.5;let Ri=0;for(const ei of tt){ei.trim();const _i=ei.getMaxScale(),Yi=(_i-1)*hi,Li={positionedGlyphs:[],lineOffset:0};Te.positionedLines[Ri]=Li;const cr=Li.positionedGlyphs;let Vi=0;if(!ei.length()){Dn+=Je,++Ri;continue}for(let wr=0;wr<ei.length();wr++){const hn=ei.getSection(wr),Bn=ei.getSectionIndex(wr),Un=ei.getCharCode(wr);let Ur=0,Yn=null,Zu=null,ys=null,_s=hi;const Oo=!(at===u.ah.horizontal||!bt&&!Nd(Un)||bt&&(qm[Un]||(yi=Un,new RegExp("\\p{sc=Arab}","u").test(String.fromCodePoint(yi)))));if(hn.imageName){const lo=St[hn.imageName];if(!lo)continue;ys=hn.imageName,Te.iconsInText=Te.iconsInText||!0,Zu=lo.paddedRect;const Ei=lo.displaySize;hn.scale=hn.scale*hi/gt,Yn={width:Ei[0],height:Ei[1],left:vr,top:-BE,advance:Oo?Ei[1]:Ei[0]},Ur=Yi+(hi-Ei[1]*hn.scale),_s=Yn.advance;const ta=Oo?Ei[0]*hn.scale-hi*_i:Ei[1]*hn.scale-hi*_i;ta>0&&ta>Vi&&(Vi=ta)}else{const lo=rt[hn.fontStack],Ei=lo&&lo[Un];if(Ei&&Ei.rect)Zu=Ei.rect,Yn=Ei.metrics;else{const ta=Le[hn.fontStack],ip=ta&&ta[Un];if(!ip)continue;Yn=ip.metrics}Ur=(_i-hn.scale)*hi}Oo?(Te.verticalizable=!0,cr.push({glyph:Un,imageName:ys,x:Ot,y:Dn+Ur,vertical:Oo,scale:hn.scale,fontStack:hn.fontStack,sectionIndex:Bn,metrics:Yn,rect:Zu}),Ot+=_s*hn.scale+Oe):(cr.push({glyph:Un,imageName:ys,x:Ot,y:Dn+Ur,vertical:Oo,scale:hn.scale,fontStack:hn.fontStack,sectionIndex:Bn,metrics:Yn,rect:Zu}),Ot+=Yn.advance*hn.scale+Oe)}cr.length!==0&&(An=Math.max(Ot-Oe,An),mG(cr,0,cr.length-1,Do,Vi)),Ot=0;const ao=Je*_i+Vi;Li.lineOffset=Math.max(Vi,Yi),Dn+=ao,gi=Math.max(ao,gi),++Ri}var yi;const sr=Dn-Xd,{horizontalAlign:ar,verticalAlign:lr}=Q_(yt);(function(ei,_i,Yi,Li,cr,Vi,ao,wr,hn){const Bn=(_i-Yi)*cr;let Un=0;Un=Vi!==ao?-wr*Li-Xd:(-Li*hn+.5)*ao;for(const Ur of ei)for(const Yn of Ur.positionedGlyphs)Yn.x+=Bn,Yn.y+=Un})(Te.positionedLines,Do,ar,lr,An,gi,Je,sr,tt.length),Te.top+=-lr*sr,Te.bottom=Te.top+sr,Te.left+=-ar*An,Te.right=Te.left+An}(ye,s,h,p,re,S,T,A,L,B,j,Y),!function(Te){for(const Le of Te)if(Le.positionedGlyphs.length!==0)return!1;return!0}(pe)&&ye}const qm={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},dG={10:!0,32:!0,38:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0},pG={40:!0};function RE(c,s,h,p,_,k){if(s.imageName){const S=p[s.imageName];return S?S.displaySize[0]*s.scale*hi/k+_:0}{const S=h[s.fontStack],T=S&&S[c];return T?T.metrics.advance*s.scale+_:0}}function LE(c,s,h,p){const _=Math.pow(c-s,2);return p?c<s?_/2:2*_:_+Math.abs(h)*h}function fG(c,s,h){let p=0;return c===10&&(p-=1e4),h&&(p+=150),c!==40&&c!==65288||(p+=50),s!==41&&s!==65289||(p+=50),p}function VE(c,s,h,p,_,k){let S=null,T=LE(s,h,_,k);for(const A of p){const B=LE(s-A.x,h,_,k)+A.badness;B<=T&&(S=A,T=B)}return{index:c,x:s,priorBreak:S,badness:T}}function FE(c){return c?FE(c.priorBreak).concat(c.index):[]}function J_(c,s,h,p,_,k){if(!c)return[];const S=[],T=function(L,j,q,Y,K,re){let ae=0;for(let be=0;be<L.length();be++){const pe=L.getSection(be);ae+=RE(L.getCharCode(be),pe,Y,K,j,re)}return ae/Math.max(1,Math.ceil(ae/q))}(c,s,h,p,_,k),A=c.text.indexOf("​")>=0;let B=0;for(let L=0;L<c.length();L++){const j=c.getSection(L),q=c.getCharCode(L);if(qm[q]||(B+=RE(q,j,p,_,s,k)),L<c.length()-1){const Y=!((z=q)<11904)&&(!!en["CJK Compatibility Forms"](z)||!!en["CJK Compatibility"](z)||!!en["CJK Strokes"](z)||!!en["CJK Symbols and Punctuation"](z)||!!en["Enclosed CJK Letters and Months"](z)||!!en["Halfwidth and Fullwidth Forms"](z)||!!en["Ideographic Description Characters"](z)||!!en["Vertical Forms"](z)||Mm.test(String.fromCodePoint(z)));(dG[q]||Y||j.imageName||L!==c.length()-2&&pG[c.getCharCode(L+1)])&&S.push(VE(L+1,B,T,S,fG(q,c.getCharCode(L+1),Y&&A),!1))}}var z;return FE(VE(c.length(),B,T,S,0,!0))}function Q_(c){let s=.5,h=.5;switch(c){case"right":case"top-right":case"bottom-right":s=1;break;case"left":case"top-left":case"bottom-left":s=0}switch(c){case"bottom":case"bottom-right":case"bottom-left":h=1;break;case"top":case"top-right":case"top-left":h=0}return{horizontalAlign:s,verticalAlign:h}}function mG(c,s,h,p,_){if(!p&&!_)return;const k=c[h],S=(c[h].x+k.metrics.advance*k.scale)*p;for(let T=s;T<=h;T++)c[T].x-=S,c[T].y+=_}function gG(c,s,h){const{horizontalAlign:p,verticalAlign:_}=Q_(h),k=s[0]-c.displaySize[0]*p,S=s[1]-c.displaySize[1]*_;return{image:c,top:S,bottom:S+c.displaySize[1],left:k,right:k+c.displaySize[0]}}function $E(c){var s,h;let p=c.left,_=c.top,k=c.right-p,S=c.bottom-_;const T=(s=c.image.textFitWidth)!==null&&s!==void 0?s:"stretchOrShrink",A=(h=c.image.textFitHeight)!==null&&h!==void 0?h:"stretchOrShrink",B=(c.image.content[2]-c.image.content[0])/(c.image.content[3]-c.image.content[1]);if(A==="proportional"){if(T==="stretchOnly"&&k/S<B||T==="proportional"){const z=Math.ceil(S*B);p*=z/k,k=z}}else if(T==="proportional"&&A==="stretchOnly"&&B!==0&&k/S>B){const z=Math.ceil(k/B);_*=z/S,S=z}return{x1:p,y1:_,x2:p+k,y2:_+S}}function jE(c,s,h,p,_,k){const S=c.image;let T;if(S.content){const re=S.content,ae=S.pixelRatio||1;T=[re[0]/ae,re[1]/ae,S.displaySize[0]-re[2]/ae,S.displaySize[1]-re[3]/ae]}const A=s.left*k,B=s.right*k;let z,L,j,q;h==="width"||h==="both"?(q=_[0]+A-p[3],L=_[0]+B+p[1]):(q=_[0]+(A+B-S.displaySize[0])/2,L=q+S.displaySize[0]);const Y=s.top*k,K=s.bottom*k;return h==="height"||h==="both"?(z=_[1]+Y-p[0],j=_[1]+K+p[2]):(z=_[1]+(Y+K-S.displaySize[1])/2,j=z+S.displaySize[1]),{image:S,top:z,right:L,bottom:j,left:q,collisionPadding:T}}const Jd=255,gs=128,ol=Jd*gs;function UE(c,s){const{expression:h}=s;if(h.kind==="constant")return{kind:"constant",layoutSize:h.evaluate(new Vn(c+1))};if(h.kind==="source")return{kind:"source"};{const{zoomStops:p,interpolationType:_}=h;let k=0;for(;k<p.length&&p[k]<=c;)k++;k=Math.max(0,k-1);let S=k;for(;S<p.length&&p[S]<c+1;)S++;S=Math.min(p.length-1,S);const T=p[k],A=p[S];return h.kind==="composite"?{kind:"composite",minZoom:T,maxZoom:A,interpolationType:_}:{kind:"camera",minZoom:T,maxZoom:A,minSize:h.evaluate(new Vn(T)),maxSize:h.evaluate(new Vn(A)),interpolationType:_}}}function eb(c,s,h){let p="never";const _=c.get(s);return _?p=_:c.get(h)&&(p="always"),p}const yG=il.VectorTileFeature.types,_G=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function Wm(c,s,h,p,_,k,S,T,A,B,z,L,j){const q=T?Math.min(ol,Math.round(T[0])):0,Y=T?Math.min(ol,Math.round(T[1])):0;c.emplaceBack(s,h,Math.round(32*p),Math.round(32*_),k,S,(q<<1)+(A?1:0),Y,16*B,16*z,256*L,256*j)}function tb(c,s,h){c.emplaceBack(s.x,s.y,h),c.emplaceBack(s.x,s.y,h),c.emplaceBack(s.x,s.y,h),c.emplaceBack(s.x,s.y,h)}function bG(c){for(const s of c.sections)if(A_(s.text))return!0;return!1}class nb{constructor(s){this.layoutVertexArray=new Ou,this.indexArray=new ro,this.programConfigurations=s,this.segments=new tn,this.dynamicLayoutVertexArray=new Vd,this.opacityVertexArray=new $r,this.hasVisibleVertices=!1,this.placedSymbolArray=new Fn}isEmpty(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0}upload(s,h,p,_){this.isEmpty()||(p&&(this.layoutVertexBuffer=s.createVertexBuffer(this.layoutVertexArray,YW.members),this.indexBuffer=s.createIndexBuffer(this.indexArray,h),this.dynamicLayoutVertexBuffer=s.createVertexBuffer(this.dynamicLayoutVertexArray,XW.members,!0),this.opacityVertexBuffer=s.createVertexBuffer(this.opacityVertexArray,_G,!0),this.opacityVertexBuffer.itemSize=1),(p||_)&&this.programConfigurations.upload(s))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy())}}ut("SymbolBuffers",nb);class ib{constructor(s,h,p){this.layoutVertexArray=new s,this.layoutAttributes=h,this.indexArray=new p,this.segments=new tn,this.collisionVertexArray=new fs}upload(s){this.layoutVertexBuffer=s.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=s.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=s.createVertexBuffer(this.collisionVertexArray,KW.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}}ut("CollisionBuffers",ib);class qu{constructor(s){this.collisionBoxArray=s.collisionBoxArray,this.zoom=s.zoom,this.overscaling=s.overscaling,this.layers=s.layers,this.layerIds=this.layers.map(S=>S.id),this.index=s.index,this.pixelRatio=s.pixelRatio,this.sourceLayerIndex=s.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=N_([]),this.placementViewportMatrix=N_([]);const h=this.layers[0]._unevaluatedLayout._values;this.textSizeData=UE(this.zoom,h["text-size"]),this.iconSizeData=UE(this.zoom,h["icon-size"]);const p=this.layers[0].layout,_=p.get("symbol-sort-key"),k=p.get("symbol-z-order");this.canOverlap=eb(p,"text-overlap","text-allow-overlap")!=="never"||eb(p,"icon-overlap","icon-allow-overlap")!=="never"||p.get("text-ignore-placement")||p.get("icon-ignore-placement"),this.sortFeaturesByKey=k!=="viewport-y"&&!_.isConstant(),this.sortFeaturesByY=(k==="viewport-y"||k==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,p.get("symbol-placement")==="point"&&(this.writingModes=p.get("text-writing-mode").map(S=>u.ah[S])),this.stateDependentLayerIds=this.layers.filter(S=>S.isStateDependent()).map(S=>S.id),this.sourceID=s.sourceID}createArrays(){this.text=new nb(new rc(this.layers,this.zoom,s=>/^text/.test(s))),this.icon=new nb(new rc(this.layers,this.zoom,s=>/^icon/.test(s))),this.glyphOffsetArray=new $n,this.lineVertexArray=new Oi,this.symbolInstances=new Jt,this.textAnchorOffsets=new jn}calculateGlyphDependencies(s,h,p,_,k){for(let S=0;S<s.length;S++)if(h[s.charCodeAt(S)]=!0,(p||_)&&k){const T=Yd[s.charAt(S)];T&&(h[T.charCodeAt(0)]=!0)}}populate(s,h,p){const _=this.layers[0],k=_.layout,S=k.get("text-font"),T=k.get("text-field"),A=k.get("icon-image"),B=(T.value.kind!=="constant"||T.value.value instanceof mr&&!T.value.value.isEmpty()||T.value.value.toString().length>0)&&(S.value.kind!=="constant"||S.value.value.length>0),z=A.value.kind!=="constant"||!!A.value.value||Object.keys(A.parameters).length>0,L=k.get("symbol-sort-key");if(this.features=[],!B&&!z)return;const j=h.iconDependencies,q=h.glyphDependencies,Y=h.availableImages,K=new Vn(this.zoom);for(const{feature:re,id:ae,index:be,sourceLayerIndex:pe}of s){const ye=_._featureFilter.needGeometry,Te=sc(re,ye);if(!_._featureFilter.filter(K,Te,p))continue;let Le,rt;if(ye||(Te.geometry=oc(re)),B){const tt=_.getValueAndResolveTokens("text-field",Te,p,Y),Je=mr.factory(tt),yt=this.hasRTLText=this.hasRTLText||bG(Je);(!yt||br.getRTLTextPluginStatus()==="unavailable"||yt&&br.isParsed())&&(Le=QW(Je,_,Te))}if(z){const tt=_.getValueAndResolveTokens("icon-image",Te,p,Y);rt=tt instanceof yr?tt:yr.fromString(tt)}if(!Le&&!rt)continue;const St=this.sortFeaturesByKey?L.evaluate(Te,{},p):void 0;if(this.features.push({id:ae,text:Le,icon:rt,index:be,sourceLayerIndex:pe,geometry:Te.geometry,properties:re.properties,type:yG[re.type],sortKey:St}),rt&&(j[rt.name]=!0),Le){const tt=S.evaluate(Te,{},p).join(","),Je=k.get("text-rotation-alignment")!=="viewport"&&k.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(u.ah.vertical)>=0;for(const yt of Le.sections)if(yt.image)j[yt.image.name]=!0;else{const dt=Bd(Le.toString()),at=yt.fontStack||tt,Oe=q[at]=q[at]||{};this.calculateGlyphDependencies(yt.text,Oe,Je,this.allowVerticalPlacement,dt)}}}k.get("symbol-placement")==="line"&&(this.features=function(re){const ae={},be={},pe=[];let ye=0;function Te(tt){pe.push(re[tt]),ye++}function Le(tt,Je,yt){const dt=be[tt];return delete be[tt],be[Je]=dt,pe[dt].geometry[0].pop(),pe[dt].geometry[0]=pe[dt].geometry[0].concat(yt[0]),dt}function rt(tt,Je,yt){const dt=ae[Je];return delete ae[Je],ae[tt]=dt,pe[dt].geometry[0].shift(),pe[dt].geometry[0]=yt[0].concat(pe[dt].geometry[0]),dt}function St(tt,Je,yt){const dt=yt?Je[0][Je[0].length-1]:Je[0][0];return`${tt}:${dt.x}:${dt.y}`}for(let tt=0;tt<re.length;tt++){const Je=re[tt],yt=Je.geometry,dt=Je.text?Je.text.toString():null;if(!dt){Te(tt);continue}const at=St(dt,yt),Oe=St(dt,yt,!0);if(at in be&&Oe in ae&&be[at]!==ae[Oe]){const bt=rt(at,Oe,yt),gt=Le(at,Oe,pe[bt].geometry);delete ae[at],delete be[Oe],be[St(dt,pe[gt].geometry,!0)]=gt,pe[bt].geometry=null}else at in be?Le(at,Oe,yt):Oe in ae?rt(at,Oe,yt):(Te(tt),ae[at]=ye-1,be[Oe]=ye-1)}return pe.filter(tt=>tt.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((re,ae)=>re.sortKey-ae.sortKey)}update(s,h,p){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(s,h,this.layers,p),this.icon.programConfigurations.updatePaintArrays(s,h,this.layers,p))}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(s){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(s),this.iconCollisionBox.upload(s)),this.text.upload(s,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(s,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(s,h){const p=this.lineVertexArray.length;if(s.segment!==void 0){let _=s.dist(h[s.segment+1]),k=s.dist(h[s.segment]);const S={};for(let T=s.segment+1;T<h.length;T++)S[T]={x:h[T].x,y:h[T].y,tileUnitDistanceFromAnchor:_},T<h.length-1&&(_+=h[T+1].dist(h[T]));for(let T=s.segment||0;T>=0;T--)S[T]={x:h[T].x,y:h[T].y,tileUnitDistanceFromAnchor:k},T>0&&(k+=h[T-1].dist(h[T]));for(let T=0;T<h.length;T++){const A=S[T];this.lineVertexArray.emplaceBack(A.x,A.y,A.tileUnitDistanceFromAnchor)}}return{lineStartIndex:p,lineLength:this.lineVertexArray.length-p}}addSymbols(s,h,p,_,k,S,T,A,B,z,L,j){const q=s.indexArray,Y=s.layoutVertexArray,K=s.segments.prepareSegment(4*h.length,Y,q,this.canOverlap?S.sortKey:void 0),re=this.glyphOffsetArray.length,ae=K.vertexLength,be=this.allowVerticalPlacement&&T===u.ah.vertical?Math.PI/2:0,pe=S.text&&S.text.sections;for(let ye=0;ye<h.length;ye++){const{tl:Te,tr:Le,bl:rt,br:St,tex:tt,pixelOffsetTL:Je,pixelOffsetBR:yt,minFontScaleX:dt,minFontScaleY:at,glyphOffset:Oe,isSDF:bt,sectionIndex:gt}=h[ye],Ot=K.vertexLength,Dn=Oe[1];Wm(Y,A.x,A.y,Te.x,Dn+Te.y,tt.x,tt.y,p,bt,Je.x,Je.y,dt,at),Wm(Y,A.x,A.y,Le.x,Dn+Le.y,tt.x+tt.w,tt.y,p,bt,yt.x,Je.y,dt,at),Wm(Y,A.x,A.y,rt.x,Dn+rt.y,tt.x,tt.y+tt.h,p,bt,Je.x,yt.y,dt,at),Wm(Y,A.x,A.y,St.x,Dn+St.y,tt.x+tt.w,tt.y+tt.h,p,bt,yt.x,yt.y,dt,at),tb(s.dynamicLayoutVertexArray,A,be),q.emplaceBack(Ot,Ot+1,Ot+2),q.emplaceBack(Ot+1,Ot+2,Ot+3),K.vertexLength+=4,K.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(Oe[0]),ye!==h.length-1&&gt===h[ye+1].sectionIndex||s.programConfigurations.populatePaintArrays(Y.length,S,S.index,{},j,pe&&pe[gt])}s.placedSymbolArray.emplaceBack(A.x,A.y,re,this.glyphOffsetArray.length-re,ae,B,z,A.segment,p?p[0]:0,p?p[1]:0,_[0],_[1],T,0,!1,0,L)}_addCollisionDebugVertex(s,h,p,_,k,S){return h.emplaceBack(0,0),s.emplaceBack(p.x,p.y,_,k,Math.round(S.x),Math.round(S.y))}addCollisionDebugVertices(s,h,p,_,k,S,T){const A=k.segments.prepareSegment(4,k.layoutVertexArray,k.indexArray),B=A.vertexLength,z=k.layoutVertexArray,L=k.collisionVertexArray,j=T.anchorX,q=T.anchorY;this._addCollisionDebugVertex(z,L,S,j,q,new E(s,h)),this._addCollisionDebugVertex(z,L,S,j,q,new E(p,h)),this._addCollisionDebugVertex(z,L,S,j,q,new E(p,_)),this._addCollisionDebugVertex(z,L,S,j,q,new E(s,_)),A.vertexLength+=4;const Y=k.indexArray;Y.emplaceBack(B,B+1),Y.emplaceBack(B+1,B+2),Y.emplaceBack(B+2,B+3),Y.emplaceBack(B+3,B),A.primitiveLength+=4}addDebugCollisionBoxes(s,h,p,_){for(let k=s;k<h;k++){const S=this.collisionBoxArray.get(k);this.addCollisionDebugVertices(S.x1,S.y1,S.x2,S.y2,_?this.textCollisionBox:this.iconCollisionBox,S.anchorPoint,p)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new ib(jr,CE.members,Si),this.iconCollisionBox=new ib(jr,CE.members,Si);for(let s=0;s<this.symbolInstances.length;s++){const h=this.symbolInstances.get(s);this.addDebugCollisionBoxes(h.textBoxStartIndex,h.textBoxEndIndex,h,!0),this.addDebugCollisionBoxes(h.verticalTextBoxStartIndex,h.verticalTextBoxEndIndex,h,!0),this.addDebugCollisionBoxes(h.iconBoxStartIndex,h.iconBoxEndIndex,h,!1),this.addDebugCollisionBoxes(h.verticalIconBoxStartIndex,h.verticalIconBoxEndIndex,h,!1)}}_deserializeCollisionBoxesForSymbol(s,h,p,_,k,S,T,A,B){const z={};for(let L=h;L<p;L++){const j=s.get(L);z.textBox={x1:j.x1,y1:j.y1,x2:j.x2,y2:j.y2,anchorPointX:j.anchorPointX,anchorPointY:j.anchorPointY},z.textFeatureIndex=j.featureIndex;break}for(let L=_;L<k;L++){const j=s.get(L);z.verticalTextBox={x1:j.x1,y1:j.y1,x2:j.x2,y2:j.y2,anchorPointX:j.anchorPointX,anchorPointY:j.anchorPointY},z.verticalTextFeatureIndex=j.featureIndex;break}for(let L=S;L<T;L++){const j=s.get(L);z.iconBox={x1:j.x1,y1:j.y1,x2:j.x2,y2:j.y2,anchorPointX:j.anchorPointX,anchorPointY:j.anchorPointY},z.iconFeatureIndex=j.featureIndex;break}for(let L=A;L<B;L++){const j=s.get(L);z.verticalIconBox={x1:j.x1,y1:j.y1,x2:j.x2,y2:j.y2,anchorPointX:j.anchorPointX,anchorPointY:j.anchorPointY},z.verticalIconFeatureIndex=j.featureIndex;break}return z}deserializeCollisionBoxes(s){this.collisionArrays=[];for(let h=0;h<this.symbolInstances.length;h++){const p=this.symbolInstances.get(h);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(s,p.textBoxStartIndex,p.textBoxEndIndex,p.verticalTextBoxStartIndex,p.verticalTextBoxEndIndex,p.iconBoxStartIndex,p.iconBoxEndIndex,p.verticalIconBoxStartIndex,p.verticalIconBoxEndIndex))}}hasTextData(){return this.text.segments.get().length>0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}addIndicesForPlacedSymbol(s,h){const p=s.placedSymbolArray.get(h),_=p.vertexStartIndex+4*p.numGlyphs;for(let k=p.vertexStartIndex;k<_;k+=4)s.indexArray.emplaceBack(k,k+1,k+2),s.indexArray.emplaceBack(k+1,k+2,k+3)}getSortedSymbolIndexes(s){if(this.sortedAngle===s&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;const h=Math.sin(s),p=Math.cos(s),_=[],k=[],S=[];for(let T=0;T<this.symbolInstances.length;++T){S.push(T);const A=this.symbolInstances.get(T);_.push(0|Math.round(h*A.anchorX+p*A.anchorY)),k.push(A.featureIndex)}return S.sort((T,A)=>_[T]-_[A]||k[A]-k[T]),S}addToSortKeyRanges(s,h){const p=this.sortKeyRanges[this.sortKeyRanges.length-1];p&&p.sortKey===h?p.symbolInstanceEnd=s+1:this.sortKeyRanges.push({sortKey:h,symbolInstanceStart:s,symbolInstanceEnd:s+1})}sortFeatures(s){if(this.sortFeaturesByY&&this.sortedAngle!==s&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(s),this.sortedAngle=s,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const h of this.symbolInstanceIndexes){const p=this.symbolInstances.get(h);this.featureSortOrder.push(p.featureIndex),[p.rightJustifiedTextSymbolIndex,p.centerJustifiedTextSymbolIndex,p.leftJustifiedTextSymbolIndex].forEach((_,k,S)=>{_>=0&&S.indexOf(_)===k&&this.addIndicesForPlacedSymbol(this.text,_)}),p.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,p.verticalPlacedTextSymbolIndex),p.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,p.placedIconSymbolIndex),p.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,p.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}let HE,qE;ut("SymbolBucket",qu,{omit:["layers","collisionBoxArray","features","compareText"]}),qu.MAX_GLYPHS=65535,qu.addDynamicAttributes=tb;var rb={get paint(){return qE=qE||new v({"icon-opacity":new Et(we.paint_symbol["icon-opacity"]),"icon-color":new Et(we.paint_symbol["icon-color"]),"icon-halo-color":new Et(we.paint_symbol["icon-halo-color"]),"icon-halo-width":new Et(we.paint_symbol["icon-halo-width"]),"icon-halo-blur":new Et(we.paint_symbol["icon-halo-blur"]),"icon-translate":new ft(we.paint_symbol["icon-translate"]),"icon-translate-anchor":new ft(we.paint_symbol["icon-translate-anchor"]),"text-opacity":new Et(we.paint_symbol["text-opacity"]),"text-color":new Et(we.paint_symbol["text-color"],{runtimeType:vt,getOverride:c=>c.textColor,hasOverride:c=>!!c.textColor}),"text-halo-color":new Et(we.paint_symbol["text-halo-color"]),"text-halo-width":new Et(we.paint_symbol["text-halo-width"]),"text-halo-blur":new Et(we.paint_symbol["text-halo-blur"]),"text-translate":new ft(we.paint_symbol["text-translate"]),"text-translate-anchor":new ft(we.paint_symbol["text-translate-anchor"])})},get layout(){return HE=HE||new v({"symbol-placement":new ft(we.layout_symbol["symbol-placement"]),"symbol-spacing":new ft(we.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new ft(we.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new Et(we.layout_symbol["symbol-sort-key"]),"symbol-z-order":new ft(we.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new ft(we.layout_symbol["icon-allow-overlap"]),"icon-overlap":new ft(we.layout_symbol["icon-overlap"]),"icon-ignore-placement":new ft(we.layout_symbol["icon-ignore-placement"]),"icon-optional":new ft(we.layout_symbol["icon-optional"]),"icon-rotation-alignment":new ft(we.layout_symbol["icon-rotation-alignment"]),"icon-size":new Et(we.layout_symbol["icon-size"]),"icon-text-fit":new ft(we.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new ft(we.layout_symbol["icon-text-fit-padding"]),"icon-image":new Et(we.layout_symbol["icon-image"]),"icon-rotate":new Et(we.layout_symbol["icon-rotate"]),"icon-padding":new Et(we.layout_symbol["icon-padding"]),"icon-keep-upright":new ft(we.layout_symbol["icon-keep-upright"]),"icon-offset":new Et(we.layout_symbol["icon-offset"]),"icon-anchor":new Et(we.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new ft(we.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new ft(we.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new ft(we.layout_symbol["text-rotation-alignment"]),"text-field":new Et(we.layout_symbol["text-field"]),"text-font":new Et(we.layout_symbol["text-font"]),"text-size":new Et(we.layout_symbol["text-size"]),"text-max-width":new Et(we.layout_symbol["text-max-width"]),"text-line-height":new ft(we.layout_symbol["text-line-height"]),"text-letter-spacing":new Et(we.layout_symbol["text-letter-spacing"]),"text-justify":new Et(we.layout_symbol["text-justify"]),"text-radial-offset":new Et(we.layout_symbol["text-radial-offset"]),"text-variable-anchor":new ft(we.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new Et(we.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new Et(we.layout_symbol["text-anchor"]),"text-max-angle":new ft(we.layout_symbol["text-max-angle"]),"text-writing-mode":new ft(we.layout_symbol["text-writing-mode"]),"text-rotate":new Et(we.layout_symbol["text-rotate"]),"text-padding":new ft(we.layout_symbol["text-padding"]),"text-keep-upright":new ft(we.layout_symbol["text-keep-upright"]),"text-transform":new Et(we.layout_symbol["text-transform"]),"text-offset":new Et(we.layout_symbol["text-offset"]),"text-allow-overlap":new ft(we.layout_symbol["text-allow-overlap"]),"text-overlap":new ft(we.layout_symbol["text-overlap"]),"text-ignore-placement":new ft(we.layout_symbol["text-ignore-placement"]),"text-optional":new ft(we.layout_symbol["text-optional"])})}};class WE{constructor(s){if(s.property.overrides===void 0)throw new Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=s.property.overrides?s.property.overrides.runtimeType:To,this.defaultValue=s}evaluate(s){if(s.formattedSection){const h=this.defaultValue.property.overrides;if(h&&h.hasOverride(s.formattedSection))return h.getOverride(s.formattedSection)}return s.feature&&s.featureState?this.defaultValue.evaluate(s.feature,s.featureState):this.defaultValue.property.specification.default}eachChild(s){this.defaultValue.isConstant()||s(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}ut("FormatSectionOverride",WE,{omit:["defaultValue"]});class Gm extends d{constructor(s){super(s,rb)}recalculate(s,h){if(super.recalculate(s,h),this.layout.get("icon-rotation-alignment")==="auto"&&(this.layout._values["icon-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-rotation-alignment")==="auto"&&(this.layout._values["text-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-pitch-alignment")==="auto"&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")==="map"?"map":"viewport"),this.layout.get("icon-pitch-alignment")==="auto"&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment")),this.layout.get("symbol-placement")==="point"){const p=this.layout.get("text-writing-mode");if(p){const _=[];for(const k of p)_.indexOf(k)<0&&_.push(k);this.layout._values["text-writing-mode"]=_}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(s,h,p,_){const k=this.layout.get(s).evaluate(h,{},p,_),S=this._unevaluatedLayout._values[s];return S.isDataDriven()||_u(S.value)||!k?k:function(T,A){return A.replace(/{([^{}]+)}/g,(B,z)=>T&&z in T?String(T[z]):"")}(h.properties,k)}createBucket(s){return new qu(s)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const s of rb.paint.overridableProperties){if(!Gm.hasPaintOverride(this.layout,s))continue;const h=this.paint.get(s),p=new WE(h),_=new yu(p,h.property.specification);let k=null;k=h.value.kind==="constant"||h.value.kind==="source"?new $a("source",_):new ja("composite",_,h.value.zoomStops),this.paint._values[s]=new Io(h.property,k,h.parameters)}}_handleOverridablePaintPropertyUpdate(s,h,p){return!(!this.layout||h.isDataDriven()||p.isDataDriven())&&Gm.hasPaintOverride(this.layout,s)}static hasPaintOverride(s,h){const p=s.get("text-field"),_=rb.paint.properties[h];let k=!1;const S=T=>{for(const A of T)if(_.overrides&&_.overrides.hasOverride(A))return void(k=!0)};if(p.value.kind==="constant"&&p.value.value instanceof mr)S(p.value.value.sections);else if(p.value.kind==="source"){const T=B=>{k||(B instanceof Jr&&si(B.value)===Kn?S(B.value.sections):B instanceof lu?S(B.sections):B.eachChild(T))},A=p.value;A._styleExpression&&T(A._styleExpression.expression)}return k}}let GE;var xG={get paint(){return GE=GE||new v({"background-color":new ft(we.paint_background["background-color"]),"background-pattern":new Pu(we.paint_background["background-pattern"]),"background-opacity":new ft(we.paint_background["background-opacity"])})}};class vG extends d{constructor(s){super(s,xG)}}let ZE;var wG={get paint(){return ZE=ZE||new v({"raster-opacity":new ft(we.paint_raster["raster-opacity"]),"raster-hue-rotate":new ft(we.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new ft(we.paint_raster["raster-brightness-min"]),"raster-brightness-max":new ft(we.paint_raster["raster-brightness-max"]),"raster-saturation":new ft(we.paint_raster["raster-saturation"]),"raster-contrast":new ft(we.paint_raster["raster-contrast"]),"raster-resampling":new ft(we.paint_raster["raster-resampling"]),"raster-fade-duration":new ft(we.paint_raster["raster-fade-duration"])})}};class kG extends d{constructor(s){super(s,wG)}}class SG extends d{constructor(s){super(s,{}),this.onAdd=h=>{this.implementation.onAdd&&this.implementation.onAdd(h,h.painter.context.gl)},this.onRemove=h=>{this.implementation.onRemove&&this.implementation.onRemove(h,h.painter.context.gl)},this.implementation=s}is3D(){return this.implementation.renderingMode==="3d"}hasOffscreenPass(){return this.implementation.prerender!==void 0}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){throw new Error("Custom layers cannot be serialized")}}class EG{constructor(s){this._methodToThrottle=s,this._triggered=!1,typeof MessageChannel<"u"&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._methodToThrottle()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(()=>{this._triggered=!1,this._methodToThrottle()},0))}remove(){delete this._channel,this._methodToThrottle=()=>{}}}const ob=63710088e-1;class sl{constructor(s,h){if(isNaN(s)||isNaN(h))throw new Error(`Invalid LngLat object: (${s}, ${h})`);if(this.lng=+s,this.lat=+h,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new sl(ve(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(s){const h=Math.PI/180,p=this.lat*h,_=s.lat*h,k=Math.sin(p)*Math.sin(_)+Math.cos(p)*Math.cos(_)*Math.cos((s.lng-this.lng)*h);return ob*Math.acos(Math.min(k,1))}static convert(s){if(s instanceof sl)return s;if(Array.isArray(s)&&(s.length===2||s.length===3))return new sl(Number(s[0]),Number(s[1]));if(!Array.isArray(s)&&typeof s=="object"&&s!==null)return new sl(Number("lng"in s?s.lng:s.lon),Number(s.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]")}}const YE=2*Math.PI*ob;function XE(c){return YE*Math.cos(c*Math.PI/180)}function KE(c){return(180+c)/360}function JE(c){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+c*Math.PI/360)))/360}function QE(c,s){return c/XE(s)}function sb(c){return 360/Math.PI*Math.atan(Math.exp((180-360*c)*Math.PI/180))-90}class Qd{constructor(s,h,p=0){this.x=+s,this.y=+h,this.z=+p}static fromLngLat(s,h=0){const p=sl.convert(s);return new Qd(KE(p.lng),JE(p.lat),QE(h,p.lat))}toLngLat(){return new sl(360*this.x-180,sb(this.y))}toAltitude(){return this.z*XE(sb(this.y))}meterInMercatorCoordinateUnits(){return 1/YE*(s=sb(this.y),1/Math.cos(s*Math.PI/180));var s}}function eC(c,s,h){var p=2*Math.PI*6378137/256/Math.pow(2,h);return[c*p-2*Math.PI*6378137/2,s*p-2*Math.PI*6378137/2]}class ab{constructor(s,h,p){if(!function(_,k,S){return!(_<0||_>25||S<0||S>=Math.pow(2,_)||k<0||k>=Math.pow(2,_))}(s,h,p))throw new Error(`x=${h}, y=${p}, z=${s} outside of bounds. 0<=x<${Math.pow(2,s)}, 0<=y<${Math.pow(2,s)} 0<=z<=25 `);this.z=s,this.x=h,this.y=p,this.key=ep(0,s,s,h,p)}equals(s){return this.z===s.z&&this.x===s.x&&this.y===s.y}url(s,h,p){const _=(S=this.y,T=this.z,A=eC(256*(k=this.x),256*(S=Math.pow(2,T)-S-1),T),B=eC(256*(k+1),256*(S+1),T),A[0]+","+A[1]+","+B[0]+","+B[1]);var k,S,T,A,B;const z=function(L,j,q){let Y,K="";for(let re=L;re>0;re--)Y=1<<re-1,K+=(j&Y?1:0)+(q&Y?2:0);return K}(this.z,this.x,this.y);return s[(this.x+this.y)%s.length].replace(/{prefix}/g,(this.x%16).toString(16)+(this.y%16).toString(16)).replace(/{z}/g,String(this.z)).replace(/{x}/g,String(this.x)).replace(/{y}/g,String(p==="tms"?Math.pow(2,this.z)-this.y-1:this.y)).replace(/{ratio}/g,h>1?"@2x":"").replace(/{quadkey}/g,z).replace(/{bbox-epsg-3857}/g,_)}isChildOf(s){const h=this.z-s.z;return h>0&&s.x===this.x>>h&&s.y===this.y>>h}getTilePoint(s){const h=Math.pow(2,this.z);return new E((s.x*h-this.x)*ai,(s.y*h-this.y)*ai)}toString(){return`${this.z}/${this.x}/${this.y}`}}class tC{constructor(s,h){this.wrap=s,this.canonical=h,this.key=ep(s,h.z,h.z,h.x,h.y)}}class so{constructor(s,h,p,_,k){if(s<p)throw new Error(`overscaledZ should be >= z; overscaledZ = ${s}; z = ${p}`);this.overscaledZ=s,this.wrap=h,this.canonical=new ab(p,+_,+k),this.key=ep(h,s,p,_,k)}clone(){return new so(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(s){return this.overscaledZ===s.overscaledZ&&this.wrap===s.wrap&&this.canonical.equals(s.canonical)}scaledTo(s){if(s>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${s}; overscaledZ = ${this.overscaledZ}`);const h=this.canonical.z-s;return s>this.canonical.z?new so(s,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new so(s,this.wrap,s,this.canonical.x>>h,this.canonical.y>>h)}calculateScaledKey(s,h){if(s>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${s}; overscaledZ = ${this.overscaledZ}`);const p=this.canonical.z-s;return s>this.canonical.z?ep(this.wrap*+h,s,this.canonical.z,this.canonical.x,this.canonical.y):ep(this.wrap*+h,s,s,this.canonical.x>>p,this.canonical.y>>p)}isChildOf(s){if(s.wrap!==this.wrap)return!1;const h=this.canonical.z-s.canonical.z;return s.overscaledZ===0||s.overscaledZ<this.overscaledZ&&s.canonical.x===this.canonical.x>>h&&s.canonical.y===this.canonical.y>>h}children(s){if(this.overscaledZ>=s)return[new so(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const h=this.canonical.z+1,p=2*this.canonical.x,_=2*this.canonical.y;return[new so(h,this.wrap,h,p,_),new so(h,this.wrap,h,p+1,_),new so(h,this.wrap,h,p,_+1),new so(h,this.wrap,h,p+1,_+1)]}isLessThan(s){return this.wrap<s.wrap||!(this.wrap>s.wrap)&&(this.overscaledZ<s.overscaledZ||!(this.overscaledZ>s.overscaledZ)&&(this.canonical.x<s.canonical.x||!(this.canonical.x>s.canonical.x)&&this.canonical.y<s.canonical.y))}wrapped(){return new so(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(s){return new so(this.overscaledZ,s,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return Math.pow(2,this.overscaledZ-this.canonical.z)}toUnwrapped(){return new tC(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(s){return this.canonical.getTilePoint(new Qd(s.x-this.wrap,s.y))}}function ep(c,s,h,p,_){(c*=2)<0&&(c=-1*c-1);const k=1<<h;return(k*k*c+k*_+p).toString(36)+h.toString(36)+s.toString(36)}ut("CanonicalTileID",ab),ut("OverscaledTileID",so,{omit:["posMatrix"]});class nC{constructor(s,h,p,_=1,k=1,S=1,T=0){if(this.uid=s,h.height!==h.width)throw new RangeError("DEM tiles must be square");if(p&&!["mapbox","terrarium","custom"].includes(p))return void ot(`"${p}" is not a valid encoding type. Valid types include "mapbox", "terrarium" and "custom".`);this.stride=h.height;const A=this.dim=h.height-2;switch(this.data=new Uint32Array(h.data.buffer),p){case"terrarium":this.redFactor=256,this.greenFactor=1,this.blueFactor=1/256,this.baseShift=32768;break;case"custom":this.redFactor=_,this.greenFactor=k,this.blueFactor=S,this.baseShift=T;break;default:this.redFactor=6553.6,this.greenFactor=25.6,this.blueFactor=.1,this.baseShift=1e4}for(let B=0;B<A;B++)this.data[this._idx(-1,B)]=this.data[this._idx(0,B)],this.data[this._idx(A,B)]=this.data[this._idx(A-1,B)],this.data[this._idx(B,-1)]=this.data[this._idx(B,0)],this.data[this._idx(B,A)]=this.data[this._idx(B,A-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(A,-1)]=this.data[this._idx(A-1,0)],this.data[this._idx(-1,A)]=this.data[this._idx(0,A-1)],this.data[this._idx(A,A)]=this.data[this._idx(A-1,A-1)],this.min=Number.MAX_SAFE_INTEGER,this.max=Number.MIN_SAFE_INTEGER;for(let B=0;B<A;B++)for(let z=0;z<A;z++){const L=this.get(B,z);L>this.max&&(this.max=L),L<this.min&&(this.min=L)}}get(s,h){const p=new Uint8Array(this.data.buffer),_=4*this._idx(s,h);return this.unpack(p[_],p[_+1],p[_+2])}getUnpackVector(){return[this.redFactor,this.greenFactor,this.blueFactor,this.baseShift]}_idx(s,h){if(s<-1||s>=this.dim+1||h<-1||h>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(h+1)*this.stride+(s+1)}unpack(s,h,p){return s*this.redFactor+h*this.greenFactor+p*this.blueFactor-this.baseShift}getPixels(){return new oo({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(s,h,p){if(this.dim!==s.dim)throw new Error("dem dimension mismatch");let _=h*this.dim,k=h*this.dim+this.dim,S=p*this.dim,T=p*this.dim+this.dim;switch(h){case-1:_=k-1;break;case 1:k=_+1}switch(p){case-1:S=T-1;break;case 1:T=S+1}const A=-h*this.dim,B=-p*this.dim;for(let z=S;z<T;z++)for(let L=_;L<k;L++)this.data[this._idx(L,z)]=s.data[this._idx(L+A,z+B)]}}ut("DEMData",nC);class iC{constructor(s){this._stringToNumber={},this._numberToString=[];for(let h=0;h<s.length;h++){const p=s[h];this._stringToNumber[p]=h,this._numberToString[h]=p}}encode(s){return this._stringToNumber[s]}decode(s){if(s>=this._numberToString.length)throw new Error(`Out of bounds. Index requested n=${s} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[s]}}class rC{constructor(s,h,p,_,k){this.type="Feature",this._vectorTileFeature=s,s._z=h,s._x=p,s._y=_,this.properties=s.properties,this.id=k}get geometry(){return this._geometry===void 0&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry}set geometry(s){this._geometry=s}toJSON(){const s={geometry:this.geometry};for(const h in this)h!=="_geometry"&&h!=="_vectorTileFeature"&&(s[h]=this[h]);return s}}class oC{constructor(s,h){this.tileID=s,this.x=s.canonical.x,this.y=s.canonical.y,this.z=s.canonical.z,this.grid=new Wa(ai,16,0),this.grid3D=new Wa(ai,16,0),this.featureIndexArray=new Gi,this.promoteId=h}insert(s,h,p,_,k,S){const T=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(p,_,k);const A=S?this.grid3D:this.grid;for(let B=0;B<h.length;B++){const z=h[B],L=[1/0,1/0,-1/0,-1/0];for(let j=0;j<z.length;j++){const q=z[j];L[0]=Math.min(L[0],q.x),L[1]=Math.min(L[1],q.y),L[2]=Math.max(L[2],q.x),L[3]=Math.max(L[3],q.y)}L[0]<ai&&L[1]<ai&&L[2]>=0&&L[3]>=0&&A.insert(T,L[0],L[1],L[2],L[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new il.VectorTile(new Y_(this.rawTileData)).layers,this.sourceLayerCoder=new iC(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(s,h,p,_){this.loadVTLayers();const k=s.params||{},S=ai/s.tileSize/s.scale,T=bd(k.filter),A=s.queryGeometry,B=s.queryPadding*S,z=aC(A),L=this.grid.query(z.minX-B,z.minY-B,z.maxX+B,z.maxY+B),j=aC(s.cameraQueryGeometry),q=this.grid3D.query(j.minX-B,j.minY-B,j.maxX+B,j.maxY+B,(re,ae,be,pe)=>function(ye,Te,Le,rt,St){for(const Je of ye)if(Te<=Je.x&&Le<=Je.y&&rt>=Je.x&&St>=Je.y)return!0;const tt=[new E(Te,Le),new E(Te,St),new E(rt,St),new E(rt,Le)];if(ye.length>2){for(const Je of tt)if(Lu(ye,Je))return!0}for(let Je=0;Je<ye.length-1;Je++)if(oW(ye[Je],ye[Je+1],tt))return!0;return!1}(s.cameraQueryGeometry,re-B,ae-B,be+B,pe+B));for(const re of q)L.push(re);L.sort(CG);const Y={};let K;for(let re=0;re<L.length;re++){const ae=L[re];if(ae===K)continue;K=ae;const be=this.featureIndexArray.get(ae);let pe=null;this.loadMatchingFeature(Y,be.bucketIndex,be.sourceLayerIndex,be.featureIndex,T,k.layers,k.availableImages,h,p,_,(ye,Te,Le)=>(pe||(pe=oc(ye)),Te.queryIntersectsFeature(A,ye,Le,pe,this.z,s.transform,S,s.pixelPosMatrix)))}return Y}loadMatchingFeature(s,h,p,_,k,S,T,A,B,z,L){const j=this.bucketLayerIDs[h];if(S&&!function(re,ae){for(let be=0;be<re.length;be++)if(ae.indexOf(re[be])>=0)return!0;return!1}(S,j))return;const q=this.sourceLayerCoder.decode(p),Y=this.vtLayers[q].feature(_);if(k.needGeometry){const re=sc(Y,!0);if(!k.filter(new Vn(this.tileID.overscaledZ),re,this.tileID.canonical))return}else if(!k.filter(new Vn(this.tileID.overscaledZ),Y))return;const K=this.getId(Y,q);for(let re=0;re<j.length;re++){const ae=j[re];if(S&&S.indexOf(ae)<0)continue;const be=A[ae];if(!be)continue;let pe={};K&&z&&(pe=z.getState(be.sourceLayer||"_geojsonTileLayer",K));const ye=Se({},B[ae]);ye.paint=sC(ye.paint,be.paint,Y,pe,T),ye.layout=sC(ye.layout,be.layout,Y,pe,T);const Te=!L||L(Y,be,pe);if(!Te)continue;const Le=new rC(Y,this.z,this.x,this.y,K);Le.layer=ye;let rt=s[ae];rt===void 0&&(rt=s[ae]=[]),rt.push({featureIndex:_,feature:Le,intersectionZ:Te})}}lookupSymbolFeatures(s,h,p,_,k,S,T,A){const B={};this.loadVTLayers();const z=bd(k);for(const L of s)this.loadMatchingFeature(B,p,_,L,z,S,T,A,h);return B}hasLayer(s){for(const h of this.bucketLayerIDs)for(const p of h)if(s===p)return!0;return!1}getId(s,h){let p=s.id;return this.promoteId&&(p=s.properties[typeof this.promoteId=="string"?this.promoteId:this.promoteId[h]],typeof p=="boolean"&&(p=Number(p))),p}}function sC(c,s,h,p,_){return Ae(c,(k,S)=>{const T=s instanceof tc?s.get(S):null;return T&&T.evaluate?T.evaluate(h,p,_):T})}function aC(c){let s=1/0,h=1/0,p=-1/0,_=-1/0;for(const k of c)s=Math.min(s,k.x),h=Math.min(h,k.y),p=Math.max(p,k.x),_=Math.max(_,k.y);return{minX:s,minY:h,maxX:p,maxY:_}}function CG(c,s){return s-c}function lC(c,s,h,p,_){const k=[];for(let S=0;S<c.length;S++){const T=c[S];let A;for(let B=0;B<T.length-1;B++){let z=T[B],L=T[B+1];z.x<s&&L.x<s||(z.x<s?z=new E(s,z.y+(s-z.x)/(L.x-z.x)*(L.y-z.y))._round():L.x<s&&(L=new E(s,z.y+(s-z.x)/(L.x-z.x)*(L.y-z.y))._round()),z.y<h&&L.y<h||(z.y<h?z=new E(z.x+(h-z.y)/(L.y-z.y)*(L.x-z.x),h)._round():L.y<h&&(L=new E(z.x+(h-z.y)/(L.y-z.y)*(L.x-z.x),h)._round()),z.x>=p&&L.x>=p||(z.x>=p?z=new E(p,z.y+(p-z.x)/(L.x-z.x)*(L.y-z.y))._round():L.x>=p&&(L=new E(p,z.y+(p-z.x)/(L.x-z.x)*(L.y-z.y))._round()),z.y>=_&&L.y>=_||(z.y>=_?z=new E(z.x+(_-z.y)/(L.y-z.y)*(L.x-z.x),_)._round():L.y>=_&&(L=new E(z.x+(_-z.y)/(L.y-z.y)*(L.x-z.x),_)._round()),A&&z.equals(A[A.length-1])||(A=[z],k.push(A)),A.push(L)))))}}return k}ut("FeatureIndex",oC,{omit:["rawTileData","sourceLayerCoder"]});class al extends E{constructor(s,h,p,_){super(s,h),this.angle=p,_!==void 0&&(this.segment=_)}clone(){return new al(this.x,this.y,this.angle,this.segment)}}function cC(c,s,h,p,_){if(s.segment===void 0||h===0)return!0;let k=s,S=s.segment+1,T=0;for(;T>-h/2;){if(S--,S<0)return!1;T-=c[S].dist(k),k=c[S]}T+=c[S].dist(c[S+1]),S++;const A=[];let B=0;for(;T<h/2;){const z=c[S],L=c[S+1];if(!L)return!1;let j=c[S-1].angleTo(z)-z.angleTo(L);for(j=Math.abs((j+3*Math.PI)%(2*Math.PI)-Math.PI),A.push({distance:T,angleDelta:j}),B+=j;T-A[0].distance>p;)B-=A.shift().angleDelta;if(B>_)return!1;S++,T+=z.dist(L)}return!0}function uC(c){let s=0;for(let h=0;h<c.length-1;h++)s+=c[h].dist(c[h+1]);return s}function hC(c,s,h){return c?.6*s*h:0}function dC(c,s){return Math.max(c?c.right-c.left:0,s?s.right-s.left:0)}function TG(c,s,h,p,_,k){const S=hC(h,_,k),T=dC(h,p)*k;let A=0;const B=uC(c)/2;for(let z=0;z<c.length-1;z++){const L=c[z],j=c[z+1],q=L.dist(j);if(A+q>B){const Y=(B-A)/q,K=nr.number(L.x,j.x,Y),re=nr.number(L.y,j.y,Y),ae=new al(K,re,j.angleTo(L),z);return ae._round(),!S||cC(c,ae,T,S,s)?ae:void 0}A+=q}}function MG(c,s,h,p,_,k,S,T,A){const B=hC(p,k,S),z=dC(p,_),L=z*S,j=c[0].x===0||c[0].x===A||c[0].y===0||c[0].y===A;return s-L<s/4&&(s=L+s/4),pC(c,j?s/2*T%s:(z/2+2*k)*S*T%s,s,B,h,L,j,!1,A)}function pC(c,s,h,p,_,k,S,T,A){const B=k/2,z=uC(c);let L=0,j=s-h,q=[];for(let Y=0;Y<c.length-1;Y++){const K=c[Y],re=c[Y+1],ae=K.dist(re),be=re.angleTo(K);for(;j+h<L+ae;){j+=h;const pe=(j-L)/ae,ye=nr.number(K.x,re.x,pe),Te=nr.number(K.y,re.y,pe);if(ye>=0&&ye<A&&Te>=0&&Te<A&&j-B>=0&&j+B<=z){const Le=new al(ye,Te,be,Y);Le._round(),p&&!cC(c,Le,k,p,_)||q.push(Le)}}L+=ae}return T||q.length||S||(q=pC(c,L/2,h,p,_,k,S,!0,A)),q}ut("Anchor",al);const Wu=vr;function fC(c,s,h,p){const _=[],k=c.image,S=k.pixelRatio,T=k.paddedRect.w-2*Wu,A=k.paddedRect.h-2*Wu;let B={x1:c.left,y1:c.top,x2:c.right,y2:c.bottom};const z=k.stretchX||[[0,T]],L=k.stretchY||[[0,A]],j=(Oe,bt)=>Oe+bt[1]-bt[0],q=z.reduce(j,0),Y=L.reduce(j,0),K=T-q,re=A-Y;let ae=0,be=q,pe=0,ye=Y,Te=0,Le=K,rt=0,St=re;if(k.content&&p){const Oe=k.content,bt=Oe[2]-Oe[0],gt=Oe[3]-Oe[1];(k.textFitWidth||k.textFitHeight)&&(B=$E(c)),ae=Zm(z,0,Oe[0]),pe=Zm(L,0,Oe[1]),be=Zm(z,Oe[0],Oe[2]),ye=Zm(L,Oe[1],Oe[3]),Te=Oe[0]-ae,rt=Oe[1]-pe,Le=bt-be,St=gt-ye}const tt=B.x1,Je=B.y1,yt=B.x2-tt,dt=B.y2-Je,at=(Oe,bt,gt,Ot)=>{const Dn=Ym(Oe.stretch-ae,be,yt,tt),An=Xm(Oe.fixed-Te,Le,Oe.stretch,q),gi=Ym(bt.stretch-pe,ye,dt,Je),Do=Xm(bt.fixed-rt,St,bt.stretch,Y),Ri=Ym(gt.stretch-ae,be,yt,tt),yi=Xm(gt.fixed-Te,Le,gt.stretch,q),sr=Ym(Ot.stretch-pe,ye,dt,Je),ar=Xm(Ot.fixed-rt,St,Ot.stretch,Y),lr=new E(Dn,gi),ei=new E(Ri,gi),_i=new E(Ri,sr),Yi=new E(Dn,sr),Li=new E(An/S,Do/S),cr=new E(yi/S,ar/S),Vi=s*Math.PI/180;if(Vi){const hn=Math.sin(Vi),Bn=Math.cos(Vi),Un=[Bn,-hn,hn,Bn];lr._matMult(Un),ei._matMult(Un),Yi._matMult(Un),_i._matMult(Un)}const ao=Oe.stretch+Oe.fixed,wr=bt.stretch+bt.fixed;return{tl:lr,tr:ei,bl:Yi,br:_i,tex:{x:k.paddedRect.x+Wu+ao,y:k.paddedRect.y+Wu+wr,w:gt.stretch+gt.fixed-ao,h:Ot.stretch+Ot.fixed-wr},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:Li,pixelOffsetBR:cr,minFontScaleX:Le/S/yt,minFontScaleY:St/S/dt,isSDF:h}};if(p&&(k.stretchX||k.stretchY)){const Oe=mC(z,K,q),bt=mC(L,re,Y);for(let gt=0;gt<Oe.length-1;gt++){const Ot=Oe[gt],Dn=Oe[gt+1];for(let An=0;An<bt.length-1;An++)_.push(at(Ot,bt[An],Dn,bt[An+1]))}}else _.push(at({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:T+1},{fixed:0,stretch:A+1}));return _}function Zm(c,s,h){let p=0;for(const _ of c)p+=Math.max(s,Math.min(h,_[1]))-Math.max(s,Math.min(h,_[0]));return p}function mC(c,s,h){const p=[{fixed:-Wu,stretch:0}];for(const[_,k]of c){const S=p[p.length-1];p.push({fixed:_-S.stretch,stretch:S.stretch}),p.push({fixed:_-S.stretch,stretch:S.stretch+(k-_)})}return p.push({fixed:s+Wu,stretch:h}),p}function Ym(c,s,h,p){return c/s*h+p}function Xm(c,s,h,p){return c-s*h/p}class Km{constructor(s,h,p,_,k,S,T,A,B,z){var L;if(this.boxStartIndex=s.length,B){let j=S.top,q=S.bottom;const Y=S.collisionPadding;Y&&(j-=Y[1],q+=Y[3]);let K=q-j;K>0&&(K=Math.max(10,K),this.circleDiameter=K)}else{const j=!((L=S.image)===null||L===void 0)&&L.content&&(S.image.textFitWidth||S.image.textFitHeight)?$E(S):{x1:S.left,y1:S.top,x2:S.right,y2:S.bottom};j.y1=j.y1*T-A[0],j.y2=j.y2*T+A[2],j.x1=j.x1*T-A[3],j.x2=j.x2*T+A[1];const q=S.collisionPadding;if(q&&(j.x1-=q[0]*T,j.y1-=q[1]*T,j.x2+=q[2]*T,j.y2+=q[3]*T),z){const Y=new E(j.x1,j.y1),K=new E(j.x2,j.y1),re=new E(j.x1,j.y2),ae=new E(j.x2,j.y2),be=z*Math.PI/180;Y._rotate(be),K._rotate(be),re._rotate(be),ae._rotate(be),j.x1=Math.min(Y.x,K.x,re.x,ae.x),j.x2=Math.max(Y.x,K.x,re.x,ae.x),j.y1=Math.min(Y.y,K.y,re.y,ae.y),j.y2=Math.max(Y.y,K.y,re.y,ae.y)}s.emplaceBack(h.x,h.y,j.x1,j.y1,j.x2,j.y2,p,_,k)}this.boxEndIndex=s.length}}class AG{constructor(s=[],h=(p,_)=>p<_?-1:p>_?1:0){if(this.data=s,this.length=this.data.length,this.compare=h,this.length>0)for(let p=(this.length>>1)-1;p>=0;p--)this._down(p)}push(s){this.data.push(s),this._up(this.length++)}pop(){if(this.length===0)return;const s=this.data[0],h=this.data.pop();return--this.length>0&&(this.data[0]=h,this._down(0)),s}peek(){return this.data[0]}_up(s){const{data:h,compare:p}=this,_=h[s];for(;s>0;){const k=s-1>>1,S=h[k];if(p(_,S)>=0)break;h[s]=S,s=k}h[s]=_}_down(s){const{data:h,compare:p}=this,_=this.length>>1,k=h[s];for(;s<_;){let S=1+(s<<1);const T=S+1;if(T<this.length&&p(h[T],h[S])<0&&(S=T),p(h[S],k)>=0)break;h[s]=h[S],s=S}h[s]=k}}function IG(c,s=1,h=!1){let p=1/0,_=1/0,k=-1/0,S=-1/0;const T=c[0];for(let q=0;q<T.length;q++){const Y=T[q];(!q||Y.x<p)&&(p=Y.x),(!q||Y.y<_)&&(_=Y.y),(!q||Y.x>k)&&(k=Y.x),(!q||Y.y>S)&&(S=Y.y)}const A=Math.min(k-p,S-_);let B=A/2;const z=new AG([],PG);if(A===0)return new E(p,_);for(let q=p;q<k;q+=A)for(let Y=_;Y<S;Y+=A)z.push(new Gu(q+B,Y+B,B,c));let L=function(q){let Y=0,K=0,re=0;const ae=q[0];for(let be=0,pe=ae.length,ye=pe-1;be<pe;ye=be++){const Te=ae[be],Le=ae[ye],rt=Te.x*Le.y-Le.x*Te.y;K+=(Te.x+Le.x)*rt,re+=(Te.y+Le.y)*rt,Y+=3*rt}return new Gu(K/Y,re/Y,0,q)}(c),j=z.length;for(;z.length;){const q=z.pop();(q.d>L.d||!L.d)&&(L=q,h&&console.log("found best %d after %d probes",Math.round(1e4*q.d)/1e4,j)),q.max-L.d<=s||(B=q.h/2,z.push(new Gu(q.p.x-B,q.p.y-B,B,c)),z.push(new Gu(q.p.x+B,q.p.y-B,B,c)),z.push(new Gu(q.p.x-B,q.p.y+B,B,c)),z.push(new Gu(q.p.x+B,q.p.y+B,B,c)),j+=4)}return h&&(console.log(`num probes: ${j}`),console.log(`best distance: ${L.d}`)),L.p}function PG(c,s){return s.max-c.max}function Gu(c,s,h,p){this.p=new E(c,s),this.h=h,this.d=function(_,k){let S=!1,T=1/0;for(let A=0;A<k.length;A++){const B=k[A];for(let z=0,L=B.length,j=L-1;z<L;j=z++){const q=B[z],Y=B[j];q.y>_.y!=Y.y>_.y&&_.x<(Y.x-q.x)*(_.y-q.y)/(Y.y-q.y)+q.x&&(S=!S),T=Math.min(T,JS(_,q,Y))}}return(S?1:-1)*Math.sqrt(T)}(this.p,p),this.max=this.d+this.h*Math.SQRT2}var Ni;u.aq=void 0,(Ni=u.aq||(u.aq={}))[Ni.center=1]="center",Ni[Ni.left=2]="left",Ni[Ni.right=3]="right",Ni[Ni.top=4]="top",Ni[Ni.bottom=5]="bottom",Ni[Ni["top-left"]=6]="top-left",Ni[Ni["top-right"]=7]="top-right",Ni[Ni["bottom-left"]=8]="bottom-left",Ni[Ni["bottom-right"]=9]="bottom-right";const ll=7,lb=Number.POSITIVE_INFINITY;function gC(c,s){return s[1]!==lb?function(h,p,_){let k=0,S=0;switch(p=Math.abs(p),_=Math.abs(_),h){case"top-right":case"top-left":case"top":S=_-ll;break;case"bottom-right":case"bottom-left":case"bottom":S=-_+ll}switch(h){case"top-right":case"bottom-right":case"right":k=-p;break;case"top-left":case"bottom-left":case"left":k=p}return[k,S]}(c,s[0],s[1]):function(h,p){let _=0,k=0;p<0&&(p=0);const S=p/Math.SQRT2;switch(h){case"top-right":case"top-left":k=S-ll;break;case"bottom-right":case"bottom-left":k=-S+ll;break;case"bottom":k=-p+ll;break;case"top":k=p-ll}switch(h){case"top-right":case"bottom-right":_=-S;break;case"top-left":case"bottom-left":_=S;break;case"left":_=p;break;case"right":_=-p}return[_,k]}(c,s[0])}function yC(c,s,h){var p;const _=c.layout,k=(p=_.get("text-variable-anchor-offset"))===null||p===void 0?void 0:p.evaluate(s,{},h);if(k){const T=k.values,A=[];for(let B=0;B<T.length;B+=2){const z=A[B]=T[B],L=T[B+1].map(j=>j*hi);z.startsWith("top")?L[1]-=ll:z.startsWith("bottom")&&(L[1]+=ll),A[B+1]=L}return new Nr(A)}const S=_.get("text-variable-anchor");if(S){let T;T=c._unevaluatedLayout.getValue("text-radial-offset")!==void 0?[_.get("text-radial-offset").evaluate(s,{},h)*hi,lb]:_.get("text-offset").evaluate(s,{},h).map(B=>B*hi);const A=[];for(const B of S)A.push(B,gC(B,T));return new Nr(A)}return null}function cb(c){switch(c){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function DG(c,s,h,p,_,k,S,T,A,B,z){let L=k.textMaxSize.evaluate(s,{});L===void 0&&(L=S);const j=c.layers[0].layout,q=j.get("icon-offset").evaluate(s,{},z),Y=bC(h.horizontal),K=S/24,re=c.tilePixelRatio*K,ae=c.tilePixelRatio*L/24,be=c.tilePixelRatio*T,pe=c.tilePixelRatio*j.get("symbol-spacing"),ye=j.get("text-padding")*c.tilePixelRatio,Te=function(Oe,bt,gt,Ot=1){const Dn=Oe.get("icon-padding").evaluate(bt,{},gt),An=Dn&&Dn.values;return[An[0]*Ot,An[1]*Ot,An[2]*Ot,An[3]*Ot]}(j,s,z,c.tilePixelRatio),Le=j.get("text-max-angle")/180*Math.PI,rt=j.get("text-rotation-alignment")!=="viewport"&&j.get("symbol-placement")!=="point",St=j.get("icon-rotation-alignment")==="map"&&j.get("symbol-placement")!=="point",tt=j.get("symbol-placement"),Je=pe/2,yt=j.get("icon-text-fit");let dt;p&&yt!=="none"&&(c.allowVerticalPlacement&&h.vertical&&(dt=jE(p,h.vertical,yt,j.get("icon-text-fit-padding"),q,K)),Y&&(p=jE(p,Y,yt,j.get("icon-text-fit-padding"),q,K)));const at=(Oe,bt)=>{bt.x<0||bt.x>=ai||bt.y<0||bt.y>=ai||function(gt,Ot,Dn,An,gi,Do,Ri,yi,sr,ar,lr,ei,_i,Yi,Li,cr,Vi,ao,wr,hn,Bn,Un,Ur,Yn,Zu){const ys=gt.addToLineVertexArray(Ot,Dn);let _s,Oo,lo,Ei,ta=0,ip=0,kC=0,SC=0,yb=-1,_b=-1;const na={};let EC=Bu("");if(gt.allowVerticalPlacement&&An.vertical){const Xi=yi.layout.get("text-rotate").evaluate(Bn,{},Yn)+90;lo=new Km(sr,Ot,ar,lr,ei,An.vertical,_i,Yi,Li,Xi),Ri&&(Ei=new Km(sr,Ot,ar,lr,ei,Ri,Vi,ao,Li,Xi))}if(gi){const Xi=yi.layout.get("icon-rotate").evaluate(Bn,{}),co=yi.layout.get("icon-text-fit")!=="none",lc=fC(gi,Xi,Ur,co),Zo=Ri?fC(Ri,Xi,Ur,co):void 0;Oo=new Km(sr,Ot,ar,lr,ei,gi,Vi,ao,!1,Xi),ta=4*lc.length;const cc=gt.iconSizeData;let bs=null;cc.kind==="source"?(bs=[gs*yi.layout.get("icon-size").evaluate(Bn,{})],bs[0]>ol&&ot(`${gt.layerIds[0]}: Value for "icon-size" is >= ${Jd}. Reduce your "icon-size".`)):cc.kind==="composite"&&(bs=[gs*Un.compositeIconSizes[0].evaluate(Bn,{},Yn),gs*Un.compositeIconSizes[1].evaluate(Bn,{},Yn)],(bs[0]>ol||bs[1]>ol)&&ot(`${gt.layerIds[0]}: Value for "icon-size" is >= ${Jd}. Reduce your "icon-size".`)),gt.addSymbols(gt.icon,lc,bs,hn,wr,Bn,u.ah.none,Ot,ys.lineStartIndex,ys.lineLength,-1,Yn),yb=gt.icon.placedSymbolArray.length-1,Zo&&(ip=4*Zo.length,gt.addSymbols(gt.icon,Zo,bs,hn,wr,Bn,u.ah.vertical,Ot,ys.lineStartIndex,ys.lineLength,-1,Yn),_b=gt.icon.placedSymbolArray.length-1)}const CC=Object.keys(An.horizontal);for(const Xi of CC){const co=An.horizontal[Xi];if(!_s){EC=Bu(co.text);const Zo=yi.layout.get("text-rotate").evaluate(Bn,{},Yn);_s=new Km(sr,Ot,ar,lr,ei,co,_i,Yi,Li,Zo)}const lc=co.positionedLines.length===1;if(kC+=_C(gt,Ot,co,Do,yi,Li,Bn,cr,ys,An.vertical?u.ah.horizontal:u.ah.horizontalOnly,lc?CC:[Xi],na,yb,Un,Yn),lc)break}An.vertical&&(SC+=_C(gt,Ot,An.vertical,Do,yi,Li,Bn,cr,ys,u.ah.vertical,["vertical"],na,_b,Un,Yn));const zG=_s?_s.boxStartIndex:gt.collisionBoxArray.length,NG=_s?_s.boxEndIndex:gt.collisionBoxArray.length,RG=lo?lo.boxStartIndex:gt.collisionBoxArray.length,LG=lo?lo.boxEndIndex:gt.collisionBoxArray.length,VG=Oo?Oo.boxStartIndex:gt.collisionBoxArray.length,FG=Oo?Oo.boxEndIndex:gt.collisionBoxArray.length,$G=Ei?Ei.boxStartIndex:gt.collisionBoxArray.length,jG=Ei?Ei.boxEndIndex:gt.collisionBoxArray.length;let Go=-1;const Qm=(Xi,co)=>Xi&&Xi.circleDiameter?Math.max(Xi.circleDiameter,co):co;Go=Qm(_s,Go),Go=Qm(lo,Go),Go=Qm(Oo,Go),Go=Qm(Ei,Go);const TC=Go>-1?1:0;TC&&(Go*=Zu/hi),gt.glyphOffsetArray.length>=qu.MAX_GLYPHS&&ot("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),Bn.sortKey!==void 0&&gt.addToSortKeyRanges(gt.symbolInstances.length,Bn.sortKey);const UG=yC(yi,Bn,Yn),[HG,qG]=function(Xi,co){const lc=Xi.length,Zo=co==null?void 0:co.values;if((Zo==null?void 0:Zo.length)>0)for(let cc=0;cc<Zo.length;cc+=2){const bs=Zo[cc+1];Xi.emplaceBack(u.aq[Zo[cc]],bs[0],bs[1])}return[lc,Xi.length]}(gt.textAnchorOffsets,UG);gt.symbolInstances.emplaceBack(Ot.x,Ot.y,na.right>=0?na.right:-1,na.center>=0?na.center:-1,na.left>=0?na.left:-1,na.vertical||-1,yb,_b,EC,zG,NG,RG,LG,VG,FG,$G,jG,ar,kC,SC,ta,ip,TC,0,_i,Go,HG,qG)}(c,bt,Oe,h,p,_,dt,c.layers[0],c.collisionBoxArray,s.index,s.sourceLayerIndex,c.index,re,[ye,ye,ye,ye],rt,A,be,Te,St,q,s,k,B,z,S)};if(tt==="line")for(const Oe of lC(s.geometry,0,0,ai,ai)){const bt=MG(Oe,pe,Le,h.vertical||Y,p,24,ae,c.overscaling,ai);for(const gt of bt)Y&&OG(c,Y.text,Je,gt)||at(Oe,gt)}else if(tt==="line-center"){for(const Oe of s.geometry)if(Oe.length>1){const bt=TG(Oe,Le,h.vertical||Y,p,24,ae);bt&&at(Oe,bt)}}else if(s.type==="Polygon")for(const Oe of uu(s.geometry,0)){const bt=IG(Oe,16);at(Oe[0],new al(bt.x,bt.y,0))}else if(s.type==="LineString")for(const Oe of s.geometry)at(Oe,new al(Oe[0].x,Oe[0].y,0));else if(s.type==="Point")for(const Oe of s.geometry)for(const bt of Oe)at([bt],new al(bt.x,bt.y,0))}function _C(c,s,h,p,_,k,S,T,A,B,z,L,j,q,Y){const K=function(be,pe,ye,Te,Le,rt,St,tt){const Je=Te.layout.get("text-rotate").evaluate(rt,{})*Math.PI/180,yt=[];for(const dt of pe.positionedLines)for(const at of dt.positionedGlyphs){if(!at.rect)continue;const Oe=at.rect||{};let bt=BE+1,gt=!0,Ot=1,Dn=0;const An=(Le||tt)&&at.vertical,gi=at.metrics.advance*at.scale/2;if(tt&&pe.verticalizable&&(Dn=dt.lineOffset/2-(at.imageName?-(hi-at.metrics.width*at.scale)/2:(at.scale-1)*hi)),at.imageName){const hn=St[at.imageName];gt=hn.sdf,Ot=hn.pixelRatio,bt=vr/Ot}const Do=Le?[at.x+gi,at.y]:[0,0];let Ri=Le?[0,0]:[at.x+gi+ye[0],at.y+ye[1]-Dn],yi=[0,0];An&&(yi=Ri,Ri=[0,0]);const sr=at.metrics.isDoubleResolution?2:1,ar=(at.metrics.left-bt)*at.scale-gi+Ri[0],lr=(-at.metrics.top-bt)*at.scale+Ri[1],ei=ar+Oe.w/sr*at.scale/Ot,_i=lr+Oe.h/sr*at.scale/Ot,Yi=new E(ar,lr),Li=new E(ei,lr),cr=new E(ar,_i),Vi=new E(ei,_i);if(An){const hn=new E(-gi,gi-Xd),Bn=-Math.PI/2,Un=hi/2-gi,Ur=new E(5-Xd-Un,-(at.imageName?Un:0)),Yn=new E(...yi);Yi._rotateAround(Bn,hn)._add(Ur)._add(Yn),Li._rotateAround(Bn,hn)._add(Ur)._add(Yn),cr._rotateAround(Bn,hn)._add(Ur)._add(Yn),Vi._rotateAround(Bn,hn)._add(Ur)._add(Yn)}if(Je){const hn=Math.sin(Je),Bn=Math.cos(Je),Un=[Bn,-hn,hn,Bn];Yi._matMult(Un),Li._matMult(Un),cr._matMult(Un),Vi._matMult(Un)}const ao=new E(0,0),wr=new E(0,0);yt.push({tl:Yi,tr:Li,bl:cr,br:Vi,tex:Oe,writingMode:pe.writingMode,glyphOffset:Do,sectionIndex:at.sectionIndex,isSDF:gt,pixelOffsetTL:ao,pixelOffsetBR:wr,minFontScaleX:0,minFontScaleY:0})}return yt}(0,h,T,_,k,S,p,c.allowVerticalPlacement),re=c.textSizeData;let ae=null;re.kind==="source"?(ae=[gs*_.layout.get("text-size").evaluate(S,{})],ae[0]>ol&&ot(`${c.layerIds[0]}: Value for "text-size" is >= ${Jd}. Reduce your "text-size".`)):re.kind==="composite"&&(ae=[gs*q.compositeTextSizes[0].evaluate(S,{},Y),gs*q.compositeTextSizes[1].evaluate(S,{},Y)],(ae[0]>ol||ae[1]>ol)&&ot(`${c.layerIds[0]}: Value for "text-size" is >= ${Jd}. Reduce your "text-size".`)),c.addSymbols(c.text,K,ae,T,k,S,B,s,A.lineStartIndex,A.lineLength,j,Y);for(const be of z)L[be]=c.text.placedSymbolArray.length-1;return 4*K.length}function bC(c){for(const s in c)return c[s];return null}function OG(c,s,h,p){const _=c.compareText;if(s in _){const k=_[s];for(let S=k.length-1;S>=0;S--)if(p.dist(k[S])<h)return!0}else _[s]=[];return _[s].push(p),!1}const xC=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class ub{static from(s){if(!(s instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[h,p]=new Uint8Array(s,0,2);if(h!==219)throw new Error("Data does not appear to be in a KDBush format.");const _=p>>4;if(_!==1)throw new Error(`Got v${_} data when expected v1.`);const k=xC[15&p];if(!k)throw new Error("Unrecognized array type.");const[S]=new Uint16Array(s,2,1),[T]=new Uint32Array(s,4,1);return new ub(T,S,k,s)}constructor(s,h=64,p=Float64Array,_){if(isNaN(s)||s<0)throw new Error(`Unpexpected numItems value: ${s}.`);this.numItems=+s,this.nodeSize=Math.min(Math.max(+h,2),65535),this.ArrayType=p,this.IndexArrayType=s<65536?Uint16Array:Uint32Array;const k=xC.indexOf(this.ArrayType),S=2*s*this.ArrayType.BYTES_PER_ELEMENT,T=s*this.IndexArrayType.BYTES_PER_ELEMENT,A=(8-T%8)%8;if(k<0)throw new Error(`Unexpected typed array class: ${p}.`);_&&_ instanceof ArrayBuffer?(this.data=_,this.ids=new this.IndexArrayType(this.data,8,s),this.coords=new this.ArrayType(this.data,8+T+A,2*s),this._pos=2*s,this._finished=!0):(this.data=new ArrayBuffer(8+S+T+A),this.ids=new this.IndexArrayType(this.data,8,s),this.coords=new this.ArrayType(this.data,8+T+A,2*s),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+k]),new Uint16Array(this.data,2,1)[0]=h,new Uint32Array(this.data,4,1)[0]=s)}add(s,h){const p=this._pos>>1;return this.ids[p]=p,this.coords[this._pos++]=s,this.coords[this._pos++]=h,p}finish(){const s=this._pos>>1;if(s!==this.numItems)throw new Error(`Added ${s} items when expected ${this.numItems}.`);return hb(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(s,h,p,_){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:k,coords:S,nodeSize:T}=this,A=[0,k.length-1,0],B=[];for(;A.length;){const z=A.pop()||0,L=A.pop()||0,j=A.pop()||0;if(L-j<=T){for(let re=j;re<=L;re++){const ae=S[2*re],be=S[2*re+1];ae>=s&&ae<=p&&be>=h&&be<=_&&B.push(k[re])}continue}const q=j+L>>1,Y=S[2*q],K=S[2*q+1];Y>=s&&Y<=p&&K>=h&&K<=_&&B.push(k[q]),(z===0?s<=Y:h<=K)&&(A.push(j),A.push(q-1),A.push(1-z)),(z===0?p>=Y:_>=K)&&(A.push(q+1),A.push(L),A.push(1-z))}return B}within(s,h,p){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:_,coords:k,nodeSize:S}=this,T=[0,_.length-1,0],A=[],B=p*p;for(;T.length;){const z=T.pop()||0,L=T.pop()||0,j=T.pop()||0;if(L-j<=S){for(let re=j;re<=L;re++)wC(k[2*re],k[2*re+1],s,h)<=B&&A.push(_[re]);continue}const q=j+L>>1,Y=k[2*q],K=k[2*q+1];wC(Y,K,s,h)<=B&&A.push(_[q]),(z===0?s-p<=Y:h-p<=K)&&(T.push(j),T.push(q-1),T.push(1-z)),(z===0?s+p>=Y:h+p>=K)&&(T.push(q+1),T.push(L),T.push(1-z))}return A}}function hb(c,s,h,p,_,k){if(_-p<=h)return;const S=p+_>>1;vC(c,s,S,p,_,k),hb(c,s,h,p,S-1,1-k),hb(c,s,h,S+1,_,1-k)}function vC(c,s,h,p,_,k){for(;_>p;){if(_-p>600){const B=_-p+1,z=h-p+1,L=Math.log(B),j=.5*Math.exp(2*L/3),q=.5*Math.sqrt(L*j*(B-j)/B)*(z-B/2<0?-1:1);vC(c,s,h,Math.max(p,Math.floor(h-z*j/B+q)),Math.min(_,Math.floor(h+(B-z)*j/B+q)),k)}const S=s[2*h+k];let T=p,A=_;for(tp(c,s,p,h),s[2*_+k]>S&&tp(c,s,p,_);T<A;){for(tp(c,s,T,A),T++,A--;s[2*T+k]<S;)T++;for(;s[2*A+k]>S;)A--}s[2*p+k]===S?tp(c,s,p,A):(A++,tp(c,s,A,_)),A<=h&&(p=A+1),h<=A&&(_=A-1)}}function tp(c,s,h,p){db(c,h,p),db(s,2*h,2*p),db(s,2*h+1,2*p+1)}function db(c,s,h){const p=c[s];c[s]=c[h],c[h]=p}function wC(c,s,h,p){const _=c-h,k=s-p;return _*_+k*k}var pb;u.bg=void 0,(pb=u.bg||(u.bg={})).create="create",pb.load="load",pb.fullLoad="fullLoad";let Jm=null,np=[];const fb=1e3/60,mb="loadTime",gb="fullLoadTime",BG={mark(c){performance.mark(c)},frame(c){const s=c;Jm!=null&&np.push(s-Jm),Jm=s},clearMetrics(){Jm=null,np=[],performance.clearMeasures(mb),performance.clearMeasures(gb);for(const c in u.bg)performance.clearMarks(u.bg[c])},getPerformanceMetrics(){performance.measure(mb,u.bg.create,u.bg.load),performance.measure(gb,u.bg.create,u.bg.fullLoad);const c=performance.getEntriesByName(mb)[0].duration,s=performance.getEntriesByName(gb)[0].duration,h=np.length,p=1/(np.reduce((k,S)=>k+S,0)/h/1e3),_=np.filter(k=>k>fb).reduce((k,S)=>k+(S-fb)/fb,0);return{loadTime:c,fullLoadTime:s,fps:p,percentDroppedFrames:_/(h+_)*100,totalFrames:h}}};u.$=class extends V{},u.A=Vu,u.B=S_,u.C=function(c){if(Vt==null){const s=c.navigator?c.navigator.userAgent:null;Vt=!!c.safari||!(!s||!(/\b(iPad|iPhone|iPod)\b/.test(s)||s.match("Safari")&&!s.match("Chrome")))}return Vt},u.D=ft,u.E=rn,u.F=class{constructor(c,s){this.target=c,this.mapId=s,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new EG(()=>this.process()),this.subscription=function(h,p,_,k){return h.addEventListener(p,_,!1),{unsubscribe:()=>{h.removeEventListener(p,_,!1)}}}(this.target,"message",h=>this.receive(h)),this.globalScope=Nt(self)?c:window}registerMessageHandler(c,s){this.messageHandlers[c]=s}sendAsync(c,s){return new Promise((h,p)=>{const _=Math.round(1e18*Math.random()).toString(36).substring(0,10);this.resolveRejects[_]={resolve:h,reject:p},s&&s.signal.addEventListener("abort",()=>{delete this.resolveRejects[_];const T={id:_,type:"<cancel>",origin:location.origin,targetMapId:c.targetMapId,sourceMapId:this.mapId};this.target.postMessage(T)},{once:!0});const k=[],S=Object.assign(Object.assign({},c),{id:_,sourceMapId:this.mapId,origin:location.origin,data:Ga(c.data,k)});this.target.postMessage(S,{transfer:k})})}receive(c){const s=c.data,h=s.id;if(!(s.origin!=="file://"&&location.origin!=="file://"&&s.origin!=="resource://android"&&location.origin!=="resource://android"&&s.origin!==location.origin||s.targetMapId&&this.mapId!==s.targetMapId)){if(s.type==="<cancel>"){delete this.tasks[h];const p=this.abortControllers[h];return delete this.abortControllers[h],void(p&&p.abort())}if(Nt(self)||s.mustQueue)return this.tasks[h]=s,this.taskQueue.push(h),void this.invoker.trigger();this.processTask(h,s)}}process(){if(this.taskQueue.length===0)return;const c=this.taskQueue.shift(),s=this.tasks[c];delete this.tasks[c],this.taskQueue.length>0&&this.invoker.trigger(),s&&this.processTask(c,s)}processTask(c,s){return l(this,void 0,void 0,function*(){if(s.type==="<response>"){const _=this.resolveRejects[c];return delete this.resolveRejects[c],_?void(s.error?_.reject(Za(s.error)):_.resolve(Za(s.data))):void 0}if(!this.messageHandlers[s.type])return void this.completeTask(c,new Error(`Could not find a registered handler for ${s.type}, map ID: ${this.mapId}, available handlers: ${Object.keys(this.messageHandlers).join(", ")}`));const h=Za(s.data),p=new AbortController;this.abortControllers[c]=p;try{const _=yield this.messageHandlers[s.type](s.sourceMapId,h,p);this.completeTask(c,null,_)}catch(_){this.completeTask(c,_)}})}completeTask(c,s,h){const p=[];delete this.abortControllers[c];const _={id:c,type:"<response>",sourceMapId:this.mapId,origin:location.origin,error:s?Ga(s):null,data:Ga(h,p)};this.target.postMessage(_,{transfer:p})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}},u.G=Rn,u.H=function(){var c=new Vu(16);return Vu!=Float32Array&&(c[1]=0,c[2]=0,c[3]=0,c[4]=0,c[6]=0,c[7]=0,c[8]=0,c[9]=0,c[11]=0,c[12]=0,c[13]=0,c[14]=0),c[0]=1,c[5]=1,c[10]=1,c[15]=1,c},u.I=K_,u.J=function(c,s,h){var p,_,k,S,T,A,B,z,L,j,q,Y,K=h[0],re=h[1],ae=h[2];return s===c?(c[12]=s[0]*K+s[4]*re+s[8]*ae+s[12],c[13]=s[1]*K+s[5]*re+s[9]*ae+s[13],c[14]=s[2]*K+s[6]*re+s[10]*ae+s[14],c[15]=s[3]*K+s[7]*re+s[11]*ae+s[15]):(_=s[1],k=s[2],S=s[3],T=s[4],A=s[5],B=s[6],z=s[7],L=s[8],j=s[9],q=s[10],Y=s[11],c[0]=p=s[0],c[1]=_,c[2]=k,c[3]=S,c[4]=T,c[5]=A,c[6]=B,c[7]=z,c[8]=L,c[9]=j,c[10]=q,c[11]=Y,c[12]=p*K+T*re+L*ae+s[12],c[13]=_*K+A*re+j*ae+s[13],c[14]=k*K+B*re+q*ae+s[14],c[15]=S*K+z*re+Y*ae+s[15]),c},u.K=function(c,s,h){var p=h[0],_=h[1],k=h[2];return c[0]=s[0]*p,c[1]=s[1]*p,c[2]=s[2]*p,c[3]=s[3]*p,c[4]=s[4]*_,c[5]=s[5]*_,c[6]=s[6]*_,c[7]=s[7]*_,c[8]=s[8]*k,c[9]=s[9]*k,c[10]=s[10]*k,c[11]=s[11]*k,c[12]=s[12],c[13]=s[13],c[14]=s[14],c[15]=s[15],c},u.L=nE,u.M=function(c,s){const h={};for(let p=0;p<s.length;p++){const _=s[p];_ in c&&(h[_]=c[_])}return h},u.N=sl,u.O=KE,u.P=E,u.Q=JE,u.R=oo,u.S=so,u.T=Au,u.U=W,u.V=te,u.W=Cn,u.X=ai,u.Y=M,u.Z=Qd,u._=l,u.a=Nn,u.a$=function(c,s){var h=c[0],p=c[1],_=c[2],k=c[3],S=c[4],T=c[5],A=c[6],B=c[7],z=c[8],L=c[9],j=c[10],q=c[11],Y=c[12],K=c[13],re=c[14],ae=c[15],be=s[0],pe=s[1],ye=s[2],Te=s[3],Le=s[4],rt=s[5],St=s[6],tt=s[7],Je=s[8],yt=s[9],dt=s[10],at=s[11],Oe=s[12],bt=s[13],gt=s[14],Ot=s[15];return Math.abs(h-be)<=or*Math.max(1,Math.abs(h),Math.abs(be))&&Math.abs(p-pe)<=or*Math.max(1,Math.abs(p),Math.abs(pe))&&Math.abs(_-ye)<=or*Math.max(1,Math.abs(_),Math.abs(ye))&&Math.abs(k-Te)<=or*Math.max(1,Math.abs(k),Math.abs(Te))&&Math.abs(S-Le)<=or*Math.max(1,Math.abs(S),Math.abs(Le))&&Math.abs(T-rt)<=or*Math.max(1,Math.abs(T),Math.abs(rt))&&Math.abs(A-St)<=or*Math.max(1,Math.abs(A),Math.abs(St))&&Math.abs(B-tt)<=or*Math.max(1,Math.abs(B),Math.abs(tt))&&Math.abs(z-Je)<=or*Math.max(1,Math.abs(z),Math.abs(Je))&&Math.abs(L-yt)<=or*Math.max(1,Math.abs(L),Math.abs(yt))&&Math.abs(j-dt)<=or*Math.max(1,Math.abs(j),Math.abs(dt))&&Math.abs(q-at)<=or*Math.max(1,Math.abs(q),Math.abs(at))&&Math.abs(Y-Oe)<=or*Math.max(1,Math.abs(Y),Math.abs(Oe))&&Math.abs(K-bt)<=or*Math.max(1,Math.abs(K),Math.abs(bt))&&Math.abs(re-gt)<=or*Math.max(1,Math.abs(re),Math.abs(gt))&&Math.abs(ae-Ot)<=or*Math.max(1,Math.abs(ae),Math.abs(Ot))},u.a0=tn,u.a1=ab,u.a2=Ve,u.a3=c=>{const s=window.document.createElement("video");return s.muted=!0,new Promise(h=>{s.onloadstart=()=>{h(s)};for(const p of c){const _=window.document.createElement("source");ct(p)||(s.crossOrigin="Anonymous"),_.src=p,s.appendChild(_)}})},u.a4=function(){return Ne++},u.a5=nt,u.a6=qu,u.a7=bd,u.a8=sc,u.a9=rC,u.aA=function(c){if(c.type==="custom")return new SG(c);switch(c.type){case"background":return new vG(c);case"circle":return new lW(c);case"fill":return new EW(c);case"fill-extrusion":return new FW(c);case"heatmap":return new uW(c);case"hillshade":return new dW(c);case"line":return new ZW(c);case"raster":return new kG(c);case"symbol":return new Gm(c)}},u.aB=Xe,u.aC=function(c,s){if(!c)return[{command:"setStyle",args:[s]}];let h=[];try{if(!qt(c.version,s.version))return[{command:"setStyle",args:[s]}];qt(c.center,s.center)||h.push({command:"setCenter",args:[s.center]}),qt(c.zoom,s.zoom)||h.push({command:"setZoom",args:[s.zoom]}),qt(c.bearing,s.bearing)||h.push({command:"setBearing",args:[s.bearing]}),qt(c.pitch,s.pitch)||h.push({command:"setPitch",args:[s.pitch]}),qt(c.sprite,s.sprite)||h.push({command:"setSprite",args:[s.sprite]}),qt(c.glyphs,s.glyphs)||h.push({command:"setGlyphs",args:[s.glyphs]}),qt(c.transition,s.transition)||h.push({command:"setTransition",args:[s.transition]}),qt(c.light,s.light)||h.push({command:"setLight",args:[s.light]}),qt(c.terrain,s.terrain)||h.push({command:"setTerrain",args:[s.terrain]}),qt(c.sky,s.sky)||h.push({command:"setSky",args:[s.sky]}),qt(c.projection,s.projection)||h.push({command:"setProjection",args:[s.projection]});const p={},_=[];(function(S,T,A,B){let z;for(z in T=T||{},S=S||{})Object.prototype.hasOwnProperty.call(S,z)&&(Object.prototype.hasOwnProperty.call(T,z)||Hi(z,A,B));for(z in T)Object.prototype.hasOwnProperty.call(T,z)&&(Object.prototype.hasOwnProperty.call(S,z)?qt(S[z],T[z])||(S[z].type==="geojson"&&T[z].type==="geojson"&&Or(S,T,z)?sn(A,{command:"setGeoJSONSourceData",args:[z,T[z].data]}):xi(z,T,A,B)):ui(z,T,A))})(c.sources,s.sources,_,p);const k=[];c.layers&&c.layers.forEach(S=>{"source"in S&&p[S.source]?h.push({command:"removeLayer",args:[S.id]}):k.push(S)}),h=h.concat(_),function(S,T,A){T=T||[];const B=(S=S||[]).map(Eo),z=T.map(Eo),L=S.reduce(Co,{}),j=T.reduce(Co,{}),q=B.slice(),Y=Object.create(null);let K,re,ae,be,pe;for(let ye=0,Te=0;ye<B.length;ye++)K=B[ye],Object.prototype.hasOwnProperty.call(j,K)?Te++:(sn(A,{command:"removeLayer",args:[K]}),q.splice(q.indexOf(K,Te),1));for(let ye=0,Te=0;ye<z.length;ye++)K=z[z.length-1-ye],q[q.length-1-ye]!==K&&(Object.prototype.hasOwnProperty.call(L,K)?(sn(A,{command:"removeLayer",args:[K]}),q.splice(q.lastIndexOf(K,q.length-Te),1)):Te++,be=q[q.length-ye],sn(A,{command:"addLayer",args:[j[K],be]}),q.splice(q.length-ye,0,K),Y[K]=!0);for(let ye=0;ye<z.length;ye++)if(K=z[ye],re=L[K],ae=j[K],!Y[K]&&!qt(re,ae))if(qt(re.source,ae.source)&&qt(re["source-layer"],ae["source-layer"])&&qt(re.type,ae.type)){for(pe in vi(re.layout,ae.layout,A,K,null,"setLayoutProperty"),vi(re.paint,ae.paint,A,K,null,"setPaintProperty"),qt(re.filter,ae.filter)||sn(A,{command:"setFilter",args:[K,ae.filter]}),qt(re.minzoom,ae.minzoom)&&qt(re.maxzoom,ae.maxzoom)||sn(A,{command:"setLayerZoomRange",args:[K,ae.minzoom,ae.maxzoom]}),re)Object.prototype.hasOwnProperty.call(re,pe)&&pe!=="layout"&&pe!=="paint"&&pe!=="filter"&&pe!=="metadata"&&pe!=="minzoom"&&pe!=="maxzoom"&&(pe.indexOf("paint.")===0?vi(re[pe],ae[pe],A,K,pe.slice(6),"setPaintProperty"):qt(re[pe],ae[pe])||sn(A,{command:"setLayerProperty",args:[K,pe,ae[pe]]}));for(pe in ae)Object.prototype.hasOwnProperty.call(ae,pe)&&!Object.prototype.hasOwnProperty.call(re,pe)&&pe!=="layout"&&pe!=="paint"&&pe!=="filter"&&pe!=="metadata"&&pe!=="minzoom"&&pe!=="maxzoom"&&(pe.indexOf("paint.")===0?vi(re[pe],ae[pe],A,K,pe.slice(6),"setPaintProperty"):qt(re[pe],ae[pe])||sn(A,{command:"setLayerProperty",args:[K,pe,ae[pe]]}))}else sn(A,{command:"removeLayer",args:[K]}),be=q[q.lastIndexOf(K)+1],sn(A,{command:"addLayer",args:[ae,be]})}(k,s.layers,h)}catch(p){console.warn("Unable to compute style diff:",p),h=[{command:"setStyle",args:[s]}]}return h},u.aD=function(c){const s=[],h=c.id;return h===void 0&&s.push({message:`layers.${h}: missing required property "id"`}),c.render===void 0&&s.push({message:`layers.${h}: missing required method "render"`}),c.renderingMode&&c.renderingMode!=="2d"&&c.renderingMode!=="3d"&&s.push({message:`layers.${h}: property "renderingMode" must be either "2d" or "3d"`}),s},u.aE=function c(s,h){if(Array.isArray(s)){if(!Array.isArray(h)||s.length!==h.length)return!1;for(let p=0;p<s.length;p++)if(!c(s[p],h[p]))return!1;return!0}if(typeof s=="object"&&s!==null&&h!==null){if(typeof h!="object"||Object.keys(s).length!==Object.keys(h).length)return!1;for(const p in s)if(!c(s[p],h[p]))return!1;return!0}return s===h},u.aF=Ae,u.aG=$e,u.aH=class extends ic{constructor(c,s){super(c,s),this.current=0}set(c){this.current!==c&&(this.current=c,this.gl.uniform1i(this.location,c))}},u.aI=Bm,u.aJ=class extends ic{constructor(c,s){super(c,s),this.current=eW}set(c){if(c[12]!==this.current[12]||c[0]!==this.current[0])return this.current=c,void this.gl.uniformMatrix4fv(this.location,!1,c);for(let s=1;s<16;s++)if(c[s]!==this.current[s]){this.current=c,this.gl.uniformMatrix4fv(this.location,!1,c);break}}},u.aK=qS,u.aL=WS,u.aM=kn,u.aN=class extends ic{constructor(c,s){super(c,s),this.current=[0,0,0]}set(c){c[0]===this.current[0]&&c[1]===this.current[1]&&c[2]===this.current[2]||(this.current=c,this.gl.uniform3f(this.location,c[0],c[1],c[2]))}},u.aO=class extends ic{constructor(c,s){super(c,s),this.current=[0,0]}set(c){c[0]===this.current[0]&&c[1]===this.current[1]||(this.current=c,this.gl.uniform2f(this.location,c[0],c[1]))}},u.aP=function(c,s,h,p,_,k,S){var T=1/(s-h),A=1/(p-_),B=1/(k-S);return c[0]=-2*T,c[1]=0,c[2]=0,c[3]=0,c[4]=0,c[5]=-2*A,c[6]=0,c[7]=0,c[8]=0,c[9]=0,c[10]=2*B,c[11]=0,c[12]=(s+h)*T,c[13]=(_+p)*A,c[14]=(S+k)*B,c[15]=1,c},u.aQ=aW,u.aR=class extends me{},u.aS=JW,u.aT=class extends xe{},u.aU=V_,u.aV=function(c){return c<=1?1:Math.pow(2,Math.ceil(Math.log(c)/Math.LN2))},u.aW=aE,u.aX=Bi,u.aY=ro,u.aZ=class extends mt{},u.a_=function(c,s){return c[0]===s[0]&&c[1]===s[1]&&c[2]===s[2]&&c[3]===s[3]&&c[4]===s[4]&&c[5]===s[5]&&c[6]===s[6]&&c[7]===s[7]&&c[8]===s[8]&&c[9]===s[9]&&c[10]===s[10]&&c[11]===s[11]&&c[12]===s[12]&&c[13]===s[13]&&c[14]===s[14]&&c[15]===s[15]},u.aa=function(c){const s={};if(c.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(h,p,_,k)=>{const S=_||k;return s[p]=!S||S.toLowerCase(),""}),s["max-age"]){const h=parseInt(s["max-age"],10);isNaN(h)?delete s["max-age"]:s["max-age"]=h}return s},u.ab=function(c,s){const h=[];for(const p in c)p in s||h.push(p);return h},u.ac=Ie,u.ad=function(c,s,h){var p=Math.sin(h),_=Math.cos(h),k=s[0],S=s[1],T=s[2],A=s[3],B=s[4],z=s[5],L=s[6],j=s[7];return s!==c&&(c[8]=s[8],c[9]=s[9],c[10]=s[10],c[11]=s[11],c[12]=s[12],c[13]=s[13],c[14]=s[14],c[15]=s[15]),c[0]=k*_+B*p,c[1]=S*_+z*p,c[2]=T*_+L*p,c[3]=A*_+j*p,c[4]=B*_-k*p,c[5]=z*_-S*p,c[6]=L*_-T*p,c[7]=j*_-A*p,c},u.ae=function(c){var s=new Vu(16);return s[0]=c[0],s[1]=c[1],s[2]=c[2],s[3]=c[3],s[4]=c[4],s[5]=c[5],s[6]=c[6],s[7]=c[7],s[8]=c[8],s[9]=c[9],s[10]=c[10],s[11]=c[11],s[12]=c[12],s[13]=c[13],s[14]=c[14],s[15]=c[15],s},u.af=Lm,u.ag=function(c,s){let h=0,p=0;if(c.kind==="constant")p=c.layoutSize;else if(c.kind!=="source"){const{interpolationType:_,minZoom:k,maxZoom:S}=c,T=_?Ie(ir.interpolationFactor(_,s,k,S),0,1):0;c.kind==="camera"?p=nr.number(c.minSize,c.maxSize,T):h=T}return{uSizeT:h,uSize:p}},u.ai=function(c,{uSize:s,uSizeT:h},{lowerSize:p,upperSize:_}){return c.kind==="source"?p/gs:c.kind==="composite"?nr.number(p/gs,_/gs,h):s},u.aj=tb,u.ak=function(c,s,h,p){const _=s.y-c.y,k=s.x-c.x,S=p.y-h.y,T=p.x-h.x,A=S*k-T*_;if(A===0)return null;const B=(T*(c.y-h.y)-S*(c.x-h.x))/A;return new E(c.x+B*k,c.y+B*_)},u.al=lC,u.am=XS,u.an=N_,u.ao=function(c){let s=1/0,h=1/0,p=-1/0,_=-1/0;for(const k of c)s=Math.min(s,k.x),h=Math.min(h,k.y),p=Math.max(p,k.x),_=Math.max(_,k.y);return[s,h,p,_]},u.ap=hi,u.ar=eb,u.as=function(c,s){var h=s[0],p=s[1],_=s[2],k=s[3],S=s[4],T=s[5],A=s[6],B=s[7],z=s[8],L=s[9],j=s[10],q=s[11],Y=s[12],K=s[13],re=s[14],ae=s[15],be=h*T-p*S,pe=h*A-_*S,ye=h*B-k*S,Te=p*A-_*T,Le=p*B-k*T,rt=_*B-k*A,St=z*K-L*Y,tt=z*re-j*Y,Je=z*ae-q*Y,yt=L*re-j*K,dt=L*ae-q*K,at=j*ae-q*re,Oe=be*at-pe*dt+ye*yt+Te*Je-Le*tt+rt*St;return Oe?(c[0]=(T*at-A*dt+B*yt)*(Oe=1/Oe),c[1]=(_*dt-p*at-k*yt)*Oe,c[2]=(K*rt-re*Le+ae*Te)*Oe,c[3]=(j*Le-L*rt-q*Te)*Oe,c[4]=(A*Je-S*at-B*tt)*Oe,c[5]=(h*at-_*Je+k*tt)*Oe,c[6]=(re*ye-Y*rt-ae*pe)*Oe,c[7]=(z*rt-j*ye+q*pe)*Oe,c[8]=(S*dt-T*Je+B*St)*Oe,c[9]=(p*Je-h*dt-k*St)*Oe,c[10]=(Y*Le-K*ye+ae*be)*Oe,c[11]=(L*ye-z*Le-q*be)*Oe,c[12]=(T*tt-S*yt-A*St)*Oe,c[13]=(h*yt-p*tt+_*St)*Oe,c[14]=(K*pe-Y*Te-re*be)*Oe,c[15]=(z*Te-L*pe+j*be)*Oe,c):null},u.at=cb,u.au=Q_,u.av=ub,u.aw=function(){const c={},s=we.$version;for(const h in we.$root){const p=we.$root[h];if(p.required){let _=null;_=h==="version"?s:p.type==="array"?[]:{},_!=null&&(c[h]=_)}}return c},u.ax=Od,u.ay=He,u.az=function(c){c=c.slice();const s=Object.create(null);for(let h=0;h<c.length;h++)s[c[h].id]=c[h];for(let h=0;h<c.length;h++)"ref"in c[h]&&(c[h]=pr(c[h],s[c[h].ref]));return c},u.b=Ft,u.b0=function(c,s){return c[0]=s[0],c[1]=s[1],c[2]=s[2],c[3]=s[3],c[4]=s[4],c[5]=s[5],c[6]=s[6],c[7]=s[7],c[8]=s[8],c[9]=s[9],c[10]=s[10],c[11]=s[11],c[12]=s[12],c[13]=s[13],c[14]=s[14],c[15]=s[15],c},u.b1=function(c,s,h){return c[0]=s[0]*h[0],c[1]=s[1]*h[1],c[2]=s[2]*h[2],c[3]=s[3]*h[3],c},u.b2=function(c,s){return c[0]*s[0]+c[1]*s[1]+c[2]*s[2]+c[3]*s[3]},u.b3=ve,u.b4=tC,u.b5=QE,u.b6=function(c,s,h,p,_){var k,S=1/Math.tan(s/2);return c[0]=S/h,c[1]=0,c[2]=0,c[3]=0,c[4]=0,c[5]=S,c[6]=0,c[7]=0,c[8]=0,c[9]=0,c[11]=-1,c[12]=0,c[13]=0,c[15]=0,_!=null&&_!==1/0?(c[10]=(_+p)*(k=1/(p-_)),c[14]=2*_*p*k):(c[10]=-1,c[14]=-2*p),c},u.b7=function(c,s,h){var p=Math.sin(h),_=Math.cos(h),k=s[4],S=s[5],T=s[6],A=s[7],B=s[8],z=s[9],L=s[10],j=s[11];return s!==c&&(c[0]=s[0],c[1]=s[1],c[2]=s[2],c[3]=s[3],c[12]=s[12],c[13]=s[13],c[14]=s[14],c[15]=s[15]),c[4]=k*_+B*p,c[5]=S*_+z*p,c[6]=T*_+L*p,c[7]=A*_+j*p,c[8]=B*_-k*p,c[9]=z*_-S*p,c[10]=L*_-T*p,c[11]=j*_-A*p,c},u.b8=G,u.b9=Q,u.bA=TE,u.bB=function(c){return c.message===pn},u.bC=Fa,u.bD=br,u.ba=function(c){return c*Math.PI/180},u.bb=function(c,s){const{x:h,y:p}=Qd.fromLngLat(s);return!(c<0||c>25||p<0||p>=1||h<0||h>=1)},u.bc=function(c,s){return c[0]=s[0],c[1]=0,c[2]=0,c[3]=0,c[4]=0,c[5]=s[1],c[6]=0,c[7]=0,c[8]=0,c[9]=0,c[10]=s[2],c[11]=0,c[12]=0,c[13]=0,c[14]=0,c[15]=1,c},u.bd=class extends N{},u.be=ob,u.bf=BG,u.bh=Ce,u.bi=function(c,s){Nn.REGISTERED_PROTOCOLS[c]=s},u.bj=function(c){delete Nn.REGISTERED_PROTOCOLS[c]},u.bk=function(c,s){const h={};for(let _=0;_<c.length;_++){const k=s&&s[c[_].id]||wm(c[_]);s&&(s[c[_].id]=k);let S=h[k];S||(S=h[k]=[]),S.push(c[_])}const p=[];for(const _ in h)p.push(h[_]);return p},u.bl=ut,u.bm=iC,u.bn=oC,u.bo=NE,u.bp=function(c){c.bucket.createArrays(),c.bucket.tilePixelRatio=ai/(512*c.bucket.overscaling),c.bucket.compareText={},c.bucket.iconsNeedLinear=!1;const s=c.bucket.layers[0],h=s.layout,p=s._unevaluatedLayout._values,_={layoutIconSize:p["icon-size"].possiblyEvaluate(new Vn(c.bucket.zoom+1),c.canonical),layoutTextSize:p["text-size"].possiblyEvaluate(new Vn(c.bucket.zoom+1),c.canonical),textMaxSize:p["text-size"].possiblyEvaluate(new Vn(18))};if(c.bucket.textSizeData.kind==="composite"){const{minZoom:B,maxZoom:z}=c.bucket.textSizeData;_.compositeTextSizes=[p["text-size"].possiblyEvaluate(new Vn(B),c.canonical),p["text-size"].possiblyEvaluate(new Vn(z),c.canonical)]}if(c.bucket.iconSizeData.kind==="composite"){const{minZoom:B,maxZoom:z}=c.bucket.iconSizeData;_.compositeIconSizes=[p["icon-size"].possiblyEvaluate(new Vn(B),c.canonical),p["icon-size"].possiblyEvaluate(new Vn(z),c.canonical)]}const k=h.get("text-line-height")*hi,S=h.get("text-rotation-alignment")!=="viewport"&&h.get("symbol-placement")!=="point",T=h.get("text-keep-upright"),A=h.get("text-size");for(const B of c.bucket.features){const z=h.get("text-font").evaluate(B,{},c.canonical).join(","),L=A.evaluate(B,{},c.canonical),j=_.layoutTextSize.evaluate(B,{},c.canonical),q=_.layoutIconSize.evaluate(B,{},c.canonical),Y={horizontal:{},vertical:void 0},K=B.text;let re,ae=[0,0];if(K){const ye=K.toString(),Te=h.get("text-letter-spacing").evaluate(B,{},c.canonical)*hi,Le=E_(ye)?Te:0,rt=h.get("text-anchor").evaluate(B,{},c.canonical),St=yC(s,B,c.canonical);if(!St){const dt=h.get("text-radial-offset").evaluate(B,{},c.canonical);ae=dt?gC(rt,[dt*hi,lb]):h.get("text-offset").evaluate(B,{},c.canonical).map(at=>at*hi)}let tt=S?"center":h.get("text-justify").evaluate(B,{},c.canonical);const Je=h.get("symbol-placement")==="point"?h.get("text-max-width").evaluate(B,{},c.canonical)*hi:1/0,yt=()=>{c.bucket.allowVerticalPlacement&&Bd(ye)&&(Y.vertical=Hm(K,c.glyphMap,c.glyphPositions,c.imagePositions,z,Je,k,rt,"left",Le,ae,u.ah.vertical,!0,j,L))};if(!S&&St){const dt=new Set;if(tt==="auto")for(let Oe=0;Oe<St.values.length;Oe+=2)dt.add(cb(St.values[Oe]));else dt.add(tt);let at=!1;for(const Oe of dt)if(!Y.horizontal[Oe])if(at)Y.horizontal[Oe]=Y.horizontal[0];else{const bt=Hm(K,c.glyphMap,c.glyphPositions,c.imagePositions,z,Je,k,"center",Oe,Le,ae,u.ah.horizontal,!1,j,L);bt&&(Y.horizontal[Oe]=bt,at=bt.positionedLines.length===1)}yt()}else{tt==="auto"&&(tt=cb(rt));const dt=Hm(K,c.glyphMap,c.glyphPositions,c.imagePositions,z,Je,k,rt,tt,Le,ae,u.ah.horizontal,!1,j,L);dt&&(Y.horizontal[tt]=dt),yt(),Bd(ye)&&S&&T&&(Y.vertical=Hm(K,c.glyphMap,c.glyphPositions,c.imagePositions,z,Je,k,rt,tt,Le,ae,u.ah.vertical,!1,j,L))}}let be=!1;if(B.icon&&B.icon.name){const ye=c.imageMap[B.icon.name];ye&&(re=gG(c.imagePositions[B.icon.name],h.get("icon-offset").evaluate(B,{},c.canonical),h.get("icon-anchor").evaluate(B,{},c.canonical)),be=!!ye.sdf,c.bucket.sdfIcons===void 0?c.bucket.sdfIcons=be:c.bucket.sdfIcons!==be&&ot("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(ye.pixelRatio!==c.bucket.pixelRatio||h.get("icon-rotate").constantOr(1)!==0)&&(c.bucket.iconsNeedLinear=!0))}const pe=bC(Y.horizontal)||Y.vertical;c.bucket.iconsInText=!!pe&&pe.iconsInText,(pe||re)&&DG(c.bucket,B,Y,re,c.imageMap,_,j,q,ae,be,c.canonical)}c.showCollisionBoxes&&c.bucket.generateCollisionDebugBuffers()},u.bq=G_,u.br=H_,u.bs=W_,u.bt=il,u.bu=Y_,u.bv=class{constructor(c){this._marks={start:[c.url,"start"].join("#"),end:[c.url,"end"].join("#"),measure:c.url.toString()},performance.mark(this._marks.start)}finish(){performance.mark(this._marks.end);let c=performance.getEntriesByName(this._marks.measure);return c.length===0&&(performance.measure(this._marks.measure,this._marks.start,this._marks.end),c=performance.getEntriesByName(this._marks.measure),performance.clearMarks(this._marks.start),performance.clearMarks(this._marks.end),performance.clearMeasures(this._marks.measure)),c}},u.bw=function(c,s,h,p,_){return l(this,void 0,void 0,function*(){if(te())try{return yield Cn(c,s,h,p,_)}catch{}return function(k,S,T,A,B){const z=k.width,L=k.height;dn&&vn||(dn=new OffscreenCanvas(z,L),vn=dn.getContext("2d",{willReadFrequently:!0})),dn.width=z,dn.height=L,vn.drawImage(k,0,0,z,L);const j=vn.getImageData(S,T,A,B);return vn.clearRect(0,0,z,L),j.data}(c,s,h,p,_)})},u.bx=nC,u.by=g,u.bz=b,u.c=ti,u.d=c=>l(void 0,void 0,void 0,function*(){if(c.byteLength===0)return createImageBitmap(new ImageData(1,1));const s=new Blob([new Uint8Array(c)],{type:"image/png"});try{return createImageBitmap(s)}catch(h){throw new Error(`Could not load image because of ${h.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`)}}),u.e=Se,u.f=c=>new Promise((s,h)=>{const p=new Image;p.onload=()=>{s(p),URL.revokeObjectURL(p.src),p.onload=null,window.requestAnimationFrame(()=>{p.src=Ht})},p.onerror=()=>h(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 _=new Blob([new Uint8Array(c)],{type:"image/png"});p.src=c.byteLength?URL.createObjectURL(_):Ht}),u.g=Pn,u.h=(c,s)=>De(Se(c,{type:"json"}),s),u.i=Nt,u.j=Mt,u.k=At,u.l=(c,s)=>De(Se(c,{type:"arrayBuffer"}),s),u.m=De,u.n=function(c){return new Y_(c).readFields(cG,[])},u.o=Ud,u.p=zE,u.q=v,u.r=k_,u.s=ct,u.t=Pd,u.u=Ks,u.v=we,u.w=ot,u.x=function([c,s,h]){return s+=90,s*=Math.PI/180,h*=Math.PI/180,{x:c*Math.cos(s)*Math.sin(h),y:c*Math.sin(s)*Math.sin(h),z:c*Math.cos(h)}},u.y=nr,u.z=Vn}),r("worker",["./shared"],function(u){class l{constructor(H){this.keyCache={},H&&this.replace(H)}replace(H){this._layerConfigs={},this._layers={},this.update(H,[])}update(H,U){for(const ie of H){this._layerConfigs[ie.id]=ie;const de=this._layers[ie.id]=u.aA(ie);de._featureFilter=u.a7(de.filter),this.keyCache[ie.id]&&delete this.keyCache[ie.id]}for(const ie of U)delete this.keyCache[ie],delete this._layerConfigs[ie],delete this._layers[ie];this.familiesBySource={};const X=u.bk(Object.values(this._layerConfigs),this.keyCache);for(const ie of X){const de=ie.map(Ee=>this._layers[Ee.id]),fe=de[0];if(fe.visibility==="none")continue;const _e=fe.source||"";let ue=this.familiesBySource[_e];ue||(ue=this.familiesBySource[_e]={});const Me=fe.sourceLayer||"_geojsonTileLayer";let ze=ue[Me];ze||(ze=ue[Me]=[]),ze.push(de)}}}class g{constructor(H){const U={},X=[];for(const _e in H){const ue=H[_e],Me=U[_e]={};for(const ze in ue){const Ee=ue[+ze];if(!Ee||Ee.bitmap.width===0||Ee.bitmap.height===0)continue;const We={x:0,y:0,w:Ee.bitmap.width+2,h:Ee.bitmap.height+2};X.push(We),Me[ze]={rect:We,metrics:Ee.metrics}}}const{w:ie,h:de}=u.p(X),fe=new u.o({width:ie||1,height:de||1});for(const _e in H){const ue=H[_e];for(const Me in ue){const ze=ue[+Me];if(!ze||ze.bitmap.width===0||ze.bitmap.height===0)continue;const Ee=U[_e][Me].rect;u.o.copy(ze.bitmap,fe,{x:0,y:0},{x:Ee.x+1,y:Ee.y+1},ze.bitmap)}}this.image=fe,this.positions=U}}u.bl("GlyphAtlas",g);class b{constructor(H){this.tileID=new u.S(H.tileID.overscaledZ,H.tileID.wrap,H.tileID.canonical.z,H.tileID.canonical.x,H.tileID.canonical.y),this.uid=H.uid,this.zoom=H.zoom,this.pixelRatio=H.pixelRatio,this.tileSize=H.tileSize,this.source=H.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=H.showCollisionBoxes,this.collectResourceTiming=!!H.collectResourceTiming,this.returnDependencies=!!H.returnDependencies,this.promoteId=H.promoteId,this.inFlightDependencies=[]}parse(H,U,X,ie){return u._(this,void 0,void 0,function*(){this.status="parsing",this.data=H,this.collisionBoxArray=new u.a5;const de=new u.bm(Object.keys(H.layers).sort()),fe=new u.bn(this.tileID,this.promoteId);fe.bucketLayerIDs=[];const _e={},ue={featureIndex:fe,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:X},Me=U.familiesBySource[this.source];for(const Ut in Me){const wn=H.layers[Ut];if(!wn)continue;wn.version===1&&u.w(`Vector tile source "${this.source}" layer "${Ut}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const qn=de.encode(Ut),mi=[];for(let ki=0;ki<wn.length;ki++){const Wi=wn.feature(ki),Aa=fe.getId(Wi,Ut);mi.push({feature:Wi,id:Aa,index:ki,sourceLayerIndex:qn})}for(const ki of Me[Ut]){const Wi=ki[0];Wi.source!==this.source&&u.w(`layer.source = ${Wi.source} does not equal this.source = ${this.source}`),Wi.minzoom&&this.zoom<Math.floor(Wi.minzoom)||Wi.maxzoom&&this.zoom>=Wi.maxzoom||Wi.visibility!=="none"&&(w(ki,this.zoom,X),(_e[Wi.id]=Wi.createBucket({index:fe.bucketLayerIDs.length,layers:ki,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:qn,sourceID:this.source})).populate(mi,ue,this.tileID.canonical),fe.bucketLayerIDs.push(ki.map(Aa=>Aa.id)))}}const ze=u.aF(ue.glyphDependencies,Ut=>Object.keys(Ut).map(Number));this.inFlightDependencies.forEach(Ut=>Ut==null?void 0:Ut.abort()),this.inFlightDependencies=[];let Ee=Promise.resolve({});if(Object.keys(ze).length){const Ut=new AbortController;this.inFlightDependencies.push(Ut),Ee=ie.sendAsync({type:"GG",data:{stacks:ze,source:this.source,tileID:this.tileID,type:"glyphs"}},Ut)}const We=Object.keys(ue.iconDependencies);let xt=Promise.resolve({});if(We.length){const Ut=new AbortController;this.inFlightDependencies.push(Ut),xt=ie.sendAsync({type:"GI",data:{icons:We,source:this.source,tileID:this.tileID,type:"icons"}},Ut)}const kt=Object.keys(ue.patternDependencies);let an=Promise.resolve({});if(kt.length){const Ut=new AbortController;this.inFlightDependencies.push(Ut),an=ie.sendAsync({type:"GI",data:{icons:kt,source:this.source,tileID:this.tileID,type:"patterns"}},Ut)}const[Lt,ln,Kt]=yield Promise.all([Ee,xt,an]),oi=new g(Lt),Zn=new u.bo(ln,Kt);for(const Ut in _e){const wn=_e[Ut];wn instanceof u.a6?(w(wn.layers,this.zoom,X),u.bp({bucket:wn,glyphMap:Lt,glyphPositions:oi.positions,imageMap:ln,imagePositions:Zn.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical})):wn.hasPattern&&(wn instanceof u.bq||wn instanceof u.br||wn instanceof u.bs)&&(w(wn.layers,this.zoom,X),wn.addFeatures(ue,this.tileID.canonical,Zn.patternPositions))}return this.status="done",{buckets:Object.values(_e).filter(Ut=>!Ut.isEmpty()),featureIndex:fe,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:oi.image,imageAtlas:Zn,glyphMap:this.returnDependencies?Lt:null,iconMap:this.returnDependencies?ln:null,glyphPositions:this.returnDependencies?oi.positions:null}})}}function w(se,H,U){const X=new u.z(H);for(const ie of se)ie.recalculate(X,U)}class E{constructor(H,U,X){this.actor=H,this.layerIndex=U,this.availableImages=X,this.fetching={},this.loading={},this.loaded={}}loadVectorTile(H,U){return u._(this,void 0,void 0,function*(){const X=yield u.l(H.request,U);try{return{vectorTile:new u.bt.VectorTile(new u.bu(X.data)),rawData:X.data,cacheControl:X.cacheControl,expires:X.expires}}catch(ie){const de=new Uint8Array(X.data);let fe=`Unable to parse the tile at ${H.request.url}, `;throw fe+=de[0]===31&&de[1]===139?"please make sure the data is not gzipped and that you have configured the relevant header in the server":`got error: ${ie.message}`,new Error(fe)}})}loadTile(H){return u._(this,void 0,void 0,function*(){const U=H.uid,X=!!(H&&H.request&&H.request.collectResourceTiming)&&new u.bv(H.request),ie=new b(H);this.loading[U]=ie;const de=new AbortController;ie.abort=de;try{const fe=yield this.loadVectorTile(H,de);if(delete this.loading[U],!fe)return null;const _e=fe.rawData,ue={};fe.expires&&(ue.expires=fe.expires),fe.cacheControl&&(ue.cacheControl=fe.cacheControl);const Me={};if(X){const Ee=X.finish();Ee&&(Me.resourceTiming=JSON.parse(JSON.stringify(Ee)))}ie.vectorTile=fe.vectorTile;const ze=ie.parse(fe.vectorTile,this.layerIndex,this.availableImages,this.actor);this.loaded[U]=ie,this.fetching[U]={rawTileData:_e,cacheControl:ue,resourceTiming:Me};try{const Ee=yield ze;return u.e({rawTileData:_e.slice(0)},Ee,ue,Me)}finally{delete this.fetching[U]}}catch(fe){throw delete this.loading[U],ie.status="done",this.loaded[U]=ie,fe}})}reloadTile(H){return u._(this,void 0,void 0,function*(){const U=H.uid;if(!this.loaded||!this.loaded[U])throw new Error("Should not be trying to reload a tile that was never loaded or has been removed");const X=this.loaded[U];if(X.showCollisionBoxes=H.showCollisionBoxes,X.status==="parsing"){const ie=yield X.parse(X.vectorTile,this.layerIndex,this.availableImages,this.actor);let de;if(this.fetching[U]){const{rawTileData:fe,cacheControl:_e,resourceTiming:ue}=this.fetching[U];delete this.fetching[U],de=u.e({rawTileData:fe.slice(0)},ie,_e,ue)}else de=ie;return de}if(X.status==="done"&&X.vectorTile)return X.parse(X.vectorTile,this.layerIndex,this.availableImages,this.actor)})}abortTile(H){return u._(this,void 0,void 0,function*(){const U=this.loading,X=H.uid;U&&U[X]&&U[X].abort&&(U[X].abort.abort(),delete U[X])})}removeTile(H){return u._(this,void 0,void 0,function*(){this.loaded&&this.loaded[H.uid]&&delete this.loaded[H.uid]})}}class C{constructor(){this.loaded={}}loadTile(H){return u._(this,void 0,void 0,function*(){const{uid:U,encoding:X,rawImageData:ie,redFactor:de,greenFactor:fe,blueFactor:_e,baseShift:ue}=H,Me=ie.width+2,ze=ie.height+2,Ee=u.b(ie)?new u.R({width:Me,height:ze},yield u.bw(ie,-1,-1,Me,ze)):ie,We=new u.bx(U,Ee,X,de,fe,_e,ue);return this.loaded=this.loaded||{},this.loaded[U]=We,We})}removeTile(H){const U=this.loaded,X=H.uid;U&&U[X]&&delete U[X]}}function P(se,H){if(se.length!==0){D(se[0],H);for(var U=1;U<se.length;U++)D(se[U],!H)}}function D(se,H){for(var U=0,X=0,ie=0,de=se.length,fe=de-1;ie<de;fe=ie++){var _e=(se[ie][0]-se[fe][0])*(se[fe][1]+se[ie][1]),ue=U+_e;X+=Math.abs(U)>=Math.abs(_e)?U-ue+_e:_e-ue+U,U=ue}U+X>=0!=!!H&&se.reverse()}var R=u.by(function se(H,U){var X,ie=H&&H.type;if(ie==="FeatureCollection")for(X=0;X<H.features.length;X++)se(H.features[X],U);else if(ie==="GeometryCollection")for(X=0;X<H.geometries.length;X++)se(H.geometries[X],U);else if(ie==="Feature")se(H.geometry,U);else if(ie==="Polygon")P(H.coordinates,U);else if(ie==="MultiPolygon")for(X=0;X<H.coordinates.length;X++)P(H.coordinates[X],U);return H});const $=u.bt.VectorTileFeature.prototype.toGeoJSON;var W={exports:{}},te=u.bz,G=u.bt.VectorTileFeature,Q=Ie;function Ie(se,H){this.options=H||{},this.features=se,this.length=se.length}function ve(se,H){this.id=typeof se.id=="number"?se.id:void 0,this.type=se.type,this.rawGeometry=se.type===1?[se.geometry]:se.geometry,this.properties=se.tags,this.extent=H||4096}Ie.prototype.feature=function(se){return new ve(this.features[se],this.options.extent)},ve.prototype.loadGeometry=function(){var se=this.rawGeometry;this.geometry=[];for(var H=0;H<se.length;H++){for(var U=se[H],X=[],ie=0;ie<U.length;ie++)X.push(new te(U[ie][0],U[ie][1]));this.geometry.push(X)}return this.geometry},ve.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var se=this.geometry,H=1/0,U=-1/0,X=1/0,ie=-1/0,de=0;de<se.length;de++)for(var fe=se[de],_e=0;_e<fe.length;_e++){var ue=fe[_e];H=Math.min(H,ue.x),U=Math.max(U,ue.x),X=Math.min(X,ue.y),ie=Math.max(ie,ue.y)}return[H,X,U,ie]},ve.prototype.toGeoJSON=G.prototype.toGeoJSON;var Se=u.bA,Ne=Q;function Ae(se){var H=new Se;return function(U,X){for(var ie in U.layers)X.writeMessage(3,$e,U.layers[ie])}(se,H),H.finish()}function $e(se,H){var U;H.writeVarintField(15,se.version||1),H.writeStringField(1,se.name||""),H.writeVarintField(5,se.extent||4096);var X={keys:[],values:[],keycache:{},valuecache:{}};for(U=0;U<se.length;U++)X.feature=se.feature(U),H.writeMessage(2,Xe,X);var ie=X.keys;for(U=0;U<ie.length;U++)H.writeStringField(3,ie[U]);var de=X.values;for(U=0;U<de.length;U++)H.writeMessage(4,Vt,de[U])}function Xe(se,H){var U=se.feature;U.id!==void 0&&H.writeVarintField(1,U.id),H.writeMessage(2,Pt,se),H.writeVarintField(3,U.type),H.writeMessage(4,Nt,U)}function Pt(se,H){var U=se.feature,X=se.keys,ie=se.values,de=se.keycache,fe=se.valuecache;for(var _e in U.properties){var ue=U.properties[_e],Me=de[_e];if(ue!==null){Me===void 0&&(X.push(_e),de[_e]=Me=X.length-1),H.writeVarint(Me);var ze=typeof ue;ze!=="string"&&ze!=="boolean"&&ze!=="number"&&(ue=JSON.stringify(ue));var Ee=ze+":"+ue,We=fe[Ee];We===void 0&&(ie.push(ue),fe[Ee]=We=ie.length-1),H.writeVarint(We)}}}function ot(se,H){return(H<<3)+(7&se)}function Tt(se){return se<<1^se>>31}function Nt(se,H){for(var U=se.loadGeometry(),X=se.type,ie=0,de=0,fe=U.length,_e=0;_e<fe;_e++){var ue=U[_e],Me=1;X===1&&(Me=ue.length),H.writeVarint(ot(1,Me));for(var ze=X===3?ue.length-1:ue.length,Ee=0;Ee<ze;Ee++){Ee===1&&X!==1&&H.writeVarint(ot(2,ze-1));var We=ue[Ee].x-ie,xt=ue[Ee].y-de;H.writeVarint(Tt(We)),H.writeVarint(Tt(xt)),ie+=We,de+=xt}X===3&&H.writeVarint(ot(7,1))}}function Vt(se,H){var U=typeof se;U==="string"?H.writeStringField(1,se):U==="boolean"?H.writeBooleanField(7,se):U==="number"&&(se%1!=0?H.writeDoubleField(3,se):se<0?H.writeSVarintField(6,se):H.writeVarintField(5,se))}W.exports=Ae,W.exports.fromVectorTileJs=Ae,W.exports.fromGeojsonVt=function(se,H){H=H||{};var U={};for(var X in se)U[X]=new Ne(se[X].features,H),U[X].name=X,U[X].version=H.version,U[X].extent=H.extent;return Ae({layers:U})},W.exports.GeoJSONWrapper=Ne;var Ft=u.by(W.exports);const Ht={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:se=>se},Cn=Math.fround||(dn=new Float32Array(1),se=>(dn[0]=+se,dn[0]));var dn;const vn=3,pn=5,ti=6;class Nn{constructor(H){this.options=Object.assign(Object.create(Ht),H),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(H){const{log:U,minZoom:X,maxZoom:ie}=this.options;U&&console.time("total time");const de=`prepare ${H.length} points`;U&&console.time(de),this.points=H;const fe=[];for(let ue=0;ue<H.length;ue++){const Me=H[ue];if(!Me.geometry)continue;const[ze,Ee]=Me.geometry.coordinates,We=Cn(Ce(ze)),xt=Cn(He(Ee));fe.push(We,xt,1/0,ue,-1,1),this.options.reduce&&fe.push(0)}let _e=this.trees[ie+1]=this._createTree(fe);U&&console.timeEnd(de);for(let ue=ie;ue>=X;ue--){const Me=+Date.now();_e=this.trees[ue]=this._createTree(this._cluster(_e,ue)),U&&console.log("z%d: %d clusters in %dms",ue,_e.numItems,+Date.now()-Me)}return U&&console.timeEnd("total time"),this}getClusters(H,U){let X=((H[0]+180)%360+360)%360-180;const ie=Math.max(-90,Math.min(90,H[1]));let de=H[2]===180?180:((H[2]+180)%360+360)%360-180;const fe=Math.max(-90,Math.min(90,H[3]));if(H[2]-H[0]>=360)X=-180,de=180;else if(X>de){const Ee=this.getClusters([X,ie,180,fe],U),We=this.getClusters([-180,ie,de,fe],U);return Ee.concat(We)}const _e=this.trees[this._limitZoom(U)],ue=_e.range(Ce(X),He(fe),Ce(de),He(ie)),Me=_e.data,ze=[];for(const Ee of ue){const We=this.stride*Ee;ze.push(Me[We+pn]>1?Pn(Me,We,this.clusterProps):this.points[Me[We+vn]])}return ze}getChildren(H){const U=this._getOriginId(H),X=this._getOriginZoom(H),ie="No cluster with the specified id.",de=this.trees[X];if(!de)throw new Error(ie);const fe=de.data;if(U*this.stride>=fe.length)throw new Error(ie);const _e=this.options.radius/(this.options.extent*Math.pow(2,X-1)),ue=de.within(fe[U*this.stride],fe[U*this.stride+1],_e),Me=[];for(const ze of ue){const Ee=ze*this.stride;fe[Ee+4]===H&&Me.push(fe[Ee+pn]>1?Pn(fe,Ee,this.clusterProps):this.points[fe[Ee+vn]])}if(Me.length===0)throw new Error(ie);return Me}getLeaves(H,U,X){const ie=[];return this._appendLeaves(ie,H,U=U||10,X=X||0,0),ie}getTile(H,U,X){const ie=this.trees[this._limitZoom(H)],de=Math.pow(2,H),{extent:fe,radius:_e}=this.options,ue=_e/fe,Me=(X-ue)/de,ze=(X+1+ue)/de,Ee={features:[]};return this._addTileFeatures(ie.range((U-ue)/de,Me,(U+1+ue)/de,ze),ie.data,U,X,de,Ee),U===0&&this._addTileFeatures(ie.range(1-ue/de,Me,1,ze),ie.data,de,X,de,Ee),U===de-1&&this._addTileFeatures(ie.range(0,Me,ue/de,ze),ie.data,-1,X,de,Ee),Ee.features.length?Ee:null}getClusterExpansionZoom(H){let U=this._getOriginZoom(H)-1;for(;U<=this.options.maxZoom;){const X=this.getChildren(H);if(U++,X.length!==1)break;H=X[0].properties.cluster_id}return U}_appendLeaves(H,U,X,ie,de){const fe=this.getChildren(U);for(const _e of fe){const ue=_e.properties;if(ue&&ue.cluster?de+ue.point_count<=ie?de+=ue.point_count:de=this._appendLeaves(H,ue.cluster_id,X,ie,de):de<ie?de++:H.push(_e),H.length===X)break}return de}_createTree(H){const U=new u.av(H.length/this.stride|0,this.options.nodeSize,Float32Array);for(let X=0;X<H.length;X+=this.stride)U.add(H[X],H[X+1]);return U.finish(),U.data=H,U}_addTileFeatures(H,U,X,ie,de,fe){for(const _e of H){const ue=_e*this.stride,Me=U[ue+pn]>1;let ze,Ee,We;if(Me)ze=Rn(U,ue,this.clusterProps),Ee=U[ue],We=U[ue+1];else{const an=this.points[U[ue+vn]];ze=an.properties;const[Lt,ln]=an.geometry.coordinates;Ee=Ce(Lt),We=He(ln)}const xt={type:1,geometry:[[Math.round(this.options.extent*(Ee*de-X)),Math.round(this.options.extent*(We*de-ie))]],tags:ze};let kt;kt=Me||this.options.generateId?U[ue+vn]:this.points[U[ue+vn]].id,kt!==void 0&&(xt.id=kt),fe.features.push(xt)}}_limitZoom(H){return Math.max(this.options.minZoom,Math.min(Math.floor(+H),this.options.maxZoom+1))}_cluster(H,U){const{radius:X,extent:ie,reduce:de,minPoints:fe}=this.options,_e=X/(ie*Math.pow(2,U)),ue=H.data,Me=[],ze=this.stride;for(let Ee=0;Ee<ue.length;Ee+=ze){if(ue[Ee+2]<=U)continue;ue[Ee+2]=U;const We=ue[Ee],xt=ue[Ee+1],kt=H.within(ue[Ee],ue[Ee+1],_e),an=ue[Ee+pn];let Lt=an;for(const ln of kt){const Kt=ln*ze;ue[Kt+2]>U&&(Lt+=ue[Kt+pn])}if(Lt>an&&Lt>=fe){let ln,Kt=We*an,oi=xt*an,Zn=-1;const Ut=((Ee/ze|0)<<5)+(U+1)+this.points.length;for(const wn of kt){const qn=wn*ze;if(ue[qn+2]<=U)continue;ue[qn+2]=U;const mi=ue[qn+pn];Kt+=ue[qn]*mi,oi+=ue[qn+1]*mi,ue[qn+4]=Ut,de&&(ln||(ln=this._map(ue,Ee,!0),Zn=this.clusterProps.length,this.clusterProps.push(ln)),de(ln,this._map(ue,qn)))}ue[Ee+4]=Ut,Me.push(Kt/Lt,oi/Lt,1/0,Ut,-1,Lt),de&&Me.push(Zn)}else{for(let ln=0;ln<ze;ln++)Me.push(ue[Ee+ln]);if(Lt>1)for(const ln of kt){const Kt=ln*ze;if(!(ue[Kt+2]<=U)){ue[Kt+2]=U;for(let oi=0;oi<ze;oi++)Me.push(ue[Kt+oi])}}}}return Me}_getOriginId(H){return H-this.points.length>>5}_getOriginZoom(H){return(H-this.points.length)%32}_map(H,U,X){if(H[U+pn]>1){const fe=this.clusterProps[H[U+ti]];return X?Object.assign({},fe):fe}const ie=this.points[H[U+vn]].properties,de=this.options.map(ie);return X&&de===ie?Object.assign({},de):de}}function Pn(se,H,U){return{type:"Feature",id:se[H+vn],properties:Rn(se,H,U),geometry:{type:"Point",coordinates:[(X=se[H],360*(X-.5)),De(se[H+1])]}};var X}function Rn(se,H,U){const X=se[H+pn],ie=X>=1e4?`${Math.round(X/1e3)}k`:X>=1e3?Math.round(X/100)/10+"k":X,de=se[H+ti],fe=de===-1?{}:Object.assign({},U[de]);return Object.assign(fe,{cluster:!0,cluster_id:se[H+vn],point_count:X,point_count_abbreviated:ie})}function Ce(se){return se/360+.5}function He(se){const H=Math.sin(se*Math.PI/180),U=.5-.25*Math.log((1+H)/(1-H))/Math.PI;return U<0?0:U>1?1:U}function De(se){const H=(180-360*se)*Math.PI/180;return 360*Math.atan(Math.exp(H))/Math.PI-90}function ct(se,H,U,X){let ie=X;const de=H+(U-H>>1);let fe,_e=U-H;const ue=se[H],Me=se[H+1],ze=se[U],Ee=se[U+1];for(let We=H+3;We<U;We+=3){const xt=Rt(se[We],se[We+1],ue,Me,ze,Ee);if(xt>ie)fe=We,ie=xt;else if(xt===ie){const kt=Math.abs(We-de);kt<_e&&(fe=We,_e=kt)}}ie>X&&(fe-H>3&&ct(se,H,fe,X),se[fe+2]=ie,U-fe>3&&ct(se,fe,U,X))}function Rt(se,H,U,X,ie,de){let fe=ie-U,_e=de-X;if(fe!==0||_e!==0){const ue=((se-U)*fe+(H-X)*_e)/(fe*fe+_e*_e);ue>1?(U=ie,X=de):ue>0&&(U+=fe*ue,X+=_e*ue)}return fe=se-U,_e=H-X,fe*fe+_e*_e}function Qt(se,H,U,X){const ie={id:se??null,type:H,geometry:U,tags:X,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if(H==="Point"||H==="MultiPoint"||H==="LineString")At(ie,U);else if(H==="Polygon")At(ie,U[0]);else if(H==="MultiLineString")for(const de of U)At(ie,de);else if(H==="MultiPolygon")for(const de of U)At(ie,de[0]);return ie}function At(se,H){for(let U=0;U<H.length;U+=3)se.minX=Math.min(se.minX,H[U]),se.minY=Math.min(se.minY,H[U+1]),se.maxX=Math.max(se.maxX,H[U]),se.maxY=Math.max(se.maxY,H[U+1])}function Mt(se,H,U,X){if(!H.geometry)return;const ie=H.geometry.coordinates;if(ie&&ie.length===0)return;const de=H.geometry.type,fe=Math.pow(U.tolerance/((1<<U.maxZoom)*U.extent),2);let _e=[],ue=H.id;if(U.promoteId?ue=H.properties[U.promoteId]:U.generateId&&(ue=X||0),de==="Point")rn(ie,_e);else if(de==="MultiPoint")for(const Me of ie)rn(Me,_e);else if(de==="LineString")we(ie,_e,fe,!1);else if(de==="MultiLineString"){if(U.lineMetrics){for(const Me of ie)_e=[],we(Me,_e,fe,!1),se.push(Qt(ue,"LineString",_e,H.properties));return}yn(ie,_e,fe,!1)}else if(de==="Polygon")yn(ie,_e,fe,!0);else{if(de!=="MultiPolygon"){if(de==="GeometryCollection"){for(const Me of H.geometry.geometries)Mt(se,{id:ue,geometry:Me,properties:H.properties},U,X);return}throw new Error("Input data is not a valid GeoJSON object.")}for(const Me of ie){const ze=[];yn(Me,ze,fe,!0),_e.push(ze)}}se.push(Qt(ue,de,_e,H.properties))}function rn(se,H){H.push(pr(se[0]),qt(se[1]),0)}function we(se,H,U,X){let ie,de,fe=0;for(let ue=0;ue<se.length;ue++){const Me=pr(se[ue][0]),ze=qt(se[ue][1]);H.push(Me,ze,0),ue>0&&(fe+=X?(ie*ze-Me*de)/2:Math.sqrt(Math.pow(Me-ie,2)+Math.pow(ze-de,2))),ie=Me,de=ze}const _e=H.length-3;H[2]=1,ct(H,0,_e,U),H[_e+2]=1,H.size=Math.abs(fe),H.start=0,H.end=H.size}function yn(se,H,U,X){for(let ie=0;ie<se.length;ie++){const de=[];we(se[ie],de,U,X),H.push(de)}}function pr(se){return se/360+.5}function qt(se){const H=Math.sin(se*Math.PI/180),U=.5-.25*Math.log((1+H)/(1-H))/Math.PI;return U<0?0:U>1?1:U}function sn(se,H,U,X,ie,de,fe,_e){if(X/=H,de>=(U/=H)&&fe<X)return se;if(fe<U||de>=X)return null;const ue=[];for(const Me of se){const ze=Me.geometry;let Ee=Me.type;const We=ie===0?Me.minX:Me.minY,xt=ie===0?Me.maxX:Me.maxY;if(We>=U&&xt<X){ue.push(Me);continue}if(xt<U||We>=X)continue;let kt=[];if(Ee==="Point"||Ee==="MultiPoint")ui(ze,kt,U,X,ie);else if(Ee==="LineString")Hi(ze,kt,U,X,ie,!1,_e.lineMetrics);else if(Ee==="MultiLineString")Or(ze,kt,U,X,ie,!1);else if(Ee==="Polygon")Or(ze,kt,U,X,ie,!0);else if(Ee==="MultiPolygon")for(const an of ze){const Lt=[];Or(an,Lt,U,X,ie,!0),Lt.length&&kt.push(Lt)}if(kt.length){if(_e.lineMetrics&&Ee==="LineString"){for(const an of kt)ue.push(Qt(Me.id,Ee,an,Me.tags));continue}Ee!=="LineString"&&Ee!=="MultiLineString"||(kt.length===1?(Ee="LineString",kt=kt[0]):Ee="MultiLineString"),Ee!=="Point"&&Ee!=="MultiPoint"||(Ee=kt.length===3?"Point":"MultiPoint"),ue.push(Qt(Me.id,Ee,kt,Me.tags))}}return ue.length?ue:null}function ui(se,H,U,X,ie){for(let de=0;de<se.length;de+=3){const fe=se[de+ie];fe>=U&&fe<=X&&vi(H,se[de],se[de+1],se[de+2])}}function Hi(se,H,U,X,ie,de,fe){let _e=xi(se);const ue=ie===0?Eo:Co;let Me,ze,Ee=se.start;for(let Lt=0;Lt<se.length-3;Lt+=3){const ln=se[Lt],Kt=se[Lt+1],oi=se[Lt+2],Zn=se[Lt+3],Ut=se[Lt+4],wn=ie===0?ln:Kt,qn=ie===0?Zn:Ut;let mi=!1;fe&&(Me=Math.sqrt(Math.pow(ln-Zn,2)+Math.pow(Kt-Ut,2))),wn<U?qn>U&&(ze=ue(_e,ln,Kt,Zn,Ut,U),fe&&(_e.start=Ee+Me*ze)):wn>X?qn<X&&(ze=ue(_e,ln,Kt,Zn,Ut,X),fe&&(_e.start=Ee+Me*ze)):vi(_e,ln,Kt,oi),qn<U&&wn>=U&&(ze=ue(_e,ln,Kt,Zn,Ut,U),mi=!0),qn>X&&wn<=X&&(ze=ue(_e,ln,Kt,Zn,Ut,X),mi=!0),!de&&mi&&(fe&&(_e.end=Ee+Me*ze),H.push(_e),_e=xi(se)),fe&&(Ee+=Me)}let We=se.length-3;const xt=se[We],kt=se[We+1],an=ie===0?xt:kt;an>=U&&an<=X&&vi(_e,xt,kt,se[We+2]),We=_e.length-3,de&&We>=3&&(_e[We]!==_e[0]||_e[We+1]!==_e[1])&&vi(_e,_e[0],_e[1],_e[2]),_e.length&&H.push(_e)}function xi(se){const H=[];return H.size=se.size,H.start=se.start,H.end=se.end,H}function Or(se,H,U,X,ie,de){for(const fe of se)Hi(fe,H,U,X,ie,de,!1)}function vi(se,H,U,X){se.push(H,U,X)}function Eo(se,H,U,X,ie,de){const fe=(de-H)/(X-H);return vi(se,de,U+(ie-U)*fe,1),fe}function Co(se,H,U,X,ie,de){const fe=(de-U)/(ie-U);return vi(se,H+(X-H)*fe,de,1),fe}function Ve(se,H){const U=[];for(let X=0;X<se.length;X++){const ie=se[X],de=ie.type;let fe;if(de==="Point"||de==="MultiPoint"||de==="LineString")fe=Br(ie.geometry,H);else if(de==="MultiLineString"||de==="Polygon"){fe=[];for(const _e of ie.geometry)fe.push(Br(_e,H))}else if(de==="MultiPolygon"){fe=[];for(const _e of ie.geometry){const ue=[];for(const Me of _e)ue.push(Br(Me,H));fe.push(ue)}}U.push(Qt(ie.id,de,fe,ie.tags))}return U}function Br(se,H){const U=[];U.size=se.size,se.start!==void 0&&(U.start=se.start,U.end=se.end);for(let X=0;X<se.length;X+=3)U.push(se[X]+H,se[X+1],se[X+2]);return U}function wi(se,H){if(se.transformed)return se;const U=1<<se.z,X=se.x,ie=se.y;for(const de of se.features){const fe=de.geometry,_e=de.type;if(de.geometry=[],_e===1)for(let ue=0;ue<fe.length;ue+=2)de.geometry.push(zr(fe[ue],fe[ue+1],H,U,X,ie));else for(let ue=0;ue<fe.length;ue++){const Me=[];for(let ze=0;ze<fe[ue].length;ze+=2)Me.push(zr(fe[ue][ze],fe[ue][ze+1],H,U,X,ie));de.geometry.push(Me)}}return se.transformed=!0,se}function zr(se,H,U,X,ie,de){return[Math.round(U*(se*X-ie)),Math.round(U*(H*X-de))]}function To(se,H,U,X,ie){const de=H===ie.maxZoom?0:ie.tolerance/((1<<H)*ie.extent),fe={features:[],numPoints:0,numSimplified:0,numFeatures:se.length,source:null,x:U,y:X,z:H,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0};for(const _e of se)Ze(fe,_e,de,ie);return fe}function Ze(se,H,U,X){const ie=H.geometry,de=H.type,fe=[];if(se.minX=Math.min(se.minX,H.minX),se.minY=Math.min(se.minY,H.minY),se.maxX=Math.max(se.maxX,H.maxX),se.maxY=Math.max(se.maxY,H.maxY),de==="Point"||de==="MultiPoint")for(let _e=0;_e<ie.length;_e+=3)fe.push(ie[_e],ie[_e+1]),se.numPoints++,se.numSimplified++;else if(de==="LineString")ke(fe,ie,se,U,!1,!1);else if(de==="MultiLineString"||de==="Polygon")for(let _e=0;_e<ie.length;_e++)ke(fe,ie[_e],se,U,de==="Polygon",_e===0);else if(de==="MultiPolygon")for(let _e=0;_e<ie.length;_e++){const ue=ie[_e];for(let Me=0;Me<ue.length;Me++)ke(fe,ue[Me],se,U,!0,Me===0)}if(fe.length){let _e=H.tags||null;if(de==="LineString"&&X.lineMetrics){_e={};for(const Me in H.tags)_e[Me]=H.tags[Me];_e.mapbox_clip_start=ie.start/ie.size,_e.mapbox_clip_end=ie.end/ie.size}const ue={geometry:fe,type:de==="Polygon"||de==="MultiPolygon"?3:de==="LineString"||de==="MultiLineString"?2:1,tags:_e};H.id!==null&&(ue.id=H.id),se.features.push(ue)}}function ke(se,H,U,X,ie,de){const fe=X*X;if(X>0&&H.size<(ie?fe:X))return void(U.numPoints+=H.length/3);const _e=[];for(let ue=0;ue<H.length;ue+=3)(X===0||H[ue+2]>fe)&&(U.numSimplified++,_e.push(H[ue],H[ue+1])),U.numPoints++;ie&&function(ue,Me){let ze=0;for(let Ee=0,We=ue.length,xt=We-2;Ee<We;xt=Ee,Ee+=2)ze+=(ue[Ee]-ue[xt])*(ue[Ee+1]+ue[xt+1]);if(ze>0===Me)for(let Ee=0,We=ue.length;Ee<We/2;Ee+=2){const xt=ue[Ee],kt=ue[Ee+1];ue[Ee]=ue[We-2-Ee],ue[Ee+1]=ue[We-1-Ee],ue[We-2-Ee]=xt,ue[We-1-Ee]=kt}}(_e,de),se.push(_e)}const Re={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0};class vt{constructor(H,U){const X=(U=this.options=function(de,fe){for(const _e in fe)de[_e]=fe[_e];return de}(Object.create(Re),U)).debug;if(X&&console.time("preprocess data"),U.maxZoom<0||U.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(U.promoteId&&U.generateId)throw new Error("promoteId and generateId cannot be used together.");let ie=function(de,fe){const _e=[];if(de.type==="FeatureCollection")for(let ue=0;ue<de.features.length;ue++)Mt(_e,de.features[ue],fe,ue);else Mt(_e,de.type==="Feature"?de:{geometry:de},fe);return _e}(H,U);this.tiles={},this.tileCoords=[],X&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",U.indexMaxZoom,U.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),ie=function(de,fe){const _e=fe.buffer/fe.extent;let ue=de;const Me=sn(de,1,-1-_e,_e,0,-1,2,fe),ze=sn(de,1,1-_e,2+_e,0,-1,2,fe);return(Me||ze)&&(ue=sn(de,1,-_e,1+_e,0,-1,2,fe)||[],Me&&(ue=Ve(Me,1).concat(ue)),ze&&(ue=ue.concat(Ve(ze,-1)))),ue}(ie,U),ie.length&&this.splitTile(ie,0,0,0),X&&(ie.length&&console.log("features: %d, points: %d",this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd("generate tiles"),console.log("tiles generated:",this.total,JSON.stringify(this.stats)))}splitTile(H,U,X,ie,de,fe,_e){const ue=[H,U,X,ie],Me=this.options,ze=Me.debug;for(;ue.length;){ie=ue.pop(),X=ue.pop(),U=ue.pop(),H=ue.pop();const Ee=1<<U,We=Wt(U,X,ie);let xt=this.tiles[We];if(!xt&&(ze>1&&console.time("creation"),xt=this.tiles[We]=To(H,U,X,ie,Me),this.tileCoords.push({z:U,x:X,y:ie}),ze)){ze>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",U,X,ie,xt.numFeatures,xt.numPoints,xt.numSimplified),console.timeEnd("creation"));const mi=`z${U}`;this.stats[mi]=(this.stats[mi]||0)+1,this.total++}if(xt.source=H,de==null){if(U===Me.indexMaxZoom||xt.numPoints<=Me.indexMaxPoints)continue}else{if(U===Me.maxZoom||U===de)continue;if(de!=null){const mi=de-U;if(X!==fe>>mi||ie!==_e>>mi)continue}}if(xt.source=null,H.length===0)continue;ze>1&&console.time("clipping");const kt=.5*Me.buffer/Me.extent,an=.5-kt,Lt=.5+kt,ln=1+kt;let Kt=null,oi=null,Zn=null,Ut=null,wn=sn(H,Ee,X-kt,X+Lt,0,xt.minX,xt.maxX,Me),qn=sn(H,Ee,X+an,X+ln,0,xt.minX,xt.maxX,Me);H=null,wn&&(Kt=sn(wn,Ee,ie-kt,ie+Lt,1,xt.minY,xt.maxY,Me),oi=sn(wn,Ee,ie+an,ie+ln,1,xt.minY,xt.maxY,Me),wn=null),qn&&(Zn=sn(qn,Ee,ie-kt,ie+Lt,1,xt.minY,xt.maxY,Me),Ut=sn(qn,Ee,ie+an,ie+ln,1,xt.minY,xt.maxY,Me),qn=null),ze>1&&console.timeEnd("clipping"),ue.push(Kt||[],U+1,2*X,2*ie),ue.push(oi||[],U+1,2*X,2*ie+1),ue.push(Zn||[],U+1,2*X+1,2*ie),ue.push(Ut||[],U+1,2*X+1,2*ie+1)}}getTile(H,U,X){H=+H,U=+U,X=+X;const ie=this.options,{extent:de,debug:fe}=ie;if(H<0||H>24)return null;const _e=1<<H,ue=Wt(H,U=U+_e&_e-1,X);if(this.tiles[ue])return wi(this.tiles[ue],de);fe>1&&console.log("drilling down to z%d-%d-%d",H,U,X);let Me,ze=H,Ee=U,We=X;for(;!Me&&ze>0;)ze--,Ee>>=1,We>>=1,Me=this.tiles[Wt(ze,Ee,We)];return Me&&Me.source?(fe>1&&(console.log("found parent tile z%d-%d-%d",ze,Ee,We),console.time("drilling down")),this.splitTile(Me.source,ze,Ee,We,H,U,X),fe>1&&console.timeEnd("drilling down"),this.tiles[ue]?wi(this.tiles[ue],de):null):null}}function Wt(se,H,U){return 32*((1<<se)*U+H)+se}function et(se,H){return H?se.properties[H]:se.id}function Ln(se,H){if(se==null)return!0;if(se.type==="Feature")return et(se,H)!=null;if(se.type==="FeatureCollection"){const U=new Set;for(const X of se.features){const ie=et(X,H);if(ie==null||U.has(ie))return!1;U.add(ie)}return!0}return!1}function Kn(se,H){const U=new Map;if(se!=null)if(se.type==="Feature")U.set(et(se,H),se);else for(const X of se.features)U.set(et(X,H),X);return U}class qi extends E{constructor(){super(...arguments),this._dataUpdateable=new Map}loadVectorTile(H,U){return u._(this,void 0,void 0,function*(){const X=H.tileID.canonical;if(!this._geoJSONIndex)throw new Error("Unable to parse the data into a cluster or geojson");const ie=this._geoJSONIndex.getTile(X.z,X.x,X.y);if(!ie)return null;const de=new class{constructor(_e){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=u.X,this.length=_e.length,this._features=_e}feature(_e){return new class{constructor(ue){this._feature=ue,this.extent=u.X,this.type=ue.type,this.properties=ue.tags,"id"in ue&&!isNaN(ue.id)&&(this.id=parseInt(ue.id,10))}loadGeometry(){if(this._feature.type===1){const ue=[];for(const Me of this._feature.geometry)ue.push([new u.P(Me[0],Me[1])]);return ue}{const ue=[];for(const Me of this._feature.geometry){const ze=[];for(const Ee of Me)ze.push(new u.P(Ee[0],Ee[1]));ue.push(ze)}return ue}}toGeoJSON(ue,Me,ze){return $.call(this,ue,Me,ze)}}(this._features[_e])}}(ie.features);let fe=Ft(de);return fe.byteOffset===0&&fe.byteLength===fe.buffer.byteLength||(fe=new Uint8Array(fe)),{vectorTile:de,rawData:fe.buffer}})}loadData(H){return u._(this,void 0,void 0,function*(){var U;(U=this._pendingRequest)===null||U===void 0||U.abort();const X=!!(H&&H.request&&H.request.collectResourceTiming)&&new u.bv(H.request);this._pendingRequest=new AbortController;try{this._pendingData=this.loadAndProcessGeoJSON(H,this._pendingRequest),this._geoJSONIndex=H.cluster?new Nn(function({superclusterOptions:fe,clusterProperties:_e}){if(!_e||!fe)return fe;const ue={},Me={},ze={accumulated:null,zoom:0},Ee={properties:null},We=Object.keys(_e);for(const xt of We){const[kt,an]=_e[xt],Lt=u.bC(an),ln=u.bC(typeof kt=="string"?[kt,["accumulated"],["get",xt]]:kt);ue[xt]=Lt.value,Me[xt]=ln.value}return fe.map=xt=>{Ee.properties=xt;const kt={};for(const an of We)kt[an]=ue[an].evaluate(ze,Ee);return kt},fe.reduce=(xt,kt)=>{Ee.properties=kt;for(const an of We)ze.accumulated=xt[an],xt[an]=Me[an].evaluate(ze,Ee)},fe}(H)).load((yield this._pendingData).features):(ie=yield this._pendingData,new vt(ie,H.geojsonVtOptions)),this.loaded={};const de={};if(X){const fe=X.finish();fe&&(de.resourceTiming={},de.resourceTiming[H.source]=JSON.parse(JSON.stringify(fe)))}return de}catch(de){if(delete this._pendingRequest,u.bB(de))return{abandoned:!0};throw de}var ie})}getData(){return u._(this,void 0,void 0,function*(){return this._pendingData})}reloadTile(H){const U=this.loaded;return U&&U[H.uid]?super.reloadTile(H):this.loadTile(H)}loadAndProcessGeoJSON(H,U){return u._(this,void 0,void 0,function*(){let X=yield this.loadGeoJSON(H,U);if(delete this._pendingRequest,typeof X!="object")throw new Error(`Input data given to '${H.source}' is not a valid GeoJSON object.`);if(R(X,!0),H.filter){const ie=u.bC(H.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(ie.result==="error")throw new Error(ie.value.map(fe=>`${fe.key}: ${fe.message}`).join(", "));X={type:"FeatureCollection",features:X.features.filter(fe=>ie.value.evaluate({zoom:0},fe))}}return X})}loadGeoJSON(H,U){return u._(this,void 0,void 0,function*(){const{promoteId:X}=H;if(H.request){const ie=yield u.h(H.request,U);return this._dataUpdateable=Ln(ie.data,X)?Kn(ie.data,X):void 0,ie.data}if(typeof H.data=="string")try{const ie=JSON.parse(H.data);return this._dataUpdateable=Ln(ie,X)?Kn(ie,X):void 0,ie}catch{throw new Error(`Input data given to '${H.source}' is not a valid GeoJSON object.`)}if(!H.dataDiff)throw new Error(`Input data given to '${H.source}' is not a valid GeoJSON object.`);if(!this._dataUpdateable)throw new Error(`Cannot update existing geojson data in ${H.source}`);return function(ie,de,fe){var _e,ue,Me,ze;if(de.removeAll&&ie.clear(),de.remove)for(const Ee of de.remove)ie.delete(Ee);if(de.add)for(const Ee of de.add){const We=et(Ee,fe);We!=null&&ie.set(We,Ee)}if(de.update)for(const Ee of de.update){let We=ie.get(Ee.id);if(We==null)continue;const xt=!Ee.removeAllProperties&&(((_e=Ee.removeProperties)===null||_e===void 0?void 0:_e.length)>0||((ue=Ee.addOrUpdateProperties)===null||ue===void 0?void 0:ue.length)>0);if((Ee.newGeometry||Ee.removeAllProperties||xt)&&(We=Object.assign({},We),ie.set(Ee.id,We),xt&&(We.properties=Object.assign({},We.properties))),Ee.newGeometry&&(We.geometry=Ee.newGeometry),Ee.removeAllProperties)We.properties={};else if(((Me=Ee.removeProperties)===null||Me===void 0?void 0:Me.length)>0)for(const kt of Ee.removeProperties)Object.prototype.hasOwnProperty.call(We.properties,kt)&&delete We.properties[kt];if(((ze=Ee.addOrUpdateProperties)===null||ze===void 0?void 0:ze.length)>0)for(const{key:kt,value:an}of Ee.addOrUpdateProperties)We.properties[kt]=an}}(this._dataUpdateable,H.dataDiff,X),{type:"FeatureCollection",features:Array.from(this._dataUpdateable.values())}})}removeSource(H){return u._(this,void 0,void 0,function*(){this._pendingRequest&&this._pendingRequest.abort()})}getClusterExpansionZoom(H){return this._geoJSONIndex.getClusterExpansionZoom(H.clusterId)}getClusterChildren(H){return this._geoJSONIndex.getChildren(H.clusterId)}getClusterLeaves(H){return this._geoJSONIndex.getLeaves(H.clusterId,H.limit,H.offset)}}class fr{constructor(H){this.self=H,this.actor=new u.F(H),this.layerIndexes={},this.availableImages={},this.workerSources={},this.demWorkerSources={},this.externalWorkerSourceTypes={},this.self.registerWorkerSource=(U,X)=>{if(this.externalWorkerSourceTypes[U])throw new Error(`Worker source with name "${U}" already registered.`);this.externalWorkerSourceTypes[U]=X},this.self.addProtocol=u.bi,this.self.removeProtocol=u.bj,this.self.registerRTLTextPlugin=U=>{if(u.bD.isParsed())throw new Error("RTL text plugin already registered.");u.bD.setMethods(U)},this.actor.registerMessageHandler("LDT",(U,X)=>this._getDEMWorkerSource(U,X.source).loadTile(X)),this.actor.registerMessageHandler("RDT",(U,X)=>u._(this,void 0,void 0,function*(){this._getDEMWorkerSource(U,X.source).removeTile(X)})),this.actor.registerMessageHandler("GCEZ",(U,X)=>u._(this,void 0,void 0,function*(){return this._getWorkerSource(U,X.type,X.source).getClusterExpansionZoom(X)})),this.actor.registerMessageHandler("GCC",(U,X)=>u._(this,void 0,void 0,function*(){return this._getWorkerSource(U,X.type,X.source).getClusterChildren(X)})),this.actor.registerMessageHandler("GCL",(U,X)=>u._(this,void 0,void 0,function*(){return this._getWorkerSource(U,X.type,X.source).getClusterLeaves(X)})),this.actor.registerMessageHandler("LD",(U,X)=>this._getWorkerSource(U,X.type,X.source).loadData(X)),this.actor.registerMessageHandler("GD",(U,X)=>this._getWorkerSource(U,X.type,X.source).getData()),this.actor.registerMessageHandler("LT",(U,X)=>this._getWorkerSource(U,X.type,X.source).loadTile(X)),this.actor.registerMessageHandler("RT",(U,X)=>this._getWorkerSource(U,X.type,X.source).reloadTile(X)),this.actor.registerMessageHandler("AT",(U,X)=>this._getWorkerSource(U,X.type,X.source).abortTile(X)),this.actor.registerMessageHandler("RMT",(U,X)=>this._getWorkerSource(U,X.type,X.source).removeTile(X)),this.actor.registerMessageHandler("RS",(U,X)=>u._(this,void 0,void 0,function*(){if(!this.workerSources[U]||!this.workerSources[U][X.type]||!this.workerSources[U][X.type][X.source])return;const ie=this.workerSources[U][X.type][X.source];delete this.workerSources[U][X.type][X.source],ie.removeSource!==void 0&&ie.removeSource(X)})),this.actor.registerMessageHandler("RM",U=>u._(this,void 0,void 0,function*(){delete this.layerIndexes[U],delete this.availableImages[U],delete this.workerSources[U],delete this.demWorkerSources[U]})),this.actor.registerMessageHandler("SR",(U,X)=>u._(this,void 0,void 0,function*(){this.referrer=X})),this.actor.registerMessageHandler("SRPS",(U,X)=>this._syncRTLPluginState(U,X)),this.actor.registerMessageHandler("IS",(U,X)=>u._(this,void 0,void 0,function*(){this.self.importScripts(X)})),this.actor.registerMessageHandler("SI",(U,X)=>this._setImages(U,X)),this.actor.registerMessageHandler("UL",(U,X)=>u._(this,void 0,void 0,function*(){this._getLayerIndex(U).update(X.layers,X.removedIds)})),this.actor.registerMessageHandler("SL",(U,X)=>u._(this,void 0,void 0,function*(){this._getLayerIndex(U).replace(X)}))}_setImages(H,U){return u._(this,void 0,void 0,function*(){this.availableImages[H]=U;for(const X in this.workerSources[H]){const ie=this.workerSources[H][X];for(const de in ie)ie[de].availableImages=U}})}_syncRTLPluginState(H,U){return u._(this,void 0,void 0,function*(){if(u.bD.isParsed())return u.bD.getState();if(U.pluginStatus!=="loading")return u.bD.setState(U),U;const X=U.pluginURL;if(this.self.importScripts(X),u.bD.isParsed()){const ie={pluginStatus:"loaded",pluginURL:X};return u.bD.setState(ie),ie}throw u.bD.setState({pluginStatus:"error",pluginURL:""}),new Error(`RTL Text Plugin failed to import scripts from ${X}`)})}_getAvailableImages(H){let U=this.availableImages[H];return U||(U=[]),U}_getLayerIndex(H){let U=this.layerIndexes[H];return U||(U=this.layerIndexes[H]=new l),U}_getWorkerSource(H,U,X){if(this.workerSources[H]||(this.workerSources[H]={}),this.workerSources[H][U]||(this.workerSources[H][U]={}),!this.workerSources[H][U][X]){const ie={sendAsync:(de,fe)=>(de.targetMapId=H,this.actor.sendAsync(de,fe))};switch(U){case"vector":this.workerSources[H][U][X]=new E(ie,this._getLayerIndex(H),this._getAvailableImages(H));break;case"geojson":this.workerSources[H][U][X]=new qi(ie,this._getLayerIndex(H),this._getAvailableImages(H));break;default:this.workerSources[H][U][X]=new this.externalWorkerSourceTypes[U](ie,this._getLayerIndex(H),this._getAvailableImages(H))}}return this.workerSources[H][U][X]}_getDEMWorkerSource(H,U){return this.demWorkerSources[H]||(this.demWorkerSources[H]={}),this.demWorkerSources[H][U]||(this.demWorkerSources[H][U]=new C),this.demWorkerSources[H][U]}}return u.i(self)&&(self.worker=new fr(self)),fr}),r("index",["exports","./shared"],function(u,l){var g="4.7.0";let b,w;const E={now:typeof performance<"u"&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),frameAsync:v=>new Promise((o,d)=>{const m=requestAnimationFrame(o);v.signal.addEventListener("abort",()=>{cancelAnimationFrame(m),d(l.c())})}),getImageData(v,o=0){return this.getImageCanvasContext(v).getImageData(-o,-o,v.width+2*o,v.height+2*o)},getImageCanvasContext(v){const o=window.document.createElement("canvas"),d=o.getContext("2d",{willReadFrequently:!0});if(!d)throw new Error("failed to create canvas 2d context");return o.width=v.width,o.height=v.height,d.drawImage(v,0,0,v.width,v.height),d},resolveURL:v=>(b||(b=document.createElement("a")),b.href=v,b.href),hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(w==null&&(w=matchMedia("(prefers-reduced-motion: reduce)")),w.matches)}};class C{static testProp(o){if(!C.docStyle)return o[0];for(let d=0;d<o.length;d++)if(o[d]in C.docStyle)return o[d];return o[0]}static create(o,d,m){const y=window.document.createElement(o);return d!==void 0&&(y.className=d),m&&m.appendChild(y),y}static createNS(o,d){return window.document.createElementNS(o,d)}static disableDrag(){C.docStyle&&C.selectProp&&(C.userSelect=C.docStyle[C.selectProp],C.docStyle[C.selectProp]="none")}static enableDrag(){C.docStyle&&C.selectProp&&(C.docStyle[C.selectProp]=C.userSelect)}static setTransform(o,d){o.style[C.transformProp]=d}static addEventListener(o,d,m,y={}){o.addEventListener(d,m,"passive"in y?y:y.capture)}static removeEventListener(o,d,m,y={}){o.removeEventListener(d,m,"passive"in y?y:y.capture)}static suppressClickInternal(o){o.preventDefault(),o.stopPropagation(),window.removeEventListener("click",C.suppressClickInternal,!0)}static suppressClick(){window.addEventListener("click",C.suppressClickInternal,!0),window.setTimeout(()=>{window.removeEventListener("click",C.suppressClickInternal,!0)},0)}static getScale(o){const d=o.getBoundingClientRect();return{x:d.width/o.offsetWidth||1,y:d.height/o.offsetHeight||1,boundingClientRect:d}}static getPoint(o,d,m){const y=d.boundingClientRect;return new l.P((m.clientX-y.left)/d.x-o.clientLeft,(m.clientY-y.top)/d.y-o.clientTop)}static mousePos(o,d){const m=C.getScale(o);return C.getPoint(o,m,d)}static touchPos(o,d){const m=[],y=C.getScale(o);for(let x=0;x<d.length;x++)m.push(C.getPoint(o,y,d[x]));return m}static mouseButton(o){return o.button}static remove(o){o.parentNode&&o.parentNode.removeChild(o)}}C.docStyle=typeof window<"u"&&window.document&&window.document.documentElement.style,C.selectProp=C.testProp(["userSelect","MozUserSelect","WebkitUserSelect","msUserSelect"]),C.transformProp=C.testProp(["transform","WebkitTransform"]);const P={supported:!1,testSupport:function(v){!$&&R&&(W?te(v):D=v)}};let D,R,$=!1,W=!1;function te(v){const o=v.createTexture();v.bindTexture(v.TEXTURE_2D,o);try{if(v.texImage2D(v.TEXTURE_2D,0,v.RGBA,v.RGBA,v.UNSIGNED_BYTE,R),v.isContextLost())return;P.supported=!0}catch{}v.deleteTexture(o),$=!0}var G;typeof document<"u"&&(R=document.createElement("img"),R.onload=()=>{D&&te(D),D=null,W=!0},R.onerror=()=>{$=!0,D=null},R.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA="),function(v){let o,d,m,y;v.resetRequestQueue=()=>{o=[],d=0,m=0,y={}},v.addThrottleControl=O=>{const N=m++;return y[N]=O,N},v.removeThrottleControl=O=>{delete y[O],M()},v.getImage=(O,N,V=!0)=>new Promise((F,Z)=>{P.supported&&(O.headers||(O.headers={}),O.headers.accept="image/webp,*/*"),l.e(O,{type:"image"}),o.push({abortController:N,requestParameters:O,supportImageRefresh:V,state:"queued",onError:J=>{Z(J)},onSuccess:J=>{F(J)}}),M()});const x=O=>l._(this,void 0,void 0,function*(){O.state="running";const{requestParameters:N,supportImageRefresh:V,onError:F,onSuccess:Z,abortController:J}=O,ee=V===!1&&!l.i(self)&&!l.g(N.url)&&(!N.headers||Object.keys(N.headers).reduce((ce,he)=>ce&&he==="accept",!0));d++;const oe=ee?I(N,J):l.m(N,J);try{const ce=yield oe;delete O.abortController,O.state="completed",ce.data instanceof HTMLImageElement||l.b(ce.data)?Z(ce):ce.data&&Z({data:yield(le=ce.data,typeof createImageBitmap=="function"?l.d(le):l.f(le)),cacheControl:ce.cacheControl,expires:ce.expires})}catch(ce){delete O.abortController,F(ce)}finally{d--,M()}var le}),M=()=>{const O=(()=>{for(const N of Object.keys(y))if(y[N]())return!0;return!1})()?l.a.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:l.a.MAX_PARALLEL_IMAGE_REQUESTS;for(let N=d;N<O&&o.length>0;N++){const V=o.shift();V.abortController.signal.aborted?N--:x(V)}},I=(O,N)=>new Promise((V,F)=>{const Z=new Image,J=O.url,ee=O.credentials;ee&&ee==="include"?Z.crossOrigin="use-credentials":(ee&&ee==="same-origin"||!l.s(J))&&(Z.crossOrigin="anonymous"),N.signal.addEventListener("abort",()=>{Z.src="",F(l.c())}),Z.fetchPriority="high",Z.onload=()=>{Z.onerror=Z.onload=null,V({data:Z})},Z.onerror=()=>{Z.onerror=Z.onload=null,N.signal.aborted||F(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."))},Z.src=J})}(G||(G={})),G.resetRequestQueue();class Q{constructor(o){this._transformRequestFn=o}transformRequest(o,d){return this._transformRequestFn&&this._transformRequestFn(o,d)||{url:o}}setTransformRequest(o){this._transformRequestFn=o}}function Ie(v){var o=new l.A(3);return o[0]=v[0],o[1]=v[1],o[2]=v[2],o}var ve,Se=function(v,o,d){return v[0]=o[0]-d[0],v[1]=o[1]-d[1],v[2]=o[2]-d[2],v};ve=new l.A(3),l.A!=Float32Array&&(ve[0]=0,ve[1]=0,ve[2]=0);var Ne=function(v){var o=v[0],d=v[1];return o*o+d*d};function Ae(v){const o=[];if(typeof v=="string")o.push({id:"default",url:v});else if(v&&v.length>0){const d=[];for(const{id:m,url:y}of v){const x=`${m}${y}`;d.indexOf(x)===-1&&(d.push(x),o.push({id:m,url:y}))}}return o}function $e(v,o,d){const m=v.split("?");return m[0]+=`${o}${d}`,m.join("?")}(function(){var v=new l.A(2);l.A!=Float32Array&&(v[0]=0,v[1]=0)})();class Xe{constructor(o,d,m,y){this.context=o,this.format=m,this.texture=o.gl.createTexture(),this.update(d,y)}update(o,d,m){const{width:y,height:x}=o,M=!(this.size&&this.size[0]===y&&this.size[1]===x||m),{context:I}=this,{gl:O}=I;if(this.useMipmap=!!(d&&d.useMipmap),O.bindTexture(O.TEXTURE_2D,this.texture),I.pixelStoreUnpackFlipY.set(!1),I.pixelStoreUnpack.set(1),I.pixelStoreUnpackPremultiplyAlpha.set(this.format===O.RGBA&&(!d||d.premultiply!==!1)),M)this.size=[y,x],o instanceof HTMLImageElement||o instanceof HTMLCanvasElement||o instanceof HTMLVideoElement||o instanceof ImageData||l.b(o)?O.texImage2D(O.TEXTURE_2D,0,this.format,this.format,O.UNSIGNED_BYTE,o):O.texImage2D(O.TEXTURE_2D,0,this.format,y,x,0,this.format,O.UNSIGNED_BYTE,o.data);else{const{x:N,y:V}=m||{x:0,y:0};o instanceof HTMLImageElement||o instanceof HTMLCanvasElement||o instanceof HTMLVideoElement||o instanceof ImageData||l.b(o)?O.texSubImage2D(O.TEXTURE_2D,0,N,V,O.RGBA,O.UNSIGNED_BYTE,o):O.texSubImage2D(O.TEXTURE_2D,0,N,V,y,x,O.RGBA,O.UNSIGNED_BYTE,o.data)}this.useMipmap&&this.isSizePowerOfTwo()&&O.generateMipmap(O.TEXTURE_2D)}bind(o,d,m){const{context:y}=this,{gl:x}=y;x.bindTexture(x.TEXTURE_2D,this.texture),m!==x.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(m=x.LINEAR),o!==this.filter&&(x.texParameteri(x.TEXTURE_2D,x.TEXTURE_MAG_FILTER,o),x.texParameteri(x.TEXTURE_2D,x.TEXTURE_MIN_FILTER,m||o),this.filter=o),d!==this.wrap&&(x.texParameteri(x.TEXTURE_2D,x.TEXTURE_WRAP_S,d),x.texParameteri(x.TEXTURE_2D,x.TEXTURE_WRAP_T,d),this.wrap=d)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){const{gl:o}=this.context;o.deleteTexture(this.texture),this.texture=null}}function Pt(v){const{userImage:o}=v;return!!(o&&o.render&&o.render())&&(v.data.replace(new Uint8Array(o.data.buffer)),!0)}class ot extends l.E{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new l.R({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(o){if(this.loaded!==o&&(this.loaded=o,o)){for(const{ids:d,promiseResolve:m}of this.requestors)m(this._getImagesForIds(d));this.requestors=[]}}getImage(o){const d=this.images[o];if(d&&!d.data&&d.spriteData){const m=d.spriteData;d.data=new l.R({width:m.width,height:m.height},m.context.getImageData(m.x,m.y,m.width,m.height).data),d.spriteData=null}return d}addImage(o,d){if(this.images[o])throw new Error(`Image id ${o} already exist, use updateImage instead`);this._validate(o,d)&&(this.images[o]=d)}_validate(o,d){let m=!0;const y=d.data||d.spriteData;return this._validateStretch(d.stretchX,y&&y.width)||(this.fire(new l.j(new Error(`Image "${o}" has invalid "stretchX" value`))),m=!1),this._validateStretch(d.stretchY,y&&y.height)||(this.fire(new l.j(new Error(`Image "${o}" has invalid "stretchY" value`))),m=!1),this._validateContent(d.content,d)||(this.fire(new l.j(new Error(`Image "${o}" has invalid "content" value`))),m=!1),m}_validateStretch(o,d){if(!o)return!0;let m=0;for(const y of o){if(y[0]<m||y[1]<y[0]||d<y[1])return!1;m=y[1]}return!0}_validateContent(o,d){if(!o)return!0;if(o.length!==4)return!1;const m=d.spriteData,y=m&&m.width||d.data.width,x=m&&m.height||d.data.height;return!(o[0]<0||y<o[0]||o[1]<0||x<o[1]||o[2]<0||y<o[2]||o[3]<0||x<o[3]||o[2]<o[0]||o[3]<o[1])}updateImage(o,d,m=!0){const y=this.getImage(o);if(m&&(y.data.width!==d.data.width||y.data.height!==d.data.height))throw new Error(`size mismatch between old image (${y.data.width}x${y.data.height}) and new image (${d.data.width}x${d.data.height}).`);d.version=y.version+1,this.images[o]=d,this.updatedImages[o]=!0}removeImage(o){const d=this.images[o];delete this.images[o],delete this.patterns[o],d.userImage&&d.userImage.onRemove&&d.userImage.onRemove()}listImages(){return Object.keys(this.images)}getImages(o){return new Promise((d,m)=>{let y=!0;if(!this.isLoaded())for(const x of o)this.images[x]||(y=!1);this.isLoaded()||y?d(this._getImagesForIds(o)):this.requestors.push({ids:o,promiseResolve:d})})}_getImagesForIds(o){const d={};for(const m of o){let y=this.getImage(m);y||(this.fire(new l.k("styleimagemissing",{id:m})),y=this.getImage(m)),y?d[m]={data:y.data.clone(),pixelRatio:y.pixelRatio,sdf:y.sdf,version:y.version,stretchX:y.stretchX,stretchY:y.stretchY,content:y.content,textFitWidth:y.textFitWidth,textFitHeight:y.textFitHeight,hasRenderCallback:!!(y.userImage&&y.userImage.render)}:l.w(`Image "${m}" 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.`)}return d}getPixelSize(){const{width:o,height:d}=this.atlasImage;return{width:o,height:d}}getPattern(o){const d=this.patterns[o],m=this.getImage(o);if(!m)return null;if(d&&d.position.version===m.version)return d.position;if(d)d.position.version=m.version;else{const y={w:m.data.width+2,h:m.data.height+2,x:0,y:0},x=new l.I(y,m);this.patterns[o]={bin:y,position:x}}return this._updatePatternAtlas(),this.patterns[o].position}bind(o){const d=o.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new Xe(o,this.atlasImage,d.RGBA),this.atlasTexture.bind(d.LINEAR,d.CLAMP_TO_EDGE)}_updatePatternAtlas(){const o=[];for(const x in this.patterns)o.push(this.patterns[x].bin);const{w:d,h:m}=l.p(o),y=this.atlasImage;y.resize({width:d||1,height:m||1});for(const x in this.patterns){const{bin:M}=this.patterns[x],I=M.x+1,O=M.y+1,N=this.getImage(x).data,V=N.width,F=N.height;l.R.copy(N,y,{x:0,y:0},{x:I,y:O},{width:V,height:F}),l.R.copy(N,y,{x:0,y:F-1},{x:I,y:O-1},{width:V,height:1}),l.R.copy(N,y,{x:0,y:0},{x:I,y:O+F},{width:V,height:1}),l.R.copy(N,y,{x:V-1,y:0},{x:I-1,y:O},{width:1,height:F}),l.R.copy(N,y,{x:0,y:0},{x:I+V,y:O},{width:1,height:F})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(o){for(const d of o){if(this.callbackDispatchedThisFrame[d])continue;this.callbackDispatchedThisFrame[d]=!0;const m=this.getImage(d);m||l.w(`Image with ID: "${d}" was not found`),Pt(m)&&this.updateImage(d,m)}}}const Tt=1e20;function Nt(v,o,d,m,y,x,M,I,O){for(let N=o;N<o+m;N++)Vt(v,d*x+N,x,y,M,I,O);for(let N=d;N<d+y;N++)Vt(v,N*x+o,1,m,M,I,O)}function Vt(v,o,d,m,y,x,M){x[0]=0,M[0]=-Tt,M[1]=Tt,y[0]=v[o];for(let I=1,O=0,N=0;I<m;I++){y[I]=v[o+I*d];const V=I*I;do{const F=x[O];N=(y[I]-y[F]+V-F*F)/(I-F)/2}while(N<=M[O]&&--O>-1);O++,x[O]=I,M[O]=N,M[O+1]=Tt}for(let I=0,O=0;I<m;I++){for(;M[O+1]<I;)O++;const N=x[O],V=I-N;v[o+I*d]=y[N]+V*V}}class Ft{constructor(o,d){this.requestManager=o,this.localIdeographFontFamily=d,this.entries={}}setURL(o){this.url=o}getGlyphs(o){return l._(this,void 0,void 0,function*(){const d=[];for(const x in o)for(const M of o[x])d.push(this._getAndCacheGlyphsPromise(x,M));const m=yield Promise.all(d),y={};for(const{stack:x,id:M,glyph:I}of m)y[x]||(y[x]={}),y[x][M]=I&&{id:I.id,bitmap:I.bitmap.clone(),metrics:I.metrics};return y})}_getAndCacheGlyphsPromise(o,d){return l._(this,void 0,void 0,function*(){let m=this.entries[o];m||(m=this.entries[o]={glyphs:{},requests:{},ranges:{}});let y=m.glyphs[d];if(y!==void 0)return{stack:o,id:d,glyph:y};if(y=this._tinySDF(m,o,d),y)return m.glyphs[d]=y,{stack:o,id:d,glyph:y};const x=Math.floor(d/256);if(256*x>65535)throw new Error("glyphs > 65535 not supported");if(m.ranges[x])return{stack:o,id:d,glyph:y};if(!this.url)throw new Error("glyphsUrl is not set");if(!m.requests[x]){const I=Ft.loadGlyphRange(o,x,this.url,this.requestManager);m.requests[x]=I}const M=yield m.requests[x];for(const I in M)this._doesCharSupportLocalGlyph(+I)||(m.glyphs[+I]=M[+I]);return m.ranges[x]=!0,{stack:o,id:d,glyph:M[d]||null}})}_doesCharSupportLocalGlyph(o){return!!this.localIdeographFontFamily&&new RegExp("\\p{Ideo}|\\p{sc=Hang}|\\p{sc=Hira}|\\p{sc=Kana}","u").test(String.fromCodePoint(o))}_tinySDF(o,d,m){const y=this.localIdeographFontFamily;if(!y||!this._doesCharSupportLocalGlyph(m))return;let x=o.tinySDF;if(!x){let I="400";/bold/i.test(d)?I="900":/medium/i.test(d)?I="500":/light/i.test(d)&&(I="200"),x=o.tinySDF=new Ft.TinySDF({fontSize:48,buffer:6,radius:16,cutoff:.25,fontFamily:y,fontWeight:I})}const M=x.draw(String.fromCharCode(m));return{id:m,bitmap:new l.o({width:M.width||60,height:M.height||60},M.data),metrics:{width:M.glyphWidth/2||24,height:M.glyphHeight/2||24,left:M.glyphLeft/2+.5||0,top:M.glyphTop/2-27.5||-8,advance:M.glyphAdvance/2||24,isDoubleResolution:!0}}}}Ft.loadGlyphRange=function(v,o,d,m){return l._(this,void 0,void 0,function*(){const y=256*o,x=y+255,M=m.transformRequest(d.replace("{fontstack}",v).replace("{range}",`${y}-${x}`),"Glyphs"),I=yield l.l(M,new AbortController);if(!I||!I.data)throw new Error(`Could not load glyph range. range: ${o}, ${y}-${x}`);const O={};for(const N of l.n(I.data))O[N.id]=N;return O})},Ft.TinySDF=class{constructor({fontSize:v=24,buffer:o=3,radius:d=8,cutoff:m=.25,fontFamily:y="sans-serif",fontWeight:x="normal",fontStyle:M="normal"}={}){this.buffer=o,this.cutoff=m,this.radius=d;const I=this.size=v+4*o,O=this._createCanvas(I),N=this.ctx=O.getContext("2d",{willReadFrequently:!0});N.font=`${M} ${x} ${v}px ${y}`,N.textBaseline="alphabetic",N.textAlign="left",N.fillStyle="black",this.gridOuter=new Float64Array(I*I),this.gridInner=new Float64Array(I*I),this.f=new Float64Array(I),this.z=new Float64Array(I+1),this.v=new Uint16Array(I)}_createCanvas(v){const o=document.createElement("canvas");return o.width=o.height=v,o}draw(v){const{width:o,actualBoundingBoxAscent:d,actualBoundingBoxDescent:m,actualBoundingBoxLeft:y,actualBoundingBoxRight:x}=this.ctx.measureText(v),M=Math.ceil(d),I=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(x-y))),O=Math.min(this.size-this.buffer,M+Math.ceil(m)),N=I+2*this.buffer,V=O+2*this.buffer,F=Math.max(N*V,0),Z=new Uint8ClampedArray(F),J={data:Z,width:N,height:V,glyphWidth:I,glyphHeight:O,glyphTop:M,glyphLeft:0,glyphAdvance:o};if(I===0||O===0)return J;const{ctx:ee,buffer:oe,gridInner:le,gridOuter:ce}=this;ee.clearRect(oe,oe,I,O),ee.fillText(v,oe,oe+M);const he=ee.getImageData(oe,oe,I,O);ce.fill(Tt,0,F),le.fill(0,0,F);for(let ne=0;ne<O;ne++)for(let me=0;me<I;me++){const ge=he.data[4*(ne*I+me)+3]/255;if(ge===0)continue;const xe=(ne+oe)*N+me+oe;if(ge===1)ce[xe]=0,le[xe]=Tt;else{const Be=.5-ge;ce[xe]=Be>0?Be*Be:0,le[xe]=Be<0?Be*Be:0}}Nt(ce,0,0,N,V,N,this.f,this.v,this.z),Nt(le,oe,oe,I,O,N,this.f,this.v,this.z);for(let ne=0;ne<F;ne++){const me=Math.sqrt(ce[ne])-Math.sqrt(le[ne]);Z[ne]=Math.round(255-255*(me/this.radius+this.cutoff))}return J}};class Ht{constructor(){this.specification=l.v.light.position}possiblyEvaluate(o,d){return l.x(o.expression.evaluate(d))}interpolate(o,d,m){return{x:l.y.number(o.x,d.x,m),y:l.y.number(o.y,d.y,m),z:l.y.number(o.z,d.z,m)}}}let Cn;class dn extends l.E{constructor(o){super(),Cn=Cn||new l.q({anchor:new l.D(l.v.light.anchor),position:new Ht,color:new l.D(l.v.light.color),intensity:new l.D(l.v.light.intensity)}),this._transitionable=new l.T(Cn),this.setLight(o),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(o,d={}){if(!this._validate(l.r,o,d))for(const m in o){const y=o[m];m.endsWith("-transition")?this._transitionable.setTransition(m.slice(0,-11),y):this._transitionable.setValue(m,y)}}updateTransitions(o){this._transitioning=this._transitionable.transitioned(o,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(o){this.properties=this._transitioning.possiblyEvaluate(o)}_validate(o,d,m){return(!m||m.validate!==!1)&&l.t(this,o.call(l.u,{value:d,style:{glyphs:!0,sprite:!0},styleSpec:l.v}))}}const vn=new l.q({"sky-color":new l.D(l.v.sky["sky-color"]),"horizon-color":new l.D(l.v.sky["horizon-color"]),"fog-color":new l.D(l.v.sky["fog-color"]),"fog-ground-blend":new l.D(l.v.sky["fog-ground-blend"]),"horizon-fog-blend":new l.D(l.v.sky["horizon-fog-blend"]),"sky-horizon-blend":new l.D(l.v.sky["sky-horizon-blend"]),"atmosphere-blend":new l.D(l.v.sky["atmosphere-blend"])});class pn extends l.E{constructor(o){super(),this._transitionable=new l.T(vn),this.setSky(o),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new l.z(0))}setSky(o,d={}){if(!this._validate(l.B,o,d)){o||(o={"sky-color":"transparent","horizon-color":"transparent","fog-color":"transparent","fog-ground-blend":1,"atmosphere-blend":0});for(const m in o){const y=o[m];m.endsWith("-transition")?this._transitionable.setTransition(m.slice(0,-11),y):this._transitionable.setValue(m,y)}}}getSky(){return this._transitionable.serialize()}updateTransitions(o){this._transitioning=this._transitionable.transitioned(o,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(o){this.properties=this._transitioning.possiblyEvaluate(o)}_validate(o,d,m={}){return(m==null?void 0:m.validate)!==!1&&l.t(this,o.call(l.u,l.e({value:d,style:{glyphs:!0,sprite:!0},styleSpec:l.v})))}calculateFogBlendOpacity(o){return o<60?0:o<70?(o-60)/10:1}}class ti{constructor(o,d){this.width=o,this.height=d,this.nextRow=0,this.data=new Uint8Array(this.width*this.height),this.dashEntry={}}getDash(o,d){const m=o.join(",")+String(d);return this.dashEntry[m]||(this.dashEntry[m]=this.addDash(o,d)),this.dashEntry[m]}getDashRanges(o,d,m){const y=[];let x=o.length%2==1?-o[o.length-1]*m:0,M=o[0]*m,I=!0;y.push({left:x,right:M,isDash:I,zeroLength:o[0]===0});let O=o[0];for(let N=1;N<o.length;N++){I=!I;const V=o[N];x=O*m,O+=V,M=O*m,y.push({left:x,right:M,isDash:I,zeroLength:V===0})}return y}addRoundDash(o,d,m){const y=d/2;for(let x=-m;x<=m;x++){const M=this.width*(this.nextRow+m+x);let I=0,O=o[I];for(let N=0;N<this.width;N++){N/O.right>1&&(O=o[++I]);const V=Math.abs(N-O.left),F=Math.abs(N-O.right),Z=Math.min(V,F);let J;const ee=x/m*(y+1);if(O.isDash){const oe=y-Math.abs(ee);J=Math.sqrt(Z*Z+oe*oe)}else J=y-Math.sqrt(Z*Z+ee*ee);this.data[M+N]=Math.max(0,Math.min(255,J+128))}}}addRegularDash(o){for(let I=o.length-1;I>=0;--I){const O=o[I],N=o[I+1];O.zeroLength?o.splice(I,1):N&&N.isDash===O.isDash&&(N.left=O.left,o.splice(I,1))}const d=o[0],m=o[o.length-1];d.isDash===m.isDash&&(d.left=m.left-this.width,m.right=d.right+this.width);const y=this.width*this.nextRow;let x=0,M=o[x];for(let I=0;I<this.width;I++){I/M.right>1&&(M=o[++x]);const O=Math.abs(I-M.left),N=Math.abs(I-M.right),V=Math.min(O,N);this.data[y+I]=Math.max(0,Math.min(255,(M.isDash?V:-V)+128))}}addDash(o,d){const m=d?7:0,y=2*m+1;if(this.nextRow+y>this.height)return l.w("LineAtlas out of space"),null;let x=0;for(let I=0;I<o.length;I++)x+=o[I];if(x!==0){const I=this.width/x,O=this.getDashRanges(o,this.width,I);d?this.addRoundDash(O,I,m):this.addRegularDash(O)}const M={y:(this.nextRow+m+.5)/this.height,height:2*m/this.height,width:x};return this.nextRow+=y,this.dirty=!0,M}bind(o){const d=o.gl;this.texture?(d.bindTexture(d.TEXTURE_2D,this.texture),this.dirty&&(this.dirty=!1,d.texSubImage2D(d.TEXTURE_2D,0,0,0,this.width,this.height,d.ALPHA,d.UNSIGNED_BYTE,this.data))):(this.texture=d.createTexture(),d.bindTexture(d.TEXTURE_2D,this.texture),d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_S,d.REPEAT),d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_T,d.REPEAT),d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MIN_FILTER,d.LINEAR),d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MAG_FILTER,d.LINEAR),d.texImage2D(d.TEXTURE_2D,0,d.ALPHA,this.width,this.height,0,d.ALPHA,d.UNSIGNED_BYTE,this.data))}}const Nn="maplibre_preloaded_worker_pool";class Pn{constructor(){this.active={}}acquire(o){if(!this.workers)for(this.workers=[];this.workers.length<Pn.workerCount;)this.workers.push(new Worker(l.a.WORKER_URL));return this.active[o]=!0,this.workers.slice()}release(o){delete this.active[o],this.numActive()===0&&(this.workers.forEach(d=>{d.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[Nn]}numActive(){return Object.keys(this.active).length}}const Rn=Math.floor(E.hardwareConcurrency/2);let Ce,He;function De(){return Ce||(Ce=new Pn),Ce}Pn.workerCount=l.C(globalThis)?Math.max(Math.min(Rn,3),1):1;class ct{constructor(o,d){this.workerPool=o,this.actors=[],this.currentActor=0,this.id=d;const m=this.workerPool.acquire(d);for(let y=0;y<m.length;y++){const x=new l.F(m[y],d);x.name=`Worker ${y}`,this.actors.push(x)}if(!this.actors.length)throw new Error("No actors found")}broadcast(o,d){const m=[];for(const y of this.actors)m.push(y.sendAsync({type:o,data:d}));return Promise.all(m)}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(o=!0){this.actors.forEach(d=>{d.remove()}),this.actors=[],o&&this.workerPool.release(this.id)}registerMessageHandler(o,d){for(const m of this.actors)m.registerMessageHandler(o,d)}}function Rt(){return He||(He=new ct(De(),l.G),He.registerMessageHandler("GR",(v,o,d)=>l.m(o,d))),He}function Qt(v,o){const d=l.H();return l.J(d,d,[1,1,0]),l.K(d,d,[.5*v.width,.5*v.height,1]),l.L(d,d,v.calculatePosMatrix(o.toUnwrapped()))}function At(v,o,d,m,y,x){const M=function(F,Z,J){if(F)for(const ee of F){const oe=Z[ee];if(oe&&oe.source===J&&oe.type==="fill-extrusion")return!0}else for(const ee in Z){const oe=Z[ee];if(oe.source===J&&oe.type==="fill-extrusion")return!0}return!1}(y&&y.layers,o,v.id),I=x.maxPitchScaleFactor(),O=v.tilesIn(m,I,M);O.sort(Mt);const N=[];for(const F of O)N.push({wrappedTileID:F.tileID.wrapped().key,queryResults:F.tile.queryRenderedFeatures(o,d,v._state,F.queryGeometry,F.cameraQueryGeometry,F.scale,y,x,I,Qt(v.transform,F.tileID))});const V=function(F){const Z={},J={};for(const ee of F){const oe=ee.queryResults,le=ee.wrappedTileID,ce=J[le]=J[le]||{};for(const he in oe){const ne=oe[he],me=ce[he]=ce[he]||{},ge=Z[he]=Z[he]||[];for(const xe of ne)me[xe.featureIndex]||(me[xe.featureIndex]=!0,ge.push(xe))}}return Z}(N);for(const F in V)V[F].forEach(Z=>{const J=Z.feature,ee=v.getFeatureState(J.layer["source-layer"],J.id);J.source=J.layer.source,J.layer["source-layer"]&&(J.sourceLayer=J.layer["source-layer"]),J.state=ee});return V}function Mt(v,o){const d=v.tileID,m=o.tileID;return d.overscaledZ-m.overscaledZ||d.canonical.y-m.canonical.y||d.wrap-m.wrap||d.canonical.x-m.canonical.x}function rn(v,o,d){return l._(this,void 0,void 0,function*(){let m=v;if(v.url?m=(yield l.h(o.transformRequest(v.url,"Source"),d)).data:yield E.frameAsync(d),!m)return null;const y=l.M(l.e(m,v),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);return"vector_layers"in m&&m.vector_layers&&(y.vectorLayerIds=m.vector_layers.map(x=>x.id)),y})}class we{constructor(o,d){o&&(d?this.setSouthWest(o).setNorthEast(d):Array.isArray(o)&&(o.length===4?this.setSouthWest([o[0],o[1]]).setNorthEast([o[2],o[3]]):this.setSouthWest(o[0]).setNorthEast(o[1])))}setNorthEast(o){return this._ne=o instanceof l.N?new l.N(o.lng,o.lat):l.N.convert(o),this}setSouthWest(o){return this._sw=o instanceof l.N?new l.N(o.lng,o.lat):l.N.convert(o),this}extend(o){const d=this._sw,m=this._ne;let y,x;if(o instanceof l.N)y=o,x=o;else{if(!(o instanceof we))return Array.isArray(o)?o.length===4||o.every(Array.isArray)?this.extend(we.convert(o)):this.extend(l.N.convert(o)):o&&("lng"in o||"lon"in o)&&"lat"in o?this.extend(l.N.convert(o)):this;if(y=o._sw,x=o._ne,!y||!x)return this}return d||m?(d.lng=Math.min(y.lng,d.lng),d.lat=Math.min(y.lat,d.lat),m.lng=Math.max(x.lng,m.lng),m.lat=Math.max(x.lat,m.lat)):(this._sw=new l.N(y.lng,y.lat),this._ne=new l.N(x.lng,x.lat)),this}getCenter(){return new l.N((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 l.N(this.getWest(),this.getNorth())}getSouthEast(){return new l.N(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(o){const{lng:d,lat:m}=l.N.convert(o);let y=this._sw.lng<=d&&d<=this._ne.lng;return this._sw.lng>this._ne.lng&&(y=this._sw.lng>=d&&d>=this._ne.lng),this._sw.lat<=m&&m<=this._ne.lat&&y}static convert(o){return o instanceof we?o:o&&new we(o)}static fromLngLat(o,d=0){const m=360*d/40075017,y=m/Math.cos(Math.PI/180*o.lat);return new we(new l.N(o.lng-y,o.lat-m),new l.N(o.lng+y,o.lat+m))}adjustAntiMeridian(){const o=new l.N(this._sw.lng,this._sw.lat),d=new l.N(this._ne.lng,this._ne.lat);return new we(o,o.lng>d.lng?new l.N(d.lng+360,d.lat):d)}}class yn{constructor(o,d,m){this.bounds=we.convert(this.validateBounds(o)),this.minzoom=d||0,this.maxzoom=m||24}validateBounds(o){return Array.isArray(o)&&o.length===4?[Math.max(-180,o[0]),Math.max(-90,o[1]),Math.min(180,o[2]),Math.min(90,o[3])]:[-180,-90,180,90]}contains(o){const d=Math.pow(2,o.z),m=Math.floor(l.O(this.bounds.getWest())*d),y=Math.floor(l.Q(this.bounds.getNorth())*d),x=Math.ceil(l.O(this.bounds.getEast())*d),M=Math.ceil(l.Q(this.bounds.getSouth())*d);return o.x>=m&&o.x<x&&o.y>=y&&o.y<M}}class pr extends l.E{constructor(o,d,m,y){if(super(),this.id=o,this.dispatcher=m,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,l.e(this,l.M(d,["url","scheme","tileSize","promoteId"])),this._options=l.e({type:"vector"},d),this._collectResourceTiming=d.collectResourceTiming,this.tileSize!==512)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(y)}load(){return l._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new l.k("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{const o=yield rn(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,this.map.style.sourceCaches[this.id].clearTiles(),o&&(l.e(this,o),o.bounds&&(this.tileBounds=new yn(o.bounds,this.minzoom,this.maxzoom)),this.fire(new l.k("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new l.k("data",{dataType:"source",sourceDataType:"content"})))}catch(o){this._tileJSONRequest=null,this.fire(new l.j(o))}})}loaded(){return this._loaded}hasTile(o){return!this.tileBounds||this.tileBounds.contains(o.canonical)}onAdd(o){this.map=o,this.load()}setSourceProperty(o){this._tileJSONRequest&&this._tileJSONRequest.abort(),o(),this.load()}setTiles(o){return this.setSourceProperty(()=>{this._options.tiles=o}),this}setUrl(o){return this.setSourceProperty(()=>{this.url=o,this._options.url=o}),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}serialize(){return l.e({},this._options)}loadTile(o){return l._(this,void 0,void 0,function*(){const d=o.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),m={request:this.map._requestManager.transformRequest(d,"Tile"),uid:o.uid,tileID:o.tileID,zoom:o.tileID.overscaledZ,tileSize:this.tileSize*o.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};m.request.collectResourceTiming=this._collectResourceTiming;let y="RT";if(o.actor&&o.state!=="expired"){if(o.state==="loading")return new Promise((x,M)=>{o.reloadPromise={resolve:x,reject:M}})}else o.actor=this.dispatcher.getActor(),y="LT";o.abortController=new AbortController;try{const x=yield o.actor.sendAsync({type:y,data:m},o.abortController);if(delete o.abortController,o.aborted)return;this._afterTileLoadWorkerResponse(o,x)}catch(x){if(delete o.abortController,o.aborted)return;if(x&&x.status!==404)throw x;this._afterTileLoadWorkerResponse(o,null)}})}_afterTileLoadWorkerResponse(o,d){if(d&&d.resourceTiming&&(o.resourceTiming=d.resourceTiming),d&&this.map._refreshExpiredTiles&&o.setExpiryData(d),o.loadVectorData(d,this.map.painter),o.reloadPromise){const m=o.reloadPromise;o.reloadPromise=null,this.loadTile(o).then(m.resolve).catch(m.reject)}}abortTile(o){return l._(this,void 0,void 0,function*(){o.abortController&&(o.abortController.abort(),delete o.abortController),o.actor&&(yield o.actor.sendAsync({type:"AT",data:{uid:o.uid,type:this.type,source:this.id}}))})}unloadTile(o){return l._(this,void 0,void 0,function*(){o.unloadVectorData(),o.actor&&(yield o.actor.sendAsync({type:"RMT",data:{uid:o.uid,type:this.type,source:this.id}}))})}hasTransition(){return!1}}class qt extends l.E{constructor(o,d,m,y){super(),this.id=o,this.dispatcher=m,this.setEventedParent(y),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=l.e({type:"raster"},d),l.e(this,l.M(d,["url","scheme","tileSize"]))}load(){return l._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new l.k("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{const o=yield rn(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,o&&(l.e(this,o),o.bounds&&(this.tileBounds=new yn(o.bounds,this.minzoom,this.maxzoom)),this.fire(new l.k("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new l.k("data",{dataType:"source",sourceDataType:"content"})))}catch(o){this._tileJSONRequest=null,this.fire(new l.j(o))}})}loaded(){return this._loaded}onAdd(o){this.map=o,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}setSourceProperty(o){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null),o(),this.load()}setTiles(o){return this.setSourceProperty(()=>{this._options.tiles=o}),this}setUrl(o){return this.setSourceProperty(()=>{this.url=o,this._options.url=o}),this}serialize(){return l.e({},this._options)}hasTile(o){return!this.tileBounds||this.tileBounds.contains(o.canonical)}loadTile(o){return l._(this,void 0,void 0,function*(){const d=o.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);o.abortController=new AbortController;try{const m=yield G.getImage(this.map._requestManager.transformRequest(d,"Tile"),o.abortController,this.map._refreshExpiredTiles);if(delete o.abortController,o.aborted)return void(o.state="unloaded");if(m&&m.data){this.map._refreshExpiredTiles&&m.cacheControl&&m.expires&&o.setExpiryData({cacheControl:m.cacheControl,expires:m.expires});const y=this.map.painter.context,x=y.gl,M=m.data;o.texture=this.map.painter.getTileTexture(M.width),o.texture?o.texture.update(M,{useMipmap:!0}):(o.texture=new Xe(y,M,x.RGBA,{useMipmap:!0}),o.texture.bind(x.LINEAR,x.CLAMP_TO_EDGE,x.LINEAR_MIPMAP_NEAREST)),o.state="loaded"}}catch(m){if(delete o.abortController,o.aborted)o.state="unloaded";else if(m)throw o.state="errored",m}})}abortTile(o){return l._(this,void 0,void 0,function*(){o.abortController&&(o.abortController.abort(),delete o.abortController)})}unloadTile(o){return l._(this,void 0,void 0,function*(){o.texture&&this.map.painter.saveTileTexture(o.texture)})}hasTransition(){return!1}}class sn extends qt{constructor(o,d,m,y){super(o,d,m,y),this.type="raster-dem",this.maxzoom=22,this._options=l.e({type:"raster-dem"},d),this.encoding=d.encoding||"mapbox",this.redFactor=d.redFactor,this.greenFactor=d.greenFactor,this.blueFactor=d.blueFactor,this.baseShift=d.baseShift}loadTile(o){return l._(this,void 0,void 0,function*(){const d=o.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),m=this.map._requestManager.transformRequest(d,"Tile");o.neighboringTiles=this._getNeighboringTiles(o.tileID),o.abortController=new AbortController;try{const y=yield G.getImage(m,o.abortController,this.map._refreshExpiredTiles);if(delete o.abortController,o.aborted)return void(o.state="unloaded");if(y&&y.data){const x=y.data;this.map._refreshExpiredTiles&&y.cacheControl&&y.expires&&o.setExpiryData({cacheControl:y.cacheControl,expires:y.expires});const M=l.b(x)&&l.U()?x:yield this.readImageNow(x),I={type:this.type,uid:o.uid,source:this.id,rawImageData:M,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};if(!o.actor||o.state==="expired"){o.actor=this.dispatcher.getActor();const O=yield o.actor.sendAsync({type:"LDT",data:I});o.dem=O,o.needsHillshadePrepare=!0,o.needsTerrainPrepare=!0,o.state="loaded"}}}catch(y){if(delete o.abortController,o.aborted)o.state="unloaded";else if(y)throw o.state="errored",y}})}readImageNow(o){return l._(this,void 0,void 0,function*(){if(typeof VideoFrame<"u"&&l.V()){const d=o.width+2,m=o.height+2;try{return new l.R({width:d,height:m},yield l.W(o,-1,-1,d,m))}catch{}}return E.getImageData(o,1)})}_getNeighboringTiles(o){const d=o.canonical,m=Math.pow(2,d.z),y=(d.x-1+m)%m,x=d.x===0?o.wrap-1:o.wrap,M=(d.x+1+m)%m,I=d.x+1===m?o.wrap+1:o.wrap,O={};return O[new l.S(o.overscaledZ,x,d.z,y,d.y).key]={backfilled:!1},O[new l.S(o.overscaledZ,I,d.z,M,d.y).key]={backfilled:!1},d.y>0&&(O[new l.S(o.overscaledZ,x,d.z,y,d.y-1).key]={backfilled:!1},O[new l.S(o.overscaledZ,o.wrap,d.z,d.x,d.y-1).key]={backfilled:!1},O[new l.S(o.overscaledZ,I,d.z,M,d.y-1).key]={backfilled:!1}),d.y+1<m&&(O[new l.S(o.overscaledZ,x,d.z,y,d.y+1).key]={backfilled:!1},O[new l.S(o.overscaledZ,o.wrap,d.z,d.x,d.y+1).key]={backfilled:!1},O[new l.S(o.overscaledZ,I,d.z,M,d.y+1).key]={backfilled:!1}),O}unloadTile(o){return l._(this,void 0,void 0,function*(){o.demTexture&&this.map.painter.saveTileTexture(o.demTexture),o.fbo&&(o.fbo.destroy(),delete o.fbo),o.dem&&delete o.dem,delete o.neighboringTiles,o.state="unloaded",o.actor&&(yield o.actor.sendAsync({type:"RDT",data:{type:this.type,uid:o.uid,source:this.id}}))})}}class ui extends l.E{constructor(o,d,m,y){super(),this.id=o,this.type="geojson",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._removed=!1,this._pendingLoads=0,this.actor=m.getActor(),this.setEventedParent(y),this._data=d.data,this._options=l.e({},d),this._collectResourceTiming=d.collectResourceTiming,d.maxzoom!==void 0&&(this.maxzoom=d.maxzoom),d.type&&(this.type=d.type),d.attribution&&(this.attribution=d.attribution),this.promoteId=d.promoteId;const x=l.X/this.tileSize;d.clusterMaxZoom!==void 0&&this.maxzoom<=d.clusterMaxZoom&&l.w(`The maxzoom value "${this.maxzoom}" is expected to be greater than the clusterMaxZoom value "${d.clusterMaxZoom}".`),this.workerOptions=l.e({source:this.id,cluster:d.cluster||!1,geojsonVtOptions:{buffer:(d.buffer!==void 0?d.buffer:128)*x,tolerance:(d.tolerance!==void 0?d.tolerance:.375)*x,extent:l.X,maxZoom:this.maxzoom,lineMetrics:d.lineMetrics||!1,generateId:d.generateId||!1},superclusterOptions:{maxZoom:d.clusterMaxZoom!==void 0?d.clusterMaxZoom:this.maxzoom-1,minPoints:Math.max(2,d.clusterMinPoints||2),extent:l.X,radius:(d.clusterRadius||50)*x,log:!1,generateId:d.generateId||!1},clusterProperties:d.clusterProperties,filter:d.filter},d.workerOptions),typeof this.promoteId=="string"&&(this.workerOptions.promoteId=this.promoteId)}load(){return l._(this,void 0,void 0,function*(){yield this._updateWorkerData()})}onAdd(o){this.map=o,this.load()}setData(o){return this._data=o,this._updateWorkerData(),this}updateData(o){return this._updateWorkerData(o),this}getData(){return l._(this,void 0,void 0,function*(){const o=l.e({type:this.type},this.workerOptions);return this.actor.sendAsync({type:"GD",data:o})})}setClusterOptions(o){return this.workerOptions.cluster=o.cluster,o&&(o.clusterRadius!==void 0&&(this.workerOptions.superclusterOptions.radius=o.clusterRadius),o.clusterMaxZoom!==void 0&&(this.workerOptions.superclusterOptions.maxZoom=o.clusterMaxZoom)),this._updateWorkerData(),this}getClusterExpansionZoom(o){return this.actor.sendAsync({type:"GCEZ",data:{type:this.type,clusterId:o,source:this.id}})}getClusterChildren(o){return this.actor.sendAsync({type:"GCC",data:{type:this.type,clusterId:o,source:this.id}})}getClusterLeaves(o,d,m){return this.actor.sendAsync({type:"GCL",data:{type:this.type,source:this.id,clusterId:o,limit:d,offset:m}})}_updateWorkerData(o){return l._(this,void 0,void 0,function*(){const d=l.e({type:this.type},this.workerOptions);o?d.dataDiff=o:typeof this._data=="string"?(d.request=this.map._requestManager.transformRequest(E.resolveURL(this._data),"Source"),d.request.collectResourceTiming=this._collectResourceTiming):d.data=JSON.stringify(this._data),this._pendingLoads++,this.fire(new l.k("dataloading",{dataType:"source"}));try{const m=yield this.actor.sendAsync({type:"LD",data:d});if(this._pendingLoads--,this._removed||m.abandoned)return void this.fire(new l.k("dataabort",{dataType:"source"}));let y=null;m.resourceTiming&&m.resourceTiming[this.id]&&(y=m.resourceTiming[this.id].slice(0));const x={dataType:"source"};this._collectResourceTiming&&y&&y.length>0&&l.e(x,{resourceTiming:y}),this.fire(new l.k("data",Object.assign(Object.assign({},x),{sourceDataType:"metadata"}))),this.fire(new l.k("data",Object.assign(Object.assign({},x),{sourceDataType:"content"})))}catch(m){if(this._pendingLoads--,this._removed)return void this.fire(new l.k("dataabort",{dataType:"source"}));this.fire(new l.j(m))}})}loaded(){return this._pendingLoads===0}loadTile(o){return l._(this,void 0,void 0,function*(){const d=o.actor?"RT":"LT";o.actor=this.actor;const m={type:this.type,uid:o.uid,tileID:o.tileID,zoom:o.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};o.abortController=new AbortController;const y=yield this.actor.sendAsync({type:d,data:m},o.abortController);delete o.abortController,o.unloadVectorData(),o.aborted||o.loadVectorData(y,this.map.painter,d==="RT")})}abortTile(o){return l._(this,void 0,void 0,function*(){o.abortController&&(o.abortController.abort(),delete o.abortController),o.aborted=!0})}unloadTile(o){return l._(this,void 0,void 0,function*(){o.unloadVectorData(),yield this.actor.sendAsync({type:"RMT",data:{uid:o.uid,type:this.type,source:this.id}})})}onRemove(){this._removed=!0,this.actor.sendAsync({type:"RS",data:{type:this.type,source:this.id}})}serialize(){return l.e({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}}var Hi=l.Y([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class xi extends l.E{constructor(o,d,m,y){super(),this.id=o,this.dispatcher=m,this.coordinates=d.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(y),this.options=d}load(o){return l._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new l.k("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=new AbortController;try{const d=yield G.getImage(this.map._requestManager.transformRequest(this.url,"Image"),this._request);this._request=null,this._loaded=!0,d&&d.data&&(this.image=d.data,o&&(this.coordinates=o),this._finishLoading())}catch(d){this._request=null,this._loaded=!0,this.fire(new l.j(d))}})}loaded(){return this._loaded}updateImage(o){return o.url?(this._request&&(this._request.abort(),this._request=null),this.options.url=o.url,this.load(o.coordinates).finally(()=>{this.texture=null}),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new l.k("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(o){this.map=o,this.load()}onRemove(){this._request&&(this._request.abort(),this._request=null)}setCoordinates(o){this.coordinates=o;const d=o.map(l.Z.fromLngLat);this.tileID=function(y){let x=1/0,M=1/0,I=-1/0,O=-1/0;for(const Z of y)x=Math.min(x,Z.x),M=Math.min(M,Z.y),I=Math.max(I,Z.x),O=Math.max(O,Z.y);const N=Math.max(I-x,O-M),V=Math.max(0,Math.floor(-Math.log(N)/Math.LN2)),F=Math.pow(2,V);return new l.a1(V,Math.floor((x+I)/2*F),Math.floor((M+O)/2*F))}(d),this.minzoom=this.maxzoom=this.tileID.z;const m=d.map(y=>this.tileID.getTilePoint(y)._round());return this._boundsArray=new l.$,this._boundsArray.emplaceBack(m[0].x,m[0].y,0,0),this._boundsArray.emplaceBack(m[1].x,m[1].y,l.X,0),this._boundsArray.emplaceBack(m[3].x,m[3].y,0,l.X),this._boundsArray.emplaceBack(m[2].x,m[2].y,l.X,l.X),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this.fire(new l.k("data",{dataType:"source",sourceDataType:"content"})),this}prepare(){if(Object.keys(this.tiles).length===0||!this.image)return;const o=this.map.painter.context,d=o.gl;this.boundsBuffer||(this.boundsBuffer=o.createVertexBuffer(this._boundsArray,Hi.members)),this.boundsSegments||(this.boundsSegments=l.a0.simpleSegment(0,0,4,2)),this.texture||(this.texture=new Xe(o,this.image,d.RGBA),this.texture.bind(d.LINEAR,d.CLAMP_TO_EDGE));let m=!1;for(const y in this.tiles){const x=this.tiles[y];x.state!=="loaded"&&(x.state="loaded",x.texture=this.texture,m=!0)}m&&this.fire(new l.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}loadTile(o){return l._(this,void 0,void 0,function*(){this.tileID&&this.tileID.equals(o.tileID.canonical)?(this.tiles[String(o.tileID.wrap)]=o,o.buckets={}):o.state="errored"})}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}}class Or extends xi{constructor(o,d,m,y){super(o,d,m,y),this.roundZoom=!0,this.type="video",this.options=d}load(){return l._(this,void 0,void 0,function*(){this._loaded=!1;const o=this.options;this.urls=[];for(const d of o.urls)this.urls.push(this.map._requestManager.transformRequest(d,"Source").url);try{const d=yield l.a3(this.urls);if(this._loaded=!0,!d)return;this.video=d,this.video.loop=!0,this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading()}catch(d){this.fire(new l.j(d))}})}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(o){if(this.video){const d=this.video.seekable;o<d.start(0)||o>d.end(0)?this.fire(new l.j(new l.a2(`sources.${this.id}`,null,`Playback for this video can be set only between the ${d.start(0)} and ${d.end(0)}-second mark.`))):this.video.currentTime=o}}getVideo(){return this.video}onAdd(o){this.map||(this.map=o,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}prepare(){if(Object.keys(this.tiles).length===0||this.video.readyState<2)return;const o=this.map.painter.context,d=o.gl;this.boundsBuffer||(this.boundsBuffer=o.createVertexBuffer(this._boundsArray,Hi.members)),this.boundsSegments||(this.boundsSegments=l.a0.simpleSegment(0,0,4,2)),this.texture?this.video.paused||(this.texture.bind(d.LINEAR,d.CLAMP_TO_EDGE),d.texSubImage2D(d.TEXTURE_2D,0,0,0,d.RGBA,d.UNSIGNED_BYTE,this.video)):(this.texture=new Xe(o,this.video,d.RGBA),this.texture.bind(d.LINEAR,d.CLAMP_TO_EDGE));let m=!1;for(const y in this.tiles){const x=this.tiles[y];x.state!=="loaded"&&(x.state="loaded",x.texture=this.texture,m=!0)}m&&this.fire(new l.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}}class vi extends xi{constructor(o,d,m,y){super(o,d,m,y),d.coordinates?Array.isArray(d.coordinates)&&d.coordinates.length===4&&!d.coordinates.some(x=>!Array.isArray(x)||x.length!==2||x.some(M=>typeof M!="number"))||this.fire(new l.j(new l.a2(`sources.${o}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new l.j(new l.a2(`sources.${o}`,null,'missing required property "coordinates"'))),d.animate&&typeof d.animate!="boolean"&&this.fire(new l.j(new l.a2(`sources.${o}`,null,'optional "animate" property must be a boolean value'))),d.canvas?typeof d.canvas=="string"||d.canvas instanceof HTMLCanvasElement||this.fire(new l.j(new l.a2(`sources.${o}`,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 l.j(new l.a2(`sources.${o}`,null,'missing required property "canvas"'))),this.options=d,this.animate=d.animate===void 0||d.animate}load(){return l._(this,void 0,void 0,function*(){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 l.j(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(o){this.map=o,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let o=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,o=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,o=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;const d=this.map.painter.context,m=d.gl;this.boundsBuffer||(this.boundsBuffer=d.createVertexBuffer(this._boundsArray,Hi.members)),this.boundsSegments||(this.boundsSegments=l.a0.simpleSegment(0,0,4,2)),this.texture?(o||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new Xe(d,this.canvas,m.RGBA,{premultiply:!0});let y=!1;for(const x in this.tiles){const M=this.tiles[x];M.state!=="loaded"&&(M.state="loaded",M.texture=this.texture,y=!0)}y&&this.fire(new l.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const o of[this.canvas.width,this.canvas.height])if(isNaN(o)||o<=0)return!0;return!1}}const Eo={},Co=v=>{switch(v){case"geojson":return ui;case"image":return xi;case"raster":return qt;case"raster-dem":return sn;case"vector":return pr;case"video":return Or;case"canvas":return vi}return Eo[v]},Ve="RTLPluginLoaded";class Br extends l.E{constructor(){super(...arguments),this.status="unavailable",this.url=null,this.dispatcher=Rt()}_syncState(o){return this.status=o,this.dispatcher.broadcast("SRPS",{pluginStatus:o,pluginURL:this.url}).catch(d=>{throw this.status="error",d})}getRTLTextPluginStatus(){return this.status}clearRTLTextPlugin(){this.status="unavailable",this.url=null}setRTLTextPlugin(o){return l._(this,arguments,void 0,function*(d,m=!1){if(this.url)throw new Error("setRTLTextPlugin cannot be called multiple times.");if(this.url=E.resolveURL(d),!this.url)throw new Error(`requested url ${d} is invalid`);if(this.status==="unavailable"){if(!m)return this._requestImport();this.status="deferred",this._syncState(this.status)}else if(this.status==="requested")return this._requestImport()})}_requestImport(){return l._(this,void 0,void 0,function*(){yield this._syncState("loading"),this.status="loaded",this.fire(new l.k(Ve))})}lazyLoad(){this.status==="unavailable"?this.status="requested":this.status==="deferred"&&this._requestImport()}}let wi=null;function zr(){return wi||(wi=new Br),wi}class To{constructor(o,d){this.timeAdded=0,this.fadeEndTime=0,this.tileID=o,this.uid=l.a4(),this.uses=0,this.tileSize=d,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.rtt=[],this.rttCoords={},this.expiredRequestCount=0,this.state="loading"}registerFadeDuration(o){const d=o+this.timeAdded;d<this.fadeEndTime||(this.fadeEndTime=d)}wasRequested(){return this.state==="errored"||this.state==="loaded"||this.state==="reloading"}clearTextures(o){this.demTexture&&o.saveTileTexture(this.demTexture),this.demTexture=null}loadVectorData(o,d,m){if(this.hasData()&&this.unloadVectorData(),this.state="loaded",o){o.featureIndex&&(this.latestFeatureIndex=o.featureIndex,o.rawTileData?(this.latestRawTileData=o.rawTileData,this.latestFeatureIndex.rawTileData=o.rawTileData):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData)),this.collisionBoxArray=o.collisionBoxArray,this.buckets=function(y,x){const M={};if(!x)return M;for(const I of y){const O=I.layerIds.map(N=>x.getLayer(N)).filter(Boolean);if(O.length!==0){I.layers=O,I.stateDependentLayerIds&&(I.stateDependentLayers=I.stateDependentLayerIds.map(N=>O.filter(V=>V.id===N)[0]));for(const N of O)M[N.id]=I}}return M}(o.buckets,d.style),this.hasSymbolBuckets=!1;for(const y in this.buckets){const x=this.buckets[y];if(x instanceof l.a6){if(this.hasSymbolBuckets=!0,!m)break;x.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const y in this.buckets){const x=this.buckets[y];if(x instanceof l.a6&&x.hasRTLText){this.hasRTLText=!0,zr().lazyLoad();break}}this.queryPadding=0;for(const y in this.buckets){const x=this.buckets[y];this.queryPadding=Math.max(this.queryPadding,d.style.getLayer(y).queryRadius(x))}o.imageAtlas&&(this.imageAtlas=o.imageAtlas),o.glyphAtlasImage&&(this.glyphAtlasImage=o.glyphAtlasImage)}else this.collisionBoxArray=new l.a5}unloadVectorData(){for(const o in this.buckets)this.buckets[o].destroy();this.buckets={},this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.imageAtlas&&(this.imageAtlas=null),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.latestFeatureIndex=null,this.state="unloaded"}getBucket(o){return this.buckets[o.id]}upload(o){for(const m in this.buckets){const y=this.buckets[m];y.uploadPending()&&y.upload(o)}const d=o.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new Xe(o,this.imageAtlas.image,d.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new Xe(o,this.glyphAtlasImage,d.ALPHA),this.glyphAtlasImage=null)}prepare(o){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(o,this.imageAtlasTexture)}queryRenderedFeatures(o,d,m,y,x,M,I,O,N,V){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:y,cameraQueryGeometry:x,scale:M,tileSize:this.tileSize,pixelPosMatrix:V,transform:O,params:I,queryPadding:this.queryPadding*N},o,d,m):{}}querySourceFeatures(o,d){const m=this.latestFeatureIndex;if(!m||!m.rawTileData)return;const y=m.loadVTLayers(),x=d&&d.sourceLayer?d.sourceLayer:"",M=y._geojsonTileLayer||y[x];if(!M)return;const I=l.a7(d&&d.filter),{z:O,x:N,y:V}=this.tileID.canonical,F={z:O,x:N,y:V};for(let Z=0;Z<M.length;Z++){const J=M.feature(Z);if(I.needGeometry){const le=l.a8(J,!0);if(!I.filter(new l.z(this.tileID.overscaledZ),le,this.tileID.canonical))continue}else if(!I.filter(new l.z(this.tileID.overscaledZ),J))continue;const ee=m.getId(J,x),oe=new l.a9(J,O,N,V,ee);oe.tile=F,o.push(oe)}}hasData(){return this.state==="loaded"||this.state==="reloading"||this.state==="expired"}patternsLoaded(){return this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length}setExpiryData(o){const d=this.expirationTime;if(o.cacheControl){const m=l.aa(o.cacheControl);m["max-age"]&&(this.expirationTime=Date.now()+1e3*m["max-age"])}else o.expires&&(this.expirationTime=new Date(o.expires).getTime());if(this.expirationTime){const m=Date.now();let y=!1;if(this.expirationTime>m)y=!1;else if(d)if(this.expirationTime<d)y=!0;else{const x=this.expirationTime-d;x?this.expirationTime=m+Math.max(x,3e4):y=!0}else y=!0;y?(this.expiredRequestCount++,this.state="expired"):this.expiredRequestCount=0}}getExpiryTimeout(){if(this.expirationTime)return this.expiredRequestCount?1e3*(1<<Math.min(this.expiredRequestCount-1,31)):Math.min(this.expirationTime-new Date().getTime(),Math.pow(2,31)-1)}setFeatureState(o,d){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData||Object.keys(o).length===0)return;const m=this.latestFeatureIndex.loadVTLayers();for(const y in this.buckets){if(!d.style.hasLayer(y))continue;const x=this.buckets[y],M=x.layers[0].sourceLayer||"_geojsonTileLayer",I=m[M],O=o[M];if(!I||!O||Object.keys(O).length===0)continue;x.update(O,I,this.imageAtlas&&this.imageAtlas.patternPositions||{});const N=d&&d.style&&d.style.getLayer(y);N&&(this.queryPadding=Math.max(this.queryPadding,N.queryRadius(x)))}}holdingForFade(){return this.symbolFadeHoldUntil!==void 0}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<E.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0}setHoldDuration(o){this.symbolFadeHoldUntil=E.now()+o}setDependencies(o,d){const m={};for(const y of d)m[y]=!0;this.dependencies[o]=m}hasDependency(o,d){for(const m of o){const y=this.dependencies[m];if(y){for(const x of d)if(y[x])return!0}}return!1}}class Ze{constructor(o,d){this.max=o,this.onRemove=d,this.reset()}reset(){for(const o in this.data)for(const d of this.data[o])d.timeout&&clearTimeout(d.timeout),this.onRemove(d.value);return this.data={},this.order=[],this}add(o,d,m){const y=o.wrapped().key;this.data[y]===void 0&&(this.data[y]=[]);const x={value:d,timeout:void 0};if(m!==void 0&&(x.timeout=setTimeout(()=>{this.remove(o,x)},m)),this.data[y].push(x),this.order.push(y),this.order.length>this.max){const M=this._getAndRemoveByKey(this.order[0]);M&&this.onRemove(M)}return this}has(o){return o.wrapped().key in this.data}getAndRemove(o){return this.has(o)?this._getAndRemoveByKey(o.wrapped().key):null}_getAndRemoveByKey(o){const d=this.data[o].shift();return d.timeout&&clearTimeout(d.timeout),this.data[o].length===0&&delete this.data[o],this.order.splice(this.order.indexOf(o),1),d.value}getByKey(o){const d=this.data[o];return d?d[0].value:null}get(o){return this.has(o)?this.data[o.wrapped().key][0].value:null}remove(o,d){if(!this.has(o))return this;const m=o.wrapped().key,y=d===void 0?0:this.data[m].indexOf(d),x=this.data[m][y];return this.data[m].splice(y,1),x.timeout&&clearTimeout(x.timeout),this.data[m].length===0&&delete this.data[m],this.onRemove(x.value),this.order.splice(this.order.indexOf(m),1),this}setMaxSize(o){for(this.max=o;this.order.length>this.max;){const d=this._getAndRemoveByKey(this.order[0]);d&&this.onRemove(d)}return this}filter(o){const d=[];for(const m in this.data)for(const y of this.data[m])o(y.value)||d.push(y);for(const m of d)this.remove(m.value.tileID,m)}}class ke{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(o,d,m){const y=String(d);if(this.stateChanges[o]=this.stateChanges[o]||{},this.stateChanges[o][y]=this.stateChanges[o][y]||{},l.e(this.stateChanges[o][y],m),this.deletedStates[o]===null){this.deletedStates[o]={};for(const x in this.state[o])x!==y&&(this.deletedStates[o][x]=null)}else if(this.deletedStates[o]&&this.deletedStates[o][y]===null){this.deletedStates[o][y]={};for(const x in this.state[o][y])m[x]||(this.deletedStates[o][y][x]=null)}else for(const x in m)this.deletedStates[o]&&this.deletedStates[o][y]&&this.deletedStates[o][y][x]===null&&delete this.deletedStates[o][y][x]}removeFeatureState(o,d,m){if(this.deletedStates[o]===null)return;const y=String(d);if(this.deletedStates[o]=this.deletedStates[o]||{},m&&d!==void 0)this.deletedStates[o][y]!==null&&(this.deletedStates[o][y]=this.deletedStates[o][y]||{},this.deletedStates[o][y][m]=null);else if(d!==void 0)if(this.stateChanges[o]&&this.stateChanges[o][y])for(m in this.deletedStates[o][y]={},this.stateChanges[o][y])this.deletedStates[o][y][m]=null;else this.deletedStates[o][y]=null;else this.deletedStates[o]=null}getState(o,d){const m=String(d),y=l.e({},(this.state[o]||{})[m],(this.stateChanges[o]||{})[m]);if(this.deletedStates[o]===null)return{};if(this.deletedStates[o]){const x=this.deletedStates[o][d];if(x===null)return{};for(const M in x)delete y[M]}return y}initializeTileState(o,d){o.setFeatureState(this.state,d)}coalesceChanges(o,d){const m={};for(const y in this.stateChanges){this.state[y]=this.state[y]||{};const x={};for(const M in this.stateChanges[y])this.state[y][M]||(this.state[y][M]={}),l.e(this.state[y][M],this.stateChanges[y][M]),x[M]=this.state[y][M];m[y]=x}for(const y in this.deletedStates){this.state[y]=this.state[y]||{};const x={};if(this.deletedStates[y]===null)for(const M in this.state[y])x[M]={},this.state[y][M]={};else for(const M in this.deletedStates[y]){if(this.deletedStates[y][M]===null)this.state[y][M]={};else for(const I of Object.keys(this.deletedStates[y][M]))delete this.state[y][M][I];x[M]=this.state[y][M]}m[y]=m[y]||{},l.e(m[y],x)}if(this.stateChanges={},this.deletedStates={},Object.keys(m).length!==0)for(const y in o)o[y].setFeatureState(m,d)}}class Re extends l.E{constructor(o,d,m){super(),this.id=o,this.dispatcher=m,this.on("data",y=>this._dataHandler(y)),this.on("dataloading",()=>{this._sourceErrored=!1}),this.on("error",()=>{this._sourceErrored=this._source.loaded()}),this._source=((y,x,M,I)=>{const O=new(Co(x.type))(y,x,M,I);if(O.id!==y)throw new Error(`Expected Source id to be ${y} instead of ${O.id}`);return O})(o,d,m,this),this._tiles={},this._cache=new Ze(0,y=>this._unloadTile(y)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new ke,this._didEmitContent=!1,this._updated=!1}onAdd(o){this.map=o,this._maxTileCacheSize=o?o._maxTileCacheSize:null,this._maxTileCacheZoomLevels=o?o._maxTileCacheZoomLevels:null,this._source&&this._source.onAdd&&this._source.onAdd(o)}onRemove(o){this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(o)}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;if(!(this.used===void 0&&this.usedForTerrain===void 0||this.used||this.usedForTerrain))return!0;if(!this._updated)return!1;for(const o in this._tiles){const d=this._tiles[o];if(d.state!=="loaded"&&d.state!=="errored")return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const o=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,o&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}_loadTile(o,d,m){return l._(this,void 0,void 0,function*(){try{yield this._source.loadTile(o),this._tileLoaded(o,d,m)}catch(y){o.state="errored",y.status!==404?this._source.fire(new l.j(y,{tile:o})):this.update(this.transform,this.terrain)}})}_unloadTile(o){this._source.unloadTile&&this._source.unloadTile(o)}_abortTile(o){this._source.abortTile&&this._source.abortTile(o),this._source.fire(new l.k("dataabort",{tile:o,coord:o.tileID,dataType:"source"}))}serialize(){return this._source.serialize()}prepare(o){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const d in this._tiles){const m=this._tiles[d];m.upload(o),m.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map(o=>o.tileID).sort(vt).map(o=>o.key)}getRenderableIds(o){const d=[];for(const m in this._tiles)this._isIdRenderable(m,o)&&d.push(this._tiles[m]);return o?d.sort((m,y)=>{const x=m.tileID,M=y.tileID,I=new l.P(x.canonical.x,x.canonical.y)._rotate(this.transform.angle),O=new l.P(M.canonical.x,M.canonical.y)._rotate(this.transform.angle);return x.overscaledZ-M.overscaledZ||O.y-I.y||O.x-I.x}).map(m=>m.tileID.key):d.map(m=>m.tileID).sort(vt).map(m=>m.key)}hasRenderableParent(o){const d=this.findLoadedParent(o,0);return!!d&&this._isIdRenderable(d.tileID.key)}_isIdRenderable(o,d){return this._tiles[o]&&this._tiles[o].hasData()&&!this._coveredTiles[o]&&(d||!this._tiles[o].holdingForFade())}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const o in this._tiles)this._tiles[o].state!=="errored"&&this._reloadTile(o,"reloading")}}_reloadTile(o,d){return l._(this,void 0,void 0,function*(){const m=this._tiles[o];m&&(m.state!=="loading"&&(m.state=d),yield this._loadTile(m,o,d))})}_tileLoaded(o,d,m){o.timeAdded=E.now(),m==="expired"&&(o.refreshedUponExpiration=!0),this._setTileReloadTimer(d,o),this.getSource().type==="raster-dem"&&o.dem&&this._backfillDEM(o),this._state.initializeTileState(o,this.map?this.map.painter:null),o.aborted||this._source.fire(new l.k("data",{dataType:"source",tile:o,coord:o.tileID}))}_backfillDEM(o){const d=this.getRenderableIds();for(let y=0;y<d.length;y++){const x=d[y];if(o.neighboringTiles&&o.neighboringTiles[x]){const M=this.getTileByID(x);m(o,M),m(M,o)}}function m(y,x){y.needsHillshadePrepare=!0,y.needsTerrainPrepare=!0;let M=x.tileID.canonical.x-y.tileID.canonical.x;const I=x.tileID.canonical.y-y.tileID.canonical.y,O=Math.pow(2,y.tileID.canonical.z),N=x.tileID.key;M===0&&I===0||Math.abs(I)>1||(Math.abs(M)>1&&(Math.abs(M+O)===1?M+=O:Math.abs(M-O)===1&&(M-=O)),x.dem&&y.dem&&(y.dem.backfillBorder(x.dem,M,I),y.neighboringTiles&&y.neighboringTiles[N]&&(y.neighboringTiles[N].backfilled=!0)))}}getTile(o){return this.getTileByID(o.key)}getTileByID(o){return this._tiles[o]}_retainLoadedChildren(o,d,m,y){for(const x in this._tiles){let M=this._tiles[x];if(y[x]||!M.hasData()||M.tileID.overscaledZ<=d||M.tileID.overscaledZ>m)continue;let I=M.tileID;for(;M&&M.tileID.overscaledZ>d+1;){const N=M.tileID.scaledTo(M.tileID.overscaledZ-1);M=this._tiles[N.key],M&&M.hasData()&&(I=N)}let O=I;for(;O.overscaledZ>d;)if(O=O.scaledTo(O.overscaledZ-1),o[O.key]){y[I.key]=I;break}}}findLoadedParent(o,d){if(o.key in this._loadedParentTiles){const m=this._loadedParentTiles[o.key];return m&&m.tileID.overscaledZ>=d?m:null}for(let m=o.overscaledZ-1;m>=d;m--){const y=o.scaledTo(m),x=this._getLoadedTile(y);if(x)return x}}findLoadedSibling(o){return this._getLoadedTile(o)}_getLoadedTile(o){const d=this._tiles[o.key];return d&&d.hasData()?d:this._cache.getByKey(o.wrapped().key)}updateCacheSize(o){const d=Math.ceil(o.width/this._source.tileSize)+1,m=Math.ceil(o.height/this._source.tileSize)+1,y=Math.floor(d*m*(this._maxTileCacheZoomLevels===null?l.a.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),x=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,y):y;this._cache.setMaxSize(x)}handleWrapJump(o){const d=Math.round((o-(this._prevLng===void 0?o:this._prevLng))/360);if(this._prevLng=o,d){const m={};for(const y in this._tiles){const x=this._tiles[y];x.tileID=x.tileID.unwrapTo(x.tileID.wrap+d),m[x.tileID.key]=x}this._tiles=m;for(const y in this._timers)clearTimeout(this._timers[y]),delete this._timers[y];for(const y in this._tiles)this._setTileReloadTimer(y,this._tiles[y])}}_updateCoveredAndRetainedTiles(o,d,m,y,x,M){const I={},O={},N=Object.keys(o),V=E.now();for(const F of N){const Z=o[F],J=this._tiles[F];if(!J||J.fadeEndTime!==0&&J.fadeEndTime<=V)continue;const ee=this.findLoadedParent(Z,d),oe=this.findLoadedSibling(Z),le=ee||oe||null;le&&(this._addTile(le.tileID),I[le.tileID.key]=le.tileID),O[F]=Z}this._retainLoadedChildren(O,y,m,o);for(const F in I)o[F]||(this._coveredTiles[F]=!0,o[F]=I[F]);if(M){const F={},Z={};for(const J of x)this._tiles[J.key].hasData()?F[J.key]=J:Z[J.key]=J;for(const J in Z){const ee=Z[J].children(this._source.maxzoom);this._tiles[ee[0].key]&&this._tiles[ee[1].key]&&this._tiles[ee[2].key]&&this._tiles[ee[3].key]&&(F[ee[0].key]=o[ee[0].key]=ee[0],F[ee[1].key]=o[ee[1].key]=ee[1],F[ee[2].key]=o[ee[2].key]=ee[2],F[ee[3].key]=o[ee[3].key]=ee[3],delete Z[J])}for(const J in Z){const ee=Z[J],oe=this.findLoadedParent(ee,this._source.minzoom),le=this.findLoadedSibling(ee),ce=oe||le||null;if(ce){F[ce.tileID.key]=o[ce.tileID.key]=ce.tileID;for(const he in F)F[he].isChildOf(ce.tileID)&&delete F[he]}}for(const J in this._tiles)F[J]||(this._coveredTiles[J]=!0)}}update(o,d){if(!this._sourceLoaded||this._paused)return;let m;this.transform=o,this.terrain=d,this.updateCacheSize(o),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?m=o.getVisibleUnwrappedCoordinates(this._source.tileID).map(V=>new l.S(V.canonical.z,V.wrap,V.canonical.z,V.canonical.x,V.canonical.y)):(m=o.coveringTiles({tileSize:this.usedForTerrain?this.tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:!this.usedForTerrain&&this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled,terrain:d}),this._source.hasTile&&(m=m.filter(V=>this._source.hasTile(V)))):m=[];const y=o.coveringZoomLevel(this._source),x=Math.max(y-Re.maxOverzooming,this._source.minzoom),M=Math.max(y+Re.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){const V={};for(const F of m)if(F.canonical.z>this._source.minzoom){const Z=F.scaledTo(F.canonical.z-1);V[Z.key]=Z;const J=F.scaledTo(Math.max(this._source.minzoom,Math.min(F.canonical.z,5)));V[J.key]=J}m=m.concat(Object.values(V))}const I=m.length===0&&!this._updated&&this._didEmitContent;this._updated=!0,I&&this.fire(new l.k("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));const O=this._updateRetainedTiles(m,y);Wt(this._source.type)&&this._updateCoveredAndRetainedTiles(O,x,M,y,m,d);for(const V in O)this._tiles[V].clearFadeHold();const N=l.ab(this._tiles,O);for(const V of N){const F=this._tiles[V];F.hasSymbolBuckets&&!F.holdingForFade()?F.setHoldDuration(this.map._fadeDuration):F.hasSymbolBuckets&&!F.symbolFadeFinished()||this._removeTile(V)}this._updateLoadedParentTileCache(),this._updateLoadedSiblingTileCache()}releaseSymbolFadeTiles(){for(const o in this._tiles)this._tiles[o].holdingForFade()&&this._removeTile(o)}_updateRetainedTiles(o,d){var m;const y={},x={},M=Math.max(d-Re.maxOverzooming,this._source.minzoom),I=Math.max(d+Re.maxUnderzooming,this._source.minzoom),O={};for(const N of o){const V=this._addTile(N);y[N.key]=N,V.hasData()||d<this._source.maxzoom&&(O[N.key]=N)}this._retainLoadedChildren(O,d,I,y);for(const N of o){let V=this._tiles[N.key];if(V.hasData())continue;if(d+1>this._source.maxzoom){const Z=N.children(this._source.maxzoom)[0],J=this.getTile(Z);if(J&&J.hasData()){y[Z.key]=Z;continue}}else{const Z=N.children(this._source.maxzoom);if(y[Z[0].key]&&y[Z[1].key]&&y[Z[2].key]&&y[Z[3].key])continue}let F=V.wasRequested();for(let Z=N.overscaledZ-1;Z>=M;--Z){const J=N.scaledTo(Z);if(x[J.key])break;if(x[J.key]=!0,V=this.getTile(J),!V&&F&&(V=this._addTile(J)),V){const ee=V.hasData();if((ee||!(!((m=this.map)===null||m===void 0)&&m.cancelPendingTileRequestsWhileZooming)||F)&&(y[J.key]=J),F=V.wasRequested(),ee)break}}}return y}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const o in this._tiles){const d=[];let m,y=this._tiles[o].tileID;for(;y.overscaledZ>0;){if(y.key in this._loadedParentTiles){m=this._loadedParentTiles[y.key];break}d.push(y.key);const x=y.scaledTo(y.overscaledZ-1);if(m=this._getLoadedTile(x),m)break;y=x}for(const x of d)this._loadedParentTiles[x]=m}}_updateLoadedSiblingTileCache(){this._loadedSiblingTiles={};for(const o in this._tiles){const d=this._tiles[o].tileID,m=this._getLoadedTile(d);this._loadedSiblingTiles[d.key]=m}}_addTile(o){let d=this._tiles[o.key];if(d)return d;d=this._cache.getAndRemove(o),d&&(this._setTileReloadTimer(o.key,d),d.tileID=o,this._state.initializeTileState(d,this.map?this.map.painter:null),this._cacheTimers[o.key]&&(clearTimeout(this._cacheTimers[o.key]),delete this._cacheTimers[o.key],this._setTileReloadTimer(o.key,d)));const m=d;return d||(d=new To(o,this._source.tileSize*o.overscaleFactor()),this._loadTile(d,o.key,d.state)),d.uses++,this._tiles[o.key]=d,m||this._source.fire(new l.k("dataloading",{tile:d,coord:d.tileID,dataType:"source"})),d}_setTileReloadTimer(o,d){o in this._timers&&(clearTimeout(this._timers[o]),delete this._timers[o]);const m=d.getExpiryTimeout();m&&(this._timers[o]=setTimeout(()=>{this._reloadTile(o,"expired"),delete this._timers[o]},m))}_removeTile(o){const d=this._tiles[o];d&&(d.uses--,delete this._tiles[o],this._timers[o]&&(clearTimeout(this._timers[o]),delete this._timers[o]),d.uses>0||(d.hasData()&&d.state!=="reloading"?this._cache.add(d.tileID,d,d.getExpiryTimeout()):(d.aborted=!0,this._abortTile(d),this._unloadTile(d))))}_dataHandler(o){const d=o.sourceDataType;o.dataType==="source"&&d==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&o.dataType==="source"&&d==="content"&&(this.reload(),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0)}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const o in this._tiles)this._removeTile(o);this._cache.reset()}tilesIn(o,d,m){const y=[],x=this.transform;if(!x)return y;const M=m?x.getCameraQueryGeometry(o):o,I=o.map(ee=>x.pointCoordinate(ee,this.terrain)),O=M.map(ee=>x.pointCoordinate(ee,this.terrain)),N=this.getIds();let V=1/0,F=1/0,Z=-1/0,J=-1/0;for(const ee of O)V=Math.min(V,ee.x),F=Math.min(F,ee.y),Z=Math.max(Z,ee.x),J=Math.max(J,ee.y);for(let ee=0;ee<N.length;ee++){const oe=this._tiles[N[ee]];if(oe.holdingForFade())continue;const le=oe.tileID,ce=Math.pow(2,x.zoom-oe.tileID.overscaledZ),he=d*oe.queryPadding*l.X/oe.tileSize/ce,ne=[le.getTilePoint(new l.Z(V,F)),le.getTilePoint(new l.Z(Z,J))];if(ne[0].x-he<l.X&&ne[0].y-he<l.X&&ne[1].x+he>=0&&ne[1].y+he>=0){const me=I.map(xe=>le.getTilePoint(xe)),ge=O.map(xe=>le.getTilePoint(xe));y.push({tile:oe,tileID:le,queryGeometry:me,cameraQueryGeometry:ge,scale:ce})}}return y}getVisibleCoordinates(o){const d=this.getRenderableIds(o).map(m=>this._tiles[m].tileID);for(const m of d)m.posMatrix=this.transform.calculatePosMatrix(m.toUnwrapped());return d}hasTransition(){if(this._source.hasTransition())return!0;if(Wt(this._source.type)){const o=E.now();for(const d in this._tiles)if(this._tiles[d].fadeEndTime>=o)return!0}return!1}setFeatureState(o,d,m){this._state.updateState(o=o||"_geojsonTileLayer",d,m)}removeFeatureState(o,d,m){this._state.removeFeatureState(o=o||"_geojsonTileLayer",d,m)}getFeatureState(o,d){return this._state.getState(o=o||"_geojsonTileLayer",d)}setDependencies(o,d,m){const y=this._tiles[o];y&&y.setDependencies(d,m)}reloadTilesForDependencies(o,d){for(const m in this._tiles)this._tiles[m].hasDependency(o,d)&&this._reloadTile(m,"reloading");this._cache.filter(m=>!m.hasDependency(o,d))}}function vt(v,o){const d=Math.abs(2*v.wrap)-+(v.wrap<0),m=Math.abs(2*o.wrap)-+(o.wrap<0);return v.overscaledZ-o.overscaledZ||m-d||o.canonical.y-v.canonical.y||o.canonical.x-v.canonical.x}function Wt(v){return v==="raster"||v==="image"||v==="video"}Re.maxOverzooming=10,Re.maxUnderzooming=3;class et{constructor(o,d){this.reset(o,d)}reset(o,d){this.points=o||[],this._distances=[0];for(let m=1;m<this.points.length;m++)this._distances[m]=this._distances[m-1]+this.points[m].dist(this.points[m-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(d||0,.5*this.length),this.paddedLength=this.length-2*this.padding}lerp(o){if(this.points.length===1)return this.points[0];o=l.ac(o,0,1);let d=1,m=this._distances[d];const y=o*this.paddedLength+this.padding;for(;m<y&&d<this._distances.length;)m=this._distances[++d];const x=d-1,M=this._distances[x],I=m-M,O=I>0?(y-M)/I:0;return this.points[x].mult(1-O).add(this.points[d].mult(O))}}function Ln(v,o){let d=!0;return v==="always"||v!=="never"&&o!=="never"||(d=!1),d}class Kn{constructor(o,d,m){const y=this.boxCells=[],x=this.circleCells=[];this.xCellCount=Math.ceil(o/m),this.yCellCount=Math.ceil(d/m);for(let M=0;M<this.xCellCount*this.yCellCount;M++)y.push([]),x.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=o,this.height=d,this.xScale=this.xCellCount/o,this.yScale=this.yCellCount/d,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(o,d,m,y,x){this._forEachCell(d,m,y,x,this._insertBoxCell,this.boxUid++),this.boxKeys.push(o),this.bboxes.push(d),this.bboxes.push(m),this.bboxes.push(y),this.bboxes.push(x)}insertCircle(o,d,m,y){this._forEachCell(d-y,m-y,d+y,m+y,this._insertCircleCell,this.circleUid++),this.circleKeys.push(o),this.circles.push(d),this.circles.push(m),this.circles.push(y)}_insertBoxCell(o,d,m,y,x,M){this.boxCells[x].push(M)}_insertCircleCell(o,d,m,y,x,M){this.circleCells[x].push(M)}_query(o,d,m,y,x,M,I){if(m<0||o>this.width||y<0||d>this.height)return[];const O=[];if(o<=0&&d<=0&&this.width<=m&&this.height<=y){if(x)return[{key:null,x1:o,y1:d,x2:m,y2:y}];for(let N=0;N<this.boxKeys.length;N++)O.push({key:this.boxKeys[N],x1:this.bboxes[4*N],y1:this.bboxes[4*N+1],x2:this.bboxes[4*N+2],y2:this.bboxes[4*N+3]});for(let N=0;N<this.circleKeys.length;N++){const V=this.circles[3*N],F=this.circles[3*N+1],Z=this.circles[3*N+2];O.push({key:this.circleKeys[N],x1:V-Z,y1:F-Z,x2:V+Z,y2:F+Z})}}else this._forEachCell(o,d,m,y,this._queryCell,O,{hitTest:x,overlapMode:M,seenUids:{box:{},circle:{}}},I);return O}query(o,d,m,y){return this._query(o,d,m,y,!1,null)}hitTest(o,d,m,y,x,M){return this._query(o,d,m,y,!0,x,M).length>0}hitTestCircle(o,d,m,y,x){const M=o-m,I=o+m,O=d-m,N=d+m;if(I<0||M>this.width||N<0||O>this.height)return!1;const V=[];return this._forEachCell(M,O,I,N,this._queryCellCircle,V,{hitTest:!0,overlapMode:y,circle:{x:o,y:d,radius:m},seenUids:{box:{},circle:{}}},x),V.length>0}_queryCell(o,d,m,y,x,M,I,O){const{seenUids:N,hitTest:V,overlapMode:F}=I,Z=this.boxCells[x];if(Z!==null){const ee=this.bboxes;for(const oe of Z)if(!N.box[oe]){N.box[oe]=!0;const le=4*oe,ce=this.boxKeys[oe];if(o<=ee[le+2]&&d<=ee[le+3]&&m>=ee[le+0]&&y>=ee[le+1]&&(!O||O(ce))&&(!V||!Ln(F,ce.overlapMode))&&(M.push({key:ce,x1:ee[le],y1:ee[le+1],x2:ee[le+2],y2:ee[le+3]}),V))return!0}}const J=this.circleCells[x];if(J!==null){const ee=this.circles;for(const oe of J)if(!N.circle[oe]){N.circle[oe]=!0;const le=3*oe,ce=this.circleKeys[oe];if(this._circleAndRectCollide(ee[le],ee[le+1],ee[le+2],o,d,m,y)&&(!O||O(ce))&&(!V||!Ln(F,ce.overlapMode))){const he=ee[le],ne=ee[le+1],me=ee[le+2];if(M.push({key:ce,x1:he-me,y1:ne-me,x2:he+me,y2:ne+me}),V)return!0}}}return!1}_queryCellCircle(o,d,m,y,x,M,I,O){const{circle:N,seenUids:V,overlapMode:F}=I,Z=this.boxCells[x];if(Z!==null){const ee=this.bboxes;for(const oe of Z)if(!V.box[oe]){V.box[oe]=!0;const le=4*oe,ce=this.boxKeys[oe];if(this._circleAndRectCollide(N.x,N.y,N.radius,ee[le+0],ee[le+1],ee[le+2],ee[le+3])&&(!O||O(ce))&&!Ln(F,ce.overlapMode))return M.push(!0),!0}}const J=this.circleCells[x];if(J!==null){const ee=this.circles;for(const oe of J)if(!V.circle[oe]){V.circle[oe]=!0;const le=3*oe,ce=this.circleKeys[oe];if(this._circlesCollide(ee[le],ee[le+1],ee[le+2],N.x,N.y,N.radius)&&(!O||O(ce))&&!Ln(F,ce.overlapMode))return M.push(!0),!0}}}_forEachCell(o,d,m,y,x,M,I,O){const N=this._convertToXCellCoord(o),V=this._convertToYCellCoord(d),F=this._convertToXCellCoord(m),Z=this._convertToYCellCoord(y);for(let J=N;J<=F;J++)for(let ee=V;ee<=Z;ee++)if(x.call(this,o,d,m,y,this.xCellCount*ee+J,M,I,O))return}_convertToXCellCoord(o){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(o*this.xScale)))}_convertToYCellCoord(o){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(o*this.yScale)))}_circlesCollide(o,d,m,y,x,M){const I=y-o,O=x-d,N=m+M;return N*N>I*I+O*O}_circleAndRectCollide(o,d,m,y,x,M,I){const O=(M-y)/2,N=Math.abs(o-(y+O));if(N>O+m)return!1;const V=(I-x)/2,F=Math.abs(d-(x+V));if(F>V+m)return!1;if(N<=O||F<=V)return!0;const Z=N-O,J=F-V;return Z*Z+J*J<=m*m}}function qi(v,o,d,m,y){const x=l.H();return o?(l.K(x,x,[1/y,1/y,1]),d||l.ad(x,x,m.angle)):l.L(x,m.labelPlaneMatrix,v),x}function fr(v,o,d,m,y){if(o){const x=l.ae(v);return l.K(x,x,[y,y,1]),d||l.ad(x,x,-m.angle),x}return m.glCoordMatrix}function se(v,o,d,m){let y;m?(y=[v,o,m(v,o),1],l.af(y,y,d)):(y=[v,o,0,1],an(y,y,d));const x=y[3];return{point:new l.P(y[0]/x,y[1]/x),signedDistanceFromCamera:x,isOccluded:!1}}function H(v,o){return .5+v/o*.5}function U(v,o){return v.x>=-o[0]&&v.x<=o[0]&&v.y>=-o[1]&&v.y<=o[1]}function X(v,o,d,m,y,x,M,I,O,N,V,F,Z,J,ee){const oe=m?v.textSizeData:v.iconSizeData,le=l.ag(oe,d.transform.zoom),ce=[256/d.width*2+1,256/d.height*2+1],he=m?v.text.dynamicLayoutVertexArray:v.icon.dynamicLayoutVertexArray;he.clear();const ne=v.lineVertexArray,me=m?v.text.placedSymbolArray:v.icon.placedSymbolArray,ge=d.transform.width/d.transform.height;let xe=!1;for(let Be=0;Be<me.length;Be++){const Fe=me.get(Be);if(Fe.hidden||Fe.writingMode===l.ah.vertical&&!xe){kt(Fe.numGlyphs,he);continue}xe=!1;const Qe=se(Fe.anchorX,Fe.anchorY,o,ee);if(!U(Qe.point,ce)){kt(Fe.numGlyphs,he);continue}const st=H(d.transform.cameraToCenterDistance,Qe.signedDistanceFromCamera),Ye=l.ai(oe,le,Fe),Ge=M?Ye/st:Ye*st,mt={getElevation:ee,labelPlaneMatrix:y,lineVertexArray:ne,pitchWithMap:M,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},projection:N,tileAnchorPoint:new l.P(Fe.anchorX,Fe.anchorY),unwrappedTileID:V,width:F,height:Z,translation:J},Bt=fe(mt,Fe,Ge,!1,I,o,x,v.glyphOffsetArray,he,ge,O);xe=Bt.useVertical,(Bt.notEnoughRoom||xe||Bt.needsFlipping&&fe(mt,Fe,Ge,!0,I,o,x,v.glyphOffsetArray,he,ge,O).notEnoughRoom)&&kt(Fe.numGlyphs,he)}m?v.text.dynamicLayoutVertexBuffer.updateData(he):v.icon.dynamicLayoutVertexBuffer.updateData(he)}function ie(v,o,d,m,y,x,M,I){const O=x.glyphStartIndex+x.numGlyphs,N=x.lineStartIndex,V=x.lineStartIndex+x.lineLength,F=o.getoffsetX(x.glyphStartIndex),Z=o.getoffsetX(O-1),J=We(v*F,d,m,y,x.segment,N,V,I,M);if(!J)return null;const ee=We(v*Z,d,m,y,x.segment,N,V,I,M);return ee?I.projectionCache.anyProjectionOccluded?null:{first:J,last:ee}:null}function de(v,o,d,m){return v===l.ah.horizontal&&Math.abs(d.y-o.y)>Math.abs(d.x-o.x)*m?{useVertical:!0}:(v===l.ah.vertical?o.y<d.y:o.x>d.x)?{needsFlipping:!0}:null}function fe(v,o,d,m,y,x,M,I,O,N,V){const F=d/24,Z=o.lineOffsetX*F,J=o.lineOffsetY*F;let ee;if(o.numGlyphs>1){const oe=o.glyphStartIndex+o.numGlyphs,le=o.lineStartIndex,ce=o.lineStartIndex+o.lineLength,he=ie(F,I,Z,J,m,o,V,v);if(!he)return{notEnoughRoom:!0};const ne=se(he.first.point.x,he.first.point.y,M,v.getElevation).point,me=se(he.last.point.x,he.last.point.y,M,v.getElevation).point;if(y&&!m){const ge=de(o.writingMode,ne,me,N);if(ge)return ge}ee=[he.first];for(let ge=o.glyphStartIndex+1;ge<oe-1;ge++)ee.push(We(F*I.getoffsetX(ge),Z,J,m,o.segment,le,ce,v,V));ee.push(he.last)}else{if(y&&!m){const le=se(v.tileAnchorPoint.x,v.tileAnchorPoint.y,x,v.getElevation).point,ce=o.lineStartIndex+o.segment+1,he=new l.P(v.lineVertexArray.getx(ce),v.lineVertexArray.gety(ce)),ne=se(he.x,he.y,x,v.getElevation),me=ne.signedDistanceFromCamera>0?ne.point:function(xe,Be,Fe,Qe,st,Ye){return _e(xe,Be,Fe,1,st,Ye)}(v.tileAnchorPoint,he,le,0,x,v),ge=de(o.writingMode,le,me,N);if(ge)return ge}const oe=We(F*I.getoffsetX(o.glyphStartIndex),Z,J,m,o.segment,o.lineStartIndex,o.lineStartIndex+o.lineLength,v,V);if(!oe||v.projectionCache.anyProjectionOccluded)return{notEnoughRoom:!0};ee=[oe]}for(const oe of ee)l.aj(O,oe.point,oe.angle);return{}}function _e(v,o,d,m,y,x){const M=v.add(v.sub(o)._unit()),I=y!==void 0?se(M.x,M.y,y,x.getElevation).point:Me(M.x,M.y,x).point,O=d.sub(I);return d.add(O._mult(m/O.mag()))}function ue(v,o,d){const m=o.projectionCache;if(m.projections[v])return m.projections[v];const y=new l.P(o.lineVertexArray.getx(v),o.lineVertexArray.gety(v)),x=Me(y.x,y.y,o);if(x.signedDistanceFromCamera>0)return m.projections[v]=x.point,m.anyProjectionOccluded=m.anyProjectionOccluded||x.isOccluded,x.point;const M=v-d.direction;return function(I,O,N,V,F){return _e(I,O,N,V,void 0,F)}(d.distanceFromAnchor===0?o.tileAnchorPoint:new l.P(o.lineVertexArray.getx(M),o.lineVertexArray.gety(M)),y,d.previousVertex,d.absOffsetX-d.distanceFromAnchor+1,o)}function Me(v,o,d){const m=v+d.translation[0],y=o+d.translation[1];let x;return!d.pitchWithMap&&d.projection.useSpecialProjectionForSymbols?(x=d.projection.projectTileCoordinates(m,y,d.unwrappedTileID,d.getElevation),x.point.x=(.5*x.point.x+.5)*d.width,x.point.y=(.5*-x.point.y+.5)*d.height):(x=se(m,y,d.labelPlaneMatrix,d.getElevation),x.isOccluded=!1),x}function ze(v,o,d){return v._unit()._perp()._mult(o*d)}function Ee(v,o,d,m,y,x,M,I,O){if(I.projectionCache.offsets[v])return I.projectionCache.offsets[v];const N=d.add(o);if(v+O.direction<m||v+O.direction>=y)return I.projectionCache.offsets[v]=N,N;const V=ue(v+O.direction,I,O),F=ze(V.sub(d),M,O.direction),Z=d.add(F),J=V.add(F);return I.projectionCache.offsets[v]=l.ak(x,N,Z,J)||N,I.projectionCache.offsets[v]}function We(v,o,d,m,y,x,M,I,O){const N=m?v-o:v+o;let V=N>0?1:-1,F=0;m&&(V*=-1,F=Math.PI),V<0&&(F+=Math.PI);let Z,J=V>0?x+y:x+y+1;I.projectionCache.cachedAnchorPoint?Z=I.projectionCache.cachedAnchorPoint:(Z=Me(I.tileAnchorPoint.x,I.tileAnchorPoint.y,I).point,I.projectionCache.cachedAnchorPoint=Z);let ee,oe,le=Z,ce=Z,he=0,ne=0;const me=Math.abs(N),ge=[];let xe;for(;he+ne<=me;){if(J+=V,J<x||J>=M)return null;he+=ne,ce=le,oe=ee;const Qe={absOffsetX:me,direction:V,distanceFromAnchor:he,previousVertex:ce};if(le=ue(J,I,Qe),d===0)ge.push(ce),xe=le.sub(ce);else{let st;const Ye=le.sub(ce);st=Ye.mag()===0?ze(ue(J+V,I,Qe).sub(le),d,V):ze(Ye,d,V),oe||(oe=ce.add(st)),ee=Ee(J,st,le,x,M,oe,d,I,Qe),ge.push(oe),xe=ee.sub(oe)}ne=xe.mag()}const Be=xe._mult((me-he)/ne)._add(oe||ce),Fe=F+Math.atan2(le.y-ce.y,le.x-ce.x);return ge.push(Be),{point:Be,angle:O?Fe:0,path:ge}}const xt=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function kt(v,o){for(let d=0;d<v;d++){const m=o.length;o.resize(m+4),o.float32.set(xt,3*m)}}function an(v,o,d){const m=o[0],y=o[1];return v[0]=d[0]*m+d[4]*y+d[12],v[1]=d[1]*m+d[5]*y+d[13],v[3]=d[3]*m+d[7]*y+d[15],v}const Lt=100;class ln{constructor(o,d,m=new Kn(o.width+200,o.height+200,25),y=new Kn(o.width+200,o.height+200,25)){this.transform=o,this.mapProjection=d,this.grid=m,this.ignoredGrid=y,this.pitchFactor=Math.cos(o._pitch)*o.cameraToCenterDistance,this.screenRightBoundary=o.width+Lt,this.screenBottomBoundary=o.height+Lt,this.gridRightBoundary=o.width+200,this.gridBottomBoundary=o.height+200,this.perspectiveRatioCutoff=.6}placeCollisionBox(o,d,m,y,x,M,I,O,N,V,F){const Z=o.anchorPointX+O[0],J=o.anchorPointY+O[1],ee=this.projectAndGetPerspectiveRatio(y,Z,J,x,V),oe=m*ee.perspectiveRatio;let le;if(M||I)le=this._projectCollisionBox(o,oe,y,x,M,I,O,ee,V,F);else{const ge=ee.point.x+(F?F.x*oe:0),xe=ee.point.y+(F?F.y*oe:0);le={allPointsOccluded:!1,box:[ge+o.x1*oe,xe+o.y1*oe,ge+o.x2*oe,xe+o.y2*oe]}}const[ce,he,ne,me]=le.box;return this.mapProjection.useSpecialProjectionForSymbols&&(M?le.allPointsOccluded:this.mapProjection.isOccluded(Z,J,x))||ee.perspectiveRatio<this.perspectiveRatioCutoff||!this.isInsideGrid(ce,he,ne,me)||d!=="always"&&this.grid.hitTest(ce,he,ne,me,d,N)?{box:[ce,he,ne,me],placeable:!1,offscreen:!1}:{box:[ce,he,ne,me],placeable:!0,offscreen:this.isOffscreen(ce,he,ne,me)}}placeCollisionCircles(o,d,m,y,x,M,I,O,N,V,F,Z,J,ee,oe,le){const ce=[],he=new l.P(d.anchorX,d.anchorY),ne=this.getPerspectiveRatio(M,he.x,he.y,I,le),me=(F?x/ne:x*ne)/l.ap,ge={getElevation:le,labelPlaneMatrix:O,lineVertexArray:m,pitchWithMap:F,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},projection:this.mapProjection,tileAnchorPoint:he,unwrappedTileID:I,width:this.transform.width,height:this.transform.height,translation:oe},xe=ie(me,y,d.lineOffsetX*me,d.lineOffsetY*me,!1,d,!1,ge);let Be=!1,Fe=!1,Qe=!0;if(xe){const st=.5*J*ne+ee,Ye=new l.P(-100,-100),Ge=new l.P(this.screenRightBoundary,this.screenBottomBoundary),mt=new et,Bt=xe.first,Ke=xe.last;let nt=[];for(let $t=Bt.path.length-1;$t>=1;$t--)nt.push(Bt.path[$t]);for(let $t=1;$t<Ke.path.length;$t++)nt.push(Ke.path[$t]);const Dt=2.5*st;if(N){const $t=this.projectPathToScreenSpace(nt,ge,N);nt=$t.some(Jt=>Jt.signedDistanceFromCamera<=0)?[]:$t.map(Jt=>Jt.point)}let Fn=[];if(nt.length>0){const $t=nt[0].clone(),Jt=nt[0].clone();for(let $n=1;$n<nt.length;$n++)$t.x=Math.min($t.x,nt[$n].x),$t.y=Math.min($t.y,nt[$n].y),Jt.x=Math.max(Jt.x,nt[$n].x),Jt.y=Math.max(Jt.y,nt[$n].y);Fn=$t.x>=Ye.x&&Jt.x<=Ge.x&&$t.y>=Ye.y&&Jt.y<=Ge.y?[nt]:Jt.x<Ye.x||$t.x>Ge.x||Jt.y<Ye.y||$t.y>Ge.y?[]:l.al([nt],Ye.x,Ye.y,Ge.x,Ge.y)}for(const $t of Fn){mt.reset($t,.25*st);let Jt=0;Jt=mt.length<=.5*st?1:Math.ceil(mt.paddedLength/Dt)+1;for(let $n=0;$n<Jt;$n++){const Oi=$n/Math.max(Jt-1,1),io=mt.lerp(Oi),jn=io.x+Lt,rr=io.y+Lt;ce.push(jn,rr,st,0);const Gi=jn-st,Bi=rr-st,Zi=jn+st,Po=rr+st;if(Qe=Qe&&this.isOffscreen(Gi,Bi,Zi,Po),Fe=Fe||this.isInsideGrid(Gi,Bi,Zi,Po),o!=="always"&&this.grid.hitTestCircle(jn,rr,st,o,Z)&&(Be=!0,!V))return{circles:[],offscreen:!1,collisionDetected:Be}}}}return{circles:!V&&Be||!Fe||ne<this.perspectiveRatioCutoff?[]:ce,offscreen:Qe,collisionDetected:Be}}projectPathToScreenSpace(o,d,m){return o.map(y=>se(y.x,y.y,m,d.getElevation))}queryRenderedSymbols(o){if(o.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};const d=[];let m=1/0,y=1/0,x=-1/0,M=-1/0;for(const V of o){const F=new l.P(V.x+Lt,V.y+Lt);m=Math.min(m,F.x),y=Math.min(y,F.y),x=Math.max(x,F.x),M=Math.max(M,F.y),d.push(F)}const I=this.grid.query(m,y,x,M).concat(this.ignoredGrid.query(m,y,x,M)),O={},N={};for(const V of I){const F=V.key;if(O[F.bucketInstanceId]===void 0&&(O[F.bucketInstanceId]={}),O[F.bucketInstanceId][F.featureIndex])continue;const Z=[new l.P(V.x1,V.y1),new l.P(V.x2,V.y1),new l.P(V.x2,V.y2),new l.P(V.x1,V.y2)];l.am(d,Z)&&(O[F.bucketInstanceId][F.featureIndex]=!0,N[F.bucketInstanceId]===void 0&&(N[F.bucketInstanceId]=[]),N[F.bucketInstanceId].push(F.featureIndex))}return N}insertCollisionBox(o,d,m,y,x,M){(m?this.ignoredGrid:this.grid).insert({bucketInstanceId:y,featureIndex:x,collisionGroupID:M,overlapMode:d},o[0],o[1],o[2],o[3])}insertCollisionCircles(o,d,m,y,x,M){const I=m?this.ignoredGrid:this.grid,O={bucketInstanceId:y,featureIndex:x,collisionGroupID:M,overlapMode:d};for(let N=0;N<o.length;N+=4)I.insertCircle(O,o[N],o[N+1],o[N+2])}projectAndGetPerspectiveRatio(o,d,m,y,x){let M;x?(M=[d,m,x(d,m),1],l.af(M,M,o)):(M=[d,m,0,1],an(M,M,o));const I=M[3];return{point:new l.P((M[0]/I+1)/2*this.transform.width+Lt,(-M[1]/I+1)/2*this.transform.height+Lt),perspectiveRatio:.5+this.transform.cameraToCenterDistance/I*.5,isOccluded:!1,signedDistanceFromCamera:I}}getPerspectiveRatio(o,d,m,y,x){const M=this.mapProjection.useSpecialProjectionForSymbols?this.mapProjection.projectTileCoordinates(d,m,y,x):se(d,m,o,x);return .5+this.transform.cameraToCenterDistance/M.signedDistanceFromCamera*.5}isOffscreen(o,d,m,y){return m<Lt||o>=this.screenRightBoundary||y<Lt||d>this.screenBottomBoundary}isInsideGrid(o,d,m,y){return m>=0&&o<this.gridRightBoundary&&y>=0&&d<this.gridBottomBoundary}getViewportMatrix(){const o=l.an([]);return l.J(o,o,[-100,-100,0]),o}_projectCollisionBox(o,d,m,y,x,M,I,O,N,V){let F=new l.P(1,0),Z=new l.P(0,1);const J=new l.P(o.anchorPointX+I[0],o.anchorPointY+I[1]);if(M&&!x){const Qe=this.projectAndGetPerspectiveRatio(m,J.x+1,J.y,y,N).point.sub(O.point).unit(),st=Math.atan(Qe.y/Qe.x)+(Qe.x<0?Math.PI:0),Ye=Math.sin(st),Ge=Math.cos(st);F=new l.P(Ge,Ye),Z=new l.P(-Ye,Ge)}else if(!M&&x){const Qe=-this.transform.angle,st=Math.sin(Qe),Ye=Math.cos(Qe);F=new l.P(Ye,st),Z=new l.P(-st,Ye)}let ee=O.point,oe=d;if(x){ee=J;const Qe=this.transform.zoom-Math.floor(this.transform.zoom);oe=Math.pow(2,-Qe),oe*=this.mapProjection.getPitchedTextCorrection(this.transform,J,y),V||(oe*=l.ac(.5+O.signedDistanceFromCamera/this.transform.cameraToCenterDistance*.5,0,4))}V&&(ee=ee.add(F.mult(V.x*oe)).add(Z.mult(V.y*oe)));const le=o.x1*oe,ce=o.x2*oe,he=(le+ce)/2,ne=o.y1*oe,me=o.y2*oe,ge=(ne+me)/2,xe=[{offsetX:le,offsetY:ne},{offsetX:he,offsetY:ne},{offsetX:ce,offsetY:ne},{offsetX:ce,offsetY:ge},{offsetX:ce,offsetY:me},{offsetX:he,offsetY:me},{offsetX:le,offsetY:me},{offsetX:le,offsetY:ge}];let Be=[];for(const{offsetX:Qe,offsetY:st}of xe)Be.push(new l.P(ee.x+F.x*Qe+Z.x*st,ee.y+F.y*Qe+Z.y*st));let Fe=!1;if(x){const Qe=Be.map(st=>this.projectAndGetPerspectiveRatio(m,st.x,st.y,y,N));Fe=Qe.some(st=>!st.isOccluded),Be=Qe.map(st=>st.point)}else Fe=!0;return{box:l.ao(Be),allPointsOccluded:!Fe}}}function Kt(v,o,d){return o*(l.X/(v.tileSize*Math.pow(2,d-v.tileID.overscaledZ)))}class oi{constructor(o,d,m,y){this.opacity=o?Math.max(0,Math.min(1,o.opacity+(o.placed?d:-d))):y&&m?1:0,this.placed=m}isHidden(){return this.opacity===0&&!this.placed}}class Zn{constructor(o,d,m,y,x){this.text=new oi(o?o.text:null,d,m,x),this.icon=new oi(o?o.icon:null,d,y,x)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class Ut{constructor(o,d,m){this.text=o,this.icon=d,this.skipFade=m}}class wn{constructor(){this.invProjMatrix=l.H(),this.viewportMatrix=l.H(),this.circles=[]}}class qn{constructor(o,d,m,y,x){this.bucketInstanceId=o,this.featureIndex=d,this.sourceLayerIndex=m,this.bucketIndex=y,this.tileID=x}}class mi{constructor(o){this.crossSourceCollisions=o,this.maxGroupID=0,this.collisionGroups={}}get(o){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[o]){const d=++this.maxGroupID;this.collisionGroups[o]={ID:d,predicate:m=>m.collisionGroupID===d}}return this.collisionGroups[o]}}function ki(v,o,d,m,y){const{horizontalAlign:x,verticalAlign:M}=l.au(v);return new l.P(-(x-.5)*o+m[0]*y,-(M-.5)*d+m[1]*y)}class Wi{constructor(o,d,m,y,x,M){this.transform=o.clone(),this.terrain=m,this.collisionIndex=new ln(this.transform,d),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=y,this.retainedQueryData={},this.collisionGroups=new mi(x),this.collisionCircleArrays={},this.collisionBoxArrays=new Map,this.prevPlacement=M,M&&(M.prevPlacement=void 0),this.placedOrientations={}}_getTerrainElevationFunc(o){const d=this.terrain;return d?(m,y)=>d.getElevation(o,m,y):null}getBucketParts(o,d,m,y){const x=m.getBucket(d),M=m.latestFeatureIndex;if(!x||!M||d.id!==x.layerIds[0])return;const I=m.collisionBoxArray,O=x.layers[0].layout,N=x.layers[0].paint,V=Math.pow(2,this.transform.zoom-m.tileID.overscaledZ),F=m.tileSize/l.X,Z=m.tileID.toUnwrapped(),J=this.transform.calculatePosMatrix(Z),ee=O.get("text-pitch-alignment")==="map",oe=O.get("text-rotation-alignment")==="map",le=Kt(m,1,this.transform.zoom),ce=this.collisionIndex.mapProjection.translatePosition(this.transform,m,N.get("text-translate"),N.get("text-translate-anchor")),he=this.collisionIndex.mapProjection.translatePosition(this.transform,m,N.get("icon-translate"),N.get("icon-translate-anchor")),ne=qi(J,ee,oe,this.transform,le);let me=null;if(ee){const xe=fr(J,ee,oe,this.transform,le);me=l.L([],this.transform.labelPlaneMatrix,xe)}this.retainedQueryData[x.bucketInstanceId]=new qn(x.bucketInstanceId,M,x.sourceLayerIndex,x.index,m.tileID);const ge={bucket:x,layout:O,translationText:ce,translationIcon:he,posMatrix:J,unwrappedTileID:Z,textLabelPlaneMatrix:ne,labelToScreenMatrix:me,scale:V,textPixelRatio:F,holdingForFade:m.holdingForFade(),collisionBoxArray:I,partiallyEvaluatedTextSize:l.ag(x.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(x.sourceID)};if(y)for(const xe of x.sortKeyRanges){const{sortKey:Be,symbolInstanceStart:Fe,symbolInstanceEnd:Qe}=xe;o.push({sortKey:Be,symbolInstanceStart:Fe,symbolInstanceEnd:Qe,parameters:ge})}else o.push({symbolInstanceStart:0,symbolInstanceEnd:x.symbolInstances.length,parameters:ge})}attemptAnchorPlacement(o,d,m,y,x,M,I,O,N,V,F,Z,J,ee,oe,le,ce,he,ne){const me=l.aq[o.textAnchor],ge=[o.textOffset0,o.textOffset1],xe=ki(me,m,y,ge,x),Be=this.collisionIndex.placeCollisionBox(d,Z,O,N,V,I,M,le,F.predicate,ne,xe);if((!he||this.collisionIndex.placeCollisionBox(he,Z,O,N,V,I,M,ce,F.predicate,ne,xe).placeable)&&Be.placeable){let Fe;if(this.prevPlacement&&this.prevPlacement.variableOffsets[J.crossTileID]&&this.prevPlacement.placements[J.crossTileID]&&this.prevPlacement.placements[J.crossTileID].text&&(Fe=this.prevPlacement.variableOffsets[J.crossTileID].anchor),J.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[J.crossTileID]={textOffset:ge,width:m,height:y,anchor:me,textBoxScale:x,prevAnchor:Fe},this.markUsedJustification(ee,me,J,oe),ee.allowVerticalPlacement&&(this.markUsedOrientation(ee,oe,J),this.placedOrientations[J.crossTileID]=oe),{shift:xe,placedGlyphBoxes:Be}}}placeLayerBucketPart(o,d,m){const{bucket:y,layout:x,translationText:M,translationIcon:I,posMatrix:O,unwrappedTileID:N,textLabelPlaneMatrix:V,labelToScreenMatrix:F,textPixelRatio:Z,holdingForFade:J,collisionBoxArray:ee,partiallyEvaluatedTextSize:oe,collisionGroup:le}=o.parameters,ce=x.get("text-optional"),he=x.get("icon-optional"),ne=l.ar(x,"text-overlap","text-allow-overlap"),me=ne==="always",ge=l.ar(x,"icon-overlap","icon-allow-overlap"),xe=ge==="always",Be=x.get("text-rotation-alignment")==="map",Fe=x.get("text-pitch-alignment")==="map",Qe=x.get("icon-text-fit")!=="none",st=x.get("symbol-z-order")==="viewport-y",Ye=me&&(xe||!y.hasIconData()||he),Ge=xe&&(me||!y.hasTextData()||ce);!y.collisionArrays&&ee&&y.deserializeCollisionBoxes(ee);const mt=this._getTerrainElevationFunc(this.retainedQueryData[y.bucketInstanceId].tileID),Bt=(Ke,nt,Dt)=>{var Fn,$t;if(d[Ke.crossTileID])return;if(J)return void(this.placements[Ke.crossTileID]=new Ut(!1,!1,!1));let Jt=!1,$n=!1,Oi=!0,io=null,jn={box:null,placeable:!1,offscreen:null},rr={box:null,placeable:!1,offscreen:null},Gi=null,Bi=null,Zi=null,Po=0,Ka=0,Du=0;nt.textFeatureIndex?Po=nt.textFeatureIndex:Ke.useRuntimeCollisionCircles&&(Po=Ke.featureIndex),nt.verticalTextFeatureIndex&&(Ka=nt.verticalTextFeatureIndex);const Ja=nt.textBox;if(Ja){const $r=Si=>{let zi=l.ah.horizontal;if(y.allowVerticalPlacement&&!Si&&this.prevPlacement){const xr=this.prevPlacement.placedOrientations[Ke.crossTileID];xr&&(this.placedOrientations[Ke.crossTileID]=xr,zi=xr,this.markUsedOrientation(y,zi,Ke))}return zi},jr=(Si,zi)=>{if(y.allowVerticalPlacement&&Ke.numVerticalGlyphVertices>0&&nt.verticalTextBox){for(const xr of y.writingModes)if(xr===l.ah.vertical?(jn=zi(),rr=jn):jn=Si(),jn&&jn.placeable)break}else jn=Si()},fs=Ke.textAnchorOffsetStartIndex,ro=Ke.textAnchorOffsetEndIndex;if(ro===fs){const Si=(zi,xr)=>{const tn=this.collisionIndex.placeCollisionBox(zi,ne,Z,O,N,Fe,Be,M,le.predicate,mt);return tn&&tn.placeable&&(this.markUsedOrientation(y,xr,Ke),this.placedOrientations[Ke.crossTileID]=xr),tn};jr(()=>Si(Ja,l.ah.horizontal),()=>{const zi=nt.verticalTextBox;return y.allowVerticalPlacement&&Ke.numVerticalGlyphVertices>0&&zi?Si(zi,l.ah.vertical):{box:null,offscreen:null}}),$r(jn&&jn.placeable)}else{let Si=l.aq[($t=(Fn=this.prevPlacement)===null||Fn===void 0?void 0:Fn.variableOffsets[Ke.crossTileID])===null||$t===void 0?void 0:$t.anchor];const zi=(tn,Js,Qa)=>{const el=tn.x2-tn.x1,Pm=tn.y2-tn.y1,I_=Ke.textBoxScale,Dm=Qe&&ge==="never"?Js:null;let ms=null,Om=ne==="never"?1:2,Bu="never";Si&&Om++;for(let nc=0;nc<Om;nc++){for(let zu=fs;zu<ro;zu++){const Nu=y.textAnchorOffsets.get(zu);if(Si&&Nu.textAnchor!==Si)continue;const tl=this.attemptAnchorPlacement(Nu,tn,el,Pm,I_,Be,Fe,Z,O,N,le,Bu,Ke,y,Qa,M,I,Dm,mt);if(tl&&(ms=tl.placedGlyphBoxes,ms&&ms.placeable))return Jt=!0,io=tl.shift,ms}Si?Si=null:Bu=ne}return m&&!ms&&(ms={box:this.collisionIndex.placeCollisionBox(Ja,"always",Z,O,N,Fe,Be,M,le.predicate,mt,new l.P(0,0)).box,offscreen:!1,placeable:!1}),ms};jr(()=>zi(Ja,nt.iconBox,l.ah.horizontal),()=>{const tn=nt.verticalTextBox;return y.allowVerticalPlacement&&(!jn||!jn.placeable)&&Ke.numVerticalGlyphVertices>0&&tn?zi(tn,nt.verticalIconBox,l.ah.vertical):{box:null,occluded:!0,offscreen:null}}),jn&&(Jt=jn.placeable,Oi=jn.offscreen);const xr=$r(jn&&jn.placeable);if(!Jt&&this.prevPlacement){const tn=this.prevPlacement.variableOffsets[Ke.crossTileID];tn&&(this.variableOffsets[Ke.crossTileID]=tn,this.markUsedJustification(y,tn.anchor,Ke,xr))}}}if(Gi=jn,Jt=Gi&&Gi.placeable,Oi=Gi&&Gi.offscreen,Ke.useRuntimeCollisionCircles){const $r=y.text.placedSymbolArray.get(Ke.centerJustifiedTextSymbolIndex),jr=l.ai(y.textSizeData,oe,$r),fs=x.get("text-padding");Bi=this.collisionIndex.placeCollisionCircles(ne,$r,y.lineVertexArray,y.glyphOffsetArray,jr,O,N,V,F,m,Fe,le.predicate,Ke.collisionCircleDiameter,fs,M,mt),Bi.circles.length&&Bi.collisionDetected&&!m&&l.w("Collisions detected, but collision boxes are not shown"),Jt=me||Bi.circles.length>0&&!Bi.collisionDetected,Oi=Oi&&Bi.offscreen}if(nt.iconFeatureIndex&&(Du=nt.iconFeatureIndex),nt.iconBox){const $r=jr=>this.collisionIndex.placeCollisionBox(jr,ge,Z,O,N,Fe,Be,I,le.predicate,mt,Qe&&io?io:void 0);rr&&rr.placeable&&nt.verticalIconBox?(Zi=$r(nt.verticalIconBox),$n=Zi.placeable):(Zi=$r(nt.iconBox),$n=Zi.placeable),Oi=Oi&&Zi.offscreen}const Fr=ce||Ke.numHorizontalGlyphVertices===0&&Ke.numVerticalGlyphVertices===0,Ou=he||Ke.numIconVertices===0;Fr||Ou?Ou?Fr||($n=$n&&Jt):Jt=$n&&Jt:$n=Jt=$n&&Jt;const Vd=$n&&Zi.placeable;if(Jt&&Gi.placeable&&this.collisionIndex.insertCollisionBox(Gi.box,ne,x.get("text-ignore-placement"),y.bucketInstanceId,rr&&rr.placeable&&Ka?Ka:Po,le.ID),Vd&&this.collisionIndex.insertCollisionBox(Zi.box,ge,x.get("icon-ignore-placement"),y.bucketInstanceId,Du,le.ID),Bi&&Jt&&this.collisionIndex.insertCollisionCircles(Bi.circles,ne,x.get("text-ignore-placement"),y.bucketInstanceId,Po,le.ID),m&&this.storeCollisionData(y.bucketInstanceId,Dt,nt,Gi,Zi,Bi),Ke.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");if(y.bucketInstanceId===0)throw new Error("bucket.bucketInstanceId can't be 0");this.placements[Ke.crossTileID]=new Ut(Jt||Ye,$n||Ge,Oi||y.justReloaded),d[Ke.crossTileID]=!0};if(st){if(o.symbolInstanceStart!==0)throw new Error("bucket.bucketInstanceId should be 0");const Ke=y.getSortedSymbolIndexes(this.transform.angle);for(let nt=Ke.length-1;nt>=0;--nt){const Dt=Ke[nt];Bt(y.symbolInstances.get(Dt),y.collisionArrays[Dt],Dt)}}else for(let Ke=o.symbolInstanceStart;Ke<o.symbolInstanceEnd;Ke++)Bt(y.symbolInstances.get(Ke),y.collisionArrays[Ke],Ke);if(m&&y.bucketInstanceId in this.collisionCircleArrays){const Ke=this.collisionCircleArrays[y.bucketInstanceId];l.as(Ke.invProjMatrix,O),Ke.viewportMatrix=this.collisionIndex.getViewportMatrix()}y.justReloaded=!1}storeCollisionData(o,d,m,y,x,M){if(m.textBox||m.iconBox){let I,O;this.collisionBoxArrays.has(o)?I=this.collisionBoxArrays.get(o):(I=new Map,this.collisionBoxArrays.set(o,I)),I.has(d)?O=I.get(d):(O={text:null,icon:null},I.set(d,O)),m.textBox&&(O.text=y.box),m.iconBox&&(O.icon=x.box)}if(M){let I=this.collisionCircleArrays[o];I===void 0&&(I=this.collisionCircleArrays[o]=new wn);for(let O=0;O<M.circles.length;O+=4)I.circles.push(M.circles[O+0]),I.circles.push(M.circles[O+1]),I.circles.push(M.circles[O+2]),I.circles.push(M.collisionDetected?1:0)}}markUsedJustification(o,d,m,y){let x;x=y===l.ah.vertical?m.verticalPlacedTextSymbolIndex:{left:m.leftJustifiedTextSymbolIndex,center:m.centerJustifiedTextSymbolIndex,right:m.rightJustifiedTextSymbolIndex}[l.at(d)];const M=[m.leftJustifiedTextSymbolIndex,m.centerJustifiedTextSymbolIndex,m.rightJustifiedTextSymbolIndex,m.verticalPlacedTextSymbolIndex];for(const I of M)I>=0&&(o.text.placedSymbolArray.get(I).crossTileID=x>=0&&I!==x?0:m.crossTileID)}markUsedOrientation(o,d,m){const y=d===l.ah.horizontal||d===l.ah.horizontalOnly?d:0,x=d===l.ah.vertical?d:0,M=[m.leftJustifiedTextSymbolIndex,m.centerJustifiedTextSymbolIndex,m.rightJustifiedTextSymbolIndex];for(const I of M)o.text.placedSymbolArray.get(I).placedOrientation=y;m.verticalPlacedTextSymbolIndex&&(o.text.placedSymbolArray.get(m.verticalPlacedTextSymbolIndex).placedOrientation=x)}commit(o){this.commitTime=o,this.zoomAtLastRecencyCheck=this.transform.zoom;const d=this.prevPlacement;let m=!1;this.prevZoomAdjustment=d?d.zoomAdjustment(this.transform.zoom):0;const y=d?d.symbolFadeChange(o):1,x=d?d.opacities:{},M=d?d.variableOffsets:{},I=d?d.placedOrientations:{};for(const O in this.placements){const N=this.placements[O],V=x[O];V?(this.opacities[O]=new Zn(V,y,N.text,N.icon),m=m||N.text!==V.text.placed||N.icon!==V.icon.placed):(this.opacities[O]=new Zn(null,y,N.text,N.icon,N.skipFade),m=m||N.text||N.icon)}for(const O in x){const N=x[O];if(!this.opacities[O]){const V=new Zn(N,y,!1,!1);V.isHidden()||(this.opacities[O]=V,m=m||N.text.placed||N.icon.placed)}}for(const O in M)this.variableOffsets[O]||!this.opacities[O]||this.opacities[O].isHidden()||(this.variableOffsets[O]=M[O]);for(const O in I)this.placedOrientations[O]||!this.opacities[O]||this.opacities[O].isHidden()||(this.placedOrientations[O]=I[O]);if(d&&d.lastPlacementChangeTime===void 0)throw new Error("Last placement time for previous placement is not defined");m?this.lastPlacementChangeTime=o:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=d?d.lastPlacementChangeTime:o)}updateLayerOpacities(o,d){const m={};for(const y of d){const x=y.getBucket(o);x&&y.latestFeatureIndex&&o.id===x.layerIds[0]&&this.updateBucketOpacities(x,y.tileID,m,y.collisionBoxArray)}}updateBucketOpacities(o,d,m,y){o.hasTextData()&&(o.text.opacityVertexArray.clear(),o.text.hasVisibleVertices=!1),o.hasIconData()&&(o.icon.opacityVertexArray.clear(),o.icon.hasVisibleVertices=!1),o.hasIconCollisionBoxData()&&o.iconCollisionBox.collisionVertexArray.clear(),o.hasTextCollisionBoxData()&&o.textCollisionBox.collisionVertexArray.clear();const x=o.layers[0],M=x.layout,I=new Zn(null,0,!1,!1,!0),O=M.get("text-allow-overlap"),N=M.get("icon-allow-overlap"),V=x._unevaluatedLayout.hasValue("text-variable-anchor")||x._unevaluatedLayout.hasValue("text-variable-anchor-offset"),F=M.get("text-rotation-alignment")==="map",Z=M.get("text-pitch-alignment")==="map",J=M.get("icon-text-fit")!=="none",ee=new Zn(null,0,O&&(N||!o.hasIconData()||M.get("icon-optional")),N&&(O||!o.hasTextData()||M.get("text-optional")),!0);!o.collisionArrays&&y&&(o.hasIconCollisionBoxData()||o.hasTextCollisionBoxData())&&o.deserializeCollisionBoxes(y);const oe=(ce,he,ne)=>{for(let me=0;me<he/4;me++)ce.opacityVertexArray.emplaceBack(ne);ce.hasVisibleVertices=ce.hasVisibleVertices||ne!==Ia},le=this.collisionBoxArrays.get(o.bucketInstanceId);for(let ce=0;ce<o.symbolInstances.length;ce++){const he=o.symbolInstances.get(ce),{numHorizontalGlyphVertices:ne,numVerticalGlyphVertices:me,crossTileID:ge}=he;let xe=this.opacities[ge];m[ge]?xe=I:xe||(xe=ee,this.opacities[ge]=xe),m[ge]=!0;const Be=he.numIconVertices>0,Fe=this.placedOrientations[he.crossTileID],Qe=Fe===l.ah.vertical,st=Fe===l.ah.horizontal||Fe===l.ah.horizontalOnly;if(ne>0||me>0){const Ge=yr(xe.text);oe(o.text,ne,Qe?Ia:Ge),oe(o.text,me,st?Ia:Ge);const mt=xe.text.isHidden();[he.rightJustifiedTextSymbolIndex,he.centerJustifiedTextSymbolIndex,he.leftJustifiedTextSymbolIndex].forEach(nt=>{nt>=0&&(o.text.placedSymbolArray.get(nt).hidden=mt||Qe?1:0)}),he.verticalPlacedTextSymbolIndex>=0&&(o.text.placedSymbolArray.get(he.verticalPlacedTextSymbolIndex).hidden=mt||st?1:0);const Bt=this.variableOffsets[he.crossTileID];Bt&&this.markUsedJustification(o,Bt.anchor,he,Fe);const Ke=this.placedOrientations[he.crossTileID];Ke&&(this.markUsedJustification(o,"left",he,Ke),this.markUsedOrientation(o,Ke,he))}if(Be){const Ge=yr(xe.icon),mt=!(J&&he.verticalPlacedIconSymbolIndex&&Qe);he.placedIconSymbolIndex>=0&&(oe(o.icon,he.numIconVertices,mt?Ge:Ia),o.icon.placedSymbolArray.get(he.placedIconSymbolIndex).hidden=xe.icon.isHidden()),he.verticalPlacedIconSymbolIndex>=0&&(oe(o.icon,he.numVerticalIconVertices,mt?Ia:Ge),o.icon.placedSymbolArray.get(he.verticalPlacedIconSymbolIndex).hidden=xe.icon.isHidden())}const Ye=le&&le.has(ce)?le.get(ce):{text:null,icon:null};if(o.hasIconCollisionBoxData()||o.hasTextCollisionBoxData()){const Ge=o.collisionArrays[ce];if(Ge){let mt=new l.P(0,0);if(Ge.textBox||Ge.verticalTextBox){let Bt=!0;if(V){const Ke=this.variableOffsets[ge];Ke?(mt=ki(Ke.anchor,Ke.width,Ke.height,Ke.textOffset,Ke.textBoxScale),F&&mt._rotate(Z?this.transform.angle:-this.transform.angle)):Bt=!1}if(Ge.textBox||Ge.verticalTextBox){let Ke;Ge.textBox&&(Ke=Qe),Ge.verticalTextBox&&(Ke=st),Aa(o.textCollisionBox.collisionVertexArray,xe.text.placed,!Bt||Ke,Ye.text,mt.x,mt.y)}}if(Ge.iconBox||Ge.verticalIconBox){const Bt=!!(!st&&Ge.verticalIconBox);let Ke;Ge.iconBox&&(Ke=Bt),Ge.verticalIconBox&&(Ke=!Bt),Aa(o.iconCollisionBox.collisionVertexArray,xe.icon.placed,Ke,Ye.icon,J?mt.x:0,J?mt.y:0)}}}}if(o.sortFeatures(this.transform.angle),this.retainedQueryData[o.bucketInstanceId]&&(this.retainedQueryData[o.bucketInstanceId].featureSortOrder=o.featureSortOrder),o.hasTextData()&&o.text.opacityVertexBuffer&&o.text.opacityVertexBuffer.updateData(o.text.opacityVertexArray),o.hasIconData()&&o.icon.opacityVertexBuffer&&o.icon.opacityVertexBuffer.updateData(o.icon.opacityVertexArray),o.hasIconCollisionBoxData()&&o.iconCollisionBox.collisionVertexBuffer&&o.iconCollisionBox.collisionVertexBuffer.updateData(o.iconCollisionBox.collisionVertexArray),o.hasTextCollisionBoxData()&&o.textCollisionBox.collisionVertexBuffer&&o.textCollisionBox.collisionVertexBuffer.updateData(o.textCollisionBox.collisionVertexArray),o.text.opacityVertexArray.length!==o.text.layoutVertexArray.length/4)throw new Error(`bucket.text.opacityVertexArray.length (= ${o.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${o.text.layoutVertexArray.length}) / 4`);if(o.icon.opacityVertexArray.length!==o.icon.layoutVertexArray.length/4)throw new Error(`bucket.icon.opacityVertexArray.length (= ${o.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${o.icon.layoutVertexArray.length}) / 4`);if(o.bucketInstanceId in this.collisionCircleArrays){const ce=this.collisionCircleArrays[o.bucketInstanceId];o.placementInvProjMatrix=ce.invProjMatrix,o.placementViewportMatrix=ce.viewportMatrix,o.collisionCircleArray=ce.circles,delete this.collisionCircleArrays[o.bucketInstanceId]}}symbolFadeChange(o){return this.fadeDuration===0?1:(o-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(o){return Math.max(0,(this.transform.zoom-o)/1.5)}hasTransitions(o){return this.stale||o-this.lastPlacementChangeTime<this.fadeDuration}stillRecent(o,d){const m=this.zoomAtLastRecencyCheck===d?1-this.zoomAdjustment(d):1;return this.zoomAtLastRecencyCheck=d,this.commitTime+this.fadeDuration*m>o}setStale(){this.stale=!0}}function Aa(v,o,d,m,y,x){m&&m.length!==0||(m=[0,0,0,0]);const M=m[0]-Lt,I=m[1]-Lt,O=m[2]-Lt,N=m[3]-Lt;v.emplaceBack(o?1:0,d?1:0,y||0,x||0,M,I),v.emplaceBack(o?1:0,d?1:0,y||0,x||0,O,I),v.emplaceBack(o?1:0,d?1:0,y||0,x||0,O,N),v.emplaceBack(o?1:0,d?1:0,y||0,x||0,M,N)}const kn=Math.pow(2,25),Xh=Math.pow(2,24),Kh=Math.pow(2,17),mr=Math.pow(2,16),gr=Math.pow(2,9),r_=Math.pow(2,8),Nr=Math.pow(2,1);function yr(v){if(v.opacity===0&&!v.placed)return 0;if(v.opacity===1&&v.placed)return 4294967295;const o=v.placed?1:0,d=Math.floor(127*v.opacity);return d*kn+o*Xh+d*Kh+o*mr+d*gr+o*r_+d*Nr+o}const Ia=0;function Fs(){return{isOccluded:(v,o,d)=>!1,getPitchedTextCorrection:(v,o,d)=>1,get useSpecialProjectionForSymbols(){return!1},projectTileCoordinates(v,o,d,m){throw new Error("Not implemented.")},translatePosition:(v,o,d,m)=>function(y,x,M,I,O=!1){if(!M[0]&&!M[1])return[0,0];const N=O?I==="map"?y.angle:0:I==="viewport"?-y.angle:0;if(N){const V=Math.sin(N),F=Math.cos(N);M=[M[0]*F-M[1]*V,M[0]*V+M[1]*F]}return[O?M[0]:Kt(x,M[0],y.zoom),O?M[1]:Kt(x,M[1],y.zoom)]}(v,o,d,m),getCircleRadiusCorrection:v=>1}}class si{constructor(o){this._sortAcrossTiles=o.layout.get("symbol-z-order")!=="viewport-y"&&!o.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(o,d,m,y,x){const M=this._bucketParts;for(;this._currentTileIndex<o.length;)if(d.getBucketParts(M,y,o[this._currentTileIndex],this._sortAcrossTiles),this._currentTileIndex++,x())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,M.sort((I,O)=>I.sortKey-O.sortKey));this._currentPartIndex<M.length;)if(d.placeLayerBucketPart(M[this._currentPartIndex],this._seenCrossTileIDs,m),this._currentPartIndex++,x())return!0;return!1}}class Ll{constructor(o,d,m,y,x,M,I,O){this.placement=new Wi(o,Fs(),d,M,I,O),this._currentPlacementIndex=m.length-1,this._forceFullPlacement=y,this._showCollisionBoxes=x,this._done=!1}isDone(){return this._done}continuePlacement(o,d,m){const y=E.now(),x=()=>!this._forceFullPlacement&&E.now()-y>2;for(;this._currentPlacementIndex>=0;){const M=d[o[this._currentPlacementIndex]],I=this.placement.collisionIndex.transform.zoom;if(M.type==="symbol"&&(!M.minzoom||M.minzoom<=I)&&(!M.maxzoom||M.maxzoom>I)){if(this._inProgressLayer||(this._inProgressLayer=new si(M)),this._inProgressLayer.continuePlacement(m[M.source],this.placement,this._showCollisionBoxes,M,x))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(o){return this.placement.commit(o),this.placement}}const Jr=512/l.X/2;class ni{constructor(o,d,m){this.tileID=o,this.bucketInstanceId=m,this._symbolsByKey={};const y=new Map;for(let x=0;x<d.length;x++){const M=d.get(x),I=M.key,O=y.get(I);O?O.push(M):y.set(I,[M])}for(const[x,M]of y){const I={positions:M.map(O=>({x:Math.floor(O.anchorX*Jr),y:Math.floor(O.anchorY*Jr)})),crossTileIDs:M.map(O=>O.crossTileID)};if(I.positions.length>128){const O=new l.av(I.positions.length,16,Uint16Array);for(const{x:N,y:V}of I.positions)O.add(N,V);O.finish(),delete I.positions,I.index=O}this._symbolsByKey[x]=I}}getScaledCoordinates(o,d){const{x:m,y,z:x}=this.tileID.canonical,{x:M,y:I,z:O}=d.canonical,N=Jr/Math.pow(2,O-x),V=(I*l.X+o.anchorY)*N,F=y*l.X*Jr;return{x:Math.floor((M*l.X+o.anchorX)*N-m*l.X*Jr),y:Math.floor(V-F)}}findMatches(o,d,m){const y=this.tileID.canonical.z<d.canonical.z?1:Math.pow(2,this.tileID.canonical.z-d.canonical.z);for(let x=0;x<o.length;x++){const M=o.get(x);if(M.crossTileID)continue;const I=this._symbolsByKey[M.key];if(!I)continue;const O=this.getScaledCoordinates(M,d);if(I.index){const N=I.index.range(O.x-y,O.y-y,O.x+y,O.y+y).sort();for(const V of N){const F=I.crossTileIDs[V];if(!m[F]){m[F]=!0,M.crossTileID=F;break}}}else if(I.positions)for(let N=0;N<I.positions.length;N++){const V=I.positions[N],F=I.crossTileIDs[N];if(Math.abs(V.x-O.x)<=y&&Math.abs(V.y-O.y)<=y&&!m[F]){m[F]=!0,M.crossTileID=F;break}}}}getCrossTileIDsLists(){return Object.values(this._symbolsByKey).map(({crossTileIDs:o})=>o)}}class tu{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class Qr{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(o){const d=Math.round((o-this.lng)/360);if(d!==0)for(const m in this.indexes){const y=this.indexes[m],x={};for(const M in y){const I=y[M];I.tileID=I.tileID.unwrapTo(I.tileID.wrap+d),x[I.tileID.key]=I}this.indexes[m]=x}this.lng=o}addBucket(o,d,m){if(this.indexes[o.overscaledZ]&&this.indexes[o.overscaledZ][o.key]){if(this.indexes[o.overscaledZ][o.key].bucketInstanceId===d.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(o.overscaledZ,this.indexes[o.overscaledZ][o.key])}for(let x=0;x<d.symbolInstances.length;x++)d.symbolInstances.get(x).crossTileID=0;this.usedCrossTileIDs[o.overscaledZ]||(this.usedCrossTileIDs[o.overscaledZ]={});const y=this.usedCrossTileIDs[o.overscaledZ];for(const x in this.indexes){const M=this.indexes[x];if(Number(x)>o.overscaledZ)for(const I in M){const O=M[I];O.tileID.isChildOf(o)&&O.findMatches(d.symbolInstances,o,y)}else{const I=M[o.scaledTo(Number(x)).key];I&&I.findMatches(d.symbolInstances,o,y)}}for(let x=0;x<d.symbolInstances.length;x++){const M=d.symbolInstances.get(x);M.crossTileID||(M.crossTileID=m.generate(),y[M.crossTileID]=!0)}return this.indexes[o.overscaledZ]===void 0&&(this.indexes[o.overscaledZ]={}),this.indexes[o.overscaledZ][o.key]=new ni(o,d.symbolInstances,d.bucketInstanceId),!0}removeBucketCrossTileIDs(o,d){for(const m of d.getCrossTileIDsLists())for(const y of m)delete this.usedCrossTileIDs[o][y]}removeStaleBuckets(o){let d=!1;for(const m in this.indexes){const y=this.indexes[m];for(const x in y)o[y[x].bucketInstanceId]||(this.removeBucketCrossTileIDs(m,y[x]),delete y[x],d=!0)}return d}}class Jh{constructor(){this.layerIndexes={},this.crossTileIDs=new tu,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(o,d,m){let y=this.layerIndexes[o.id];y===void 0&&(y=this.layerIndexes[o.id]=new Qr);let x=!1;const M={};y.handleWrapJump(m);for(const I of d){const O=I.getBucket(o);O&&o.id===O.layerIds[0]&&(O.bucketInstanceId||(O.bucketInstanceId=++this.maxBucketInstanceId),y.addBucket(I.tileID,O,this.crossTileIDs)&&(x=!0),M[O.bucketInstanceId]=!0)}return y.removeStaleBuckets(M)&&(x=!0),x}pruneUnusedLayers(o){const d={};o.forEach(m=>{d[m]=!0});for(const m in this.layerIndexes)d[m]||delete this.layerIndexes[m]}}const eo=(v,o)=>l.t(v,o&&o.filter(d=>d.identifier!=="source.canvas")),o_=l.aw();class nu extends l.E{constructor(o,d={}){super(),this._rtlPluginLoaded=()=>{for(const m in this.sourceCaches){const y=this.sourceCaches[m].getSource().type;y!=="vector"&&y!=="geojson"||this.sourceCaches[m].reload()}},this.map=o,this.dispatcher=new ct(De(),o._getMapId()),this.dispatcher.registerMessageHandler("GG",(m,y)=>this.getGlyphs(m,y)),this.dispatcher.registerMessageHandler("GI",(m,y)=>this.getImages(m,y)),this.imageManager=new ot,this.imageManager.setEventedParent(this),this.glyphManager=new Ft(o._requestManager,d.localIdeographFontFamily),this.lineAtlas=new ti(256,512),this.crossTileSymbolIndex=new Jh,this._spritesImagesIds={},this._layers={},this._order=[],this.sourceCaches={},this.zoomHistory=new l.ax,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast("SR",l.ay()),zr().on(Ve,this._rtlPluginLoaded),this.on("data",m=>{if(m.dataType!=="source"||m.sourceDataType!=="metadata")return;const y=this.sourceCaches[m.sourceId];if(!y)return;const x=y.getSource();if(x&&x.vectorLayerIds)for(const M in this._layers){const I=this._layers[M];I.source===x.id&&this._validateLayer(I)}})}loadURL(o,d={},m){this.fire(new l.k("dataloading",{dataType:"style"})),d.validate=typeof d.validate!="boolean"||d.validate;const y=this.map._requestManager.transformRequest(o,"Style");this._loadStyleRequest=new AbortController;const x=this._loadStyleRequest;l.h(y,this._loadStyleRequest).then(M=>{this._loadStyleRequest=null,this._load(M.data,d,m)}).catch(M=>{this._loadStyleRequest=null,M&&!x.signal.aborted&&this.fire(new l.j(M))})}loadJSON(o,d={},m){this.fire(new l.k("dataloading",{dataType:"style"})),this._frameRequest=new AbortController,E.frameAsync(this._frameRequest).then(()=>{this._frameRequest=null,d.validate=d.validate!==!1,this._load(o,d,m)}).catch(()=>{})}loadEmpty(){this.fire(new l.k("dataloading",{dataType:"style"})),this._load(o_,{validate:!1})}_load(o,d,m){var y;const x=d.transformStyle?d.transformStyle(m,o):o;if(!d.validate||!eo(this,l.u(x))){this._loaded=!0,this.stylesheet=x;for(const M in x.sources)this.addSource(M,x.sources[M],{validate:!1});x.sprite?this._loadSprite(x.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(x.glyphs),this._createLayers(),this.light=new dn(this.stylesheet.light),this.sky=new pn(this.stylesheet.sky),this.map.setTerrain((y=this.stylesheet.terrain)!==null&&y!==void 0?y:null),this.fire(new l.k("data",{dataType:"style"})),this.fire(new l.k("style.load"))}}_createLayers(){const o=l.az(this.stylesheet.layers);this.dispatcher.broadcast("SL",o),this._order=o.map(d=>d.id),this._layers={},this._serializedLayers=null;for(const d of o){const m=l.aA(d);m.setEventedParent(this,{layer:{id:d.id}}),this._layers[d.id]=m}}_loadSprite(o,d=!1,m=void 0){let y;this.imageManager.setLoaded(!1),this._spriteRequest=new AbortController,function(x,M,I,O){return l._(this,void 0,void 0,function*(){const N=Ae(x),V=I>1?"@2x":"",F={},Z={};for(const{id:J,url:ee}of N){const oe=M.transformRequest($e(ee,V,".json"),"SpriteJSON");F[J]=l.h(oe,O);const le=M.transformRequest($e(ee,V,".png"),"SpriteImage");Z[J]=G.getImage(le,O)}return yield Promise.all([...Object.values(F),...Object.values(Z)]),function(J,ee){return l._(this,void 0,void 0,function*(){const oe={};for(const le in J){oe[le]={};const ce=E.getImageCanvasContext((yield ee[le]).data),he=(yield J[le]).data;for(const ne in he){const{width:me,height:ge,x:xe,y:Be,sdf:Fe,pixelRatio:Qe,stretchX:st,stretchY:Ye,content:Ge,textFitWidth:mt,textFitHeight:Bt}=he[ne];oe[le][ne]={data:null,pixelRatio:Qe,sdf:Fe,stretchX:st,stretchY:Ye,content:Ge,textFitWidth:mt,textFitHeight:Bt,spriteData:{width:me,height:ge,x:xe,y:Be,context:ce}}}}return oe})}(F,Z)})}(o,this.map._requestManager,this.map.getPixelRatio(),this._spriteRequest).then(x=>{if(this._spriteRequest=null,x)for(const M in x){this._spritesImagesIds[M]=[];const I=this._spritesImagesIds[M]?this._spritesImagesIds[M].filter(O=>!(O in x)):[];for(const O of I)this.imageManager.removeImage(O),this._changedImages[O]=!0;for(const O in x[M]){const N=M==="default"?O:`${M}:${O}`;this._spritesImagesIds[M].push(N),N in this.imageManager.images?this.imageManager.updateImage(N,x[M][O],!1):this.imageManager.addImage(N,x[M][O]),d&&(this._changedImages[N]=!0)}}}).catch(x=>{this._spriteRequest=null,y=x,this.fire(new l.j(y))}).finally(()=>{this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),d&&(this._changed=!0),this.dispatcher.broadcast("SI",this._availableImages),this.fire(new l.k("data",{dataType:"style"})),m&&m(y)})}_unloadSprite(){for(const o of Object.values(this._spritesImagesIds).flat())this.imageManager.removeImage(o),this._changedImages[o]=!0;this._spritesImagesIds={},this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new l.k("data",{dataType:"style"}))}_validateLayer(o){const d=this.sourceCaches[o.source];if(!d)return;const m=o.sourceLayer;if(!m)return;const y=d.getSource();(y.type==="geojson"||y.vectorLayerIds&&y.vectorLayerIds.indexOf(m)===-1)&&this.fire(new l.j(new Error(`Source layer "${m}" does not exist on source "${y.id}" as specified by style layer "${o.id}".`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(const o in this.sourceCaches)if(!this.sourceCaches[o].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeByIds(o,d=!1){const m=this._serializedAllLayers();if(!o||o.length===0)return Object.values(d?l.aB(m):m);const y=[];for(const x of o)if(m[x]){const M=d?l.aB(m[x]):m[x];y.push(M)}return y}_serializedAllLayers(){let o=this._serializedLayers;if(o)return o;o=this._serializedLayers={};const d=Object.keys(this._layers);for(const m of d){const y=this._layers[m];y.type!=="custom"&&(o[m]=y.serialize())}return o}hasTransitions(){if(this.light&&this.light.hasTransition()||this.sky&&this.sky.hasTransition())return!0;for(const o in this.sourceCaches)if(this.sourceCaches[o].hasTransition())return!0;for(const o in this._layers)if(this._layers[o].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading.")}update(o){if(!this._loaded)return;const d=this._changed;if(d){const y=Object.keys(this._updatedLayers),x=Object.keys(this._removedLayers);(y.length||x.length)&&this._updateWorkerLayers(y,x);for(const M in this._updatedSources){const I=this._updatedSources[M];if(I==="reload")this._reloadSource(M);else{if(I!=="clear")throw new Error(`Invalid action ${I}`);this._clearSource(M)}}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(const M in this._updatedPaintProps)this._layers[M].updateTransitions(o);this.light.updateTransitions(o),this.sky.updateTransitions(o),this._resetUpdates()}const m={};for(const y in this.sourceCaches){const x=this.sourceCaches[y];m[y]=x.used,x.used=!1}for(const y of this._order){const x=this._layers[y];x.recalculate(o,this._availableImages),!x.isHidden(o.zoom)&&x.source&&(this.sourceCaches[x.source].used=!0)}for(const y in m){const x=this.sourceCaches[y];!!m[y]!=!!x.used&&x.fire(new l.k("data",{sourceDataType:"visibility",dataType:"source",sourceId:y}))}this.light.recalculate(o),this.sky.recalculate(o),this.z=o.zoom,d&&this.fire(new l.k("data",{dataType:"style"}))}_updateTilesForChangedImages(){const o=Object.keys(this._changedImages);if(o.length){for(const d in this.sourceCaches)this.sourceCaches[d].reloadTilesForDependencies(["icons","patterns"],o);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(const o in this.sourceCaches)this.sourceCaches[o].reloadTilesForDependencies(["glyphs"],[""]);this._glyphsDidChange=!1}}_updateWorkerLayers(o,d){this.dispatcher.broadcast("UL",{layers:this._serializeByIds(o,!1),removedIds:d})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(o,d={}){var m;this._checkLoaded();const y=this.serialize();if(o=d.transformStyle?d.transformStyle(y,o):o,((m=d.validate)===null||m===void 0||m)&&eo(this,l.u(o)))return!1;(o=l.aB(o)).layers=l.az(o.layers);const x=l.aC(y,o),M=this._getOperationsToPerform(x);if(M.unimplemented.length>0)throw new Error(`Unimplemented: ${M.unimplemented.join(", ")}.`);if(M.operations.length===0)return!1;for(const I of M.operations)I();return this.stylesheet=o,this._serializedLayers=null,!0}_getOperationsToPerform(o){const d=[],m=[];for(const y of o)switch(y.command){case"setCenter":case"setZoom":case"setBearing":case"setPitch":continue;case"addLayer":d.push(()=>this.addLayer.apply(this,y.args));break;case"removeLayer":d.push(()=>this.removeLayer.apply(this,y.args));break;case"setPaintProperty":d.push(()=>this.setPaintProperty.apply(this,y.args));break;case"setLayoutProperty":d.push(()=>this.setLayoutProperty.apply(this,y.args));break;case"setFilter":d.push(()=>this.setFilter.apply(this,y.args));break;case"addSource":d.push(()=>this.addSource.apply(this,y.args));break;case"removeSource":d.push(()=>this.removeSource.apply(this,y.args));break;case"setLayerZoomRange":d.push(()=>this.setLayerZoomRange.apply(this,y.args));break;case"setLight":d.push(()=>this.setLight.apply(this,y.args));break;case"setGeoJSONSourceData":d.push(()=>this.setGeoJSONSourceData.apply(this,y.args));break;case"setGlyphs":d.push(()=>this.setGlyphs.apply(this,y.args));break;case"setSprite":d.push(()=>this.setSprite.apply(this,y.args));break;case"setSky":d.push(()=>this.setSky.apply(this,y.args));break;case"setTerrain":d.push(()=>this.map.setTerrain.apply(this,y.args));break;case"setTransition":d.push(()=>{});break;default:m.push(y.command)}return{operations:d,unimplemented:m}}addImage(o,d){if(this.getImage(o))return this.fire(new l.j(new Error(`An image named "${o}" already exists.`)));this.imageManager.addImage(o,d),this._afterImageUpdated(o)}updateImage(o,d){this.imageManager.updateImage(o,d)}getImage(o){return this.imageManager.getImage(o)}removeImage(o){if(!this.getImage(o))return this.fire(new l.j(new Error(`An image named "${o}" does not exist.`)));this.imageManager.removeImage(o),this._afterImageUpdated(o)}_afterImageUpdated(o){this._availableImages=this.imageManager.listImages(),this._changedImages[o]=!0,this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new l.k("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(o,d,m={}){if(this._checkLoaded(),this.sourceCaches[o]!==void 0)throw new Error(`Source "${o}" already exists.`);if(!d.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(d).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(d.type)>=0&&this._validate(l.u.source,`sources.${o}`,d,null,m))return;this.map&&this.map._collectResourceTiming&&(d.collectResourceTiming=!0);const y=this.sourceCaches[o]=new Re(o,d,this.dispatcher);y.style=this,y.setEventedParent(this,()=>({isSourceLoaded:y.loaded(),source:y.serialize(),sourceId:o})),y.onAdd(this.map),this._changed=!0}removeSource(o){if(this._checkLoaded(),this.sourceCaches[o]===void 0)throw new Error("There is no source with this ID");for(const m in this._layers)if(this._layers[m].source===o)return this.fire(new l.j(new Error(`Source "${o}" cannot be removed while layer "${m}" is using it.`)));const d=this.sourceCaches[o];delete this.sourceCaches[o],delete this._updatedSources[o],d.fire(new l.k("data",{sourceDataType:"metadata",dataType:"source",sourceId:o})),d.setEventedParent(null),d.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(o,d){if(this._checkLoaded(),this.sourceCaches[o]===void 0)throw new Error(`There is no source with this ID=${o}`);const m=this.sourceCaches[o].getSource();if(m.type!=="geojson")throw new Error(`geojsonSource.type is ${m.type}, which is !== 'geojson`);m.setData(d),this._changed=!0}getSource(o){return this.sourceCaches[o]&&this.sourceCaches[o].getSource()}addLayer(o,d,m={}){this._checkLoaded();const y=o.id;if(this.getLayer(y))return void this.fire(new l.j(new Error(`Layer "${y}" already exists on this map.`)));let x;if(o.type==="custom"){if(eo(this,l.aD(o)))return;x=l.aA(o)}else{if("source"in o&&typeof o.source=="object"&&(this.addSource(y,o.source),o=l.aB(o),o=l.e(o,{source:y})),this._validate(l.u.layer,`layers.${y}`,o,{arrayIndex:-1},m))return;x=l.aA(o),this._validateLayer(x),x.setEventedParent(this,{layer:{id:y}})}const M=d?this._order.indexOf(d):this._order.length;if(d&&M===-1)this.fire(new l.j(new Error(`Cannot add layer "${y}" before non-existing layer "${d}".`)));else{if(this._order.splice(M,0,y),this._layerOrderChanged=!0,this._layers[y]=x,this._removedLayers[y]&&x.source&&x.type!=="custom"){const I=this._removedLayers[y];delete this._removedLayers[y],I.type!==x.type?this._updatedSources[x.source]="clear":(this._updatedSources[x.source]="reload",this.sourceCaches[x.source].pause())}this._updateLayer(x),x.onAdd&&x.onAdd(this.map)}}moveLayer(o,d){if(this._checkLoaded(),this._changed=!0,!this._layers[o])return void this.fire(new l.j(new Error(`The layer '${o}' does not exist in the map's style and cannot be moved.`)));if(o===d)return;const m=this._order.indexOf(o);this._order.splice(m,1);const y=d?this._order.indexOf(d):this._order.length;d&&y===-1?this.fire(new l.j(new Error(`Cannot move layer "${o}" before non-existing layer "${d}".`))):(this._order.splice(y,0,o),this._layerOrderChanged=!0)}removeLayer(o){this._checkLoaded();const d=this._layers[o];if(!d)return void this.fire(new l.j(new Error(`Cannot remove non-existing layer "${o}".`)));d.setEventedParent(null);const m=this._order.indexOf(o);this._order.splice(m,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[o]=d,delete this._layers[o],this._serializedLayers&&delete this._serializedLayers[o],delete this._updatedLayers[o],delete this._updatedPaintProps[o],d.onRemove&&d.onRemove(this.map)}getLayer(o){return this._layers[o]}getLayersOrder(){return[...this._order]}hasLayer(o){return o in this._layers}setLayerZoomRange(o,d,m){this._checkLoaded();const y=this.getLayer(o);y?y.minzoom===d&&y.maxzoom===m||(d!=null&&(y.minzoom=d),m!=null&&(y.maxzoom=m),this._updateLayer(y)):this.fire(new l.j(new Error(`Cannot set the zoom range of non-existing layer "${o}".`)))}setFilter(o,d,m={}){this._checkLoaded();const y=this.getLayer(o);if(y){if(!l.aE(y.filter,d))return d==null?(y.filter=void 0,void this._updateLayer(y)):void(this._validate(l.u.filter,`layers.${y.id}.filter`,d,null,m)||(y.filter=l.aB(d),this._updateLayer(y)))}else this.fire(new l.j(new Error(`Cannot filter non-existing layer "${o}".`)))}getFilter(o){return l.aB(this.getLayer(o).filter)}setLayoutProperty(o,d,m,y={}){this._checkLoaded();const x=this.getLayer(o);x?l.aE(x.getLayoutProperty(d),m)||(x.setLayoutProperty(d,m,y),this._updateLayer(x)):this.fire(new l.j(new Error(`Cannot style non-existing layer "${o}".`)))}getLayoutProperty(o,d){const m=this.getLayer(o);if(m)return m.getLayoutProperty(d);this.fire(new l.j(new Error(`Cannot get style of non-existing layer "${o}".`)))}setPaintProperty(o,d,m,y={}){this._checkLoaded();const x=this.getLayer(o);x?l.aE(x.getPaintProperty(d),m)||(x.setPaintProperty(d,m,y)&&this._updateLayer(x),this._changed=!0,this._updatedPaintProps[o]=!0,this._serializedLayers=null):this.fire(new l.j(new Error(`Cannot style non-existing layer "${o}".`)))}getPaintProperty(o,d){return this.getLayer(o).getPaintProperty(d)}setFeatureState(o,d){this._checkLoaded();const m=o.source,y=o.sourceLayer,x=this.sourceCaches[m];if(x===void 0)return void this.fire(new l.j(new Error(`The source '${m}' does not exist in the map's style.`)));const M=x.getSource().type;M==="geojson"&&y?this.fire(new l.j(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):M!=="vector"||y?(o.id===void 0&&this.fire(new l.j(new Error("The feature id parameter must be provided."))),x.setFeatureState(y,o.id,d)):this.fire(new l.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(o,d){this._checkLoaded();const m=o.source,y=this.sourceCaches[m];if(y===void 0)return void this.fire(new l.j(new Error(`The source '${m}' does not exist in the map's style.`)));const x=y.getSource().type,M=x==="vector"?o.sourceLayer:void 0;x!=="vector"||M?d&&typeof o.id!="string"&&typeof o.id!="number"?this.fire(new l.j(new Error("A feature id is required to remove its specific state property."))):y.removeFeatureState(M,o.id,d):this.fire(new l.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(o){this._checkLoaded();const d=o.source,m=o.sourceLayer,y=this.sourceCaches[d];if(y!==void 0)return y.getSource().type!=="vector"||m?(o.id===void 0&&this.fire(new l.j(new Error("The feature id parameter must be provided."))),y.getFeatureState(m,o.id)):void this.fire(new l.j(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new l.j(new Error(`The source '${d}' does not exist in the map's style.`)))}getTransition(){return l.e({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){if(!this._loaded)return;const o=l.aF(this.sourceCaches,x=>x.serialize()),d=this._serializeByIds(this._order,!0),m=this.map.getTerrain()||void 0,y=this.stylesheet;return l.aG({version:y.version,name:y.name,metadata:y.metadata,light:y.light,sky:y.sky,center:y.center,zoom:y.zoom,bearing:y.bearing,pitch:y.pitch,sprite:y.sprite,glyphs:y.glyphs,transition:y.transition,sources:o,layers:d,terrain:m},x=>x!==void 0)}_updateLayer(o){this._updatedLayers[o.id]=!0,o.source&&!this._updatedSources[o.source]&&this.sourceCaches[o.source].getSource().type!=="raster"&&(this._updatedSources[o.source]="reload",this.sourceCaches[o.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(o){const d=M=>this._layers[M].type==="fill-extrusion",m={},y=[];for(let M=this._order.length-1;M>=0;M--){const I=this._order[M];if(d(I)){m[I]=M;for(const O of o){const N=O[I];if(N)for(const V of N)y.push(V)}}}y.sort((M,I)=>I.intersectionZ-M.intersectionZ);const x=[];for(let M=this._order.length-1;M>=0;M--){const I=this._order[M];if(d(I))for(let O=y.length-1;O>=0;O--){const N=y[O].feature;if(m[N.layer.id]<M)break;x.push(N),y.pop()}else for(const O of o){const N=O[I];if(N)for(const V of N)x.push(V.feature)}}return x}queryRenderedFeatures(o,d,m){d&&d.filter&&this._validate(l.u.filter,"queryRenderedFeatures.filter",d.filter,null,d);const y={};if(d&&d.layers){if(!Array.isArray(d.layers))return this.fire(new l.j(new Error("parameters.layers must be an Array."))),[];for(const I of d.layers){const O=this._layers[I];if(!O)return this.fire(new l.j(new Error(`The layer '${I}' does not exist in the map's style and cannot be queried for features.`))),[];y[O.source]=!0}}const x=[];d.availableImages=this._availableImages;const M=this._serializedAllLayers();for(const I in this.sourceCaches)d.layers&&!y[I]||x.push(At(this.sourceCaches[I],this._layers,M,o,d,m));return this.placement&&x.push(function(I,O,N,V,F,Z,J){const ee={},oe=Z.queryRenderedSymbols(V),le=[];for(const ce of Object.keys(oe).map(Number))le.push(J[ce]);le.sort(Mt);for(const ce of le){const he=ce.featureIndex.lookupSymbolFeatures(oe[ce.bucketInstanceId],O,ce.bucketIndex,ce.sourceLayerIndex,F.filter,F.layers,F.availableImages,I);for(const ne in he){const me=ee[ne]=ee[ne]||[],ge=he[ne];ge.sort((xe,Be)=>{const Fe=ce.featureSortOrder;if(Fe){const Qe=Fe.indexOf(xe.featureIndex);return Fe.indexOf(Be.featureIndex)-Qe}return Be.featureIndex-xe.featureIndex});for(const xe of ge)me.push(xe)}}for(const ce in ee)ee[ce].forEach(he=>{const ne=he.feature,me=N[I[ce].source].getFeatureState(ne.layer["source-layer"],ne.id);ne.source=ne.layer.source,ne.layer["source-layer"]&&(ne.sourceLayer=ne.layer["source-layer"]),ne.state=me});return ee}(this._layers,M,this.sourceCaches,o,d,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(x)}querySourceFeatures(o,d){d&&d.filter&&this._validate(l.u.filter,"querySourceFeatures.filter",d.filter,null,d);const m=this.sourceCaches[o];return m?function(y,x){const M=y.getRenderableIds().map(N=>y.getTileByID(N)),I=[],O={};for(let N=0;N<M.length;N++){const V=M[N],F=V.tileID.canonical.key;O[F]||(O[F]=!0,V.querySourceFeatures(I,x))}return I}(m,d):[]}getLight(){return this.light.getLight()}setLight(o,d={}){this._checkLoaded();const m=this.light.getLight();let y=!1;for(const M in o)if(!l.aE(o[M],m[M])){y=!0;break}if(!y)return;const x={now:E.now(),transition:l.e({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(o,d),this.light.updateTransitions(x)}getSky(){var o;return(o=this.stylesheet)===null||o===void 0?void 0:o.sky}setSky(o,d={}){const m=this.getSky();let y=!1;if(!o&&!m)return;if(o&&!m)y=!0;else if(!o&&m)y=!0;else for(const M in o)if(!l.aE(o[M],m[M])){y=!0;break}if(!y)return;const x={now:E.now(),transition:l.e({duration:300,delay:0},this.stylesheet.transition)};this.stylesheet.sky=o,this.sky.setSky(o,d),this.sky.updateTransitions(x)}_validate(o,d,m,y,x={}){return(!x||x.validate!==!1)&&eo(this,o.call(l.u,l.e({key:d,style:this.serialize(),value:m,styleSpec:l.v},y)))}_remove(o=!0){this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._loadStyleRequest&&(this._loadStyleRequest.abort(),this._loadStyleRequest=null),this._spriteRequest&&(this._spriteRequest.abort(),this._spriteRequest=null),zr().off(Ve,this._rtlPluginLoaded);for(const d in this._layers)this._layers[d].setEventedParent(null);for(const d in this.sourceCaches){const m=this.sourceCaches[d];m.setEventedParent(null),m.onRemove(this.map)}this.imageManager.setEventedParent(null),this.setEventedParent(null),o&&this.dispatcher.broadcast("RM",void 0),this.dispatcher.remove(o)}_clearSource(o){this.sourceCaches[o].clearTiles()}_reloadSource(o){this.sourceCaches[o].resume(),this.sourceCaches[o].reload()}_updateSources(o){for(const d in this.sourceCaches)this.sourceCaches[d].update(o,this.map.terrain)}_generateCollisionBoxes(){for(const o in this.sourceCaches)this._reloadSource(o)}_updatePlacement(o,d,m,y,x=!1){let M=!1,I=!1;const O={};for(const N of this._order){const V=this._layers[N];if(V.type!=="symbol")continue;if(!O[V.source]){const Z=this.sourceCaches[V.source];O[V.source]=Z.getRenderableIds(!0).map(J=>Z.getTileByID(J)).sort((J,ee)=>ee.tileID.overscaledZ-J.tileID.overscaledZ||(J.tileID.isLessThan(ee.tileID)?-1:1))}const F=this.crossTileSymbolIndex.addLayer(V,O[V.source],o.center.lng);M=M||F}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((x=x||this._layerOrderChanged||m===0)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(E.now(),o.zoom))&&(this.pauseablePlacement=new Ll(o,this.map.terrain,this._order,x,d,m,y,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,O),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(E.now()),I=!0),M&&this.pauseablePlacement.placement.setStale()),I||M)for(const N of this._order){const V=this._layers[N];V.type==="symbol"&&this.placement.updateLayerOpacities(V,O[V.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(E.now())}_releaseSymbolFadeTiles(){for(const o in this.sourceCaches)this.sourceCaches[o].releaseSymbolFadeTiles()}getImages(o,d){return l._(this,void 0,void 0,function*(){const m=yield this.imageManager.getImages(d.icons);this._updateTilesForChangedImages();const y=this.sourceCaches[d.source];return y&&y.setDependencies(d.tileID.key,d.type,d.icons),m})}getGlyphs(o,d){return l._(this,void 0,void 0,function*(){const m=yield this.glyphManager.getGlyphs(d.stacks),y=this.sourceCaches[d.source];return y&&y.setDependencies(d.tileID.key,d.type,[""]),m})}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(o,d={}){this._checkLoaded(),o&&this._validate(l.u.glyphs,"glyphs",o,null,d)||(this._glyphsDidChange=!0,this.stylesheet.glyphs=o,this.glyphManager.entries={},this.glyphManager.setURL(o))}addSprite(o,d,m={},y){this._checkLoaded();const x=[{id:o,url:d}],M=[...Ae(this.stylesheet.sprite),...x];this._validate(l.u.sprite,"sprite",M,null,m)||(this.stylesheet.sprite=M,this._loadSprite(x,!0,y))}removeSprite(o){this._checkLoaded();const d=Ae(this.stylesheet.sprite);if(d.find(m=>m.id===o)){if(this._spritesImagesIds[o])for(const m of this._spritesImagesIds[o])this.imageManager.removeImage(m),this._changedImages[m]=!0;d.splice(d.findIndex(m=>m.id===o),1),this.stylesheet.sprite=d.length>0?d:void 0,delete this._spritesImagesIds[o],this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new l.k("data",{dataType:"style"}))}else this.fire(new l.j(new Error(`Sprite "${o}" doesn't exists on this map.`)))}getSprite(){return Ae(this.stylesheet.sprite)}setSprite(o,d={},m){this._checkLoaded(),o&&this._validate(l.u.sprite,"sprite",o,null,d)||(this.stylesheet.sprite=o,o?this._loadSprite(o,!0,m):(this._unloadSprite(),m&&m(null)))}}var $s=l.Y([{name:"a_pos",type:"Int16",components:2}]);const ds={prelude:fn(`#ifdef GL_ES
50
50
  precision mediump float;
51
51
  #else
52
52
  #if !defined(lowp)
@@ -125,7 +125,7 @@ void main() {
125
125
  #pragma mapbox: initialize highp vec4 stroke_color
126
126
  #pragma mapbox: initialize mediump float stroke_width
127
127
  #pragma mapbox: initialize lowp float stroke_opacity
128
- vec2 extrude=v_data.xy;float extrude_length=length(extrude);float antialiased_blur=v_data.z;float opacity_t=smoothstep(0.0,antialiased_blur,extrude_length-1.0);float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(antialiased_blur,0.0,extrude_length-radius/(radius+stroke_width));gl_FragColor=v_visibility*opacity_t*mix(color*opacity,stroke_color*stroke_opacity,color_t);
128
+ vec2 extrude=v_data.xy;float extrude_length=length(extrude);lowp float antialiasblur=v_data.z;float antialiased_blur=-max(blur,antialiasblur);float opacity_t=smoothstep(0.0,antialiased_blur,extrude_length-1.0);float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(antialiased_blur,0.0,extrude_length-radius/(radius+stroke_width));gl_FragColor=v_visibility*opacity_t*mix(color*opacity,stroke_color*stroke_opacity,color_t);
129
129
  #ifdef OVERDRAW_INSPECTOR
130
130
  gl_FragColor=vec4(1.0);
131
131
  #endif
@@ -145,7 +145,7 @@ void main(void) {
145
145
  #pragma mapbox: initialize highp vec4 stroke_color
146
146
  #pragma mapbox: initialize mediump float stroke_width
147
147
  #pragma mapbox: initialize lowp float stroke_opacity
148
- vec2 extrude=vec2(mod(a_pos,2.0)*2.0-1.0);vec2 circle_center=floor(a_pos*0.5);float ele=get_elevation(circle_center);v_visibility=calculate_visibility(u_matrix*vec4(circle_center,ele,1.0));if (u_pitch_with_map) {vec2 corner_position=circle_center;if (u_scale_with_map) {corner_position+=extrude*(radius+stroke_width)*u_extrude_scale;} else {vec4 projected_center=u_matrix*vec4(circle_center,0,1);corner_position+=extrude*(radius+stroke_width)*u_extrude_scale*(projected_center.w/u_camera_to_center_distance);}gl_Position=u_matrix*vec4(corner_position,ele,1);} else {gl_Position=u_matrix*vec4(circle_center,ele,1);if (u_scale_with_map) {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*u_camera_to_center_distance;} else {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*gl_Position.w;}}float antialiasblur=-max(1.0/u_device_pixel_ratio/(radius+stroke_width),blur);v_data=vec3(extrude.x,extrude.y,antialiasblur);}`),clippingMask:fn("void main() {gl_FragColor=vec4(1.0);}","attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),heatmap:fn(`uniform highp float u_intensity;varying vec2 v_extrude;
148
+ vec2 extrude=vec2(mod(a_pos,2.0)*2.0-1.0);vec2 circle_center=floor(a_pos*0.5);float ele=get_elevation(circle_center);v_visibility=calculate_visibility(u_matrix*vec4(circle_center,ele,1.0));if (u_pitch_with_map) {vec2 corner_position=circle_center;if (u_scale_with_map) {corner_position+=extrude*(radius+stroke_width)*u_extrude_scale;} else {vec4 projected_center=u_matrix*vec4(circle_center,0,1);corner_position+=extrude*(radius+stroke_width)*u_extrude_scale*(projected_center.w/u_camera_to_center_distance);}gl_Position=u_matrix*vec4(corner_position,ele,1);} else {gl_Position=u_matrix*vec4(circle_center,ele,1);if (u_scale_with_map) {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*u_camera_to_center_distance;} else {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*gl_Position.w;}}lowp float antialiasblur=1.0/u_device_pixel_ratio/(radius+stroke_width);v_data=vec3(extrude.x,extrude.y,antialiasblur);}`),clippingMask:fn("void main() {gl_FragColor=vec4(1.0);}","attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),heatmap:fn(`uniform highp float u_intensity;varying vec2 v_extrude;
149
149
  #pragma mapbox: define highp float weight
150
150
  #define GAUSS_COEF 0.3989422804014327
151
151
  void main() {
@@ -621,7 +621,7 @@ uniform ${V} ${F} u_${Z};
621
621
  #endif
622
622
  `}),staticAttributes:m,staticUniforms:M}}class Qh{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(o,d,m,y,x,M,I,O,N){this.context=o;let V=this.boundPaintVertexBuffers.length!==y.length;for(let F=0;!V&&F<y.length;F++)this.boundPaintVertexBuffers[F]!==y[F]&&(V=!0);!this.vao||this.boundProgram!==d||this.boundLayoutVertexBuffer!==m||V||this.boundIndexBuffer!==x||this.boundVertexOffset!==M||this.boundDynamicVertexBuffer!==I||this.boundDynamicVertexBuffer2!==O||this.boundDynamicVertexBuffer3!==N?this.freshBind(d,m,y,x,M,I,O,N):(o.bindVertexArray.set(this.vao),I&&I.bind(),x&&x.dynamicDraw&&x.bind(),O&&O.bind(),N&&N.bind())}freshBind(o,d,m,y,x,M,I,O){const N=o.numAttributes,V=this.context,F=V.gl;this.vao&&this.destroy(),this.vao=V.createVertexArray(),V.bindVertexArray.set(this.vao),this.boundProgram=o,this.boundLayoutVertexBuffer=d,this.boundPaintVertexBuffers=m,this.boundIndexBuffer=y,this.boundVertexOffset=x,this.boundDynamicVertexBuffer=M,this.boundDynamicVertexBuffer2=I,this.boundDynamicVertexBuffer3=O,d.enableAttributes(F,o);for(const Z of m)Z.enableAttributes(F,o);M&&M.enableAttributes(F,o),I&&I.enableAttributes(F,o),O&&O.enableAttributes(F,o),d.bind(),d.setVertexAttribPointers(F,o,x);for(const Z of m)Z.bind(),Z.setVertexAttribPointers(F,o,x);M&&(M.bind(),M.setVertexAttribPointers(F,o,x)),y&&y.bind(),I&&(I.bind(),I.setVertexAttribPointers(F,o,x)),O&&(O.bind(),O.setVertexAttribPointers(F,o,x)),V.currentNumAttributes=N}destroy(){this.vao&&(this.context.deleteVertexArray(this.vao),this.vao=null)}}const ed=(v,o,d,m,y)=>({u_matrix:v,u_texture:0,u_ele_delta:o,u_fog_matrix:d,u_fog_color:m?m.properties.get("fog-color"):l.aM.white,u_fog_ground_blend:m?m.properties.get("fog-ground-blend"):1,u_fog_ground_blend_opacity:m?m.calculateFogBlendOpacity(y):0,u_horizon_color:m?m.properties.get("horizon-color"):l.aM.white,u_horizon_fog_blend:m?m.properties.get("horizon-fog-blend"):1});function Pa(v){const o=[];for(let d=0;d<v.length;d++){if(v[d]===null)continue;const m=v[d].split(" ");o.push(m.pop())}return o}class td{constructor(o,d,m,y,x,M){const I=o.gl;this.program=I.createProgram();const O=Pa(d.staticAttributes),N=m?m.getBinderAttributes():[],V=O.concat(N),F=ds.prelude.staticUniforms?Pa(ds.prelude.staticUniforms):[],Z=d.staticUniforms?Pa(d.staticUniforms):[],J=m?m.getBinderUniforms():[],ee=F.concat(Z).concat(J),oe=[];for(const xe of ee)oe.indexOf(xe)<0&&oe.push(xe);const le=m?m.defines():[];x&&le.push("#define OVERDRAW_INSPECTOR;"),M&&le.push("#define TERRAIN3D;");const ce=le.concat(ds.prelude.fragmentSource,d.fragmentSource).join(`
623
623
  `),he=le.concat(ds.prelude.vertexSource,d.vertexSource).join(`
624
- `),ne=I.createShader(I.FRAGMENT_SHADER);if(I.isContextLost())return void(this.failedToCreate=!0);if(I.shaderSource(ne,ce),I.compileShader(ne),!I.getShaderParameter(ne,I.COMPILE_STATUS))throw new Error(`Could not compile fragment shader: ${I.getShaderInfoLog(ne)}`);I.attachShader(this.program,ne);const me=I.createShader(I.VERTEX_SHADER);if(I.isContextLost())return void(this.failedToCreate=!0);if(I.shaderSource(me,he),I.compileShader(me),!I.getShaderParameter(me,I.COMPILE_STATUS))throw new Error(`Could not compile vertex shader: ${I.getShaderInfoLog(me)}`);I.attachShader(this.program,me),this.attributes={};const ge={};this.numAttributes=V.length;for(let xe=0;xe<this.numAttributes;xe++)V[xe]&&(I.bindAttribLocation(this.program,xe,V[xe]),this.attributes[V[xe]]=xe);if(I.linkProgram(this.program),!I.getProgramParameter(this.program,I.LINK_STATUS))throw new Error(`Program failed to link: ${I.getProgramInfoLog(this.program)}`);I.deleteShader(me),I.deleteShader(ne);for(let xe=0;xe<oe.length;xe++){const Be=oe[xe];if(Be&&!ge[Be]){const Fe=I.getUniformLocation(this.program,Be);Fe&&(ge[Be]=Fe)}}this.fixedUniforms=y(o,ge),this.terrainUniforms=((xe,Be)=>({u_depth:new l.aH(xe,Be.u_depth),u_terrain:new l.aH(xe,Be.u_terrain),u_terrain_dim:new l.aI(xe,Be.u_terrain_dim),u_terrain_matrix:new l.aJ(xe,Be.u_terrain_matrix),u_terrain_unpack:new l.aK(xe,Be.u_terrain_unpack),u_terrain_exaggeration:new l.aI(xe,Be.u_terrain_exaggeration)}))(o,ge),this.binderUniforms=m?m.getUniforms(o,ge):[]}draw(o,d,m,y,x,M,I,O,N,V,F,Z,J,ee,oe,le,ce,he){const ne=o.gl;if(this.failedToCreate)return;if(o.program.set(this.program),o.setDepthMode(m),o.setStencilMode(y),o.setColorMode(x),o.setCullFace(M),O){o.activeTexture.set(ne.TEXTURE2),ne.bindTexture(ne.TEXTURE_2D,O.depthTexture),o.activeTexture.set(ne.TEXTURE3),ne.bindTexture(ne.TEXTURE_2D,O.texture);for(const ge in this.terrainUniforms)this.terrainUniforms[ge].set(O[ge])}for(const ge in this.fixedUniforms)this.fixedUniforms[ge].set(I[ge]);oe&&oe.setUniforms(o,this.binderUniforms,J,{zoom:ee});let me=0;switch(d){case ne.LINES:me=2;break;case ne.TRIANGLES:me=3;break;case ne.LINE_STRIP:me=1}for(const ge of Z.get()){const xe=ge.vaos||(ge.vaos={});(xe[N]||(xe[N]=new Qh)).bind(o,this,V,oe?oe.getPaintVertexBuffers():[],F,ge.vertexOffset,le,ce,he),ne.drawElements(d,ge.primitiveLength*me,ne.UNSIGNED_SHORT,ge.primitiveOffset*me*2)}}}function iu(v,o,d){const m=1/Kt(d,1,o.transform.tileZoom),y=Math.pow(2,d.tileID.overscaledZ),x=d.tileSize*Math.pow(2,o.transform.tileZoom)/y,M=x*(d.tileID.canonical.x+d.tileID.wrap*y),I=x*d.tileID.canonical.y;return{u_image:0,u_texsize:d.imageAtlasTexture.size,u_scale:[m,v.fromScale,v.toScale],u_fade:v.t,u_pixel_coord_upper:[M>>16,I>>16],u_pixel_coord_lower:[65535&M,65535&I]}}const Vl=(v,o,d,m)=>{const y=o.style.light,x=y.properties.get("position"),M=[x.x,x.y,x.z],I=function(){var N=new l.A(9);return l.A!=Float32Array&&(N[1]=0,N[2]=0,N[3]=0,N[5]=0,N[6]=0,N[7]=0),N[0]=1,N[4]=1,N[8]=1,N}();y.properties.get("anchor")==="viewport"&&function(N,V){var F=Math.sin(V),Z=Math.cos(V);N[0]=Z,N[1]=F,N[2]=0,N[3]=-F,N[4]=Z,N[5]=0,N[6]=0,N[7]=0,N[8]=1}(I,-o.transform.angle),function(N,V,F){var Z=V[0],J=V[1],ee=V[2];N[0]=Z*F[0]+J*F[3]+ee*F[6],N[1]=Z*F[1]+J*F[4]+ee*F[7],N[2]=Z*F[2]+J*F[5]+ee*F[8]}(M,M,I);const O=y.properties.get("color");return{u_matrix:v,u_lightpos:M,u_lightintensity:y.properties.get("intensity"),u_lightcolor:[O.r,O.g,O.b],u_vertical_gradient:+d,u_opacity:m}},ru=(v,o,d,m,y,x,M)=>l.e(Vl(v,o,d,m),iu(x,o,M),{u_height_factor:-Math.pow(2,y.overscaledZ)/M.tileSize/8}),Da=v=>({u_matrix:v}),Jf=(v,o,d,m)=>l.e(Da(v),iu(d,o,m)),s_=(v,o)=>({u_matrix:v,u_world:o}),Qf=(v,o,d,m,y)=>l.e(Jf(v,o,d,m),{u_world:y}),a_=(v,o,d,m)=>{const y=v.transform;let x,M;if(m.paint.get("circle-pitch-alignment")==="map"){const I=Kt(d,1,y.zoom);x=!0,M=[I,I]}else x=!1,M=y.pixelsToGLUnits;return{u_camera_to_center_distance:y.cameraToCenterDistance,u_scale_with_map:+(m.paint.get("circle-pitch-scale")==="map"),u_matrix:v.translatePosMatrix(o.posMatrix,d,m.paint.get("circle-translate"),m.paint.get("circle-translate-anchor")),u_pitch_with_map:+x,u_device_pixel_ratio:v.pixelRatio,u_extrude_scale:M}},js=(v,o,d)=>({u_matrix:v,u_inv_matrix:o,u_camera_to_center_distance:d.cameraToCenterDistance,u_viewport_size:[d.width,d.height]}),Fl=(v,o,d=1)=>({u_matrix:v,u_color:o,u_overlay:0,u_overlay_scale:d}),nr=v=>({u_matrix:v}),ir=(v,o,d,m)=>({u_matrix:v,u_extrude_scale:Kt(o,1,d),u_intensity:m}),ou=(v,o,d,m)=>{const y=l.H();l.aP(y,0,v.width,v.height,0,0,1);const x=v.context.gl;return{u_matrix:y,u_world:[x.drawingBufferWidth,x.drawingBufferHeight],u_image:d,u_color_ramp:m,u_opacity:o.paint.get("heatmap-opacity")}};function su(v,o){const d=Math.pow(2,o.canonical.z),m=o.canonical.y;return[new l.Z(0,m/d).toLngLat().lat,new l.Z(0,(m+1)/d).toLngLat().lat]}const au=(v,o,d,m)=>{const y=v.transform;return{u_matrix:nm(v,o,d,m),u_ratio:1/Kt(o,1,y.zoom),u_device_pixel_ratio:v.pixelRatio,u_units_to_pixels:[1/y.pixelsToGLUnits[0],1/y.pixelsToGLUnits[1]]}},em=(v,o,d,m,y)=>l.e(au(v,o,d,y),{u_image:0,u_image_height:m}),Oa=(v,o,d,m,y)=>{const x=v.transform,M=tm(o,x);return{u_matrix:nm(v,o,d,y),u_texsize:o.imageAtlasTexture.size,u_ratio:1/Kt(o,1,x.zoom),u_device_pixel_ratio:v.pixelRatio,u_image:0,u_scale:[M,m.fromScale,m.toScale],u_fade:m.t,u_units_to_pixels:[1/x.pixelsToGLUnits[0],1/x.pixelsToGLUnits[1]]}},l_=(v,o,d,m,y,x)=>{const M=v.lineAtlas,I=tm(o,v.transform),O=d.layout.get("line-cap")==="round",N=M.getDash(m.from,O),V=M.getDash(m.to,O),F=N.width*y.fromScale,Z=V.width*y.toScale;return l.e(au(v,o,d,x),{u_patternscale_a:[I/F,-N.height/2],u_patternscale_b:[I/Z,-V.height/2],u_sdfgamma:M.width/(256*Math.min(F,Z)*v.pixelRatio)/2,u_image:0,u_tex_y_a:N.y,u_tex_y_b:V.y,u_mix:y.t})};function tm(v,o){return 1/Kt(v,1,o.tileZoom)}function nm(v,o,d,m){return v.translatePosMatrix(m?m.posMatrix:o.tileID.posMatrix,o,d.paint.get("line-translate"),d.paint.get("line-translate-anchor"))}const c_=(v,o,d,m,y)=>{return{u_matrix:v,u_tl_parent:o,u_scale_parent:d,u_buffer_scale:1,u_fade_t:m.mix,u_opacity:m.opacity*y.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:y.paint.get("raster-brightness-min"),u_brightness_high:y.paint.get("raster-brightness-max"),u_saturation_factor:(M=y.paint.get("raster-saturation"),M>0?1-1/(1.001-M):-M),u_contrast_factor:(x=y.paint.get("raster-contrast"),x>0?1/(1-x):1+x),u_spin_weights:u_(y.paint.get("raster-hue-rotate"))};var x,M};function u_(v){v*=Math.PI/180;const o=Math.sin(v),d=Math.cos(v);return[(2*d+1)/3,(-Math.sqrt(3)*o-d+1)/3,(Math.sqrt(3)*o-d+1)/3]}const im=(v,o,d,m,y,x,M,I,O,N,V,F,Z,J)=>{const ee=M.transform;return{u_is_size_zoom_constant:+(v==="constant"||v==="source"),u_is_size_feature_constant:+(v==="constant"||v==="camera"),u_size_t:o?o.uSizeT:0,u_size:o?o.uSize:0,u_camera_to_center_distance:ee.cameraToCenterDistance,u_pitch:ee.pitch/360*2*Math.PI,u_rotate_symbol:+d,u_aspect_ratio:ee.width/ee.height,u_fade_change:M.options.fadeDuration?M.symbolFadeChange:1,u_matrix:I,u_label_plane_matrix:O,u_coord_matrix:N,u_is_text:+F,u_pitch_with_map:+m,u_is_along_line:y,u_is_variable_anchor:x,u_texsize:Z,u_texture:0,u_translation:V,u_pitched_scale:J}},$l=(v,o,d,m,y,x,M,I,O,N,V,F,Z,J,ee)=>{const oe=M.transform;return l.e(im(v,o,d,m,y,x,M,I,O,N,V,F,Z,ee),{u_gamma_scale:m?Math.cos(oe._pitch)*oe.cameraToCenterDistance:1,u_device_pixel_ratio:M.pixelRatio,u_is_halo:+J})},nd=(v,o,d,m,y,x,M,I,O,N,V,F,Z,J)=>l.e($l(v,o,d,m,y,x,M,I,O,N,V,!0,F,!0,J),{u_texsize_icon:Z,u_texture_icon:1}),lu=(v,o,d)=>({u_matrix:v,u_opacity:o,u_color:d}),id=(v,o,d,m,y,x)=>l.e(function(M,I,O,N){const V=O.imageManager.getPattern(M.from.toString()),F=O.imageManager.getPattern(M.to.toString()),{width:Z,height:J}=O.imageManager.getPixelSize(),ee=Math.pow(2,N.tileID.overscaledZ),oe=N.tileSize*Math.pow(2,O.transform.tileZoom)/ee,le=oe*(N.tileID.canonical.x+N.tileID.wrap*ee),ce=oe*N.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:V.tl,u_pattern_br_a:V.br,u_pattern_tl_b:F.tl,u_pattern_br_b:F.br,u_texsize:[Z,J],u_mix:I.t,u_pattern_size_a:V.displaySize,u_pattern_size_b:F.displaySize,u_scale_a:I.fromScale,u_scale_b:I.toScale,u_tile_units_to_pixels:1/Kt(N,1,O.transform.tileZoom),u_pixel_coord_upper:[le>>16,ce>>16],u_pixel_coord_lower:[65535&le,65535&ce]}}(m,x,d,y),{u_matrix:v,u_opacity:o}),rd={fillExtrusion:(v,o)=>({u_matrix:new l.aJ(v,o.u_matrix),u_lightpos:new l.aN(v,o.u_lightpos),u_lightintensity:new l.aI(v,o.u_lightintensity),u_lightcolor:new l.aN(v,o.u_lightcolor),u_vertical_gradient:new l.aI(v,o.u_vertical_gradient),u_opacity:new l.aI(v,o.u_opacity)}),fillExtrusionPattern:(v,o)=>({u_matrix:new l.aJ(v,o.u_matrix),u_lightpos:new l.aN(v,o.u_lightpos),u_lightintensity:new l.aI(v,o.u_lightintensity),u_lightcolor:new l.aN(v,o.u_lightcolor),u_vertical_gradient:new l.aI(v,o.u_vertical_gradient),u_height_factor:new l.aI(v,o.u_height_factor),u_image:new l.aH(v,o.u_image),u_texsize:new l.aO(v,o.u_texsize),u_pixel_coord_upper:new l.aO(v,o.u_pixel_coord_upper),u_pixel_coord_lower:new l.aO(v,o.u_pixel_coord_lower),u_scale:new l.aN(v,o.u_scale),u_fade:new l.aI(v,o.u_fade),u_opacity:new l.aI(v,o.u_opacity)}),fill:(v,o)=>({u_matrix:new l.aJ(v,o.u_matrix)}),fillPattern:(v,o)=>({u_matrix:new l.aJ(v,o.u_matrix),u_image:new l.aH(v,o.u_image),u_texsize:new l.aO(v,o.u_texsize),u_pixel_coord_upper:new l.aO(v,o.u_pixel_coord_upper),u_pixel_coord_lower:new l.aO(v,o.u_pixel_coord_lower),u_scale:new l.aN(v,o.u_scale),u_fade:new l.aI(v,o.u_fade)}),fillOutline:(v,o)=>({u_matrix:new l.aJ(v,o.u_matrix),u_world:new l.aO(v,o.u_world)}),fillOutlinePattern:(v,o)=>({u_matrix:new l.aJ(v,o.u_matrix),u_world:new l.aO(v,o.u_world),u_image:new l.aH(v,o.u_image),u_texsize:new l.aO(v,o.u_texsize),u_pixel_coord_upper:new l.aO(v,o.u_pixel_coord_upper),u_pixel_coord_lower:new l.aO(v,o.u_pixel_coord_lower),u_scale:new l.aN(v,o.u_scale),u_fade:new l.aI(v,o.u_fade)}),circle:(v,o)=>({u_camera_to_center_distance:new l.aI(v,o.u_camera_to_center_distance),u_scale_with_map:new l.aH(v,o.u_scale_with_map),u_pitch_with_map:new l.aH(v,o.u_pitch_with_map),u_extrude_scale:new l.aO(v,o.u_extrude_scale),u_device_pixel_ratio:new l.aI(v,o.u_device_pixel_ratio),u_matrix:new l.aJ(v,o.u_matrix)}),collisionBox:(v,o)=>({u_matrix:new l.aJ(v,o.u_matrix),u_pixel_extrude_scale:new l.aO(v,o.u_pixel_extrude_scale)}),collisionCircle:(v,o)=>({u_matrix:new l.aJ(v,o.u_matrix),u_inv_matrix:new l.aJ(v,o.u_inv_matrix),u_camera_to_center_distance:new l.aI(v,o.u_camera_to_center_distance),u_viewport_size:new l.aO(v,o.u_viewport_size)}),debug:(v,o)=>({u_color:new l.aL(v,o.u_color),u_matrix:new l.aJ(v,o.u_matrix),u_overlay:new l.aH(v,o.u_overlay),u_overlay_scale:new l.aI(v,o.u_overlay_scale)}),clippingMask:(v,o)=>({u_matrix:new l.aJ(v,o.u_matrix)}),heatmap:(v,o)=>({u_extrude_scale:new l.aI(v,o.u_extrude_scale),u_intensity:new l.aI(v,o.u_intensity),u_matrix:new l.aJ(v,o.u_matrix)}),heatmapTexture:(v,o)=>({u_matrix:new l.aJ(v,o.u_matrix),u_world:new l.aO(v,o.u_world),u_image:new l.aH(v,o.u_image),u_color_ramp:new l.aH(v,o.u_color_ramp),u_opacity:new l.aI(v,o.u_opacity)}),hillshade:(v,o)=>({u_matrix:new l.aJ(v,o.u_matrix),u_image:new l.aH(v,o.u_image),u_latrange:new l.aO(v,o.u_latrange),u_light:new l.aO(v,o.u_light),u_shadow:new l.aL(v,o.u_shadow),u_highlight:new l.aL(v,o.u_highlight),u_accent:new l.aL(v,o.u_accent)}),hillshadePrepare:(v,o)=>({u_matrix:new l.aJ(v,o.u_matrix),u_image:new l.aH(v,o.u_image),u_dimension:new l.aO(v,o.u_dimension),u_zoom:new l.aI(v,o.u_zoom),u_unpack:new l.aK(v,o.u_unpack)}),line:(v,o)=>({u_matrix:new l.aJ(v,o.u_matrix),u_ratio:new l.aI(v,o.u_ratio),u_device_pixel_ratio:new l.aI(v,o.u_device_pixel_ratio),u_units_to_pixels:new l.aO(v,o.u_units_to_pixels)}),lineGradient:(v,o)=>({u_matrix:new l.aJ(v,o.u_matrix),u_ratio:new l.aI(v,o.u_ratio),u_device_pixel_ratio:new l.aI(v,o.u_device_pixel_ratio),u_units_to_pixels:new l.aO(v,o.u_units_to_pixels),u_image:new l.aH(v,o.u_image),u_image_height:new l.aI(v,o.u_image_height)}),linePattern:(v,o)=>({u_matrix:new l.aJ(v,o.u_matrix),u_texsize:new l.aO(v,o.u_texsize),u_ratio:new l.aI(v,o.u_ratio),u_device_pixel_ratio:new l.aI(v,o.u_device_pixel_ratio),u_image:new l.aH(v,o.u_image),u_units_to_pixels:new l.aO(v,o.u_units_to_pixels),u_scale:new l.aN(v,o.u_scale),u_fade:new l.aI(v,o.u_fade)}),lineSDF:(v,o)=>({u_matrix:new l.aJ(v,o.u_matrix),u_ratio:new l.aI(v,o.u_ratio),u_device_pixel_ratio:new l.aI(v,o.u_device_pixel_ratio),u_units_to_pixels:new l.aO(v,o.u_units_to_pixels),u_patternscale_a:new l.aO(v,o.u_patternscale_a),u_patternscale_b:new l.aO(v,o.u_patternscale_b),u_sdfgamma:new l.aI(v,o.u_sdfgamma),u_image:new l.aH(v,o.u_image),u_tex_y_a:new l.aI(v,o.u_tex_y_a),u_tex_y_b:new l.aI(v,o.u_tex_y_b),u_mix:new l.aI(v,o.u_mix)}),raster:(v,o)=>({u_matrix:new l.aJ(v,o.u_matrix),u_tl_parent:new l.aO(v,o.u_tl_parent),u_scale_parent:new l.aI(v,o.u_scale_parent),u_buffer_scale:new l.aI(v,o.u_buffer_scale),u_fade_t:new l.aI(v,o.u_fade_t),u_opacity:new l.aI(v,o.u_opacity),u_image0:new l.aH(v,o.u_image0),u_image1:new l.aH(v,o.u_image1),u_brightness_low:new l.aI(v,o.u_brightness_low),u_brightness_high:new l.aI(v,o.u_brightness_high),u_saturation_factor:new l.aI(v,o.u_saturation_factor),u_contrast_factor:new l.aI(v,o.u_contrast_factor),u_spin_weights:new l.aN(v,o.u_spin_weights)}),symbolIcon:(v,o)=>({u_is_size_zoom_constant:new l.aH(v,o.u_is_size_zoom_constant),u_is_size_feature_constant:new l.aH(v,o.u_is_size_feature_constant),u_size_t:new l.aI(v,o.u_size_t),u_size:new l.aI(v,o.u_size),u_camera_to_center_distance:new l.aI(v,o.u_camera_to_center_distance),u_pitch:new l.aI(v,o.u_pitch),u_rotate_symbol:new l.aH(v,o.u_rotate_symbol),u_aspect_ratio:new l.aI(v,o.u_aspect_ratio),u_fade_change:new l.aI(v,o.u_fade_change),u_matrix:new l.aJ(v,o.u_matrix),u_label_plane_matrix:new l.aJ(v,o.u_label_plane_matrix),u_coord_matrix:new l.aJ(v,o.u_coord_matrix),u_is_text:new l.aH(v,o.u_is_text),u_pitch_with_map:new l.aH(v,o.u_pitch_with_map),u_is_along_line:new l.aH(v,o.u_is_along_line),u_is_variable_anchor:new l.aH(v,o.u_is_variable_anchor),u_texsize:new l.aO(v,o.u_texsize),u_texture:new l.aH(v,o.u_texture),u_translation:new l.aO(v,o.u_translation),u_pitched_scale:new l.aI(v,o.u_pitched_scale)}),symbolSDF:(v,o)=>({u_is_size_zoom_constant:new l.aH(v,o.u_is_size_zoom_constant),u_is_size_feature_constant:new l.aH(v,o.u_is_size_feature_constant),u_size_t:new l.aI(v,o.u_size_t),u_size:new l.aI(v,o.u_size),u_camera_to_center_distance:new l.aI(v,o.u_camera_to_center_distance),u_pitch:new l.aI(v,o.u_pitch),u_rotate_symbol:new l.aH(v,o.u_rotate_symbol),u_aspect_ratio:new l.aI(v,o.u_aspect_ratio),u_fade_change:new l.aI(v,o.u_fade_change),u_matrix:new l.aJ(v,o.u_matrix),u_label_plane_matrix:new l.aJ(v,o.u_label_plane_matrix),u_coord_matrix:new l.aJ(v,o.u_coord_matrix),u_is_text:new l.aH(v,o.u_is_text),u_pitch_with_map:new l.aH(v,o.u_pitch_with_map),u_is_along_line:new l.aH(v,o.u_is_along_line),u_is_variable_anchor:new l.aH(v,o.u_is_variable_anchor),u_texsize:new l.aO(v,o.u_texsize),u_texture:new l.aH(v,o.u_texture),u_gamma_scale:new l.aI(v,o.u_gamma_scale),u_device_pixel_ratio:new l.aI(v,o.u_device_pixel_ratio),u_is_halo:new l.aH(v,o.u_is_halo),u_translation:new l.aO(v,o.u_translation),u_pitched_scale:new l.aI(v,o.u_pitched_scale)}),symbolTextAndIcon:(v,o)=>({u_is_size_zoom_constant:new l.aH(v,o.u_is_size_zoom_constant),u_is_size_feature_constant:new l.aH(v,o.u_is_size_feature_constant),u_size_t:new l.aI(v,o.u_size_t),u_size:new l.aI(v,o.u_size),u_camera_to_center_distance:new l.aI(v,o.u_camera_to_center_distance),u_pitch:new l.aI(v,o.u_pitch),u_rotate_symbol:new l.aH(v,o.u_rotate_symbol),u_aspect_ratio:new l.aI(v,o.u_aspect_ratio),u_fade_change:new l.aI(v,o.u_fade_change),u_matrix:new l.aJ(v,o.u_matrix),u_label_plane_matrix:new l.aJ(v,o.u_label_plane_matrix),u_coord_matrix:new l.aJ(v,o.u_coord_matrix),u_is_text:new l.aH(v,o.u_is_text),u_pitch_with_map:new l.aH(v,o.u_pitch_with_map),u_is_along_line:new l.aH(v,o.u_is_along_line),u_is_variable_anchor:new l.aH(v,o.u_is_variable_anchor),u_texsize:new l.aO(v,o.u_texsize),u_texsize_icon:new l.aO(v,o.u_texsize_icon),u_texture:new l.aH(v,o.u_texture),u_texture_icon:new l.aH(v,o.u_texture_icon),u_gamma_scale:new l.aI(v,o.u_gamma_scale),u_device_pixel_ratio:new l.aI(v,o.u_device_pixel_ratio),u_is_halo:new l.aH(v,o.u_is_halo),u_translation:new l.aO(v,o.u_translation),u_pitched_scale:new l.aI(v,o.u_pitched_scale)}),background:(v,o)=>({u_matrix:new l.aJ(v,o.u_matrix),u_opacity:new l.aI(v,o.u_opacity),u_color:new l.aL(v,o.u_color)}),backgroundPattern:(v,o)=>({u_matrix:new l.aJ(v,o.u_matrix),u_opacity:new l.aI(v,o.u_opacity),u_image:new l.aH(v,o.u_image),u_pattern_tl_a:new l.aO(v,o.u_pattern_tl_a),u_pattern_br_a:new l.aO(v,o.u_pattern_br_a),u_pattern_tl_b:new l.aO(v,o.u_pattern_tl_b),u_pattern_br_b:new l.aO(v,o.u_pattern_br_b),u_texsize:new l.aO(v,o.u_texsize),u_mix:new l.aI(v,o.u_mix),u_pattern_size_a:new l.aO(v,o.u_pattern_size_a),u_pattern_size_b:new l.aO(v,o.u_pattern_size_b),u_scale_a:new l.aI(v,o.u_scale_a),u_scale_b:new l.aI(v,o.u_scale_b),u_pixel_coord_upper:new l.aO(v,o.u_pixel_coord_upper),u_pixel_coord_lower:new l.aO(v,o.u_pixel_coord_lower),u_tile_units_to_pixels:new l.aI(v,o.u_tile_units_to_pixels)}),terrain:(v,o)=>({u_matrix:new l.aJ(v,o.u_matrix),u_texture:new l.aH(v,o.u_texture),u_ele_delta:new l.aI(v,o.u_ele_delta),u_fog_matrix:new l.aJ(v,o.u_fog_matrix),u_fog_color:new l.aL(v,o.u_fog_color),u_fog_ground_blend:new l.aI(v,o.u_fog_ground_blend),u_fog_ground_blend_opacity:new l.aI(v,o.u_fog_ground_blend_opacity),u_horizon_color:new l.aL(v,o.u_horizon_color),u_horizon_fog_blend:new l.aI(v,o.u_horizon_fog_blend)}),terrainDepth:(v,o)=>({u_matrix:new l.aJ(v,o.u_matrix),u_ele_delta:new l.aI(v,o.u_ele_delta)}),terrainCoords:(v,o)=>({u_matrix:new l.aJ(v,o.u_matrix),u_texture:new l.aH(v,o.u_texture),u_terrain_coords_id:new l.aI(v,o.u_terrain_coords_id),u_ele_delta:new l.aI(v,o.u_ele_delta)}),sky:(v,o)=>({u_sky_color:new l.aL(v,o.u_sky_color),u_horizon_color:new l.aL(v,o.u_horizon_color),u_horizon:new l.aI(v,o.u_horizon),u_sky_horizon_blend:new l.aI(v,o.u_sky_horizon_blend)})};class Mo{constructor(o,d,m){this.context=o;const y=o.gl;this.buffer=y.createBuffer(),this.dynamicDraw=!!m,this.context.unbindVAO(),o.bindElementBuffer.set(this.buffer),y.bufferData(y.ELEMENT_ARRAY_BUFFER,d.arrayBuffer,this.dynamicDraw?y.DYNAMIC_DRAW:y.STATIC_DRAW),this.dynamicDraw||delete d.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(o){const d=this.context.gl;if(!this.dynamicDraw)throw new Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),d.bufferSubData(d.ELEMENT_ARRAY_BUFFER,0,o.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const h_={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class od{constructor(o,d,m,y){this.length=d.length,this.attributes=m,this.itemSize=d.bytesPerElement,this.dynamicDraw=y,this.context=o;const x=o.gl;this.buffer=x.createBuffer(),o.bindVertexBuffer.set(this.buffer),x.bufferData(x.ARRAY_BUFFER,d.arrayBuffer,this.dynamicDraw?x.DYNAMIC_DRAW:x.STATIC_DRAW),this.dynamicDraw||delete d.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(o){if(o.length!==this.length)throw new Error(`Length of new data is ${o.length}, which doesn't match current length of ${this.length}`);const d=this.context.gl;this.bind(),d.bufferSubData(d.ARRAY_BUFFER,0,o.arrayBuffer)}enableAttributes(o,d){for(let m=0;m<this.attributes.length;m++){const y=d.attributes[this.attributes[m].name];y!==void 0&&o.enableVertexAttribArray(y)}}setVertexAttribPointers(o,d,m){for(let y=0;y<this.attributes.length;y++){const x=this.attributes[y],M=d.attributes[x.name];M!==void 0&&o.vertexAttribPointer(M,x.components,o[h_[x.type]],!1,this.itemSize,x.offset+this.itemSize*(m||0))}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const Us=new WeakMap;function ps(v){var o;if(Us.has(v))return Us.get(v);{const d=(o=v.getParameter(v.VERSION))===null||o===void 0?void 0:o.startsWith("WebGL 2.0");return Us.set(v,d),d}}class _n{constructor(o){this.gl=o.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(o){}getDefault(){return this.default}setDefault(){this.set(this.default)}}class cu extends _n{getDefault(){return l.aM.transparent}set(o){const d=this.current;(o.r!==d.r||o.g!==d.g||o.b!==d.b||o.a!==d.a||this.dirty)&&(this.gl.clearColor(o.r,o.g,o.b,o.a),this.current=o,this.dirty=!1)}}class d_ extends _n{getDefault(){return 1}set(o){(o!==this.current||this.dirty)&&(this.gl.clearDepth(o),this.current=o,this.dirty=!1)}}class Ba extends _n{getDefault(){return 0}set(o){(o!==this.current||this.dirty)&&(this.gl.clearStencil(o),this.current=o,this.dirty=!1)}}class p_ extends _n{getDefault(){return[!0,!0,!0,!0]}set(o){const d=this.current;(o[0]!==d[0]||o[1]!==d[1]||o[2]!==d[2]||o[3]!==d[3]||this.dirty)&&(this.gl.colorMask(o[0],o[1],o[2],o[3]),this.current=o,this.dirty=!1)}}class rm extends _n{getDefault(){return!0}set(o){(o!==this.current||this.dirty)&&(this.gl.depthMask(o),this.current=o,this.dirty=!1)}}class f_ extends _n{getDefault(){return 255}set(o){(o!==this.current||this.dirty)&&(this.gl.stencilMask(o),this.current=o,this.dirty=!1)}}class om extends _n{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(o){const d=this.current;(o.func!==d.func||o.ref!==d.ref||o.mask!==d.mask||this.dirty)&&(this.gl.stencilFunc(o.func,o.ref,o.mask),this.current=o,this.dirty=!1)}}class sd extends _n{getDefault(){const o=this.gl;return[o.KEEP,o.KEEP,o.KEEP]}set(o){const d=this.current;(o[0]!==d[0]||o[1]!==d[1]||o[2]!==d[2]||this.dirty)&&(this.gl.stencilOp(o[0],o[1],o[2]),this.current=o,this.dirty=!1)}}class sm extends _n{getDefault(){return!1}set(o){if(o===this.current&&!this.dirty)return;const d=this.gl;o?d.enable(d.STENCIL_TEST):d.disable(d.STENCIL_TEST),this.current=o,this.dirty=!1}}class am extends _n{getDefault(){return[0,1]}set(o){const d=this.current;(o[0]!==d[0]||o[1]!==d[1]||this.dirty)&&(this.gl.depthRange(o[0],o[1]),this.current=o,this.dirty=!1)}}class lm extends _n{getDefault(){return!1}set(o){if(o===this.current&&!this.dirty)return;const d=this.gl;o?d.enable(d.DEPTH_TEST):d.disable(d.DEPTH_TEST),this.current=o,this.dirty=!1}}class cm extends _n{getDefault(){return this.gl.LESS}set(o){(o!==this.current||this.dirty)&&(this.gl.depthFunc(o),this.current=o,this.dirty=!1)}}class Hs extends _n{getDefault(){return!1}set(o){if(o===this.current&&!this.dirty)return;const d=this.gl;o?d.enable(d.BLEND):d.disable(d.BLEND),this.current=o,this.dirty=!1}}class um extends _n{getDefault(){const o=this.gl;return[o.ONE,o.ZERO]}set(o){const d=this.current;(o[0]!==d[0]||o[1]!==d[1]||this.dirty)&&(this.gl.blendFunc(o[0],o[1]),this.current=o,this.dirty=!1)}}class m_ extends _n{getDefault(){return l.aM.transparent}set(o){const d=this.current;(o.r!==d.r||o.g!==d.g||o.b!==d.b||o.a!==d.a||this.dirty)&&(this.gl.blendColor(o.r,o.g,o.b,o.a),this.current=o,this.dirty=!1)}}class hm extends _n{getDefault(){return this.gl.FUNC_ADD}set(o){(o!==this.current||this.dirty)&&(this.gl.blendEquation(o),this.current=o,this.dirty=!1)}}class jl extends _n{getDefault(){return!1}set(o){if(o===this.current&&!this.dirty)return;const d=this.gl;o?d.enable(d.CULL_FACE):d.disable(d.CULL_FACE),this.current=o,this.dirty=!1}}class g_ extends _n{getDefault(){return this.gl.BACK}set(o){(o!==this.current||this.dirty)&&(this.gl.cullFace(o),this.current=o,this.dirty=!1)}}class uu extends _n{getDefault(){return this.gl.CCW}set(o){(o!==this.current||this.dirty)&&(this.gl.frontFace(o),this.current=o,this.dirty=!1)}}class y_ extends _n{getDefault(){return null}set(o){(o!==this.current||this.dirty)&&(this.gl.useProgram(o),this.current=o,this.dirty=!1)}}class __ extends _n{getDefault(){return this.gl.TEXTURE0}set(o){(o!==this.current||this.dirty)&&(this.gl.activeTexture(o),this.current=o,this.dirty=!1)}}class dm extends _n{getDefault(){const o=this.gl;return[0,0,o.drawingBufferWidth,o.drawingBufferHeight]}set(o){const d=this.current;(o[0]!==d[0]||o[1]!==d[1]||o[2]!==d[2]||o[3]!==d[3]||this.dirty)&&(this.gl.viewport(o[0],o[1],o[2],o[3]),this.current=o,this.dirty=!1)}}class pm extends _n{getDefault(){return null}set(o){if(o===this.current&&!this.dirty)return;const d=this.gl;d.bindFramebuffer(d.FRAMEBUFFER,o),this.current=o,this.dirty=!1}}class fm extends _n{getDefault(){return null}set(o){if(o===this.current&&!this.dirty)return;const d=this.gl;d.bindRenderbuffer(d.RENDERBUFFER,o),this.current=o,this.dirty=!1}}class ad extends _n{getDefault(){return null}set(o){if(o===this.current&&!this.dirty)return;const d=this.gl;d.bindTexture(d.TEXTURE_2D,o),this.current=o,this.dirty=!1}}class mm extends _n{getDefault(){return null}set(o){if(o===this.current&&!this.dirty)return;const d=this.gl;d.bindBuffer(d.ARRAY_BUFFER,o),this.current=o,this.dirty=!1}}class hu extends _n{getDefault(){return null}set(o){const d=this.gl;d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,o),this.current=o,this.dirty=!1}}class Ho extends _n{getDefault(){return null}set(o){var d;if(o===this.current&&!this.dirty)return;const m=this.gl;ps(m)?m.bindVertexArray(o):(d=m.getExtension("OES_vertex_array_object"))===null||d===void 0||d.bindVertexArrayOES(o),this.current=o,this.dirty=!1}}class ld extends _n{getDefault(){return 4}set(o){if(o===this.current&&!this.dirty)return;const d=this.gl;d.pixelStorei(d.UNPACK_ALIGNMENT,o),this.current=o,this.dirty=!1}}class cd extends _n{getDefault(){return!1}set(o){if(o===this.current&&!this.dirty)return;const d=this.gl;d.pixelStorei(d.UNPACK_PREMULTIPLY_ALPHA_WEBGL,o),this.current=o,this.dirty=!1}}class ud extends _n{getDefault(){return!1}set(o){if(o===this.current&&!this.dirty)return;const d=this.gl;d.pixelStorei(d.UNPACK_FLIP_Y_WEBGL,o),this.current=o,this.dirty=!1}}class du extends _n{constructor(o,d){super(o),this.context=o,this.parent=d}getDefault(){return null}}class hd extends du{setDirty(){this.dirty=!0}set(o){if(o===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const d=this.gl;d.framebufferTexture2D(d.FRAMEBUFFER,d.COLOR_ATTACHMENT0,d.TEXTURE_2D,o,0),this.current=o,this.dirty=!1}}class qs extends du{set(o){if(o===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const d=this.gl;d.framebufferRenderbuffer(d.FRAMEBUFFER,d.DEPTH_ATTACHMENT,d.RENDERBUFFER,o),this.current=o,this.dirty=!1}}class dd extends du{set(o){if(o===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const d=this.gl;d.framebufferRenderbuffer(d.FRAMEBUFFER,d.DEPTH_STENCIL_ATTACHMENT,d.RENDERBUFFER,o),this.current=o,this.dirty=!1}}class b_{constructor(o,d,m,y,x){this.context=o,this.width=d,this.height=m;const M=o.gl,I=this.framebuffer=M.createFramebuffer();if(this.colorAttachment=new hd(o,I),y)this.depthAttachment=x?new dd(o,I):new qs(o,I);else if(x)throw new Error("Stencil cannot be set without depth");if(M.checkFramebufferStatus(M.FRAMEBUFFER)!==M.FRAMEBUFFER_COMPLETE)throw new Error("Framebuffer is not complete")}destroy(){const o=this.context.gl,d=this.colorAttachment.get();if(d&&o.deleteTexture(d),this.depthAttachment){const m=this.depthAttachment.get();m&&o.deleteRenderbuffer(m)}o.deleteFramebuffer(this.framebuffer)}}class Jn{constructor(o,d,m){this.blendFunction=o,this.blendColor=d,this.mask=m}}Jn.Replace=[1,0],Jn.disabled=new Jn(Jn.Replace,l.aM.transparent,[!1,!1,!1,!1]),Jn.unblended=new Jn(Jn.Replace,l.aM.transparent,[!0,!0,!0,!0]),Jn.alphaBlended=new Jn([1,771],l.aM.transparent,[!0,!0,!0,!0]);class x_{constructor(o){var d,m;if(this.gl=o,this.clearColor=new cu(this),this.clearDepth=new d_(this),this.clearStencil=new Ba(this),this.colorMask=new p_(this),this.depthMask=new rm(this),this.stencilMask=new f_(this),this.stencilFunc=new om(this),this.stencilOp=new sd(this),this.stencilTest=new sm(this),this.depthRange=new am(this),this.depthTest=new lm(this),this.depthFunc=new cm(this),this.blend=new Hs(this),this.blendFunc=new um(this),this.blendColor=new m_(this),this.blendEquation=new hm(this),this.cullFace=new jl(this),this.cullFaceSide=new g_(this),this.frontFace=new uu(this),this.program=new y_(this),this.activeTexture=new __(this),this.viewport=new dm(this),this.bindFramebuffer=new pm(this),this.bindRenderbuffer=new fm(this),this.bindTexture=new ad(this),this.bindVertexBuffer=new mm(this),this.bindElementBuffer=new hu(this),this.bindVertexArray=new Ho(this),this.pixelStoreUnpack=new ld(this),this.pixelStoreUnpackPremultiplyAlpha=new cd(this),this.pixelStoreUnpackFlipY=new ud(this),this.extTextureFilterAnisotropic=o.getExtension("EXT_texture_filter_anisotropic")||o.getExtension("MOZ_EXT_texture_filter_anisotropic")||o.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=o.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),this.maxTextureSize=o.getParameter(o.MAX_TEXTURE_SIZE),ps(o)){this.HALF_FLOAT=o.HALF_FLOAT;const y=o.getExtension("EXT_color_buffer_half_float");this.RGBA16F=(d=o.RGBA16F)!==null&&d!==void 0?d:y==null?void 0:y.RGBA16F_EXT,this.RGB16F=(m=o.RGB16F)!==null&&m!==void 0?m:y==null?void 0:y.RGB16F_EXT,o.getExtension("EXT_color_buffer_float")}else{o.getExtension("EXT_color_buffer_half_float"),o.getExtension("OES_texture_half_float_linear");const y=o.getExtension("OES_texture_half_float");this.HALF_FLOAT=y==null?void 0:y.HALF_FLOAT_OES}}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.bindVertexArray.dirty=!0,this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0}createIndexBuffer(o,d){return new Mo(this,o,d)}createVertexBuffer(o,d,m){return new od(this,o,d,m)}createRenderbuffer(o,d,m){const y=this.gl,x=y.createRenderbuffer();return this.bindRenderbuffer.set(x),y.renderbufferStorage(y.RENDERBUFFER,o,d,m),this.bindRenderbuffer.set(null),x}createFramebuffer(o,d,m,y){return new b_(this,o,d,m,y)}clear({color:o,depth:d,stencil:m}){const y=this.gl;let x=0;o&&(x|=y.COLOR_BUFFER_BIT,this.clearColor.set(o),this.colorMask.set([!0,!0,!0,!0])),d!==void 0&&(x|=y.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(d),this.depthMask.set(!0)),m!==void 0&&(x|=y.STENCIL_BUFFER_BIT,this.clearStencil.set(m),this.stencilMask.set(255)),y.clear(x)}setCullFace(o){o.enable===!1?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(o.mode),this.frontFace.set(o.frontFace))}setDepthMode(o){o.func!==this.gl.ALWAYS||o.mask?(this.depthTest.set(!0),this.depthFunc.set(o.func),this.depthMask.set(o.mask),this.depthRange.set(o.range)):this.depthTest.set(!1)}setStencilMode(o){o.test.func!==this.gl.ALWAYS||o.mask?(this.stencilTest.set(!0),this.stencilMask.set(o.mask),this.stencilOp.set([o.fail,o.depthFail,o.pass]),this.stencilFunc.set({func:o.test.func,ref:o.ref,mask:o.test.mask})):this.stencilTest.set(!1)}setColorMode(o){l.aE(o.blendFunction,Jn.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(o.blendFunction),this.blendColor.set(o.blendColor)),this.colorMask.set(o.mask)}createVertexArray(){var o;return ps(this.gl)?this.gl.createVertexArray():(o=this.gl.getExtension("OES_vertex_array_object"))===null||o===void 0?void 0:o.createVertexArrayOES()}deleteVertexArray(o){var d;return ps(this.gl)?this.gl.deleteVertexArray(o):(d=this.gl.getExtension("OES_vertex_array_object"))===null||d===void 0?void 0:d.deleteVertexArrayOES(o)}unbindVAO(){this.bindVertexArray.set(null)}}class Gt{constructor(o,d,m){this.func=o,this.mask=d,this.range=m}}Gt.ReadOnly=!1,Gt.ReadWrite=!0,Gt.disabled=new Gt(519,Gt.ReadOnly,[0,1]);const pu=7680;class On{constructor(o,d,m,y,x,M){this.test=o,this.ref=d,this.mask=m,this.fail=y,this.depthFail=x,this.pass=M}}On.disabled=new On({func:519,mask:0},0,0,pu,pu,pu);class Tn{constructor(o,d,m){this.enable=o,this.mode=d,this.frontFace=m}}let Ws;function Ul(v,o,d,m,y){const x=v.context,M=x.gl,I=v.useProgram("collisionBox"),O=[];let N=0,V=0;for(let ce=0;ce<m.length;ce++){const he=m[ce],ne=o.getTile(he).getBucket(d);if(!ne)continue;const me=y?ne.textCollisionBox:ne.iconCollisionBox,ge=ne.collisionCircleArray;if(ge.length>0){const xe=l.H();l.aQ(xe,ne.placementInvProjMatrix,v.transform.glCoordMatrix),l.aQ(xe,xe,ne.placementViewportMatrix),O.push({circleArray:ge,circleOffset:V,transform:he.posMatrix,invTransform:xe,coord:he}),N+=ge.length/4,V=N}me&&I.draw(x,M.LINES,Gt.disabled,On.disabled,v.colorModeForRenderPass(),Tn.disabled,{u_matrix:he.posMatrix,u_pixel_extrude_scale:[1/(F=v.transform).width,1/F.height]},v.style.map.terrain&&v.style.map.terrain.getTerrainData(he),d.id,me.layoutVertexBuffer,me.indexBuffer,me.segments,null,v.transform.zoom,null,null,me.collisionVertexBuffer)}var F;if(!y||!O.length)return;const Z=v.useProgram("collisionCircle"),J=new l.aR;J.resize(4*N),J._trim();let ee=0;for(const ce of O)for(let he=0;he<ce.circleArray.length/4;he++){const ne=4*he,me=ce.circleArray[ne+0],ge=ce.circleArray[ne+1],xe=ce.circleArray[ne+2],Be=ce.circleArray[ne+3];J.emplace(ee++,me,ge,xe,Be,0),J.emplace(ee++,me,ge,xe,Be,1),J.emplace(ee++,me,ge,xe,Be,2),J.emplace(ee++,me,ge,xe,Be,3)}(!Ws||Ws.length<2*N)&&(Ws=function(ce){const he=2*ce,ne=new l.aT;ne.resize(he),ne._trim();for(let me=0;me<he;me++){const ge=6*me;ne.uint16[ge+0]=4*me+0,ne.uint16[ge+1]=4*me+1,ne.uint16[ge+2]=4*me+2,ne.uint16[ge+3]=4*me+2,ne.uint16[ge+4]=4*me+3,ne.uint16[ge+5]=4*me+0}return ne}(N));const oe=x.createIndexBuffer(Ws,!0),le=x.createVertexBuffer(J,l.aS.members,!0);for(const ce of O){const he=js(ce.transform,ce.invTransform,v.transform);Z.draw(x,M.TRIANGLES,Gt.disabled,On.disabled,v.colorModeForRenderPass(),Tn.disabled,he,v.style.map.terrain&&v.style.map.terrain.getTerrainData(ce.coord),d.id,le,oe,l.a0.simpleSegment(0,2*ce.circleOffset,ce.circleArray.length,ce.circleArray.length/2),null,v.transform.zoom,null,null,null)}le.destroy(),oe.destroy()}Tn.disabled=new Tn(!1,1029,2305),Tn.backCCW=new Tn(!0,1029,2305);const Hl=l.an(new Float32Array(16));function pd(v,o,d,m,y,x){const{horizontalAlign:M,verticalAlign:I}=l.au(v);return new l.P((-(M-.5)*o/y+m[0])*x,(-(I-.5)*d/y+m[1])*x)}function Gs(v,o,d,m,y,x){const M=o.tileAnchorPoint.add(new l.P(o.translation[0],o.translation[1]));if(o.pitchWithMap){let I=m.mult(x);d||(I=I.rotate(-y));const O=M.add(I);return se(O.x,O.y,o.labelPlaneMatrix,o.getElevation).point}if(d){const I=Me(o.tileAnchorPoint.x+1,o.tileAnchorPoint.y,o).point.sub(v),O=Math.atan(I.y/I.x)+(I.x<0?Math.PI:0);return v.add(m.rotate(O))}return v.add(m)}function za(v,o,d,m,y,x,M,I,O,N,V,F,Z,J){const ee=v.text.placedSymbolArray,oe=v.text.dynamicLayoutVertexArray,le=v.icon.dynamicLayoutVertexArray,ce={};oe.clear();for(let he=0;he<ee.length;he++){const ne=ee.get(he),me=ne.hidden||!ne.crossTileID||v.allowVerticalPlacement&&!ne.placedOrientation?null:m[ne.crossTileID];if(me){const ge=new l.P(ne.anchorX,ne.anchorY),xe={getElevation:J,width:y.width,height:y.height,labelPlaneMatrix:x,lineVertexArray:null,pitchWithMap:d,projection:V,projectionCache:null,tileAnchorPoint:ge,translation:F,unwrappedTileID:Z},Be=d?se(ge.x,ge.y,M,J):Me(ge.x,ge.y,xe),Fe=H(y.cameraToCenterDistance,Be.signedDistanceFromCamera);let Qe=l.ai(v.textSizeData,O,ne)*Fe/l.ap;d&&(Qe*=v.tilePixelRatio/I);const{width:st,height:Ye,anchor:Ge,textOffset:mt,textBoxScale:Bt}=me,Ke=pd(Ge,st,Ye,mt,Bt,Qe),nt=V.getPitchedTextCorrection(y,ge.add(new l.P(F[0],F[1])),Z),Dt=Gs(Be.point,xe,o,Ke,y.angle,nt),Fn=v.allowVerticalPlacement&&ne.placedOrientation===l.ah.vertical?Math.PI/2:0;for(let $t=0;$t<ne.numGlyphs;$t++)l.aj(oe,Dt,Fn);N&&ne.associatedIconIndex>=0&&(ce[ne.associatedIconIndex]={shiftedAnchor:Dt,angle:Fn})}else kt(ne.numGlyphs,oe)}if(N){le.clear();const he=v.icon.placedSymbolArray;for(let ne=0;ne<he.length;ne++){const me=he.get(ne);if(me.hidden)kt(me.numGlyphs,le);else{const ge=ce[ne];if(ge)for(let xe=0;xe<me.numGlyphs;xe++)l.aj(le,ge.shiftedAnchor,ge.angle);else kt(me.numGlyphs,le)}}v.icon.dynamicLayoutVertexBuffer.updateData(le)}v.text.dynamicLayoutVertexBuffer.updateData(oe)}function Rr(v,o,d){return d.iconsInText&&o?"symbolTextAndIcon":v?"symbolSDF":"symbolIcon"}function fd(v,o,d,m,y,x,M,I,O,N,V,F){const Z=v.context,J=Z.gl,ee=v.transform,oe=Fs(),le=I==="map",ce=O==="map",he=I!=="viewport"&&d.layout.get("symbol-placement")!=="point",ne=le&&!ce&&!he,me=!ce&&he,ge=!d.layout.get("symbol-sort-key").isConstant();let xe=!1;const Be=v.depthModeForSublayer(0,Gt.ReadOnly),Fe=d._unevaluatedLayout.hasValue("text-variable-anchor")||d._unevaluatedLayout.hasValue("text-variable-anchor-offset"),Qe=[],st=oe.getCircleRadiusCorrection(ee);for(const Ye of m){const Ge=o.getTile(Ye),mt=Ge.getBucket(d);if(!mt)continue;const Bt=y?mt.text:mt.icon;if(!Bt||!Bt.segments.get().length||!Bt.hasVisibleVertices)continue;const Ke=Bt.programConfigurations.get(d.id),nt=y||mt.sdfIcons,Dt=y?mt.textSizeData:mt.iconSizeData,Fn=ce||ee.pitch!==0,$t=v.useProgram(Rr(nt,y,mt),Ke),Jt=l.ag(Dt,ee.zoom),$n=v.style.map.terrain&&v.style.map.terrain.getTerrainData(Ye);let Oi,io,jn,rr,Gi=[0,0],Bi=null;if(y)io=Ge.glyphAtlasTexture,jn=J.LINEAR,Oi=Ge.glyphAtlasTexture.size,mt.iconsInText&&(Gi=Ge.imageAtlasTexture.size,Bi=Ge.imageAtlasTexture,rr=Fn||v.options.rotating||v.options.zooming||Dt.kind==="composite"||Dt.kind==="camera"?J.LINEAR:J.NEAREST);else{const tn=d.layout.get("icon-size").constantOr(0)!==1||mt.iconsNeedLinear;io=Ge.imageAtlasTexture,jn=nt||v.options.rotating||v.options.zooming||tn||Fn?J.LINEAR:J.NEAREST,Oi=Ge.imageAtlasTexture.size}const Zi=Kt(Ge,1,v.transform.zoom),Po=me?Ye.posMatrix:Hl,Ka=qi(Po,ce,le,v.transform,Zi),Du=fr(Po,ce,le,v.transform,Zi),Ja=fr(Ye.posMatrix,ce,le,v.transform,Zi),Fr=oe.translatePosition(v.transform,Ge,x,M),Ou=Fe&&mt.hasTextData(),Vd=d.layout.get("icon-text-fit")!=="none"&&Ou&&mt.hasIconData();if(he){const tn=v.style.map.terrain?(Qa,el)=>v.style.map.terrain.getElevation(Ye,Qa,el):null,Js=d.layout.get("text-rotation-alignment")==="map";X(mt,Ye.posMatrix,v,y,Ka,Ja,ce,N,Js,oe,Ye.toUnwrapped(),ee.width,ee.height,Fr,tn)}const $r=Ye.posMatrix,jr=y&&Fe||Vd,fs=he||jr?Hl:Ka,ro=Du,Si=nt&&d.paint.get(y?"text-halo-width":"icon-halo-width").constantOr(1)!==0;let zi;zi=nt?mt.iconsInText?nd(Dt.kind,Jt,ne,ce,he,jr,v,$r,fs,ro,Fr,Oi,Gi,st):$l(Dt.kind,Jt,ne,ce,he,jr,v,$r,fs,ro,Fr,y,Oi,!0,st):im(Dt.kind,Jt,ne,ce,he,jr,v,$r,fs,ro,Fr,y,Oi,st);const xr={program:$t,buffers:Bt,uniformValues:zi,atlasTexture:io,atlasTextureIcon:Bi,atlasInterpolation:jn,atlasInterpolationIcon:rr,isSDF:nt,hasHalo:Si};if(ge&&mt.canOverlap){xe=!0;const tn=Bt.segments.get();for(const Js of tn)Qe.push({segments:new l.a0([Js]),sortKey:Js.sortKey,state:xr,terrainData:$n})}else Qe.push({segments:Bt.segments,sortKey:0,state:xr,terrainData:$n})}xe&&Qe.sort((Ye,Ge)=>Ye.sortKey-Ge.sortKey);for(const Ye of Qe){const Ge=Ye.state;if(Z.activeTexture.set(J.TEXTURE0),Ge.atlasTexture.bind(Ge.atlasInterpolation,J.CLAMP_TO_EDGE),Ge.atlasTextureIcon&&(Z.activeTexture.set(J.TEXTURE1),Ge.atlasTextureIcon&&Ge.atlasTextureIcon.bind(Ge.atlasInterpolationIcon,J.CLAMP_TO_EDGE)),Ge.isSDF){const mt=Ge.uniformValues;Ge.hasHalo&&(mt.u_is_halo=1,md(Ge.buffers,Ye.segments,d,v,Ge.program,Be,V,F,mt,Ye.terrainData)),mt.u_is_halo=0}md(Ge.buffers,Ye.segments,d,v,Ge.program,Be,V,F,Ge.uniformValues,Ye.terrainData)}}function md(v,o,d,m,y,x,M,I,O,N){const V=m.context;y.draw(V,V.gl.TRIANGLES,x,M,I,Tn.disabled,O,N,d.id,v.layoutVertexBuffer,v.indexBuffer,o,d.paint,m.transform.zoom,v.programConfigurations.get(d.id),v.dynamicLayoutVertexBuffer,v.opacityVertexBuffer)}function gd(v,o,d,m){const y=v.context,x=y.gl,M=On.disabled,I=new Jn([x.ONE,x.ONE],l.aM.transparent,[!0,!0,!0,!0]),O=o.getBucket(d);if(!O)return;const N=m.key;let V=d.heatmapFbos.get(N);V||(V=ql(y,o.tileSize,o.tileSize),d.heatmapFbos.set(N,V)),y.bindFramebuffer.set(V.framebuffer),y.viewport.set([0,0,o.tileSize,o.tileSize]),y.clear({color:l.aM.transparent});const F=O.programConfigurations.get(d.id),Z=v.useProgram("heatmap",F),J=v.style.map.terrain.getTerrainData(m);Z.draw(y,x.TRIANGLES,Gt.disabled,M,I,Tn.disabled,ir(m.posMatrix,o,v.transform.zoom,d.paint.get("heatmap-intensity")),J,d.id,O.layoutVertexBuffer,O.indexBuffer,O.segments,d.paint,v.transform.zoom,F)}function Zs(v,o,d){const m=v.context,y=m.gl;m.setColorMode(v.colorModeForRenderPass());const x=Wl(m,o),M=d.key,I=o.heatmapFbos.get(M);I&&(m.activeTexture.set(y.TEXTURE0),y.bindTexture(y.TEXTURE_2D,I.colorAttachment.get()),m.activeTexture.set(y.TEXTURE1),x.bind(y.LINEAR,y.CLAMP_TO_EDGE),v.useProgram("heatmapTexture").draw(m,y.TRIANGLES,Gt.disabled,On.disabled,v.colorModeForRenderPass(),Tn.disabled,ou(v,o,0,1),null,o.id,v.rasterBoundsBuffer,v.quadTriangleIndexBuffer,v.rasterBoundsSegments,o.paint,v.transform.zoom),I.destroy(),o.heatmapFbos.delete(M))}function ql(v,o,d){var m,y;const x=v.gl,M=x.createTexture();x.bindTexture(x.TEXTURE_2D,M),x.texParameteri(x.TEXTURE_2D,x.TEXTURE_WRAP_S,x.CLAMP_TO_EDGE),x.texParameteri(x.TEXTURE_2D,x.TEXTURE_WRAP_T,x.CLAMP_TO_EDGE),x.texParameteri(x.TEXTURE_2D,x.TEXTURE_MIN_FILTER,x.LINEAR),x.texParameteri(x.TEXTURE_2D,x.TEXTURE_MAG_FILTER,x.LINEAR);const I=(m=v.HALF_FLOAT)!==null&&m!==void 0?m:x.UNSIGNED_BYTE,O=(y=v.RGBA16F)!==null&&y!==void 0?y:x.RGBA;x.texImage2D(x.TEXTURE_2D,0,O,o,d,0,x.RGBA,I,null);const N=v.createFramebuffer(o,d,!1,!1);return N.colorAttachment.set(M),N}function Wl(v,o){return o.colorRampTexture||(o.colorRampTexture=new Xe(v,o.colorRamp,v.gl.RGBA)),o.colorRampTexture}function Na(v,o,d,m,y){if(!d||!m||!m.imageAtlas)return;const x=m.imageAtlas.patternPositions;let M=x[d.to.toString()],I=x[d.from.toString()];if(!M&&I&&(M=I),!I&&M&&(I=M),!M||!I){const O=y.getPaintProperty(o);M=x[O],I=x[O]}M&&I&&v.setConstantPatternPositions(M,I)}function Gl(v,o,d,m,y,x,M){const I=v.context.gl,O="fill-pattern",N=d.paint.get(O),V=N&&N.constantOr(1),F=d.getCrossfadeParameters();let Z,J,ee,oe,le;M?(J=V&&!d.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",Z=I.LINES):(J=V?"fillPattern":"fill",Z=I.TRIANGLES);const ce=N.constantOr(null);for(const he of m){const ne=o.getTile(he);if(V&&!ne.patternsLoaded())continue;const me=ne.getBucket(d);if(!me)continue;const ge=me.programConfigurations.get(d.id),xe=v.useProgram(J,ge),Be=v.style.map.terrain&&v.style.map.terrain.getTerrainData(he);V&&(v.context.activeTexture.set(I.TEXTURE0),ne.imageAtlasTexture.bind(I.LINEAR,I.CLAMP_TO_EDGE),ge.updatePaintBuffers(F)),Na(ge,O,ce,ne,d);const Fe=Be?he:null,Qe=v.translatePosMatrix(Fe?Fe.posMatrix:he.posMatrix,ne,d.paint.get("fill-translate"),d.paint.get("fill-translate-anchor"));if(M){oe=me.indexBuffer2,le=me.segments2;const st=[I.drawingBufferWidth,I.drawingBufferHeight];ee=J==="fillOutlinePattern"&&V?Qf(Qe,v,F,ne,st):s_(Qe,st)}else oe=me.indexBuffer,le=me.segments,ee=V?Jf(Qe,v,F,ne):Da(Qe);xe.draw(v.context,Z,y,v.stencilModeForClipping(he),x,Tn.disabled,ee,Be,d.id,me.layoutVertexBuffer,oe,le,d.paint,v.transform.zoom,ge)}}function fu(v,o,d,m,y,x,M){const I=v.context,O=I.gl,N="fill-extrusion-pattern",V=d.paint.get(N),F=V.constantOr(1),Z=d.getCrossfadeParameters(),J=d.paint.get("fill-extrusion-opacity"),ee=V.constantOr(null);for(const oe of m){const le=o.getTile(oe),ce=le.getBucket(d);if(!ce)continue;const he=v.style.map.terrain&&v.style.map.terrain.getTerrainData(oe),ne=ce.programConfigurations.get(d.id),me=v.useProgram(F?"fillExtrusionPattern":"fillExtrusion",ne);F&&(v.context.activeTexture.set(O.TEXTURE0),le.imageAtlasTexture.bind(O.LINEAR,O.CLAMP_TO_EDGE),ne.updatePaintBuffers(Z)),Na(ne,N,ee,le,d);const ge=v.translatePosMatrix(oe.posMatrix,le,d.paint.get("fill-extrusion-translate"),d.paint.get("fill-extrusion-translate-anchor")),xe=d.paint.get("fill-extrusion-vertical-gradient"),Be=F?ru(ge,v,xe,J,oe,Z,le):Vl(ge,v,xe,J);me.draw(I,I.gl.TRIANGLES,y,x,M,Tn.backCCW,Be,he,d.id,ce.layoutVertexBuffer,ce.indexBuffer,ce.segments,d.paint,v.transform.zoom,ne,v.style.map.terrain&&ce.centroidVertexBuffer)}}function Ra(v,o,d,m,y,x,M){const I=v.context,O=I.gl,N=d.fbo;if(!N)return;const V=v.useProgram("hillshade"),F=v.style.map.terrain&&v.style.map.terrain.getTerrainData(o);I.activeTexture.set(O.TEXTURE0),O.bindTexture(O.TEXTURE_2D,N.colorAttachment.get()),V.draw(I,O.TRIANGLES,y,x,M,Tn.disabled,((Z,J,ee,oe)=>{const le=ee.paint.get("hillshade-shadow-color"),ce=ee.paint.get("hillshade-highlight-color"),he=ee.paint.get("hillshade-accent-color");let ne=ee.paint.get("hillshade-illumination-direction")*(Math.PI/180);ee.paint.get("hillshade-illumination-anchor")==="viewport"&&(ne-=Z.transform.angle);const me=!Z.options.moving;return{u_matrix:oe?oe.posMatrix:Z.transform.calculatePosMatrix(J.tileID.toUnwrapped(),me),u_image:0,u_latrange:su(0,J.tileID),u_light:[ee.paint.get("hillshade-exaggeration"),ne],u_shadow:le,u_highlight:ce,u_accent:he}})(v,d,m,F?o:null),F,m.id,v.rasterBoundsBuffer,v.quadTriangleIndexBuffer,v.rasterBoundsSegments)}function La(v,o,d,m,y,x){const M=v.context,I=M.gl,O=o.dem;if(O&&O.data){const N=O.dim,V=O.stride,F=O.getPixels();if(M.activeTexture.set(I.TEXTURE1),M.pixelStoreUnpackPremultiplyAlpha.set(!1),o.demTexture=o.demTexture||v.getTileTexture(V),o.demTexture){const J=o.demTexture;J.update(F,{premultiply:!1}),J.bind(I.NEAREST,I.CLAMP_TO_EDGE)}else o.demTexture=new Xe(M,F,I.RGBA,{premultiply:!1}),o.demTexture.bind(I.NEAREST,I.CLAMP_TO_EDGE);M.activeTexture.set(I.TEXTURE0);let Z=o.fbo;if(!Z){const J=new Xe(M,{width:N,height:N,data:null},I.RGBA);J.bind(I.LINEAR,I.CLAMP_TO_EDGE),Z=o.fbo=M.createFramebuffer(N,N,!0,!1),Z.colorAttachment.set(J.texture)}M.bindFramebuffer.set(Z.framebuffer),M.viewport.set([0,0,N,N]),v.useProgram("hillshadePrepare").draw(M,I.TRIANGLES,m,y,x,Tn.disabled,((J,ee)=>{const oe=ee.stride,le=l.H();return l.aP(le,0,l.X,-l.X,0,0,1),l.J(le,le,[0,-l.X,0]),{u_matrix:le,u_image:1,u_dimension:[oe,oe],u_zoom:J.overscaledZ,u_unpack:ee.getUnpackVector()}})(o.tileID,O),null,d.id,v.rasterBoundsBuffer,v.quadTriangleIndexBuffer,v.rasterBoundsSegments),o.needsHillshadePrepare=!1}}function gm(v,o,d,m,y,x){const M=m.paint.get("raster-fade-duration");if(!x&&M>0){const I=E.now(),O=(I-v.timeAdded)/M,N=o?(I-o.timeAdded)/M:-1,V=d.getSource(),F=y.coveringZoomLevel({tileSize:V.tileSize,roundZoom:V.roundZoom}),Z=!o||Math.abs(o.tileID.overscaledZ-F)>Math.abs(v.tileID.overscaledZ-F),J=Z&&v.refreshedUponExpiration?1:l.ac(Z?O:1-N,0,1);return v.refreshedUponExpiration&&O>=1&&(v.refreshedUponExpiration=!1),o?{opacity:1,mix:1-J}:{opacity:J,mix:0}}return{opacity:1,mix:0}}const yd=new l.aM(1,0,0,1),un=new l.aM(0,1,0,1),mu=new l.aM(0,0,1,1),v_=new l.aM(1,0,1,1),ym=new l.aM(0,1,1,1);function Va(v,o,d,m){gu(v,0,o+d/2,v.transform.width,d,m)}function _m(v,o,d,m){gu(v,o-d/2,0,d,v.transform.height,m)}function gu(v,o,d,m,y,x){const M=v.context,I=M.gl;I.enable(I.SCISSOR_TEST),I.scissor(o*v.pixelRatio,d*v.pixelRatio,m*v.pixelRatio,y*v.pixelRatio),M.clear({color:x}),I.disable(I.SCISSOR_TEST)}function bm(v,o,d){const m=v.context,y=m.gl,x=d.posMatrix,M=v.useProgram("debug"),I=Gt.disabled,O=On.disabled,N=v.colorModeForRenderPass(),V="$debug",F=v.style.map.terrain&&v.style.map.terrain.getTerrainData(d);m.activeTexture.set(y.TEXTURE0);const Z=o.getTileByID(d.key).latestRawTileData,J=Math.floor((Z&&Z.byteLength||0)/1024),ee=o.getTile(d).tileSize,oe=512/Math.min(ee,512)*(d.overscaledZ/v.transform.zoom)*.5;let le=d.canonical.toString();d.overscaledZ!==d.canonical.z&&(le+=` => ${d.overscaledZ}`),function(ce,he){ce.initDebugOverlayCanvas();const ne=ce.debugOverlayCanvas,me=ce.context.gl,ge=ce.debugOverlayCanvas.getContext("2d");ge.clearRect(0,0,ne.width,ne.height),ge.shadowColor="white",ge.shadowBlur=2,ge.lineWidth=1.5,ge.strokeStyle="white",ge.textBaseline="top",ge.font="bold 36px Open Sans, sans-serif",ge.fillText(he,5,5),ge.strokeText(he,5,5),ce.debugOverlayTexture.update(ne),ce.debugOverlayTexture.bind(me.LINEAR,me.CLAMP_TO_EDGE)}(v,`${le} ${J}kB`),M.draw(m,y.TRIANGLES,I,O,Jn.alphaBlended,Tn.disabled,Fl(x,l.aM.transparent,oe),null,V,v.debugBuffer,v.quadTriangleIndexBuffer,v.debugSegments),M.draw(m,y.LINE_STRIP,I,O,N,Tn.disabled,Fl(x,l.aM.red),F,V,v.debugBuffer,v.tileBorderIndexBuffer,v.debugSegments)}function xm(v,o,d){const m=v.context,y=m.gl,x=v.colorModeForRenderPass(),M=new Gt(y.LEQUAL,Gt.ReadWrite,v.depthRangeFor3D),I=v.useProgram("terrain"),O=o.getTerrainMesh();m.bindFramebuffer.set(null),m.viewport.set([0,0,v.width,v.height]);for(const N of d){const V=v.renderToTexture.getTexture(N),F=o.getTerrainData(N.tileID);m.activeTexture.set(y.TEXTURE0),y.bindTexture(y.TEXTURE_2D,V.texture);const Z=v.transform.calculatePosMatrix(N.tileID.toUnwrapped()),J=o.getMeshFrameDelta(v.transform.zoom),ee=v.transform.calculateFogMatrix(N.tileID.toUnwrapped()),oe=ed(Z,J,ee,v.style.sky,v.transform.pitch);I.draw(m,y.TRIANGLES,M,On.disabled,x,Tn.backCCW,oe,F,"terrain",O.vertexBuffer,O.indexBuffer,O.segments)}}class yu{constructor(o,d,m){this.vertexBuffer=o,this.indexBuffer=d,this.segments=m}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.vertexBuffer=null,this.indexBuffer=null,this.segments=null}}class _u{constructor(o,d){this.context=new x_(o),this.transform=d,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:l.an(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=Re.maxUnderzooming+Re.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new Jh}resize(o,d,m){if(this.width=Math.floor(o*m),this.height=Math.floor(d*m),this.pixelRatio=m,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const y of this.style._order)this.style._layers[y].resize()}setup(){const o=this.context,d=new l.aX;d.emplaceBack(0,0),d.emplaceBack(l.X,0),d.emplaceBack(0,l.X),d.emplaceBack(l.X,l.X),this.tileExtentBuffer=o.createVertexBuffer(d,$s.members),this.tileExtentSegments=l.a0.simpleSegment(0,0,4,2);const m=new l.aX;m.emplaceBack(0,0),m.emplaceBack(l.X,0),m.emplaceBack(0,l.X),m.emplaceBack(l.X,l.X),this.debugBuffer=o.createVertexBuffer(m,$s.members),this.debugSegments=l.a0.simpleSegment(0,0,4,5);const y=new l.$;y.emplaceBack(0,0,0,0),y.emplaceBack(l.X,0,l.X,0),y.emplaceBack(0,l.X,0,l.X),y.emplaceBack(l.X,l.X,l.X,l.X),this.rasterBoundsBuffer=o.createVertexBuffer(y,Hi.members),this.rasterBoundsSegments=l.a0.simpleSegment(0,0,4,2);const x=new l.aX;x.emplaceBack(0,0),x.emplaceBack(1,0),x.emplaceBack(0,1),x.emplaceBack(1,1),this.viewportBuffer=o.createVertexBuffer(x,$s.members),this.viewportSegments=l.a0.simpleSegment(0,0,4,2);const M=new l.aZ;M.emplaceBack(0),M.emplaceBack(1),M.emplaceBack(3),M.emplaceBack(2),M.emplaceBack(0),this.tileBorderIndexBuffer=o.createIndexBuffer(M);const I=new l.aY;I.emplaceBack(0,1,2),I.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=o.createIndexBuffer(I);const O=this.context.gl;this.stencilClearMode=new On({func:O.ALWAYS,mask:0},0,255,O.ZERO,O.ZERO,O.ZERO)}clearStencil(){const o=this.context,d=o.gl;this.nextStencilID=1,this.currentStencilSource=void 0;const m=l.H();l.aP(m,0,this.width,this.height,0,0,1),l.K(m,m,[d.drawingBufferWidth,d.drawingBufferHeight,0]),this.useProgram("clippingMask").draw(o,d.TRIANGLES,Gt.disabled,this.stencilClearMode,Jn.disabled,Tn.disabled,nr(m),null,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(o,d){if(this.currentStencilSource===o.source||!o.isTileClipped()||!d||!d.length)return;this.currentStencilSource=o.source;const m=this.context,y=m.gl;this.nextStencilID+d.length>256&&this.clearStencil(),m.setColorMode(Jn.disabled),m.setDepthMode(Gt.disabled);const x=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(const M of d){const I=this._tileClippingMaskIDs[M.key]=this.nextStencilID++,O=this.style.map.terrain&&this.style.map.terrain.getTerrainData(M);x.draw(m,y.TRIANGLES,Gt.disabled,new On({func:y.ALWAYS,mask:0},I,255,y.KEEP,y.KEEP,y.REPLACE),Jn.disabled,Tn.disabled,nr(M.posMatrix),O,"$clipping",this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const o=this.nextStencilID++,d=this.context.gl;return new On({func:d.NOTEQUAL,mask:255},o,255,d.KEEP,d.KEEP,d.REPLACE)}stencilModeForClipping(o){const d=this.context.gl;return new On({func:d.EQUAL,mask:255},this._tileClippingMaskIDs[o.key],0,d.KEEP,d.KEEP,d.REPLACE)}stencilConfigForOverlap(o){const d=this.context.gl,m=o.sort((M,I)=>I.overscaledZ-M.overscaledZ),y=m[m.length-1].overscaledZ,x=m[0].overscaledZ-y+1;if(x>1){this.currentStencilSource=void 0,this.nextStencilID+x>256&&this.clearStencil();const M={};for(let I=0;I<x;I++)M[I+y]=new On({func:d.GEQUAL,mask:255},I+this.nextStencilID,255,d.KEEP,d.KEEP,d.REPLACE);return this.nextStencilID+=x,[M,m]}return[{[y]:On.disabled},m]}colorModeForRenderPass(){const o=this.context.gl;return this._showOverdrawInspector?new Jn([o.CONSTANT_COLOR,o.ONE],new l.aM(.125,.125,.125,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?Jn.unblended:Jn.alphaBlended}depthModeForSublayer(o,d,m){if(!this.opaquePassEnabledForLayer())return Gt.disabled;const y=1-((1+this.currentLayer)*this.numSublayers+o)*this.depthEpsilon;return new Gt(m||this.context.gl.LEQUAL,d,[y,y])}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}render(o,d){this.style=o,this.options=d,this.lineAtlas=o.lineAtlas,this.imageManager=o.imageManager,this.glyphManager=o.glyphManager,this.symbolFadeChange=o.placement.symbolFadeChange(E.now()),this.imageManager.beginFrame();const m=this.style._order,y=this.style.sourceCaches,x={},M={},I={};for(const O in y){const N=y[O];N.used&&N.prepare(this.context),x[O]=N.getVisibleCoordinates(),M[O]=x[O].slice().reverse(),I[O]=N.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let O=0;O<m.length;O++)if(this.style._layers[m[O]].is3D()){this.opaquePassCutoff=O;break}this.maybeDrawDepthAndCoords(!1),this.renderToTexture&&(this.renderToTexture.prepareForRender(this.style,this.transform.zoom),this.opaquePassCutoff=0),this.renderPass="offscreen";for(const O of m){const N=this.style._layers[O];if(!N.hasOffscreenPass()||N.isHidden(this.transform.zoom))continue;const V=M[N.source];(N.type==="custom"||V.length)&&this.renderLayer(this,y[N.source],N,V)}if(this.context.bindFramebuffer.set(null),this.context.clear({color:d.showOverdrawInspector?l.aM.black:l.aM.transparent,depth:1}),this.clearStencil(),this.style.sky&&function(O,N){const V=O.context,F=V.gl,Z=((ce,he,ne)=>({u_sky_color:ce.properties.get("sky-color"),u_horizon_color:ce.properties.get("horizon-color"),u_horizon:(he.height/2+he.getHorizon())*ne,u_sky_horizon_blend:ce.properties.get("sky-horizon-blend")*he.height/2*ne}))(N,O.style.map.transform,O.pixelRatio),J=new Gt(F.LEQUAL,Gt.ReadWrite,[0,1]),ee=On.disabled,oe=O.colorModeForRenderPass(),le=O.useProgram("sky");if(!N.mesh){const ce=new l.aX;ce.emplaceBack(-1,-1),ce.emplaceBack(1,-1),ce.emplaceBack(1,1),ce.emplaceBack(-1,1);const he=new l.aY;he.emplaceBack(0,1,2),he.emplaceBack(0,2,3),N.mesh=new yu(V.createVertexBuffer(ce,$s.members),V.createIndexBuffer(he),l.a0.simpleSegment(0,0,ce.length,he.length))}le.draw(V,F.TRIANGLES,J,ee,oe,Tn.disabled,Z,void 0,"sky",N.mesh.vertexBuffer,N.mesh.indexBuffer,N.mesh.segments)}(this,this.style.sky),this._showOverdrawInspector=d.showOverdrawInspector,this.depthRangeFor3D=[0,1-(o._order.length+2)*this.numSublayers*this.depthEpsilon],!this.renderToTexture)for(this.renderPass="opaque",this.currentLayer=m.length-1;this.currentLayer>=0;this.currentLayer--){const O=this.style._layers[m[this.currentLayer]],N=y[O.source],V=x[O.source];this._renderTileClippingMasks(O,V),this.renderLayer(this,N,O,V)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayer<m.length;this.currentLayer++){const O=this.style._layers[m[this.currentLayer]],N=y[O.source];if(this.renderToTexture&&this.renderToTexture.renderLayer(O))continue;const V=(O.type==="symbol"?I:M)[O.source];this._renderTileClippingMasks(O,x[O.source]),this.renderLayer(this,N,O,V)}if(this.options.showTileBoundaries){const O=function(N,V){let F=null;const Z=Object.values(N._layers).flatMap(le=>le.source&&!le.isHidden(V)?[N.sourceCaches[le.source]]:[]),J=Z.filter(le=>le.getSource().type==="vector"),ee=Z.filter(le=>le.getSource().type!=="vector"),oe=le=>{(!F||F.getSource().maxzoom<le.getSource().maxzoom)&&(F=le)};return J.forEach(le=>oe(le)),F||ee.forEach(le=>oe(le)),F}(this.style,this.transform.zoom);O&&function(N,V,F){for(let Z=0;Z<F.length;Z++)bm(N,V,F[Z])}(this,O,O.getVisibleCoordinates())}this.options.showPadding&&function(O){const N=O.transform.padding;Va(O,O.transform.height-(N.top||0),3,yd),Va(O,N.bottom||0,3,un),_m(O,N.left||0,3,mu),_m(O,O.transform.width-(N.right||0),3,v_);const V=O.transform.centerPoint;(function(F,Z,J,ee){gu(F,Z-1,J-10,2,20,ee),gu(F,Z-10,J-1,20,2,ee)})(O,V.x,O.transform.height-V.y,ym)}(this),this.context.setDefault()}maybeDrawDepthAndCoords(o){if(!this.style||!this.style.map||!this.style.map.terrain)return;const d=this.terrainFacilitator.matrix,m=this.transform.modelViewProjectionMatrix;let y=this.terrainFacilitator.dirty;y||(y=o?!l.a_(d,m):!l.a$(d,m)),y||(y=this.style.map.terrain.sourceCache.tilesAfterTime(this.terrainFacilitator.renderTime).length>0),y&&(l.b0(d,m),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,function(x,M){const I=x.context,O=I.gl,N=Jn.unblended,V=new Gt(O.LEQUAL,Gt.ReadWrite,[0,1]),F=M.getTerrainMesh(),Z=M.sourceCache.getRenderableTiles(),J=x.useProgram("terrainDepth");I.bindFramebuffer.set(M.getFramebuffer("depth").framebuffer),I.viewport.set([0,0,x.width/devicePixelRatio,x.height/devicePixelRatio]),I.clear({color:l.aM.transparent,depth:1});for(const ee of Z){const oe=M.getTerrainData(ee.tileID),le={u_matrix:x.transform.calculatePosMatrix(ee.tileID.toUnwrapped()),u_ele_delta:M.getMeshFrameDelta(x.transform.zoom)};J.draw(I,O.TRIANGLES,V,On.disabled,N,Tn.backCCW,le,oe,"terrain",F.vertexBuffer,F.indexBuffer,F.segments)}I.bindFramebuffer.set(null),I.viewport.set([0,0,x.width,x.height])}(this,this.style.map.terrain),function(x,M){const I=x.context,O=I.gl,N=Jn.unblended,V=new Gt(O.LEQUAL,Gt.ReadWrite,[0,1]),F=M.getTerrainMesh(),Z=M.getCoordsTexture(),J=M.sourceCache.getRenderableTiles(),ee=x.useProgram("terrainCoords");I.bindFramebuffer.set(M.getFramebuffer("coords").framebuffer),I.viewport.set([0,0,x.width/devicePixelRatio,x.height/devicePixelRatio]),I.clear({color:l.aM.transparent,depth:1}),M.coordsIndex=[];for(const oe of J){const le=M.getTerrainData(oe.tileID);I.activeTexture.set(O.TEXTURE0),O.bindTexture(O.TEXTURE_2D,Z.texture);const ce={u_matrix:x.transform.calculatePosMatrix(oe.tileID.toUnwrapped()),u_terrain_coords_id:(255-M.coordsIndex.length)/255,u_texture:0,u_ele_delta:M.getMeshFrameDelta(x.transform.zoom)};ee.draw(I,O.TRIANGLES,V,On.disabled,N,Tn.backCCW,ce,le,"terrain",F.vertexBuffer,F.indexBuffer,F.segments),M.coordsIndex.push(oe.tileID.key)}I.bindFramebuffer.set(null),I.viewport.set([0,0,x.width,x.height])}(this,this.style.map.terrain))}renderLayer(o,d,m,y){if(!m.isHidden(this.transform.zoom)&&(m.type==="background"||m.type==="custom"||(y||[]).length))switch(this.id=m.id,m.type){case"symbol":(function(x,M,I,O,N){if(x.renderPass!=="translucent")return;const V=On.disabled,F=x.colorModeForRenderPass();(I._unevaluatedLayout.hasValue("text-variable-anchor")||I._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&function(Z,J,ee,oe,le,ce,he,ne,me){const ge=J.transform,xe=Fs(),Be=le==="map",Fe=ce==="map";for(const Qe of Z){const st=oe.getTile(Qe),Ye=st.getBucket(ee);if(!Ye||!Ye.text||!Ye.text.segments.get().length)continue;const Ge=l.ag(Ye.textSizeData,ge.zoom),mt=Kt(st,1,J.transform.zoom),Bt=qi(Qe.posMatrix,Fe,Be,J.transform,mt),Ke=ee.layout.get("icon-text-fit")!=="none"&&Ye.hasIconData();if(Ge){const nt=Math.pow(2,ge.zoom-st.tileID.overscaledZ),Dt=J.style.map.terrain?($t,Jt)=>J.style.map.terrain.getElevation(Qe,$t,Jt):null,Fn=xe.translatePosition(ge,st,he,ne);za(Ye,Be,Fe,me,ge,Bt,Qe.posMatrix,nt,Ge,Ke,xe,Fn,Qe.toUnwrapped(),Dt)}}}(O,x,I,M,I.layout.get("text-rotation-alignment"),I.layout.get("text-pitch-alignment"),I.paint.get("text-translate"),I.paint.get("text-translate-anchor"),N),I.paint.get("icon-opacity").constantOr(1)!==0&&fd(x,M,I,O,!1,I.paint.get("icon-translate"),I.paint.get("icon-translate-anchor"),I.layout.get("icon-rotation-alignment"),I.layout.get("icon-pitch-alignment"),I.layout.get("icon-keep-upright"),V,F),I.paint.get("text-opacity").constantOr(1)!==0&&fd(x,M,I,O,!0,I.paint.get("text-translate"),I.paint.get("text-translate-anchor"),I.layout.get("text-rotation-alignment"),I.layout.get("text-pitch-alignment"),I.layout.get("text-keep-upright"),V,F),M.map.showCollisionBoxes&&(Ul(x,M,I,O,!0),Ul(x,M,I,O,!1))})(o,d,m,y,this.style.placement.variableOffsets);break;case"circle":(function(x,M,I,O){if(x.renderPass!=="translucent")return;const N=I.paint.get("circle-opacity"),V=I.paint.get("circle-stroke-width"),F=I.paint.get("circle-stroke-opacity"),Z=!I.layout.get("circle-sort-key").isConstant();if(N.constantOr(1)===0&&(V.constantOr(1)===0||F.constantOr(1)===0))return;const J=x.context,ee=J.gl,oe=x.depthModeForSublayer(0,Gt.ReadOnly),le=On.disabled,ce=x.colorModeForRenderPass(),he=[];for(let ne=0;ne<O.length;ne++){const me=O[ne],ge=M.getTile(me),xe=ge.getBucket(I);if(!xe)continue;const Be=xe.programConfigurations.get(I.id),Fe=x.useProgram("circle",Be),Qe=xe.layoutVertexBuffer,st=xe.indexBuffer,Ye=x.style.map.terrain&&x.style.map.terrain.getTerrainData(me),Ge={programConfiguration:Be,program:Fe,layoutVertexBuffer:Qe,indexBuffer:st,uniformValues:a_(x,me,ge,I),terrainData:Ye};if(Z){const mt=xe.segments.get();for(const Bt of mt)he.push({segments:new l.a0([Bt]),sortKey:Bt.sortKey,state:Ge})}else he.push({segments:xe.segments,sortKey:0,state:Ge})}Z&&he.sort((ne,me)=>ne.sortKey-me.sortKey);for(const ne of he){const{programConfiguration:me,program:ge,layoutVertexBuffer:xe,indexBuffer:Be,uniformValues:Fe,terrainData:Qe}=ne.state;ge.draw(J,ee.TRIANGLES,oe,le,ce,Tn.disabled,Fe,Qe,I.id,xe,Be,ne.segments,I.paint,x.transform.zoom,me)}})(o,d,m,y);break;case"heatmap":(function(x,M,I,O){if(I.paint.get("heatmap-opacity")===0)return;const N=x.context;if(x.style.map.terrain){for(const V of O){const F=M.getTile(V);M.hasRenderableParent(V)||(x.renderPass==="offscreen"?gd(x,F,I,V):x.renderPass==="translucent"&&Zs(x,I,V))}N.viewport.set([0,0,x.width,x.height])}else x.renderPass==="offscreen"?function(V,F,Z,J){const ee=V.context,oe=ee.gl,le=On.disabled,ce=new Jn([oe.ONE,oe.ONE],l.aM.transparent,[!0,!0,!0,!0]);(function(he,ne,me){const ge=he.gl;he.activeTexture.set(ge.TEXTURE1),he.viewport.set([0,0,ne.width/4,ne.height/4]);let xe=me.heatmapFbos.get(l.aU);xe?(ge.bindTexture(ge.TEXTURE_2D,xe.colorAttachment.get()),he.bindFramebuffer.set(xe.framebuffer)):(xe=ql(he,ne.width/4,ne.height/4),me.heatmapFbos.set(l.aU,xe))})(ee,V,Z),ee.clear({color:l.aM.transparent});for(let he=0;he<J.length;he++){const ne=J[he];if(F.hasRenderableParent(ne))continue;const me=F.getTile(ne),ge=me.getBucket(Z);if(!ge)continue;const xe=ge.programConfigurations.get(Z.id),Be=V.useProgram("heatmap",xe),{zoom:Fe}=V.transform;Be.draw(ee,oe.TRIANGLES,Gt.disabled,le,ce,Tn.disabled,ir(ne.posMatrix,me,Fe,Z.paint.get("heatmap-intensity")),null,Z.id,ge.layoutVertexBuffer,ge.indexBuffer,ge.segments,Z.paint,V.transform.zoom,xe)}ee.viewport.set([0,0,V.width,V.height])}(x,M,I,O):x.renderPass==="translucent"&&function(V,F){const Z=V.context,J=Z.gl;Z.setColorMode(V.colorModeForRenderPass());const ee=F.heatmapFbos.get(l.aU);ee&&(Z.activeTexture.set(J.TEXTURE0),J.bindTexture(J.TEXTURE_2D,ee.colorAttachment.get()),Z.activeTexture.set(J.TEXTURE1),Wl(Z,F).bind(J.LINEAR,J.CLAMP_TO_EDGE),V.useProgram("heatmapTexture").draw(Z,J.TRIANGLES,Gt.disabled,On.disabled,V.colorModeForRenderPass(),Tn.disabled,ou(V,F,0,1),null,F.id,V.viewportBuffer,V.quadTriangleIndexBuffer,V.viewportSegments,F.paint,V.transform.zoom))}(x,I)})(o,d,m,y);break;case"line":(function(x,M,I,O){if(x.renderPass!=="translucent")return;const N=I.paint.get("line-opacity"),V=I.paint.get("line-width");if(N.constantOr(1)===0||V.constantOr(1)===0)return;const F=x.depthModeForSublayer(0,Gt.ReadOnly),Z=x.colorModeForRenderPass(),J=I.paint.get("line-dasharray"),ee=I.paint.get("line-pattern"),oe=ee.constantOr(1),le=I.paint.get("line-gradient"),ce=I.getCrossfadeParameters(),he=oe?"linePattern":J?"lineSDF":le?"lineGradient":"line",ne=x.context,me=ne.gl;let ge=!0;for(const xe of O){const Be=M.getTile(xe);if(oe&&!Be.patternsLoaded())continue;const Fe=Be.getBucket(I);if(!Fe)continue;const Qe=Fe.programConfigurations.get(I.id),st=x.context.program.get(),Ye=x.useProgram(he,Qe),Ge=ge||Ye.program!==st,mt=x.style.map.terrain&&x.style.map.terrain.getTerrainData(xe),Bt=ee.constantOr(null);if(Bt&&Be.imageAtlas){const Dt=Be.imageAtlas,Fn=Dt.patternPositions[Bt.to.toString()],$t=Dt.patternPositions[Bt.from.toString()];Fn&&$t&&Qe.setConstantPatternPositions(Fn,$t)}const Ke=mt?xe:null,nt=oe?Oa(x,Be,I,ce,Ke):J?l_(x,Be,I,J,ce,Ke):le?em(x,Be,I,Fe.lineClipsArray.length,Ke):au(x,Be,I,Ke);if(oe)ne.activeTexture.set(me.TEXTURE0),Be.imageAtlasTexture.bind(me.LINEAR,me.CLAMP_TO_EDGE),Qe.updatePaintBuffers(ce);else if(J&&(Ge||x.lineAtlas.dirty))ne.activeTexture.set(me.TEXTURE0),x.lineAtlas.bind(ne);else if(le){const Dt=Fe.gradients[I.id];let Fn=Dt.texture;if(I.gradientVersion!==Dt.version){let $t=256;if(I.stepInterpolant){const Jt=M.getSource().maxzoom,$n=xe.canonical.z===Jt?Math.ceil(1<<x.transform.maxZoom-xe.canonical.z):1;$t=l.ac(l.aV(Fe.maxLineLength/l.X*1024*$n),256,ne.maxTextureSize)}Dt.gradient=l.aW({expression:I.gradientExpression(),evaluationKey:"lineProgress",resolution:$t,image:Dt.gradient||void 0,clips:Fe.lineClipsArray}),Dt.texture?Dt.texture.update(Dt.gradient):Dt.texture=new Xe(ne,Dt.gradient,me.RGBA),Dt.version=I.gradientVersion,Fn=Dt.texture}ne.activeTexture.set(me.TEXTURE0),Fn.bind(I.stepInterpolant?me.NEAREST:me.LINEAR,me.CLAMP_TO_EDGE)}Ye.draw(ne,me.TRIANGLES,F,x.stencilModeForClipping(xe),Z,Tn.disabled,nt,mt,I.id,Fe.layoutVertexBuffer,Fe.indexBuffer,Fe.segments,I.paint,x.transform.zoom,Qe,Fe.layoutVertexBuffer2),ge=!1}})(o,d,m,y);break;case"fill":(function(x,M,I,O){const N=I.paint.get("fill-color"),V=I.paint.get("fill-opacity");if(V.constantOr(1)===0)return;const F=x.colorModeForRenderPass(),Z=I.paint.get("fill-pattern"),J=x.opaquePassEnabledForLayer()&&!Z.constantOr(1)&&N.constantOr(l.aM.transparent).a===1&&V.constantOr(0)===1?"opaque":"translucent";if(x.renderPass===J){const ee=x.depthModeForSublayer(1,x.renderPass==="opaque"?Gt.ReadWrite:Gt.ReadOnly);Gl(x,M,I,O,ee,F,!1)}if(x.renderPass==="translucent"&&I.paint.get("fill-antialias")){const ee=x.depthModeForSublayer(I.getPaintProperty("fill-outline-color")?2:0,Gt.ReadOnly);Gl(x,M,I,O,ee,F,!0)}})(o,d,m,y);break;case"fill-extrusion":(function(x,M,I,O){const N=I.paint.get("fill-extrusion-opacity");if(N!==0&&x.renderPass==="translucent"){const V=new Gt(x.context.gl.LEQUAL,Gt.ReadWrite,x.depthRangeFor3D);if(N!==1||I.paint.get("fill-extrusion-pattern").constantOr(1))fu(x,M,I,O,V,On.disabled,Jn.disabled),fu(x,M,I,O,V,x.stencilModeFor3D(),x.colorModeForRenderPass());else{const F=x.colorModeForRenderPass();fu(x,M,I,O,V,On.disabled,F)}}})(o,d,m,y);break;case"hillshade":(function(x,M,I,O){if(x.renderPass!=="offscreen"&&x.renderPass!=="translucent")return;const N=x.context,V=x.depthModeForSublayer(0,Gt.ReadOnly),F=x.colorModeForRenderPass(),[Z,J]=x.renderPass==="translucent"?x.stencilConfigForOverlap(O):[{},O];for(const ee of J){const oe=M.getTile(ee);oe.needsHillshadePrepare!==void 0&&oe.needsHillshadePrepare&&x.renderPass==="offscreen"?La(x,oe,I,V,On.disabled,F):x.renderPass==="translucent"&&Ra(x,ee,oe,I,V,Z[ee.overscaledZ],F)}N.viewport.set([0,0,x.width,x.height])})(o,d,m,y);break;case"raster":(function(x,M,I,O){if(x.renderPass!=="translucent"||I.paint.get("raster-opacity")===0||!O.length)return;const N=x.context,V=N.gl,F=M.getSource(),Z=x.useProgram("raster"),J=x.colorModeForRenderPass(),[ee,oe]=F instanceof xi?[{},O]:x.stencilConfigForOverlap(O),le=oe[oe.length-1].overscaledZ,ce=!x.options.moving;for(const he of oe){const ne=x.depthModeForSublayer(he.overscaledZ-le,I.paint.get("raster-opacity")===1?Gt.ReadWrite:Gt.ReadOnly,V.LESS),me=M.getTile(he);me.registerFadeDuration(I.paint.get("raster-fade-duration"));const ge=M.findLoadedParent(he,0),xe=M.findLoadedSibling(he),Be=gm(me,ge||xe||null,M,I,x.transform,x.style.map.terrain);let Fe,Qe;const st=I.paint.get("raster-resampling")==="nearest"?V.NEAREST:V.LINEAR;N.activeTexture.set(V.TEXTURE0),me.texture.bind(st,V.CLAMP_TO_EDGE,V.LINEAR_MIPMAP_NEAREST),N.activeTexture.set(V.TEXTURE1),ge?(ge.texture.bind(st,V.CLAMP_TO_EDGE,V.LINEAR_MIPMAP_NEAREST),Fe=Math.pow(2,ge.tileID.overscaledZ-me.tileID.overscaledZ),Qe=[me.tileID.canonical.x*Fe%1,me.tileID.canonical.y*Fe%1]):me.texture.bind(st,V.CLAMP_TO_EDGE,V.LINEAR_MIPMAP_NEAREST),me.texture.useMipmap&&N.extTextureFilterAnisotropic&&x.transform.pitch>20&&V.texParameterf(V.TEXTURE_2D,N.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,N.extTextureFilterAnisotropicMax);const Ye=x.style.map.terrain&&x.style.map.terrain.getTerrainData(he),Ge=Ye?he:null,mt=Ge?Ge.posMatrix:x.transform.calculatePosMatrix(he.toUnwrapped(),ce),Bt=c_(mt,Qe||[0,0],Fe||1,Be,I);F instanceof xi?Z.draw(N,V.TRIANGLES,ne,On.disabled,J,Tn.disabled,Bt,Ye,I.id,F.boundsBuffer,x.quadTriangleIndexBuffer,F.boundsSegments):Z.draw(N,V.TRIANGLES,ne,ee[he.overscaledZ],J,Tn.disabled,Bt,Ye,I.id,x.rasterBoundsBuffer,x.quadTriangleIndexBuffer,x.rasterBoundsSegments)}})(o,d,m,y);break;case"background":(function(x,M,I,O){const N=I.paint.get("background-color"),V=I.paint.get("background-opacity");if(V===0)return;const F=x.context,Z=F.gl,J=x.transform,ee=J.tileSize,oe=I.paint.get("background-pattern");if(x.isPatternMissing(oe))return;const le=!oe&&N.a===1&&V===1&&x.opaquePassEnabledForLayer()?"opaque":"translucent";if(x.renderPass!==le)return;const ce=On.disabled,he=x.depthModeForSublayer(0,le==="opaque"?Gt.ReadWrite:Gt.ReadOnly),ne=x.colorModeForRenderPass(),me=x.useProgram(oe?"backgroundPattern":"background"),ge=O||J.coveringTiles({tileSize:ee,terrain:x.style.map.terrain});oe&&(F.activeTexture.set(Z.TEXTURE0),x.imageManager.bind(x.context));const xe=I.getCrossfadeParameters();for(const Be of ge){const Fe=O?Be.posMatrix:x.transform.calculatePosMatrix(Be.toUnwrapped()),Qe=oe?id(Fe,V,x,oe,{tileID:Be,tileSize:ee},xe):lu(Fe,V,N),st=x.style.map.terrain&&x.style.map.terrain.getTerrainData(Be);me.draw(F,Z.TRIANGLES,he,ce,ne,Tn.disabled,Qe,st,I.id,x.tileExtentBuffer,x.quadTriangleIndexBuffer,x.tileExtentSegments)}})(o,0,m,y);break;case"custom":(function(x,M,I){const O=x.context,N=I.implementation;if(x.renderPass==="offscreen"){const V=N.prerender;V&&(x.setCustomLayerDefaults(),O.setColorMode(x.colorModeForRenderPass()),V.call(N,O.gl,x.transform.customLayerMatrix()),O.setDirty(),x.setBaseState())}else if(x.renderPass==="translucent"){x.setCustomLayerDefaults(),O.setColorMode(x.colorModeForRenderPass()),O.setStencilMode(On.disabled);const V=N.renderingMode==="3d"?new Gt(x.context.gl.LEQUAL,Gt.ReadWrite,x.depthRangeFor3D):x.depthModeForSublayer(0,Gt.ReadOnly);O.setDepthMode(V),N.render(O.gl,x.transform.customLayerMatrix(),{farZ:x.transform.farZ,nearZ:x.transform.nearZ,fov:x.transform._fov,modelViewProjectionMatrix:x.transform.modelViewProjectionMatrix,projectionMatrix:x.transform.projectionMatrix}),O.setDirty(),x.setBaseState(),O.bindFramebuffer.set(null)}})(o,0,m)}}translatePosMatrix(o,d,m,y,x){if(!m[0]&&!m[1])return o;const M=x?y==="map"?this.transform.angle:0:y==="viewport"?-this.transform.angle:0;if(M){const N=Math.sin(M),V=Math.cos(M);m=[m[0]*V-m[1]*N,m[0]*N+m[1]*V]}const I=[x?m[0]:Kt(d,m[0],this.transform.zoom),x?m[1]:Kt(d,m[1],this.transform.zoom),0],O=new Float32Array(16);return l.J(O,o,I),O}saveTileTexture(o){const d=this._tileTextures[o.size[0]];d?d.push(o):this._tileTextures[o.size[0]]=[o]}getTileTexture(o){const d=this._tileTextures[o];return d&&d.length>0?d.pop():null}isPatternMissing(o){if(!o)return!1;if(!o.from||!o.to)return!0;const d=this.imageManager.getPattern(o.from.toString()),m=this.imageManager.getPattern(o.to.toString());return!d||!m}useProgram(o,d){this.cache=this.cache||{};const m=o+(d?d.cacheKey:"")+(this._showOverdrawInspector?"/overdraw":"")+(this.style.map.terrain?"/terrain":"");return this.cache[m]||(this.cache[m]=new td(this.context,ds[o],d,rd[o],this._showOverdrawInspector,this.style.map.terrain)),this.cache[m]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){const o=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(o.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new Xe(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}overLimit(){const{drawingBufferWidth:o,drawingBufferHeight:d}=this.context.gl;return this.width!==o||this.height!==d}}class Fa{constructor(o,d){this.points=o,this.planes=d}static fromInvProjectionMatrix(o,d,m){const y=Math.pow(2,m),x=[[-1,1,-1,1],[1,1,-1,1],[1,-1,-1,1],[-1,-1,-1,1],[-1,1,1,1],[1,1,1,1],[1,-1,1,1],[-1,-1,1,1]].map(I=>{const O=1/(I=l.af([],I,o))[3]/d*y;return l.b1(I,I,[O,O,1/I[3],O])}),M=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(I=>{const O=function(Z,J){var ee=J[0],oe=J[1],le=J[2],ce=ee*ee+oe*oe+le*le;return ce>0&&(ce=1/Math.sqrt(ce)),Z[0]=J[0]*ce,Z[1]=J[1]*ce,Z[2]=J[2]*ce,Z}([],function(Z,J,ee){var oe=J[0],le=J[1],ce=J[2],he=ee[0],ne=ee[1],me=ee[2];return Z[0]=le*me-ce*ne,Z[1]=ce*he-oe*me,Z[2]=oe*ne-le*he,Z}([],Se([],x[I[0]],x[I[1]]),Se([],x[I[2]],x[I[1]]))),N=-((V=O)[0]*(F=x[I[1]])[0]+V[1]*F[1]+V[2]*F[2]);var V,F;return O.concat(N)});return new Fa(x,M)}}class $a{constructor(o,d){this.min=o,this.max=d,this.center=function(m,y,x){return m[0]=.5*y[0],m[1]=.5*y[1],m[2]=.5*y[2],m}([],function(m,y,x){return m[0]=y[0]+x[0],m[1]=y[1]+x[1],m[2]=y[2]+x[2],m}([],this.min,this.max))}quadrant(o){const d=[o%2==0,o<2],m=Ie(this.min),y=Ie(this.max);for(let x=0;x<d.length;x++)m[x]=d[x]?this.min[x]:this.center[x],y[x]=d[x]?this.center[x]:this.max[x];return y[2]=this.max[2],new $a(m,y)}distanceX(o){return Math.max(Math.min(this.max[0],o[0]),this.min[0])-o[0]}distanceY(o){return Math.max(Math.min(this.max[1],o[1]),this.min[1])-o[1]}intersects(o){const d=[[this.min[0],this.min[1],this.min[2],1],[this.max[0],this.min[1],this.min[2],1],[this.max[0],this.max[1],this.min[2],1],[this.min[0],this.max[1],this.min[2],1],[this.min[0],this.min[1],this.max[2],1],[this.max[0],this.min[1],this.max[2],1],[this.max[0],this.max[1],this.max[2],1],[this.min[0],this.max[1],this.max[2],1]];let m=!0;for(let y=0;y<o.planes.length;y++){const x=o.planes[y];let M=0;for(let I=0;I<d.length;I++)l.b2(x,d[I])>=0&&M++;if(M===0)return 0;M!==d.length&&(m=!1)}if(m)return 2;for(let y=0;y<3;y++){let x=Number.MAX_VALUE,M=-Number.MAX_VALUE;for(let I=0;I<o.points.length;I++){const O=o.points[I][y]-this.min[y];x=Math.min(x,O),M=Math.max(M,O)}if(M<0||x>this.max[y]-this.min[y])return 0}return 1}}class ja{constructor(o=0,d=0,m=0,y=0){if(isNaN(o)||o<0||isNaN(d)||d<0||isNaN(m)||m<0||isNaN(y)||y<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=o,this.bottom=d,this.left=m,this.right=y}interpolate(o,d,m){return d.top!=null&&o.top!=null&&(this.top=l.y.number(o.top,d.top,m)),d.bottom!=null&&o.bottom!=null&&(this.bottom=l.y.number(o.bottom,d.bottom,m)),d.left!=null&&o.left!=null&&(this.left=l.y.number(o.left,d.left,m)),d.right!=null&&o.right!=null&&(this.right=l.y.number(o.right,d.right,m)),this}getCenter(o,d){const m=l.ac((this.left+o-this.right)/2,0,o),y=l.ac((this.top+d-this.bottom)/2,0,d);return new l.P(m,y)}equals(o){return this.top===o.top&&this.bottom===o.bottom&&this.left===o.left&&this.right===o.right}clone(){return new ja(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}const _d=85.051129;class Ua{constructor(o,d,m,y,x){this.tileSize=512,this._renderWorldCopies=x===void 0||!!x,this._minZoom=o||0,this._maxZoom=d||22,this._minPitch=m??0,this._maxPitch=y??60,this.setMaxBounds(),this.width=0,this.height=0,this._center=new l.N(0,0),this._elevation=0,this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new ja,this._posMatrixCache={},this._alignedPosMatrixCache={},this._fogMatrixCache={},this.minElevationForCurrentTile=0}clone(){const o=new Ua(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return o.apply(this),o}apply(o){this.tileSize=o.tileSize,this.latRange=o.latRange,this.lngRange=o.lngRange,this.width=o.width,this.height=o.height,this._center=o._center,this._elevation=o._elevation,this.minElevationForCurrentTile=o.minElevationForCurrentTile,this.zoom=o.zoom,this.angle=o.angle,this._fov=o._fov,this._pitch=o._pitch,this._unmodified=o._unmodified,this._edgeInsets=o._edgeInsets.clone(),this._calcMatrices()}get minZoom(){return this._minZoom}set minZoom(o){this._minZoom!==o&&(this._minZoom=o,this.zoom=Math.max(this.zoom,o))}get maxZoom(){return this._maxZoom}set maxZoom(o){this._maxZoom!==o&&(this._maxZoom=o,this.zoom=Math.min(this.zoom,o))}get minPitch(){return this._minPitch}set minPitch(o){this._minPitch!==o&&(this._minPitch=o,this.pitch=Math.max(this.pitch,o))}get maxPitch(){return this._maxPitch}set maxPitch(o){this._maxPitch!==o&&(this._maxPitch=o,this.pitch=Math.min(this.pitch,o))}get renderWorldCopies(){return this._renderWorldCopies}set renderWorldCopies(o){o===void 0?o=!0:o===null&&(o=!1),this._renderWorldCopies=o}get worldSize(){return this.tileSize*this.scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new l.P(this.width,this.height)}get bearing(){return-this.angle/Math.PI*180}set bearing(o){const d=-l.b3(o,-180,180)*Math.PI/180;this.angle!==d&&(this._unmodified=!1,this.angle=d,this._calcMatrices(),this.rotationMatrix=function(){var m=new l.A(4);return l.A!=Float32Array&&(m[1]=0,m[2]=0),m[0]=1,m[3]=1,m}(),function(m,y,x){var M=y[0],I=y[1],O=y[2],N=y[3],V=Math.sin(x),F=Math.cos(x);m[0]=M*F+O*V,m[1]=I*F+N*V,m[2]=M*-V+O*F,m[3]=I*-V+N*F}(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(o){const d=l.ac(o,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==d&&(this._unmodified=!1,this._pitch=d,this._calcMatrices())}get fov(){return this._fov/Math.PI*180}set fov(o){o=Math.max(.01,Math.min(60,o)),this._fov!==o&&(this._unmodified=!1,this._fov=o/180*Math.PI,this._calcMatrices())}get zoom(){return this._zoom}set zoom(o){const d=Math.min(Math.max(o,this.minZoom),this.maxZoom);this._zoom!==d&&(this._unmodified=!1,this._zoom=d,this.tileZoom=Math.max(0,Math.floor(d)),this.scale=this.zoomScale(d),this._constrain(),this._calcMatrices())}get center(){return this._center}set center(o){o.lat===this._center.lat&&o.lng===this._center.lng||(this._unmodified=!1,this._center=o,this._constrain(),this._calcMatrices())}get elevation(){return this._elevation}set elevation(o){o!==this._elevation&&(this._elevation=o,this._constrain(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}set padding(o){this._edgeInsets.equals(o)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,o,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}isPaddingEqual(o){return this._edgeInsets.equals(o)}interpolatePadding(o,d,m){this._unmodified=!1,this._edgeInsets.interpolate(o,d,m),this._constrain(),this._calcMatrices()}coveringZoomLevel(o){const d=(o.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/o.tileSize));return Math.max(0,d)}getVisibleUnwrappedCoordinates(o){const d=[new l.b4(0,o)];if(this._renderWorldCopies){const m=this.pointCoordinate(new l.P(0,0)),y=this.pointCoordinate(new l.P(this.width,0)),x=this.pointCoordinate(new l.P(this.width,this.height)),M=this.pointCoordinate(new l.P(0,this.height)),I=Math.floor(Math.min(m.x,y.x,x.x,M.x)),O=Math.floor(Math.max(m.x,y.x,x.x,M.x)),N=1;for(let V=I-N;V<=O+N;V++)V!==0&&d.push(new l.b4(V,o))}return d}coveringTiles(o){var d,m;let y=this.coveringZoomLevel(o);const x=y;if(o.minzoom!==void 0&&y<o.minzoom)return[];o.maxzoom!==void 0&&y>o.maxzoom&&(y=o.maxzoom);const M=this.pointCoordinate(this.getCameraPoint()),I=l.Z.fromLngLat(this.center),O=Math.pow(2,y),N=[O*M.x,O*M.y,0],V=[O*I.x,O*I.y,0],F=Fa.fromInvProjectionMatrix(this.invModelViewProjectionMatrix,this.worldSize,y);let Z=o.minzoom||0;!o.terrain&&this.pitch<=60&&this._edgeInsets.top<.1&&(Z=y);const J=o.terrain?2/Math.min(this.tileSize,o.tileSize)*this.tileSize:3,ee=ne=>({aabb:new $a([ne*O,0,0],[(ne+1)*O,O,0]),zoom:0,x:0,y:0,wrap:ne,fullyVisible:!1}),oe=[],le=[],ce=y,he=o.reparseOverscaled?x:y;if(this._renderWorldCopies)for(let ne=1;ne<=3;ne++)oe.push(ee(-ne)),oe.push(ee(ne));for(oe.push(ee(0));oe.length>0;){const ne=oe.pop(),me=ne.x,ge=ne.y;let xe=ne.fullyVisible;if(!xe){const Ye=ne.aabb.intersects(F);if(Ye===0)continue;xe=Ye===2}const Be=o.terrain?N:V,Fe=ne.aabb.distanceX(Be),Qe=ne.aabb.distanceY(Be),st=Math.max(Math.abs(Fe),Math.abs(Qe));if(ne.zoom===ce||st>J+(1<<ce-ne.zoom)-2&&ne.zoom>=Z){const Ye=ce-ne.zoom,Ge=N[0]-.5-(me<<Ye),mt=N[1]-.5-(ge<<Ye);le.push({tileID:new l.S(ne.zoom===ce?he:ne.zoom,ne.wrap,ne.zoom,me,ge),distanceSq:Ne([V[0]-.5-me,V[1]-.5-ge]),tileDistanceToCamera:Math.sqrt(Ge*Ge+mt*mt)})}else for(let Ye=0;Ye<4;Ye++){const Ge=(me<<1)+Ye%2,mt=(ge<<1)+(Ye>>1),Bt=ne.zoom+1;let Ke=ne.aabb.quadrant(Ye);if(o.terrain){const nt=new l.S(Bt,ne.wrap,Bt,Ge,mt),Dt=o.terrain.getMinMaxElevation(nt),Fn=(d=Dt.minElevation)!==null&&d!==void 0?d:this.elevation,$t=(m=Dt.maxElevation)!==null&&m!==void 0?m:this.elevation;Ke=new $a([Ke.min[0],Ke.min[1],Fn],[Ke.max[0],Ke.max[1],$t])}oe.push({aabb:Ke,zoom:Bt,x:Ge,y:mt,wrap:ne.wrap,fullyVisible:xe})}}return le.sort((ne,me)=>ne.distanceSq-me.distanceSq).map(ne=>ne.tileID)}resize(o,d){this.width=o,this.height=d,this.pixelsToGLUnits=[2/o,-2/d],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(o){return Math.pow(2,o)}scaleZoom(o){return Math.log(o)/Math.LN2}project(o){const d=l.ac(o.lat,-85.051129,_d);return new l.P(l.O(o.lng)*this.worldSize,l.Q(d)*this.worldSize)}unproject(o){return new l.Z(o.x/this.worldSize,o.y/this.worldSize).toLngLat()}get point(){return this.project(this.center)}getCameraPosition(){return{lngLat:this.pointLocation(this.getCameraPoint()),altitude:Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter+this.elevation}}recalculateZoom(o){const d=this.elevation,m=Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter,y=this.pointLocation(this.centerPoint,o),x=o.getElevationForLngLatZoom(y,this.tileZoom);if(!(this.elevation-x))return;const M=m+d-x,I=Math.cos(this._pitch)*this.cameraToCenterDistance/M/l.b5(1,y.lat),O=this.scaleZoom(I/this.tileSize);this._elevation=x,this._center=y,this.zoom=O}setLocationAtPoint(o,d){const m=this.pointCoordinate(d),y=this.pointCoordinate(this.centerPoint),x=this.locationCoordinate(o),M=new l.Z(x.x-(m.x-y.x),x.y-(m.y-y.y));this.center=this.coordinateLocation(M),this._renderWorldCopies&&(this.center=this.center.wrap())}locationPoint(o,d){return d?this.coordinatePoint(this.locationCoordinate(o),d.getElevationForLngLatZoom(o,this.tileZoom),this.pixelMatrix3D):this.coordinatePoint(this.locationCoordinate(o))}pointLocation(o,d){return this.coordinateLocation(this.pointCoordinate(o,d))}locationCoordinate(o){return l.Z.fromLngLat(o)}coordinateLocation(o){return o&&o.toLngLat()}pointCoordinate(o,d){if(d){const Z=d.pointCoordinate(o);if(Z!=null)return Z}const m=[o.x,o.y,0,1],y=[o.x,o.y,1,1];l.af(m,m,this.pixelMatrixInverse),l.af(y,y,this.pixelMatrixInverse);const x=m[3],M=y[3],I=m[1]/x,O=y[1]/M,N=m[2]/x,V=y[2]/M,F=N===V?0:(0-N)/(V-N);return new l.Z(l.y.number(m[0]/x,y[0]/M,F)/this.worldSize,l.y.number(I,O,F)/this.worldSize)}coordinatePoint(o,d=0,m=this.pixelMatrix){const y=[o.x*this.worldSize,o.y*this.worldSize,d,1];return l.af(y,y,m),new l.P(y[0]/y[3],y[1]/y[3])}getBounds(){const o=Math.max(0,this.height/2-this.getHorizon());return new we().extend(this.pointLocation(new l.P(0,o))).extend(this.pointLocation(new l.P(this.width,o))).extend(this.pointLocation(new l.P(this.width,this.height))).extend(this.pointLocation(new l.P(0,this.height)))}getMaxBounds(){return this.latRange&&this.latRange.length===2&&this.lngRange&&this.lngRange.length===2?new we([this.lngRange[0],this.latRange[0]],[this.lngRange[1],this.latRange[1]]):null}getHorizon(){return Math.tan(Math.PI/2-this._pitch)*this.cameraToCenterDistance*.85}setMaxBounds(o){o?(this.lngRange=[o.getWest(),o.getEast()],this.latRange=[o.getSouth(),o.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-85.051129,_d])}calculateTileMatrix(o){const d=o.canonical,m=this.worldSize/this.zoomScale(d.z),y=d.x+Math.pow(2,d.z)*o.wrap,x=l.an(new Float64Array(16));return l.J(x,x,[y*m,d.y*m,0]),l.K(x,x,[m/l.X,m/l.X,1]),x}calculatePosMatrix(o,d=!1){const m=o.key,y=d?this._alignedPosMatrixCache:this._posMatrixCache;if(y[m])return y[m];const x=this.calculateTileMatrix(o);return l.L(x,d?this.alignedModelViewProjectionMatrix:this.modelViewProjectionMatrix,x),y[m]=new Float32Array(x),y[m]}calculateFogMatrix(o){const d=o.key,m=this._fogMatrixCache;if(m[d])return m[d];const y=this.calculateTileMatrix(o);return l.L(y,this.fogMatrix,y),m[d]=new Float32Array(y),m[d]}customLayerMatrix(){return this.mercatorMatrix.slice()}getConstrained(o,d){d=l.ac(+d,this.minZoom,this.maxZoom);const m={center:new l.N(o.lng,o.lat),zoom:d};let y=this.lngRange;if(!this._renderWorldCopies&&y===null){const ne=179.9999999999;y=[-ne,ne]}const x=this.tileSize*this.zoomScale(m.zoom);let M=0,I=x,O=0,N=x,V=0,F=0;const{x:Z,y:J}=this.size;if(this.latRange){const ne=this.latRange;M=l.Q(ne[1])*x,I=l.Q(ne[0])*x,I-M<J&&(V=J/(I-M))}y&&(O=l.b3(l.O(y[0])*x,0,x),N=l.b3(l.O(y[1])*x,0,x),N<O&&(N+=x),N-O<Z&&(F=Z/(N-O)));const{x:ee,y:oe}=this.project.call({worldSize:x},o);let le,ce;const he=Math.max(F||0,V||0);if(he){const ne=new l.P(F?(N+O)/2:ee,V?(I+M)/2:oe);return m.center=this.unproject.call({worldSize:x},ne).wrap(),m.zoom+=this.scaleZoom(he),m}if(this.latRange){const ne=J/2;oe-ne<M&&(ce=M+ne),oe+ne>I&&(ce=I-ne)}if(y){const ne=(O+N)/2;let me=ee;this._renderWorldCopies&&(me=l.b3(ee,ne-x/2,ne+x/2));const ge=Z/2;me-ge<O&&(le=O+ge),me+ge>N&&(le=N-ge)}if(le!==void 0||ce!==void 0){const ne=new l.P(le??ee,ce??oe);m.center=this.unproject.call({worldSize:x},ne).wrap()}return m}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;const o=this._unmodified,{center:d,zoom:m}=this.getConstrained(this.center,this.zoom);this.center=d,this.zoom=m,this._unmodified=o,this._constraining=!1}_calcMatrices(){if(!this.height)return;const o=this.centerOffset,d=this.point.x,m=this.point.y;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height,this._pixelPerMeter=l.b5(1,this.center.lat)*this.worldSize;let y=l.an(new Float64Array(16));l.K(y,y,[this.width/2,-this.height/2,1]),l.J(y,y,[1,-1,0]),this.labelPlaneMatrix=y,y=l.an(new Float64Array(16)),l.K(y,y,[1,-1,1]),l.J(y,y,[-1,-1,0]),l.K(y,y,[2/this.width,2/this.height,1]),this.glCoordMatrix=y;const x=this.cameraToCenterDistance+this._elevation*this._pixelPerMeter/Math.cos(this._pitch),M=Math.min(this.elevation,this.minElevationForCurrentTile),I=x-M*this._pixelPerMeter/Math.cos(this._pitch),O=M<0?I:x,N=Math.PI/2+this._pitch,V=this._fov*(.5+o.y/this.height),F=Math.sin(V)*O/Math.sin(l.ac(Math.PI-N-V,.01,Math.PI-.01)),Z=this.getHorizon(),J=2*Math.atan(Z/this.cameraToCenterDistance)*(.5+o.y/(2*Z)),ee=Math.sin(J)*O/Math.sin(l.ac(Math.PI-N-J,.01,Math.PI-.01)),oe=Math.min(F,ee);this.farZ=1.01*(Math.cos(Math.PI/2-this._pitch)*oe+O),this.nearZ=this.height/50,y=new Float64Array(16),l.b6(y,this._fov,this.width/this.height,this.nearZ,this.farZ),y[8]=2*-o.x/this.width,y[9]=2*o.y/this.height,this.projectionMatrix=l.ae(y),l.K(y,y,[1,-1,1]),l.J(y,y,[0,0,-this.cameraToCenterDistance]),l.b7(y,y,this._pitch),l.ad(y,y,this.angle),l.J(y,y,[-d,-m,0]),this.mercatorMatrix=l.K([],y,[this.worldSize,this.worldSize,this.worldSize]),l.K(y,y,[1,1,this._pixelPerMeter]),this.pixelMatrix=l.L(new Float64Array(16),this.labelPlaneMatrix,y),l.J(y,y,[0,0,-this.elevation]),this.modelViewProjectionMatrix=y,this.invModelViewProjectionMatrix=l.as([],y),this.fogMatrix=new Float64Array(16),l.b6(this.fogMatrix,this._fov,this.width/this.height,x,this.farZ),this.fogMatrix[8]=2*-o.x/this.width,this.fogMatrix[9]=2*o.y/this.height,l.K(this.fogMatrix,this.fogMatrix,[1,-1,1]),l.J(this.fogMatrix,this.fogMatrix,[0,0,-this.cameraToCenterDistance]),l.b7(this.fogMatrix,this.fogMatrix,this._pitch),l.ad(this.fogMatrix,this.fogMatrix,this.angle),l.J(this.fogMatrix,this.fogMatrix,[-d,-m,0]),l.K(this.fogMatrix,this.fogMatrix,[1,1,this._pixelPerMeter]),l.J(this.fogMatrix,this.fogMatrix,[0,0,-this.elevation]),this.pixelMatrix3D=l.L(new Float64Array(16),this.labelPlaneMatrix,y);const le=this.width%2/2,ce=this.height%2/2,he=Math.cos(this.angle),ne=Math.sin(this.angle),me=d-Math.round(d)+he*le+ne*ce,ge=m-Math.round(m)+he*ce+ne*le,xe=new Float64Array(y);if(l.J(xe,xe,[me>.5?me-1:me,ge>.5?ge-1:ge,0]),this.alignedModelViewProjectionMatrix=xe,y=l.as(new Float64Array(16),this.pixelMatrix),!y)throw new Error("failed to invert matrix");this.pixelMatrixInverse=y,this._posMatrixCache={},this._alignedPosMatrixCache={},this._fogMatrixCache={}}maxPitchScaleFactor(){if(!this.pixelMatrixInverse)return 1;const o=this.pointCoordinate(new l.P(0,0)),d=[o.x*this.worldSize,o.y*this.worldSize,0,1];return l.af(d,d,this.pixelMatrix)[3]/this.cameraToCenterDistance}getCameraPoint(){const o=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new l.P(0,o))}getCameraQueryGeometry(o){const d=this.getCameraPoint();if(o.length===1)return[o[0],d];{let m=d.x,y=d.y,x=d.x,M=d.y;for(const I of o)m=Math.min(m,I.x),y=Math.min(y,I.y),x=Math.max(x,I.x),M=Math.max(M,I.y);return[new l.P(m,y),new l.P(x,y),new l.P(x,M),new l.P(m,M),new l.P(m,y)]}}lngLatToCameraDepth(o,d){const m=this.locationCoordinate(o),y=[m.x*this.worldSize,m.y*this.worldSize,d,1];return l.af(y,y,this.modelViewProjectionMatrix),y[2]/y[3]}}function Zl(v,o){let d,m=!1,y=null,x=null;const M=()=>{y=null,m&&(v.apply(x,d),y=setTimeout(M,o),m=!1)};return(...I)=>(m=!0,x=this,d=I,y||M(),y)}class bu{constructor(o){this._getCurrentHash=()=>{const d=window.location.hash.replace("#","");if(this._hashName){let m;return d.split("&").map(y=>y.split("=")).forEach(y=>{y[0]===this._hashName&&(m=y)}),(m&&m[1]||"").split("/")}return d.split("/")},this._onHashChange=()=>{const d=this._getCurrentHash();if(d.length>=3&&!d.some(m=>isNaN(m))){const m=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(d[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+d[2],+d[1]],zoom:+d[0],bearing:m,pitch:+(d[4]||0)}),!0}return!1},this._updateHashUnthrottled=()=>{const d=window.location.href.replace(/(#.*)?$/,this.getHashString());window.history.replaceState(window.history.state,null,d)},this._removeHash=()=>{const d=this._getCurrentHash();if(d.length===0)return;const m=d.join("/");let y=m;y.split("&").length>0&&(y=y.split("&")[0]),this._hashName&&(y=`${this._hashName}=${m}`);let x=window.location.hash.replace(y,"");x.startsWith("#&")?x=x.slice(0,1)+x.slice(2):x==="#"&&(x="");let M=window.location.href.replace(/(#.+)?$/,x);M=M.replace("&&","&"),window.history.replaceState(window.history.state,null,M)},this._updateHash=Zl(this._updateHashUnthrottled,300),this._hashName=o&&encodeURIComponent(o)}addTo(o){return this._map=o,addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this}remove(){return removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),this._removeHash(),delete this._map,this}getHashString(o){const d=this._map.getCenter(),m=Math.round(100*this._map.getZoom())/100,y=Math.ceil((m*Math.LN2+Math.log(512/360/.5))/Math.LN10),x=Math.pow(10,y),M=Math.round(d.lng*x)/x,I=Math.round(d.lat*x)/x,O=this._map.getBearing(),N=this._map.getPitch();let V="";if(V+=o?`/${M}/${I}/${m}`:`${m}/${I}/${M}`,(O||N)&&(V+="/"+Math.round(10*O)/10),N&&(V+=`/${Math.round(N)}`),this._hashName){const F=this._hashName;let Z=!1;const J=window.location.hash.slice(1).split("&").map(ee=>{const oe=ee.split("=")[0];return oe===F?(Z=!0,`${oe}=${V}`):ee}).filter(ee=>ee);return Z||J.push(`${F}=${V}`),`#${J.join("&")}`}return`#${V}`}}const xu={linearity:.3,easing:l.b8(0,0,.3,1)},bd=l.e({deceleration:2500,maxSpeed:1400},xu),w_=l.e({deceleration:20,maxSpeed:1400},xu),vm=l.e({deceleration:1e3,maxSpeed:360},xu),vu=l.e({deceleration:1e3,maxSpeed:90},xu);class xd{constructor(o){this._map=o,this.clear()}clear(){this._inertiaBuffer=[]}record(o){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:E.now(),settings:o})}_drainInertiaBuffer(){const o=this._inertiaBuffer,d=E.now();for(;o.length>0&&d-o[0].time>160;)o.shift()}_onMoveEnd(o){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const d={zoom:0,bearing:0,pitch:0,pan:new l.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:x}of this._inertiaBuffer)d.zoom+=x.zoomDelta||0,d.bearing+=x.bearingDelta||0,d.pitch+=x.pitchDelta||0,x.panDelta&&d.pan._add(x.panDelta),x.around&&(d.around=x.around),x.pinchAround&&(d.pinchAround=x.pinchAround);const m=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,y={};if(d.pan.mag()){const x=Xl(d.pan.mag(),m,l.e({},bd,o||{}));y.offset=d.pan.mult(x.amount/d.pan.mag()),y.center=this._map.transform.center,Yl(y,x)}if(d.zoom){const x=Xl(d.zoom,m,w_);y.zoom=this._map.transform.zoom+x.amount,Yl(y,x)}if(d.bearing){const x=Xl(d.bearing,m,vm);y.bearing=this._map.transform.bearing+l.ac(x.amount,-179,179),Yl(y,x)}if(d.pitch){const x=Xl(d.pitch,m,vu);y.pitch=this._map.transform.pitch+x.amount,Yl(y,x)}if(y.zoom||y.bearing){const x=d.pinchAround===void 0?d.around:d.pinchAround;y.around=x?this._map.unproject(x):this._map.getCenter()}return this.clear(),l.e(y,{noMoveStart:!0})}}function Yl(v,o){(!v.duration||v.duration<o.duration)&&(v.duration=o.duration,v.easing=o.easing)}function Xl(v,o,d){const{maxSpeed:m,linearity:y,deceleration:x}=d,M=l.ac(v*y/(o/1e3),-m,m),I=Math.abs(M)/(x*y);return{easing:d.easing,duration:1e3*I,amount:M*(I/2)}}class Di extends l.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(o,d,m,y={}){const x=C.mousePos(d.getCanvas(),m),M=d.unproject(x);super(o,l.e({point:x,lngLat:M,originalEvent:m},y)),this._defaultPrevented=!1,this.target=d}}class Ys extends l.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(o,d,m){const y=o==="touchend"?m.changedTouches:m.touches,x=C.touchPos(d.getCanvasContainer(),y),M=x.map(O=>d.unproject(O)),I=x.reduce((O,N,V,F)=>O.add(N.div(F.length)),new l.P(0,0));super(o,{points:x,point:I,lngLats:M,lngLat:d.unproject(I),originalEvent:m}),this._defaultPrevented=!1}}class wm extends l.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(o,d,m){super(o,{originalEvent:m}),this._defaultPrevented=!1}}class km{constructor(o,d){this._map=o,this._clickTolerance=d.clickTolerance}reset(){delete this._mousedownPos}wheel(o){return this._firePreventable(new wm(o.type,this._map,o))}mousedown(o,d){return this._mousedownPos=d,this._firePreventable(new Di(o.type,this._map,o))}mouseup(o){this._map.fire(new Di(o.type,this._map,o))}click(o,d){this._mousedownPos&&this._mousedownPos.dist(d)>=this._clickTolerance||this._map.fire(new Di(o.type,this._map,o))}dblclick(o){return this._firePreventable(new Di(o.type,this._map,o))}mouseover(o){this._map.fire(new Di(o.type,this._map,o))}mouseout(o){this._map.fire(new Di(o.type,this._map,o))}touchstart(o){return this._firePreventable(new Ys(o.type,this._map,o))}touchmove(o){this._map.fire(new Ys(o.type,this._map,o))}touchend(o){this._map.fire(new Ys(o.type,this._map,o))}touchcancel(o){this._map.fire(new Ys(o.type,this._map,o))}_firePreventable(o){if(this._map.fire(o),o.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Qn{constructor(o){this._map=o}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(o){this._map.fire(new Di(o.type,this._map,o))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new Di("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(o){this._delayContextMenu?this._contextMenuEvent=o:this._ignoreContextMenu||this._map.fire(new Di(o.type,this._map,o)),this._map.listens("contextmenu")&&o.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class to{constructor(o){this._map=o}get transform(){return this._map._requestedCameraState||this._map.transform}get center(){return{lng:this.transform.center.lng,lat:this.transform.center.lat}}get zoom(){return this.transform.zoom}get pitch(){return this.transform.pitch}get bearing(){return this.transform.bearing}unproject(o){return this.transform.pointLocation(l.P.convert(o),this._map.terrain)}}class _r{constructor(o,d){this._map=o,this._tr=new to(o),this._el=o.getCanvasContainer(),this._container=o.getContainer(),this._clickTolerance=d.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(o,d){this.isEnabled()&&o.shiftKey&&o.button===0&&(C.disableDrag(),this._startPos=this._lastPos=d,this._active=!0)}mousemoveWindow(o,d){if(!this._active)return;const m=d;if(this._lastPos.equals(m)||!this._box&&m.dist(this._startPos)<this._clickTolerance)return;const y=this._startPos;this._lastPos=m,this._box||(this._box=C.create("div","maplibregl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair"),this._fireEvent("boxzoomstart",o));const x=Math.min(y.x,m.x),M=Math.max(y.x,m.x),I=Math.min(y.y,m.y),O=Math.max(y.y,m.y);C.setTransform(this._box,`translate(${x}px,${I}px)`),this._box.style.width=M-x+"px",this._box.style.height=O-I+"px"}mouseupWindow(o,d){if(!this._active||o.button!==0)return;const m=this._startPos,y=d;if(this.reset(),C.suppressClick(),m.x!==y.x||m.y!==y.y)return this._map.fire(new l.k("boxzoomend",{originalEvent:o})),{cameraAnimation:x=>x.fitScreenCoordinates(m,y,this._tr.bearing,{linear:!0})};this._fireEvent("boxzoomcancel",o)}keydown(o){this._active&&o.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",o))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(C.remove(this._box),this._box=null),C.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(o,d){return this._map.fire(new l.k(o,{originalEvent:d}))}}function Kl(v,o){if(v.length!==o.length)throw new Error(`The number of touches and points are not equal - touches ${v.length}, points ${o.length}`);const d={};for(let m=0;m<v.length;m++)d[v[m].identifier]=o[m];return d}class vd{constructor(o){this.reset(),this.numTouches=o.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(o,d,m){(this.centroid||m.length>this.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=o.timeStamp),m.length===this.numTouches&&(this.centroid=function(y){const x=new l.P(0,0);for(const M of y)x._add(M);return x.div(y.length)}(d),this.touches=Kl(m,d)))}touchmove(o,d,m){if(this.aborted||!this.centroid)return;const y=Kl(m,d);for(const x in this.touches){const M=y[x];(!M||M.dist(this.touches[x])>30)&&(this.aborted=!0)}}touchend(o,d,m){if((!this.centroid||o.timeStamp-this.startTime>500)&&(this.aborted=!0),m.length===0){const y=!this.aborted&&this.centroid;if(this.reset(),y)return y}}}class wu{constructor(o){this.singleTap=new vd(o),this.numTaps=o.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(o,d,m){this.singleTap.touchstart(o,d,m)}touchmove(o,d,m){this.singleTap.touchmove(o,d,m)}touchend(o,d,m){const y=this.singleTap.touchend(o,d,m);if(y){const x=o.timeStamp-this.lastTime<500,M=!this.lastTap||this.lastTap.dist(y)<30;if(x&&M||this.reset(),this.count++,this.lastTime=o.timeStamp,this.lastTap=y,this.count===this.numTaps)return this.reset(),y}}}class Ha{constructor(o){this._tr=new to(o),this._zoomIn=new wu({numTouches:1,numTaps:2}),this._zoomOut=new wu({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(o,d,m){this._zoomIn.touchstart(o,d,m),this._zoomOut.touchstart(o,d,m)}touchmove(o,d,m){this._zoomIn.touchmove(o,d,m),this._zoomOut.touchmove(o,d,m)}touchend(o,d,m){const y=this._zoomIn.touchend(o,d,m),x=this._zoomOut.touchend(o,d,m),M=this._tr;return y?(this._active=!0,o.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:I=>I.easeTo({duration:300,zoom:M.zoom+1,around:M.unproject(y)},{originalEvent:o})}):x?(this._active=!0,o.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:I=>I.easeTo({duration:300,zoom:M.zoom-1,around:M.unproject(x)},{originalEvent:o})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class qo{constructor(o){this._enabled=!!o.enable,this._moveStateManager=o.moveStateManager,this._clickTolerance=o.clickTolerance||1,this._moveFunction=o.move,this._activateOnStart=!!o.activateOnStart,o.assignEvents(this),this.reset()}reset(o){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(o)}_move(...o){const d=this._moveFunction(...o);if(d.bearingDelta||d.pitchDelta||d.around||d.panDelta)return this._active=!0,d}dragStart(o,d){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(o)&&(this._moveStateManager.startMove(o),this._lastPoint=d.length?d[0]:d,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(o,d){if(!this.isEnabled())return;const m=this._lastPoint;if(!m)return;if(o.preventDefault(),!this._moveStateManager.isValidMoveEvent(o))return void this.reset(o);const y=d.length?d[0]:d;return!this._moved&&y.dist(m)<this._clickTolerance?void 0:(this._moved=!0,this._lastPoint=y,this._move(m,y))}dragEnd(o){this.isEnabled()&&this._lastPoint&&this._moveStateManager.isValidEndEvent(o)&&(this._moved&&C.suppressClick(),this.reset(o))}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}getClickTolerance(){return this._clickTolerance}}const wd={0:1,2:2};class ku{constructor(o){this._correctEvent=o.checkCorrectEvent}startMove(o){const d=C.mouseButton(o);this._eventButton=d}endMove(o){delete this._eventButton}isValidStartEvent(o){return this._correctEvent(o)}isValidMoveEvent(o){return!function(d,m){const y=wd[m];return d.buttons===void 0||(d.buttons&y)!==y}(o,this._eventButton)}isValidEndEvent(o){return C.mouseButton(o)===this._eventButton}}class kd{constructor(){this._firstTouch=void 0}_isOneFingerTouch(o){return o.targetTouches.length===1}_isSameTouchEvent(o){return o.targetTouches[0].identifier===this._firstTouch}startMove(o){this._firstTouch=o.targetTouches[0].identifier}endMove(o){delete this._firstTouch}isValidStartEvent(o){return this._isOneFingerTouch(o)}isValidMoveEvent(o){return this._isOneFingerTouch(o)&&this._isSameTouchEvent(o)}isValidEndEvent(o){return this._isOneFingerTouch(o)&&this._isSameTouchEvent(o)}}const Su=v=>{v.mousedown=v.dragStart,v.mousemoveWindow=v.dragMove,v.mouseup=v.dragEnd,v.contextmenu=o=>{o.preventDefault()}},Sd=({enable:v,clickTolerance:o,bearingDegreesPerPixelMoved:d=.8})=>{const m=new ku({checkCorrectEvent:y=>C.mouseButton(y)===0&&y.ctrlKey||C.mouseButton(y)===2});return new qo({clickTolerance:o,move:(y,x)=>({bearingDelta:(x.x-y.x)*d}),moveStateManager:m,enable:v,assignEvents:Su})},Ed=({enable:v,clickTolerance:o,pitchDegreesPerPixelMoved:d=-.5})=>{const m=new ku({checkCorrectEvent:y=>C.mouseButton(y)===0&&y.ctrlKey||C.mouseButton(y)===2});return new qo({clickTolerance:o,move:(y,x)=>({pitchDelta:(x.y-y.y)*d}),moveStateManager:m,enable:v,assignEvents:Su})};class Xs{constructor(o,d){this._clickTolerance=o.clickTolerance||1,this._map=d,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new l.P(0,0)}_shouldBePrevented(o){return o<(this._map.cooperativeGestures.isEnabled()?2:1)}touchstart(o,d,m){return this._calculateTransform(o,d,m)}touchmove(o,d,m){if(this._active){if(!this._shouldBePrevented(m.length))return o.preventDefault(),this._calculateTransform(o,d,m);this._map.cooperativeGestures.notifyGestureBlocked("touch_pan",o)}}touchend(o,d,m){this._calculateTransform(o,d,m),this._active&&this._shouldBePrevented(m.length)&&this.reset()}touchcancel(){this.reset()}_calculateTransform(o,d,m){m.length>0&&(this._active=!0);const y=Kl(m,d),x=new l.P(0,0),M=new l.P(0,0);let I=0;for(const N in y){const V=y[N],F=this._touches[N];F&&(x._add(V),M._add(V.sub(F)),I++,y[N]=V)}if(this._touches=y,this._shouldBePrevented(I)||!M.mag())return;const O=M.div(I);return this._sum._add(O),this._sum.mag()<this._clickTolerance?void 0:{around:x.div(I),panDelta:O}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Eu{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}touchstart(o,d,m){this._firstTwoTouches||m.length<2||(this._firstTwoTouches=[m[0].identifier,m[1].identifier],this._start([d[0],d[1]]))}touchmove(o,d,m){if(!this._firstTwoTouches)return;o.preventDefault();const[y,x]=this._firstTwoTouches,M=Jl(m,d,y),I=Jl(m,d,x);if(!M||!I)return;const O=this._aroundCenter?null:M.add(I).div(2);return this._move([M,I],O,o)}touchend(o,d,m){if(!this._firstTwoTouches)return;const[y,x]=this._firstTwoTouches,M=Jl(m,d,y),I=Jl(m,d,x);M&&I||(this._active&&C.suppressClick(),this.reset())}touchcancel(){this.reset()}enable(o){this._enabled=!0,this._aroundCenter=!!o&&o.around==="center"}disable(){this._enabled=!1,this.reset()}isEnabled(){return!!this._enabled}isActive(){return!!this._active}}function Jl(v,o,d){for(let m=0;m<v.length;m++)if(v[m].identifier===d)return o[m]}function Cd(v,o){return Math.log(v/o)/Math.LN2}class Td extends Eu{reset(){super.reset(),delete this._distance,delete this._startDistance}_start(o){this._startDistance=this._distance=o[0].dist(o[1])}_move(o,d){const m=this._distance;if(this._distance=o[0].dist(o[1]),this._active||!(Math.abs(Cd(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:Cd(this._distance,m),pinchAround:d}}}function Md(v,o){return 180*v.angleWith(o)/Math.PI}class Ad extends Eu{reset(){super.reset(),delete this._minDiameter,delete this._startVector,delete this._vector}_start(o){this._startVector=this._vector=o[0].sub(o[1]),this._minDiameter=o[0].dist(o[1])}_move(o,d,m){const y=this._vector;if(this._vector=o[0].sub(o[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:Md(this._vector,y),pinchAround:d}}_isBelowThreshold(o){this._minDiameter=Math.min(this._minDiameter,o.mag());const d=25/(Math.PI*this._minDiameter)*360,m=Md(o,this._startVector);return Math.abs(m)<d}}function Cu(v){return Math.abs(v.y)>Math.abs(v.x)}class qa extends Eu{constructor(o){super(),this._currentTouchCount=0,this._map=o}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(o,d,m){super.touchstart(o,d,m),this._currentTouchCount=m.length}_start(o){this._lastPoints=o,Cu(o[0].sub(o[1]))&&(this._valid=!1)}_move(o,d,m){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;const y=o[0].sub(this._lastPoints[0]),x=o[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(y,x,m.timeStamp),this._valid?(this._lastPoints=o,this._active=!0,{pitchDelta:(y.y+x.y)/2*-.5}):void 0}gestureBeginsVertically(o,d,m){if(this._valid!==void 0)return this._valid;const y=o.mag()>=2,x=d.mag()>=2;if(!y&&!x)return;if(!y||!x)return this._firstMove===void 0&&(this._firstMove=m),m-this._firstMove<100&&void 0;const M=o.y>0==d.y>0;return Cu(o)&&Cu(d)&&M}}const Sm={panStep:100,bearingStep:15,pitchStep:10};class Lr{constructor(o){this._tr=new to(o);const d=Sm;this._panStep=d.panStep,this._bearingStep=d.bearingStep,this._pitchStep=d.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(o){if(o.altKey||o.ctrlKey||o.metaKey)return;let d=0,m=0,y=0,x=0,M=0;switch(o.keyCode){case 61:case 107:case 171:case 187:d=1;break;case 189:case 109:case 173:d=-1;break;case 37:o.shiftKey?m=-1:(o.preventDefault(),x=-1);break;case 39:o.shiftKey?m=1:(o.preventDefault(),x=1);break;case 38:o.shiftKey?y=1:(o.preventDefault(),M=-1);break;case 40:o.shiftKey?y=-1:(o.preventDefault(),M=1);break;default:return}return this._rotationDisabled&&(m=0,y=0),{cameraAnimation:I=>{const O=this._tr;I.easeTo({duration:300,easeId:"keyboardHandler",easing:Ao,zoom:d?Math.round(O.zoom)+d*(o.shiftKey?2:1):O.zoom,bearing:O.bearing+m*this._bearingStep,pitch:O.pitch+y*this._pitchStep,offset:[-x*this._panStep,-M*this._panStep],center:O.center},{originalEvent:o})}}}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 Ao(v){return v*(2-v)}const Id=4.000244140625;class no{constructor(o,d){this._onTimeout=m=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(m)},this._map=o,this._tr=new to(o),this._triggerRenderFrame=d,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222}setZoomRate(o){this._defaultZoomRate=o}setWheelZoomRate(o){this._wheelZoomRate=o}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(o){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!o&&o.around==="center")}disable(){this.isEnabled()&&(this._enabled=!1)}_shouldBePrevented(o){return!!this._map.cooperativeGestures.isEnabled()&&!(o.ctrlKey||this._map.cooperativeGestures.isBypassed(o))}wheel(o){if(!this.isEnabled())return;if(this._shouldBePrevented(o))return void this._map.cooperativeGestures.notifyGestureBlocked("wheel_zoom",o);let d=o.deltaMode===WheelEvent.DOM_DELTA_LINE?40*o.deltaY:o.deltaY;const m=E.now(),y=m-(this._lastWheelEventTime||0);this._lastWheelEventTime=m,d!==0&&d%Id==0?this._type="wheel":d!==0&&Math.abs(d)<4?this._type="trackpad":y>400?(this._type=null,this._lastValue=d,this._timeout=setTimeout(this._onTimeout,40,o)):this._type||(this._type=Math.abs(y*d)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,d+=this._lastValue)),o.shiftKey&&d&&(d/=4),this._type&&(this._lastWheelEvent=o,this._delta-=d,this._active||this._start(o)),o.preventDefault()}_start(o){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 d=C.mousePos(this._map.getCanvas(),o),m=this._tr;this._around=d.y>m.transform.height/2-m.transform.getHorizon()?l.N.convert(this._aroundCenter?m.center:m.unproject(d)):l.N.convert(m.center),this._aroundPoint=m.transform.locationPoint(this._around),this._frameId||(this._frameId=!0,this._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;const o=this._tr.transform;if(this._delta!==0){const O=this._type==="wheel"&&Math.abs(this._delta)>Id?this._wheelZoomRate:this._defaultZoomRate;let N=2/(1+Math.exp(-Math.abs(this._delta*O)));this._delta<0&&N!==0&&(N=1/N);const V=typeof this._targetZoom=="number"?o.zoomScale(this._targetZoom):o.scale;this._targetZoom=Math.min(o.maxZoom,Math.max(o.minZoom,o.scaleZoom(V*N))),this._type==="wheel"&&(this._startZoom=o.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}const d=typeof this._targetZoom=="number"?this._targetZoom:o.zoom,m=this._startZoom,y=this._easing;let x,M=!1;const I=E.now()-this._lastWheelEventTime;if(this._type==="wheel"&&m&&y&&I){const O=Math.min(I/200,1),N=y(O);x=l.y.number(m,d,N),O<1?this._frameId||(this._frameId=!0):M=!0}else x=d,M=!0;return this._active=!0,M&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200)),{noInertia:!0,needsRenderFrame:!M,zoomDelta:x-o.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(o){let d=l.b9;if(this._prevEase){const m=this._prevEase,y=(E.now()-m.start)/m.duration,x=m.easing(y+.01)-m.easing(y),M=.27/Math.sqrt(x*x+1e-4)*.01,I=Math.sqrt(.0729-M*M);d=l.b8(M,I,.25,1)}return this._prevEase={start:E.now(),duration:o,easing:d},d}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}}class Ks{constructor(o,d){this._clickZoom=o,this._tapZoom=d}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 k_{constructor(o){this._tr=new to(o),this.reset()}reset(){this._active=!1}dblclick(o,d){return o.preventDefault(),{cameraAnimation:m=>{m.easeTo({duration:300,zoom:this._tr.zoom+(o.shiftKey?-1:1),around:this._tr.unproject(d)},{originalEvent:o})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class S_{constructor(){this._tap=new wu({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,delete this._tapPoint,this._tap.reset()}touchstart(o,d,m){if(!this._swipePoint)if(this._tapTime){const y=d[0],x=o.timeStamp-this._tapTime<500,M=this._tapPoint.dist(y)<30;x&&M?m.length>0&&(this._swipePoint=y,this._swipeTouch=m[0].identifier):this.reset()}else this._tap.touchstart(o,d,m)}touchmove(o,d,m){if(this._tapTime){if(this._swipePoint){if(m[0].identifier!==this._swipeTouch)return;const y=d[0],x=y.y-this._swipePoint.y;return this._swipePoint=y,o.preventDefault(),this._active=!0,{zoomDelta:x/128}}}else this._tap.touchmove(o,d,m)}touchend(o,d,m){if(this._tapTime)this._swipePoint&&m.length===0&&this.reset();else{const y=this._tap.touchend(o,d,m);y&&(this._tapTime=o.timeStamp,this._tapPoint=y)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Em{constructor(o,d,m){this._el=o,this._mousePan=d,this._touchPan=m}enable(o){this._inertiaOptions=o||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("maplibregl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("maplibregl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class Cm{constructor(o,d,m){this._pitchWithRotate=o.pitchWithRotate,this._mouseRotate=d,this._mousePitch=m}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 Pd{constructor(o,d,m,y){this._el=o,this._touchZoom=d,this._touchRotate=m,this._tapDragZoom=y,this._rotationDisabled=!1,this._enabled=!0}enable(o){this._touchZoom.enable(o),this._rotationDisabled||this._touchRotate.enable(o),this._tapDragZoom.enable(),this._el.classList.add("maplibregl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("maplibregl-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()}}class Wa{constructor(o,d){this._bypassKey=navigator.userAgent.indexOf("Mac")!==-1?"metaKey":"ctrlKey",this._map=o,this._options=d,this._enabled=!1}isActive(){return!1}reset(){}_setupUI(){if(this._container)return;const o=this._map.getCanvasContainer();o.classList.add("maplibregl-cooperative-gestures"),this._container=C.create("div","maplibregl-cooperative-gesture-screen",o);let d=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");this._bypassKey==="metaKey"&&(d=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));const m=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),y=document.createElement("div");y.className="maplibregl-desktop-message",y.textContent=d,this._container.appendChild(y);const x=document.createElement("div");x.className="maplibregl-mobile-message",x.textContent=m,this._container.appendChild(x),this._container.setAttribute("aria-hidden","true")}_destroyUI(){this._container&&(C.remove(this._container),this._map.getCanvasContainer().classList.remove("maplibregl-cooperative-gestures")),delete this._container}enable(){this._setupUI(),this._enabled=!0}disable(){this._enabled=!1,this._destroyUI()}isEnabled(){return this._enabled}isBypassed(o){return o[this._bypassKey]}notifyGestureBlocked(o,d){this._enabled&&(this._map.fire(new l.k("cooperativegestureprevented",{gestureType:o,originalEvent:d})),this._container.classList.add("maplibregl-show"),setTimeout(()=>{this._container.classList.remove("maplibregl-show")},100))}}const Vr=v=>v.zoom||v.drag||v.pitch||v.rotate;class ut extends l.k{}function Tu(v){return v.panDelta&&v.panDelta.mag()||v.zoomDelta||v.bearingDelta||v.pitchDelta}class Dd{constructor(o,d){this.handleWindowEvent=y=>{this.handleEvent(y,`${y.type}Window`)},this.handleEvent=(y,x)=>{if(y.type==="blur")return void this.stop(!0);this._updatingCamera=!0;const M=y.type==="renderFrame"?void 0:y,I={needsRenderFrame:!1},O={},N={},V=y.touches,F=V?this._getMapTouches(V):void 0,Z=F?C.touchPos(this._map.getCanvas(),F):C.mousePos(this._map.getCanvas(),y);for(const{handlerName:oe,handler:le,allowed:ce}of this._handlers){if(!le.isEnabled())continue;let he;this._blockedByActive(N,ce,oe)?le.reset():le[x||y.type]&&(he=le[x||y.type](y,Z,F),this.mergeHandlerResult(I,O,he,oe,M),he&&he.needsRenderFrame&&this._triggerRenderFrame()),(he||le.isActive())&&(N[oe]=le)}const J={};for(const oe in this._previousActiveHandlers)N[oe]||(J[oe]=M);this._previousActiveHandlers=N,(Object.keys(J).length||Tu(I))&&(this._changes.push([I,O,J]),this._triggerRenderFrame()),(Object.keys(N).length||Tu(I))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:ee}=I;ee&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],ee(this._map))},this._map=o,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new xd(o),this._bearingSnap=d.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(d);const m=this._el;this._listeners=[[m,"touchstart",{passive:!0}],[m,"touchmove",{passive:!1}],[m,"touchend",void 0],[m,"touchcancel",void 0],[m,"mousedown",void 0],[m,"mousemove",void 0],[m,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[m,"mouseover",void 0],[m,"mouseout",void 0],[m,"dblclick",void 0],[m,"click",void 0],[m,"keydown",{capture:!1}],[m,"keyup",void 0],[m,"wheel",{passive:!1}],[m,"contextmenu",void 0],[window,"blur",void 0]];for(const[y,x,M]of this._listeners)C.addEventListener(y,x,y===document?this.handleWindowEvent:this.handleEvent,M)}destroy(){for(const[o,d,m]of this._listeners)C.removeEventListener(o,d,o===document?this.handleWindowEvent:this.handleEvent,m)}_addDefaultHandlers(o){const d=this._map,m=d.getCanvasContainer();this._add("mapEvent",new km(d,o));const y=d.boxZoom=new _r(d,o);this._add("boxZoom",y),o.interactive&&o.boxZoom&&y.enable();const x=d.cooperativeGestures=new Wa(d,o.cooperativeGestures);this._add("cooperativeGestures",x),o.cooperativeGestures&&x.enable();const M=new Ha(d),I=new k_(d);d.doubleClickZoom=new Ks(I,M),this._add("tapZoom",M),this._add("clickZoom",I),o.interactive&&o.doubleClickZoom&&d.doubleClickZoom.enable();const O=new S_;this._add("tapDragZoom",O);const N=d.touchPitch=new qa(d);this._add("touchPitch",N),o.interactive&&o.touchPitch&&d.touchPitch.enable(o.touchPitch);const V=Sd(o),F=Ed(o);d.dragRotate=new Cm(o,V,F),this._add("mouseRotate",V,["mousePitch"]),this._add("mousePitch",F,["mouseRotate"]),o.interactive&&o.dragRotate&&d.dragRotate.enable();const Z=(({enable:he,clickTolerance:ne})=>{const me=new ku({checkCorrectEvent:ge=>C.mouseButton(ge)===0&&!ge.ctrlKey});return new qo({clickTolerance:ne,move:(ge,xe)=>({around:xe,panDelta:xe.sub(ge)}),activateOnStart:!0,moveStateManager:me,enable:he,assignEvents:Su})})(o),J=new Xs(o,d);d.dragPan=new Em(m,Z,J),this._add("mousePan",Z),this._add("touchPan",J,["touchZoom","touchRotate"]),o.interactive&&o.dragPan&&d.dragPan.enable(o.dragPan);const ee=new Ad,oe=new Td;d.touchZoomRotate=new Pd(m,oe,ee,O),this._add("touchRotate",ee,["touchPan","touchZoom"]),this._add("touchZoom",oe,["touchPan","touchRotate"]),o.interactive&&o.touchZoomRotate&&d.touchZoomRotate.enable(o.touchZoomRotate);const le=d.scrollZoom=new no(d,()=>this._triggerRenderFrame());this._add("scrollZoom",le,["mousePan"]),o.interactive&&o.scrollZoom&&d.scrollZoom.enable(o.scrollZoom);const ce=d.keyboard=new Lr(d);this._add("keyboard",ce),o.interactive&&o.keyboard&&d.keyboard.enable(),this._add("blockableMapEvent",new Qn(d))}_add(o,d,m){this._handlers.push({handlerName:o,handler:d,allowed:m}),this._handlersById[o]=d}stop(o){if(!this._updatingCamera){for(const{handler:d}of this._handlers)d.reset();this._inertia.clear(),this._fireEvents({},{},o),this._changes=[]}}isActive(){for(const{handler:o}of this._handlers)if(o.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!Vr(this._eventsInProgress)||this.isZooming()}_blockedByActive(o,d,m){for(const y in o)if(y!==m&&(!d||d.indexOf(y)<0))return!0;return!1}_getMapTouches(o){const d=[];for(const m of o)this._el.contains(m.target)&&d.push(m);return d}mergeHandlerResult(o,d,m,y,x){if(!m)return;l.e(o,m);const M={handlerName:y,originalEvent:m.originalEvent||x};m.zoomDelta!==void 0&&(d.zoom=M),m.panDelta!==void 0&&(d.drag=M),m.pitchDelta!==void 0&&(d.pitch=M),m.bearingDelta!==void 0&&(d.rotate=M)}_applyChanges(){const o={},d={},m={};for(const[y,x,M]of this._changes)y.panDelta&&(o.panDelta=(o.panDelta||new l.P(0,0))._add(y.panDelta)),y.zoomDelta&&(o.zoomDelta=(o.zoomDelta||0)+y.zoomDelta),y.bearingDelta&&(o.bearingDelta=(o.bearingDelta||0)+y.bearingDelta),y.pitchDelta&&(o.pitchDelta=(o.pitchDelta||0)+y.pitchDelta),y.around!==void 0&&(o.around=y.around),y.pinchAround!==void 0&&(o.pinchAround=y.pinchAround),y.noInertia&&(o.noInertia=y.noInertia),l.e(d,x),l.e(m,M);this._updateMapTransform(o,d,m),this._changes=[]}_updateMapTransform(o,d,m){const y=this._map,x=y._getTransformForUpdate(),M=y.terrain;if(!(Tu(o)||M&&this._terrainMovement))return this._fireEvents(d,m,!0);let{panDelta:I,zoomDelta:O,bearingDelta:N,pitchDelta:V,around:F,pinchAround:Z}=o;Z!==void 0&&(F=Z),y._stop(!0),F=F||y.transform.centerPoint;const J=x.pointLocation(I?F.sub(I):F);N&&(x.bearing+=N),V&&(x.pitch+=V),O&&(x.zoom+=O),M?this._terrainMovement||!d.drag&&!d.zoom?d.drag&&this._terrainMovement?x.center=x.pointLocation(x.centerPoint.sub(I)):x.setLocationAtPoint(J,F):(this._terrainMovement=!0,this._map._elevationFreeze=!0,x.setLocationAtPoint(J,F)):x.setLocationAtPoint(J,F),y._applyUpdatedTransform(x),this._map._update(),o.noInertia||this._inertia.record(o),this._fireEvents(d,m,!0)}_fireEvents(o,d,m){const y=Vr(this._eventsInProgress),x=Vr(o),M={};for(const F in o){const{originalEvent:Z}=o[F];this._eventsInProgress[F]||(M[`${F}start`]=Z),this._eventsInProgress[F]=o[F]}!y&&x&&this._fireEvent("movestart",x.originalEvent);for(const F in M)this._fireEvent(F,M[F]);x&&this._fireEvent("move",x.originalEvent);for(const F in o){const{originalEvent:Z}=o[F];this._fireEvent(F,Z)}const I={};let O;for(const F in this._eventsInProgress){const{handlerName:Z,originalEvent:J}=this._eventsInProgress[F];this._handlersById[Z].isActive()||(delete this._eventsInProgress[F],O=d[Z]||J,I[`${F}end`]=O)}for(const F in I)this._fireEvent(F,I[F]);const N=Vr(this._eventsInProgress),V=(y||x)&&!N;if(V&&this._terrainMovement){this._map._elevationFreeze=!1,this._terrainMovement=!1;const F=this._map._getTransformForUpdate();F.recalculateZoom(this._map.terrain),this._map._applyUpdatedTransform(F)}if(m&&V){this._updatingCamera=!0;const F=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),Z=J=>J!==0&&-this._bearingSnap<J&&J<this._bearingSnap;!F||!F.essential&&E.prefersReducedMotion?(this._map.fire(new l.k("moveend",{originalEvent:O})),Z(this._map.getBearing())&&this._map.resetNorth()):(Z(F.bearing||this._map.getBearing())&&(F.bearing=0),F.freezeElevation=!0,this._map.easeTo(F,{originalEvent:O})),this._updatingCamera=!1}}_fireEvent(o,d){this._map.fire(new l.k(o,d?{originalEvent:d}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(o=>{delete this._frameId,this.handleEvent(new ut("renderFrame",{timeStamp:o})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}class Tm extends l.E{constructor(o,d){super(),this._renderFrameCallback=()=>{const m=Math.min((E.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(m)),m<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this._moving=!1,this._zooming=!1,this.transform=o,this._bearingSnap=d.bearingSnap,this.on("moveend",()=>{delete this._requestedCameraState})}getCenter(){return new l.N(this.transform.center.lng,this.transform.center.lat)}setCenter(o,d){return this.jumpTo({center:o},d)}panBy(o,d,m){return o=l.P.convert(o).mult(-1),this.panTo(this.transform.center,l.e({offset:o},d),m)}panTo(o,d,m){return this.easeTo(l.e({center:o},d),m)}getZoom(){return this.transform.zoom}setZoom(o,d){return this.jumpTo({zoom:o},d),this}zoomTo(o,d,m){return this.easeTo(l.e({zoom:o},d),m)}zoomIn(o,d){return this.zoomTo(this.getZoom()+1,o,d),this}zoomOut(o,d){return this.zoomTo(this.getZoom()-1,o,d),this}getBearing(){return this.transform.bearing}setBearing(o,d){return this.jumpTo({bearing:o},d),this}getPadding(){return this.transform.padding}setPadding(o,d){return this.jumpTo({padding:o},d),this}rotateTo(o,d,m){return this.easeTo(l.e({bearing:o},d),m)}resetNorth(o,d){return this.rotateTo(0,l.e({duration:1e3},o),d),this}resetNorthPitch(o,d){return this.easeTo(l.e({bearing:0,pitch:0,duration:1e3},o),d),this}snapToNorth(o,d){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(o,d):this}getPitch(){return this.transform.pitch}setPitch(o,d){return this.jumpTo({pitch:o},d),this}cameraForBounds(o,d){o=we.convert(o).adjustAntiMeridian();const m=d&&d.bearing||0;return this._cameraForBoxAndBearing(o.getNorthWest(),o.getSouthEast(),m,d)}_cameraForBoxAndBearing(o,d,m,y){const x={top:0,bottom:0,right:0,left:0};if(typeof(y=l.e({padding:x,offset:[0,0],maxZoom:this.transform.maxZoom},y)).padding=="number"){const Ye=y.padding;y.padding={top:Ye,bottom:Ye,right:Ye,left:Ye}}y.padding=l.e(x,y.padding);const M=this.transform,I=M.padding,O=new we(o,d),N=M.project(O.getNorthWest()),V=M.project(O.getNorthEast()),F=M.project(O.getSouthEast()),Z=M.project(O.getSouthWest()),J=l.ba(-m),ee=N.rotate(J),oe=V.rotate(J),le=F.rotate(J),ce=Z.rotate(J),he=new l.P(Math.max(ee.x,oe.x,ce.x,le.x),Math.max(ee.y,oe.y,ce.y,le.y)),ne=new l.P(Math.min(ee.x,oe.x,ce.x,le.x),Math.min(ee.y,oe.y,ce.y,le.y)),me=he.sub(ne),ge=(M.width-(I.left+I.right+y.padding.left+y.padding.right))/me.x,xe=(M.height-(I.top+I.bottom+y.padding.top+y.padding.bottom))/me.y;if(xe<0||ge<0)return void l.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.");const Be=Math.min(M.scaleZoom(M.scale*Math.min(ge,xe)),y.maxZoom),Fe=l.P.convert(y.offset),Qe=new l.P((y.padding.left-y.padding.right)/2,(y.padding.top-y.padding.bottom)/2).rotate(l.ba(m)),st=Fe.add(Qe).mult(M.scale/M.zoomScale(Be));return{center:M.unproject(N.add(F).div(2).sub(st)),zoom:Be,bearing:m}}fitBounds(o,d,m){return this._fitInternal(this.cameraForBounds(o,d),d,m)}fitScreenCoordinates(o,d,m,y,x){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.pointLocation(l.P.convert(o)),this.transform.pointLocation(l.P.convert(d)),m,y),y,x)}_fitInternal(o,d,m){return o?(delete(d=l.e(o,d)).padding,d.linear?this.easeTo(d,m):this.flyTo(d,m)):this}jumpTo(o,d){this.stop();const m=this._getTransformForUpdate();let y=!1,x=!1,M=!1;return"zoom"in o&&m.zoom!==+o.zoom&&(y=!0,m.zoom=+o.zoom),o.center!==void 0&&(m.center=l.N.convert(o.center)),"bearing"in o&&m.bearing!==+o.bearing&&(x=!0,m.bearing=+o.bearing),"pitch"in o&&m.pitch!==+o.pitch&&(M=!0,m.pitch=+o.pitch),o.padding==null||m.isPaddingEqual(o.padding)||(m.padding=o.padding),this._applyUpdatedTransform(m),this.fire(new l.k("movestart",d)).fire(new l.k("move",d)),y&&this.fire(new l.k("zoomstart",d)).fire(new l.k("zoom",d)).fire(new l.k("zoomend",d)),x&&this.fire(new l.k("rotatestart",d)).fire(new l.k("rotate",d)).fire(new l.k("rotateend",d)),M&&this.fire(new l.k("pitchstart",d)).fire(new l.k("pitch",d)).fire(new l.k("pitchend",d)),this.fire(new l.k("moveend",d))}calculateCameraOptionsFromTo(o,d,m,y=0){const x=l.Z.fromLngLat(o,d),M=l.Z.fromLngLat(m,y),I=M.x-x.x,O=M.y-x.y,N=M.z-x.z,V=Math.hypot(I,O,N);if(V===0)throw new Error("Can't calculate camera options with same From and To");const F=Math.hypot(I,O),Z=this.transform.scaleZoom(this.transform.cameraToCenterDistance/V/this.transform.tileSize),J=180*Math.atan2(I,-O)/Math.PI;let ee=180*Math.acos(F/V)/Math.PI;return ee=N<0?90-ee:90+ee,{center:M.toLngLat(),zoom:Z,pitch:ee,bearing:J}}easeTo(o,d){var m;this._stop(!1,o.easeId),((o=l.e({offset:[0,0],duration:500,easing:l.b9},o)).animate===!1||!o.essential&&E.prefersReducedMotion)&&(o.duration=0);const y=this._getTransformForUpdate(),x=y.zoom,M=y.bearing,I=y.pitch,O=y.padding,N="bearing"in o?this._normalizeBearing(o.bearing,M):M,V="pitch"in o?+o.pitch:I,F="padding"in o?o.padding:y.padding,Z=l.P.convert(o.offset);let J=y.centerPoint.add(Z);const ee=y.pointLocation(J),{center:oe,zoom:le}=y.getConstrained(l.N.convert(o.center||ee),(m=o.zoom)!==null&&m!==void 0?m:x);this._normalizeCenter(oe,y);const ce=y.project(ee),he=y.project(oe).sub(ce),ne=y.zoomScale(le-x);let me,ge;o.around&&(me=l.N.convert(o.around),ge=y.locationPoint(me));const xe={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=this._zooming||le!==x,this._rotating=this._rotating||M!==N,this._pitching=this._pitching||V!==I,this._padding=!y.isPaddingEqual(F),this._easeId=o.easeId,this._prepareEase(d,o.noMoveStart,xe),this.terrain&&this._prepareElevation(oe),this._ease(Be=>{if(this._zooming&&(y.zoom=l.y.number(x,le,Be)),this._rotating&&(y.bearing=l.y.number(M,N,Be)),this._pitching&&(y.pitch=l.y.number(I,V,Be)),this._padding&&(y.interpolatePadding(O,F,Be),J=y.centerPoint.add(Z)),this.terrain&&!o.freezeElevation&&this._updateElevation(Be),me)y.setLocationAtPoint(me,ge);else{const Fe=y.zoomScale(y.zoom-x),Qe=le>x?Math.min(2,ne):Math.max(.5,ne),st=Math.pow(Qe,1-Be),Ye=y.unproject(ce.add(he.mult(Be*st)).mult(Fe));y.setLocationAtPoint(y.renderWorldCopies?Ye.wrap():Ye,J)}this._applyUpdatedTransform(y),this._fireMoveEvents(d)},Be=>{this.terrain&&o.freezeElevation&&this._finalizeElevation(),this._afterEase(d,Be)},o),this}_prepareEase(o,d,m={}){this._moving=!0,d||m.moving||this.fire(new l.k("movestart",o)),this._zooming&&!m.zooming&&this.fire(new l.k("zoomstart",o)),this._rotating&&!m.rotating&&this.fire(new l.k("rotatestart",o)),this._pitching&&!m.pitching&&this.fire(new l.k("pitchstart",o))}_prepareElevation(o){this._elevationCenter=o,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(o,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(o){this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);const d=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(o<1&&d!==this._elevationTarget){const m=this._elevationTarget-this._elevationStart;this._elevationStart+=o*(m-(d-(m*o+this._elevationStart))/(1-o)),this._elevationTarget=d}this.transform.elevation=l.y.number(this._elevationStart,this._elevationTarget,o)}_finalizeElevation(){this._elevationFreeze=!1,this.transform.recalculateZoom(this.terrain)}_getTransformForUpdate(){return this.transformCameraUpdate||this.terrain?(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState):this.transform}_elevateCameraIfInsideTerrain(o){const d=o.getCameraPosition(),m=this.terrain.getElevationForLngLatZoom(d.lngLat,o.zoom);if(d.altitude<m){const y=this.calculateCameraOptionsFromTo(d.lngLat,m,o.center,o.elevation);return{pitch:y.pitch,zoom:y.zoom}}return{}}_applyUpdatedTransform(o){const d=[];if(this.terrain&&d.push(y=>this._elevateCameraIfInsideTerrain(y)),this.transformCameraUpdate&&d.push(y=>this.transformCameraUpdate(y)),!d.length)return;const m=o.clone();for(const y of d){const x=m.clone(),{center:M,zoom:I,pitch:O,bearing:N,elevation:V}=y(x);M&&(x.center=M),I!==void 0&&(x.zoom=I),O!==void 0&&(x.pitch=O),N!==void 0&&(x.bearing=N),V!==void 0&&(x.elevation=V),m.apply(x)}this.transform.apply(m)}_fireMoveEvents(o){this.fire(new l.k("move",o)),this._zooming&&this.fire(new l.k("zoom",o)),this._rotating&&this.fire(new l.k("rotate",o)),this._pitching&&this.fire(new l.k("pitch",o))}_afterEase(o,d){if(this._easeId&&d&&this._easeId===d)return;delete this._easeId;const m=this._zooming,y=this._rotating,x=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,m&&this.fire(new l.k("zoomend",o)),y&&this.fire(new l.k("rotateend",o)),x&&this.fire(new l.k("pitchend",o)),this.fire(new l.k("moveend",o))}flyTo(o,d){var m;if(!o.essential&&E.prefersReducedMotion){const nt=l.M(o,["center","zoom","bearing","pitch","around"]);return this.jumpTo(nt,d)}this.stop(),o=l.e({offset:[0,0],speed:1.2,curve:1.42,easing:l.b9},o);const y=this._getTransformForUpdate(),x=y.zoom,M=y.bearing,I=y.pitch,O=y.padding,N="bearing"in o?this._normalizeBearing(o.bearing,M):M,V="pitch"in o?+o.pitch:I,F="padding"in o?o.padding:y.padding,Z=l.P.convert(o.offset);let J=y.centerPoint.add(Z);const ee=y.pointLocation(J),{center:oe,zoom:le}=y.getConstrained(l.N.convert(o.center||ee),(m=o.zoom)!==null&&m!==void 0?m:x);this._normalizeCenter(oe,y);const ce=y.zoomScale(le-x),he=y.project(ee),ne=y.project(oe).sub(he);let me=o.curve;const ge=Math.max(y.width,y.height),xe=ge/ce,Be=ne.mag();if("minZoom"in o){const nt=l.ac(Math.min(o.minZoom,x,le),y.minZoom,y.maxZoom),Dt=ge/y.zoomScale(nt-x);me=Math.sqrt(Dt/Be*2)}const Fe=me*me;function Qe(nt){const Dt=(xe*xe-ge*ge+(nt?-1:1)*Fe*Fe*Be*Be)/(2*(nt?xe:ge)*Fe*Be);return Math.log(Math.sqrt(Dt*Dt+1)-Dt)}function st(nt){return(Math.exp(nt)-Math.exp(-nt))/2}function Ye(nt){return(Math.exp(nt)+Math.exp(-nt))/2}const Ge=Qe(!1);let mt=function(nt){return Ye(Ge)/Ye(Ge+me*nt)},Bt=function(nt){return ge*((Ye(Ge)*(st(Dt=Ge+me*nt)/Ye(Dt))-st(Ge))/Fe)/Be;var Dt},Ke=(Qe(!0)-Ge)/me;if(Math.abs(Be)<1e-6||!isFinite(Ke)){if(Math.abs(ge-xe)<1e-6)return this.easeTo(o,d);const nt=xe<ge?-1:1;Ke=Math.abs(Math.log(xe/ge))/me,Bt=()=>0,mt=Dt=>Math.exp(nt*me*Dt)}return o.duration="duration"in o?+o.duration:1e3*Ke/("screenSpeed"in o?+o.screenSpeed/me:+o.speed),o.maxDuration&&o.duration>o.maxDuration&&(o.duration=0),this._zooming=!0,this._rotating=M!==N,this._pitching=V!==I,this._padding=!y.isPaddingEqual(F),this._prepareEase(d,!1),this.terrain&&this._prepareElevation(oe),this._ease(nt=>{const Dt=nt*Ke,Fn=1/mt(Dt);y.zoom=nt===1?le:x+y.scaleZoom(Fn),this._rotating&&(y.bearing=l.y.number(M,N,nt)),this._pitching&&(y.pitch=l.y.number(I,V,nt)),this._padding&&(y.interpolatePadding(O,F,nt),J=y.centerPoint.add(Z)),this.terrain&&!o.freezeElevation&&this._updateElevation(nt);const $t=nt===1?oe:y.unproject(he.add(ne.mult(Bt(Dt))).mult(Fn));y.setLocationAtPoint(y.renderWorldCopies?$t.wrap():$t,J),this._applyUpdatedTransform(y),this._fireMoveEvents(d)},()=>{this.terrain&&o.freezeElevation&&this._finalizeElevation(),this._afterEase(d)},o),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(o,d){var m;if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const y=this._onEaseEnd;delete this._onEaseEnd,y.call(this,d)}return o||(m=this.handlers)===null||m===void 0||m.stop(!1),this}_ease(o,d,m){m.animate===!1||m.duration===0?(o(1),d()):(this._easeStart=E.now(),this._easeOptions=m,this._onEaseFrame=o,this._onEaseEnd=d,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(o,d){o=l.b3(o,-180,180);const m=Math.abs(o-d);return Math.abs(o-360-d)<m&&(o-=360),Math.abs(o+360-d)<m&&(o+=360),o}_normalizeCenter(o,d){if(!d.renderWorldCopies||d.lngRange)return;const m=o.lng-d.center.lng;o.lng+=m>180?-360:m<-180?360:0}queryTerrainElevation(o){return this.terrain?this.terrain.getElevationForLngLatZoom(l.N.convert(o),this.transform.tileZoom)-this.transform.elevation:null}}const Ga={compact:!0,customAttribution:'<a href="https://maplibre.org/" target="_blank">MapLibre</a>'};class Za{constructor(o=Ga){this._toggleAttribution=()=>{this._container.classList.contains("maplibregl-compact")&&(this._container.classList.contains("maplibregl-compact-show")?(this._container.setAttribute("open",""),this._container.classList.remove("maplibregl-compact-show")):(this._container.classList.add("maplibregl-compact-show"),this._container.removeAttribute("open")))},this._updateData=d=>{!d||d.sourceDataType!=="metadata"&&d.sourceDataType!=="visibility"&&d.dataType!=="style"&&d.type!=="terrain"||this._updateAttributions()},this._updateCompact=()=>{this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact===!1?this._container.setAttribute("open",""):this._container.classList.contains("maplibregl-compact")||this._container.classList.contains("maplibregl-attrib-empty")||(this._container.setAttribute("open",""),this._container.classList.add("maplibregl-compact","maplibregl-compact-show")):(this._container.setAttribute("open",""),this._container.classList.contains("maplibregl-compact")&&this._container.classList.remove("maplibregl-compact","maplibregl-compact-show"))},this._updateCompactMinimize=()=>{this._container.classList.contains("maplibregl-compact")&&this._container.classList.contains("maplibregl-compact-show")&&this._container.classList.remove("maplibregl-compact-show")},this.options=o}getDefaultPosition(){return"bottom-right"}onAdd(o){return this._map=o,this._compact=this.options.compact,this._container=C.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=C.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=C.create("div","maplibregl-ctrl-attrib-inner",this._container),this._updateAttributions(),this._updateCompact(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("terrain",this._updateData),this._map.on("resize",this._updateCompact),this._map.on("drag",this._updateCompactMinimize),this._container}onRemove(){C.remove(this._container),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("terrain",this._updateData),this._map.off("resize",this._updateCompact),this._map.off("drag",this._updateCompactMinimize),this._map=void 0,this._compact=void 0,this._attribHTML=void 0}_setElementTitle(o,d){const m=this._map._getUIString(`AttributionControl.${d}`);o.title=m,o.setAttribute("aria-label",m)}_updateAttributions(){if(!this._map.style)return;let o=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?o=o.concat(this.options.customAttribution.map(y=>typeof y!="string"?"":y)):typeof this.options.customAttribution=="string"&&o.push(this.options.customAttribution)),this._map.style.stylesheet){const y=this._map.style.stylesheet;this.styleOwner=y.owner,this.styleId=y.id}const d=this._map.style.sourceCaches;for(const y in d){const x=d[y];if(x.used||x.usedForTerrain){const M=x.getSource();M.attribution&&o.indexOf(M.attribution)<0&&o.push(M.attribution)}}o=o.filter(y=>String(y).trim()),o.sort((y,x)=>y.length-x.length),o=o.filter((y,x)=>{for(let M=x+1;M<o.length;M++)if(o[M].indexOf(y)>=0)return!1;return!0});const m=o.join(" | ");m!==this._attribHTML&&(this._attribHTML=m,o.length?(this._innerContainer.innerHTML=m,this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}}class Od{constructor(o={}){this._updateCompact=()=>{const d=this._container.children;if(d.length){const m=d[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&m.classList.add("maplibregl-compact"):m.classList.remove("maplibregl-compact")}},this.options=o}getDefaultPosition(){return"bottom-left"}onAdd(o){this._map=o,this._compact=this.options&&this.options.compact,this._container=C.create("div","maplibregl-ctrl");const d=C.create("a","maplibregl-ctrl-logo");return d.target="_blank",d.rel="noopener nofollow",d.href="https://maplibre.org/",d.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),d.setAttribute("rel","noopener nofollow"),this._container.appendChild(d),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){C.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class en{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(o){const d=++this._id;return this._queue.push({callback:o,id:d,cancelled:!1}),d}remove(o){const d=this._currentlyRunning,m=d?this._queue.concat(d):this._queue;for(const y of m)if(y.id===o)return void(y.cancelled=!0)}run(o=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");const d=this._currentlyRunning=this._queue;this._queue=[];for(const m of d)if(!m.cancelled&&(m.callback(o),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}var Bd=l.Y([{name:"a_pos3d",type:"Int16",components:3}]);class E_ extends l.E{constructor(o){super(),this.sourceCache=o,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.deltaZoom=1,o.usedForTerrain=!0,o.tileSize=this.tileSize*2**this.deltaZoom}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null}update(o,d){this.sourceCache.update(o,d),this._renderableTilesKeys=[];const m={};for(const y of o.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:d}))m[y.key]=!0,this._renderableTilesKeys.push(y.key),this._tiles[y.key]||(y.posMatrix=new Float64Array(16),l.aP(y.posMatrix,0,l.X,0,l.X,0,1),this._tiles[y.key]=new To(y,this.tileSize));for(const y in this._tiles)m[y]||delete this._tiles[y]}freeRtt(o){for(const d in this._tiles){const m=this._tiles[d];(!o||m.tileID.equals(o)||m.tileID.isChildOf(o)||o.isChildOf(m.tileID))&&(m.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map(o=>this.getTileByID(o))}getTileByID(o){return this._tiles[o]}getTerrainCoords(o){const d={};for(const m of this._renderableTilesKeys){const y=this._tiles[m].tileID;if(y.canonical.equals(o.canonical)){const x=o.clone();x.posMatrix=new Float64Array(16),l.aP(x.posMatrix,0,l.X,0,l.X,0,1),d[m]=x}else if(y.canonical.isChildOf(o.canonical)){const x=o.clone();x.posMatrix=new Float64Array(16);const M=y.canonical.z-o.canonical.z,I=y.canonical.x-(y.canonical.x>>M<<M),O=y.canonical.y-(y.canonical.y>>M<<M),N=l.X>>M;l.aP(x.posMatrix,0,N,0,N,0,1),l.J(x.posMatrix,x.posMatrix,[-I*N,-O*N,0]),d[m]=x}else if(o.canonical.isChildOf(y.canonical)){const x=o.clone();x.posMatrix=new Float64Array(16);const M=o.canonical.z-y.canonical.z,I=o.canonical.x-(o.canonical.x>>M<<M),O=o.canonical.y-(o.canonical.y>>M<<M),N=l.X>>M;l.aP(x.posMatrix,0,l.X,0,l.X,0,1),l.J(x.posMatrix,x.posMatrix,[I*N,O*N,0]),l.K(x.posMatrix,x.posMatrix,[1/2**M,1/2**M,0]),d[m]=x}}return d}getSourceTile(o,d){const m=this.sourceCache._source;let y=o.overscaledZ-this.deltaZoom;if(y>m.maxzoom&&(y=m.maxzoom),y<m.minzoom)return null;this._sourceTileCache[o.key]||(this._sourceTileCache[o.key]=o.scaledTo(y).key);let x=this.sourceCache.getTileByID(this._sourceTileCache[o.key]);if((!x||!x.dem)&&d)for(;y>=m.minzoom&&(!x||!x.dem);)x=this.sourceCache.getTileByID(o.scaledTo(y--).key);return x}tilesAfterTime(o=Date.now()){return Object.values(this._tiles).filter(d=>d.timeAdded>=o)}}class zd{constructor(o,d,m){this.painter=o,this.sourceCache=new E_(d),this.options=m,this.exaggeration=typeof m.exaggeration=="number"?m.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}getDEMElevation(o,d,m,y=l.X){var x;if(!(d>=0&&d<y&&m>=0&&m<y))return 0;const M=this.getTerrainData(o),I=(x=M.tile)===null||x===void 0?void 0:x.dem;if(!I)return 0;const O=function(ee,oe,le){var ce=oe[0],he=oe[1];return ee[0]=le[0]*ce+le[4]*he+le[12],ee[1]=le[1]*ce+le[5]*he+le[13],ee}([],[d/y*l.X,m/y*l.X],M.u_terrain_matrix),N=[O[0]*I.dim,O[1]*I.dim],V=Math.floor(N[0]),F=Math.floor(N[1]),Z=N[0]-V,J=N[1]-F;return I.get(V,F)*(1-Z)*(1-J)+I.get(V+1,F)*Z*(1-J)+I.get(V,F+1)*(1-Z)*J+I.get(V+1,F+1)*Z*J}getElevationForLngLatZoom(o,d){if(!l.bb(d,o.wrap()))return 0;const{tileID:m,mercatorX:y,mercatorY:x}=this._getOverscaledTileIDFromLngLatZoom(o,d);return this.getElevation(m,y%l.X,x%l.X,l.X)}getElevation(o,d,m,y=l.X){return this.getDEMElevation(o,d,m,y)*this.exaggeration}getTerrainData(o){if(!this._emptyDemTexture){const y=this.painter.context,x=new l.R({width:1,height:1},new Uint8Array(4));this._emptyDepthTexture=new Xe(y,x,y.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new Xe(y,new l.R({width:1,height:1}),y.gl.RGBA,{premultiply:!1}),this._emptyDemTexture.bind(y.gl.NEAREST,y.gl.CLAMP_TO_EDGE),this._emptyDemMatrix=l.an([])}const d=this.sourceCache.getSourceTile(o,!0);if(d&&d.dem&&(!d.demTexture||d.needsTerrainPrepare)){const y=this.painter.context;d.demTexture=this.painter.getTileTexture(d.dem.stride),d.demTexture?d.demTexture.update(d.dem.getPixels(),{premultiply:!1}):d.demTexture=new Xe(y,d.dem.getPixels(),y.gl.RGBA,{premultiply:!1}),d.demTexture.bind(y.gl.NEAREST,y.gl.CLAMP_TO_EDGE),d.needsTerrainPrepare=!1}const m=d&&d+d.tileID.key+o.key;if(m&&!this._demMatrixCache[m]){const y=this.sourceCache.sourceCache._source.maxzoom;let x=o.canonical.z-d.tileID.canonical.z;o.overscaledZ>o.canonical.z&&(o.canonical.z>=y?x=o.canonical.z-y:l.w("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const M=o.canonical.x-(o.canonical.x>>x<<x),I=o.canonical.y-(o.canonical.y>>x<<x),O=l.bc(new Float64Array(16),[1/(l.X<<x),1/(l.X<<x),0]);l.J(O,O,[M*l.X,I*l.X,0]),this._demMatrixCache[o.key]={matrix:O,coord:o}}return{u_depth:2,u_terrain:3,u_terrain_dim:d&&d.dem&&d.dem.dim||1,u_terrain_matrix:m?this._demMatrixCache[o.key].matrix:this._emptyDemMatrix,u_terrain_unpack:d&&d.dem&&d.dem.getUnpackVector()||this._emptyDemUnpack,u_terrain_exaggeration:this.exaggeration,texture:(d&&d.demTexture||this._emptyDemTexture).texture,depthTexture:(this._fboDepthTexture||this._emptyDepthTexture).texture,tile:d}}getFramebuffer(o){const d=this.painter,m=d.width/devicePixelRatio,y=d.height/devicePixelRatio;return!this._fbo||this._fbo.width===m&&this._fbo.height===y||(this._fbo.destroy(),this._fboCoordsTexture.destroy(),this._fboDepthTexture.destroy(),delete this._fbo,delete this._fboDepthTexture,delete this._fboCoordsTexture),this._fboCoordsTexture||(this._fboCoordsTexture=new Xe(d.context,{width:m,height:y,data:null},d.context.gl.RGBA,{premultiply:!1}),this._fboCoordsTexture.bind(d.context.gl.NEAREST,d.context.gl.CLAMP_TO_EDGE)),this._fboDepthTexture||(this._fboDepthTexture=new Xe(d.context,{width:m,height:y,data:null},d.context.gl.RGBA,{premultiply:!1}),this._fboDepthTexture.bind(d.context.gl.NEAREST,d.context.gl.CLAMP_TO_EDGE)),this._fbo||(this._fbo=d.context.createFramebuffer(m,y,!0,!1),this._fbo.depthAttachment.set(d.context.createRenderbuffer(d.context.gl.DEPTH_COMPONENT16,m,y))),this._fbo.colorAttachment.set(o==="coords"?this._fboCoordsTexture.texture:this._fboDepthTexture.texture),this._fbo}getCoordsTexture(){const o=this.painter.context;if(this._coordsTexture)return this._coordsTexture;const d=new Uint8Array(this._coordsTextureSize*this._coordsTextureSize*4);for(let x=0,M=0;x<this._coordsTextureSize;x++)for(let I=0;I<this._coordsTextureSize;I++,M+=4)d[M+0]=255&I,d[M+1]=255&x,d[M+2]=I>>8<<4|x>>8,d[M+3]=0;const m=new l.R({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(d.buffer)),y=new Xe(o,m,o.gl.RGBA,{premultiply:!1});return y.bind(o.gl.NEAREST,o.gl.CLAMP_TO_EDGE),this._coordsTexture=y,y}pointCoordinate(o){this.painter.maybeDrawDepthAndCoords(!0);const d=new Uint8Array(4),m=this.painter.context,y=m.gl,x=Math.round(o.x*this.painter.pixelRatio/devicePixelRatio),M=Math.round(o.y*this.painter.pixelRatio/devicePixelRatio),I=Math.round(this.painter.height/devicePixelRatio);m.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),y.readPixels(x,I-M-1,1,1,y.RGBA,y.UNSIGNED_BYTE,d),m.bindFramebuffer.set(null);const O=d[0]+(d[2]>>4<<8),N=d[1]+((15&d[2])<<8),V=this.coordsIndex[255-d[3]],F=V&&this.sourceCache.getTileByID(V);if(!F)return null;const Z=this._coordsTextureSize,J=(1<<F.tileID.canonical.z)*Z;return new l.Z((F.tileID.canonical.x*Z+O)/J+F.tileID.wrap,(F.tileID.canonical.y*Z+N)/J,this.getElevation(F.tileID,O,N,Z))}depthAtPoint(o){const d=new Uint8Array(4),m=this.painter.context,y=m.gl;return m.bindFramebuffer.set(this.getFramebuffer("depth").framebuffer),y.readPixels(o.x,this.painter.height/devicePixelRatio-o.y-1,1,1,y.RGBA,y.UNSIGNED_BYTE,d),m.bindFramebuffer.set(null),(d[0]/16777216+d[1]/65536+d[2]/256+d[3])/256}getTerrainMesh(){if(this._mesh)return this._mesh;const o=this.painter.context,d=new l.bd,m=new l.aY,y=this.meshSize,x=l.X/y,M=y*y;for(let F=0;F<=y;F++)for(let Z=0;Z<=y;Z++)d.emplaceBack(Z*x,F*x,0);for(let F=0;F<M;F+=y+1)for(let Z=0;Z<y;Z++)m.emplaceBack(Z+F,y+Z+F+1,y+Z+F+2),m.emplaceBack(Z+F,y+Z+F+2,Z+F+1);const I=d.length,O=I+2*(y+1);for(const F of[0,1])for(let Z=0;Z<=y;Z++)for(const J of[0,1])d.emplaceBack(Z*x,F*l.X,J);for(let F=0;F<2*y;F+=2)m.emplaceBack(O+F,O+F+1,O+F+3),m.emplaceBack(O+F,O+F+3,O+F+2),m.emplaceBack(I+F,I+F+3,I+F+1),m.emplaceBack(I+F,I+F+2,I+F+3);const N=d.length,V=N+2*(y+1);for(const F of[0,1])for(let Z=0;Z<=y;Z++)for(const J of[0,1])d.emplaceBack(F*l.X,Z*x,J);for(let F=0;F<2*y;F+=2)m.emplaceBack(N+F,N+F+1,N+F+3),m.emplaceBack(N+F,N+F+3,N+F+2),m.emplaceBack(V+F,V+F+3,V+F+1),m.emplaceBack(V+F,V+F+2,V+F+3);return this._mesh=new yu(o.createVertexBuffer(d,Bd.members),o.createIndexBuffer(m),l.a0.simpleSegment(0,0,d.length,m.length)),this._mesh}getMeshFrameDelta(o){return 2*Math.PI*l.be/Math.pow(2,o)/5}getMinTileElevationForLngLatZoom(o,d){var m;const{tileID:y}=this._getOverscaledTileIDFromLngLatZoom(o,d);return(m=this.getMinMaxElevation(y).minElevation)!==null&&m!==void 0?m:0}getMinMaxElevation(o){const d=this.getTerrainData(o).tile,m={minElevation:null,maxElevation:null};return d&&d.dem&&(m.minElevation=d.dem.min*this.exaggeration,m.maxElevation=d.dem.max*this.exaggeration),m}_getOverscaledTileIDFromLngLatZoom(o,d){const m=l.Z.fromLngLat(o.wrap()),y=(1<<d)*l.X,x=m.x*y,M=m.y*y,I=Math.floor(x/l.X),O=Math.floor(M/l.X);return{tileID:new l.S(d,0,d,I,O),mercatorX:x,mercatorY:M}}}class C_{constructor(o,d,m){this._context=o,this._size=d,this._tileSize=m,this._objects=[],this._recentlyUsed=[],this._stamp=0}destruct(){for(const o of this._objects)o.texture.destroy(),o.fbo.destroy()}_createObject(o){const d=this._context.createFramebuffer(this._tileSize,this._tileSize,!0,!0),m=new Xe(this._context,{width:this._tileSize,height:this._tileSize,data:null},this._context.gl.RGBA);return m.bind(this._context.gl.LINEAR,this._context.gl.CLAMP_TO_EDGE),d.depthAttachment.set(this._context.createRenderbuffer(this._context.gl.DEPTH_STENCIL,this._tileSize,this._tileSize)),d.colorAttachment.set(m.texture),{id:o,fbo:d,texture:m,stamp:-1,inUse:!1}}getObjectForId(o){return this._objects[o]}useObject(o){o.inUse=!0,this._recentlyUsed=this._recentlyUsed.filter(d=>o.id!==d),this._recentlyUsed.push(o.id)}stampObject(o){o.stamp=++this._stamp}getOrCreateFreeObject(){for(const d of this._recentlyUsed)if(!this._objects[d].inUse)return this._objects[d];if(this._objects.length>=this._size)throw new Error("No free RenderPool available, call freeAllObjects() required!");const o=this._createObject(this._objects.length);return this._objects.push(o),o}freeObject(o){o.inUse=!1}freeAllObjects(){for(const o of this._objects)this.freeObject(o)}isFull(){return!(this._objects.length<this._size)&&this._objects.some(o=>!o.inUse)===!1}}const Ya={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0};class Mm{constructor(o,d){this.painter=o,this.terrain=d,this.pool=new C_(o.context,30,d.sourceCache.tileSize*d.qualityFactor)}destruct(){this.pool.destruct()}getTexture(o){return this.pool.getObjectForId(o.rtt[this._stacks.length-1].id).texture}prepareForRender(o,d){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.sourceCache.getRenderableTiles(),this._renderableLayerIds=o._order.filter(m=>!o._layers[m].isHidden(d)),this._coordsDescendingInv={};for(const m in o.sourceCaches){this._coordsDescendingInv[m]={};const y=o.sourceCaches[m].getVisibleCoordinates();for(const x of y){const M=this.terrain.sourceCache.getTerrainCoords(x);for(const I in M)this._coordsDescendingInv[m][I]||(this._coordsDescendingInv[m][I]=[]),this._coordsDescendingInv[m][I].push(M[I])}}this._coordsDescendingInvStr={};for(const m of o._order){const y=o._layers[m],x=y.source;if(Ya[y.type]&&!this._coordsDescendingInvStr[x]){this._coordsDescendingInvStr[x]={};for(const M in this._coordsDescendingInv[x])this._coordsDescendingInvStr[x][M]=this._coordsDescendingInv[x][M].map(I=>I.key).sort().join()}}for(const m of this._renderableTiles)for(const y in this._coordsDescendingInvStr){const x=this._coordsDescendingInvStr[y][m.tileID.key];x&&x!==m.rttCoords[y]&&(m.rtt=[])}}renderLayer(o){if(o.isHidden(this.painter.transform.zoom))return!1;const d=o.type,m=this.painter,y=this._renderableLayerIds[this._renderableLayerIds.length-1]===o.id;if(Ya[d]&&(this._prevType&&Ya[this._prevType]||this._stacks.push([]),this._prevType=d,this._stacks[this._stacks.length-1].push(o.id),!y))return!0;if(Ya[this._prevType]||Ya[d]&&y){this._prevType=d;const x=this._stacks.length-1,M=this._stacks[x]||[];for(const I of this._renderableTiles){if(this.pool.isFull()&&(xm(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(I),I.rtt[x]){const N=this.pool.getObjectForId(I.rtt[x].id);if(N.stamp===I.rtt[x].stamp){this.pool.useObject(N);continue}}const O=this.pool.getOrCreateFreeObject();this.pool.useObject(O),this.pool.stampObject(O),I.rtt[x]={id:O.id,stamp:O.stamp},m.context.bindFramebuffer.set(O.fbo.framebuffer),m.context.clear({color:l.aM.transparent,stencil:0}),m.currentStencilSource=void 0;for(let N=0;N<M.length;N++){const V=m.style._layers[M[N]],F=V.source?this._coordsDescendingInv[V.source][I.tileID.key]:[I.tileID];m.context.viewport.set([0,0,O.fbo.width,O.fbo.height]),m._renderTileClippingMasks(V,F),m.renderLayer(m,m.style.sourceCaches[V.source],V,F),V.source&&(I.rttCoords[V.source]=this._coordsDescendingInvStr[V.source][I.tileID.key])}}return xm(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects(),Ya[d]}return!1}}const Nd={"AttributionControl.ToggleAttribution":"Toggle attribution","AttributionControl.MapFeedback":"Map feedback","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"MapLibre logo","Map.Title":"Map","Marker.Title":"Map marker","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","Popup.Close":"Close popup","ScaleControl.Feet":"ft","ScaleControl.Meters":"m","ScaleControl.Kilometers":"km","ScaleControl.Miles":"mi","ScaleControl.NauticalMiles":"nm","TerrainControl.Enable":"Enable terrain","TerrainControl.Disable":"Disable terrain","CooperativeGesturesHandler.WindowsHelpText":"Use Ctrl + scroll to zoom the map","CooperativeGesturesHandler.MacHelpText":"Use ⌘ + scroll to zoom the map","CooperativeGesturesHandler.MobileHelpText":"Use two fingers to move the map"},Am=g,T_={hash:!1,interactive:!0,bearingSnap:7,attributionControl:Ga,maplibreLogo:!1,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:!1,refreshExpiredTiles:!0,scrollZoom:!0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:60,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:!1,trackResize:!0,center:[0,0],zoom:0,bearing:0,pitch:0,renderWorldCopies:!0,maxTileCacheSize:null,maxTileCacheZoomLevels:l.a.MAX_TILE_CACHE_ZOOM_LEVELS,transformRequest:null,transformCameraUpdate:null,fadeDuration:300,crossSourceCollisions:!0,clickTolerance:3,localIdeographFontFamily:"sans-serif",pitchWithRotate:!0,validateStyle:!0,maxCanvasSize:[4096,4096],cancelPendingTileRequestsWhileZooming:!0},Rd=v=>{v.touchstart=v.dragStart,v.touchmoveWindow=v.dragMove,v.touchend=v.dragEnd},M_={showCompass:!0,showZoom:!0,visualizePitch:!1};class A_{constructor(o,d,m=!1){this.mousedown=M=>{this.startMouse(l.e({},M,{ctrlKey:!0,preventDefault:()=>M.preventDefault()}),C.mousePos(this.element,M)),C.addEventListener(window,"mousemove",this.mousemove),C.addEventListener(window,"mouseup",this.mouseup)},this.mousemove=M=>{this.moveMouse(M,C.mousePos(this.element,M))},this.mouseup=M=>{this.mouseRotate.dragEnd(M),this.mousePitch&&this.mousePitch.dragEnd(M),this.offTemp()},this.touchstart=M=>{M.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=C.touchPos(this.element,M.targetTouches)[0],this.startTouch(M,this._startPos),C.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),C.addEventListener(window,"touchend",this.touchend))},this.touchmove=M=>{M.targetTouches.length!==1?this.reset():(this._lastPos=C.touchPos(this.element,M.targetTouches)[0],this.moveTouch(M,this._lastPos))},this.touchend=M=>{M.targetTouches.length===0&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)<this._clickTolerance&&this.element.click(),delete this._startPos,delete this._lastPos,this.offTemp()},this.reset=()=>{this.mouseRotate.reset(),this.mousePitch&&this.mousePitch.reset(),this.touchRotate.reset(),this.touchPitch&&this.touchPitch.reset(),delete this._startPos,delete this._lastPos,this.offTemp()},this._clickTolerance=10;const y=o.dragRotate._mouseRotate.getClickTolerance(),x=o.dragRotate._mousePitch.getClickTolerance();this.element=d,this.mouseRotate=Sd({clickTolerance:y,enable:!0}),this.touchRotate=(({enable:M,clickTolerance:I,bearingDegreesPerPixelMoved:O=.8})=>{const N=new kd;return new qo({clickTolerance:I,move:(V,F)=>({bearingDelta:(F.x-V.x)*O}),moveStateManager:N,enable:M,assignEvents:Rd})})({clickTolerance:y,enable:!0}),this.map=o,m&&(this.mousePitch=Ed({clickTolerance:x,enable:!0}),this.touchPitch=(({enable:M,clickTolerance:I,pitchDegreesPerPixelMoved:O=-.5})=>{const N=new kd;return new qo({clickTolerance:I,move:(V,F)=>({pitchDelta:(F.y-V.y)*O}),moveStateManager:N,enable:M,assignEvents:Rd})})({clickTolerance:x,enable:!0})),C.addEventListener(d,"mousedown",this.mousedown),C.addEventListener(d,"touchstart",this.touchstart,{passive:!1}),C.addEventListener(d,"touchcancel",this.reset)}startMouse(o,d){this.mouseRotate.dragStart(o,d),this.mousePitch&&this.mousePitch.dragStart(o,d),C.disableDrag()}startTouch(o,d){this.touchRotate.dragStart(o,d),this.touchPitch&&this.touchPitch.dragStart(o,d),C.disableDrag()}moveMouse(o,d){const m=this.map,{bearingDelta:y}=this.mouseRotate.dragMove(o,d)||{};if(y&&m.setBearing(m.getBearing()+y),this.mousePitch){const{pitchDelta:x}=this.mousePitch.dragMove(o,d)||{};x&&m.setPitch(m.getPitch()+x)}}moveTouch(o,d){const m=this.map,{bearingDelta:y}=this.touchRotate.dragMove(o,d)||{};if(y&&m.setBearing(m.getBearing()+y),this.touchPitch){const{pitchDelta:x}=this.touchPitch.dragMove(o,d)||{};x&&m.setPitch(m.getPitch()+x)}}off(){const o=this.element;C.removeEventListener(o,"mousedown",this.mousedown),C.removeEventListener(o,"touchstart",this.touchstart,{passive:!1}),C.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),C.removeEventListener(window,"touchend",this.touchend),C.removeEventListener(o,"touchcancel",this.reset),this.offTemp()}offTemp(){C.enableDrag(),C.removeEventListener(window,"mousemove",this.mousemove),C.removeEventListener(window,"mouseup",this.mouseup),C.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),C.removeEventListener(window,"touchend",this.touchend)}}let br;function Vn(v,o,d){const m=new l.N(v.lng,v.lat);if(v=new l.N(v.lng,v.lat),o){const y=new l.N(v.lng-360,v.lat),x=new l.N(v.lng+360,v.lat),M=d.locationPoint(v).distSqr(o);d.locationPoint(y).distSqr(o)<M?v=y:d.locationPoint(x).distSqr(o)<M&&(v=x)}for(;Math.abs(v.lng-d.center.lng)>180;){const y=d.locationPoint(v);if(y.x>=0&&y.y>=0&&y.x<=d.width&&y.y<=d.height)break;v.lng>d.center.lng?v.lng-=360:v.lng+=360}return v.lng!==m.lng&&d.locationPoint(v).y>d.height/2-d.getHorizon()?v:m}const Xa={center:"translate(-50%,-50%)",top:"translate(-50%,0)","top-left":"translate(0,0)","top-right":"translate(-100%,0)",bottom:"translate(-50%,-100%)","bottom-left":"translate(0,-100%)","bottom-right":"translate(-100%,-100%)",left:"translate(0,-50%)",right:"translate(-100%,-50%)"};function Mu(v,o,d){const m=v.classList;for(const y in Xa)m.remove(`maplibregl-${d}-anchor-${y}`);m.add(`maplibregl-${d}-anchor-${o}`)}class Au extends l.E{constructor(o){if(super(),this._onKeyPress=d=>{const m=d.code,y=d.charCode||d.keyCode;m!=="Space"&&m!=="Enter"&&y!==32&&y!==13||this.togglePopup()},this._onMapClick=d=>{const m=d.originalEvent.target,y=this._element;this._popup&&(m===y||y.contains(m))&&this.togglePopup()},this._update=d=>{var m;if(!this._map)return;const y=this._map.loaded()&&!this._map.isMoving();((d==null?void 0:d.type)==="terrain"||(d==null?void 0:d.type)==="render"&&!y)&&this._map.once("render",this._update),this._lngLat=this._map.transform.renderWorldCopies?Vn(this._lngLat,this._flatPos,this._map.transform):(m=this._lngLat)===null||m===void 0?void 0:m.wrap(),this._flatPos=this._pos=this._map.project(this._lngLat)._add(this._offset),this._map.terrain&&(this._flatPos=this._map.transform.locationPoint(this._lngLat)._add(this._offset));let x="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?x=`rotateZ(${this._rotation}deg)`:this._rotationAlignment==="map"&&(x=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let M="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?M="rotateX(0deg)":this._pitchAlignment==="map"&&(M=`rotateX(${this._map.getPitch()}deg)`),this._subpixelPositioning||d&&d.type!=="moveend"||(this._pos=this._pos.round()),C.setTransform(this._element,`${Xa[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${M} ${x}`),E.frameAsync(new AbortController).then(()=>{this._updateOpacity(d&&d.type==="moveend")}).catch(()=>{})},this._onMove=d=>{if(!this._isDragging){const m=this._clickTolerance||this._map._clickTolerance;this._isDragging=d.point.dist(this._pointerdownPos)>=m}this._isDragging&&(this._pos=d.point.sub(this._positionDelta),this._lngLat=this._map.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none",this._state==="pending"&&(this._state="active",this.fire(new l.k("dragstart"))),this.fire(new l.k("drag")))},this._onUp=()=>{this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1,this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),this._state==="active"&&this.fire(new l.k("dragend")),this._state="inactive"},this._addDragHandler=d=>{this._element.contains(d.originalEvent.target)&&(d.preventDefault(),this._positionDelta=d.point.sub(this._pos).add(this._offset),this._pointerdownPos=d.point,this._state="pending",this._map.on("mousemove",this._onMove),this._map.on("touchmove",this._onMove),this._map.once("mouseup",this._onUp),this._map.once("touchend",this._onUp))},this._anchor=o&&o.anchor||"center",this._color=o&&o.color||"#3FB1CE",this._scale=o&&o.scale||1,this._draggable=o&&o.draggable||!1,this._clickTolerance=o&&o.clickTolerance||0,this._subpixelPositioning=o&&o.subpixelPositioning||!1,this._isDragging=!1,this._state="inactive",this._rotation=o&&o.rotation||0,this._rotationAlignment=o&&o.rotationAlignment||"auto",this._pitchAlignment=o&&o.pitchAlignment&&o.pitchAlignment!=="auto"?o.pitchAlignment:this._rotationAlignment,this.setOpacity(),this.setOpacity(o==null?void 0:o.opacity,o==null?void 0:o.opacityWhenCovered),o&&o.element)this._element=o.element,this._offset=l.P.convert(o&&o.offset||[0,0]);else{this._defaultMarker=!0,this._element=C.create("div");const d=C.createNS("http://www.w3.org/2000/svg","svg"),m=41,y=27;d.setAttributeNS(null,"display","block"),d.setAttributeNS(null,"height",`${m}px`),d.setAttributeNS(null,"width",`${y}px`),d.setAttributeNS(null,"viewBox",`0 0 ${y} ${m}`);const x=C.createNS("http://www.w3.org/2000/svg","g");x.setAttributeNS(null,"stroke","none"),x.setAttributeNS(null,"stroke-width","1"),x.setAttributeNS(null,"fill","none"),x.setAttributeNS(null,"fill-rule","evenodd");const M=C.createNS("http://www.w3.org/2000/svg","g");M.setAttributeNS(null,"fill-rule","nonzero");const I=C.createNS("http://www.w3.org/2000/svg","g");I.setAttributeNS(null,"transform","translate(3.0, 29.0)"),I.setAttributeNS(null,"fill","#000000");const O=[{rx:"10.5",ry:"5.25002273"},{rx:"10.5",ry:"5.25002273"},{rx:"9.5",ry:"4.77275007"},{rx:"8.5",ry:"4.29549936"},{rx:"7.5",ry:"3.81822308"},{rx:"6.5",ry:"3.34094679"},{rx:"5.5",ry:"2.86367051"},{rx:"4.5",ry:"2.38636864"}];for(const ce of O){const he=C.createNS("http://www.w3.org/2000/svg","ellipse");he.setAttributeNS(null,"opacity","0.04"),he.setAttributeNS(null,"cx","10.5"),he.setAttributeNS(null,"cy","5.80029008"),he.setAttributeNS(null,"rx",ce.rx),he.setAttributeNS(null,"ry",ce.ry),I.appendChild(he)}const N=C.createNS("http://www.w3.org/2000/svg","g");N.setAttributeNS(null,"fill",this._color);const V=C.createNS("http://www.w3.org/2000/svg","path");V.setAttributeNS(null,"d","M27,13.5 C27,19.074644 20.250001,27.000002 14.75,34.500002 C14.016665,35.500004 12.983335,35.500004 12.25,34.500002 C6.7499993,27.000002 0,19.222562 0,13.5 C0,6.0441559 6.0441559,0 13.5,0 C20.955844,0 27,6.0441559 27,13.5 Z"),N.appendChild(V);const F=C.createNS("http://www.w3.org/2000/svg","g");F.setAttributeNS(null,"opacity","0.25"),F.setAttributeNS(null,"fill","#000000");const Z=C.createNS("http://www.w3.org/2000/svg","path");Z.setAttributeNS(null,"d","M13.5,0 C6.0441559,0 0,6.0441559 0,13.5 C0,19.222562 6.7499993,27 12.25,34.5 C13,35.522727 14.016664,35.500004 14.75,34.5 C20.250001,27 27,19.074644 27,13.5 C27,6.0441559 20.955844,0 13.5,0 Z M13.5,1 C20.415404,1 26,6.584596 26,13.5 C26,15.898657 24.495584,19.181431 22.220703,22.738281 C19.945823,26.295132 16.705119,30.142167 13.943359,33.908203 C13.743445,34.180814 13.612715,34.322738 13.5,34.441406 C13.387285,34.322738 13.256555,34.180814 13.056641,33.908203 C10.284481,30.127985 7.4148684,26.314159 5.015625,22.773438 C2.6163816,19.232715 1,15.953538 1,13.5 C1,6.584596 6.584596,1 13.5,1 Z"),F.appendChild(Z);const J=C.createNS("http://www.w3.org/2000/svg","g");J.setAttributeNS(null,"transform","translate(6.0, 7.0)"),J.setAttributeNS(null,"fill","#FFFFFF");const ee=C.createNS("http://www.w3.org/2000/svg","g");ee.setAttributeNS(null,"transform","translate(8.0, 8.0)");const oe=C.createNS("http://www.w3.org/2000/svg","circle");oe.setAttributeNS(null,"fill","#000000"),oe.setAttributeNS(null,"opacity","0.25"),oe.setAttributeNS(null,"cx","5.5"),oe.setAttributeNS(null,"cy","5.5"),oe.setAttributeNS(null,"r","5.4999962");const le=C.createNS("http://www.w3.org/2000/svg","circle");le.setAttributeNS(null,"fill","#FFFFFF"),le.setAttributeNS(null,"cx","5.5"),le.setAttributeNS(null,"cy","5.5"),le.setAttributeNS(null,"r","5.4999962"),ee.appendChild(oe),ee.appendChild(le),M.appendChild(I),M.appendChild(N),M.appendChild(F),M.appendChild(J),M.appendChild(ee),d.appendChild(M),d.setAttributeNS(null,"height",m*this._scale+"px"),d.setAttributeNS(null,"width",y*this._scale+"px"),this._element.appendChild(d),this._offset=l.P.convert(o&&o.offset||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",d=>{d.preventDefault()}),this._element.addEventListener("mousedown",d=>{d.preventDefault()}),Mu(this._element,this._anchor,"marker"),o&&o.className)for(const d of o.className.split(" "))this._element.classList.add(d);this._popup=null}addTo(o){return this.remove(),this._map=o,this._element.setAttribute("aria-label",o._getUIString("Marker.Title")),o.getCanvasContainer().appendChild(this._element),o.on("move",this._update),o.on("moveend",this._update),o.on("terrain",this._update),this.setDraggable(this._draggable),this._update(),this._map.on("click",this._onMapClick),this}remove(){return this._opacityTimeout&&(clearTimeout(this._opacityTimeout),delete this._opacityTimeout),this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._update),this._map.off("moveend",this._update),this._map.off("terrain",this._update),this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler),this._map.off("mouseup",this._onUp),this._map.off("touchend",this._onUp),this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),delete this._map),C.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(o){return this._lngLat=l.N.convert(o),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(o){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),o){if(!("offset"in o.options)){const y=Math.abs(13.5)/Math.SQRT2;o.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[y,-1*(38.1-13.5+y)],"bottom-right":[-y,-1*(38.1-13.5+y)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=o,this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}setSubpixelPositioning(o){return this._subpixelPositioning=o,this}getPopup(){return this._popup}togglePopup(){const o=this._popup;return this._element.style.opacity===this._opacityWhenCovered?this:o?(o.isOpen()?o.remove():(o.setLngLat(this._lngLat),o.addTo(this._map)),this):this}_updateOpacity(o=!1){var d,m;if(!(!((d=this._map)===null||d===void 0)&&d.terrain))return void(this._element.style.opacity!==this._opacity&&(this._element.style.opacity=this._opacity));if(o)this._opacityTimeout=null;else{if(this._opacityTimeout)return;this._opacityTimeout=setTimeout(()=>{this._opacityTimeout=null},100)}const y=this._map,x=y.terrain.depthAtPoint(this._pos),M=y.terrain.getElevationForLngLatZoom(this._lngLat,y.transform.tileZoom);if(y.transform.lngLatToCameraDepth(this._lngLat,M)-x<.006)return void(this._element.style.opacity=this._opacity);const I=-this._offset.y/y.transform._pixelPerMeter,O=Math.sin(y.getPitch()*Math.PI/180)*I,N=y.terrain.depthAtPoint(new l.P(this._pos.x,this._pos.y-this._offset.y)),V=y.transform.lngLatToCameraDepth(this._lngLat,M+O)-N>.006;!((m=this._popup)===null||m===void 0)&&m.isOpen()&&V&&this._popup.remove(),this._element.style.opacity=V?this._opacityWhenCovered:this._opacity}getOffset(){return this._offset}setOffset(o){return this._offset=l.P.convert(o),this._update(),this}addClassName(o){this._element.classList.add(o)}removeClassName(o){this._element.classList.remove(o)}toggleClassName(o){return this._element.classList.toggle(o)}setDraggable(o){return this._draggable=!!o,this._map&&(o?(this._map.on("mousedown",this._addDragHandler),this._map.on("touchstart",this._addDragHandler)):(this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(o){return this._rotation=o||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(o){return this._rotationAlignment=o||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(o){return this._pitchAlignment=o&&o!=="auto"?o:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}setOpacity(o,d){return o===void 0&&d===void 0&&(this._opacity="1",this._opacityWhenCovered="0.2"),o!==void 0&&(this._opacity=o),d!==void 0&&(this._opacityWhenCovered=d),this._map&&this._updateOpacity(!0),this}}const Im={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let Ql=0,ec=!1;const Io={maxWidth:100,unit:"metric"};function tc(v,o,d){const m=d&&d.maxWidth||100,y=v._container.clientHeight/2,x=v.unproject([0,y]),M=v.unproject([m,y]),I=x.distanceTo(M);if(d&&d.unit==="imperial"){const O=3.2808*I;O>5280?ft(o,m,O/5280,v._getUIString("ScaleControl.Miles")):ft(o,m,O,v._getUIString("ScaleControl.Feet"))}else d&&d.unit==="nautical"?ft(o,m,I/1852,v._getUIString("ScaleControl.NauticalMiles")):I>=1e3?ft(o,m,I/1e3,v._getUIString("ScaleControl.Kilometers")):ft(o,m,I,v._getUIString("ScaleControl.Meters"))}function ft(v,o,d,m){const y=function(x){const M=Math.pow(10,`${Math.floor(x)}`.length-1);let I=x/M;return I=I>=10?10:I>=5?5:I>=3?3:I>=2?2:I>=1?1:function(O){const N=Math.pow(10,Math.ceil(-Math.log(O)/Math.LN10));return Math.round(O*N)/N}(I),M*I}(d);v.style.width=o*(y/d)+"px",v.innerHTML=`${y}&nbsp;${m}`}const Et={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1},Iu=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function Pu(v){if(v){if(typeof v=="number"){const o=Math.round(Math.abs(v)/Math.SQRT2);return{center:new l.P(0,0),top:new l.P(0,v),"top-left":new l.P(o,o),"top-right":new l.P(-o,o),bottom:new l.P(0,-v),"bottom-left":new l.P(o,-o),"bottom-right":new l.P(-o,-o),left:new l.P(v,0),right:new l.P(-v,0)}}if(v instanceof l.P||Array.isArray(v)){const o=l.P.convert(v);return{center:o,top:o,"top-left":o,"top-right":o,bottom:o,"bottom-left":o,"bottom-right":o,left:o,right:o}}return{center:l.P.convert(v.center||[0,0]),top:l.P.convert(v.top||[0,0]),"top-left":l.P.convert(v["top-left"]||[0,0]),"top-right":l.P.convert(v["top-right"]||[0,0]),bottom:l.P.convert(v.bottom||[0,0]),"bottom-left":l.P.convert(v["bottom-left"]||[0,0]),"bottom-right":l.P.convert(v["bottom-right"]||[0,0]),left:l.P.convert(v.left||[0,0]),right:l.P.convert(v.right||[0,0])}}return Pu(new l.P(0,0))}const Ld=g;u.AJAXError=l.bh,u.Evented=l.E,u.LngLat=l.N,u.MercatorCoordinate=l.Z,u.Point=l.P,u.addProtocol=l.bi,u.config=l.a,u.removeProtocol=l.bj,u.AttributionControl=Za,u.BoxZoomHandler=_r,u.CanvasSource=vi,u.CooperativeGesturesHandler=Wa,u.DoubleClickZoomHandler=Ks,u.DragPanHandler=Em,u.DragRotateHandler=Cm,u.EdgeInsets=ja,u.FullscreenControl=class extends l.E{constructor(v={}){super(),this._onFullscreenChange=()=>{var o;let d=window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement;for(;!((o=d==null?void 0:d.shadowRoot)===null||o===void 0)&&o.fullscreenElement;)d=d.shadowRoot.fullscreenElement;d===this._container!==this._fullscreen&&this._handleFullscreenChange()},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},this._fullscreen=!1,v&&v.container&&(v.container instanceof HTMLElement?this._container=v.container:l.w("Full screen control 'container' must be a DOM element.")),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onmozfullscreenchange"in document?this._fullscreenchange="mozfullscreenchange":"onwebkitfullscreenchange"in document?this._fullscreenchange="webkitfullscreenchange":"onmsfullscreenchange"in document&&(this._fullscreenchange="MSFullscreenChange")}onAdd(v){return this._map=v,this._container||(this._container=this._map.getContainer()),this._controlContainer=C.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){C.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const v=this._fullscreenButton=C.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);C.create("span","maplibregl-ctrl-icon",v).setAttribute("aria-hidden","true"),v.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){const v=this._getTitle();this._fullscreenButton.setAttribute("aria-label",v),this._fullscreenButton.title=v}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_handleFullscreenChange(){this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("maplibregl-ctrl-shrink"),this._fullscreenButton.classList.toggle("maplibregl-ctrl-fullscreen"),this._updateTitle(),this._fullscreen?(this.fire(new l.k("fullscreenstart")),this._prevCooperativeGesturesEnabled=this._map.cooperativeGestures.isEnabled(),this._map.cooperativeGestures.disable()):(this.fire(new l.k("fullscreenend")),this._prevCooperativeGesturesEnabled&&this._map.cooperativeGestures.enable())}_exitFullscreen(){window.document.exitFullscreen?window.document.exitFullscreen():window.document.mozCancelFullScreen?window.document.mozCancelFullScreen():window.document.msExitFullscreen?window.document.msExitFullscreen():window.document.webkitCancelFullScreen?window.document.webkitCancelFullScreen():this._togglePseudoFullScreen()}_requestFullscreen(){this._container.requestFullscreen?this._container.requestFullscreen():this._container.mozRequestFullScreen?this._container.mozRequestFullScreen():this._container.msRequestFullscreen?this._container.msRequestFullscreen():this._container.webkitRequestFullscreen?this._container.webkitRequestFullscreen():this._togglePseudoFullScreen()}_togglePseudoFullScreen(){this._container.classList.toggle("maplibregl-pseudo-fullscreen"),this._handleFullscreenChange(),this._map.resize()}},u.GeoJSONSource=ui,u.GeolocateControl=class extends l.E{constructor(v){super(),this._onSuccess=o=>{if(this._map){if(this._isOutOfMapMaxBounds(o))return this._setErrorState(),this.fire(new l.k("outofmaxbounds",o)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=o,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background");break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}this.options.showUserLocation&&this._watchState!=="OFF"&&this._updateMarker(o),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(o),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new l.k("geolocate",o)),this._finish()}},this._updateCamera=o=>{const d=new l.N(o.coords.longitude,o.coords.latitude),m=o.coords.accuracy,y=this._map.getBearing(),x=l.e({bearing:y},this.options.fitBoundsOptions),M=we.fromLngLat(d,m);this._map.fitBounds(M,x,{geolocateSource:!0})},this._updateMarker=o=>{if(o){const d=new l.N(o.coords.longitude,o.coords.latitude);this._accuracyCircleMarker.setLngLat(d).addTo(this._map),this._userLocationDotMarker.setLngLat(d).addTo(this._map),this._accuracy=o.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()},this._onZoom=()=>{this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()},this._onError=o=>{if(this._map){if(this.options.trackUserLocation)if(o.code===1){this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;const d=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=d,this._geolocateButton.setAttribute("aria-label",d),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(o.code===3&&ec)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new l.k("error",o)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._setupUI=()=>{this._map&&(this._container.addEventListener("contextmenu",o=>o.preventDefault()),this._geolocateButton=C.create("button","maplibregl-ctrl-geolocate",this._container),C.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",this._geolocateButton.disabled=!0)},this._finishSetupUI=o=>{if(this._map){if(o===!1){l.w("Geolocation support is not available so the GeolocateControl will be disabled.");const d=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=d,this._geolocateButton.setAttribute("aria-label",d)}else{const d=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.disabled=!1,this._geolocateButton.title=d,this._geolocateButton.setAttribute("aria-label",d)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=C.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new Au({element:this._dotElement}),this._circleElement=C.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new Au({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",()=>this.trigger()),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",d=>{d.geolocateSource||this._watchState!=="ACTIVE_LOCK"||d.originalEvent&&d.originalEvent.type==="resize"||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this.fire(new l.k("trackuserlocationend")),this.fire(new l.k("userlocationlostfocus")))})}},this.options=l.e({},Im,v)}onAdd(v){return this._map=v,this._container=C.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),function(){return l._(this,arguments,void 0,function*(o=!1){if(br!==void 0&&!o)return br;if(window.navigator.permissions===void 0)return br=!!window.navigator.geolocation,br;try{br=(yield window.navigator.permissions.query({name:"geolocation"})).state!=="denied"}catch{br=!!window.navigator.geolocation}return br})}().then(o=>this._finishSetupUI(o)),this._container}onRemove(){this._geolocationWatchID!==void 0&&(window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),C.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,Ql=0,ec=!1}_isOutOfMapMaxBounds(v){const o=this._map.getMaxBounds(),d=v.coords;return o&&(d.longitude<o.getWest()||d.longitude>o.getEast()||d.latitude<o.getSouth()||d.latitude>o.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"ACTIVE_ERROR":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}}_updateCircleRadius(){const v=this._map.getBounds(),o=v.getSouthEast(),d=v.getNorthEast(),m=o.distanceTo(d),y=Math.ceil(this._accuracy/(m/this._map._container.clientHeight)*2);this._circleElement.style.width=`${y}px`,this._circleElement.style.height=`${y}px`}trigger(){if(!this._setup)return l.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 l.k("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":Ql--,ec=!1,this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this.fire(new l.k("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new l.k("trackuserlocationstart")),this.fire(new l.k("userlocationfocus"));break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"OFF":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}if(this._watchState==="OFF"&&this._geolocationWatchID!==void 0)this._clearWatch();else if(this._geolocationWatchID===void 0){let v;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),Ql++,Ql>1?(v={maximumAge:6e5,timeout:0},ec=!0):(v=this.options.positionOptions,ec=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,v)}}else window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0}_clearWatch(){window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}},u.Hash=bu,u.ImageSource=xi,u.KeyboardHandler=Lr,u.LngLatBounds=we,u.LogoControl=Od,u.Map=class extends Tm{constructor(v){l.bf.mark(l.bg.create);const o=Object.assign(Object.assign({},T_),v);if(o.minZoom!=null&&o.maxZoom!=null&&o.minZoom>o.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(o.minPitch!=null&&o.maxPitch!=null&&o.minPitch>o.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(o.minPitch!=null&&o.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(o.maxPitch!=null&&o.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(super(new Ua(o.minZoom,o.maxZoom,o.minPitch,o.maxPitch,o.renderWorldCopies),{bearingSnap:o.bearingSnap}),this._idleTriggered=!1,this._crossFadingFactor=1,this._renderTaskQueue=new en,this._controls=[],this._mapId=l.a4(),this._contextLost=d=>{d.preventDefault(),this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this.fire(new l.k("webglcontextlost",{originalEvent:d}))},this._contextRestored=d=>{this._setupPainter(),this.resize(),this._update(),this.fire(new l.k("webglcontextrestored",{originalEvent:d}))},this._onMapScroll=d=>{if(d.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()},this._interactive=o.interactive,this._maxTileCacheSize=o.maxTileCacheSize,this._maxTileCacheZoomLevels=o.maxTileCacheZoomLevels,this._failIfMajorPerformanceCaveat=o.failIfMajorPerformanceCaveat===!0,this._preserveDrawingBuffer=o.preserveDrawingBuffer===!0,this._antialias=o.antialias===!0,this._trackResize=o.trackResize===!0,this._bearingSnap=o.bearingSnap,this._refreshExpiredTiles=o.refreshExpiredTiles===!0,this._fadeDuration=o.fadeDuration,this._crossSourceCollisions=o.crossSourceCollisions===!0,this._collectResourceTiming=o.collectResourceTiming===!0,this._locale=Object.assign(Object.assign({},Nd),o.locale),this._clickTolerance=o.clickTolerance,this._overridePixelRatio=o.pixelRatio,this._maxCanvasSize=o.maxCanvasSize,this.transformCameraUpdate=o.transformCameraUpdate,this.cancelPendingTileRequestsWhileZooming=o.cancelPendingTileRequestsWhileZooming===!0,this._imageQueueHandle=G.addThrottleControl(()=>this.isMoving()),this._requestManager=new Q(o.transformRequest),typeof o.container=="string"){if(this._container=document.getElementById(o.container),!this._container)throw new Error(`Container '${o.container}' not found.`)}else{if(!(o.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=o.container}if(o.maxBounds&&this.setMaxBounds(o.maxBounds),this._setupContainer(),this._setupPainter(),this.on("move",()=>this._update(!1)).on("moveend",()=>this._update(!1)).on("zoom",()=>this._update(!0)).on("terrain",()=>{this.painter.terrainFacilitator.dirty=!0,this._update(!0)}).once("idle",()=>{this._idleTriggered=!0}),typeof window<"u"){addEventListener("online",this._onWindowOnline,!1);let d=!1;const m=Zl(y=>{this._trackResize&&!this._removed&&(this.resize(y),this.redraw())},50);this._resizeObserver=new ResizeObserver(y=>{d?m(y):d=!0}),this._resizeObserver.observe(this._container)}this.handlers=new Dd(this,o),this._hash=o.hash&&new bu(typeof o.hash=="string"&&o.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:o.center,zoom:o.zoom,bearing:o.bearing,pitch:o.pitch}),o.bounds&&(this.resize(),this.fitBounds(o.bounds,l.e({},o.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=o.localIdeographFontFamily,this._validateStyle=o.validateStyle,o.style&&this.setStyle(o.style,{localIdeographFontFamily:o.localIdeographFontFamily}),o.attributionControl&&this.addControl(new Za(typeof o.attributionControl=="boolean"?void 0:o.attributionControl)),o.maplibreLogo&&this.addControl(new Od,o.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)}),this.on("data",d=>{this._update(d.dataType==="style"),this.fire(new l.k(`${d.dataType}data`,d))}),this.on("dataloading",d=>{this.fire(new l.k(`${d.dataType}dataloading`,d))}),this.on("dataabort",d=>{this.fire(new l.k("sourcedataabort",d))})}_getMapId(){return this._mapId}addControl(v,o){if(o===void 0&&(o=v.getDefaultPosition?v.getDefaultPosition():"top-right"),!v||!v.onAdd)return this.fire(new l.j(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const d=v.onAdd(this);this._controls.push(v);const m=this._controlPositions[o];return o.indexOf("bottom")!==-1?m.insertBefore(d,m.firstChild):m.appendChild(d),this}removeControl(v){if(!v||!v.onRemove)return this.fire(new l.j(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const o=this._controls.indexOf(v);return o>-1&&this._controls.splice(o,1),v.onRemove(this),this}hasControl(v){return this._controls.indexOf(v)>-1}calculateCameraOptionsFromTo(v,o,d,m){return m==null&&this.terrain&&(m=this.terrain.getElevationForLngLatZoom(d,this.transform.tileZoom)),super.calculateCameraOptionsFromTo(v,o,d,m)}resize(v){var o;const d=this._containerDimensions(),m=d[0],y=d[1],x=this._getClampedPixelRatio(m,y);if(this._resizeCanvas(m,y,x),this.painter.resize(m,y,x),this.painter.overLimit()){const I=this.painter.context.gl;this._maxCanvasSize=[I.drawingBufferWidth,I.drawingBufferHeight];const O=this._getClampedPixelRatio(m,y);this._resizeCanvas(m,y,O),this.painter.resize(m,y,O)}this.transform.resize(m,y),(o=this._requestedCameraState)===null||o===void 0||o.resize(m,y);const M=!this._moving;return M&&(this.stop(),this.fire(new l.k("movestart",v)).fire(new l.k("move",v))),this.fire(new l.k("resize",v)),M&&this.fire(new l.k("moveend",v)),this}_getClampedPixelRatio(v,o){const{0:d,1:m}=this._maxCanvasSize,y=this.getPixelRatio(),x=v*y,M=o*y;return Math.min(x>d?d/x:1,M>m?m/M:1)*y}getPixelRatio(){var v;return(v=this._overridePixelRatio)!==null&&v!==void 0?v:devicePixelRatio}setPixelRatio(v){this._overridePixelRatio=v,this.resize()}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(v){return this.transform.setMaxBounds(we.convert(v)),this._update()}setMinZoom(v){if((v=v??-2)>=-2&&v<=this.transform.maxZoom)return this.transform.minZoom=v,this._update(),this.getZoom()<v&&this.setZoom(v),this;throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(v){if((v=v??22)>=this.transform.minZoom)return this.transform.maxZoom=v,this._update(),this.getZoom()>v&&this.setZoom(v),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(v){if((v=v??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(v>=0&&v<=this.transform.maxPitch)return this.transform.minPitch=v,this._update(),this.getPitch()<v&&this.setPitch(v),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(v){if((v=v??60)>85)throw new Error("maxPitch must be less than or equal to 85");if(v>=this.transform.minPitch)return this.transform.maxPitch=v,this._update(),this.getPitch()>v&&this.setPitch(v),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(v){return this.transform.renderWorldCopies=v,this._update()}project(v){return this.transform.locationPoint(l.N.convert(v),this.style&&this.terrain)}unproject(v){return this.transform.pointLocation(l.P.convert(v),this.terrain)}isMoving(){var v;return this._moving||((v=this.handlers)===null||v===void 0?void 0:v.isMoving())}isZooming(){var v;return this._zooming||((v=this.handlers)===null||v===void 0?void 0:v.isZooming())}isRotating(){var v;return this._rotating||((v=this.handlers)===null||v===void 0?void 0:v.isRotating())}_createDelegatedListener(v,o,d){if(v==="mouseenter"||v==="mouseover"){let m=!1;return{layers:o,listener:d,delegates:{mousemove:x=>{const M=o.filter(O=>this.getLayer(O)),I=M.length!==0?this.queryRenderedFeatures(x.point,{layers:M}):[];I.length?m||(m=!0,d.call(this,new Di(v,this,x.originalEvent,{features:I}))):m=!1},mouseout:()=>{m=!1}}}}if(v==="mouseleave"||v==="mouseout"){let m=!1;return{layers:o,listener:d,delegates:{mousemove:M=>{const I=o.filter(O=>this.getLayer(O));(I.length!==0?this.queryRenderedFeatures(M.point,{layers:I}):[]).length?m=!0:m&&(m=!1,d.call(this,new Di(v,this,M.originalEvent)))},mouseout:M=>{m&&(m=!1,d.call(this,new Di(v,this,M.originalEvent)))}}}}{const m=y=>{const x=o.filter(I=>this.getLayer(I)),M=x.length!==0?this.queryRenderedFeatures(y.point,{layers:x}):[];M.length&&(y.features=M,d.call(this,y),delete y.features)};return{layers:o,listener:d,delegates:{[v]:m}}}}_saveDelegatedListener(v,o){this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[v]=this._delegatedListeners[v]||[],this._delegatedListeners[v].push(o)}_removeDelegatedListener(v,o,d){if(!this._delegatedListeners||!this._delegatedListeners[v])return;const m=this._delegatedListeners[v];for(let y=0;y<m.length;y++){const x=m[y];if(x.listener===d&&x.layers.length===o.length&&x.layers.every(M=>o.includes(M))){for(const M in x.delegates)this.off(M,x.delegates[M]);return void m.splice(y,1)}}}on(v,o,d){if(d===void 0)return super.on(v,o);const m=this._createDelegatedListener(v,typeof o=="string"?[o]:o,d);this._saveDelegatedListener(v,m);for(const y in m.delegates)this.on(y,m.delegates[y]);return this}once(v,o,d){if(d===void 0)return super.once(v,o);const m=typeof o=="string"?[o]:o,y=this._createDelegatedListener(v,m,d);for(const x in y.delegates){const M=y.delegates[x];y.delegates[x]=(...I)=>{this._removeDelegatedListener(v,m,d),M(...I)}}this._saveDelegatedListener(v,y);for(const x in y.delegates)this.once(x,y.delegates[x]);return this}off(v,o,d){return d===void 0?super.off(v,o):(this._removeDelegatedListener(v,typeof o=="string"?[o]:o,d),this)}queryRenderedFeatures(v,o){if(!this.style)return[];let d;const m=v instanceof l.P||Array.isArray(v),y=m?v:[[0,0],[this.transform.width,this.transform.height]];if(o=o||(m?{}:v)||{},y instanceof l.P||typeof y[0]=="number")d=[l.P.convert(y)];else{const x=l.P.convert(y[0]),M=l.P.convert(y[1]);d=[x,new l.P(M.x,x.y),M,new l.P(x.x,M.y),x]}return this.style.queryRenderedFeatures(d,o,this.transform)}querySourceFeatures(v,o){return this.style.querySourceFeatures(v,o)}setStyle(v,o){return(o=l.e({},{localIdeographFontFamily:this._localIdeographFontFamily,validate:this._validateStyle},o)).diff!==!1&&o.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&v?(this._diffStyle(v,o),this):(this._localIdeographFontFamily=o.localIdeographFontFamily,this._updateStyle(v,o))}setTransformRequest(v){return this._requestManager.setTransformRequest(v),this}_getUIString(v){const o=this._locale[v];if(o==null)throw new Error(`Missing UI string '${v}'`);return o}_updateStyle(v,o){if(o.transformStyle&&this.style&&!this.style._loaded)return void this.style.once("style.load",()=>this._updateStyle(v,o));const d=this.style&&o.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!v)),v?(this.style=new nu(this,o||{}),this.style.setEventedParent(this,{style:this.style}),typeof v=="string"?this.style.loadURL(v,o,d):this.style.loadJSON(v,o,d),this):(delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new nu(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(v,o){if(typeof v=="string"){const d=this._requestManager.transformRequest(v,"Style");l.h(d,new AbortController).then(m=>{this._updateDiff(m.data,o)}).catch(m=>{m&&this.fire(new l.j(m))})}else typeof v=="object"&&this._updateDiff(v,o)}_updateDiff(v,o){try{this.style.setState(v,o)&&this._update(!0)}catch(d){l.w(`Unable to perform style diff: ${d.message||d.error||d}. Rebuilding the style from scratch.`),this._updateStyle(v,o)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():l.w("There is no style added to the map.")}addSource(v,o){return this._lazyInitEmptyStyle(),this.style.addSource(v,o),this._update(!0)}isSourceLoaded(v){const o=this.style&&this.style.sourceCaches[v];if(o!==void 0)return o.loaded();this.fire(new l.j(new Error(`There is no source with ID '${v}'`)))}setTerrain(v){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),v){const o=this.style.sourceCaches[v.source];if(!o)throw new Error(`cannot load terrain, because there exists no source with ID: ${v.source}`);this.terrain===null&&o.reload();for(const d in this.style._layers){const m=this.style._layers[d];m.type==="hillshade"&&m.source===v.source&&l.w("You are using the same source for a hillshade layer and for 3D terrain. Please consider using two separate sources to improve rendering quality.")}this.terrain=new zd(this.painter,o,v),this.painter.renderToTexture=new Mm(this.painter,this.terrain),this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this._terrainDataCallback=d=>{d.dataType==="style"?this.terrain.sourceCache.freeRtt():d.dataType==="source"&&d.tile&&(d.sourceId!==v.source||this._elevationFreeze||(this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this.terrain.sourceCache.freeRtt(d.tile.tileID))},this.style.on("data",this._terrainDataCallback)}else this.terrain&&this.terrain.sourceCache.destruct(),this.terrain=null,this.painter.renderToTexture&&this.painter.renderToTexture.destruct(),this.painter.renderToTexture=null,this.transform.minElevationForCurrentTile=0,this.transform.elevation=0;return this.fire(new l.k("terrain",{terrain:v})),this}getTerrain(){var v,o;return(o=(v=this.terrain)===null||v===void 0?void 0:v.options)!==null&&o!==void 0?o:null}areTilesLoaded(){const v=this.style&&this.style.sourceCaches;for(const o in v){const d=v[o]._tiles;for(const m in d){const y=d[m];if(y.state!=="loaded"&&y.state!=="errored")return!1}}return!0}removeSource(v){return this.style.removeSource(v),this._update(!0)}getSource(v){return this.style.getSource(v)}addImage(v,o,d={}){const{pixelRatio:m=1,sdf:y=!1,stretchX:x,stretchY:M,content:I,textFitWidth:O,textFitHeight:N}=d;if(this._lazyInitEmptyStyle(),!(o instanceof HTMLImageElement||l.b(o))){if(o.width===void 0||o.height===void 0)return this.fire(new l.j(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));{const{width:V,height:F,data:Z}=o,J=o;return this.style.addImage(v,{data:new l.R({width:V,height:F},new Uint8Array(Z)),pixelRatio:m,stretchX:x,stretchY:M,content:I,textFitWidth:O,textFitHeight:N,sdf:y,version:0,userImage:J}),J.onAdd&&J.onAdd(this,v),this}}{const{width:V,height:F,data:Z}=E.getImageData(o);this.style.addImage(v,{data:new l.R({width:V,height:F},Z),pixelRatio:m,stretchX:x,stretchY:M,content:I,textFitWidth:O,textFitHeight:N,sdf:y,version:0})}}updateImage(v,o){const d=this.style.getImage(v);if(!d)return this.fire(new l.j(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const m=o instanceof HTMLImageElement||l.b(o)?E.getImageData(o):o,{width:y,height:x,data:M}=m;if(y===void 0||x===void 0)return this.fire(new l.j(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(y!==d.data.width||x!==d.data.height)return this.fire(new l.j(new Error("The width and height of the updated image must be that same as the previous version of the image")));const I=!(o instanceof HTMLImageElement||l.b(o));return d.data.replace(M,I),this.style.updateImage(v,d),this}getImage(v){return this.style.getImage(v)}hasImage(v){return v?!!this.style.getImage(v):(this.fire(new l.j(new Error("Missing required image id"))),!1)}removeImage(v){this.style.removeImage(v)}loadImage(v){return G.getImage(this._requestManager.transformRequest(v,"Image"),new AbortController)}listImages(){return this.style.listImages()}addLayer(v,o){return this._lazyInitEmptyStyle(),this.style.addLayer(v,o),this._update(!0)}moveLayer(v,o){return this.style.moveLayer(v,o),this._update(!0)}removeLayer(v){return this.style.removeLayer(v),this._update(!0)}getLayer(v){return this.style.getLayer(v)}getLayersOrder(){return this.style.getLayersOrder()}setLayerZoomRange(v,o,d){return this.style.setLayerZoomRange(v,o,d),this._update(!0)}setFilter(v,o,d={}){return this.style.setFilter(v,o,d),this._update(!0)}getFilter(v){return this.style.getFilter(v)}setPaintProperty(v,o,d,m={}){return this.style.setPaintProperty(v,o,d,m),this._update(!0)}getPaintProperty(v,o){return this.style.getPaintProperty(v,o)}setLayoutProperty(v,o,d,m={}){return this.style.setLayoutProperty(v,o,d,m),this._update(!0)}getLayoutProperty(v,o){return this.style.getLayoutProperty(v,o)}setGlyphs(v,o={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(v,o),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(v,o,d={}){return this._lazyInitEmptyStyle(),this.style.addSprite(v,o,d,m=>{m||this._update(!0)}),this}removeSprite(v){return this._lazyInitEmptyStyle(),this.style.removeSprite(v),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(v,o={}){return this._lazyInitEmptyStyle(),this.style.setSprite(v,o,d=>{d||this._update(!0)}),this}setLight(v,o={}){return this._lazyInitEmptyStyle(),this.style.setLight(v,o),this._update(!0)}getLight(){return this.style.getLight()}setSky(v){return this._lazyInitEmptyStyle(),this.style.setSky(v),this._update(!0)}getSky(){return this.style.getSky()}setFeatureState(v,o){return this.style.setFeatureState(v,o),this._update()}removeFeatureState(v,o){return this.style.removeFeatureState(v,o),this._update()}getFeatureState(v){return this.style.getFeatureState(v)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let v=0,o=0;return this._container&&(v=this._container.clientWidth||400,o=this._container.clientHeight||300),[v,o]}_setupContainer(){const v=this._container;v.classList.add("maplibregl-map");const o=this._canvasContainer=C.create("div","maplibregl-canvas-container",v);this._interactive&&o.classList.add("maplibregl-interactive"),this._canvas=C.create("canvas","maplibregl-canvas",o),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex",this._interactive?"0":"-1"),this._canvas.setAttribute("aria-label",this._getUIString("Map.Title")),this._canvas.setAttribute("role","region");const d=this._containerDimensions(),m=this._getClampedPixelRatio(d[0],d[1]);this._resizeCanvas(d[0],d[1],m);const y=this._controlContainer=C.create("div","maplibregl-control-container",v),x=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(M=>{x[M]=C.create("div",`maplibregl-ctrl-${M} `,y)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(v,o,d){this._canvas.width=Math.floor(d*v),this._canvas.height=Math.floor(d*o),this._canvas.style.width=`${v}px`,this._canvas.style.height=`${o}px`}_setupPainter(){const v={alpha:!0,stencil:!0,depth:!0,failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1};let o=null;this._canvas.addEventListener("webglcontextcreationerror",m=>{o={requestedAttributes:v},m&&(o.statusMessage=m.statusMessage,o.type=m.type)},{once:!0});const d=this._canvas.getContext("webgl2",v)||this._canvas.getContext("webgl",v);if(!d){const m="Failed to initialize WebGL";throw o?(o.message=m,new Error(JSON.stringify(o))):new Error(m)}this.painter=new _u(d,this.transform),P.testSupport(d)}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(v){return this.style&&this.style._loaded?(this._styleDirty=this._styleDirty||v,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(v){return this._update(),this._renderTaskQueue.add(v)}_cancelRenderFrame(v){this._renderTaskQueue.remove(v)}_render(v){const o=this._idleTriggered?this._fadeDuration:0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(v),this._removed)return;let d=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const y=this.transform.zoom,x=E.now();this.style.zoomHistory.update(y,x);const M=new l.z(y,{now:x,fadeDuration:o,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),I=M.crossFadingFactor();I===1&&I===this._crossFadingFactor||(d=!0,this._crossFadingFactor=I),this.style.update(M)}this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain?(this.terrain.sourceCache.update(this.transform,this.terrain),this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this._elevationFreeze||(this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))):(this.transform.minElevationForCurrentTile=0,this.transform.elevation=0),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,o,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:o,showPadding:this.showPadding}),this.fire(new l.k("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,l.bf.mark(l.bg.load),this.fire(new l.k("load"))),this.style&&(this.style.hasTransitions()||d)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();const m=this._sourcesDirty||this._styleDirty||this._placementDirty;return m||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new l.k("idle")),!this._loaded||this._fullyLoaded||m||(this._fullyLoaded=!0,l.bf.mark(l.bg.fullLoad)),this}redraw(){return this.style&&(this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._render(0)),this}remove(){var v;this._hash&&this._hash.remove();for(const d of this._controls)d.onRemove(this);this._controls=[],this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._renderTaskQueue.clear(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),typeof window<"u"&&removeEventListener("online",this._onWindowOnline,!1),G.removeThrottleControl(this._imageQueueHandle),(v=this._resizeObserver)===null||v===void 0||v.disconnect();const o=this.painter.context.gl.getExtension("WEBGL_lose_context");o!=null&&o.loseContext&&o.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),C.remove(this._canvasContainer),C.remove(this._controlContainer),this._container.classList.remove("maplibregl-map"),l.bf.clearMetrics(),this._removed=!0,this.fire(new l.k("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,E.frameAsync(this._frameRequest).then(v=>{l.bf.frame(v),this._frameRequest=null,this._render(v)}).catch(()=>{}))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(v){this._showTileBoundaries!==v&&(this._showTileBoundaries=v,this._update())}get showPadding(){return!!this._showPadding}set showPadding(v){this._showPadding!==v&&(this._showPadding=v,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(v){this._showCollisionBoxes!==v&&(this._showCollisionBoxes=v,v?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(v){this._showOverdrawInspector!==v&&(this._showOverdrawInspector=v,this._update())}get repaint(){return!!this._repaint}set repaint(v){this._repaint!==v&&(this._repaint=v,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(v){this._vertices=v,this._update()}get version(){return Am}getCameraTargetElevation(){return this.transform.elevation}},u.MapMouseEvent=Di,u.MapTouchEvent=Ys,u.MapWheelEvent=wm,u.Marker=Au,u.NavigationControl=class{constructor(v){this._updateZoomButtons=()=>{const o=this._map.getZoom(),d=o===this._map.getMaxZoom(),m=o===this._map.getMinZoom();this._zoomInButton.disabled=d,this._zoomOutButton.disabled=m,this._zoomInButton.setAttribute("aria-disabled",d.toString()),this._zoomOutButton.setAttribute("aria-disabled",m.toString())},this._rotateCompassArrow=()=>{const o=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(this._map.transform.pitch*(Math.PI/180)),.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${this._map.transform.angle*(180/Math.PI)}deg)`:`rotate(${this._map.transform.angle*(180/Math.PI)}deg)`;this._compassIcon.style.transform=o},this._setButtonTitle=(o,d)=>{const m=this._map._getUIString(`NavigationControl.${d}`);o.title=m,o.setAttribute("aria-label",m)},this.options=l.e({},M_,v),this._container=C.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",o=>o.preventDefault()),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",o=>this._map.zoomIn({},{originalEvent:o})),C.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",o=>this._map.zoomOut({},{originalEvent:o})),C.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",o=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:o}):this._map.resetNorth({},{originalEvent:o})}),this._compassIcon=C.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}onAdd(v){return this._map=v,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),this._map.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&this._map.on("pitch",this._rotateCompassArrow),this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new A_(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){C.remove(this._container),this.options.showZoom&&this._map.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&this._map.off("pitch",this._rotateCompassArrow),this._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(v,o){const d=C.create("button",v,this._container);return d.type="button",d.addEventListener("click",o),d}},u.Popup=class extends l.E{constructor(v){super(),this.remove=()=>(this._content&&C.remove(this._content),this._container&&(C.remove(this._container),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("mousemove",this._onMouseMove),this._map.off("mouseup",this._onMouseUp),this._map.off("drag",this._onDrag),this._map._canvasContainer.classList.remove("maplibregl-track-pointer"),delete this._map,this.fire(new l.k("close"))),this),this._onMouseUp=o=>{this._update(o.point)},this._onMouseMove=o=>{this._update(o.point)},this._onDrag=o=>{this._update(o.point)},this._update=o=>{var d;if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(!this._container){if(this._container=C.create("div","maplibregl-popup",this._map.getContainer()),this._tip=C.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(const I of this.options.className.split(" "))this._container.classList.add(I);this._closeButton&&this._closeButton.setAttribute("aria-label",this._map._getUIString("Popup.Close")),this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer")}if(this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._lngLat=this._map.transform.renderWorldCopies&&!this._trackPointer?Vn(this._lngLat,this._flatPos,this._map.transform):(d=this._lngLat)===null||d===void 0?void 0:d.wrap(),this._trackPointer&&!o)return;const m=this._flatPos=this._pos=this._trackPointer&&o?o:this._map.project(this._lngLat);this._map.terrain&&(this._flatPos=this._trackPointer&&o?o:this._map.transform.locationPoint(this._lngLat));let y=this.options.anchor;const x=Pu(this.options.offset);if(!y){const I=this._container.offsetWidth,O=this._container.offsetHeight;let N;N=m.y+x.bottom.y<O?["top"]:m.y>this._map.transform.height-O?["bottom"]:[],m.x<I/2?N.push("left"):m.x>this._map.transform.width-I/2&&N.push("right"),y=N.length===0?"bottom":N.join("-")}let M=m.add(x[y]);this.options.subpixelPositioning||(M=M.round()),C.setTransform(this._container,`${Xa[y]} translate(${M.x}px,${M.y}px)`),Mu(this._container,y,"popup")},this._onClose=()=>{this.remove()},this.options=l.e(Object.create(Et),v)}addTo(v){return this._map&&this.remove(),this._map=v,this.options.closeOnClick&&this._map.on("click",this._onClose),this.options.closeOnMove&&this._map.on("move",this._onClose),this._map.on("remove",this.remove),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._onMouseMove),this._map.on("mouseup",this._onMouseUp),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")):this._map.on("move",this._update),this.fire(new l.k("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(v){return this._lngLat=l.N.convert(v),this._pos=null,this._flatPos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._onMouseMove),this._container&&this._container.classList.remove("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.remove("maplibregl-track-pointer")),this}trackPointer(){return this._trackPointer=!0,this._pos=null,this._flatPos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._onMouseMove),this._map.on("drag",this._onDrag),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")),this}getElement(){return this._container}setText(v){return this.setDOMContent(document.createTextNode(v))}setHTML(v){const o=document.createDocumentFragment(),d=document.createElement("body");let m;for(d.innerHTML=v;m=d.firstChild,m;)o.appendChild(m);return this.setDOMContent(o)}getMaxWidth(){var v;return(v=this._container)===null||v===void 0?void 0:v.style.maxWidth}setMaxWidth(v){return this.options.maxWidth=v,this._update(),this}setDOMContent(v){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=C.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(v),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(v){return this._container&&this._container.classList.add(v),this}removeClassName(v){return this._container&&this._container.classList.remove(v),this}setOffset(v){return this.options.offset=v,this._update(),this}toggleClassName(v){if(this._container)return this._container.classList.toggle(v)}setSubpixelPositioning(v){this.options.subpixelPositioning=v}_createCloseButton(){this.options.closeButton&&(this._closeButton=C.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.innerHTML="&#215;",this._closeButton.addEventListener("click",this._onClose))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const v=this._container.querySelector(Iu);v&&v.focus()}},u.RasterDEMTileSource=sn,u.RasterTileSource=qt,u.ScaleControl=class{constructor(v){this._onMove=()=>{tc(this._map,this._container,this.options)},this.setUnit=o=>{this.options.unit=o,tc(this._map,this._container,this.options)},this.options=Object.assign(Object.assign({},Io),v)}getDefaultPosition(){return"bottom-left"}onAdd(v){return this._map=v,this._container=C.create("div","maplibregl-ctrl maplibregl-ctrl-scale",v.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){C.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}},u.ScrollZoomHandler=no,u.Style=nu,u.TerrainControl=class{constructor(v){this._toggleTerrain=()=>{this._map.getTerrain()?this._map.setTerrain(null):this._map.setTerrain(this.options),this._updateTerrainIcon()},this._updateTerrainIcon=()=>{this._terrainButton.classList.remove("maplibregl-ctrl-terrain"),this._terrainButton.classList.remove("maplibregl-ctrl-terrain-enabled"),this._map.terrain?(this._terrainButton.classList.add("maplibregl-ctrl-terrain-enabled"),this._terrainButton.title=this._map._getUIString("TerrainControl.Disable")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.Enable"))},this.options=v}onAdd(v){return this._map=v,this._container=C.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=C.create("button","maplibregl-ctrl-terrain",this._container),C.create("span","maplibregl-ctrl-icon",this._terrainButton).setAttribute("aria-hidden","true"),this._terrainButton.type="button",this._terrainButton.addEventListener("click",this._toggleTerrain),this._updateTerrainIcon(),this._map.on("terrain",this._updateTerrainIcon),this._container}onRemove(){C.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},u.TwoFingersTouchPitchHandler=qa,u.TwoFingersTouchRotateHandler=Ad,u.TwoFingersTouchZoomHandler=Td,u.TwoFingersTouchZoomRotateHandler=Pd,u.VectorTileSource=pr,u.VideoSource=Or,u.addSourceType=(v,o)=>l._(void 0,void 0,void 0,function*(){if(Co(v))throw new Error(`A source type called "${v}" already exists.`);((d,m)=>{Eo[d]=m})(v,o)}),u.clearPrewarmedResources=function(){const v=Ce;v&&(v.isPreloaded()&&v.numActive()===1?(v.release(Nn),Ce=null):console.warn("Could not clear WebWorkers since there are active Map instances that still reference it. The pre-warmed WebWorker pool can only be cleared when all map instances have been removed with map.remove()"))},u.getMaxParallelImageRequests=function(){return l.a.MAX_PARALLEL_IMAGE_REQUESTS},u.getRTLTextPluginStatus=function(){return zr().getRTLTextPluginStatus()},u.getVersion=function(){return Ld},u.getWorkerCount=function(){return Pn.workerCount},u.getWorkerUrl=function(){return l.a.WORKER_URL},u.importScriptInWorkers=function(v){return Rt().broadcast("IS",v)},u.prewarm=function(){De().acquire(Nn)},u.setMaxParallelImageRequests=function(v){l.a.MAX_PARALLEL_IMAGE_REQUESTS=v},u.setRTLTextPlugin=function(v,o){return zr().setRTLTextPlugin(v,o)},u.setWorkerCount=function(v){Pn.workerCount=v},u.setWorkerUrl=function(v){l.a.WORKER_URL=v}});var a=n;return a})})(Y1);var DB=Y1.exports;const OB=IB(DB),Fp=["#FF6633","#FFB399","#FF33FF","#00B3E6","#E6B333","#3366E6","#999966","#99FF99","#B34D4D","#80B300","#809900","#E6B3B3","#6680B3","#66991A","#FF99E6","#CCFF1A","#FF1A66","#E6331A","#33FFCC","#66994D","#B366CC","#4D8000","#B33300","#CC80CC","#66664D","#991AFF","#E666FF","#4DB3FF","#1AB399","#E666B3","#33991A","#CC9999","#B3B31A","#00E680","#4D8066","#809980","#E6FF80","#1AFF33","#999933","#FF3380","#CCCC00","#66E64D","#4D80CC","#9900B3","#E64D66","#4DB380","#FF4D4D","#99E6E6","#6666FF","#FFFF99"],Cr={};async function $p(t="pin4-sm-mi-plumber+f45942.png",e=null){try{const i=t!=null&&t.includes("/")?t:`/api-user/marker_icon/${t}`,r=await e.loadImage(i);if(e.hasImage(t))return;e==null||e.addImage(t,r.data,{sdf:t==null?void 0:t.includes("+sdf")})}catch(n){console.error(n)}}function BB(t){if(!(t!=null&&t.startsWith("rgba")))return t;const e=t.replace(/^rgba?\(|\s+|\)$/g,"").split(",");return`${((1<<24)+(parseInt(e[0],10)<<16)+(parseInt(e[1],10)<<8)+parseInt(e[2],10)).toString(16).slice(1)}`}Cr.point=async(t={},e={},n=null)=>{var E,C,P,D,R,$,W,te,G,Q,Ie,ve;e||(e={}),((E=e==null?void 0:e.width)==null?void 0:E[0])==="["&&(e.width={stops:JSON.parse(e.width)}),typeof(e==null?void 0:e.width)=="string"&&(e.width-=0),typeof(e==null?void 0:e.opacity)=="string"&&(e.opacity=(e.opacity-0)*100);const i=((C=t.style)==null?void 0:C.colorAttr)||((P=t.style)==null?void 0:P.iconCls);let r={circle:"none-xl-{{marker}}+222.png",circle2:"circle-xl-{{marker}}+222.png",pin2:"pin2-xl-{{marker}}+sdf.png",pin:"pin-xl-{{marker}}+sdf.png"}[e.iconType]||(e==null?void 0:e.icon);const[a,u]=(r==null?void 0:r.split("-"))||[],l=((D=t.style)==null?void 0:D.color)||"blue";!((R=t.style)!=null&&R.iconAttr)&&(r!=null&&r.includes("{{marker}}"))&&(r=r.replace("{{marker}}","fa-star"));const g="gray",b=(Se,Ne)=>`${Se==null?void 0:Se.split("+")[0]}+${Ne.replace("#","")}.png`;if(t.legendAuto={icon:[],color:[]},($=t.style)!=null&&$.iconAttr&&r){const Se=(te=(W=t.meta)==null?void 0:W.columns)==null?void 0:te.find(Ae=>{var $e;return Ae.name===(($e=t==null?void 0:t.style)==null?void 0:$e.iconAttr)}),Ne=(Se==null?void 0:Se.values)||await it.get(`/api-user/gis-ir/${t.id}/${(G=t.style)==null?void 0:G.iconAttr}`).then(Ae=>Ae.data.rows);if(Ne!=null&&Ne.length){const Ae=r.replace("{{color}}",l.length?l:BB(l)||[0]).split("+")[1].split(/[.-]/)[0];Ne.forEach(($e,Xe)=>{var Pt;return $e.icon=(Pt=$e.icon)!=null&&Pt.includes("png")?$e.icon:`${a}-${u}-${$e.data||$e.icon||`ub-${Xe}`}+${r!=null&&r.includes("circle")?"ddd-222":Ae}.png`}),r=r!=null&&r.includes("{{")?`${a}-${u}-fa-question+0c53ad.png`:r,t.legendAuto.iconText=(Se==null?void 0:Se.title)||t.style.iconAttr,Ne.forEach($e=>t.legendAuto.icon.push($e)),t.legendAuto.icon.push({icon:r,text:"Не визначено"}),t.style.iconArr=["match",["get",t.style.iconAttr]].concat(Ne.filter($e=>$e.id).reduce(($e,Xe)=>$e.concat([Xe.id,Xe.icon]),[])).concat([r]),await Promise.all(Ne.map($e=>$e.icon).map($e=>$p($e,n))),await $p(r,n)}else r=i?"pin6-m-fa-star+{{color}}.png":`pin6-m-fa-star+${l==null?void 0:l.replace("#","")}.png`}if(r!=null&&r.includes("{{color}}")?r=r.replace("{{color}}","222"):e!=null&&e.icon&&e.iconAttr,i){const Se=(Ie=(Q=t.meta)==null?void 0:Q.columns)==null?void 0:Ie.find(Ae=>Ae.name===i),Ne=(Se==null?void 0:Se.values)||await it.get(`/api-user/gis-ir/${t.id}/${i}`).then(Ae=>Ae.data.rows);t.style.color=Ne!=null&&Ne.length?["match",["get",i]].concat(Ne.filter(Ae=>Ae.id).reduce((Ae,$e,Xe)=>Ae.concat([$e.id,$e.color||Fp[Xe]]),[])).concat(["#aaa"]):l,t.style.colorArr=t.style.color,t.legendAuto.colorText=(Se==null?void 0:Se.title)||i,Ne.forEach(Ae=>t.legendAuto.color.push(Ae)),t.legendAuto.color.push({color:"#aaa",text:"Не визначено"}),!((ve=t.style)!=null&&ve.iconAttr)&&!(r!=null&&r.includes("+sdf"))&&r&&(Ne.forEach((Ae,$e)=>Ae.icon=b(r,Ae.color||Fp[$e])),t.style.iconArr=["match",["get",i]].concat(Ne.filter(Ae=>Ae.id).reduce((Ae,$e)=>Ae.concat([$e.id,$e.icon]),[])).concat([b(r,g)]),await Promise.all(Ne.map(Ae=>Ae.icon).map(Ae=>$p(Ae,n))))}if(r&&!(r!=null&&r.includes("{"))){const Se=e!=null&&e.colorAttr?b(r,g):r;await $p(Se,n)}const w=r!=null&&r.includes("sdf")?["interpolate",["linear"],["zoom"],14,.1,18,.2]:["interpolate",["linear"],["zoom"],14,.7,16,1];return e.iconOffset=r!=null&&r.includes("pin")?[0,r!=null&&r.includes("+sdf")?-96:-20]:null,[{id:`${t.id}`,source:t.id,type:"circle",cluster:!0,lsource:e==null?void 0:e.lsource,minzoom:(e==null?void 0:e.minzoom)!==void 0?+(e==null?void 0:e.minzoom):4,maxzoom:(r!=null&&r.includes("+sdf")||!(r!=null&&r.includes("circle"))&&!(r!=null&&r.includes("none"))?+e.iconZoom:null)||+(e==null?void 0:e.maxzoom)||24,filter:["all",["==",["geometry-type"],"Point"],["!",["has","point_count"]]],paint:{"circle-stroke-width":["case",["boolean",["feature-state","select"],!1],(e==null?void 0:e.strokeWidth)||1,["boolean",["feature-state","hover"],!1],2,(e==null?void 0:e.strokeWidth)||1],"circle-stroke-color":["case",["boolean",["feature-state","select"],!1],(e==null?void 0:e.stroke)||(e==null?void 0:e.color)||"#fff",["boolean",["feature-state","hover"],!1],"maroon",(e==null?void 0:e.stroke)||(e==null?void 0:e.color)||"#fff"],"circle-opacity":(e.iconZoom?["interpolate",["exponential",.5],["zoom"],+e.iconZoom-1,1,+e.iconZoom,r!=null&&r.includes("none")?.3:0]:null)||e.opacity||1,"circle-color":e.color||["case",["boolean",["feature-state","hover"],!1],"red","blue"],"circle-radius":(Array.isArray(e.width)?{stops:e.width}:null)||e.width||{stops:e.iconZoom?[[+e.iconZoom,4],[+e.iconZoom,8],[18,16]]:[[13,4],[15,8],[18,12]]}}}].concat(e.iconArr||e.icon?[{id:`${t.id}-5`,source:t.id,lsource:e==null?void 0:e.lsource,type:"symbol",minzoom:+e.iconZoom||16,filter:["all",["!",["has","point_count"]]],layout:{"icon-image":e!=null&&e.colorAttr&&e.iconArr||r,"icon-allow-overlap":!0,...e.iconOffset?{"icon-offset":e.iconOffset||!1}:{},...w?{"icon-size":w||!1}:{}},paint:{"icon-opacity":["case",["boolean",["feature-state","hover"],!1],.5,["boolean",["feature-state","select"],!1],.5,(r!=null&&r.includes("+sdf")?1:null)||(r!=null&&r.includes("circle")?.6:1)],...r!=null&&r.includes("+sdf")?{"icon-color":["case",["boolean",["feature-state","hover"],!1],"#cd0bbf",["boolean",["feature-state","select"],!1],"#8517cf",e.color||"#aa0000"]}:{}}}]:[]).concat(e.label?[{id:`${t.id}-4`,source:t.id,lsource:e==null?void 0:e.lsource,type:"symbol",minzoom:14,filter:["!",["has","point_count"]],layout:{"text-field":e.label,"text-font":["Open Sans Regular"],"text-size":e["text-size"]||8},paint:{"text-color":e["text-color"]||"#ffffff","text-halo-color":e["text-halo-color"]||"black"}}]:[]).concat(t.cluster||e.clusterMaxZoom?[{id:`${t.id}-1`,source:t.id,lsource:e==null?void 0:e.lsource,type:"circle",filter:["has","point_count"],paint:{"circle-color":["step",["get","point_count"],"#51bbd6",100,"#f1f075",750,"#f28cb1"],"circle-radius":["step",["get","point_count"],20,100,30,750,40]}},{id:`${t.id}-2`,source:t.id,lsource:e==null?void 0:e.lsource,type:"symbol",filter:["has","point_count"],layout:{"text-field":"{point_count_abbreviated}","text-font":["Open Sans Regular"],"text-size":12}}]:[])},Cr.label=(t={})=>[{id:t.id,source:t.id,type:"line",layout:{"text-field":"{str_name}","text-font":["DIN Offc Pro Italic","Arial Unicode MS Regular"],"symbol-placement":"line","text-pitch-alignment":"viewport","text-max-angle":30,"text-size":{base:1,stops:[[13,12],[18,16]]}},paint:{"text-halo-width":0,"text-halo-blur":0,"text-color":"#78888a"}}],Cr.polygon=async(t={},e={},n=null)=>{var a,u,l,g;const{colorAttr:i}=e,r=((a=t.style)==null?void 0:a.color)||"blue";if(e.colorAttr){n.getSource(t.id)&&n.getSource(n.getSource(t.id).setData(`${n.getSource(t.id)._data.split("&props")[0]}&props=${i}`));const b=((l=(u=t.meta)==null?void 0:u.columns.find(w=>w.name===i))==null?void 0:l.values)||await it.get(`/api-user/gis-ir/${t.id}/${i}`).then(w=>w.data.rows);t.legendAuto={color:[]},b.forEach(w=>t.legendAuto.color.push(w)),t.legendAuto.color.push({color:"#aaa",text:"Не визначено"}),t.style.color=b?["match",["get",i]].concat(b.filter(w=>w.id).reduce((w,E,C)=>w.concat([E.id,E.color||Fp[C]]),[])).concat(["#aaa"]):r}return[{id:`${t.id}`,source:`${t.id}`,lsource:e==null?void 0:e.lsource,minzoom:(+(e==null?void 0:e.minzoom)||+(e==null?void 0:e.pointZoom)||0)-0,maxzoom:+(e==null?void 0:e.maxzoom)||24,type:"fill",filter:["all",["match",["geometry-type"],["Polygon","MultiPolygon"],!0,!1]],paint:{"fill-color":["case",["boolean",["feature-state","hover"],!1],"red",["boolean",["feature-state","select"],!1],"#c356c1",(e==null?void 0:e.color)||"#0080ff"],"fill-opacity":.5}}].concat(e!=null&&e.pointZoom?[{id:`${t.id}-5`,source:(g=t.url)!=null&&g.includes(".vmt")?`${t.id}`:`${t.id}-point`,type:"circle",minzoom:0,maxzoom:((e==null?void 0:e.pointZoom)||1)-0,paint:{"circle-color":["case",["boolean",["feature-state","hover"],!1],"red",(e==null?void 0:e.color)||"blue"],"circle-stroke-width":1,"circle-stroke-color":"#fff"}}]:[]).concat(e!=null&&e.label?[{id:`${t.id}-1`,source:t.id,type:"symbol",lsource:e==null?void 0:e.lsource,minzoom:15,layout:{"text-field":e==null?void 0:e.label,"text-font":["Open Sans Regular"],"text-size":e["text-size"]||{stops:[[14,4],[18,16]]}},paint:{"text-color":e["text-color"]||"#ffffff","text-halo-color":e["text-halo-color"]||"#fff","text-halo-width":e["text-halo-width"]||0}}]:[]).concat(e!=null&&e.stroke?[{id:`${t.id}-2`,source:t.id,lsource:e==null?void 0:e.lsource,minzoom:(+(e==null?void 0:e.minzoom)||+(e==null?void 0:e.pointZoom)||0)-0,maxzoom:+(e==null?void 0:e.maxzoom)||24,type:"line",paint:{"line-color":["case",["boolean",["feature-state","select"],!1],"#c356c1",e.stroke],"line-width":["case",["boolean",["feature-state","select"],!1],3,(e.width||e["line-width"]||1)-0]}}]:[])},Cr.line=(t={},e={})=>[{id:t.id,source:t.id,lsource:e.lsource,type:"line",filter1:["all",["match",["geometry-type"],["LineString","MultiLineString","MultiPolygon","Polygon"],!0,!1]],minzoom:(e==null?void 0:e.minzoom)||t.minzoom||5,layout:{"line-join":"round","line-cap":"round"},paint:{"line-width":["case",["boolean",["feature-state","select"],!1],4,e.width||e["line-width"]||1],"line-color":["case",["boolean",["feature-state","select"],!1],"#c356c1",e.color||e["line-color"]||"#c71ccb"],"line-gap-width":e["line-gap-width"]||0}}].concat(e.label?[{id:`${t.id}-4`,source:t.id,lsource:e.lsource,type:"symbol",minzoom:14,paint:{"text-color":"#111","text-halo-color":"#fff","text-halo-width":2},layout:{"symbol-placement":"line","text-letter-spacing":.2,"text-field":e.label,"text-font":["Open Sans Regular"],"text-size":e["text-size"]||15}}]:[]),Cr.linestring=Cr.line,Cr.circle=Cr.point;async function zB(t,e,n){var l,g,b,w,E,C,P,D,R,$,W,te;typeof e.style=="string"&&(e.style=e.style[0]==="{"?JSON.parse(e.style):(l=window.YAML.parse(e.style))==null?void 0:l.style),(b=(g=e.style)==null?void 0:g.filter)==null||b.call(g,G=>G.source).forEach(G=>{G.lsource=`${e.id}-${G.source}`});const i=((w=e==null?void 0:e.style)==null?void 0:w.type)||((W=((P=(C=(E=e==null?void 0:e.meta)==null?void 0:E.geom)==null?void 0:C.geometry)==null?void 0:P.length)>2?["point"]:[(($=(R=(D=e==null?void 0:e.meta)==null?void 0:D.geom)==null?void 0:R.geometry)==null?void 0:$[0].toLowerCase())||"point"])==null?void 0:W.map(G=>{var Q;return(Q=G==null?void 0:G.replace)==null?void 0:Q.call(G,"multi","")})),r=Array.isArray(i)?i:[i],a=(await Promise.all(Array.isArray(e==null?void 0:e.style)?e.style.map(async G=>{var Q;return(Q=Cr[G.type])==null?void 0:Q.call(Cr,e,G,n)}):r.map(async G=>{var Q;return(Q=Cr[G])==null?void 0:Q.call(Cr,e,e.style,n)}))).reduce((G,Q)=>Q?G.concat(Q):G,[]);a.forEach((G,Q)=>{G.id=`${G.id}-${Q}`});const u=a;return(e.service==="vtile"||(te=e.url)!=null&&te.includes(".vmt"))&&u.forEach(G=>{G.layout||(G.layout={}),G.layout.visibility="visible",G["source-layer"]=G.lsource||e.data||t}),u}const NB={data(){return{layerList:[],layerObj:{},colors:Fp,activeLayer:"",addedLayersSettings:[],hoveredFeatureId:null}},computed:{interactiveSources(){return this.layerList.filter(t=>t==null?void 0:t.interactive).map(t=>t.id)}},methods:{moveLayers(t,e=this.map){e.getStyle().layers.forEach(n=>{n.id.match(t)&&e.moveLayer(n.id)})},getLayersBySourceId(t,e){return e.getStyle().layers.filter(i=>i.id.match(t))},async setVisible(t,e=!0,n={}){const i=typeof t=="object";try{const{style:r,map:a=this.map}=n,u=(t==null?void 0:t.id)||t,l=i?t:await this.getLayerById(u);if(!(l!=null&&l.id))throw new Error("MixinError: Layer has no id");const g=a.getStyle().layers.filter(b=>b.id.match(u));!g.length||r?await this.addToLayers({...l,...(n==null?void 0:n.data)||{},interactive:(l==null?void 0:l.interactive)!==void 0?l==null?void 0:l.interactive:!0,visible:e},{map:a,cb:n==null?void 0:n.onAddLayer}):(this.layerList=this.layerList.map(b=>b.id===l.id?{...b,visible:e}:b),g.forEach(b=>{a.setLayoutProperty(b.id,"visibility",e?"visible":"none")})),n!=null&&n.cb&&await(n==null?void 0:n.cb(l))}catch(r){console.error(r),!n.onAddLayer||n.onAddLayer({data:i?t:{id:t},message:r.message,type:"error"})}},async addToLayers(t,e={}){try{const{map:n=this==null?void 0:this.map}=e;this.layerList.find(r=>r.id===t.id)||(this.layerList=this.layerList.concat(t)),this.layerObj={...this.layerObj,[t.id]:t},t.visible?t!=null&&t.layer?await this.addVectorLayer(t,n):t.service==="vtile"?await this.addVtileLayer(t,n):t.service==="geojson"?await this.addGeojsonLayers(t,n):this.addRasterLayer(t,n):n.getStyle().layers.forEach(async r=>{r.source===t.id&&await n.setLayoutProperty(r.id,"visibility","none")}),!(e!=null&&e.cb&&(t!=null&&t.visible))||await e.cb({data:t,type:"success"}),this.moveLayers("gl-draw")}catch(n){!e.cb||e.cb({data:t,message:n.message,type:"error"}),console.error(n)}},addRasterLayer(t,e){e.addSource(t.id,{type:"raster",tiles:[(t==null?void 0:t.url)||(t==null?void 0:t.url1)],tileSize:256,...t!=null&&t.scheme?{scheme:t==null?void 0:t.scheme}:{}}),e.addLayer({id:t.id,type:"raster",source:t.id,minzoom:0,maxzoom:(t==null?void 0:t.maxzoom)||22})},async addVtileLayer(t){await this.createGeometryLayer({data:t},"vector")},async addVectorLayer(t,e){const{data:n}=await it.get(t.layer),i={...t,source:t.id,layers:[]};Object.keys(n.sources).forEach(async r=>{await e.addSource(t.id,{type:n.sources[r].type,maxzoom:n.sources[r].maxzoom,url:n.sources[r].url})}),await n.layers.forEach(async r=>{await e.addLayer({...r,source:t.id,id:`${r.id}-${t.id}`}),i.layers=await i.layers.concat(`${r.id}-${t.id}`)})},async addGeojsonLayers(t){const e=n=>{throw this.$notify({type:"error",title:"Відсутня геометрія у обраному шарі",message:n,position:"bottom-right"}),this.layerList=this.layerList.filter(i=>i.id!==t.id),new Error(n)};if(typeof(t==null?void 0:t.geojson)=="object"){this.createGeometryLayer({data:t,geojson:t.geojson},"geojson");return}try{const n=await it.get((t==null?void 0:t.geojson)||(t==null?void 0:t.url)),i=await n.data;if(n.statusText==="OK")this.createGeometryLayer({data:t,geojson:i},"geojson");else throw new Error((i==null?void 0:i.message)||(n==null?void 0:n.statusText)||"Error addGeojson layer")}catch(n){e(n.message),console.error(n)}},async createGeometryLayer({data:t,geojson:e},n){var l,g,b,w,E;const{map:i}=this,r=await zB(t.id,this.layerList.find(C=>C.id==t.id),i),a={type:n,cluster:((l=t==null?void 0:t.style)==null?void 0:l.cluster)||!1,clusterMaxZoom:((g=t==null?void 0:t.style)==null?void 0:g.clusterMaxZoom)||14};n==="vector"&&(a.tiles=[`${window.location.origin}${(t==null?void 0:t.geojson)||(t==null?void 0:t.url)}${t!=null&&t.version?`?ver=${t.version}`:""}${t.props?`&props=${t.props}`:""}${(b=t==null?void 0:t.style)!=null&&b.pointZoom?`&pointZoom=${t.style.pointZoom}`:""}`]),n==="geojson"&&(a.data=e||`${window.location.origin}${(t==null?void 0:t.geojson)||(t==null?void 0:t.url)}`),i.addSource(t.id,a),r.forEach(C=>{var D;const P={...C,source:t.id,maxzoom:+(C==null?void 0:C.maxzoom)||24,minzoom:+(C==null?void 0:C.minzoom)||0,cluster:!1,clusterMaxZoom:2};i.addLayer(P),i.moveLayer(C.id),(D=C==null?void 0:C.layout)!=null&&D["text-field"]||this.apiLayersHover(C.id,t.id,i),this.addedLayersSettings=this.addedLayersSettings.concat(P)});const u=r.map(C=>C.type).filter(C=>C&&C!=="symbol");(E=(w=t==null?void 0:t.meta)==null?void 0:w.geom)!=null&&E.geometry&&t.meta.geom.geometry.filter(P=>!u.includes(this.geometryByType(P,!0))).forEach(P=>{this.createStyleObj({type:P,style:t.style},t.id)})},async setStyle(t,e,n=this.map){const i=(t==null?void 0:t.id)||t;n.getStyle().layers.forEach(a=>{a.source===i&&n.removeLayer(a.id)}),n.getSource(i)&&(n==null||n.removeSource(i)),this.layerList=this.layerList.map(a=>(a.id===i&&(a.style=e),a));const r=this.layerList.find(a=>a.id===i);this.addToLayers(r)},setLayerData({source:t,data:e}){const n=(t==null?void 0:t.id)||t;this.layerList=this.layerList.map(i=>i.id===n?{...i,...e}:i),this.layerObj={...this.layerObj,[t]:{...this.layerObj[t],...e}}},geometryByType(t,e=!1){if(t==="fill"||t==="Polygon"||t==="MultiPolygon")return e?"fill":"Polygon";if(t==="circle"||t==="Point"||t==="MultiPoint")return e?"circle":"Point";if(t==="line"||t==="LineString"||t==="MultiLineString")return e?"line":"LineString"},async removeLayer(t,e=this.map){const n=(t==null?void 0:t.id)||t;this.layerList=this.layerList.filter(i=>i.id!==n),await e.getStyle().layers.forEach(async i=>{i.source===n&&await e.removeLayer(i.id)}),await e.removeSource(n)},async reloadUrl(t,e=this.map){const n=(t==null?void 0:t.id)||t;await e.getStyle().layers.forEach(i=>{i.id===n&&e.removeLayer(i.id)}),await e.removeSource(n),await this.setVisible(t,!0)},async setFilter(t,e){const n=this.layerObj[t],i=await this.map.getSource(t);if(n.service==="vtile")await i.setTiles([`${window.location.origin}${n.geojson||n.url}${n.url.includes("?")?"&":"?"}filter=${e}${n.props?`&props=${n.props}`:""}`]);else if(n.service==="geojson"){const{data:r}=await it.get((n==null?void 0:n.geojson)||`${n==null?void 0:n.url}?filter=${e}`);await this.map.getSource(t).setData(r)}},async getLayerById(t,e=null){var i;const n=(t==null?void 0:t.id)||t;try{const r=(i=this.layerList)==null?void 0:i.find(u=>u.id===n);if(r)return r;const a=await it.get(`/api-user/gis-ir/${n}${t!=null&&t.service?`?service=${t==null?void 0:t.service}`:""}`);if(a.statusText==="OK"){const u=await a.data;return!e||await e(u),u}return this.$notify({type:"warning",message:`Шар ${n} не було знайдено!`}),null}catch(r){this.$notify({type:"warning",message:`Шар ${n} не було знайдено!`}),console.error(r)}},createStyleObj({type:t,style:e},n){const i=this.geometryByType(t,!0);if(!i)throw Error("Geomery type ERROR: Error adding missing layers");const r=`${n}-${i}`;if(this.map.getStyle().layers.find(u=>u.id===r))return;const a={id:r,type:i,source:n,"source-layer":n,layout:{},paint:{[`${i}-color`]:["case",["boolean",["feature-state","hover"],!1],"red",(e==null?void 0:e.color)||"#444e3d"],[`${i}-opacity`]:e!=null&&e.opacity||i==="fill"?.5:1},filter:["all",["==",["geometry-type"],this.geometryByType(t)]]};this.map.addLayer(a),this.addedLayersSettings=this.addedLayersSettings.concat(a),this.apiLayersHover(r,n,this.map)},apiLayersHover(t,e,n){const i=n.getSource(e),r=()=>{const a={source:e,id:this.hoveredFeatureId};return i.type==="vector"&&(a.sourceLayer=e),a};n.on("mousemove",t,a=>{a.features.length>0&&(this.hoveredFeatureId!==null&&n.setFeatureState(r(),{hover:!1}),this.hoveredFeatureId=a.features[0].id,n.setFeatureState(r(),{hover:!0}))}),n.on("mouseleave",t,()=>{this.hoveredFeatureId!==null&&n.setFeatureState(r(),{hover:!1}),this.hoveredFeatureId=null})},async changeBaseLayer(t,e=!0,n=!0){await this.setVisible(t,e);const i=(t==null?void 0:t.id)||t;i!==this.activeLayer&&(n&&this.activeLayer&&await this.setVisible(this.activeLayer,!1),this.map.getStyle().layers.forEach(r=>{r.source!==i&&r.type!=="background"&&this.map.moveLayer(r.id)}),this.activeLayer=i)},async refreshLayer(t,e=this.map){const n=(t==null?void 0:t.id)||t;await e.getStyle().layers.forEach(i=>{i.source===n&&e.removeLayer(i.id)}),await e.removeSource(n),this.layers=await this.layers.filter(i=>i.id!==n),await this.setVisible(typeof t=="object"?t:n)}}},RB={props:{objectData:{type:Array,default:()=>[]},object:{type:Object,default:()=>null},mapRef:{type:Object,default:()=>null}},computed:{currentLayer(){var n;const t=(n=this.object)==null?void 0:n.source;return this.mapRef.layerObj[t]},popupPosition(){var e,n,i;return((i=(n=(e=this.currentLayer)==null?void 0:e.setting)==null?void 0:n.popup)==null?void 0:i.position)||"horizontal"},popupWidth(){var e,n,i;return`${((i=(n=(e=this.currentLayer)==null?void 0:e.setting)==null?void 0:n.popup)==null?void 0:i.width)||240}px`},popupRows(){return this.objectData.filter(t=>t.column!=="image")},positionIsVertical(){return this.popupPosition==="vertical"}},methods:{rowValue(t){return t.value},rowTitle(t){return t.title}}},LB={key:0,class:"vsTailwind map-popup__vertical"},VB={class:"mb-1"},FB={class:"text-sm"},$B={key:1,class:"map__popup-body"},jB=["innerHTML"],UB={key:1};function HB(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("div",{class:"map-popup",style:f.normalizeStyle({"max-width":a.popupWidth,width:a.popupWidth})},[a.positionIsVertical?(f.openBlock(),f.createElementBlock("div",LB,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(a.popupRows,u=>(f.openBlock(),f.createElementBlock("div",{class:"border-b py-1 last:border-none last:pt-1 last:pb-0",key:a.rowTitle(u)},[f.createElementVNode("strong",VB,f.toDisplayString(a.rowTitle(u)),1),f.createElementVNode("div",FB,f.toDisplayString(a.rowValue(u)),1)]))),128))])):(f.openBlock(),f.createElementBlock("table",$B,[f.createElementVNode("tbody",null,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(a.popupRows,u=>f.withDirectives((f.openBlock(),f.createElementBlock("tr",{key:a.rowTitle(u),class:"map__popup-body-item"},[f.createElementVNode("td",null,f.toDisplayString(a.rowTitle(u)),1),a.rowValue(u)?(f.openBlock(),f.createElementBlock("td",{key:0,innerHTML:a.rowValue(u)},null,8,jB)):(f.openBlock(),f.createElementBlock("td",UB,e[0]||(e[0]=[f.createElementVNode("div",{class:"text-red-500"}," Не визначено ",-1)])))])),[[f.vShow,!a.rowValue(u).includes("id")]])),128))])]))],4)}const qB=je(RB,[["render",HB],["__scopeId","data-v-3f5a9aff"]]),X1={width:200,show:!0,position:"horizontal"},WB={components:{VsPopupBody:qB},props:{aviableFields:{type:Array,default:()=>[]},mapRef:{type:[Object,Array],default:()=>{}},object:{type:[Object,Array],default:()=>{}}},data(){return{objectData:[],popupSettings:X1}},computed:{getImage(){return this.objectData.find(t=>t.column==="image")||null},currentLayer(){var t;return(t=this.$parent.layerList)==null?void 0:t.find(e=>{var n;return(e==null?void 0:e.id)===((n=this.object)==null?void 0:n.source)})}},watch:{async object(t,e){t!==null&&(t==null?void 0:t.id)!==(e==null?void 0:e.id)||!(t!=null&&t.id)?await this.getFormatObject(t):t===null&&(this.objectData=[])}},methods:{async getFormatObject(t){var g,b,w,E,C,P;if(!t)return;const e=Object.keys(t.properties).filter(D=>!D.match("__text")&&!["id"].includes(D)),{currentLayer:n}=this;if((g=n==null?void 0:n.setting)!=null&&g.popup&&(this.popupSettings=(n==null?void 0:n.setting.popup)||X1),!(n!=null&&n.meta)){const D=e.map(R=>({title:R,value:t.properties[R]}));this.objectData=[...D,{value:((b=t.properties)==null?void 0:b.image)||"",title:"Фото",column:"image"}];return}const i=n.meta.columns,r=e.map(D=>{var G,Q,Ie,ve;const R={},W=Object.assign({values:[]},i.find(Se=>Se.name===D));typeof W.values!="object"&&console.warn(`Warning: Layer ${t.source} has key "values" which is not an object in meta!`);const te=W!=null&&W.values&&((G=W==null?void 0:W.values)==null?void 0:G.find(Se=>(Se==null?void 0:Se.id)==t.properties[D]))||null;return R.value=(W==null?void 0:W.format)==="select"?this.formatBadge({text:(te==null?void 0:te.text)||((Q=t.properties)==null?void 0:Q[`${D}__text`])||((Ie=t.properties)==null?void 0:Ie[D])||"-",color:(te==null?void 0:te.color)||"#1989FA"}):(te==null?void 0:te.text)||((ve=t.properties)==null?void 0:ve[`${D}__text`])||t.properties[D],R.column=D,R.title=(W==null?void 0:W[window==null?void 0:window.lang])||(W==null?void 0:W.ua)||(W==null?void 0:W.title)||D,R});this.objectData=[...r,{value:((w=t.properties)==null?void 0:w.image)||"",title:"Фото",column:"image"}];const a=(C=(E=n==null?void 0:n.setting)==null?void 0:E.popup)==null?void 0:C.popup,u=typeof a=="string"?a==null?void 0:a.split(","):a,l=[...this.aviableFields,...((P=n==null?void 0:n.popup)==null?void 0:P.split(","))||[],...u||[]];this.objectData=l.length?this.objectData.filter(D=>l.includes(D.column)||l.includes(D.title)):[]},noInfoObject(){var i,r,a,u,l;if(!this.object)return"Інформація відсутня";const{currentLayer:t}=this,e=((r=(i=t==null?void 0:t.meta)==null?void 0:i.columns)==null?void 0:r.find(g=>(g==null?void 0:g.meta)==="title"))||((a=t==null?void 0:t.meta)==null?void 0:a.columns[0])||null;return{title:(t==null?void 0:t.name)||(t==null?void 0:t.id)||((u=this.object)==null?void 0:u.sourceLayer)||((l=this.object)==null?void 0:l.source)||"Дані по шару не знайдено",column:e}},formatBadge(t){const e=(t==null?void 0:t.text)||"-";return t!=null&&t.color?`<span >${e}</span>`:e}}},GB={key:0},ZB={key:0},YB=["src","alt"],XB={key:1},KB={class:"text-left text-sm m-b-sm"},JB={key:1,class:"text-center"};function QB(t,e,n,i,r,a){var l,g,b,w,E,C,P,D,R,$,W;const u=f.resolveComponent("VsPopupBody");return f.openBlock(),f.createElementBlock("div",{class:f.normalizeClass((((l=r.popupSettings)==null?void 0:l.position)||"horizontal")+"-position")},[r.objectData.filter(te=>te.column!=="image").length?(f.openBlock(),f.createElementBlock("div",GB,[a.getImage&&((g=a.getImage)!=null&&g.value)?(f.openBlock(),f.createElementBlock("div",ZB,[f.createElementVNode("img",{class:"popup-image",src:"files/"+a.getImage.value,alt:a.getImage.column},null,8,YB)])):f.createCommentVNode("",!0),f.createVNode(u,{"object-data":r.objectData,object:n.object,mapRef:n.mapRef},null,8,["object-data","object","mapRef"])])):(f.openBlock(),f.createElementBlock("div",XB,[(b=a.noInfoObject())!=null&&b.column?(f.openBlock(),f.createElementBlock(f.Fragment,{key:0},[f.createElementVNode("b",KB,f.toDisplayString(a.noInfoObject().title),1),f.createElementVNode("div",null,[f.createElementVNode("b",null,f.toDisplayString(((E=(w=a.noInfoObject())==null?void 0:w.column)==null?void 0:E.ua)||((P=(C=a.noInfoObject())==null?void 0:C.column)==null?void 0:P.title))+":",1),f.createTextVNode(" "+f.toDisplayString(((W=(D=n.object)==null?void 0:D.properties)==null?void 0:W[($=(R=a.noInfoObject())==null?void 0:R.column)==null?void 0:$.name])||"-"),1)])],64)):(f.openBlock(),f.createElementBlock("div",JB,f.toDisplayString(a.noInfoObject().title),1))]))],2)}const ez=je(WB,[["render",QB],["__scopeId","data-v-deb51e0a"]]),{Map:tz,NavigationControl:nz,Popup:iz}=OB,rz={mixins:[NB],components:{VsMapPopup:ez},props:{popupVisible:{type:Boolean,default:()=>!0},map:{type:Object,default:()=>null},height:{type:String,default:()=>"400px"}},data(){return{mapId:`gis-map-${Math.floor(Math.random()*1e3)}`,features:[],popup:{geometry:null,map:null},cityBbox:null}},async mounted(){this.initMap()},computed:{mapRef(){return this}},methods:{initMap(){const t={version:8,glyphs:"https://fonts.openmaptiles.org/{fontstack}/{range}.pbf",sources:{},layers:[]},e=new tz({container:this.mapId,style:t,center:[0,0],zoom:1,interactive:!0});e.addControl(new nz({visualizePitch:!0})),window==null||window.addEventListener("resize",()=>{e.resize()}),e.on("load",this.onMapLoad)},async onMapLoad(t){const e=t.target;e.resize();const n={id:"graymap",name:"Сіра карта",url:"https://basemaps.cartocdn.com/light_all/{z}/{x}/{y}.png",service:"TMS",category:"Базові карти",attribution:"&copy; <a href='http://www.openstreetmap.org/copyright'>OpenStreetMap</a>, &copy; <a href='https://carto.com/attributions'>CARTO</a>",bounds1:"ua",image:"https://basemaps.cartocdn.com/light_all/10/601/348.png",position:0,owner:"OSM",basemap:!0};await this.$emit("update:map",e),await this.setVisible(n,!0),this.$emit("load",e),this.createPopup(),this.createBoundsLayers(),this.createAtuLayer()},createPopup(){var n,i,r,a,u,l;const{map:t}=this,e=["measure","geometry","mapbox-gl-draw-hot","mapbox-gl-draw-cold"];this.popup.map=new iz({closeOnClick:!1}).setDOMContent((i=(n=this==null?void 0:this.$refs)==null?void 0:n.popup)==null?void 0:i.$el),t&&(t.on("mousemove",g=>{var w,E;const b=t.queryRenderedFeatures(g.point).filter(C=>{var R,$,W;const P=this.layerList.find(te=>te.id===C.source),D=(($=(R=P==null?void 0:P.setting)==null?void 0:R.popup)==null?void 0:$.show)===void 0?!0:P.setting.popup.show;if((this.interactiveSources.includes(C.source)&&!((W=C.properties)!=null&&W.cluster)&&D||!P&&Object.keys(C.properties).length)&&!e.includes(C.source))return C}).filter(C=>{var P,D;return!((D=(P=C.layer)==null?void 0:P.layout)!=null&&D["text-field"])});b.length&&this.popupVisible?(this.features=(b==null?void 0:b[0])||null,(w=this.popup.map)==null||w.setLngLat(Object.values(g.lngLat)).addTo(t),t.getCanvas().style.cursor=b.length?"pointer":"grab"):(this.features=null,(E=this.popup.map)==null||E.remove()),this.$emit("mouseMove",{event:g,features:b})}),t.on("touchend",this.handleMapClick),t.on("click",this.handleMapClick),t.on("dblclick",g=>{const b=t.queryRenderedFeatures(g.point);this.$emit("dbclick",{features:b,event:g})}),(l=(u=(a=(r=this==null?void 0:this.$refs)==null?void 0:r.popup)==null?void 0:a.$el)==null?void 0:u.parentElement)==null||l.addEventListener("mouseenter",()=>{var g;(g=this.popup.map)==null||g.remove()}))},createBoundsLayers(){const{map:t}=this;t&&(t.addSource("bounds-dataset",{type:"geojson",data:{type:"FeatureCollection",features:[]}}),t.addLayer({id:"bounds-dataset-line",type:"line",source:"bounds-dataset",layout:{},paint:{"line-color":"#a91a9e","line-width":2}}))},handleMapClick(t){if(!this.map)return;const e=this.map.queryRenderedFeatures(t.point);if(!e.length)return;const n=e.filter(i=>this.interactiveSources.includes(i==null?void 0:i.source));this.$emit("mapClick",n)},homeZoom(){const{map:t}=this,e=this.cityBbox?this.cityBbox:[22.1352,44.3909,40.2276,52.3791];t==null||t.fitBounds(e,{duration:0,padding:10})}}},oz={class:"relative"},sz=["id"];function az(t,e,n,i,r,a){const u=f.resolveComponent("VsMapPopup");return f.openBlock(),f.createElementBlock("div",oz,[f.createElementVNode("div",{id:r.mapId,style:f.normalizeStyle({height:n.height})},null,12,sz),f.createVNode(u,{ref:"popup",object:r.features,"map-ref":a.mapRef},null,8,["object","map-ref"])])}const lz=je(rz,[["render",az]]),Qo="widget-map-source",cz={components:{VsMap:lz},props:{geometry:{type:Object,default:()=>null},zoom:{type:String,default:()=>"50"}},data(){return{map:null}},mounted(){this.geometry&&this.initGeometryLayer()},watch:{geometry(){console.log(this.zoom),this.initGeometryLayer()}},methods:{initMap(){this.geometry&&this.map&&this.initGeometryLayer()},handleMapLoad(){this.initMap()},initGeometryLayer(){const{map:t}=this;if(!t)return;const e=this.formatGeojson(this.geometry),n=t.getSource(Qo);if(this.zoomToGeometry(e),n){n.setData(e);return}t.addSource(Qo,{type:"geojson",data:e}),t.addLayer({id:`${Qo}-point`,type:"circle",source:Qo,paint:{"circle-radius":10,"circle-color":"#F84C4C"},filter:["==","$type","Point"]}),t.addLayer({id:`${Qo}-polygon`,type:"fill",source:Qo,layout:{},paint:{"fill-color":"#0080ff","fill-opacity":.5},filter:["==","$type","Polygon"]}),t.addLayer({id:`${Qo}-polygon-line`,type:"line",source:Qo,layout:{},paint:{"line-color":"#0080ff","line-width":2},filter:["==","$type","Polygon"]}),t.addLayer({id:`${Qo}-line`,type:"line",source:Qo,layout:{},paint:{"line-color":"#0080ff","line-width":3},filter:["==","$type","LineString"]})},formatGeojson(t){let e=t;const n=t==null?void 0:t.type;if(Array.isArray(t))return Z1(t);if(!n)throw new Error("Unknown geometry type!");return n==="FeatureCollection"?t:(n==="Feature"&&(e=[t]),!["FeatureCollection","Feature"].includes(n)&&(e=[PB(t)]),Z1(e))},zoomToGeometry(t){const{map:e}=this,n=MB(t);e.fitBounds(n,{zoom:this.zoom,padding:30,duration:0})}}};function uz(t,e,n,i,r,a){const u=f.resolveComponent("VsMap");return f.openBlock(),f.createElementBlock("div",null,[f.createVNode(u,{map:r.map,"onUpdate:map":e[0]||(e[0]=l=>r.map=l),onLoad:a.handleMapLoad},null,8,["map","onLoad"])])}const K1=je(cz,[["render",uz]]),lt=(t,e=1e4)=>(t=parseFloat(t+"")||0,Math.round((t+Number.EPSILON)*e)/e),ly=function(t){if(!(t&&t instanceof Element&&t.offsetParent))return!1;const e=t.scrollHeight>t.clientHeight,n=window.getComputedStyle(t).overflowY,i=n.indexOf("hidden")!==-1,r=n.indexOf("visible")!==-1;return e&&!i&&!r},jp=function(t,e=void 0){return!(!t||t===document.body||e&&t===e)&&(ly(t)?t:jp(t.parentElement,e))},es=function(t){var e=new DOMParser().parseFromString(t,"text/html").body;if(e.childElementCount>1){for(var n=document.createElement("div");e.firstChild;)n.appendChild(e.firstChild);return n}return e.firstChild},cy=t=>`${t||""}`.split(" ").filter(e=>!!e),ts=(t,e,n)=>{t&&cy(e).forEach(i=>{t.classList.toggle(i,n||!1)})};class Ec{constructor(e){Object.defineProperty(this,"pageX",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"pageY",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"clientX",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"clientY",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"time",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"nativePointer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.nativePointer=e,this.pageX=e.pageX,this.pageY=e.pageY,this.clientX=e.clientX,this.clientY=e.clientY,this.id=self.Touch&&e instanceof Touch?e.identifier:-1,this.time=Date.now()}}const Cc={passive:!1};class hz{constructor(e,{start:n=()=>!0,move:i=()=>{},end:r=()=>{}}){Object.defineProperty(this,"element",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"startCallback",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"moveCallback",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"endCallback",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"currentPointers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"startPointers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),this.element=e,this.startCallback=n,this.moveCallback=i,this.endCallback=r;for(const a of["onPointerStart","onTouchStart","onMove","onTouchEnd","onPointerEnd","onWindowBlur"])this[a]=this[a].bind(this);this.element.addEventListener("mousedown",this.onPointerStart,Cc),this.element.addEventListener("touchstart",this.onTouchStart,Cc),this.element.addEventListener("touchmove",this.onMove,Cc),this.element.addEventListener("touchend",this.onTouchEnd),this.element.addEventListener("touchcancel",this.onTouchEnd)}onPointerStart(e){if(!e.buttons||e.button!==0)return;const n=new Ec(e);this.currentPointers.some(i=>i.id===n.id)||this.triggerPointerStart(n,e)&&(window.addEventListener("mousemove",this.onMove),window.addEventListener("mouseup",this.onPointerEnd),window.addEventListener("blur",this.onWindowBlur))}onTouchStart(e){for(const n of Array.from(e.changedTouches||[]))this.triggerPointerStart(new Ec(n),e);window.addEventListener("blur",this.onWindowBlur)}onMove(e){const n=this.currentPointers.slice(),i="changedTouches"in e?Array.from(e.changedTouches||[]).map(a=>new Ec(a)):[new Ec(e)],r=[];for(const a of i){const u=this.currentPointers.findIndex(l=>l.id===a.id);u<0||(r.push(a),this.currentPointers[u]=a)}r.length&&this.moveCallback(e,this.currentPointers.slice(),n)}onPointerEnd(e){e.buttons>0&&e.button!==0||(this.triggerPointerEnd(e,new Ec(e)),window.removeEventListener("mousemove",this.onMove),window.removeEventListener("mouseup",this.onPointerEnd),window.removeEventListener("blur",this.onWindowBlur))}onTouchEnd(e){for(const n of Array.from(e.changedTouches||[]))this.triggerPointerEnd(e,new Ec(n))}triggerPointerStart(e,n){return!!this.startCallback(n,e,this.currentPointers.slice())&&(this.currentPointers.push(e),this.startPointers.push(e),!0)}triggerPointerEnd(e,n){const i=this.currentPointers.findIndex(r=>r.id===n.id);i<0||(this.currentPointers.splice(i,1),this.startPointers.splice(i,1),this.endCallback(e,n,this.currentPointers.slice()))}onWindowBlur(){this.clear()}clear(){for(;this.currentPointers.length;){const e=this.currentPointers[this.currentPointers.length-1];this.currentPointers.splice(this.currentPointers.length-1,1),this.startPointers.splice(this.currentPointers.length-1,1),this.endCallback(new Event("touchend",{bubbles:!0,cancelable:!0,clientX:e.clientX,clientY:e.clientY}),e,this.currentPointers.slice())}}stop(){this.element.removeEventListener("mousedown",this.onPointerStart,Cc),this.element.removeEventListener("touchstart",this.onTouchStart,Cc),this.element.removeEventListener("touchmove",this.onMove,Cc),this.element.removeEventListener("touchend",this.onTouchEnd),this.element.removeEventListener("touchcancel",this.onTouchEnd),window.removeEventListener("mousemove",this.onMove),window.removeEventListener("mouseup",this.onPointerEnd),window.removeEventListener("blur",this.onWindowBlur)}}function J1(t,e){return e?Math.sqrt(Math.pow(e.clientX-t.clientX,2)+Math.pow(e.clientY-t.clientY,2)):0}function Q1(t,e){return e?{clientX:(t.clientX+e.clientX)/2,clientY:(t.clientY+e.clientY)/2}:t}const uy=t=>typeof t=="object"&&t!==null&&t.constructor===Object&&Object.prototype.toString.call(t)==="[object Object]",Tr=(t,...e)=>{const n=e.length;for(let i=0;i<n;i++){const r=e[i]||{};Object.entries(r).forEach(([a,u])=>{const l=Array.isArray(u)?[]:{};t[a]||Object.assign(t,{[a]:l}),uy(u)?Object.assign(t[a],Tr(l,u)):Array.isArray(u)?Object.assign(t,{[a]:[...u]}):Object.assign(t,{[a]:u})})}return t},hy=function(t,e){return t.split(".").reduce((n,i)=>typeof n=="object"?n[i]:void 0,e)};class Up{constructor(e={}){Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"events",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),this.setOptions(e);for(const n of Object.getOwnPropertyNames(Object.getPrototypeOf(this)))n.startsWith("on")&&typeof this[n]=="function"&&(this[n]=this[n].bind(this))}setOptions(e){this.options=e?Tr({},this.constructor.defaults,e):{};for(const[n,i]of Object.entries(this.option("on")||{}))this.on(n,i)}option(e,...n){let i=hy(e,this.options);return i&&typeof i=="function"&&(i=i.call(this,this,...n)),i}optionFor(e,n,i,...r){let a=hy(n,e);var u;typeof(u=a)!="string"||isNaN(u)||isNaN(parseFloat(u))||(a=parseFloat(a)),a==="true"&&(a=!0),a==="false"&&(a=!1),a&&typeof a=="function"&&(a=a.call(this,this,e,...r));let l=hy(n,this.options);return l&&typeof l=="function"?a=l.call(this,this,e,...r,a):a===void 0&&(a=l),a===void 0?i:a}cn(e){const n=this.options.classes;return n&&n[e]||""}localize(e,n=[]){e=String(e).replace(/\{\{(\w+).?(\w+)?\}\}/g,(i,r,a)=>{let u="";return a?u=this.option(`${r[0]+r.toLowerCase().substring(1)}.l10n.${a}`):r&&(u=this.option(`l10n.${r}`)),u||(u=i),u});for(let i=0;i<n.length;i++)e=e.split(n[i][0]).join(n[i][1]);return e=e.replace(/\{\{(.*?)\}\}/g,(i,r)=>r)}on(e,n){let i=[];typeof e=="string"?i=e.split(" "):Array.isArray(e)&&(i=e),this.events||(this.events=new Map),i.forEach(r=>{let a=this.events.get(r);a||(this.events.set(r,[]),a=[]),a.includes(n)||a.push(n),this.events.set(r,a)})}off(e,n){let i=[];typeof e=="string"?i=e.split(" "):Array.isArray(e)&&(i=e),i.forEach(r=>{const a=this.events.get(r);if(Array.isArray(a)){const u=a.indexOf(n);u>-1&&a.splice(u,1)}})}emit(e,...n){[...this.events.get(e)||[]].forEach(i=>i(this,...n)),e!=="*"&&this.emit("*",e,...n)}}Object.defineProperty(Up,"version",{enumerable:!0,configurable:!0,writable:!0,value:"5.0.36"}),Object.defineProperty(Up,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{}});class dy extends Up{constructor(e={}){super(e),Object.defineProperty(this,"plugins",{enumerable:!0,configurable:!0,writable:!0,value:{}})}attachPlugins(e={}){const n=new Map;for(const[i,r]of Object.entries(e)){const a=this.option(i),u=this.plugins[i];u||a===!1?u&&a===!1&&(u.detach(),delete this.plugins[i]):n.set(i,new r(this,a||{}))}for(const[i,r]of n)this.plugins[i]=r,r.attach()}detachPlugins(e){e=e||Object.keys(this.plugins);for(const n of e){const i=this.plugins[n];i&&i.detach(),delete this.plugins[n]}return this.emit("detachPlugins"),this}}var In;(function(t){t[t.Init=0]="Init",t[t.Error=1]="Error",t[t.Ready=2]="Ready",t[t.Panning=3]="Panning",t[t.Mousemove=4]="Mousemove",t[t.Destroy=5]="Destroy"})(In||(In={}));const Ps=["a","b","c","d","e","f"],ev={PANUP:"Move up",PANDOWN:"Move down",PANLEFT:"Move left",PANRIGHT:"Move right",ZOOMIN:"Zoom in",ZOOMOUT:"Zoom out",TOGGLEZOOM:"Toggle zoom level",TOGGLE1TO1:"Toggle zoom level",ITERATEZOOM:"Toggle zoom level",ROTATECCW:"Rotate counterclockwise",ROTATECW:"Rotate clockwise",FLIPX:"Flip horizontally",FLIPY:"Flip vertically",FITX:"Fit horizontally",FITY:"Fit vertically",RESET:"Reset",TOGGLEFS:"Toggle fullscreen"},dz={content:null,width:"auto",height:"auto",panMode:"drag",touch:!0,dragMinThreshold:3,lockAxis:!1,mouseMoveFactor:1,mouseMoveFriction:.12,zoom:!0,pinchToZoom:!0,panOnlyZoomed:"auto",minScale:1,maxScale:2,friction:.25,dragFriction:.35,decelFriction:.05,click:"toggleZoom",dblClick:!1,wheel:"zoom",wheelLimit:7,spinner:!0,bounds:"auto",infinite:!1,rubberband:!0,bounce:!0,maxVelocity:75,transformParent:!1,classes:{content:"f-panzoom__content",isLoading:"is-loading",canZoomIn:"can-zoom_in",canZoomOut:"can-zoom_out",isDraggable:"is-draggable",isDragging:"is-dragging",inFullscreen:"in-fullscreen",htmlHasFullscreen:"with-panzoom-in-fullscreen"},l10n:ev},tv='<circle cx="25" cy="25" r="20"></circle>',py='<div class="f-spinner"><svg viewBox="0 0 50 50">'+tv+tv+"</svg></div>",Mr=t=>t&&t!==null&&t instanceof Element&&"nodeType"in t,En=(t,e)=>{t&&cy(e).forEach(n=>{t.classList.remove(n)})},Ct=(t,e)=>{t&&cy(e).forEach(n=>{t.classList.add(n)})},Hp={a:1,b:0,c:0,d:1,e:0,f:0},pz=1e5,qp=1e4,fo="mousemove",nv="drag",iv="content",mo="auto";let fy=null,my=null;class ha extends dy{get fits(){return this.contentRect.width-this.contentRect.fitWidth<1&&this.contentRect.height-this.contentRect.fitHeight<1}get isTouchDevice(){return my===null&&(my=window.matchMedia("(hover: none)").matches),my}get isMobile(){return fy===null&&(fy=/iPhone|iPad|iPod|Android/i.test(navigator.userAgent)),fy}get panMode(){return this.options.panMode!==fo||this.isTouchDevice?nv:fo}get panOnlyZoomed(){const e=this.options.panOnlyZoomed;return e===mo?this.isTouchDevice:e}get isInfinite(){return this.option("infinite")}get angle(){return 180*Math.atan2(this.current.b,this.current.a)/Math.PI||0}get targetAngle(){return 180*Math.atan2(this.target.b,this.target.a)/Math.PI||0}get scale(){const{a:e,b:n}=this.current;return Math.sqrt(e*e+n*n)||1}get targetScale(){const{a:e,b:n}=this.target;return Math.sqrt(e*e+n*n)||1}get minScale(){return this.option("minScale")||1}get fullScale(){const{contentRect:e}=this;return e.fullWidth/e.fitWidth||1}get maxScale(){return this.fullScale*(this.option("maxScale")||1)||1}get coverScale(){const{containerRect:e,contentRect:n}=this,i=Math.max(e.height/n.fitHeight,e.width/n.fitWidth)||1;return Math.min(this.fullScale,i)}get isScaling(){return Math.abs(this.targetScale-this.scale)>1e-5&&!this.isResting}get isContentLoading(){const e=this.content;return!!(e&&e instanceof HTMLImageElement)&&!e.complete}get isResting(){if(this.isBouncingX||this.isBouncingY)return!1;for(const e of Ps){const n=e=="e"||e==="f"?1e-4:1e-5;if(Math.abs(this.target[e]-this.current[e])>n)return!1}return!(!this.ignoreBounds&&!this.checkBounds().inBounds)}constructor(e,n={},i={}){var r;if(super(n),Object.defineProperty(this,"pointerTracker",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"resizeObserver",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"updateTimer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"clickTimer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"rAF",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"isTicking",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"ignoreBounds",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"isBouncingX",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"isBouncingY",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"clicks",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"trackingPoints",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"pwt",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"cwd",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"pmme",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"friction",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:In.Init}),Object.defineProperty(this,"isDragging",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"container",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"content",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"spinner",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"containerRect",{enumerable:!0,configurable:!0,writable:!0,value:{width:0,height:0,innerWidth:0,innerHeight:0}}),Object.defineProperty(this,"contentRect",{enumerable:!0,configurable:!0,writable:!0,value:{top:0,right:0,bottom:0,left:0,fullWidth:0,fullHeight:0,fitWidth:0,fitHeight:0,width:0,height:0}}),Object.defineProperty(this,"dragStart",{enumerable:!0,configurable:!0,writable:!0,value:{x:0,y:0,top:0,left:0,time:0}}),Object.defineProperty(this,"dragOffset",{enumerable:!0,configurable:!0,writable:!0,value:{x:0,y:0,time:0}}),Object.defineProperty(this,"current",{enumerable:!0,configurable:!0,writable:!0,value:Object.assign({},Hp)}),Object.defineProperty(this,"target",{enumerable:!0,configurable:!0,writable:!0,value:Object.assign({},Hp)}),Object.defineProperty(this,"velocity",{enumerable:!0,configurable:!0,writable:!0,value:{a:0,b:0,c:0,d:0,e:0,f:0}}),Object.defineProperty(this,"lockedAxis",{enumerable:!0,configurable:!0,writable:!0,value:!1}),!e)throw new Error("Container Element Not Found");this.container=e,this.initContent(),this.attachPlugins(Object.assign(Object.assign({},ha.Plugins),i)),this.emit("attachPlugins"),this.emit("init");const a=this.content;if(a.addEventListener("load",this.onLoad),a.addEventListener("error",this.onError),this.isContentLoading){if(this.option("spinner")){e.classList.add(this.cn("isLoading"));const u=es(py);!e.contains(a)||a.parentElement instanceof HTMLPictureElement?this.spinner=e.appendChild(u):this.spinner=((r=a.parentElement)===null||r===void 0?void 0:r.insertBefore(u,a))||null}this.emit("beforeLoad")}else queueMicrotask(()=>{this.enable()})}initContent(){const{container:e}=this,n=this.cn(iv);let i=this.option(iv)||e.querySelector(`.${n}`);if(i||(i=e.querySelector("img,picture")||e.firstElementChild,i&&Ct(i,n)),i instanceof HTMLPictureElement&&(i=i.querySelector("img")),!i)throw new Error("No content found");this.content=i}onLoad(){const{spinner:e,container:n,state:i}=this;e&&(e.remove(),this.spinner=null),this.option("spinner")&&n.classList.remove(this.cn("isLoading")),this.emit("afterLoad"),i===In.Init?this.enable():this.updateMetrics()}onError(){this.state!==In.Destroy&&(this.spinner&&(this.spinner.remove(),this.spinner=null),this.stop(),this.detachEvents(),this.state=In.Error,this.emit("error"))}getNextScale(e){const{fullScale:n,targetScale:i,coverScale:r,maxScale:a,minScale:u}=this;let l=u;switch(e){case"toggleMax":l=i-u<.5*(a-u)?a:u;break;case"toggleCover":l=i-u<.5*(r-u)?r:u;break;case"toggleZoom":l=i-u<.5*(n-u)?n:u;break;case"iterateZoom":let g=[1,n,a].sort((w,E)=>w-E),b=g.findIndex(w=>w>i+1e-5);l=g[b]||1}return l}attachObserver(){var e;const n=()=>{const{container:i,containerRect:r}=this;return Math.abs(r.width-i.getBoundingClientRect().width)>.1||Math.abs(r.height-i.getBoundingClientRect().height)>.1};this.resizeObserver||window.ResizeObserver===void 0||(this.resizeObserver=new ResizeObserver(()=>{this.updateTimer||(n()?(this.onResize(),this.isMobile&&(this.updateTimer=setTimeout(()=>{n()&&this.onResize(),this.updateTimer=null},500))):this.updateTimer&&(clearTimeout(this.updateTimer),this.updateTimer=null))})),(e=this.resizeObserver)===null||e===void 0||e.observe(this.container)}detachObserver(){var e;(e=this.resizeObserver)===null||e===void 0||e.disconnect()}attachEvents(){const{container:e}=this;e.addEventListener("click",this.onClick,{passive:!1,capture:!1}),e.addEventListener("wheel",this.onWheel,{passive:!1}),this.pointerTracker=new hz(e,{start:this.onPointerDown,move:this.onPointerMove,end:this.onPointerUp}),document.addEventListener(fo,this.onMouseMove)}detachEvents(){var e;const{container:n}=this;n.removeEventListener("click",this.onClick,{passive:!1,capture:!1}),n.removeEventListener("wheel",this.onWheel,{passive:!1}),(e=this.pointerTracker)===null||e===void 0||e.stop(),this.pointerTracker=null,document.removeEventListener(fo,this.onMouseMove),document.removeEventListener("keydown",this.onKeydown,!0),this.clickTimer&&(clearTimeout(this.clickTimer),this.clickTimer=null),this.updateTimer&&(clearTimeout(this.updateTimer),this.updateTimer=null)}animate(){this.setTargetForce();const e=this.friction,n=this.option("maxVelocity");for(const i of Ps)e?(this.velocity[i]*=1-e,n&&!this.isScaling&&(this.velocity[i]=Math.max(Math.min(this.velocity[i],n),-1*n)),this.current[i]+=this.velocity[i]):this.current[i]=this.target[i];this.setTransform(),this.setEdgeForce(),!this.isResting||this.isDragging?this.rAF=requestAnimationFrame(()=>this.animate()):this.stop("current")}setTargetForce(){for(const e of Ps)e==="e"&&this.isBouncingX||e==="f"&&this.isBouncingY||(this.velocity[e]=(1/(1-this.friction)-1)*(this.target[e]-this.current[e]))}checkBounds(e=0,n=0){const{current:i}=this,r=i.e+e,a=i.f+n,u=this.getBounds(),{x:l,y:g}=u,b=l.min,w=l.max,E=g.min,C=g.max;let P=0,D=0;return b!==1/0&&r<b?P=b-r:w!==1/0&&r>w&&(P=w-r),E!==1/0&&a<E?D=E-a:C!==1/0&&a>C&&(D=C-a),Math.abs(P)<1e-4&&(P=0),Math.abs(D)<1e-4&&(D=0),Object.assign(Object.assign({},u),{xDiff:P,yDiff:D,inBounds:!P&&!D})}clampTargetBounds(){const{target:e}=this,{x:n,y:i}=this.getBounds();n.min!==1/0&&(e.e=Math.max(e.e,n.min)),n.max!==1/0&&(e.e=Math.min(e.e,n.max)),i.min!==1/0&&(e.f=Math.max(e.f,i.min)),i.max!==1/0&&(e.f=Math.min(e.f,i.max))}calculateContentDim(e=this.current){const{content:n,contentRect:i}=this,{fitWidth:r,fitHeight:a,fullWidth:u,fullHeight:l}=i;let g=u,b=l;if(this.option("zoom")||this.angle!==0){const w=!(n instanceof HTMLImageElement)&&(window.getComputedStyle(n).maxWidth==="none"||window.getComputedStyle(n).maxHeight==="none"),E=w?u:r,C=w?l:a,P=this.getMatrix(e),D=new DOMPoint(0,0).matrixTransform(P),R=new DOMPoint(0+E,0).matrixTransform(P),$=new DOMPoint(0+E,0+C).matrixTransform(P),W=new DOMPoint(0,0+C).matrixTransform(P),te=Math.abs($.x-D.x),G=Math.abs($.y-D.y),Q=Math.abs(W.x-R.x),Ie=Math.abs(W.y-R.y);g=Math.max(te,Q),b=Math.max(G,Ie)}return{contentWidth:g,contentHeight:b}}setEdgeForce(){if(this.ignoreBounds||this.isDragging||this.panMode===fo||this.targetScale<this.scale)return this.isBouncingX=!1,void(this.isBouncingY=!1);const{target:e}=this,{x:n,y:i,xDiff:r,yDiff:a}=this.checkBounds(),u=this.option("maxVelocity");let l=this.velocity.e,g=this.velocity.f;r!==0?(this.isBouncingX=!0,r*l<=0?l+=.14*r:(l=.14*r,n.min!==1/0&&(this.target.e=Math.max(e.e,n.min)),n.max!==1/0&&(this.target.e=Math.min(e.e,n.max))),u&&(l=Math.max(Math.min(l,u),-1*u))):this.isBouncingX=!1,a!==0?(this.isBouncingY=!0,a*g<=0?g+=.14*a:(g=.14*a,i.min!==1/0&&(this.target.f=Math.max(e.f,i.min)),i.max!==1/0&&(this.target.f=Math.min(e.f,i.max))),u&&(g=Math.max(Math.min(g,u),-1*u))):this.isBouncingY=!1,this.isBouncingX&&(this.velocity.e=l),this.isBouncingY&&(this.velocity.f=g)}enable(){const{content:e}=this,n=new DOMMatrixReadOnly(window.getComputedStyle(e).transform);for(const i of Ps)this.current[i]=this.target[i]=n[i];this.updateMetrics(),this.attachObserver(),this.attachEvents(),this.state=In.Ready,this.emit("ready")}onClick(e){var n;e.type==="click"&&e.detail===0&&(this.dragOffset.x=0,this.dragOffset.y=0),this.isDragging&&((n=this.pointerTracker)===null||n===void 0||n.clear(),this.trackingPoints=[],this.startDecelAnim());const i=e.target;if(!i||e.defaultPrevented)return;if(i.hasAttribute("disabled"))return e.preventDefault(),void e.stopPropagation();if((()=>{const P=window.getSelection();return P&&P.type==="Range"})()&&!i.closest("button"))return;const r=i.closest("[data-panzoom-action]"),a=i.closest("[data-panzoom-change]"),u=r||a,l=u&&Mr(u)?u.dataset:null;if(l){const P=l.panzoomChange,D=l.panzoomAction;if((P||D)&&e.preventDefault(),P){let R={};try{R=JSON.parse(P)}catch{console&&console.warn("The given data was not valid JSON")}return void this.applyChange(R)}if(D)return void(this[D]&&this[D]())}if(Math.abs(this.dragOffset.x)>3||Math.abs(this.dragOffset.y)>3)return e.preventDefault(),void e.stopPropagation();if(i.closest("[data-fancybox]"))return;const g=this.content.getBoundingClientRect(),b=this.dragStart;if(b.time&&!this.canZoomOut()&&(Math.abs(g.x-b.x)>2||Math.abs(g.y-b.y)>2))return;this.dragStart.time=0;const w=P=>{this.option("zoom",e)&&P&&typeof P=="string"&&/(iterateZoom)|(toggle(Zoom|Full|Cover|Max)|(zoomTo(Fit|Cover|Max)))/.test(P)&&typeof this[P]=="function"&&(e.preventDefault(),this[P]({event:e}))},E=this.option("click",e),C=this.option("dblClick",e);C?(this.clicks++,this.clicks==1&&(this.clickTimer=setTimeout(()=>{this.clicks===1?(this.emit("click",e),!e.defaultPrevented&&E&&w(E)):(this.emit("dblClick",e),e.defaultPrevented||w(C)),this.clicks=0,this.clickTimer=null},350))):(this.emit("click",e),!e.defaultPrevented&&E&&w(E))}addTrackingPoint(e){const n=this.trackingPoints.filter(i=>i.time>Date.now()-100);n.push(e),this.trackingPoints=n}onPointerDown(e,n,i){var r;if(this.option("touch",e)===!1)return!1;this.pwt=0,this.dragOffset={x:0,y:0,time:0},this.trackingPoints=[];const a=this.content.getBoundingClientRect();if(this.dragStart={x:a.x,y:a.y,top:a.top,left:a.left,time:Date.now()},this.clickTimer)return!1;if(this.panMode===fo&&this.targetScale>1)return e.preventDefault(),e.stopPropagation(),!1;const u=e.composedPath()[0];if(!i.length){if(["TEXTAREA","OPTION","INPUT","SELECT","VIDEO","IFRAME"].includes(u.nodeName)||u.closest("[contenteditable],[data-selectable],[data-draggable],[data-clickable],[data-panzoom-change],[data-panzoom-action]"))return!1;(r=window.getSelection())===null||r===void 0||r.removeAllRanges()}if(e.type==="mousedown")["A","BUTTON"].includes(u.nodeName)||e.preventDefault();else if(Math.abs(this.velocity.a)>.3)return!1;return this.target.e=this.current.e,this.target.f=this.current.f,this.stop(),this.isDragging||(this.isDragging=!0,this.addTrackingPoint(n),this.emit("touchStart",e)),!0}onPointerMove(e,n,i){if(this.option("touch",e)===!1||!this.isDragging||n.length<2&&this.panOnlyZoomed&&lt(this.targetScale)<=lt(this.minScale)||(this.emit("touchMove",e),e.defaultPrevented))return;this.addTrackingPoint(n[0]);const{content:r}=this,a=Q1(i[0],i[1]),u=Q1(n[0],n[1]);let l=0,g=0;if(n.length>1){const G=r.getBoundingClientRect();l=a.clientX-G.left-.5*G.width,g=a.clientY-G.top-.5*G.height}const b=J1(i[0],i[1]),w=J1(n[0],n[1]);let E=b?w/b:1,C=u.clientX-a.clientX,P=u.clientY-a.clientY;this.dragOffset.x+=C,this.dragOffset.y+=P,this.dragOffset.time=Date.now()-this.dragStart.time;let D=lt(this.targetScale)===lt(this.minScale)&&this.option("lockAxis");if(D&&!this.lockedAxis)if(D==="xy"||D==="y"||e.type==="touchmove"){if(Math.abs(this.dragOffset.x)<6&&Math.abs(this.dragOffset.y)<6)return void e.preventDefault();const G=Math.abs(180*Math.atan2(this.dragOffset.y,this.dragOffset.x)/Math.PI);this.lockedAxis=G>45&&G<135?"y":"x",this.dragOffset.x=0,this.dragOffset.y=0,C=0,P=0}else this.lockedAxis=D;if(jp(e.target,this.content)&&(D="x",this.dragOffset.y=0),D&&D!=="xy"&&this.lockedAxis!==D&&lt(this.targetScale)===lt(this.minScale))return;e.cancelable&&e.preventDefault(),this.container.classList.add(this.cn("isDragging"));const R=this.checkBounds(C,P);this.option("rubberband")?(this.isInfinite!=="x"&&(R.xDiff>0&&C<0||R.xDiff<0&&C>0)&&(C*=Math.max(0,.5-Math.abs(.75/this.contentRect.fitWidth*R.xDiff))),this.isInfinite!=="y"&&(R.yDiff>0&&P<0||R.yDiff<0&&P>0)&&(P*=Math.max(0,.5-Math.abs(.75/this.contentRect.fitHeight*R.yDiff)))):(R.xDiff&&(C=0),R.yDiff&&(P=0));const $=this.targetScale,W=this.minScale,te=this.maxScale;$<.5*W&&(E=Math.max(E,W)),$>1.5*te&&(E=Math.min(E,te)),this.lockedAxis==="y"&&lt($)===lt(W)&&(C=0),this.lockedAxis==="x"&&lt($)===lt(W)&&(P=0),this.applyChange({originX:l,originY:g,panX:C,panY:P,scale:E,friction:this.option("dragFriction"),ignoreBounds:!0})}onPointerUp(e,n,i){if(i.length)return this.dragOffset.x=0,this.dragOffset.y=0,void(this.trackingPoints=[]);this.container.classList.remove(this.cn("isDragging")),this.isDragging&&(this.addTrackingPoint(n),this.panOnlyZoomed&&this.contentRect.width-this.contentRect.fitWidth<1&&this.contentRect.height-this.contentRect.fitHeight<1&&(this.trackingPoints=[]),jp(e.target,this.content)&&this.lockedAxis==="y"&&(this.trackingPoints=[]),this.emit("touchEnd",e),this.isDragging=!1,this.lockedAxis=!1,this.state!==In.Destroy&&(e.defaultPrevented||this.startDecelAnim()))}startDecelAnim(){var e;const n=this.isScaling;this.rAF&&(cancelAnimationFrame(this.rAF),this.rAF=null),this.isBouncingX=!1,this.isBouncingY=!1;for(const G of Ps)this.velocity[G]=0;this.target.e=this.current.e,this.target.f=this.current.f,En(this.container,"is-scaling"),En(this.container,"is-animating"),this.isTicking=!1;const{trackingPoints:i}=this,r=i[0],a=i[i.length-1];let u=0,l=0,g=0;a&&r&&(u=a.clientX-r.clientX,l=a.clientY-r.clientY,g=a.time-r.time);const b=((e=window.visualViewport)===null||e===void 0?void 0:e.scale)||1;b!==1&&(u*=b,l*=b);let w=0,E=0,C=0,P=0,D=this.option("decelFriction");const R=this.targetScale;if(g>0){C=Math.abs(u)>3?u/(g/30):0,P=Math.abs(l)>3?l/(g/30):0;const G=this.option("maxVelocity");G&&(C=Math.max(Math.min(C,G),-1*G),P=Math.max(Math.min(P,G),-1*G))}C&&(w=C/(1/(1-D)-1)),P&&(E=P/(1/(1-D)-1)),(this.option("lockAxis")==="y"||this.option("lockAxis")==="xy"&&this.lockedAxis==="y"&&lt(R)===this.minScale)&&(w=C=0),(this.option("lockAxis")==="x"||this.option("lockAxis")==="xy"&&this.lockedAxis==="x"&&lt(R)===this.minScale)&&(E=P=0);const $=this.dragOffset.x,W=this.dragOffset.y,te=this.option("dragMinThreshold")||0;Math.abs($)<te&&Math.abs(W)<te&&(w=E=0,C=P=0),(this.option("zoom")&&(R<this.minScale-1e-5||R>this.maxScale+1e-5)||n&&!w&&!E)&&(D=.35),this.applyChange({panX:w,panY:E,friction:D}),this.emit("decel",C,P,$,W)}onWheel(e){var n=[-e.deltaX||0,-e.deltaY||0,-e.detail||0].reduce(function(a,u){return Math.abs(u)>Math.abs(a)?u:a});const i=Math.max(-1,Math.min(1,n));if(this.emit("wheel",e,i),this.panMode===fo||e.defaultPrevented)return;const r=this.option("wheel");r==="pan"?(e.preventDefault(),this.panOnlyZoomed&&!this.canZoomOut()||this.applyChange({panX:2*-e.deltaX,panY:2*-e.deltaY,bounce:!1})):r==="zoom"&&this.option("zoom")!==!1&&this.zoomWithWheel(e)}onMouseMove(e){this.panWithMouse(e)}onKeydown(e){e.key==="Escape"&&this.toggleFS()}onResize(){this.updateMetrics(),this.checkBounds().inBounds||this.requestTick()}setTransform(){this.emit("beforeTransform");const{current:e,target:n,content:i,contentRect:r}=this,a=Object.assign({},Hp);for(const $ of Ps){const W=$=="e"||$==="f"?qp:pz;a[$]=lt(e[$],W),Math.abs(n[$]-e[$])<($=="e"||$==="f"?.51:.001)&&(e[$]=n[$])}let{a:u,b:l,c:g,d:b,e:w,f:E}=a,C=`matrix(${u}, ${l}, ${g}, ${b}, ${w}, ${E})`,P=i.parentElement instanceof HTMLPictureElement?i.parentElement:i;if(this.option("transformParent")&&(P=P.parentElement||P),P.style.transform===C)return;P.style.transform=C;const{contentWidth:D,contentHeight:R}=this.calculateContentDim();r.width=D,r.height=R,this.emit("afterTransform")}updateMetrics(e=!1){var n;if(!this||this.state===In.Destroy||this.isContentLoading)return;const i=Math.max(1,((n=window.visualViewport)===null||n===void 0?void 0:n.scale)||1),{container:r,content:a}=this,u=a instanceof HTMLImageElement,l=r.getBoundingClientRect(),g=getComputedStyle(this.container);let b=l.width*i,w=l.height*i;const E=parseFloat(g.paddingTop)+parseFloat(g.paddingBottom),C=b-(parseFloat(g.paddingLeft)+parseFloat(g.paddingRight)),P=w-E;this.containerRect={width:b,height:w,innerWidth:C,innerHeight:P};const D=parseFloat(a.dataset.width||"")||(ot=>{let Tt=0;return Tt=ot instanceof HTMLImageElement?ot.naturalWidth:ot instanceof SVGElement?ot.width.baseVal.value:Math.max(ot.offsetWidth,ot.scrollWidth),Tt||0})(a),R=parseFloat(a.dataset.height||"")||(ot=>{let Tt=0;return Tt=ot instanceof HTMLImageElement?ot.naturalHeight:ot instanceof SVGElement?ot.height.baseVal.value:Math.max(ot.offsetHeight,ot.scrollHeight),Tt||0})(a);let $=this.option("width",D)||mo,W=this.option("height",R)||mo;const te=$===mo,G=W===mo;typeof $!="number"&&($=D),typeof W!="number"&&(W=R),te&&($=D*(W/R)),G&&(W=R/(D/$));let Q=a.parentElement instanceof HTMLPictureElement?a.parentElement:a;this.option("transformParent")&&(Q=Q.parentElement||Q);const Ie=Q.getAttribute("style")||"";Q.style.setProperty("transform","none","important"),u&&(Q.style.width="",Q.style.height=""),Q.offsetHeight;const ve=a.getBoundingClientRect();let Se=ve.width*i,Ne=ve.height*i,Ae=Se,$e=Ne;Se=Math.min(Se,$),Ne=Math.min(Ne,W),u?{width:Se,height:Ne}=((ot,Tt,Nt,Vt)=>{const Ft=Nt/ot,Ht=Vt/Tt,Cn=Math.min(Ft,Ht);return{width:ot*=Cn,height:Tt*=Cn}})($,W,Se,Ne):(Se=Math.min(Se,$),Ne=Math.min(Ne,W));let Xe=.5*($e-Ne),Pt=.5*(Ae-Se);this.contentRect=Object.assign(Object.assign({},this.contentRect),{top:ve.top-l.top+Xe,bottom:l.bottom-ve.bottom+Xe,left:ve.left-l.left+Pt,right:l.right-ve.right+Pt,fitWidth:Se,fitHeight:Ne,width:Se,height:Ne,fullWidth:$,fullHeight:W}),Q.style.cssText=Ie,u&&(Q.style.width=`${Se}px`,Q.style.height=`${Ne}px`),this.setTransform(),e!==!0&&this.emit("refresh"),this.ignoreBounds||(lt(this.targetScale)<lt(this.minScale)?this.zoomTo(this.minScale,{friction:0}):this.targetScale>this.maxScale?this.zoomTo(this.maxScale,{friction:0}):this.state===In.Init||this.checkBounds().inBounds||this.requestTick()),this.updateControls()}calculateBounds(){const{contentWidth:e,contentHeight:n}=this.calculateContentDim(this.target),{targetScale:i,lockedAxis:r}=this,{fitWidth:a,fitHeight:u}=this.contentRect;let l=0,g=0,b=0,w=0;const E=this.option("infinite");if(E===!0||r&&E===r)l=-1/0,b=1/0,g=-1/0,w=1/0;else{let{containerRect:C,contentRect:P}=this,D=lt(a*i,qp),R=lt(u*i,qp),{innerWidth:$,innerHeight:W}=C;if(C.width===D&&($=C.width),C.width===R&&(W=C.height),e>$){b=.5*(e-$),l=-1*b;let te=.5*(P.right-P.left);l+=te,b+=te}if(a>$&&e<$&&(l-=.5*(a-$),b-=.5*(a-$)),n>W){w=.5*(n-W),g=-1*w;let te=.5*(P.bottom-P.top);g+=te,w+=te}u>W&&n<W&&(l-=.5*(u-W),b-=.5*(u-W))}return{x:{min:l,max:b},y:{min:g,max:w}}}getBounds(){const e=this.option("bounds");return e!==mo?e:this.calculateBounds()}updateControls(){const e=this,n=e.container,{panMode:i,contentRect:r,targetScale:a,minScale:u}=e;let l=u,g=e.option("click")||!1;g&&(l=e.getNextScale(g));let b=e.canZoomIn(),w=e.canZoomOut(),E=i===nv&&!!this.option("touch"),C=w&&E;if(E&&(lt(a)<lt(u)&&!this.panOnlyZoomed&&(C=!0),(lt(r.width,1)>lt(r.fitWidth,1)||lt(r.height,1)>lt(r.fitHeight,1))&&(C=!0)),lt(r.width*a,1)<lt(r.fitWidth,1)&&(C=!1),i===fo&&(C=!1),ts(n,this.cn("isDraggable"),C),!this.option("zoom"))return;let P=b&&lt(l)>lt(a),D=!P&&!C&&w&&lt(l)<lt(a);ts(n,this.cn("canZoomIn"),P),ts(n,this.cn("canZoomOut"),D);for(const R of n.querySelectorAll("[data-panzoom-action]")){let $=!1,W=!1;switch(R.dataset.panzoomAction){case"zoomIn":b?$=!0:W=!0;break;case"zoomOut":w?$=!0:W=!0;break;case"toggleZoom":case"iterateZoom":b||w?$=!0:W=!0;const te=R.querySelector("g");te&&(te.style.display=b?"":"none")}$?(R.removeAttribute("disabled"),R.removeAttribute("tabindex")):W&&(R.setAttribute("disabled",""),R.setAttribute("tabindex","-1"))}}panTo({x:e=this.target.e,y:n=this.target.f,scale:i=this.targetScale,friction:r=this.option("friction"),angle:a=0,originX:u=0,originY:l=0,flipX:g=!1,flipY:b=!1,ignoreBounds:w=!1}){this.state!==In.Destroy&&this.applyChange({panX:e-this.target.e,panY:n-this.target.f,scale:i/this.targetScale,angle:a,originX:u,originY:l,friction:r,flipX:g,flipY:b,ignoreBounds:w})}applyChange({panX:e=0,panY:n=0,scale:i=1,angle:r=0,originX:a=-this.current.e,originY:u=-this.current.f,friction:l=this.option("friction"),flipX:g=!1,flipY:b=!1,ignoreBounds:w=!1,bounce:E=this.option("bounce")}){const C=this.state;if(C===In.Destroy)return;this.rAF&&(cancelAnimationFrame(this.rAF),this.rAF=null),this.friction=l||0,this.ignoreBounds=w;const{current:P}=this,D=P.e,R=P.f,$=this.getMatrix(this.target);let W=new DOMMatrix().translate(D,R).translate(a,u).translate(e,n);if(this.option("zoom")){if(!w){const te=this.targetScale,G=this.minScale,Q=this.maxScale;te*i<G&&(i=G/te),te*i>Q&&(i=Q/te)}W=W.scale(i)}W=W.translate(-a,-u).translate(-D,-R).multiply($),r&&(W=W.rotate(r)),g&&(W=W.scale(-1,1)),b&&(W=W.scale(1,-1));for(const te of Ps)te!=="e"&&te!=="f"&&(W[te]>this.minScale+1e-5||W[te]<this.minScale-1e-5)?this.target[te]=W[te]:this.target[te]=lt(W[te],qp);(this.targetScale<this.scale||Math.abs(i-1)>.1||this.panMode===fo||E===!1)&&!w&&this.clampTargetBounds(),C===In.Init?this.animate():this.isResting||(this.state=In.Panning,this.requestTick())}stop(e=!1){if(this.state===In.Init||this.state===In.Destroy)return;const n=this.isTicking;this.rAF&&(cancelAnimationFrame(this.rAF),this.rAF=null),this.isBouncingX=!1,this.isBouncingY=!1;for(const i of Ps)this.velocity[i]=0,e==="current"?this.current[i]=this.target[i]:e==="target"&&(this.target[i]=this.current[i]);this.setTransform(),En(this.container,"is-scaling"),En(this.container,"is-animating"),this.isTicking=!1,this.state=In.Ready,n&&(this.emit("endAnimation"),this.updateControls())}requestTick(){this.isTicking||(this.emit("startAnimation"),this.updateControls(),Ct(this.container,"is-animating"),this.isScaling&&Ct(this.container,"is-scaling")),this.isTicking=!0,this.rAF||(this.rAF=requestAnimationFrame(()=>this.animate()))}panWithMouse(e,n=this.option("mouseMoveFriction")){if(this.pmme=e,this.panMode!==fo||!e||lt(this.targetScale)<=lt(this.minScale))return;this.emit("mouseMove",e);const{container:i,containerRect:r,contentRect:a}=this,u=r.width,l=r.height,g=i.getBoundingClientRect(),b=(e.clientX||0)-g.left,w=(e.clientY||0)-g.top;let{contentWidth:E,contentHeight:C}=this.calculateContentDim(this.target);const P=this.option("mouseMoveFactor");P>1&&(E!==u&&(E*=P),C!==l&&(C*=P));let D=.5*(E-u)-b/u*100/100*(E-u);D+=.5*(a.right-a.left);let R=.5*(C-l)-w/l*100/100*(C-l);R+=.5*(a.bottom-a.top),this.applyChange({panX:D-this.target.e,panY:R-this.target.f,friction:n})}zoomWithWheel(e){if(this.state===In.Destroy||this.state===In.Init)return;const n=Date.now();if(n-this.pwt<45)return void e.preventDefault();this.pwt=n;var i=[-e.deltaX||0,-e.deltaY||0,-e.detail||0].reduce(function(b,w){return Math.abs(w)>Math.abs(b)?w:b});const r=Math.max(-1,Math.min(1,i)),{targetScale:a,maxScale:u,minScale:l}=this;let g=a*(100+45*r)/100;lt(g)<lt(l)&&lt(a)<=lt(l)?(this.cwd+=Math.abs(r),g=l):lt(g)>lt(u)&&lt(a)>=lt(u)?(this.cwd+=Math.abs(r),g=u):(this.cwd=0,g=Math.max(Math.min(g,u),l)),this.cwd>this.option("wheelLimit")||(e.preventDefault(),lt(g)!==lt(a)&&this.zoomTo(g,{event:e}))}canZoomIn(){return this.option("zoom")&&(lt(this.contentRect.width,1)<lt(this.contentRect.fitWidth,1)||lt(this.targetScale)<lt(this.maxScale))}canZoomOut(){return this.option("zoom")&&lt(this.targetScale)>lt(this.minScale)}zoomIn(e=1.25,n){this.zoomTo(this.targetScale*e,n)}zoomOut(e=.8,n){this.zoomTo(this.targetScale*e,n)}zoomToFit(e){this.zoomTo("fit",e)}zoomToCover(e){this.zoomTo("cover",e)}zoomToFull(e){this.zoomTo("full",e)}zoomToMax(e){this.zoomTo("max",e)}toggleZoom(e){this.zoomTo(this.getNextScale("toggleZoom"),e)}toggleMax(e){this.zoomTo(this.getNextScale("toggleMax"),e)}toggleCover(e){this.zoomTo(this.getNextScale("toggleCover"),e)}iterateZoom(e){this.zoomTo("next",e)}zoomTo(e=1,{friction:n=mo,originX:i=mo,originY:r=mo,event:a}={}){if(this.isContentLoading||this.state===In.Destroy)return;const{targetScale:u,fullScale:l,maxScale:g,coverScale:b}=this;if(this.stop(),this.panMode===fo&&(a=this.pmme||a),a||i===mo||r===mo){const E=this.content.getBoundingClientRect(),C=this.container.getBoundingClientRect(),P=a?a.clientX:C.left+.5*C.width,D=a?a.clientY:C.top+.5*C.height;i=P-E.left-.5*E.width,r=D-E.top-.5*E.height}let w=1;typeof e=="number"?w=e:e==="full"?w=l:e==="cover"?w=b:e==="max"?w=g:e==="fit"?w=1:e==="next"&&(w=this.getNextScale("iterateZoom")),w=w/u||1,n=n===mo?w>1?.15:.25:n,this.applyChange({scale:w,originX:i,originY:r,friction:n}),a&&this.panMode===fo&&this.panWithMouse(a,n)}rotateCCW(){this.applyChange({angle:-90})}rotateCW(){this.applyChange({angle:90})}flipX(){this.applyChange({flipX:!0})}flipY(){this.applyChange({flipY:!0})}fitX(){this.stop("target");const{containerRect:e,contentRect:n,target:i}=this;this.applyChange({panX:.5*e.width-(n.left+.5*n.fitWidth)-i.e,panY:.5*e.height-(n.top+.5*n.fitHeight)-i.f,scale:e.width/n.fitWidth/this.targetScale,originX:0,originY:0,ignoreBounds:!0})}fitY(){this.stop("target");const{containerRect:e,contentRect:n,target:i}=this;this.applyChange({panX:.5*e.width-(n.left+.5*n.fitWidth)-i.e,panY:.5*e.innerHeight-(n.top+.5*n.fitHeight)-i.f,scale:e.height/n.fitHeight/this.targetScale,originX:0,originY:0,ignoreBounds:!0})}toggleFS(){const{container:e}=this,n=this.cn("inFullscreen"),i=this.cn("htmlHasFullscreen");e.classList.toggle(n);const r=e.classList.contains(n);r?(document.documentElement.classList.add(i),document.addEventListener("keydown",this.onKeydown,!0)):(document.documentElement.classList.remove(i),document.removeEventListener("keydown",this.onKeydown,!0)),this.updateMetrics(),this.emit(r?"enterFS":"exitFS")}getMatrix(e=this.current){const{a:n,b:i,c:r,d:a,e:u,f:l}=e;return new DOMMatrix([n,i,r,a,u,l])}reset(e){if(this.state!==In.Init&&this.state!==In.Destroy){this.stop("current");for(const n of Ps)this.target[n]=Hp[n];this.target.a=this.minScale,this.target.d=this.minScale,this.clampTargetBounds(),this.isResting||(this.friction=e===void 0?this.option("friction"):e,this.state=In.Panning,this.requestTick())}}destroy(){this.stop(),this.state=In.Destroy,this.detachEvents(),this.detachObserver();const{container:e,content:n}=this,i=this.option("classes")||{};for(const r of Object.values(i))e.classList.remove(r+"");n&&(n.removeEventListener("load",this.onLoad),n.removeEventListener("error",this.onError)),this.detachPlugins()}}Object.defineProperty(ha,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:dz}),Object.defineProperty(ha,"Plugins",{enumerable:!0,configurable:!0,writable:!0,value:{}});const rv=function(t,e){let n=!0;return(...i)=>{n&&(n=!1,t(...i),setTimeout(()=>{n=!0},e))}},ov=(t,e)=>{let n=[];return t.childNodes.forEach(i=>{i.nodeType!==Node.ELEMENT_NODE||e&&!i.matches(e)||n.push(i)}),n},fz={viewport:null,track:null,enabled:!0,slides:[],axis:"x",transition:"fade",preload:1,slidesPerPage:"auto",initialPage:0,friction:.12,Panzoom:{decelFriction:.12},center:!0,infinite:!0,fill:!0,dragFree:!1,adaptiveHeight:!1,direction:"ltr",classes:{container:"f-carousel",viewport:"f-carousel__viewport",track:"f-carousel__track",slide:"f-carousel__slide",isLTR:"is-ltr",isRTL:"is-rtl",isHorizontal:"is-horizontal",isVertical:"is-vertical",inTransition:"in-transition",isSelected:"is-selected"},l10n:{NEXT:"Next slide",PREV:"Previous slide",GOTO:"Go to slide #%d"}};var di;(function(t){t[t.Init=0]="Init",t[t.Ready=1]="Ready",t[t.Destroy=2]="Destroy"})(di||(di={}));const gy=t=>{if(typeof t=="string"||t instanceof HTMLElement)t={html:t};else{const e=t.thumb;e!==void 0&&(typeof e=="string"&&(t.thumbSrc=e),e instanceof HTMLImageElement&&(t.thumbEl=e,t.thumbElSrc=e.src,t.thumbSrc=e.src),delete t.thumb)}return Object.assign({html:"",el:null,isDom:!1,class:"",customClass:"",index:-1,dim:0,gap:0,pos:0,transition:!1},t)},mz=(t={})=>Object.assign({index:-1,slides:[],dim:0,pos:-1},t);class Vo extends Up{constructor(e,n){super(n),Object.defineProperty(this,"instance",{enumerable:!0,configurable:!0,writable:!0,value:e})}attach(){}detach(){}}const gz={classes:{list:"f-carousel__dots",isDynamic:"is-dynamic",hasDots:"has-dots",dot:"f-carousel__dot",isBeforePrev:"is-before-prev",isPrev:"is-prev",isCurrent:"is-current",isNext:"is-next",isAfterNext:"is-after-next"},dotTpl:'<button type="button" data-carousel-page="%i" aria-label="{{GOTO}}"><span class="f-carousel__dot" aria-hidden="true"></span></button>',dynamicFrom:11,maxCount:1/0,minCount:2};class sv extends Vo{constructor(){super(...arguments),Object.defineProperty(this,"isDynamic",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"list",{enumerable:!0,configurable:!0,writable:!0,value:null})}onRefresh(){this.refresh()}build(){let e=this.list;if(!e){e=document.createElement("ul"),Ct(e,this.cn("list")),e.setAttribute("role","tablist");const n=this.instance.container;n.appendChild(e),Ct(n,this.cn("hasDots")),this.list=e}return e}refresh(){var e;const n=this.instance.pages.length,i=Math.min(2,this.option("minCount")),r=Math.max(2e3,this.option("maxCount")),a=this.option("dynamicFrom");if(n<i||n>r)return void this.cleanup();const u=typeof a=="number"&&n>5&&n>=a,l=!this.list||this.isDynamic!==u||this.list.children.length!==n;l&&this.cleanup();const g=this.build();if(ts(g,this.cn("isDynamic"),!!u),l)for(let E=0;E<n;E++)g.append(this.createItem(E));let b,w=0;for(const E of[...g.children]){const C=w===this.instance.page;C&&(b=E),ts(E,this.cn("isCurrent"),C),(e=E.children[0])===null||e===void 0||e.setAttribute("aria-selected",C?"true":"false");for(const P of["isBeforePrev","isPrev","isNext","isAfterNext"])En(E,this.cn(P));w++}if(b=b||g.firstChild,u&&b){const E=b.previousElementSibling,C=E&&E.previousElementSibling;Ct(E,this.cn("isPrev")),Ct(C,this.cn("isBeforePrev"));const P=b.nextElementSibling,D=P&&P.nextElementSibling;Ct(P,this.cn("isNext")),Ct(D,this.cn("isAfterNext"))}this.isDynamic=u}createItem(e=0){var n;const i=document.createElement("li");i.setAttribute("role","presentation");const r=es(this.instance.localize(this.option("dotTpl"),[["%d",e+1]]).replace(/\%i/g,e+""));return i.appendChild(r),(n=i.children[0])===null||n===void 0||n.setAttribute("role","tab"),i}cleanup(){this.list&&(this.list.remove(),this.list=null),this.isDynamic=!1,En(this.instance.container,this.cn("hasDots"))}attach(){this.instance.on(["refresh","change"],this.onRefresh)}detach(){this.instance.off(["refresh","change"],this.onRefresh),this.cleanup()}}Object.defineProperty(sv,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:gz});const Wp="disabled",Gp="next",av="prev";class lv extends Vo{constructor(){super(...arguments),Object.defineProperty(this,"container",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"prev",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"next",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"isDom",{enumerable:!0,configurable:!0,writable:!0,value:!1})}onRefresh(){const e=this.instance,n=e.pages.length,i=e.page;if(n<2)return void this.cleanup();this.build();let r=this.prev,a=this.next;r&&a&&(r.removeAttribute(Wp),a.removeAttribute(Wp),e.isInfinite||(i<=0&&r.setAttribute(Wp,""),i>=n-1&&a.setAttribute(Wp,"")))}addBtn(e){var n;const i=this.instance,r=document.createElement("button");r.setAttribute("tabindex","0"),r.setAttribute("title",i.localize(`{{${e.toUpperCase()}}}`)),Ct(r,this.cn("button")+" "+this.cn(e===Gp?"isNext":"isPrev"));const a=i.isRTL?e===Gp?av:Gp:e;var u;return r.innerHTML=i.localize(this.option(`${a}Tpl`)),r.dataset[`carousel${u=e,u?u.match("^[a-z]")?u.charAt(0).toUpperCase()+u.substring(1):u:""}`]="true",(n=this.container)===null||n===void 0||n.appendChild(r),r}build(){const e=this.instance.container,n=this.cn("container");let{container:i,prev:r,next:a}=this;i||(i=e.querySelector("."+n),this.isDom=!!i),i||(i=document.createElement("div"),Ct(i,n),e.appendChild(i)),this.container=i,a||(a=i.querySelector("[data-carousel-next]")),a||(a=this.addBtn(Gp)),this.next=a,r||(r=i.querySelector("[data-carousel-prev]")),r||(r=this.addBtn(av)),this.prev=r}cleanup(){this.isDom||(this.prev&&this.prev.remove(),this.next&&this.next.remove(),this.container&&this.container.remove()),this.prev=null,this.next=null,this.container=null,this.isDom=!1}attach(){this.instance.on(["refresh","change"],this.onRefresh)}detach(){this.instance.off(["refresh","change"],this.onRefresh),this.cleanup()}}Object.defineProperty(lv,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{classes:{container:"f-carousel__nav",button:"f-button",isNext:"is-next",isPrev:"is-prev"},nextTpl:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" tabindex="-1"><path d="M9 3l9 9-9 9"/></svg>',prevTpl:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" tabindex="-1"><path d="M15 3l-9 9 9 9"/></svg>'}});class cv extends Vo{constructor(){super(...arguments),Object.defineProperty(this,"selectedIndex",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"target",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"nav",{enumerable:!0,configurable:!0,writable:!0,value:null})}addAsTargetFor(e){this.target=this.instance,this.nav=e,this.attachEvents()}addAsNavFor(e){this.nav=this.instance,this.target=e,this.attachEvents()}attachEvents(){const{nav:e,target:n}=this;e&&n&&(e.options.initialSlide=n.options.initialPage,e.state===di.Ready?this.onNavReady(e):e.on("ready",this.onNavReady),n.state===di.Ready?this.onTargetReady(n):n.on("ready",this.onTargetReady))}onNavReady(e){e.on("createSlide",this.onNavCreateSlide),e.on("Panzoom.click",this.onNavClick),e.on("Panzoom.touchEnd",this.onNavTouch),this.onTargetChange()}onTargetReady(e){e.on("change",this.onTargetChange),e.on("Panzoom.refresh",this.onTargetChange),this.onTargetChange()}onNavClick(e,n,i){this.onNavTouch(e,e.panzoom,i)}onNavTouch(e,n,i){var r,a;if(Math.abs(n.dragOffset.x)>3||Math.abs(n.dragOffset.y)>3)return;const u=i.target,{nav:l,target:g}=this;if(!l||!g||!u)return;const b=u.closest("[data-index]");if(i.stopPropagation(),i.preventDefault(),!b)return;const w=parseInt(b.dataset.index||"",10)||0,E=g.getPageForSlide(w),C=l.getPageForSlide(w);l.slideTo(C),g.slideTo(E,{friction:((a=(r=this.nav)===null||r===void 0?void 0:r.plugins)===null||a===void 0?void 0:a.Sync.option("friction"))||0}),this.markSelectedSlide(w)}onNavCreateSlide(e,n){n.index===this.selectedIndex&&this.markSelectedSlide(n.index)}onTargetChange(){var e,n;const{target:i,nav:r}=this;if(!i||!r||r.state!==di.Ready||i.state!==di.Ready)return;const a=(n=(e=i.pages[i.page])===null||e===void 0?void 0:e.slides[0])===null||n===void 0?void 0:n.index,u=r.getPageForSlide(a);this.markSelectedSlide(a),r.slideTo(u,r.prevPage===null&&i.prevPage===null?{friction:0}:void 0)}markSelectedSlide(e){const n=this.nav;n&&n.state===di.Ready&&(this.selectedIndex=e,[...n.slides].map(i=>{i.el&&i.el.classList[i.index===e?"add":"remove"]("is-nav-selected")}))}attach(){const e=this;let n=e.options.target,i=e.options.nav;n?e.addAsNavFor(n):i&&e.addAsTargetFor(i)}detach(){const e=this,n=e.nav,i=e.target;n&&(n.off("ready",e.onNavReady),n.off("createSlide",e.onNavCreateSlide),n.off("Panzoom.click",e.onNavClick),n.off("Panzoom.touchEnd",e.onNavTouch)),e.nav=null,i&&(i.off("ready",e.onTargetReady),i.off("refresh",e.onTargetChange),i.off("change",e.onTargetChange)),e.target=null}}Object.defineProperty(cv,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{friction:.35}});const yz={Navigation:lv,Dots:sv,Sync:cv},Zp="animationend",uv="isSelected",Yp="slide";class da extends dy{get axis(){return this.isHorizontal?"e":"f"}get isEnabled(){return this.state===di.Ready}get isInfinite(){let e=!1;const{contentDim:n,viewportDim:i,pages:r,slides:a}=this,u=a[0];return r.length>=2&&u&&n+u.dim>=i&&(e=this.option("infinite")),e}get isRTL(){return this.option("direction")==="rtl"}get isHorizontal(){return this.option("axis")==="x"}constructor(e,n={},i={}){if(super(),Object.defineProperty(this,"bp",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"lp",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"userOptions",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"userPlugins",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:di.Init}),Object.defineProperty(this,"page",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"prevPage",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"container",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"viewport",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"track",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"slides",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"pages",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"panzoom",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"inTransition",{enumerable:!0,configurable:!0,writable:!0,value:new Set}),Object.defineProperty(this,"contentDim",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"viewportDim",{enumerable:!0,configurable:!0,writable:!0,value:0}),typeof e=="string"&&(e=document.querySelector(e)),!e||!Mr(e))throw new Error("No Element found");this.container=e,this.slideNext=rv(this.slideNext.bind(this),150),this.slidePrev=rv(this.slidePrev.bind(this),150),this.userOptions=n,this.userPlugins=i,queueMicrotask(()=>{this.processOptions()})}processOptions(){var e,n;const i=Tr({},da.defaults,this.userOptions);let r="";const a=i.breakpoints;if(a&&uy(a))for(const[u,l]of Object.entries(a))window.matchMedia(u).matches&&uy(l)&&(r+=u,Tr(i,l));r===this.bp&&this.state!==di.Init||(this.bp=r,this.state===di.Ready&&(i.initialSlide=((n=(e=this.pages[this.page])===null||e===void 0?void 0:e.slides[0])===null||n===void 0?void 0:n.index)||0),this.state!==di.Init&&this.destroy(),super.setOptions(i),this.option("enabled")===!1?this.attachEvents():setTimeout(()=>{this.init()},0))}init(){this.state=di.Init,this.emit("init"),this.attachPlugins(Object.assign(Object.assign({},da.Plugins),this.userPlugins)),this.emit("attachPlugins"),this.initLayout(),this.initSlides(),this.updateMetrics(),this.setInitialPosition(),this.initPanzoom(),this.attachEvents(),this.state=di.Ready,this.emit("ready")}initLayout(){const{container:e}=this,n=this.option("classes");Ct(e,this.cn("container")),ts(e,n.isLTR,!this.isRTL),ts(e,n.isRTL,this.isRTL),ts(e,n.isVertical,!this.isHorizontal),ts(e,n.isHorizontal,this.isHorizontal);let i=this.option("viewport")||e.querySelector(`.${n.viewport}`);i||(i=document.createElement("div"),Ct(i,n.viewport),i.append(...ov(e,`.${n.slide}`)),e.prepend(i)),i.addEventListener("scroll",this.onScroll);let r=this.option("track")||e.querySelector(`.${n.track}`);r||(r=document.createElement("div"),Ct(r,n.track),r.append(...Array.from(i.childNodes))),r.setAttribute("aria-live","polite"),i.contains(r)||i.prepend(r),this.viewport=i,this.track=r,this.emit("initLayout")}initSlides(){const{track:e}=this;if(!e)return;const n=[...this.slides],i=[];[...ov(e,`.${this.cn(Yp)}`)].forEach(r=>{if(Mr(r)){const a=gy({el:r,isDom:!0,index:this.slides.length});i.push(a)}});for(let r of[...this.option("slides",[])||[],...n])i.push(gy(r));this.slides=i;for(let r=0;r<this.slides.length;r++)this.slides[r].index=r;for(const r of i)this.emit("beforeInitSlide",r,r.index),this.emit("initSlide",r,r.index);this.emit("initSlides")}setInitialPage(){const e=this.option("initialSlide");this.page=typeof e=="number"?this.getPageForSlide(e):parseInt(this.option("initialPage",0)+"",10)||0}setInitialPosition(){const{track:e,pages:n,isHorizontal:i}=this;if(!e||!n.length)return;let r=this.page;n[r]||(this.page=r=0);const a=(n[r].pos||0)*(this.isRTL&&i?1:-1),u=i?`${a}px`:"0",l=i?"0":`${a}px`;e.style.transform=`translate3d(${u}, ${l}, 0) scale(1)`,this.option("adaptiveHeight")&&this.setViewportHeight()}initPanzoom(){this.panzoom&&(this.panzoom.destroy(),this.panzoom=null);const e=this.option("Panzoom")||{};this.panzoom=new ha(this.viewport,Tr({},{content:this.track,zoom:!1,panOnlyZoomed:!1,lockAxis:this.isHorizontal?"x":"y",infinite:this.isInfinite,click:!1,dblClick:!1,touch:n=>!(this.pages.length<2&&!n.options.infinite),bounds:()=>this.getBounds(),maxVelocity:n=>Math.abs(n.target[this.axis]-n.current[this.axis])<2*this.viewportDim?100:0},e)),this.panzoom.on("*",(n,i,...r)=>{this.emit(`Panzoom.${i}`,n,...r)}),this.panzoom.on("decel",this.onDecel),this.panzoom.on("refresh",this.onRefresh),this.panzoom.on("beforeTransform",this.onBeforeTransform),this.panzoom.on("endAnimation",this.onEndAnimation)}attachEvents(){const e=this.container;e&&(e.addEventListener("click",this.onClick,{passive:!1,capture:!1}),e.addEventListener("slideTo",this.onSlideTo)),window.addEventListener("resize",this.onResize)}createPages(){let e=[];const{contentDim:n,viewportDim:i}=this;let r=this.option("slidesPerPage");r=(r==="auto"||n<=i)&&this.option("fill")!==!1?1/0:parseFloat(r+"");let a=0,u=0,l=0;for(const g of this.slides)(!e.length||u+g.dim-i>.05||l>=r)&&(e.push(mz()),a=e.length-1,u=0,l=0),e[a].slides.push(g),u+=g.dim+g.gap,l++;return e}processPages(){const e=this.pages,{contentDim:n,viewportDim:i,isInfinite:r}=this,a=this.option("center"),u=this.option("fill"),l=u&&a&&n>i&&!r;if(e.forEach((w,E)=>{var C;w.index=E,w.pos=((C=w.slides[0])===null||C===void 0?void 0:C.pos)||0,w.dim=0;for(const[P,D]of w.slides.entries())w.dim+=D.dim,P<w.slides.length-1&&(w.dim+=D.gap);l&&w.pos+.5*w.dim<.5*i?w.pos=0:l&&w.pos+.5*w.dim>=n-.5*i?w.pos=n-i:a&&(w.pos+=-.5*(i-w.dim))}),e.forEach(w=>{u&&!r&&n>i&&(w.pos=Math.max(w.pos,0),w.pos=Math.min(w.pos,n-i)),w.pos=lt(w.pos,1e3),w.dim=lt(w.dim,1e3),Math.abs(w.pos)<=.1&&(w.pos=0)}),r)return e;const g=[];let b;return e.forEach(w=>{const E=Object.assign({},w);b&&E.pos===b.pos?(b.dim+=E.dim,b.slides=[...b.slides,...E.slides]):(E.index=g.length,b=E,g.push(E))}),g}getPageFromIndex(e=0){const n=this.pages.length;let i;return e=parseInt((e||0).toString())||0,i=this.isInfinite?(e%n+n)%n:Math.max(Math.min(e,n-1),0),i}getSlideMetrics(e){var n,i;const r=this.isHorizontal?"width":"height";let a=0,u=0,l=e.el;const g=!(!l||l.parentNode);if(l?a=parseFloat(l.dataset[r]||"")||0:(l=document.createElement("div"),l.style.visibility="hidden",(this.track||document.body).prepend(l)),Ct(l,this.cn(Yp)+" "+e.class+" "+e.customClass),a)l.style[r]=`${a}px`,l.style[r==="width"?"height":"width"]="";else{g&&(this.track||document.body).prepend(l),a=l.getBoundingClientRect()[r]*Math.max(1,((n=window.visualViewport)===null||n===void 0?void 0:n.scale)||1);let w=l[this.isHorizontal?"offsetWidth":"offsetHeight"];w-1>a&&(a=w)}const b=getComputedStyle(l);return b.boxSizing==="content-box"&&(this.isHorizontal?(a+=parseFloat(b.paddingLeft)||0,a+=parseFloat(b.paddingRight)||0):(a+=parseFloat(b.paddingTop)||0,a+=parseFloat(b.paddingBottom)||0)),u=parseFloat(b[this.isHorizontal?"marginRight":"marginBottom"])||0,g?(i=l.parentElement)===null||i===void 0||i.removeChild(l):e.el||l.remove(),{dim:lt(a,1e3),gap:lt(u,1e3)}}getBounds(){const{isInfinite:e,isRTL:n,isHorizontal:i,pages:r}=this;let a={min:0,max:0};if(e)a={min:-1/0,max:1/0};else if(r.length){const u=r[0].pos,l=r[r.length-1].pos;a=n&&i?{min:u,max:l}:{min:-1*l,max:-1*u}}return{x:i?a:{min:0,max:0},y:i?{min:0,max:0}:a}}repositionSlides(){let e,{isHorizontal:n,isRTL:i,isInfinite:r,viewport:a,viewportDim:u,contentDim:l,page:g,pages:b,slides:w,panzoom:E}=this,C=0,P=0,D=0,R=0;E?R=-1*E.current[this.axis]:b[g]&&(R=b[g].pos||0),e=n?i?"right":"left":"top",i&&n&&(R*=-1);for(const G of w){const Q=G.el;Q?(e==="top"?(Q.style.right="",Q.style.left=""):Q.style.top="",G.index!==C?Q.style[e]=P===0?"":`${lt(P,1e3)}px`:Q.style[e]="",D+=G.dim+G.gap,C++):P+=G.dim+G.gap}if(r&&D&&a){let G=getComputedStyle(a),Q="padding",Ie=n?"Right":"Bottom",ve=parseFloat(G[Q+(n?"Left":"Top")]);R-=ve,u+=ve,u+=parseFloat(G[Q+Ie]);for(const Se of w)Se.el&&(lt(Se.pos)<lt(u)&&lt(Se.pos+Se.dim+Se.gap)<lt(R)&&lt(R)>lt(l-u)&&(Se.el.style[e]=`${lt(P+D,1e3)}px`),lt(Se.pos+Se.gap)>=lt(l-u)&&lt(Se.pos)>lt(R+u)&&lt(R)<lt(u)&&(Se.el.style[e]=`-${lt(D,1e3)}px`))}let $,W,te=[...this.inTransition];if(te.length>1&&($=b[te[0]],W=b[te[1]]),$&&W){let G=0;for(const Q of w)Q.el?this.inTransition.has(Q.index)&&$.slides.indexOf(Q)<0&&(Q.el.style[e]=`${lt(G+($.pos-W.pos),1e3)}px`):G+=Q.dim+Q.gap}}createSlideEl(e){const{track:n,slides:i}=this;if(!n||!e||e.el&&e.el.parentNode)return;const r=e.el||document.createElement("div");Ct(r,this.cn(Yp)),Ct(r,e.class),Ct(r,e.customClass);const a=e.html;a&&(a instanceof HTMLElement?r.appendChild(a):r.innerHTML=e.html+"");const u=[];i.forEach((w,E)=>{w.el&&u.push(E)});const l=e.index;let g=null;u.length&&(g=i[u.reduce((w,E)=>Math.abs(E-l)<Math.abs(w-l)?E:w)]);const b=g&&g.el&&g.el.parentNode?g.index<e.index?g.el.nextSibling:g.el:null;n.insertBefore(r,n.contains(b)?b:null),e.el=r,this.emit("createSlide",e)}removeSlideEl(e,n=!1){const i=e==null?void 0:e.el;if(!i||!i.parentNode)return;const r=this.cn(uv);if(i.classList.contains(r)&&(En(i,r),this.emit("unselectSlide",e)),e.isDom&&!n)return i.removeAttribute("aria-hidden"),i.removeAttribute("data-index"),void(i.style.left="");this.emit("removeSlide",e);const a=new CustomEvent(Zp);i.dispatchEvent(a),e.el&&(e.el.remove(),e.el=null)}transitionTo(e=0,n=this.option("transition")){var i,r,a,u;if(!n)return!1;const l=this.page,{pages:g,panzoom:b}=this;e=parseInt((e||0).toString())||0;const w=this.getPageFromIndex(e);if(!b||!g[w]||g.length<2||Math.abs((((r=(i=g[l])===null||i===void 0?void 0:i.slides[0])===null||r===void 0?void 0:r.dim)||0)-this.viewportDim)>1)return!1;let E=e>l?1:-1;this.isInfinite&&(l===0&&e===g.length-1&&(E=-1),l===g.length-1&&e===0&&(E=1));const C=g[w].pos*(this.isRTL?1:-1);if(l===w&&Math.abs(C-b.target[this.axis])<1)return!1;this.clearTransitions();const P=b.isResting;Ct(this.container,this.cn("inTransition"));const D=((a=g[l])===null||a===void 0?void 0:a.slides[0])||null,R=((u=g[w])===null||u===void 0?void 0:u.slides[0])||null;this.inTransition.add(R.index),this.createSlideEl(R);let $=D.el,W=R.el;P||n===Yp||(n="fadeFast",$=null);const te=this.isRTL?"next":"prev",G=this.isRTL?"prev":"next";return $&&(this.inTransition.add(D.index),D.transition=n,$.addEventListener(Zp,this.onAnimationEnd),$.classList.add(`f-${n}Out`,`to-${E>0?G:te}`)),W&&(R.transition=n,W.addEventListener(Zp,this.onAnimationEnd),W.classList.add(`f-${n}In`,`from-${E>0?te:G}`)),b.current[this.axis]=C,b.target[this.axis]=C,b.requestTick(),this.onChange(w),!0}manageSlideVisiblity(){const e=new Set,n=new Set,i=this.getVisibleSlides(parseFloat(this.option("preload",0)+"")||0);for(const r of this.slides)i.has(r)?e.add(r):n.add(r);for(const r of this.inTransition)e.add(this.slides[r]);for(const r of e)this.createSlideEl(r),this.lazyLoadSlide(r);for(const r of n)e.has(r)||this.removeSlideEl(r);this.markSelectedSlides(),this.repositionSlides()}markSelectedSlides(){if(!this.pages[this.page]||!this.pages[this.page].slides)return;const e="aria-hidden";let n=this.cn(uv);if(n)for(const i of this.slides){const r=i.el;r&&(r.dataset.index=`${i.index}`,r.classList.contains("f-thumbs__slide")?this.getVisibleSlides(0).has(i)?r.removeAttribute(e):r.setAttribute(e,"true"):this.pages[this.page].slides.includes(i)?(r.classList.contains(n)||(Ct(r,n),this.emit("selectSlide",i)),r.removeAttribute(e)):(r.classList.contains(n)&&(En(r,n),this.emit("unselectSlide",i)),r.setAttribute(e,"true")))}}flipInfiniteTrack(){const{axis:e,isHorizontal:n,isInfinite:i,isRTL:r,viewportDim:a,contentDim:u}=this,l=this.panzoom;if(!l||!i)return;let g=l.current[e],b=l.target[e]-g,w=0,E=.5*a;r&&n?(g<-E&&(w=-1,g+=u),g>u-E&&(w=1,g-=u)):(g>E&&(w=1,g-=u),g<-u+E&&(w=-1,g+=u)),w&&(l.current[e]=g,l.target[e]=g+b)}lazyLoadImg(e,n){const i=this,r="f-fadeIn",a="is-preloading";let u=!1,l=null;const g=()=>{u||(u=!0,l&&(l.remove(),l=null),En(n,a),n.complete&&(Ct(n,r),setTimeout(()=>{En(n,r)},350)),this.option("adaptiveHeight")&&e.el&&this.pages[this.page].slides.indexOf(e)>-1&&(i.updateMetrics(),i.setViewportHeight()),this.emit("load",e))};Ct(n,a),n.src=n.dataset.lazySrcset||n.dataset.lazySrc||"",delete n.dataset.lazySrc,delete n.dataset.lazySrcset,n.addEventListener("error",()=>{g()}),n.addEventListener("load",()=>{g()}),setTimeout(()=>{const b=n.parentNode;b&&e.el&&(n.complete?g():u||(l=es(py),b.insertBefore(l,n)))},300)}lazyLoadSlide(e){const n=e&&e.el;if(!n)return;const i=new Set;let r=Array.from(n.querySelectorAll("[data-lazy-src],[data-lazy-srcset]"));n.dataset.lazySrc&&r.push(n),r.map(a=>{a instanceof HTMLImageElement?i.add(a):a instanceof HTMLElement&&a.dataset.lazySrc&&(a.style.backgroundImage=`url('${a.dataset.lazySrc}')`,delete a.dataset.lazySrc)});for(const a of i)this.lazyLoadImg(e,a)}onAnimationEnd(e){var n;const i=e.target,r=i?parseInt(i.dataset.index||"",10)||0:-1,a=this.slides[r],u=e.animationName;if(!i||!a||!u)return;const l=!!this.inTransition.has(r)&&a.transition;l&&u.substring(0,l.length+2)===`f-${l}`&&this.inTransition.delete(r),this.inTransition.size||this.clearTransitions(),r===this.page&&(!((n=this.panzoom)===null||n===void 0)&&n.isResting)&&this.emit("settle")}onDecel(e,n=0,i=0,r=0,a=0){if(this.option("dragFree"))return void this.setPageFromPosition();const{isRTL:u,isHorizontal:l,axis:g,pages:b}=this,w=b.length,E=Math.abs(Math.atan2(i,n)/(Math.PI/180));let C=0;if(C=E>45&&E<135?l?0:i:l?n:0,!w)return;let P=this.page,D=u&&l?1:-1;const R=e.current[g]*D;let{pageIndex:$}=this.getPageFromPosition(R);Math.abs(C)>5?(b[P].dim<document.documentElement["client"+(this.isHorizontal?"Width":"Height")]-1&&(P=$),P=u&&l?C<0?P-1:P+1:C<0?P+1:P-1):P=r===0&&a===0?P:$,this.slideTo(P,{transition:!1,friction:e.option("decelFriction")})}onClick(e){const n=e.target,i=n&&Mr(n)?n.dataset:null;let r,a;i&&(i.carouselPage!==void 0?(a="slideTo",r=i.carouselPage):i.carouselNext!==void 0?a="slideNext":i.carouselPrev!==void 0&&(a="slidePrev")),a?(e.preventDefault(),e.stopPropagation(),n&&!n.hasAttribute("disabled")&&this[a](r)):this.emit("click",e)}onSlideTo(e){const n=e.detail||0;this.slideTo(this.getPageForSlide(n),{friction:0})}onChange(e,n=0){const i=this.page;this.prevPage=i,this.page=e,this.option("adaptiveHeight")&&this.setViewportHeight(),e!==i&&(this.markSelectedSlides(),this.emit("change",e,i,n))}onRefresh(){let e=this.contentDim,n=this.viewportDim;this.updateMetrics(),this.contentDim===e&&this.viewportDim===n||this.slideTo(this.page,{friction:0,transition:!1})}onScroll(){var e;(e=this.viewport)===null||e===void 0||e.scroll(0,0)}onResize(){this.option("breakpoints")&&this.processOptions()}onBeforeTransform(e){this.lp!==e.current[this.axis]&&(this.flipInfiniteTrack(),this.manageSlideVisiblity()),this.lp=e.current.e}onEndAnimation(){this.inTransition.size||this.emit("settle")}reInit(e=null,n=null){this.destroy(),this.state=di.Init,this.prevPage=null,this.userOptions=e||this.userOptions,this.userPlugins=n||this.userPlugins,this.processOptions()}slideTo(e=0,{friction:n=this.option("friction"),transition:i=this.option("transition")}={}){if(this.state===di.Destroy)return;e=parseInt((e||0).toString())||0;const r=this.getPageFromIndex(e),{axis:a,isHorizontal:u,isRTL:l,pages:g,panzoom:b}=this,w=g.length,E=l&&u?1:-1;if(!b||!w)return;if(this.page!==r){const P=new Event("beforeChange",{bubbles:!0,cancelable:!0});if(this.emit("beforeChange",P,e),P.defaultPrevented)return}if(this.transitionTo(e,i))return;let C=g[r].pos;if(this.isInfinite){const P=this.contentDim,D=b.target[a]*E;w===2?C+=P*Math.floor(parseFloat(e+"")/2):C=[C,C-P,C+P].reduce(function(R,$){return Math.abs($-D)<Math.abs(R-D)?$:R})}C*=E,Math.abs(b.target[a]-C)<1||(b.panTo({x:u?C:0,y:u?0:C,friction:n}),this.onChange(r))}slideToClosest(e){if(this.panzoom){const{pageIndex:n}=this.getPageFromPosition();this.slideTo(n,e)}}slideNext(){this.slideTo(this.page+1)}slidePrev(){this.slideTo(this.page-1)}clearTransitions(){this.inTransition.clear(),En(this.container,this.cn("inTransition"));const e=["to-prev","to-next","from-prev","from-next"];for(const n of this.slides){const i=n.el;if(i){i.removeEventListener(Zp,this.onAnimationEnd),i.classList.remove(...e);const r=n.transition;r&&i.classList.remove(`f-${r}Out`,`f-${r}In`)}}this.manageSlideVisiblity()}addSlide(e,n){var i,r,a,u;const l=this.panzoom,g=((i=this.pages[this.page])===null||i===void 0?void 0:i.pos)||0,b=((r=this.pages[this.page])===null||r===void 0?void 0:r.dim)||0,w=this.contentDim<this.viewportDim;let E=Array.isArray(n)?n:[n];const C=[];for(const P of E)C.push(gy(P));this.slides.splice(e,0,...C);for(let P=0;P<this.slides.length;P++)this.slides[P].index=P;for(const P of C)this.emit("beforeInitSlide",P,P.index);if(this.page>=e&&(this.page+=C.length),this.updateMetrics(),l){const P=((a=this.pages[this.page])===null||a===void 0?void 0:a.pos)||0,D=((u=this.pages[this.page])===null||u===void 0?void 0:u.dim)||0,R=this.pages.length||1,$=this.isRTL?b-D:D-b,W=this.isRTL?g-P:P-g;w&&R===1?(e<=this.page&&(l.current[this.axis]-=$,l.target[this.axis]-=$),l.panTo({[this.isHorizontal?"x":"y"]:-1*P})):W&&e<=this.page&&(l.target[this.axis]-=W,l.current[this.axis]-=W,l.requestTick())}for(const P of C)this.emit("initSlide",P,P.index)}prependSlide(e){this.addSlide(0,e)}appendSlide(e){this.addSlide(this.slides.length,e)}removeSlide(e){const n=this.slides.length;e=(e%n+n)%n;const i=this.slides[e];if(i){this.removeSlideEl(i,!0),this.slides.splice(e,1);for(let r=0;r<this.slides.length;r++)this.slides[r].index=r;this.updateMetrics(),this.slideTo(this.page,{friction:0,transition:!1}),this.emit("destroySlide",i)}}updateMetrics(){const{panzoom:e,viewport:n,track:i,slides:r,isHorizontal:a,isInfinite:u}=this;if(!i)return;const l=a?"width":"height",g=a?"offsetWidth":"offsetHeight";if(n){let E=Math.max(n[g],lt(n.getBoundingClientRect()[l],1e3)),C=getComputedStyle(n),P="padding",D=a?"Right":"Bottom";E-=parseFloat(C[P+(a?"Left":"Top")])+parseFloat(C[P+D]),this.viewportDim=E}let b,w=0;for(const[E,C]of r.entries()){let P=0,D=0;!C.el&&b?(P=b.dim,D=b.gap):({dim:P,gap:D}=this.getSlideMetrics(C),b=C),P=lt(P,1e3),D=lt(D,1e3),C.dim=P,C.gap=D,C.pos=w,w+=P,(u||E<r.length-1)&&(w+=D)}w=lt(w,1e3),this.contentDim=w,e&&(e.contentRect[l]=w,e.contentRect[a?"fullWidth":"fullHeight"]=w),this.pages=this.createPages(),this.pages=this.processPages(),this.state===di.Init&&this.setInitialPage(),this.page=Math.max(0,Math.min(this.page,this.pages.length-1)),this.manageSlideVisiblity(),this.emit("refresh")}getProgress(e,n=!1,i=!1){e===void 0&&(e=this.page);const r=this,a=r.panzoom,u=r.contentDim,l=r.pages[e]||0;if(!l||!a)return e>this.page?-1:1;let g=-1*a.current.e,b=lt((g-l.pos)/(1*l.dim),1e3),w=b,E=b;this.isInfinite&&i!==!0&&(w=lt((g-l.pos+u)/(1*l.dim),1e3),E=lt((g-l.pos-u)/(1*l.dim),1e3));let C=[b,w,E].reduce(function(P,D){return Math.abs(D)<Math.abs(P)?D:P});return n?C:C>1?1:C<-1?-1:C}setViewportHeight(){const{page:e,pages:n,viewport:i,isHorizontal:r}=this;if(!i||!n[e])return;let a=0;r&&this.track&&(this.track.style.height="auto",n[e].slides.forEach(u=>{u.el&&(a=Math.max(a,u.el.offsetHeight))})),i.style.height=a?`${a}px`:""}getPageForSlide(e){for(const n of this.pages)for(const i of n.slides)if(i.index===e)return n.index;return-1}getVisibleSlides(e=0){var n;const i=new Set;let{panzoom:r,contentDim:a,viewportDim:u,pages:l,page:g}=this;if(u){a=a+((n=this.slides[this.slides.length-1])===null||n===void 0?void 0:n.gap)||0;let b=0;b=r&&r.state!==In.Init&&r.state!==In.Destroy?-1*r.current[this.axis]:l[g]&&l[g].pos||0,this.isInfinite&&(b-=Math.floor(b/a)*a),this.isRTL&&this.isHorizontal&&(b*=-1);const w=b-u*e,E=b+u*(e+1),C=this.isInfinite?[-1,0,1]:[0];for(const P of this.slides)for(const D of C){const R=P.pos+D*a,$=R+P.dim+P.gap;R<E&&$>w&&i.add(P)}}return i}getPageFromPosition(e){const{viewportDim:n,contentDim:i,slides:r,pages:a,panzoom:u}=this,l=a.length,g=r.length,b=r[0],w=r[g-1],E=this.option("center");let C=0,P=0,D=0,R=e===void 0?-1*((u==null?void 0:u.target[this.axis])||0):e;E&&(R+=.5*n),this.isInfinite?(R<b.pos-.5*w.gap&&(R-=i,D=-1),R>w.pos+w.dim+.5*w.gap&&(R-=i,D=1)):R=Math.max(b.pos||0,Math.min(R,w.pos));let $=w,W=r.find(te=>{const G=te.pos-.5*$.gap,Q=te.pos+te.dim+.5*te.gap;return $=te,R>=G&&R<Q});return W||(W=w),P=this.getPageForSlide(W.index),C=P+D*l,{page:C,pageIndex:P}}setPageFromPosition(){const{pageIndex:e}=this.getPageFromPosition();this.onChange(e)}destroy(){if([di.Destroy].includes(this.state))return;this.state=di.Destroy;const{container:e,viewport:n,track:i,slides:r,panzoom:a}=this,u=this.option("classes");e.removeEventListener("click",this.onClick,{passive:!1,capture:!1}),e.removeEventListener("slideTo",this.onSlideTo),window.removeEventListener("resize",this.onResize),a&&(a.destroy(),this.panzoom=null),r&&r.forEach(g=>{this.removeSlideEl(g)}),this.detachPlugins(),n&&(n.removeEventListener("scroll",this.onScroll),n.offsetParent&&i&&i.offsetParent&&n.replaceWith(...i.childNodes));for(const[g,b]of Object.entries(u))g!=="container"&&b&&e.classList.remove(b);this.track=null,this.viewport=null,this.page=0,this.slides=[];const l=this.events.get("ready");this.events=new Map,l&&this.events.set("ready",l)}}Object.defineProperty(da,"Panzoom",{enumerable:!0,configurable:!0,writable:!0,value:ha}),Object.defineProperty(da,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:fz}),Object.defineProperty(da,"Plugins",{enumerable:!0,configurable:!0,writable:!0,value:yz});const hv=function(t){if(!Mr(t))return 0;const e=window.scrollY,n=window.innerHeight,i=e+n,r=t.getBoundingClientRect(),a=r.y+e,u=r.height,l=a+u;if(e>l||i<a)return 0;if(e<a&&i>l||a<e&&l>i)return 100;let g=u;a<e&&(g-=e-a),l>i&&(g-=l-i);const b=g/n*100;return Math.round(b)},mh=!(typeof window>"u"||!window.document||!window.document.createElement);let yy;const _y=["a[href]","area[href]",'input:not([disabled]):not([type="hidden"]):not([aria-hidden])',"select:not([disabled]):not([aria-hidden])","textarea:not([disabled]):not([aria-hidden])","button:not([disabled]):not([aria-hidden]):not(.fancybox-focus-guard)","iframe","object","embed","video","audio","[contenteditable]",'[tabindex]:not([tabindex^="-"]):not([disabled]):not([aria-hidden])'].join(","),dv=t=>{if(t&&mh){yy===void 0&&document.createElement("div").focus({get preventScroll(){return yy=!0,!1}});try{if(yy)t.focus({preventScroll:!0});else{const e=window.scrollY||document.body.scrollTop,n=window.scrollX||document.body.scrollLeft;t.focus(),document.body.scrollTo({top:e,left:n,behavior:"auto"})}}catch{}}},pv=()=>{const t=document;let e,n="",i="",r="";return t.fullscreenEnabled?(n="requestFullscreen",i="exitFullscreen",r="fullscreenElement"):t.webkitFullscreenEnabled&&(n="webkitRequestFullscreen",i="webkitExitFullscreen",r="webkitFullscreenElement"),n&&(e={request:function(a=t.documentElement){return n==="webkitRequestFullscreen"?a[n](Element.ALLOW_KEYBOARD_INPUT):a[n]()},exit:function(){return t[r]&&t[i]()},isFullscreen:function(){return t[r]}}),e},by={animated:!0,autoFocus:!0,backdropClick:"close",Carousel:{classes:{container:"fancybox__carousel",viewport:"fancybox__viewport",track:"fancybox__track",slide:"fancybox__slide"}},closeButton:"auto",closeExisting:!1,commonCaption:!1,compact:()=>window.matchMedia("(max-width: 578px), (max-height: 578px)").matches,contentClick:"toggleZoom",contentDblClick:!1,defaultType:"image",defaultDisplay:"flex",dragToClose:!0,Fullscreen:{autoStart:!1},groupAll:!1,groupAttr:"data-fancybox",hideClass:"f-fadeOut",hideScrollbar:!0,idle:3500,keyboard:{Escape:"close",Delete:"close",Backspace:"close",PageUp:"next",PageDown:"prev",ArrowUp:"prev",ArrowDown:"next",ArrowRight:"next",ArrowLeft:"prev"},l10n:Object.assign(Object.assign({},ev),{CLOSE:"Close",NEXT:"Next",PREV:"Previous",MODAL:"You can close this modal content with the ESC key",ERROR:"Something Went Wrong, Please Try Again Later",IMAGE_ERROR:"Image Not Found",ELEMENT_NOT_FOUND:"HTML Element Not Found",AJAX_NOT_FOUND:"Error Loading AJAX : Not Found",AJAX_FORBIDDEN:"Error Loading AJAX : Forbidden",IFRAME_ERROR:"Error Loading Page",TOGGLE_ZOOM:"Toggle zoom level",TOGGLE_THUMBS:"Toggle thumbnails",TOGGLE_SLIDESHOW:"Toggle slideshow",TOGGLE_FULLSCREEN:"Toggle full-screen mode",DOWNLOAD:"Download"}),parentEl:null,placeFocusBack:!0,showClass:"f-zoomInUp",startIndex:0,tpl:{closeButton:'<button data-fancybox-close class="f-button is-close-btn" title="{{CLOSE}}"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" tabindex="-1"><path d="M20 20L4 4m16 0L4 20"/></svg></button>',main:`<div class="fancybox__container" role="dialog" aria-modal="true" aria-label="{{MODAL}}" tabindex="-1">
624
+ `),ne=I.createShader(I.FRAGMENT_SHADER);if(I.isContextLost())return void(this.failedToCreate=!0);if(I.shaderSource(ne,ce),I.compileShader(ne),!I.getShaderParameter(ne,I.COMPILE_STATUS))throw new Error(`Could not compile fragment shader: ${I.getShaderInfoLog(ne)}`);I.attachShader(this.program,ne);const me=I.createShader(I.VERTEX_SHADER);if(I.isContextLost())return void(this.failedToCreate=!0);if(I.shaderSource(me,he),I.compileShader(me),!I.getShaderParameter(me,I.COMPILE_STATUS))throw new Error(`Could not compile vertex shader: ${I.getShaderInfoLog(me)}`);I.attachShader(this.program,me),this.attributes={};const ge={};this.numAttributes=V.length;for(let xe=0;xe<this.numAttributes;xe++)V[xe]&&(I.bindAttribLocation(this.program,xe,V[xe]),this.attributes[V[xe]]=xe);if(I.linkProgram(this.program),!I.getProgramParameter(this.program,I.LINK_STATUS))throw new Error(`Program failed to link: ${I.getProgramInfoLog(this.program)}`);I.deleteShader(me),I.deleteShader(ne);for(let xe=0;xe<oe.length;xe++){const Be=oe[xe];if(Be&&!ge[Be]){const Fe=I.getUniformLocation(this.program,Be);Fe&&(ge[Be]=Fe)}}this.fixedUniforms=y(o,ge),this.terrainUniforms=((xe,Be)=>({u_depth:new l.aH(xe,Be.u_depth),u_terrain:new l.aH(xe,Be.u_terrain),u_terrain_dim:new l.aI(xe,Be.u_terrain_dim),u_terrain_matrix:new l.aJ(xe,Be.u_terrain_matrix),u_terrain_unpack:new l.aK(xe,Be.u_terrain_unpack),u_terrain_exaggeration:new l.aI(xe,Be.u_terrain_exaggeration)}))(o,ge),this.binderUniforms=m?m.getUniforms(o,ge):[]}draw(o,d,m,y,x,M,I,O,N,V,F,Z,J,ee,oe,le,ce,he){const ne=o.gl;if(this.failedToCreate)return;if(o.program.set(this.program),o.setDepthMode(m),o.setStencilMode(y),o.setColorMode(x),o.setCullFace(M),O){o.activeTexture.set(ne.TEXTURE2),ne.bindTexture(ne.TEXTURE_2D,O.depthTexture),o.activeTexture.set(ne.TEXTURE3),ne.bindTexture(ne.TEXTURE_2D,O.texture);for(const ge in this.terrainUniforms)this.terrainUniforms[ge].set(O[ge])}for(const ge in this.fixedUniforms)this.fixedUniforms[ge].set(I[ge]);oe&&oe.setUniforms(o,this.binderUniforms,J,{zoom:ee});let me=0;switch(d){case ne.LINES:me=2;break;case ne.TRIANGLES:me=3;break;case ne.LINE_STRIP:me=1}for(const ge of Z.get()){const xe=ge.vaos||(ge.vaos={});(xe[N]||(xe[N]=new Qh)).bind(o,this,V,oe?oe.getPaintVertexBuffers():[],F,ge.vertexOffset,le,ce,he),ne.drawElements(d,ge.primitiveLength*me,ne.UNSIGNED_SHORT,ge.primitiveOffset*me*2)}}}function iu(v,o,d){const m=1/Kt(d,1,o.transform.tileZoom),y=Math.pow(2,d.tileID.overscaledZ),x=d.tileSize*Math.pow(2,o.transform.tileZoom)/y,M=x*(d.tileID.canonical.x+d.tileID.wrap*y),I=x*d.tileID.canonical.y;return{u_image:0,u_texsize:d.imageAtlasTexture.size,u_scale:[m,v.fromScale,v.toScale],u_fade:v.t,u_pixel_coord_upper:[M>>16,I>>16],u_pixel_coord_lower:[65535&M,65535&I]}}const Vl=(v,o,d,m)=>{const y=o.style.light,x=y.properties.get("position"),M=[x.x,x.y,x.z],I=function(){var N=new l.A(9);return l.A!=Float32Array&&(N[1]=0,N[2]=0,N[3]=0,N[5]=0,N[6]=0,N[7]=0),N[0]=1,N[4]=1,N[8]=1,N}();y.properties.get("anchor")==="viewport"&&function(N,V){var F=Math.sin(V),Z=Math.cos(V);N[0]=Z,N[1]=F,N[2]=0,N[3]=-F,N[4]=Z,N[5]=0,N[6]=0,N[7]=0,N[8]=1}(I,-o.transform.angle),function(N,V,F){var Z=V[0],J=V[1],ee=V[2];N[0]=Z*F[0]+J*F[3]+ee*F[6],N[1]=Z*F[1]+J*F[4]+ee*F[7],N[2]=Z*F[2]+J*F[5]+ee*F[8]}(M,M,I);const O=y.properties.get("color");return{u_matrix:v,u_lightpos:M,u_lightintensity:y.properties.get("intensity"),u_lightcolor:[O.r,O.g,O.b],u_vertical_gradient:+d,u_opacity:m}},ru=(v,o,d,m,y,x,M)=>l.e(Vl(v,o,d,m),iu(x,o,M),{u_height_factor:-Math.pow(2,y.overscaledZ)/M.tileSize/8}),Da=v=>({u_matrix:v}),Jf=(v,o,d,m)=>l.e(Da(v),iu(d,o,m)),s_=(v,o)=>({u_matrix:v,u_world:o}),Qf=(v,o,d,m,y)=>l.e(Jf(v,o,d,m),{u_world:y}),a_=(v,o,d,m)=>{const y=v.transform;let x,M;if(m.paint.get("circle-pitch-alignment")==="map"){const I=Kt(d,1,y.zoom);x=!0,M=[I,I]}else x=!1,M=y.pixelsToGLUnits;return{u_camera_to_center_distance:y.cameraToCenterDistance,u_scale_with_map:+(m.paint.get("circle-pitch-scale")==="map"),u_matrix:v.translatePosMatrix(o.posMatrix,d,m.paint.get("circle-translate"),m.paint.get("circle-translate-anchor")),u_pitch_with_map:+x,u_device_pixel_ratio:v.pixelRatio,u_extrude_scale:M}},js=(v,o,d)=>({u_matrix:v,u_inv_matrix:o,u_camera_to_center_distance:d.cameraToCenterDistance,u_viewport_size:[d.width,d.height]}),Fl=(v,o,d=1)=>({u_matrix:v,u_color:o,u_overlay:0,u_overlay_scale:d}),nr=v=>({u_matrix:v}),ir=(v,o,d,m)=>({u_matrix:v,u_extrude_scale:Kt(o,1,d),u_intensity:m}),ou=(v,o,d,m)=>{const y=l.H();l.aP(y,0,v.width,v.height,0,0,1);const x=v.context.gl;return{u_matrix:y,u_world:[x.drawingBufferWidth,x.drawingBufferHeight],u_image:d,u_color_ramp:m,u_opacity:o.paint.get("heatmap-opacity")}};function su(v,o){const d=Math.pow(2,o.canonical.z),m=o.canonical.y;return[new l.Z(0,m/d).toLngLat().lat,new l.Z(0,(m+1)/d).toLngLat().lat]}const au=(v,o,d,m)=>{const y=v.transform;return{u_matrix:nm(v,o,d,m),u_ratio:1/Kt(o,1,y.zoom),u_device_pixel_ratio:v.pixelRatio,u_units_to_pixels:[1/y.pixelsToGLUnits[0],1/y.pixelsToGLUnits[1]]}},em=(v,o,d,m,y)=>l.e(au(v,o,d,y),{u_image:0,u_image_height:m}),Oa=(v,o,d,m,y)=>{const x=v.transform,M=tm(o,x);return{u_matrix:nm(v,o,d,y),u_texsize:o.imageAtlasTexture.size,u_ratio:1/Kt(o,1,x.zoom),u_device_pixel_ratio:v.pixelRatio,u_image:0,u_scale:[M,m.fromScale,m.toScale],u_fade:m.t,u_units_to_pixels:[1/x.pixelsToGLUnits[0],1/x.pixelsToGLUnits[1]]}},l_=(v,o,d,m,y,x)=>{const M=v.lineAtlas,I=tm(o,v.transform),O=d.layout.get("line-cap")==="round",N=M.getDash(m.from,O),V=M.getDash(m.to,O),F=N.width*y.fromScale,Z=V.width*y.toScale;return l.e(au(v,o,d,x),{u_patternscale_a:[I/F,-N.height/2],u_patternscale_b:[I/Z,-V.height/2],u_sdfgamma:M.width/(256*Math.min(F,Z)*v.pixelRatio)/2,u_image:0,u_tex_y_a:N.y,u_tex_y_b:V.y,u_mix:y.t})};function tm(v,o){return 1/Kt(v,1,o.tileZoom)}function nm(v,o,d,m){return v.translatePosMatrix(m?m.posMatrix:o.tileID.posMatrix,o,d.paint.get("line-translate"),d.paint.get("line-translate-anchor"))}const c_=(v,o,d,m,y)=>{return{u_matrix:v,u_tl_parent:o,u_scale_parent:d,u_buffer_scale:1,u_fade_t:m.mix,u_opacity:m.opacity*y.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:y.paint.get("raster-brightness-min"),u_brightness_high:y.paint.get("raster-brightness-max"),u_saturation_factor:(M=y.paint.get("raster-saturation"),M>0?1-1/(1.001-M):-M),u_contrast_factor:(x=y.paint.get("raster-contrast"),x>0?1/(1-x):1+x),u_spin_weights:u_(y.paint.get("raster-hue-rotate"))};var x,M};function u_(v){v*=Math.PI/180;const o=Math.sin(v),d=Math.cos(v);return[(2*d+1)/3,(-Math.sqrt(3)*o-d+1)/3,(Math.sqrt(3)*o-d+1)/3]}const im=(v,o,d,m,y,x,M,I,O,N,V,F,Z,J)=>{const ee=M.transform;return{u_is_size_zoom_constant:+(v==="constant"||v==="source"),u_is_size_feature_constant:+(v==="constant"||v==="camera"),u_size_t:o?o.uSizeT:0,u_size:o?o.uSize:0,u_camera_to_center_distance:ee.cameraToCenterDistance,u_pitch:ee.pitch/360*2*Math.PI,u_rotate_symbol:+d,u_aspect_ratio:ee.width/ee.height,u_fade_change:M.options.fadeDuration?M.symbolFadeChange:1,u_matrix:I,u_label_plane_matrix:O,u_coord_matrix:N,u_is_text:+F,u_pitch_with_map:+m,u_is_along_line:y,u_is_variable_anchor:x,u_texsize:Z,u_texture:0,u_translation:V,u_pitched_scale:J}},$l=(v,o,d,m,y,x,M,I,O,N,V,F,Z,J,ee)=>{const oe=M.transform;return l.e(im(v,o,d,m,y,x,M,I,O,N,V,F,Z,ee),{u_gamma_scale:m?Math.cos(oe._pitch)*oe.cameraToCenterDistance:1,u_device_pixel_ratio:M.pixelRatio,u_is_halo:+J})},nd=(v,o,d,m,y,x,M,I,O,N,V,F,Z,J)=>l.e($l(v,o,d,m,y,x,M,I,O,N,V,!0,F,!0,J),{u_texsize_icon:Z,u_texture_icon:1}),lu=(v,o,d)=>({u_matrix:v,u_opacity:o,u_color:d}),id=(v,o,d,m,y,x)=>l.e(function(M,I,O,N){const V=O.imageManager.getPattern(M.from.toString()),F=O.imageManager.getPattern(M.to.toString()),{width:Z,height:J}=O.imageManager.getPixelSize(),ee=Math.pow(2,N.tileID.overscaledZ),oe=N.tileSize*Math.pow(2,O.transform.tileZoom)/ee,le=oe*(N.tileID.canonical.x+N.tileID.wrap*ee),ce=oe*N.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:V.tl,u_pattern_br_a:V.br,u_pattern_tl_b:F.tl,u_pattern_br_b:F.br,u_texsize:[Z,J],u_mix:I.t,u_pattern_size_a:V.displaySize,u_pattern_size_b:F.displaySize,u_scale_a:I.fromScale,u_scale_b:I.toScale,u_tile_units_to_pixels:1/Kt(N,1,O.transform.tileZoom),u_pixel_coord_upper:[le>>16,ce>>16],u_pixel_coord_lower:[65535&le,65535&ce]}}(m,x,d,y),{u_matrix:v,u_opacity:o}),rd={fillExtrusion:(v,o)=>({u_matrix:new l.aJ(v,o.u_matrix),u_lightpos:new l.aN(v,o.u_lightpos),u_lightintensity:new l.aI(v,o.u_lightintensity),u_lightcolor:new l.aN(v,o.u_lightcolor),u_vertical_gradient:new l.aI(v,o.u_vertical_gradient),u_opacity:new l.aI(v,o.u_opacity)}),fillExtrusionPattern:(v,o)=>({u_matrix:new l.aJ(v,o.u_matrix),u_lightpos:new l.aN(v,o.u_lightpos),u_lightintensity:new l.aI(v,o.u_lightintensity),u_lightcolor:new l.aN(v,o.u_lightcolor),u_vertical_gradient:new l.aI(v,o.u_vertical_gradient),u_height_factor:new l.aI(v,o.u_height_factor),u_image:new l.aH(v,o.u_image),u_texsize:new l.aO(v,o.u_texsize),u_pixel_coord_upper:new l.aO(v,o.u_pixel_coord_upper),u_pixel_coord_lower:new l.aO(v,o.u_pixel_coord_lower),u_scale:new l.aN(v,o.u_scale),u_fade:new l.aI(v,o.u_fade),u_opacity:new l.aI(v,o.u_opacity)}),fill:(v,o)=>({u_matrix:new l.aJ(v,o.u_matrix)}),fillPattern:(v,o)=>({u_matrix:new l.aJ(v,o.u_matrix),u_image:new l.aH(v,o.u_image),u_texsize:new l.aO(v,o.u_texsize),u_pixel_coord_upper:new l.aO(v,o.u_pixel_coord_upper),u_pixel_coord_lower:new l.aO(v,o.u_pixel_coord_lower),u_scale:new l.aN(v,o.u_scale),u_fade:new l.aI(v,o.u_fade)}),fillOutline:(v,o)=>({u_matrix:new l.aJ(v,o.u_matrix),u_world:new l.aO(v,o.u_world)}),fillOutlinePattern:(v,o)=>({u_matrix:new l.aJ(v,o.u_matrix),u_world:new l.aO(v,o.u_world),u_image:new l.aH(v,o.u_image),u_texsize:new l.aO(v,o.u_texsize),u_pixel_coord_upper:new l.aO(v,o.u_pixel_coord_upper),u_pixel_coord_lower:new l.aO(v,o.u_pixel_coord_lower),u_scale:new l.aN(v,o.u_scale),u_fade:new l.aI(v,o.u_fade)}),circle:(v,o)=>({u_camera_to_center_distance:new l.aI(v,o.u_camera_to_center_distance),u_scale_with_map:new l.aH(v,o.u_scale_with_map),u_pitch_with_map:new l.aH(v,o.u_pitch_with_map),u_extrude_scale:new l.aO(v,o.u_extrude_scale),u_device_pixel_ratio:new l.aI(v,o.u_device_pixel_ratio),u_matrix:new l.aJ(v,o.u_matrix)}),collisionBox:(v,o)=>({u_matrix:new l.aJ(v,o.u_matrix),u_pixel_extrude_scale:new l.aO(v,o.u_pixel_extrude_scale)}),collisionCircle:(v,o)=>({u_matrix:new l.aJ(v,o.u_matrix),u_inv_matrix:new l.aJ(v,o.u_inv_matrix),u_camera_to_center_distance:new l.aI(v,o.u_camera_to_center_distance),u_viewport_size:new l.aO(v,o.u_viewport_size)}),debug:(v,o)=>({u_color:new l.aL(v,o.u_color),u_matrix:new l.aJ(v,o.u_matrix),u_overlay:new l.aH(v,o.u_overlay),u_overlay_scale:new l.aI(v,o.u_overlay_scale)}),clippingMask:(v,o)=>({u_matrix:new l.aJ(v,o.u_matrix)}),heatmap:(v,o)=>({u_extrude_scale:new l.aI(v,o.u_extrude_scale),u_intensity:new l.aI(v,o.u_intensity),u_matrix:new l.aJ(v,o.u_matrix)}),heatmapTexture:(v,o)=>({u_matrix:new l.aJ(v,o.u_matrix),u_world:new l.aO(v,o.u_world),u_image:new l.aH(v,o.u_image),u_color_ramp:new l.aH(v,o.u_color_ramp),u_opacity:new l.aI(v,o.u_opacity)}),hillshade:(v,o)=>({u_matrix:new l.aJ(v,o.u_matrix),u_image:new l.aH(v,o.u_image),u_latrange:new l.aO(v,o.u_latrange),u_light:new l.aO(v,o.u_light),u_shadow:new l.aL(v,o.u_shadow),u_highlight:new l.aL(v,o.u_highlight),u_accent:new l.aL(v,o.u_accent)}),hillshadePrepare:(v,o)=>({u_matrix:new l.aJ(v,o.u_matrix),u_image:new l.aH(v,o.u_image),u_dimension:new l.aO(v,o.u_dimension),u_zoom:new l.aI(v,o.u_zoom),u_unpack:new l.aK(v,o.u_unpack)}),line:(v,o)=>({u_matrix:new l.aJ(v,o.u_matrix),u_ratio:new l.aI(v,o.u_ratio),u_device_pixel_ratio:new l.aI(v,o.u_device_pixel_ratio),u_units_to_pixels:new l.aO(v,o.u_units_to_pixels)}),lineGradient:(v,o)=>({u_matrix:new l.aJ(v,o.u_matrix),u_ratio:new l.aI(v,o.u_ratio),u_device_pixel_ratio:new l.aI(v,o.u_device_pixel_ratio),u_units_to_pixels:new l.aO(v,o.u_units_to_pixels),u_image:new l.aH(v,o.u_image),u_image_height:new l.aI(v,o.u_image_height)}),linePattern:(v,o)=>({u_matrix:new l.aJ(v,o.u_matrix),u_texsize:new l.aO(v,o.u_texsize),u_ratio:new l.aI(v,o.u_ratio),u_device_pixel_ratio:new l.aI(v,o.u_device_pixel_ratio),u_image:new l.aH(v,o.u_image),u_units_to_pixels:new l.aO(v,o.u_units_to_pixels),u_scale:new l.aN(v,o.u_scale),u_fade:new l.aI(v,o.u_fade)}),lineSDF:(v,o)=>({u_matrix:new l.aJ(v,o.u_matrix),u_ratio:new l.aI(v,o.u_ratio),u_device_pixel_ratio:new l.aI(v,o.u_device_pixel_ratio),u_units_to_pixels:new l.aO(v,o.u_units_to_pixels),u_patternscale_a:new l.aO(v,o.u_patternscale_a),u_patternscale_b:new l.aO(v,o.u_patternscale_b),u_sdfgamma:new l.aI(v,o.u_sdfgamma),u_image:new l.aH(v,o.u_image),u_tex_y_a:new l.aI(v,o.u_tex_y_a),u_tex_y_b:new l.aI(v,o.u_tex_y_b),u_mix:new l.aI(v,o.u_mix)}),raster:(v,o)=>({u_matrix:new l.aJ(v,o.u_matrix),u_tl_parent:new l.aO(v,o.u_tl_parent),u_scale_parent:new l.aI(v,o.u_scale_parent),u_buffer_scale:new l.aI(v,o.u_buffer_scale),u_fade_t:new l.aI(v,o.u_fade_t),u_opacity:new l.aI(v,o.u_opacity),u_image0:new l.aH(v,o.u_image0),u_image1:new l.aH(v,o.u_image1),u_brightness_low:new l.aI(v,o.u_brightness_low),u_brightness_high:new l.aI(v,o.u_brightness_high),u_saturation_factor:new l.aI(v,o.u_saturation_factor),u_contrast_factor:new l.aI(v,o.u_contrast_factor),u_spin_weights:new l.aN(v,o.u_spin_weights)}),symbolIcon:(v,o)=>({u_is_size_zoom_constant:new l.aH(v,o.u_is_size_zoom_constant),u_is_size_feature_constant:new l.aH(v,o.u_is_size_feature_constant),u_size_t:new l.aI(v,o.u_size_t),u_size:new l.aI(v,o.u_size),u_camera_to_center_distance:new l.aI(v,o.u_camera_to_center_distance),u_pitch:new l.aI(v,o.u_pitch),u_rotate_symbol:new l.aH(v,o.u_rotate_symbol),u_aspect_ratio:new l.aI(v,o.u_aspect_ratio),u_fade_change:new l.aI(v,o.u_fade_change),u_matrix:new l.aJ(v,o.u_matrix),u_label_plane_matrix:new l.aJ(v,o.u_label_plane_matrix),u_coord_matrix:new l.aJ(v,o.u_coord_matrix),u_is_text:new l.aH(v,o.u_is_text),u_pitch_with_map:new l.aH(v,o.u_pitch_with_map),u_is_along_line:new l.aH(v,o.u_is_along_line),u_is_variable_anchor:new l.aH(v,o.u_is_variable_anchor),u_texsize:new l.aO(v,o.u_texsize),u_texture:new l.aH(v,o.u_texture),u_translation:new l.aO(v,o.u_translation),u_pitched_scale:new l.aI(v,o.u_pitched_scale)}),symbolSDF:(v,o)=>({u_is_size_zoom_constant:new l.aH(v,o.u_is_size_zoom_constant),u_is_size_feature_constant:new l.aH(v,o.u_is_size_feature_constant),u_size_t:new l.aI(v,o.u_size_t),u_size:new l.aI(v,o.u_size),u_camera_to_center_distance:new l.aI(v,o.u_camera_to_center_distance),u_pitch:new l.aI(v,o.u_pitch),u_rotate_symbol:new l.aH(v,o.u_rotate_symbol),u_aspect_ratio:new l.aI(v,o.u_aspect_ratio),u_fade_change:new l.aI(v,o.u_fade_change),u_matrix:new l.aJ(v,o.u_matrix),u_label_plane_matrix:new l.aJ(v,o.u_label_plane_matrix),u_coord_matrix:new l.aJ(v,o.u_coord_matrix),u_is_text:new l.aH(v,o.u_is_text),u_pitch_with_map:new l.aH(v,o.u_pitch_with_map),u_is_along_line:new l.aH(v,o.u_is_along_line),u_is_variable_anchor:new l.aH(v,o.u_is_variable_anchor),u_texsize:new l.aO(v,o.u_texsize),u_texture:new l.aH(v,o.u_texture),u_gamma_scale:new l.aI(v,o.u_gamma_scale),u_device_pixel_ratio:new l.aI(v,o.u_device_pixel_ratio),u_is_halo:new l.aH(v,o.u_is_halo),u_translation:new l.aO(v,o.u_translation),u_pitched_scale:new l.aI(v,o.u_pitched_scale)}),symbolTextAndIcon:(v,o)=>({u_is_size_zoom_constant:new l.aH(v,o.u_is_size_zoom_constant),u_is_size_feature_constant:new l.aH(v,o.u_is_size_feature_constant),u_size_t:new l.aI(v,o.u_size_t),u_size:new l.aI(v,o.u_size),u_camera_to_center_distance:new l.aI(v,o.u_camera_to_center_distance),u_pitch:new l.aI(v,o.u_pitch),u_rotate_symbol:new l.aH(v,o.u_rotate_symbol),u_aspect_ratio:new l.aI(v,o.u_aspect_ratio),u_fade_change:new l.aI(v,o.u_fade_change),u_matrix:new l.aJ(v,o.u_matrix),u_label_plane_matrix:new l.aJ(v,o.u_label_plane_matrix),u_coord_matrix:new l.aJ(v,o.u_coord_matrix),u_is_text:new l.aH(v,o.u_is_text),u_pitch_with_map:new l.aH(v,o.u_pitch_with_map),u_is_along_line:new l.aH(v,o.u_is_along_line),u_is_variable_anchor:new l.aH(v,o.u_is_variable_anchor),u_texsize:new l.aO(v,o.u_texsize),u_texsize_icon:new l.aO(v,o.u_texsize_icon),u_texture:new l.aH(v,o.u_texture),u_texture_icon:new l.aH(v,o.u_texture_icon),u_gamma_scale:new l.aI(v,o.u_gamma_scale),u_device_pixel_ratio:new l.aI(v,o.u_device_pixel_ratio),u_is_halo:new l.aH(v,o.u_is_halo),u_translation:new l.aO(v,o.u_translation),u_pitched_scale:new l.aI(v,o.u_pitched_scale)}),background:(v,o)=>({u_matrix:new l.aJ(v,o.u_matrix),u_opacity:new l.aI(v,o.u_opacity),u_color:new l.aL(v,o.u_color)}),backgroundPattern:(v,o)=>({u_matrix:new l.aJ(v,o.u_matrix),u_opacity:new l.aI(v,o.u_opacity),u_image:new l.aH(v,o.u_image),u_pattern_tl_a:new l.aO(v,o.u_pattern_tl_a),u_pattern_br_a:new l.aO(v,o.u_pattern_br_a),u_pattern_tl_b:new l.aO(v,o.u_pattern_tl_b),u_pattern_br_b:new l.aO(v,o.u_pattern_br_b),u_texsize:new l.aO(v,o.u_texsize),u_mix:new l.aI(v,o.u_mix),u_pattern_size_a:new l.aO(v,o.u_pattern_size_a),u_pattern_size_b:new l.aO(v,o.u_pattern_size_b),u_scale_a:new l.aI(v,o.u_scale_a),u_scale_b:new l.aI(v,o.u_scale_b),u_pixel_coord_upper:new l.aO(v,o.u_pixel_coord_upper),u_pixel_coord_lower:new l.aO(v,o.u_pixel_coord_lower),u_tile_units_to_pixels:new l.aI(v,o.u_tile_units_to_pixels)}),terrain:(v,o)=>({u_matrix:new l.aJ(v,o.u_matrix),u_texture:new l.aH(v,o.u_texture),u_ele_delta:new l.aI(v,o.u_ele_delta),u_fog_matrix:new l.aJ(v,o.u_fog_matrix),u_fog_color:new l.aL(v,o.u_fog_color),u_fog_ground_blend:new l.aI(v,o.u_fog_ground_blend),u_fog_ground_blend_opacity:new l.aI(v,o.u_fog_ground_blend_opacity),u_horizon_color:new l.aL(v,o.u_horizon_color),u_horizon_fog_blend:new l.aI(v,o.u_horizon_fog_blend)}),terrainDepth:(v,o)=>({u_matrix:new l.aJ(v,o.u_matrix),u_ele_delta:new l.aI(v,o.u_ele_delta)}),terrainCoords:(v,o)=>({u_matrix:new l.aJ(v,o.u_matrix),u_texture:new l.aH(v,o.u_texture),u_terrain_coords_id:new l.aI(v,o.u_terrain_coords_id),u_ele_delta:new l.aI(v,o.u_ele_delta)}),sky:(v,o)=>({u_sky_color:new l.aL(v,o.u_sky_color),u_horizon_color:new l.aL(v,o.u_horizon_color),u_horizon:new l.aI(v,o.u_horizon),u_sky_horizon_blend:new l.aI(v,o.u_sky_horizon_blend)})};class Mo{constructor(o,d,m){this.context=o;const y=o.gl;this.buffer=y.createBuffer(),this.dynamicDraw=!!m,this.context.unbindVAO(),o.bindElementBuffer.set(this.buffer),y.bufferData(y.ELEMENT_ARRAY_BUFFER,d.arrayBuffer,this.dynamicDraw?y.DYNAMIC_DRAW:y.STATIC_DRAW),this.dynamicDraw||delete d.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(o){const d=this.context.gl;if(!this.dynamicDraw)throw new Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),d.bufferSubData(d.ELEMENT_ARRAY_BUFFER,0,o.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const h_={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class od{constructor(o,d,m,y){this.length=d.length,this.attributes=m,this.itemSize=d.bytesPerElement,this.dynamicDraw=y,this.context=o;const x=o.gl;this.buffer=x.createBuffer(),o.bindVertexBuffer.set(this.buffer),x.bufferData(x.ARRAY_BUFFER,d.arrayBuffer,this.dynamicDraw?x.DYNAMIC_DRAW:x.STATIC_DRAW),this.dynamicDraw||delete d.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(o){if(o.length!==this.length)throw new Error(`Length of new data is ${o.length}, which doesn't match current length of ${this.length}`);const d=this.context.gl;this.bind(),d.bufferSubData(d.ARRAY_BUFFER,0,o.arrayBuffer)}enableAttributes(o,d){for(let m=0;m<this.attributes.length;m++){const y=d.attributes[this.attributes[m].name];y!==void 0&&o.enableVertexAttribArray(y)}}setVertexAttribPointers(o,d,m){for(let y=0;y<this.attributes.length;y++){const x=this.attributes[y],M=d.attributes[x.name];M!==void 0&&o.vertexAttribPointer(M,x.components,o[h_[x.type]],!1,this.itemSize,x.offset+this.itemSize*(m||0))}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const Us=new WeakMap;function ps(v){var o;if(Us.has(v))return Us.get(v);{const d=(o=v.getParameter(v.VERSION))===null||o===void 0?void 0:o.startsWith("WebGL 2.0");return Us.set(v,d),d}}class _n{constructor(o){this.gl=o.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(o){}getDefault(){return this.default}setDefault(){this.set(this.default)}}class cu extends _n{getDefault(){return l.aM.transparent}set(o){const d=this.current;(o.r!==d.r||o.g!==d.g||o.b!==d.b||o.a!==d.a||this.dirty)&&(this.gl.clearColor(o.r,o.g,o.b,o.a),this.current=o,this.dirty=!1)}}class d_ extends _n{getDefault(){return 1}set(o){(o!==this.current||this.dirty)&&(this.gl.clearDepth(o),this.current=o,this.dirty=!1)}}class Ba extends _n{getDefault(){return 0}set(o){(o!==this.current||this.dirty)&&(this.gl.clearStencil(o),this.current=o,this.dirty=!1)}}class p_ extends _n{getDefault(){return[!0,!0,!0,!0]}set(o){const d=this.current;(o[0]!==d[0]||o[1]!==d[1]||o[2]!==d[2]||o[3]!==d[3]||this.dirty)&&(this.gl.colorMask(o[0],o[1],o[2],o[3]),this.current=o,this.dirty=!1)}}class rm extends _n{getDefault(){return!0}set(o){(o!==this.current||this.dirty)&&(this.gl.depthMask(o),this.current=o,this.dirty=!1)}}class f_ extends _n{getDefault(){return 255}set(o){(o!==this.current||this.dirty)&&(this.gl.stencilMask(o),this.current=o,this.dirty=!1)}}class om extends _n{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(o){const d=this.current;(o.func!==d.func||o.ref!==d.ref||o.mask!==d.mask||this.dirty)&&(this.gl.stencilFunc(o.func,o.ref,o.mask),this.current=o,this.dirty=!1)}}class sd extends _n{getDefault(){const o=this.gl;return[o.KEEP,o.KEEP,o.KEEP]}set(o){const d=this.current;(o[0]!==d[0]||o[1]!==d[1]||o[2]!==d[2]||this.dirty)&&(this.gl.stencilOp(o[0],o[1],o[2]),this.current=o,this.dirty=!1)}}class sm extends _n{getDefault(){return!1}set(o){if(o===this.current&&!this.dirty)return;const d=this.gl;o?d.enable(d.STENCIL_TEST):d.disable(d.STENCIL_TEST),this.current=o,this.dirty=!1}}class am extends _n{getDefault(){return[0,1]}set(o){const d=this.current;(o[0]!==d[0]||o[1]!==d[1]||this.dirty)&&(this.gl.depthRange(o[0],o[1]),this.current=o,this.dirty=!1)}}class lm extends _n{getDefault(){return!1}set(o){if(o===this.current&&!this.dirty)return;const d=this.gl;o?d.enable(d.DEPTH_TEST):d.disable(d.DEPTH_TEST),this.current=o,this.dirty=!1}}class cm extends _n{getDefault(){return this.gl.LESS}set(o){(o!==this.current||this.dirty)&&(this.gl.depthFunc(o),this.current=o,this.dirty=!1)}}class Hs extends _n{getDefault(){return!1}set(o){if(o===this.current&&!this.dirty)return;const d=this.gl;o?d.enable(d.BLEND):d.disable(d.BLEND),this.current=o,this.dirty=!1}}class um extends _n{getDefault(){const o=this.gl;return[o.ONE,o.ZERO]}set(o){const d=this.current;(o[0]!==d[0]||o[1]!==d[1]||this.dirty)&&(this.gl.blendFunc(o[0],o[1]),this.current=o,this.dirty=!1)}}class m_ extends _n{getDefault(){return l.aM.transparent}set(o){const d=this.current;(o.r!==d.r||o.g!==d.g||o.b!==d.b||o.a!==d.a||this.dirty)&&(this.gl.blendColor(o.r,o.g,o.b,o.a),this.current=o,this.dirty=!1)}}class hm extends _n{getDefault(){return this.gl.FUNC_ADD}set(o){(o!==this.current||this.dirty)&&(this.gl.blendEquation(o),this.current=o,this.dirty=!1)}}class jl extends _n{getDefault(){return!1}set(o){if(o===this.current&&!this.dirty)return;const d=this.gl;o?d.enable(d.CULL_FACE):d.disable(d.CULL_FACE),this.current=o,this.dirty=!1}}class g_ extends _n{getDefault(){return this.gl.BACK}set(o){(o!==this.current||this.dirty)&&(this.gl.cullFace(o),this.current=o,this.dirty=!1)}}class uu extends _n{getDefault(){return this.gl.CCW}set(o){(o!==this.current||this.dirty)&&(this.gl.frontFace(o),this.current=o,this.dirty=!1)}}class y_ extends _n{getDefault(){return null}set(o){(o!==this.current||this.dirty)&&(this.gl.useProgram(o),this.current=o,this.dirty=!1)}}class __ extends _n{getDefault(){return this.gl.TEXTURE0}set(o){(o!==this.current||this.dirty)&&(this.gl.activeTexture(o),this.current=o,this.dirty=!1)}}class dm extends _n{getDefault(){const o=this.gl;return[0,0,o.drawingBufferWidth,o.drawingBufferHeight]}set(o){const d=this.current;(o[0]!==d[0]||o[1]!==d[1]||o[2]!==d[2]||o[3]!==d[3]||this.dirty)&&(this.gl.viewport(o[0],o[1],o[2],o[3]),this.current=o,this.dirty=!1)}}class pm extends _n{getDefault(){return null}set(o){if(o===this.current&&!this.dirty)return;const d=this.gl;d.bindFramebuffer(d.FRAMEBUFFER,o),this.current=o,this.dirty=!1}}class fm extends _n{getDefault(){return null}set(o){if(o===this.current&&!this.dirty)return;const d=this.gl;d.bindRenderbuffer(d.RENDERBUFFER,o),this.current=o,this.dirty=!1}}class ad extends _n{getDefault(){return null}set(o){if(o===this.current&&!this.dirty)return;const d=this.gl;d.bindTexture(d.TEXTURE_2D,o),this.current=o,this.dirty=!1}}class mm extends _n{getDefault(){return null}set(o){if(o===this.current&&!this.dirty)return;const d=this.gl;d.bindBuffer(d.ARRAY_BUFFER,o),this.current=o,this.dirty=!1}}class hu extends _n{getDefault(){return null}set(o){const d=this.gl;d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,o),this.current=o,this.dirty=!1}}class Ho extends _n{getDefault(){return null}set(o){var d;if(o===this.current&&!this.dirty)return;const m=this.gl;ps(m)?m.bindVertexArray(o):(d=m.getExtension("OES_vertex_array_object"))===null||d===void 0||d.bindVertexArrayOES(o),this.current=o,this.dirty=!1}}class ld extends _n{getDefault(){return 4}set(o){if(o===this.current&&!this.dirty)return;const d=this.gl;d.pixelStorei(d.UNPACK_ALIGNMENT,o),this.current=o,this.dirty=!1}}class cd extends _n{getDefault(){return!1}set(o){if(o===this.current&&!this.dirty)return;const d=this.gl;d.pixelStorei(d.UNPACK_PREMULTIPLY_ALPHA_WEBGL,o),this.current=o,this.dirty=!1}}class ud extends _n{getDefault(){return!1}set(o){if(o===this.current&&!this.dirty)return;const d=this.gl;d.pixelStorei(d.UNPACK_FLIP_Y_WEBGL,o),this.current=o,this.dirty=!1}}class du extends _n{constructor(o,d){super(o),this.context=o,this.parent=d}getDefault(){return null}}class hd extends du{setDirty(){this.dirty=!0}set(o){if(o===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const d=this.gl;d.framebufferTexture2D(d.FRAMEBUFFER,d.COLOR_ATTACHMENT0,d.TEXTURE_2D,o,0),this.current=o,this.dirty=!1}}class qs extends du{set(o){if(o===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const d=this.gl;d.framebufferRenderbuffer(d.FRAMEBUFFER,d.DEPTH_ATTACHMENT,d.RENDERBUFFER,o),this.current=o,this.dirty=!1}}class dd extends du{set(o){if(o===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const d=this.gl;d.framebufferRenderbuffer(d.FRAMEBUFFER,d.DEPTH_STENCIL_ATTACHMENT,d.RENDERBUFFER,o),this.current=o,this.dirty=!1}}class b_{constructor(o,d,m,y,x){this.context=o,this.width=d,this.height=m;const M=o.gl,I=this.framebuffer=M.createFramebuffer();if(this.colorAttachment=new hd(o,I),y)this.depthAttachment=x?new dd(o,I):new qs(o,I);else if(x)throw new Error("Stencil cannot be set without depth");if(M.checkFramebufferStatus(M.FRAMEBUFFER)!==M.FRAMEBUFFER_COMPLETE)throw new Error("Framebuffer is not complete")}destroy(){const o=this.context.gl,d=this.colorAttachment.get();if(d&&o.deleteTexture(d),this.depthAttachment){const m=this.depthAttachment.get();m&&o.deleteRenderbuffer(m)}o.deleteFramebuffer(this.framebuffer)}}class Jn{constructor(o,d,m){this.blendFunction=o,this.blendColor=d,this.mask=m}}Jn.Replace=[1,0],Jn.disabled=new Jn(Jn.Replace,l.aM.transparent,[!1,!1,!1,!1]),Jn.unblended=new Jn(Jn.Replace,l.aM.transparent,[!0,!0,!0,!0]),Jn.alphaBlended=new Jn([1,771],l.aM.transparent,[!0,!0,!0,!0]);class x_{constructor(o){var d,m;if(this.gl=o,this.clearColor=new cu(this),this.clearDepth=new d_(this),this.clearStencil=new Ba(this),this.colorMask=new p_(this),this.depthMask=new rm(this),this.stencilMask=new f_(this),this.stencilFunc=new om(this),this.stencilOp=new sd(this),this.stencilTest=new sm(this),this.depthRange=new am(this),this.depthTest=new lm(this),this.depthFunc=new cm(this),this.blend=new Hs(this),this.blendFunc=new um(this),this.blendColor=new m_(this),this.blendEquation=new hm(this),this.cullFace=new jl(this),this.cullFaceSide=new g_(this),this.frontFace=new uu(this),this.program=new y_(this),this.activeTexture=new __(this),this.viewport=new dm(this),this.bindFramebuffer=new pm(this),this.bindRenderbuffer=new fm(this),this.bindTexture=new ad(this),this.bindVertexBuffer=new mm(this),this.bindElementBuffer=new hu(this),this.bindVertexArray=new Ho(this),this.pixelStoreUnpack=new ld(this),this.pixelStoreUnpackPremultiplyAlpha=new cd(this),this.pixelStoreUnpackFlipY=new ud(this),this.extTextureFilterAnisotropic=o.getExtension("EXT_texture_filter_anisotropic")||o.getExtension("MOZ_EXT_texture_filter_anisotropic")||o.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=o.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),this.maxTextureSize=o.getParameter(o.MAX_TEXTURE_SIZE),ps(o)){this.HALF_FLOAT=o.HALF_FLOAT;const y=o.getExtension("EXT_color_buffer_half_float");this.RGBA16F=(d=o.RGBA16F)!==null&&d!==void 0?d:y==null?void 0:y.RGBA16F_EXT,this.RGB16F=(m=o.RGB16F)!==null&&m!==void 0?m:y==null?void 0:y.RGB16F_EXT,o.getExtension("EXT_color_buffer_float")}else{o.getExtension("EXT_color_buffer_half_float"),o.getExtension("OES_texture_half_float_linear");const y=o.getExtension("OES_texture_half_float");this.HALF_FLOAT=y==null?void 0:y.HALF_FLOAT_OES}}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.bindVertexArray.dirty=!0,this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0}createIndexBuffer(o,d){return new Mo(this,o,d)}createVertexBuffer(o,d,m){return new od(this,o,d,m)}createRenderbuffer(o,d,m){const y=this.gl,x=y.createRenderbuffer();return this.bindRenderbuffer.set(x),y.renderbufferStorage(y.RENDERBUFFER,o,d,m),this.bindRenderbuffer.set(null),x}createFramebuffer(o,d,m,y){return new b_(this,o,d,m,y)}clear({color:o,depth:d,stencil:m}){const y=this.gl;let x=0;o&&(x|=y.COLOR_BUFFER_BIT,this.clearColor.set(o),this.colorMask.set([!0,!0,!0,!0])),d!==void 0&&(x|=y.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(d),this.depthMask.set(!0)),m!==void 0&&(x|=y.STENCIL_BUFFER_BIT,this.clearStencil.set(m),this.stencilMask.set(255)),y.clear(x)}setCullFace(o){o.enable===!1?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(o.mode),this.frontFace.set(o.frontFace))}setDepthMode(o){o.func!==this.gl.ALWAYS||o.mask?(this.depthTest.set(!0),this.depthFunc.set(o.func),this.depthMask.set(o.mask),this.depthRange.set(o.range)):this.depthTest.set(!1)}setStencilMode(o){o.test.func!==this.gl.ALWAYS||o.mask?(this.stencilTest.set(!0),this.stencilMask.set(o.mask),this.stencilOp.set([o.fail,o.depthFail,o.pass]),this.stencilFunc.set({func:o.test.func,ref:o.ref,mask:o.test.mask})):this.stencilTest.set(!1)}setColorMode(o){l.aE(o.blendFunction,Jn.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(o.blendFunction),this.blendColor.set(o.blendColor)),this.colorMask.set(o.mask)}createVertexArray(){var o;return ps(this.gl)?this.gl.createVertexArray():(o=this.gl.getExtension("OES_vertex_array_object"))===null||o===void 0?void 0:o.createVertexArrayOES()}deleteVertexArray(o){var d;return ps(this.gl)?this.gl.deleteVertexArray(o):(d=this.gl.getExtension("OES_vertex_array_object"))===null||d===void 0?void 0:d.deleteVertexArrayOES(o)}unbindVAO(){this.bindVertexArray.set(null)}}class Gt{constructor(o,d,m){this.func=o,this.mask=d,this.range=m}}Gt.ReadOnly=!1,Gt.ReadWrite=!0,Gt.disabled=new Gt(519,Gt.ReadOnly,[0,1]);const pu=7680;class On{constructor(o,d,m,y,x,M){this.test=o,this.ref=d,this.mask=m,this.fail=y,this.depthFail=x,this.pass=M}}On.disabled=new On({func:519,mask:0},0,0,pu,pu,pu);class Tn{constructor(o,d,m){this.enable=o,this.mode=d,this.frontFace=m}}let Ws;function Ul(v,o,d,m,y){const x=v.context,M=x.gl,I=v.useProgram("collisionBox"),O=[];let N=0,V=0;for(let ce=0;ce<m.length;ce++){const he=m[ce],ne=o.getTile(he).getBucket(d);if(!ne)continue;const me=y?ne.textCollisionBox:ne.iconCollisionBox,ge=ne.collisionCircleArray;if(ge.length>0){const xe=l.H();l.aQ(xe,ne.placementInvProjMatrix,v.transform.glCoordMatrix),l.aQ(xe,xe,ne.placementViewportMatrix),O.push({circleArray:ge,circleOffset:V,transform:he.posMatrix,invTransform:xe,coord:he}),N+=ge.length/4,V=N}me&&I.draw(x,M.LINES,Gt.disabled,On.disabled,v.colorModeForRenderPass(),Tn.disabled,{u_matrix:he.posMatrix,u_pixel_extrude_scale:[1/(F=v.transform).width,1/F.height]},v.style.map.terrain&&v.style.map.terrain.getTerrainData(he),d.id,me.layoutVertexBuffer,me.indexBuffer,me.segments,null,v.transform.zoom,null,null,me.collisionVertexBuffer)}var F;if(!y||!O.length)return;const Z=v.useProgram("collisionCircle"),J=new l.aR;J.resize(4*N),J._trim();let ee=0;for(const ce of O)for(let he=0;he<ce.circleArray.length/4;he++){const ne=4*he,me=ce.circleArray[ne+0],ge=ce.circleArray[ne+1],xe=ce.circleArray[ne+2],Be=ce.circleArray[ne+3];J.emplace(ee++,me,ge,xe,Be,0),J.emplace(ee++,me,ge,xe,Be,1),J.emplace(ee++,me,ge,xe,Be,2),J.emplace(ee++,me,ge,xe,Be,3)}(!Ws||Ws.length<2*N)&&(Ws=function(ce){const he=2*ce,ne=new l.aT;ne.resize(he),ne._trim();for(let me=0;me<he;me++){const ge=6*me;ne.uint16[ge+0]=4*me+0,ne.uint16[ge+1]=4*me+1,ne.uint16[ge+2]=4*me+2,ne.uint16[ge+3]=4*me+2,ne.uint16[ge+4]=4*me+3,ne.uint16[ge+5]=4*me+0}return ne}(N));const oe=x.createIndexBuffer(Ws,!0),le=x.createVertexBuffer(J,l.aS.members,!0);for(const ce of O){const he=js(ce.transform,ce.invTransform,v.transform);Z.draw(x,M.TRIANGLES,Gt.disabled,On.disabled,v.colorModeForRenderPass(),Tn.disabled,he,v.style.map.terrain&&v.style.map.terrain.getTerrainData(ce.coord),d.id,le,oe,l.a0.simpleSegment(0,2*ce.circleOffset,ce.circleArray.length,ce.circleArray.length/2),null,v.transform.zoom,null,null,null)}le.destroy(),oe.destroy()}Tn.disabled=new Tn(!1,1029,2305),Tn.backCCW=new Tn(!0,1029,2305);const Hl=l.an(new Float32Array(16));function pd(v,o,d,m,y,x){const{horizontalAlign:M,verticalAlign:I}=l.au(v);return new l.P((-(M-.5)*o/y+m[0])*x,(-(I-.5)*d/y+m[1])*x)}function Gs(v,o,d,m,y,x){const M=o.tileAnchorPoint.add(new l.P(o.translation[0],o.translation[1]));if(o.pitchWithMap){let I=m.mult(x);d||(I=I.rotate(-y));const O=M.add(I);return se(O.x,O.y,o.labelPlaneMatrix,o.getElevation).point}if(d){const I=Me(o.tileAnchorPoint.x+1,o.tileAnchorPoint.y,o).point.sub(v),O=Math.atan(I.y/I.x)+(I.x<0?Math.PI:0);return v.add(m.rotate(O))}return v.add(m)}function za(v,o,d,m,y,x,M,I,O,N,V,F,Z,J){const ee=v.text.placedSymbolArray,oe=v.text.dynamicLayoutVertexArray,le=v.icon.dynamicLayoutVertexArray,ce={};oe.clear();for(let he=0;he<ee.length;he++){const ne=ee.get(he),me=ne.hidden||!ne.crossTileID||v.allowVerticalPlacement&&!ne.placedOrientation?null:m[ne.crossTileID];if(me){const ge=new l.P(ne.anchorX,ne.anchorY),xe={getElevation:J,width:y.width,height:y.height,labelPlaneMatrix:x,lineVertexArray:null,pitchWithMap:d,projection:V,projectionCache:null,tileAnchorPoint:ge,translation:F,unwrappedTileID:Z},Be=d?se(ge.x,ge.y,M,J):Me(ge.x,ge.y,xe),Fe=H(y.cameraToCenterDistance,Be.signedDistanceFromCamera);let Qe=l.ai(v.textSizeData,O,ne)*Fe/l.ap;d&&(Qe*=v.tilePixelRatio/I);const{width:st,height:Ye,anchor:Ge,textOffset:mt,textBoxScale:Bt}=me,Ke=pd(Ge,st,Ye,mt,Bt,Qe),nt=V.getPitchedTextCorrection(y,ge.add(new l.P(F[0],F[1])),Z),Dt=Gs(Be.point,xe,o,Ke,y.angle,nt),Fn=v.allowVerticalPlacement&&ne.placedOrientation===l.ah.vertical?Math.PI/2:0;for(let $t=0;$t<ne.numGlyphs;$t++)l.aj(oe,Dt,Fn);N&&ne.associatedIconIndex>=0&&(ce[ne.associatedIconIndex]={shiftedAnchor:Dt,angle:Fn})}else kt(ne.numGlyphs,oe)}if(N){le.clear();const he=v.icon.placedSymbolArray;for(let ne=0;ne<he.length;ne++){const me=he.get(ne);if(me.hidden)kt(me.numGlyphs,le);else{const ge=ce[ne];if(ge)for(let xe=0;xe<me.numGlyphs;xe++)l.aj(le,ge.shiftedAnchor,ge.angle);else kt(me.numGlyphs,le)}}v.icon.dynamicLayoutVertexBuffer.updateData(le)}v.text.dynamicLayoutVertexBuffer.updateData(oe)}function Rr(v,o,d){return d.iconsInText&&o?"symbolTextAndIcon":v?"symbolSDF":"symbolIcon"}function fd(v,o,d,m,y,x,M,I,O,N,V,F){const Z=v.context,J=Z.gl,ee=v.transform,oe=Fs(),le=I==="map",ce=O==="map",he=I!=="viewport"&&d.layout.get("symbol-placement")!=="point",ne=le&&!ce&&!he,me=!ce&&he,ge=!d.layout.get("symbol-sort-key").isConstant();let xe=!1;const Be=v.depthModeForSublayer(0,Gt.ReadOnly),Fe=d._unevaluatedLayout.hasValue("text-variable-anchor")||d._unevaluatedLayout.hasValue("text-variable-anchor-offset"),Qe=[],st=oe.getCircleRadiusCorrection(ee);for(const Ye of m){const Ge=o.getTile(Ye),mt=Ge.getBucket(d);if(!mt)continue;const Bt=y?mt.text:mt.icon;if(!Bt||!Bt.segments.get().length||!Bt.hasVisibleVertices)continue;const Ke=Bt.programConfigurations.get(d.id),nt=y||mt.sdfIcons,Dt=y?mt.textSizeData:mt.iconSizeData,Fn=ce||ee.pitch!==0,$t=v.useProgram(Rr(nt,y,mt),Ke),Jt=l.ag(Dt,ee.zoom),$n=v.style.map.terrain&&v.style.map.terrain.getTerrainData(Ye);let Oi,io,jn,rr,Gi=[0,0],Bi=null;if(y)io=Ge.glyphAtlasTexture,jn=J.LINEAR,Oi=Ge.glyphAtlasTexture.size,mt.iconsInText&&(Gi=Ge.imageAtlasTexture.size,Bi=Ge.imageAtlasTexture,rr=Fn||v.options.rotating||v.options.zooming||Dt.kind==="composite"||Dt.kind==="camera"?J.LINEAR:J.NEAREST);else{const tn=d.layout.get("icon-size").constantOr(0)!==1||mt.iconsNeedLinear;io=Ge.imageAtlasTexture,jn=nt||v.options.rotating||v.options.zooming||tn||Fn?J.LINEAR:J.NEAREST,Oi=Ge.imageAtlasTexture.size}const Zi=Kt(Ge,1,v.transform.zoom),Po=me?Ye.posMatrix:Hl,Ka=qi(Po,ce,le,v.transform,Zi),Du=fr(Po,ce,le,v.transform,Zi),Ja=fr(Ye.posMatrix,ce,le,v.transform,Zi),Fr=oe.translatePosition(v.transform,Ge,x,M),Ou=Fe&&mt.hasTextData(),Vd=d.layout.get("icon-text-fit")!=="none"&&Ou&&mt.hasIconData();if(he){const tn=v.style.map.terrain?(Qa,el)=>v.style.map.terrain.getElevation(Ye,Qa,el):null,Js=d.layout.get("text-rotation-alignment")==="map";X(mt,Ye.posMatrix,v,y,Ka,Ja,ce,N,Js,oe,Ye.toUnwrapped(),ee.width,ee.height,Fr,tn)}const $r=Ye.posMatrix,jr=y&&Fe||Vd,fs=he||jr?Hl:Ka,ro=Du,Si=nt&&d.paint.get(y?"text-halo-width":"icon-halo-width").constantOr(1)!==0;let zi;zi=nt?mt.iconsInText?nd(Dt.kind,Jt,ne,ce,he,jr,v,$r,fs,ro,Fr,Oi,Gi,st):$l(Dt.kind,Jt,ne,ce,he,jr,v,$r,fs,ro,Fr,y,Oi,!0,st):im(Dt.kind,Jt,ne,ce,he,jr,v,$r,fs,ro,Fr,y,Oi,st);const xr={program:$t,buffers:Bt,uniformValues:zi,atlasTexture:io,atlasTextureIcon:Bi,atlasInterpolation:jn,atlasInterpolationIcon:rr,isSDF:nt,hasHalo:Si};if(ge&&mt.canOverlap){xe=!0;const tn=Bt.segments.get();for(const Js of tn)Qe.push({segments:new l.a0([Js]),sortKey:Js.sortKey,state:xr,terrainData:$n})}else Qe.push({segments:Bt.segments,sortKey:0,state:xr,terrainData:$n})}xe&&Qe.sort((Ye,Ge)=>Ye.sortKey-Ge.sortKey);for(const Ye of Qe){const Ge=Ye.state;if(Z.activeTexture.set(J.TEXTURE0),Ge.atlasTexture.bind(Ge.atlasInterpolation,J.CLAMP_TO_EDGE),Ge.atlasTextureIcon&&(Z.activeTexture.set(J.TEXTURE1),Ge.atlasTextureIcon&&Ge.atlasTextureIcon.bind(Ge.atlasInterpolationIcon,J.CLAMP_TO_EDGE)),Ge.isSDF){const mt=Ge.uniformValues;Ge.hasHalo&&(mt.u_is_halo=1,md(Ge.buffers,Ye.segments,d,v,Ge.program,Be,V,F,mt,Ye.terrainData)),mt.u_is_halo=0}md(Ge.buffers,Ye.segments,d,v,Ge.program,Be,V,F,Ge.uniformValues,Ye.terrainData)}}function md(v,o,d,m,y,x,M,I,O,N){const V=m.context;y.draw(V,V.gl.TRIANGLES,x,M,I,Tn.disabled,O,N,d.id,v.layoutVertexBuffer,v.indexBuffer,o,d.paint,m.transform.zoom,v.programConfigurations.get(d.id),v.dynamicLayoutVertexBuffer,v.opacityVertexBuffer)}function gd(v,o,d,m){const y=v.context,x=y.gl,M=On.disabled,I=new Jn([x.ONE,x.ONE],l.aM.transparent,[!0,!0,!0,!0]),O=o.getBucket(d);if(!O)return;const N=m.key;let V=d.heatmapFbos.get(N);V||(V=ql(y,o.tileSize,o.tileSize),d.heatmapFbos.set(N,V)),y.bindFramebuffer.set(V.framebuffer),y.viewport.set([0,0,o.tileSize,o.tileSize]),y.clear({color:l.aM.transparent});const F=O.programConfigurations.get(d.id),Z=v.useProgram("heatmap",F),J=v.style.map.terrain.getTerrainData(m);Z.draw(y,x.TRIANGLES,Gt.disabled,M,I,Tn.disabled,ir(m.posMatrix,o,v.transform.zoom,d.paint.get("heatmap-intensity")),J,d.id,O.layoutVertexBuffer,O.indexBuffer,O.segments,d.paint,v.transform.zoom,F)}function Zs(v,o,d){const m=v.context,y=m.gl;m.setColorMode(v.colorModeForRenderPass());const x=Wl(m,o),M=d.key,I=o.heatmapFbos.get(M);I&&(m.activeTexture.set(y.TEXTURE0),y.bindTexture(y.TEXTURE_2D,I.colorAttachment.get()),m.activeTexture.set(y.TEXTURE1),x.bind(y.LINEAR,y.CLAMP_TO_EDGE),v.useProgram("heatmapTexture").draw(m,y.TRIANGLES,Gt.disabled,On.disabled,v.colorModeForRenderPass(),Tn.disabled,ou(v,o,0,1),null,o.id,v.rasterBoundsBuffer,v.quadTriangleIndexBuffer,v.rasterBoundsSegments,o.paint,v.transform.zoom),I.destroy(),o.heatmapFbos.delete(M))}function ql(v,o,d){var m,y;const x=v.gl,M=x.createTexture();x.bindTexture(x.TEXTURE_2D,M),x.texParameteri(x.TEXTURE_2D,x.TEXTURE_WRAP_S,x.CLAMP_TO_EDGE),x.texParameteri(x.TEXTURE_2D,x.TEXTURE_WRAP_T,x.CLAMP_TO_EDGE),x.texParameteri(x.TEXTURE_2D,x.TEXTURE_MIN_FILTER,x.LINEAR),x.texParameteri(x.TEXTURE_2D,x.TEXTURE_MAG_FILTER,x.LINEAR);const I=(m=v.HALF_FLOAT)!==null&&m!==void 0?m:x.UNSIGNED_BYTE,O=(y=v.RGBA16F)!==null&&y!==void 0?y:x.RGBA;x.texImage2D(x.TEXTURE_2D,0,O,o,d,0,x.RGBA,I,null);const N=v.createFramebuffer(o,d,!1,!1);return N.colorAttachment.set(M),N}function Wl(v,o){return o.colorRampTexture||(o.colorRampTexture=new Xe(v,o.colorRamp,v.gl.RGBA)),o.colorRampTexture}function Na(v,o,d,m,y){if(!d||!m||!m.imageAtlas)return;const x=m.imageAtlas.patternPositions;let M=x[d.to.toString()],I=x[d.from.toString()];if(!M&&I&&(M=I),!I&&M&&(I=M),!M||!I){const O=y.getPaintProperty(o);M=x[O],I=x[O]}M&&I&&v.setConstantPatternPositions(M,I)}function Gl(v,o,d,m,y,x,M){const I=v.context.gl,O="fill-pattern",N=d.paint.get(O),V=N&&N.constantOr(1),F=d.getCrossfadeParameters();let Z,J,ee,oe,le;M?(J=V&&!d.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",Z=I.LINES):(J=V?"fillPattern":"fill",Z=I.TRIANGLES);const ce=N.constantOr(null);for(const he of m){const ne=o.getTile(he);if(V&&!ne.patternsLoaded())continue;const me=ne.getBucket(d);if(!me)continue;const ge=me.programConfigurations.get(d.id),xe=v.useProgram(J,ge),Be=v.style.map.terrain&&v.style.map.terrain.getTerrainData(he);V&&(v.context.activeTexture.set(I.TEXTURE0),ne.imageAtlasTexture.bind(I.LINEAR,I.CLAMP_TO_EDGE),ge.updatePaintBuffers(F)),Na(ge,O,ce,ne,d);const Fe=Be?he:null,Qe=v.translatePosMatrix(Fe?Fe.posMatrix:he.posMatrix,ne,d.paint.get("fill-translate"),d.paint.get("fill-translate-anchor"));if(M){oe=me.indexBuffer2,le=me.segments2;const st=[I.drawingBufferWidth,I.drawingBufferHeight];ee=J==="fillOutlinePattern"&&V?Qf(Qe,v,F,ne,st):s_(Qe,st)}else oe=me.indexBuffer,le=me.segments,ee=V?Jf(Qe,v,F,ne):Da(Qe);xe.draw(v.context,Z,y,v.stencilModeForClipping(he),x,Tn.disabled,ee,Be,d.id,me.layoutVertexBuffer,oe,le,d.paint,v.transform.zoom,ge)}}function fu(v,o,d,m,y,x,M){const I=v.context,O=I.gl,N="fill-extrusion-pattern",V=d.paint.get(N),F=V.constantOr(1),Z=d.getCrossfadeParameters(),J=d.paint.get("fill-extrusion-opacity"),ee=V.constantOr(null);for(const oe of m){const le=o.getTile(oe),ce=le.getBucket(d);if(!ce)continue;const he=v.style.map.terrain&&v.style.map.terrain.getTerrainData(oe),ne=ce.programConfigurations.get(d.id),me=v.useProgram(F?"fillExtrusionPattern":"fillExtrusion",ne);F&&(v.context.activeTexture.set(O.TEXTURE0),le.imageAtlasTexture.bind(O.LINEAR,O.CLAMP_TO_EDGE),ne.updatePaintBuffers(Z)),Na(ne,N,ee,le,d);const ge=v.translatePosMatrix(oe.posMatrix,le,d.paint.get("fill-extrusion-translate"),d.paint.get("fill-extrusion-translate-anchor")),xe=d.paint.get("fill-extrusion-vertical-gradient"),Be=F?ru(ge,v,xe,J,oe,Z,le):Vl(ge,v,xe,J);me.draw(I,I.gl.TRIANGLES,y,x,M,Tn.backCCW,Be,he,d.id,ce.layoutVertexBuffer,ce.indexBuffer,ce.segments,d.paint,v.transform.zoom,ne,v.style.map.terrain&&ce.centroidVertexBuffer)}}function Ra(v,o,d,m,y,x,M){const I=v.context,O=I.gl,N=d.fbo;if(!N)return;const V=v.useProgram("hillshade"),F=v.style.map.terrain&&v.style.map.terrain.getTerrainData(o);I.activeTexture.set(O.TEXTURE0),O.bindTexture(O.TEXTURE_2D,N.colorAttachment.get()),V.draw(I,O.TRIANGLES,y,x,M,Tn.disabled,((Z,J,ee,oe)=>{const le=ee.paint.get("hillshade-shadow-color"),ce=ee.paint.get("hillshade-highlight-color"),he=ee.paint.get("hillshade-accent-color");let ne=ee.paint.get("hillshade-illumination-direction")*(Math.PI/180);ee.paint.get("hillshade-illumination-anchor")==="viewport"&&(ne-=Z.transform.angle);const me=!Z.options.moving;return{u_matrix:oe?oe.posMatrix:Z.transform.calculatePosMatrix(J.tileID.toUnwrapped(),me),u_image:0,u_latrange:su(0,J.tileID),u_light:[ee.paint.get("hillshade-exaggeration"),ne],u_shadow:le,u_highlight:ce,u_accent:he}})(v,d,m,F?o:null),F,m.id,v.rasterBoundsBuffer,v.quadTriangleIndexBuffer,v.rasterBoundsSegments)}function La(v,o,d,m,y,x){const M=v.context,I=M.gl,O=o.dem;if(O&&O.data){const N=O.dim,V=O.stride,F=O.getPixels();if(M.activeTexture.set(I.TEXTURE1),M.pixelStoreUnpackPremultiplyAlpha.set(!1),o.demTexture=o.demTexture||v.getTileTexture(V),o.demTexture){const J=o.demTexture;J.update(F,{premultiply:!1}),J.bind(I.NEAREST,I.CLAMP_TO_EDGE)}else o.demTexture=new Xe(M,F,I.RGBA,{premultiply:!1}),o.demTexture.bind(I.NEAREST,I.CLAMP_TO_EDGE);M.activeTexture.set(I.TEXTURE0);let Z=o.fbo;if(!Z){const J=new Xe(M,{width:N,height:N,data:null},I.RGBA);J.bind(I.LINEAR,I.CLAMP_TO_EDGE),Z=o.fbo=M.createFramebuffer(N,N,!0,!1),Z.colorAttachment.set(J.texture)}M.bindFramebuffer.set(Z.framebuffer),M.viewport.set([0,0,N,N]),v.useProgram("hillshadePrepare").draw(M,I.TRIANGLES,m,y,x,Tn.disabled,((J,ee)=>{const oe=ee.stride,le=l.H();return l.aP(le,0,l.X,-l.X,0,0,1),l.J(le,le,[0,-l.X,0]),{u_matrix:le,u_image:1,u_dimension:[oe,oe],u_zoom:J.overscaledZ,u_unpack:ee.getUnpackVector()}})(o.tileID,O),null,d.id,v.rasterBoundsBuffer,v.quadTriangleIndexBuffer,v.rasterBoundsSegments),o.needsHillshadePrepare=!1}}function gm(v,o,d,m,y,x){const M=m.paint.get("raster-fade-duration");if(!x&&M>0){const I=E.now(),O=(I-v.timeAdded)/M,N=o?(I-o.timeAdded)/M:-1,V=d.getSource(),F=y.coveringZoomLevel({tileSize:V.tileSize,roundZoom:V.roundZoom}),Z=!o||Math.abs(o.tileID.overscaledZ-F)>Math.abs(v.tileID.overscaledZ-F),J=Z&&v.refreshedUponExpiration?1:l.ac(Z?O:1-N,0,1);return v.refreshedUponExpiration&&O>=1&&(v.refreshedUponExpiration=!1),o?{opacity:1,mix:1-J}:{opacity:J,mix:0}}return{opacity:1,mix:0}}const yd=new l.aM(1,0,0,1),un=new l.aM(0,1,0,1),mu=new l.aM(0,0,1,1),v_=new l.aM(1,0,1,1),ym=new l.aM(0,1,1,1);function Va(v,o,d,m){gu(v,0,o+d/2,v.transform.width,d,m)}function _m(v,o,d,m){gu(v,o-d/2,0,d,v.transform.height,m)}function gu(v,o,d,m,y,x){const M=v.context,I=M.gl;I.enable(I.SCISSOR_TEST),I.scissor(o*v.pixelRatio,d*v.pixelRatio,m*v.pixelRatio,y*v.pixelRatio),M.clear({color:x}),I.disable(I.SCISSOR_TEST)}function bm(v,o,d){const m=v.context,y=m.gl,x=d.posMatrix,M=v.useProgram("debug"),I=Gt.disabled,O=On.disabled,N=v.colorModeForRenderPass(),V="$debug",F=v.style.map.terrain&&v.style.map.terrain.getTerrainData(d);m.activeTexture.set(y.TEXTURE0);const Z=o.getTileByID(d.key).latestRawTileData,J=Math.floor((Z&&Z.byteLength||0)/1024),ee=o.getTile(d).tileSize,oe=512/Math.min(ee,512)*(d.overscaledZ/v.transform.zoom)*.5;let le=d.canonical.toString();d.overscaledZ!==d.canonical.z&&(le+=` => ${d.overscaledZ}`),function(ce,he){ce.initDebugOverlayCanvas();const ne=ce.debugOverlayCanvas,me=ce.context.gl,ge=ce.debugOverlayCanvas.getContext("2d");ge.clearRect(0,0,ne.width,ne.height),ge.shadowColor="white",ge.shadowBlur=2,ge.lineWidth=1.5,ge.strokeStyle="white",ge.textBaseline="top",ge.font="bold 36px Open Sans, sans-serif",ge.fillText(he,5,5),ge.strokeText(he,5,5),ce.debugOverlayTexture.update(ne),ce.debugOverlayTexture.bind(me.LINEAR,me.CLAMP_TO_EDGE)}(v,`${le} ${J}kB`),M.draw(m,y.TRIANGLES,I,O,Jn.alphaBlended,Tn.disabled,Fl(x,l.aM.transparent,oe),null,V,v.debugBuffer,v.quadTriangleIndexBuffer,v.debugSegments),M.draw(m,y.LINE_STRIP,I,O,N,Tn.disabled,Fl(x,l.aM.red),F,V,v.debugBuffer,v.tileBorderIndexBuffer,v.debugSegments)}function xm(v,o,d){const m=v.context,y=m.gl,x=v.colorModeForRenderPass(),M=new Gt(y.LEQUAL,Gt.ReadWrite,v.depthRangeFor3D),I=v.useProgram("terrain"),O=o.getTerrainMesh();m.bindFramebuffer.set(null),m.viewport.set([0,0,v.width,v.height]);for(const N of d){const V=v.renderToTexture.getTexture(N),F=o.getTerrainData(N.tileID);m.activeTexture.set(y.TEXTURE0),y.bindTexture(y.TEXTURE_2D,V.texture);const Z=v.transform.calculatePosMatrix(N.tileID.toUnwrapped()),J=o.getMeshFrameDelta(v.transform.zoom),ee=v.transform.calculateFogMatrix(N.tileID.toUnwrapped()),oe=ed(Z,J,ee,v.style.sky,v.transform.pitch);I.draw(m,y.TRIANGLES,M,On.disabled,x,Tn.backCCW,oe,F,"terrain",O.vertexBuffer,O.indexBuffer,O.segments)}}class yu{constructor(o,d,m){this.vertexBuffer=o,this.indexBuffer=d,this.segments=m}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.vertexBuffer=null,this.indexBuffer=null,this.segments=null}}class _u{constructor(o,d){this.context=new x_(o),this.transform=d,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:l.an(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=Re.maxUnderzooming+Re.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new Jh}resize(o,d,m){if(this.width=Math.floor(o*m),this.height=Math.floor(d*m),this.pixelRatio=m,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const y of this.style._order)this.style._layers[y].resize()}setup(){const o=this.context,d=new l.aX;d.emplaceBack(0,0),d.emplaceBack(l.X,0),d.emplaceBack(0,l.X),d.emplaceBack(l.X,l.X),this.tileExtentBuffer=o.createVertexBuffer(d,$s.members),this.tileExtentSegments=l.a0.simpleSegment(0,0,4,2);const m=new l.aX;m.emplaceBack(0,0),m.emplaceBack(l.X,0),m.emplaceBack(0,l.X),m.emplaceBack(l.X,l.X),this.debugBuffer=o.createVertexBuffer(m,$s.members),this.debugSegments=l.a0.simpleSegment(0,0,4,5);const y=new l.$;y.emplaceBack(0,0,0,0),y.emplaceBack(l.X,0,l.X,0),y.emplaceBack(0,l.X,0,l.X),y.emplaceBack(l.X,l.X,l.X,l.X),this.rasterBoundsBuffer=o.createVertexBuffer(y,Hi.members),this.rasterBoundsSegments=l.a0.simpleSegment(0,0,4,2);const x=new l.aX;x.emplaceBack(0,0),x.emplaceBack(1,0),x.emplaceBack(0,1),x.emplaceBack(1,1),this.viewportBuffer=o.createVertexBuffer(x,$s.members),this.viewportSegments=l.a0.simpleSegment(0,0,4,2);const M=new l.aZ;M.emplaceBack(0),M.emplaceBack(1),M.emplaceBack(3),M.emplaceBack(2),M.emplaceBack(0),this.tileBorderIndexBuffer=o.createIndexBuffer(M);const I=new l.aY;I.emplaceBack(0,1,2),I.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=o.createIndexBuffer(I);const O=this.context.gl;this.stencilClearMode=new On({func:O.ALWAYS,mask:0},0,255,O.ZERO,O.ZERO,O.ZERO)}clearStencil(){const o=this.context,d=o.gl;this.nextStencilID=1,this.currentStencilSource=void 0;const m=l.H();l.aP(m,0,this.width,this.height,0,0,1),l.K(m,m,[d.drawingBufferWidth,d.drawingBufferHeight,0]),this.useProgram("clippingMask").draw(o,d.TRIANGLES,Gt.disabled,this.stencilClearMode,Jn.disabled,Tn.disabled,nr(m),null,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(o,d){if(this.currentStencilSource===o.source||!o.isTileClipped()||!d||!d.length)return;this.currentStencilSource=o.source;const m=this.context,y=m.gl;this.nextStencilID+d.length>256&&this.clearStencil(),m.setColorMode(Jn.disabled),m.setDepthMode(Gt.disabled);const x=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(const M of d){const I=this._tileClippingMaskIDs[M.key]=this.nextStencilID++,O=this.style.map.terrain&&this.style.map.terrain.getTerrainData(M);x.draw(m,y.TRIANGLES,Gt.disabled,new On({func:y.ALWAYS,mask:0},I,255,y.KEEP,y.KEEP,y.REPLACE),Jn.disabled,Tn.disabled,nr(M.posMatrix),O,"$clipping",this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const o=this.nextStencilID++,d=this.context.gl;return new On({func:d.NOTEQUAL,mask:255},o,255,d.KEEP,d.KEEP,d.REPLACE)}stencilModeForClipping(o){const d=this.context.gl;return new On({func:d.EQUAL,mask:255},this._tileClippingMaskIDs[o.key],0,d.KEEP,d.KEEP,d.REPLACE)}stencilConfigForOverlap(o){const d=this.context.gl,m=o.sort((M,I)=>I.overscaledZ-M.overscaledZ),y=m[m.length-1].overscaledZ,x=m[0].overscaledZ-y+1;if(x>1){this.currentStencilSource=void 0,this.nextStencilID+x>256&&this.clearStencil();const M={};for(let I=0;I<x;I++)M[I+y]=new On({func:d.GEQUAL,mask:255},I+this.nextStencilID,255,d.KEEP,d.KEEP,d.REPLACE);return this.nextStencilID+=x,[M,m]}return[{[y]:On.disabled},m]}colorModeForRenderPass(){const o=this.context.gl;return this._showOverdrawInspector?new Jn([o.CONSTANT_COLOR,o.ONE],new l.aM(.125,.125,.125,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?Jn.unblended:Jn.alphaBlended}depthModeForSublayer(o,d,m){if(!this.opaquePassEnabledForLayer())return Gt.disabled;const y=1-((1+this.currentLayer)*this.numSublayers+o)*this.depthEpsilon;return new Gt(m||this.context.gl.LEQUAL,d,[y,y])}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}render(o,d){this.style=o,this.options=d,this.lineAtlas=o.lineAtlas,this.imageManager=o.imageManager,this.glyphManager=o.glyphManager,this.symbolFadeChange=o.placement.symbolFadeChange(E.now()),this.imageManager.beginFrame();const m=this.style._order,y=this.style.sourceCaches,x={},M={},I={};for(const O in y){const N=y[O];N.used&&N.prepare(this.context),x[O]=N.getVisibleCoordinates(),M[O]=x[O].slice().reverse(),I[O]=N.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let O=0;O<m.length;O++)if(this.style._layers[m[O]].is3D()){this.opaquePassCutoff=O;break}this.maybeDrawDepthAndCoords(!1),this.renderToTexture&&(this.renderToTexture.prepareForRender(this.style,this.transform.zoom),this.opaquePassCutoff=0),this.renderPass="offscreen";for(const O of m){const N=this.style._layers[O];if(!N.hasOffscreenPass()||N.isHidden(this.transform.zoom))continue;const V=M[N.source];(N.type==="custom"||V.length)&&this.renderLayer(this,y[N.source],N,V)}if(this.context.bindFramebuffer.set(null),this.context.clear({color:d.showOverdrawInspector?l.aM.black:l.aM.transparent,depth:1}),this.clearStencil(),this.style.sky&&function(O,N){const V=O.context,F=V.gl,Z=((ce,he,ne)=>({u_sky_color:ce.properties.get("sky-color"),u_horizon_color:ce.properties.get("horizon-color"),u_horizon:(he.height/2+he.getHorizon())*ne,u_sky_horizon_blend:ce.properties.get("sky-horizon-blend")*he.height/2*ne}))(N,O.style.map.transform,O.pixelRatio),J=new Gt(F.LEQUAL,Gt.ReadWrite,[0,1]),ee=On.disabled,oe=O.colorModeForRenderPass(),le=O.useProgram("sky");if(!N.mesh){const ce=new l.aX;ce.emplaceBack(-1,-1),ce.emplaceBack(1,-1),ce.emplaceBack(1,1),ce.emplaceBack(-1,1);const he=new l.aY;he.emplaceBack(0,1,2),he.emplaceBack(0,2,3),N.mesh=new yu(V.createVertexBuffer(ce,$s.members),V.createIndexBuffer(he),l.a0.simpleSegment(0,0,ce.length,he.length))}le.draw(V,F.TRIANGLES,J,ee,oe,Tn.disabled,Z,void 0,"sky",N.mesh.vertexBuffer,N.mesh.indexBuffer,N.mesh.segments)}(this,this.style.sky),this._showOverdrawInspector=d.showOverdrawInspector,this.depthRangeFor3D=[0,1-(o._order.length+2)*this.numSublayers*this.depthEpsilon],!this.renderToTexture)for(this.renderPass="opaque",this.currentLayer=m.length-1;this.currentLayer>=0;this.currentLayer--){const O=this.style._layers[m[this.currentLayer]],N=y[O.source],V=x[O.source];this._renderTileClippingMasks(O,V),this.renderLayer(this,N,O,V)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayer<m.length;this.currentLayer++){const O=this.style._layers[m[this.currentLayer]],N=y[O.source];if(this.renderToTexture&&this.renderToTexture.renderLayer(O))continue;const V=(O.type==="symbol"?I:M)[O.source];this._renderTileClippingMasks(O,x[O.source]),this.renderLayer(this,N,O,V)}if(this.options.showTileBoundaries){const O=function(N,V){let F=null;const Z=Object.values(N._layers).flatMap(le=>le.source&&!le.isHidden(V)?[N.sourceCaches[le.source]]:[]),J=Z.filter(le=>le.getSource().type==="vector"),ee=Z.filter(le=>le.getSource().type!=="vector"),oe=le=>{(!F||F.getSource().maxzoom<le.getSource().maxzoom)&&(F=le)};return J.forEach(le=>oe(le)),F||ee.forEach(le=>oe(le)),F}(this.style,this.transform.zoom);O&&function(N,V,F){for(let Z=0;Z<F.length;Z++)bm(N,V,F[Z])}(this,O,O.getVisibleCoordinates())}this.options.showPadding&&function(O){const N=O.transform.padding;Va(O,O.transform.height-(N.top||0),3,yd),Va(O,N.bottom||0,3,un),_m(O,N.left||0,3,mu),_m(O,O.transform.width-(N.right||0),3,v_);const V=O.transform.centerPoint;(function(F,Z,J,ee){gu(F,Z-1,J-10,2,20,ee),gu(F,Z-10,J-1,20,2,ee)})(O,V.x,O.transform.height-V.y,ym)}(this),this.context.setDefault()}maybeDrawDepthAndCoords(o){if(!this.style||!this.style.map||!this.style.map.terrain)return;const d=this.terrainFacilitator.matrix,m=this.transform.modelViewProjectionMatrix;let y=this.terrainFacilitator.dirty;y||(y=o?!l.a_(d,m):!l.a$(d,m)),y||(y=this.style.map.terrain.sourceCache.tilesAfterTime(this.terrainFacilitator.renderTime).length>0),y&&(l.b0(d,m),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,function(x,M){const I=x.context,O=I.gl,N=Jn.unblended,V=new Gt(O.LEQUAL,Gt.ReadWrite,[0,1]),F=M.getTerrainMesh(),Z=M.sourceCache.getRenderableTiles(),J=x.useProgram("terrainDepth");I.bindFramebuffer.set(M.getFramebuffer("depth").framebuffer),I.viewport.set([0,0,x.width/devicePixelRatio,x.height/devicePixelRatio]),I.clear({color:l.aM.transparent,depth:1});for(const ee of Z){const oe=M.getTerrainData(ee.tileID),le={u_matrix:x.transform.calculatePosMatrix(ee.tileID.toUnwrapped()),u_ele_delta:M.getMeshFrameDelta(x.transform.zoom)};J.draw(I,O.TRIANGLES,V,On.disabled,N,Tn.backCCW,le,oe,"terrain",F.vertexBuffer,F.indexBuffer,F.segments)}I.bindFramebuffer.set(null),I.viewport.set([0,0,x.width,x.height])}(this,this.style.map.terrain),function(x,M){const I=x.context,O=I.gl,N=Jn.unblended,V=new Gt(O.LEQUAL,Gt.ReadWrite,[0,1]),F=M.getTerrainMesh(),Z=M.getCoordsTexture(),J=M.sourceCache.getRenderableTiles(),ee=x.useProgram("terrainCoords");I.bindFramebuffer.set(M.getFramebuffer("coords").framebuffer),I.viewport.set([0,0,x.width/devicePixelRatio,x.height/devicePixelRatio]),I.clear({color:l.aM.transparent,depth:1}),M.coordsIndex=[];for(const oe of J){const le=M.getTerrainData(oe.tileID);I.activeTexture.set(O.TEXTURE0),O.bindTexture(O.TEXTURE_2D,Z.texture);const ce={u_matrix:x.transform.calculatePosMatrix(oe.tileID.toUnwrapped()),u_terrain_coords_id:(255-M.coordsIndex.length)/255,u_texture:0,u_ele_delta:M.getMeshFrameDelta(x.transform.zoom)};ee.draw(I,O.TRIANGLES,V,On.disabled,N,Tn.backCCW,ce,le,"terrain",F.vertexBuffer,F.indexBuffer,F.segments),M.coordsIndex.push(oe.tileID.key)}I.bindFramebuffer.set(null),I.viewport.set([0,0,x.width,x.height])}(this,this.style.map.terrain))}renderLayer(o,d,m,y){if(!m.isHidden(this.transform.zoom)&&(m.type==="background"||m.type==="custom"||(y||[]).length))switch(this.id=m.id,m.type){case"symbol":(function(x,M,I,O,N){if(x.renderPass!=="translucent")return;const V=On.disabled,F=x.colorModeForRenderPass();(I._unevaluatedLayout.hasValue("text-variable-anchor")||I._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&function(Z,J,ee,oe,le,ce,he,ne,me){const ge=J.transform,xe=Fs(),Be=le==="map",Fe=ce==="map";for(const Qe of Z){const st=oe.getTile(Qe),Ye=st.getBucket(ee);if(!Ye||!Ye.text||!Ye.text.segments.get().length)continue;const Ge=l.ag(Ye.textSizeData,ge.zoom),mt=Kt(st,1,J.transform.zoom),Bt=qi(Qe.posMatrix,Fe,Be,J.transform,mt),Ke=ee.layout.get("icon-text-fit")!=="none"&&Ye.hasIconData();if(Ge){const nt=Math.pow(2,ge.zoom-st.tileID.overscaledZ),Dt=J.style.map.terrain?($t,Jt)=>J.style.map.terrain.getElevation(Qe,$t,Jt):null,Fn=xe.translatePosition(ge,st,he,ne);za(Ye,Be,Fe,me,ge,Bt,Qe.posMatrix,nt,Ge,Ke,xe,Fn,Qe.toUnwrapped(),Dt)}}}(O,x,I,M,I.layout.get("text-rotation-alignment"),I.layout.get("text-pitch-alignment"),I.paint.get("text-translate"),I.paint.get("text-translate-anchor"),N),I.paint.get("icon-opacity").constantOr(1)!==0&&fd(x,M,I,O,!1,I.paint.get("icon-translate"),I.paint.get("icon-translate-anchor"),I.layout.get("icon-rotation-alignment"),I.layout.get("icon-pitch-alignment"),I.layout.get("icon-keep-upright"),V,F),I.paint.get("text-opacity").constantOr(1)!==0&&fd(x,M,I,O,!0,I.paint.get("text-translate"),I.paint.get("text-translate-anchor"),I.layout.get("text-rotation-alignment"),I.layout.get("text-pitch-alignment"),I.layout.get("text-keep-upright"),V,F),M.map.showCollisionBoxes&&(Ul(x,M,I,O,!0),Ul(x,M,I,O,!1))})(o,d,m,y,this.style.placement.variableOffsets);break;case"circle":(function(x,M,I,O){if(x.renderPass!=="translucent")return;const N=I.paint.get("circle-opacity"),V=I.paint.get("circle-stroke-width"),F=I.paint.get("circle-stroke-opacity"),Z=!I.layout.get("circle-sort-key").isConstant();if(N.constantOr(1)===0&&(V.constantOr(1)===0||F.constantOr(1)===0))return;const J=x.context,ee=J.gl,oe=x.depthModeForSublayer(0,Gt.ReadOnly),le=On.disabled,ce=x.colorModeForRenderPass(),he=[];for(let ne=0;ne<O.length;ne++){const me=O[ne],ge=M.getTile(me),xe=ge.getBucket(I);if(!xe)continue;const Be=xe.programConfigurations.get(I.id),Fe=x.useProgram("circle",Be),Qe=xe.layoutVertexBuffer,st=xe.indexBuffer,Ye=x.style.map.terrain&&x.style.map.terrain.getTerrainData(me),Ge={programConfiguration:Be,program:Fe,layoutVertexBuffer:Qe,indexBuffer:st,uniformValues:a_(x,me,ge,I),terrainData:Ye};if(Z){const mt=xe.segments.get();for(const Bt of mt)he.push({segments:new l.a0([Bt]),sortKey:Bt.sortKey,state:Ge})}else he.push({segments:xe.segments,sortKey:0,state:Ge})}Z&&he.sort((ne,me)=>ne.sortKey-me.sortKey);for(const ne of he){const{programConfiguration:me,program:ge,layoutVertexBuffer:xe,indexBuffer:Be,uniformValues:Fe,terrainData:Qe}=ne.state;ge.draw(J,ee.TRIANGLES,oe,le,ce,Tn.disabled,Fe,Qe,I.id,xe,Be,ne.segments,I.paint,x.transform.zoom,me)}})(o,d,m,y);break;case"heatmap":(function(x,M,I,O){if(I.paint.get("heatmap-opacity")===0)return;const N=x.context;if(x.style.map.terrain){for(const V of O){const F=M.getTile(V);M.hasRenderableParent(V)||(x.renderPass==="offscreen"?gd(x,F,I,V):x.renderPass==="translucent"&&Zs(x,I,V))}N.viewport.set([0,0,x.width,x.height])}else x.renderPass==="offscreen"?function(V,F,Z,J){const ee=V.context,oe=ee.gl,le=On.disabled,ce=new Jn([oe.ONE,oe.ONE],l.aM.transparent,[!0,!0,!0,!0]);(function(he,ne,me){const ge=he.gl;he.activeTexture.set(ge.TEXTURE1),he.viewport.set([0,0,ne.width/4,ne.height/4]);let xe=me.heatmapFbos.get(l.aU);xe?(ge.bindTexture(ge.TEXTURE_2D,xe.colorAttachment.get()),he.bindFramebuffer.set(xe.framebuffer)):(xe=ql(he,ne.width/4,ne.height/4),me.heatmapFbos.set(l.aU,xe))})(ee,V,Z),ee.clear({color:l.aM.transparent});for(let he=0;he<J.length;he++){const ne=J[he];if(F.hasRenderableParent(ne))continue;const me=F.getTile(ne),ge=me.getBucket(Z);if(!ge)continue;const xe=ge.programConfigurations.get(Z.id),Be=V.useProgram("heatmap",xe),{zoom:Fe}=V.transform;Be.draw(ee,oe.TRIANGLES,Gt.disabled,le,ce,Tn.disabled,ir(ne.posMatrix,me,Fe,Z.paint.get("heatmap-intensity")),null,Z.id,ge.layoutVertexBuffer,ge.indexBuffer,ge.segments,Z.paint,V.transform.zoom,xe)}ee.viewport.set([0,0,V.width,V.height])}(x,M,I,O):x.renderPass==="translucent"&&function(V,F){const Z=V.context,J=Z.gl;Z.setColorMode(V.colorModeForRenderPass());const ee=F.heatmapFbos.get(l.aU);ee&&(Z.activeTexture.set(J.TEXTURE0),J.bindTexture(J.TEXTURE_2D,ee.colorAttachment.get()),Z.activeTexture.set(J.TEXTURE1),Wl(Z,F).bind(J.LINEAR,J.CLAMP_TO_EDGE),V.useProgram("heatmapTexture").draw(Z,J.TRIANGLES,Gt.disabled,On.disabled,V.colorModeForRenderPass(),Tn.disabled,ou(V,F,0,1),null,F.id,V.viewportBuffer,V.quadTriangleIndexBuffer,V.viewportSegments,F.paint,V.transform.zoom))}(x,I)})(o,d,m,y);break;case"line":(function(x,M,I,O){if(x.renderPass!=="translucent")return;const N=I.paint.get("line-opacity"),V=I.paint.get("line-width");if(N.constantOr(1)===0||V.constantOr(1)===0)return;const F=x.depthModeForSublayer(0,Gt.ReadOnly),Z=x.colorModeForRenderPass(),J=I.paint.get("line-dasharray"),ee=I.paint.get("line-pattern"),oe=ee.constantOr(1),le=I.paint.get("line-gradient"),ce=I.getCrossfadeParameters(),he=oe?"linePattern":J?"lineSDF":le?"lineGradient":"line",ne=x.context,me=ne.gl;let ge=!0;for(const xe of O){const Be=M.getTile(xe);if(oe&&!Be.patternsLoaded())continue;const Fe=Be.getBucket(I);if(!Fe)continue;const Qe=Fe.programConfigurations.get(I.id),st=x.context.program.get(),Ye=x.useProgram(he,Qe),Ge=ge||Ye.program!==st,mt=x.style.map.terrain&&x.style.map.terrain.getTerrainData(xe),Bt=ee.constantOr(null);if(Bt&&Be.imageAtlas){const Dt=Be.imageAtlas,Fn=Dt.patternPositions[Bt.to.toString()],$t=Dt.patternPositions[Bt.from.toString()];Fn&&$t&&Qe.setConstantPatternPositions(Fn,$t)}const Ke=mt?xe:null,nt=oe?Oa(x,Be,I,ce,Ke):J?l_(x,Be,I,J,ce,Ke):le?em(x,Be,I,Fe.lineClipsArray.length,Ke):au(x,Be,I,Ke);if(oe)ne.activeTexture.set(me.TEXTURE0),Be.imageAtlasTexture.bind(me.LINEAR,me.CLAMP_TO_EDGE),Qe.updatePaintBuffers(ce);else if(J&&(Ge||x.lineAtlas.dirty))ne.activeTexture.set(me.TEXTURE0),x.lineAtlas.bind(ne);else if(le){const Dt=Fe.gradients[I.id];let Fn=Dt.texture;if(I.gradientVersion!==Dt.version){let $t=256;if(I.stepInterpolant){const Jt=M.getSource().maxzoom,$n=xe.canonical.z===Jt?Math.ceil(1<<x.transform.maxZoom-xe.canonical.z):1;$t=l.ac(l.aV(Fe.maxLineLength/l.X*1024*$n),256,ne.maxTextureSize)}Dt.gradient=l.aW({expression:I.gradientExpression(),evaluationKey:"lineProgress",resolution:$t,image:Dt.gradient||void 0,clips:Fe.lineClipsArray}),Dt.texture?Dt.texture.update(Dt.gradient):Dt.texture=new Xe(ne,Dt.gradient,me.RGBA),Dt.version=I.gradientVersion,Fn=Dt.texture}ne.activeTexture.set(me.TEXTURE0),Fn.bind(I.stepInterpolant?me.NEAREST:me.LINEAR,me.CLAMP_TO_EDGE)}Ye.draw(ne,me.TRIANGLES,F,x.stencilModeForClipping(xe),Z,Tn.disabled,nt,mt,I.id,Fe.layoutVertexBuffer,Fe.indexBuffer,Fe.segments,I.paint,x.transform.zoom,Qe,Fe.layoutVertexBuffer2),ge=!1}})(o,d,m,y);break;case"fill":(function(x,M,I,O){const N=I.paint.get("fill-color"),V=I.paint.get("fill-opacity");if(V.constantOr(1)===0)return;const F=x.colorModeForRenderPass(),Z=I.paint.get("fill-pattern"),J=x.opaquePassEnabledForLayer()&&!Z.constantOr(1)&&N.constantOr(l.aM.transparent).a===1&&V.constantOr(0)===1?"opaque":"translucent";if(x.renderPass===J){const ee=x.depthModeForSublayer(1,x.renderPass==="opaque"?Gt.ReadWrite:Gt.ReadOnly);Gl(x,M,I,O,ee,F,!1)}if(x.renderPass==="translucent"&&I.paint.get("fill-antialias")){const ee=x.depthModeForSublayer(I.getPaintProperty("fill-outline-color")?2:0,Gt.ReadOnly);Gl(x,M,I,O,ee,F,!0)}})(o,d,m,y);break;case"fill-extrusion":(function(x,M,I,O){const N=I.paint.get("fill-extrusion-opacity");if(N!==0&&x.renderPass==="translucent"){const V=new Gt(x.context.gl.LEQUAL,Gt.ReadWrite,x.depthRangeFor3D);if(N!==1||I.paint.get("fill-extrusion-pattern").constantOr(1))fu(x,M,I,O,V,On.disabled,Jn.disabled),fu(x,M,I,O,V,x.stencilModeFor3D(),x.colorModeForRenderPass());else{const F=x.colorModeForRenderPass();fu(x,M,I,O,V,On.disabled,F)}}})(o,d,m,y);break;case"hillshade":(function(x,M,I,O){if(x.renderPass!=="offscreen"&&x.renderPass!=="translucent")return;const N=x.context,V=x.depthModeForSublayer(0,Gt.ReadOnly),F=x.colorModeForRenderPass(),[Z,J]=x.renderPass==="translucent"?x.stencilConfigForOverlap(O):[{},O];for(const ee of J){const oe=M.getTile(ee);oe.needsHillshadePrepare!==void 0&&oe.needsHillshadePrepare&&x.renderPass==="offscreen"?La(x,oe,I,V,On.disabled,F):x.renderPass==="translucent"&&Ra(x,ee,oe,I,V,Z[ee.overscaledZ],F)}N.viewport.set([0,0,x.width,x.height])})(o,d,m,y);break;case"raster":(function(x,M,I,O){if(x.renderPass!=="translucent"||I.paint.get("raster-opacity")===0||!O.length)return;const N=x.context,V=N.gl,F=M.getSource(),Z=x.useProgram("raster"),J=x.colorModeForRenderPass(),[ee,oe]=F instanceof xi?[{},O]:x.stencilConfigForOverlap(O),le=oe[oe.length-1].overscaledZ,ce=!x.options.moving;for(const he of oe){const ne=x.depthModeForSublayer(he.overscaledZ-le,I.paint.get("raster-opacity")===1?Gt.ReadWrite:Gt.ReadOnly,V.LESS),me=M.getTile(he);me.registerFadeDuration(I.paint.get("raster-fade-duration"));const ge=M.findLoadedParent(he,0),xe=M.findLoadedSibling(he),Be=gm(me,ge||xe||null,M,I,x.transform,x.style.map.terrain);let Fe,Qe;const st=I.paint.get("raster-resampling")==="nearest"?V.NEAREST:V.LINEAR;N.activeTexture.set(V.TEXTURE0),me.texture.bind(st,V.CLAMP_TO_EDGE,V.LINEAR_MIPMAP_NEAREST),N.activeTexture.set(V.TEXTURE1),ge?(ge.texture.bind(st,V.CLAMP_TO_EDGE,V.LINEAR_MIPMAP_NEAREST),Fe=Math.pow(2,ge.tileID.overscaledZ-me.tileID.overscaledZ),Qe=[me.tileID.canonical.x*Fe%1,me.tileID.canonical.y*Fe%1]):me.texture.bind(st,V.CLAMP_TO_EDGE,V.LINEAR_MIPMAP_NEAREST),me.texture.useMipmap&&N.extTextureFilterAnisotropic&&x.transform.pitch>20&&V.texParameterf(V.TEXTURE_2D,N.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,N.extTextureFilterAnisotropicMax);const Ye=x.style.map.terrain&&x.style.map.terrain.getTerrainData(he),Ge=Ye?he:null,mt=Ge?Ge.posMatrix:x.transform.calculatePosMatrix(he.toUnwrapped(),ce),Bt=c_(mt,Qe||[0,0],Fe||1,Be,I);F instanceof xi?Z.draw(N,V.TRIANGLES,ne,On.disabled,J,Tn.disabled,Bt,Ye,I.id,F.boundsBuffer,x.quadTriangleIndexBuffer,F.boundsSegments):Z.draw(N,V.TRIANGLES,ne,ee[he.overscaledZ],J,Tn.disabled,Bt,Ye,I.id,x.rasterBoundsBuffer,x.quadTriangleIndexBuffer,x.rasterBoundsSegments)}})(o,d,m,y);break;case"background":(function(x,M,I,O){const N=I.paint.get("background-color"),V=I.paint.get("background-opacity");if(V===0)return;const F=x.context,Z=F.gl,J=x.transform,ee=J.tileSize,oe=I.paint.get("background-pattern");if(x.isPatternMissing(oe))return;const le=!oe&&N.a===1&&V===1&&x.opaquePassEnabledForLayer()?"opaque":"translucent";if(x.renderPass!==le)return;const ce=On.disabled,he=x.depthModeForSublayer(0,le==="opaque"?Gt.ReadWrite:Gt.ReadOnly),ne=x.colorModeForRenderPass(),me=x.useProgram(oe?"backgroundPattern":"background"),ge=O||J.coveringTiles({tileSize:ee,terrain:x.style.map.terrain});oe&&(F.activeTexture.set(Z.TEXTURE0),x.imageManager.bind(x.context));const xe=I.getCrossfadeParameters();for(const Be of ge){const Fe=O?Be.posMatrix:x.transform.calculatePosMatrix(Be.toUnwrapped()),Qe=oe?id(Fe,V,x,oe,{tileID:Be,tileSize:ee},xe):lu(Fe,V,N),st=x.style.map.terrain&&x.style.map.terrain.getTerrainData(Be);me.draw(F,Z.TRIANGLES,he,ce,ne,Tn.disabled,Qe,st,I.id,x.tileExtentBuffer,x.quadTriangleIndexBuffer,x.tileExtentSegments)}})(o,0,m,y);break;case"custom":(function(x,M,I){const O=x.context,N=I.implementation;if(x.renderPass==="offscreen"){const V=N.prerender;V&&(x.setCustomLayerDefaults(),O.setColorMode(x.colorModeForRenderPass()),V.call(N,O.gl,x.transform.customLayerMatrix()),O.setDirty(),x.setBaseState())}else if(x.renderPass==="translucent"){x.setCustomLayerDefaults(),O.setColorMode(x.colorModeForRenderPass()),O.setStencilMode(On.disabled);const V=N.renderingMode==="3d"?new Gt(x.context.gl.LEQUAL,Gt.ReadWrite,x.depthRangeFor3D):x.depthModeForSublayer(0,Gt.ReadOnly);O.setDepthMode(V),N.render(O.gl,x.transform.customLayerMatrix(),{farZ:x.transform.farZ,nearZ:x.transform.nearZ,fov:x.transform._fov,modelViewProjectionMatrix:x.transform.modelViewProjectionMatrix,projectionMatrix:x.transform.projectionMatrix}),O.setDirty(),x.setBaseState(),O.bindFramebuffer.set(null)}})(o,0,m)}}translatePosMatrix(o,d,m,y,x){if(!m[0]&&!m[1])return o;const M=x?y==="map"?this.transform.angle:0:y==="viewport"?-this.transform.angle:0;if(M){const N=Math.sin(M),V=Math.cos(M);m=[m[0]*V-m[1]*N,m[0]*N+m[1]*V]}const I=[x?m[0]:Kt(d,m[0],this.transform.zoom),x?m[1]:Kt(d,m[1],this.transform.zoom),0],O=new Float32Array(16);return l.J(O,o,I),O}saveTileTexture(o){const d=this._tileTextures[o.size[0]];d?d.push(o):this._tileTextures[o.size[0]]=[o]}getTileTexture(o){const d=this._tileTextures[o];return d&&d.length>0?d.pop():null}isPatternMissing(o){if(!o)return!1;if(!o.from||!o.to)return!0;const d=this.imageManager.getPattern(o.from.toString()),m=this.imageManager.getPattern(o.to.toString());return!d||!m}useProgram(o,d){this.cache=this.cache||{};const m=o+(d?d.cacheKey:"")+(this._showOverdrawInspector?"/overdraw":"")+(this.style.map.terrain?"/terrain":"");return this.cache[m]||(this.cache[m]=new td(this.context,ds[o],d,rd[o],this._showOverdrawInspector,this.style.map.terrain)),this.cache[m]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){const o=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(o.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new Xe(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}overLimit(){const{drawingBufferWidth:o,drawingBufferHeight:d}=this.context.gl;return this.width!==o||this.height!==d}}class Fa{constructor(o,d){this.points=o,this.planes=d}static fromInvProjectionMatrix(o,d,m){const y=Math.pow(2,m),x=[[-1,1,-1,1],[1,1,-1,1],[1,-1,-1,1],[-1,-1,-1,1],[-1,1,1,1],[1,1,1,1],[1,-1,1,1],[-1,-1,1,1]].map(I=>{const O=1/(I=l.af([],I,o))[3]/d*y;return l.b1(I,I,[O,O,1/I[3],O])}),M=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(I=>{const O=function(Z,J){var ee=J[0],oe=J[1],le=J[2],ce=ee*ee+oe*oe+le*le;return ce>0&&(ce=1/Math.sqrt(ce)),Z[0]=J[0]*ce,Z[1]=J[1]*ce,Z[2]=J[2]*ce,Z}([],function(Z,J,ee){var oe=J[0],le=J[1],ce=J[2],he=ee[0],ne=ee[1],me=ee[2];return Z[0]=le*me-ce*ne,Z[1]=ce*he-oe*me,Z[2]=oe*ne-le*he,Z}([],Se([],x[I[0]],x[I[1]]),Se([],x[I[2]],x[I[1]]))),N=-((V=O)[0]*(F=x[I[1]])[0]+V[1]*F[1]+V[2]*F[2]);var V,F;return O.concat(N)});return new Fa(x,M)}}class $a{constructor(o,d){this.min=o,this.max=d,this.center=function(m,y,x){return m[0]=.5*y[0],m[1]=.5*y[1],m[2]=.5*y[2],m}([],function(m,y,x){return m[0]=y[0]+x[0],m[1]=y[1]+x[1],m[2]=y[2]+x[2],m}([],this.min,this.max))}quadrant(o){const d=[o%2==0,o<2],m=Ie(this.min),y=Ie(this.max);for(let x=0;x<d.length;x++)m[x]=d[x]?this.min[x]:this.center[x],y[x]=d[x]?this.center[x]:this.max[x];return y[2]=this.max[2],new $a(m,y)}distanceX(o){return Math.max(Math.min(this.max[0],o[0]),this.min[0])-o[0]}distanceY(o){return Math.max(Math.min(this.max[1],o[1]),this.min[1])-o[1]}intersects(o){const d=[[this.min[0],this.min[1],this.min[2],1],[this.max[0],this.min[1],this.min[2],1],[this.max[0],this.max[1],this.min[2],1],[this.min[0],this.max[1],this.min[2],1],[this.min[0],this.min[1],this.max[2],1],[this.max[0],this.min[1],this.max[2],1],[this.max[0],this.max[1],this.max[2],1],[this.min[0],this.max[1],this.max[2],1]];let m=!0;for(let y=0;y<o.planes.length;y++){const x=o.planes[y];let M=0;for(let I=0;I<d.length;I++)l.b2(x,d[I])>=0&&M++;if(M===0)return 0;M!==d.length&&(m=!1)}if(m)return 2;for(let y=0;y<3;y++){let x=Number.MAX_VALUE,M=-Number.MAX_VALUE;for(let I=0;I<o.points.length;I++){const O=o.points[I][y]-this.min[y];x=Math.min(x,O),M=Math.max(M,O)}if(M<0||x>this.max[y]-this.min[y])return 0}return 1}}class ja{constructor(o=0,d=0,m=0,y=0){if(isNaN(o)||o<0||isNaN(d)||d<0||isNaN(m)||m<0||isNaN(y)||y<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=o,this.bottom=d,this.left=m,this.right=y}interpolate(o,d,m){return d.top!=null&&o.top!=null&&(this.top=l.y.number(o.top,d.top,m)),d.bottom!=null&&o.bottom!=null&&(this.bottom=l.y.number(o.bottom,d.bottom,m)),d.left!=null&&o.left!=null&&(this.left=l.y.number(o.left,d.left,m)),d.right!=null&&o.right!=null&&(this.right=l.y.number(o.right,d.right,m)),this}getCenter(o,d){const m=l.ac((this.left+o-this.right)/2,0,o),y=l.ac((this.top+d-this.bottom)/2,0,d);return new l.P(m,y)}equals(o){return this.top===o.top&&this.bottom===o.bottom&&this.left===o.left&&this.right===o.right}clone(){return new ja(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}const _d=85.051129;class Ua{constructor(o,d,m,y,x){this.tileSize=512,this._renderWorldCopies=x===void 0||!!x,this._minZoom=o||0,this._maxZoom=d||22,this._minPitch=m??0,this._maxPitch=y??60,this.setMaxBounds(),this.width=0,this.height=0,this._center=new l.N(0,0),this._elevation=0,this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new ja,this._posMatrixCache={},this._alignedPosMatrixCache={},this._fogMatrixCache={},this.minElevationForCurrentTile=0}clone(){const o=new Ua(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return o.apply(this),o}apply(o){this.tileSize=o.tileSize,this.latRange=o.latRange,this.lngRange=o.lngRange,this.width=o.width,this.height=o.height,this._center=o._center,this._elevation=o._elevation,this.minElevationForCurrentTile=o.minElevationForCurrentTile,this.zoom=o.zoom,this.angle=o.angle,this._fov=o._fov,this._pitch=o._pitch,this._unmodified=o._unmodified,this._edgeInsets=o._edgeInsets.clone(),this._calcMatrices()}get minZoom(){return this._minZoom}set minZoom(o){this._minZoom!==o&&(this._minZoom=o,this.zoom=Math.max(this.zoom,o))}get maxZoom(){return this._maxZoom}set maxZoom(o){this._maxZoom!==o&&(this._maxZoom=o,this.zoom=Math.min(this.zoom,o))}get minPitch(){return this._minPitch}set minPitch(o){this._minPitch!==o&&(this._minPitch=o,this.pitch=Math.max(this.pitch,o))}get maxPitch(){return this._maxPitch}set maxPitch(o){this._maxPitch!==o&&(this._maxPitch=o,this.pitch=Math.min(this.pitch,o))}get renderWorldCopies(){return this._renderWorldCopies}set renderWorldCopies(o){o===void 0?o=!0:o===null&&(o=!1),this._renderWorldCopies=o}get worldSize(){return this.tileSize*this.scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new l.P(this.width,this.height)}get bearing(){return-this.angle/Math.PI*180}set bearing(o){const d=-l.b3(o,-180,180)*Math.PI/180;this.angle!==d&&(this._unmodified=!1,this.angle=d,this._calcMatrices(),this.rotationMatrix=function(){var m=new l.A(4);return l.A!=Float32Array&&(m[1]=0,m[2]=0),m[0]=1,m[3]=1,m}(),function(m,y,x){var M=y[0],I=y[1],O=y[2],N=y[3],V=Math.sin(x),F=Math.cos(x);m[0]=M*F+O*V,m[1]=I*F+N*V,m[2]=M*-V+O*F,m[3]=I*-V+N*F}(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(o){const d=l.ac(o,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==d&&(this._unmodified=!1,this._pitch=d,this._calcMatrices())}get fov(){return this._fov/Math.PI*180}set fov(o){o=Math.max(.01,Math.min(60,o)),this._fov!==o&&(this._unmodified=!1,this._fov=o/180*Math.PI,this._calcMatrices())}get zoom(){return this._zoom}set zoom(o){const d=Math.min(Math.max(o,this.minZoom),this.maxZoom);this._zoom!==d&&(this._unmodified=!1,this._zoom=d,this.tileZoom=Math.max(0,Math.floor(d)),this.scale=this.zoomScale(d),this._constrain(),this._calcMatrices())}get center(){return this._center}set center(o){o.lat===this._center.lat&&o.lng===this._center.lng||(this._unmodified=!1,this._center=o,this._constrain(),this._calcMatrices())}get elevation(){return this._elevation}set elevation(o){o!==this._elevation&&(this._elevation=o,this._constrain(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}set padding(o){this._edgeInsets.equals(o)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,o,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}isPaddingEqual(o){return this._edgeInsets.equals(o)}interpolatePadding(o,d,m){this._unmodified=!1,this._edgeInsets.interpolate(o,d,m),this._constrain(),this._calcMatrices()}coveringZoomLevel(o){const d=(o.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/o.tileSize));return Math.max(0,d)}getVisibleUnwrappedCoordinates(o){const d=[new l.b4(0,o)];if(this._renderWorldCopies){const m=this.pointCoordinate(new l.P(0,0)),y=this.pointCoordinate(new l.P(this.width,0)),x=this.pointCoordinate(new l.P(this.width,this.height)),M=this.pointCoordinate(new l.P(0,this.height)),I=Math.floor(Math.min(m.x,y.x,x.x,M.x)),O=Math.floor(Math.max(m.x,y.x,x.x,M.x)),N=1;for(let V=I-N;V<=O+N;V++)V!==0&&d.push(new l.b4(V,o))}return d}coveringTiles(o){var d,m;let y=this.coveringZoomLevel(o);const x=y;if(o.minzoom!==void 0&&y<o.minzoom)return[];o.maxzoom!==void 0&&y>o.maxzoom&&(y=o.maxzoom);const M=this.pointCoordinate(this.getCameraPoint()),I=l.Z.fromLngLat(this.center),O=Math.pow(2,y),N=[O*M.x,O*M.y,0],V=[O*I.x,O*I.y,0],F=Fa.fromInvProjectionMatrix(this.invModelViewProjectionMatrix,this.worldSize,y);let Z=o.minzoom||0;!o.terrain&&this.pitch<=60&&this._edgeInsets.top<.1&&(Z=y);const J=o.terrain?2/Math.min(this.tileSize,o.tileSize)*this.tileSize:3,ee=ne=>({aabb:new $a([ne*O,0,0],[(ne+1)*O,O,0]),zoom:0,x:0,y:0,wrap:ne,fullyVisible:!1}),oe=[],le=[],ce=y,he=o.reparseOverscaled?x:y;if(this._renderWorldCopies)for(let ne=1;ne<=3;ne++)oe.push(ee(-ne)),oe.push(ee(ne));for(oe.push(ee(0));oe.length>0;){const ne=oe.pop(),me=ne.x,ge=ne.y;let xe=ne.fullyVisible;if(!xe){const Ye=ne.aabb.intersects(F);if(Ye===0)continue;xe=Ye===2}const Be=o.terrain?N:V,Fe=ne.aabb.distanceX(Be),Qe=ne.aabb.distanceY(Be),st=Math.max(Math.abs(Fe),Math.abs(Qe));if(ne.zoom===ce||st>J+(1<<ce-ne.zoom)-2&&ne.zoom>=Z){const Ye=ce-ne.zoom,Ge=N[0]-.5-(me<<Ye),mt=N[1]-.5-(ge<<Ye);le.push({tileID:new l.S(ne.zoom===ce?he:ne.zoom,ne.wrap,ne.zoom,me,ge),distanceSq:Ne([V[0]-.5-me,V[1]-.5-ge]),tileDistanceToCamera:Math.sqrt(Ge*Ge+mt*mt)})}else for(let Ye=0;Ye<4;Ye++){const Ge=(me<<1)+Ye%2,mt=(ge<<1)+(Ye>>1),Bt=ne.zoom+1;let Ke=ne.aabb.quadrant(Ye);if(o.terrain){const nt=new l.S(Bt,ne.wrap,Bt,Ge,mt),Dt=o.terrain.getMinMaxElevation(nt),Fn=(d=Dt.minElevation)!==null&&d!==void 0?d:this.elevation,$t=(m=Dt.maxElevation)!==null&&m!==void 0?m:this.elevation;Ke=new $a([Ke.min[0],Ke.min[1],Fn],[Ke.max[0],Ke.max[1],$t])}oe.push({aabb:Ke,zoom:Bt,x:Ge,y:mt,wrap:ne.wrap,fullyVisible:xe})}}return le.sort((ne,me)=>ne.distanceSq-me.distanceSq).map(ne=>ne.tileID)}resize(o,d){this.width=o,this.height=d,this.pixelsToGLUnits=[2/o,-2/d],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(o){return Math.pow(2,o)}scaleZoom(o){return Math.log(o)/Math.LN2}project(o){const d=l.ac(o.lat,-85.051129,_d);return new l.P(l.O(o.lng)*this.worldSize,l.Q(d)*this.worldSize)}unproject(o){return new l.Z(o.x/this.worldSize,o.y/this.worldSize).toLngLat()}get point(){return this.project(this.center)}getCameraPosition(){return{lngLat:this.pointLocation(this.getCameraPoint()),altitude:Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter+this.elevation}}recalculateZoom(o){const d=this.elevation,m=Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter,y=this.pointLocation(this.centerPoint,o),x=o.getElevationForLngLatZoom(y,this.tileZoom);if(!(this.elevation-x))return;const M=m+d-x,I=Math.cos(this._pitch)*this.cameraToCenterDistance/M/l.b5(1,y.lat),O=this.scaleZoom(I/this.tileSize);this._elevation=x,this._center=y,this.zoom=O}setLocationAtPoint(o,d){const m=this.pointCoordinate(d),y=this.pointCoordinate(this.centerPoint),x=this.locationCoordinate(o),M=new l.Z(x.x-(m.x-y.x),x.y-(m.y-y.y));this.center=this.coordinateLocation(M),this._renderWorldCopies&&(this.center=this.center.wrap())}locationPoint(o,d){return d?this.coordinatePoint(this.locationCoordinate(o),d.getElevationForLngLatZoom(o,this.tileZoom),this.pixelMatrix3D):this.coordinatePoint(this.locationCoordinate(o))}pointLocation(o,d){return this.coordinateLocation(this.pointCoordinate(o,d))}locationCoordinate(o){return l.Z.fromLngLat(o)}coordinateLocation(o){return o&&o.toLngLat()}pointCoordinate(o,d){if(d){const Z=d.pointCoordinate(o);if(Z!=null)return Z}const m=[o.x,o.y,0,1],y=[o.x,o.y,1,1];l.af(m,m,this.pixelMatrixInverse),l.af(y,y,this.pixelMatrixInverse);const x=m[3],M=y[3],I=m[1]/x,O=y[1]/M,N=m[2]/x,V=y[2]/M,F=N===V?0:(0-N)/(V-N);return new l.Z(l.y.number(m[0]/x,y[0]/M,F)/this.worldSize,l.y.number(I,O,F)/this.worldSize)}coordinatePoint(o,d=0,m=this.pixelMatrix){const y=[o.x*this.worldSize,o.y*this.worldSize,d,1];return l.af(y,y,m),new l.P(y[0]/y[3],y[1]/y[3])}getBounds(){const o=Math.max(0,this.height/2-this.getHorizon());return new we().extend(this.pointLocation(new l.P(0,o))).extend(this.pointLocation(new l.P(this.width,o))).extend(this.pointLocation(new l.P(this.width,this.height))).extend(this.pointLocation(new l.P(0,this.height)))}getMaxBounds(){return this.latRange&&this.latRange.length===2&&this.lngRange&&this.lngRange.length===2?new we([this.lngRange[0],this.latRange[0]],[this.lngRange[1],this.latRange[1]]):null}getHorizon(){return Math.tan(Math.PI/2-this._pitch)*this.cameraToCenterDistance*.85}setMaxBounds(o){o?(this.lngRange=[o.getWest(),o.getEast()],this.latRange=[o.getSouth(),o.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-85.051129,_d])}calculateTileMatrix(o){const d=o.canonical,m=this.worldSize/this.zoomScale(d.z),y=d.x+Math.pow(2,d.z)*o.wrap,x=l.an(new Float64Array(16));return l.J(x,x,[y*m,d.y*m,0]),l.K(x,x,[m/l.X,m/l.X,1]),x}calculatePosMatrix(o,d=!1){const m=o.key,y=d?this._alignedPosMatrixCache:this._posMatrixCache;if(y[m])return y[m];const x=this.calculateTileMatrix(o);return l.L(x,d?this.alignedModelViewProjectionMatrix:this.modelViewProjectionMatrix,x),y[m]=new Float32Array(x),y[m]}calculateFogMatrix(o){const d=o.key,m=this._fogMatrixCache;if(m[d])return m[d];const y=this.calculateTileMatrix(o);return l.L(y,this.fogMatrix,y),m[d]=new Float32Array(y),m[d]}customLayerMatrix(){return this.mercatorMatrix.slice()}getConstrained(o,d){d=l.ac(+d,this.minZoom,this.maxZoom);const m={center:new l.N(o.lng,o.lat),zoom:d};let y=this.lngRange;if(!this._renderWorldCopies&&y===null){const ne=179.9999999999;y=[-ne,ne]}const x=this.tileSize*this.zoomScale(m.zoom);let M=0,I=x,O=0,N=x,V=0,F=0;const{x:Z,y:J}=this.size;if(this.latRange){const ne=this.latRange;M=l.Q(ne[1])*x,I=l.Q(ne[0])*x,I-M<J&&(V=J/(I-M))}y&&(O=l.b3(l.O(y[0])*x,0,x),N=l.b3(l.O(y[1])*x,0,x),N<O&&(N+=x),N-O<Z&&(F=Z/(N-O)));const{x:ee,y:oe}=this.project.call({worldSize:x},o);let le,ce;const he=Math.max(F||0,V||0);if(he){const ne=new l.P(F?(N+O)/2:ee,V?(I+M)/2:oe);return m.center=this.unproject.call({worldSize:x},ne).wrap(),m.zoom+=this.scaleZoom(he),m}if(this.latRange){const ne=J/2;oe-ne<M&&(ce=M+ne),oe+ne>I&&(ce=I-ne)}if(y){const ne=(O+N)/2;let me=ee;this._renderWorldCopies&&(me=l.b3(ee,ne-x/2,ne+x/2));const ge=Z/2;me-ge<O&&(le=O+ge),me+ge>N&&(le=N-ge)}if(le!==void 0||ce!==void 0){const ne=new l.P(le??ee,ce??oe);m.center=this.unproject.call({worldSize:x},ne).wrap()}return m}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;const o=this._unmodified,{center:d,zoom:m}=this.getConstrained(this.center,this.zoom);this.center=d,this.zoom=m,this._unmodified=o,this._constraining=!1}_calcMatrices(){if(!this.height)return;const o=this.centerOffset,d=this.point.x,m=this.point.y;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height,this._pixelPerMeter=l.b5(1,this.center.lat)*this.worldSize;let y=l.an(new Float64Array(16));l.K(y,y,[this.width/2,-this.height/2,1]),l.J(y,y,[1,-1,0]),this.labelPlaneMatrix=y,y=l.an(new Float64Array(16)),l.K(y,y,[1,-1,1]),l.J(y,y,[-1,-1,0]),l.K(y,y,[2/this.width,2/this.height,1]),this.glCoordMatrix=y;const x=this.cameraToCenterDistance+this._elevation*this._pixelPerMeter/Math.cos(this._pitch),M=Math.min(this.elevation,this.minElevationForCurrentTile),I=x-M*this._pixelPerMeter/Math.cos(this._pitch),O=M<0?I:x,N=Math.PI/2+this._pitch,V=this._fov*(.5+o.y/this.height),F=Math.sin(V)*O/Math.sin(l.ac(Math.PI-N-V,.01,Math.PI-.01)),Z=this.getHorizon(),J=2*Math.atan(Z/this.cameraToCenterDistance)*(.5+o.y/(2*Z)),ee=Math.sin(J)*O/Math.sin(l.ac(Math.PI-N-J,.01,Math.PI-.01)),oe=Math.min(F,ee);this.farZ=1.01*(Math.cos(Math.PI/2-this._pitch)*oe+O),this.nearZ=this.height/50,y=new Float64Array(16),l.b6(y,this._fov,this.width/this.height,this.nearZ,this.farZ),y[8]=2*-o.x/this.width,y[9]=2*o.y/this.height,this.projectionMatrix=l.ae(y),l.K(y,y,[1,-1,1]),l.J(y,y,[0,0,-this.cameraToCenterDistance]),l.b7(y,y,this._pitch),l.ad(y,y,this.angle),l.J(y,y,[-d,-m,0]),this.mercatorMatrix=l.K([],y,[this.worldSize,this.worldSize,this.worldSize]),l.K(y,y,[1,1,this._pixelPerMeter]),this.pixelMatrix=l.L(new Float64Array(16),this.labelPlaneMatrix,y),l.J(y,y,[0,0,-this.elevation]),this.modelViewProjectionMatrix=y,this.invModelViewProjectionMatrix=l.as([],y),this.fogMatrix=new Float64Array(16),l.b6(this.fogMatrix,this._fov,this.width/this.height,x,this.farZ),this.fogMatrix[8]=2*-o.x/this.width,this.fogMatrix[9]=2*o.y/this.height,l.K(this.fogMatrix,this.fogMatrix,[1,-1,1]),l.J(this.fogMatrix,this.fogMatrix,[0,0,-this.cameraToCenterDistance]),l.b7(this.fogMatrix,this.fogMatrix,this._pitch),l.ad(this.fogMatrix,this.fogMatrix,this.angle),l.J(this.fogMatrix,this.fogMatrix,[-d,-m,0]),l.K(this.fogMatrix,this.fogMatrix,[1,1,this._pixelPerMeter]),l.J(this.fogMatrix,this.fogMatrix,[0,0,-this.elevation]),this.pixelMatrix3D=l.L(new Float64Array(16),this.labelPlaneMatrix,y);const le=this.width%2/2,ce=this.height%2/2,he=Math.cos(this.angle),ne=Math.sin(this.angle),me=d-Math.round(d)+he*le+ne*ce,ge=m-Math.round(m)+he*ce+ne*le,xe=new Float64Array(y);if(l.J(xe,xe,[me>.5?me-1:me,ge>.5?ge-1:ge,0]),this.alignedModelViewProjectionMatrix=xe,y=l.as(new Float64Array(16),this.pixelMatrix),!y)throw new Error("failed to invert matrix");this.pixelMatrixInverse=y,this._posMatrixCache={},this._alignedPosMatrixCache={},this._fogMatrixCache={}}maxPitchScaleFactor(){if(!this.pixelMatrixInverse)return 1;const o=this.pointCoordinate(new l.P(0,0)),d=[o.x*this.worldSize,o.y*this.worldSize,0,1];return l.af(d,d,this.pixelMatrix)[3]/this.cameraToCenterDistance}getCameraPoint(){const o=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new l.P(0,o))}getCameraQueryGeometry(o){const d=this.getCameraPoint();if(o.length===1)return[o[0],d];{let m=d.x,y=d.y,x=d.x,M=d.y;for(const I of o)m=Math.min(m,I.x),y=Math.min(y,I.y),x=Math.max(x,I.x),M=Math.max(M,I.y);return[new l.P(m,y),new l.P(x,y),new l.P(x,M),new l.P(m,M),new l.P(m,y)]}}lngLatToCameraDepth(o,d){const m=this.locationCoordinate(o),y=[m.x*this.worldSize,m.y*this.worldSize,d,1];return l.af(y,y,this.modelViewProjectionMatrix),y[2]/y[3]}}function Zl(v,o){let d,m=!1,y=null,x=null;const M=()=>{y=null,m&&(v.apply(x,d),y=setTimeout(M,o),m=!1)};return(...I)=>(m=!0,x=this,d=I,y||M(),y)}class bu{constructor(o){this._getCurrentHash=()=>{const d=window.location.hash.replace("#","");if(this._hashName){let m;return d.split("&").map(y=>y.split("=")).forEach(y=>{y[0]===this._hashName&&(m=y)}),(m&&m[1]||"").split("/")}return d.split("/")},this._onHashChange=()=>{const d=this._getCurrentHash();if(d.length>=3&&!d.some(m=>isNaN(m))){const m=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(d[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+d[2],+d[1]],zoom:+d[0],bearing:m,pitch:+(d[4]||0)}),!0}return!1},this._updateHashUnthrottled=()=>{const d=window.location.href.replace(/(#.+)?$/,this.getHashString());window.history.replaceState(window.history.state,null,d)},this._removeHash=()=>{const d=this._getCurrentHash();if(d.length===0)return;const m=d.join("/");let y=m;y.split("&").length>0&&(y=y.split("&")[0]),this._hashName&&(y=`${this._hashName}=${m}`);let x=window.location.hash.replace(y,"");x.startsWith("#&")?x=x.slice(0,1)+x.slice(2):x==="#"&&(x="");let M=window.location.href.replace(/(#.+)?$/,x);M=M.replace("&&","&"),window.history.replaceState(window.history.state,null,M)},this._updateHash=Zl(this._updateHashUnthrottled,300),this._hashName=o&&encodeURIComponent(o)}addTo(o){return this._map=o,addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this}remove(){return removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),this._removeHash(),delete this._map,this}getHashString(o){const d=this._map.getCenter(),m=Math.round(100*this._map.getZoom())/100,y=Math.ceil((m*Math.LN2+Math.log(512/360/.5))/Math.LN10),x=Math.pow(10,y),M=Math.round(d.lng*x)/x,I=Math.round(d.lat*x)/x,O=this._map.getBearing(),N=this._map.getPitch();let V="";if(V+=o?`/${M}/${I}/${m}`:`${m}/${I}/${M}`,(O||N)&&(V+="/"+Math.round(10*O)/10),N&&(V+=`/${Math.round(N)}`),this._hashName){const F=this._hashName;let Z=!1;const J=window.location.hash.slice(1).split("&").map(ee=>{const oe=ee.split("=")[0];return oe===F?(Z=!0,`${oe}=${V}`):ee}).filter(ee=>ee);return Z||J.push(`${F}=${V}`),`#${J.join("&")}`}return`#${V}`}}const xu={linearity:.3,easing:l.b8(0,0,.3,1)},bd=l.e({deceleration:2500,maxSpeed:1400},xu),w_=l.e({deceleration:20,maxSpeed:1400},xu),vm=l.e({deceleration:1e3,maxSpeed:360},xu),vu=l.e({deceleration:1e3,maxSpeed:90},xu);class xd{constructor(o){this._map=o,this.clear()}clear(){this._inertiaBuffer=[]}record(o){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:E.now(),settings:o})}_drainInertiaBuffer(){const o=this._inertiaBuffer,d=E.now();for(;o.length>0&&d-o[0].time>160;)o.shift()}_onMoveEnd(o){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const d={zoom:0,bearing:0,pitch:0,pan:new l.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:x}of this._inertiaBuffer)d.zoom+=x.zoomDelta||0,d.bearing+=x.bearingDelta||0,d.pitch+=x.pitchDelta||0,x.panDelta&&d.pan._add(x.panDelta),x.around&&(d.around=x.around),x.pinchAround&&(d.pinchAround=x.pinchAround);const m=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,y={};if(d.pan.mag()){const x=Xl(d.pan.mag(),m,l.e({},bd,o||{}));y.offset=d.pan.mult(x.amount/d.pan.mag()),y.center=this._map.transform.center,Yl(y,x)}if(d.zoom){const x=Xl(d.zoom,m,w_);y.zoom=this._map.transform.zoom+x.amount,Yl(y,x)}if(d.bearing){const x=Xl(d.bearing,m,vm);y.bearing=this._map.transform.bearing+l.ac(x.amount,-179,179),Yl(y,x)}if(d.pitch){const x=Xl(d.pitch,m,vu);y.pitch=this._map.transform.pitch+x.amount,Yl(y,x)}if(y.zoom||y.bearing){const x=d.pinchAround===void 0?d.around:d.pinchAround;y.around=x?this._map.unproject(x):this._map.getCenter()}return this.clear(),l.e(y,{noMoveStart:!0})}}function Yl(v,o){(!v.duration||v.duration<o.duration)&&(v.duration=o.duration,v.easing=o.easing)}function Xl(v,o,d){const{maxSpeed:m,linearity:y,deceleration:x}=d,M=l.ac(v*y/(o/1e3),-m,m),I=Math.abs(M)/(x*y);return{easing:d.easing,duration:1e3*I,amount:M*(I/2)}}class Di extends l.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(o,d,m,y={}){const x=C.mousePos(d.getCanvas(),m),M=d.unproject(x);super(o,l.e({point:x,lngLat:M,originalEvent:m},y)),this._defaultPrevented=!1,this.target=d}}class Ys extends l.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(o,d,m){const y=o==="touchend"?m.changedTouches:m.touches,x=C.touchPos(d.getCanvasContainer(),y),M=x.map(O=>d.unproject(O)),I=x.reduce((O,N,V,F)=>O.add(N.div(F.length)),new l.P(0,0));super(o,{points:x,point:I,lngLats:M,lngLat:d.unproject(I),originalEvent:m}),this._defaultPrevented=!1}}class wm extends l.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(o,d,m){super(o,{originalEvent:m}),this._defaultPrevented=!1}}class km{constructor(o,d){this._map=o,this._clickTolerance=d.clickTolerance}reset(){delete this._mousedownPos}wheel(o){return this._firePreventable(new wm(o.type,this._map,o))}mousedown(o,d){return this._mousedownPos=d,this._firePreventable(new Di(o.type,this._map,o))}mouseup(o){this._map.fire(new Di(o.type,this._map,o))}click(o,d){this._mousedownPos&&this._mousedownPos.dist(d)>=this._clickTolerance||this._map.fire(new Di(o.type,this._map,o))}dblclick(o){return this._firePreventable(new Di(o.type,this._map,o))}mouseover(o){this._map.fire(new Di(o.type,this._map,o))}mouseout(o){this._map.fire(new Di(o.type,this._map,o))}touchstart(o){return this._firePreventable(new Ys(o.type,this._map,o))}touchmove(o){this._map.fire(new Ys(o.type,this._map,o))}touchend(o){this._map.fire(new Ys(o.type,this._map,o))}touchcancel(o){this._map.fire(new Ys(o.type,this._map,o))}_firePreventable(o){if(this._map.fire(o),o.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Qn{constructor(o){this._map=o}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(o){this._map.fire(new Di(o.type,this._map,o))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new Di("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(o){this._delayContextMenu?this._contextMenuEvent=o:this._ignoreContextMenu||this._map.fire(new Di(o.type,this._map,o)),this._map.listens("contextmenu")&&o.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class to{constructor(o){this._map=o}get transform(){return this._map._requestedCameraState||this._map.transform}get center(){return{lng:this.transform.center.lng,lat:this.transform.center.lat}}get zoom(){return this.transform.zoom}get pitch(){return this.transform.pitch}get bearing(){return this.transform.bearing}unproject(o){return this.transform.pointLocation(l.P.convert(o),this._map.terrain)}}class _r{constructor(o,d){this._map=o,this._tr=new to(o),this._el=o.getCanvasContainer(),this._container=o.getContainer(),this._clickTolerance=d.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(o,d){this.isEnabled()&&o.shiftKey&&o.button===0&&(C.disableDrag(),this._startPos=this._lastPos=d,this._active=!0)}mousemoveWindow(o,d){if(!this._active)return;const m=d;if(this._lastPos.equals(m)||!this._box&&m.dist(this._startPos)<this._clickTolerance)return;const y=this._startPos;this._lastPos=m,this._box||(this._box=C.create("div","maplibregl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair"),this._fireEvent("boxzoomstart",o));const x=Math.min(y.x,m.x),M=Math.max(y.x,m.x),I=Math.min(y.y,m.y),O=Math.max(y.y,m.y);C.setTransform(this._box,`translate(${x}px,${I}px)`),this._box.style.width=M-x+"px",this._box.style.height=O-I+"px"}mouseupWindow(o,d){if(!this._active||o.button!==0)return;const m=this._startPos,y=d;if(this.reset(),C.suppressClick(),m.x!==y.x||m.y!==y.y)return this._map.fire(new l.k("boxzoomend",{originalEvent:o})),{cameraAnimation:x=>x.fitScreenCoordinates(m,y,this._tr.bearing,{linear:!0})};this._fireEvent("boxzoomcancel",o)}keydown(o){this._active&&o.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",o))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(C.remove(this._box),this._box=null),C.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(o,d){return this._map.fire(new l.k(o,{originalEvent:d}))}}function Kl(v,o){if(v.length!==o.length)throw new Error(`The number of touches and points are not equal - touches ${v.length}, points ${o.length}`);const d={};for(let m=0;m<v.length;m++)d[v[m].identifier]=o[m];return d}class vd{constructor(o){this.reset(),this.numTouches=o.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(o,d,m){(this.centroid||m.length>this.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=o.timeStamp),m.length===this.numTouches&&(this.centroid=function(y){const x=new l.P(0,0);for(const M of y)x._add(M);return x.div(y.length)}(d),this.touches=Kl(m,d)))}touchmove(o,d,m){if(this.aborted||!this.centroid)return;const y=Kl(m,d);for(const x in this.touches){const M=y[x];(!M||M.dist(this.touches[x])>30)&&(this.aborted=!0)}}touchend(o,d,m){if((!this.centroid||o.timeStamp-this.startTime>500)&&(this.aborted=!0),m.length===0){const y=!this.aborted&&this.centroid;if(this.reset(),y)return y}}}class wu{constructor(o){this.singleTap=new vd(o),this.numTaps=o.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(o,d,m){this.singleTap.touchstart(o,d,m)}touchmove(o,d,m){this.singleTap.touchmove(o,d,m)}touchend(o,d,m){const y=this.singleTap.touchend(o,d,m);if(y){const x=o.timeStamp-this.lastTime<500,M=!this.lastTap||this.lastTap.dist(y)<30;if(x&&M||this.reset(),this.count++,this.lastTime=o.timeStamp,this.lastTap=y,this.count===this.numTaps)return this.reset(),y}}}class Ha{constructor(o){this._tr=new to(o),this._zoomIn=new wu({numTouches:1,numTaps:2}),this._zoomOut=new wu({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(o,d,m){this._zoomIn.touchstart(o,d,m),this._zoomOut.touchstart(o,d,m)}touchmove(o,d,m){this._zoomIn.touchmove(o,d,m),this._zoomOut.touchmove(o,d,m)}touchend(o,d,m){const y=this._zoomIn.touchend(o,d,m),x=this._zoomOut.touchend(o,d,m),M=this._tr;return y?(this._active=!0,o.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:I=>I.easeTo({duration:300,zoom:M.zoom+1,around:M.unproject(y)},{originalEvent:o})}):x?(this._active=!0,o.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:I=>I.easeTo({duration:300,zoom:M.zoom-1,around:M.unproject(x)},{originalEvent:o})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class qo{constructor(o){this._enabled=!!o.enable,this._moveStateManager=o.moveStateManager,this._clickTolerance=o.clickTolerance||1,this._moveFunction=o.move,this._activateOnStart=!!o.activateOnStart,o.assignEvents(this),this.reset()}reset(o){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(o)}_move(...o){const d=this._moveFunction(...o);if(d.bearingDelta||d.pitchDelta||d.around||d.panDelta)return this._active=!0,d}dragStart(o,d){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(o)&&(this._moveStateManager.startMove(o),this._lastPoint=d.length?d[0]:d,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(o,d){if(!this.isEnabled())return;const m=this._lastPoint;if(!m)return;if(o.preventDefault(),!this._moveStateManager.isValidMoveEvent(o))return void this.reset(o);const y=d.length?d[0]:d;return!this._moved&&y.dist(m)<this._clickTolerance?void 0:(this._moved=!0,this._lastPoint=y,this._move(m,y))}dragEnd(o){this.isEnabled()&&this._lastPoint&&this._moveStateManager.isValidEndEvent(o)&&(this._moved&&C.suppressClick(),this.reset(o))}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}getClickTolerance(){return this._clickTolerance}}const wd={0:1,2:2};class ku{constructor(o){this._correctEvent=o.checkCorrectEvent}startMove(o){const d=C.mouseButton(o);this._eventButton=d}endMove(o){delete this._eventButton}isValidStartEvent(o){return this._correctEvent(o)}isValidMoveEvent(o){return!function(d,m){const y=wd[m];return d.buttons===void 0||(d.buttons&y)!==y}(o,this._eventButton)}isValidEndEvent(o){return C.mouseButton(o)===this._eventButton}}class kd{constructor(){this._firstTouch=void 0}_isOneFingerTouch(o){return o.targetTouches.length===1}_isSameTouchEvent(o){return o.targetTouches[0].identifier===this._firstTouch}startMove(o){this._firstTouch=o.targetTouches[0].identifier}endMove(o){delete this._firstTouch}isValidStartEvent(o){return this._isOneFingerTouch(o)}isValidMoveEvent(o){return this._isOneFingerTouch(o)&&this._isSameTouchEvent(o)}isValidEndEvent(o){return this._isOneFingerTouch(o)&&this._isSameTouchEvent(o)}}const Su=v=>{v.mousedown=v.dragStart,v.mousemoveWindow=v.dragMove,v.mouseup=v.dragEnd,v.contextmenu=o=>{o.preventDefault()}},Sd=({enable:v,clickTolerance:o,bearingDegreesPerPixelMoved:d=.8})=>{const m=new ku({checkCorrectEvent:y=>C.mouseButton(y)===0&&y.ctrlKey||C.mouseButton(y)===2});return new qo({clickTolerance:o,move:(y,x)=>({bearingDelta:(x.x-y.x)*d}),moveStateManager:m,enable:v,assignEvents:Su})},Ed=({enable:v,clickTolerance:o,pitchDegreesPerPixelMoved:d=-.5})=>{const m=new ku({checkCorrectEvent:y=>C.mouseButton(y)===0&&y.ctrlKey||C.mouseButton(y)===2});return new qo({clickTolerance:o,move:(y,x)=>({pitchDelta:(x.y-y.y)*d}),moveStateManager:m,enable:v,assignEvents:Su})};class Xs{constructor(o,d){this._clickTolerance=o.clickTolerance||1,this._map=d,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new l.P(0,0)}_shouldBePrevented(o){return o<(this._map.cooperativeGestures.isEnabled()?2:1)}touchstart(o,d,m){return this._calculateTransform(o,d,m)}touchmove(o,d,m){if(this._active){if(!this._shouldBePrevented(m.length))return o.preventDefault(),this._calculateTransform(o,d,m);this._map.cooperativeGestures.notifyGestureBlocked("touch_pan",o)}}touchend(o,d,m){this._calculateTransform(o,d,m),this._active&&this._shouldBePrevented(m.length)&&this.reset()}touchcancel(){this.reset()}_calculateTransform(o,d,m){m.length>0&&(this._active=!0);const y=Kl(m,d),x=new l.P(0,0),M=new l.P(0,0);let I=0;for(const N in y){const V=y[N],F=this._touches[N];F&&(x._add(V),M._add(V.sub(F)),I++,y[N]=V)}if(this._touches=y,this._shouldBePrevented(I)||!M.mag())return;const O=M.div(I);return this._sum._add(O),this._sum.mag()<this._clickTolerance?void 0:{around:x.div(I),panDelta:O}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Eu{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}touchstart(o,d,m){this._firstTwoTouches||m.length<2||(this._firstTwoTouches=[m[0].identifier,m[1].identifier],this._start([d[0],d[1]]))}touchmove(o,d,m){if(!this._firstTwoTouches)return;o.preventDefault();const[y,x]=this._firstTwoTouches,M=Jl(m,d,y),I=Jl(m,d,x);if(!M||!I)return;const O=this._aroundCenter?null:M.add(I).div(2);return this._move([M,I],O,o)}touchend(o,d,m){if(!this._firstTwoTouches)return;const[y,x]=this._firstTwoTouches,M=Jl(m,d,y),I=Jl(m,d,x);M&&I||(this._active&&C.suppressClick(),this.reset())}touchcancel(){this.reset()}enable(o){this._enabled=!0,this._aroundCenter=!!o&&o.around==="center"}disable(){this._enabled=!1,this.reset()}isEnabled(){return!!this._enabled}isActive(){return!!this._active}}function Jl(v,o,d){for(let m=0;m<v.length;m++)if(v[m].identifier===d)return o[m]}function Cd(v,o){return Math.log(v/o)/Math.LN2}class Td extends Eu{reset(){super.reset(),delete this._distance,delete this._startDistance}_start(o){this._startDistance=this._distance=o[0].dist(o[1])}_move(o,d){const m=this._distance;if(this._distance=o[0].dist(o[1]),this._active||!(Math.abs(Cd(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:Cd(this._distance,m),pinchAround:d}}}function Md(v,o){return 180*v.angleWith(o)/Math.PI}class Ad extends Eu{reset(){super.reset(),delete this._minDiameter,delete this._startVector,delete this._vector}_start(o){this._startVector=this._vector=o[0].sub(o[1]),this._minDiameter=o[0].dist(o[1])}_move(o,d,m){const y=this._vector;if(this._vector=o[0].sub(o[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:Md(this._vector,y),pinchAround:d}}_isBelowThreshold(o){this._minDiameter=Math.min(this._minDiameter,o.mag());const d=25/(Math.PI*this._minDiameter)*360,m=Md(o,this._startVector);return Math.abs(m)<d}}function Cu(v){return Math.abs(v.y)>Math.abs(v.x)}class qa extends Eu{constructor(o){super(),this._currentTouchCount=0,this._map=o}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(o,d,m){super.touchstart(o,d,m),this._currentTouchCount=m.length}_start(o){this._lastPoints=o,Cu(o[0].sub(o[1]))&&(this._valid=!1)}_move(o,d,m){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;const y=o[0].sub(this._lastPoints[0]),x=o[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(y,x,m.timeStamp),this._valid?(this._lastPoints=o,this._active=!0,{pitchDelta:(y.y+x.y)/2*-.5}):void 0}gestureBeginsVertically(o,d,m){if(this._valid!==void 0)return this._valid;const y=o.mag()>=2,x=d.mag()>=2;if(!y&&!x)return;if(!y||!x)return this._firstMove===void 0&&(this._firstMove=m),m-this._firstMove<100&&void 0;const M=o.y>0==d.y>0;return Cu(o)&&Cu(d)&&M}}const Sm={panStep:100,bearingStep:15,pitchStep:10};class Lr{constructor(o){this._tr=new to(o);const d=Sm;this._panStep=d.panStep,this._bearingStep=d.bearingStep,this._pitchStep=d.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(o){if(o.altKey||o.ctrlKey||o.metaKey)return;let d=0,m=0,y=0,x=0,M=0;switch(o.keyCode){case 61:case 107:case 171:case 187:d=1;break;case 189:case 109:case 173:d=-1;break;case 37:o.shiftKey?m=-1:(o.preventDefault(),x=-1);break;case 39:o.shiftKey?m=1:(o.preventDefault(),x=1);break;case 38:o.shiftKey?y=1:(o.preventDefault(),M=-1);break;case 40:o.shiftKey?y=-1:(o.preventDefault(),M=1);break;default:return}return this._rotationDisabled&&(m=0,y=0),{cameraAnimation:I=>{const O=this._tr;I.easeTo({duration:300,easeId:"keyboardHandler",easing:Ao,zoom:d?Math.round(O.zoom)+d*(o.shiftKey?2:1):O.zoom,bearing:O.bearing+m*this._bearingStep,pitch:O.pitch+y*this._pitchStep,offset:[-x*this._panStep,-M*this._panStep],center:O.center},{originalEvent:o})}}}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 Ao(v){return v*(2-v)}const Id=4.000244140625;class no{constructor(o,d){this._onTimeout=m=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(m)},this._map=o,this._tr=new to(o),this._triggerRenderFrame=d,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222}setZoomRate(o){this._defaultZoomRate=o}setWheelZoomRate(o){this._wheelZoomRate=o}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(o){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!o&&o.around==="center")}disable(){this.isEnabled()&&(this._enabled=!1)}_shouldBePrevented(o){return!!this._map.cooperativeGestures.isEnabled()&&!(o.ctrlKey||this._map.cooperativeGestures.isBypassed(o))}wheel(o){if(!this.isEnabled())return;if(this._shouldBePrevented(o))return void this._map.cooperativeGestures.notifyGestureBlocked("wheel_zoom",o);let d=o.deltaMode===WheelEvent.DOM_DELTA_LINE?40*o.deltaY:o.deltaY;const m=E.now(),y=m-(this._lastWheelEventTime||0);this._lastWheelEventTime=m,d!==0&&d%Id==0?this._type="wheel":d!==0&&Math.abs(d)<4?this._type="trackpad":y>400?(this._type=null,this._lastValue=d,this._timeout=setTimeout(this._onTimeout,40,o)):this._type||(this._type=Math.abs(y*d)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,d+=this._lastValue)),o.shiftKey&&d&&(d/=4),this._type&&(this._lastWheelEvent=o,this._delta-=d,this._active||this._start(o)),o.preventDefault()}_start(o){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 d=C.mousePos(this._map.getCanvas(),o),m=this._tr;this._around=d.y>m.transform.height/2-m.transform.getHorizon()?l.N.convert(this._aroundCenter?m.center:m.unproject(d)):l.N.convert(m.center),this._aroundPoint=m.transform.locationPoint(this._around),this._frameId||(this._frameId=!0,this._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;const o=this._tr.transform;if(this._delta!==0){const O=this._type==="wheel"&&Math.abs(this._delta)>Id?this._wheelZoomRate:this._defaultZoomRate;let N=2/(1+Math.exp(-Math.abs(this._delta*O)));this._delta<0&&N!==0&&(N=1/N);const V=typeof this._targetZoom=="number"?o.zoomScale(this._targetZoom):o.scale;this._targetZoom=Math.min(o.maxZoom,Math.max(o.minZoom,o.scaleZoom(V*N))),this._type==="wheel"&&(this._startZoom=o.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}const d=typeof this._targetZoom=="number"?this._targetZoom:o.zoom,m=this._startZoom,y=this._easing;let x,M=!1;const I=E.now()-this._lastWheelEventTime;if(this._type==="wheel"&&m&&y&&I){const O=Math.min(I/200,1),N=y(O);x=l.y.number(m,d,N),O<1?this._frameId||(this._frameId=!0):M=!0}else x=d,M=!0;return this._active=!0,M&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200)),{noInertia:!0,needsRenderFrame:!M,zoomDelta:x-o.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(o){let d=l.b9;if(this._prevEase){const m=this._prevEase,y=(E.now()-m.start)/m.duration,x=m.easing(y+.01)-m.easing(y),M=.27/Math.sqrt(x*x+1e-4)*.01,I=Math.sqrt(.0729-M*M);d=l.b8(M,I,.25,1)}return this._prevEase={start:E.now(),duration:o,easing:d},d}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}}class Ks{constructor(o,d){this._clickZoom=o,this._tapZoom=d}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 k_{constructor(o){this._tr=new to(o),this.reset()}reset(){this._active=!1}dblclick(o,d){return o.preventDefault(),{cameraAnimation:m=>{m.easeTo({duration:300,zoom:this._tr.zoom+(o.shiftKey?-1:1),around:this._tr.unproject(d)},{originalEvent:o})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class S_{constructor(){this._tap=new wu({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,delete this._tapPoint,this._tap.reset()}touchstart(o,d,m){if(!this._swipePoint)if(this._tapTime){const y=d[0],x=o.timeStamp-this._tapTime<500,M=this._tapPoint.dist(y)<30;x&&M?m.length>0&&(this._swipePoint=y,this._swipeTouch=m[0].identifier):this.reset()}else this._tap.touchstart(o,d,m)}touchmove(o,d,m){if(this._tapTime){if(this._swipePoint){if(m[0].identifier!==this._swipeTouch)return;const y=d[0],x=y.y-this._swipePoint.y;return this._swipePoint=y,o.preventDefault(),this._active=!0,{zoomDelta:x/128}}}else this._tap.touchmove(o,d,m)}touchend(o,d,m){if(this._tapTime)this._swipePoint&&m.length===0&&this.reset();else{const y=this._tap.touchend(o,d,m);y&&(this._tapTime=o.timeStamp,this._tapPoint=y)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Em{constructor(o,d,m){this._el=o,this._mousePan=d,this._touchPan=m}enable(o){this._inertiaOptions=o||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("maplibregl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("maplibregl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class Cm{constructor(o,d,m){this._pitchWithRotate=o.pitchWithRotate,this._mouseRotate=d,this._mousePitch=m}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 Pd{constructor(o,d,m,y){this._el=o,this._touchZoom=d,this._touchRotate=m,this._tapDragZoom=y,this._rotationDisabled=!1,this._enabled=!0}enable(o){this._touchZoom.enable(o),this._rotationDisabled||this._touchRotate.enable(o),this._tapDragZoom.enable(),this._el.classList.add("maplibregl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("maplibregl-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()}}class Wa{constructor(o,d){this._bypassKey=navigator.userAgent.indexOf("Mac")!==-1?"metaKey":"ctrlKey",this._map=o,this._options=d,this._enabled=!1}isActive(){return!1}reset(){}_setupUI(){if(this._container)return;const o=this._map.getCanvasContainer();o.classList.add("maplibregl-cooperative-gestures"),this._container=C.create("div","maplibregl-cooperative-gesture-screen",o);let d=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");this._bypassKey==="metaKey"&&(d=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));const m=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),y=document.createElement("div");y.className="maplibregl-desktop-message",y.textContent=d,this._container.appendChild(y);const x=document.createElement("div");x.className="maplibregl-mobile-message",x.textContent=m,this._container.appendChild(x),this._container.setAttribute("aria-hidden","true")}_destroyUI(){this._container&&(C.remove(this._container),this._map.getCanvasContainer().classList.remove("maplibregl-cooperative-gestures")),delete this._container}enable(){this._setupUI(),this._enabled=!0}disable(){this._enabled=!1,this._destroyUI()}isEnabled(){return this._enabled}isBypassed(o){return o[this._bypassKey]}notifyGestureBlocked(o,d){this._enabled&&(this._map.fire(new l.k("cooperativegestureprevented",{gestureType:o,originalEvent:d})),this._container.classList.add("maplibregl-show"),setTimeout(()=>{this._container.classList.remove("maplibregl-show")},100))}}const Vr=v=>v.zoom||v.drag||v.pitch||v.rotate;class ut extends l.k{}function Tu(v){return v.panDelta&&v.panDelta.mag()||v.zoomDelta||v.bearingDelta||v.pitchDelta}class Dd{constructor(o,d){this.handleWindowEvent=y=>{this.handleEvent(y,`${y.type}Window`)},this.handleEvent=(y,x)=>{if(y.type==="blur")return void this.stop(!0);this._updatingCamera=!0;const M=y.type==="renderFrame"?void 0:y,I={needsRenderFrame:!1},O={},N={},V=y.touches,F=V?this._getMapTouches(V):void 0,Z=F?C.touchPos(this._map.getCanvas(),F):C.mousePos(this._map.getCanvas(),y);for(const{handlerName:oe,handler:le,allowed:ce}of this._handlers){if(!le.isEnabled())continue;let he;this._blockedByActive(N,ce,oe)?le.reset():le[x||y.type]&&(he=le[x||y.type](y,Z,F),this.mergeHandlerResult(I,O,he,oe,M),he&&he.needsRenderFrame&&this._triggerRenderFrame()),(he||le.isActive())&&(N[oe]=le)}const J={};for(const oe in this._previousActiveHandlers)N[oe]||(J[oe]=M);this._previousActiveHandlers=N,(Object.keys(J).length||Tu(I))&&(this._changes.push([I,O,J]),this._triggerRenderFrame()),(Object.keys(N).length||Tu(I))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:ee}=I;ee&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],ee(this._map))},this._map=o,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new xd(o),this._bearingSnap=d.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(d);const m=this._el;this._listeners=[[m,"touchstart",{passive:!0}],[m,"touchmove",{passive:!1}],[m,"touchend",void 0],[m,"touchcancel",void 0],[m,"mousedown",void 0],[m,"mousemove",void 0],[m,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[m,"mouseover",void 0],[m,"mouseout",void 0],[m,"dblclick",void 0],[m,"click",void 0],[m,"keydown",{capture:!1}],[m,"keyup",void 0],[m,"wheel",{passive:!1}],[m,"contextmenu",void 0],[window,"blur",void 0]];for(const[y,x,M]of this._listeners)C.addEventListener(y,x,y===document?this.handleWindowEvent:this.handleEvent,M)}destroy(){for(const[o,d,m]of this._listeners)C.removeEventListener(o,d,o===document?this.handleWindowEvent:this.handleEvent,m)}_addDefaultHandlers(o){const d=this._map,m=d.getCanvasContainer();this._add("mapEvent",new km(d,o));const y=d.boxZoom=new _r(d,o);this._add("boxZoom",y),o.interactive&&o.boxZoom&&y.enable();const x=d.cooperativeGestures=new Wa(d,o.cooperativeGestures);this._add("cooperativeGestures",x),o.cooperativeGestures&&x.enable();const M=new Ha(d),I=new k_(d);d.doubleClickZoom=new Ks(I,M),this._add("tapZoom",M),this._add("clickZoom",I),o.interactive&&o.doubleClickZoom&&d.doubleClickZoom.enable();const O=new S_;this._add("tapDragZoom",O);const N=d.touchPitch=new qa(d);this._add("touchPitch",N),o.interactive&&o.touchPitch&&d.touchPitch.enable(o.touchPitch);const V=Sd(o),F=Ed(o);d.dragRotate=new Cm(o,V,F),this._add("mouseRotate",V,["mousePitch"]),this._add("mousePitch",F,["mouseRotate"]),o.interactive&&o.dragRotate&&d.dragRotate.enable();const Z=(({enable:he,clickTolerance:ne})=>{const me=new ku({checkCorrectEvent:ge=>C.mouseButton(ge)===0&&!ge.ctrlKey});return new qo({clickTolerance:ne,move:(ge,xe)=>({around:xe,panDelta:xe.sub(ge)}),activateOnStart:!0,moveStateManager:me,enable:he,assignEvents:Su})})(o),J=new Xs(o,d);d.dragPan=new Em(m,Z,J),this._add("mousePan",Z),this._add("touchPan",J,["touchZoom","touchRotate"]),o.interactive&&o.dragPan&&d.dragPan.enable(o.dragPan);const ee=new Ad,oe=new Td;d.touchZoomRotate=new Pd(m,oe,ee,O),this._add("touchRotate",ee,["touchPan","touchZoom"]),this._add("touchZoom",oe,["touchPan","touchRotate"]),o.interactive&&o.touchZoomRotate&&d.touchZoomRotate.enable(o.touchZoomRotate);const le=d.scrollZoom=new no(d,()=>this._triggerRenderFrame());this._add("scrollZoom",le,["mousePan"]),o.interactive&&o.scrollZoom&&d.scrollZoom.enable(o.scrollZoom);const ce=d.keyboard=new Lr(d);this._add("keyboard",ce),o.interactive&&o.keyboard&&d.keyboard.enable(),this._add("blockableMapEvent",new Qn(d))}_add(o,d,m){this._handlers.push({handlerName:o,handler:d,allowed:m}),this._handlersById[o]=d}stop(o){if(!this._updatingCamera){for(const{handler:d}of this._handlers)d.reset();this._inertia.clear(),this._fireEvents({},{},o),this._changes=[]}}isActive(){for(const{handler:o}of this._handlers)if(o.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!Vr(this._eventsInProgress)||this.isZooming()}_blockedByActive(o,d,m){for(const y in o)if(y!==m&&(!d||d.indexOf(y)<0))return!0;return!1}_getMapTouches(o){const d=[];for(const m of o)this._el.contains(m.target)&&d.push(m);return d}mergeHandlerResult(o,d,m,y,x){if(!m)return;l.e(o,m);const M={handlerName:y,originalEvent:m.originalEvent||x};m.zoomDelta!==void 0&&(d.zoom=M),m.panDelta!==void 0&&(d.drag=M),m.pitchDelta!==void 0&&(d.pitch=M),m.bearingDelta!==void 0&&(d.rotate=M)}_applyChanges(){const o={},d={},m={};for(const[y,x,M]of this._changes)y.panDelta&&(o.panDelta=(o.panDelta||new l.P(0,0))._add(y.panDelta)),y.zoomDelta&&(o.zoomDelta=(o.zoomDelta||0)+y.zoomDelta),y.bearingDelta&&(o.bearingDelta=(o.bearingDelta||0)+y.bearingDelta),y.pitchDelta&&(o.pitchDelta=(o.pitchDelta||0)+y.pitchDelta),y.around!==void 0&&(o.around=y.around),y.pinchAround!==void 0&&(o.pinchAround=y.pinchAround),y.noInertia&&(o.noInertia=y.noInertia),l.e(d,x),l.e(m,M);this._updateMapTransform(o,d,m),this._changes=[]}_updateMapTransform(o,d,m){const y=this._map,x=y._getTransformForUpdate(),M=y.terrain;if(!(Tu(o)||M&&this._terrainMovement))return this._fireEvents(d,m,!0);let{panDelta:I,zoomDelta:O,bearingDelta:N,pitchDelta:V,around:F,pinchAround:Z}=o;Z!==void 0&&(F=Z),y._stop(!0),F=F||y.transform.centerPoint;const J=x.pointLocation(I?F.sub(I):F);N&&(x.bearing+=N),V&&(x.pitch+=V),O&&(x.zoom+=O),M?this._terrainMovement||!d.drag&&!d.zoom?d.drag&&this._terrainMovement?x.center=x.pointLocation(x.centerPoint.sub(I)):x.setLocationAtPoint(J,F):(this._terrainMovement=!0,this._map._elevationFreeze=!0,x.setLocationAtPoint(J,F)):x.setLocationAtPoint(J,F),y._applyUpdatedTransform(x),this._map._update(),o.noInertia||this._inertia.record(o),this._fireEvents(d,m,!0)}_fireEvents(o,d,m){const y=Vr(this._eventsInProgress),x=Vr(o),M={};for(const F in o){const{originalEvent:Z}=o[F];this._eventsInProgress[F]||(M[`${F}start`]=Z),this._eventsInProgress[F]=o[F]}!y&&x&&this._fireEvent("movestart",x.originalEvent);for(const F in M)this._fireEvent(F,M[F]);x&&this._fireEvent("move",x.originalEvent);for(const F in o){const{originalEvent:Z}=o[F];this._fireEvent(F,Z)}const I={};let O;for(const F in this._eventsInProgress){const{handlerName:Z,originalEvent:J}=this._eventsInProgress[F];this._handlersById[Z].isActive()||(delete this._eventsInProgress[F],O=d[Z]||J,I[`${F}end`]=O)}for(const F in I)this._fireEvent(F,I[F]);const N=Vr(this._eventsInProgress),V=(y||x)&&!N;if(V&&this._terrainMovement){this._map._elevationFreeze=!1,this._terrainMovement=!1;const F=this._map._getTransformForUpdate();F.recalculateZoom(this._map.terrain),this._map._applyUpdatedTransform(F)}if(m&&V){this._updatingCamera=!0;const F=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),Z=J=>J!==0&&-this._bearingSnap<J&&J<this._bearingSnap;!F||!F.essential&&E.prefersReducedMotion?(this._map.fire(new l.k("moveend",{originalEvent:O})),Z(this._map.getBearing())&&this._map.resetNorth()):(Z(F.bearing||this._map.getBearing())&&(F.bearing=0),F.freezeElevation=!0,this._map.easeTo(F,{originalEvent:O})),this._updatingCamera=!1}}_fireEvent(o,d){this._map.fire(new l.k(o,d?{originalEvent:d}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(o=>{delete this._frameId,this.handleEvent(new ut("renderFrame",{timeStamp:o})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}class Tm extends l.E{constructor(o,d){super(),this._renderFrameCallback=()=>{const m=Math.min((E.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(m)),m<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this._moving=!1,this._zooming=!1,this.transform=o,this._bearingSnap=d.bearingSnap,this.on("moveend",()=>{delete this._requestedCameraState})}getCenter(){return new l.N(this.transform.center.lng,this.transform.center.lat)}setCenter(o,d){return this.jumpTo({center:o},d)}panBy(o,d,m){return o=l.P.convert(o).mult(-1),this.panTo(this.transform.center,l.e({offset:o},d),m)}panTo(o,d,m){return this.easeTo(l.e({center:o},d),m)}getZoom(){return this.transform.zoom}setZoom(o,d){return this.jumpTo({zoom:o},d),this}zoomTo(o,d,m){return this.easeTo(l.e({zoom:o},d),m)}zoomIn(o,d){return this.zoomTo(this.getZoom()+1,o,d),this}zoomOut(o,d){return this.zoomTo(this.getZoom()-1,o,d),this}getBearing(){return this.transform.bearing}setBearing(o,d){return this.jumpTo({bearing:o},d),this}getPadding(){return this.transform.padding}setPadding(o,d){return this.jumpTo({padding:o},d),this}rotateTo(o,d,m){return this.easeTo(l.e({bearing:o},d),m)}resetNorth(o,d){return this.rotateTo(0,l.e({duration:1e3},o),d),this}resetNorthPitch(o,d){return this.easeTo(l.e({bearing:0,pitch:0,duration:1e3},o),d),this}snapToNorth(o,d){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(o,d):this}getPitch(){return this.transform.pitch}setPitch(o,d){return this.jumpTo({pitch:o},d),this}cameraForBounds(o,d){o=we.convert(o).adjustAntiMeridian();const m=d&&d.bearing||0;return this._cameraForBoxAndBearing(o.getNorthWest(),o.getSouthEast(),m,d)}_cameraForBoxAndBearing(o,d,m,y){const x={top:0,bottom:0,right:0,left:0};if(typeof(y=l.e({padding:x,offset:[0,0],maxZoom:this.transform.maxZoom},y)).padding=="number"){const Ye=y.padding;y.padding={top:Ye,bottom:Ye,right:Ye,left:Ye}}y.padding=l.e(x,y.padding);const M=this.transform,I=M.padding,O=new we(o,d),N=M.project(O.getNorthWest()),V=M.project(O.getNorthEast()),F=M.project(O.getSouthEast()),Z=M.project(O.getSouthWest()),J=l.ba(-m),ee=N.rotate(J),oe=V.rotate(J),le=F.rotate(J),ce=Z.rotate(J),he=new l.P(Math.max(ee.x,oe.x,ce.x,le.x),Math.max(ee.y,oe.y,ce.y,le.y)),ne=new l.P(Math.min(ee.x,oe.x,ce.x,le.x),Math.min(ee.y,oe.y,ce.y,le.y)),me=he.sub(ne),ge=(M.width-(I.left+I.right+y.padding.left+y.padding.right))/me.x,xe=(M.height-(I.top+I.bottom+y.padding.top+y.padding.bottom))/me.y;if(xe<0||ge<0)return void l.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.");const Be=Math.min(M.scaleZoom(M.scale*Math.min(ge,xe)),y.maxZoom),Fe=l.P.convert(y.offset),Qe=new l.P((y.padding.left-y.padding.right)/2,(y.padding.top-y.padding.bottom)/2).rotate(l.ba(m)),st=Fe.add(Qe).mult(M.scale/M.zoomScale(Be));return{center:M.unproject(N.add(F).div(2).sub(st)),zoom:Be,bearing:m}}fitBounds(o,d,m){return this._fitInternal(this.cameraForBounds(o,d),d,m)}fitScreenCoordinates(o,d,m,y,x){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.pointLocation(l.P.convert(o)),this.transform.pointLocation(l.P.convert(d)),m,y),y,x)}_fitInternal(o,d,m){return o?(delete(d=l.e(o,d)).padding,d.linear?this.easeTo(d,m):this.flyTo(d,m)):this}jumpTo(o,d){this.stop();const m=this._getTransformForUpdate();let y=!1,x=!1,M=!1;return"zoom"in o&&m.zoom!==+o.zoom&&(y=!0,m.zoom=+o.zoom),o.center!==void 0&&(m.center=l.N.convert(o.center)),"bearing"in o&&m.bearing!==+o.bearing&&(x=!0,m.bearing=+o.bearing),"pitch"in o&&m.pitch!==+o.pitch&&(M=!0,m.pitch=+o.pitch),o.padding==null||m.isPaddingEqual(o.padding)||(m.padding=o.padding),this._applyUpdatedTransform(m),this.fire(new l.k("movestart",d)).fire(new l.k("move",d)),y&&this.fire(new l.k("zoomstart",d)).fire(new l.k("zoom",d)).fire(new l.k("zoomend",d)),x&&this.fire(new l.k("rotatestart",d)).fire(new l.k("rotate",d)).fire(new l.k("rotateend",d)),M&&this.fire(new l.k("pitchstart",d)).fire(new l.k("pitch",d)).fire(new l.k("pitchend",d)),this.fire(new l.k("moveend",d))}calculateCameraOptionsFromTo(o,d,m,y=0){const x=l.Z.fromLngLat(o,d),M=l.Z.fromLngLat(m,y),I=M.x-x.x,O=M.y-x.y,N=M.z-x.z,V=Math.hypot(I,O,N);if(V===0)throw new Error("Can't calculate camera options with same From and To");const F=Math.hypot(I,O),Z=this.transform.scaleZoom(this.transform.cameraToCenterDistance/V/this.transform.tileSize),J=180*Math.atan2(I,-O)/Math.PI;let ee=180*Math.acos(F/V)/Math.PI;return ee=N<0?90-ee:90+ee,{center:M.toLngLat(),zoom:Z,pitch:ee,bearing:J}}easeTo(o,d){var m;this._stop(!1,o.easeId),((o=l.e({offset:[0,0],duration:500,easing:l.b9},o)).animate===!1||!o.essential&&E.prefersReducedMotion)&&(o.duration=0);const y=this._getTransformForUpdate(),x=y.zoom,M=y.bearing,I=y.pitch,O=y.padding,N="bearing"in o?this._normalizeBearing(o.bearing,M):M,V="pitch"in o?+o.pitch:I,F="padding"in o?o.padding:y.padding,Z=l.P.convert(o.offset);let J=y.centerPoint.add(Z);const ee=y.pointLocation(J),{center:oe,zoom:le}=y.getConstrained(l.N.convert(o.center||ee),(m=o.zoom)!==null&&m!==void 0?m:x);this._normalizeCenter(oe,y);const ce=y.project(ee),he=y.project(oe).sub(ce),ne=y.zoomScale(le-x);let me,ge;o.around&&(me=l.N.convert(o.around),ge=y.locationPoint(me));const xe={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=this._zooming||le!==x,this._rotating=this._rotating||M!==N,this._pitching=this._pitching||V!==I,this._padding=!y.isPaddingEqual(F),this._easeId=o.easeId,this._prepareEase(d,o.noMoveStart,xe),this.terrain&&this._prepareElevation(oe),this._ease(Be=>{if(this._zooming&&(y.zoom=l.y.number(x,le,Be)),this._rotating&&(y.bearing=l.y.number(M,N,Be)),this._pitching&&(y.pitch=l.y.number(I,V,Be)),this._padding&&(y.interpolatePadding(O,F,Be),J=y.centerPoint.add(Z)),this.terrain&&!o.freezeElevation&&this._updateElevation(Be),me)y.setLocationAtPoint(me,ge);else{const Fe=y.zoomScale(y.zoom-x),Qe=le>x?Math.min(2,ne):Math.max(.5,ne),st=Math.pow(Qe,1-Be),Ye=y.unproject(ce.add(he.mult(Be*st)).mult(Fe));y.setLocationAtPoint(y.renderWorldCopies?Ye.wrap():Ye,J)}this._applyUpdatedTransform(y),this._fireMoveEvents(d)},Be=>{this.terrain&&o.freezeElevation&&this._finalizeElevation(),this._afterEase(d,Be)},o),this}_prepareEase(o,d,m={}){this._moving=!0,d||m.moving||this.fire(new l.k("movestart",o)),this._zooming&&!m.zooming&&this.fire(new l.k("zoomstart",o)),this._rotating&&!m.rotating&&this.fire(new l.k("rotatestart",o)),this._pitching&&!m.pitching&&this.fire(new l.k("pitchstart",o))}_prepareElevation(o){this._elevationCenter=o,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(o,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(o){this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);const d=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(o<1&&d!==this._elevationTarget){const m=this._elevationTarget-this._elevationStart;this._elevationStart+=o*(m-(d-(m*o+this._elevationStart))/(1-o)),this._elevationTarget=d}this.transform.elevation=l.y.number(this._elevationStart,this._elevationTarget,o)}_finalizeElevation(){this._elevationFreeze=!1,this.transform.recalculateZoom(this.terrain)}_getTransformForUpdate(){return this.transformCameraUpdate||this.terrain?(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState):this.transform}_elevateCameraIfInsideTerrain(o){const d=o.getCameraPosition(),m=this.terrain.getElevationForLngLatZoom(d.lngLat,o.zoom);if(d.altitude<m){const y=this.calculateCameraOptionsFromTo(d.lngLat,m,o.center,o.elevation);return{pitch:y.pitch,zoom:y.zoom}}return{}}_applyUpdatedTransform(o){const d=[];if(this.terrain&&d.push(y=>this._elevateCameraIfInsideTerrain(y)),this.transformCameraUpdate&&d.push(y=>this.transformCameraUpdate(y)),!d.length)return;const m=o.clone();for(const y of d){const x=m.clone(),{center:M,zoom:I,pitch:O,bearing:N,elevation:V}=y(x);M&&(x.center=M),I!==void 0&&(x.zoom=I),O!==void 0&&(x.pitch=O),N!==void 0&&(x.bearing=N),V!==void 0&&(x.elevation=V),m.apply(x)}this.transform.apply(m)}_fireMoveEvents(o){this.fire(new l.k("move",o)),this._zooming&&this.fire(new l.k("zoom",o)),this._rotating&&this.fire(new l.k("rotate",o)),this._pitching&&this.fire(new l.k("pitch",o))}_afterEase(o,d){if(this._easeId&&d&&this._easeId===d)return;delete this._easeId;const m=this._zooming,y=this._rotating,x=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,m&&this.fire(new l.k("zoomend",o)),y&&this.fire(new l.k("rotateend",o)),x&&this.fire(new l.k("pitchend",o)),this.fire(new l.k("moveend",o))}flyTo(o,d){var m;if(!o.essential&&E.prefersReducedMotion){const nt=l.M(o,["center","zoom","bearing","pitch","around"]);return this.jumpTo(nt,d)}this.stop(),o=l.e({offset:[0,0],speed:1.2,curve:1.42,easing:l.b9},o);const y=this._getTransformForUpdate(),x=y.zoom,M=y.bearing,I=y.pitch,O=y.padding,N="bearing"in o?this._normalizeBearing(o.bearing,M):M,V="pitch"in o?+o.pitch:I,F="padding"in o?o.padding:y.padding,Z=l.P.convert(o.offset);let J=y.centerPoint.add(Z);const ee=y.pointLocation(J),{center:oe,zoom:le}=y.getConstrained(l.N.convert(o.center||ee),(m=o.zoom)!==null&&m!==void 0?m:x);this._normalizeCenter(oe,y);const ce=y.zoomScale(le-x),he=y.project(ee),ne=y.project(oe).sub(he);let me=o.curve;const ge=Math.max(y.width,y.height),xe=ge/ce,Be=ne.mag();if("minZoom"in o){const nt=l.ac(Math.min(o.minZoom,x,le),y.minZoom,y.maxZoom),Dt=ge/y.zoomScale(nt-x);me=Math.sqrt(Dt/Be*2)}const Fe=me*me;function Qe(nt){const Dt=(xe*xe-ge*ge+(nt?-1:1)*Fe*Fe*Be*Be)/(2*(nt?xe:ge)*Fe*Be);return Math.log(Math.sqrt(Dt*Dt+1)-Dt)}function st(nt){return(Math.exp(nt)-Math.exp(-nt))/2}function Ye(nt){return(Math.exp(nt)+Math.exp(-nt))/2}const Ge=Qe(!1);let mt=function(nt){return Ye(Ge)/Ye(Ge+me*nt)},Bt=function(nt){return ge*((Ye(Ge)*(st(Dt=Ge+me*nt)/Ye(Dt))-st(Ge))/Fe)/Be;var Dt},Ke=(Qe(!0)-Ge)/me;if(Math.abs(Be)<1e-6||!isFinite(Ke)){if(Math.abs(ge-xe)<1e-6)return this.easeTo(o,d);const nt=xe<ge?-1:1;Ke=Math.abs(Math.log(xe/ge))/me,Bt=()=>0,mt=Dt=>Math.exp(nt*me*Dt)}return o.duration="duration"in o?+o.duration:1e3*Ke/("screenSpeed"in o?+o.screenSpeed/me:+o.speed),o.maxDuration&&o.duration>o.maxDuration&&(o.duration=0),this._zooming=!0,this._rotating=M!==N,this._pitching=V!==I,this._padding=!y.isPaddingEqual(F),this._prepareEase(d,!1),this.terrain&&this._prepareElevation(oe),this._ease(nt=>{const Dt=nt*Ke,Fn=1/mt(Dt);y.zoom=nt===1?le:x+y.scaleZoom(Fn),this._rotating&&(y.bearing=l.y.number(M,N,nt)),this._pitching&&(y.pitch=l.y.number(I,V,nt)),this._padding&&(y.interpolatePadding(O,F,nt),J=y.centerPoint.add(Z)),this.terrain&&!o.freezeElevation&&this._updateElevation(nt);const $t=nt===1?oe:y.unproject(he.add(ne.mult(Bt(Dt))).mult(Fn));y.setLocationAtPoint(y.renderWorldCopies?$t.wrap():$t,J),this._applyUpdatedTransform(y),this._fireMoveEvents(d)},()=>{this.terrain&&o.freezeElevation&&this._finalizeElevation(),this._afterEase(d)},o),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(o,d){var m;if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const y=this._onEaseEnd;delete this._onEaseEnd,y.call(this,d)}return o||(m=this.handlers)===null||m===void 0||m.stop(!1),this}_ease(o,d,m){m.animate===!1||m.duration===0?(o(1),d()):(this._easeStart=E.now(),this._easeOptions=m,this._onEaseFrame=o,this._onEaseEnd=d,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(o,d){o=l.b3(o,-180,180);const m=Math.abs(o-d);return Math.abs(o-360-d)<m&&(o-=360),Math.abs(o+360-d)<m&&(o+=360),o}_normalizeCenter(o,d){if(!d.renderWorldCopies||d.lngRange)return;const m=o.lng-d.center.lng;o.lng+=m>180?-360:m<-180?360:0}queryTerrainElevation(o){return this.terrain?this.terrain.getElevationForLngLatZoom(l.N.convert(o),this.transform.tileZoom)-this.transform.elevation:null}}const Ga={compact:!0,customAttribution:'<a href="https://maplibre.org/" target="_blank">MapLibre</a>'};class Za{constructor(o=Ga){this._toggleAttribution=()=>{this._container.classList.contains("maplibregl-compact")&&(this._container.classList.contains("maplibregl-compact-show")?(this._container.setAttribute("open",""),this._container.classList.remove("maplibregl-compact-show")):(this._container.classList.add("maplibregl-compact-show"),this._container.removeAttribute("open")))},this._updateData=d=>{!d||d.sourceDataType!=="metadata"&&d.sourceDataType!=="visibility"&&d.dataType!=="style"&&d.type!=="terrain"||this._updateAttributions()},this._updateCompact=()=>{this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact===!1?this._container.setAttribute("open",""):this._container.classList.contains("maplibregl-compact")||this._container.classList.contains("maplibregl-attrib-empty")||(this._container.setAttribute("open",""),this._container.classList.add("maplibregl-compact","maplibregl-compact-show")):(this._container.setAttribute("open",""),this._container.classList.contains("maplibregl-compact")&&this._container.classList.remove("maplibregl-compact","maplibregl-compact-show"))},this._updateCompactMinimize=()=>{this._container.classList.contains("maplibregl-compact")&&this._container.classList.contains("maplibregl-compact-show")&&this._container.classList.remove("maplibregl-compact-show")},this.options=o}getDefaultPosition(){return"bottom-right"}onAdd(o){return this._map=o,this._compact=this.options.compact,this._container=C.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=C.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=C.create("div","maplibregl-ctrl-attrib-inner",this._container),this._updateAttributions(),this._updateCompact(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("terrain",this._updateData),this._map.on("resize",this._updateCompact),this._map.on("drag",this._updateCompactMinimize),this._container}onRemove(){C.remove(this._container),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("terrain",this._updateData),this._map.off("resize",this._updateCompact),this._map.off("drag",this._updateCompactMinimize),this._map=void 0,this._compact=void 0,this._attribHTML=void 0}_setElementTitle(o,d){const m=this._map._getUIString(`AttributionControl.${d}`);o.title=m,o.setAttribute("aria-label",m)}_updateAttributions(){if(!this._map.style)return;let o=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?o=o.concat(this.options.customAttribution.map(y=>typeof y!="string"?"":y)):typeof this.options.customAttribution=="string"&&o.push(this.options.customAttribution)),this._map.style.stylesheet){const y=this._map.style.stylesheet;this.styleOwner=y.owner,this.styleId=y.id}const d=this._map.style.sourceCaches;for(const y in d){const x=d[y];if(x.used||x.usedForTerrain){const M=x.getSource();M.attribution&&o.indexOf(M.attribution)<0&&o.push(M.attribution)}}o=o.filter(y=>String(y).trim()),o.sort((y,x)=>y.length-x.length),o=o.filter((y,x)=>{for(let M=x+1;M<o.length;M++)if(o[M].indexOf(y)>=0)return!1;return!0});const m=o.join(" | ");m!==this._attribHTML&&(this._attribHTML=m,o.length?(this._innerContainer.innerHTML=m,this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}}class Od{constructor(o={}){this._updateCompact=()=>{const d=this._container.children;if(d.length){const m=d[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&m.classList.add("maplibregl-compact"):m.classList.remove("maplibregl-compact")}},this.options=o}getDefaultPosition(){return"bottom-left"}onAdd(o){this._map=o,this._compact=this.options&&this.options.compact,this._container=C.create("div","maplibregl-ctrl");const d=C.create("a","maplibregl-ctrl-logo");return d.target="_blank",d.rel="noopener nofollow",d.href="https://maplibre.org/",d.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),d.setAttribute("rel","noopener nofollow"),this._container.appendChild(d),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){C.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class en{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(o){const d=++this._id;return this._queue.push({callback:o,id:d,cancelled:!1}),d}remove(o){const d=this._currentlyRunning,m=d?this._queue.concat(d):this._queue;for(const y of m)if(y.id===o)return void(y.cancelled=!0)}run(o=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");const d=this._currentlyRunning=this._queue;this._queue=[];for(const m of d)if(!m.cancelled&&(m.callback(o),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}var Bd=l.Y([{name:"a_pos3d",type:"Int16",components:3}]);class E_ extends l.E{constructor(o){super(),this.sourceCache=o,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.deltaZoom=1,o.usedForTerrain=!0,o.tileSize=this.tileSize*2**this.deltaZoom}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null}update(o,d){this.sourceCache.update(o,d),this._renderableTilesKeys=[];const m={};for(const y of o.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:d}))m[y.key]=!0,this._renderableTilesKeys.push(y.key),this._tiles[y.key]||(y.posMatrix=new Float64Array(16),l.aP(y.posMatrix,0,l.X,0,l.X,0,1),this._tiles[y.key]=new To(y,this.tileSize));for(const y in this._tiles)m[y]||delete this._tiles[y]}freeRtt(o){for(const d in this._tiles){const m=this._tiles[d];(!o||m.tileID.equals(o)||m.tileID.isChildOf(o)||o.isChildOf(m.tileID))&&(m.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map(o=>this.getTileByID(o))}getTileByID(o){return this._tiles[o]}getTerrainCoords(o){const d={};for(const m of this._renderableTilesKeys){const y=this._tiles[m].tileID;if(y.canonical.equals(o.canonical)){const x=o.clone();x.posMatrix=new Float64Array(16),l.aP(x.posMatrix,0,l.X,0,l.X,0,1),d[m]=x}else if(y.canonical.isChildOf(o.canonical)){const x=o.clone();x.posMatrix=new Float64Array(16);const M=y.canonical.z-o.canonical.z,I=y.canonical.x-(y.canonical.x>>M<<M),O=y.canonical.y-(y.canonical.y>>M<<M),N=l.X>>M;l.aP(x.posMatrix,0,N,0,N,0,1),l.J(x.posMatrix,x.posMatrix,[-I*N,-O*N,0]),d[m]=x}else if(o.canonical.isChildOf(y.canonical)){const x=o.clone();x.posMatrix=new Float64Array(16);const M=o.canonical.z-y.canonical.z,I=o.canonical.x-(o.canonical.x>>M<<M),O=o.canonical.y-(o.canonical.y>>M<<M),N=l.X>>M;l.aP(x.posMatrix,0,l.X,0,l.X,0,1),l.J(x.posMatrix,x.posMatrix,[I*N,O*N,0]),l.K(x.posMatrix,x.posMatrix,[1/2**M,1/2**M,0]),d[m]=x}}return d}getSourceTile(o,d){const m=this.sourceCache._source;let y=o.overscaledZ-this.deltaZoom;if(y>m.maxzoom&&(y=m.maxzoom),y<m.minzoom)return null;this._sourceTileCache[o.key]||(this._sourceTileCache[o.key]=o.scaledTo(y).key);let x=this.sourceCache.getTileByID(this._sourceTileCache[o.key]);if((!x||!x.dem)&&d)for(;y>=m.minzoom&&(!x||!x.dem);)x=this.sourceCache.getTileByID(o.scaledTo(y--).key);return x}tilesAfterTime(o=Date.now()){return Object.values(this._tiles).filter(d=>d.timeAdded>=o)}}class zd{constructor(o,d,m){this.painter=o,this.sourceCache=new E_(d),this.options=m,this.exaggeration=typeof m.exaggeration=="number"?m.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}getDEMElevation(o,d,m,y=l.X){var x;if(!(d>=0&&d<y&&m>=0&&m<y))return 0;const M=this.getTerrainData(o),I=(x=M.tile)===null||x===void 0?void 0:x.dem;if(!I)return 0;const O=function(ee,oe,le){var ce=oe[0],he=oe[1];return ee[0]=le[0]*ce+le[4]*he+le[12],ee[1]=le[1]*ce+le[5]*he+le[13],ee}([],[d/y*l.X,m/y*l.X],M.u_terrain_matrix),N=[O[0]*I.dim,O[1]*I.dim],V=Math.floor(N[0]),F=Math.floor(N[1]),Z=N[0]-V,J=N[1]-F;return I.get(V,F)*(1-Z)*(1-J)+I.get(V+1,F)*Z*(1-J)+I.get(V,F+1)*(1-Z)*J+I.get(V+1,F+1)*Z*J}getElevationForLngLatZoom(o,d){if(!l.bb(d,o.wrap()))return 0;const{tileID:m,mercatorX:y,mercatorY:x}=this._getOverscaledTileIDFromLngLatZoom(o,d);return this.getElevation(m,y%l.X,x%l.X,l.X)}getElevation(o,d,m,y=l.X){return this.getDEMElevation(o,d,m,y)*this.exaggeration}getTerrainData(o){if(!this._emptyDemTexture){const y=this.painter.context,x=new l.R({width:1,height:1},new Uint8Array(4));this._emptyDepthTexture=new Xe(y,x,y.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new Xe(y,new l.R({width:1,height:1}),y.gl.RGBA,{premultiply:!1}),this._emptyDemTexture.bind(y.gl.NEAREST,y.gl.CLAMP_TO_EDGE),this._emptyDemMatrix=l.an([])}const d=this.sourceCache.getSourceTile(o,!0);if(d&&d.dem&&(!d.demTexture||d.needsTerrainPrepare)){const y=this.painter.context;d.demTexture=this.painter.getTileTexture(d.dem.stride),d.demTexture?d.demTexture.update(d.dem.getPixels(),{premultiply:!1}):d.demTexture=new Xe(y,d.dem.getPixels(),y.gl.RGBA,{premultiply:!1}),d.demTexture.bind(y.gl.NEAREST,y.gl.CLAMP_TO_EDGE),d.needsTerrainPrepare=!1}const m=d&&d+d.tileID.key+o.key;if(m&&!this._demMatrixCache[m]){const y=this.sourceCache.sourceCache._source.maxzoom;let x=o.canonical.z-d.tileID.canonical.z;o.overscaledZ>o.canonical.z&&(o.canonical.z>=y?x=o.canonical.z-y:l.w("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const M=o.canonical.x-(o.canonical.x>>x<<x),I=o.canonical.y-(o.canonical.y>>x<<x),O=l.bc(new Float64Array(16),[1/(l.X<<x),1/(l.X<<x),0]);l.J(O,O,[M*l.X,I*l.X,0]),this._demMatrixCache[o.key]={matrix:O,coord:o}}return{u_depth:2,u_terrain:3,u_terrain_dim:d&&d.dem&&d.dem.dim||1,u_terrain_matrix:m?this._demMatrixCache[o.key].matrix:this._emptyDemMatrix,u_terrain_unpack:d&&d.dem&&d.dem.getUnpackVector()||this._emptyDemUnpack,u_terrain_exaggeration:this.exaggeration,texture:(d&&d.demTexture||this._emptyDemTexture).texture,depthTexture:(this._fboDepthTexture||this._emptyDepthTexture).texture,tile:d}}getFramebuffer(o){const d=this.painter,m=d.width/devicePixelRatio,y=d.height/devicePixelRatio;return!this._fbo||this._fbo.width===m&&this._fbo.height===y||(this._fbo.destroy(),this._fboCoordsTexture.destroy(),this._fboDepthTexture.destroy(),delete this._fbo,delete this._fboDepthTexture,delete this._fboCoordsTexture),this._fboCoordsTexture||(this._fboCoordsTexture=new Xe(d.context,{width:m,height:y,data:null},d.context.gl.RGBA,{premultiply:!1}),this._fboCoordsTexture.bind(d.context.gl.NEAREST,d.context.gl.CLAMP_TO_EDGE)),this._fboDepthTexture||(this._fboDepthTexture=new Xe(d.context,{width:m,height:y,data:null},d.context.gl.RGBA,{premultiply:!1}),this._fboDepthTexture.bind(d.context.gl.NEAREST,d.context.gl.CLAMP_TO_EDGE)),this._fbo||(this._fbo=d.context.createFramebuffer(m,y,!0,!1),this._fbo.depthAttachment.set(d.context.createRenderbuffer(d.context.gl.DEPTH_COMPONENT16,m,y))),this._fbo.colorAttachment.set(o==="coords"?this._fboCoordsTexture.texture:this._fboDepthTexture.texture),this._fbo}getCoordsTexture(){const o=this.painter.context;if(this._coordsTexture)return this._coordsTexture;const d=new Uint8Array(this._coordsTextureSize*this._coordsTextureSize*4);for(let x=0,M=0;x<this._coordsTextureSize;x++)for(let I=0;I<this._coordsTextureSize;I++,M+=4)d[M+0]=255&I,d[M+1]=255&x,d[M+2]=I>>8<<4|x>>8,d[M+3]=0;const m=new l.R({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(d.buffer)),y=new Xe(o,m,o.gl.RGBA,{premultiply:!1});return y.bind(o.gl.NEAREST,o.gl.CLAMP_TO_EDGE),this._coordsTexture=y,y}pointCoordinate(o){this.painter.maybeDrawDepthAndCoords(!0);const d=new Uint8Array(4),m=this.painter.context,y=m.gl,x=Math.round(o.x*this.painter.pixelRatio/devicePixelRatio),M=Math.round(o.y*this.painter.pixelRatio/devicePixelRatio),I=Math.round(this.painter.height/devicePixelRatio);m.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),y.readPixels(x,I-M-1,1,1,y.RGBA,y.UNSIGNED_BYTE,d),m.bindFramebuffer.set(null);const O=d[0]+(d[2]>>4<<8),N=d[1]+((15&d[2])<<8),V=this.coordsIndex[255-d[3]],F=V&&this.sourceCache.getTileByID(V);if(!F)return null;const Z=this._coordsTextureSize,J=(1<<F.tileID.canonical.z)*Z;return new l.Z((F.tileID.canonical.x*Z+O)/J+F.tileID.wrap,(F.tileID.canonical.y*Z+N)/J,this.getElevation(F.tileID,O,N,Z))}depthAtPoint(o){const d=new Uint8Array(4),m=this.painter.context,y=m.gl;return m.bindFramebuffer.set(this.getFramebuffer("depth").framebuffer),y.readPixels(o.x,this.painter.height/devicePixelRatio-o.y-1,1,1,y.RGBA,y.UNSIGNED_BYTE,d),m.bindFramebuffer.set(null),(d[0]/16777216+d[1]/65536+d[2]/256+d[3])/256}getTerrainMesh(){if(this._mesh)return this._mesh;const o=this.painter.context,d=new l.bd,m=new l.aY,y=this.meshSize,x=l.X/y,M=y*y;for(let F=0;F<=y;F++)for(let Z=0;Z<=y;Z++)d.emplaceBack(Z*x,F*x,0);for(let F=0;F<M;F+=y+1)for(let Z=0;Z<y;Z++)m.emplaceBack(Z+F,y+Z+F+1,y+Z+F+2),m.emplaceBack(Z+F,y+Z+F+2,Z+F+1);const I=d.length,O=I+2*(y+1);for(const F of[0,1])for(let Z=0;Z<=y;Z++)for(const J of[0,1])d.emplaceBack(Z*x,F*l.X,J);for(let F=0;F<2*y;F+=2)m.emplaceBack(O+F,O+F+1,O+F+3),m.emplaceBack(O+F,O+F+3,O+F+2),m.emplaceBack(I+F,I+F+3,I+F+1),m.emplaceBack(I+F,I+F+2,I+F+3);const N=d.length,V=N+2*(y+1);for(const F of[0,1])for(let Z=0;Z<=y;Z++)for(const J of[0,1])d.emplaceBack(F*l.X,Z*x,J);for(let F=0;F<2*y;F+=2)m.emplaceBack(N+F,N+F+1,N+F+3),m.emplaceBack(N+F,N+F+3,N+F+2),m.emplaceBack(V+F,V+F+3,V+F+1),m.emplaceBack(V+F,V+F+2,V+F+3);return this._mesh=new yu(o.createVertexBuffer(d,Bd.members),o.createIndexBuffer(m),l.a0.simpleSegment(0,0,d.length,m.length)),this._mesh}getMeshFrameDelta(o){return 2*Math.PI*l.be/Math.pow(2,o)/5}getMinTileElevationForLngLatZoom(o,d){var m;const{tileID:y}=this._getOverscaledTileIDFromLngLatZoom(o,d);return(m=this.getMinMaxElevation(y).minElevation)!==null&&m!==void 0?m:0}getMinMaxElevation(o){const d=this.getTerrainData(o).tile,m={minElevation:null,maxElevation:null};return d&&d.dem&&(m.minElevation=d.dem.min*this.exaggeration,m.maxElevation=d.dem.max*this.exaggeration),m}_getOverscaledTileIDFromLngLatZoom(o,d){const m=l.Z.fromLngLat(o.wrap()),y=(1<<d)*l.X,x=m.x*y,M=m.y*y,I=Math.floor(x/l.X),O=Math.floor(M/l.X);return{tileID:new l.S(d,0,d,I,O),mercatorX:x,mercatorY:M}}}class C_{constructor(o,d,m){this._context=o,this._size=d,this._tileSize=m,this._objects=[],this._recentlyUsed=[],this._stamp=0}destruct(){for(const o of this._objects)o.texture.destroy(),o.fbo.destroy()}_createObject(o){const d=this._context.createFramebuffer(this._tileSize,this._tileSize,!0,!0),m=new Xe(this._context,{width:this._tileSize,height:this._tileSize,data:null},this._context.gl.RGBA);return m.bind(this._context.gl.LINEAR,this._context.gl.CLAMP_TO_EDGE),d.depthAttachment.set(this._context.createRenderbuffer(this._context.gl.DEPTH_STENCIL,this._tileSize,this._tileSize)),d.colorAttachment.set(m.texture),{id:o,fbo:d,texture:m,stamp:-1,inUse:!1}}getObjectForId(o){return this._objects[o]}useObject(o){o.inUse=!0,this._recentlyUsed=this._recentlyUsed.filter(d=>o.id!==d),this._recentlyUsed.push(o.id)}stampObject(o){o.stamp=++this._stamp}getOrCreateFreeObject(){for(const d of this._recentlyUsed)if(!this._objects[d].inUse)return this._objects[d];if(this._objects.length>=this._size)throw new Error("No free RenderPool available, call freeAllObjects() required!");const o=this._createObject(this._objects.length);return this._objects.push(o),o}freeObject(o){o.inUse=!1}freeAllObjects(){for(const o of this._objects)this.freeObject(o)}isFull(){return!(this._objects.length<this._size)&&this._objects.some(o=>!o.inUse)===!1}}const Ya={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0};class Mm{constructor(o,d){this.painter=o,this.terrain=d,this.pool=new C_(o.context,30,d.sourceCache.tileSize*d.qualityFactor)}destruct(){this.pool.destruct()}getTexture(o){return this.pool.getObjectForId(o.rtt[this._stacks.length-1].id).texture}prepareForRender(o,d){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.sourceCache.getRenderableTiles(),this._renderableLayerIds=o._order.filter(m=>!o._layers[m].isHidden(d)),this._coordsDescendingInv={};for(const m in o.sourceCaches){this._coordsDescendingInv[m]={};const y=o.sourceCaches[m].getVisibleCoordinates();for(const x of y){const M=this.terrain.sourceCache.getTerrainCoords(x);for(const I in M)this._coordsDescendingInv[m][I]||(this._coordsDescendingInv[m][I]=[]),this._coordsDescendingInv[m][I].push(M[I])}}this._coordsDescendingInvStr={};for(const m of o._order){const y=o._layers[m],x=y.source;if(Ya[y.type]&&!this._coordsDescendingInvStr[x]){this._coordsDescendingInvStr[x]={};for(const M in this._coordsDescendingInv[x])this._coordsDescendingInvStr[x][M]=this._coordsDescendingInv[x][M].map(I=>I.key).sort().join()}}for(const m of this._renderableTiles)for(const y in this._coordsDescendingInvStr){const x=this._coordsDescendingInvStr[y][m.tileID.key];x&&x!==m.rttCoords[y]&&(m.rtt=[])}}renderLayer(o){if(o.isHidden(this.painter.transform.zoom))return!1;const d=o.type,m=this.painter,y=this._renderableLayerIds[this._renderableLayerIds.length-1]===o.id;if(Ya[d]&&(this._prevType&&Ya[this._prevType]||this._stacks.push([]),this._prevType=d,this._stacks[this._stacks.length-1].push(o.id),!y))return!0;if(Ya[this._prevType]||Ya[d]&&y){this._prevType=d;const x=this._stacks.length-1,M=this._stacks[x]||[];for(const I of this._renderableTiles){if(this.pool.isFull()&&(xm(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(I),I.rtt[x]){const N=this.pool.getObjectForId(I.rtt[x].id);if(N.stamp===I.rtt[x].stamp){this.pool.useObject(N);continue}}const O=this.pool.getOrCreateFreeObject();this.pool.useObject(O),this.pool.stampObject(O),I.rtt[x]={id:O.id,stamp:O.stamp},m.context.bindFramebuffer.set(O.fbo.framebuffer),m.context.clear({color:l.aM.transparent,stencil:0}),m.currentStencilSource=void 0;for(let N=0;N<M.length;N++){const V=m.style._layers[M[N]],F=V.source?this._coordsDescendingInv[V.source][I.tileID.key]:[I.tileID];m.context.viewport.set([0,0,O.fbo.width,O.fbo.height]),m._renderTileClippingMasks(V,F),m.renderLayer(m,m.style.sourceCaches[V.source],V,F),V.source&&(I.rttCoords[V.source]=this._coordsDescendingInvStr[V.source][I.tileID.key])}}return xm(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects(),Ya[d]}return!1}}const Nd={"AttributionControl.ToggleAttribution":"Toggle attribution","AttributionControl.MapFeedback":"Map feedback","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"MapLibre logo","Map.Title":"Map","Marker.Title":"Map marker","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","Popup.Close":"Close popup","ScaleControl.Feet":"ft","ScaleControl.Meters":"m","ScaleControl.Kilometers":"km","ScaleControl.Miles":"mi","ScaleControl.NauticalMiles":"nm","TerrainControl.Enable":"Enable terrain","TerrainControl.Disable":"Disable terrain","CooperativeGesturesHandler.WindowsHelpText":"Use Ctrl + scroll to zoom the map","CooperativeGesturesHandler.MacHelpText":"Use ⌘ + scroll to zoom the map","CooperativeGesturesHandler.MobileHelpText":"Use two fingers to move the map"},Am=g,T_={hash:!1,interactive:!0,bearingSnap:7,attributionControl:Ga,maplibreLogo:!1,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:!1,refreshExpiredTiles:!0,scrollZoom:!0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:60,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:!1,trackResize:!0,center:[0,0],zoom:0,bearing:0,pitch:0,renderWorldCopies:!0,maxTileCacheSize:null,maxTileCacheZoomLevels:l.a.MAX_TILE_CACHE_ZOOM_LEVELS,transformRequest:null,transformCameraUpdate:null,fadeDuration:300,crossSourceCollisions:!0,clickTolerance:3,localIdeographFontFamily:"sans-serif",pitchWithRotate:!0,validateStyle:!0,maxCanvasSize:[4096,4096],cancelPendingTileRequestsWhileZooming:!0},Rd=v=>{v.touchstart=v.dragStart,v.touchmoveWindow=v.dragMove,v.touchend=v.dragEnd},M_={showCompass:!0,showZoom:!0,visualizePitch:!1};class A_{constructor(o,d,m=!1){this.mousedown=M=>{this.startMouse(l.e({},M,{ctrlKey:!0,preventDefault:()=>M.preventDefault()}),C.mousePos(this.element,M)),C.addEventListener(window,"mousemove",this.mousemove),C.addEventListener(window,"mouseup",this.mouseup)},this.mousemove=M=>{this.moveMouse(M,C.mousePos(this.element,M))},this.mouseup=M=>{this.mouseRotate.dragEnd(M),this.mousePitch&&this.mousePitch.dragEnd(M),this.offTemp()},this.touchstart=M=>{M.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=C.touchPos(this.element,M.targetTouches)[0],this.startTouch(M,this._startPos),C.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),C.addEventListener(window,"touchend",this.touchend))},this.touchmove=M=>{M.targetTouches.length!==1?this.reset():(this._lastPos=C.touchPos(this.element,M.targetTouches)[0],this.moveTouch(M,this._lastPos))},this.touchend=M=>{M.targetTouches.length===0&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)<this._clickTolerance&&this.element.click(),delete this._startPos,delete this._lastPos,this.offTemp()},this.reset=()=>{this.mouseRotate.reset(),this.mousePitch&&this.mousePitch.reset(),this.touchRotate.reset(),this.touchPitch&&this.touchPitch.reset(),delete this._startPos,delete this._lastPos,this.offTemp()},this._clickTolerance=10;const y=o.dragRotate._mouseRotate.getClickTolerance(),x=o.dragRotate._mousePitch.getClickTolerance();this.element=d,this.mouseRotate=Sd({clickTolerance:y,enable:!0}),this.touchRotate=(({enable:M,clickTolerance:I,bearingDegreesPerPixelMoved:O=.8})=>{const N=new kd;return new qo({clickTolerance:I,move:(V,F)=>({bearingDelta:(F.x-V.x)*O}),moveStateManager:N,enable:M,assignEvents:Rd})})({clickTolerance:y,enable:!0}),this.map=o,m&&(this.mousePitch=Ed({clickTolerance:x,enable:!0}),this.touchPitch=(({enable:M,clickTolerance:I,pitchDegreesPerPixelMoved:O=-.5})=>{const N=new kd;return new qo({clickTolerance:I,move:(V,F)=>({pitchDelta:(F.y-V.y)*O}),moveStateManager:N,enable:M,assignEvents:Rd})})({clickTolerance:x,enable:!0})),C.addEventListener(d,"mousedown",this.mousedown),C.addEventListener(d,"touchstart",this.touchstart,{passive:!1}),C.addEventListener(d,"touchcancel",this.reset)}startMouse(o,d){this.mouseRotate.dragStart(o,d),this.mousePitch&&this.mousePitch.dragStart(o,d),C.disableDrag()}startTouch(o,d){this.touchRotate.dragStart(o,d),this.touchPitch&&this.touchPitch.dragStart(o,d),C.disableDrag()}moveMouse(o,d){const m=this.map,{bearingDelta:y}=this.mouseRotate.dragMove(o,d)||{};if(y&&m.setBearing(m.getBearing()+y),this.mousePitch){const{pitchDelta:x}=this.mousePitch.dragMove(o,d)||{};x&&m.setPitch(m.getPitch()+x)}}moveTouch(o,d){const m=this.map,{bearingDelta:y}=this.touchRotate.dragMove(o,d)||{};if(y&&m.setBearing(m.getBearing()+y),this.touchPitch){const{pitchDelta:x}=this.touchPitch.dragMove(o,d)||{};x&&m.setPitch(m.getPitch()+x)}}off(){const o=this.element;C.removeEventListener(o,"mousedown",this.mousedown),C.removeEventListener(o,"touchstart",this.touchstart,{passive:!1}),C.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),C.removeEventListener(window,"touchend",this.touchend),C.removeEventListener(o,"touchcancel",this.reset),this.offTemp()}offTemp(){C.enableDrag(),C.removeEventListener(window,"mousemove",this.mousemove),C.removeEventListener(window,"mouseup",this.mouseup),C.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),C.removeEventListener(window,"touchend",this.touchend)}}let br;function Vn(v,o,d){const m=new l.N(v.lng,v.lat);if(v=new l.N(v.lng,v.lat),o){const y=new l.N(v.lng-360,v.lat),x=new l.N(v.lng+360,v.lat),M=d.locationPoint(v).distSqr(o);d.locationPoint(y).distSqr(o)<M?v=y:d.locationPoint(x).distSqr(o)<M&&(v=x)}for(;Math.abs(v.lng-d.center.lng)>180;){const y=d.locationPoint(v);if(y.x>=0&&y.y>=0&&y.x<=d.width&&y.y<=d.height)break;v.lng>d.center.lng?v.lng-=360:v.lng+=360}return v.lng!==m.lng&&d.locationPoint(v).y>d.height/2-d.getHorizon()?v:m}const Xa={center:"translate(-50%,-50%)",top:"translate(-50%,0)","top-left":"translate(0,0)","top-right":"translate(-100%,0)",bottom:"translate(-50%,-100%)","bottom-left":"translate(0,-100%)","bottom-right":"translate(-100%,-100%)",left:"translate(0,-50%)",right:"translate(-100%,-50%)"};function Mu(v,o,d){const m=v.classList;for(const y in Xa)m.remove(`maplibregl-${d}-anchor-${y}`);m.add(`maplibregl-${d}-anchor-${o}`)}class Au extends l.E{constructor(o){if(super(),this._onKeyPress=d=>{const m=d.code,y=d.charCode||d.keyCode;m!=="Space"&&m!=="Enter"&&y!==32&&y!==13||this.togglePopup()},this._onMapClick=d=>{const m=d.originalEvent.target,y=this._element;this._popup&&(m===y||y.contains(m))&&this.togglePopup()},this._update=d=>{var m;if(!this._map)return;const y=this._map.loaded()&&!this._map.isMoving();((d==null?void 0:d.type)==="terrain"||(d==null?void 0:d.type)==="render"&&!y)&&this._map.once("render",this._update),this._lngLat=this._map.transform.renderWorldCopies?Vn(this._lngLat,this._flatPos,this._map.transform):(m=this._lngLat)===null||m===void 0?void 0:m.wrap(),this._flatPos=this._pos=this._map.project(this._lngLat)._add(this._offset),this._map.terrain&&(this._flatPos=this._map.transform.locationPoint(this._lngLat)._add(this._offset));let x="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?x=`rotateZ(${this._rotation}deg)`:this._rotationAlignment==="map"&&(x=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let M="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?M="rotateX(0deg)":this._pitchAlignment==="map"&&(M=`rotateX(${this._map.getPitch()}deg)`),this._subpixelPositioning||d&&d.type!=="moveend"||(this._pos=this._pos.round()),C.setTransform(this._element,`${Xa[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${M} ${x}`),E.frameAsync(new AbortController).then(()=>{this._updateOpacity(d&&d.type==="moveend")}).catch(()=>{})},this._onMove=d=>{if(!this._isDragging){const m=this._clickTolerance||this._map._clickTolerance;this._isDragging=d.point.dist(this._pointerdownPos)>=m}this._isDragging&&(this._pos=d.point.sub(this._positionDelta),this._lngLat=this._map.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none",this._state==="pending"&&(this._state="active",this.fire(new l.k("dragstart"))),this.fire(new l.k("drag")))},this._onUp=()=>{this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1,this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),this._state==="active"&&this.fire(new l.k("dragend")),this._state="inactive"},this._addDragHandler=d=>{this._element.contains(d.originalEvent.target)&&(d.preventDefault(),this._positionDelta=d.point.sub(this._pos).add(this._offset),this._pointerdownPos=d.point,this._state="pending",this._map.on("mousemove",this._onMove),this._map.on("touchmove",this._onMove),this._map.once("mouseup",this._onUp),this._map.once("touchend",this._onUp))},this._anchor=o&&o.anchor||"center",this._color=o&&o.color||"#3FB1CE",this._scale=o&&o.scale||1,this._draggable=o&&o.draggable||!1,this._clickTolerance=o&&o.clickTolerance||0,this._subpixelPositioning=o&&o.subpixelPositioning||!1,this._isDragging=!1,this._state="inactive",this._rotation=o&&o.rotation||0,this._rotationAlignment=o&&o.rotationAlignment||"auto",this._pitchAlignment=o&&o.pitchAlignment&&o.pitchAlignment!=="auto"?o.pitchAlignment:this._rotationAlignment,this.setOpacity(),this.setOpacity(o==null?void 0:o.opacity,o==null?void 0:o.opacityWhenCovered),o&&o.element)this._element=o.element,this._offset=l.P.convert(o&&o.offset||[0,0]);else{this._defaultMarker=!0,this._element=C.create("div");const d=C.createNS("http://www.w3.org/2000/svg","svg"),m=41,y=27;d.setAttributeNS(null,"display","block"),d.setAttributeNS(null,"height",`${m}px`),d.setAttributeNS(null,"width",`${y}px`),d.setAttributeNS(null,"viewBox",`0 0 ${y} ${m}`);const x=C.createNS("http://www.w3.org/2000/svg","g");x.setAttributeNS(null,"stroke","none"),x.setAttributeNS(null,"stroke-width","1"),x.setAttributeNS(null,"fill","none"),x.setAttributeNS(null,"fill-rule","evenodd");const M=C.createNS("http://www.w3.org/2000/svg","g");M.setAttributeNS(null,"fill-rule","nonzero");const I=C.createNS("http://www.w3.org/2000/svg","g");I.setAttributeNS(null,"transform","translate(3.0, 29.0)"),I.setAttributeNS(null,"fill","#000000");const O=[{rx:"10.5",ry:"5.25002273"},{rx:"10.5",ry:"5.25002273"},{rx:"9.5",ry:"4.77275007"},{rx:"8.5",ry:"4.29549936"},{rx:"7.5",ry:"3.81822308"},{rx:"6.5",ry:"3.34094679"},{rx:"5.5",ry:"2.86367051"},{rx:"4.5",ry:"2.38636864"}];for(const ce of O){const he=C.createNS("http://www.w3.org/2000/svg","ellipse");he.setAttributeNS(null,"opacity","0.04"),he.setAttributeNS(null,"cx","10.5"),he.setAttributeNS(null,"cy","5.80029008"),he.setAttributeNS(null,"rx",ce.rx),he.setAttributeNS(null,"ry",ce.ry),I.appendChild(he)}const N=C.createNS("http://www.w3.org/2000/svg","g");N.setAttributeNS(null,"fill",this._color);const V=C.createNS("http://www.w3.org/2000/svg","path");V.setAttributeNS(null,"d","M27,13.5 C27,19.074644 20.250001,27.000002 14.75,34.500002 C14.016665,35.500004 12.983335,35.500004 12.25,34.500002 C6.7499993,27.000002 0,19.222562 0,13.5 C0,6.0441559 6.0441559,0 13.5,0 C20.955844,0 27,6.0441559 27,13.5 Z"),N.appendChild(V);const F=C.createNS("http://www.w3.org/2000/svg","g");F.setAttributeNS(null,"opacity","0.25"),F.setAttributeNS(null,"fill","#000000");const Z=C.createNS("http://www.w3.org/2000/svg","path");Z.setAttributeNS(null,"d","M13.5,0 C6.0441559,0 0,6.0441559 0,13.5 C0,19.222562 6.7499993,27 12.25,34.5 C13,35.522727 14.016664,35.500004 14.75,34.5 C20.250001,27 27,19.074644 27,13.5 C27,6.0441559 20.955844,0 13.5,0 Z M13.5,1 C20.415404,1 26,6.584596 26,13.5 C26,15.898657 24.495584,19.181431 22.220703,22.738281 C19.945823,26.295132 16.705119,30.142167 13.943359,33.908203 C13.743445,34.180814 13.612715,34.322738 13.5,34.441406 C13.387285,34.322738 13.256555,34.180814 13.056641,33.908203 C10.284481,30.127985 7.4148684,26.314159 5.015625,22.773438 C2.6163816,19.232715 1,15.953538 1,13.5 C1,6.584596 6.584596,1 13.5,1 Z"),F.appendChild(Z);const J=C.createNS("http://www.w3.org/2000/svg","g");J.setAttributeNS(null,"transform","translate(6.0, 7.0)"),J.setAttributeNS(null,"fill","#FFFFFF");const ee=C.createNS("http://www.w3.org/2000/svg","g");ee.setAttributeNS(null,"transform","translate(8.0, 8.0)");const oe=C.createNS("http://www.w3.org/2000/svg","circle");oe.setAttributeNS(null,"fill","#000000"),oe.setAttributeNS(null,"opacity","0.25"),oe.setAttributeNS(null,"cx","5.5"),oe.setAttributeNS(null,"cy","5.5"),oe.setAttributeNS(null,"r","5.4999962");const le=C.createNS("http://www.w3.org/2000/svg","circle");le.setAttributeNS(null,"fill","#FFFFFF"),le.setAttributeNS(null,"cx","5.5"),le.setAttributeNS(null,"cy","5.5"),le.setAttributeNS(null,"r","5.4999962"),ee.appendChild(oe),ee.appendChild(le),M.appendChild(I),M.appendChild(N),M.appendChild(F),M.appendChild(J),M.appendChild(ee),d.appendChild(M),d.setAttributeNS(null,"height",m*this._scale+"px"),d.setAttributeNS(null,"width",y*this._scale+"px"),this._element.appendChild(d),this._offset=l.P.convert(o&&o.offset||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",d=>{d.preventDefault()}),this._element.addEventListener("mousedown",d=>{d.preventDefault()}),Mu(this._element,this._anchor,"marker"),o&&o.className)for(const d of o.className.split(" "))this._element.classList.add(d);this._popup=null}addTo(o){return this.remove(),this._map=o,this._element.setAttribute("aria-label",o._getUIString("Marker.Title")),o.getCanvasContainer().appendChild(this._element),o.on("move",this._update),o.on("moveend",this._update),o.on("terrain",this._update),this.setDraggable(this._draggable),this._update(),this._map.on("click",this._onMapClick),this}remove(){return this._opacityTimeout&&(clearTimeout(this._opacityTimeout),delete this._opacityTimeout),this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._update),this._map.off("moveend",this._update),this._map.off("terrain",this._update),this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler),this._map.off("mouseup",this._onUp),this._map.off("touchend",this._onUp),this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),delete this._map),C.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(o){return this._lngLat=l.N.convert(o),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(o){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),o){if(!("offset"in o.options)){const y=Math.abs(13.5)/Math.SQRT2;o.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[y,-1*(38.1-13.5+y)],"bottom-right":[-y,-1*(38.1-13.5+y)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=o,this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}setSubpixelPositioning(o){return this._subpixelPositioning=o,this}getPopup(){return this._popup}togglePopup(){const o=this._popup;return this._element.style.opacity===this._opacityWhenCovered?this:o?(o.isOpen()?o.remove():(o.setLngLat(this._lngLat),o.addTo(this._map)),this):this}_updateOpacity(o=!1){var d,m;if(!(!((d=this._map)===null||d===void 0)&&d.terrain))return void(this._element.style.opacity!==this._opacity&&(this._element.style.opacity=this._opacity));if(o)this._opacityTimeout=null;else{if(this._opacityTimeout)return;this._opacityTimeout=setTimeout(()=>{this._opacityTimeout=null},100)}const y=this._map,x=y.terrain.depthAtPoint(this._pos),M=y.terrain.getElevationForLngLatZoom(this._lngLat,y.transform.tileZoom);if(y.transform.lngLatToCameraDepth(this._lngLat,M)-x<.006)return void(this._element.style.opacity=this._opacity);const I=-this._offset.y/y.transform._pixelPerMeter,O=Math.sin(y.getPitch()*Math.PI/180)*I,N=y.terrain.depthAtPoint(new l.P(this._pos.x,this._pos.y-this._offset.y)),V=y.transform.lngLatToCameraDepth(this._lngLat,M+O)-N>.006;!((m=this._popup)===null||m===void 0)&&m.isOpen()&&V&&this._popup.remove(),this._element.style.opacity=V?this._opacityWhenCovered:this._opacity}getOffset(){return this._offset}setOffset(o){return this._offset=l.P.convert(o),this._update(),this}addClassName(o){this._element.classList.add(o)}removeClassName(o){this._element.classList.remove(o)}toggleClassName(o){return this._element.classList.toggle(o)}setDraggable(o){return this._draggable=!!o,this._map&&(o?(this._map.on("mousedown",this._addDragHandler),this._map.on("touchstart",this._addDragHandler)):(this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(o){return this._rotation=o||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(o){return this._rotationAlignment=o||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(o){return this._pitchAlignment=o&&o!=="auto"?o:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}setOpacity(o,d){return o===void 0&&d===void 0&&(this._opacity="1",this._opacityWhenCovered="0.2"),o!==void 0&&(this._opacity=o),d!==void 0&&(this._opacityWhenCovered=d),this._map&&this._updateOpacity(!0),this}}const Im={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let Ql=0,ec=!1;const Io={maxWidth:100,unit:"metric"};function tc(v,o,d){const m=d&&d.maxWidth||100,y=v._container.clientHeight/2,x=v.unproject([0,y]),M=v.unproject([m,y]),I=x.distanceTo(M);if(d&&d.unit==="imperial"){const O=3.2808*I;O>5280?ft(o,m,O/5280,v._getUIString("ScaleControl.Miles")):ft(o,m,O,v._getUIString("ScaleControl.Feet"))}else d&&d.unit==="nautical"?ft(o,m,I/1852,v._getUIString("ScaleControl.NauticalMiles")):I>=1e3?ft(o,m,I/1e3,v._getUIString("ScaleControl.Kilometers")):ft(o,m,I,v._getUIString("ScaleControl.Meters"))}function ft(v,o,d,m){const y=function(x){const M=Math.pow(10,`${Math.floor(x)}`.length-1);let I=x/M;return I=I>=10?10:I>=5?5:I>=3?3:I>=2?2:I>=1?1:function(O){const N=Math.pow(10,Math.ceil(-Math.log(O)/Math.LN10));return Math.round(O*N)/N}(I),M*I}(d);v.style.width=o*(y/d)+"px",v.innerHTML=`${y}&nbsp;${m}`}const Et={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1},Iu=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function Pu(v){if(v){if(typeof v=="number"){const o=Math.round(Math.abs(v)/Math.SQRT2);return{center:new l.P(0,0),top:new l.P(0,v),"top-left":new l.P(o,o),"top-right":new l.P(-o,o),bottom:new l.P(0,-v),"bottom-left":new l.P(o,-o),"bottom-right":new l.P(-o,-o),left:new l.P(v,0),right:new l.P(-v,0)}}if(v instanceof l.P||Array.isArray(v)){const o=l.P.convert(v);return{center:o,top:o,"top-left":o,"top-right":o,bottom:o,"bottom-left":o,"bottom-right":o,left:o,right:o}}return{center:l.P.convert(v.center||[0,0]),top:l.P.convert(v.top||[0,0]),"top-left":l.P.convert(v["top-left"]||[0,0]),"top-right":l.P.convert(v["top-right"]||[0,0]),bottom:l.P.convert(v.bottom||[0,0]),"bottom-left":l.P.convert(v["bottom-left"]||[0,0]),"bottom-right":l.P.convert(v["bottom-right"]||[0,0]),left:l.P.convert(v.left||[0,0]),right:l.P.convert(v.right||[0,0])}}return Pu(new l.P(0,0))}const Ld=g;u.AJAXError=l.bh,u.Evented=l.E,u.LngLat=l.N,u.MercatorCoordinate=l.Z,u.Point=l.P,u.addProtocol=l.bi,u.config=l.a,u.removeProtocol=l.bj,u.AttributionControl=Za,u.BoxZoomHandler=_r,u.CanvasSource=vi,u.CooperativeGesturesHandler=Wa,u.DoubleClickZoomHandler=Ks,u.DragPanHandler=Em,u.DragRotateHandler=Cm,u.EdgeInsets=ja,u.FullscreenControl=class extends l.E{constructor(v={}){super(),this._onFullscreenChange=()=>{var o;let d=window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement;for(;!((o=d==null?void 0:d.shadowRoot)===null||o===void 0)&&o.fullscreenElement;)d=d.shadowRoot.fullscreenElement;d===this._container!==this._fullscreen&&this._handleFullscreenChange()},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},this._fullscreen=!1,v&&v.container&&(v.container instanceof HTMLElement?this._container=v.container:l.w("Full screen control 'container' must be a DOM element.")),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onmozfullscreenchange"in document?this._fullscreenchange="mozfullscreenchange":"onwebkitfullscreenchange"in document?this._fullscreenchange="webkitfullscreenchange":"onmsfullscreenchange"in document&&(this._fullscreenchange="MSFullscreenChange")}onAdd(v){return this._map=v,this._container||(this._container=this._map.getContainer()),this._controlContainer=C.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){C.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const v=this._fullscreenButton=C.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);C.create("span","maplibregl-ctrl-icon",v).setAttribute("aria-hidden","true"),v.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){const v=this._getTitle();this._fullscreenButton.setAttribute("aria-label",v),this._fullscreenButton.title=v}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_handleFullscreenChange(){this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("maplibregl-ctrl-shrink"),this._fullscreenButton.classList.toggle("maplibregl-ctrl-fullscreen"),this._updateTitle(),this._fullscreen?(this.fire(new l.k("fullscreenstart")),this._prevCooperativeGesturesEnabled=this._map.cooperativeGestures.isEnabled(),this._map.cooperativeGestures.disable()):(this.fire(new l.k("fullscreenend")),this._prevCooperativeGesturesEnabled&&this._map.cooperativeGestures.enable())}_exitFullscreen(){window.document.exitFullscreen?window.document.exitFullscreen():window.document.mozCancelFullScreen?window.document.mozCancelFullScreen():window.document.msExitFullscreen?window.document.msExitFullscreen():window.document.webkitCancelFullScreen?window.document.webkitCancelFullScreen():this._togglePseudoFullScreen()}_requestFullscreen(){this._container.requestFullscreen?this._container.requestFullscreen():this._container.mozRequestFullScreen?this._container.mozRequestFullScreen():this._container.msRequestFullscreen?this._container.msRequestFullscreen():this._container.webkitRequestFullscreen?this._container.webkitRequestFullscreen():this._togglePseudoFullScreen()}_togglePseudoFullScreen(){this._container.classList.toggle("maplibregl-pseudo-fullscreen"),this._handleFullscreenChange(),this._map.resize()}},u.GeoJSONSource=ui,u.GeolocateControl=class extends l.E{constructor(v){super(),this._onSuccess=o=>{if(this._map){if(this._isOutOfMapMaxBounds(o))return this._setErrorState(),this.fire(new l.k("outofmaxbounds",o)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=o,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background");break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}this.options.showUserLocation&&this._watchState!=="OFF"&&this._updateMarker(o),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(o),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new l.k("geolocate",o)),this._finish()}},this._updateCamera=o=>{const d=new l.N(o.coords.longitude,o.coords.latitude),m=o.coords.accuracy,y=this._map.getBearing(),x=l.e({bearing:y},this.options.fitBoundsOptions),M=we.fromLngLat(d,m);this._map.fitBounds(M,x,{geolocateSource:!0})},this._updateMarker=o=>{if(o){const d=new l.N(o.coords.longitude,o.coords.latitude);this._accuracyCircleMarker.setLngLat(d).addTo(this._map),this._userLocationDotMarker.setLngLat(d).addTo(this._map),this._accuracy=o.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()},this._onZoom=()=>{this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()},this._onError=o=>{if(this._map){if(this.options.trackUserLocation)if(o.code===1){this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;const d=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=d,this._geolocateButton.setAttribute("aria-label",d),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(o.code===3&&ec)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new l.k("error",o)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._setupUI=()=>{this._map&&(this._container.addEventListener("contextmenu",o=>o.preventDefault()),this._geolocateButton=C.create("button","maplibregl-ctrl-geolocate",this._container),C.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",this._geolocateButton.disabled=!0)},this._finishSetupUI=o=>{if(this._map){if(o===!1){l.w("Geolocation support is not available so the GeolocateControl will be disabled.");const d=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=d,this._geolocateButton.setAttribute("aria-label",d)}else{const d=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.disabled=!1,this._geolocateButton.title=d,this._geolocateButton.setAttribute("aria-label",d)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=C.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new Au({element:this._dotElement}),this._circleElement=C.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new Au({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",()=>this.trigger()),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",d=>{d.geolocateSource||this._watchState!=="ACTIVE_LOCK"||d.originalEvent&&d.originalEvent.type==="resize"||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this.fire(new l.k("trackuserlocationend")),this.fire(new l.k("userlocationlostfocus")))})}},this.options=l.e({},Im,v)}onAdd(v){return this._map=v,this._container=C.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),function(){return l._(this,arguments,void 0,function*(o=!1){if(br!==void 0&&!o)return br;if(window.navigator.permissions===void 0)return br=!!window.navigator.geolocation,br;try{br=(yield window.navigator.permissions.query({name:"geolocation"})).state!=="denied"}catch{br=!!window.navigator.geolocation}return br})}().then(o=>this._finishSetupUI(o)),this._container}onRemove(){this._geolocationWatchID!==void 0&&(window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),C.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,Ql=0,ec=!1}_isOutOfMapMaxBounds(v){const o=this._map.getMaxBounds(),d=v.coords;return o&&(d.longitude<o.getWest()||d.longitude>o.getEast()||d.latitude<o.getSouth()||d.latitude>o.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"ACTIVE_ERROR":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}}_updateCircleRadius(){const v=this._map.getBounds(),o=v.getSouthEast(),d=v.getNorthEast(),m=o.distanceTo(d),y=Math.ceil(this._accuracy/(m/this._map._container.clientHeight)*2);this._circleElement.style.width=`${y}px`,this._circleElement.style.height=`${y}px`}trigger(){if(!this._setup)return l.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 l.k("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":Ql--,ec=!1,this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this.fire(new l.k("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new l.k("trackuserlocationstart")),this.fire(new l.k("userlocationfocus"));break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"OFF":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}if(this._watchState==="OFF"&&this._geolocationWatchID!==void 0)this._clearWatch();else if(this._geolocationWatchID===void 0){let v;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),Ql++,Ql>1?(v={maximumAge:6e5,timeout:0},ec=!0):(v=this.options.positionOptions,ec=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,v)}}else window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0}_clearWatch(){window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}},u.Hash=bu,u.ImageSource=xi,u.KeyboardHandler=Lr,u.LngLatBounds=we,u.LogoControl=Od,u.Map=class extends Tm{constructor(v){l.bf.mark(l.bg.create);const o=Object.assign(Object.assign({},T_),v);if(o.minZoom!=null&&o.maxZoom!=null&&o.minZoom>o.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(o.minPitch!=null&&o.maxPitch!=null&&o.minPitch>o.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(o.minPitch!=null&&o.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(o.maxPitch!=null&&o.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(super(new Ua(o.minZoom,o.maxZoom,o.minPitch,o.maxPitch,o.renderWorldCopies),{bearingSnap:o.bearingSnap}),this._idleTriggered=!1,this._crossFadingFactor=1,this._renderTaskQueue=new en,this._controls=[],this._mapId=l.a4(),this._contextLost=d=>{d.preventDefault(),this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this.fire(new l.k("webglcontextlost",{originalEvent:d}))},this._contextRestored=d=>{this._setupPainter(),this.resize(),this._update(),this.fire(new l.k("webglcontextrestored",{originalEvent:d}))},this._onMapScroll=d=>{if(d.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()},this._interactive=o.interactive,this._maxTileCacheSize=o.maxTileCacheSize,this._maxTileCacheZoomLevels=o.maxTileCacheZoomLevels,this._failIfMajorPerformanceCaveat=o.failIfMajorPerformanceCaveat===!0,this._preserveDrawingBuffer=o.preserveDrawingBuffer===!0,this._antialias=o.antialias===!0,this._trackResize=o.trackResize===!0,this._bearingSnap=o.bearingSnap,this._refreshExpiredTiles=o.refreshExpiredTiles===!0,this._fadeDuration=o.fadeDuration,this._crossSourceCollisions=o.crossSourceCollisions===!0,this._collectResourceTiming=o.collectResourceTiming===!0,this._locale=Object.assign(Object.assign({},Nd),o.locale),this._clickTolerance=o.clickTolerance,this._overridePixelRatio=o.pixelRatio,this._maxCanvasSize=o.maxCanvasSize,this.transformCameraUpdate=o.transformCameraUpdate,this.cancelPendingTileRequestsWhileZooming=o.cancelPendingTileRequestsWhileZooming===!0,this._imageQueueHandle=G.addThrottleControl(()=>this.isMoving()),this._requestManager=new Q(o.transformRequest),typeof o.container=="string"){if(this._container=document.getElementById(o.container),!this._container)throw new Error(`Container '${o.container}' not found.`)}else{if(!(o.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=o.container}if(o.maxBounds&&this.setMaxBounds(o.maxBounds),this._setupContainer(),this._setupPainter(),this.on("move",()=>this._update(!1)).on("moveend",()=>this._update(!1)).on("zoom",()=>this._update(!0)).on("terrain",()=>{this.painter.terrainFacilitator.dirty=!0,this._update(!0)}).once("idle",()=>{this._idleTriggered=!0}),typeof window<"u"){addEventListener("online",this._onWindowOnline,!1);let d=!1;const m=Zl(y=>{this._trackResize&&!this._removed&&(this.resize(y),this.redraw())},50);this._resizeObserver=new ResizeObserver(y=>{d?m(y):d=!0}),this._resizeObserver.observe(this._container)}this.handlers=new Dd(this,o),this._hash=o.hash&&new bu(typeof o.hash=="string"&&o.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:o.center,zoom:o.zoom,bearing:o.bearing,pitch:o.pitch}),o.bounds&&(this.resize(),this.fitBounds(o.bounds,l.e({},o.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=o.localIdeographFontFamily,this._validateStyle=o.validateStyle,o.style&&this.setStyle(o.style,{localIdeographFontFamily:o.localIdeographFontFamily}),o.attributionControl&&this.addControl(new Za(typeof o.attributionControl=="boolean"?void 0:o.attributionControl)),o.maplibreLogo&&this.addControl(new Od,o.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)}),this.on("data",d=>{this._update(d.dataType==="style"),this.fire(new l.k(`${d.dataType}data`,d))}),this.on("dataloading",d=>{this.fire(new l.k(`${d.dataType}dataloading`,d))}),this.on("dataabort",d=>{this.fire(new l.k("sourcedataabort",d))})}_getMapId(){return this._mapId}addControl(v,o){if(o===void 0&&(o=v.getDefaultPosition?v.getDefaultPosition():"top-right"),!v||!v.onAdd)return this.fire(new l.j(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const d=v.onAdd(this);this._controls.push(v);const m=this._controlPositions[o];return o.indexOf("bottom")!==-1?m.insertBefore(d,m.firstChild):m.appendChild(d),this}removeControl(v){if(!v||!v.onRemove)return this.fire(new l.j(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const o=this._controls.indexOf(v);return o>-1&&this._controls.splice(o,1),v.onRemove(this),this}hasControl(v){return this._controls.indexOf(v)>-1}calculateCameraOptionsFromTo(v,o,d,m){return m==null&&this.terrain&&(m=this.terrain.getElevationForLngLatZoom(d,this.transform.tileZoom)),super.calculateCameraOptionsFromTo(v,o,d,m)}resize(v){var o;const d=this._containerDimensions(),m=d[0],y=d[1],x=this._getClampedPixelRatio(m,y);if(this._resizeCanvas(m,y,x),this.painter.resize(m,y,x),this.painter.overLimit()){const I=this.painter.context.gl;this._maxCanvasSize=[I.drawingBufferWidth,I.drawingBufferHeight];const O=this._getClampedPixelRatio(m,y);this._resizeCanvas(m,y,O),this.painter.resize(m,y,O)}this.transform.resize(m,y),(o=this._requestedCameraState)===null||o===void 0||o.resize(m,y);const M=!this._moving;return M&&(this.stop(),this.fire(new l.k("movestart",v)).fire(new l.k("move",v))),this.fire(new l.k("resize",v)),M&&this.fire(new l.k("moveend",v)),this}_getClampedPixelRatio(v,o){const{0:d,1:m}=this._maxCanvasSize,y=this.getPixelRatio(),x=v*y,M=o*y;return Math.min(x>d?d/x:1,M>m?m/M:1)*y}getPixelRatio(){var v;return(v=this._overridePixelRatio)!==null&&v!==void 0?v:devicePixelRatio}setPixelRatio(v){this._overridePixelRatio=v,this.resize()}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(v){return this.transform.setMaxBounds(we.convert(v)),this._update()}setMinZoom(v){if((v=v??-2)>=-2&&v<=this.transform.maxZoom)return this.transform.minZoom=v,this._update(),this.getZoom()<v&&this.setZoom(v),this;throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(v){if((v=v??22)>=this.transform.minZoom)return this.transform.maxZoom=v,this._update(),this.getZoom()>v&&this.setZoom(v),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(v){if((v=v??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(v>=0&&v<=this.transform.maxPitch)return this.transform.minPitch=v,this._update(),this.getPitch()<v&&this.setPitch(v),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(v){if((v=v??60)>85)throw new Error("maxPitch must be less than or equal to 85");if(v>=this.transform.minPitch)return this.transform.maxPitch=v,this._update(),this.getPitch()>v&&this.setPitch(v),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(v){return this.transform.renderWorldCopies=v,this._update()}project(v){return this.transform.locationPoint(l.N.convert(v),this.style&&this.terrain)}unproject(v){return this.transform.pointLocation(l.P.convert(v),this.terrain)}isMoving(){var v;return this._moving||((v=this.handlers)===null||v===void 0?void 0:v.isMoving())}isZooming(){var v;return this._zooming||((v=this.handlers)===null||v===void 0?void 0:v.isZooming())}isRotating(){var v;return this._rotating||((v=this.handlers)===null||v===void 0?void 0:v.isRotating())}_createDelegatedListener(v,o,d){if(v==="mouseenter"||v==="mouseover"){let m=!1;return{layers:o,listener:d,delegates:{mousemove:x=>{const M=o.filter(O=>this.getLayer(O)),I=M.length!==0?this.queryRenderedFeatures(x.point,{layers:M}):[];I.length?m||(m=!0,d.call(this,new Di(v,this,x.originalEvent,{features:I}))):m=!1},mouseout:()=>{m=!1}}}}if(v==="mouseleave"||v==="mouseout"){let m=!1;return{layers:o,listener:d,delegates:{mousemove:M=>{const I=o.filter(O=>this.getLayer(O));(I.length!==0?this.queryRenderedFeatures(M.point,{layers:I}):[]).length?m=!0:m&&(m=!1,d.call(this,new Di(v,this,M.originalEvent)))},mouseout:M=>{m&&(m=!1,d.call(this,new Di(v,this,M.originalEvent)))}}}}{const m=y=>{const x=o.filter(I=>this.getLayer(I)),M=x.length!==0?this.queryRenderedFeatures(y.point,{layers:x}):[];M.length&&(y.features=M,d.call(this,y),delete y.features)};return{layers:o,listener:d,delegates:{[v]:m}}}}_saveDelegatedListener(v,o){this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[v]=this._delegatedListeners[v]||[],this._delegatedListeners[v].push(o)}_removeDelegatedListener(v,o,d){if(!this._delegatedListeners||!this._delegatedListeners[v])return;const m=this._delegatedListeners[v];for(let y=0;y<m.length;y++){const x=m[y];if(x.listener===d&&x.layers.length===o.length&&x.layers.every(M=>o.includes(M))){for(const M in x.delegates)this.off(M,x.delegates[M]);return void m.splice(y,1)}}}on(v,o,d){if(d===void 0)return super.on(v,o);const m=this._createDelegatedListener(v,typeof o=="string"?[o]:o,d);this._saveDelegatedListener(v,m);for(const y in m.delegates)this.on(y,m.delegates[y]);return this}once(v,o,d){if(d===void 0)return super.once(v,o);const m=typeof o=="string"?[o]:o,y=this._createDelegatedListener(v,m,d);for(const x in y.delegates){const M=y.delegates[x];y.delegates[x]=(...I)=>{this._removeDelegatedListener(v,m,d),M(...I)}}this._saveDelegatedListener(v,y);for(const x in y.delegates)this.once(x,y.delegates[x]);return this}off(v,o,d){return d===void 0?super.off(v,o):(this._removeDelegatedListener(v,typeof o=="string"?[o]:o,d),this)}queryRenderedFeatures(v,o){if(!this.style)return[];let d;const m=v instanceof l.P||Array.isArray(v),y=m?v:[[0,0],[this.transform.width,this.transform.height]];if(o=o||(m?{}:v)||{},y instanceof l.P||typeof y[0]=="number")d=[l.P.convert(y)];else{const x=l.P.convert(y[0]),M=l.P.convert(y[1]);d=[x,new l.P(M.x,x.y),M,new l.P(x.x,M.y),x]}return this.style.queryRenderedFeatures(d,o,this.transform)}querySourceFeatures(v,o){return this.style.querySourceFeatures(v,o)}setStyle(v,o){return(o=l.e({},{localIdeographFontFamily:this._localIdeographFontFamily,validate:this._validateStyle},o)).diff!==!1&&o.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&v?(this._diffStyle(v,o),this):(this._localIdeographFontFamily=o.localIdeographFontFamily,this._updateStyle(v,o))}setTransformRequest(v){return this._requestManager.setTransformRequest(v),this}_getUIString(v){const o=this._locale[v];if(o==null)throw new Error(`Missing UI string '${v}'`);return o}_updateStyle(v,o){if(o.transformStyle&&this.style&&!this.style._loaded)return void this.style.once("style.load",()=>this._updateStyle(v,o));const d=this.style&&o.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!v)),v?(this.style=new nu(this,o||{}),this.style.setEventedParent(this,{style:this.style}),typeof v=="string"?this.style.loadURL(v,o,d):this.style.loadJSON(v,o,d),this):(delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new nu(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(v,o){if(typeof v=="string"){const d=this._requestManager.transformRequest(v,"Style");l.h(d,new AbortController).then(m=>{this._updateDiff(m.data,o)}).catch(m=>{m&&this.fire(new l.j(m))})}else typeof v=="object"&&this._updateDiff(v,o)}_updateDiff(v,o){try{this.style.setState(v,o)&&this._update(!0)}catch(d){l.w(`Unable to perform style diff: ${d.message||d.error||d}. Rebuilding the style from scratch.`),this._updateStyle(v,o)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():l.w("There is no style added to the map.")}addSource(v,o){return this._lazyInitEmptyStyle(),this.style.addSource(v,o),this._update(!0)}isSourceLoaded(v){const o=this.style&&this.style.sourceCaches[v];if(o!==void 0)return o.loaded();this.fire(new l.j(new Error(`There is no source with ID '${v}'`)))}setTerrain(v){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),v){const o=this.style.sourceCaches[v.source];if(!o)throw new Error(`cannot load terrain, because there exists no source with ID: ${v.source}`);this.terrain===null&&o.reload();for(const d in this.style._layers){const m=this.style._layers[d];m.type==="hillshade"&&m.source===v.source&&l.w("You are using the same source for a hillshade layer and for 3D terrain. Please consider using two separate sources to improve rendering quality.")}this.terrain=new zd(this.painter,o,v),this.painter.renderToTexture=new Mm(this.painter,this.terrain),this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this._terrainDataCallback=d=>{d.dataType==="style"?this.terrain.sourceCache.freeRtt():d.dataType==="source"&&d.tile&&(d.sourceId!==v.source||this._elevationFreeze||(this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this.terrain.sourceCache.freeRtt(d.tile.tileID))},this.style.on("data",this._terrainDataCallback)}else this.terrain&&this.terrain.sourceCache.destruct(),this.terrain=null,this.painter.renderToTexture&&this.painter.renderToTexture.destruct(),this.painter.renderToTexture=null,this.transform.minElevationForCurrentTile=0,this.transform.elevation=0;return this.fire(new l.k("terrain",{terrain:v})),this}getTerrain(){var v,o;return(o=(v=this.terrain)===null||v===void 0?void 0:v.options)!==null&&o!==void 0?o:null}areTilesLoaded(){const v=this.style&&this.style.sourceCaches;for(const o in v){const d=v[o]._tiles;for(const m in d){const y=d[m];if(y.state!=="loaded"&&y.state!=="errored")return!1}}return!0}removeSource(v){return this.style.removeSource(v),this._update(!0)}getSource(v){return this.style.getSource(v)}addImage(v,o,d={}){const{pixelRatio:m=1,sdf:y=!1,stretchX:x,stretchY:M,content:I,textFitWidth:O,textFitHeight:N}=d;if(this._lazyInitEmptyStyle(),!(o instanceof HTMLImageElement||l.b(o))){if(o.width===void 0||o.height===void 0)return this.fire(new l.j(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));{const{width:V,height:F,data:Z}=o,J=o;return this.style.addImage(v,{data:new l.R({width:V,height:F},new Uint8Array(Z)),pixelRatio:m,stretchX:x,stretchY:M,content:I,textFitWidth:O,textFitHeight:N,sdf:y,version:0,userImage:J}),J.onAdd&&J.onAdd(this,v),this}}{const{width:V,height:F,data:Z}=E.getImageData(o);this.style.addImage(v,{data:new l.R({width:V,height:F},Z),pixelRatio:m,stretchX:x,stretchY:M,content:I,textFitWidth:O,textFitHeight:N,sdf:y,version:0})}}updateImage(v,o){const d=this.style.getImage(v);if(!d)return this.fire(new l.j(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const m=o instanceof HTMLImageElement||l.b(o)?E.getImageData(o):o,{width:y,height:x,data:M}=m;if(y===void 0||x===void 0)return this.fire(new l.j(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(y!==d.data.width||x!==d.data.height)return this.fire(new l.j(new Error("The width and height of the updated image must be that same as the previous version of the image")));const I=!(o instanceof HTMLImageElement||l.b(o));return d.data.replace(M,I),this.style.updateImage(v,d),this}getImage(v){return this.style.getImage(v)}hasImage(v){return v?!!this.style.getImage(v):(this.fire(new l.j(new Error("Missing required image id"))),!1)}removeImage(v){this.style.removeImage(v)}loadImage(v){return G.getImage(this._requestManager.transformRequest(v,"Image"),new AbortController)}listImages(){return this.style.listImages()}addLayer(v,o){return this._lazyInitEmptyStyle(),this.style.addLayer(v,o),this._update(!0)}moveLayer(v,o){return this.style.moveLayer(v,o),this._update(!0)}removeLayer(v){return this.style.removeLayer(v),this._update(!0)}getLayer(v){return this.style.getLayer(v)}getLayersOrder(){return this.style.getLayersOrder()}setLayerZoomRange(v,o,d){return this.style.setLayerZoomRange(v,o,d),this._update(!0)}setFilter(v,o,d={}){return this.style.setFilter(v,o,d),this._update(!0)}getFilter(v){return this.style.getFilter(v)}setPaintProperty(v,o,d,m={}){return this.style.setPaintProperty(v,o,d,m),this._update(!0)}getPaintProperty(v,o){return this.style.getPaintProperty(v,o)}setLayoutProperty(v,o,d,m={}){return this.style.setLayoutProperty(v,o,d,m),this._update(!0)}getLayoutProperty(v,o){return this.style.getLayoutProperty(v,o)}setGlyphs(v,o={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(v,o),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(v,o,d={}){return this._lazyInitEmptyStyle(),this.style.addSprite(v,o,d,m=>{m||this._update(!0)}),this}removeSprite(v){return this._lazyInitEmptyStyle(),this.style.removeSprite(v),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(v,o={}){return this._lazyInitEmptyStyle(),this.style.setSprite(v,o,d=>{d||this._update(!0)}),this}setLight(v,o={}){return this._lazyInitEmptyStyle(),this.style.setLight(v,o),this._update(!0)}getLight(){return this.style.getLight()}setSky(v){return this._lazyInitEmptyStyle(),this.style.setSky(v),this._update(!0)}getSky(){return this.style.getSky()}setFeatureState(v,o){return this.style.setFeatureState(v,o),this._update()}removeFeatureState(v,o){return this.style.removeFeatureState(v,o),this._update()}getFeatureState(v){return this.style.getFeatureState(v)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let v=0,o=0;return this._container&&(v=this._container.clientWidth||400,o=this._container.clientHeight||300),[v,o]}_setupContainer(){const v=this._container;v.classList.add("maplibregl-map");const o=this._canvasContainer=C.create("div","maplibregl-canvas-container",v);this._interactive&&o.classList.add("maplibregl-interactive"),this._canvas=C.create("canvas","maplibregl-canvas",o),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex",this._interactive?"0":"-1"),this._canvas.setAttribute("aria-label",this._getUIString("Map.Title")),this._canvas.setAttribute("role","region");const d=this._containerDimensions(),m=this._getClampedPixelRatio(d[0],d[1]);this._resizeCanvas(d[0],d[1],m);const y=this._controlContainer=C.create("div","maplibregl-control-container",v),x=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(M=>{x[M]=C.create("div",`maplibregl-ctrl-${M} `,y)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(v,o,d){this._canvas.width=Math.floor(d*v),this._canvas.height=Math.floor(d*o),this._canvas.style.width=`${v}px`,this._canvas.style.height=`${o}px`}_setupPainter(){const v={alpha:!0,stencil:!0,depth:!0,failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1};let o=null;this._canvas.addEventListener("webglcontextcreationerror",m=>{o={requestedAttributes:v},m&&(o.statusMessage=m.statusMessage,o.type=m.type)},{once:!0});const d=this._canvas.getContext("webgl2",v)||this._canvas.getContext("webgl",v);if(!d){const m="Failed to initialize WebGL";throw o?(o.message=m,new Error(JSON.stringify(o))):new Error(m)}this.painter=new _u(d,this.transform),P.testSupport(d)}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(v){return this.style&&this.style._loaded?(this._styleDirty=this._styleDirty||v,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(v){return this._update(),this._renderTaskQueue.add(v)}_cancelRenderFrame(v){this._renderTaskQueue.remove(v)}_render(v){const o=this._idleTriggered?this._fadeDuration:0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(v),this._removed)return;let d=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const y=this.transform.zoom,x=E.now();this.style.zoomHistory.update(y,x);const M=new l.z(y,{now:x,fadeDuration:o,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),I=M.crossFadingFactor();I===1&&I===this._crossFadingFactor||(d=!0,this._crossFadingFactor=I),this.style.update(M)}this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain?(this.terrain.sourceCache.update(this.transform,this.terrain),this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this._elevationFreeze||(this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))):(this.transform.minElevationForCurrentTile=0,this.transform.elevation=0),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,o,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:o,showPadding:this.showPadding}),this.fire(new l.k("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,l.bf.mark(l.bg.load),this.fire(new l.k("load"))),this.style&&(this.style.hasTransitions()||d)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();const m=this._sourcesDirty||this._styleDirty||this._placementDirty;return m||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new l.k("idle")),!this._loaded||this._fullyLoaded||m||(this._fullyLoaded=!0,l.bf.mark(l.bg.fullLoad)),this}redraw(){return this.style&&(this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._render(0)),this}remove(){var v;this._hash&&this._hash.remove();for(const d of this._controls)d.onRemove(this);this._controls=[],this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._renderTaskQueue.clear(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),typeof window<"u"&&removeEventListener("online",this._onWindowOnline,!1),G.removeThrottleControl(this._imageQueueHandle),(v=this._resizeObserver)===null||v===void 0||v.disconnect();const o=this.painter.context.gl.getExtension("WEBGL_lose_context");o!=null&&o.loseContext&&o.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),C.remove(this._canvasContainer),C.remove(this._controlContainer),this._container.classList.remove("maplibregl-map"),l.bf.clearMetrics(),this._removed=!0,this.fire(new l.k("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,E.frameAsync(this._frameRequest).then(v=>{l.bf.frame(v),this._frameRequest=null,this._render(v)}).catch(()=>{}))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(v){this._showTileBoundaries!==v&&(this._showTileBoundaries=v,this._update())}get showPadding(){return!!this._showPadding}set showPadding(v){this._showPadding!==v&&(this._showPadding=v,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(v){this._showCollisionBoxes!==v&&(this._showCollisionBoxes=v,v?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(v){this._showOverdrawInspector!==v&&(this._showOverdrawInspector=v,this._update())}get repaint(){return!!this._repaint}set repaint(v){this._repaint!==v&&(this._repaint=v,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(v){this._vertices=v,this._update()}get version(){return Am}getCameraTargetElevation(){return this.transform.elevation}},u.MapMouseEvent=Di,u.MapTouchEvent=Ys,u.MapWheelEvent=wm,u.Marker=Au,u.NavigationControl=class{constructor(v){this._updateZoomButtons=()=>{const o=this._map.getZoom(),d=o===this._map.getMaxZoom(),m=o===this._map.getMinZoom();this._zoomInButton.disabled=d,this._zoomOutButton.disabled=m,this._zoomInButton.setAttribute("aria-disabled",d.toString()),this._zoomOutButton.setAttribute("aria-disabled",m.toString())},this._rotateCompassArrow=()=>{const o=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(this._map.transform.pitch*(Math.PI/180)),.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${this._map.transform.angle*(180/Math.PI)}deg)`:`rotate(${this._map.transform.angle*(180/Math.PI)}deg)`;this._compassIcon.style.transform=o},this._setButtonTitle=(o,d)=>{const m=this._map._getUIString(`NavigationControl.${d}`);o.title=m,o.setAttribute("aria-label",m)},this.options=l.e({},M_,v),this._container=C.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",o=>o.preventDefault()),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",o=>this._map.zoomIn({},{originalEvent:o})),C.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",o=>this._map.zoomOut({},{originalEvent:o})),C.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",o=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:o}):this._map.resetNorth({},{originalEvent:o})}),this._compassIcon=C.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}onAdd(v){return this._map=v,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),this._map.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&this._map.on("pitch",this._rotateCompassArrow),this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new A_(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){C.remove(this._container),this.options.showZoom&&this._map.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&this._map.off("pitch",this._rotateCompassArrow),this._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(v,o){const d=C.create("button",v,this._container);return d.type="button",d.addEventListener("click",o),d}},u.Popup=class extends l.E{constructor(v){super(),this.remove=()=>(this._content&&C.remove(this._content),this._container&&(C.remove(this._container),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("mousemove",this._onMouseMove),this._map.off("mouseup",this._onMouseUp),this._map.off("drag",this._onDrag),this._map._canvasContainer.classList.remove("maplibregl-track-pointer"),delete this._map,this.fire(new l.k("close"))),this),this._onMouseUp=o=>{this._update(o.point)},this._onMouseMove=o=>{this._update(o.point)},this._onDrag=o=>{this._update(o.point)},this._update=o=>{var d;if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(!this._container){if(this._container=C.create("div","maplibregl-popup",this._map.getContainer()),this._tip=C.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(const I of this.options.className.split(" "))this._container.classList.add(I);this._closeButton&&this._closeButton.setAttribute("aria-label",this._map._getUIString("Popup.Close")),this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer")}if(this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._lngLat=this._map.transform.renderWorldCopies&&!this._trackPointer?Vn(this._lngLat,this._flatPos,this._map.transform):(d=this._lngLat)===null||d===void 0?void 0:d.wrap(),this._trackPointer&&!o)return;const m=this._flatPos=this._pos=this._trackPointer&&o?o:this._map.project(this._lngLat);this._map.terrain&&(this._flatPos=this._trackPointer&&o?o:this._map.transform.locationPoint(this._lngLat));let y=this.options.anchor;const x=Pu(this.options.offset);if(!y){const I=this._container.offsetWidth,O=this._container.offsetHeight;let N;N=m.y+x.bottom.y<O?["top"]:m.y>this._map.transform.height-O?["bottom"]:[],m.x<I/2?N.push("left"):m.x>this._map.transform.width-I/2&&N.push("right"),y=N.length===0?"bottom":N.join("-")}let M=m.add(x[y]);this.options.subpixelPositioning||(M=M.round()),C.setTransform(this._container,`${Xa[y]} translate(${M.x}px,${M.y}px)`),Mu(this._container,y,"popup")},this._onClose=()=>{this.remove()},this.options=l.e(Object.create(Et),v)}addTo(v){return this._map&&this.remove(),this._map=v,this.options.closeOnClick&&this._map.on("click",this._onClose),this.options.closeOnMove&&this._map.on("move",this._onClose),this._map.on("remove",this.remove),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._onMouseMove),this._map.on("mouseup",this._onMouseUp),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")):this._map.on("move",this._update),this.fire(new l.k("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(v){return this._lngLat=l.N.convert(v),this._pos=null,this._flatPos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._onMouseMove),this._container&&this._container.classList.remove("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.remove("maplibregl-track-pointer")),this}trackPointer(){return this._trackPointer=!0,this._pos=null,this._flatPos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._onMouseMove),this._map.on("drag",this._onDrag),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")),this}getElement(){return this._container}setText(v){return this.setDOMContent(document.createTextNode(v))}setHTML(v){const o=document.createDocumentFragment(),d=document.createElement("body");let m;for(d.innerHTML=v;m=d.firstChild,m;)o.appendChild(m);return this.setDOMContent(o)}getMaxWidth(){var v;return(v=this._container)===null||v===void 0?void 0:v.style.maxWidth}setMaxWidth(v){return this.options.maxWidth=v,this._update(),this}setDOMContent(v){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=C.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(v),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(v){return this._container&&this._container.classList.add(v),this}removeClassName(v){return this._container&&this._container.classList.remove(v),this}setOffset(v){return this.options.offset=v,this._update(),this}toggleClassName(v){if(this._container)return this._container.classList.toggle(v)}setSubpixelPositioning(v){this.options.subpixelPositioning=v}_createCloseButton(){this.options.closeButton&&(this._closeButton=C.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.innerHTML="&#215;",this._closeButton.addEventListener("click",this._onClose))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const v=this._container.querySelector(Iu);v&&v.focus()}},u.RasterDEMTileSource=sn,u.RasterTileSource=qt,u.ScaleControl=class{constructor(v){this._onMove=()=>{tc(this._map,this._container,this.options)},this.setUnit=o=>{this.options.unit=o,tc(this._map,this._container,this.options)},this.options=Object.assign(Object.assign({},Io),v)}getDefaultPosition(){return"bottom-left"}onAdd(v){return this._map=v,this._container=C.create("div","maplibregl-ctrl maplibregl-ctrl-scale",v.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){C.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}},u.ScrollZoomHandler=no,u.Style=nu,u.TerrainControl=class{constructor(v){this._toggleTerrain=()=>{this._map.getTerrain()?this._map.setTerrain(null):this._map.setTerrain(this.options),this._updateTerrainIcon()},this._updateTerrainIcon=()=>{this._terrainButton.classList.remove("maplibregl-ctrl-terrain"),this._terrainButton.classList.remove("maplibregl-ctrl-terrain-enabled"),this._map.terrain?(this._terrainButton.classList.add("maplibregl-ctrl-terrain-enabled"),this._terrainButton.title=this._map._getUIString("TerrainControl.Disable")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.Enable"))},this.options=v}onAdd(v){return this._map=v,this._container=C.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=C.create("button","maplibregl-ctrl-terrain",this._container),C.create("span","maplibregl-ctrl-icon",this._terrainButton).setAttribute("aria-hidden","true"),this._terrainButton.type="button",this._terrainButton.addEventListener("click",this._toggleTerrain),this._updateTerrainIcon(),this._map.on("terrain",this._updateTerrainIcon),this._container}onRemove(){C.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},u.TwoFingersTouchPitchHandler=qa,u.TwoFingersTouchRotateHandler=Ad,u.TwoFingersTouchZoomHandler=Td,u.TwoFingersTouchZoomRotateHandler=Pd,u.VectorTileSource=pr,u.VideoSource=Or,u.addSourceType=(v,o)=>l._(void 0,void 0,void 0,function*(){if(Co(v))throw new Error(`A source type called "${v}" already exists.`);((d,m)=>{Eo[d]=m})(v,o)}),u.clearPrewarmedResources=function(){const v=Ce;v&&(v.isPreloaded()&&v.numActive()===1?(v.release(Nn),Ce=null):console.warn("Could not clear WebWorkers since there are active Map instances that still reference it. The pre-warmed WebWorker pool can only be cleared when all map instances have been removed with map.remove()"))},u.getMaxParallelImageRequests=function(){return l.a.MAX_PARALLEL_IMAGE_REQUESTS},u.getRTLTextPluginStatus=function(){return zr().getRTLTextPluginStatus()},u.getVersion=function(){return Ld},u.getWorkerCount=function(){return Pn.workerCount},u.getWorkerUrl=function(){return l.a.WORKER_URL},u.importScriptInWorkers=function(v){return Rt().broadcast("IS",v)},u.prewarm=function(){De().acquire(Nn)},u.setMaxParallelImageRequests=function(v){l.a.MAX_PARALLEL_IMAGE_REQUESTS=v},u.setRTLTextPlugin=function(v,o){return zr().setRTLTextPlugin(v,o)},u.setWorkerCount=function(v){Pn.workerCount=v},u.setWorkerUrl=function(v){l.a.WORKER_URL=v}});var a=n;return a})})(Y1);var DB=Y1.exports;const OB=IB(DB),Fp=["#FF6633","#FFB399","#FF33FF","#00B3E6","#E6B333","#3366E6","#999966","#99FF99","#B34D4D","#80B300","#809900","#E6B3B3","#6680B3","#66991A","#FF99E6","#CCFF1A","#FF1A66","#E6331A","#33FFCC","#66994D","#B366CC","#4D8000","#B33300","#CC80CC","#66664D","#991AFF","#E666FF","#4DB3FF","#1AB399","#E666B3","#33991A","#CC9999","#B3B31A","#00E680","#4D8066","#809980","#E6FF80","#1AFF33","#999933","#FF3380","#CCCC00","#66E64D","#4D80CC","#9900B3","#E64D66","#4DB380","#FF4D4D","#99E6E6","#6666FF","#FFFF99"],Cr={};async function $p(t="pin4-sm-mi-plumber+f45942.png",e=null){try{const i=t!=null&&t.includes("/")?t:`/api-user/marker_icon/${t}`,r=await e.loadImage(i);if(e.hasImage(t))return;e==null||e.addImage(t,r.data,{sdf:t==null?void 0:t.includes("+sdf")})}catch(n){console.error(n)}}function BB(t){if(!(t!=null&&t.startsWith("rgba")))return t;const e=t.replace(/^rgba?\(|\s+|\)$/g,"").split(",");return`${((1<<24)+(parseInt(e[0],10)<<16)+(parseInt(e[1],10)<<8)+parseInt(e[2],10)).toString(16).slice(1)}`}Cr.point=async(t={},e={},n=null)=>{var E,C,P,D,R,$,W,te,G,Q,Ie,ve;e||(e={}),((E=e==null?void 0:e.width)==null?void 0:E[0])==="["&&(e.width={stops:JSON.parse(e.width)}),typeof(e==null?void 0:e.width)=="string"&&(e.width-=0),typeof(e==null?void 0:e.opacity)=="string"&&(e.opacity=(e.opacity-0)*100);const i=((C=t.style)==null?void 0:C.colorAttr)||((P=t.style)==null?void 0:P.iconCls);let r={circle:"none-xl-{{marker}}+222.png",circle2:"circle-xl-{{marker}}+222.png",pin2:"pin2-xl-{{marker}}+sdf.png",pin:"pin-xl-{{marker}}+sdf.png"}[e.iconType]||(e==null?void 0:e.icon);const[a,u]=(r==null?void 0:r.split("-"))||[],l=((D=t.style)==null?void 0:D.color)||"blue";!((R=t.style)!=null&&R.iconAttr)&&(r!=null&&r.includes("{{marker}}"))&&(r=r.replace("{{marker}}","fa-star"));const g="gray",b=(Se,Ne)=>`${Se==null?void 0:Se.split("+")[0]}+${Ne.replace("#","")}.png`;if(t.legendAuto={icon:[],color:[]},($=t.style)!=null&&$.iconAttr&&r){const Se=(te=(W=t.meta)==null?void 0:W.columns)==null?void 0:te.find(Ae=>{var $e;return Ae.name===(($e=t==null?void 0:t.style)==null?void 0:$e.iconAttr)}),Ne=(Se==null?void 0:Se.values)||await it.get(`/api-user/gis-ir/${t.id}/${(G=t.style)==null?void 0:G.iconAttr}`).then(Ae=>Ae.data.rows);if(Ne!=null&&Ne.length){const Ae=r.replace("{{color}}",l.length?l:BB(l)||[0]).split("+")[1].split(/[.-]/)[0];Ne.forEach(($e,Xe)=>{var Pt;return $e.icon=(Pt=$e.icon)!=null&&Pt.includes("png")?$e.icon:`${a}-${u}-${$e.data||$e.icon||`ub-${Xe}`}+${r!=null&&r.includes("circle")?"ddd-222":Ae}.png`}),r=r!=null&&r.includes("{{")?`${a}-${u}-fa-question+0c53ad.png`:r,t.legendAuto.iconText=(Se==null?void 0:Se.title)||t.style.iconAttr,Ne.forEach($e=>t.legendAuto.icon.push($e)),t.legendAuto.icon.push({icon:r,text:"Не визначено"}),t.style.iconArr=["match",["get",t.style.iconAttr]].concat(Ne.filter($e=>$e.id).reduce(($e,Xe)=>$e.concat([Xe.id,Xe.icon]),[])).concat([r]),await Promise.all(Ne.map($e=>$e.icon).map($e=>$p($e,n))),await $p(r,n)}else r=i?"pin6-m-fa-star+{{color}}.png":`pin6-m-fa-star+${l==null?void 0:l.replace("#","")}.png`}if(r!=null&&r.includes("{{color}}")?r=r.replace("{{color}}","222"):e!=null&&e.icon&&e.iconAttr,i){const Se=(Ie=(Q=t.meta)==null?void 0:Q.columns)==null?void 0:Ie.find(Ae=>Ae.name===i),Ne=(Se==null?void 0:Se.values)||await it.get(`/api-user/gis-ir/${t.id}/${i}`).then(Ae=>Ae.data.rows);t.style.color=Ne!=null&&Ne.length?["match",["get",i]].concat(Ne.filter(Ae=>Ae.id).reduce((Ae,$e,Xe)=>Ae.concat([$e.id,$e.color||Fp[Xe]]),[])).concat(["#aaa"]):l,t.style.colorArr=t.style.color,t.legendAuto.colorText=(Se==null?void 0:Se.title)||i,Ne.forEach(Ae=>t.legendAuto.color.push(Ae)),t.legendAuto.color.push({color:"#aaa",text:"Не визначено"}),!((ve=t.style)!=null&&ve.iconAttr)&&!(r!=null&&r.includes("+sdf"))&&r&&(Ne.forEach((Ae,$e)=>Ae.icon=b(r,Ae.color||Fp[$e])),t.style.iconArr=["match",["get",i]].concat(Ne.filter(Ae=>Ae.id).reduce((Ae,$e)=>Ae.concat([$e.id,$e.icon]),[])).concat([b(r,g)]),await Promise.all(Ne.map(Ae=>Ae.icon).map(Ae=>$p(Ae,n))))}if(r&&!(r!=null&&r.includes("{"))){const Se=e!=null&&e.colorAttr?b(r,g):r;await $p(Se,n)}const w=r!=null&&r.includes("sdf")?["interpolate",["linear"],["zoom"],14,.1,18,.2]:["interpolate",["linear"],["zoom"],14,.7,16,1];return e.iconOffset=r!=null&&r.includes("pin")?[0,r!=null&&r.includes("+sdf")?-96:-20]:null,[{id:`${t.id}`,source:t.id,type:"circle",cluster:!0,lsource:e==null?void 0:e.lsource,minzoom:(e==null?void 0:e.minzoom)!==void 0?+(e==null?void 0:e.minzoom):4,maxzoom:(r!=null&&r.includes("+sdf")||!(r!=null&&r.includes("circle"))&&!(r!=null&&r.includes("none"))?+e.iconZoom:null)||+(e==null?void 0:e.maxzoom)||24,filter:["all",["==",["geometry-type"],"Point"],["!",["has","point_count"]]],paint:{"circle-stroke-width":["case",["boolean",["feature-state","select"],!1],(e==null?void 0:e.strokeWidth)||1,["boolean",["feature-state","hover"],!1],2,(e==null?void 0:e.strokeWidth)||1],"circle-stroke-color":["case",["boolean",["feature-state","select"],!1],(e==null?void 0:e.stroke)||(e==null?void 0:e.color)||"#fff",["boolean",["feature-state","hover"],!1],"maroon",(e==null?void 0:e.stroke)||(e==null?void 0:e.color)||"#fff"],"circle-opacity":(e.iconZoom?["interpolate",["exponential",.5],["zoom"],+e.iconZoom-1,1,+e.iconZoom,r!=null&&r.includes("none")?.3:0]:null)||e.opacity||1,"circle-color":e.color||["case",["boolean",["feature-state","hover"],!1],"red","blue"],"circle-radius":(Array.isArray(e.width)?{stops:e.width}:null)||e.width||{stops:e.iconZoom?[[+e.iconZoom,4],[+e.iconZoom,8],[18,16]]:[[13,4],[15,8],[18,12]]}}}].concat(e.iconArr||e.icon?[{id:`${t.id}-5`,source:t.id,lsource:e==null?void 0:e.lsource,type:"symbol",minzoom:+e.iconZoom||16,filter:["all",["!",["has","point_count"]]],layout:{"icon-image":e!=null&&e.colorAttr&&e.iconArr||r,"icon-allow-overlap":!0,...e.iconOffset?{"icon-offset":e.iconOffset||!1}:{},...w?{"icon-size":w||!1}:{}},paint:{"icon-opacity":["case",["boolean",["feature-state","hover"],!1],.5,["boolean",["feature-state","select"],!1],.5,(r!=null&&r.includes("+sdf")?1:null)||(r!=null&&r.includes("circle")?.6:1)],...r!=null&&r.includes("+sdf")?{"icon-color":["case",["boolean",["feature-state","hover"],!1],"#cd0bbf",["boolean",["feature-state","select"],!1],"#8517cf",e.color||"#aa0000"]}:{}}}]:[]).concat(e.label?[{id:`${t.id}-4`,source:t.id,lsource:e==null?void 0:e.lsource,type:"symbol",minzoom:14,filter:["!",["has","point_count"]],layout:{"text-field":e.label,"text-font":["Open Sans Regular"],"text-size":e["text-size"]||8},paint:{"text-color":e["text-color"]||"#ffffff","text-halo-color":e["text-halo-color"]||"black"}}]:[]).concat(t.cluster||e.clusterMaxZoom?[{id:`${t.id}-1`,source:t.id,lsource:e==null?void 0:e.lsource,type:"circle",filter:["has","point_count"],paint:{"circle-color":["step",["get","point_count"],"#51bbd6",100,"#f1f075",750,"#f28cb1"],"circle-radius":["step",["get","point_count"],20,100,30,750,40]}},{id:`${t.id}-2`,source:t.id,lsource:e==null?void 0:e.lsource,type:"symbol",filter:["has","point_count"],layout:{"text-field":"{point_count_abbreviated}","text-font":["Open Sans Regular"],"text-size":12}}]:[])},Cr.label=(t={})=>[{id:t.id,source:t.id,type:"line",layout:{"text-field":"{str_name}","text-font":["DIN Offc Pro Italic","Arial Unicode MS Regular"],"symbol-placement":"line","text-pitch-alignment":"viewport","text-max-angle":30,"text-size":{base:1,stops:[[13,12],[18,16]]}},paint:{"text-halo-width":0,"text-halo-blur":0,"text-color":"#78888a"}}],Cr.polygon=async(t={},e={},n=null)=>{var a,u,l,g;const{colorAttr:i}=e,r=((a=t.style)==null?void 0:a.color)||"blue";if(e.colorAttr){n.getSource(t.id)&&n.getSource(n.getSource(t.id).setData(`${n.getSource(t.id)._data.split("&props")[0]}&props=${i}`));const b=((l=(u=t.meta)==null?void 0:u.columns.find(w=>w.name===i))==null?void 0:l.values)||await it.get(`/api-user/gis-ir/${t.id}/${i}`).then(w=>w.data.rows);t.legendAuto={color:[]},b.forEach(w=>t.legendAuto.color.push(w)),t.legendAuto.color.push({color:"#aaa",text:"Не визначено"}),t.style.color=b?["match",["get",i]].concat(b.filter(w=>w.id).reduce((w,E,C)=>w.concat([E.id,E.color||Fp[C]]),[])).concat(["#aaa"]):r}return[{id:`${t.id}`,source:`${t.id}`,lsource:e==null?void 0:e.lsource,minzoom:(+(e==null?void 0:e.minzoom)||+(e==null?void 0:e.pointZoom)||0)-0,maxzoom:+(e==null?void 0:e.maxzoom)||24,type:"fill",filter:["all",["match",["geometry-type"],["Polygon","MultiPolygon"],!0,!1]],paint:{"fill-color":["case",["boolean",["feature-state","hover"],!1],"red",["boolean",["feature-state","select"],!1],"#c356c1",(e==null?void 0:e.color)||"#0080ff"],"fill-opacity":.5}}].concat(e!=null&&e.pointZoom?[{id:`${t.id}-5`,source:(g=t.url)!=null&&g.includes(".vmt")?`${t.id}`:`${t.id}-point`,type:"circle",minzoom:0,maxzoom:((e==null?void 0:e.pointZoom)||1)-0,paint:{"circle-color":["case",["boolean",["feature-state","hover"],!1],"red",(e==null?void 0:e.color)||"blue"],"circle-stroke-width":1,"circle-stroke-color":"#fff"}}]:[]).concat(e!=null&&e.label?[{id:`${t.id}-1`,source:t.id,type:"symbol",lsource:e==null?void 0:e.lsource,minzoom:15,layout:{"text-field":e==null?void 0:e.label,"text-font":["Open Sans Regular"],"text-size":e["text-size"]||{stops:[[14,4],[18,16]]}},paint:{"text-color":e["text-color"]||"#ffffff","text-halo-color":e["text-halo-color"]||"#fff","text-halo-width":e["text-halo-width"]||0}}]:[]).concat(e!=null&&e.stroke?[{id:`${t.id}-2`,source:t.id,lsource:e==null?void 0:e.lsource,minzoom:(+(e==null?void 0:e.minzoom)||+(e==null?void 0:e.pointZoom)||0)-0,maxzoom:+(e==null?void 0:e.maxzoom)||24,type:"line",paint:{"line-color":["case",["boolean",["feature-state","select"],!1],"#c356c1",e.stroke],"line-width":["case",["boolean",["feature-state","select"],!1],3,(e.width||e["line-width"]||1)-0]}}]:[])},Cr.line=(t={},e={})=>[{id:t.id,source:t.id,lsource:e.lsource,type:"line",filter1:["all",["match",["geometry-type"],["LineString","MultiLineString","MultiPolygon","Polygon"],!0,!1]],minzoom:(e==null?void 0:e.minzoom)||t.minzoom||5,layout:{"line-join":"round","line-cap":"round"},paint:{"line-width":["case",["boolean",["feature-state","select"],!1],4,e.width||e["line-width"]||1],"line-color":["case",["boolean",["feature-state","select"],!1],"#c356c1",e.color||e["line-color"]||"#c71ccb"],"line-gap-width":e["line-gap-width"]||0}}].concat(e.label?[{id:`${t.id}-4`,source:t.id,lsource:e.lsource,type:"symbol",minzoom:14,paint:{"text-color":"#111","text-halo-color":"#fff","text-halo-width":2},layout:{"symbol-placement":"line","text-letter-spacing":.2,"text-field":e.label,"text-font":["Open Sans Regular"],"text-size":e["text-size"]||15}}]:[]),Cr.linestring=Cr.line,Cr.circle=Cr.point;async function zB(t,e,n){var l,g,b,w,E,C,P,D,R,$,W,te;typeof e.style=="string"&&(e.style=e.style[0]==="{"?JSON.parse(e.style):(l=window.YAML.parse(e.style))==null?void 0:l.style),(b=(g=e.style)==null?void 0:g.filter)==null||b.call(g,G=>G.source).forEach(G=>{G.lsource=`${e.id}-${G.source}`});const i=((w=e==null?void 0:e.style)==null?void 0:w.type)||((W=((P=(C=(E=e==null?void 0:e.meta)==null?void 0:E.geom)==null?void 0:C.geometry)==null?void 0:P.length)>2?["point"]:[(($=(R=(D=e==null?void 0:e.meta)==null?void 0:D.geom)==null?void 0:R.geometry)==null?void 0:$[0].toLowerCase())||"point"])==null?void 0:W.map(G=>{var Q;return(Q=G==null?void 0:G.replace)==null?void 0:Q.call(G,"multi","")})),r=Array.isArray(i)?i:[i],a=(await Promise.all(Array.isArray(e==null?void 0:e.style)?e.style.map(async G=>{var Q;return(Q=Cr[G.type])==null?void 0:Q.call(Cr,e,G,n)}):r.map(async G=>{var Q;return(Q=Cr[G])==null?void 0:Q.call(Cr,e,e.style,n)}))).reduce((G,Q)=>Q?G.concat(Q):G,[]);a.forEach((G,Q)=>{G.id=`${G.id}-${Q}`});const u=a;return(e.service==="vtile"||(te=e.url)!=null&&te.includes(".vmt"))&&u.forEach(G=>{G.layout||(G.layout={}),G.layout.visibility="visible",G["source-layer"]=G.lsource||e.data||t}),u}const NB={data(){return{layerList:[],layerObj:{},colors:Fp,activeLayer:"",addedLayersSettings:[],hoveredFeatureId:null}},computed:{interactiveSources(){return this.layerList.filter(t=>t==null?void 0:t.interactive).map(t=>t.id)}},methods:{moveLayers(t,e=this.map){e.getStyle().layers.forEach(n=>{n.id.match(t)&&e.moveLayer(n.id)})},getLayersBySourceId(t,e){return e.getStyle().layers.filter(i=>i.id.match(t))},async setVisible(t,e=!0,n={}){const i=typeof t=="object";try{const{style:r,map:a=this.map}=n,u=(t==null?void 0:t.id)||t,l=i?t:await this.getLayerById(u);if(!(l!=null&&l.id))throw new Error("MixinError: Layer has no id");const g=a.getStyle().layers.filter(b=>b.id.match(u));!g.length||r?await this.addToLayers({...l,...(n==null?void 0:n.data)||{},interactive:(l==null?void 0:l.interactive)!==void 0?l==null?void 0:l.interactive:!0,visible:e},{map:a,cb:n==null?void 0:n.onAddLayer}):(this.layerList=this.layerList.map(b=>b.id===l.id?{...b,visible:e}:b),g.forEach(b=>{a.setLayoutProperty(b.id,"visibility",e?"visible":"none")})),n!=null&&n.cb&&await(n==null?void 0:n.cb(l))}catch(r){console.error(r),!n.onAddLayer||n.onAddLayer({data:i?t:{id:t},message:r.message,type:"error"})}},async addToLayers(t,e={}){try{const{map:n=this==null?void 0:this.map}=e;this.layerList.find(r=>r.id===t.id)||(this.layerList=this.layerList.concat(t)),this.layerObj={...this.layerObj,[t.id]:t},t.visible?t!=null&&t.layer?await this.addVectorLayer(t,n):t.service==="vtile"?await this.addVtileLayer(t,n):t.service==="geojson"?await this.addGeojsonLayers(t,n):this.addRasterLayer(t,n):n.getStyle().layers.forEach(async r=>{r.source===t.id&&await n.setLayoutProperty(r.id,"visibility","none")}),!(e!=null&&e.cb&&(t!=null&&t.visible))||await e.cb({data:t,type:"success"}),this.moveLayers("gl-draw")}catch(n){!e.cb||e.cb({data:t,message:n.message,type:"error"}),console.error(n)}},addRasterLayer(t,e){e.addSource(t.id,{type:"raster",tiles:[(t==null?void 0:t.url)||(t==null?void 0:t.url1)],tileSize:256,...t!=null&&t.scheme?{scheme:t==null?void 0:t.scheme}:{}}),e.addLayer({id:t.id,type:"raster",source:t.id,minzoom:0,maxzoom:(t==null?void 0:t.maxzoom)||22})},async addVtileLayer(t){await this.createGeometryLayer({data:t},"vector")},async addVectorLayer(t,e){const{data:n}=await it.get(t.layer),i={...t,source:t.id,layers:[]};Object.keys(n.sources).forEach(async r=>{await e.addSource(t.id,{type:n.sources[r].type,maxzoom:n.sources[r].maxzoom,url:n.sources[r].url})}),await n.layers.forEach(async r=>{await e.addLayer({...r,source:t.id,id:`${r.id}-${t.id}`}),i.layers=await i.layers.concat(`${r.id}-${t.id}`)})},async addGeojsonLayers(t){const e=n=>{throw this.$notify({type:"error",title:"Відсутня геометрія у обраному шарі",message:n,position:"bottom-right"}),this.layerList=this.layerList.filter(i=>i.id!==t.id),new Error(n)};if(typeof(t==null?void 0:t.geojson)=="object"){this.createGeometryLayer({data:t,geojson:t.geojson},"geojson");return}try{const n=await it.get((t==null?void 0:t.geojson)||(t==null?void 0:t.url)),i=await n.data;if(n.statusText==="OK")this.createGeometryLayer({data:t,geojson:i},"geojson");else throw new Error((i==null?void 0:i.message)||(n==null?void 0:n.statusText)||"Error addGeojson layer")}catch(n){e(n.message),console.error(n)}},async createGeometryLayer({data:t,geojson:e},n){var l,g,b,w,E;const{map:i}=this,r=await zB(t.id,this.layerList.find(C=>C.id==t.id),i),a={type:n,cluster:((l=t==null?void 0:t.style)==null?void 0:l.cluster)||!1,clusterMaxZoom:((g=t==null?void 0:t.style)==null?void 0:g.clusterMaxZoom)||14};n==="vector"&&(a.tiles=[`${window.location.origin}${(t==null?void 0:t.geojson)||(t==null?void 0:t.url)}${t!=null&&t.version?`?ver=${t.version}`:""}${t.props?`&props=${t.props}`:""}${(b=t==null?void 0:t.style)!=null&&b.pointZoom?`&pointZoom=${t.style.pointZoom}`:""}`]),n==="geojson"&&(a.data=e||`${window.location.origin}${(t==null?void 0:t.geojson)||(t==null?void 0:t.url)}`),i.addSource(t.id,a),r.forEach(C=>{var D;const P={...C,source:t.id,maxzoom:+(C==null?void 0:C.maxzoom)||24,minzoom:+(C==null?void 0:C.minzoom)||0,cluster:!1,clusterMaxZoom:2};i.addLayer(P),i.moveLayer(C.id),(D=C==null?void 0:C.layout)!=null&&D["text-field"]||this.apiLayersHover(C.id,t.id,i),this.addedLayersSettings=this.addedLayersSettings.concat(P)});const u=r.map(C=>C.type).filter(C=>C&&C!=="symbol");(E=(w=t==null?void 0:t.meta)==null?void 0:w.geom)!=null&&E.geometry&&t.meta.geom.geometry.filter(P=>!u.includes(this.geometryByType(P,!0))).forEach(P=>{this.createStyleObj({type:P,style:t.style},t.id)})},async setStyle(t,e,n=this.map){const i=(t==null?void 0:t.id)||t;n.getStyle().layers.forEach(a=>{a.source===i&&n.removeLayer(a.id)}),n.getSource(i)&&(n==null||n.removeSource(i)),this.layerList=this.layerList.map(a=>(a.id===i&&(a.style=e),a));const r=this.layerList.find(a=>a.id===i);this.addToLayers(r)},setLayerData({source:t,data:e}){const n=(t==null?void 0:t.id)||t;this.layerList=this.layerList.map(i=>i.id===n?{...i,...e}:i),this.layerObj={...this.layerObj,[t]:{...this.layerObj[t],...e}}},geometryByType(t,e=!1){if(t==="fill"||t==="Polygon"||t==="MultiPolygon")return e?"fill":"Polygon";if(t==="circle"||t==="Point"||t==="MultiPoint")return e?"circle":"Point";if(t==="line"||t==="LineString"||t==="MultiLineString")return e?"line":"LineString"},async removeLayer(t,e=this.map){const n=(t==null?void 0:t.id)||t;this.layerList=this.layerList.filter(i=>i.id!==n),await e.getStyle().layers.forEach(async i=>{i.source===n&&await e.removeLayer(i.id)}),await e.removeSource(n)},async reloadUrl(t,e=this.map){const n=(t==null?void 0:t.id)||t;await e.getStyle().layers.forEach(i=>{i.id===n&&e.removeLayer(i.id)}),await e.removeSource(n),await this.setVisible(t,!0)},async setFilter(t,e){const n=this.layerObj[t],i=await this.map.getSource(t);if(n.service==="vtile")await i.setTiles([`${window.location.origin}${n.geojson||n.url}${n.url.includes("?")?"&":"?"}filter=${e}${n.props?`&props=${n.props}`:""}`]);else if(n.service==="geojson"){const{data:r}=await it.get((n==null?void 0:n.geojson)||`${n==null?void 0:n.url}?filter=${e}`);await this.map.getSource(t).setData(r)}},async getLayerById(t,e=null){var i;const n=(t==null?void 0:t.id)||t;try{const r=(i=this.layerList)==null?void 0:i.find(u=>u.id===n);if(r)return r;const a=await it.get(`/api-user/gis-ir/${n}${t!=null&&t.service?`?service=${t==null?void 0:t.service}`:""}`);if(a.statusText==="OK"){const u=await a.data;return!e||await e(u),u}return this.$notify({type:"warning",message:`Шар ${n} не було знайдено!`}),null}catch(r){this.$notify({type:"warning",message:`Шар ${n} не було знайдено!`}),console.error(r)}},createStyleObj({type:t,style:e},n){const i=this.geometryByType(t,!0);if(!i)throw Error("Geomery type ERROR: Error adding missing layers");const r=`${n}-${i}`;if(this.map.getStyle().layers.find(u=>u.id===r))return;const a={id:r,type:i,source:n,"source-layer":n,layout:{},paint:{[`${i}-color`]:["case",["boolean",["feature-state","hover"],!1],"red",(e==null?void 0:e.color)||"#444e3d"],[`${i}-opacity`]:e!=null&&e.opacity||i==="fill"?.5:1},filter:["all",["==",["geometry-type"],this.geometryByType(t)]]};this.map.addLayer(a),this.addedLayersSettings=this.addedLayersSettings.concat(a),this.apiLayersHover(r,n,this.map)},apiLayersHover(t,e,n){const i=n.getSource(e),r=()=>{const a={source:e,id:this.hoveredFeatureId};return i.type==="vector"&&(a.sourceLayer=e),a};n.on("mousemove",t,a=>{a.features.length>0&&(this.hoveredFeatureId!==null&&n.setFeatureState(r(),{hover:!1}),this.hoveredFeatureId=a.features[0].id,n.setFeatureState(r(),{hover:!0}))}),n.on("mouseleave",t,()=>{this.hoveredFeatureId!==null&&n.setFeatureState(r(),{hover:!1}),this.hoveredFeatureId=null})},async changeBaseLayer(t,e=!0,n=!0){await this.setVisible(t,e);const i=(t==null?void 0:t.id)||t;i!==this.activeLayer&&(n&&this.activeLayer&&await this.setVisible(this.activeLayer,!1),this.map.getStyle().layers.forEach(r=>{r.source!==i&&r.type!=="background"&&this.map.moveLayer(r.id)}),this.activeLayer=i)},async refreshLayer(t,e=this.map){const n=(t==null?void 0:t.id)||t;await e.getStyle().layers.forEach(i=>{i.source===n&&e.removeLayer(i.id)}),await e.removeSource(n),this.layers=await this.layers.filter(i=>i.id!==n),await this.setVisible(typeof t=="object"?t:n)}}},RB={props:{objectData:{type:Array,default:()=>[]},object:{type:Object,default:()=>null},mapRef:{type:Object,default:()=>null}},computed:{currentLayer(){var n;const t=(n=this.object)==null?void 0:n.source;return this.mapRef.layerObj[t]},popupPosition(){var e,n,i;return((i=(n=(e=this.currentLayer)==null?void 0:e.setting)==null?void 0:n.popup)==null?void 0:i.position)||"horizontal"},popupWidth(){var e,n,i;return`${((i=(n=(e=this.currentLayer)==null?void 0:e.setting)==null?void 0:n.popup)==null?void 0:i.width)||240}px`},popupRows(){return this.objectData.filter(t=>t.column!=="image")},positionIsVertical(){return this.popupPosition==="vertical"}},methods:{rowValue(t){return t.value},rowTitle(t){return t.title}}},LB={key:0,class:"vsTailwind map-popup__vertical"},VB={class:"mb-1"},FB={class:"text-sm"},$B={key:1,class:"map__popup-body"},jB=["innerHTML"],UB={key:1};function HB(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("div",{class:"map-popup",style:f.normalizeStyle({"max-width":a.popupWidth,width:a.popupWidth})},[a.positionIsVertical?(f.openBlock(),f.createElementBlock("div",LB,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(a.popupRows,u=>(f.openBlock(),f.createElementBlock("div",{class:"border-b py-1 last:border-none last:pt-1 last:pb-0",key:a.rowTitle(u)},[f.createElementVNode("strong",VB,f.toDisplayString(a.rowTitle(u)),1),f.createElementVNode("div",FB,f.toDisplayString(a.rowValue(u)),1)]))),128))])):(f.openBlock(),f.createElementBlock("table",$B,[f.createElementVNode("tbody",null,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(a.popupRows,u=>f.withDirectives((f.openBlock(),f.createElementBlock("tr",{key:a.rowTitle(u),class:"map__popup-body-item"},[f.createElementVNode("td",null,f.toDisplayString(a.rowTitle(u)),1),a.rowValue(u)?(f.openBlock(),f.createElementBlock("td",{key:0,innerHTML:a.rowValue(u)},null,8,jB)):(f.openBlock(),f.createElementBlock("td",UB,e[0]||(e[0]=[f.createElementVNode("div",{class:"text-red-500"}," Не визначено ",-1)])))])),[[f.vShow,!a.rowValue(u).includes("id")]])),128))])]))],4)}const qB=je(RB,[["render",HB],["__scopeId","data-v-3f5a9aff"]]),X1={width:200,show:!0,position:"horizontal"},WB={components:{VsPopupBody:qB},props:{aviableFields:{type:Array,default:()=>[]},mapRef:{type:[Object,Array],default:()=>{}},object:{type:[Object,Array],default:()=>{}}},data(){return{objectData:[],popupSettings:X1}},computed:{getImage(){return this.objectData.find(t=>t.column==="image")||null},currentLayer(){var t;return(t=this.$parent.layerList)==null?void 0:t.find(e=>{var n;return(e==null?void 0:e.id)===((n=this.object)==null?void 0:n.source)})}},watch:{async object(t,e){t!==null&&(t==null?void 0:t.id)!==(e==null?void 0:e.id)||!(t!=null&&t.id)?await this.getFormatObject(t):t===null&&(this.objectData=[])}},methods:{async getFormatObject(t){var g,b,w,E,C,P;if(!t)return;const e=Object.keys(t.properties).filter(D=>!D.match("__text")&&!["id"].includes(D)),{currentLayer:n}=this;if((g=n==null?void 0:n.setting)!=null&&g.popup&&(this.popupSettings=(n==null?void 0:n.setting.popup)||X1),!(n!=null&&n.meta)){const D=e.map(R=>({title:R,value:t.properties[R]}));this.objectData=[...D,{value:((b=t.properties)==null?void 0:b.image)||"",title:"Фото",column:"image"}];return}const i=n.meta.columns,r=e.map(D=>{var G,Q,Ie,ve;const R={},W=Object.assign({values:[]},i.find(Se=>Se.name===D));typeof W.values!="object"&&console.warn(`Warning: Layer ${t.source} has key "values" which is not an object in meta!`);const te=W!=null&&W.values&&((G=W==null?void 0:W.values)==null?void 0:G.find(Se=>(Se==null?void 0:Se.id)==t.properties[D]))||null;return R.value=(W==null?void 0:W.format)==="select"?this.formatBadge({text:(te==null?void 0:te.text)||((Q=t.properties)==null?void 0:Q[`${D}__text`])||((Ie=t.properties)==null?void 0:Ie[D])||"-",color:(te==null?void 0:te.color)||"#1989FA"}):(te==null?void 0:te.text)||((ve=t.properties)==null?void 0:ve[`${D}__text`])||t.properties[D],R.column=D,R.title=(W==null?void 0:W[window==null?void 0:window.lang])||(W==null?void 0:W.ua)||(W==null?void 0:W.title)||D,R});this.objectData=[...r,{value:((w=t.properties)==null?void 0:w.image)||"",title:"Фото",column:"image"}];const a=(C=(E=n==null?void 0:n.setting)==null?void 0:E.popup)==null?void 0:C.popup,u=typeof a=="string"?a==null?void 0:a.split(","):a,l=[...this.aviableFields,...((P=n==null?void 0:n.popup)==null?void 0:P.split(","))||[],...u||[]];this.objectData=l.length?this.objectData.filter(D=>l.includes(D.column)||l.includes(D.title)):[]},noInfoObject(){var i,r,a,u,l;if(!this.object)return"Інформація відсутня";const{currentLayer:t}=this,e=((r=(i=t==null?void 0:t.meta)==null?void 0:i.columns)==null?void 0:r.find(g=>(g==null?void 0:g.meta)==="title"))||((a=t==null?void 0:t.meta)==null?void 0:a.columns[0])||null;return{title:(t==null?void 0:t.name)||(t==null?void 0:t.id)||((u=this.object)==null?void 0:u.sourceLayer)||((l=this.object)==null?void 0:l.source)||"Дані по шару не знайдено",column:e}},formatBadge(t){const e=(t==null?void 0:t.text)||"-";return t!=null&&t.color?`<span >${e}</span>`:e}}},GB={key:0},ZB={key:0},YB=["src","alt"],XB={key:1},KB={class:"text-left text-sm m-b-sm"},JB={key:1,class:"text-center"};function QB(t,e,n,i,r,a){var l,g,b,w,E,C,P,D,R,$,W;const u=f.resolveComponent("VsPopupBody");return f.openBlock(),f.createElementBlock("div",{class:f.normalizeClass((((l=r.popupSettings)==null?void 0:l.position)||"horizontal")+"-position")},[r.objectData.filter(te=>te.column!=="image").length?(f.openBlock(),f.createElementBlock("div",GB,[a.getImage&&((g=a.getImage)!=null&&g.value)?(f.openBlock(),f.createElementBlock("div",ZB,[f.createElementVNode("img",{class:"popup-image",src:"files/"+a.getImage.value,alt:a.getImage.column},null,8,YB)])):f.createCommentVNode("",!0),f.createVNode(u,{"object-data":r.objectData,object:n.object,mapRef:n.mapRef},null,8,["object-data","object","mapRef"])])):(f.openBlock(),f.createElementBlock("div",XB,[(b=a.noInfoObject())!=null&&b.column?(f.openBlock(),f.createElementBlock(f.Fragment,{key:0},[f.createElementVNode("b",KB,f.toDisplayString(a.noInfoObject().title),1),f.createElementVNode("div",null,[f.createElementVNode("b",null,f.toDisplayString(((E=(w=a.noInfoObject())==null?void 0:w.column)==null?void 0:E.ua)||((P=(C=a.noInfoObject())==null?void 0:C.column)==null?void 0:P.title))+":",1),f.createTextVNode(" "+f.toDisplayString(((W=(D=n.object)==null?void 0:D.properties)==null?void 0:W[($=(R=a.noInfoObject())==null?void 0:R.column)==null?void 0:$.name])||"-"),1)])],64)):(f.openBlock(),f.createElementBlock("div",JB,f.toDisplayString(a.noInfoObject().title),1))]))],2)}const ez=je(WB,[["render",QB],["__scopeId","data-v-deb51e0a"]]),{Map:tz,NavigationControl:nz,Popup:iz}=OB,rz={mixins:[NB],components:{VsMapPopup:ez},props:{popupVisible:{type:Boolean,default:()=>!0},map:{type:Object,default:()=>null},height:{type:String,default:()=>"400px"}},data(){return{mapId:`gis-map-${Math.floor(Math.random()*1e3)}`,features:[],popup:{geometry:null,map:null},cityBbox:null}},async mounted(){this.initMap()},computed:{mapRef(){return this}},methods:{initMap(){const t={version:8,glyphs:"https://fonts.openmaptiles.org/{fontstack}/{range}.pbf",sources:{},layers:[]},e=new tz({container:this.mapId,style:t,center:[0,0],zoom:1,interactive:!0});e.addControl(new nz({visualizePitch:!0})),window==null||window.addEventListener("resize",()=>{e.resize()}),e.on("load",this.onMapLoad)},async onMapLoad(t){const e=t.target;e.resize();const n={id:"graymap",name:"Сіра карта",url:"https://basemaps.cartocdn.com/light_all/{z}/{x}/{y}.png",service:"TMS",category:"Базові карти",attribution:"&copy; <a href='http://www.openstreetmap.org/copyright'>OpenStreetMap</a>, &copy; <a href='https://carto.com/attributions'>CARTO</a>",bounds1:"ua",image:"https://basemaps.cartocdn.com/light_all/10/601/348.png",position:0,owner:"OSM",basemap:!0};await this.$emit("update:map",e),await this.setVisible(n,!0),this.$emit("load",e),this.createPopup(),this.createBoundsLayers(),this.createAtuLayer()},createPopup(){var n,i,r,a,u,l;const{map:t}=this,e=["measure","geometry","mapbox-gl-draw-hot","mapbox-gl-draw-cold"];this.popup.map=new iz({closeOnClick:!1}).setDOMContent((i=(n=this==null?void 0:this.$refs)==null?void 0:n.popup)==null?void 0:i.$el),t&&(t.on("mousemove",g=>{var w,E;const b=t.queryRenderedFeatures(g.point).filter(C=>{var R,$,W;const P=this.layerList.find(te=>te.id===C.source),D=(($=(R=P==null?void 0:P.setting)==null?void 0:R.popup)==null?void 0:$.show)===void 0?!0:P.setting.popup.show;if((this.interactiveSources.includes(C.source)&&!((W=C.properties)!=null&&W.cluster)&&D||!P&&Object.keys(C.properties).length)&&!e.includes(C.source))return C}).filter(C=>{var P,D;return!((D=(P=C.layer)==null?void 0:P.layout)!=null&&D["text-field"])});b.length&&this.popupVisible?(this.features=(b==null?void 0:b[0])||null,(w=this.popup.map)==null||w.setLngLat(Object.values(g.lngLat)).addTo(t),t.getCanvas().style.cursor=b.length?"pointer":"grab"):(this.features=null,(E=this.popup.map)==null||E.remove()),this.$emit("mouseMove",{event:g,features:b})}),t.on("touchend",this.handleMapClick),t.on("click",this.handleMapClick),t.on("dblclick",g=>{const b=t.queryRenderedFeatures(g.point);this.$emit("dbclick",{features:b,event:g})}),(l=(u=(a=(r=this==null?void 0:this.$refs)==null?void 0:r.popup)==null?void 0:a.$el)==null?void 0:u.parentElement)==null||l.addEventListener("mouseenter",()=>{var g;(g=this.popup.map)==null||g.remove()}))},createBoundsLayers(){const{map:t}=this;t&&(t.addSource("bounds-dataset",{type:"geojson",data:{type:"FeatureCollection",features:[]}}),t.addLayer({id:"bounds-dataset-line",type:"line",source:"bounds-dataset",layout:{},paint:{"line-color":"#a91a9e","line-width":2}}))},handleMapClick(t){if(!this.map)return;const e=this.map.queryRenderedFeatures(t.point);if(!e.length)return;const n=e.filter(i=>this.interactiveSources.includes(i==null?void 0:i.source));this.$emit("mapClick",n)},homeZoom(){const{map:t}=this,e=this.cityBbox?this.cityBbox:[22.1352,44.3909,40.2276,52.3791];t==null||t.fitBounds(e,{duration:0,padding:10})}}},oz={class:"relative"},sz=["id"];function az(t,e,n,i,r,a){const u=f.resolveComponent("VsMapPopup");return f.openBlock(),f.createElementBlock("div",oz,[f.createElementVNode("div",{id:r.mapId,style:f.normalizeStyle({height:n.height})},null,12,sz),f.createVNode(u,{ref:"popup",object:r.features,"map-ref":a.mapRef},null,8,["object","map-ref"])])}const lz=je(rz,[["render",az]]),Qo="widget-map-source",cz={components:{VsMap:lz},props:{geometry:{type:Object,default:()=>null},zoom:{type:String,default:()=>"50"}},data(){return{map:null}},mounted(){this.geometry&&this.initGeometryLayer()},watch:{geometry(){console.log(this.zoom),this.initGeometryLayer()}},methods:{initMap(){this.geometry&&this.map&&this.initGeometryLayer()},handleMapLoad(){this.initMap()},initGeometryLayer(){const{map:t}=this;if(!t)return;const e=this.formatGeojson(this.geometry),n=t.getSource(Qo);if(this.zoomToGeometry(e),n){n.setData(e);return}t.addSource(Qo,{type:"geojson",data:e}),t.addLayer({id:`${Qo}-point`,type:"circle",source:Qo,paint:{"circle-radius":10,"circle-color":"#F84C4C"},filter:["==","$type","Point"]}),t.addLayer({id:`${Qo}-polygon`,type:"fill",source:Qo,layout:{},paint:{"fill-color":"#0080ff","fill-opacity":.5},filter:["==","$type","Polygon"]}),t.addLayer({id:`${Qo}-polygon-line`,type:"line",source:Qo,layout:{},paint:{"line-color":"#0080ff","line-width":2},filter:["==","$type","Polygon"]}),t.addLayer({id:`${Qo}-line`,type:"line",source:Qo,layout:{},paint:{"line-color":"#0080ff","line-width":3},filter:["==","$type","LineString"]})},formatGeojson(t){let e=t;const n=t==null?void 0:t.type;if(Array.isArray(t))return Z1(t);if(!n)throw new Error("Unknown geometry type!");return n==="FeatureCollection"?t:(n==="Feature"&&(e=[t]),!["FeatureCollection","Feature"].includes(n)&&(e=[PB(t)]),Z1(e))},zoomToGeometry(t){const{map:e}=this,n=MB(t);e.fitBounds(n,{zoom:this.zoom,padding:30,duration:0})}}};function uz(t,e,n,i,r,a){const u=f.resolveComponent("VsMap");return f.openBlock(),f.createElementBlock("div",null,[f.createVNode(u,{map:r.map,"onUpdate:map":e[0]||(e[0]=l=>r.map=l),onLoad:a.handleMapLoad},null,8,["map","onLoad"])])}const K1=je(cz,[["render",uz]]),lt=(t,e=1e4)=>(t=parseFloat(t+"")||0,Math.round((t+Number.EPSILON)*e)/e),ly=function(t){if(!(t&&t instanceof Element&&t.offsetParent))return!1;const e=t.scrollHeight>t.clientHeight,n=window.getComputedStyle(t).overflowY,i=n.indexOf("hidden")!==-1,r=n.indexOf("visible")!==-1;return e&&!i&&!r},jp=function(t,e=void 0){return!(!t||t===document.body||e&&t===e)&&(ly(t)?t:jp(t.parentElement,e))},es=function(t){var e=new DOMParser().parseFromString(t,"text/html").body;if(e.childElementCount>1){for(var n=document.createElement("div");e.firstChild;)n.appendChild(e.firstChild);return n}return e.firstChild},cy=t=>`${t||""}`.split(" ").filter(e=>!!e),ts=(t,e,n)=>{t&&cy(e).forEach(i=>{t.classList.toggle(i,n||!1)})};class Ec{constructor(e){Object.defineProperty(this,"pageX",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"pageY",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"clientX",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"clientY",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"time",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"nativePointer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.nativePointer=e,this.pageX=e.pageX,this.pageY=e.pageY,this.clientX=e.clientX,this.clientY=e.clientY,this.id=self.Touch&&e instanceof Touch?e.identifier:-1,this.time=Date.now()}}const Cc={passive:!1};class hz{constructor(e,{start:n=()=>!0,move:i=()=>{},end:r=()=>{}}){Object.defineProperty(this,"element",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"startCallback",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"moveCallback",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"endCallback",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"currentPointers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"startPointers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),this.element=e,this.startCallback=n,this.moveCallback=i,this.endCallback=r;for(const a of["onPointerStart","onTouchStart","onMove","onTouchEnd","onPointerEnd","onWindowBlur"])this[a]=this[a].bind(this);this.element.addEventListener("mousedown",this.onPointerStart,Cc),this.element.addEventListener("touchstart",this.onTouchStart,Cc),this.element.addEventListener("touchmove",this.onMove,Cc),this.element.addEventListener("touchend",this.onTouchEnd),this.element.addEventListener("touchcancel",this.onTouchEnd)}onPointerStart(e){if(!e.buttons||e.button!==0)return;const n=new Ec(e);this.currentPointers.some(i=>i.id===n.id)||this.triggerPointerStart(n,e)&&(window.addEventListener("mousemove",this.onMove),window.addEventListener("mouseup",this.onPointerEnd),window.addEventListener("blur",this.onWindowBlur))}onTouchStart(e){for(const n of Array.from(e.changedTouches||[]))this.triggerPointerStart(new Ec(n),e);window.addEventListener("blur",this.onWindowBlur)}onMove(e){const n=this.currentPointers.slice(),i="changedTouches"in e?Array.from(e.changedTouches||[]).map(a=>new Ec(a)):[new Ec(e)],r=[];for(const a of i){const u=this.currentPointers.findIndex(l=>l.id===a.id);u<0||(r.push(a),this.currentPointers[u]=a)}r.length&&this.moveCallback(e,this.currentPointers.slice(),n)}onPointerEnd(e){e.buttons>0&&e.button!==0||(this.triggerPointerEnd(e,new Ec(e)),window.removeEventListener("mousemove",this.onMove),window.removeEventListener("mouseup",this.onPointerEnd),window.removeEventListener("blur",this.onWindowBlur))}onTouchEnd(e){for(const n of Array.from(e.changedTouches||[]))this.triggerPointerEnd(e,new Ec(n))}triggerPointerStart(e,n){return!!this.startCallback(n,e,this.currentPointers.slice())&&(this.currentPointers.push(e),this.startPointers.push(e),!0)}triggerPointerEnd(e,n){const i=this.currentPointers.findIndex(r=>r.id===n.id);i<0||(this.currentPointers.splice(i,1),this.startPointers.splice(i,1),this.endCallback(e,n,this.currentPointers.slice()))}onWindowBlur(){this.clear()}clear(){for(;this.currentPointers.length;){const e=this.currentPointers[this.currentPointers.length-1];this.currentPointers.splice(this.currentPointers.length-1,1),this.startPointers.splice(this.currentPointers.length-1,1),this.endCallback(new Event("touchend",{bubbles:!0,cancelable:!0,clientX:e.clientX,clientY:e.clientY}),e,this.currentPointers.slice())}}stop(){this.element.removeEventListener("mousedown",this.onPointerStart,Cc),this.element.removeEventListener("touchstart",this.onTouchStart,Cc),this.element.removeEventListener("touchmove",this.onMove,Cc),this.element.removeEventListener("touchend",this.onTouchEnd),this.element.removeEventListener("touchcancel",this.onTouchEnd),window.removeEventListener("mousemove",this.onMove),window.removeEventListener("mouseup",this.onPointerEnd),window.removeEventListener("blur",this.onWindowBlur)}}function J1(t,e){return e?Math.sqrt(Math.pow(e.clientX-t.clientX,2)+Math.pow(e.clientY-t.clientY,2)):0}function Q1(t,e){return e?{clientX:(t.clientX+e.clientX)/2,clientY:(t.clientY+e.clientY)/2}:t}const uy=t=>typeof t=="object"&&t!==null&&t.constructor===Object&&Object.prototype.toString.call(t)==="[object Object]",Tr=(t,...e)=>{const n=e.length;for(let i=0;i<n;i++){const r=e[i]||{};Object.entries(r).forEach(([a,u])=>{const l=Array.isArray(u)?[]:{};t[a]||Object.assign(t,{[a]:l}),uy(u)?Object.assign(t[a],Tr(l,u)):Array.isArray(u)?Object.assign(t,{[a]:[...u]}):Object.assign(t,{[a]:u})})}return t},hy=function(t,e){return t.split(".").reduce((n,i)=>typeof n=="object"?n[i]:void 0,e)};class Up{constructor(e={}){Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"events",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),this.setOptions(e);for(const n of Object.getOwnPropertyNames(Object.getPrototypeOf(this)))n.startsWith("on")&&typeof this[n]=="function"&&(this[n]=this[n].bind(this))}setOptions(e){this.options=e?Tr({},this.constructor.defaults,e):{};for(const[n,i]of Object.entries(this.option("on")||{}))this.on(n,i)}option(e,...n){let i=hy(e,this.options);return i&&typeof i=="function"&&(i=i.call(this,this,...n)),i}optionFor(e,n,i,...r){let a=hy(n,e);var u;typeof(u=a)!="string"||isNaN(u)||isNaN(parseFloat(u))||(a=parseFloat(a)),a==="true"&&(a=!0),a==="false"&&(a=!1),a&&typeof a=="function"&&(a=a.call(this,this,e,...r));let l=hy(n,this.options);return l&&typeof l=="function"?a=l.call(this,this,e,...r,a):a===void 0&&(a=l),a===void 0?i:a}cn(e){const n=this.options.classes;return n&&n[e]||""}localize(e,n=[]){e=String(e).replace(/\{\{(\w+).?(\w+)?\}\}/g,(i,r,a)=>{let u="";return a?u=this.option(`${r[0]+r.toLowerCase().substring(1)}.l10n.${a}`):r&&(u=this.option(`l10n.${r}`)),u||(u=i),u});for(let i=0;i<n.length;i++)e=e.split(n[i][0]).join(n[i][1]);return e=e.replace(/\{\{(.*?)\}\}/g,(i,r)=>r)}on(e,n){let i=[];typeof e=="string"?i=e.split(" "):Array.isArray(e)&&(i=e),this.events||(this.events=new Map),i.forEach(r=>{let a=this.events.get(r);a||(this.events.set(r,[]),a=[]),a.includes(n)||a.push(n),this.events.set(r,a)})}off(e,n){let i=[];typeof e=="string"?i=e.split(" "):Array.isArray(e)&&(i=e),i.forEach(r=>{const a=this.events.get(r);if(Array.isArray(a)){const u=a.indexOf(n);u>-1&&a.splice(u,1)}})}emit(e,...n){[...this.events.get(e)||[]].forEach(i=>i(this,...n)),e!=="*"&&this.emit("*",e,...n)}}Object.defineProperty(Up,"version",{enumerable:!0,configurable:!0,writable:!0,value:"5.0.36"}),Object.defineProperty(Up,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{}});class dy extends Up{constructor(e={}){super(e),Object.defineProperty(this,"plugins",{enumerable:!0,configurable:!0,writable:!0,value:{}})}attachPlugins(e={}){const n=new Map;for(const[i,r]of Object.entries(e)){const a=this.option(i),u=this.plugins[i];u||a===!1?u&&a===!1&&(u.detach(),delete this.plugins[i]):n.set(i,new r(this,a||{}))}for(const[i,r]of n)this.plugins[i]=r,r.attach()}detachPlugins(e){e=e||Object.keys(this.plugins);for(const n of e){const i=this.plugins[n];i&&i.detach(),delete this.plugins[n]}return this.emit("detachPlugins"),this}}var In;(function(t){t[t.Init=0]="Init",t[t.Error=1]="Error",t[t.Ready=2]="Ready",t[t.Panning=3]="Panning",t[t.Mousemove=4]="Mousemove",t[t.Destroy=5]="Destroy"})(In||(In={}));const Ps=["a","b","c","d","e","f"],ev={PANUP:"Move up",PANDOWN:"Move down",PANLEFT:"Move left",PANRIGHT:"Move right",ZOOMIN:"Zoom in",ZOOMOUT:"Zoom out",TOGGLEZOOM:"Toggle zoom level",TOGGLE1TO1:"Toggle zoom level",ITERATEZOOM:"Toggle zoom level",ROTATECCW:"Rotate counterclockwise",ROTATECW:"Rotate clockwise",FLIPX:"Flip horizontally",FLIPY:"Flip vertically",FITX:"Fit horizontally",FITY:"Fit vertically",RESET:"Reset",TOGGLEFS:"Toggle fullscreen"},dz={content:null,width:"auto",height:"auto",panMode:"drag",touch:!0,dragMinThreshold:3,lockAxis:!1,mouseMoveFactor:1,mouseMoveFriction:.12,zoom:!0,pinchToZoom:!0,panOnlyZoomed:"auto",minScale:1,maxScale:2,friction:.25,dragFriction:.35,decelFriction:.05,click:"toggleZoom",dblClick:!1,wheel:"zoom",wheelLimit:7,spinner:!0,bounds:"auto",infinite:!1,rubberband:!0,bounce:!0,maxVelocity:75,transformParent:!1,classes:{content:"f-panzoom__content",isLoading:"is-loading",canZoomIn:"can-zoom_in",canZoomOut:"can-zoom_out",isDraggable:"is-draggable",isDragging:"is-dragging",inFullscreen:"in-fullscreen",htmlHasFullscreen:"with-panzoom-in-fullscreen"},l10n:ev},tv='<circle cx="25" cy="25" r="20"></circle>',py='<div class="f-spinner"><svg viewBox="0 0 50 50">'+tv+tv+"</svg></div>",Mr=t=>t&&t!==null&&t instanceof Element&&"nodeType"in t,En=(t,e)=>{t&&cy(e).forEach(n=>{t.classList.remove(n)})},Ct=(t,e)=>{t&&cy(e).forEach(n=>{t.classList.add(n)})},Hp={a:1,b:0,c:0,d:1,e:0,f:0},pz=1e5,qp=1e4,fo="mousemove",nv="drag",iv="content",mo="auto";let fy=null,my=null;class ha extends dy{get fits(){return this.contentRect.width-this.contentRect.fitWidth<1&&this.contentRect.height-this.contentRect.fitHeight<1}get isTouchDevice(){return my===null&&(my=window.matchMedia("(hover: none)").matches),my}get isMobile(){return fy===null&&(fy=/iPhone|iPad|iPod|Android/i.test(navigator.userAgent)),fy}get panMode(){return this.options.panMode!==fo||this.isTouchDevice?nv:fo}get panOnlyZoomed(){const e=this.options.panOnlyZoomed;return e===mo?this.isTouchDevice:e}get isInfinite(){return this.option("infinite")}get angle(){return 180*Math.atan2(this.current.b,this.current.a)/Math.PI||0}get targetAngle(){return 180*Math.atan2(this.target.b,this.target.a)/Math.PI||0}get scale(){const{a:e,b:n}=this.current;return Math.sqrt(e*e+n*n)||1}get targetScale(){const{a:e,b:n}=this.target;return Math.sqrt(e*e+n*n)||1}get minScale(){return this.option("minScale")||1}get fullScale(){const{contentRect:e}=this;return e.fullWidth/e.fitWidth||1}get maxScale(){return this.fullScale*(this.option("maxScale")||1)||1}get coverScale(){const{containerRect:e,contentRect:n}=this,i=Math.max(e.height/n.fitHeight,e.width/n.fitWidth)||1;return Math.min(this.fullScale,i)}get isScaling(){return Math.abs(this.targetScale-this.scale)>1e-5&&!this.isResting}get isContentLoading(){const e=this.content;return!!(e&&e instanceof HTMLImageElement)&&!e.complete}get isResting(){if(this.isBouncingX||this.isBouncingY)return!1;for(const e of Ps){const n=e=="e"||e==="f"?1e-4:1e-5;if(Math.abs(this.target[e]-this.current[e])>n)return!1}return!(!this.ignoreBounds&&!this.checkBounds().inBounds)}constructor(e,n={},i={}){var r;if(super(n),Object.defineProperty(this,"pointerTracker",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"resizeObserver",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"updateTimer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"clickTimer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"rAF",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"isTicking",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"ignoreBounds",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"isBouncingX",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"isBouncingY",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"clicks",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"trackingPoints",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"pwt",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"cwd",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"pmme",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"friction",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:In.Init}),Object.defineProperty(this,"isDragging",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"container",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"content",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"spinner",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"containerRect",{enumerable:!0,configurable:!0,writable:!0,value:{width:0,height:0,innerWidth:0,innerHeight:0}}),Object.defineProperty(this,"contentRect",{enumerable:!0,configurable:!0,writable:!0,value:{top:0,right:0,bottom:0,left:0,fullWidth:0,fullHeight:0,fitWidth:0,fitHeight:0,width:0,height:0}}),Object.defineProperty(this,"dragStart",{enumerable:!0,configurable:!0,writable:!0,value:{x:0,y:0,top:0,left:0,time:0}}),Object.defineProperty(this,"dragOffset",{enumerable:!0,configurable:!0,writable:!0,value:{x:0,y:0,time:0}}),Object.defineProperty(this,"current",{enumerable:!0,configurable:!0,writable:!0,value:Object.assign({},Hp)}),Object.defineProperty(this,"target",{enumerable:!0,configurable:!0,writable:!0,value:Object.assign({},Hp)}),Object.defineProperty(this,"velocity",{enumerable:!0,configurable:!0,writable:!0,value:{a:0,b:0,c:0,d:0,e:0,f:0}}),Object.defineProperty(this,"lockedAxis",{enumerable:!0,configurable:!0,writable:!0,value:!1}),!e)throw new Error("Container Element Not Found");this.container=e,this.initContent(),this.attachPlugins(Object.assign(Object.assign({},ha.Plugins),i)),this.emit("attachPlugins"),this.emit("init");const a=this.content;if(a.addEventListener("load",this.onLoad),a.addEventListener("error",this.onError),this.isContentLoading){if(this.option("spinner")){e.classList.add(this.cn("isLoading"));const u=es(py);!e.contains(a)||a.parentElement instanceof HTMLPictureElement?this.spinner=e.appendChild(u):this.spinner=((r=a.parentElement)===null||r===void 0?void 0:r.insertBefore(u,a))||null}this.emit("beforeLoad")}else queueMicrotask(()=>{this.enable()})}initContent(){const{container:e}=this,n=this.cn(iv);let i=this.option(iv)||e.querySelector(`.${n}`);if(i||(i=e.querySelector("img,picture")||e.firstElementChild,i&&Ct(i,n)),i instanceof HTMLPictureElement&&(i=i.querySelector("img")),!i)throw new Error("No content found");this.content=i}onLoad(){const{spinner:e,container:n,state:i}=this;e&&(e.remove(),this.spinner=null),this.option("spinner")&&n.classList.remove(this.cn("isLoading")),this.emit("afterLoad"),i===In.Init?this.enable():this.updateMetrics()}onError(){this.state!==In.Destroy&&(this.spinner&&(this.spinner.remove(),this.spinner=null),this.stop(),this.detachEvents(),this.state=In.Error,this.emit("error"))}getNextScale(e){const{fullScale:n,targetScale:i,coverScale:r,maxScale:a,minScale:u}=this;let l=u;switch(e){case"toggleMax":l=i-u<.5*(a-u)?a:u;break;case"toggleCover":l=i-u<.5*(r-u)?r:u;break;case"toggleZoom":l=i-u<.5*(n-u)?n:u;break;case"iterateZoom":let g=[1,n,a].sort((w,E)=>w-E),b=g.findIndex(w=>w>i+1e-5);l=g[b]||1}return l}attachObserver(){var e;const n=()=>{const{container:i,containerRect:r}=this;return Math.abs(r.width-i.getBoundingClientRect().width)>.1||Math.abs(r.height-i.getBoundingClientRect().height)>.1};this.resizeObserver||window.ResizeObserver===void 0||(this.resizeObserver=new ResizeObserver(()=>{this.updateTimer||(n()?(this.onResize(),this.isMobile&&(this.updateTimer=setTimeout(()=>{n()&&this.onResize(),this.updateTimer=null},500))):this.updateTimer&&(clearTimeout(this.updateTimer),this.updateTimer=null))})),(e=this.resizeObserver)===null||e===void 0||e.observe(this.container)}detachObserver(){var e;(e=this.resizeObserver)===null||e===void 0||e.disconnect()}attachEvents(){const{container:e}=this;e.addEventListener("click",this.onClick,{passive:!1,capture:!1}),e.addEventListener("wheel",this.onWheel,{passive:!1}),this.pointerTracker=new hz(e,{start:this.onPointerDown,move:this.onPointerMove,end:this.onPointerUp}),document.addEventListener(fo,this.onMouseMove)}detachEvents(){var e;const{container:n}=this;n.removeEventListener("click",this.onClick,{passive:!1,capture:!1}),n.removeEventListener("wheel",this.onWheel,{passive:!1}),(e=this.pointerTracker)===null||e===void 0||e.stop(),this.pointerTracker=null,document.removeEventListener(fo,this.onMouseMove),document.removeEventListener("keydown",this.onKeydown,!0),this.clickTimer&&(clearTimeout(this.clickTimer),this.clickTimer=null),this.updateTimer&&(clearTimeout(this.updateTimer),this.updateTimer=null)}animate(){this.setTargetForce();const e=this.friction,n=this.option("maxVelocity");for(const i of Ps)e?(this.velocity[i]*=1-e,n&&!this.isScaling&&(this.velocity[i]=Math.max(Math.min(this.velocity[i],n),-1*n)),this.current[i]+=this.velocity[i]):this.current[i]=this.target[i];this.setTransform(),this.setEdgeForce(),!this.isResting||this.isDragging?this.rAF=requestAnimationFrame(()=>this.animate()):this.stop("current")}setTargetForce(){for(const e of Ps)e==="e"&&this.isBouncingX||e==="f"&&this.isBouncingY||(this.velocity[e]=(1/(1-this.friction)-1)*(this.target[e]-this.current[e]))}checkBounds(e=0,n=0){const{current:i}=this,r=i.e+e,a=i.f+n,u=this.getBounds(),{x:l,y:g}=u,b=l.min,w=l.max,E=g.min,C=g.max;let P=0,D=0;return b!==1/0&&r<b?P=b-r:w!==1/0&&r>w&&(P=w-r),E!==1/0&&a<E?D=E-a:C!==1/0&&a>C&&(D=C-a),Math.abs(P)<1e-4&&(P=0),Math.abs(D)<1e-4&&(D=0),Object.assign(Object.assign({},u),{xDiff:P,yDiff:D,inBounds:!P&&!D})}clampTargetBounds(){const{target:e}=this,{x:n,y:i}=this.getBounds();n.min!==1/0&&(e.e=Math.max(e.e,n.min)),n.max!==1/0&&(e.e=Math.min(e.e,n.max)),i.min!==1/0&&(e.f=Math.max(e.f,i.min)),i.max!==1/0&&(e.f=Math.min(e.f,i.max))}calculateContentDim(e=this.current){const{content:n,contentRect:i}=this,{fitWidth:r,fitHeight:a,fullWidth:u,fullHeight:l}=i;let g=u,b=l;if(this.option("zoom")||this.angle!==0){const w=!(n instanceof HTMLImageElement)&&(window.getComputedStyle(n).maxWidth==="none"||window.getComputedStyle(n).maxHeight==="none"),E=w?u:r,C=w?l:a,P=this.getMatrix(e),D=new DOMPoint(0,0).matrixTransform(P),R=new DOMPoint(0+E,0).matrixTransform(P),$=new DOMPoint(0+E,0+C).matrixTransform(P),W=new DOMPoint(0,0+C).matrixTransform(P),te=Math.abs($.x-D.x),G=Math.abs($.y-D.y),Q=Math.abs(W.x-R.x),Ie=Math.abs(W.y-R.y);g=Math.max(te,Q),b=Math.max(G,Ie)}return{contentWidth:g,contentHeight:b}}setEdgeForce(){if(this.ignoreBounds||this.isDragging||this.panMode===fo||this.targetScale<this.scale)return this.isBouncingX=!1,void(this.isBouncingY=!1);const{target:e}=this,{x:n,y:i,xDiff:r,yDiff:a}=this.checkBounds(),u=this.option("maxVelocity");let l=this.velocity.e,g=this.velocity.f;r!==0?(this.isBouncingX=!0,r*l<=0?l+=.14*r:(l=.14*r,n.min!==1/0&&(this.target.e=Math.max(e.e,n.min)),n.max!==1/0&&(this.target.e=Math.min(e.e,n.max))),u&&(l=Math.max(Math.min(l,u),-1*u))):this.isBouncingX=!1,a!==0?(this.isBouncingY=!0,a*g<=0?g+=.14*a:(g=.14*a,i.min!==1/0&&(this.target.f=Math.max(e.f,i.min)),i.max!==1/0&&(this.target.f=Math.min(e.f,i.max))),u&&(g=Math.max(Math.min(g,u),-1*u))):this.isBouncingY=!1,this.isBouncingX&&(this.velocity.e=l),this.isBouncingY&&(this.velocity.f=g)}enable(){const{content:e}=this,n=new DOMMatrixReadOnly(window.getComputedStyle(e).transform);for(const i of Ps)this.current[i]=this.target[i]=n[i];this.updateMetrics(),this.attachObserver(),this.attachEvents(),this.state=In.Ready,this.emit("ready")}onClick(e){var n;e.type==="click"&&e.detail===0&&(this.dragOffset.x=0,this.dragOffset.y=0),this.isDragging&&((n=this.pointerTracker)===null||n===void 0||n.clear(),this.trackingPoints=[],this.startDecelAnim());const i=e.target;if(!i||e.defaultPrevented)return;if(i.hasAttribute("disabled"))return e.preventDefault(),void e.stopPropagation();if((()=>{const P=window.getSelection();return P&&P.type==="Range"})()&&!i.closest("button"))return;const r=i.closest("[data-panzoom-action]"),a=i.closest("[data-panzoom-change]"),u=r||a,l=u&&Mr(u)?u.dataset:null;if(l){const P=l.panzoomChange,D=l.panzoomAction;if((P||D)&&e.preventDefault(),P){let R={};try{R=JSON.parse(P)}catch{console&&console.warn("The given data was not valid JSON")}return void this.applyChange(R)}if(D)return void(this[D]&&this[D]())}if(Math.abs(this.dragOffset.x)>3||Math.abs(this.dragOffset.y)>3)return e.preventDefault(),void e.stopPropagation();if(i.closest("[data-fancybox]"))return;const g=this.content.getBoundingClientRect(),b=this.dragStart;if(b.time&&!this.canZoomOut()&&(Math.abs(g.x-b.x)>2||Math.abs(g.y-b.y)>2))return;this.dragStart.time=0;const w=P=>{this.option("zoom",e)&&P&&typeof P=="string"&&/(iterateZoom)|(toggle(Zoom|Full|Cover|Max)|(zoomTo(Fit|Cover|Max)))/.test(P)&&typeof this[P]=="function"&&(e.preventDefault(),this[P]({event:e}))},E=this.option("click",e),C=this.option("dblClick",e);C?(this.clicks++,this.clicks==1&&(this.clickTimer=setTimeout(()=>{this.clicks===1?(this.emit("click",e),!e.defaultPrevented&&E&&w(E)):(this.emit("dblClick",e),e.defaultPrevented||w(C)),this.clicks=0,this.clickTimer=null},350))):(this.emit("click",e),!e.defaultPrevented&&E&&w(E))}addTrackingPoint(e){const n=this.trackingPoints.filter(i=>i.time>Date.now()-100);n.push(e),this.trackingPoints=n}onPointerDown(e,n,i){var r;if(this.option("touch",e)===!1)return!1;this.pwt=0,this.dragOffset={x:0,y:0,time:0},this.trackingPoints=[];const a=this.content.getBoundingClientRect();if(this.dragStart={x:a.x,y:a.y,top:a.top,left:a.left,time:Date.now()},this.clickTimer)return!1;if(this.panMode===fo&&this.targetScale>1)return e.preventDefault(),e.stopPropagation(),!1;const u=e.composedPath()[0];if(!i.length){if(["TEXTAREA","OPTION","INPUT","SELECT","VIDEO","IFRAME"].includes(u.nodeName)||u.closest("[contenteditable],[data-selectable],[data-draggable],[data-clickable],[data-panzoom-change],[data-panzoom-action]"))return!1;(r=window.getSelection())===null||r===void 0||r.removeAllRanges()}if(e.type==="mousedown")["A","BUTTON"].includes(u.nodeName)||e.preventDefault();else if(Math.abs(this.velocity.a)>.3)return!1;return this.target.e=this.current.e,this.target.f=this.current.f,this.stop(),this.isDragging||(this.isDragging=!0,this.addTrackingPoint(n),this.emit("touchStart",e)),!0}onPointerMove(e,n,i){if(this.option("touch",e)===!1||!this.isDragging||n.length<2&&this.panOnlyZoomed&&lt(this.targetScale)<=lt(this.minScale)||(this.emit("touchMove",e),e.defaultPrevented))return;this.addTrackingPoint(n[0]);const{content:r}=this,a=Q1(i[0],i[1]),u=Q1(n[0],n[1]);let l=0,g=0;if(n.length>1){const G=r.getBoundingClientRect();l=a.clientX-G.left-.5*G.width,g=a.clientY-G.top-.5*G.height}const b=J1(i[0],i[1]),w=J1(n[0],n[1]);let E=b?w/b:1,C=u.clientX-a.clientX,P=u.clientY-a.clientY;this.dragOffset.x+=C,this.dragOffset.y+=P,this.dragOffset.time=Date.now()-this.dragStart.time;let D=lt(this.targetScale)===lt(this.minScale)&&this.option("lockAxis");if(D&&!this.lockedAxis)if(D==="xy"||D==="y"||e.type==="touchmove"){if(Math.abs(this.dragOffset.x)<6&&Math.abs(this.dragOffset.y)<6)return void e.preventDefault();const G=Math.abs(180*Math.atan2(this.dragOffset.y,this.dragOffset.x)/Math.PI);this.lockedAxis=G>45&&G<135?"y":"x",this.dragOffset.x=0,this.dragOffset.y=0,C=0,P=0}else this.lockedAxis=D;if(jp(e.target,this.content)&&(D="x",this.dragOffset.y=0),D&&D!=="xy"&&this.lockedAxis!==D&&lt(this.targetScale)===lt(this.minScale))return;e.cancelable&&e.preventDefault(),this.container.classList.add(this.cn("isDragging"));const R=this.checkBounds(C,P);this.option("rubberband")?(this.isInfinite!=="x"&&(R.xDiff>0&&C<0||R.xDiff<0&&C>0)&&(C*=Math.max(0,.5-Math.abs(.75/this.contentRect.fitWidth*R.xDiff))),this.isInfinite!=="y"&&(R.yDiff>0&&P<0||R.yDiff<0&&P>0)&&(P*=Math.max(0,.5-Math.abs(.75/this.contentRect.fitHeight*R.yDiff)))):(R.xDiff&&(C=0),R.yDiff&&(P=0));const $=this.targetScale,W=this.minScale,te=this.maxScale;$<.5*W&&(E=Math.max(E,W)),$>1.5*te&&(E=Math.min(E,te)),this.lockedAxis==="y"&&lt($)===lt(W)&&(C=0),this.lockedAxis==="x"&&lt($)===lt(W)&&(P=0),this.applyChange({originX:l,originY:g,panX:C,panY:P,scale:E,friction:this.option("dragFriction"),ignoreBounds:!0})}onPointerUp(e,n,i){if(i.length)return this.dragOffset.x=0,this.dragOffset.y=0,void(this.trackingPoints=[]);this.container.classList.remove(this.cn("isDragging")),this.isDragging&&(this.addTrackingPoint(n),this.panOnlyZoomed&&this.contentRect.width-this.contentRect.fitWidth<1&&this.contentRect.height-this.contentRect.fitHeight<1&&(this.trackingPoints=[]),jp(e.target,this.content)&&this.lockedAxis==="y"&&(this.trackingPoints=[]),this.emit("touchEnd",e),this.isDragging=!1,this.lockedAxis=!1,this.state!==In.Destroy&&(e.defaultPrevented||this.startDecelAnim()))}startDecelAnim(){var e;const n=this.isScaling;this.rAF&&(cancelAnimationFrame(this.rAF),this.rAF=null),this.isBouncingX=!1,this.isBouncingY=!1;for(const G of Ps)this.velocity[G]=0;this.target.e=this.current.e,this.target.f=this.current.f,En(this.container,"is-scaling"),En(this.container,"is-animating"),this.isTicking=!1;const{trackingPoints:i}=this,r=i[0],a=i[i.length-1];let u=0,l=0,g=0;a&&r&&(u=a.clientX-r.clientX,l=a.clientY-r.clientY,g=a.time-r.time);const b=((e=window.visualViewport)===null||e===void 0?void 0:e.scale)||1;b!==1&&(u*=b,l*=b);let w=0,E=0,C=0,P=0,D=this.option("decelFriction");const R=this.targetScale;if(g>0){C=Math.abs(u)>3?u/(g/30):0,P=Math.abs(l)>3?l/(g/30):0;const G=this.option("maxVelocity");G&&(C=Math.max(Math.min(C,G),-1*G),P=Math.max(Math.min(P,G),-1*G))}C&&(w=C/(1/(1-D)-1)),P&&(E=P/(1/(1-D)-1)),(this.option("lockAxis")==="y"||this.option("lockAxis")==="xy"&&this.lockedAxis==="y"&&lt(R)===this.minScale)&&(w=C=0),(this.option("lockAxis")==="x"||this.option("lockAxis")==="xy"&&this.lockedAxis==="x"&&lt(R)===this.minScale)&&(E=P=0);const $=this.dragOffset.x,W=this.dragOffset.y,te=this.option("dragMinThreshold")||0;Math.abs($)<te&&Math.abs(W)<te&&(w=E=0,C=P=0),(this.option("zoom")&&(R<this.minScale-1e-5||R>this.maxScale+1e-5)||n&&!w&&!E)&&(D=.35),this.applyChange({panX:w,panY:E,friction:D}),this.emit("decel",C,P,$,W)}onWheel(e){var n=[-e.deltaX||0,-e.deltaY||0,-e.detail||0].reduce(function(a,u){return Math.abs(u)>Math.abs(a)?u:a});const i=Math.max(-1,Math.min(1,n));if(this.emit("wheel",e,i),this.panMode===fo||e.defaultPrevented)return;const r=this.option("wheel");r==="pan"?(e.preventDefault(),this.panOnlyZoomed&&!this.canZoomOut()||this.applyChange({panX:2*-e.deltaX,panY:2*-e.deltaY,bounce:!1})):r==="zoom"&&this.option("zoom")!==!1&&this.zoomWithWheel(e)}onMouseMove(e){this.panWithMouse(e)}onKeydown(e){e.key==="Escape"&&this.toggleFS()}onResize(){this.updateMetrics(),this.checkBounds().inBounds||this.requestTick()}setTransform(){this.emit("beforeTransform");const{current:e,target:n,content:i,contentRect:r}=this,a=Object.assign({},Hp);for(const $ of Ps){const W=$=="e"||$==="f"?qp:pz;a[$]=lt(e[$],W),Math.abs(n[$]-e[$])<($=="e"||$==="f"?.51:.001)&&(e[$]=n[$])}let{a:u,b:l,c:g,d:b,e:w,f:E}=a,C=`matrix(${u}, ${l}, ${g}, ${b}, ${w}, ${E})`,P=i.parentElement instanceof HTMLPictureElement?i.parentElement:i;if(this.option("transformParent")&&(P=P.parentElement||P),P.style.transform===C)return;P.style.transform=C;const{contentWidth:D,contentHeight:R}=this.calculateContentDim();r.width=D,r.height=R,this.emit("afterTransform")}updateMetrics(e=!1){var n;if(!this||this.state===In.Destroy||this.isContentLoading)return;const i=Math.max(1,((n=window.visualViewport)===null||n===void 0?void 0:n.scale)||1),{container:r,content:a}=this,u=a instanceof HTMLImageElement,l=r.getBoundingClientRect(),g=getComputedStyle(this.container);let b=l.width*i,w=l.height*i;const E=parseFloat(g.paddingTop)+parseFloat(g.paddingBottom),C=b-(parseFloat(g.paddingLeft)+parseFloat(g.paddingRight)),P=w-E;this.containerRect={width:b,height:w,innerWidth:C,innerHeight:P};const D=parseFloat(a.dataset.width||"")||(ot=>{let Tt=0;return Tt=ot instanceof HTMLImageElement?ot.naturalWidth:ot instanceof SVGElement?ot.width.baseVal.value:Math.max(ot.offsetWidth,ot.scrollWidth),Tt||0})(a),R=parseFloat(a.dataset.height||"")||(ot=>{let Tt=0;return Tt=ot instanceof HTMLImageElement?ot.naturalHeight:ot instanceof SVGElement?ot.height.baseVal.value:Math.max(ot.offsetHeight,ot.scrollHeight),Tt||0})(a);let $=this.option("width",D)||mo,W=this.option("height",R)||mo;const te=$===mo,G=W===mo;typeof $!="number"&&($=D),typeof W!="number"&&(W=R),te&&($=D*(W/R)),G&&(W=R/(D/$));let Q=a.parentElement instanceof HTMLPictureElement?a.parentElement:a;this.option("transformParent")&&(Q=Q.parentElement||Q);const Ie=Q.getAttribute("style")||"";Q.style.setProperty("transform","none","important"),u&&(Q.style.width="",Q.style.height=""),Q.offsetHeight;const ve=a.getBoundingClientRect();let Se=ve.width*i,Ne=ve.height*i,Ae=Se,$e=Ne;Se=Math.min(Se,$),Ne=Math.min(Ne,W),u?{width:Se,height:Ne}=((ot,Tt,Nt,Vt)=>{const Ft=Nt/ot,Ht=Vt/Tt,Cn=Math.min(Ft,Ht);return{width:ot*=Cn,height:Tt*=Cn}})($,W,Se,Ne):(Se=Math.min(Se,$),Ne=Math.min(Ne,W));let Xe=.5*($e-Ne),Pt=.5*(Ae-Se);this.contentRect=Object.assign(Object.assign({},this.contentRect),{top:ve.top-l.top+Xe,bottom:l.bottom-ve.bottom+Xe,left:ve.left-l.left+Pt,right:l.right-ve.right+Pt,fitWidth:Se,fitHeight:Ne,width:Se,height:Ne,fullWidth:$,fullHeight:W}),Q.style.cssText=Ie,u&&(Q.style.width=`${Se}px`,Q.style.height=`${Ne}px`),this.setTransform(),e!==!0&&this.emit("refresh"),this.ignoreBounds||(lt(this.targetScale)<lt(this.minScale)?this.zoomTo(this.minScale,{friction:0}):this.targetScale>this.maxScale?this.zoomTo(this.maxScale,{friction:0}):this.state===In.Init||this.checkBounds().inBounds||this.requestTick()),this.updateControls()}calculateBounds(){const{contentWidth:e,contentHeight:n}=this.calculateContentDim(this.target),{targetScale:i,lockedAxis:r}=this,{fitWidth:a,fitHeight:u}=this.contentRect;let l=0,g=0,b=0,w=0;const E=this.option("infinite");if(E===!0||r&&E===r)l=-1/0,b=1/0,g=-1/0,w=1/0;else{let{containerRect:C,contentRect:P}=this,D=lt(a*i,qp),R=lt(u*i,qp),{innerWidth:$,innerHeight:W}=C;if(C.width===D&&($=C.width),C.width===R&&(W=C.height),e>$){b=.5*(e-$),l=-1*b;let te=.5*(P.right-P.left);l+=te,b+=te}if(a>$&&e<$&&(l-=.5*(a-$),b-=.5*(a-$)),n>W){w=.5*(n-W),g=-1*w;let te=.5*(P.bottom-P.top);g+=te,w+=te}u>W&&n<W&&(l-=.5*(u-W),b-=.5*(u-W))}return{x:{min:l,max:b},y:{min:g,max:w}}}getBounds(){const e=this.option("bounds");return e!==mo?e:this.calculateBounds()}updateControls(){const e=this,n=e.container,{panMode:i,contentRect:r,targetScale:a,minScale:u}=e;let l=u,g=e.option("click")||!1;g&&(l=e.getNextScale(g));let b=e.canZoomIn(),w=e.canZoomOut(),E=i===nv&&!!this.option("touch"),C=w&&E;if(E&&(lt(a)<lt(u)&&!this.panOnlyZoomed&&(C=!0),(lt(r.width,1)>lt(r.fitWidth,1)||lt(r.height,1)>lt(r.fitHeight,1))&&(C=!0)),lt(r.width*a,1)<lt(r.fitWidth,1)&&(C=!1),i===fo&&(C=!1),ts(n,this.cn("isDraggable"),C),!this.option("zoom"))return;let P=b&&lt(l)>lt(a),D=!P&&!C&&w&&lt(l)<lt(a);ts(n,this.cn("canZoomIn"),P),ts(n,this.cn("canZoomOut"),D);for(const R of n.querySelectorAll("[data-panzoom-action]")){let $=!1,W=!1;switch(R.dataset.panzoomAction){case"zoomIn":b?$=!0:W=!0;break;case"zoomOut":w?$=!0:W=!0;break;case"toggleZoom":case"iterateZoom":b||w?$=!0:W=!0;const te=R.querySelector("g");te&&(te.style.display=b?"":"none")}$?(R.removeAttribute("disabled"),R.removeAttribute("tabindex")):W&&(R.setAttribute("disabled",""),R.setAttribute("tabindex","-1"))}}panTo({x:e=this.target.e,y:n=this.target.f,scale:i=this.targetScale,friction:r=this.option("friction"),angle:a=0,originX:u=0,originY:l=0,flipX:g=!1,flipY:b=!1,ignoreBounds:w=!1}){this.state!==In.Destroy&&this.applyChange({panX:e-this.target.e,panY:n-this.target.f,scale:i/this.targetScale,angle:a,originX:u,originY:l,friction:r,flipX:g,flipY:b,ignoreBounds:w})}applyChange({panX:e=0,panY:n=0,scale:i=1,angle:r=0,originX:a=-this.current.e,originY:u=-this.current.f,friction:l=this.option("friction"),flipX:g=!1,flipY:b=!1,ignoreBounds:w=!1,bounce:E=this.option("bounce")}){const C=this.state;if(C===In.Destroy)return;this.rAF&&(cancelAnimationFrame(this.rAF),this.rAF=null),this.friction=l||0,this.ignoreBounds=w;const{current:P}=this,D=P.e,R=P.f,$=this.getMatrix(this.target);let W=new DOMMatrix().translate(D,R).translate(a,u).translate(e,n);if(this.option("zoom")){if(!w){const te=this.targetScale,G=this.minScale,Q=this.maxScale;te*i<G&&(i=G/te),te*i>Q&&(i=Q/te)}W=W.scale(i)}W=W.translate(-a,-u).translate(-D,-R).multiply($),r&&(W=W.rotate(r)),g&&(W=W.scale(-1,1)),b&&(W=W.scale(1,-1));for(const te of Ps)te!=="e"&&te!=="f"&&(W[te]>this.minScale+1e-5||W[te]<this.minScale-1e-5)?this.target[te]=W[te]:this.target[te]=lt(W[te],qp);(this.targetScale<this.scale||Math.abs(i-1)>.1||this.panMode===fo||E===!1)&&!w&&this.clampTargetBounds(),C===In.Init?this.animate():this.isResting||(this.state=In.Panning,this.requestTick())}stop(e=!1){if(this.state===In.Init||this.state===In.Destroy)return;const n=this.isTicking;this.rAF&&(cancelAnimationFrame(this.rAF),this.rAF=null),this.isBouncingX=!1,this.isBouncingY=!1;for(const i of Ps)this.velocity[i]=0,e==="current"?this.current[i]=this.target[i]:e==="target"&&(this.target[i]=this.current[i]);this.setTransform(),En(this.container,"is-scaling"),En(this.container,"is-animating"),this.isTicking=!1,this.state=In.Ready,n&&(this.emit("endAnimation"),this.updateControls())}requestTick(){this.isTicking||(this.emit("startAnimation"),this.updateControls(),Ct(this.container,"is-animating"),this.isScaling&&Ct(this.container,"is-scaling")),this.isTicking=!0,this.rAF||(this.rAF=requestAnimationFrame(()=>this.animate()))}panWithMouse(e,n=this.option("mouseMoveFriction")){if(this.pmme=e,this.panMode!==fo||!e||lt(this.targetScale)<=lt(this.minScale))return;this.emit("mouseMove",e);const{container:i,containerRect:r,contentRect:a}=this,u=r.width,l=r.height,g=i.getBoundingClientRect(),b=(e.clientX||0)-g.left,w=(e.clientY||0)-g.top;let{contentWidth:E,contentHeight:C}=this.calculateContentDim(this.target);const P=this.option("mouseMoveFactor");P>1&&(E!==u&&(E*=P),C!==l&&(C*=P));let D=.5*(E-u)-b/u*100/100*(E-u);D+=.5*(a.right-a.left);let R=.5*(C-l)-w/l*100/100*(C-l);R+=.5*(a.bottom-a.top),this.applyChange({panX:D-this.target.e,panY:R-this.target.f,friction:n})}zoomWithWheel(e){if(this.state===In.Destroy||this.state===In.Init)return;const n=Date.now();if(n-this.pwt<45)return void e.preventDefault();this.pwt=n;var i=[-e.deltaX||0,-e.deltaY||0,-e.detail||0].reduce(function(b,w){return Math.abs(w)>Math.abs(b)?w:b});const r=Math.max(-1,Math.min(1,i)),{targetScale:a,maxScale:u,minScale:l}=this;let g=a*(100+45*r)/100;lt(g)<lt(l)&&lt(a)<=lt(l)?(this.cwd+=Math.abs(r),g=l):lt(g)>lt(u)&&lt(a)>=lt(u)?(this.cwd+=Math.abs(r),g=u):(this.cwd=0,g=Math.max(Math.min(g,u),l)),this.cwd>this.option("wheelLimit")||(e.preventDefault(),lt(g)!==lt(a)&&this.zoomTo(g,{event:e}))}canZoomIn(){return this.option("zoom")&&(lt(this.contentRect.width,1)<lt(this.contentRect.fitWidth,1)||lt(this.targetScale)<lt(this.maxScale))}canZoomOut(){return this.option("zoom")&&lt(this.targetScale)>lt(this.minScale)}zoomIn(e=1.25,n){this.zoomTo(this.targetScale*e,n)}zoomOut(e=.8,n){this.zoomTo(this.targetScale*e,n)}zoomToFit(e){this.zoomTo("fit",e)}zoomToCover(e){this.zoomTo("cover",e)}zoomToFull(e){this.zoomTo("full",e)}zoomToMax(e){this.zoomTo("max",e)}toggleZoom(e){this.zoomTo(this.getNextScale("toggleZoom"),e)}toggleMax(e){this.zoomTo(this.getNextScale("toggleMax"),e)}toggleCover(e){this.zoomTo(this.getNextScale("toggleCover"),e)}iterateZoom(e){this.zoomTo("next",e)}zoomTo(e=1,{friction:n=mo,originX:i=mo,originY:r=mo,event:a}={}){if(this.isContentLoading||this.state===In.Destroy)return;const{targetScale:u,fullScale:l,maxScale:g,coverScale:b}=this;if(this.stop(),this.panMode===fo&&(a=this.pmme||a),a||i===mo||r===mo){const E=this.content.getBoundingClientRect(),C=this.container.getBoundingClientRect(),P=a?a.clientX:C.left+.5*C.width,D=a?a.clientY:C.top+.5*C.height;i=P-E.left-.5*E.width,r=D-E.top-.5*E.height}let w=1;typeof e=="number"?w=e:e==="full"?w=l:e==="cover"?w=b:e==="max"?w=g:e==="fit"?w=1:e==="next"&&(w=this.getNextScale("iterateZoom")),w=w/u||1,n=n===mo?w>1?.15:.25:n,this.applyChange({scale:w,originX:i,originY:r,friction:n}),a&&this.panMode===fo&&this.panWithMouse(a,n)}rotateCCW(){this.applyChange({angle:-90})}rotateCW(){this.applyChange({angle:90})}flipX(){this.applyChange({flipX:!0})}flipY(){this.applyChange({flipY:!0})}fitX(){this.stop("target");const{containerRect:e,contentRect:n,target:i}=this;this.applyChange({panX:.5*e.width-(n.left+.5*n.fitWidth)-i.e,panY:.5*e.height-(n.top+.5*n.fitHeight)-i.f,scale:e.width/n.fitWidth/this.targetScale,originX:0,originY:0,ignoreBounds:!0})}fitY(){this.stop("target");const{containerRect:e,contentRect:n,target:i}=this;this.applyChange({panX:.5*e.width-(n.left+.5*n.fitWidth)-i.e,panY:.5*e.innerHeight-(n.top+.5*n.fitHeight)-i.f,scale:e.height/n.fitHeight/this.targetScale,originX:0,originY:0,ignoreBounds:!0})}toggleFS(){const{container:e}=this,n=this.cn("inFullscreen"),i=this.cn("htmlHasFullscreen");e.classList.toggle(n);const r=e.classList.contains(n);r?(document.documentElement.classList.add(i),document.addEventListener("keydown",this.onKeydown,!0)):(document.documentElement.classList.remove(i),document.removeEventListener("keydown",this.onKeydown,!0)),this.updateMetrics(),this.emit(r?"enterFS":"exitFS")}getMatrix(e=this.current){const{a:n,b:i,c:r,d:a,e:u,f:l}=e;return new DOMMatrix([n,i,r,a,u,l])}reset(e){if(this.state!==In.Init&&this.state!==In.Destroy){this.stop("current");for(const n of Ps)this.target[n]=Hp[n];this.target.a=this.minScale,this.target.d=this.minScale,this.clampTargetBounds(),this.isResting||(this.friction=e===void 0?this.option("friction"):e,this.state=In.Panning,this.requestTick())}}destroy(){this.stop(),this.state=In.Destroy,this.detachEvents(),this.detachObserver();const{container:e,content:n}=this,i=this.option("classes")||{};for(const r of Object.values(i))e.classList.remove(r+"");n&&(n.removeEventListener("load",this.onLoad),n.removeEventListener("error",this.onError)),this.detachPlugins()}}Object.defineProperty(ha,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:dz}),Object.defineProperty(ha,"Plugins",{enumerable:!0,configurable:!0,writable:!0,value:{}});const rv=function(t,e){let n=!0;return(...i)=>{n&&(n=!1,t(...i),setTimeout(()=>{n=!0},e))}},ov=(t,e)=>{let n=[];return t.childNodes.forEach(i=>{i.nodeType!==Node.ELEMENT_NODE||e&&!i.matches(e)||n.push(i)}),n},fz={viewport:null,track:null,enabled:!0,slides:[],axis:"x",transition:"fade",preload:1,slidesPerPage:"auto",initialPage:0,friction:.12,Panzoom:{decelFriction:.12},center:!0,infinite:!0,fill:!0,dragFree:!1,adaptiveHeight:!1,direction:"ltr",classes:{container:"f-carousel",viewport:"f-carousel__viewport",track:"f-carousel__track",slide:"f-carousel__slide",isLTR:"is-ltr",isRTL:"is-rtl",isHorizontal:"is-horizontal",isVertical:"is-vertical",inTransition:"in-transition",isSelected:"is-selected"},l10n:{NEXT:"Next slide",PREV:"Previous slide",GOTO:"Go to slide #%d"}};var di;(function(t){t[t.Init=0]="Init",t[t.Ready=1]="Ready",t[t.Destroy=2]="Destroy"})(di||(di={}));const gy=t=>{if(typeof t=="string"||t instanceof HTMLElement)t={html:t};else{const e=t.thumb;e!==void 0&&(typeof e=="string"&&(t.thumbSrc=e),e instanceof HTMLImageElement&&(t.thumbEl=e,t.thumbElSrc=e.src,t.thumbSrc=e.src),delete t.thumb)}return Object.assign({html:"",el:null,isDom:!1,class:"",customClass:"",index:-1,dim:0,gap:0,pos:0,transition:!1},t)},mz=(t={})=>Object.assign({index:-1,slides:[],dim:0,pos:-1},t);class Vo extends Up{constructor(e,n){super(n),Object.defineProperty(this,"instance",{enumerable:!0,configurable:!0,writable:!0,value:e})}attach(){}detach(){}}const gz={classes:{list:"f-carousel__dots",isDynamic:"is-dynamic",hasDots:"has-dots",dot:"f-carousel__dot",isBeforePrev:"is-before-prev",isPrev:"is-prev",isCurrent:"is-current",isNext:"is-next",isAfterNext:"is-after-next"},dotTpl:'<button type="button" data-carousel-page="%i" aria-label="{{GOTO}}"><span class="f-carousel__dot" aria-hidden="true"></span></button>',dynamicFrom:11,maxCount:1/0,minCount:2};class sv extends Vo{constructor(){super(...arguments),Object.defineProperty(this,"isDynamic",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"list",{enumerable:!0,configurable:!0,writable:!0,value:null})}onRefresh(){this.refresh()}build(){let e=this.list;if(!e){e=document.createElement("ul"),Ct(e,this.cn("list")),e.setAttribute("role","tablist");const n=this.instance.container;n.appendChild(e),Ct(n,this.cn("hasDots")),this.list=e}return e}refresh(){var e;const n=this.instance.pages.length,i=Math.min(2,this.option("minCount")),r=Math.max(2e3,this.option("maxCount")),a=this.option("dynamicFrom");if(n<i||n>r)return void this.cleanup();const u=typeof a=="number"&&n>5&&n>=a,l=!this.list||this.isDynamic!==u||this.list.children.length!==n;l&&this.cleanup();const g=this.build();if(ts(g,this.cn("isDynamic"),!!u),l)for(let E=0;E<n;E++)g.append(this.createItem(E));let b,w=0;for(const E of[...g.children]){const C=w===this.instance.page;C&&(b=E),ts(E,this.cn("isCurrent"),C),(e=E.children[0])===null||e===void 0||e.setAttribute("aria-selected",C?"true":"false");for(const P of["isBeforePrev","isPrev","isNext","isAfterNext"])En(E,this.cn(P));w++}if(b=b||g.firstChild,u&&b){const E=b.previousElementSibling,C=E&&E.previousElementSibling;Ct(E,this.cn("isPrev")),Ct(C,this.cn("isBeforePrev"));const P=b.nextElementSibling,D=P&&P.nextElementSibling;Ct(P,this.cn("isNext")),Ct(D,this.cn("isAfterNext"))}this.isDynamic=u}createItem(e=0){var n;const i=document.createElement("li");i.setAttribute("role","presentation");const r=es(this.instance.localize(this.option("dotTpl"),[["%d",e+1]]).replace(/\%i/g,e+""));return i.appendChild(r),(n=i.children[0])===null||n===void 0||n.setAttribute("role","tab"),i}cleanup(){this.list&&(this.list.remove(),this.list=null),this.isDynamic=!1,En(this.instance.container,this.cn("hasDots"))}attach(){this.instance.on(["refresh","change"],this.onRefresh)}detach(){this.instance.off(["refresh","change"],this.onRefresh),this.cleanup()}}Object.defineProperty(sv,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:gz});const Wp="disabled",Gp="next",av="prev";class lv extends Vo{constructor(){super(...arguments),Object.defineProperty(this,"container",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"prev",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"next",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"isDom",{enumerable:!0,configurable:!0,writable:!0,value:!1})}onRefresh(){const e=this.instance,n=e.pages.length,i=e.page;if(n<2)return void this.cleanup();this.build();let r=this.prev,a=this.next;r&&a&&(r.removeAttribute(Wp),a.removeAttribute(Wp),e.isInfinite||(i<=0&&r.setAttribute(Wp,""),i>=n-1&&a.setAttribute(Wp,"")))}addBtn(e){var n;const i=this.instance,r=document.createElement("button");r.setAttribute("tabindex","0"),r.setAttribute("title",i.localize(`{{${e.toUpperCase()}}}`)),Ct(r,this.cn("button")+" "+this.cn(e===Gp?"isNext":"isPrev"));const a=i.isRTL?e===Gp?av:Gp:e;var u;return r.innerHTML=i.localize(this.option(`${a}Tpl`)),r.dataset[`carousel${u=e,u?u.match("^[a-z]")?u.charAt(0).toUpperCase()+u.substring(1):u:""}`]="true",(n=this.container)===null||n===void 0||n.appendChild(r),r}build(){const e=this.instance.container,n=this.cn("container");let{container:i,prev:r,next:a}=this;i||(i=e.querySelector("."+n),this.isDom=!!i),i||(i=document.createElement("div"),Ct(i,n),e.appendChild(i)),this.container=i,a||(a=i.querySelector("[data-carousel-next]")),a||(a=this.addBtn(Gp)),this.next=a,r||(r=i.querySelector("[data-carousel-prev]")),r||(r=this.addBtn(av)),this.prev=r}cleanup(){this.isDom||(this.prev&&this.prev.remove(),this.next&&this.next.remove(),this.container&&this.container.remove()),this.prev=null,this.next=null,this.container=null,this.isDom=!1}attach(){this.instance.on(["refresh","change"],this.onRefresh)}detach(){this.instance.off(["refresh","change"],this.onRefresh),this.cleanup()}}Object.defineProperty(lv,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{classes:{container:"f-carousel__nav",button:"f-button",isNext:"is-next",isPrev:"is-prev"},nextTpl:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" tabindex="-1"><path d="M9 3l9 9-9 9"/></svg>',prevTpl:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" tabindex="-1"><path d="M15 3l-9 9 9 9"/></svg>'}});class cv extends Vo{constructor(){super(...arguments),Object.defineProperty(this,"selectedIndex",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"target",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"nav",{enumerable:!0,configurable:!0,writable:!0,value:null})}addAsTargetFor(e){this.target=this.instance,this.nav=e,this.attachEvents()}addAsNavFor(e){this.nav=this.instance,this.target=e,this.attachEvents()}attachEvents(){const{nav:e,target:n}=this;e&&n&&(e.options.initialSlide=n.options.initialPage,e.state===di.Ready?this.onNavReady(e):e.on("ready",this.onNavReady),n.state===di.Ready?this.onTargetReady(n):n.on("ready",this.onTargetReady))}onNavReady(e){e.on("createSlide",this.onNavCreateSlide),e.on("Panzoom.click",this.onNavClick),e.on("Panzoom.touchEnd",this.onNavTouch),this.onTargetChange()}onTargetReady(e){e.on("change",this.onTargetChange),e.on("Panzoom.refresh",this.onTargetChange),this.onTargetChange()}onNavClick(e,n,i){this.onNavTouch(e,e.panzoom,i)}onNavTouch(e,n,i){var r,a;if(Math.abs(n.dragOffset.x)>3||Math.abs(n.dragOffset.y)>3)return;const u=i.target,{nav:l,target:g}=this;if(!l||!g||!u)return;const b=u.closest("[data-index]");if(i.stopPropagation(),i.preventDefault(),!b)return;const w=parseInt(b.dataset.index||"",10)||0,E=g.getPageForSlide(w),C=l.getPageForSlide(w);l.slideTo(C),g.slideTo(E,{friction:((a=(r=this.nav)===null||r===void 0?void 0:r.plugins)===null||a===void 0?void 0:a.Sync.option("friction"))||0}),this.markSelectedSlide(w)}onNavCreateSlide(e,n){n.index===this.selectedIndex&&this.markSelectedSlide(n.index)}onTargetChange(){var e,n;const{target:i,nav:r}=this;if(!i||!r||r.state!==di.Ready||i.state!==di.Ready)return;const a=(n=(e=i.pages[i.page])===null||e===void 0?void 0:e.slides[0])===null||n===void 0?void 0:n.index,u=r.getPageForSlide(a);this.markSelectedSlide(a),r.slideTo(u,r.prevPage===null&&i.prevPage===null?{friction:0}:void 0)}markSelectedSlide(e){const n=this.nav;n&&n.state===di.Ready&&(this.selectedIndex=e,[...n.slides].map(i=>{i.el&&i.el.classList[i.index===e?"add":"remove"]("is-nav-selected")}))}attach(){const e=this;let n=e.options.target,i=e.options.nav;n?e.addAsNavFor(n):i&&e.addAsTargetFor(i)}detach(){const e=this,n=e.nav,i=e.target;n&&(n.off("ready",e.onNavReady),n.off("createSlide",e.onNavCreateSlide),n.off("Panzoom.click",e.onNavClick),n.off("Panzoom.touchEnd",e.onNavTouch)),e.nav=null,i&&(i.off("ready",e.onTargetReady),i.off("refresh",e.onTargetChange),i.off("change",e.onTargetChange)),e.target=null}}Object.defineProperty(cv,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{friction:.35}});const yz={Navigation:lv,Dots:sv,Sync:cv},Zp="animationend",uv="isSelected",Yp="slide";class da extends dy{get axis(){return this.isHorizontal?"e":"f"}get isEnabled(){return this.state===di.Ready}get isInfinite(){let e=!1;const{contentDim:n,viewportDim:i,pages:r,slides:a}=this,u=a[0];return r.length>=2&&u&&n+u.dim>=i&&(e=this.option("infinite")),e}get isRTL(){return this.option("direction")==="rtl"}get isHorizontal(){return this.option("axis")==="x"}constructor(e,n={},i={}){if(super(),Object.defineProperty(this,"bp",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"lp",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"userOptions",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"userPlugins",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:di.Init}),Object.defineProperty(this,"page",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"prevPage",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"container",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"viewport",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"track",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"slides",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"pages",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"panzoom",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"inTransition",{enumerable:!0,configurable:!0,writable:!0,value:new Set}),Object.defineProperty(this,"contentDim",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"viewportDim",{enumerable:!0,configurable:!0,writable:!0,value:0}),typeof e=="string"&&(e=document.querySelector(e)),!e||!Mr(e))throw new Error("No Element found");this.container=e,this.slideNext=rv(this.slideNext.bind(this),150),this.slidePrev=rv(this.slidePrev.bind(this),150),this.userOptions=n,this.userPlugins=i,queueMicrotask(()=>{this.processOptions()})}processOptions(){var e,n;const i=Tr({},da.defaults,this.userOptions);let r="";const a=i.breakpoints;if(a&&uy(a))for(const[u,l]of Object.entries(a))window.matchMedia(u).matches&&uy(l)&&(r+=u,Tr(i,l));r===this.bp&&this.state!==di.Init||(this.bp=r,this.state===di.Ready&&(i.initialSlide=((n=(e=this.pages[this.page])===null||e===void 0?void 0:e.slides[0])===null||n===void 0?void 0:n.index)||0),this.state!==di.Init&&this.destroy(),super.setOptions(i),this.option("enabled")===!1?this.attachEvents():setTimeout(()=>{this.init()},0))}init(){this.state=di.Init,this.emit("init"),this.attachPlugins(Object.assign(Object.assign({},da.Plugins),this.userPlugins)),this.emit("attachPlugins"),this.initLayout(),this.initSlides(),this.updateMetrics(),this.setInitialPosition(),this.initPanzoom(),this.attachEvents(),this.state=di.Ready,this.emit("ready")}initLayout(){const{container:e}=this,n=this.option("classes");Ct(e,this.cn("container")),ts(e,n.isLTR,!this.isRTL),ts(e,n.isRTL,this.isRTL),ts(e,n.isVertical,!this.isHorizontal),ts(e,n.isHorizontal,this.isHorizontal);let i=this.option("viewport")||e.querySelector(`.${n.viewport}`);i||(i=document.createElement("div"),Ct(i,n.viewport),i.append(...ov(e,`.${n.slide}`)),e.prepend(i)),i.addEventListener("scroll",this.onScroll);let r=this.option("track")||e.querySelector(`.${n.track}`);r||(r=document.createElement("div"),Ct(r,n.track),r.append(...Array.from(i.childNodes))),r.setAttribute("aria-live","polite"),i.contains(r)||i.prepend(r),this.viewport=i,this.track=r,this.emit("initLayout")}initSlides(){const{track:e}=this;if(!e)return;const n=[...this.slides],i=[];[...ov(e,`.${this.cn(Yp)}`)].forEach(r=>{if(Mr(r)){const a=gy({el:r,isDom:!0,index:this.slides.length});i.push(a)}});for(let r of[...this.option("slides",[])||[],...n])i.push(gy(r));this.slides=i;for(let r=0;r<this.slides.length;r++)this.slides[r].index=r;for(const r of i)this.emit("beforeInitSlide",r,r.index),this.emit("initSlide",r,r.index);this.emit("initSlides")}setInitialPage(){const e=this.option("initialSlide");this.page=typeof e=="number"?this.getPageForSlide(e):parseInt(this.option("initialPage",0)+"",10)||0}setInitialPosition(){const{track:e,pages:n,isHorizontal:i}=this;if(!e||!n.length)return;let r=this.page;n[r]||(this.page=r=0);const a=(n[r].pos||0)*(this.isRTL&&i?1:-1),u=i?`${a}px`:"0",l=i?"0":`${a}px`;e.style.transform=`translate3d(${u}, ${l}, 0) scale(1)`,this.option("adaptiveHeight")&&this.setViewportHeight()}initPanzoom(){this.panzoom&&(this.panzoom.destroy(),this.panzoom=null);const e=this.option("Panzoom")||{};this.panzoom=new ha(this.viewport,Tr({},{content:this.track,zoom:!1,panOnlyZoomed:!1,lockAxis:this.isHorizontal?"x":"y",infinite:this.isInfinite,click:!1,dblClick:!1,touch:n=>!(this.pages.length<2&&!n.options.infinite),bounds:()=>this.getBounds(),maxVelocity:n=>Math.abs(n.target[this.axis]-n.current[this.axis])<2*this.viewportDim?100:0},e)),this.panzoom.on("*",(n,i,...r)=>{this.emit(`Panzoom.${i}`,n,...r)}),this.panzoom.on("decel",this.onDecel),this.panzoom.on("refresh",this.onRefresh),this.panzoom.on("beforeTransform",this.onBeforeTransform),this.panzoom.on("endAnimation",this.onEndAnimation)}attachEvents(){const e=this.container;e&&(e.addEventListener("click",this.onClick,{passive:!1,capture:!1}),e.addEventListener("slideTo",this.onSlideTo)),window.addEventListener("resize",this.onResize)}createPages(){let e=[];const{contentDim:n,viewportDim:i}=this;let r=this.option("slidesPerPage");r=(r==="auto"||n<=i)&&this.option("fill")!==!1?1/0:parseFloat(r+"");let a=0,u=0,l=0;for(const g of this.slides)(!e.length||u+g.dim-i>.05||l>=r)&&(e.push(mz()),a=e.length-1,u=0,l=0),e[a].slides.push(g),u+=g.dim+g.gap,l++;return e}processPages(){const e=this.pages,{contentDim:n,viewportDim:i,isInfinite:r}=this,a=this.option("center"),u=this.option("fill"),l=u&&a&&n>i&&!r;if(e.forEach((w,E)=>{var C;w.index=E,w.pos=((C=w.slides[0])===null||C===void 0?void 0:C.pos)||0,w.dim=0;for(const[P,D]of w.slides.entries())w.dim+=D.dim,P<w.slides.length-1&&(w.dim+=D.gap);l&&w.pos+.5*w.dim<.5*i?w.pos=0:l&&w.pos+.5*w.dim>=n-.5*i?w.pos=n-i:a&&(w.pos+=-.5*(i-w.dim))}),e.forEach(w=>{u&&!r&&n>i&&(w.pos=Math.max(w.pos,0),w.pos=Math.min(w.pos,n-i)),w.pos=lt(w.pos,1e3),w.dim=lt(w.dim,1e3),Math.abs(w.pos)<=.1&&(w.pos=0)}),r)return e;const g=[];let b;return e.forEach(w=>{const E=Object.assign({},w);b&&E.pos===b.pos?(b.dim+=E.dim,b.slides=[...b.slides,...E.slides]):(E.index=g.length,b=E,g.push(E))}),g}getPageFromIndex(e=0){const n=this.pages.length;let i;return e=parseInt((e||0).toString())||0,i=this.isInfinite?(e%n+n)%n:Math.max(Math.min(e,n-1),0),i}getSlideMetrics(e){var n,i;const r=this.isHorizontal?"width":"height";let a=0,u=0,l=e.el;const g=!(!l||l.parentNode);if(l?a=parseFloat(l.dataset[r]||"")||0:(l=document.createElement("div"),l.style.visibility="hidden",(this.track||document.body).prepend(l)),Ct(l,this.cn(Yp)+" "+e.class+" "+e.customClass),a)l.style[r]=`${a}px`,l.style[r==="width"?"height":"width"]="";else{g&&(this.track||document.body).prepend(l),a=l.getBoundingClientRect()[r]*Math.max(1,((n=window.visualViewport)===null||n===void 0?void 0:n.scale)||1);let w=l[this.isHorizontal?"offsetWidth":"offsetHeight"];w-1>a&&(a=w)}const b=getComputedStyle(l);return b.boxSizing==="content-box"&&(this.isHorizontal?(a+=parseFloat(b.paddingLeft)||0,a+=parseFloat(b.paddingRight)||0):(a+=parseFloat(b.paddingTop)||0,a+=parseFloat(b.paddingBottom)||0)),u=parseFloat(b[this.isHorizontal?"marginRight":"marginBottom"])||0,g?(i=l.parentElement)===null||i===void 0||i.removeChild(l):e.el||l.remove(),{dim:lt(a,1e3),gap:lt(u,1e3)}}getBounds(){const{isInfinite:e,isRTL:n,isHorizontal:i,pages:r}=this;let a={min:0,max:0};if(e)a={min:-1/0,max:1/0};else if(r.length){const u=r[0].pos,l=r[r.length-1].pos;a=n&&i?{min:u,max:l}:{min:-1*l,max:-1*u}}return{x:i?a:{min:0,max:0},y:i?{min:0,max:0}:a}}repositionSlides(){let e,{isHorizontal:n,isRTL:i,isInfinite:r,viewport:a,viewportDim:u,contentDim:l,page:g,pages:b,slides:w,panzoom:E}=this,C=0,P=0,D=0,R=0;E?R=-1*E.current[this.axis]:b[g]&&(R=b[g].pos||0),e=n?i?"right":"left":"top",i&&n&&(R*=-1);for(const G of w){const Q=G.el;Q?(e==="top"?(Q.style.right="",Q.style.left=""):Q.style.top="",G.index!==C?Q.style[e]=P===0?"":`${lt(P,1e3)}px`:Q.style[e]="",D+=G.dim+G.gap,C++):P+=G.dim+G.gap}if(r&&D&&a){let G=getComputedStyle(a),Q="padding",Ie=n?"Right":"Bottom",ve=parseFloat(G[Q+(n?"Left":"Top")]);R-=ve,u+=ve,u+=parseFloat(G[Q+Ie]);for(const Se of w)Se.el&&(lt(Se.pos)<lt(u)&&lt(Se.pos+Se.dim+Se.gap)<lt(R)&&lt(R)>lt(l-u)&&(Se.el.style[e]=`${lt(P+D,1e3)}px`),lt(Se.pos+Se.gap)>=lt(l-u)&&lt(Se.pos)>lt(R+u)&&lt(R)<lt(u)&&(Se.el.style[e]=`-${lt(D,1e3)}px`))}let $,W,te=[...this.inTransition];if(te.length>1&&($=b[te[0]],W=b[te[1]]),$&&W){let G=0;for(const Q of w)Q.el?this.inTransition.has(Q.index)&&$.slides.indexOf(Q)<0&&(Q.el.style[e]=`${lt(G+($.pos-W.pos),1e3)}px`):G+=Q.dim+Q.gap}}createSlideEl(e){const{track:n,slides:i}=this;if(!n||!e||e.el&&e.el.parentNode)return;const r=e.el||document.createElement("div");Ct(r,this.cn(Yp)),Ct(r,e.class),Ct(r,e.customClass);const a=e.html;a&&(a instanceof HTMLElement?r.appendChild(a):r.innerHTML=e.html+"");const u=[];i.forEach((w,E)=>{w.el&&u.push(E)});const l=e.index;let g=null;u.length&&(g=i[u.reduce((w,E)=>Math.abs(E-l)<Math.abs(w-l)?E:w)]);const b=g&&g.el&&g.el.parentNode?g.index<e.index?g.el.nextSibling:g.el:null;n.insertBefore(r,n.contains(b)?b:null),e.el=r,this.emit("createSlide",e)}removeSlideEl(e,n=!1){const i=e==null?void 0:e.el;if(!i||!i.parentNode)return;const r=this.cn(uv);if(i.classList.contains(r)&&(En(i,r),this.emit("unselectSlide",e)),e.isDom&&!n)return i.removeAttribute("aria-hidden"),i.removeAttribute("data-index"),void(i.style.left="");this.emit("removeSlide",e);const a=new CustomEvent(Zp);i.dispatchEvent(a),e.el&&(e.el.remove(),e.el=null)}transitionTo(e=0,n=this.option("transition")){var i,r,a,u;if(!n)return!1;const l=this.page,{pages:g,panzoom:b}=this;e=parseInt((e||0).toString())||0;const w=this.getPageFromIndex(e);if(!b||!g[w]||g.length<2||Math.abs((((r=(i=g[l])===null||i===void 0?void 0:i.slides[0])===null||r===void 0?void 0:r.dim)||0)-this.viewportDim)>1)return!1;let E=e>l?1:-1;this.isInfinite&&(l===0&&e===g.length-1&&(E=-1),l===g.length-1&&e===0&&(E=1));const C=g[w].pos*(this.isRTL?1:-1);if(l===w&&Math.abs(C-b.target[this.axis])<1)return!1;this.clearTransitions();const P=b.isResting;Ct(this.container,this.cn("inTransition"));const D=((a=g[l])===null||a===void 0?void 0:a.slides[0])||null,R=((u=g[w])===null||u===void 0?void 0:u.slides[0])||null;this.inTransition.add(R.index),this.createSlideEl(R);let $=D.el,W=R.el;P||n===Yp||(n="fadeFast",$=null);const te=this.isRTL?"next":"prev",G=this.isRTL?"prev":"next";return $&&(this.inTransition.add(D.index),D.transition=n,$.addEventListener(Zp,this.onAnimationEnd),$.classList.add(`f-${n}Out`,`to-${E>0?G:te}`)),W&&(R.transition=n,W.addEventListener(Zp,this.onAnimationEnd),W.classList.add(`f-${n}In`,`from-${E>0?te:G}`)),b.current[this.axis]=C,b.target[this.axis]=C,b.requestTick(),this.onChange(w),!0}manageSlideVisiblity(){const e=new Set,n=new Set,i=this.getVisibleSlides(parseFloat(this.option("preload",0)+"")||0);for(const r of this.slides)i.has(r)?e.add(r):n.add(r);for(const r of this.inTransition)e.add(this.slides[r]);for(const r of e)this.createSlideEl(r),this.lazyLoadSlide(r);for(const r of n)e.has(r)||this.removeSlideEl(r);this.markSelectedSlides(),this.repositionSlides()}markSelectedSlides(){if(!this.pages[this.page]||!this.pages[this.page].slides)return;const e="aria-hidden";let n=this.cn(uv);if(n)for(const i of this.slides){const r=i.el;r&&(r.dataset.index=`${i.index}`,r.classList.contains("f-thumbs__slide")?this.getVisibleSlides(0).has(i)?r.removeAttribute(e):r.setAttribute(e,"true"):this.pages[this.page].slides.includes(i)?(r.classList.contains(n)||(Ct(r,n),this.emit("selectSlide",i)),r.removeAttribute(e)):(r.classList.contains(n)&&(En(r,n),this.emit("unselectSlide",i)),r.setAttribute(e,"true")))}}flipInfiniteTrack(){const{axis:e,isHorizontal:n,isInfinite:i,isRTL:r,viewportDim:a,contentDim:u}=this,l=this.panzoom;if(!l||!i)return;let g=l.current[e],b=l.target[e]-g,w=0,E=.5*a;r&&n?(g<-E&&(w=-1,g+=u),g>u-E&&(w=1,g-=u)):(g>E&&(w=1,g-=u),g<-u+E&&(w=-1,g+=u)),w&&(l.current[e]=g,l.target[e]=g+b)}lazyLoadImg(e,n){const i=this,r="f-fadeIn",a="is-preloading";let u=!1,l=null;const g=()=>{u||(u=!0,l&&(l.remove(),l=null),En(n,a),n.complete&&(Ct(n,r),setTimeout(()=>{En(n,r)},350)),this.option("adaptiveHeight")&&e.el&&this.pages[this.page].slides.indexOf(e)>-1&&(i.updateMetrics(),i.setViewportHeight()),this.emit("load",e))};Ct(n,a),n.src=n.dataset.lazySrcset||n.dataset.lazySrc||"",delete n.dataset.lazySrc,delete n.dataset.lazySrcset,n.addEventListener("error",()=>{g()}),n.addEventListener("load",()=>{g()}),setTimeout(()=>{const b=n.parentNode;b&&e.el&&(n.complete?g():u||(l=es(py),b.insertBefore(l,n)))},300)}lazyLoadSlide(e){const n=e&&e.el;if(!n)return;const i=new Set;let r=Array.from(n.querySelectorAll("[data-lazy-src],[data-lazy-srcset]"));n.dataset.lazySrc&&r.push(n),r.map(a=>{a instanceof HTMLImageElement?i.add(a):a instanceof HTMLElement&&a.dataset.lazySrc&&(a.style.backgroundImage=`url('${a.dataset.lazySrc}')`,delete a.dataset.lazySrc)});for(const a of i)this.lazyLoadImg(e,a)}onAnimationEnd(e){var n;const i=e.target,r=i?parseInt(i.dataset.index||"",10)||0:-1,a=this.slides[r],u=e.animationName;if(!i||!a||!u)return;const l=!!this.inTransition.has(r)&&a.transition;l&&u.substring(0,l.length+2)===`f-${l}`&&this.inTransition.delete(r),this.inTransition.size||this.clearTransitions(),r===this.page&&(!((n=this.panzoom)===null||n===void 0)&&n.isResting)&&this.emit("settle")}onDecel(e,n=0,i=0,r=0,a=0){if(this.option("dragFree"))return void this.setPageFromPosition();const{isRTL:u,isHorizontal:l,axis:g,pages:b}=this,w=b.length,E=Math.abs(Math.atan2(i,n)/(Math.PI/180));let C=0;if(C=E>45&&E<135?l?0:i:l?n:0,!w)return;let P=this.page,D=u&&l?1:-1;const R=e.current[g]*D;let{pageIndex:$}=this.getPageFromPosition(R);Math.abs(C)>5?(b[P].dim<document.documentElement["client"+(this.isHorizontal?"Width":"Height")]-1&&(P=$),P=u&&l?C<0?P-1:P+1:C<0?P+1:P-1):P=r===0&&a===0?P:$,this.slideTo(P,{transition:!1,friction:e.option("decelFriction")})}onClick(e){const n=e.target,i=n&&Mr(n)?n.dataset:null;let r,a;i&&(i.carouselPage!==void 0?(a="slideTo",r=i.carouselPage):i.carouselNext!==void 0?a="slideNext":i.carouselPrev!==void 0&&(a="slidePrev")),a?(e.preventDefault(),e.stopPropagation(),n&&!n.hasAttribute("disabled")&&this[a](r)):this.emit("click",e)}onSlideTo(e){const n=e.detail||0;this.slideTo(this.getPageForSlide(n),{friction:0})}onChange(e,n=0){const i=this.page;this.prevPage=i,this.page=e,this.option("adaptiveHeight")&&this.setViewportHeight(),e!==i&&(this.markSelectedSlides(),this.emit("change",e,i,n))}onRefresh(){let e=this.contentDim,n=this.viewportDim;this.updateMetrics(),this.contentDim===e&&this.viewportDim===n||this.slideTo(this.page,{friction:0,transition:!1})}onScroll(){var e;(e=this.viewport)===null||e===void 0||e.scroll(0,0)}onResize(){this.option("breakpoints")&&this.processOptions()}onBeforeTransform(e){this.lp!==e.current[this.axis]&&(this.flipInfiniteTrack(),this.manageSlideVisiblity()),this.lp=e.current.e}onEndAnimation(){this.inTransition.size||this.emit("settle")}reInit(e=null,n=null){this.destroy(),this.state=di.Init,this.prevPage=null,this.userOptions=e||this.userOptions,this.userPlugins=n||this.userPlugins,this.processOptions()}slideTo(e=0,{friction:n=this.option("friction"),transition:i=this.option("transition")}={}){if(this.state===di.Destroy)return;e=parseInt((e||0).toString())||0;const r=this.getPageFromIndex(e),{axis:a,isHorizontal:u,isRTL:l,pages:g,panzoom:b}=this,w=g.length,E=l&&u?1:-1;if(!b||!w)return;if(this.page!==r){const P=new Event("beforeChange",{bubbles:!0,cancelable:!0});if(this.emit("beforeChange",P,e),P.defaultPrevented)return}if(this.transitionTo(e,i))return;let C=g[r].pos;if(this.isInfinite){const P=this.contentDim,D=b.target[a]*E;w===2?C+=P*Math.floor(parseFloat(e+"")/2):C=[C,C-P,C+P].reduce(function(R,$){return Math.abs($-D)<Math.abs(R-D)?$:R})}C*=E,Math.abs(b.target[a]-C)<1||(b.panTo({x:u?C:0,y:u?0:C,friction:n}),this.onChange(r))}slideToClosest(e){if(this.panzoom){const{pageIndex:n}=this.getPageFromPosition();this.slideTo(n,e)}}slideNext(){this.slideTo(this.page+1)}slidePrev(){this.slideTo(this.page-1)}clearTransitions(){this.inTransition.clear(),En(this.container,this.cn("inTransition"));const e=["to-prev","to-next","from-prev","from-next"];for(const n of this.slides){const i=n.el;if(i){i.removeEventListener(Zp,this.onAnimationEnd),i.classList.remove(...e);const r=n.transition;r&&i.classList.remove(`f-${r}Out`,`f-${r}In`)}}this.manageSlideVisiblity()}addSlide(e,n){var i,r,a,u;const l=this.panzoom,g=((i=this.pages[this.page])===null||i===void 0?void 0:i.pos)||0,b=((r=this.pages[this.page])===null||r===void 0?void 0:r.dim)||0,w=this.contentDim<this.viewportDim;let E=Array.isArray(n)?n:[n];const C=[];for(const P of E)C.push(gy(P));this.slides.splice(e,0,...C);for(let P=0;P<this.slides.length;P++)this.slides[P].index=P;for(const P of C)this.emit("beforeInitSlide",P,P.index);if(this.page>=e&&(this.page+=C.length),this.updateMetrics(),l){const P=((a=this.pages[this.page])===null||a===void 0?void 0:a.pos)||0,D=((u=this.pages[this.page])===null||u===void 0?void 0:u.dim)||0,R=this.pages.length||1,$=this.isRTL?b-D:D-b,W=this.isRTL?g-P:P-g;w&&R===1?(e<=this.page&&(l.current[this.axis]-=$,l.target[this.axis]-=$),l.panTo({[this.isHorizontal?"x":"y"]:-1*P})):W&&e<=this.page&&(l.target[this.axis]-=W,l.current[this.axis]-=W,l.requestTick())}for(const P of C)this.emit("initSlide",P,P.index)}prependSlide(e){this.addSlide(0,e)}appendSlide(e){this.addSlide(this.slides.length,e)}removeSlide(e){const n=this.slides.length;e=(e%n+n)%n;const i=this.slides[e];if(i){this.removeSlideEl(i,!0),this.slides.splice(e,1);for(let r=0;r<this.slides.length;r++)this.slides[r].index=r;this.updateMetrics(),this.slideTo(this.page,{friction:0,transition:!1}),this.emit("destroySlide",i)}}updateMetrics(){const{panzoom:e,viewport:n,track:i,slides:r,isHorizontal:a,isInfinite:u}=this;if(!i)return;const l=a?"width":"height",g=a?"offsetWidth":"offsetHeight";if(n){let E=Math.max(n[g],lt(n.getBoundingClientRect()[l],1e3)),C=getComputedStyle(n),P="padding",D=a?"Right":"Bottom";E-=parseFloat(C[P+(a?"Left":"Top")])+parseFloat(C[P+D]),this.viewportDim=E}let b,w=0;for(const[E,C]of r.entries()){let P=0,D=0;!C.el&&b?(P=b.dim,D=b.gap):({dim:P,gap:D}=this.getSlideMetrics(C),b=C),P=lt(P,1e3),D=lt(D,1e3),C.dim=P,C.gap=D,C.pos=w,w+=P,(u||E<r.length-1)&&(w+=D)}w=lt(w,1e3),this.contentDim=w,e&&(e.contentRect[l]=w,e.contentRect[a?"fullWidth":"fullHeight"]=w),this.pages=this.createPages(),this.pages=this.processPages(),this.state===di.Init&&this.setInitialPage(),this.page=Math.max(0,Math.min(this.page,this.pages.length-1)),this.manageSlideVisiblity(),this.emit("refresh")}getProgress(e,n=!1,i=!1){e===void 0&&(e=this.page);const r=this,a=r.panzoom,u=r.contentDim,l=r.pages[e]||0;if(!l||!a)return e>this.page?-1:1;let g=-1*a.current.e,b=lt((g-l.pos)/(1*l.dim),1e3),w=b,E=b;this.isInfinite&&i!==!0&&(w=lt((g-l.pos+u)/(1*l.dim),1e3),E=lt((g-l.pos-u)/(1*l.dim),1e3));let C=[b,w,E].reduce(function(P,D){return Math.abs(D)<Math.abs(P)?D:P});return n?C:C>1?1:C<-1?-1:C}setViewportHeight(){const{page:e,pages:n,viewport:i,isHorizontal:r}=this;if(!i||!n[e])return;let a=0;r&&this.track&&(this.track.style.height="auto",n[e].slides.forEach(u=>{u.el&&(a=Math.max(a,u.el.offsetHeight))})),i.style.height=a?`${a}px`:""}getPageForSlide(e){for(const n of this.pages)for(const i of n.slides)if(i.index===e)return n.index;return-1}getVisibleSlides(e=0){var n;const i=new Set;let{panzoom:r,contentDim:a,viewportDim:u,pages:l,page:g}=this;if(u){a=a+((n=this.slides[this.slides.length-1])===null||n===void 0?void 0:n.gap)||0;let b=0;b=r&&r.state!==In.Init&&r.state!==In.Destroy?-1*r.current[this.axis]:l[g]&&l[g].pos||0,this.isInfinite&&(b-=Math.floor(b/a)*a),this.isRTL&&this.isHorizontal&&(b*=-1);const w=b-u*e,E=b+u*(e+1),C=this.isInfinite?[-1,0,1]:[0];for(const P of this.slides)for(const D of C){const R=P.pos+D*a,$=R+P.dim+P.gap;R<E&&$>w&&i.add(P)}}return i}getPageFromPosition(e){const{viewportDim:n,contentDim:i,slides:r,pages:a,panzoom:u}=this,l=a.length,g=r.length,b=r[0],w=r[g-1],E=this.option("center");let C=0,P=0,D=0,R=e===void 0?-1*((u==null?void 0:u.target[this.axis])||0):e;E&&(R+=.5*n),this.isInfinite?(R<b.pos-.5*w.gap&&(R-=i,D=-1),R>w.pos+w.dim+.5*w.gap&&(R-=i,D=1)):R=Math.max(b.pos||0,Math.min(R,w.pos));let $=w,W=r.find(te=>{const G=te.pos-.5*$.gap,Q=te.pos+te.dim+.5*te.gap;return $=te,R>=G&&R<Q});return W||(W=w),P=this.getPageForSlide(W.index),C=P+D*l,{page:C,pageIndex:P}}setPageFromPosition(){const{pageIndex:e}=this.getPageFromPosition();this.onChange(e)}destroy(){if([di.Destroy].includes(this.state))return;this.state=di.Destroy;const{container:e,viewport:n,track:i,slides:r,panzoom:a}=this,u=this.option("classes");e.removeEventListener("click",this.onClick,{passive:!1,capture:!1}),e.removeEventListener("slideTo",this.onSlideTo),window.removeEventListener("resize",this.onResize),a&&(a.destroy(),this.panzoom=null),r&&r.forEach(g=>{this.removeSlideEl(g)}),this.detachPlugins(),n&&(n.removeEventListener("scroll",this.onScroll),n.offsetParent&&i&&i.offsetParent&&n.replaceWith(...i.childNodes));for(const[g,b]of Object.entries(u))g!=="container"&&b&&e.classList.remove(b);this.track=null,this.viewport=null,this.page=0,this.slides=[];const l=this.events.get("ready");this.events=new Map,l&&this.events.set("ready",l)}}Object.defineProperty(da,"Panzoom",{enumerable:!0,configurable:!0,writable:!0,value:ha}),Object.defineProperty(da,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:fz}),Object.defineProperty(da,"Plugins",{enumerable:!0,configurable:!0,writable:!0,value:yz});const hv=function(t){if(!Mr(t))return 0;const e=window.scrollY,n=window.innerHeight,i=e+n,r=t.getBoundingClientRect(),a=r.y+e,u=r.height,l=a+u;if(e>l||i<a)return 0;if(e<a&&i>l||a<e&&l>i)return 100;let g=u;a<e&&(g-=e-a),l>i&&(g-=l-i);const b=g/n*100;return Math.round(b)},mh=!(typeof window>"u"||!window.document||!window.document.createElement);let yy;const _y=["a[href]","area[href]",'input:not([disabled]):not([type="hidden"]):not([aria-hidden])',"select:not([disabled]):not([aria-hidden])","textarea:not([disabled]):not([aria-hidden])","button:not([disabled]):not([aria-hidden]):not(.fancybox-focus-guard)","iframe","object","embed","video","audio","[contenteditable]",'[tabindex]:not([tabindex^="-"]):not([disabled]):not([aria-hidden])'].join(","),dv=t=>{if(t&&mh){yy===void 0&&document.createElement("div").focus({get preventScroll(){return yy=!0,!1}});try{if(yy)t.focus({preventScroll:!0});else{const e=window.scrollY||document.body.scrollTop,n=window.scrollX||document.body.scrollLeft;t.focus(),document.body.scrollTo({top:e,left:n,behavior:"auto"})}}catch{}}},pv=()=>{const t=document;let e,n="",i="",r="";return t.fullscreenEnabled?(n="requestFullscreen",i="exitFullscreen",r="fullscreenElement"):t.webkitFullscreenEnabled&&(n="webkitRequestFullscreen",i="webkitExitFullscreen",r="webkitFullscreenElement"),n&&(e={request:function(a=t.documentElement){return n==="webkitRequestFullscreen"?a[n](Element.ALLOW_KEYBOARD_INPUT):a[n]()},exit:function(){return t[r]&&t[i]()},isFullscreen:function(){return t[r]}}),e},by={animated:!0,autoFocus:!0,backdropClick:"close",Carousel:{classes:{container:"fancybox__carousel",viewport:"fancybox__viewport",track:"fancybox__track",slide:"fancybox__slide"}},closeButton:"auto",closeExisting:!1,commonCaption:!1,compact:()=>window.matchMedia("(max-width: 578px), (max-height: 578px)").matches,contentClick:"toggleZoom",contentDblClick:!1,defaultType:"image",defaultDisplay:"flex",dragToClose:!0,Fullscreen:{autoStart:!1},groupAll:!1,groupAttr:"data-fancybox",hideClass:"f-fadeOut",hideScrollbar:!0,idle:3500,keyboard:{Escape:"close",Delete:"close",Backspace:"close",PageUp:"next",PageDown:"prev",ArrowUp:"prev",ArrowDown:"next",ArrowRight:"next",ArrowLeft:"prev"},l10n:Object.assign(Object.assign({},ev),{CLOSE:"Close",NEXT:"Next",PREV:"Previous",MODAL:"You can close this modal content with the ESC key",ERROR:"Something Went Wrong, Please Try Again Later",IMAGE_ERROR:"Image Not Found",ELEMENT_NOT_FOUND:"HTML Element Not Found",AJAX_NOT_FOUND:"Error Loading AJAX : Not Found",AJAX_FORBIDDEN:"Error Loading AJAX : Forbidden",IFRAME_ERROR:"Error Loading Page",TOGGLE_ZOOM:"Toggle zoom level",TOGGLE_THUMBS:"Toggle thumbnails",TOGGLE_SLIDESHOW:"Toggle slideshow",TOGGLE_FULLSCREEN:"Toggle full-screen mode",DOWNLOAD:"Download"}),parentEl:null,placeFocusBack:!0,showClass:"f-zoomInUp",startIndex:0,tpl:{closeButton:'<button data-fancybox-close class="f-button is-close-btn" title="{{CLOSE}}"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" tabindex="-1"><path d="M20 20L4 4m16 0L4 20"/></svg></button>',main:`<div class="fancybox__container" role="dialog" aria-modal="true" aria-label="{{MODAL}}" tabindex="-1">
625
625
  <div class="fancybox__backdrop"></div>
626
626
  <div class="fancybox__carousel"></div>
627
627
  <div class="fancybox__footer"></div>
@@ -783,4 +783,4 @@ img.ProseMirror-separator {
783
783
  </div>
784
784
  </VsDialog>
785
785
  </div>
786
- `});g.mount(l)})},i9=async()=>{try{const{data:t}=await it.get("/api/user-menu");return Kr.value=t,e_(t)}catch(t){return console.error(t),[]}},r9=(t,e)=>{Object.entries(e).forEach(([n,i])=>{t.component(n,i)})},o9={async install(t,{componentsApp:e={},settings:n}){ra.value={...ra,...n};try{const r=(await i9()).filter(u=>u==null?void 0:u.component).map(u=>({...u,component:{...n_,...e}[u==null?void 0:u.component]}));r9(t,{...n_,...e}),t.component("admin",QT);const{router:a}=await BA(r);window.app={...t,router:a},window.v3plugin={...t.config.globalProperties,...FS},t.config.globalProperties={...t.config.globalProperties,$componentsConfig:{...TB,componentsApp:e},$router:a,$v3plugin:FS,$utils:{reloadCardPage:i_}},t.use(a)}catch(i){console.error(i)}},components:n_},s9={data(){return{formValues:{},scheme:null,table:"",token:""}},mounted(){this.getFormScheme()},methods:{flattenMenu(t){const e=[];return t.forEach(n=>{n.menu?e.push(...this.flattenMenu(n.menu)):e.push(n)}),e},async getFormScheme(){var i,r;const t=this.flattenMenu(Kr.value);t!=null&&t.length||this.$router.replace("/404");const e=t==null?void 0:t.find(a=>{var u,l;return(a==null?void 0:a.path)==((l=(u=this.$route)==null?void 0:u.query)==null?void 0:l.table)});e||this.$router.replace("/404");const n=e==null?void 0:e.table;this.table=n;try{const{data:{form:a}}=await it.get(`/api/template/table/${n}`),{data:u}=await it.get(`/api/table/${this.table}/${(r=(i=this.$route)==null?void 0:i.query)==null?void 0:r.id}`);this.token=(u==null?void 0:u.token)||"",this.formValues=u||{};const{data:l}=await it.get(`/api/template/form/${a}`);this.scheme=(l==null?void 0:l.schema)||l}catch{}},async onlyEditObject(){try{await this.$refs.form.doValidation(),await it.put(`/api/table/${this.token}`,this.formValues),await this.$notify({title:"Успішно!",message:"Об'єкт успішно створено",type:"success"})}catch{this.$notify({title:"Помилка!",message:"Сталася помилка",type:"error"})}},async editObjectAndRedirect(){try{await this.$refs.form.doValidation(),await it.put(`/api/table/${this.token}`,this.formValues),await this.$router.back(),await this.$notify({title:"Успішно!",message:"Об'єкт успішно створено",type:"success"})}catch{this.$notify({title:"Помилка!",message:"Сталася помилка",type:"error"})}}}},a9={style:{width:"calc(100vw - 260px)"},class:"bg-gray-50"},l9={class:"h-[76px] mt-[15px] flex items-center justify-between mx-[20px] px-[20px] bg-white border rounded-xl"},c9={class:"flex items-center gap-[6px]"},u9={style:{height:"calc(100vh - 155px)",width:"calc(100vw - 260px)"},class:"bg-gray-50 p-[20px] flex"},h9={class:"bg-white w-full rounded-xl border p-[20px] overflow-auto [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar:horizontal]:h-[8px] [&::-webkit-scrollbar-track]:bg-gray-100 [&::-webkit-scrollbar-thumb]:bg-gray-300 dark:[&::-webkit-scrollbar-track]:bg-neutral-700 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500"};function d9(t,e,n,i,r,a){const u=f.resolveComponent("VsForm");return f.openBlock(),f.createElementBlock("div",a9,[f.createElementVNode("div",l9,[e[4]||(e[4]=f.createElementVNode("h2",{class:"text-xl font-medium"},"Редагувати",-1)),f.createElementVNode("div",c9,[f.createElementVNode("button",{onClick:e[0]||(e[0]=l=>t.$router.back()),class:"flex items-center px-3 py-2 text-sm font-medium text-gray-800 duration-300 bg-white border border-gray-100 rounded-lg shadow gap-x-2 focus:outline-none hover:bg-gray-50 hover:border-gray-100"}," Повернутися "),f.createElementVNode("button",{onClick:e[1]||(e[1]=(...l)=>a.onlyEditObject&&a.onlyEditObject(...l)),class:"inline-flex items-center px-3 py-2 text-sm font-medium text-white duration-300 bg-blue-600 border border-transparent rounded-lg gap-x-2 hover:bg-blue-700 hover:text-white"}," Зберегти "),f.createElementVNode("button",{onClick:e[2]||(e[2]=(...l)=>a.editObjectAndRedirect&&a.editObjectAndRedirect(...l)),class:"inline-flex items-center px-3 py-2 text-sm font-medium text-white duration-300 bg-blue-600 border border-transparent rounded-lg gap-x-2 hover:bg-blue-700 hover:text-white"}," Зберегти і повернутися ")])]),f.createElementVNode("div",u9,[f.createElementVNode("div",h9,[r.scheme?(f.openBlock(),f.createBlock(u,{key:0,ref:"form",scheme:r.scheme,modelValue:r.formValues,"onUpdate:modelValue":e[3]||(e[3]=l=>r.formValues=l),class:"p-0 mt-[20px]"},null,8,["scheme","modelValue"])):f.createCommentVNode("",!0)])])])}const p9=Object.freeze(Object.defineProperty({__proto__:null,default:je(s9,[["render",d9]])},Symbol.toStringTag,{value:"Module"})),f9={data(){return{formValues:{},scheme:null,table:"",token:"",api:""}},mounted(){this.getFormScheme()},methods:{flattenMenu(t){const e=[];return t.forEach(n=>{n.menu?e.push(...this.flattenMenu(n.menu)):e.push(n)}),e},async getFormScheme(){var i,r;const t=this.flattenMenu(Kr.value);t!=null&&t.length||this.$router.replace("/404");const e=t==null?void 0:t.find(a=>{var u,l;return(a==null?void 0:a.path)==((l=(u=this.$route)==null?void 0:u.query)==null?void 0:l.table)});e||this.$router.replace("/404");const n=e==null?void 0:e.table;this.table=n;try{const a=await it.get(`/api/table-data/${n}`),{data:u}=await it.get(`/api/template/form/${(i=a==null?void 0:a.data)==null?void 0:i.form}`);this.scheme=(u==null?void 0:u.schema)||u,this.api=(u==null?void 0:u.api)||"",this.token=(r=a==null?void 0:a.data)==null?void 0:r.addToken}catch{}},async createObject(){var e,n,i,r,a,u,l,g,b;const t=this.$refs.form;try{await t.doValidation(),await it.post(this.api||`/api/table/${this.token}`,this.formValues),await this.$router.back(),await this.$notify({title:"Успішно!",message:"Об'єкт успішно створено",type:"success"})}catch(w){const E=((e=w==null?void 0:w.response)==null?void 0:e.data)||"";let C=((a=(r=(i=(n=Object.entries(t==null?void 0:t.formErrors))==null?void 0:n[0])==null?void 0:i[1])==null?void 0:r[0])==null?void 0:a.message)==="Це поле обов'язкове"?"Заповніть обов'язкові поля":(b=(g=(l=(u=Object.entries(t==null?void 0:t.formErrors))==null?void 0:u[0])==null?void 0:l[1])==null?void 0:g[0])==null?void 0:b.message;this.$notify({title:"Помилка!",message:E||C||"Сталася помилка валідаціі",type:"error"})}}}},m9={style:{width:"calc(100vw - 260px)"},class:"bg-gray-50"},g9={class:"h-[76px] mt-[15px] flex items-center justify-between mx-[20px] px-[20px] bg-white border rounded-xl"},y9={class:"flex items-center gap-[6px]"},_9={style:{height:"calc(100vh - 165px)",width:"calc(100vw - 260px)"},class:"bg-gray-50 p-[20px] flex"},b9={class:"bg-white w-full rounded-xl border p-[20px] overflow-auto [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar:horizontal]:h-[8px] [&::-webkit-scrollbar-track]:bg-gray-100 [&::-webkit-scrollbar-thumb]:bg-gray-300 dark:[&::-webkit-scrollbar-track]:bg-neutral-700 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500"};function x9(t,e,n,i,r,a){const u=f.resolveComponent("VsForm");return f.openBlock(),f.createElementBlock("div",m9,[f.createElementVNode("div",g9,[e[3]||(e[3]=f.createElementVNode("h2",{class:"text-xl font-medium"},"Створити",-1)),f.createElementVNode("div",y9,[f.createElementVNode("button",{onClick:e[0]||(e[0]=l=>t.$router.back()),class:"flex items-center px-3 py-2 text-sm font-medium text-gray-800 duration-300 bg-white border border-gray-100 rounded-lg shadow gap-x-2 focus:outline-none hover:bg-gray-50 hover:border-gray-100"}," Скасувати "),f.createElementVNode("button",{onClick:e[1]||(e[1]=(...l)=>a.createObject&&a.createObject(...l)),class:"inline-flex items-center px-3 py-2 text-sm font-medium text-white duration-300 bg-blue-600 border border-transparent rounded-lg gap-x-2 hover:bg-blue-700 hover:text-white"}," Зберегти ")])]),f.createElementVNode("div",_9,[f.createElementVNode("div",b9,[r.scheme?(f.openBlock(),f.createBlock(u,{key:0,ref:"form",scheme:r.scheme,modelValue:r.formValues,"onUpdate:modelValue":e[2]||(e[2]=l=>r.formValues=l),class:"p-0 mt-[20px]"},null,8,["scheme","modelValue"])):f.createCommentVNode("",!0)])])])}const v9=Object.freeze(Object.defineProperty({__proto__:null,default:je(f9,[["render",x9]])},Symbol.toStringTag,{value:"Module"})),w9={};function k9(t,e,n,i,r,a){const u=f.resolveComponent("router-view");return f.openBlock(),f.createBlock(u)}const $S=Object.freeze(Object.defineProperty({__proto__:null,default:je(w9,[["render",k9]])},Symbol.toStringTag,{value:"Module"})),S9={},E9={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-logout"};function C9(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("svg",E9,e[0]||(e[0]=[f.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),f.createElementVNode("path",{d:"M14 8v-2a2 2 0 0 0 -2 -2h-7a2 2 0 0 0 -2 2v12a2 2 0 0 0 2 2h7a2 2 0 0 0 2 -2v-2"},null,-1),f.createElementVNode("path",{d:"M9 12h12l-3 -3"},null,-1),f.createElementVNode("path",{d:"M18 15l3 -3"},null,-1)]))}const T9=je(S9,[["render",C9]]),M9={},A9={viewBox:"0 0 1823 249",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function I9(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("svg",A9,e[0]||(e[0]=[f.createStaticVNode('<path d="M218.88 96.05C223.55 99.19 228.69 101.56 234.09 103.07V145.42C212.05 151.54 195.83 171.79 195.83 195.75C195.83 200.22 196.41 204.65 197.53 208.94L160.92 230.08C156.82 226.06 152.08 222.73 146.91 220.24V171.62C164.83 163.13 176.59 145.06 176.59 124.48C176.59 123.17 176.54 121.86 176.44 120.56L218.88 96.05ZM220.32 79.09L160.97 113.36C162.04 116.88 162.61 120.61 162.61 124.48C162.61 142.66 149.93 157.87 132.93 161.76V230.05C143.4 232.46 152.23 239.16 157.46 248.21L215 214.99C211.7 209.34 209.81 202.77 209.81 195.75C209.81 174.62 226.94 157.49 248.07 157.49V91.02C237.14 91.02 227.29 86.43 220.32 79.09Z" fill="#CE3936"></path><path d="M161.39 19.13L197.44 39.94C196.39 44.11 195.84 48.42 195.84 52.75C195.84 54.21 195.9 55.65 196.02 57.1L153.9 81.42C145.27 75.5 134.95 72.24 124.36 72.24C113.83 72.24 103.57 75.47 94.96 81.32L52.71 56.93C52.82 55.55 52.88 54.16 52.88 52.76C52.88 48.43 52.34 44.12 51.28 39.95L87.3 19.16C96.98 28.89 110.26 34.58 124.34 34.58C138.42 34.57 151.7 28.87 161.39 19.13ZM157.77 0.919983C151.24 12.66 138.71 20.6 124.33 20.6C109.95 20.6 97.44 12.67 90.9 0.939983L33.9 33.85C37.08 39.43 38.91 45.88 38.91 52.76C38.91 56.71 38.31 60.52 37.2 64.11L96.46 98.32C103.44 90.87 113.36 86.22 124.37 86.22C135.44 86.22 145.41 90.93 152.39 98.44L211.59 64.27C210.45 60.64 209.83 56.78 209.83 52.77C209.83 45.89 211.65 39.44 214.84 33.86L157.77 0.919983Z" fill="#CE3936"></path><path d="M29.97 95.95L72.28 120.38C72.17 121.74 72.12 123.1 72.12 124.47C72.12 145.02 83.86 163.08 101.74 171.58V220.23C96.58 222.71 91.84 226.04 87.75 230.05L51.17 208.93C52.29 204.64 52.87 200.21 52.87 195.74C52.87 171.78 36.65 151.53 14.61 145.41V103.06C20.07 101.55 25.27 99.14 29.97 95.95ZM28.5 78.97C21.52 86.38 11.63 91.02 0.640015 91.02V157.49C21.77 157.49 38.9 174.62 38.9 195.75C38.9 202.77 37 209.33 33.71 214.99L91.2 248.18C96.43 239.14 105.25 232.45 115.71 230.04V161.73C98.74 157.81 86.09 142.62 86.09 124.46C86.09 120.54 86.68 116.75 87.78 113.18L28.5 78.97Z" fill="#CE3936"></path><path d="M498.39 177.5V144.88C498.39 128.55 485.11 115.27 468.78 115.27H343.22C342.69 115.27 342.18 115.32 341.67 115.4H337.19C332.35 115.4 328.42 111.46 328.42 106.63V74C328.42 69.16 332.36 65.23 337.19 65.23H486.33C492.08 65.23 496.75 60.57 496.75 54.81C496.75 49.06 492.08 44.39 486.33 44.39H337.19C320.86 44.39 307.58 57.67 307.58 74V106.62C307.58 122.95 320.86 136.23 337.19 136.23H462.75C463.28 136.23 463.79 136.18 464.3 136.1H468.78C473.62 136.1 477.55 140.04 477.55 144.87V177.49C477.55 182.33 473.61 186.26 468.78 186.26H319.64C313.89 186.26 309.22 190.92 309.22 196.68C309.22 202.43 313.89 207.1 319.64 207.1H468.78C485.11 207.11 498.39 193.83 498.39 177.5Z" fill="#CE3935"></path><path d="M710.7 177.32V75.24C710.7 58.91 697.42 45.63 681.09 45.63H550.05C533.72 45.63 520.44 58.91 520.44 75.24V177.32C520.44 193.65 533.72 206.93 550.05 206.93H681.1C697.42 206.93 710.7 193.65 710.7 177.32ZM541.27 75.24C541.27 70.4 545.21 66.47 550.04 66.47H681.09C685.93 66.47 689.86 70.41 689.86 75.24V177.32C689.86 182.16 685.92 186.09 681.09 186.09H550.05C545.21 186.09 541.28 182.15 541.28 177.32V75.24H541.27Z" fill="#CE3935"></path><path d="M1823 177.32V75.24C1823 58.91 1809.72 45.63 1793.39 45.63H1662.34C1646.01 45.63 1632.73 58.91 1632.73 75.24V177.32C1632.73 193.65 1646.01 206.93 1662.34 206.93H1793.39C1809.72 206.93 1823 193.65 1823 177.32ZM1653.57 75.24C1653.57 70.4 1657.51 66.47 1662.34 66.47H1793.39C1798.23 66.47 1802.16 70.41 1802.16 75.24V177.32C1802.16 182.16 1798.22 186.09 1793.39 186.09H1662.34C1657.5 186.09 1653.57 182.15 1653.57 177.32V75.24Z" fill="#CE3935"></path><path d="M756.76 196.51V152H849.42C855.17 152 859.84 147.34 859.84 141.58C859.84 135.83 855.17 131.16 849.42 131.16H756.76V75.23C756.76 70.39 760.7 66.46 765.53 66.46H893.29C899.04 66.46 903.71 61.8 903.71 56.04C903.71 50.29 899.04 45.62 893.29 45.62H765.53C749.2 45.62 735.92 58.9 735.92 75.23V196.5C735.92 202.25 740.59 206.92 746.34 206.92C752.09 206.93 756.76 202.27 756.76 196.51Z" fill="#CE3935"></path><path d="M933.86 66.47H1006.51V194.32C1006.51 200.07 1011.18 204.74 1016.93 204.74C1022.68 204.74 1027.35 200.07 1027.35 194.32V66.47H1100C1105.75 66.47 1110.42 61.81 1110.42 56.05C1110.42 50.3 1105.76 45.63 1100 45.63H933.86C928.11 45.63 923.44 50.29 923.44 56.05C923.45 61.81 928.11 66.47 933.86 66.47Z" fill="#CE3935"></path><path d="M1218.44 204.19C1224.19 204.19 1228.86 199.53 1228.86 193.77V152H1368.13C1384.46 152 1397.74 138.72 1397.74 122.39V75.24C1397.74 58.91 1384.46 45.63 1368.13 45.63H1237.63C1221.3 45.63 1208.02 58.91 1208.02 75.24V193.77C1208.02 199.53 1212.68 204.19 1218.44 204.19ZM1237.63 66.47H1368.13C1372.97 66.47 1376.9 70.41 1376.9 75.24V122.39C1376.9 127.23 1372.96 131.16 1368.13 131.16H1228.86V75.23C1228.86 70.41 1232.79 66.47 1237.63 66.47Z" fill="#CE3935"></path><path d="M1430.64 204.19C1436.39 204.19 1441.06 199.53 1441.06 193.77V152H1523.95C1524.57 153.18 1525.42 154.26 1526.51 155.17L1581.89 201.23C1583.83 202.85 1586.2 203.64 1588.55 203.64C1591.54 203.64 1594.5 202.36 1596.57 199.88C1600.25 195.46 1599.64 188.89 1595.22 185.21L1555.29 152H1580.33C1596.66 152 1609.94 138.72 1609.94 122.39V75.24C1609.94 58.91 1596.66 45.63 1580.33 45.63H1449.83C1433.5 45.63 1420.22 58.91 1420.22 75.24V193.77C1420.22 199.53 1424.88 204.19 1430.64 204.19ZM1449.83 66.47H1580.33C1585.17 66.47 1589.1 70.41 1589.1 75.24V122.39C1589.1 127.23 1585.17 131.16 1580.33 131.16H1441.06V75.23C1441.05 70.41 1444.99 66.47 1449.83 66.47Z" fill="#CE3935"></path>',10)]))}const P9=je(M9,[["render",I9]]),D9={},O9={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-chevron-down"};function B9(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("svg",O9,e[0]||(e[0]=[f.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),f.createElementVNode("path",{d:"M6 9l6 6l6 -6"},null,-1)]))}const jS=je(D9,[["render",B9]]),z9={components:{IconChevronDown:jS},props:{route:Object,searchable:String},mounted(){var t,e,n;(t=this.route)!=null&&t.menu&&(n=(e=this.route)==null?void 0:e.menu)!=null&&n.some(i=>{var r,a;return(i==null?void 0:i.path)===this.$route.path.replace("/","")||((a=(r=this.$route)==null?void 0:r.params)==null?void 0:a.table)===(i==null?void 0:i.table)&&(i==null?void 0:i.table)})&&(this.isOpen=!0)},watch:{route(t){t!=null&&t.open&&(this.isOpen=!0)}},data(){return{isOpen:!1}},methods:{highLight(t){if(!this.searchable)return t;const e=this.searchable.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),n=new RegExp(`(${e})(\\s*)`,"gi");return t.replace(n,(i,r,a)=>`<span style="color:#1989fa;">${r}</span>${a}`)}}},N9={key:0,class:""},R9={class:"ml-[30px] py-[6px] before:block before:absolute relative w-[196px] flex flex-col gap-[6px] inline-block before:w-[2px] before:h-[100%] before:bg-gray-100 before:left-[-14px] cursor-pointer"},L9={key:1};function V9(t,e,n,i,r,a){var g,b,w,E,C,P,D,R,$,W,te,G,Q,Ie,ve;const u=f.resolveComponent("IconChevronDown"),l=f.resolveComponent("router-link");return(g=n.route)!=null&&g.menu?(f.openBlock(),f.createElementBlock("div",N9,[f.createElementVNode("button",{onClick:e[0]||(e[0]=Se=>r.isOpen=!r.isOpen),class:f.normalizeClass(["flex items-center justify-start w-full px-3 py-2 text-sm text-left text-gray-800 duration-300 border-none rounded-lg cursor-pointer gap-x-3 focus:outline-none hover:bg-gray-100",[((w=(b=n.route)==null?void 0:b.menu)==null?void 0:w.some(Se=>{var Ne,Ae;return(Se==null?void 0:Se.path)===t.$route.path.replace("/","")||(Se==null?void 0:Se.table)===((Ae=(Ne=t.$route)==null?void 0:Ne.params)==null?void 0:Ae.table)&&(Se==null?void 0:Se.table)}))&&"bg-gray-100"]])},[f.createTextVNode(f.toDisplayString((E=n.route)==null?void 0:E.ua)+" ",1),f.createVNode(u,{class:f.normalizeClass([[r.isOpen&&"-rotate-180"],"ml-auto duration-300"]),width:"14",height:"14"},null,8,["class"])],2),f.createVNode(f.Transition,{name:"fade"},{default:f.withCtx(()=>{var Se;return[f.withDirectives(f.createElementVNode("ul",R9,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList((Se=n.route)==null?void 0:Se.menu,(Ne,Ae)=>{var $e,Xe;return f.openBlock(),f.createElementBlock("li",{key:Ae,class:"w-full"},[f.createVNode(l,{innerHTML:a.highLight(Ne==null?void 0:Ne.ua),to:"/"+(Ne==null?void 0:Ne.path),class:f.normalizeClass([[((Ne==null?void 0:Ne.path)===t.$route.path.replace("/","")||((Xe=($e=t.$route)==null?void 0:$e.params)==null?void 0:Xe.table)===(Ne==null?void 0:Ne.table)&&(Ne==null?void 0:Ne.table))&&"bg-gray-100"],"inline-block px-3 py-2 text-sm text-gray-800 rounded-lg hover:bg-gray-100 focus:outline-none focus:bg-gray-100"])},null,8,["innerHTML","to","class"])])}),128))],512),[[f.vShow,r.isOpen]])]}),_:1})])):(C=n.route)!=null&&C.hidden?f.createCommentVNode("",!0):(f.openBlock(),f.createElementBlock("div",L9,[f.createVNode(l,{innerHTML:a.highLight((P=n.route)==null?void 0:P.ua),to:((R=(D=n.route)==null?void 0:D.path)==null?void 0:R[0])==="/"?($=n.route)==null?void 0:$.path:"/"+((W=n.route)==null?void 0:W.path),class:f.normalizeClass([[(((te=n.route)==null?void 0:te.path.replace("/",""))===t.$route.path.replace("/","")||((Q=(G=t.$route)==null?void 0:G.params)==null?void 0:Q.table)===((Ie=n.route)==null?void 0:Ie.table)&&((ve=n.route)==null?void 0:ve.table))&&"bg-gray-100"],"inline-block py-2 w-full font-[400] px-3 text-sm text-gray-800 rounded-lg items-center hover:bg-gray-100 duration-300 hover:text-gray-800"])},null,8,["innerHTML","to","class"])]))}const F9={components:{IconLogout:T9,NavbarItem:je(z9,[["render",V9]]),IconLogo:P9,IconSearch:t_},data(){return{activeIndex:null,searchValue:""}},computed:{data(){var t;return(t=this.searchValue)!=null&&t.trim()?this.filterMenu(Kr.value,this.searchValue):Kr.value},logo(){var t;return((t=ra.value)==null?void 0:t.logo)||"/assets/logo.svg"}},methods:{filterMenu(t,e){return t.map(n=>{var i,r;if(n.menu){const a=this.filterMenu(n.menu,e);if(a.length>0)return{...n,menu:a,open:!0}}else if((r=(i=n.ua)==null?void 0:i.toLowerCase())!=null&&r.includes(e.toLowerCase()))return n;return null}).filter(Boolean)}}},$9={class:"flex flex-col h-[100vh] border-r w-[260px] shrink-0"},j9=["src"],U9={class:"relative"},H9={class:"p-[16px] overflow-y-auto [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-track]:bg-gray-100 [&::-webkit-scrollbar-thumb]:bg-gray-300 dark:[&::-webkit-scrollbar-track]:bg-neutral-700 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500"},q9={class:"flex flex-col flex-wrap w-full pb-3"},W9={key:0,class:"flex flex-col gap-[6px]"},G9={key:1,class:"text-gray-800 text-lg mt-[20px]"};function Z9(t,e,n,i,r,a){var b;const u=f.resolveComponent("IconSearch"),l=f.resolveComponent("VsText"),g=f.resolveComponent("NavbarItem");return f.openBlock(),f.createElementBlock("div",$9,[f.createElementVNode("img",{src:a.logo,height:"40",width:"200",class:"my-[20px] ml-[20px]"},null,8,j9),f.createElementVNode("div",U9,[f.createVNode(u,{height:"16",width:"16",class:"absolute top-[12px] left-[30px] text-gray-500 z-[1]"}),f.createVNode(l,{type:"text",modelValue:r.searchValue,"onUpdate:modelValue":e[0]||(e[0]=w=>r.searchValue=w),clearable:!0,placeholder:"Пошук по меню",class:"[&>input]:h-[40px] [&>input]:block [&>input]:rounded-none [&>input]:border-x-0 [&>input]:pl-[60px] [&>input:focus]:outline-none [&>input:focus]:focus:ring-0 [&>input:focus]:border-y-gray-200 [&>input:focus]:border-y-1 [&>input:focus]:border-x-0"},null,8,["modelValue"])]),f.createElementVNode("div",H9,[f.createElementVNode("nav",q9,[(b=a.data)!=null&&b.length?(f.openBlock(),f.createElementBlock("ul",W9,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(a.data,(w,E)=>(f.openBlock(),f.createElementBlock("li",{key:E,class:"flex flex-col gap-[6px]"},[f.createVNode(g,{route:w,searchable:r.searchValue},null,8,["route","searchable"])]))),128))])):(f.openBlock(),f.createElementBlock("div",G9,"Не знайдено"))])])])}const Y9=je(F9,[["render",Z9]]),X9={},K9={class:"flex-shrink-0 size-4",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function J9(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("svg",K9,e[0]||(e[0]=[f.createElementVNode("circle",{cx:"12",cy:"12",r:"10"},null,-1),f.createElementVNode("path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"},null,-1),f.createElementVNode("path",{d:"M12 17h.01"},null,-1)]))}const Q9={components:{IconQuestion:je(X9,[["render",J9]]),IconUser:BS,AdminNotification:NS},mounted(){this.getUserData()},data(){return{userData:null,isVisible:!1}},watch:{isVisible(t){t?setTimeout(()=>window.addEventListener("click",this.closeOnOutsideClick),0):window.removeEventListener("click",this.closeOnOutsideClick)}},methods:{async getUserData(){try{const{data:t}=await it.get("/user");this.userData=t}catch{}},async logout(){try{await it.get("/logout"),await window.history.pushState({},"","/login"),await location.reload(),localStorage.removeItem("user")}catch{}},closeOnOutsideClick(){this.isVisible=!1}},beforeUnmount(){window.removeEventListener("click",this.closeOnOutsideClick)}},eU={class:"h-[60px] border-b flex justify-end px-[20px]",style:{width:"calc(100vw - 260px)"}},tU={class:"flex items-center gap-[6px]"},nU={href:"docs-softpro.com",class:"size-[38px] inline-flex justify-center items-center gap-x-2 rounded-full border border-transparent text-gray-500 hover:bg-gray-100 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-gray-100 dark:text-neutral-400 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700"},iU={class:"relative"},rU=["src"],oU={key:1,class:"size-[40px] rounded-full bg-gray-200 flex items-center justify-center"},sU={class:"p-[10px] gap-[6px] items-center border-b flex justify-between"},aU=["src"],lU={key:1,class:"size-[40px] rounded-full bg-gray-200 flex items-center justify-center"},cU={class:"text-[14px] mr-[10px] text-gray-500"},uU={class:"flex flex-col p-[4px]"};function hU(t,e,n,i,r,a){var w,E,C,P,D,R,$,W,te,G;const u=f.resolveComponent("IconQuestion"),l=f.resolveComponent("AdminNotification"),g=f.resolveComponent("IconUser"),b=f.resolveComponent("router-link");return f.openBlock(),f.createElementBlock("div",eU,[f.createElementVNode("div",tU,[f.createElementVNode("a",nU,[f.createVNode(u,{height:"24",width:"24"})]),f.createVNode(l),e[4]||(e[4]=f.createElementVNode("div",{class:"h-[30px] w-[1px] bg-gray-200 ml-[10px] mr-[10px]"},null,-1)),f.createElementVNode("div",iU,[f.createElementVNode("div",{onClick:e[0]||(e[0]=Q=>r.isVisible=!0),class:"cursor-pointer"},[(E=(w=r.userData)==null?void 0:w.user)!=null&&E.avatar?(f.openBlock(),f.createElementBlock("img",{key:0,class:"flex-shrink-0 size-[30px] rounded-full",src:(P=(C=r.userData)==null?void 0:C.user)==null?void 0:P.avatar,alt:"Image Description"},null,8,rU)):(f.openBlock(),f.createElementBlock("div",oU,[f.createVNode(g)]))]),r.isVisible?(f.openBlock(),f.createElementBlock("div",{key:0,onClick:e[2]||(e[2]=f.withModifiers(()=>{},["stop"])),class:"fixed bg-white w-[180px] top-[55px] right-[20px] shadow-xl rounded-xl z-[1]"},[f.createElementVNode("div",sU,[(R=(D=r.userData)==null?void 0:D.user)!=null&&R.avatar?(f.openBlock(),f.createElementBlock("img",{key:0,class:"flex-shrink-0 size-[30px] rounded-full",src:(W=($=r.userData)==null?void 0:$.user)==null?void 0:W.avatar,alt:"Image Description"},null,8,aU)):(f.openBlock(),f.createElementBlock("div",lU,[f.createVNode(g)])),f.createElementVNode("div",null,[f.createElementVNode("p",cU,f.toDisplayString((G=(te=r.userData)==null?void 0:te.user)==null?void 0:G.username),1)])]),f.createElementVNode("div",uU,[f.createVNode(b,{to:"profile",disabled:!0,class:"p-[8px] block rounded-lg w-full mb-[4px] text-start hover:bg-gray-100 !duration-300"},{default:f.withCtx(()=>e[3]||(e[3]=[f.createTextVNode("Профіль")])),_:1}),f.createElementVNode("button",{onClick:e[1]||(e[1]=(...Q)=>a.logout&&a.logout(...Q)),class:"p-[8px] block rounded-lg w-full text-start hover:bg-gray-100 !duration-300"}," Вийти ")])])):f.createCommentVNode("",!0)])])])}const dU={components:{navbar:Y9,AdminHeader:je(Q9,[["render",hU]])},computed:{isMenu(){return Kr.value||null},header(){var t;return((t=ra.value)==null?void 0:t.header)||"admin-header"}}},pU={class:"admin-wrapper"},fU={class:"flex flex-col"};function mU(t,e,n,i,r,a){const u=f.resolveComponent("navbar"),l=f.resolveComponent("router-view");return f.openBlock(),f.createElementBlock("div",pU,[f.createVNode(u),f.createElementVNode("div",fU,[a.isMenu?(f.openBlock(),f.createElementBlock(f.Fragment,{key:0},[(f.openBlock(),f.createBlock(f.resolveDynamicComponent(a.header))),f.createVNode(l)],64)):f.createCommentVNode("",!0)])])}const gU=Object.freeze(Object.defineProperty({__proto__:null,default:je(dU,[["render",mU],["__scopeId","data-v-98158745"]])},Symbol.toStringTag,{value:"Module"})),yU={data(){return{currentSort:""}},props:{data:{type:Object,default:()=>null},activeColumn:{type:String}},computed:{label(){var t,e;return((t=this.data)==null?void 0:t.ua)||((e=this.data)==null?void 0:e.label)||this.data.title||"null"},selectedSortParam(){var t,e;return(e=(t=this.$route)==null?void 0:t.query)==null?void 0:e.sort},getVisibleIcon(){return this.data.format!=="image"&&this.data.format!=="verify"}},watch:{activeColumn(t){t!==this.data.name&&(this.currentSort="")}},methods:{changeCurrentSort(t){switch(t){case"":return"asc";case"asc":return"desc";case"desc":return"";default:return""}},handleClickSortBtn(t){this.$emit("change-active",this.data.name),this.currentSort=this.changeCurrentSort(t);const e=this.$route.query,{sort:n,...i}=e,r=this.currentSort?`${this.data.name}-${this.currentSort}`:"";this.$router.replace({query:{...i,...r&&{sort:r}}})},isValueEqualToSelected(t){return`${this.data.name}-${t}`===this.selectedSortParam}}},_U={scope:"col",class:"text-start px-2 py-1"},bU={class:"flex-shrink-0 size-3.5",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},xU={key:0,d:"m7 15 5 5 5-5"},vU={key:1,d:"m7 9 5-5 5 5"},wU={key:1,class:"text-sm text-stone-500 px-[4px] py-2.5 text-start font-normal"};function kU(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("th",_U,[a.getVisibleIcon?(f.openBlock(),f.createElementBlock("button",{key:0,type:"button",class:"text-sm text-stone-500 px-[4px] py-2.5 text-start font-normal flex items-center gap-[6px]",onClick:e[0]||(e[0]=u=>a.handleClickSortBtn(r.currentSort))},[f.createTextVNode(f.toDisplayString(a.label)+" ",1),(f.openBlock(),f.createElementBlock("svg",bU,[r.currentSort==="asc"||r.currentSort===""?(f.openBlock(),f.createElementBlock("path",xU)):f.createCommentVNode("",!0),r.currentSort==="desc"||r.currentSort===""?(f.openBlock(),f.createElementBlock("path",vU)):f.createCommentVNode("",!0)]))])):(f.openBlock(),f.createElementBlock("p",wU,f.toDisplayString(a.label),1))])}const SU=je(yU,[["render",kU]]),EU={},CU={class:"flex-shrink-0 size-3.5",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function TU(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("svg",CU,e[0]||(e[0]=[f.createStaticVNode('<path d="M3 6h18"></path><path d="M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"></path><path d="M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"></path><line x1="10" x2="10" y1="11" y2="17"></line><line x1="14" x2="14" y1="11" y2="17"></line>',5)]))}const MU=je(EU,[["render",TU]]),AU={props:{height:{type:String,default:"16"},width:{type:String,default:"12"},color:{type:String,default:"black"}}},IU={style:{display:"none"}},PU=["height","width","fill"];function DU(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock(f.Fragment,null,[(f.openBlock(),f.createElementBlock("svg",IU,e[0]||(e[0]=[f.createElementVNode("symbol",{id:"icon-pencil",viewBox:"0 0 32 32"},[f.createElementVNode("path",{d:"M27 0c2.761 0 5 2.239 5 5 0 1.126-0.372 2.164-1 3l-2 2-7-7 2-2c0.836-0.628 1.874-1 3-1zM2 23l-2 9 9-2 18.5-18.5-7-7-18.5 18.5zM22.362 11.362l-14 14-1.724-1.724 14-14 1.724 1.724z"})],-1)]))),(f.openBlock(),f.createElementBlock("svg",{height:n.height,width:n.width,fill:n.color},e[1]||(e[1]=[f.createElementVNode("use",{"xlink:href":"#icon-pencil"},null,-1)]),8,PU))],64)}const OU={components:{IconMore:IS,IconDelete:MU,IconEdit:je(AU,[["render",DU]])},emits:["updateTable"],props:{item:Object,table:String,isForm:null,actions:Array,default:()=>[]},data(){return{formVisible:!1,isDeleteConfirm:!1,formValue:{},top:0,left:0}},computed:{getCustomActions(){return this.actions.filter(t=>typeof t=="object")}},methods:{openConfirm(){this.isDeleteConfirm=!0,document.querySelector("body").click()},async getData(){var t;try{const{data:e}=await it.get(`/api/table/${this.table}/${(t=this.item)==null?void 0:t.id}`);this.formValue=e}catch(e){console.error(e)}},doSomethingOnCancel(){this.formVisible=!1},async deleteElement(){var t;try{const{data:e}=await it.get(`/api/table/${this.table}/${(t=this.item)==null?void 0:t.id}`);await it.delete(`/api/table/${e==null?void 0:e.token}`),await this.$notify({title:"Успішно!",message:"Об`єкт успішно видалeно",type:"success"}),await this.$emit("update-table")}catch{this.$notify({title:"Помилка!",message:"Сталася помилка",type:"error"})}finally{this.isDeleteConfirm=!1}},async customButtonAction(t){var e;document.querySelector("body").click(),t!=null&&t.form?(await this.$v3plugin.$form({form:t==null?void 0:t.form,id:(e=this.item)==null?void 0:e.id,api:t==null?void 0:t.api,title:t==null?void 0:t.title}),await this.$emit("update-table")):await this.$v3plugin.$api({confirm:t==null?void 0:t.confirm,api:t==null?void 0:t.api,method:t==null?void 0:t.method})}}},BU={class:"hs-dropdown [--placement:bottom-right] inline-flex"},zU={class:"inline-flex items-center justify-center bg-white border rounded-lg shadow-sm size-7 gap-x-2 border-stone-200 text-stone-800 hover:bg-stone-50 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-stone-50"},NU={class:"flex flex-col items-start"},RU=["onClick"],LU={class:"text-gray-800"},VU={key:1,class:"h-[1px] w-[80%] bg-gray-200 ml-auto mr-auto"},FU={class:"p-4"},$U={class:"flex justify-end mt-4 gap-x-3"};function jU(t,e,n,i,r,a){const u=f.resolveComponent("IconMore"),l=f.resolveComponent("IconEdit"),g=f.resolveComponent("router-link"),b=f.resolveComponent("IconDelete"),w=f.resolveComponent("VsPopover"),E=f.resolveComponent("VsDialog");return f.openBlock(),f.createElementBlock(f.Fragment,null,[f.createElementVNode("div",BU,[f.createVNode(w,{trigger:"click",placement:"bottom-left"},{reference:f.withCtx(()=>[f.createElementVNode("button",zU,[f.createVNode(u,{height:"16",width:"16"})])]),default:f.withCtx(()=>{var C,P,D,R,$;return[f.createElementVNode("div",NU,[(C=n.actions)!=null&&C.includes("edit")&&n.isForm?(f.openBlock(),f.createBlock(g,{key:0,to:`/edit?table=${(D=(P=t.$route)==null?void 0:P.params)==null?void 0:D.catchAll}&id=${(R=n.item)==null?void 0:R.id}`,class:"w-full flex items-center gap-x-3 py-1.5 px-2 rounded-lg text-[13px] text-stone-800 hover:bg-stone-100 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-stone-100"},{default:f.withCtx(()=>[f.createVNode(l,{color:"#000"}),e[4]||(e[4]=f.createTextVNode(" Редагувати "))]),_:1},8,["to"])):f.createCommentVNode("",!0),(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(a.getCustomActions,(W,te)=>(f.openBlock(),f.createElementBlock("button",{key:te,onClick:G=>a.customButtonAction(W),class:"w-full flex items-center gap-x-3 py-1.5 px-2 rounded-lg text-[13px] text-stone-800 hover:bg-stone-100 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-stone-100"},[f.createVNode(b,{class:"opacity-0"}),f.createElementVNode("span",LU,f.toDisplayString(W==null?void 0:W.label),1)],8,RU))),128)),n.isForm?(f.openBlock(),f.createElementBlock("div",VU)):f.createCommentVNode("",!0),($=n.actions)!=null&&$.includes("del")?(f.openBlock(),f.createElementBlock("button",{key:2,onClick:e[0]||(e[0]=f.withModifiers((...W)=>a.openConfirm&&a.openConfirm(...W),["stop"])),class:"w-full flex items-center gap-x-3 py-1.5 px-2 rounded-lg text-[13px] text-stone-800 hover:bg-stone-100 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-stone-100"},[f.createVNode(b),e[5]||(e[5]=f.createElementVNode("span",{class:"text-gray-800"},"Видалити",-1))])):f.createCommentVNode("",!0)])]}),_:1})]),f.createVNode(E,{visible:r.isDeleteConfirm,"onUpdate:visible":e[3]||(e[3]=C=>r.isDeleteConfirm=C),size:"small",title:"Ви впевнені?"},{default:f.withCtx(()=>[f.createElementVNode("div",FU,[e[6]||(e[6]=f.createElementVNode("p",{class:"mt-1 text-gray-500 dark:text-neutral-500"}," Ви впевнені, що хочете видалити цей об'єкт? ",-1)),f.createElementVNode("div",$U,[f.createElementVNode("button",{type:"button",class:"inline-flex items-center px-3 py-2 text-sm font-medium text-gray-800 bg-white border border-gray-200 rounded-lg shadow-sm gap-x-2 hover:bg-gray-50 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-gray-50 dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700",onClick:e[1]||(e[1]=C=>r.isDeleteConfirm=!1)}," Скасувати "),f.createElementVNode("button",{type:"button",class:"inline-flex items-center px-3 py-2 text-sm font-semibold text-white bg-red-500 border border-transparent rounded-lg gap-x-2 hover:bg-red-600 disabled:opacity-50 disabled:pointer-events-none",onClick:e[2]||(e[2]=(...C)=>a.deleteElement&&a.deleteElement(...C))}," Так, я впевнена/ий ")])])]),_:1},8,["visible"])],64)}const UU=je(OU,[["render",jU]]),HU={},qU={class:"flex-shrink-0 mt-0.5 size-3.5",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function WU(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("svg",qU,e[0]||(e[0]=[f.createElementVNode("path",{d:"m3 16 4 4 4-4"},null,-1),f.createElementVNode("path",{d:"M7 20V4"},null,-1),f.createElementVNode("path",{d:"m21 8-4-4-4 4"},null,-1),f.createElementVNode("path",{d:"M17 4v16"},null,-1)]))}const GU=je(HU,[["render",WU]]),ZU={},YU={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-rosette-discount-check"};function XU(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("svg",YU,e[0]||(e[0]=[f.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),f.createElementVNode("path",{d:"M5 7.2a2.2 2.2 0 0 1 2.2 -2.2h1a2.2 2.2 0 0 0 1.55 -.64l.7 -.7a2.2 2.2 0 0 1 3.12 0l.7 .7c.412 .41 .97 .64 1.55 .64h1a2.2 2.2 0 0 1 2.2 2.2v1c0 .58 .23 1.138 .64 1.55l.7 .7a2.2 2.2 0 0 1 0 3.12l-.7 .7a2.2 2.2 0 0 0 -.64 1.55v1a2.2 2.2 0 0 1 -2.2 2.2h-1a2.2 2.2 0 0 0 -1.55 .64l-.7 .7a2.2 2.2 0 0 1 -3.12 0l-.7 -.7a2.2 2.2 0 0 0 -1.55 -.64h-1a2.2 2.2 0 0 1 -2.2 -2.2v-1a2.2 2.2 0 0 0 -.64 -1.55l-.7 -.7a2.2 2.2 0 0 1 0 -3.12l.7 -.7a2.2 2.2 0 0 0 .64 -1.55v-1"},null,-1),f.createElementVNode("path",{d:"M9 12l2 2l4 -4"},null,-1)]))}const KU={components:{IconExport:GU,IconChevronDown:jS,IconSuccess:je(ZU,[["render",XU]])},props:{table:String,columns:Array,page:[String,Number],filterCustom:String,filterState:String,filters:String},data(){return{isOpen:!1,tableFormats:["json","csv","xlsx"],format:"",cols:[],activeAction:"",isSuccessTemplate:!1,actions:[{name:"choceAll",function:this.choceAll,label:"Вибрати усі"},{name:"choceVisible",function:this.choceVisible,label:"Вибрати поточні"},{name:"clearAll",function:this.clearAll,label:"Жодного"}]}},watch:{isOpen(t){t||(this.format="",this.cols=[],this.activeAction="",this.isSuccessTemplate=!1)}},methods:{async exportTable(){var t;if(!((t=this.cols)!=null&&t.length)){this.$notify({type:"error",title:"Помилка",message:"Оберіть колонки для експорту!"});return}if(!this.format){this.$notify({type:"error",title:"Помилка",message:"Оберіть формат!"});return}try{const e=await it.get("/api/export",{params:{table:this.table,format:this.format,cols:this.cols.join(","),page:this.page,filter:this.filters||null,state:this.filterState||null,custom:this.filterCustom||null},responseType:"blob"}),n=new Blob([e.data],{type:"application/octet-stream"}),i=window.URL.createObjectURL(n),r=document.createElement("a");r.href=i,r.setAttribute("download",`${this.table.split(".")[0]}.${this.format}`),document.body.appendChild(r),r.click(),document.body.removeChild(r),window.URL.revokeObjectURL(i),this.$notify({type:"success",title:"Експорт",message:"Файл успішно експортовано!"}),this.isSuccessTemplate=!0}catch(e){console.error("Ошибка при экспорте файла:",e),this.$notify({type:"error",title:"Помилка",message:"Не вдалося експортувати файл."})}},selectFormat(t){this.format=t},choceAll(){var t;this.cols=(t=this.columns)==null?void 0:t.map(e=>e==null?void 0:e.name),this.activeAction="choceAll"},clearAll(){this.cols=[],this.activeAction="clearAll"},choceVisible(){var t,e;this.cols=(e=(t=this.columns)==null?void 0:t.filter(n=>(n==null?void 0:n.hidden)!==!0))==null?void 0:e.map(n=>n==null?void 0:n.name),this.activeAction="choceVisible"}}},JU={key:0,class:"flex flex-col items-center"},QU={key:1,class:"p-4"},eH={class:"pb-5 mb-5 border-b border-gray-200 last:pb-0 last:mb-0 last:border-b-0 dark:border-neutral-700"},tH={class:"flex items-center"},nH={class:"flex items-center gap-[10px] ml-auto"},iH=["onClick"],rH={key:0,class:"block h-[8px] w-[8px] rounded-full bg-blue-500"},oH={class:"mt-2 flex row flex-wrap gap-y-[5px] gap-x-[10px]"},sH={class:"pb-5 mb-5 border-b border-gray-200 last:pb-0 last:mb-0 last:border-b-0 dark:border-neutral-700"},aH={class:"mt-2 space-y-2"},lH=["id","onChange"],cH=["for"],uH={key:0,class:"flex w-full justify-end p-[20px] gap-[6px] border-t"},hH={key:1,class:"flex w-full justify-end p-[20px] gap-[6px] border-t"};function dH(t,e,n,i,r,a){const u=f.resolveComponent("IconExport"),l=f.resolveComponent("IconChevronDown"),g=f.resolveComponent("IconSuccess"),b=f.resolveComponent("VsCheckbox"),w=f.resolveComponent("VsDialog");return f.openBlock(),f.createElementBlock(f.Fragment,null,[f.createElementVNode("button",{onClick:e[0]||(e[0]=E=>r.isOpen=!0),class:"py-2 px-2.5 inline-flex items-center gap-x-1.5 text-xs font-medium rounded-lg border border-gray-200 bg-white text-gray-800 shadow-sm hover:bg-gray-50 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-gray-50 dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700"},[f.createVNode(u,{height:"16",width:"16"}),e[7]||(e[7]=f.createTextVNode(" Експорт ")),f.createVNode(l,{height:"12",width:"16"})]),f.createVNode(w,{visible:r.isOpen,"onUpdate:visible":e[6]||(e[6]=E=>r.isOpen=E),title:"Експорт таблиці",size:"small",closeClickBack:!0},{footer:f.withCtx(()=>[r.isSuccessTemplate?(f.openBlock(),f.createElementBlock("div",uH,[f.createElementVNode("button",{type:"button",class:"inline-flex items-center justify-center px-3 py-2 text-sm font-medium text-gray-800 align-middle bg-white border border-gray-200 rounded-lg shadow-sm text-nowrap text-start hover:bg-gray-50 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700",onClick:e[2]||(e[2]=E=>r.isOpen=!1)}," Закрити "),f.createElementVNode("button",{type:"button",class:"inline-flex items-center justify-center px-3 py-2 text-sm font-medium text-white align-middle bg-blue-600 border border-blue-600 rounded-lg shadow-sm text-nowrap gap-x-2 text-start hover:bg-blue-700 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:ring-1 focus:ring-blue-300 dark:focus:ring-blue-500",onClick:e[3]||(e[3]=E=>r.isSuccessTemplate=!1)}," Вигрузити ще ")])):(f.openBlock(),f.createElementBlock("div",hH,[f.createElementVNode("button",{type:"button",class:"inline-flex items-center justify-center px-3 py-2 text-sm font-medium text-gray-800 align-middle bg-white border border-gray-200 rounded-lg shadow-sm text-nowrap text-start hover:bg-gray-50 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700",onClick:e[4]||(e[4]=E=>r.isOpen=!1)}," Скасувати "),f.createElementVNode("button",{type:"button",class:"inline-flex items-center justify-center px-3 py-2 text-sm font-medium text-white align-middle bg-blue-600 border border-blue-600 rounded-lg shadow-sm text-nowrap gap-x-2 text-start hover:bg-blue-700 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:ring-1 focus:ring-blue-300 dark:focus:ring-blue-500",onClick:e[5]||(e[5]=(...E)=>a.exportTable&&a.exportTable(...E))}," Завантажити таблицю ")]))]),default:f.withCtx(()=>[r.isSuccessTemplate?(f.openBlock(),f.createElementBlock("div",JU,[f.createVNode(g,{height:"100",width:"100",class:"text-green-200 mb-[20px]"}),e[8]||(e[8]=f.createElementVNode("h2",null,"Звіт сформовано і збережено",-1))])):(f.openBlock(),f.createElementBlock("div",QU,[f.createElementVNode("div",eH,[f.createElementVNode("div",tH,[e[9]||(e[9]=f.createElementVNode("h2",{class:"text-sm text-gray-500"}," Виберіть стовпці таблиці для експорту: ",-1)),f.createElementVNode("div",nH,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(r.actions,E=>(f.openBlock(),f.createElementBlock("button",{key:E==null?void 0:E.name,onClick:E==null?void 0:E.function,class:"inline-flex items-center gap-[8px] justify-center px-3 py-2 text-sm font-medium text-gray-800 align-middle bg-white border-gray-200 text-nowrap text-start"},[f.createElementVNode("span",{class:f.normalizeClass(["h-[14px] w-[14px] border rounded-full flex items-center justify-center",{"border-blue-500":(E==null?void 0:E.name)===r.activeAction}])},[(E==null?void 0:E.name)===r.activeAction?(f.openBlock(),f.createElementBlock("span",rH)):f.createCommentVNode("",!0)],2),f.createTextVNode(" "+f.toDisplayString(E==null?void 0:E.label),1)],8,iH))),128))])]),f.createElementVNode("div",oH,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(n.columns,(E,C)=>(f.openBlock(),f.createElementBlock("div",{class:"flex items-center",key:C,style:{width:"calc((100% - 10px) / 2)"}},[f.createVNode(b,{class:"[&>label]:text-sm [&>label]:text-gray-800 [&>label]:ms-3 !gap-x-[1px] !p-0",modelValue:r.cols,"onUpdate:modelValue":e[1]||(e[1]=P=>r.cols=P),value:E==null?void 0:E.name,label:E==null?void 0:E.ua},null,8,["modelValue","value","label"])]))),128))])]),f.createElementVNode("div",sH,[e[10]||(e[10]=f.createElementVNode("h2",{class:"text-sm text-gray-500"},"Виберіть формат таблиці:",-1)),f.createElementVNode("div",aH,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(r.tableFormats,(E,C)=>(f.openBlock(),f.createElementBlock("div",{class:"flex items-center",key:C},[f.createElementVNode("input",{type:"radio",name:"hs-pro-duecmfm",class:"text-blue-600 border-gray-300 rounded-full shrink-0 focus:ring-blue-500 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-800 dark:border-neutral-500 dark:checked:bg-blue-500 dark:checked:border-blue-500 dark:focus:ring-offset-gray-800",id:E,onChange:P=>a.selectFormat(E)},null,40,lH),f.createElementVNode("label",{for:E,class:"text-sm text-gray-800 ms-3 dark:text-neutral-400"}," Формат "+f.toDisplayString(E),9,cH)]))),128))])])]))]),_:1},8,["visible"])],64)}const pH=je(KU,[["render",dH]]),fH={},mH={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-columns"};function gH(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("svg",mH,e[0]||(e[0]=[f.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M4 6l5.5 0"></path><path d="M4 10l5.5 0"></path><path d="M4 14l5.5 0"></path><path d="M4 18l5.5 0"></path><path d="M14.5 6l5.5 0"></path><path d="M14.5 10l5.5 0"></path><path d="M14.5 14l5.5 0"></path><path d="M14.5 18l5.5 0"></path>',9)]))}const yH=je(fH,[["render",gH]]),_H={props:{column:Object},emits:["update-column"],data(){return{value:!1}},watch:{value(t){this.$emit("update-column",{...this.column,hidden:!t})}},mounted(){var t;((t=this.column)==null?void 0:t.hidden)!==!0&&(this.value=!0)}},bH={class:"flex w-full gap-[8px] items-centr"};function xH(t,e,n,i,r,a){var u,l;return f.openBlock(),f.createElementBlock("label",bH,[f.withDirectives(f.createElementVNode("input",{"onUpdate:modelValue":e[0]||(e[0]=g=>r.value=g),type:"checkbox"},null,512),[[f.vModelCheckbox,r.value]]),f.createTextVNode(" "+f.toDisplayString(((u=n.column)==null?void 0:u.ua)||((l=n.column)==null?void 0:l.title)),1)])}const vH={components:{IconColumns:yH,AdminTableColumnsHiddenItem:je(_H,[["render",xH]])},emits:["update-columns"],props:{columns:Array},methods:{updateColumn(t){const e=this.columns.findIndex(i=>(i==null?void 0:i.name)===(t==null?void 0:t.name)),n=this.columns;n[e]=t,this.$emit("update-columns",[...n])}}},wH={class:"py-2 px-2.5 inline-flex items-center gap-x-1.5 text-xs font-medium rounded-lg border border-gray-200 bg-white text-gray-800 shadow-sm hover:bg-gray-50 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-gray-50 dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700"},kH={class:"py-[10px] px-[10px] w-[260px]"},SH={class:"flex flex-col gap-[3px] max-h-[400px] w-full overflow-auto [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar:horizontal]:h-[8px] [&::-webkit-scrollbar-track]:bg-gray-100 [&::-webkit-scrollbar-thumb]:bg-gray-300 dark:[&::-webkit-scrollbar-track]:bg-neutral-700 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500"};function EH(t,e,n,i,r,a){const u=f.resolveComponent("IconColumns"),l=f.resolveComponent("AdminTableColumnsHiddenItem"),g=f.resolveComponent("VsPopover");return f.openBlock(),f.createBlock(g,{trigger:"click",placement:"bottom"},{reference:f.withCtx(()=>[f.createElementVNode("button",wH,[f.createVNode(u,{height:"20",width:"16"})])]),default:f.withCtx(()=>[f.createElementVNode("div",kH,[e[0]||(e[0]=f.createElementVNode("h2",{class:"text-sm mb-[8px]"},"Оберіть колонки, щоб приховати",-1)),f.createElementVNode("ul",SH,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(n.columns,(b,w)=>(f.openBlock(),f.createElementBlock("li",{key:w},[f.createVNode(l,{column:b,onUpdateColumn:a.updateColumn},null,8,["column","onUpdateColumn"])]))),128))])])]),_:1})}const CH=je(vH,[["render",EH]]),TH={},MH={class:"hidden sm:block shrink-0 size-3",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",viewBox:"0 0 16 16"};function AH(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("svg",MH,e[0]||(e[0]=[f.createElementVNode("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M8 1C8.55228 1 9 1.44772 9 2V7L14 7C14.5523 7 15 7.44771 15 8C15 8.55228 14.5523 9 14 9L9 9V14C9 14.5523 8.55228 15 8 15C7.44772 15 7 14.5523 7 14V9.00001L2 9.00001C1.44772 9.00001 1 8.5523 1 8.00001C0.999999 7.44773 1.44771 7.00001 2 7.00001L7 7.00001V2C7 1.44772 7.44772 1 8 1Z"},null,-1)]))}const US=je(TH,[["render",AH]]),IH={props:{row:Object,column:Object,table:String}};function PH(t,e,n,i,r,a){var u,l,g,b,w,E,C,P;return f.openBlock(),f.createBlock(f.resolveDynamicComponent(((u=n.column)==null?void 0:u.format)==="custom"?(l=n.column)==null?void 0:l.component:`table-format-${((b=(g=n.column)==null?void 0:g.format)==null?void 0:b.toLowerCase())||"text"}`),{onUpdateTable:e[0]||(e[0]=D=>t.$emit("update-table")),name:(w=n.column)==null?void 0:w.name,data:n.row,value:(C=n.row)==null?void 0:C[(E=n.column)==null?void 0:E.name],table:n.table,column:n.column,edit:(P=n.column)==null?void 0:P.edit},null,40,["name","data","value","table","column","edit"])}const HS=je(IH,[["render",PH]]),DH={},OH={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-minus"};function BH(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("svg",OH,e[0]||(e[0]=[f.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),f.createElementVNode("path",{d:"M5 12l14 0"},null,-1)]))}const zH={components:{IconPlus:US,IconMinus:je(DH,[["render",BH]])},props:{title:String,defaultValue:{type:Boolean,default:()=>!1}},data(){return{expanded:this.defaultValue}}},NH={class:"hs-accordion"},RH={class:"py-0.5 flex items-center gap-x-0.5 w-full"},LH={class:"text-sm font-medium"},VH={class:"relative inline-block w-full duration-150 cursor-pointer before:block before:absolute b"};function FH(t,e,n,i,r,a){const u=f.resolveComponent("IconPlus"),l=f.resolveComponent("IconMinus");return f.openBlock(),f.createElementBlock("div",null,[f.createElementVNode("div",null,[f.createElementVNode("div",NH,[f.createElementVNode("div",RH,[f.createElementVNode("div",{onClick:e[0]||(e[0]=g=>r.expanded=!r.expanded),class:"rounded-md cursor-pointer grow"},[f.createElementVNode("span",LH,f.toDisplayString(n.title),1)]),f.createElementVNode("button",{class:"flex items-center justify-center rounded-md size-6 hover:bg-gray-100",onClick:e[1]||(e[1]=g=>r.expanded=!r.expanded)},[r.expanded?(f.openBlock(),f.createBlock(l,{key:1,width:"14"})):(f.openBlock(),f.createBlock(u,{key:0}))])]),f.createVNode(f.Transition,{name:"fade"},{default:f.withCtx(()=>[f.withDirectives(f.createElementVNode("div",VH,[f.renderSlot(t.$slots,"default",{},void 0,!0)],512),[[f.vShow,r.expanded]])]),_:3})])])])}const $H={components:{AdminComponentIs:HS,AdminTree:je(zH,[["render",FH],["__scopeId","data-v-c6318482"]]),VsNoData:RS,VsWidgetComments:DS,VsWidgetMap:K1,VsWidgetFileList:Xv},props:{table:String,columns:Array,row:Object}},jH={class:"hs-accordion border-gray-100 w-[360px] shrink-0 overflow-auto [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar:horizontal]:h-[8px] [&::-webkit-scrollbar-track]:bg-gray-100 [&::-webkit-scrollbar-thumb]:bg-gray-300 dark:[&::-webkit-scrollbar-track]:bg-neutral-700 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500",style:{height:"calc(100vh - 310px)"}},UH={class:"border-l",style:{height:"calc(100vh - 360px)"}},HH={class:"flex items-center justify-between py-1 gap-x-4"},qH={class:"col-span-1"},WH={class:"inline-flex items-center gap-x-2 text-[13px] text-gray-500 dark:text-neutral-500"},GH={class:"col-span-2"},ZH={class:"font-medium text-[13px] text-gray-800 dark:text-neutral-200"},YH={class:"table-info-card"},XH={class:"table-info-card"};function KH(t,e,n,i,r,a){var C,P,D;const u=f.resolveComponent("AdminComponentIs"),l=f.resolveComponent("AdminTree"),g=f.resolveComponent("VsWidgetMap"),b=f.resolveComponent("VsNoData"),w=f.resolveComponent("VsWidgetComments"),E=f.resolveComponent("VsWidgetFileList");return f.openBlock(),f.createElementBlock("div",jH,[e[0]||(e[0]=f.createElementVNode("div",{class:"p-[10px] pl-[18px] pb-[18px] border-b"},[f.createElementVNode("h2",{class:"text-sm font-medium"},"Інформація про об'єкт")],-1)),f.createElementVNode("div",UH,[(P=(C=t.$route)==null?void 0:C.query)!=null&&P.card?(f.openBlock(),f.createElementBlock(f.Fragment,{key:0},[n.row?(f.openBlock(),f.createBlock(l,{key:0,defaultValue:!0,title:"Основна інформація",class:"border-b p-[10px] py-[16px]"},{default:f.withCtx(()=>[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(n.columns,R=>(f.openBlock(),f.createElementBlock("dl",HH,[f.createElementVNode("dt",qH,[f.createElementVNode("p",WH,f.toDisplayString((R==null?void 0:R.ua)||(R==null?void 0:R.title))+": ",1)]),f.createElementVNode("dd",GH,[f.createElementVNode("p",ZH,[f.createVNode(u,{row:n.row,column:R,table:n.table},null,8,["row","column","table"])])])]))),256))]),_:1})):f.createCommentVNode("",!0),(D=n.row)!=null&&D.geom?(f.openBlock(),f.createBlock(l,{key:1,title:"Карта",class:"border-b p-[10px] py-[16px]"},{default:f.withCtx(()=>{var R,$;return[(R=n.row)!=null&&R.geom?(f.openBlock(),f.createBlock(g,{key:0,geometry:($=n.row)==null?void 0:$.geom,zoom:14},null,8,["geometry"])):(f.openBlock(),f.createBlock(b,{key:1,title:"У об'єкта відсутня геометрія",text:"",class:"[&>div]:h-[200px] [&>div]:min-h-[400px] h-[400px]"}))]}),_:1})):f.createCommentVNode("",!0),f.createVNode(l,{title:"Коментарі",class:"border-b p-[10px] py-[16px]"},{default:f.withCtx(()=>{var R;return[f.createElementVNode("div",YH,[f.createVNode(w,{id:(R=n.row)==null?void 0:R.id},null,8,["id"])])]}),_:1}),f.createVNode(l,{title:"Файли",class:"border-b p-[10px] py-[16px]"},{default:f.withCtx(()=>{var R;return[f.createElementVNode("div",XH,[f.createVNode(E,{id:(R=n.row)==null?void 0:R.id},null,8,["id"])])]}),_:1})],64)):(f.openBlock(),f.createBlock(b,{key:1,text:"Оберіть один з об'єктів в таблиці для відображення інформаціі про нього"}))])])}const JH=je($H,[["render",KH]]),QH={},eq={class:"hidden xl:block shrink-0 size-4",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function tq(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("svg",eq,e[0]||(e[0]=[f.createElementVNode("rect",{width:"18",height:"18",x:"3",y:"3",rx:"2"},null,-1),f.createElementVNode("path",{d:"M15 3v18"},null,-1),f.createElementVNode("path",{d:"m8 9 3 3-3 3"},null,-1)]))}const nq=je(QH,[["render",tq]]),iq={},rq={class:"h21yx vs0hq",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function oq(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("svg",rq,e[0]||(e[0]=[f.createStaticVNode('<line x1="21" x2="14" y1="4" y2="4"></line><line x1="10" x2="3" y1="4" y2="4"></line><line x1="21" x2="12" y1="12" y2="12"></line><line x1="8" x2="3" y1="12" y2="12"></line><line x1="21" x2="16" y1="20" y2="20"></line><line x1="12" x2="3" y1="20" y2="20"></line><line x1="14" x2="14" y1="2" y2="6"></line><line x1="8" x2="8" y1="10" y2="14"></line><line x1="16" x2="16" y1="18" y2="22"></line>',9)]))}const sq={emits:["filterChange"],props:{scheme:{type:Object},onFilters:{type:Number}},components:{IconFilter:je(iq,[["render",oq]])},data(){return{isFilters:!1}},methods:{closeFilter({target:t}){this.isFilters&&t.classList.contains("filter-container")&&(this.isFilters=!1)}}},aq={key:0,class:"font-medium text-[10px] py-0.5 px-[5px] bg-gray-800 text-white leading-3 rounded-full dark:bg-neutral-500"},lq={class:"filter-content h-screen bg-white w-[400px] p-[20px] pt-[10px] overflow-x-auto bg-white [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar:horizontal]:h-[8px] [&::-webkit-scrollbar-track]:bg-gray-100 [&::-webkit-scrollbar-thumb]:bg-gray-300 dark:[&::-webkit-scrollbar-track]:bg-neutral-700 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500"};function cq(t,e,n,i,r,a){const u=f.resolveComponent("IconFilter"),l=f.resolveComponent("VsFilter");return f.openBlock(),f.createElementBlock(f.Fragment,null,[f.createElementVNode("button",{onClick:e[0]||(e[0]=g=>r.isFilters=!r.isFilters),class:"py-2 px-2.5 inline-flex items-center gap-x-1.5 text-xs font-medium rounded-lg border border-gray-200 bg-white text-gray-800 shadow-sm hover:bg-gray-50 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-gray-50 dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700"},[f.createVNode(u,{height:"16",width:"16"}),e[4]||(e[4]=f.createTextVNode(" Фільтри ")),n.onFilters?(f.openBlock(),f.createElementBlock("span",aq,f.toDisplayString(n.onFilters),1)):f.createCommentVNode("",!0)]),f.createVNode(f.Transition,{name:"fade"},{default:f.withCtx(()=>{var g;return[f.withDirectives(f.createElementVNode("div",{onClick:e[3]||(e[3]=(...b)=>a.closeFilter&&a.closeFilter(...b)),style:{height:"100vh"},class:"fixed filter-container top-0 flex justify-end items-center z-[2] right-0 left-0 bottom-0 bg-[rgba(0,0,0,0.5)]"},[f.createElementVNode("div",lq,[(g=n.scheme)!=null&&g.length?(f.openBlock(),f.createBlock(l,{key:0,ref:"filter",scheme:n.scheme,layout:"default","apply-vue-router":"",history:"",name:"filter",onFilterChange:e[1]||(e[1]=b=>t.$emit("filterChange",b)),closeFilterBtn:!0,onFilterClose:e[2]||(e[2]=b=>r.isFilters=!1)},null,8,["scheme"])):f.createCommentVNode("",!0)])],512),[[f.vShow,r.isFilters]])]}),_:1})],64)}const uq=je(sq,[["render",cq]]),hq={props:{tabsList:{type:Array,default:()=>[]},filterState:String}},dq={class:"relative flex space-x-1 mb-[20px] after:absolute after:w-[99%] after:bottom-0 after:inset-x-0 after:border-b-2 after:border-gray-200 dark:after:border-neutral-700","aria-label":"Tabs",role:"tablist","aria-orientation":"horizontal"},pq=["onClick"];function fq(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("nav",dq,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(n.tabsList,u=>(f.openBlock(),f.createElementBlock("button",{onClick:l=>t.$emit("update:filterState",u==null?void 0:u.name),class:f.normalizeClass(["hs-tab-active:after:bg-gray-800 hs-tab-active:text-gray-800 px-2.5 py-1.5 mb-2 relative inline-flex justify-center items-center gap-x-2 hover:bg-gray-100 text-gray-500 hover:text-gray-800 text-sm rounded-lg disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-gray-100 after:absolute after:-bottom-2 after:inset-x-0 after:z-10 after:h-0.5 after:pointer-events-none dark:hs-tab-active:text-neutral-200 dark:hs-tab-active:after:bg-neutral-400 dark:text-neutral-500 dark:hover:text-neutral-300 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700 active",{" font-semibold after:absolute after:bottom-[-8px] after:left-2.5 after:right-2.5 after:z-10 after:h-0.5 after:bg-gray-800":(u==null?void 0:u.name)===n.filterState}])},f.toDisplayString(u==null?void 0:u.label),11,pq))),256))])}const mq=je(hq,[["render",fq]]),gq={},yq={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-filter"};function _q(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("svg",yq,e[0]||(e[0]=[f.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),f.createElementVNode("path",{d:"M4 4h16v2.172a2 2 0 0 1 -.586 1.414l-4.414 4.414v7l-6 2v-8.5l-4.48 -4.928a2 2 0 0 1 -.52 -1.345v-2.227z"},null,-1)]))}const bq={components:{IconFilter2:je(gq,[["render",_q]])},props:{filterCustom:String,customList:Array}},xq={class:"py-2 px-2.5 inline-flex items-center gap-x-1.5 text-xs font-medium rounded-lg border border-gray-200 bg-white text-gray-800 shadow-sm hover:bg-gray-50 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-gray-50 dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700"},vq={class:"flex flex-col gap-[4px]"},wq=["onClick"];function kq(t,e,n,i,r,a){const u=f.resolveComponent("IconFilter2"),l=f.resolveComponent("VsPopover");return f.openBlock(),f.createBlock(l,{ref:"popover",placement:"bottom"},{reference:f.withCtx(()=>[f.createElementVNode("button",xq,[f.createVNode(u,{height:"20",width:"20"})])]),default:f.withCtx(()=>[f.createElementVNode("div",vq,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(n.customList,(g,b)=>(f.openBlock(),f.createElementBlock("button",{onClick:w=>{var E;t.$emit("update:filterCustom",g==null?void 0:g.name),(E=t.$refs)==null||E.popover.togglePopover()},key:b,class:f.normalizeClass(["p-[8px] block rounded-lg w-[140px] text-start hover:bg-gray-100 !duration-300",{"bg-gray-100":n.filterCustom===(g==null?void 0:g.name)}])},f.toDisplayString(g==null?void 0:g.label),11,wq))),128)),f.createElementVNode("button",{class:"p-[8px] block rounded-lg w-[140px] text-start hover:bg-gray-100 !duration-300",onClick:e[0]||(e[0]=g=>{var b;t.$emit("update:filterCustom",void 0),(b=t.$refs)==null||b.popover.togglePopover()})}," Скинути фільтри ")])]),_:1},512)}const Sq=je(bq,[["render",kq]]),Eq={class:"flex items-center gap-x-2"},Cq={props:{table:String,title:String},components:{AdminTableControl:UU,AdminTableExport:pH,AdminTableColumnsHidden:CH,AdminTableColumn:SU,AdminNodata:zS,IconPlus:US,IconSearch:t_,AdminTableCardInfo:JH,IconOpenCard:nq,AdminComponentIs:HS,AdminTableFilters:uq,AdminTableTabs:mq,AdminTableCustomFilters:Sq,AdminTableCustomButtons:{__name:"admin-table-custom-buttons",props:{slots:Object},setup(t){var l,g,b,w,E;const{asyncTemplateSlot:e}=(E=(w=(b=(g=(l=f.getCurrentInstance())==null?void 0:l.appContext)==null?void 0:g.app)==null?void 0:b.config)==null?void 0:w.globalProperties)==null?void 0:E.utils,n=f.ref(""),i=f.ref(""),r=t,a=()=>{var C,P,D,R,$;if((C=r.slots)!=null&&C.panelLeft||(i.value="div"),(D=(P=r.slots)==null?void 0:P.panelLeft)!=null&&D.includes("<")){const W=e("PanelLeft",(R=r.slots)==null?void 0:R.panelLeft,["name"]);i.value=W}else i.value=($=r.slots)==null?void 0:$.panelLeft},u=()=>{var C,P,D,R,$;if((C=r.slots)!=null&&C.panelRight||(n.value="div"),(D=(P=r.slots)==null?void 0:P.panelRight)!=null&&D.includes("<")){const W=e("PanelRight",(R=r.slots)==null?void 0:R.panelRight,["name"]);n.value=W}else n.value=($=r.slots)==null?void 0:$.panelRight};return a(),u(),(C,P)=>(f.openBlock(),f.createElementBlock("div",Eq,[(f.openBlock(),f.createBlock(f.resolveDynamicComponent(i.value))),(f.openBlock(),f.createBlock(f.resolveDynamicComponent(n.value)))]))}}},data(){return{tableData:{},filterScheme:[],page:1,searchValue:"",limit:0,filters:null,activeColumn:"",isVisibleCardInfo:!1,onFilters:0,filterState:null,filterCustom:null,visibleColumns:[],initialHiddenColumns:""}},async mounted(){await this.checkUrlMounted(),await this.getTableData(),await this.getFilters()},computed:{defaultPage(){var t,e;return((e=(t=this.$route)==null?void 0:t.query)==null?void 0:e.page)||1},columns(){var t,e;return(e=(t=this.tableData)==null?void 0:t.columns)==null?void 0:e.filter(n=>(n==null?void 0:n.hidden)!==!0)},isForm(){var t;return(t=this.tableData)==null?void 0:t.form},isNoData(){var t,e;return!((t=this.tableData)!=null&&t.rows)||!((e=this.columns)!=null&&e.length)},activeCardRow(){var t,e;return((e=(t=this.tableData)==null?void 0:t.rows)==null?void 0:e.find(n=>{var i,r;return(n==null?void 0:n.id)===((r=(i=this.$route)==null?void 0:i.query)==null?void 0:r.card)}))||{}},getActions(){var t;return(t=this.tableData)==null?void 0:t.actions}},watch:{async table(){this.tableData=null,await this.getTableData()},searchValue:{handler:((t,e=300)=>{let n;return function(...i){clearTimeout(n),n=setTimeout(()=>{t.apply(this,i)},e)}})(async function(t){var e;await this.getTableData(),this.$router.push({...this.$route,query:{...(e=this.$route)==null?void 0:e.query,search:t||void 0}})},500)},$route:{handler(t,e){var n,i;((n=t==null?void 0:t.params)==null?void 0:n.catchAll)!==((i=e==null?void 0:e.params)==null?void 0:i.catchAll)&&(this.visibleColumns=[],this.unmountedData(),this.getFilters())},deep:!0},limit(t){var e;this.$router.replace({query:{...(e=this.$route)==null?void 0:e.query,limit:t}})},filterState(t){var e;t&&(this.$router.replace({...this.$route,query:{...(e=this.$route)==null?void 0:e.query,filterState:t}}),this.getTableData())},filterCustom(t){var e;this.$router.replace({...this.$route,query:{...(e=this.$route)==null?void 0:e.query,custom:t}}),this.getTableData()},columns(t){var e,n,i,r;this.visibleColumns=t==null?void 0:t.map(a=>a==null?void 0:a.name),this.initialHiddenColumns===((e=this.visibleColumns)==null?void 0:e.join(","))&&(this.visibleColumns=[]),this.$router.replace({...this.$route,query:{...(n=this.$route)==null?void 0:n.query,columns:(i=this.visibleColumns)!=null&&i.length?(r=this.visibleColumns)==null?void 0:r.join(","):void 0}})}},methods:{async checkUrlMounted(){var t,e,n,i,r,a,u,l,g,b,w,E,C,P,D,R,$;this.page=((e=(t=this.$route)==null?void 0:t.query)==null?void 0:e.page)||1,this.limit=((i=(n=this.$route)==null?void 0:n.query)==null?void 0:i.limit)||20,this.filters=((u=decodeURI((a=(r=this.$route)==null?void 0:r.query)==null?void 0:a.filter))==null?void 0:u.replaceAll("+"," "))||null,this.filterState=((g=(l=this.$route)==null?void 0:l.query)==null?void 0:g.filterState)||null,this.filterCustom=((w=(b=this.$route)==null?void 0:b.query)==null?void 0:w.custom)||null,this.searchValue=((C=(E=this.$route)==null?void 0:E.query)==null?void 0:C.search)||"",this.visibleColumns=((R=(D=(P=this.$route)==null?void 0:P.query)==null?void 0:D.columns)==null?void 0:R.split(","))||[],($=this.$route)!=null&&$.query.card&&(this.isVisibleCardInfo=!0)},rowWidth(t){var n,i;const e=(i=(n=this.tableData)==null?void 0:n.columns)==null?void 0:i.find(r=>r.name===t);if(e){const r=e==null?void 0:e.width;return typeof r=="number"?`${r}px`:r!=null&&r.includes("px")?r:`${r}px`}},unmountedData(){this.page=1,this.visibleColumns=[],this.filterCustom=null,this.filterState=null,this.isVisibleCardInfo=!1,this.filterScheme=null,this.filters=null,this.onFilters=0,this.searchValue=""},async getTableData(){var t,e,n,i,r,a,u,l,g,b,w;try{const{data:E}=await it.get(`/api/template/table/${this.table}`),C=await it.get(`/api/table-data/${this.table}`,{params:{page:this.page,search:this.searchValue||null,limit:this.limit,filter:this.filters||null,order:((e=(t=this.$route)==null?void 0:t.query)==null?void 0:e.sort)||null,state:this.filterState||null,custom:this.filterCustom||null}});this.tableData={...E,...(C==null?void 0:C.data)||{}},this.initialHiddenColumns=(a=(r=(i=(n=this.tableData)==null?void 0:n.columns)==null?void 0:i.filter(P=>(P==null?void 0:P.hidden)!==!0))==null?void 0:r.map(P=>P==null?void 0:P.name))==null?void 0:a.join(","),(u=this.visibleColumns)!=null&&u.length?(l=this.tableData)==null||l.columns.forEach(P=>{var D;(D=this.visibleColumns)!=null&&D.includes(P==null?void 0:P.name)?P.hidden=!1:P.hidden=!0}):this.visibleColumns=(w=(b=(g=this.tableData)==null?void 0:g.columns)==null?void 0:b.filter(P=>(P==null?void 0:P.hidden)!==!0))==null?void 0:w.map(P=>P==null?void 0:P.name)}catch{}},async getFilters(){var t;try{const{data:e}=await it.get(`/api/table-filter/${this.table}`);this.filterScheme=(t=e==null?void 0:e.list)==null?void 0:t.map(n=>({...n,label:(n==null?void 0:n.label)||(n==null?void 0:n.ua)}))}catch{}},async handlePageChange(t){const e=this.$route.query;this.page=t,!(!(e!=null&&e.page)&&t===1||e.page===t)&&(await this.$router.replace({query:{...e,page:t}}),await this.getTableData())},async changeLimit(t){this.limit=await t,this.defaultPage=1,await this.getTableData()},async filterChange({url:t,state:e}){var n;this.filters=t!=="no-url"?t:null,this.onFilters=(n=Object.entries(e))==null?void 0:n.length,this.page=1,await this.getTableData()},changeActiveColumn(t){this.activeColumn=t,this.getTableData()},pushToCard(t){var e;((e=this.tableData)==null?void 0:e.card)===!1||this.$router.push(`/card/${this.table}/${t}`)},changeActiveCardInfo(t){var e;this.isVisibleCardInfo&&this.$router.push({...this.$route,query:{...(e=this.$route)==null?void 0:e.query,card:t}})},toggleCardInfo(){var t;this.isVisibleCardInfo=!this.isVisibleCardInfo,this.isVisibleCardInfo||this.$router.push({...this.$route,query:{...(t=this.$route)==null?void 0:t.query,card:void 0}})}}},Tq={class:"w-[calc(100vw - 320px)] bg-gray-50"},Mq={class:"h-[76px] mt-[15px] flex items-center justify-between mx-[20px] px-[20px] bg-white border rounded-xl"},Aq={class:"text-xl font-medium"},Iq={style:{height:"calc(100vh - 155px)",width:"calc(100vw - 260px)"},class:"bg-gray-50 p-[20px] flex pt-[10px]"},Pq={class:"bg-white w-full rounded-xl border p-[20px] pr-0"},Dq={class:"flex"},Oq={class:"flex gap-[6px] ml-auto"},Bq={class:"inline-block w-full align-middle"},zq={key:0,class:"relative w-max min-w-full divide-y divide-gray-200 table-fixed dark:divide-neutral-700"},Nq={class:"sticky top-[-1px] bg-white w-full after:absolute after:content-[''] after:block after:w-full after:h-px after:bg-stone-200"},Rq={class:"right-0 border-t border-stone-200"},Lq={key:0,class:"w-[70px] sticky right-0 top-0"},Vq={class:"divide-y divide-gray-200"},Fq={class:"px-4 py-3 text-sm text-gray-600"},$q=["onClick"],jq=["onClick"],Uq={class:"p-[20px] flex justify-start items-center w-full"},Hq={class:"w-[200px]"},qq={class:"text-sm text-gray-600 dark:text-neutral-400"},Wq={class:"font-semibold text-gray-800 dark:text-neutral-200"},Gq={key:0},Zq={key:0,class:"font-semibold text-gray-800 dark:text-neutral-200"};function Yq(t,e,n,i,r,a){var Se,Ne,Ae,$e,Xe,Pt,ot,Tt,Nt,Vt,Ft,Ht,Cn,dn,vn,pn,ti,Nn,Pn,Rn,Ce,He;const u=f.resolveComponent("IconPlus"),l=f.resolveComponent("router-link"),g=f.resolveComponent("AdminTableTabs"),b=f.resolveComponent("IconSearch"),w=f.resolveComponent("VsText"),E=f.resolveComponent("AdminTableCustomButtons"),C=f.resolveComponent("AdminTableCustomFilters"),P=f.resolveComponent("AdminTableColumnsHidden"),D=f.resolveComponent("AdminTableExport"),R=f.resolveComponent("AdminTableFilters"),$=f.resolveComponent("IconOpenCard"),W=f.resolveComponent("AdminTableColumn"),te=f.resolveComponent("AdminComponentIs"),G=f.resolveComponent("AdminTableControl"),Q=f.resolveComponent("AdminNodata"),Ie=f.resolveComponent("VsPagination"),ve=f.resolveComponent("AdminTableCardInfo");return f.openBlock(),f.createElementBlock("div",Tq,[f.createElementVNode("div",Mq,[f.createElementVNode("h2",Aq,f.toDisplayString(n.title),1),a.isForm?(f.openBlock(),f.createBlock(l,{key:0,to:`/add?table=${(Ne=(Se=t.$route)==null?void 0:Se.params)==null?void 0:Ne.catchAll}`,class:"inline-flex items-center px-3 py-2 text-sm font-medium text-white duration-300 bg-blue-600 border border-transparent rounded-lg gap-x-2 hover:bg-blue-700 hover:text-white"},{default:f.withCtx(()=>[f.createVNode(u,{height:"16",width:"16"}),e[5]||(e[5]=f.createTextVNode(" Додати "))]),_:1},8,["to"])):f.createCommentVNode("",!0)]),f.createElementVNode("div",Iq,[f.createElementVNode("div",Pq,[($e=(Ae=r.tableData)==null?void 0:Ae.filterState)!=null&&$e.length?(f.openBlock(),f.createBlock(g,{key:0,tabsList:(Xe=r.tableData)==null?void 0:Xe.filterState,filterState:r.filterState,"onUpdate:filterState":e[0]||(e[0]=De=>r.filterState=De)},null,8,["tabsList","filterState"])):f.createCommentVNode("",!0),f.createElementVNode("div",Dq,[f.createElementVNode("div",{class:f.normalizeClass([r.isVisibleCardInfo?"w-[calc(100%-360px)]":"w-full"])},[f.createElementVNode("div",{class:f.normalizeClass(["flex sm:grid sm:grid-cols-2 gap-x-2 sm:gap-x-5 mb-[10px] relative",{"pr-[20px]":!r.isVisibleCardInfo}])},[f.createVNode(b,{height:"14",width:"14",class:"absolute top-[10px] left-[14px] text-gray-500 z-[1]"}),f.createVNode(w,{modelValue:r.searchValue,"onUpdate:modelValue":e[1]||(e[1]=De=>r.searchValue=De),placeholder:"Пошук...",clearable:!0,class:"[&>input]:py-[7px] [&>input]:ps-10 [&>input]:pe-8 [&>input]:block [&>input]:w-full [&>input]:bg-gray-100 [&>input]:border-transparent [&>input]:rounded-lg [&>input]:text-sm [&>input]:focus:bg-white [&>input]:focus:border-blue-500 [&>input]:focus:ring-blue-500 [&>input]:disabled:opacity-50 [&>input]:disabled:pointer-events-none [&>input]:dark:bg-neutral-700 [&>input]:dark:border-transparent [&>input]:dark:text-neutral-400 [&>input]:dark:placeholder:text-neutral-400 dark:focus:bg-neutral-800 dark:focus:ring-neutral-600"},null,8,["modelValue"]),f.createElementVNode("div",Oq,[(Pt=r.tableData)!=null&&Pt.slots?(f.openBlock(),f.createBlock(E,{key:0,slots:(ot=r.tableData)==null?void 0:ot.slots},null,8,["slots"])):f.createCommentVNode("",!0),(Nt=(Tt=r.tableData)==null?void 0:Tt.filterCustom)!=null&&Nt.length?(f.openBlock(),f.createBlock(C,{key:1,customList:(Vt=r.tableData)==null?void 0:Vt.filterCustom,filterCustom:r.filterCustom,"onUpdate:filterCustom":e[2]||(e[2]=De=>r.filterCustom=De)},null,8,["customList","filterCustom"])):f.createCommentVNode("",!0),f.createVNode(P,{columns:(Ft=r.tableData)==null?void 0:Ft.columns,onUpdateColumns:e[3]||(e[3]=De=>r.tableData.columns=De)},null,8,["columns"]),f.createVNode(D,{table:n.table,columns:(Ht=r.tableData)==null?void 0:Ht.columns,page:r.page,"filter-state":r.filterState,"filter-custom":r.filterCustom,filters:r.filters},null,8,["table","columns","page","filter-state","filter-custom","filters"]),(Cn=r.filterScheme)!=null&&Cn.length?(f.openBlock(),f.createBlock(R,{key:2,scheme:r.filterScheme,onFilters:r.onFilters,onFilterChange:a.filterChange},null,8,["scheme","onFilters","onFilterChange"])):f.createCommentVNode("",!0),f.createElementVNode("button",{onClick:e[4]||(e[4]=(...De)=>a.toggleCardInfo&&a.toggleCardInfo(...De)),class:"py-2 px-2.5 inline-flex items-center gap-x-1.5 text-xs font-medium rounded-lg border border-gray-200 bg-white text-gray-800 shadow-sm hover:bg-gray-50 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-gray-50 dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700"},[f.createVNode($,{class:f.normalizeClass({"rotate-180 duration-300":!r.isVisibleCardInfo})},null,8,["class"])])])],2),f.createElementVNode("div",{class:f.normalizeClass(["flex items-start justify-start w-full space-y-5",{"pr-[20px]":!r.isVisibleCardInfo}])},[f.createElementVNode("div",{style:f.normalizeStyle({height:(vn=(dn=r.tableData)==null?void 0:dn.filterState)!=null&&vn.length?"calc(100vh - 370px)":"calc(100vh - 330px)"}),class:"overflow-x-auto w-full [&::-webkit-scrollbar]:h-2 [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-track]:bg-stone-100 [&::-webkit-scrollbar-thumb]:bg-stone-300 dark:[&::-webkit-scrollbar-track]:bg-neutral-700 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500"},[f.createElementVNode("div",Bq,[a.isNoData?(f.openBlock(),f.createBlock(Q,{key:1})):(f.openBlock(),f.createElementBlock("table",zq,[f.createElementVNode("thead",Nq,[f.createElementVNode("tr",Rq,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(a.columns,De=>(f.openBlock(),f.createBlock(W,{key:De.name,style:f.normalizeStyle({width:a.rowWidth(De==null?void 0:De.name),textAlign:De==null?void 0:De.align,wordBreak:De==null?void 0:De.wrap}),data:De,activeColumn:r.activeColumn,onChangeActive:a.changeActiveColumn},null,8,["style","data","activeColumn","onChangeActive"]))),128)),(ti=(pn=a.getActions)==null?void 0:pn.filter(De=>De!=="add"))!=null&&ti.length?(f.openBlock(),f.createElementBlock("th",Lq)):f.createCommentVNode("",!0)])]),f.createElementVNode("tbody",Vq,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList((Nn=r.tableData)==null?void 0:Nn.rows,(De,ct)=>{var Rt,Qt,At,Mt,rn,we,yn,pr,qt,sn;return f.openBlock(),f.createElementBlock("tr",{key:ct,class:f.normalizeClass({"bg-gray-50":((Qt=(Rt=t.$route)==null?void 0:Rt.query)==null?void 0:Qt.card)===(De==null?void 0:De.id)})},[f.createElementVNode("td",Fq,[f.createElementVNode("button",{onClick:()=>a.pushToCard(De==null?void 0:De.id),class:f.normalizeClass(["text-sm font-medium",[((At=r.tableData)==null?void 0:At.card)===!1?"":"text-blue-600 decoration-2 focus:outline-none focus:underline hover:text-blue-600 hover:underline"]])},[f.createVNode(te,{row:De,column:a.columns[0],table:n.table,onUpdateTable:a.getTableData},null,8,["row","column","table","onUpdateTable"])],10,$q)]),(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList((Mt=a.columns)==null?void 0:Mt.slice(1),ui=>(f.openBlock(),f.createElementBlock("td",{onClick:Hi=>a.changeActiveCardInfo(De==null?void 0:De.id),class:f.normalizeClass(["px-3 py-3 text-sm text-gray-600 text-start",{"cursor-pointer":r.isVisibleCardInfo}]),key:ui.name},[f.createVNode(te,{row:De,column:ui,table:n.table,onUpdateTable:a.getTableData},null,8,["row","column","table","onUpdateTable"])],10,jq))),128)),(we=(rn=a.getActions)==null?void 0:rn.filter(ui=>ui!=="add"))!=null&&we.length?(f.openBlock(),f.createElementBlock("td",{key:0,class:f.normalizeClass(["text-center sticky right-0 w-[80px] px-[10px]",{"bg-gray-50":((pr=(yn=t.$route)==null?void 0:yn.query)==null?void 0:pr.card)===(De==null?void 0:De.id),"bg-white":((sn=(qt=t.$route)==null?void 0:qt.query)==null?void 0:sn.card)!==(De==null?void 0:De.id)}])},[f.createVNode(G,{actions:a.getActions,isForm:a.isForm,item:De,table:n.table,onUpdateTable:a.getTableData},null,8,["actions","isForm","item","table","onUpdateTable"])],2)):f.createCommentVNode("",!0)],2)}),128))])]))])],4)],2),f.createElementVNode("div",Uq,[f.createElementVNode("div",Hq,[f.createElementVNode("p",qq,[f.createElementVNode("span",Wq,[f.createTextVNode(f.toDisplayString(r.filters||r.searchValue?"Знайдено":"Об'єктів")+" "+f.toDisplayString(((Pn=r.tableData)==null?void 0:Pn.count)||"0 ")+" ",1),r.filters||r.searchValue?(f.openBlock(),f.createElementBlock("span",Gq," з")):f.createCommentVNode("",!0)]),r.filters||r.searchValue?(f.openBlock(),f.createElementBlock("span",Zq,f.toDisplayString(" "+((Rn=r.tableData)==null?void 0:Rn.filtered)||0),1)):f.createCommentVNode("",!0)])]),Math.ceil(((Ce=r.tableData)==null?void 0:Ce.filtered)/r.limit)>1?(f.openBlock(),f.createBlock(Ie,{key:0,goTo:!1,class:"justify-end","default-page":parseInt(a.defaultPage),total:((He=r.tableData)==null?void 0:He.filtered)||0,pageSize:parseInt(r.limit),onPageChange:a.handlePageChange,pageSizes:[10,16,20],onPageSizeChange:a.changeLimit,backgroundColor:"#F3F4F6"},null,8,["default-page","total","pageSize","onPageChange","onPageSizeChange"])):f.createCommentVNode("",!0)])],2),f.createVNode(f.Transition,{name:"slide-fade"},{default:f.withCtx(()=>{var De;return[r.isVisibleCardInfo?(f.openBlock(),f.createBlock(ve,{key:0,table:n.table,columns:(De=r.tableData)==null?void 0:De.columns,row:a.activeCardRow},null,8,["table","columns","row"])):f.createCommentVNode("",!0)]}),_:1})])])])])}const Xq={components:{AdminTable:je(Cq,[["render",Yq],["__scopeId","data-v-ec85e237"]])},data(){return{table:!1,interface:"",title:""}},watch:{$route:{async handler(){Kr!=null&&Kr.value||await this.getMenu(),await this.checkPageType()},deep:!0},title(t){var e;t&&(document.title=(((e=ra.value)==null?void 0:e.titlePrefix)||"")+t)}},async mounted(){await this.checkPageType()},methods:{flattenMenu(t){const e=[];return t.forEach(n=>{n.menu?e.push(...this.flattenMenu(n.menu)):e.push(n)}),e},async checkPageType(){var i,r;const t=this.flattenMenu(Kr.value);t!=null&&t.length||this.$router.replace("/404");const e=t==null?void 0:t.find(a=>{var u,l;return(a==null?void 0:a.path)==((l=(u=this.$route)==null?void 0:u.params)==null?void 0:l.catchAll)});this.title=e==null?void 0:e.ua,e||this.$router.replace("/404"),e!=null&&e.component&&this.$router.replace((r=(i=this.$route)==null?void 0:i.params)==null?void 0:r.catchAll);const n=e==null?void 0:e.table;this.table=n||!1,!n&&this.getInterface()},async getInterface(){var t,e;try{const{data:n}=await it.get(`/api/template/interface/${((e=(t=this.$route)==null?void 0:t.params)==null?void 0:e.catchAll)||""}`);this.interface=n||""}catch{this.interface=""}}}},Kq=["innerHTML"];function Jq(t,e,n,i,r,a){const u=f.resolveComponent("AdminTable");return r.table?(f.openBlock(),f.createBlock(u,{key:0,table:r.table,title:r.title},null,8,["table","title"])):(f.openBlock(),f.createElementBlock("div",{key:1,class:"w-full bg-gray-50",style:{height:"calc(100vh - 120px)"},innerHTML:r.interface},null,8,Kq))}const Qq=Object.freeze(Object.defineProperty({__proto__:null,default:je(Xq,[["render",Jq]])},Symbol.toStringTag,{value:"Module"}));return o9});
786
+ `});g.mount(l)})},i9=async()=>{try{const{data:t}=await it.get("/api/user-menu");return Kr.value=t,e_(t)}catch(t){return console.error(t),[]}},r9=(t,e)=>{Object.entries(e).forEach(([n,i])=>{t.component(n,i)})},o9={async install(t,{componentsApp:e={},settings:n,routes:i=[]}){ra.value={...ra,...n};try{const a=(await i9()).filter(l=>l==null?void 0:l.component).map(l=>({...l,component:{...n_,...e}[l==null?void 0:l.component]}));r9(t,{...n_,...e}),t.component("admin",QT);const{router:u}=await BA(a.concat(i));window.app={...t,router:u},window.v3plugin={...t.config.globalProperties,...FS},t.config.globalProperties={...t.config.globalProperties,$componentsConfig:{...TB,componentsApp:e},$router:u,$v3plugin:FS,$utils:{reloadCardPage:i_}},t.use(u)}catch(r){console.error(r)}},components:n_},s9={data(){return{formValues:{},scheme:null,table:"",token:""}},mounted(){this.getFormScheme()},methods:{flattenMenu(t){const e=[];return t.forEach(n=>{n.menu?e.push(...this.flattenMenu(n.menu)):e.push(n)}),e},async getFormScheme(){var i,r;const t=this.flattenMenu(Kr.value);t!=null&&t.length||this.$router.replace("/404");const e=t==null?void 0:t.find(a=>{var u,l;return(a==null?void 0:a.path)==((l=(u=this.$route)==null?void 0:u.query)==null?void 0:l.table)});e||this.$router.replace("/404");const n=e==null?void 0:e.table;this.table=n;try{const{data:{form:a}}=await it.get(`/api/template/table/${n}`),{data:u}=await it.get(`/api/table/${this.table}/${(r=(i=this.$route)==null?void 0:i.query)==null?void 0:r.id}`);this.token=(u==null?void 0:u.token)||"",this.formValues=u||{};const{data:l}=await it.get(`/api/template/form/${a}`);this.scheme=(l==null?void 0:l.schema)||l}catch{}},async onlyEditObject(){try{await this.$refs.form.doValidation(),await it.put(`/api/table/${this.token}`,this.formValues),await this.$notify({title:"Успішно!",message:"Об'єкт успішно створено",type:"success"})}catch{this.$notify({title:"Помилка!",message:"Сталася помилка",type:"error"})}},async editObjectAndRedirect(){try{await this.$refs.form.doValidation(),await it.put(`/api/table/${this.token}`,this.formValues),await this.$router.back(),await this.$notify({title:"Успішно!",message:"Об'єкт успішно створено",type:"success"})}catch{this.$notify({title:"Помилка!",message:"Сталася помилка",type:"error"})}}}},a9={style:{width:"calc(100vw - 260px)"},class:"bg-gray-50"},l9={class:"h-[76px] mt-[15px] flex items-center justify-between mx-[20px] px-[20px] bg-white border rounded-xl"},c9={class:"flex items-center gap-[6px]"},u9={style:{height:"calc(100vh - 155px)",width:"calc(100vw - 260px)"},class:"bg-gray-50 p-[20px] flex"},h9={class:"bg-white w-full rounded-xl border p-[20px] overflow-auto [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar:horizontal]:h-[8px] [&::-webkit-scrollbar-track]:bg-gray-100 [&::-webkit-scrollbar-thumb]:bg-gray-300 dark:[&::-webkit-scrollbar-track]:bg-neutral-700 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500"};function d9(t,e,n,i,r,a){const u=f.resolveComponent("VsForm");return f.openBlock(),f.createElementBlock("div",a9,[f.createElementVNode("div",l9,[e[4]||(e[4]=f.createElementVNode("h2",{class:"text-xl font-medium"},"Редагувати",-1)),f.createElementVNode("div",c9,[f.createElementVNode("button",{onClick:e[0]||(e[0]=l=>t.$router.back()),class:"flex items-center px-3 py-2 text-sm font-medium text-gray-800 duration-300 bg-white border border-gray-100 rounded-lg shadow gap-x-2 focus:outline-none hover:bg-gray-50 hover:border-gray-100"}," Повернутися "),f.createElementVNode("button",{onClick:e[1]||(e[1]=(...l)=>a.onlyEditObject&&a.onlyEditObject(...l)),class:"inline-flex items-center px-3 py-2 text-sm font-medium text-white duration-300 bg-blue-600 border border-transparent rounded-lg gap-x-2 hover:bg-blue-700 hover:text-white"}," Зберегти "),f.createElementVNode("button",{onClick:e[2]||(e[2]=(...l)=>a.editObjectAndRedirect&&a.editObjectAndRedirect(...l)),class:"inline-flex items-center px-3 py-2 text-sm font-medium text-white duration-300 bg-blue-600 border border-transparent rounded-lg gap-x-2 hover:bg-blue-700 hover:text-white"}," Зберегти і повернутися ")])]),f.createElementVNode("div",u9,[f.createElementVNode("div",h9,[r.scheme?(f.openBlock(),f.createBlock(u,{key:0,ref:"form",scheme:r.scheme,modelValue:r.formValues,"onUpdate:modelValue":e[3]||(e[3]=l=>r.formValues=l),class:"p-0 mt-[20px]"},null,8,["scheme","modelValue"])):f.createCommentVNode("",!0)])])])}const p9=Object.freeze(Object.defineProperty({__proto__:null,default:je(s9,[["render",d9]])},Symbol.toStringTag,{value:"Module"})),f9={data(){return{formValues:{},scheme:null,table:"",token:"",api:""}},mounted(){this.getFormScheme()},methods:{flattenMenu(t){const e=[];return t.forEach(n=>{n.menu?e.push(...this.flattenMenu(n.menu)):e.push(n)}),e},async getFormScheme(){var i,r;const t=this.flattenMenu(Kr.value);t!=null&&t.length||this.$router.replace("/404");const e=t==null?void 0:t.find(a=>{var u,l;return(a==null?void 0:a.path)==((l=(u=this.$route)==null?void 0:u.query)==null?void 0:l.table)});e||this.$router.replace("/404");const n=e==null?void 0:e.table;this.table=n;try{const a=await it.get(`/api/table-data/${n}`),{data:u}=await it.get(`/api/template/form/${(i=a==null?void 0:a.data)==null?void 0:i.form}`);this.scheme=(u==null?void 0:u.schema)||u,this.api=(u==null?void 0:u.api)||"",this.token=(r=a==null?void 0:a.data)==null?void 0:r.addToken}catch{}},async createObject(){var e,n,i,r,a,u,l,g,b;const t=this.$refs.form;try{await t.doValidation(),await it.post(this.api||`/api/table/${this.token}`,this.formValues),await this.$router.back(),await this.$notify({title:"Успішно!",message:"Об'єкт успішно створено",type:"success"})}catch(w){const E=((e=w==null?void 0:w.response)==null?void 0:e.data)||"";let C=((a=(r=(i=(n=Object.entries(t==null?void 0:t.formErrors))==null?void 0:n[0])==null?void 0:i[1])==null?void 0:r[0])==null?void 0:a.message)==="Це поле обов'язкове"?"Заповніть обов'язкові поля":(b=(g=(l=(u=Object.entries(t==null?void 0:t.formErrors))==null?void 0:u[0])==null?void 0:l[1])==null?void 0:g[0])==null?void 0:b.message;this.$notify({title:"Помилка!",message:E||C||"Сталася помилка валідаціі",type:"error"})}}}},m9={style:{width:"calc(100vw - 260px)"},class:"bg-gray-50"},g9={class:"h-[76px] mt-[15px] flex items-center justify-between mx-[20px] px-[20px] bg-white border rounded-xl"},y9={class:"flex items-center gap-[6px]"},_9={style:{height:"calc(100vh - 165px)",width:"calc(100vw - 260px)"},class:"bg-gray-50 p-[20px] flex"},b9={class:"bg-white w-full rounded-xl border p-[20px] overflow-auto [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar:horizontal]:h-[8px] [&::-webkit-scrollbar-track]:bg-gray-100 [&::-webkit-scrollbar-thumb]:bg-gray-300 dark:[&::-webkit-scrollbar-track]:bg-neutral-700 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500"};function x9(t,e,n,i,r,a){const u=f.resolveComponent("VsForm");return f.openBlock(),f.createElementBlock("div",m9,[f.createElementVNode("div",g9,[e[3]||(e[3]=f.createElementVNode("h2",{class:"text-xl font-medium"},"Створити",-1)),f.createElementVNode("div",y9,[f.createElementVNode("button",{onClick:e[0]||(e[0]=l=>t.$router.back()),class:"flex items-center px-3 py-2 text-sm font-medium text-gray-800 duration-300 bg-white border border-gray-100 rounded-lg shadow gap-x-2 focus:outline-none hover:bg-gray-50 hover:border-gray-100"}," Скасувати "),f.createElementVNode("button",{onClick:e[1]||(e[1]=(...l)=>a.createObject&&a.createObject(...l)),class:"inline-flex items-center px-3 py-2 text-sm font-medium text-white duration-300 bg-blue-600 border border-transparent rounded-lg gap-x-2 hover:bg-blue-700 hover:text-white"}," Зберегти ")])]),f.createElementVNode("div",_9,[f.createElementVNode("div",b9,[r.scheme?(f.openBlock(),f.createBlock(u,{key:0,ref:"form",scheme:r.scheme,modelValue:r.formValues,"onUpdate:modelValue":e[2]||(e[2]=l=>r.formValues=l),class:"p-0 mt-[20px]"},null,8,["scheme","modelValue"])):f.createCommentVNode("",!0)])])])}const v9=Object.freeze(Object.defineProperty({__proto__:null,default:je(f9,[["render",x9]])},Symbol.toStringTag,{value:"Module"})),w9={};function k9(t,e,n,i,r,a){const u=f.resolveComponent("router-view");return f.openBlock(),f.createBlock(u)}const $S=Object.freeze(Object.defineProperty({__proto__:null,default:je(w9,[["render",k9]])},Symbol.toStringTag,{value:"Module"})),S9={},E9={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-logout"};function C9(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("svg",E9,e[0]||(e[0]=[f.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),f.createElementVNode("path",{d:"M14 8v-2a2 2 0 0 0 -2 -2h-7a2 2 0 0 0 -2 2v12a2 2 0 0 0 2 2h7a2 2 0 0 0 2 -2v-2"},null,-1),f.createElementVNode("path",{d:"M9 12h12l-3 -3"},null,-1),f.createElementVNode("path",{d:"M18 15l3 -3"},null,-1)]))}const T9=je(S9,[["render",C9]]),M9={},A9={viewBox:"0 0 1823 249",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function I9(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("svg",A9,e[0]||(e[0]=[f.createStaticVNode('<path d="M218.88 96.05C223.55 99.19 228.69 101.56 234.09 103.07V145.42C212.05 151.54 195.83 171.79 195.83 195.75C195.83 200.22 196.41 204.65 197.53 208.94L160.92 230.08C156.82 226.06 152.08 222.73 146.91 220.24V171.62C164.83 163.13 176.59 145.06 176.59 124.48C176.59 123.17 176.54 121.86 176.44 120.56L218.88 96.05ZM220.32 79.09L160.97 113.36C162.04 116.88 162.61 120.61 162.61 124.48C162.61 142.66 149.93 157.87 132.93 161.76V230.05C143.4 232.46 152.23 239.16 157.46 248.21L215 214.99C211.7 209.34 209.81 202.77 209.81 195.75C209.81 174.62 226.94 157.49 248.07 157.49V91.02C237.14 91.02 227.29 86.43 220.32 79.09Z" fill="#CE3936"></path><path d="M161.39 19.13L197.44 39.94C196.39 44.11 195.84 48.42 195.84 52.75C195.84 54.21 195.9 55.65 196.02 57.1L153.9 81.42C145.27 75.5 134.95 72.24 124.36 72.24C113.83 72.24 103.57 75.47 94.96 81.32L52.71 56.93C52.82 55.55 52.88 54.16 52.88 52.76C52.88 48.43 52.34 44.12 51.28 39.95L87.3 19.16C96.98 28.89 110.26 34.58 124.34 34.58C138.42 34.57 151.7 28.87 161.39 19.13ZM157.77 0.919983C151.24 12.66 138.71 20.6 124.33 20.6C109.95 20.6 97.44 12.67 90.9 0.939983L33.9 33.85C37.08 39.43 38.91 45.88 38.91 52.76C38.91 56.71 38.31 60.52 37.2 64.11L96.46 98.32C103.44 90.87 113.36 86.22 124.37 86.22C135.44 86.22 145.41 90.93 152.39 98.44L211.59 64.27C210.45 60.64 209.83 56.78 209.83 52.77C209.83 45.89 211.65 39.44 214.84 33.86L157.77 0.919983Z" fill="#CE3936"></path><path d="M29.97 95.95L72.28 120.38C72.17 121.74 72.12 123.1 72.12 124.47C72.12 145.02 83.86 163.08 101.74 171.58V220.23C96.58 222.71 91.84 226.04 87.75 230.05L51.17 208.93C52.29 204.64 52.87 200.21 52.87 195.74C52.87 171.78 36.65 151.53 14.61 145.41V103.06C20.07 101.55 25.27 99.14 29.97 95.95ZM28.5 78.97C21.52 86.38 11.63 91.02 0.640015 91.02V157.49C21.77 157.49 38.9 174.62 38.9 195.75C38.9 202.77 37 209.33 33.71 214.99L91.2 248.18C96.43 239.14 105.25 232.45 115.71 230.04V161.73C98.74 157.81 86.09 142.62 86.09 124.46C86.09 120.54 86.68 116.75 87.78 113.18L28.5 78.97Z" fill="#CE3936"></path><path d="M498.39 177.5V144.88C498.39 128.55 485.11 115.27 468.78 115.27H343.22C342.69 115.27 342.18 115.32 341.67 115.4H337.19C332.35 115.4 328.42 111.46 328.42 106.63V74C328.42 69.16 332.36 65.23 337.19 65.23H486.33C492.08 65.23 496.75 60.57 496.75 54.81C496.75 49.06 492.08 44.39 486.33 44.39H337.19C320.86 44.39 307.58 57.67 307.58 74V106.62C307.58 122.95 320.86 136.23 337.19 136.23H462.75C463.28 136.23 463.79 136.18 464.3 136.1H468.78C473.62 136.1 477.55 140.04 477.55 144.87V177.49C477.55 182.33 473.61 186.26 468.78 186.26H319.64C313.89 186.26 309.22 190.92 309.22 196.68C309.22 202.43 313.89 207.1 319.64 207.1H468.78C485.11 207.11 498.39 193.83 498.39 177.5Z" fill="#CE3935"></path><path d="M710.7 177.32V75.24C710.7 58.91 697.42 45.63 681.09 45.63H550.05C533.72 45.63 520.44 58.91 520.44 75.24V177.32C520.44 193.65 533.72 206.93 550.05 206.93H681.1C697.42 206.93 710.7 193.65 710.7 177.32ZM541.27 75.24C541.27 70.4 545.21 66.47 550.04 66.47H681.09C685.93 66.47 689.86 70.41 689.86 75.24V177.32C689.86 182.16 685.92 186.09 681.09 186.09H550.05C545.21 186.09 541.28 182.15 541.28 177.32V75.24H541.27Z" fill="#CE3935"></path><path d="M1823 177.32V75.24C1823 58.91 1809.72 45.63 1793.39 45.63H1662.34C1646.01 45.63 1632.73 58.91 1632.73 75.24V177.32C1632.73 193.65 1646.01 206.93 1662.34 206.93H1793.39C1809.72 206.93 1823 193.65 1823 177.32ZM1653.57 75.24C1653.57 70.4 1657.51 66.47 1662.34 66.47H1793.39C1798.23 66.47 1802.16 70.41 1802.16 75.24V177.32C1802.16 182.16 1798.22 186.09 1793.39 186.09H1662.34C1657.5 186.09 1653.57 182.15 1653.57 177.32V75.24Z" fill="#CE3935"></path><path d="M756.76 196.51V152H849.42C855.17 152 859.84 147.34 859.84 141.58C859.84 135.83 855.17 131.16 849.42 131.16H756.76V75.23C756.76 70.39 760.7 66.46 765.53 66.46H893.29C899.04 66.46 903.71 61.8 903.71 56.04C903.71 50.29 899.04 45.62 893.29 45.62H765.53C749.2 45.62 735.92 58.9 735.92 75.23V196.5C735.92 202.25 740.59 206.92 746.34 206.92C752.09 206.93 756.76 202.27 756.76 196.51Z" fill="#CE3935"></path><path d="M933.86 66.47H1006.51V194.32C1006.51 200.07 1011.18 204.74 1016.93 204.74C1022.68 204.74 1027.35 200.07 1027.35 194.32V66.47H1100C1105.75 66.47 1110.42 61.81 1110.42 56.05C1110.42 50.3 1105.76 45.63 1100 45.63H933.86C928.11 45.63 923.44 50.29 923.44 56.05C923.45 61.81 928.11 66.47 933.86 66.47Z" fill="#CE3935"></path><path d="M1218.44 204.19C1224.19 204.19 1228.86 199.53 1228.86 193.77V152H1368.13C1384.46 152 1397.74 138.72 1397.74 122.39V75.24C1397.74 58.91 1384.46 45.63 1368.13 45.63H1237.63C1221.3 45.63 1208.02 58.91 1208.02 75.24V193.77C1208.02 199.53 1212.68 204.19 1218.44 204.19ZM1237.63 66.47H1368.13C1372.97 66.47 1376.9 70.41 1376.9 75.24V122.39C1376.9 127.23 1372.96 131.16 1368.13 131.16H1228.86V75.23C1228.86 70.41 1232.79 66.47 1237.63 66.47Z" fill="#CE3935"></path><path d="M1430.64 204.19C1436.39 204.19 1441.06 199.53 1441.06 193.77V152H1523.95C1524.57 153.18 1525.42 154.26 1526.51 155.17L1581.89 201.23C1583.83 202.85 1586.2 203.64 1588.55 203.64C1591.54 203.64 1594.5 202.36 1596.57 199.88C1600.25 195.46 1599.64 188.89 1595.22 185.21L1555.29 152H1580.33C1596.66 152 1609.94 138.72 1609.94 122.39V75.24C1609.94 58.91 1596.66 45.63 1580.33 45.63H1449.83C1433.5 45.63 1420.22 58.91 1420.22 75.24V193.77C1420.22 199.53 1424.88 204.19 1430.64 204.19ZM1449.83 66.47H1580.33C1585.17 66.47 1589.1 70.41 1589.1 75.24V122.39C1589.1 127.23 1585.17 131.16 1580.33 131.16H1441.06V75.23C1441.05 70.41 1444.99 66.47 1449.83 66.47Z" fill="#CE3935"></path>',10)]))}const P9=je(M9,[["render",I9]]),D9={},O9={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-chevron-down"};function B9(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("svg",O9,e[0]||(e[0]=[f.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),f.createElementVNode("path",{d:"M6 9l6 6l6 -6"},null,-1)]))}const jS=je(D9,[["render",B9]]),z9={components:{IconChevronDown:jS},props:{route:Object,searchable:String},mounted(){var t,e,n;(t=this.route)!=null&&t.menu&&(n=(e=this.route)==null?void 0:e.menu)!=null&&n.some(i=>{var r,a;return(i==null?void 0:i.path)===this.$route.path.replace("/","")||((a=(r=this.$route)==null?void 0:r.params)==null?void 0:a.table)===(i==null?void 0:i.table)&&(i==null?void 0:i.table)})&&(this.isOpen=!0)},watch:{route(t){t!=null&&t.open&&(this.isOpen=!0)}},data(){return{isOpen:!1}},methods:{highLight(t){if(!this.searchable)return t;const e=this.searchable.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),n=new RegExp(`(${e})(\\s*)`,"gi");return t.replace(n,(i,r,a)=>`<span style="color:#1989fa;">${r}</span>${a}`)}}},N9={key:0,class:""},R9={class:"ml-[30px] py-[6px] before:block before:absolute relative w-[196px] flex flex-col gap-[6px] inline-block before:w-[2px] before:h-[100%] before:bg-gray-100 before:left-[-14px] cursor-pointer"},L9={key:1};function V9(t,e,n,i,r,a){var g,b,w,E,C,P,D,R,$,W,te,G,Q,Ie,ve;const u=f.resolveComponent("IconChevronDown"),l=f.resolveComponent("router-link");return(g=n.route)!=null&&g.menu?(f.openBlock(),f.createElementBlock("div",N9,[f.createElementVNode("button",{onClick:e[0]||(e[0]=Se=>r.isOpen=!r.isOpen),class:f.normalizeClass(["flex items-center justify-start w-full px-3 py-2 text-sm text-left text-gray-800 duration-300 border-none rounded-lg cursor-pointer gap-x-3 focus:outline-none hover:bg-gray-100",[((w=(b=n.route)==null?void 0:b.menu)==null?void 0:w.some(Se=>{var Ne,Ae;return(Se==null?void 0:Se.path)===t.$route.path.replace("/","")||(Se==null?void 0:Se.table)===((Ae=(Ne=t.$route)==null?void 0:Ne.params)==null?void 0:Ae.table)&&(Se==null?void 0:Se.table)}))&&"bg-gray-100"]])},[f.createTextVNode(f.toDisplayString((E=n.route)==null?void 0:E.ua)+" ",1),f.createVNode(u,{class:f.normalizeClass([[r.isOpen&&"-rotate-180"],"ml-auto duration-300"]),width:"14",height:"14"},null,8,["class"])],2),f.createVNode(f.Transition,{name:"fade"},{default:f.withCtx(()=>{var Se;return[f.withDirectives(f.createElementVNode("ul",R9,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList((Se=n.route)==null?void 0:Se.menu,(Ne,Ae)=>{var $e,Xe;return f.openBlock(),f.createElementBlock("li",{key:Ae,class:"w-full"},[f.createVNode(l,{innerHTML:a.highLight(Ne==null?void 0:Ne.ua),to:"/"+(Ne==null?void 0:Ne.path),class:f.normalizeClass([[((Ne==null?void 0:Ne.path)===t.$route.path.replace("/","")||((Xe=($e=t.$route)==null?void 0:$e.params)==null?void 0:Xe.table)===(Ne==null?void 0:Ne.table)&&(Ne==null?void 0:Ne.table))&&"bg-gray-100"],"inline-block px-3 py-2 text-sm text-gray-800 rounded-lg hover:bg-gray-100 focus:outline-none focus:bg-gray-100"])},null,8,["innerHTML","to","class"])])}),128))],512),[[f.vShow,r.isOpen]])]}),_:1})])):(C=n.route)!=null&&C.hidden?f.createCommentVNode("",!0):(f.openBlock(),f.createElementBlock("div",L9,[f.createVNode(l,{innerHTML:a.highLight((P=n.route)==null?void 0:P.ua),to:((R=(D=n.route)==null?void 0:D.path)==null?void 0:R[0])==="/"?($=n.route)==null?void 0:$.path:"/"+((W=n.route)==null?void 0:W.path),class:f.normalizeClass([[(((te=n.route)==null?void 0:te.path.replace("/",""))===t.$route.path.replace("/","")||((Q=(G=t.$route)==null?void 0:G.params)==null?void 0:Q.table)===((Ie=n.route)==null?void 0:Ie.table)&&((ve=n.route)==null?void 0:ve.table))&&"bg-gray-100"],"inline-block py-2 w-full font-[400] px-3 text-sm text-gray-800 rounded-lg items-center hover:bg-gray-100 duration-300 hover:text-gray-800"])},null,8,["innerHTML","to","class"])]))}const F9={components:{IconLogout:T9,NavbarItem:je(z9,[["render",V9]]),IconLogo:P9,IconSearch:t_},data(){return{activeIndex:null,searchValue:""}},computed:{data(){var t;return(t=this.searchValue)!=null&&t.trim()?this.filterMenu(Kr.value,this.searchValue):Kr.value},logo(){var t;return((t=ra.value)==null?void 0:t.logo)||"/assets/logo.svg"}},methods:{filterMenu(t,e){return t.map(n=>{var i,r;if(n.menu){const a=this.filterMenu(n.menu,e);if(a.length>0)return{...n,menu:a,open:!0}}else if((r=(i=n.ua)==null?void 0:i.toLowerCase())!=null&&r.includes(e.toLowerCase()))return n;return null}).filter(Boolean)}}},$9={class:"flex flex-col h-[100vh] border-r w-[260px] shrink-0"},j9=["src"],U9={class:"relative"},H9={class:"p-[16px] overflow-y-auto [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-track]:bg-gray-100 [&::-webkit-scrollbar-thumb]:bg-gray-300 dark:[&::-webkit-scrollbar-track]:bg-neutral-700 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500"},q9={class:"flex flex-col flex-wrap w-full pb-3"},W9={key:0,class:"flex flex-col gap-[6px]"},G9={key:1,class:"text-gray-800 text-lg mt-[20px]"};function Z9(t,e,n,i,r,a){var b;const u=f.resolveComponent("IconSearch"),l=f.resolveComponent("VsText"),g=f.resolveComponent("NavbarItem");return f.openBlock(),f.createElementBlock("div",$9,[f.createElementVNode("img",{src:a.logo,height:"40",width:"200",class:"my-[20px] ml-[20px]"},null,8,j9),f.createElementVNode("div",U9,[f.createVNode(u,{height:"16",width:"16",class:"absolute top-[12px] left-[30px] text-gray-500 z-[1]"}),f.createVNode(l,{type:"text",modelValue:r.searchValue,"onUpdate:modelValue":e[0]||(e[0]=w=>r.searchValue=w),clearable:!0,placeholder:"Пошук по меню",class:"[&>input]:h-[40px] [&>input]:block [&>input]:rounded-none [&>input]:border-x-0 [&>input]:pl-[60px] [&>input:focus]:outline-none [&>input:focus]:focus:ring-0 [&>input:focus]:border-y-gray-200 [&>input:focus]:border-y-1 [&>input:focus]:border-x-0"},null,8,["modelValue"])]),f.createElementVNode("div",H9,[f.createElementVNode("nav",q9,[(b=a.data)!=null&&b.length?(f.openBlock(),f.createElementBlock("ul",W9,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(a.data,(w,E)=>(f.openBlock(),f.createElementBlock("li",{key:E,class:"flex flex-col gap-[6px]"},[f.createVNode(g,{route:w,searchable:r.searchValue},null,8,["route","searchable"])]))),128))])):(f.openBlock(),f.createElementBlock("div",G9,"Не знайдено"))])])])}const Y9=je(F9,[["render",Z9]]),X9={},K9={class:"flex-shrink-0 size-4",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function J9(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("svg",K9,e[0]||(e[0]=[f.createElementVNode("circle",{cx:"12",cy:"12",r:"10"},null,-1),f.createElementVNode("path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"},null,-1),f.createElementVNode("path",{d:"M12 17h.01"},null,-1)]))}const Q9={components:{IconQuestion:je(X9,[["render",J9]]),IconUser:BS,AdminNotification:NS},mounted(){this.getUserData()},data(){return{userData:null,isVisible:!1}},watch:{isVisible(t){t?setTimeout(()=>window.addEventListener("click",this.closeOnOutsideClick),0):window.removeEventListener("click",this.closeOnOutsideClick)}},methods:{async getUserData(){try{const{data:t}=await it.get("/user");this.userData=t}catch{}},async logout(){try{await it.get("/logout"),await window.history.pushState({},"","/login"),await location.reload(),localStorage.removeItem("user")}catch{}},closeOnOutsideClick(){this.isVisible=!1}},beforeUnmount(){window.removeEventListener("click",this.closeOnOutsideClick)}},eU={class:"h-[60px] border-b flex justify-end px-[20px]",style:{width:"calc(100vw - 260px)"}},tU={class:"flex items-center gap-[6px]"},nU={href:"docs-softpro.com",class:"size-[38px] inline-flex justify-center items-center gap-x-2 rounded-full border border-transparent text-gray-500 hover:bg-gray-100 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-gray-100 dark:text-neutral-400 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700"},iU={class:"relative"},rU=["src"],oU={key:1,class:"size-[40px] rounded-full bg-gray-200 flex items-center justify-center"},sU={class:"p-[10px] gap-[6px] items-center border-b flex justify-between"},aU=["src"],lU={key:1,class:"size-[40px] rounded-full bg-gray-200 flex items-center justify-center"},cU={class:"text-[14px] mr-[10px] text-gray-500"},uU={class:"flex flex-col p-[4px]"};function hU(t,e,n,i,r,a){var w,E,C,P,D,R,$,W,te,G;const u=f.resolveComponent("IconQuestion"),l=f.resolveComponent("AdminNotification"),g=f.resolveComponent("IconUser"),b=f.resolveComponent("router-link");return f.openBlock(),f.createElementBlock("div",eU,[f.createElementVNode("div",tU,[f.createElementVNode("a",nU,[f.createVNode(u,{height:"24",width:"24"})]),f.createVNode(l),e[4]||(e[4]=f.createElementVNode("div",{class:"h-[30px] w-[1px] bg-gray-200 ml-[10px] mr-[10px]"},null,-1)),f.createElementVNode("div",iU,[f.createElementVNode("div",{onClick:e[0]||(e[0]=Q=>r.isVisible=!0),class:"cursor-pointer"},[(E=(w=r.userData)==null?void 0:w.user)!=null&&E.avatar?(f.openBlock(),f.createElementBlock("img",{key:0,class:"flex-shrink-0 size-[30px] rounded-full",src:(P=(C=r.userData)==null?void 0:C.user)==null?void 0:P.avatar,alt:"Image Description"},null,8,rU)):(f.openBlock(),f.createElementBlock("div",oU,[f.createVNode(g)]))]),r.isVisible?(f.openBlock(),f.createElementBlock("div",{key:0,onClick:e[2]||(e[2]=f.withModifiers(()=>{},["stop"])),class:"fixed bg-white w-[180px] top-[55px] right-[20px] shadow-xl rounded-xl z-[1]"},[f.createElementVNode("div",sU,[(R=(D=r.userData)==null?void 0:D.user)!=null&&R.avatar?(f.openBlock(),f.createElementBlock("img",{key:0,class:"flex-shrink-0 size-[30px] rounded-full",src:(W=($=r.userData)==null?void 0:$.user)==null?void 0:W.avatar,alt:"Image Description"},null,8,aU)):(f.openBlock(),f.createElementBlock("div",lU,[f.createVNode(g)])),f.createElementVNode("div",null,[f.createElementVNode("p",cU,f.toDisplayString((G=(te=r.userData)==null?void 0:te.user)==null?void 0:G.username),1)])]),f.createElementVNode("div",uU,[f.createVNode(b,{to:"profile",disabled:!0,class:"p-[8px] block rounded-lg w-full mb-[4px] text-start hover:bg-gray-100 !duration-300"},{default:f.withCtx(()=>e[3]||(e[3]=[f.createTextVNode("Профіль")])),_:1}),f.createElementVNode("button",{onClick:e[1]||(e[1]=(...Q)=>a.logout&&a.logout(...Q)),class:"p-[8px] block rounded-lg w-full text-start hover:bg-gray-100 !duration-300"}," Вийти ")])])):f.createCommentVNode("",!0)])])])}const dU={components:{navbar:Y9,AdminHeader:je(Q9,[["render",hU]])},computed:{isMenu(){return Kr.value||null},header(){var t;return((t=ra.value)==null?void 0:t.header)||"admin-header"}}},pU={class:"admin-wrapper"},fU={class:"flex flex-col"};function mU(t,e,n,i,r,a){const u=f.resolveComponent("navbar"),l=f.resolveComponent("router-view");return f.openBlock(),f.createElementBlock("div",pU,[f.createVNode(u),f.createElementVNode("div",fU,[a.isMenu?(f.openBlock(),f.createElementBlock(f.Fragment,{key:0},[(f.openBlock(),f.createBlock(f.resolveDynamicComponent(a.header))),f.createVNode(l)],64)):f.createCommentVNode("",!0)])])}const gU=Object.freeze(Object.defineProperty({__proto__:null,default:je(dU,[["render",mU],["__scopeId","data-v-98158745"]])},Symbol.toStringTag,{value:"Module"})),yU={data(){return{currentSort:""}},props:{data:{type:Object,default:()=>null},activeColumn:{type:String}},computed:{label(){var t,e;return((t=this.data)==null?void 0:t.ua)||((e=this.data)==null?void 0:e.label)||this.data.title||"null"},selectedSortParam(){var t,e;return(e=(t=this.$route)==null?void 0:t.query)==null?void 0:e.sort},getVisibleIcon(){return this.data.format!=="image"&&this.data.format!=="verify"}},watch:{activeColumn(t){t!==this.data.name&&(this.currentSort="")}},methods:{changeCurrentSort(t){switch(t){case"":return"asc";case"asc":return"desc";case"desc":return"";default:return""}},handleClickSortBtn(t){this.$emit("change-active",this.data.name),this.currentSort=this.changeCurrentSort(t);const e=this.$route.query,{sort:n,...i}=e,r=this.currentSort?`${this.data.name}-${this.currentSort}`:"";this.$router.replace({query:{...i,...r&&{sort:r}}})},isValueEqualToSelected(t){return`${this.data.name}-${t}`===this.selectedSortParam}}},_U={scope:"col",class:"text-start px-2 py-1"},bU={class:"flex-shrink-0 size-3.5",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},xU={key:0,d:"m7 15 5 5 5-5"},vU={key:1,d:"m7 9 5-5 5 5"},wU={key:1,class:"text-sm text-stone-500 px-[4px] py-2.5 text-start font-normal"};function kU(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("th",_U,[a.getVisibleIcon?(f.openBlock(),f.createElementBlock("button",{key:0,type:"button",class:"text-sm text-stone-500 px-[4px] py-2.5 text-start font-normal flex items-center gap-[6px]",onClick:e[0]||(e[0]=u=>a.handleClickSortBtn(r.currentSort))},[f.createTextVNode(f.toDisplayString(a.label)+" ",1),(f.openBlock(),f.createElementBlock("svg",bU,[r.currentSort==="asc"||r.currentSort===""?(f.openBlock(),f.createElementBlock("path",xU)):f.createCommentVNode("",!0),r.currentSort==="desc"||r.currentSort===""?(f.openBlock(),f.createElementBlock("path",vU)):f.createCommentVNode("",!0)]))])):(f.openBlock(),f.createElementBlock("p",wU,f.toDisplayString(a.label),1))])}const SU=je(yU,[["render",kU]]),EU={},CU={class:"flex-shrink-0 size-3.5",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function TU(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("svg",CU,e[0]||(e[0]=[f.createStaticVNode('<path d="M3 6h18"></path><path d="M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"></path><path d="M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"></path><line x1="10" x2="10" y1="11" y2="17"></line><line x1="14" x2="14" y1="11" y2="17"></line>',5)]))}const MU=je(EU,[["render",TU]]),AU={props:{height:{type:String,default:"16"},width:{type:String,default:"12"},color:{type:String,default:"black"}}},IU={style:{display:"none"}},PU=["height","width","fill"];function DU(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock(f.Fragment,null,[(f.openBlock(),f.createElementBlock("svg",IU,e[0]||(e[0]=[f.createElementVNode("symbol",{id:"icon-pencil",viewBox:"0 0 32 32"},[f.createElementVNode("path",{d:"M27 0c2.761 0 5 2.239 5 5 0 1.126-0.372 2.164-1 3l-2 2-7-7 2-2c0.836-0.628 1.874-1 3-1zM2 23l-2 9 9-2 18.5-18.5-7-7-18.5 18.5zM22.362 11.362l-14 14-1.724-1.724 14-14 1.724 1.724z"})],-1)]))),(f.openBlock(),f.createElementBlock("svg",{height:n.height,width:n.width,fill:n.color},e[1]||(e[1]=[f.createElementVNode("use",{"xlink:href":"#icon-pencil"},null,-1)]),8,PU))],64)}const OU={components:{IconMore:IS,IconDelete:MU,IconEdit:je(AU,[["render",DU]])},emits:["updateTable"],props:{item:Object,table:String,isForm:null,actions:Array,default:()=>[]},data(){return{formVisible:!1,isDeleteConfirm:!1,formValue:{},top:0,left:0}},computed:{getCustomActions(){return this.actions.filter(t=>typeof t=="object")}},methods:{openConfirm(){this.isDeleteConfirm=!0,document.querySelector("body").click()},async getData(){var t;try{const{data:e}=await it.get(`/api/table/${this.table}/${(t=this.item)==null?void 0:t.id}`);this.formValue=e}catch(e){console.error(e)}},doSomethingOnCancel(){this.formVisible=!1},async deleteElement(){var t;try{const{data:e}=await it.get(`/api/table/${this.table}/${(t=this.item)==null?void 0:t.id}`);await it.delete(`/api/table/${e==null?void 0:e.token}`),await this.$notify({title:"Успішно!",message:"Об`єкт успішно видалeно",type:"success"}),await this.$emit("update-table")}catch{this.$notify({title:"Помилка!",message:"Сталася помилка",type:"error"})}finally{this.isDeleteConfirm=!1}},async customButtonAction(t){var e;document.querySelector("body").click(),t!=null&&t.form?(await this.$v3plugin.$form({form:t==null?void 0:t.form,id:(e=this.item)==null?void 0:e.id,api:t==null?void 0:t.api,title:t==null?void 0:t.title}),await this.$emit("update-table")):await this.$v3plugin.$api({confirm:t==null?void 0:t.confirm,api:t==null?void 0:t.api,method:t==null?void 0:t.method})}}},BU={class:"hs-dropdown [--placement:bottom-right] inline-flex"},zU={class:"inline-flex items-center justify-center bg-white border rounded-lg shadow-sm size-7 gap-x-2 border-stone-200 text-stone-800 hover:bg-stone-50 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-stone-50"},NU={class:"flex flex-col items-start"},RU=["onClick"],LU={class:"text-gray-800"},VU={key:1,class:"h-[1px] w-[80%] bg-gray-200 ml-auto mr-auto"},FU={class:"p-4"},$U={class:"flex justify-end mt-4 gap-x-3"};function jU(t,e,n,i,r,a){const u=f.resolveComponent("IconMore"),l=f.resolveComponent("IconEdit"),g=f.resolveComponent("router-link"),b=f.resolveComponent("IconDelete"),w=f.resolveComponent("VsPopover"),E=f.resolveComponent("VsDialog");return f.openBlock(),f.createElementBlock(f.Fragment,null,[f.createElementVNode("div",BU,[f.createVNode(w,{trigger:"click",placement:"bottom-left"},{reference:f.withCtx(()=>[f.createElementVNode("button",zU,[f.createVNode(u,{height:"16",width:"16"})])]),default:f.withCtx(()=>{var C,P,D,R,$;return[f.createElementVNode("div",NU,[(C=n.actions)!=null&&C.includes("edit")&&n.isForm?(f.openBlock(),f.createBlock(g,{key:0,to:`/edit?table=${(D=(P=t.$route)==null?void 0:P.params)==null?void 0:D.catchAll}&id=${(R=n.item)==null?void 0:R.id}`,class:"w-full flex items-center gap-x-3 py-1.5 px-2 rounded-lg text-[13px] text-stone-800 hover:bg-stone-100 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-stone-100"},{default:f.withCtx(()=>[f.createVNode(l,{color:"#000"}),e[4]||(e[4]=f.createTextVNode(" Редагувати "))]),_:1},8,["to"])):f.createCommentVNode("",!0),(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(a.getCustomActions,(W,te)=>(f.openBlock(),f.createElementBlock("button",{key:te,onClick:G=>a.customButtonAction(W),class:"w-full flex items-center gap-x-3 py-1.5 px-2 rounded-lg text-[13px] text-stone-800 hover:bg-stone-100 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-stone-100"},[f.createVNode(b,{class:"opacity-0"}),f.createElementVNode("span",LU,f.toDisplayString(W==null?void 0:W.label),1)],8,RU))),128)),n.isForm?(f.openBlock(),f.createElementBlock("div",VU)):f.createCommentVNode("",!0),($=n.actions)!=null&&$.includes("del")?(f.openBlock(),f.createElementBlock("button",{key:2,onClick:e[0]||(e[0]=f.withModifiers((...W)=>a.openConfirm&&a.openConfirm(...W),["stop"])),class:"w-full flex items-center gap-x-3 py-1.5 px-2 rounded-lg text-[13px] text-stone-800 hover:bg-stone-100 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-stone-100"},[f.createVNode(b),e[5]||(e[5]=f.createElementVNode("span",{class:"text-gray-800"},"Видалити",-1))])):f.createCommentVNode("",!0)])]}),_:1})]),f.createVNode(E,{visible:r.isDeleteConfirm,"onUpdate:visible":e[3]||(e[3]=C=>r.isDeleteConfirm=C),size:"small",title:"Ви впевнені?"},{default:f.withCtx(()=>[f.createElementVNode("div",FU,[e[6]||(e[6]=f.createElementVNode("p",{class:"mt-1 text-gray-500 dark:text-neutral-500"}," Ви впевнені, що хочете видалити цей об'єкт? ",-1)),f.createElementVNode("div",$U,[f.createElementVNode("button",{type:"button",class:"inline-flex items-center px-3 py-2 text-sm font-medium text-gray-800 bg-white border border-gray-200 rounded-lg shadow-sm gap-x-2 hover:bg-gray-50 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-gray-50 dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700",onClick:e[1]||(e[1]=C=>r.isDeleteConfirm=!1)}," Скасувати "),f.createElementVNode("button",{type:"button",class:"inline-flex items-center px-3 py-2 text-sm font-semibold text-white bg-red-500 border border-transparent rounded-lg gap-x-2 hover:bg-red-600 disabled:opacity-50 disabled:pointer-events-none",onClick:e[2]||(e[2]=(...C)=>a.deleteElement&&a.deleteElement(...C))}," Так, я впевнена/ий ")])])]),_:1},8,["visible"])],64)}const UU=je(OU,[["render",jU]]),HU={},qU={class:"flex-shrink-0 mt-0.5 size-3.5",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function WU(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("svg",qU,e[0]||(e[0]=[f.createElementVNode("path",{d:"m3 16 4 4 4-4"},null,-1),f.createElementVNode("path",{d:"M7 20V4"},null,-1),f.createElementVNode("path",{d:"m21 8-4-4-4 4"},null,-1),f.createElementVNode("path",{d:"M17 4v16"},null,-1)]))}const GU=je(HU,[["render",WU]]),ZU={},YU={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-rosette-discount-check"};function XU(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("svg",YU,e[0]||(e[0]=[f.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),f.createElementVNode("path",{d:"M5 7.2a2.2 2.2 0 0 1 2.2 -2.2h1a2.2 2.2 0 0 0 1.55 -.64l.7 -.7a2.2 2.2 0 0 1 3.12 0l.7 .7c.412 .41 .97 .64 1.55 .64h1a2.2 2.2 0 0 1 2.2 2.2v1c0 .58 .23 1.138 .64 1.55l.7 .7a2.2 2.2 0 0 1 0 3.12l-.7 .7a2.2 2.2 0 0 0 -.64 1.55v1a2.2 2.2 0 0 1 -2.2 2.2h-1a2.2 2.2 0 0 0 -1.55 .64l-.7 .7a2.2 2.2 0 0 1 -3.12 0l-.7 -.7a2.2 2.2 0 0 0 -1.55 -.64h-1a2.2 2.2 0 0 1 -2.2 -2.2v-1a2.2 2.2 0 0 0 -.64 -1.55l-.7 -.7a2.2 2.2 0 0 1 0 -3.12l.7 -.7a2.2 2.2 0 0 0 .64 -1.55v-1"},null,-1),f.createElementVNode("path",{d:"M9 12l2 2l4 -4"},null,-1)]))}const KU={components:{IconExport:GU,IconChevronDown:jS,IconSuccess:je(ZU,[["render",XU]])},props:{table:String,columns:Array,page:[String,Number],filterCustom:String,filterState:String,filters:String},data(){return{isOpen:!1,tableFormats:["json","csv","xlsx"],format:"",cols:[],activeAction:"",isSuccessTemplate:!1,actions:[{name:"choceAll",function:this.choceAll,label:"Вибрати усі"},{name:"choceVisible",function:this.choceVisible,label:"Вибрати поточні"},{name:"clearAll",function:this.clearAll,label:"Жодного"}]}},watch:{isOpen(t){t||(this.format="",this.cols=[],this.activeAction="",this.isSuccessTemplate=!1)}},methods:{async exportTable(){var t;if(!((t=this.cols)!=null&&t.length)){this.$notify({type:"error",title:"Помилка",message:"Оберіть колонки для експорту!"});return}if(!this.format){this.$notify({type:"error",title:"Помилка",message:"Оберіть формат!"});return}try{const e=await it.get("/api/export",{params:{table:this.table,format:this.format,cols:this.cols.join(","),page:this.page,filter:this.filters||null,state:this.filterState||null,custom:this.filterCustom||null},responseType:"blob"}),n=new Blob([e.data],{type:"application/octet-stream"}),i=window.URL.createObjectURL(n),r=document.createElement("a");r.href=i,r.setAttribute("download",`${this.table.split(".")[0]}.${this.format}`),document.body.appendChild(r),r.click(),document.body.removeChild(r),window.URL.revokeObjectURL(i),this.$notify({type:"success",title:"Експорт",message:"Файл успішно експортовано!"}),this.isSuccessTemplate=!0}catch(e){console.error("Ошибка при экспорте файла:",e),this.$notify({type:"error",title:"Помилка",message:"Не вдалося експортувати файл."})}},selectFormat(t){this.format=t},choceAll(){var t;this.cols=(t=this.columns)==null?void 0:t.map(e=>e==null?void 0:e.name),this.activeAction="choceAll"},clearAll(){this.cols=[],this.activeAction="clearAll"},choceVisible(){var t,e;this.cols=(e=(t=this.columns)==null?void 0:t.filter(n=>(n==null?void 0:n.hidden)!==!0))==null?void 0:e.map(n=>n==null?void 0:n.name),this.activeAction="choceVisible"}}},JU={key:0,class:"flex flex-col items-center"},QU={key:1,class:"p-4"},eH={class:"pb-5 mb-5 border-b border-gray-200 last:pb-0 last:mb-0 last:border-b-0 dark:border-neutral-700"},tH={class:"flex items-center"},nH={class:"flex items-center gap-[10px] ml-auto"},iH=["onClick"],rH={key:0,class:"block h-[8px] w-[8px] rounded-full bg-blue-500"},oH={class:"mt-2 flex row flex-wrap gap-y-[5px] gap-x-[10px]"},sH={class:"pb-5 mb-5 border-b border-gray-200 last:pb-0 last:mb-0 last:border-b-0 dark:border-neutral-700"},aH={class:"mt-2 space-y-2"},lH=["id","onChange"],cH=["for"],uH={key:0,class:"flex w-full justify-end p-[20px] gap-[6px] border-t"},hH={key:1,class:"flex w-full justify-end p-[20px] gap-[6px] border-t"};function dH(t,e,n,i,r,a){const u=f.resolveComponent("IconExport"),l=f.resolveComponent("IconChevronDown"),g=f.resolveComponent("IconSuccess"),b=f.resolveComponent("VsCheckbox"),w=f.resolveComponent("VsDialog");return f.openBlock(),f.createElementBlock(f.Fragment,null,[f.createElementVNode("button",{onClick:e[0]||(e[0]=E=>r.isOpen=!0),class:"py-2 px-2.5 inline-flex items-center gap-x-1.5 text-xs font-medium rounded-lg border border-gray-200 bg-white text-gray-800 shadow-sm hover:bg-gray-50 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-gray-50 dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700"},[f.createVNode(u,{height:"16",width:"16"}),e[7]||(e[7]=f.createTextVNode(" Експорт ")),f.createVNode(l,{height:"12",width:"16"})]),f.createVNode(w,{visible:r.isOpen,"onUpdate:visible":e[6]||(e[6]=E=>r.isOpen=E),title:"Експорт таблиці",size:"small",closeClickBack:!0},{footer:f.withCtx(()=>[r.isSuccessTemplate?(f.openBlock(),f.createElementBlock("div",uH,[f.createElementVNode("button",{type:"button",class:"inline-flex items-center justify-center px-3 py-2 text-sm font-medium text-gray-800 align-middle bg-white border border-gray-200 rounded-lg shadow-sm text-nowrap text-start hover:bg-gray-50 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700",onClick:e[2]||(e[2]=E=>r.isOpen=!1)}," Закрити "),f.createElementVNode("button",{type:"button",class:"inline-flex items-center justify-center px-3 py-2 text-sm font-medium text-white align-middle bg-blue-600 border border-blue-600 rounded-lg shadow-sm text-nowrap gap-x-2 text-start hover:bg-blue-700 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:ring-1 focus:ring-blue-300 dark:focus:ring-blue-500",onClick:e[3]||(e[3]=E=>r.isSuccessTemplate=!1)}," Вигрузити ще ")])):(f.openBlock(),f.createElementBlock("div",hH,[f.createElementVNode("button",{type:"button",class:"inline-flex items-center justify-center px-3 py-2 text-sm font-medium text-gray-800 align-middle bg-white border border-gray-200 rounded-lg shadow-sm text-nowrap text-start hover:bg-gray-50 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700",onClick:e[4]||(e[4]=E=>r.isOpen=!1)}," Скасувати "),f.createElementVNode("button",{type:"button",class:"inline-flex items-center justify-center px-3 py-2 text-sm font-medium text-white align-middle bg-blue-600 border border-blue-600 rounded-lg shadow-sm text-nowrap gap-x-2 text-start hover:bg-blue-700 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:ring-1 focus:ring-blue-300 dark:focus:ring-blue-500",onClick:e[5]||(e[5]=(...E)=>a.exportTable&&a.exportTable(...E))}," Завантажити таблицю ")]))]),default:f.withCtx(()=>[r.isSuccessTemplate?(f.openBlock(),f.createElementBlock("div",JU,[f.createVNode(g,{height:"100",width:"100",class:"text-green-200 mb-[20px]"}),e[8]||(e[8]=f.createElementVNode("h2",null,"Звіт сформовано і збережено",-1))])):(f.openBlock(),f.createElementBlock("div",QU,[f.createElementVNode("div",eH,[f.createElementVNode("div",tH,[e[9]||(e[9]=f.createElementVNode("h2",{class:"text-sm text-gray-500"}," Виберіть стовпці таблиці для експорту: ",-1)),f.createElementVNode("div",nH,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(r.actions,E=>(f.openBlock(),f.createElementBlock("button",{key:E==null?void 0:E.name,onClick:E==null?void 0:E.function,class:"inline-flex items-center gap-[8px] justify-center px-3 py-2 text-sm font-medium text-gray-800 align-middle bg-white border-gray-200 text-nowrap text-start"},[f.createElementVNode("span",{class:f.normalizeClass(["h-[14px] w-[14px] border rounded-full flex items-center justify-center",{"border-blue-500":(E==null?void 0:E.name)===r.activeAction}])},[(E==null?void 0:E.name)===r.activeAction?(f.openBlock(),f.createElementBlock("span",rH)):f.createCommentVNode("",!0)],2),f.createTextVNode(" "+f.toDisplayString(E==null?void 0:E.label),1)],8,iH))),128))])]),f.createElementVNode("div",oH,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(n.columns,(E,C)=>(f.openBlock(),f.createElementBlock("div",{class:"flex items-center",key:C,style:{width:"calc((100% - 10px) / 2)"}},[f.createVNode(b,{class:"[&>label]:text-sm [&>label]:text-gray-800 [&>label]:ms-3 !gap-x-[1px] !p-0",modelValue:r.cols,"onUpdate:modelValue":e[1]||(e[1]=P=>r.cols=P),value:E==null?void 0:E.name,label:E==null?void 0:E.ua},null,8,["modelValue","value","label"])]))),128))])]),f.createElementVNode("div",sH,[e[10]||(e[10]=f.createElementVNode("h2",{class:"text-sm text-gray-500"},"Виберіть формат таблиці:",-1)),f.createElementVNode("div",aH,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(r.tableFormats,(E,C)=>(f.openBlock(),f.createElementBlock("div",{class:"flex items-center",key:C},[f.createElementVNode("input",{type:"radio",name:"hs-pro-duecmfm",class:"text-blue-600 border-gray-300 rounded-full shrink-0 focus:ring-blue-500 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-800 dark:border-neutral-500 dark:checked:bg-blue-500 dark:checked:border-blue-500 dark:focus:ring-offset-gray-800",id:E,onChange:P=>a.selectFormat(E)},null,40,lH),f.createElementVNode("label",{for:E,class:"text-sm text-gray-800 ms-3 dark:text-neutral-400"}," Формат "+f.toDisplayString(E),9,cH)]))),128))])])]))]),_:1},8,["visible"])],64)}const pH=je(KU,[["render",dH]]),fH={},mH={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-columns"};function gH(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("svg",mH,e[0]||(e[0]=[f.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M4 6l5.5 0"></path><path d="M4 10l5.5 0"></path><path d="M4 14l5.5 0"></path><path d="M4 18l5.5 0"></path><path d="M14.5 6l5.5 0"></path><path d="M14.5 10l5.5 0"></path><path d="M14.5 14l5.5 0"></path><path d="M14.5 18l5.5 0"></path>',9)]))}const yH=je(fH,[["render",gH]]),_H={props:{column:Object},emits:["update-column"],data(){return{value:!1}},watch:{value(t){this.$emit("update-column",{...this.column,hidden:!t})}},mounted(){var t;((t=this.column)==null?void 0:t.hidden)!==!0&&(this.value=!0)}},bH={class:"flex w-full gap-[8px] items-centr"};function xH(t,e,n,i,r,a){var u,l;return f.openBlock(),f.createElementBlock("label",bH,[f.withDirectives(f.createElementVNode("input",{"onUpdate:modelValue":e[0]||(e[0]=g=>r.value=g),type:"checkbox"},null,512),[[f.vModelCheckbox,r.value]]),f.createTextVNode(" "+f.toDisplayString(((u=n.column)==null?void 0:u.ua)||((l=n.column)==null?void 0:l.title)),1)])}const vH={components:{IconColumns:yH,AdminTableColumnsHiddenItem:je(_H,[["render",xH]])},emits:["update-columns"],props:{columns:Array},methods:{updateColumn(t){const e=this.columns.findIndex(i=>(i==null?void 0:i.name)===(t==null?void 0:t.name)),n=this.columns;n[e]=t,this.$emit("update-columns",[...n])}}},wH={class:"py-2 px-2.5 inline-flex items-center gap-x-1.5 text-xs font-medium rounded-lg border border-gray-200 bg-white text-gray-800 shadow-sm hover:bg-gray-50 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-gray-50 dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700"},kH={class:"py-[10px] px-[10px] w-[260px]"},SH={class:"flex flex-col gap-[3px] max-h-[400px] w-full overflow-auto [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar:horizontal]:h-[8px] [&::-webkit-scrollbar-track]:bg-gray-100 [&::-webkit-scrollbar-thumb]:bg-gray-300 dark:[&::-webkit-scrollbar-track]:bg-neutral-700 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500"};function EH(t,e,n,i,r,a){const u=f.resolveComponent("IconColumns"),l=f.resolveComponent("AdminTableColumnsHiddenItem"),g=f.resolveComponent("VsPopover");return f.openBlock(),f.createBlock(g,{trigger:"click",placement:"bottom"},{reference:f.withCtx(()=>[f.createElementVNode("button",wH,[f.createVNode(u,{height:"20",width:"16"})])]),default:f.withCtx(()=>[f.createElementVNode("div",kH,[e[0]||(e[0]=f.createElementVNode("h2",{class:"text-sm mb-[8px]"},"Оберіть колонки, щоб приховати",-1)),f.createElementVNode("ul",SH,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(n.columns,(b,w)=>(f.openBlock(),f.createElementBlock("li",{key:w},[f.createVNode(l,{column:b,onUpdateColumn:a.updateColumn},null,8,["column","onUpdateColumn"])]))),128))])])]),_:1})}const CH=je(vH,[["render",EH]]),TH={},MH={class:"hidden sm:block shrink-0 size-3",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",viewBox:"0 0 16 16"};function AH(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("svg",MH,e[0]||(e[0]=[f.createElementVNode("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M8 1C8.55228 1 9 1.44772 9 2V7L14 7C14.5523 7 15 7.44771 15 8C15 8.55228 14.5523 9 14 9L9 9V14C9 14.5523 8.55228 15 8 15C7.44772 15 7 14.5523 7 14V9.00001L2 9.00001C1.44772 9.00001 1 8.5523 1 8.00001C0.999999 7.44773 1.44771 7.00001 2 7.00001L7 7.00001V2C7 1.44772 7.44772 1 8 1Z"},null,-1)]))}const US=je(TH,[["render",AH]]),IH={props:{row:Object,column:Object,table:String}};function PH(t,e,n,i,r,a){var u,l,g,b,w,E,C,P;return f.openBlock(),f.createBlock(f.resolveDynamicComponent(((u=n.column)==null?void 0:u.format)==="custom"?(l=n.column)==null?void 0:l.component:`table-format-${((b=(g=n.column)==null?void 0:g.format)==null?void 0:b.toLowerCase())||"text"}`),{onUpdateTable:e[0]||(e[0]=D=>t.$emit("update-table")),name:(w=n.column)==null?void 0:w.name,data:n.row,value:(C=n.row)==null?void 0:C[(E=n.column)==null?void 0:E.name],table:n.table,column:n.column,edit:(P=n.column)==null?void 0:P.edit},null,40,["name","data","value","table","column","edit"])}const HS=je(IH,[["render",PH]]),DH={},OH={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-minus"};function BH(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("svg",OH,e[0]||(e[0]=[f.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),f.createElementVNode("path",{d:"M5 12l14 0"},null,-1)]))}const zH={components:{IconPlus:US,IconMinus:je(DH,[["render",BH]])},props:{title:String,defaultValue:{type:Boolean,default:()=>!1}},data(){return{expanded:this.defaultValue}}},NH={class:"hs-accordion"},RH={class:"py-0.5 flex items-center gap-x-0.5 w-full"},LH={class:"text-sm font-medium"},VH={class:"relative inline-block w-full duration-150 cursor-pointer before:block before:absolute b"};function FH(t,e,n,i,r,a){const u=f.resolveComponent("IconPlus"),l=f.resolveComponent("IconMinus");return f.openBlock(),f.createElementBlock("div",null,[f.createElementVNode("div",null,[f.createElementVNode("div",NH,[f.createElementVNode("div",RH,[f.createElementVNode("div",{onClick:e[0]||(e[0]=g=>r.expanded=!r.expanded),class:"rounded-md cursor-pointer grow"},[f.createElementVNode("span",LH,f.toDisplayString(n.title),1)]),f.createElementVNode("button",{class:"flex items-center justify-center rounded-md size-6 hover:bg-gray-100",onClick:e[1]||(e[1]=g=>r.expanded=!r.expanded)},[r.expanded?(f.openBlock(),f.createBlock(l,{key:1,width:"14"})):(f.openBlock(),f.createBlock(u,{key:0}))])]),f.createVNode(f.Transition,{name:"fade"},{default:f.withCtx(()=>[f.withDirectives(f.createElementVNode("div",VH,[f.renderSlot(t.$slots,"default",{},void 0,!0)],512),[[f.vShow,r.expanded]])]),_:3})])])])}const $H={components:{AdminComponentIs:HS,AdminTree:je(zH,[["render",FH],["__scopeId","data-v-c6318482"]]),VsNoData:RS,VsWidgetComments:DS,VsWidgetMap:K1,VsWidgetFileList:Xv},props:{table:String,columns:Array,row:Object}},jH={class:"hs-accordion border-gray-100 w-[360px] shrink-0 overflow-auto [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar:horizontal]:h-[8px] [&::-webkit-scrollbar-track]:bg-gray-100 [&::-webkit-scrollbar-thumb]:bg-gray-300 dark:[&::-webkit-scrollbar-track]:bg-neutral-700 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500",style:{height:"calc(100vh - 310px)"}},UH={class:"border-l",style:{height:"calc(100vh - 360px)"}},HH={class:"flex items-center justify-between py-1 gap-x-4"},qH={class:"col-span-1"},WH={class:"inline-flex items-center gap-x-2 text-[13px] text-gray-500 dark:text-neutral-500"},GH={class:"col-span-2"},ZH={class:"font-medium text-[13px] text-gray-800 dark:text-neutral-200"},YH={class:"table-info-card"},XH={class:"table-info-card"};function KH(t,e,n,i,r,a){var C,P,D;const u=f.resolveComponent("AdminComponentIs"),l=f.resolveComponent("AdminTree"),g=f.resolveComponent("VsWidgetMap"),b=f.resolveComponent("VsNoData"),w=f.resolveComponent("VsWidgetComments"),E=f.resolveComponent("VsWidgetFileList");return f.openBlock(),f.createElementBlock("div",jH,[e[0]||(e[0]=f.createElementVNode("div",{class:"p-[10px] pl-[18px] pb-[18px] border-b"},[f.createElementVNode("h2",{class:"text-sm font-medium"},"Інформація про об'єкт")],-1)),f.createElementVNode("div",UH,[(P=(C=t.$route)==null?void 0:C.query)!=null&&P.card?(f.openBlock(),f.createElementBlock(f.Fragment,{key:0},[n.row?(f.openBlock(),f.createBlock(l,{key:0,defaultValue:!0,title:"Основна інформація",class:"border-b p-[10px] py-[16px]"},{default:f.withCtx(()=>[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(n.columns,R=>(f.openBlock(),f.createElementBlock("dl",HH,[f.createElementVNode("dt",qH,[f.createElementVNode("p",WH,f.toDisplayString((R==null?void 0:R.ua)||(R==null?void 0:R.title))+": ",1)]),f.createElementVNode("dd",GH,[f.createElementVNode("p",ZH,[f.createVNode(u,{row:n.row,column:R,table:n.table},null,8,["row","column","table"])])])]))),256))]),_:1})):f.createCommentVNode("",!0),(D=n.row)!=null&&D.geom?(f.openBlock(),f.createBlock(l,{key:1,title:"Карта",class:"border-b p-[10px] py-[16px]"},{default:f.withCtx(()=>{var R,$;return[(R=n.row)!=null&&R.geom?(f.openBlock(),f.createBlock(g,{key:0,geometry:($=n.row)==null?void 0:$.geom,zoom:14},null,8,["geometry"])):(f.openBlock(),f.createBlock(b,{key:1,title:"У об'єкта відсутня геометрія",text:"",class:"[&>div]:h-[200px] [&>div]:min-h-[400px] h-[400px]"}))]}),_:1})):f.createCommentVNode("",!0),f.createVNode(l,{title:"Коментарі",class:"border-b p-[10px] py-[16px]"},{default:f.withCtx(()=>{var R;return[f.createElementVNode("div",YH,[f.createVNode(w,{id:(R=n.row)==null?void 0:R.id},null,8,["id"])])]}),_:1}),f.createVNode(l,{title:"Файли",class:"border-b p-[10px] py-[16px]"},{default:f.withCtx(()=>{var R;return[f.createElementVNode("div",XH,[f.createVNode(E,{id:(R=n.row)==null?void 0:R.id},null,8,["id"])])]}),_:1})],64)):(f.openBlock(),f.createBlock(b,{key:1,text:"Оберіть один з об'єктів в таблиці для відображення інформаціі про нього"}))])])}const JH=je($H,[["render",KH]]),QH={},eq={class:"hidden xl:block shrink-0 size-4",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function tq(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("svg",eq,e[0]||(e[0]=[f.createElementVNode("rect",{width:"18",height:"18",x:"3",y:"3",rx:"2"},null,-1),f.createElementVNode("path",{d:"M15 3v18"},null,-1),f.createElementVNode("path",{d:"m8 9 3 3-3 3"},null,-1)]))}const nq=je(QH,[["render",tq]]),iq={},rq={class:"h21yx vs0hq",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function oq(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("svg",rq,e[0]||(e[0]=[f.createStaticVNode('<line x1="21" x2="14" y1="4" y2="4"></line><line x1="10" x2="3" y1="4" y2="4"></line><line x1="21" x2="12" y1="12" y2="12"></line><line x1="8" x2="3" y1="12" y2="12"></line><line x1="21" x2="16" y1="20" y2="20"></line><line x1="12" x2="3" y1="20" y2="20"></line><line x1="14" x2="14" y1="2" y2="6"></line><line x1="8" x2="8" y1="10" y2="14"></line><line x1="16" x2="16" y1="18" y2="22"></line>',9)]))}const sq={emits:["filterChange"],props:{scheme:{type:Object},onFilters:{type:Number}},components:{IconFilter:je(iq,[["render",oq]])},data(){return{isFilters:!1}},methods:{closeFilter({target:t}){this.isFilters&&t.classList.contains("filter-container")&&(this.isFilters=!1)}}},aq={key:0,class:"font-medium text-[10px] py-0.5 px-[5px] bg-gray-800 text-white leading-3 rounded-full dark:bg-neutral-500"},lq={class:"filter-content h-screen bg-white w-[400px] p-[20px] pt-[10px] overflow-x-auto bg-white [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar:horizontal]:h-[8px] [&::-webkit-scrollbar-track]:bg-gray-100 [&::-webkit-scrollbar-thumb]:bg-gray-300 dark:[&::-webkit-scrollbar-track]:bg-neutral-700 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500"};function cq(t,e,n,i,r,a){const u=f.resolveComponent("IconFilter"),l=f.resolveComponent("VsFilter");return f.openBlock(),f.createElementBlock(f.Fragment,null,[f.createElementVNode("button",{onClick:e[0]||(e[0]=g=>r.isFilters=!r.isFilters),class:"py-2 px-2.5 inline-flex items-center gap-x-1.5 text-xs font-medium rounded-lg border border-gray-200 bg-white text-gray-800 shadow-sm hover:bg-gray-50 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-gray-50 dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700"},[f.createVNode(u,{height:"16",width:"16"}),e[4]||(e[4]=f.createTextVNode(" Фільтри ")),n.onFilters?(f.openBlock(),f.createElementBlock("span",aq,f.toDisplayString(n.onFilters),1)):f.createCommentVNode("",!0)]),f.createVNode(f.Transition,{name:"fade"},{default:f.withCtx(()=>{var g;return[f.withDirectives(f.createElementVNode("div",{onClick:e[3]||(e[3]=(...b)=>a.closeFilter&&a.closeFilter(...b)),style:{height:"100vh"},class:"fixed filter-container top-0 flex justify-end items-center z-[2] right-0 left-0 bottom-0 bg-[rgba(0,0,0,0.5)]"},[f.createElementVNode("div",lq,[(g=n.scheme)!=null&&g.length?(f.openBlock(),f.createBlock(l,{key:0,ref:"filter",scheme:n.scheme,layout:"default","apply-vue-router":"",history:"",name:"filter",onFilterChange:e[1]||(e[1]=b=>t.$emit("filterChange",b)),closeFilterBtn:!0,onFilterClose:e[2]||(e[2]=b=>r.isFilters=!1)},null,8,["scheme"])):f.createCommentVNode("",!0)])],512),[[f.vShow,r.isFilters]])]}),_:1})],64)}const uq=je(sq,[["render",cq]]),hq={props:{tabsList:{type:Array,default:()=>[]},filterState:String}},dq={class:"relative flex space-x-1 mb-[20px] after:absolute after:w-[99%] after:bottom-0 after:inset-x-0 after:border-b-2 after:border-gray-200 dark:after:border-neutral-700","aria-label":"Tabs",role:"tablist","aria-orientation":"horizontal"},pq=["onClick"];function fq(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("nav",dq,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(n.tabsList,u=>(f.openBlock(),f.createElementBlock("button",{onClick:l=>t.$emit("update:filterState",u==null?void 0:u.name),class:f.normalizeClass(["hs-tab-active:after:bg-gray-800 hs-tab-active:text-gray-800 px-2.5 py-1.5 mb-2 relative inline-flex justify-center items-center gap-x-2 hover:bg-gray-100 text-gray-500 hover:text-gray-800 text-sm rounded-lg disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-gray-100 after:absolute after:-bottom-2 after:inset-x-0 after:z-10 after:h-0.5 after:pointer-events-none dark:hs-tab-active:text-neutral-200 dark:hs-tab-active:after:bg-neutral-400 dark:text-neutral-500 dark:hover:text-neutral-300 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700 active",{" font-semibold after:absolute after:bottom-[-8px] after:left-2.5 after:right-2.5 after:z-10 after:h-0.5 after:bg-gray-800":(u==null?void 0:u.name)===n.filterState}])},f.toDisplayString(u==null?void 0:u.label),11,pq))),256))])}const mq=je(hq,[["render",fq]]),gq={},yq={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-filter"};function _q(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("svg",yq,e[0]||(e[0]=[f.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),f.createElementVNode("path",{d:"M4 4h16v2.172a2 2 0 0 1 -.586 1.414l-4.414 4.414v7l-6 2v-8.5l-4.48 -4.928a2 2 0 0 1 -.52 -1.345v-2.227z"},null,-1)]))}const bq={components:{IconFilter2:je(gq,[["render",_q]])},props:{filterCustom:String,customList:Array}},xq={class:"py-2 px-2.5 inline-flex items-center gap-x-1.5 text-xs font-medium rounded-lg border border-gray-200 bg-white text-gray-800 shadow-sm hover:bg-gray-50 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-gray-50 dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700"},vq={class:"flex flex-col gap-[4px]"},wq=["onClick"];function kq(t,e,n,i,r,a){const u=f.resolveComponent("IconFilter2"),l=f.resolveComponent("VsPopover");return f.openBlock(),f.createBlock(l,{ref:"popover",placement:"bottom"},{reference:f.withCtx(()=>[f.createElementVNode("button",xq,[f.createVNode(u,{height:"20",width:"20"})])]),default:f.withCtx(()=>[f.createElementVNode("div",vq,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(n.customList,(g,b)=>(f.openBlock(),f.createElementBlock("button",{onClick:w=>{var E;t.$emit("update:filterCustom",g==null?void 0:g.name),(E=t.$refs)==null||E.popover.togglePopover()},key:b,class:f.normalizeClass(["p-[8px] block rounded-lg w-[140px] text-start hover:bg-gray-100 !duration-300",{"bg-gray-100":n.filterCustom===(g==null?void 0:g.name)}])},f.toDisplayString(g==null?void 0:g.label),11,wq))),128)),f.createElementVNode("button",{class:"p-[8px] block rounded-lg w-[140px] text-start hover:bg-gray-100 !duration-300",onClick:e[0]||(e[0]=g=>{var b;t.$emit("update:filterCustom",void 0),(b=t.$refs)==null||b.popover.togglePopover()})}," Скинути фільтри ")])]),_:1},512)}const Sq=je(bq,[["render",kq]]),Eq={class:"flex items-center gap-x-2"},Cq={props:{table:String,title:String},components:{AdminTableControl:UU,AdminTableExport:pH,AdminTableColumnsHidden:CH,AdminTableColumn:SU,AdminNodata:zS,IconPlus:US,IconSearch:t_,AdminTableCardInfo:JH,IconOpenCard:nq,AdminComponentIs:HS,AdminTableFilters:uq,AdminTableTabs:mq,AdminTableCustomFilters:Sq,AdminTableCustomButtons:{__name:"admin-table-custom-buttons",props:{slots:Object},setup(t){var l,g,b,w,E;const{asyncTemplateSlot:e}=(E=(w=(b=(g=(l=f.getCurrentInstance())==null?void 0:l.appContext)==null?void 0:g.app)==null?void 0:b.config)==null?void 0:w.globalProperties)==null?void 0:E.utils,n=f.ref(""),i=f.ref(""),r=t,a=()=>{var C,P,D,R,$;if((C=r.slots)!=null&&C.panelLeft||(i.value="div"),(D=(P=r.slots)==null?void 0:P.panelLeft)!=null&&D.includes("<")){const W=e("PanelLeft",(R=r.slots)==null?void 0:R.panelLeft,["name"]);i.value=W}else i.value=($=r.slots)==null?void 0:$.panelLeft},u=()=>{var C,P,D,R,$;if((C=r.slots)!=null&&C.panelRight||(n.value="div"),(D=(P=r.slots)==null?void 0:P.panelRight)!=null&&D.includes("<")){const W=e("PanelRight",(R=r.slots)==null?void 0:R.panelRight,["name"]);n.value=W}else n.value=($=r.slots)==null?void 0:$.panelRight};return a(),u(),(C,P)=>(f.openBlock(),f.createElementBlock("div",Eq,[(f.openBlock(),f.createBlock(f.resolveDynamicComponent(i.value))),(f.openBlock(),f.createBlock(f.resolveDynamicComponent(n.value)))]))}}},data(){return{tableData:{},filterScheme:[],page:1,searchValue:"",limit:0,filters:null,activeColumn:"",isVisibleCardInfo:!1,onFilters:0,filterState:null,filterCustom:null,visibleColumns:[],initialHiddenColumns:""}},async mounted(){await this.checkUrlMounted(),await this.getTableData(),await this.getFilters()},computed:{defaultPage(){var t,e;return((e=(t=this.$route)==null?void 0:t.query)==null?void 0:e.page)||1},columns(){var t,e;return(e=(t=this.tableData)==null?void 0:t.columns)==null?void 0:e.filter(n=>(n==null?void 0:n.hidden)!==!0)},isForm(){var t;return(t=this.tableData)==null?void 0:t.form},isNoData(){var t,e;return!((t=this.tableData)!=null&&t.rows)||!((e=this.columns)!=null&&e.length)},activeCardRow(){var t,e;return((e=(t=this.tableData)==null?void 0:t.rows)==null?void 0:e.find(n=>{var i,r;return(n==null?void 0:n.id)===((r=(i=this.$route)==null?void 0:i.query)==null?void 0:r.card)}))||{}},getActions(){var t;return(t=this.tableData)==null?void 0:t.actions}},watch:{async table(){this.tableData=null,await this.getTableData()},searchValue:{handler:((t,e=300)=>{let n;return function(...i){clearTimeout(n),n=setTimeout(()=>{t.apply(this,i)},e)}})(async function(t){var e;await this.getTableData(),this.$router.push({...this.$route,query:{...(e=this.$route)==null?void 0:e.query,search:t||void 0}})},500)},$route:{handler(t,e){var n,i;((n=t==null?void 0:t.params)==null?void 0:n.catchAll)!==((i=e==null?void 0:e.params)==null?void 0:i.catchAll)&&(this.visibleColumns=[],this.unmountedData(),this.getFilters())},deep:!0},limit(t){var e;this.$router.replace({query:{...(e=this.$route)==null?void 0:e.query,limit:t}})},filterState(t){var e;t&&(this.$router.replace({...this.$route,query:{...(e=this.$route)==null?void 0:e.query,filterState:t}}),this.getTableData())},filterCustom(t){var e;this.$router.replace({...this.$route,query:{...(e=this.$route)==null?void 0:e.query,custom:t}}),this.getTableData()},columns(t){var e,n,i,r;this.visibleColumns=t==null?void 0:t.map(a=>a==null?void 0:a.name),this.initialHiddenColumns===((e=this.visibleColumns)==null?void 0:e.join(","))&&(this.visibleColumns=[]),this.$router.replace({...this.$route,query:{...(n=this.$route)==null?void 0:n.query,columns:(i=this.visibleColumns)!=null&&i.length?(r=this.visibleColumns)==null?void 0:r.join(","):void 0}})}},methods:{async checkUrlMounted(){var t,e,n,i,r,a,u,l,g,b,w,E,C,P,D,R,$;this.page=((e=(t=this.$route)==null?void 0:t.query)==null?void 0:e.page)||1,this.limit=((i=(n=this.$route)==null?void 0:n.query)==null?void 0:i.limit)||20,this.filters=((u=decodeURI((a=(r=this.$route)==null?void 0:r.query)==null?void 0:a.filter))==null?void 0:u.replaceAll("+"," "))||null,this.filterState=((g=(l=this.$route)==null?void 0:l.query)==null?void 0:g.filterState)||null,this.filterCustom=((w=(b=this.$route)==null?void 0:b.query)==null?void 0:w.custom)||null,this.searchValue=((C=(E=this.$route)==null?void 0:E.query)==null?void 0:C.search)||"",this.visibleColumns=((R=(D=(P=this.$route)==null?void 0:P.query)==null?void 0:D.columns)==null?void 0:R.split(","))||[],($=this.$route)!=null&&$.query.card&&(this.isVisibleCardInfo=!0)},rowWidth(t){var n,i;const e=(i=(n=this.tableData)==null?void 0:n.columns)==null?void 0:i.find(r=>r.name===t);if(e){const r=e==null?void 0:e.width;return typeof r=="number"?`${r}px`:r!=null&&r.includes("px")?r:`${r}px`}},unmountedData(){this.page=1,this.visibleColumns=[],this.filterCustom=null,this.filterState=null,this.isVisibleCardInfo=!1,this.filterScheme=null,this.filters=null,this.onFilters=0,this.searchValue=""},async getTableData(){var t,e,n,i,r,a,u,l,g,b,w;try{const{data:E}=await it.get(`/api/template/table/${this.table}`),C=await it.get(`/api/table-data/${this.table}`,{params:{page:this.page,search:this.searchValue||null,limit:this.limit,filter:this.filters||null,order:((e=(t=this.$route)==null?void 0:t.query)==null?void 0:e.sort)||null,state:this.filterState||null,custom:this.filterCustom||null}});this.tableData={...E,...(C==null?void 0:C.data)||{}},this.initialHiddenColumns=(a=(r=(i=(n=this.tableData)==null?void 0:n.columns)==null?void 0:i.filter(P=>(P==null?void 0:P.hidden)!==!0))==null?void 0:r.map(P=>P==null?void 0:P.name))==null?void 0:a.join(","),(u=this.visibleColumns)!=null&&u.length?(l=this.tableData)==null||l.columns.forEach(P=>{var D;(D=this.visibleColumns)!=null&&D.includes(P==null?void 0:P.name)?P.hidden=!1:P.hidden=!0}):this.visibleColumns=(w=(b=(g=this.tableData)==null?void 0:g.columns)==null?void 0:b.filter(P=>(P==null?void 0:P.hidden)!==!0))==null?void 0:w.map(P=>P==null?void 0:P.name)}catch{}},async getFilters(){var t;try{const{data:e}=await it.get(`/api/table-filter/${this.table}`);this.filterScheme=(t=e==null?void 0:e.list)==null?void 0:t.map(n=>({...n,label:(n==null?void 0:n.label)||(n==null?void 0:n.ua)}))}catch{}},async handlePageChange(t){const e=this.$route.query;this.page=t,!(!(e!=null&&e.page)&&t===1||e.page===t)&&(await this.$router.replace({query:{...e,page:t}}),await this.getTableData())},async changeLimit(t){this.limit=await t,this.defaultPage=1,await this.getTableData()},async filterChange({url:t,state:e}){var n;this.filters=t!=="no-url"?t:null,this.onFilters=(n=Object.entries(e))==null?void 0:n.length,this.page=1,await this.getTableData()},changeActiveColumn(t){this.activeColumn=t,this.getTableData()},pushToCard(t){var e;((e=this.tableData)==null?void 0:e.card)===!1||this.$router.push(`/card/${this.table}/${t}`)},changeActiveCardInfo(t){var e;this.isVisibleCardInfo&&this.$router.push({...this.$route,query:{...(e=this.$route)==null?void 0:e.query,card:t}})},toggleCardInfo(){var t;this.isVisibleCardInfo=!this.isVisibleCardInfo,this.isVisibleCardInfo||this.$router.push({...this.$route,query:{...(t=this.$route)==null?void 0:t.query,card:void 0}})}}},Tq={class:"w-[calc(100vw - 320px)] bg-gray-50"},Mq={class:"h-[76px] mt-[15px] flex items-center justify-between mx-[20px] px-[20px] bg-white border rounded-xl"},Aq={class:"text-xl font-medium"},Iq={style:{height:"calc(100vh - 155px)",width:"calc(100vw - 260px)"},class:"bg-gray-50 p-[20px] flex pt-[10px]"},Pq={class:"bg-white w-full rounded-xl border p-[20px] pr-0"},Dq={class:"flex"},Oq={class:"flex gap-[6px] ml-auto"},Bq={class:"inline-block w-full align-middle"},zq={key:0,class:"relative w-max min-w-full divide-y divide-gray-200 table-fixed dark:divide-neutral-700"},Nq={class:"sticky top-[-1px] bg-white w-full after:absolute after:content-[''] after:block after:w-full after:h-px after:bg-stone-200"},Rq={class:"right-0 border-t border-stone-200"},Lq={key:0,class:"w-[70px] sticky right-0 top-0"},Vq={class:"divide-y divide-gray-200"},Fq={class:"px-4 py-3 text-sm text-gray-600"},$q=["onClick"],jq=["onClick"],Uq={class:"p-[20px] flex justify-start items-center w-full"},Hq={class:"w-[200px]"},qq={class:"text-sm text-gray-600 dark:text-neutral-400"},Wq={class:"font-semibold text-gray-800 dark:text-neutral-200"},Gq={key:0},Zq={key:0,class:"font-semibold text-gray-800 dark:text-neutral-200"};function Yq(t,e,n,i,r,a){var Se,Ne,Ae,$e,Xe,Pt,ot,Tt,Nt,Vt,Ft,Ht,Cn,dn,vn,pn,ti,Nn,Pn,Rn,Ce,He;const u=f.resolveComponent("IconPlus"),l=f.resolveComponent("router-link"),g=f.resolveComponent("AdminTableTabs"),b=f.resolveComponent("IconSearch"),w=f.resolveComponent("VsText"),E=f.resolveComponent("AdminTableCustomButtons"),C=f.resolveComponent("AdminTableCustomFilters"),P=f.resolveComponent("AdminTableColumnsHidden"),D=f.resolveComponent("AdminTableExport"),R=f.resolveComponent("AdminTableFilters"),$=f.resolveComponent("IconOpenCard"),W=f.resolveComponent("AdminTableColumn"),te=f.resolveComponent("AdminComponentIs"),G=f.resolveComponent("AdminTableControl"),Q=f.resolveComponent("AdminNodata"),Ie=f.resolveComponent("VsPagination"),ve=f.resolveComponent("AdminTableCardInfo");return f.openBlock(),f.createElementBlock("div",Tq,[f.createElementVNode("div",Mq,[f.createElementVNode("h2",Aq,f.toDisplayString(n.title),1),a.isForm?(f.openBlock(),f.createBlock(l,{key:0,to:`/add?table=${(Ne=(Se=t.$route)==null?void 0:Se.params)==null?void 0:Ne.catchAll}`,class:"inline-flex items-center px-3 py-2 text-sm font-medium text-white duration-300 bg-blue-600 border border-transparent rounded-lg gap-x-2 hover:bg-blue-700 hover:text-white"},{default:f.withCtx(()=>[f.createVNode(u,{height:"16",width:"16"}),e[5]||(e[5]=f.createTextVNode(" Додати "))]),_:1},8,["to"])):f.createCommentVNode("",!0)]),f.createElementVNode("div",Iq,[f.createElementVNode("div",Pq,[($e=(Ae=r.tableData)==null?void 0:Ae.filterState)!=null&&$e.length?(f.openBlock(),f.createBlock(g,{key:0,tabsList:(Xe=r.tableData)==null?void 0:Xe.filterState,filterState:r.filterState,"onUpdate:filterState":e[0]||(e[0]=De=>r.filterState=De)},null,8,["tabsList","filterState"])):f.createCommentVNode("",!0),f.createElementVNode("div",Dq,[f.createElementVNode("div",{class:f.normalizeClass([r.isVisibleCardInfo?"w-[calc(100%-360px)]":"w-full"])},[f.createElementVNode("div",{class:f.normalizeClass(["flex sm:grid sm:grid-cols-2 gap-x-2 sm:gap-x-5 mb-[10px] relative",{"pr-[20px]":!r.isVisibleCardInfo}])},[f.createVNode(b,{height:"14",width:"14",class:"absolute top-[10px] left-[14px] text-gray-500 z-[1]"}),f.createVNode(w,{modelValue:r.searchValue,"onUpdate:modelValue":e[1]||(e[1]=De=>r.searchValue=De),placeholder:"Пошук...",clearable:!0,class:"[&>input]:py-[7px] [&>input]:ps-10 [&>input]:pe-8 [&>input]:block [&>input]:w-full [&>input]:bg-gray-100 [&>input]:border-transparent [&>input]:rounded-lg [&>input]:text-sm [&>input]:focus:bg-white [&>input]:focus:border-blue-500 [&>input]:focus:ring-blue-500 [&>input]:disabled:opacity-50 [&>input]:disabled:pointer-events-none [&>input]:dark:bg-neutral-700 [&>input]:dark:border-transparent [&>input]:dark:text-neutral-400 [&>input]:dark:placeholder:text-neutral-400 dark:focus:bg-neutral-800 dark:focus:ring-neutral-600"},null,8,["modelValue"]),f.createElementVNode("div",Oq,[(Pt=r.tableData)!=null&&Pt.slots?(f.openBlock(),f.createBlock(E,{key:0,slots:(ot=r.tableData)==null?void 0:ot.slots},null,8,["slots"])):f.createCommentVNode("",!0),(Nt=(Tt=r.tableData)==null?void 0:Tt.filterCustom)!=null&&Nt.length?(f.openBlock(),f.createBlock(C,{key:1,customList:(Vt=r.tableData)==null?void 0:Vt.filterCustom,filterCustom:r.filterCustom,"onUpdate:filterCustom":e[2]||(e[2]=De=>r.filterCustom=De)},null,8,["customList","filterCustom"])):f.createCommentVNode("",!0),f.createVNode(P,{columns:(Ft=r.tableData)==null?void 0:Ft.columns,onUpdateColumns:e[3]||(e[3]=De=>r.tableData.columns=De)},null,8,["columns"]),f.createVNode(D,{table:n.table,columns:(Ht=r.tableData)==null?void 0:Ht.columns,page:r.page,"filter-state":r.filterState,"filter-custom":r.filterCustom,filters:r.filters},null,8,["table","columns","page","filter-state","filter-custom","filters"]),(Cn=r.filterScheme)!=null&&Cn.length?(f.openBlock(),f.createBlock(R,{key:2,scheme:r.filterScheme,onFilters:r.onFilters,onFilterChange:a.filterChange},null,8,["scheme","onFilters","onFilterChange"])):f.createCommentVNode("",!0),f.createElementVNode("button",{onClick:e[4]||(e[4]=(...De)=>a.toggleCardInfo&&a.toggleCardInfo(...De)),class:"py-2 px-2.5 inline-flex items-center gap-x-1.5 text-xs font-medium rounded-lg border border-gray-200 bg-white text-gray-800 shadow-sm hover:bg-gray-50 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-gray-50 dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700"},[f.createVNode($,{class:f.normalizeClass({"rotate-180 duration-300":!r.isVisibleCardInfo})},null,8,["class"])])])],2),f.createElementVNode("div",{class:f.normalizeClass(["flex items-start justify-start w-full space-y-5",{"pr-[20px]":!r.isVisibleCardInfo}])},[f.createElementVNode("div",{style:f.normalizeStyle({height:(vn=(dn=r.tableData)==null?void 0:dn.filterState)!=null&&vn.length?"calc(100vh - 370px)":"calc(100vh - 330px)"}),class:"overflow-x-auto w-full [&::-webkit-scrollbar]:h-2 [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-track]:bg-stone-100 [&::-webkit-scrollbar-thumb]:bg-stone-300 dark:[&::-webkit-scrollbar-track]:bg-neutral-700 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500"},[f.createElementVNode("div",Bq,[a.isNoData?(f.openBlock(),f.createBlock(Q,{key:1})):(f.openBlock(),f.createElementBlock("table",zq,[f.createElementVNode("thead",Nq,[f.createElementVNode("tr",Rq,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(a.columns,De=>(f.openBlock(),f.createBlock(W,{key:De.name,style:f.normalizeStyle({width:a.rowWidth(De==null?void 0:De.name),textAlign:De==null?void 0:De.align,wordBreak:De==null?void 0:De.wrap}),data:De,activeColumn:r.activeColumn,onChangeActive:a.changeActiveColumn},null,8,["style","data","activeColumn","onChangeActive"]))),128)),(ti=(pn=a.getActions)==null?void 0:pn.filter(De=>De!=="add"))!=null&&ti.length?(f.openBlock(),f.createElementBlock("th",Lq)):f.createCommentVNode("",!0)])]),f.createElementVNode("tbody",Vq,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList((Nn=r.tableData)==null?void 0:Nn.rows,(De,ct)=>{var Rt,Qt,At,Mt,rn,we,yn,pr,qt,sn;return f.openBlock(),f.createElementBlock("tr",{key:ct,class:f.normalizeClass({"bg-gray-50":((Qt=(Rt=t.$route)==null?void 0:Rt.query)==null?void 0:Qt.card)===(De==null?void 0:De.id)})},[f.createElementVNode("td",Fq,[f.createElementVNode("button",{onClick:()=>a.pushToCard(De==null?void 0:De.id),class:f.normalizeClass(["text-sm font-medium",[((At=r.tableData)==null?void 0:At.card)===!1?"":"text-blue-600 decoration-2 focus:outline-none focus:underline hover:text-blue-600 hover:underline"]])},[f.createVNode(te,{row:De,column:a.columns[0],table:n.table,onUpdateTable:a.getTableData},null,8,["row","column","table","onUpdateTable"])],10,$q)]),(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList((Mt=a.columns)==null?void 0:Mt.slice(1),ui=>(f.openBlock(),f.createElementBlock("td",{onClick:Hi=>a.changeActiveCardInfo(De==null?void 0:De.id),class:f.normalizeClass(["px-3 py-3 text-sm text-gray-600 text-start",{"cursor-pointer":r.isVisibleCardInfo}]),key:ui.name},[f.createVNode(te,{row:De,column:ui,table:n.table,onUpdateTable:a.getTableData},null,8,["row","column","table","onUpdateTable"])],10,jq))),128)),(we=(rn=a.getActions)==null?void 0:rn.filter(ui=>ui!=="add"))!=null&&we.length?(f.openBlock(),f.createElementBlock("td",{key:0,class:f.normalizeClass(["text-center sticky right-0 w-[80px] px-[10px]",{"bg-gray-50":((pr=(yn=t.$route)==null?void 0:yn.query)==null?void 0:pr.card)===(De==null?void 0:De.id),"bg-white":((sn=(qt=t.$route)==null?void 0:qt.query)==null?void 0:sn.card)!==(De==null?void 0:De.id)}])},[f.createVNode(G,{actions:a.getActions,isForm:a.isForm,item:De,table:n.table,onUpdateTable:a.getTableData},null,8,["actions","isForm","item","table","onUpdateTable"])],2)):f.createCommentVNode("",!0)],2)}),128))])]))])],4)],2),f.createElementVNode("div",Uq,[f.createElementVNode("div",Hq,[f.createElementVNode("p",qq,[f.createElementVNode("span",Wq,[f.createTextVNode(f.toDisplayString(r.filters||r.searchValue?"Знайдено":"Об'єктів")+" "+f.toDisplayString(((Pn=r.tableData)==null?void 0:Pn.count)||"0 ")+" ",1),r.filters||r.searchValue?(f.openBlock(),f.createElementBlock("span",Gq," з")):f.createCommentVNode("",!0)]),r.filters||r.searchValue?(f.openBlock(),f.createElementBlock("span",Zq,f.toDisplayString(" "+((Rn=r.tableData)==null?void 0:Rn.filtered)||0),1)):f.createCommentVNode("",!0)])]),Math.ceil(((Ce=r.tableData)==null?void 0:Ce.filtered)/r.limit)>1?(f.openBlock(),f.createBlock(Ie,{key:0,goTo:!1,class:"justify-end","default-page":parseInt(a.defaultPage),total:((He=r.tableData)==null?void 0:He.filtered)||0,pageSize:parseInt(r.limit),onPageChange:a.handlePageChange,pageSizes:[10,16,20],onPageSizeChange:a.changeLimit,backgroundColor:"#F3F4F6"},null,8,["default-page","total","pageSize","onPageChange","onPageSizeChange"])):f.createCommentVNode("",!0)])],2),f.createVNode(f.Transition,{name:"slide-fade"},{default:f.withCtx(()=>{var De;return[r.isVisibleCardInfo?(f.openBlock(),f.createBlock(ve,{key:0,table:n.table,columns:(De=r.tableData)==null?void 0:De.columns,row:a.activeCardRow},null,8,["table","columns","row"])):f.createCommentVNode("",!0)]}),_:1})])])])])}const Xq={components:{AdminTable:je(Cq,[["render",Yq],["__scopeId","data-v-ec85e237"]])},data(){return{table:!1,interface:"",title:""}},watch:{$route:{async handler(){Kr!=null&&Kr.value||await this.getMenu(),await this.checkPageType()},deep:!0},title(t){var e;t&&(document.title=(((e=ra.value)==null?void 0:e.titlePrefix)||"")+t)}},async mounted(){await this.checkPageType()},methods:{flattenMenu(t){const e=[];return t.forEach(n=>{n.menu?e.push(...this.flattenMenu(n.menu)):e.push(n)}),e},async checkPageType(){var i,r;const t=this.flattenMenu(Kr.value);t!=null&&t.length||this.$router.replace("/404");const e=t==null?void 0:t.find(a=>{var u,l;return(a==null?void 0:a.path)==((l=(u=this.$route)==null?void 0:u.params)==null?void 0:l.catchAll)});this.title=e==null?void 0:e.ua,e||this.$router.replace("/404"),e!=null&&e.component&&this.$router.replace((r=(i=this.$route)==null?void 0:i.params)==null?void 0:r.catchAll);const n=e==null?void 0:e.table;this.table=n||!1,!n&&this.getInterface()},async getInterface(){var t,e;try{const{data:n}=await it.get(`/api/template/interface/${((e=(t=this.$route)==null?void 0:t.params)==null?void 0:e.catchAll)||""}`);this.interface=n||""}catch{this.interface=""}}}},Kq=["innerHTML"];function Jq(t,e,n,i,r,a){const u=f.resolveComponent("AdminTable");return r.table?(f.openBlock(),f.createBlock(u,{key:0,table:r.table,title:r.title},null,8,["table","title"])):(f.openBlock(),f.createElementBlock("div",{key:1,class:"w-full bg-gray-50",style:{height:"calc(100vh - 120px)"},innerHTML:r.interface},null,8,Kq))}const Qq=Object.freeze(Object.defineProperty({__proto__:null,default:je(Xq,[["render",Jq]])},Symbol.toStringTag,{value:"Module"}));return o9});