mapbox-gl
Version:
A WebGL interactive maps library
1 lines • 902 kB
JavaScript
import{i as e,a as t,b as i,c as o,d as s,P as r,v as n,e as a,u as l,g as c,f as h,s as d,w as u,p as _,h as p,j as f,k as m,l as g,I as v,m as y,R as x,n as b,o as w,q as T,E,r as S,D as I,t as C,x as R,y as A,z as D,A as L,B as O,C as P,F as M,T as z,G as F,H as B,V as k,J as N,K as U,L as j,M as G,N as V,O as H,Q as q,S as Z,U as W,W as $,X,Y,Z as K,_ as Q,$ as J,a0 as ee,a1 as te,a2 as ie,a3 as oe,a4 as se,a5 as re,a6 as ne,a7 as ae,a8 as le,a9 as ce,aa as he,ab as de,ac as ue,ad as _e,ae as pe,af as fe,ag as me,ah as ge,ai as ve,aj as ye,ak as xe,al as be,am as we,an as Te,ao as Ee,ap as Se,aq as Ie,ar as Ce,as as Re,at as Ae,au as De,av as Le,aw as Oe,ax as Pe,ay as Me,az as ze,aA as Fe,aB as Be,aC as ke,aD as Ne,aE as Ue,aF as je,aG as Ge,aH as Ve,aI as He,aJ as qe,aK as Ze,aL as We,aM as $e,aN as Xe,aO as Ye,aP as Ke,aQ as Qe,aR as Je,aS as et,aT as tt,aU as it,aV as ot,aW as st,aX as rt,aY as nt,aZ as at,a_ as lt,a$ as ct,b0 as ht,b1 as dt,b2 as ut,b3 as _t,b4 as pt,b5 as ft,b6 as mt,b7 as gt,b8 as vt,b9 as yt,ba as xt,bb as bt,bc as wt,bd as Tt,be as Et,bf as St,bg as It,bh as Ct,bi as Rt,bj as At,bk as Dt,bl as Lt,bm as Ot,bn as Pt,bo as Mt,bp as zt,bq as Ft,br as Bt,bs as kt,bt as Nt,bu as Ut,bv as jt,bw as Gt,bx as Vt,by as Ht,bz as qt,bA as Zt,bB as Wt,bC as $t,bD as Xt,bE as Yt,bF as Kt,bG as Qt,bH as Jt,bI as ei,bJ as ti,bK as ii,bL as oi,bM as si,bN as ri,bO as ni,bP as ai,bQ as li,bR as ci,bS as hi,bT as di,bU as ui,bV as _i,bW as pi,bX as fi,bY as mi,bZ as gi,b_ as vi,b$ as yi,c0 as xi,c1 as bi,c2 as wi,c3 as Ti,c4 as Ei,c5 as Si,c6 as Ii,c7 as Ci,c8 as Ri,c9 as Ai,ca as Di,cb as Li,cc as Oi,cd as Pi,ce as Mi,cf as zi,cg as Fi,ch as Bi,ci as ki,cj as Ni,ck as Ui,cl as ji,cm as Gi,cn as Vi,co as Hi,cp as qi,cq as Zi,cr as Wi,cs as $i,ct as Xi,cu as Yi,cv as Ki,cw as Qi,cx as Ji,cy as eo,cz as to,cA as io,cB as oo,cC as so,cD as ro,cE as no,cF as ao,cG as lo,cH as co,cI as ho,cJ as uo,cK as _o,cL as po,cM as fo,cN as mo,cO as go,cP as vo,cQ as yo,cR as xo,cS as bo,cT as wo,cU as To,cV as Eo,cW as So,cX as Io,cY as Co,cZ as Ro,c_ as Ao,c$ as Do,d0 as Lo,d1 as Oo,d2 as Po,d3 as Mo,d4 as zo,d5 as Fo,d6 as Bo,d7 as ko,d8 as No,d9 as Uo,da as jo,db as Go,dc as Vo,dd as Ho,de as qo,df as Zo,dg as Wo,dh as $o,di as Xo,dj as Yo,dk as Ko,dl as Qo,dm as Jo,dn as es,dp as ts,dq as is,dr as os,ds as ss,dt as rs,du as ns,dv as as,dw as ls,dx as cs,dy as hs,dz as ds,dA as us,dB as _s,dC as ps,dD as fs,dE as ms,dF as gs,dG as vs,dH as ys,dI as xs,dJ as bs,dK as ws,dL as Ts,dM as Es,dN as Ss,dO as Is,dP as Cs,dQ as Rs,dR as As,dS as Ds,dT as Ls,dU as Os,dV as Ps,dW as Ms,dX as zs,dY as Fs,dZ as Bs,d_ as ks,d$ as Ns,e0 as Us,e1 as js,e2 as Gs,e3 as Vs,e4 as Hs,e5 as qs,e6 as Zs,e7 as Ws,e8 as $s,e9 as Xs,ea as Ys,eb as Ks,ec as Qs,ed as Js,ee as er,ef as tr,eg as ir,eh as or,ei as sr,ej as rr,ek as nr,el as ar,em as lr,en as cr,eo as hr,ep as dr,eq as ur,er as _r,es as pr,et as fr,eu as mr,ev as gr,ew as vr,ex as yr,ey as xr,ez as br,eA as wr,eB as Tr,eC as Er,eD as Sr,eE as Ir,eF as Cr,eG as Rr,eH as Ar,eI as Dr,eJ as Lr,eK as Or,eL as Pr,eM as Mr,eN as zr,eO as Fr,eP as Br,eQ as kr,eR as Nr,eS as Ur,eT as jr,eU as Gr,eV as Vr,eW as Hr,eX as qr,eY as Zr,eZ as Wr,e_ as $r,e$ as Xr,f0 as Yr,f1 as Kr,f2 as Qr,f3 as Jr,f4 as en,f5 as tn,f6 as on,f7 as sn,f8 as rn,f9 as nn,fa as an,fb as ln,fc as cn,fd as hn,fe as dn,ff as un,fg as _n,fh as pn,fi as fn}from"./shared.js";var mn="3.17.0";const gn={create:"create",load:"load",fullLoad:"fullLoad"},vn={mark(e){performance.mark(e)},measure(e,t,i){performance.measure(e,t,i)}};function yn(r){const n=r.name.split("?")[0];return t(n)&&n.includes("mapbox-gl.js")?"javascript":t(n)&&n.includes("mapbox-gl.css")?"css":i(n)?"fontRange":o(n)?"sprite":e(n)?"style":s(n)?"tilejson":"other"}var xn,bn={},wn=function(){if(xn)return bn;function e(e){return!t(e)}function t(t){return"undefined"==typeof window||"undefined"==typeof document?"not a browser":function(){if(!("Worker"in window&&"Blob"in window&&"URL"in window))return!1;var e,t,i=new Blob([""],{type:"text/javascript"}),o=URL.createObjectURL(i);try{t=new Worker(o),e=!0}catch(t){e=!1}return t&&t.terminate(),URL.revokeObjectURL(o),e}()?function(){var e=document.createElement("canvas");e.width=e.height=1;var t=e.getContext("2d");if(!t)return!1;var i=t.getImageData(0,0,1,1);return i&&i.width===e.width}()?(void 0===i[o=t&&t.failIfMajorPerformanceCaveat]&&(i[o]=function(t){var i,o=function(t){var i=document.createElement("canvas"),o=Object.create(e.webGLContextAttributes);return o.failIfMajorPerformanceCaveat=t,i.getContext("webgl2",o)}(t);if(!o)return!1;try{i=o.createShader(o.VERTEX_SHADER)}catch(e){return!1}return!(!i||o.isContextLost())&&(o.shaderSource(i,"void main() {}"),o.compileShader(i),!0===o.getShaderParameter(i,o.COMPILE_STATUS))}(o)),i[o]?document.documentMode?"insufficient ECMAScript 6 support":void 0:"insufficient WebGL2 support"):"insufficient Canvas/getImageData support":"insufficient worker support";var o}xn=1,bn.supported=e,bn.notSupportedReason=t;var i={};return e.webGLContextAttributes={antialias:!1,alpha:!0,stencil:!0,depth:!0},bn}();function Tn(e,t,i){const o=document.createElement(e);return null!=t&&(o.className=t),i&&i.appendChild(o),o}function En(e,t,i){const o=document.createElementNS("http://www.w3.org/2000/svg",e);for(const e of Object.keys(t))o.setAttributeNS(null,e,String(t[e]));return i&&i.appendChild(o),o}const Sn="undefined"!=typeof document?document.documentElement&&document.documentElement.style:null,In=Sn&&void 0!==Sn.userSelect?"userSelect":"WebkitUserSelect";let Cn;function Rn(){Sn&&In&&(Cn=Sn[In],Sn[In]="none")}function An(){Sn&&In&&(Sn[In]=Cn)}function Dn(e){e.preventDefault(),e.stopPropagation(),window.removeEventListener("click",Dn,!0)}function Ln(){window.addEventListener("click",Dn,!0),window.setTimeout((()=>{window.removeEventListener("click",Dn,!0)}),0)}function On(e,t){const i=e.getBoundingClientRect();return zn(e,i,t)}function Pn(e,t){const i=e.getBoundingClientRect(),o=[];for(let s=0;s<t.length;s++)o.push(zn(e,i,t[s]));return o}function Mn(e){return/firefox/i.test(navigator.userAgent)&&/macintosh/i.test(navigator.userAgent)&&2===e.button&&e.ctrlKey?0:e.button}function zn(e,t,i){const o=e.offsetWidth===t.width?1:e.offsetWidth/t.width;return new r((i.clientX-t.left)*o,(i.clientY-t.top)*o)}const Fn="01",Bn="NO_ACCESS_TOKEN";class kn{constructor(e,t,i){this._transformRequestFn=e,this._customAccessToken=t,this._silenceAuthErrors=!!i,this._createSkuToken()}_createSkuToken(){const e=function(){let e="";for(let t=0;t<10;t++)e+="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"[Math.floor(62*Math.random())];return{token:["1",Fn,e].join(""),tokenExpiresAt:Date.now()+432e5}}();this._skuToken=e.token,this._skuTokenExpiresAt=e.tokenExpiresAt}_isSkuTokenExpired(){return Date.now()>this._skuTokenExpiresAt}transformRequest(e,t){return this._transformRequestFn&&this._transformRequestFn(e,t)||{url:e}}normalizeStyleURL(e,t){if(!p(e))return e;const i=Un(e);return i.params.push(`sdk=js-${mn}`),i.path=`/styles/v1${i.path}`,this._makeAPIURL(i,this._customAccessToken||t)}normalizeGlyphsURL(e,t){if(!p(e))return e;const i=Un(e);return i.path=`/fonts/v1${i.path}`,this._makeAPIURL(i,this._customAccessToken||t)}normalizeModelURL(e,t){if(!p(e))return e;const i=Un(e);return i.path=`/models/v1${i.path}`,this._makeAPIURL(i,this._customAccessToken||t)}normalizeSourceURL(e,t,i,o){if(!p(e))return e;const s=Un(e);return s.path=`/v4/${s.authority}.json`,s.params.push("secure"),i&&s.params.push(`language=${i}`),o&&s.params.push(`worldview=${o}`),this._makeAPIURL(s,this._customAccessToken||t)}normalizeIconsetURL(e,t){const i=Un(e);return p(e)?(i.path=`/styles/v1${i.path}/iconset.pbf`,this._makeAPIURL(i,this._customAccessToken||t)):jn(i)}normalizeSpriteURL(e,t,i,o){const s=Un(e);return p(e)?(s.path=`/styles/v1${s.path}/sprite${t}${i}`,this._makeAPIURL(s,this._customAccessToken||o)):(s.path+=`${t}${i}`,jn(s))}normalizeTileURL(e,t,i){if(this._isSkuTokenExpired()&&this._createSkuToken(),e&&!p(e))return e;const o=Un(e);o.path=o.path.replace(/(\.(png|jpg)\d*)(?=$)/,`${t||i&&"raster"!==o.authority&&512===i?"@2x":""}${m.supported?".webp":"$1"}`),"raster"===o.authority?o.path=`/${a.RASTER_URL_PREFIX}${o.path}`:"rasterarrays"===o.authority?o.path=`/${a.RASTERARRAYS_URL_PREFIX}${o.path}`:"3dtiles"===o.authority?o.path=`/${a.TILES3D_URL_PREFIX}${o.path}`:(o.path=o.path.replace(/^.+\/v4\//,"/"),o.path=`/${a.TILE_URL_VERSION}${o.path}`);const s=this._customAccessToken||function(e){for(const t of e){const e=t.match(/^access_token=(.*)$/);if(e)return e[1]}return null}(o.params)||a.ACCESS_TOKEN;return a.REQUIRE_ACCESS_TOKEN&&s&&this._skuToken&&o.params.push(`sku=${this._skuToken}`),this._makeAPIURL(o,s)}canonicalizeTileURL(e,t){const i=Un(e);if(!i.path.match(/^(\/v4\/|\/(raster|rasterarrays)\/v1\/)/)||!i.path.match(/\.[\w]+$/))return e;let o="mapbox://";i.path.match(/^\/raster\/v1\//)?o+=`raster/${i.path.replace(`/${a.RASTER_URL_PREFIX}/`,"")}`:i.path.match(/^\/rasterarrays\/v1\//)?o+=`rasterarrays/${i.path.replace(`/${a.RASTERARRAYS_URL_PREFIX}/`,"")}`:o+=`tiles/${i.path.replace(`/${a.TILE_URL_VERSION}/`,"")}`;let s=i.params;return t&&(s=s.filter((e=>!e.match(/^access_token=/)))),s.length&&(o+=`?${s.join("&")}`),o}canonicalizeTileset(e,t){const i=!!t&&p(t),o=[];for(const t of e.tiles||[])f(t)?o.push(this.canonicalizeTileURL(t,i)):o.push(t);return o}_makeAPIURL(e,t){const i="See https://docs.mapbox.com/api/overview/#access-tokens-and-token-scopes",o=Un(a.API_URL);if(e.protocol=o.protocol,e.authority=o.authority,"http"===e.protocol){const t=e.params.indexOf("secure");t>=0&&e.params.splice(t,1)}if("/"!==o.path&&(e.path=`${o.path}${e.path}`),!a.REQUIRE_ACCESS_TOKEN)return jn(e);if(t=t||a.ACCESS_TOKEN,!this._silenceAuthErrors){if(!t)throw new Error(`An API access token is required to use Mapbox GL. ${i}`);if("s"===t[0])throw new Error(`Use a public access token (pk.*) with Mapbox GL, not a secret access token (sk.*). ${i}`)}return e.params=e.params.filter((e=>-1===e.indexOf("access_token"))),e.params.push(`access_token=${t||""}`),jn(e)}}const Nn=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function Un(e){const t=e.match(Nn);if(!t)throw new Error("Unable to parse URL object");return{protocol:t[1],authority:t[2],path:t[3]||"/",params:t[4]?t[4].split("&"):[]}}function jn(e){const t=e.params.length?`?${e.params.join("&")}`:"";return`${e.protocol}://${e.authority}${e.path}${t}`}const Gn="mapbox.eventData";function Vn(e){if(!e)return null;const t=e.split(".");if(!t||3!==t.length)return null;try{return JSON.parse(g(t[1]))}catch(e){return null}}class Hn{constructor(e){this.type=e,this.anonId=null,this.anonIdTimestamp=null,this.eventData={},this.queue=[],this.pendingRequest=null}getStorageKey(e){const t=Vn(a.ACCESS_TOKEN);let i="";return i=t&&t.u?h(t.u):a.ACCESS_TOKEN||"",e?`${Gn}.${e}:${i}`:`${Gn}:${i}`}fetchEventData(){const e=d("localStorage"),t=this.getStorageKey(),i=this.getStorageKey("uuid"),o=this.getStorageKey("uuidTimestamp");if(e)try{const e=localStorage.getItem(t);e&&(this.eventData=JSON.parse(e));const s=localStorage.getItem(i);s&&(this.anonId=s);const r=localStorage.getItem(o);r&&(this.anonIdTimestamp=Number(r));const n=Date.now()-864e5;(!this.anonIdTimestamp||this.anonIdTimestamp<n)&&this.refreshUUID()}catch(e){u("Unable to read from LocalStorage")}}refreshUUID(){this.anonId=l(),this.anonIdTimestamp=Date.now()}saveEventData(){const e=d("localStorage"),t=this.getStorageKey(),i=this.getStorageKey("uuid"),o=this.getStorageKey("uuidTimestamp"),s=this.anonId,r=this.anonIdTimestamp;if(e&&s)try{localStorage.setItem(i,s),Object.keys(this.eventData).length>=1&&localStorage.setItem(t,JSON.stringify(this.eventData)),r&&localStorage.setItem(o,r.toString())}catch(e){u("Unable to write to LocalStorage")}}processRequests(e){}postEvent(e,t,i,o){if(!a.EVENTS_URL)return;const s=Un(a.EVENTS_URL);s.params.push(`access_token=${o||a.ACCESS_TOKEN||""}`);const r={event:this.type,created:new Date(e).toISOString()},n=t?Object.assign(r,t):r,l={url:jn(s),headers:{"Content-Type":"text/plain"},body:JSON.stringify([n])};this.pendingRequest=_(l,(e=>{this.pendingRequest=null,i(e),this.saveEventData(),this.processRequests(o)}))}queueRequest(e,t){this.queue.push(e),this.processRequests(t)}}class qn extends Hn{constructor(e){super("metrics"),e&&(this.data=e)}postMetricsEvent(e){if(!a.EVENTS_URL||!e&&!a.ACCESS_TOKEN)return;this.anonId||this.fetchEventData(),n(this.anonId)||this.refreshUUID();const t=Object.assign({},this.data,{sessionId:this.anonId});this.queueRequest({timestamp:Date.now(),payload:t},e)}processRequests(e){if(this.pendingRequest||0===this.queue.length)return;const{timestamp:t,payload:i}=this.queue.shift();this.postEvent(t,i,(()=>{}),e)}}const Zn=new class extends Hn{constructor(e){super("appUserTurnstile"),this._customAccessToken=e}postTurnstileEvent(e,t){a.EVENTS_URL&&a.ACCESS_TOKEN&&Array.isArray(e)&&e.some((e=>p(e)||f(e)))&&this.queueRequest(Date.now(),t)}processRequests(e){if(this.pendingRequest||0===this.queue.length)return;this.anonId&&this.anonIdTimestamp&&this.eventData.lastSuccess&&this.eventData.tokenU||this.fetchEventData();const t=Vn(a.ACCESS_TOKEN),i=t?t.u:a.ACCESS_TOKEN;let o=i!==this.eventData.tokenU;n(this.anonId)||(this.refreshUUID(),o=!0);const s=this.queue.shift();if(this.eventData.lastSuccess){const e=new Date(this.eventData.lastSuccess),t=new Date(s),i=(s-this.eventData.lastSuccess)/864e5;o=o||i>=1||i<-1||e.getDate()!==t.getDate()}else o=!0;o?this.postEvent(s,{sdkIdentifier:"mapbox-gl-js",sdkVersion:mn,skuId:Fn,"enabled.telemetry":!1,userId:this.anonId},(e=>{e||(this.eventData.lastSuccess=s,this.eventData.tokenU=i)}),e):this.processRequests()}},Wn=Zn.postTurnstileEvent.bind(Zn),$n=new class extends Hn{constructor(){super("map.load"),this.success={},this.skuToken=""}postMapLoadEvent(e,t,i,o){this.skuToken=t,this.errorCb=o,a.EVENTS_URL&&(i||a.ACCESS_TOKEN?this.queueRequest({id:e,timestamp:Date.now()},i):this.errorCb(new Error(Bn)))}processRequests(e){if(this.pendingRequest||0===this.queue.length)return;const{id:t,timestamp:i}=this.queue.shift();t&&this.success[t]||(this.anonId&&this.anonIdTimestamp||this.fetchEventData(),n(this.anonId)||this.refreshUUID(),this.postEvent(i,{sdkIdentifier:"mapbox-gl-js",sdkVersion:mn,skuId:Fn,skuToken:this.skuToken,userId:this.anonId},(e=>{e?this.errorCb(e):t&&(this.success[t]=!0)}),e))}remove(){this.errorCb=null}},Xn=$n.postMapLoadEvent.bind($n),Yn=new class extends Hn{constructor(){super("style.load"),this.eventIdPerMapInstanceMap=new Map,this.mapInstanceIdMap=new WeakMap}getMapInstanceId(e){let t=this.mapInstanceIdMap.get(e);return t||(t=l(),this.mapInstanceIdMap.set(e,t)),t}getEventId(e){const t=this.eventIdPerMapInstanceMap.get(e)||0;return this.eventIdPerMapInstanceMap.set(e,t+1),t}postStyleLoadEvent(e,t){const{map:i,style:o,importedStyles:s}=t;if(!a.EVENTS_URL||!e&&!a.ACCESS_TOKEN)return;const r=this.getMapInstanceId(i),n={mapInstanceId:r,eventId:this.getEventId(r),style:o};s.length&&(n.importedStyles=s),this.queueRequest({timestamp:Date.now(),payload:n},e)}processRequests(e){if(this.pendingRequest||0===this.queue.length)return;const{timestamp:t,payload:i}=this.queue.shift();this.postEvent(t,i,(()=>{}),e)}},Kn=Yn.postStyleLoadEvent.bind(Yn),Qn=new qn({attributes:[{name:"maps/js/layer-animations/style-with-appearances"}]}),Jn=Qn.postMetricsEvent.bind(Qn),ea=new qn({attributes:[{name:"maps/js/layer-animations/runtime-appearances"}]}),ta=ea.postMetricsEvent.bind(ea),ia=new class extends Hn{constructor(){super("gljs.performance")}postPerformanceEvent(e,t){a.EVENTS_URL&&(e||a.ACCESS_TOKEN)&&this.queueRequest({timestamp:Date.now(),performanceData:t},e)}processRequests(t){if(this.pendingRequest||0===this.queue.length)return;const{timestamp:i,performanceData:o}=this.queue.shift(),s=function(t){const i=performance.getEntriesByType("resource"),o=performance.getEntriesByType("mark"),s=function(e){const t={};if(e)for(const i in e)if("other"!==i)for(const o of e[i]){const e=`${i}ResolveRangeMin`,s=`${i}ResolveRangeMax`,r=`${i}RequestCount`,n=`${i}RequestCachedCount`;t[e]=Math.min(t[e]||1/0,o.startTime),t[s]=Math.max(t[s]||-1/0,o.responseEnd);const a=e=>{void 0===t[e]&&(t[e]=0),++t[e]};void 0!==o.transferSize&&0===o.transferSize&&a(n),a(r)}return t}(function(e,t){const i={};if(e)for(const o of e){const e=t(o);void 0===i[e]&&(i[e]=[]),i[e].push(o)}return i}(i,yn)),r=window.devicePixelRatio,n=navigator.connection||navigator.mozConnection||navigator.webkitConnection,a=n?n.effectiveType:void 0,l={counters:[],metadata:[],attributes:[]},c=(e,t,i)=>{null!=i&&e.push({name:t,value:i.toString()})};for(const e in s)c(l.counters,e,s[e]);if(t.interactionRange[0]!==1/0&&t.interactionRange[1]!==-1/0&&(c(l.counters,"interactionRangeMin",t.interactionRange[0]),c(l.counters,"interactionRangeMax",t.interactionRange[1])),o)for(const e of Object.values(gn)){const t=o.find((t=>t.name===e));t&&c(l.counters,e,t.startTime)}return c(l.counters,"visibilityHidden",t.visibilityHidden),c(l.attributes,"style",function(t){if(t)for(const i of t){const t=i.name.split("?")[0];if(e(t)){const e=t.split("/").slice(-2);if(2===e.length)return`mapbox://styles/${e[0]}/${e[1]}`}}}(i)),c(l.attributes,"terrainEnabled",t.terrainEnabled?"true":"false"),c(l.attributes,"fogEnabled",t.fogEnabled?"true":"false"),c(l.attributes,"projection",t.projection),c(l.attributes,"zoom",t.zoom),c(l.metadata,"devicePixelRatio",r),c(l.metadata,"connectionEffectiveType",a),c(l.metadata,"navigatorUserAgent",navigator.userAgent),c(l.metadata,"screenWidth",window.screen.width),c(l.metadata,"screenHeight",window.screen.height),c(l.metadata,"windowWidth",window.innerWidth),c(l.metadata,"windowHeight",window.innerHeight),c(l.metadata,"mapWidth",t.width/r),c(l.metadata,"mapHeight",t.height/r),c(l.metadata,"webglRenderer",t.renderer),c(l.metadata,"webglVendor",t.vendor),c(l.metadata,"sdkVersion",mn),c(l.metadata,"sdkIdentifier","mapbox-gl-js"),l}(o);for(const e of s.metadata);for(const e of s.counters);for(const e of s.attributes);this.postEvent(i,s,(()=>{}),t)}},oa=ia.postPerformanceEvent.bind(ia),sa=new class extends Hn{constructor(){super("map.auth"),this.success={},this.skuToken=""}getSession(e,t,i,o){if(!a.API_URL||!a.SESSION_PATH)return;const s=Un(a.API_URL+a.SESSION_PATH);s.params.push(`sku=${t||""}`),s.params.push(`access_token=${o||a.ACCESS_TOKEN||""}`);const r={url:jn(s),headers:{"Content-Type":"text/plain"}};this.pendingRequest=c(r,(e=>{this.pendingRequest=null,i(e),this.saveEventData(),this.processRequests(o)}))}getSessionAPI(e,t,i,o){this.skuToken=t,this.errorCb=o,a.SESSION_PATH&&a.API_URL&&(i||a.ACCESS_TOKEN?this.queueRequest({id:e,timestamp:Date.now()},i):this.errorCb(new Error(Bn)))}processRequests(e){if(this.pendingRequest||0===this.queue.length)return;const{id:t,timestamp:i}=this.queue.shift();t&&this.success[t]||this.getSession(i,this.skuToken,(e=>{e?this.errorCb(e):t&&(this.success[t]=!0)}),e)}remove(){this.errorCb=null}},ra=sa.getSessionAPI.bind(sa),na=new Set;function aa(e,t){t?na.add(e):na.delete(e)}class la{constructor(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSourceCaches={},this._updatedPaintProps=new Set,this._updatedImages={}}isDirty(){return this._changed}setDirty(){this._changed=!0}getUpdatedSourceCaches(){return this._updatedSourceCaches}updateSourceCache(e,t){this._updatedSourceCaches[e]=t,this.setDirty()}discardSourceCacheUpdate(e){delete this._updatedSourceCaches[e]}updateLayer(e){const t=e.scope;this._updatedLayers[t]=this._updatedLayers[t]||new Set,this._updatedLayers[t].add(e.id),this.setDirty()}removeLayer(e){const t=e.scope;this._removedLayers[t]=this._removedLayers[t]||{},this._updatedLayers[t]=this._updatedLayers[t]||new Set,this._removedLayers[t][e.id]=e,this._updatedLayers[t].delete(e.id),this._updatedPaintProps.delete(e.fqid),this.setDirty()}getRemovedLayer(e){return this._removedLayers[e.scope]?this._removedLayers[e.scope][e.id]:null}discardLayerRemoval(e){this._removedLayers[e.scope]&&delete this._removedLayers[e.scope][e.id]}getLayerUpdatesByScope(){const e={};for(const t in this._updatedLayers)e[t]=e[t]||{},e[t].updatedIds=Array.from(this._updatedLayers[t].values());for(const t in this._removedLayers)e[t]=e[t]||{},e[t].removedIds=Object.keys(this._removedLayers[t]);return e}getUpdatedPaintProperties(){return this._updatedPaintProps}updatePaintProperties(e){this._updatedPaintProps.add(e.fqid),this.setDirty()}getUpdatedImages(e){return this._updatedImages[e]?Array.from(this._updatedImages[e].values()):[]}updateImage(e,t){this._updatedImages[t]=this._updatedImages[t]||new Set,this._updatedImages[t].add(v.toString(e)),this.setDirty()}resetUpdatedImages(e){this._updatedImages[e]&&this._updatedImages[e].clear()}reset(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSourceCaches={},this._updatedPaintProps.clear(),this._updatedImages={}}}function ca(e){const{userImage:t}=e;return!!(t&&t.render&&t.render())&&(e.data.replace(new Uint8Array(t.data.buffer)),!0)}class ha extends E{constructor(e){super(),this.imageProviders=new Map,this.images=new Map,this.updatedImages=new Map,this.callbackDispatchedThisFrame=new Map,this.loaded=new Map,this.requestors=[],this.patterns=new Map,this.patternsInFlight=new Set,this.atlasImage=new Map,this.atlasTexture=new Map,this.dirty=!0,this.spriteFormat=e,"raster"!==e&&S()&&(this.imageRasterizerDispatcher=new I(C(),this,"Image Rasterizer Worker",1))}addScope(e){this.loaded.set(e,!1),this.imageProviders.set(e,new Map),this.images.set(e,new Map),this.updatedImages.set(e,new Set),this.callbackDispatchedThisFrame.set(e,new Set),this.patterns.set(e,new Map),this.atlasImage.set(e,new T({width:1,height:1}))}removeScope(e){this.loaded.delete(e),this.imageProviders.delete(e),this.images.delete(e),this.updatedImages.delete(e),this.callbackDispatchedThisFrame.delete(e),this.patterns.delete(e),this.atlasImage.delete(e);const t=this.atlasTexture.get(e);t&&(t.destroy(),this.atlasTexture.delete(e))}addImageProvider(e,t){this.imageProviders.has(t)||this.imageProviders.set(t,new Map),this.imageProviders.get(t).set(e.id,e)}removeImageProvider(e,t){this.imageProviders.has(t)&&this.imageProviders.get(t).delete(e)}getPendingImageProviders(){const e=[];for(const t of this.imageProviders.values())for(const i of t.values())i.hasPendingRequests()&&e.push(i);return e}get imageRasterizer(){return this._imageRasterizer||(this._imageRasterizer=new R),this._imageRasterizer}isLoaded(){for(const e of this.loaded.keys())if(!this.loaded.get(e))return!1;return!0}setLoaded(e,t){if(this.loaded.get(t)!==e&&(this.loaded.set(t,e),e)){for(const{ids:e,callback:i}of this.requestors)this._notify(e,t,i);this.requestors=[]}}hasImage(e,t){return!!this.getImage(e,t)}getImage(e,t){return this.images.get(t).get(e.toString())}addImage(e,t,i){this._validate(e,i)&&this.images.get(t).set(e.toString(),i)}_validate(e,t){let i=!0;return this._validateStretch(t.stretchX,t.data&&t.data.width)||(this.fire(new A(new Error(`Image "${e.name}" has invalid "stretchX" value`))),i=!1),this._validateStretch(t.stretchY,t.data&&t.data.height)||(this.fire(new A(new Error(`Image "${e.name}" has invalid "stretchY" value`))),i=!1),this._validateContent(t.content,t)||(this.fire(new A(new Error(`Image "${e.name}" has invalid "content" value`))),i=!1),i}_validateStretch(e,t){if(!e)return!0;let i=0;for(const o of e){if(o[0]<i||o[1]<o[0]||t<o[1])return!1;i=o[1]}return!0}_validateContent(e,t){if(!e)return!0;if(4!==e.length)return!1;if(!t.usvg){if(e[0]<0||t.data.width<e[0])return!1;if(e[1]<0||t.data.height<e[1])return!1;if(e[2]<0||t.data.width<e[2])return!1;if(e[3]<0||t.data.height<e[3])return!1}return!(e[2]<e[0]||e[3]<e[1])}updateImage(e,t,i){const o=this.images.get(t).get(e.toString());i.version=o.version+1,this.images.get(t).set(e.toString(),i),this.updatedImages.get(t).add(e),this.removeFromImageRasterizerCache(e,t)}clearUpdatedImages(e){this.updatedImages.get(e).clear()}removeFromImageRasterizerCache(e,t){"raster"!==this.spriteFormat&&(S()?this.imageRasterizerDispatcher.getActor().send("removeRasterizedImages",{imageIds:[e],scope:t}):this.imageRasterizer.removeImagesFromCacheByIds([e],t))}removeImage(e,t){const i=this.images.get(t),o=i.get(e.toString());i.delete(e.toString()),this.patterns.get(t).delete(e.toString()),this.removeFromImageRasterizerCache(e,t),o.userImage&&o.userImage.onRemove&&o.userImage.onRemove()}listImages(e){return Array.from(this.images.get(e).keys()).map((e=>v.from(e)))}getImages(e,t,i){const o=[],s=[],r=this.imageProviders.get(t);for(const i of e){if(!i.iconsetId){o.push(i);continue}const e=r.get(i.iconsetId);e&&(this.getImage(i,t)?s.push(i):e.addPendingRequest(i))}if(0===o.length)return void this._notify(s,t,i);let n=!0;const a=!!this.loaded.get(t),l=this.images.get(t);if(!a)for(const e of o)l.has(e.toString())||(n=!1);a||n?this._notify(o,t,i):this.requestors.push({ids:o,scope:t,callback:i})}rasterizeImages(e,t){const i=new Map,{tasks:o,scope:s}=e;for(const[e,t]of o.entries()){const o=this.getImage(t.id,s);o&&i.set(e,{image:o,imageVariant:t})}this._rasterizeImages(s,i,t)}_rasterizeImages(e,t,i){if(S())this.imageRasterizerDispatcher.getActor().send("rasterizeImagesWorker",{tasks:t,scope:e},i);else{const o=new Map;for(const[i,{image:s,imageVariant:r}]of t.entries())o.set(i,this.imageRasterizer.rasterize(r,s,e,0));i(void 0,o)}}getUpdatedImages(e){return this.updatedImages.get(e)||new Set}_notify(e,t,i){const o=this.images.get(t),s=new Map;for(const t of e){if(!o.get(t.toString())){if(t.iconsetId)continue;this.fire(new D("styleimagemissing",{id:t.name}))}const e=o.get(t.toString());if(!e){u(`Image "${t.name}" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.`);continue}const i={data:e.usvg?null:e.data.clone(),pixelRatio:e.pixelRatio,sdf:e.sdf,usvg:e.usvg,version:e.version,stretchX:e.stretchX,stretchY:e.stretchY,content:e.content,hasRenderCallback:Boolean(e.userImage&&e.userImage.render)};e.usvg&&Object.assign(i,{width:e.icon.usvg_tree.width,height:e.icon.usvg_tree.height}),s.set(v.toString(t),i)}i(null,s)}getPixelSize(e){const{width:t,height:i}=this.atlasImage.get(e);return{width:t,height:i}}getPattern(e,t,i){const o=e.toString(),s=this.patterns.get(t),r=s.get(o),n=this.getImage(e,t);if(!n)return null;if(r){if(r.position.version===n.version)return r.position;r.position.version=n.version}else{if(n.usvg&&!n.data){const s=this.getPatternInFlightId(o,t);if(this.patternsInFlight.has(s))return null;this.patternsInFlight.add(s);const r=new L(e).scaleSelf(w.devicePixelRatio),a=new Map([[r.toString(),{image:n,imageVariant:r}]]);return this._rasterizeImages(t,a,((e,o)=>this.storePatternImage(r,t,n,i,o))),null}this.storePattern(e,t,n)}return this._updatePatternAtlas(t,i),s.get(o).position}getPatternInFlightId(e,t){return O(e,t)}hasPatternsInFlight(){return 0!==this.patternsInFlight.size}storePatternImage(e,t,i,o,s){const r=e.toString(),n=s?s.get(r):void 0;n&&(i.data=n,this.storePattern(e.id,t,i),this._updatePatternAtlas(t,o),this.patternsInFlight.delete(this.getPatternInFlightId(e.id.toString(),t)))}storePattern(e,t,i){const o={w:i.data.width+2*M,h:i.data.height+2*M,x:0,y:0},s=new P(o,i,M);this.patterns.get(t).set(e.toString(),{bin:o,position:s})}destroyAtlasTextures(){for(const e of this.atlasTexture.values())e&&e.destroy();this.atlasTexture.clear()}bind(e,t){const i=e.gl;let o=this.atlasTexture.get(t);o?this.dirty&&(o.update(this.atlasImage.get(t)),this.dirty=!1):(o=new z(e,this.atlasImage.get(t),i.RGBA8),this.atlasTexture.set(t,o)),o.bind(i.LINEAR,i.CLAMP_TO_EDGE)}_updatePatternAtlas(e,t){const i=this.patterns.get(e),o=Array.from(i.values()).map((({bin:e})=>e)),{w:s,h:r}=F(o),n=this.atlasImage.get(e);n.resize({width:s||1,height:r||1});const a=this.images.get(e);for(const[e,{bin:o,position:s}]of i.entries()){let i=s.padding;const r=o.x+i,l=o.y+i,c=a.get(e).data,h=c.width,d=c.height;i=i>1?i-1:i,T.copy(c,n,{x:0,y:0},{x:r,y:l},{width:h,height:d},t),T.copy(c,n,{x:0,y:d-i},{x:r,y:l-i},{width:h,height:i},t),T.copy(c,n,{x:0,y:0},{x:r,y:l+d},{width:h,height:i},t),T.copy(c,n,{x:h-i,y:0},{x:r-i,y:l},{width:i,height:d},t),T.copy(c,n,{x:0,y:0},{x:r+h,y:l},{width:i,height:d},t),T.copy(c,n,{x:h-i,y:d-i},{x:r-i,y:l-i},{width:i,height:i},t),T.copy(c,n,{x:0,y:d-i},{x:r+h,y:l-i},{width:i,height:i},t),T.copy(c,n,{x:0,y:0},{x:r+h,y:l+d},{width:i,height:i},t),T.copy(c,n,{x:h-i,y:0},{x:r-i,y:l+d},{width:i,height:i},t)}this.dirty=!0}beginFrame(){for(const e of this.images.keys())this.callbackDispatchedThisFrame.set(e,new Set)}dispatchRenderCallbacks(e,t){const i=this.images.get(t);for(const o of e){if(this.callbackDispatchedThisFrame.get(t).has(o.toString()))continue;this.callbackDispatchedThisFrame.get(t).add(o.toString());const e=i.get(o.toString());ca(e)&&this.updateImage(o,t,e)}}destroy(){this.imageRasterizerDispatcher&&this.imageRasterizerDispatcher.remove()}}function da(e){const t=e.value,i=e.valueSpec,o=e.style,s=e.styleSpec,r=e.key,n=e.arrayElementValidator||Pa;if(!Array.isArray(t))return[new k(r,t,`array expected, ${U(t)} found`)];if(i.length&&t.length!==i.length)return[new k(r,t,`array length ${i.length} expected, length ${t.length} found`)];if(i["min-length"]&&t.length<i["min-length"])return[new k(r,t,`array length at least ${i["min-length"]} expected, length ${t.length} found`)];let a={type:i.value,values:i.values,minimum:i.minimum,maximum:i.maximum,function:void 0};s.$version<7&&(a.function=i.function),B(i.value)&&(a=i.value);let l=[];for(let e=0;e<t.length;e++)l=l.concat(n({array:t,arrayIndex:e,value:t[e],valueSpec:a,style:o,styleSpec:s,key:`${r}[${e}]`},!0));return l}function ua(e){const t=e.key,i=e.value,o=e.valueSpec;if(!j(i))return[new k(t,i,`number expected, ${U(i)} found`)];if(i!=i)return[new k(t,i,"number expected, NaN found")];if("minimum"in o){let s=o.minimum;if(Array.isArray(o.minimum)&&(s=o.minimum[e.arrayIndex]),i<s)return[new k(t,i,`${i} is less than the minimum value ${s}`)]}if("maximum"in o){let s=o.maximum;if(Array.isArray(o.maximum)&&(s=o.maximum[e.arrayIndex]),i>s)return[new k(t,i,`${i} is greater than the maximum value ${s}`)]}return[]}function _a(e){const t=e.key,i=e.value;if(!B(i))return[new k(t,i,`object expected, ${U(i)} found`)];const o=e.valueSpec,s=N(i.type);let r,n,a,l={};const c="categorical"!==s&&void 0===i.property,h=!c,d=function(e){const t=e.stops;return Array.isArray(t)&&Array.isArray(t[0])&&B(t[0][0])}(i),u=Ma({key:e.key,value:e.value,valueSpec:e.styleSpec.function,style:e.style,styleSpec:e.styleSpec,objectElementValidators:{stops:function(e){if("identity"===s)return[new k(e.key,e.value,'identity function may not have a "stops" property')];let t=[];const i=e.value;return t=t.concat(da({key:e.key,value:i,valueSpec:e.valueSpec,style:e.style,styleSpec:e.styleSpec,arrayElementValidator:_})),Array.isArray(i)&&0===i.length&&t.push(new k(e.key,i,"array must have at least one stop")),t},default:function(e){return Pa({key:e.key,value:e.value,valueSpec:o,style:e.style,styleSpec:e.styleSpec})}}});return"identity"===s&&c&&u.push(new k(e.key,e.value,'missing required property "property"')),"identity"===s||i.stops||u.push(new k(e.key,e.value,'missing required property "stops"')),"exponential"===s&&o.expression&&!G(o)&&u.push(new k(e.key,e.value,"exponential functions not supported")),e.styleSpec.$version>=8&&(h&&!V(o)?u.push(new k(e.key,e.value,"property functions not supported")):c&&!H(o)&&u.push(new k(e.key,e.value,"zoom functions not supported"))),"categorical"!==s&&!d||void 0!==i.property||u.push(new k(e.key,e.value,'"property" property is required')),u;function _(e){let t=[];const i=e.value,s=e.key;if(!Array.isArray(i))return[new k(s,i,`array expected, ${U(i)} found`)];if(2!==i.length)return[new k(s,i,`array length 2 expected, length ${i.length} found`)];if(d){if(!B(i[0]))return[new k(s,i,`object expected, ${U(i[0])} found`)];const o=i[0];if(void 0===o.zoom)return[new k(s,i,"object stop key must have zoom")];if(void 0===o.value)return[new k(s,i,"object stop key must have value")];const r=N(o.zoom);if("number"!=typeof r)return[new k(s,o.zoom,"stop zoom values must be numbers")];if(a&&a>r)return[new k(s,o.zoom,"stop zoom values must appear in ascending order")];r!==a&&(a=r,n=void 0,l={}),t=t.concat(Ma({key:`${s}[0]`,value:i[0],valueSpec:{zoom:{}},style:e.style,styleSpec:e.styleSpec,objectElementValidators:{zoom:ua,value:p}}))}else t=t.concat(p({key:`${s}[0]`,value:i[0]},i));return q(Z(i[1]))?t.concat([new k(`${s}[1]`,i[1],"expressions are not allowed in function stops.")]):t.concat(Pa({key:`${s}[1]`,value:i[1],valueSpec:o,style:e.style,styleSpec:e.styleSpec}))}function p(e,t){const i=U(e.value),a=N(e.value),c=null!==e.value?e.value:t;if(r){if(i!==r)return[new k(e.key,c,`${i} stop domain type must match previous stop domain type ${r}`)]}else r=i;if("number"!==i&&"string"!==i&&"boolean"!==i&&"number"!=typeof a&&"string"!=typeof a&&"boolean"!=typeof a)return[new k(e.key,c,"stop domain value must be a number, string, or boolean")];if("number"!==i&&"categorical"!==s){let t=`number expected, ${i} found`;return V(o)&&void 0===s&&(t+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new k(e.key,c,t)]}return"categorical"!==s||"number"!==i||"number"==typeof a&&isFinite(a)&&Math.floor(a)===a?"categorical"!==s&&"number"===i&&"number"==typeof a&&"number"==typeof n&&void 0!==n&&a<n?[new k(e.key,c,"stop domain values must appear in ascending order")]:(n=a,"categorical"===s&&a in l?[new k(e.key,c,"stop domain values must be unique")]:(l[a]=!0,[])):[new k(e.key,c,`integer expected, found ${String(a)}`)]}}function pa(e){const t=("property"===e.expressionContext?$:W)(Z(e.value),e.valueSpec);if("error"===t.result)return t.value.map((t=>new k(`${e.key}${t.key}`,e.value,t.message)));const i=t.value.expression||t.value._styleExpression.expression;if("property"===e.expressionContext&&"text-font"===e.propertyKey&&!i.outputDefined())return[new k(e.key,e.value,`Invalid data expression for "${e.propertyKey}". Output values must be contained as literals within the expression.`)];if("property"===e.expressionContext&&"layout"===e.propertyType&&!K(i))return[new k(e.key,e.value,'"feature-state" data expressions are not supported with layout properties.')];if("filter"===e.expressionContext)return fa(i,e);if("appearance"===e.expressionContext)return ma(i,e);if(e.expressionContext&&0===e.expressionContext.indexOf("cluster")){if(!X(i,["zoom","feature-state"]))return[new k(e.key,e.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if("cluster-initial"===e.expressionContext&&!Y(i))return[new k(e.key,e.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function fa(e,t){const i=new Set(["zoom","feature-state","pitch","distance-from-center"]);if(t.valueSpec&&t.valueSpec.expression)for(const e of t.valueSpec.expression.parameters)i.delete(e);if(0===i.size)return[];const o=[];return e instanceof Q&&i.has(e.name)?[new k(t.key,t.value,`["${e.name}"] expression is not supported in a filter for a ${t.object.type} layer with id: ${t.object.id}`)]:(e.eachChild((e=>{o.push(...fa(e,t))})),o)}function ma(e,t){const i=new Set;if(t.valueSpec&&t.valueSpec.expression)for(const e of t.valueSpec.expression.parameters)i.add(e);if(0===i.size)return[];const o=[];return e instanceof Q&&!i.has(e.name)?[new k(t.key,t.value,`["${e.name}"] is not an allowed parameter`)]:(e.eachChild((e=>{o.push(...ma(e,t))})),o)}function ga(e){const t=e.key,i=e.value,o=e.valueSpec,s=[];return Array.isArray(o.values)?-1===o.values.indexOf(N(i))&&s.push(new k(t,i,`expected one of [${o.values.join(", ")}], ${JSON.stringify(i)} found`)):-1===Object.keys(o.values).indexOf(N(i))&&s.push(new k(t,i,`expected one of [${Object.keys(o.values).join(", ")}], ${JSON.stringify(i)} found`)),s}function va(e){return ie(Z(e.value))?pa(Object.assign({},e,{expressionContext:"filter",valueSpec:e.styleSpec[`filter_${e.layerType||"fill"}`]})):ya(e)}function ya(e){const t=e.value,i=e.key;if(!Array.isArray(t))return[new k(i,t,`array expected, ${U(t)} found`)];if(t.length<1)return[new k(i,t,"filter array must have at least 1 element")];const o=e.styleSpec;let s=ga({key:`${i}[0]`,value:t[0],valueSpec:o.filter_operator});const r=()=>{t.length>=2&&(ee(t[1])||s.push(new k(`${i}[1]`,t[1],`string expected, ${U(t[1])} found`)));for(let e=2;e<t.length;e++)"$type"===N(t[1])?s=s.concat(ga({key:`${i}[${e}]`,value:t[e],valueSpec:o.geometry_type})):ee(t[e])||j(t[e])||J(t[e])||s.push(new k(`${i}[${e}]`,t[e],`string, number, or boolean expected, ${U(t[e])} found.`))};switch(N(t[0])){case"<":case"<=":case">":case">=":t.length>=2&&"$type"===N(t[1])&&s.push(new k(i,t,`"$type" cannot be use with operator "${t[0]}"`)),3!==t.length&&s.push(new k(i,t,`filter array for operator "${t[0]}" must have 3 elements`)),r();break;case"==":case"!=":3!==t.length&&s.push(new k(i,t,`filter array for operator "${t[0]}" must have 3 elements`)),r();break;case"in":case"!in":r();break;case"any":case"all":case"none":for(let o=1;o<t.length;o++)s=s.concat(ya({key:`${i}[${o}]`,value:t[o],styleSpec:e.styleSpec}));break;case"has":case"!has":2!==t.length?s.push(new k(i,t,`filter array for "${t[0]}" operator must have 2 elements`)):ee(t[1])||s.push(new k(`${i}[1]`,t[1],`string expected, ${U(t[1])} found`))}return s}function xa(e,t){const i=e.key,o=e.style,s=e.layer,r=e.styleSpec,n=e.value,a=e.objectKey,l=r[`${t}_${e.layerType}`];if(!l)return[];const c=a.match(/^(.*)-use-theme$/);if(c&&l[c[1]])return q(Z(n))?[].concat(Pa({key:i,value:n,valueSpec:{type:"string",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},style:o,styleSpec:r,expressionContext:"property",propertyType:t,propertyKey:a})):Pa({key:i,value:n,valueSpec:{type:"string"},style:o,styleSpec:r});const h=a.match(/^(.*)-transition$/);if("paint"===t&&h&&l[h[1]]&&l[h[1]].transition)return Pa({key:i,value:n,valueSpec:r.transition,style:o,styleSpec:r});const d=e.valueSpec||l[a];if(!d)return[new oe(i,n,`unknown property "${a}"`)];let u;if(ee(n)&&V(d)&&!d.tokens&&(u=/^{([^}]+)}$/.exec(n))){const e=`\`{ "type": "identity", "property": ${u?JSON.stringify(u[1]):'"_"'} }\``;return[new k(i,n,`"${a}" does not support interpolation syntax\nUse an identity property function instead: ${e}.`)]}const _=[];if("symbol"===e.layerType)"text-field"!==a||!o||o.glyphs||o.imports||_.push(new k(i,n,'use of "text-field" requires a style "glyphs" property')),"text-font"===a&&se(Z(n))&&"identity"===N(n.type)&&_.push(new k(i,n,'"text-font" does not support identity functions'));else if("model"===e.layerType&&"paint"===t&&s&&s.layout&&s.layout.hasOwnProperty("model-id")&&V(d)&&(re(d)||H(d))){const e=$(Z(n),d).value,t="expression"in e&&e.expression||"_styleExpression"in e&&e._styleExpression&&e._styleExpression.expression;t&&!X(t,["measure-light"])&&("model-emissive-strength"===a&&Y(t)&&K(t)||_.push(new k(i,n,`${a} does not support measure-light expressions when the model layer source is vector tile or GeoJSON.`)))}return _.concat(Pa({key:e.key,value:n,valueSpec:d,style:o,styleSpec:r,expressionContext:"property",propertyType:t,propertyKey:a}))}function ba(e){return xa(e,"paint")}function wa(e){return xa(e,"layout")}function Ta(e){let t=[];const i=e.value,o=e.key,s=e.style,r=e.styleSpec;if(!B(i))return[new k(o,i,"object expected")];i.type||i.ref||t.push(new k(o,i,'either "type" or "ref" is required'));let n=N(i.type);const a=N(i.ref);if(i.id){const r=N(i.id);for(let n=0;n<e.arrayIndex;n++){const e=s.layers[n];N(e.id)===r&&t.push(new k(o,i.id,`duplicate layer id "${r}", previously used at line ${e.id.__line__}`))}}if("ref"in i){let e;["type","source","source-layer","filter","layout"].forEach((e=>{e in i&&t.push(new k(o,i[e],`"${e}" is prohibited for ref layers`))})),s.layers.forEach((t=>{N(t.id)===a&&(e=t)})),e?e.ref?t.push(new k(o,i.ref,"ref cannot reference another ref layer")):n=N(e.type):"string"==typeof a&&t.push(new k(o,i.ref,`ref layer "${a}" not found`))}else if("background"!==n&&"sky"!==n&&"slot"!==n)if(i.source)if(ee(i.source)){const e=s.sources&&s.sources[i.source],r=e&&N(e.type);e?"vector"===r&&"raster"===n?t.push(new k(o,i.source,`layer "${i.id}" requires a raster source`)):"raster"===r&&"raster"!==n?t.push(new k(o,i.source,`layer "${i.id}" requires a vector source`)):"vector"!==r||i["source-layer"]?"raster-dem"===r&&"hillshade"!==n?t.push(new k(o,i.source,"raster-dem source can only be used with layer type 'hillshade'.")):"raster-array"!==r||["raster","raster-particle"].includes(n)?"line"===n&&i.paint&&(i.paint["line-gradient"]||i.paint["line-trim-offset"])&&"geojson"===r&&!e.lineMetrics?t.push(new k(o,i,`layer "${i.id}" specifies a line-gradient, which requires the GeoJSON source to have \`lineMetrics\` enabled.`)):"raster-particle"===n&&"raster-array"!==r&&t.push(new k(o,i.source,`layer "${i.id}" requires a 'raster-array' source.`)):t.push(new k(o,i.source,"raster-array source can only be used with layer type 'raster'.")):t.push(new k(o,i,`layer "${i.id}" must specify a "source-layer"`)):t.push(new k(o,i.source,`source "${i.source}" not found`))}else t.push(new k(`${o}.source`,i.source,'"source" must be a string'));else t.push(new k(o,i,'missing required property "source"'));return t=t.concat(Ma({key:o,value:i,valueSpec:r.layer,style:e.style,styleSpec:e.styleSpec,objectElementValidators:{"*":()=>[],type:()=>Pa({key:`${o}.type`,value:i.type,valueSpec:r.layer.type,style:e.style,styleSpec:e.styleSpec,object:i,objectKey:"type"}),filter:e=>va(Object.assign({layerType:n},e)),layout:e=>Ma({layer:i,key:e.key,value:e.value,valueSpec:{},style:e.style,styleSpec:e.styleSpec,objectElementValidators:{"*":e=>wa(Object.assign({layerType:n},e))}}),paint:e=>Ma({layer:i,key:e.key,value:e.value,valueSpec:{},style:e.style,styleSpec:e.styleSpec,objectElementValidators:{"*":e=>ba(Object.assign({layerType:n,layer:i},e))}}),appearances(e){const t=da({key:e.key,value:e.value,valueSpec:e.valueSpec,style:e.style,styleSpec:e.styleSpec,arrayElementValidator:e=>function(e){const{key:t,layer:i,layerType:o}=e,s=N(e.value),r=N(s.name),n=N(s.condition),a=Ma({key:t,value:s,valueSpec:e.styleSpec.appearance,style:e.style,styleSpec:e.styleSpec,objectElementValidators:{condition:e=>function(e){const t=[];return t.push(...pa({key:e.key,value:e.object.condition,valueSpec:ne.appearance.condition,expressionContext:"appearance"})),t}(Object.assign({layer:i,layerType:o},e)),properties:e=>function(e){const t=[],{styleSpec:i,layer:o,layerType:s}=e,r=i[`paint_${s}`],n=i[`layout_${s}`],a=e.object[e.objectKey];for(const i in a){const l=i in r?"paint":i in n?"layout":void 0;if(!l){t.push(new k(e.key,i,`unknown property "${i}" for layer type "${s}"`));continue}const c=Object.assign({},e,{key:`${e.key}.${i}`,object:a,objectKey:i,layer:o,layerType:s,value:a[i],valueSpec:"paint"===l?r[i]:n[i]});t.push(...xa(c,l))}return t}(Object.assign({layer:i,layerType:o},e))}});return"hidden"!==r&&void 0===n&&a.push(new k(e.key,"name",'Appearance with name different than "hidden" must have a condition')),a}(Object.assign({layerType:n,layer:i},e))}),o=Array.isArray(e.value)?e.value:[],s=new Set;return o.forEach(((o,r)=>{const n=N(o.name);if(n)if(s.has(n)){const o=N(i.id);t.push(new k(e.key,n,`Duplicated appearance name "${n}" for layer "${o}"`))}else s.add(n)})),t}}})),t}function Ea({key:e,value:t}){return ee(t)?[]:[new k(e,t,`string expected, ${U(t)} found`)]}const Sa={promoteId:function e({key:t,value:i}){if(ee(i))return Ea({key:t,value:i});if(Array.isArray(i)){const e=[],o=Z(i),s=W(o);return"error"===s.result&&s.value.forEach((i=>{e.push(new k(`${t}${i.key}`,null,`${i.message}`))})),X(s.value.expression,["zoom","heatmap-density","line-progress","raster-value","sky-radial-progress","accumulated","is-supported-script","pitch","distance-from-center","measure-light","raster-particle-speed"])||e.push(new k(`${t}`,null,"promoteId expression should be only feature dependent")),e}if(!B(i))return[new k(t,i,`string, expression or object expected, "${U(i)}" found`)];const o=[];for(const s in i)o.push(...e({key:`${t}.${s}`,value:i[s]}));return o}};function Ia(e){const t=e.value,i=e.key,o=e.styleSpec,s=e.style;if(!B(t))return[new k(i,t,`object expected, ${U(t)} found`)];if(!("type"in t))return[new k(i,t,'"type" is required')];const r=N(t.type);let n=[];switch(["vector","raster","raster-dem","raster-array"].includes(r)&&("url"in t||"tiles"in t||n.push(new oe(i,t,'Either "url" or "tiles" is required.'))),r){case"vector":case"raster":case"raster-dem":case"raster-array":return n=n.concat(Ma({key:i,value:t,valueSpec:o[`source_${r.replace("-","_")}`],style:e.style,styleSpec:o,objectElementValidators:Sa})),n;case"geojson":if(n=Ma({key:i,value:t,valueSpec:o.source_geojson,style:s,styleSpec:o,objectElementValidators:Sa}),"cluster"in t&&"clusterProperties"in t){if(!B(t.clusterProperties))return[new k(`${i}.clusterProperties`,t,`object expected, ${U(t)} found`)];for(const e in t.clusterProperties){const o=t.clusterProperties[e];if(!Array.isArray(o))return[new k(`${i}.clusterProperties.${e}`,o,"array expected")];const[s,r]=o,a="string"==typeof s?[s,["accumulated"],["get",e]]:s;n.push(...pa({key:`${i}.${e}.map`,value:r,expressionContext:"cluster-map"})),n.push(...pa({key:`${i}.${e}.reduce`,value:a,expressionContext:"cluster-reduce"}))}}return n;case"video":return Ma({key:i,value:t,valueSpec:o.source_video,style:s,styleSpec:o});case"image":return Ma({key:i,value:t,valueSpec:o.source_image,style:s,styleSpec:o});case"canvas":return[new k(i,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return ga({key:`${i}.type`,value:t.type,valueSpec:{values:Ca(o)}})}}function Ca(e){return e.source.reduce(((t,i)=>{const o=e[i];return"enum"===o.type.type&&(t=t.concat(Object.keys(o.type.values||{}))),t}),[])}function Ra(e){const t=e.value,i=e.styleSpec,o=i.light,s=e.style;if(void 0===t)return[];if(!B(t))return[new k("light",t,`object expected, ${U(t)} found`)];let r=[];for(const e in t){const n=e.match(/^(.*)-transition$/),a=e.match(/^(.*)-use-theme$/);r=r.concat(a&&o[a[1]]?Pa({key:e,value:t[e],valueSpec:{type:"string"},style:s,styleSpec:i}):n&&o[n[1]]&&o[n[1]].transition?Pa({key:e,value:t[e],valueSpec:i.transition,style:s,styleSpec:i}):o[e]?Pa({key:e,value:t[e],valueSpec:o[e],style:s,styleSpec:i}):[new k(e,t[e],`unknown property "${e}"`)])}return r}function Aa(e){const t=e.value;if(!t)return[];const i=e.key;if(!B(t))return[new k(i,t,`object expected, ${U(t)} found`)];let o=[];const s=e.styleSpec,r=s["light-3d"],n=e.style,a=e.style.lights;for(const e of["type","id"])if(!(e in t))return o=o.concat([new k(i,t,`missing property "${e}"`)]),o;if(!ee(t.type))return o=o.concat([new k(`${i}.type`,t.type,"string expected")]),o;if(a)for(let s=0;s<e.arrayIndex;s++){const e=N(t.type),r=a[s];N(r.type)===e&&o.push(new k(i,t.id,`duplicate light type "${t.type}", previously defined at line ${r.id.__line__}`))}const l=`properties_light_${t.type}`;if(!(l in s))return o=o.concat([new k(`${i}.type`,t,`Invalid light type ${t.type}`)]),o;const c=s[l];for(const i in t)if("properties"===i){const r=t[i];if(!B(r))return o=o.concat([new k("properties",r,`object expected, ${U(r)} found`)]),o;for(const a in r){const l=a.match(/^(.*)-transition$/),h=a.match(/^(.*)-use-theme$/);o=o.concat(h&&c[h[1]]?Pa({key:i,value:r[a],valueSpec:{type:"string"},style:n,styleSpec:s}):l&&c[l[1]]&&c[l[1]].transition?Pa({key:i,value:t[i],valueSpec:s.transition,style:n,styleSpec:s}):c[a]?Pa({key:a,value:r[a],valueSpec:c[a],style:n,styleSpec:s}):[new oe(e.key,r[a],`unknown property "${a}"`)])}}else o=o.concat(r[i]?Pa({key:i,value:t[i],valueSpec:r[i],style:n,styleSpec:s}):[new oe(i,t[i],`unknown property "${i}"`)]);return o}function Da(e){const t=e.value,i=e.key,o=e.style,s=e.styleSpec,r=s.terrain;if(null==t)return[];if(!B(t))return[new k("terrain",t,`object expected, ${U(t)} found`)];let n=[];for(const e in t){const i=e.match(/^(.*)-transition$/),a=e.match(/^(.*)-use-theme$/);n=n.concat(a&&r[a[1]]?Pa({key:e,value:t[e],valueSpec:{type:"string"},style:o,styleSpec:s}):i&&r[i[1]]&&r[i[1]].transition?Pa({key:e,value:t[e],valueSpec:s.transition,style:o,styleSpec:s}):r[e]?Pa({key:e,value:t[e],valueSpec:r[e],style:o,styleSpec:s}):[new oe(e,t[e],`unknown property "${e}"`)])}if(t.source)if(ee(t.source)){const e=o.sources&&o.sources[t.source],s=e&&N(e.type);e?"raster-dem"!==s&&n.push(new k(`${i}.source`,t.source,`terrain cannot be used with a source of type ${s}, it only be used with a "raster-dem" source type`)):n.push(new k(`${i}.source`,t.source,`source "${t.source}" not found`))}else n.push(new k(`${i}.source`,t.source,"source must be a string"));else n.push(new k(i,t,'terrain is missing required property "source"'));return n}function La(e){const t=e.value,i=e.style,o=e.styleSpec,s=o.fog;if(void 0===t)return[];if(!B(t))return[new k("fog",t,`object expected, ${U(t)} found`)];let r=[];for(const e in t){const n=e.match(/^(.*)-transition$/),a=e.match(/^(.*)-use-theme$/);r=r.concat(a&&s[a[1]]?Pa({key:e,value:t[e],valueSpec:{type:"string"},style:i,styleSpec:o}):n&&s[n[1]]&&s[n[1]].transition?Pa({key:e,value:t[e],valueSpec:o.transition,style:i,styleSpec:o}):s[e]?Pa({key:e,value:t[e],valueSpec:s[e],style:i,styleSpec:o}):[new oe(e,t[e],`unknown property "${e}"`)])}return r}const Oa={"*":()=>[],array:da,boolean:function(e){const t=e.value,i=e.key;return J(t)?[]:[new k(i,t,`boolean expected, ${U(t)} found`)]},number:ua,color:function({key:e,value:t}){return ee(t)?null===te.parseCSSColor(t)?[new k(e,t,`color expected, "${t}" found`)]:[]:[new k(e,t,`color expected, ${U(t)} found`)]},enum:ga,filter:va,function:_a,layer:Ta,object:Ma,source:Ia,model:ae,light:Ra,"light-3d":Aa,terrain:Da,fog:La,string:Ea,formatted:function(e){return 0===Ea(e).length?[]:pa(e)},resolvedImage:function(e){return 0===Ea(e).length?[]:pa(e)},projection:function(e){const t=e.value,i=e.styleSpec,o=i.projection,s=e.style;if(B(t)){let e=[];for(const