@mapvx/web-js 4.0.0 → 4.0.1-dev.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/README.md +11 -0
  2. package/dist/cjs/index.js +1 -1
  3. package/dist/cjs/index.js.map +1 -1
  4. package/dist/es/domain/models/scene3D.d.ts +13 -0
  5. package/dist/es/domain/models/scene3D.d.ts.map +1 -1
  6. package/dist/es/index.d.ts +1 -0
  7. package/dist/es/index.d.ts.map +1 -1
  8. package/dist/es/index.js +5 -0
  9. package/dist/es/index.js.map +1 -1
  10. package/dist/es/logger/sentry.js +1 -1
  11. package/dist/es/map/generated/maplibreWorkerSource.d.ts +11 -0
  12. package/dist/es/map/generated/maplibreWorkerSource.d.ts.map +1 -0
  13. package/dist/es/map/generated/maplibreWorkerSource.js +14 -0
  14. package/dist/es/map/generated/maplibreWorkerSource.js.map +1 -0
  15. package/dist/es/map/installMapLibreWorker.d.ts +87 -0
  16. package/dist/es/map/installMapLibreWorker.d.ts.map +1 -0
  17. package/dist/es/map/installMapLibreWorker.js +134 -0
  18. package/dist/es/map/installMapLibreWorker.js.map +1 -0
  19. package/dist/es/map/map.d.ts +0 -1
  20. package/dist/es/map/map.d.ts.map +1 -1
  21. package/dist/es/map/map.js +15 -17
  22. package/dist/es/map/map.js.map +1 -1
  23. package/dist/es/map/scene3DController.d.ts +15 -4
  24. package/dist/es/map/scene3DController.d.ts.map +1 -1
  25. package/dist/es/map/scene3DController.js +22 -10
  26. package/dist/es/map/scene3DController.js.map +1 -1
  27. package/dist/umd/index.js +200 -45
  28. package/dist/umd/index.js.map +1 -1
  29. package/package.json +12 -7
  30. package/dist/es/domain/models/_rtl.d.ts +0 -7
  31. package/dist/es/domain/models/_rtl.d.ts.map +0 -1
  32. package/dist/es/domain/models/_rtl.js +0 -7
  33. package/dist/es/domain/models/_rtl.js.map +0 -1
package/dist/umd/index.js CHANGED
@@ -215,15 +215,18 @@ __webpack_require__.d(__webpack_exports__, {
215
215
  UnitSystem: () => (/* reexport */ UnitSystem),
216
216
  circleRing: () => (/* reexport */ circleRing),
217
217
  createRouteAnimationIconDataUrl: () => (/* reexport */ createRouteAnimationIconDataUrl),
218
+ getMapLibreWorkerUrl: () => (/* reexport */ getMapLibreWorkerUrl),
218
219
  initializeSDK: () => (/* reexport */ initializeSDK),
219
220
  injectPreconnects: () => (/* reexport */ injectPreconnects),
221
+ installMapLibreWorker: () => (/* reexport */ installMapLibreWorker),
220
222
  isBasicWithIcon: () => (/* reexport */ isBasicWithIcon),
221
223
  isBasicWithImageUrl: () => (/* reexport */ isBasicWithImageUrl),
222
224
  isBasicWithLogo: () => (/* reexport */ isBasicWithLogo),
223
225
  isMapVxRequestHostname: () => (/* reexport */ isMapVxRequestHostname),
224
226
  isValidCircleConfig: () => (/* reexport */ isValidCircleConfig),
225
227
  loadCustomization: () => (/* reexport */ loadCustomization),
226
- loadStyles: () => (/* binding */ loadStyles)
228
+ loadStyles: () => (/* binding */ loadStyles),
229
+ setMapLibreWorkerUrl: () => (/* reexport */ setMapLibreWorkerUrl)
227
230
  });
228
231
 
229
232
  ;// ./src/infrastructure/cache/LRUCache.ts
@@ -11112,7 +11115,7 @@ const extractSafariExtensionDetails = (func, filename) => {
11112
11115
  // exists only for the type-checker, so in the ES/CJS builds the identifier is
11113
11116
  // genuinely absent and a direct comparison throws ReferenceError at module load.
11114
11117
  // `typeof` is the only safe way to probe a possibly-undeclared global.
11115
- var sentry_SDK_VERSION = false ? 0 : "4.0.0";
11118
+ var sentry_SDK_VERSION = false ? 0 : "4.0.1-dev.2";
11116
11119
  var DSN = false ? 0 : "https://872f598f020e3cd73a0933b562d24c81@sentry.mapvx.app/5";
11117
11120
 
11118
11121
  /**
@@ -11396,7 +11399,7 @@ var maplibre_gl_shared_e=Object.create,maplibre_gl_shared_t=Object.definePropert
11396
11399
  * MapLibre GL JS
11397
11400
  * @license 3-Clause BSD. Full text of license: https://github.com/maplibre/maplibre-gl-js/blob/v6.9.0/LICENSE.txt
11398
11401
  */
11399
- var maplibre_gl_Mr=`6.9.0`;function maplibre_gl_Nr(){var e=new maplibre_gl_shared_h(4);return maplibre_gl_shared_h!=Float32Array&&(e[1]=0,e[2]=0),e[0]=1,e[3]=1,e}function maplibre_gl_Pr(e,t){var n=t[0],r=t[1],i=t[2],a=t[3],o=n*a-i*r;return o?(o=1/o,e[0]=a*o,e[1]=-r*o,e[2]=-i*o,e[3]=n*o,e):null}function maplibre_gl_Fr(e){return e[0]*e[3]-e[2]*e[1]}function maplibre_gl_Ir(e,t,n){var r=t[0],i=t[1],a=t[2],o=t[3],s=Math.sin(n),c=Math.cos(n);return e[0]=r*c+a*s,e[1]=i*c+o*s,e[2]=r*-s+a*c,e[3]=i*-s+o*c,e}let maplibre_gl_Lr,maplibre_gl_Rr,maplibre_gl_zr;const maplibre_gl_Br={frame(e,t,n,r){let i=r||window,a=i.requestAnimationFrame(e=>{o(),t(e)}),{unsubscribe:o}=maplibre_gl_shared_Qt(e.signal,`abort`,()=>{o(),i.cancelAnimationFrame(a),n(new maplibre_gl_shared_pn(e.signal.reason))},!1)},frameAsync(e,t){return new Promise((n,r)=>{this.frame(e,n,r,t)})},getImageData(e,t=0){return this.getImageCanvasContext(e).getImageData(-t,-t,e.width+2*t,e.height+2*t)},getImageCanvasContext(e){let t;if(maplibre_gl_shared_f()&&!maplibre_gl_shared_m())t=new OffscreenCanvas(e.width,e.height).getContext(`2d`,{willReadFrequently:!0});else{let n=window.document.createElement(`canvas`);n.width=e.width,n.height=e.height,t=n.getContext(`2d`,{willReadFrequently:!0})}if(!t)throw Error(`failed to create canvas 2d context`);return t.drawImage(e,0,0,e.width,e.height),t},resolveURL(e){return maplibre_gl_Lr||=document.createElement(`a`),maplibre_gl_Lr.href=e,maplibre_gl_Lr.href},get hardwareConcurrency(){return typeof navigator<`u`&&navigator.hardwareConcurrency||4},get prefersReducedMotion(){return maplibre_gl_zr===void 0?matchMedia?(maplibre_gl_Rr??=matchMedia(`(prefers-reduced-motion: reduce)`),maplibre_gl_Rr.matches):!1:maplibre_gl_zr},set prefersReducedMotion(e){maplibre_gl_zr=e}},maplibre_gl_Vr=new class{constructor(){this._frozenAt=null}getCurrentTime(){return this._frozenAt===null?performance.now():this._frozenAt}setNow(e){this._frozenAt=e}restoreNow(){this._frozenAt=null}isFrozen(){return this._frozenAt!==null}};function maplibre_gl_U(){return maplibre_gl_Vr.getCurrentTime()}function maplibre_gl_Hr(e){maplibre_gl_Vr.setNow(e)}function maplibre_gl_Ur(){maplibre_gl_Vr.restoreNow()}function maplibre_gl_Wr(){return maplibre_gl_Vr.isFrozen()}var maplibre_gl_W=class e{static{this.docStyle=typeof window<`u`&&window.document?.documentElement.style}static{this.selectProp=!e.docStyle||`userSelect`in e.docStyle?`userSelect`:`webkitUserSelect`}static create(e,t,n){let r=window.document.createElement(e);return t!==void 0&&(r.className=t),n&&n.appendChild(r),r}static createNS(e,t){return window.document.createElementNS(e,t)}static disableDrag(){e.docStyle&&e.selectProp&&(e.userSelect=e.docStyle[e.selectProp],e.docStyle[e.selectProp]=`none`)}static enableDrag(){e.docStyle&&e.selectProp&&(e.docStyle[e.selectProp]=e.userSelect)}static suppressClickInternal(t){t.preventDefault(),t.stopPropagation(),window.removeEventListener(`click`,e.suppressClickInternal,!0)}static suppressClick(){window.addEventListener(`click`,e.suppressClickInternal,!0),window.setTimeout(()=>{window.removeEventListener(`click`,e.suppressClickInternal,!0)},0)}static getScale(e){let t=e.getBoundingClientRect();return{x:t.width/e.offsetWidth||1,y:t.height/e.offsetHeight||1,boundingClientRect:t}}static getPoint(e,t,n){let r=t.boundingClientRect;return new maplibre_gl_shared_l((n.clientX-r.left)/t.x-e.clientLeft,(n.clientY-r.top)/t.y-e.clientTop)}static mousePos(t,n){let r=e.getScale(t);return e.getPoint(t,r,n)}static touchPos(t,n){let r=[],i=e.getScale(t);for(let a of n)r.push(e.getPoint(t,i,a));return r}static sanitize(t){let n=new DOMParser().parseFromString(t,`text/html`).body||document.createElement(`body`),r=n.querySelectorAll(`script, iframe`);for(let e of r)e.remove();return e.clean(n),n.innerHTML}static isPossiblyDangerous(e,t){let n=t.replace(/\s+/g,``).toLowerCase();if([`src`,`href`,`xlink:href`].includes(e)&&(n.includes(`javascript:`)||n.includes(`data:`))||e===`srcdoc`||e.startsWith(`on`))return!0}static clean(t){let n=t.children;for(let t of n)e.removeAttributes(t),e.clean(t)}static removeAttributes(t){for(let{name:n,value:r}of Array.from(t.attributes))e.isPossiblyDangerous(n,r)&&t.removeAttribute(n)}};let maplibre_gl_Gr;(function(e){let n,r,i,a;e.resetRequestQueue=()=>{n=[],r=0,i=0,a={}},e.addThrottleControl=e=>{let t=i++;return a[t]=e,t},e.removeThrottleControl=e=>{delete a[e],u()};let o=()=>{for(let e of Object.keys(a))if(a[e]())return!0;return!1};async function s(e,t,n,r,i=!0,a){let o=await e.transformRequest(t,n);return maplibre_gl_shared_hn(r.signal),maplibre_gl_Gr.getImage(o,r,i,a)}e.transformAndGetImage=s,e.getImage=(e,t,r=!0,i)=>new Promise((a,o)=>{e.headers||={},e.headers.accept=`image/webp,*/*`,maplibre_gl_shared_xt(e,{type:`image`});let s={abortController:t,requestParameters:e,supportImageRefresh:r,imageBitmapOptions:i,state:`queued`,onError:e=>{o(e)},onSuccess:e=>{a(e)}};n.push(s),u()});let c=(e,t)=>typeof createImageBitmap==`function`?maplibre_gl_shared_Wt(e,t):maplibre_gl_shared_Gt(e),l=async e=>{e.state=`running`;let{requestParameters:n,supportImageRefresh:i,imageBitmapOptions:a,onError:o,onSuccess:s,abortController:l}=e,f=i===!1&&!a&&!maplibre_gl_shared_zt(self)&&!dist_maplibre_gl_shared_n(n.url)&&(!n.headers||Object.keys(n.headers).reduce((e,t)=>e&&t===`accept`,!0));r++;let p=f?d(n,l):maplibre_gl_shared_En(n,l);try{let t=await p;delete e.abortController,e.state=`completed`,t.data instanceof HTMLImageElement||maplibre_gl_shared_Ut(t.data)?s(t):!t.data||t.data.byteLength===0?s({data:null,cacheControl:t.cacheControl,expires:t.expires}):s({data:await c(t.data,a),cacheControl:t.cacheControl,expires:t.expires})}catch(n){delete e.abortController,o(maplibre_gl_shared_Qe(n))}finally{r--,u()}},u=()=>{let e=o()?maplibre_gl_shared_gn.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:maplibre_gl_shared_gn.MAX_PARALLEL_IMAGE_REQUESTS;for(let t=r;t<e&&n.length>0;t++){let e=n.shift();if(e.abortController.signal.aborted){t--;continue}l(e)}},d=(e,t)=>new Promise((n,r)=>{let i=new Image,a=e.url,o=e.credentials;o&&o===`include`?i.crossOrigin=`use-credentials`:(o&&o===`same-origin`||!maplibre_gl_shared_kn(a))&&(i.crossOrigin=`anonymous`),t.signal.addEventListener(`abort`,()=>{i.src=``,r(new maplibre_gl_shared_pn(t.signal.reason))}),i.fetchPriority=`high`,i.onload=()=>{i.onerror=i.onload=null,n({data:i})},i.onerror=()=>{i.onerror=i.onload=null,!t.signal.aborted&&r(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.`))},i.src=a})})(maplibre_gl_Gr||={}),maplibre_gl_Gr.resetRequestQueue();var maplibre_gl_Kr=class{constructor(e){this._transformRequestFn=e??null}transformRequest(e,t){return this._transformRequestFn&&this._transformRequestFn(e,t)||{url:e}}setTransformRequest(e){this._transformRequestFn=e}},maplibre_gl_qr=class extends maplibre_gl_shared_Nn{},maplibre_gl_G=class extends maplibre_gl_qr{},maplibre_gl_Jr=class extends maplibre_gl_qr{constructor(e={}){super(`style.load`,e)}},maplibre_gl_Yr=class extends maplibre_gl_qr{constructor(e,t={}){super(e,t),this.dataType=`style`}},maplibre_gl_K=class extends maplibre_gl_qr{constructor(e,t={}){super(e,t),this.dataType=`source`}},maplibre_gl_Xr=class extends maplibre_gl_qr{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,t,n,r={}){n=n instanceof MouseEvent?n:new MouseEvent(e,n);let i=maplibre_gl_W.mousePos(t.getCanvas(),n),a=t.unproject(i);super(e,maplibre_gl_shared_xt({point:i,lngLat:a,originalEvent:n},r)),this._defaultPrevented=!1,this.target=t}},maplibre_gl_Zr=class extends maplibre_gl_qr{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,t,n){let r=e===`touchend`?n.changedTouches:n.touches,i=maplibre_gl_W.touchPos(t.getCanvasContainer(),r),a=i.map(e=>t.unproject(e)),o=i.reduce((e,t,n,r)=>e.add(t.div(r.length)),new maplibre_gl_shared_l(0,0)),s=t.unproject(o);super(e,{points:i,point:o,lngLats:a,lngLat:s,originalEvent:n}),this._defaultPrevented=!1}},maplibre_gl_Qr=class extends maplibre_gl_qr{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,t){super(`wheel`,{originalEvent:t}),this._defaultPrevented=!1}},maplibre_gl_$r=class extends maplibre_gl_qr{},maplibre_gl_ei=class extends maplibre_gl_qr{constructor(e={}){super(`terrain`,e)}},maplibre_gl_ti=class extends maplibre_gl_qr{constructor(e={}){super(`projectiontransition`,e)}},maplibre_gl_ni=class extends maplibre_gl_qr{},maplibre_gl_ri=class extends maplibre_gl_qr{constructor(e={}){super(`styleimagemissing`,e)}};function maplibre_gl_ii(e,t){let n={};for(let t in e)t!==`ref`&&(n[t]=e[t]);return maplibre_gl_shared_Ln.forEach(e=>{e in t&&(n[e]=t[e])}),n}function maplibre_gl_ai(e){e=e.slice();let t=Object.create(null);for(let n=0;n<e.length;n++)t[e[n].id]=e[n];for(let n=0;n<e.length;n++)`ref`in e[n]&&(e[n]=maplibre_gl_ii(e[n],t[e[n].ref]));return e}function maplibre_gl_q(e,t){if(Array.isArray(e)){if(!Array.isArray(t)||e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!maplibre_gl_q(e[n],t[n]))return!1;return!0}if(typeof e==`object`&&e&&t!==null){if(typeof t!=`object`||Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(!maplibre_gl_q(e[n],t[n]))return!1;return!0}return e===t}function maplibre_gl_oi(e,t){e.push(t)}function maplibre_gl_si(e,t,n){maplibre_gl_oi(n,{command:`addSource`,args:[e,t[e]]})}function maplibre_gl_ci(e,t,n){maplibre_gl_oi(t,{command:`removeSource`,args:[e]}),n[e]=!0}function maplibre_gl_li(e,t,n,r){maplibre_gl_ci(e,n,r),maplibre_gl_si(e,t,n)}function maplibre_gl_ui(e,t,n){let r;for(r in e[n])if(Object.prototype.hasOwnProperty.call(e[n],r)&&r!==`data`&&!maplibre_gl_q(e[n][r],t[n][r]))return!1;for(r in t[n])if(Object.prototype.hasOwnProperty.call(t[n],r)&&r!==`data`&&!maplibre_gl_q(e[n][r],t[n][r]))return!1;return!0}function maplibre_gl_di(e,t,n,r){e||={},t||={};let i;for(i in e)Object.prototype.hasOwnProperty.call(e,i)&&(Object.prototype.hasOwnProperty.call(t,i)||maplibre_gl_ci(i,n,r));for(i in t)Object.prototype.hasOwnProperty.call(t,i)&&(Object.prototype.hasOwnProperty.call(e,i)?maplibre_gl_q(e[i],t[i])||(e[i].type===`geojson`&&t[i].type===`geojson`&&maplibre_gl_ui(e,t,i)?maplibre_gl_oi(n,{command:`setGeoJSONSourceData`,args:[i,t[i].data]}):maplibre_gl_li(i,t,n,r)):maplibre_gl_si(i,t,n))}function maplibre_gl_fi(e,t,n,r,i,a){e||={},t||={};for(let o in e)Object.prototype.hasOwnProperty.call(e,o)&&(maplibre_gl_q(e[o],t[o])||n.push({command:a,args:[r,o,t[o],i]}));for(let o in t)Object.prototype.hasOwnProperty.call(t,o)&&!Object.prototype.hasOwnProperty.call(e,o)&&(maplibre_gl_q(e[o],t[o])||n.push({command:a,args:[r,o,t[o],i]}))}function maplibre_gl_pi(e){return e.id}function maplibre_gl_mi(e,t){return e[t.id]=t,e}function maplibre_gl_hi(e,t,n){e||=[],t||=[];let r=e.map(maplibre_gl_pi),i=t.map(maplibre_gl_pi),a=e.reduce(maplibre_gl_mi,{}),o=t.reduce(maplibre_gl_mi,{}),s=r.slice(),c=Object.create(null),l,u,d,f,p;for(let e=0,t=0;e<r.length;e++)l=r[e],Object.prototype.hasOwnProperty.call(o,l)?t++:(maplibre_gl_oi(n,{command:`removeLayer`,args:[l]}),s.splice(s.indexOf(l,t),1));for(let e=0,t=0;e<i.length;e++)l=i[i.length-1-e],s[s.length-1-e]!==l&&(Object.prototype.hasOwnProperty.call(a,l)?(maplibre_gl_oi(n,{command:`removeLayer`,args:[l]}),s.splice(s.lastIndexOf(l,s.length-t),1)):t++,f=s[s.length-e],maplibre_gl_oi(n,{command:`addLayer`,args:[o[l],f]}),s.splice(s.length-e,0,l),c[l]=!0);for(let e=0;e<i.length;e++)if(l=i[e],u=a[l],d=o[l],!(c[l]||maplibre_gl_q(u,d))){if(!maplibre_gl_q(u.source,d.source)||!maplibre_gl_q(u[`source-layer`],d[`source-layer`])||!maplibre_gl_q(u.type,d.type)){maplibre_gl_oi(n,{command:`removeLayer`,args:[l]}),f=s[s.lastIndexOf(l)+1],maplibre_gl_oi(n,{command:`addLayer`,args:[d,f]});continue}for(p in maplibre_gl_fi(u.layout,d.layout,n,l,null,`setLayoutProperty`),maplibre_gl_fi(u.paint,d.paint,n,l,null,`setPaintProperty`),maplibre_gl_q(u.filter,d.filter)||maplibre_gl_oi(n,{command:`setFilter`,args:[l,d.filter]}),(!maplibre_gl_q(u.minzoom,d.minzoom)||!maplibre_gl_q(u.maxzoom,d.maxzoom))&&maplibre_gl_oi(n,{command:`setLayerZoomRange`,args:[l,d.minzoom,d.maxzoom]}),u)Object.prototype.hasOwnProperty.call(u,p)&&p!==`layout`&&p!==`paint`&&p!==`filter`&&p!==`metadata`&&p!==`minzoom`&&p!==`maxzoom`&&(p.indexOf(`paint.`)===0?maplibre_gl_fi(u[p],d[p],n,l,p.slice(6),`setPaintProperty`):maplibre_gl_q(u[p],d[p])||maplibre_gl_oi(n,{command:`setLayerProperty`,args:[l,p,d[p]]}));for(p in d)Object.prototype.hasOwnProperty.call(d,p)&&!Object.prototype.hasOwnProperty.call(u,p)&&p!==`layout`&&p!==`paint`&&p!==`filter`&&p!==`metadata`&&p!==`minzoom`&&p!==`maxzoom`&&(p.indexOf(`paint.`)===0?maplibre_gl_fi(u[p],d[p],n,l,p.slice(6),`setPaintProperty`):maplibre_gl_q(u[p],d[p])||maplibre_gl_oi(n,{command:`setLayerProperty`,args:[l,p,d[p]]}))}}function maplibre_gl_gi(e,t){if(!e)return[{command:`setStyle`,args:[t]}];let n=[];try{if(!maplibre_gl_q(e.version,t.version))return[{command:`setStyle`,args:[t]}];maplibre_gl_q(e.center,t.center)||n.push({command:`setCenter`,args:[t.center]}),maplibre_gl_q(e.state,t.state)||n.push({command:`setGlobalState`,args:[t.state]}),maplibre_gl_q(e.centerAltitude,t.centerAltitude)||n.push({command:`setCenterAltitude`,args:[t.centerAltitude]}),maplibre_gl_q(e.zoom,t.zoom)||n.push({command:`setZoom`,args:[t.zoom]}),maplibre_gl_q(e.bearing,t.bearing)||n.push({command:`setBearing`,args:[t.bearing]}),maplibre_gl_q(e.pitch,t.pitch)||n.push({command:`setPitch`,args:[t.pitch]}),maplibre_gl_q(e.roll,t.roll)||n.push({command:`setRoll`,args:[t.roll]}),maplibre_gl_q(e.sprite,t.sprite)||n.push({command:`setSprite`,args:[t.sprite]}),maplibre_gl_q(e.glyphs,t.glyphs)||n.push({command:`setGlyphs`,args:[t.glyphs]}),maplibre_gl_q(e[`font-faces`],t[`font-faces`])||n.push({command:`setFontFaces`,args:[t[`font-faces`]]}),maplibre_gl_q(e.transition,t.transition)||n.push({command:`setTransition`,args:[t.transition]}),maplibre_gl_q(e.light,t.light)||n.push({command:`setLight`,args:[t.light]}),maplibre_gl_q(e.terrain,t.terrain)||n.push({command:`setTerrain`,args:[t.terrain]}),maplibre_gl_q(e.sky,t.sky)||n.push({command:`setSky`,args:[t.sky]}),maplibre_gl_q(e.projection,t.projection)||n.push({command:`setProjection`,args:[t.projection]});let r={},i=[];maplibre_gl_di(e.sources,t.sources,i,r);let a=[];e.layers&&e.layers.forEach(e=>{`source`in e&&r[e.source]?n.push({command:`removeLayer`,args:[e.id]}):a.push(e)}),n=n.concat(i),maplibre_gl_hi(a,t.layers,n)}catch(e){console.warn(`Unable to compute style diff:`,e),n=[{command:`setStyle`,args:[t]}]}return n}function maplibre_gl_i(){let e={},t=maplibre_gl_shared_P.$version;for(let n in maplibre_gl_shared_P.$root){let r=maplibre_gl_shared_P.$root[n];if(r.required){let i=null;i=n===`version`?t:r.type===`array`?[]:{},i!=null&&(e[n]=i)}}return e}function maplibre_gl_vi(e){let t=[];if(typeof e==`string`)t.push({id:`default`,url:e});else if(e&&e.length>0){let n=[];for(let{id:r,url:i}of e){let e=`${r}${i}`;n.includes(e)||(n.push(e),t.push({id:r,url:i}))}}return t}function maplibre_gl_yi(e,t,n){try{let r=new URL(e);return r.pathname+=`${t}${n}`,r.toString()}catch{throw Error(`Invalid sprite URL "${e}", must be absolute. Modify style specification directly or use TransformStyleFunction to correct the issue dynamically`)}}async function maplibre_gl_bi(e,t,n,r){let i=maplibre_gl_vi(e),a=n>1?`@2x`:``,o={},s={};for(let{id:e,url:n}of i){let i=await t.transformRequest(maplibre_gl_yi(n,a,`.json`),`SpriteJSON`);o[e]=maplibre_gl_shared_Dn(i,r);let c=await t.transformRequest(maplibre_gl_yi(n,a,`.png`),`SpriteImage`);s[e]=maplibre_gl_Gr.getImage(c,r)}return await Promise.all([...Object.values(o),...Object.values(s)]),maplibre_gl_xi(o,s)}async function maplibre_gl_xi(e,t){let n={};for(let r in e){n[r]={};let i=(await t[r]).data;if(!i)throw Error(`Could not load sprite image for ${r}: the response is empty`);let a=maplibre_gl_Br.getImageCanvasContext(i),o=(await e[r]).data;for(let e in o){let{width:t,height:i,x:s,y:c,sdf:l,pixelRatio:u,stretchX:d,stretchY:f,content:p,textFitWidth:m,textFitHeight:h}=o[e],g={width:t,height:i,x:s,y:c,context:a};n[r][e]={data:null,pixelRatio:u,sdf:l,stretchX:d,stretchY:f,content:p,textFitWidth:m,textFitHeight:h,spriteData:g}}}return n}var maplibre_gl_Si=class extends maplibre_gl_shared_Fn{constructor(){super(),this.images={},this.updateVersion=0,this.loaded=!1,this.requestors=[],this.missingImageResolver=null,this._spriteImagesIds={},this._imagesIds=null,this._renderCallbacksDispatchedThisFrame={}}destroy(){for(let e of Object.keys(this.images))this.removeImage(e);this._spriteImagesIds={}}isLoaded(){return this.loaded}setLoaded(e){if(this.loaded!==e&&(this.loaded=e,e)){for(let{ids:e,promiseResolve:t}of this.requestors)t(this._getImagesForIds(e));this.requestors=[]}}getImage(e){let t=this.images[e];if(t&&!t.data&&t.spriteData){let e=t.spriteData;t.data=new Ad({width:e.width,height:e.height},e.context.getImageData(e.x,e.y,e.width,e.height).data),t.spriteData=null}return t}addImage(e,t){if(this.images[e])throw Error(`Image id ${e} already exist, use updateImage instead`);this._validate(e,t)&&(this.images[e]=t,this._imagesIds=null,t.isWebGLImage&&this.updateImage(e,t,!1))}_validate(e,t){let n=!0,r=t.data||t.spriteData;return this._validateStretch(t.stretchX,r?.width)||(this.fire(new maplibre_gl_shared_Pn(Error(`Image "${e}" has invalid "stretchX" value`))),n=!1),this._validateStretch(t.stretchY,r?.height)||(this.fire(new maplibre_gl_shared_Pn(Error(`Image "${e}" has invalid "stretchY" value`))),n=!1),this._validateContent(t.content,t)||(this.fire(new maplibre_gl_shared_Pn(Error(`Image "${e}" has invalid "content" value`))),n=!1),n}_validateStretch(e,t){if(!e)return!0;let n=0;for(let r of e){if(r[0]<n||r[1]<r[0]||t<r[1])return!1;n=r[1]}return!0}_validateContent(e,t){if(!e)return!0;if(e.length!==4)return!1;let n=t.spriteData,r=n?.width||t.data.width,i=n?.height||t.data.height;return e[0]<0||r<e[0]||e[1]<0||i<e[1]||e[2]<0||r<e[2]||e[3]<0||i<e[3]||e[2]<e[0]?!1:e[3]>=e[1]}updateImage(e,t,n=!0){let r=this.images[e];if(n){let e=r.data||r.spriteData;if(e.width!==t.data.width||e.height!==t.data.height)throw Error(`size mismatch between old image (${e.width}x${e.height}) and new image (${t.data.width}x${t.data.height}).`)}t.version=(r.version??0)+1,this.images[e]=t,this.updateVersion++}removeImage(e){let t=this.images[e];t&&(delete this.images[e],this._imagesIds=null,t.userImage?.onRemove&&t.userImage.onRemove())}listImages(){return this._imagesIds??=Object.keys(this.images),this._imagesIds}_getSpriteImageId(e,t){return e==="default"?t:`${e}:${t}`}setSpriteImages(e,t){let n=this._spriteImagesIds[e]??[],r=[];for(let n in t){let i=this._getSpriteImageId(e,n);r.push(i),i in this.images?this.updateImage(i,t[n],!1):this.addImage(i,t[n])}let i=new Set(r),a=n.filter(e=>!i.has(e));for(let e of a)this.removeImage(e);return this._spriteImagesIds[e]=r,{loaded:r,removed:a}}removeSpriteImages(e){let t=this._spriteImagesIds[e]??[];for(let e of t)this.removeImage(e);return delete this._spriteImagesIds[e],t}removeAllSpriteImages(){let e=Object.values(this._spriteImagesIds).flat();for(let t of e)this.removeImage(t);return this._spriteImagesIds={},e}setMissingImageResolver(e){this.missingImageResolver=e}getImages(e){return new Promise((t,n)=>{let r=!0;if(!this.isLoaded())for(let t of e)this.images[t]||(r=!1);this.isLoaded()||r?t(this._getImagesForIds(e)):this.requestors.push({ids:e,promiseResolve:t})})}async _getImagesForIds(e){let t=new Set(e.filter(e=>!this.getImage(e))),n=this.missingImageResolver;n&&await Promise.allSettled(Array.from(t,e=>n(e)));let r={};for(let n of e){let e=this.getImage(n);e&&(t.delete(n),r[n]={data:e.data.clone(),pixelRatio:e.pixelRatio,sdf:e.sdf,version:e.version,stretchX:e.stretchX,stretchY:e.stretchY,content:e.content,textFitWidth:e.textFitWidth,textFitHeight:e.textFitHeight,hasRenderCallback:!!e.userImage?.render,isWebGLImage:e.isWebGLImage})}for(let e of t)this.fire(new maplibre_gl_ri({id:e})),maplibre_gl_shared_Ft(`Image "${e}" could not be loaded. Please make sure you have added the image before it is needed with map.addImage(), resolved it with map.setMissingStyleImageResolver(), or included it in a "sprite" property in your style.`);return r}beginFrame(){this._renderCallbacksDispatchedThisFrame={}}dispatchRenderCallbacks(e){for(let t of e){if(this._renderCallbacksDispatchedThisFrame[t])continue;this._renderCallbacksDispatchedThisFrame[t]=!0;let e=this.getImage(t);e||maplibre_gl_shared_Ft(`Image with ID: "${t}" was not found`),nv(e)&&this.updateImage(t,e)}}cloneImages(){let e={};for(let t in this.images){let n=this.images[t];e[t]={...n,data:n.data?n.data.clone():null}}return e}},maplibre_gl_Ci=class{constructor(e){this._imageManager=e,this._entries={},this._image=new Ad({width:1,height:1}),this._dirty=!0}destroy(){this._texture&&=(this._texture.destroy(),null),this._entries={},this._image=new Ad({width:1,height:1}),this._dirty=!0}getPixelSize(){let{width:e,height:t}=this._image;return{width:e,height:t}}getPattern(e){let t=this._imageManager.getImage(e);if(!t)return null;let n=this._entries[e];if(n?.image!==t){let n={w:t.data.width+2,h:t.data.height+2,x:0,y:0};this._entries[e]={bin:n,position:new iv(n,t),image:t}}else if(n.position.version!==t.version)n.position.version=t.version;else return n.position;return this._update(),this._entries[e].position}bind(e){let t=e.gl;this._texture?this._dirty&&=(this._texture.update(this._image),!1):(this._texture=new Gd(e,this._image,t.RGBA),this._dirty=!1),this._texture.bind(t.LINEAR,t.CLAMP_TO_EDGE)}_update(){for(let e in this._entries)this._imageManager.getImage(e)||delete this._entries[e];let e=[];for(let t in this._entries)e.push(this._entries[t].bin);let{w:t,h:n}=rv(e),r=this._image;r.resize({width:t||1,height:n||1});for(let e in this._entries){let{bin:t}=this._entries[e],n=t.x+1,i=t.y+1,a=this._entries[e].image.data,o=a.width,s=a.height;Ad.copy(a,r,{x:0,y:0},{x:n,y:i},{width:o,height:s}),Ad.copy(a,r,{x:0,y:s-1},{x:n,y:i-1},{width:o,height:1}),Ad.copy(a,r,{x:0,y:0},{x:n,y:i+s},{width:o,height:1}),Ad.copy(a,r,{x:o-1,y:0},{x:n-1,y:i},{width:1,height:s}),Ad.copy(a,r,{x:0,y:0},{x:n+o,y:i},{width:1,height:s})}this._dirty=!0}};const maplibre_gl_wi=1114111,maplibre_gl_Ti={start:0,end:maplibre_gl_wi};let maplibre_gl_Ei=0;function maplibre_gl_Di(e){let t=/^u\+([0-9a-f]*)(\?+)$/i.exec(e);if(t){let[,e,n]=t;return e.length+n.length>6?null:maplibre_gl_Oi(parseInt(`${e}${`0`.repeat(n.length)}`,16),parseInt(`${e}${`f`.repeat(n.length)}`,16))}let n=/^u\+([0-9a-f]{1,6})(?:-([0-9a-f]{1,6}))?$/i.exec(e);if(!n)return null;let r=parseInt(n[1],16);return maplibre_gl_Oi(r,n[2]===void 0?r:parseInt(n[2],16))}function maplibre_gl_Oi(e,t){return e>t||e>maplibre_gl_wi?null:{start:e,end:Math.min(t,maplibre_gl_wi)}}function maplibre_gl_ki(e,t){return e.ranges.some(({start:e,end:n})=>t>=e&&t<=n)}var maplibre_gl_Ai=class{constructor(e){this.requestManager=e,this._faces={},this._registered=new Set}setFontFaces(e){this._unregisterAll(),this._faces={};for(let[t,n]of Object.entries(e??{})){let e=Array.isArray(n)?n:[n];this._faces[t]=e.map(e=>this._declareFontFace(t,e)).filter(e=>e!==null)}}hasFontFaces(){return Object.keys(this._faces).length>0}async getFontFamily(e,t){for(let n of e.split(`,`))for(let e of this._faces[n.trim()]??[])if(maplibre_gl_ki(e,t)&&(e.loaded??=this._loadFontFace(e),await e.loaded))return e.family;return null}_declareFontFace(e,t){let n=typeof t==`string`?{url:t}:t;if(typeof n?.url!=`string`)return maplibre_gl_shared_Ft(`Ignoring the font face declared for "${e}": it has no URL.`),null;let r=`maplibre-gl-font-face-${maplibre_gl_Ei++}`,i=n[`unicode-range`];if(!i?.length)return{url:n.url,ranges:[maplibre_gl_Ti],family:r};let a=[];for(let e of i){let t=maplibre_gl_Di(e);if(!t){maplibre_gl_shared_Ft(`Ignoring the unicode range "${e}" of the font face at ${n.url}: it is not a valid range.`);continue}a.push(t)}return a.length?{url:n.url,ranges:a,family:r}:null}async _loadFontFace(e){if(typeof FontFace>`u`||typeof document>`u`||!document.fonts)return maplibre_gl_shared_Ft(`Ignoring the font face at ${e.url}: this environment has no CSS Font Loading API.`),!1;let n;try{return n=new FontFace(e.family,await this._downloadFontFile(e.url)),Object.values(this._faces).some(t=>t.includes(e))?(document.fonts.add(n),this._registered.add(n),await n.load(),!0):!1}catch(r){return n&&this._unregister(n),maplibre_gl_shared_Ft(`Ignoring the font face at ${e.url}: ${maplibre_gl_shared_Qe(r).message}`),!1}}async _downloadFontFile(e){let t=await this.requestManager.transformRequest(e,`Glyphs`),n=await maplibre_gl_shared_On(t,new AbortController);if(!n?.data)throw Error(`the response was empty for the font file at ${e}`);return n.data}_unregister(e){document.fonts?.delete(e),this._registered.delete(e)}_unregisterAll(){for(let e of this._registered)document.fonts?.delete(e);this._registered.clear()}destroy(){this._unregisterAll(),this._faces={}}};const maplibre_gl_ji=0x56bc75e2d63100000,maplibre_gl_Mi=new Float64Array(256);for(let e=0;e<256;e++){let t=.5-(e/255)**(1/2.2);maplibre_gl_Mi[e]=t*Math.abs(t)}maplibre_gl_Mi[255]=-0x56bc75e2d63100000;var maplibre_gl_Ni=class{constructor({fontSize:e=24,buffer:t=3,radius:n=8,cutoff:r=.25,fontFamily:i=`sans-serif`,fontWeight:a=`normal`,fontStyle:o=`normal`,lang:s=null}={}){this.buffer=t,this.radius=n,this.cutoff=r,this.lang=s;let c=this.size=e+t*4,l=this._createCanvas(c),u=this.ctx=l.getContext(`2d`,{willReadFrequently:!0});u.font=`${o} ${a} ${e}px ${i}`,u.textBaseline=`alphabetic`,u.textAlign=`left`,u.fillStyle=`black`,this.gridOuter=new Float64Array(c*c),this.gridInner=new Float64Array(c*c),this.f=new Float64Array(c),this.z=new Float64Array(c+1),this.v=new Uint16Array(c)}_createCanvas(e){if(typeof OffscreenCanvas<`u`)return new OffscreenCanvas(e,e);let t=document.createElement(`canvas`);return t.width=t.height=e,t}draw(e){let{width:t,actualBoundingBoxAscent:n,actualBoundingBoxDescent:r,actualBoundingBoxLeft:i,actualBoundingBoxRight:a}=this.ctx.measureText(e),o=Math.ceil(n),s=Math.floor(-i),c=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(a)-s)),l=Math.max(0,Math.min(this.size-this.buffer,o+Math.ceil(r))),u=c+2*this.buffer,d=l+2*this.buffer,f=Math.max(u*d,0),p=new Uint8ClampedArray(f),m={data:p,width:u,height:d,glyphWidth:c,glyphHeight:l,glyphTop:o,glyphLeft:s,glyphAdvance:t};if(c===0||l===0)return m;let{ctx:h,buffer:g,gridInner:_,gridOuter:v}=this;this.lang&&(h.lang=this.lang),h.clearRect(g,g,c,l),h.fillText(e,g-s,g+o);let y=h.getImageData(g,g,c,l);v.fill(maplibre_gl_ji,0,f),_.fill(0,0,f);let b=3;for(let e=0;e<l;e++){let t=(e+g)*u+g;for(let e=0;e<c;e++,b+=4,t++){let e=y.data[b];if(e===0)continue;let n=maplibre_gl_Mi[e];v[t]=Math.max(0,n),_[t]=Math.max(0,-n)}}maplibre_gl_Pi(v,0,0,u,d,u,this.f,this.v,this.z);let x=Math.min(g,1);maplibre_gl_Pi(_,g-x,g-x,c+2*x,l+2*x,u,this.f,this.v,this.z);let S=255/this.radius,C=255*(1-this.cutoff);for(let e=0;e<f;e++){let t=Math.sqrt(v[e])-Math.sqrt(_[e]);p[e]=Math.round(C-S*t)}return m}};function maplibre_gl_Pi(e,t,n,r,i,a,o,s,c){for(let l=t;l<t+r;l++)maplibre_gl_Fi(e,n*a+l,a,i,o,s,c);for(let l=n;l<n+i;l++)maplibre_gl_Fi(e,l*a+t,1,r,o,s,c)}function maplibre_gl_Fi(e,t,n,r,i,a,o){a[0]=0,o[0]=-0x56bc75e2d63100000,o[1]=maplibre_gl_ji,i[0]=e[t];for(let s=1,c=0,l=0;s<r;s++){i[s]=e[t+s*n];let r=s*s;do{let e=a[c];l=(i[s]-i[e]+r-e*e)/(s-e)/2}while(l<=o[c]&&--c>-1);c++,a[c]=s,o[c]=l,o[c+1]=maplibre_gl_ji}for(let s=0,c=0;s<r;s++){for(;o[c+1]<s;)c++;let r=a[c],l=s-r;e[t+s*n]=i[r]+l*l}}const maplibre_gl_Ii=maplibre_gl_shared_P.layout_symbol[`text-font`].default.join(`,`),maplibre_gl_Li=(e,t)=>{let n=new maplibre_gl_Ni(e);return n.buffer=t,n};var maplibre_gl_Ri=class{constructor(e,t,n,r=maplibre_gl_Li){this.requestManager=e,this.localIdeographFontFamily=t,this.entries={},this.lang=n,this.fontFaceManager=new maplibre_gl_Ai(e),this.createRasterizer=r}setURL(e){this.url=e}setFontFaces(e){this.fontFaceManager.setFontFaces(e),this.entries={}}async getGlyphs(e){let t=[];for(let n in e)for(let r of e[n])t.push(this._getAndCacheGlyphsPromise(n,r));let n=await Promise.all(t),r={};for(let{stack:e,id:t,glyph:i}of n)r[e]||={},r[e][t]=i&&{id:i.id,bitmap:i.bitmap.clone(),metrics:i.metrics};return r}async _getAndCacheGlyphsPromise(e,t){this.entries[e]??={glyphs:{},requests:{},ranges:{}};let n=this.entries[e],r=n.glyphs[t];if(r!==void 0)return{stack:e,id:t,glyph:r};let i=t.codePointAt(0),a=this.fontFaceManager.hasFontFaces()?await this.fontFaceManager.getFontFamily(e,i):null;return a?(r=n.glyphs[t]=await this._drawGlyph(n,e,t,a),{stack:e,id:t,glyph:r}):!this.url||Jg(t)||this._charUsesLocalIdeographFontFamily(i)?(r=n.glyphs[t]=await this._drawGlyph(n,e,t),{stack:e,id:t,glyph:r}):await this._downloadAndCacheRangePromise(e,t)}async _downloadAndCacheRangePromise(e,n){let r=n.codePointAt(0),i=this.entries[e],a=Math.floor(r/256);if(i.ranges[a])return{stack:e,id:n,glyph:null};i.requests[a]||=this._loadGlyphRange(e,a);try{let t=await i.requests[a];for(let e in t)i.glyphs[String.fromCodePoint(+e)]=t[+e];return i.ranges[a]=!0,{stack:e,id:n,glyph:t[r]||null}}catch(o){let s=i.glyphs[n]=await this._drawGlyph(i,e,n);return this._warnOnMissingGlyphRange(s,a,r,maplibre_gl_shared_Qe(o)),{stack:e,id:n,glyph:s}}}async _loadGlyphRange(e,t){let n=t*256,r=n+255,i=await this.requestManager.transformRequest(this.url.replace(`{fontstack}`,e).replace(`{range}`,`${n}-${r}`),`Glyphs`),a=await maplibre_gl_shared_On(i,new AbortController);if(!a?.data)throw Error(`Could not load glyph range. range: ${t}, ${n}-${r}`);let o={};for(let e of ev(a.data))o[e.id]=e;return o}_warnOnMissingGlyphRange(e,t,n,r){let i=t*256,a=i+255,o=n.toString(16).padStart(4,`0`).toUpperCase();maplibre_gl_shared_Ft(`Unable to load glyph range ${t}, ${i}-${a}. Rendering codepoint U+${o} locally instead. ${r}`)}_charUsesLocalIdeographFontFamily(e){return!!this.localIdeographFontFamily&&gg(e)}async _drawGlyph(e,t,n,r){let i=(await this._getTinySDF(e,t,n,r)).draw(n),a=/^\p{gc=Cf}+$/u.test(n);return{id:n.codePointAt(0),bitmap:new kd({width:i.width||60,height:i.height||60},i.data),metrics:{width:a?0:i.glyphWidth/2||24,height:i.glyphHeight/2||24,left:i.glyphLeft/2+.5||0,top:i.glyphTop/2-27.5||-8,advance:a?0:i.glyphAdvance/2||24,isDoubleResolution:!0}}}_getTinySDF(e,t,n,r){let i=Jg(n);if(r){let t=i?`clusterTinySDFs`:`fontFaceTinySDFs`;return e[t]??={},e[t][r]||=this._createTinySDF(r,!1,i?3:1),e[t][r]}let a=t===maplibre_gl_Ii&&this.localIdeographFontFamily!==``&&this._charUsesLocalIdeographFontFamily(n.codePointAt(0)),o=a?this.localIdeographFontFamily:t;if(i)return e.clusterTinySDFs??={},e.clusterTinySDFs[o]||=this._createTinySDF(o,!0,3),e.clusterTinySDFs[o];let s=a?`ideographTinySDF`:`tinySDF`;return e[s]||=this._createTinySDF(o),e[s]}async _createTinySDF(e,n=!0,r=1){let i=e?e.split(`,`):[];i.push(`sans-serif`);let a=i.map(e=>/[-\w]+/.test(e)?e:`'${CSS.escape(e)}'`).join(`,`),o=n?this._fontWeight(i[0]):void 0,s=n?this._fontStyle(i[0]):`normal`;if(typeof document<`u`&&document.fonts?.load)try{await document.fonts.load(`${s} ${o||`normal`} 48px ${a}`)}catch(e){maplibre_gl_shared_Ft(`Failed to load font "${a}": ${maplibre_gl_shared_Qe(e).message}`)}return this.createRasterizer({fontSize:48,buffer:Math.max(6,Math.ceil(48*(r-1)/4)),radius:16,cutoff:.25,fontFamily:a,fontWeight:o,fontStyle:s,lang:this.lang},6)}_fontStyle(e){return/italic/i.test(e)?`italic`:/oblique/i.test(e)?`oblique`:`normal`}_fontWeight(e){let t={thin:100,hairline:100,"extra light":200,"ultra light":200,light:300,normal:400,regular:400,medium:500,semibold:600,demibold:600,bold:700,"extra bold":800,"ultra bold":800,black:900,heavy:900,"extra black":950,"ultra black":950},n;for(let[r,i]of Object.entries(t))RegExp(`\\b${r}\\b`,`i`).test(e)&&(n=`${i}`);return n}destroy(){for(let e in this.entries){let t=this.entries[e];t.tinySDF=null,t.ideographTinySDF=null,t.fontFaceTinySDFs={},t.glyphs={},t.requests={},t.ranges={}}this.entries={},this.fontFaceManager.destroy()}};let maplibre_gl_zi;const maplibre_gl_Bi=()=>maplibre_gl_zi||=new maplibre_gl_shared_Rc({anchor:new maplibre_gl_shared_K(maplibre_gl_shared_P.light.anchor,`anchor`),position:new maplibre_gl_shared_K(maplibre_gl_shared_P.light.position,`position`),color:new maplibre_gl_shared_K(maplibre_gl_shared_P.light.color,`color`),intensity:new maplibre_gl_shared_K(maplibre_gl_shared_P.light.intensity,`intensity`)});var maplibre_gl_Vi=class extends maplibre_gl_shared_Fn{constructor(e,t){super(),this._transitionable=new maplibre_gl_shared_Dc(maplibre_gl_Bi(),`light`,t),this.setLight(e),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}getCartesianPosition(){return maplibre_gl_shared_Rt(this.properties.get(`position`))}setLight(e,t={}){if(!this._validate(maplibre_gl_shared_lc.light,e,t))for(let t in e){let n=e[t];t.endsWith(`-transition`)?this._transitionable.setTransition(t.slice(0,-maplibre_gl_shared_wc.length),n):this._transitionable.setValue(t,n)}}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}_validate(e,t,n){return maplibre_gl_shared_mc(this,e,{value:t},n)}};let maplibre_gl_Hi;const maplibre_gl_Ui=()=>maplibre_gl_Hi||=new maplibre_gl_shared_Rc({"sky-color":new maplibre_gl_shared_K(maplibre_gl_shared_P.sky[`sky-color`],`sky-color`),"horizon-color":new maplibre_gl_shared_K(maplibre_gl_shared_P.sky[`horizon-color`],`horizon-color`),"fog-color":new maplibre_gl_shared_K(maplibre_gl_shared_P.sky[`fog-color`],`fog-color`),"fog-ground-blend":new maplibre_gl_shared_K(maplibre_gl_shared_P.sky[`fog-ground-blend`],`fog-ground-blend`),"horizon-fog-blend":new maplibre_gl_shared_K(maplibre_gl_shared_P.sky[`horizon-fog-blend`],`horizon-fog-blend`),"sky-horizon-blend":new maplibre_gl_shared_K(maplibre_gl_shared_P.sky[`sky-horizon-blend`],`sky-horizon-blend`),"atmosphere-blend":new maplibre_gl_shared_K(maplibre_gl_shared_P.sky[`atmosphere-blend`],`atmosphere-blend`)});var maplibre_gl_Wi=class extends maplibre_gl_shared_Fn{constructor(e,t){super(),this._transitionable=new maplibre_gl_shared_Dc(maplibre_gl_Ui(),`sky`,t),this.setSky(e),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new maplibre_gl_shared_G(0))}setSky(e,t={}){if(!this._validate(maplibre_gl_shared_lc.sky,e,t)){e||={"sky-color":`transparent`,"horizon-color":`transparent`,"fog-color":`transparent`,"fog-ground-blend":1,"atmosphere-blend":0};for(let t in e){let n=e[t];t.endsWith(`-transition`)?this._transitionable.setTransition(t.slice(0,-maplibre_gl_shared_wc.length),n):this._transitionable.setValue(t,n)}}}getSky(){return this._transitionable.serialize()}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}_validate(e,t,n={}){return maplibre_gl_shared_mc(this,e,{value:t},n)}calculateFogBlendOpacity(e){return e<60?0:e<70?(e-60)/10:1}},maplibre_gl_Gi=class{constructor(e,t){this.width=e,this.height=t,this.nextRow=0,this.data=new Uint8Array(this.width*this.height),this.dashEntry={}}getDash(e,t){let n=e.join(`,`)+String(t);return this.dashEntry[n]||=this.addDash(e,t),this.dashEntry[n]}getDashRanges(e,t,n){let r=e.length%2==1,i=[],a=r?-e[e.length-1]*n:0,o=e[0]*n,s=!0;i.push({left:a,right:o,isDash:s,zeroLength:e[0]===0});let c=e[0];for(let t=1;t<e.length;t++){s=!s;let r=e[t];a=c*n,c+=r,o=c*n,i.push({left:a,right:o,isDash:s,zeroLength:r===0})}return i}addRoundDash(e,t,n){let r=t/2;for(let t=-n;t<=n;t++){let i=this.nextRow+n+t,a=this.width*i,o=0,s=e[o];for(let i=0;i<this.width;i++){i/s.right>1&&(s=e[++o]);let c=Math.abs(i-s.left),l=Math.abs(i-s.right),u=Math.min(c,l),d,f=t/n*(r+1);if(s.isDash){let e=r-Math.abs(f);d=Math.sqrt(u*u+e*e)}else d=r-Math.sqrt(u*u+f*f);this.data[a+i]=Math.max(0,Math.min(255,d+128))}}}addRegularDash(e){for(let t=e.length-1;t>=0;--t){let n=e[t],r=e[t+1];n.zeroLength?e.splice(t,1):r?.isDash===n.isDash&&(r.left=n.left,e.splice(t,1))}let t=e[0],n=e[e.length-1];t.isDash===n.isDash&&(t.left=n.left-this.width,n.right=t.right+this.width);let r=this.width*this.nextRow,i=0,a=e[i];for(let t=0;t<this.width;t++){t/a.right>1&&(a=e[++i]);let n=Math.abs(t-a.left),o=Math.abs(t-a.right),s=Math.min(n,o),c=a.isDash?s:-s;this.data[r+t]=Math.max(0,Math.min(255,c+128))}}addDash(e,t){let n=t?7:0,r=2*n+1;if(this.nextRow+r>this.height)return maplibre_gl_shared_Ft(`LineAtlas out of space`),null;let i=0;for(let t of e)i+=t;if(i!==0){let r=this.width/i,a=this.getDashRanges(e,this.width,r);t?this.addRoundDash(a,r,n):this.addRegularDash(a)}let a={y:this.nextRow+n,height:2*n,width:i};return this.nextRow+=r,this.dirty=!0,a}bind(e){let t=e.gl;this.texture?(t.bindTexture(t.TEXTURE_2D,this.texture),this.dirty&&(this.dirty=!1,t.texSubImage2D(t.TEXTURE_2D,0,0,0,this.width,this.height,t.ALPHA,t.UNSIGNED_BYTE,this.data))):(this.texture=t.createTexture(),t.bindTexture(t.TEXTURE_2D,this.texture),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.REPEAT),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.REPEAT),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texImage2D(t.TEXTURE_2D,0,t.ALPHA,this.width,this.height,0,t.ALPHA,t.UNSIGNED_BYTE,this.data))}};function maplibre_gl_Ki(e){if(!e)return!1;let t=globalThis.location;if(!t)return!1;try{return new URL(e,t.href).origin!==t.origin}catch{return!1}}function maplibre_gl_qi(){let e="file:///home/runner/work/sdk-web/sdk-web/node_modules/.pnpm/maplibre-gl@6.9.0/node_modules/maplibre-gl/dist/maplibre-gl.mjs";if(!/^https?:/.test(e))return``;let t=e.endsWith(`-dev.mjs`)?`maplibre-gl-worker-dev.mjs`:`maplibre-gl-worker.mjs`;return new URL(`./${t}`,e).href}function maplibre_gl_Ji(e,t){if(t)try{return new Worker(e,{type:`module`})}catch(e){console.warn(`Module worker not supported, falling back to classic worker`,e)}return new Worker(e)}async function maplibre_gl_Yi(e){let t=await fetch(e);if(!t.ok)throw Error(`Failed to fetch worker script (${t.status}): ${e}`);let n=await t.text(),r=new Blob([n],{type:`text/javascript`});return URL.createObjectURL(r)}function maplibre_gl_Xi(e){let t=new Blob([`import ${JSON.stringify(__webpack_require__(586)(e).href)}`],{type:`text/javascript`});return URL.createObjectURL(t)}async function maplibre_gl_Zi(){let e=maplibre_gl_shared_gn.WORKER_URL||maplibre_gl_qi(),t=!e?.endsWith(`.cjs`);if(!maplibre_gl_Ki(e))return maplibre_gl_Ji(e,t);if(t){let n=maplibre_gl_Xi(e);try{return maplibre_gl_Ji(n,t)}finally{URL.revokeObjectURL(n)}}let n=await maplibre_gl_Yi(e);try{return maplibre_gl_Ji(n,t)}finally{URL.revokeObjectURL(n)}}const maplibre_gl_Qi=`maplibre_preloaded_worker_pool`;var maplibre_gl_$i=class e{constructor(){this.active={},this.workersPromise=null}async acquire(t){if(this.active[t]=!0,!this.workersPromise){let t=[];for(;t.length<e.workerCount;)t.push(maplibre_gl_Zi());this.workersPromise=Promise.all(t)}return(await this.workersPromise).slice()}release(e){if(delete this.active[e],this.numActive()===0&&this.workersPromise){let e=this.workersPromise;this.workersPromise=null,e.then(e=>{for(let t of e)t.terminate()})}}isPreloaded(){return!!this.active[maplibre_gl_Qi]}numActive(){return Object.keys(this.active).length}};const maplibre_gl_ea=Math.floor(maplibre_gl_Br.hardwareConcurrency/2);maplibre_gl_$i.workerCount=maplibre_gl_shared_Ht(globalThis)?Math.max(Math.min(maplibre_gl_ea,3),1):1;let maplibre_gl_ta;function maplibre_gl_na(){return maplibre_gl_ta||=new maplibre_gl_$i,maplibre_gl_ta}function maplibre_gl_ra(){maplibre_gl_na().acquire(maplibre_gl_Qi)}function maplibre_gl_ia(){let e=maplibre_gl_ta;e&&(e.isPreloaded()&&e.numActive()===1?(e.release(maplibre_gl_Qi),maplibre_gl_ta=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()`))}var maplibre_gl_aa=class{constructor(e,t){this.workerPool=e,this.actors=[],this.currentActor=0,this.id=t,this.removed=!1,this.actorsPromise=this.initActors(t)}async initActors(e){let t=await this.workerPool.acquire(e);if(this.removed)return[];if(this.actors=t.map((t,n)=>{let r=new maplibre_gl_shared_sb(t,e);return r.name=`Worker ${n}`,r}),!this.actors.length)throw Error(`No actors found`);return this.actors}async broadcast(e,t){let n=await this.actorsPromise;return Promise.all(n.map(n=>n.sendAsync({type:e,data:t})))}async getActor(){let e=await this.actorsPromise;return this.currentActor=(this.currentActor+1)%e.length,e[this.currentActor]}async waitForInitComplete(){this.actors.length===0&&await this.actorsPromise}getReadyActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(e=!0){this.removed=!0;for(let e of this.actors)e.remove();this.actors=[],e&&this.workerPool.release(this.id)}async registerMessageHandler(e,t){let n=await this.actorsPromise;for(let r of n)r.registerMessageHandler(e,t)}async unregisterMessageHandler(e){let t=await this.actorsPromise;for(let n of t)n.unregisterMessageHandler(e)}};let maplibre_gl_oa;function maplibre_gl_sa(){return maplibre_gl_oa||(maplibre_gl_oa=new maplibre_gl_aa(maplibre_gl_na(),maplibre_gl_shared_bn),maplibre_gl_oa.registerMessageHandler(`GR`,(e,t,n)=>maplibre_gl_shared_En(t,n))),maplibre_gl_oa}function maplibre_gl_ca(e,t){let n=maplibre_gl_shared_b();return maplibre_gl_shared_E(n,n,[1,1,0]),maplibre_gl_shared_D(n,n,[e.width*.5,e.height*.5,1]),e.calculatePosMatrix?maplibre_gl_shared_T(n,n,e.calculatePosMatrix(t.toUnwrapped())):n}function maplibre_gl_la(e,t,n){if(e)for(let r of e){let e=t[r];if(e?.source===n&&e.type===`fill-extrusion`)return!0}else for(let e in t){let r=t[e];if(r.source===n&&r.type===`fill-extrusion`)return!0}return!1}function maplibre_gl_ua(e,t,n,r,i,a,o){let s=maplibre_gl_la(i?.layers??null,t,e.id),c=a.maxPitchScaleFactor(),l=e.tilesIn(r,c,s);l.sort(maplibre_gl_pa);let u=[];for(let r of l)u.push({wrappedTileID:r.tileID.wrapped().key,queryResults:r.tile.queryRenderedFeatures(t,n,e.getState(),r.queryGeometry,r.cameraQueryGeometry,r.scale,i,a,c,maplibre_gl_ca(a,r.tileID),o?(e,t)=>o(r.tileID,e,t):void 0)});return maplibre_gl_ha(maplibre_gl_ma(u),e)}function maplibre_gl_da(e,t,n,r,i,a,o){let s={},c=a.queryRenderedSymbols(r),l=[];for(let e of Object.keys(c).map(Number))l.push(o[e]);l.sort(maplibre_gl_pa);for(let n of l){let r=n.featureIndex.lookupSymbolFeatures(c[n.bucketInstanceId],t,n.bucketIndex,n.sourceLayerIndex,{filterSpec:i.filter,globalState:i.globalState},i.layers,i.availableImages,e);for(let e in r){s[e]||=[];let t=r[e];t.sort((e,t)=>{let r=n.featureSortOrder;if(r){let n=r.indexOf(e.featureIndex);return r.indexOf(t.featureIndex)-n}return t.featureIndex-e.featureIndex});for(let n of t)s[e].push(n)}}return maplibre_gl_ga(s,e,n)}function maplibre_gl_fa(e,t){let n=e.getRenderableIds().map(t=>e.getTileByID(t)),r=[],i={};for(let e of n){let n=e.tileID.canonical.key;i[n]||(i[n]=!0,e.querySourceFeatures(r,t))}return r}function maplibre_gl_pa(e,t){let n=e.tileID,r=t.tileID;return n.overscaledZ-r.overscaledZ||n.canonical.y-r.canonical.y||n.wrap-r.wrap||n.canonical.x-r.canonical.x}function maplibre_gl_ma(e){let t={},n={};for(let{queryResults:r,wrappedTileID:i}of e){n[i]||={};let e=n[i];for(let n in r){let i=r[n];e[n]||={};let a=e[n];t[n]||=[];for(let e of i)a[e.featureIndex]||(a[e.featureIndex]=!0,t[n].push(e))}}return t}function maplibre_gl_ha(e,t){for(let n in e)for(let r of e[n])maplibre_gl_a(r,t);return e}function maplibre_gl_ga(e,t,n){for(let r in e)for(let i of e[r]){let e=n[t[r].source];maplibre_gl_a(i,e)}return e}function maplibre_gl_a(e,t){let n=e.feature,r=t.getFeatureState(n.layer[`source-layer`],n.id);n.source=n.layer.source,n.layer[`source-layer`]&&(n.sourceLayer=n.layer[`source-layer`]),n.state=r}async function maplibre_gl_va(e,t,n,r){let i=e;if(e.url?i=(await maplibre_gl_shared_Dn(await t.transformRequest(e.url,`Source`),n)).data:await maplibre_gl_Br.frameAsync(n,r),!i)return null;let a=maplibre_gl_shared_St(maplibre_gl_shared_xt(i,e),[`tiles`,`minzoom`,`maxzoom`,`attribution`,`bounds`,`scheme`,`tileSize`,`encoding`]);return`vector_layers`in i&&i.vector_layers&&(a.vectorLayerIds=i.vector_layers.map(e=>e.id)),a}var maplibre_gl_ya=class e{constructor(e,t){e&&(t?this.setSouthWest(e).setNorthEast(t):Array.isArray(e)&&(e.length===4?this.setSouthWest([e[0],e[1]]).setNorthEast([e[2],e[3]]):this.setSouthWest(e[0]).setNorthEast(e[1])))}setNorthEast(e){return this._ne=e instanceof maplibre_gl_shared_Mp?new maplibre_gl_shared_Mp(e.lng,e.lat):maplibre_gl_shared_Mp.convert(e),this}setSouthWest(e){return this._sw=e instanceof maplibre_gl_shared_Mp?new maplibre_gl_shared_Mp(e.lng,e.lat):maplibre_gl_shared_Mp.convert(e),this}extend(t){let n=this._sw,r=this._ne,i,a;if(t instanceof maplibre_gl_shared_Mp)i=t,a=t;else if(t instanceof e){if(i=t._sw,a=t._ne,!i||!a)return this}else{if(Array.isArray(t)){if(t.length===4||t.every(Array.isArray)){let n=t;return this.extend(e.convert(n))}{let e=t;return this.extend(maplibre_gl_shared_Mp.convert(e))}}return t&&(`lng`in t||`lon`in t)&&`lat`in t?this.extend(maplibre_gl_shared_Mp.convert(t)):this}return!n&&!r?(this._sw=new maplibre_gl_shared_Mp(i.lng,i.lat),this._ne=new maplibre_gl_shared_Mp(a.lng,a.lat)):(n.lng=Math.min(i.lng,n.lng),n.lat=Math.min(i.lat,n.lat),r.lng=Math.max(a.lng,r.lng),r.lat=Math.max(a.lat,r.lat)),this}getCenter(){return new maplibre_gl_shared_Mp((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 maplibre_gl_shared_Mp(this.getWest(),this.getNorth())}getSouthEast(){return new maplibre_gl_shared_Mp(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(e){let{lng:t,lat:n}=maplibre_gl_shared_Mp.convert(e),r=this._sw.lat<=n&&n<=this._ne.lat,i=this._sw.lng<=t&&t<=this._ne.lng;return this._sw.lng>this._ne.lng&&(i=this._sw.lng>=t&&t>=this._ne.lng),r&&i}intersects(t){if(t=e.convert(t),!(t.getNorth()>=this.getSouth()&&t.getSouth()<=this.getNorth()))return!1;let n=Math.abs(this.getEast()-this.getWest()),r=Math.abs(t.getEast()-t.getWest());if(n>=360||r>=360)return!0;let i=maplibre_gl_shared_bt(this.getWest(),-180,180),a=maplibre_gl_shared_bt(this.getEast(),-180,180),o=maplibre_gl_shared_bt(t.getWest(),-180,180),s=maplibre_gl_shared_bt(t.getEast(),-180,180),c=i>a,l=o>s;return c&&l?!0:c?s>=i||o<=a:l?a>=o||i<=s:o<=a&&s>=i}static convert(t){return t instanceof e||!t?t:new e(t)}static fromLngLat(t,n=0){let r=360*n/40075017,i=r/Math.cos(Math.PI/180*t.lat);return new e(new maplibre_gl_shared_Mp(t.lng-i,t.lat-r),new maplibre_gl_shared_Mp(t.lng+i,t.lat+r))}adjustAntiMeridian(){let t=new maplibre_gl_shared_Mp(this._sw.lng,this._sw.lat),n=new maplibre_gl_shared_Mp(this._ne.lng,this._ne.lat);return t.lng>n.lng?new e(t,new maplibre_gl_shared_Mp(n.lng+360,n.lat)):new e(t,n)}},maplibre_gl_ba=class{constructor(e,t,n){this.bounds=maplibre_gl_ya.convert(this.validateBounds(e)),this.minzoom=t||0,this.maxzoom=n||24}validateBounds(e){return!Array.isArray(e)||e.length!==4?[-180,-90,180,90]:[Math.max(-180,e[0]),Math.max(-90,e[1]),Math.min(180,e[2]),Math.min(90,e[3])]}contains(e){let t=2**e.z,n={minX:Math.floor(maplibre_gl_shared_Fp(this.bounds.getWest())*t),minY:Math.floor(maplibre_gl_shared_Ip(this.bounds.getNorth())*t),maxX:Math.ceil(maplibre_gl_shared_Fp(this.bounds.getEast())*t),maxY:Math.ceil(maplibre_gl_shared_Ip(this.bounds.getSouth())*t)};return e.x>=n.minX&&e.x<n.maxX&&e.y>=n.minY&&e.y<n.maxY}},maplibre_gl_xa=class extends maplibre_gl_shared_Fn{constructor(e,t,n,r){if(super(),this.id=e,this.dispatcher=n,this.type=`vector`,this.minzoom=0,this.maxzoom=22,this.scheme=`xyz`,this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,maplibre_gl_shared_xt(this,maplibre_gl_shared_St(t,[`url`,`scheme`,`tileSize`,`promoteId`,`encoding`])),this._options=maplibre_gl_shared_xt({type:`vector`},t),this._collectResourceTiming=t.collectResourceTiming,this.tileSize!==512)throw Error(`vector tile sources must have a tileSize of 512`);this.setEventedParent(r)}async load(e=!1){this._loaded=!1,this.fire(new maplibre_gl_K(`dataloading`)),this._tileJSONRequest=new AbortController;try{let t=await maplibre_gl_va(this._options,this.map._requestManager,this._tileJSONRequest,this.map._ownerWindow);this._tileJSONRequest=null,this._loaded=!0,t&&(maplibre_gl_shared_xt(this,t),t.bounds&&(this.tileBounds=new maplibre_gl_ba(t.bounds,this.minzoom,this.maxzoom)),this.fire(new maplibre_gl_K(`data`,{sourceDataType:`metadata`})),this.fire(new maplibre_gl_K(`data`,{sourceDataType:`content`,sourceDataChanged:e})))}catch(e){this._tileJSONRequest=null,this._loaded=!0,maplibre_gl_shared_mn(e)||this.fire(new maplibre_gl_shared_Pn(maplibre_gl_shared_Qe(e)))}}loaded(){return this._loaded}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}onAdd(e){this.map=e,this.load()}setSourceProperty(e){this._tileJSONRequest&&this._tileJSONRequest.abort(),e(),this.load(!0)}setTiles(e){return this.setSourceProperty(()=>{this.tiles=e,this._options.tiles=e}),this}setUrl(e){return this.setSourceProperty(()=>{this.url=e,this._options.url=e}),this}onRemove(){this._tileJSONRequest&&=(this._tileJSONRequest.abort(),null)}serialize(){return maplibre_gl_shared_xt({},this._options)}async loadTile(e){let t=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),n={request:await this.map._requestManager.transformRequest(t,`Tile`),uid:e.uid,tileID:e.tileID,zoom:e.tileID.overscaledZ,tileSize:this.tileSize*e.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,subdivisionGranularity:this.map.style.projection.subdivisionGranularity,encoding:this.encoding,overzoomParameters:await this._getOverzoomParameters(e),etag:e.etag};n.request.collectResourceTiming=this._collectResourceTiming,await this.dispatcher.waitForInitComplete();let r=`RT`;if(!e.actor||e.state===`expired`)e.actor=this.dispatcher.getReadyActor(),r=`LT`;else if(e.state===`loading`)return new Promise((t,n)=>{e.reloadPromise={resolve:t,reject:n}});e.abortController=new AbortController;try{let t=await e.actor.sendAsync({type:r,data:n},e.abortController);if(delete e.abortController,e.aborted)return;this._afterTileLoadWorkerResponse(e,t);let i={};return t?.etagUnmodified&&(i.unmodified=!0),i}catch(t){if(delete e.abortController,e.aborted||maplibre_gl_shared_mn(t))return;if(t&&t.status!==404)throw t;this._afterTileLoadWorkerResponse(e,null)}}async _getOverzoomParameters(e){if(e.tileID.canonical.z<=this.maxzoom||this.map._zoomLevelsToOverscale===void 0)return;let t=e.tileID.scaledTo(this.maxzoom).canonical,n=t.url(this.tiles,this.map.getPixelRatio(),this.scheme);return{maxZoomTileID:t,overzoomRequest:await this.map._requestManager.transformRequest(n,`Tile`)}}_afterTileLoadWorkerResponse(e,t){if(t?.resourceTiming&&(e.resourceTiming=t.resourceTiming),t&&this.map._refreshExpiredTiles&&e.setExpiryData(t),e.etag=t?.etag,e.loadVectorData(t,this.map.painter),e.reloadPromise){let t=e.reloadPromise;e.reloadPromise=null,this.loadTile(e).then(t.resolve).catch(t.reject)}}async abortTile(e){e.abortController&&(e.abortController.abort(),delete e.abortController),e.actor&&await e.actor.sendAsync({type:`AT`,data:{uid:e.uid,type:this.type,source:this.id}})}async unloadTile(e){e.unloadVectorData(),e.actor&&await e.actor.sendAsync({type:`RMT`,data:{uid:e.uid,type:this.type,source:this.id}})}hasTransition(){return!1}},maplibre_gl_Sa=class extends maplibre_gl_shared_Fn{constructor(e,t,n,r){super(),this.id=e,this.dispatcher=n,this.setEventedParent(r),this.type=`raster`,this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme=`xyz`,this.tileSize=512,this._loaded=!1,this._premultiplyAlpha=!0,this._options=maplibre_gl_shared_xt({type:`raster`},t),maplibre_gl_shared_xt(this,maplibre_gl_shared_St(t,[`url`,`scheme`,`tileSize`]))}async load(e=!1){this._loaded=!1,this.fire(new maplibre_gl_K(`dataloading`)),this._tileJSONRequest=new AbortController;try{let t=await maplibre_gl_va(this._options,this.map._requestManager,this._tileJSONRequest,this.map._ownerWindow);this._tileJSONRequest=null,this._loaded=!0,t&&(maplibre_gl_shared_xt(this,t),t.bounds&&(this.tileBounds=new maplibre_gl_ba(t.bounds,this.minzoom,this.maxzoom)),this.fire(new maplibre_gl_K(`data`,{sourceDataType:`metadata`})),this.fire(new maplibre_gl_K(`data`,{sourceDataType:`content`,sourceDataChanged:e})))}catch(e){this._tileJSONRequest=null,this._loaded=!0,maplibre_gl_shared_mn(e)||this.fire(new maplibre_gl_shared_Pn(maplibre_gl_shared_Qe(e)))}}loaded(){return this._loaded}onAdd(e){this.map=e,this.load()}onRemove(){this._tileJSONRequest&&=(this._tileJSONRequest.abort(),null)}setSourceProperty(e){this._tileJSONRequest&&=(this._tileJSONRequest.abort(),null),e(),this.load(!0)}setTiles(e){return this.setSourceProperty(()=>{this.tiles=e,this._options.tiles=e}),this}setUrl(e){return this.setSourceProperty(()=>{this.url=e,this._options.url=e}),this}serialize(){return maplibre_gl_shared_xt({},this._options)}setPremultiplyAlpha(e){return this._premultiplyAlpha===e||this.setSourceProperty(()=>{this._premultiplyAlpha=e}),this}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}async loadTile(e){let t=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),n=this._premultiplyAlpha,r=n?void 0:{premultiplyAlpha:`none`};e.abortController=new AbortController;try{let i=await maplibre_gl_Gr.transformAndGetImage(this.map._requestManager,t,`Tile`,e.abortController,this.map._refreshExpiredTiles,r);if(delete e.abortController,e.aborted){e.state=`unloaded`;return}if(i){this.map._refreshExpiredTiles&&(i.cacheControl||i.expires)&&e.setExpiryData({cacheControl:i.cacheControl,expires:i.expires});let t=this.map.painter.context,r=t.gl,a=i.data??new Ad({width:1,height:1},new Uint8Array(4));e.texture=this.map.painter.getTileTexture(a.width),e.texture?e.texture.update(a,{useMipmap:!0,premultiply:n}):(e.texture=new Gd(t,a,r.RGBA,{useMipmap:!0,premultiply:n}),e.texture.bind(r.LINEAR,r.CLAMP_TO_EDGE,r.LINEAR_MIPMAP_NEAREST)),e.state=`loaded`}}catch(t){if(delete e.abortController,e.aborted)e.state=`unloaded`;else if(t)throw e.state=`errored`,t}}async abortTile(e){e.abortController&&(e.abortController.abort(),delete e.abortController)}async unloadTile(e){e.texture&&this.map.painter.saveTileTexture(e.texture)}hasTransition(){return!1}},maplibre_gl_Ca=class extends maplibre_gl_Sa{constructor(e,t,n,r){super(e,t,n,r),this.type=`raster-dem`,this.maxzoom=22,this._options=maplibre_gl_shared_xt({type:`raster-dem`},t),this.encoding=t.encoding||`mapbox`,this.redFactor=t.redFactor,this.greenFactor=t.greenFactor,this.blueFactor=t.blueFactor,this.baseShift=t.baseShift}async loadTile(e){let t=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);e.neighboringTiles=this._getNeighboringTiles(e.tileID),e.abortController=new AbortController;try{let n=await maplibre_gl_Gr.transformAndGetImage(this.map._requestManager,t,`Tile`,e.abortController,this.map._refreshExpiredTiles,{colorSpaceConversion:`none`});if(delete e.abortController,e.aborted){e.state=`unloaded`;return}if(n){if(this.map._refreshExpiredTiles&&(n.cacheControl||n.expires)&&e.setExpiryData({cacheControl:n.cacheControl,expires:n.expires}),!n.data){e.state=`loaded`;return}let t=n.data,r=maplibre_gl_shared_Ut(t)&&maplibre_gl_shared_f()?t:await this.readImageNow(t),i={type:this.type,uid:e.uid,source:this.id,rawImageData:r,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};if(e.actor&&e.state!==`expired`&&e.state!==`reloading`)return;await this.dispatcher.waitForInitComplete(),(!e.actor||e.state===`expired`)&&(e.actor=this.dispatcher.getReadyActor()),e.dem=await e.actor.sendAsync({type:`LDT`,data:i}),e.needsHillshadePrepare=!0,e.needsTerrainPrepare=!0,e.needsColorReliefPrepare=!0,e.state=`loaded`}}catch(t){if(delete e.abortController,e.aborted)e.state=`unloaded`;else if(t)throw e.state=`errored`,t}}async readImageNow(e){if(typeof VideoFrame<`u`&&maplibre_gl_shared_m()){let t=e.width+4,n=e.height+4;try{return new Ad({width:t,height:n},await maplibre_gl_shared_qt(e,-2,-2,t,n))}catch{}}return maplibre_gl_Br.getImageData(e,2)}_getNeighboringTiles(e){let t=e.canonical,n=2**t.z,r=(t.x-1+n)%n,i=t.x===0?e.wrap-1:e.wrap,a=(t.x+1+n)%n,o=t.x+1===n?e.wrap+1:e.wrap,s={};return s[new maplibre_gl_shared_fb(e.overscaledZ,i,t.z,r,t.y).key]={backfilled:!1},s[new maplibre_gl_shared_fb(e.overscaledZ,o,t.z,a,t.y).key]={backfilled:!1},t.y>0&&(s[new maplibre_gl_shared_fb(e.overscaledZ,i,t.z,r,t.y-1).key]={backfilled:!1},s[new maplibre_gl_shared_fb(e.overscaledZ,e.wrap,t.z,t.x,t.y-1).key]={backfilled:!1},s[new maplibre_gl_shared_fb(e.overscaledZ,o,t.z,a,t.y-1).key]={backfilled:!1}),t.y+1<n&&(s[new maplibre_gl_shared_fb(e.overscaledZ,i,t.z,r,t.y+1).key]={backfilled:!1},s[new maplibre_gl_shared_fb(e.overscaledZ,e.wrap,t.z,t.x,t.y+1).key]={backfilled:!1},s[new maplibre_gl_shared_fb(e.overscaledZ,o,t.z,a,t.y+1).key]={backfilled:!1}),s}async unloadTile(e){e.demTexture&&this.map.painter.saveTileTexture(e.demTexture),e.fbo&&(e.fbo.destroy(),delete e.fbo),e.dem&&delete e.dem,delete e.neighboringTiles,e.state=`unloaded`,e.actor&&await e.actor.sendAsync({type:`RDT`,data:{type:this.type,uid:e.uid,source:this.id}})}};function maplibre_gl_wa(e,t){return t?e.properties[t]:e.id}function maplibre_gl_Ta(e,t){let n=new Map;if(e==null||e.type==null)return n;if(e.type===`Feature`){let r=maplibre_gl_wa(e,t);return r==null?void 0:(n.set(r,e),n)}if(e.type===`FeatureCollection`){let r=new Set;for(let i of e.features){let e=maplibre_gl_wa(i,t);if(e==null||r.has(e))return;r.add(e),n.set(e,i)}return n}}function maplibre_gl_Ea(e,t,n){let r=[];if(t.removeAll)e.clear();else if(t.remove)for(let n of t.remove){let t=e.get(n);t&&(r.push(t.geometry),e.delete(n))}if(t.add)for(let i of t.add){let t=maplibre_gl_wa(i,n);if(t==null)continue;let a=e.get(t);a&&r.push(a.geometry),r.push(i.geometry),e.set(t,i)}if(t.update)for(let n of t.update){let t=e.get(n.id);if(!t)continue;let i=!!n.newGeometry,a=n.removeAllProperties||n.removeProperties?.length>0||n.addOrUpdateProperties?.length>0;if(!i&&!a)continue;r.push(t.geometry);let o={...t};if(e.set(n.id,o),i&&(r.push(n.newGeometry),o.geometry=n.newGeometry),a){if(o.properties=n.removeAllProperties?{}:{...o.properties||{}},n.removeProperties)for(let e of n.removeProperties)delete o.properties[e];if(n.addOrUpdateProperties)for(let{key:e,value:t}of n.addOrUpdateProperties)o.properties[e]=t}}return r}function maplibre_gl_Da(e,t,n){if(!e)return t||{};if(!t)return e||{};n&&(maplibre_gl_Aa(e.add,n),maplibre_gl_Aa(t.add,n));let r=maplibre_gl_Ma(e),i=maplibre_gl_Ma(t);maplibre_gl_Oa(r,i);let a={};if((r.removeAll||i.removeAll)&&(a.removeAll=!0),a.remove=new Set([...r.remove,...i.remove]),a.add=new Map([...r.add,...i.add]),a.update=new Map([...r.update,...i.update]),a.remove.size&&a.add.size)for(let e of a.add.keys())a.remove.delete(e);let o=maplibre_gl_Na(a);return n&&maplibre_gl_ja(o.add,n),o}function maplibre_gl_Oa(e,t){t.removeAll&&(e.add.clear(),e.update.clear(),e.remove.clear(),t.remove.clear());for(let n of t.remove)e.add.delete(n),e.update.delete(n);for(let[n,r]of t.update){let i=e.update.get(n);i&&(t.update.set(n,maplibre_gl_ka(i,r)),e.update.delete(n))}}function maplibre_gl_ka(e,t){let n={id:e.id};if(t.removeAllProperties&&(delete e.removeProperties,delete e.addOrUpdateProperties,delete t.removeProperties),t.removeProperties&&e.addOrUpdateProperties){let n=new Set(t.removeProperties);e.addOrUpdateProperties=e.addOrUpdateProperties.filter(e=>!n.has(e.key))}return(e.removeAllProperties||t.removeAllProperties)&&(n.removeAllProperties=!0),(e.removeProperties||t.removeProperties)&&(n.removeProperties=[...e.removeProperties||[],...t.removeProperties||[]]),(e.addOrUpdateProperties||t.addOrUpdateProperties)&&(n.addOrUpdateProperties=[...e.addOrUpdateProperties||[],...t.addOrUpdateProperties||[]]),(e.newGeometry||t.newGeometry)&&(n.newGeometry=t.newGeometry||e.newGeometry),n}function maplibre_gl_Aa(e,t){if(e)for(let n of e){let e=maplibre_gl_wa(n,t);e!=null&&(n.id=e)}}function maplibre_gl_ja(e,t){if(e)for(let n of e)maplibre_gl_wa(n,t)!=null&&delete n.id}function maplibre_gl_Ma(e){if(!e)return{};let t={};return t.removeAll=e.removeAll,t.remove=new Set(e.remove||[]),t.add=new Map(e.add?.map(e=>[e.id,e])),t.update=new Map(e.update?.map(e=>[e.id,e])),t}function maplibre_gl_Na(e){let t={};return e.removeAll&&(t.removeAll=e.removeAll),e.remove&&(t.remove=Array.from(e.remove)),e.add&&(t.add=Array.from(e.add.values())),e.update&&(t.update=Array.from(e.update.values())),t}function maplibre_gl_Pa(e){return!e||e.length===0?[]:typeof e[0]==`number`?[e]:e.flatMap(e=>maplibre_gl_Pa(e))}function maplibre_gl_Fa(e){return e.type===`GeometryCollection`?e.geometries.flatMap(e=>maplibre_gl_Fa(e)):maplibre_gl_Pa(e.coordinates)}function maplibre_gl_Ia(e){let t=new maplibre_gl_ya,n;switch(e.type){case`FeatureCollection`:n=e.features.flatMap(e=>maplibre_gl_Fa(e.geometry));break;case`Feature`:n=maplibre_gl_Fa(e.geometry);break;default:n=maplibre_gl_Fa(e)}if(n.length===0)return t;for(let e of n){let[n,r]=e;t.extend([n,r])}return t}function maplibre_gl_La({x:e,y:t,z:n},r=0){let i=maplibre_gl_shared_Rp((e-r)/2**n),a=maplibre_gl_shared_zp((t+1+r)/2**n),o=maplibre_gl_shared_Rp((e+1+r)/2**n),s=maplibre_gl_shared_zp((t-r)/2**n);return new maplibre_gl_ya([i,a],[o,s])}var maplibre_gl_Ra=class extends maplibre_gl_shared_Fn{constructor(e,t,n,r){super(),this.id=e,this.type=`geojson`,this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._removed=!1,this._isUpdatingWorker=!1,this._pendingWorkerUpdate={data:t.data},this.actorPromise=n.getActor(),this.setEventedParent(r),this._data=typeof t.data==`string`?{url:t.data}:{geojson:t.data},this._options=maplibre_gl_shared_xt({},t),this._collectResourceTiming=t.collectResourceTiming,t.maxzoom!==void 0&&(this.maxzoom=t.maxzoom),t.type&&(this.type=t.type),t.attribution&&(this.attribution=t.attribution),this.promoteId=t.promoteId,t.clusterMaxZoom!==void 0&&this.maxzoom<=t.clusterMaxZoom&&maplibre_gl_shared_Ft(`The maxzoom value "${this.maxzoom}" is expected to be greater than the clusterMaxZoom value "${t.clusterMaxZoom}".`),this.workerOptions=maplibre_gl_shared_xt({source:this.id,geojsonVtOptions:{buffer:this._pixelsToTileUnits(t.buffer===void 0?128:t.buffer),tolerance:this._pixelsToTileUnits(t.tolerance===void 0?.375:t.tolerance),extent:(/* inlined export .Rr */8192),maxZoom:this.maxzoom,lineMetrics:t.lineMetrics||!1,generateId:t.generateId||!1,promoteId:typeof t.promoteId==`string`?t.promoteId:void 0,cluster:t.cluster||!1,clusterOptions:{maxZoom:this._getClusterMaxZoom(t.clusterMaxZoom),minPoints:Math.max(2,t.clusterMinPoints||2),extent:(/* inlined export .Rr */8192),radius:this._pixelsToTileUnits(t.clusterRadius||50),log:!1,generateId:t.generateId||!1}},clusterProperties:t.clusterProperties,filter:t.filter},t.workerOptions)}_hasPendingWorkerUpdate(){return this._pendingWorkerUpdate.data!==void 0||this._pendingWorkerUpdate.diff!==void 0||this._pendingWorkerUpdate.updateCluster}_pixelsToTileUnits(e){return e*((/* inlined export .Rr */8192)/this.tileSize)}_tileUnitsToPixels(e){return e/((/* inlined export .Rr */8192)/this.tileSize)}_getClusterMaxZoom(e){let t=e?Math.round(e):this.maxzoom-1;return Number.isInteger(e)||e===void 0||maplibre_gl_shared_Ft(`Integer expected for option 'clusterMaxZoom': provided value "${e}" rounded to "${t}"`),t}async load(){await this._updateWorkerData()}onAdd(e){this.map=e,this.load()}setData(e){return this._data=typeof e==`string`?{url:e}:{geojson:e},this._pendingWorkerUpdate={data:e},this._updateWorkerData()}updateData(e){return this._pendingWorkerUpdate.diff=maplibre_gl_Da(this._pendingWorkerUpdate.diff,e),this._updateWorkerData()}async getData(){return this._data.url&&await this.once(`data`),this._data.geojson?this._data.geojson:{type:`FeatureCollection`,features:Array.from(this._data.updateable.values())}}async getBounds(){return maplibre_gl_Ia(await this.getData())}setClusterOptions(e){return this.workerOptions.geojsonVtOptions.cluster=e.cluster,e.clusterRadius!==void 0&&(this.workerOptions.geojsonVtOptions.clusterOptions.radius=this._pixelsToTileUnits(e.clusterRadius)),e.clusterMaxZoom!==void 0&&(this.workerOptions.geojsonVtOptions.clusterOptions.maxZoom=this._getClusterMaxZoom(e.clusterMaxZoom)),this._pendingWorkerUpdate.updateCluster=!0,this._updateWorkerData()}getClusterOptions(){let{cluster:e,clusterOptions:t}=this.workerOptions.geojsonVtOptions;return{cluster:e,clusterMaxZoom:t.maxZoom,clusterRadius:this._tileUnitsToPixels(t.radius)}}async getClusterExpansionZoom(e){return(await this.actorPromise).sendAsync({type:`GCEZ`,data:{type:this.type,clusterId:e,source:this.id}})}async getClusterChildren(e){return(await this.actorPromise).sendAsync({type:`GCC`,data:{type:this.type,clusterId:e,source:this.id}})}async getClusterLeaves(e,t,n){return(await this.actorPromise).sendAsync({type:`GCL`,data:{type:this.type,source:this.id,clusterId:e,limit:t,offset:n}})}async _updateWorkerData(){if(this._isUpdatingWorker)return this._updatePromise;if(!this._hasPendingWorkerUpdate()){maplibre_gl_shared_Ft(`No pending worker updates for GeoJSONSource ${this.id}.`);return}let{data:e,diff:t,updateCluster:n}=this._pendingWorkerUpdate,r=this._getLoadGeoJSONParameters(e,t,n);e===void 0?t?this._pendingWorkerUpdate.diff=void 0:n&&(this._pendingWorkerUpdate.updateCluster=void 0):this._pendingWorkerUpdate.data=void 0,this._updatePromise=this._dispatchWorkerUpdate(r),await this._updatePromise}async _getLoadGeoJSONParameters(e,t,n){let r=maplibre_gl_shared_xt({type:this.type,source:this.id},this.workerOptions);if(typeof e==`string`)return r.request=await this.map._requestManager.transformRequest(maplibre_gl_Br.resolveURL(e),`Source`),r.request.collectResourceTiming=this._collectResourceTiming,r;if(e!==void 0)return r.data=e,r;if(t)return r.dataDiff=t,r;if(n)return r.updateCluster=!0,r}async _dispatchWorkerUpdate(e){this._isUpdatingWorker=!0,this.fire(new maplibre_gl_K(`dataloading`));try{let t=await e,n=await(await this.actorPromise).sendAsync({type:`LD`,data:t});if(this._isUpdatingWorker=!1,this._removed||n.abandoned){this.fire(new maplibre_gl_K(`dataabort`));return}n.data&&(this._data={geojson:n.data});let r=this._applyDiffToSource(t.dataDiff),i=this._getShouldReloadTileOptions(r),a={};this._applyResourceTiming(a,n),this.fire(new maplibre_gl_K(`data`,{...a,sourceDataType:`metadata`})),this.fire(new maplibre_gl_K(`data`,{...a,sourceDataType:`content`,shouldReloadTileOptions:i}))}catch(e){if(this._isUpdatingWorker=!1,this._removed){this.fire(new maplibre_gl_K(`dataabort`));return}this.fire(new maplibre_gl_shared_Pn(maplibre_gl_shared_Qe(e)))}finally{this._hasPendingWorkerUpdate()&&await this._updateWorkerData()}}_applyResourceTiming(e,t){if(!this._collectResourceTiming)return;let n=t.resourceTiming?.[this.id];if(!n)return;let r=n.slice(0);r?.length&&maplibre_gl_shared_xt(e,{resourceTiming:r})}_applyDiffToSource(e){if(!e)return;let t=typeof this.promoteId==`string`?this.promoteId:void 0;if(!this._data.url&&!this._data.updateable){let e=maplibre_gl_Ta(this._data.geojson,t);if(!e)throw Error(`GeoJSONSource "${this.id}": GeoJSON data is not compatible with updateData`);this._data={updateable:e}}if(!this._data.updateable)return;let n=maplibre_gl_Ea(this._data.updateable,e,t);if(!(e.removeAll||this._options.cluster))return n}_getShouldReloadTileOptions(e){if(e)return{affectedBounds:e.filter(Boolean).map(e=>maplibre_gl_Ia(e))}}shouldReloadTile(e,{affectedBounds:t}){if(e.state===`loading`)return!0;if(e.state===`unloaded`)return!1;let{buffer:n,extent:r}=this.workerOptions.geojsonVtOptions,i=maplibre_gl_La(e.tileID.canonical,n/r);for(let e of t)if(i.intersects(e))return!0;return!1}loaded(){return!this._isUpdatingWorker&&!this._hasPendingWorkerUpdate()}async loadTile(e){let t=e.actor?`RT`:`LT`;e.actor=await this.actorPromise;let n={type:this.type,uid:e.uid,tileID:e.tileID,zoom:e.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,subdivisionGranularity:this.map.style.projection.subdivisionGranularity};e.abortController=new AbortController;try{let r=await(await this.actorPromise).sendAsync({type:t,data:n},e.abortController);delete e.abortController,e.unloadVectorData(),e.aborted||e.loadVectorData(r,this.map.painter,t===`RT`)}catch(t){if(delete e.abortController,e.aborted||maplibre_gl_shared_mn(t))return;throw t}}async abortTile(e){e.abortController&&(e.abortController.abort(),delete e.abortController),e.aborted=!0}async unloadTile(e){e.unloadVectorData(),await(await this.actorPromise).sendAsync({type:`RMT`,data:{uid:e.uid,type:this.type,source:this.id}})}onRemove(){this._removed=!0,this.actorPromise.then(e=>e.sendAsync({type:`RS`,data:{type:this.type,source:this.id}}))}serialize(){return maplibre_gl_shared_xt({},this._options,{type:this.type,data:this._data.updateable?{type:`FeatureCollection`,features:Array.from(this._data.updateable.values())}:this._data.url||this._data.geojson})}hasTransition(){return!1}};const maplibre_gl_za=[0,0,1],maplibre_gl_Ba=(e,t)=>({u_tl_parent:new maplibre_gl_shared_gu(e,t.u_tl_parent),u_scale_parent:new maplibre_gl_shared_hu(e,t.u_scale_parent),u_buffer_scale:new maplibre_gl_shared_hu(e,t.u_buffer_scale),u_image_warp:new dist_maplibre_gl_shared_u(e,t.u_image_warp),u_fade_t:new maplibre_gl_shared_hu(e,t.u_fade_t),u_opacity:new maplibre_gl_shared_hu(e,t.u_opacity),u_image0:new maplibre_gl_shared_mu(e,t.u_image0),u_image1:new maplibre_gl_shared_mu(e,t.u_image1),u_brightness_low:new maplibre_gl_shared_hu(e,t.u_brightness_low),u_brightness_high:new maplibre_gl_shared_hu(e,t.u_brightness_high),u_saturation_factor:new maplibre_gl_shared_hu(e,t.u_saturation_factor),u_contrast_factor:new maplibre_gl_shared_hu(e,t.u_contrast_factor),u_spin_weights:new dist_maplibre_gl_shared_u(e,t.u_spin_weights),u_coords_top:new maplibre_gl_shared_vu(e,t.u_coords_top),u_coords_bottom:new maplibre_gl_shared_vu(e,t.u_coords_bottom)}),maplibre_gl_Va=(e,t,n,r,i,a)=>({u_tl_parent:e,u_scale_parent:t,u_buffer_scale:1,u_image_warp:a,u_fade_t:n.mix,u_opacity:n.opacity*r.paint.get(`raster-opacity`),u_image0:0,u_image1:1,u_brightness_low:r.paint.get(`raster-brightness-min`),u_brightness_high:r.paint.get(`raster-brightness-max`),u_saturation_factor:maplibre_gl_Wa(r.paint.get(`raster-saturation`)),u_contrast_factor:maplibre_gl_Ua(r.paint.get(`raster-contrast`)),u_spin_weights:maplibre_gl_Ha(r.paint.get(`raster-hue-rotate`)),u_coords_top:[i[0].x,i[0].y,i[1].x,i[1].y],u_coords_bottom:[i[3].x,i[3].y,i[2].x,i[2].y]});function maplibre_gl_Ha(e){e*=Math.PI/180;let t=Math.sin(e),n=Math.cos(e);return[(2*n+1)/3,(-Math.sqrt(3)*t-n+1)/3,(Math.sqrt(3)*t-n+1)/3]}function maplibre_gl_Ua(e){return e>0?1/(1-e):1+e}function maplibre_gl_Wa(e){return e>0?1-1/(1.001-e):-e}var maplibre_gl_Ga=class{constructor(e,t,n){this.vertexBuffer=e,this.indexBuffer=t,this.segments=n}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.vertexBuffer=null,this.indexBuffer=null,this.segments=null}};const maplibre_gl_Ka=maplibre_gl_shared_Yc([{name:`a_pos`,type:`Int16`,components:2}]),maplibre_gl_qa=(/* inlined export .Rr */8192)/128;function maplibre_gl_Ja(e,t){let n=maplibre_gl_Ya(t,`16bit`),r=maplibre_gl_shared_Pl.deserialize({arrayBuffer:n.vertices,length:n.vertices.byteLength/2/2}),i=maplibre_gl_shared_Zl.deserialize({arrayBuffer:n.indices,length:n.indices.byteLength/2/3});return new maplibre_gl_Ga(e.createVertexBuffer(r,maplibre_gl_Ka.members),e.createIndexBuffer(i),maplibre_gl_shared_nu.simpleSegment(0,0,r.length,i.length))}function maplibre_gl_Ya(e,t){let n=e.granularity===void 0?1:Math.max(e.granularity,1),r=n+(e.generateBorders?2:0),i=n+(e.extendToNorthPole||e.generateBorders?1:0)+(e.extendToSouthPole||e.generateBorders?1:0),a=r+1,o=i+1,s=e.generateBorders?-1:0,c=e.generateBorders||e.extendToNorthPole?-1:0,l=n+ +!!e.generateBorders,u=n+(e.generateBorders||e.extendToSouthPole?1:0),d=a*o,f=r*i*6,p=a*o>65536;if(p&&t===`16bit`)throw Error(`Granularity is too large and meshes would not fit inside 16 bit vertex indices.`);let m=p||t===`32bit`,h=new Int16Array(d*2),g=0;for(let t=c;t<=u;t++)for(let r=s;r<=l;r++){let i=r/n*(/* inlined export .Rr */8192);r===-1&&(i=-maplibre_gl_qa),r===n+1&&(i=(/* inlined export .Rr */8192)+maplibre_gl_qa);let a=t/n*(/* inlined export .Rr */8192);t===-1&&(a=e.extendToNorthPole?(/* inlined export .ht */-32768):-maplibre_gl_qa),t===n+1&&(a=e.extendToSouthPole?(/* inlined export .gt */32767):(/* inlined export .Rr */8192)+maplibre_gl_qa),h[g++]=i,h[g++]=a}let _=m?new Uint32Array(f):new Uint16Array(f),v=0;for(let e=0;e<i;e++)for(let t=0;t<r;t++){let n=t+e*a,r=t+1+e*a,i=t+(e+1)*a,o=t+1+(e+1)*a;_[v++]=n,_[v++]=i,_[v++]=r,_[v++]=r,_[v++]=i,_[v++]=o}return{vertices:h.buffer.slice(0),indices:_.buffer.slice(0),uses32bitIndices:m}}var maplibre_gl_Xa=class extends maplibre_gl_shared_Fn{constructor(e,t,n,r){super(),this.imageWarp=maplibre_gl_za,this.flippedWindingOrder=!1,this._warp=`auto`,this._imageDirty=!1,this._subdividedQuad=!1,this._subdividedMesh=null,this.id=e,this.dispatcher=n,this.coordinates=t.coordinates,this.type=`image`,this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(r),this.options=t}async load(e){if(this.options.url===void 0){this._loaded=!0,this._finishLoading();return}this._loaded=!1,this.fire(new maplibre_gl_K(`dataloading`)),this.url=this.options.url,this._abortController=new AbortController;try{let t=await maplibre_gl_Gr.transformAndGetImage(this.map._requestManager,this.url,`Image`,this._abortController);this._abortController=null,this._loaded=!0,t?.data?(this._setImage(t.data),e&&(this.coordinates=e),this._finishLoading()):this.fire(new maplibre_gl_shared_Pn(Error(`Could not load image ${this.url}: the response is empty`)))}catch(e){if(maplibre_gl_shared_mn(e))return;this._abortController=null,this._loaded=!0,this.fire(new maplibre_gl_shared_Pn(maplibre_gl_shared_Qe(e)))}}loaded(){return this._loaded}updateImage(e){return this._abortController&&=(this._abortController.abort(),null),`image`in e?(this._loaded=!0,this._setImage(e.image),e.coordinates&&(this.coordinates=e.coordinates),this._finishLoading(),this):e.url?(this.options.url=e.url,this.load(e.coordinates),this):this}_setImage(e){this.image=e,this._imageDirty=!0}getMesh(e,t){return!this._subdividedQuad||t?null:(this._subdividedMesh??=maplibre_gl_Ja(e,{granularity:16}),this._subdividedMesh)}_disposeTexture(){this.texture?.destroy(),this.texture=null}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new maplibre_gl_K(`data`,{sourceDataType:`metadata`})))}onAdd(e){this.map=e,this.load()}onRemove(){this._abortController&&=(this._abortController.abort(),null),this._disposeTexture(),this._subdividedMesh?.destroy(),this._subdividedMesh=null,this.image=null,this.tiles={}}setWarp(e){return this._warp===e?this:(this._warp=e,this.tileCoords&&this.setCoordinates(this.coordinates),this)}getWarp(){return this._warp}setCoordinates(e){this.coordinates=e;let t=e.map(maplibre_gl_shared_Hp.fromLngLat);return this.tileID=maplibre_gl_Za(t),this.terrainTileRanges=this._getOverlappingTileRanges(t),this.minzoom=this.maxzoom=this.tileID.z,this.tileCoords=t.map(e=>this.tileID.getTilePoint(e)._round()),this.imageWarp=maplibre_gl_$a(this.tileCoords,this._warp),this._subdividedQuad=this.imageWarp[2]>0&&!maplibre_gl_to(this.tileCoords),this.flippedWindingOrder=maplibre_gl_Qa(this.tileCoords),this.fire(new maplibre_gl_K(`data`,{sourceDataType:`content`})),this}prepare(){if(Object.keys(this.tiles).length===0||!this.image)return;let e=this.map.painter.context,t=e.gl;this.texture?this._imageDirty&&(this.texture.update(this.image),this.texture.bind(t.LINEAR,t.CLAMP_TO_EDGE)):(this.texture=new Gd(e,this.image,t.RGBA),this.texture.bind(t.LINEAR,t.CLAMP_TO_EDGE)),this._imageDirty=!1;let n=!1;for(let e in this.tiles){let t=this.tiles[e];t.state!==`loaded`&&(t.state=`loaded`,t.texture=this.texture,n=!0)}n&&this.fire(new maplibre_gl_K(`data`,{sourceDataType:`idle`,sourceId:this.id}))}async loadTile(e){this.tileID?.equals(e.tileID.canonical)?(this.tiles[String(e.tileID.wrap)]=e,e.buckets={}):e.state=`errored`}serialize(){let e={type:`image`,coordinates:this.coordinates};return this.options.url!==void 0&&(e.url=this.options.url),e}hasTransition(){return!1}_getOverlappingTileRanges(e){let{minX:t,minY:n,maxX:r,maxY:i}=maplibre_gl_shared_xp.fromPoints(e),a={};for(let e=0;e<=25;e++){let o=2**e,s=Math.floor(t*o),c=Math.floor(n*o),l=Math.floor(r*o),u=Math.floor(i*o),d=(s%o+o)%o,f=l%o,p=Math.floor(s/o),m=Math.floor(l/o);a[e]={minWrap:p,maxWrap:m,minTileXWrapped:d,maxTileXWrapped:f,minTileY:c,maxTileY:u}}return a}};function maplibre_gl_Za(e){let t=maplibre_gl_shared_xp.fromPoints(e),n=t.width(),r=t.height(),i=Math.max(0,Math.floor(-Math.log(Math.max(n,r))/Math.LN2)),a=2**i;return new maplibre_gl_shared_ub(i,Math.floor((t.minX+t.maxX)/2*a),Math.floor((t.minY+t.maxY)/2*a))}function maplibre_gl_Qa(e){let t=e[1].x-e[0].x,n=e[1].y-e[0].y,r=e[2].x-e[0].x;return t*(e[2].y-e[0].y)-n*r<0}function maplibre_gl_$a(e,t){if(t===`flat`||maplibre_gl_to(e))return maplibre_gl_za;let[n,r,i,a]=e,o=n.x-r.x+i.x-a.x,s=n.y-r.y+i.y-a.y,c=[r.x-i.x,r.y-i.y,a.x-i.x,a.y-i.y],[l,u,d,f]=c,p=maplibre_gl_Fr(c),m=(o*f-d*s)/p,h=(l*s-o*u)/p,g=[1,1+m,1+m+h,1+h],_=Math.max(...g)/Math.min(...g),v=t===`perspective`?0:maplibre_gl_eo(_);return!(_>=1&&_<=512)||v>=1?maplibre_gl_za:[m,h,v]}function maplibre_gl_eo(e){let t=(1-4/e)/(1-4/512);return Math.max(0,t)}function maplibre_gl_to(e){let[t,n,r,i]=e;return t.x+r.x===n.x+i.x&&t.y+r.y===n.y+i.y}var maplibre_gl_no=class extends maplibre_gl_Xa{constructor(e,t,n,r){super(e,t,n,r),this._onPlayingHandler=()=>{this.map?.triggerRepaint()},this.roundZoom=!0,this.type=`video`,this.options=t}async load(){this._loaded=!1;let e=this.options;this.urls=[];for(let t of e.urls)this.urls.push((await this.map._requestManager.transformRequest(t,`Source`)).url);try{let e=await maplibre_gl_shared_An(this.urls);if(this._loaded=!0,!e)return;this.video=e,this.video.loop=!0,this.video.addEventListener(`playing`,this._onPlayingHandler),this.map&&this.video.play(),this._finishLoading()}catch(e){this.fire(new maplibre_gl_shared_Pn(maplibre_gl_shared_Qe(e)))}}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(e){if(this.video){let t=this.video.seekable;e<t.start(0)||e>t.end(0)?this.fire(new maplibre_gl_shared_Pn(new maplibre_gl_shared_F(`sources.${this.id}`,null,`Playback for this video can be set only between the ${t.start(0)} and ${t.end(0)}-second mark.`))):this.video.currentTime=e}}getVideo(){return this.video}onAdd(e){this.map||(this.map=e,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}onRemove(){super.onRemove(),this.video&&(this.video.removeEventListener(`playing`,this._onPlayingHandler),this.video.pause())}prepare(){if(Object.keys(this.tiles).length===0||this.video.readyState<2)return;let e=this.map.painter.context,t=e.gl;this.texture?this.video.paused||(this.texture.bind(t.LINEAR,t.CLAMP_TO_EDGE),t.texSubImage2D(t.TEXTURE_2D,0,0,0,t.RGBA,t.UNSIGNED_BYTE,this.video)):(this.texture=new Gd(e,this.video,t.RGBA),this.texture.bind(t.LINEAR,t.CLAMP_TO_EDGE));let n=!1;for(let e in this.tiles){let t=this.tiles[e];t.state!==`loaded`&&(t.state=`loaded`,t.texture=this.texture,n=!0)}n&&this.fire(new maplibre_gl_K(`data`,{sourceDataType:`idle`,sourceId:this.id}))}serialize(){return{type:`video`,urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}},maplibre_gl_ro=class extends maplibre_gl_Xa{constructor(e,t,n,r){super(e,t,n,r),t.coordinates?(!Array.isArray(t.coordinates)||t.coordinates.length!==4||t.coordinates.some(e=>!Array.isArray(e)||e.length!==2||e.some(e=>typeof e!=`number`)))&&this.fire(new maplibre_gl_shared_Pn(new maplibre_gl_shared_F(`sources.${e}`,null,`"coordinates" property must be an array of 4 longitude/latitude array pairs`))):this.fire(new maplibre_gl_shared_Pn(new maplibre_gl_shared_F(`sources.${e}`,null,`missing required property "coordinates"`))),t.animate&&typeof t.animate!=`boolean`&&this.fire(new maplibre_gl_shared_Pn(new maplibre_gl_shared_F(`sources.${e}`,null,`optional "animate" property must be a boolean value`))),t.canvas?typeof t.canvas!=`string`&&!(t.canvas instanceof HTMLCanvasElement)&&this.fire(new maplibre_gl_shared_Pn(new maplibre_gl_shared_F(`sources.${e}`,null,`"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance`))):this.fire(new maplibre_gl_shared_Pn(new maplibre_gl_shared_F(`sources.${e}`,null,`missing required property "canvas"`))),this.options=t,this.animate=t.animate===void 0||t.animate}async load(){if(this._loaded=!0,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 maplibre_gl_shared_Pn(Error(`Canvas dimensions cannot be less than or equal to zero.`)));return}this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&=(this.prepare(),!1)},this._finishLoading()}getCanvas(){return this.canvas}onAdd(e){this.map=e,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this._playing=!1,super.onRemove()}prepare(){let e=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,e=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,e=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;let t=this.map.painter.context,n=t.gl;this.texture?(e||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):(this.texture=new Gd(t,this.canvas,n.RGBA,{premultiply:!0}),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE));let r=!1;for(let e in this.tiles){let t=this.tiles[e];t.state!==`loaded`&&(t.state=`loaded`,t.texture=this.texture,r=!0)}r&&this.fire(new maplibre_gl_K(`data`,{sourceDataType:`idle`,sourceId:this.id}))}serialize(){return{type:`canvas`,animate:this.animate,canvas:this.options.canvas,coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(let e of[this.canvas.width,this.canvas.height])if(isNaN(e)||e<=0)return!0;return!1}};const maplibre_gl_io={},maplibre_gl_ao=(e,t,n,r)=>{let i=new(maplibre_gl_oo(t.type))(e,t,n,r);if(i.id!==e)throw Error(`Expected Source id to be ${e} instead of ${i.id}`);return i},maplibre_gl_oo=e=>{switch(e){case`geojson`:return maplibre_gl_Ra;case`image`:return maplibre_gl_Xa;case`raster`:return maplibre_gl_Sa;case`raster-dem`:return maplibre_gl_Ca;case`vector`:return maplibre_gl_xa;case`video`:return maplibre_gl_no;case`canvas`:return maplibre_gl_ro}return maplibre_gl_io[e]},maplibre_gl_so=(e,t)=>{maplibre_gl_io[e]=t},maplibre_gl_co=async(e,t)=>{if(maplibre_gl_oo(e))throw Error(`A source type called "${e}" already exists.`);maplibre_gl_so(e,t)};function maplibre_gl_lo(e,t){let n={};if(!t)return n;for(let r of e){let e=r.layerIds.map(e=>t.getLayer(e)).filter(Boolean);if(e.length!==0){r.layers=e,r.stateDependentLayerIds&&(r.stateDependentLayers=r.stateDependentLayerIds.map(t=>e.filter(e=>e.id===t)[0]));for(let t of e)n[t.id]=r}}return n}const maplibre_gl_uo=`RTLPluginLoaded`;var maplibre_gl_fo=class extends maplibre_gl_shared_Fn{constructor(...e){super(...e),this.status=`unavailable`,this.url=null,this.dispatcher=maplibre_gl_sa()}_syncState(e){return this.status=e,this.dispatcher.broadcast(`SRPS`,{pluginStatus:e,pluginURL:this.url}).catch(e=>{throw this.status=`error`,e})}getRTLTextPluginStatus(){return this.status}clearRTLTextPlugin(){this.status=`unavailable`,this.url=null}async setRTLTextPlugin(e,t=!1){if(this.url)throw Error(`setRTLTextPlugin cannot be called multiple times.`);if(this.url=maplibre_gl_Br.resolveURL(e),!this.url)throw Error(`requested url ${e} is invalid`);if(this.status===`unavailable`){if(t)this.status=`deferred`,this._syncState(this.status);else return this._requestImport()}else if(this.status===`requested`)return this._requestImport()}async _requestImport(){await this._syncState(`loading`),this.status=`loaded`,this.fire(new maplibre_gl_shared_Nn(maplibre_gl_uo))}lazyLoad(){this.status===`unavailable`?this.status=`requested`:this.status===`deferred`&&this._requestImport()}};let maplibre_gl_po=null;function maplibre_gl_mo(){return maplibre_gl_po||=new maplibre_gl_fo,maplibre_gl_po}var maplibre_gl_ho=class{constructor(e,t){this.timeAdded=0,this.fadeEndTime=0,this.fadeOpacity=1,this.tileID=e,this.uid=maplibre_gl_shared_wt(),this.uses=0,this.tileSize=t,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.rttObjects=[],this.rttFingerprint={},this.expiredRequestCount=0,this.state=`loading`,this.featureStateRevision=-1}isRenderable(e){return this.hasData()&&(!this.fadeEndTime||this.fadeOpacity>0)&&(e||!this.holdingForSymbolFade())}setCrossFadeLogic({fadingRole:e,fadingDirection:t,fadingParentID:n,fadeEndTime:r}){this.resetFadeLogic(),this.fadingRole=e,this.fadingDirection=t,this.fadingParentID=n,this.fadeEndTime=r}setSelfFadeLogic(e){this.resetFadeLogic(),this.selfFading=!0,this.fadeEndTime=e}resetFadeLogic(){this.fadingRole=null,this.fadingDirection=null,this.fadingParentID=null,this.selfFading=!1,this.timeAdded=maplibre_gl_U(),this.fadeEndTime=0,this.fadeOpacity=1}wasRequested(){return this.state===`errored`||this.state===`loaded`||this.state===`reloading`}clearTextures(e){this.demTexture&&e.saveTileTexture(this.demTexture),this.demTexture=null}getRTT(e){return this.rttObjects[e]}acquireRTT(e,t,n){return this.rttObjects[t]=e.acquireRTT(n)}releaseRTT(e){if(this.rttObjects.length!==0){for(let t of this.rttObjects)t&&e.releaseRTT(t);this.rttObjects.length=0}}loadVectorData(e,t,n){if(e?.etagUnmodified===!0){this.state=`loaded`;return}if(this.hasData()&&this.unloadVectorData(),this.state=`loaded`,!e){this.collisionBoxArray=new maplibre_gl_shared_Cl;return}e.featureIndex&&(this.latestFeatureIndex=e.featureIndex,e.rawTileData?(this.latestRawTileData=e.rawTileData,this.latestEncoding=e.encoding,this.latestFeatureIndex.rawTileData=e.rawTileData,this.latestFeatureIndex.encoding=e.encoding):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData,this.latestFeatureIndex.encoding=this.latestEncoding)),this.collisionBoxArray=e.collisionBoxArray,this.buckets=maplibre_gl_lo(e.buckets,t?.style),this.hasSymbolBuckets=!1;for(let e in this.buckets){let t=this.buckets[e];if(t instanceof zy){if(this.hasSymbolBuckets=!0,n)t.justReloaded=!0;else break}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(let e in this.buckets){let t=this.buckets[e];if(t instanceof zy&&t.hasRTLText){this.hasRTLText=!0,maplibre_gl_mo().lazyLoad();break}}this.queryPadding=0;for(let e in this.buckets){let n=this.buckets[e];this.queryPadding=Math.max(this.queryPadding,t.style.getLayer(e).queryRadius(n))}e.imageAtlas&&(this.imageAtlas=e.imageAtlas),e.glyphAtlasImage&&(this.glyphAtlasImage=e.glyphAtlasImage),this.dashPositions=e.dashPositions}unloadVectorData(){for(let e in this.buckets)this.buckets[e].destroy();this.buckets={},this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.imageAtlas=null,this.dashPositions=null,this.latestFeatureIndex=null,this.state=`unloaded`}getBucket(e){return this.buckets[e.id]}upload(e){for(let t in this.buckets){let n=this.buckets[t];n.uploadPending()&&n.upload(e)}let t=e.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new Gd(e,this.imageAtlas.image,t.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&=(this.glyphAtlasTexture=new Gd(e,this.glyphAtlasImage,t.ALPHA),null)}prepare(e){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(e,this.imageAtlasTexture)}queryRenderedFeatures(e,t,n,r,i,a,o,s,c,l,u){return this.latestFeatureIndex?.rawTileData?this.latestFeatureIndex.query({queryGeometry:r,cameraQueryGeometry:i,scale:a,tileSize:this.tileSize,pixelPosMatrix:l,transform:s,params:o,queryPadding:this.queryPadding*c,getElevation:u},e,t,n):{}}querySourceFeatures(e,t){let n=this.latestFeatureIndex;if(!n?.rawTileData)return;let r=n.loadVTLayers(),i=t?.sourceLayer?t.sourceLayer:``,a=r._geojsonTileLayer||r[i];if(!a)return;let o=maplibre_gl_shared_es(t?.filter,`querySourceFeatures[${i}].filter`,t?.globalState),{z:s,x:l,y:u}=this.tileID.canonical,d={z:s,x:l,y:u};for(let t=0;t<a.length;t++){let r=a.feature(t);if(o.needGeometry){let e=maplibre_gl_shared_Bu(r,!0);if(!o.filter(new maplibre_gl_shared_G(this.tileID.overscaledZ),e,this.tileID.canonical))continue}else if(!o.filter(new maplibre_gl_shared_G(this.tileID.overscaledZ),r))continue;let f=n.getId(r,i),p=new maplibre_gl_shared_Mb(r,s,l,u,f);p.tile=d,e.push(p)}}hasData(){return this.state===`loaded`||this.state===`reloading`||this.state===`expired`}patternsLoaded(){return this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length}setExpiryData(e){let t=this.expirationTime;if(e.cacheControl){let t=maplibre_gl_shared_Bt(e.cacheControl);t[`max-age`]&&(this.expirationTime=Date.now()+t[`max-age`]*1e3)}else e.expires&&(this.expirationTime=new Date(e.expires).getTime());if(this.expirationTime){let e=Date.now(),n=!1;if(this.expirationTime>e)n=!1;else if(!t)n=!0;else if(this.expirationTime<t)n=!0;else{let r=this.expirationTime-t;r?this.expirationTime=e+Math.max(r,3e4):n=!0}n?(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(),2**31-1)}setFeatureState(e,t,n){if(!this.latestFeatureIndex?.rawTileData||Object.keys(e).length===0||this.featureStateRevision===n)return;this.featureStateRevision=n;let r=this.latestFeatureIndex.loadVTLayers();for(let n in this.buckets){if(!t.style.hasLayer(n))continue;let i=this.buckets[n],a=i.layers[0].sourceLayer||`_geojsonTileLayer`,o=r[a],s=e[a];if(!o||!s||s.length===0)continue;i.update(s,o,this.imageAtlas?.patternPositions||{},this.dashPositions||{});let c=t?.style?.getLayer(n);c&&(this.queryPadding=Math.max(this.queryPadding,c.queryRadius(i)))}}holdingForSymbolFade(){return this.symbolFadeHoldUntil!==void 0}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<maplibre_gl_U()}clearSymbolFadeHold(){this.symbolFadeHoldUntil=void 0}setSymbolHoldDuration(e){this.symbolFadeHoldUntil=maplibre_gl_U()+e}setDependencies(e,t){let n={};for(let e of t)n[e]=!0;this.dependencies[e]=n}hasDependency(e,t){for(let n of e){let e=this.dependencies[n];if(e){for(let n of t)if(e[n])return!0}}return!1}};function maplibre_gl_go(e){let t=[];for(let n in e)t.push({id:n,state:e[n]});return t}var maplibre_gl_o=class{constructor(){this.state={},this.stateChanges={},this.deletedStates={},this.revision=0}updateState(e,t,n){let r=String(t);if(this.stateChanges[e]||={},this.stateChanges[e][r]||={},maplibre_gl_shared_xt(this.stateChanges[e][r],n),this.deletedStates[e]===null){this.deletedStates[e]={};for(let t in this.state[e])if(t===r){this.deletedStates[e][r]={};for(let i in this.state[e][t])n[i]===void 0&&(this.deletedStates[e][r][i]=null)}else this.deletedStates[e][t]=null}else if(this.deletedStates[e]?.[r]===null){this.deletedStates[e][r]={};for(let t in this.state[e][r])n[t]===void 0&&(this.deletedStates[e][r][t]=null)}else for(let t in n)this.deletedStates[e]?.[r]?.[t]===null&&delete this.deletedStates[e][r][t]}removeFeatureState(e,t,n){if(this.deletedStates[e]===null)return;let r=String(t);if(this.deletedStates[e]||={},n&&t!==void 0)this.deletedStates[e][r]!==null&&(this.deletedStates[e][r]||={},this.deletedStates[e][r][n]=null);else if(t!==void 0){if(this.stateChanges[e]?.[r])for(n in this.deletedStates[e][r]={},this.stateChanges[e][r])this.deletedStates[e][r][n]=null;else this.deletedStates[e][r]=null}else this.deletedStates[e]=null}getState(e,t){let n=String(t),r=this.state[e]||{},i=this.stateChanges[e]||{},a=maplibre_gl_shared_xt({},r[n],i[n]);if(this.deletedStates[e]===null)return{};if(this.deletedStates[e]){let n=this.deletedStates[e][t];if(n===null)return{};for(let e in n)delete a[e]}return a}initializeTileState(e,t){let n={};for(let e in this.state)n[e]=maplibre_gl_go(this.state[e]);e.setFeatureState(n,t,this.revision)}coalesceChanges(e,t){let n={};for(let e in this.stateChanges){this.state[e]||={},n[e]||={};for(let t in this.stateChanges[e])this.state[e][t]||={},maplibre_gl_shared_xt(this.state[e][t],this.stateChanges[e][t]),n[e][t]=this.state[e][t]}for(let e in this.deletedStates)if(this.state[e]||={},n[e]||={},this.deletedStates[e]===null)for(let t in this.state[e])this.state[e][t]={},n[e][t]={};else for(let t in this.deletedStates[e]){if(this.deletedStates[e][t]===null)this.state[e][t]={};else for(let n of Object.keys(this.deletedStates[e][t]))delete this.state[e][t][n];n[e][t]=this.state[e][t]}if(this.stateChanges={},this.deletedStates={},Object.keys(n).length===0)return;this.revision++;let r={};for(let e in n)r[e]=maplibre_gl_go(n[e]);e.setFeatureState(r,t,this.revision)}},maplibre_gl_vo=class e{constructor(e,t){this.min=e,this.max=t,this.center=maplibre_gl_shared_pe([],maplibre_gl_shared_de([],this.min,this.max),.5)}quadrant(t){let n=[t%2==0,t<2],r=maplibre_gl_shared_ce(this.min),i=maplibre_gl_shared_ce(this.max);for(let e=0;e<n.length;e++)r[e]=n[e]?this.min[e]:this.center[e],i[e]=n[e]?this.center[e]:this.max[e];return i[2]=this.max[2],new e(r,i)}distanceX(e){return Math.max(Math.min(this.max[0],e[0]),this.min[0])-e[0]}distanceY(e){return Math.max(Math.min(this.max[1],e[1]),this.min[1])-e[1]}intersectsFrustum(e){let t=!0;for(let n of e.planes){let e=this.intersectsPlane(n);if(e===0)return 0;e===1&&(t=!1)}return t?2:e.aabb.min[0]>this.max[0]||e.aabb.min[1]>this.max[1]||e.aabb.min[2]>this.max[2]||e.aabb.max[0]<this.min[0]||e.aabb.max[1]<this.min[1]||e.aabb.max[2]<this.min[2]?0:1}intersectsPlane(e){let t=e[3],n=e[3];for(let r=0;r<3;r++)e[r]>0?(t+=e[r]*this.min[r],n+=e[r]*this.max[r]):(n+=e[r]*this.min[r],t+=e[r]*this.max[r]);return t>=0?2:n<0?0:1}},maplibre_gl_yo=class e{constructor(e,t,n){this.points=e,this.planes=t,this.aabb=n}static fromInvProjectionMatrix(t,r=1,i=0,a,o){let s=[[-1,1,-1,1],[1,1,-1,1],[1,-1,-1,1],[-1,-1,-1,1],[-1,1,1,1],[1,1,1,1],[1,-1,1,1],[-1,-1,1,1]],c=o?[[6,5,4],[0,1,2],[0,3,7],[2,1,5],[3,2,6],[0,4,5]]:[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]],l=2**i,u=s.map(e=>maplibre_gl_bo(e,t,r,l));a&&maplibre_gl_xo(u,c[0],a,o);let d=c.map(e=>{let t=maplibre_gl_shared_Ee([],u[e[0]],u[e[1]]),r=maplibre_gl_shared_Ee([],u[e[2]],u[e[1]]),i=maplibre_gl_shared_j([],maplibre_gl_shared_ve([],t,r)),a=-dist_maplibre_gl_shared_e(i,u[e[1]]);return i.concat(a)}),f=[1/0,1/0,1/0],p=[-1/0,-1/0,-1/0];for(let e of u)for(let t=0;t<3;t++)f[t]=Math.min(f[t],e[t]),p[t]=Math.max(p[t],e[t]);return new e(u,d,new maplibre_gl_vo(f,p))}};function maplibre_gl_bo(e,t,n,r){let i=maplibre_gl_shared_Ne([],e,t),a=1/i[3]/n*r;return maplibre_gl_shared_Pe(i,i,[a,a,1/i[3],a])}function maplibre_gl_xo(e,t,n,r){let i=r?4:0,a=r?0:4,o=0,s=[],c=[];for(let t=0;t<4;t++){let n=maplibre_gl_shared_Ee([],e[t+a],e[t+i]),r=maplibre_gl_shared_le(n);maplibre_gl_shared_pe(n,n,1/r),s.push(r),c.push(n)}for(let t=0;t<4;t++){let r=maplibre_gl_shared_st(e[t+i],c[t],n);o=r!==null&&r>=0?Math.max(o,r):Math.max(o,s[t])}let l=maplibre_gl_So(e,t),u=maplibre_gl_Co(n,l);if(u!==null){let e=u/dist_maplibre_gl_shared_e(c[0],l);o=Math.min(o,e)}for(let t=0;t<4;t++){let n=Math.min(o,s[t]);e[t+a]=[e[t+i][0]+c[t][0]*n,e[t+i][1]+c[t][1]*n,e[t+i][2]+c[t][2]*n,1]}}function maplibre_gl_So(e,t){let r=maplibre_gl_shared_Ee([],e[t[0]],e[t[1]]),i=maplibre_gl_shared_Ee([],e[t[2]],e[t[1]]),a=[0,0,0,0];return maplibre_gl_shared_j(a,maplibre_gl_shared_ve([],r,i)),a[3]=-dist_maplibre_gl_shared_e(a,e[t[0]]),a}function maplibre_gl_Co(e,t){let n=maplibre_gl_shared_De(e),r=maplibre_gl_shared_je([],e,1/n),i=maplibre_gl_shared_Ee([],t,maplibre_gl_shared_pe([],r,dist_maplibre_gl_shared_e(t,r))),a=maplibre_gl_shared_De(i);if(a>0){let e=Math.sqrt(1-r[3]*r[3]),n=maplibre_gl_shared_pe([],r,-r[3]),o=maplibre_gl_shared_de([],n,maplibre_gl_shared_pe([],i,e/a));return maplibre_gl_shared_at(t,o)}return null}function maplibre_gl_wo(e,t,n){let r=t.intersectsFrustum(e);if(!n||r===0)return r;let i=t.intersectsPlane(n);return i===0?0:r===2&&i===2?2:1}function maplibre_gl_To(e,t,n){let r=0,i=(n-t)/10;for(let a=0;a<10;a++){let o=t+(a+.5)/10*(n-t);r+=i*Math.cos(o)**+e}return r}function maplibre_gl_Eo(e,t){return function(n,r,i,a,o){let s=2*((e-1)/maplibre_gl_shared_Ot(Math.cos(maplibre_gl_shared_$t((/* inlined export .Q */89.25)-o))/Math.cos(maplibre_gl_shared_$t((/* inlined export .Q */89.25))))-1),c=Math.acos(i/a),l=2*maplibre_gl_To(s-1,0,maplibre_gl_shared_$t(o/2)),u=Math.min(maplibre_gl_shared_$t((/* inlined export .Q */89.25)),c+maplibre_gl_shared_$t(o/2)),d=Math.min(u,c-maplibre_gl_shared_$t(o/2)),f=maplibre_gl_To(s-1,d,u),p=Math.atan(r/i),m=Math.hypot(r,i),h=n;return h+=maplibre_gl_shared_Ot(a/m/Math.max(.5,Math.cos(maplibre_gl_shared_$t(o/2)))),h+=s*maplibre_gl_shared_Ot(Math.cos(p))/2,h-=maplibre_gl_shared_Ot(Math.max(1,f/l/t))/2,h}}const maplibre_gl_Do=maplibre_gl_Eo(9.314,3);function maplibre_gl_Oo(e,t){let n=(t.roundZoom?Math.round:Math.floor)(e.zoom+maplibre_gl_shared_Ot(e.tileSize/t.tileSize));return Math.max(0,n)}function maplibre_gl_ko(e,t){let n=(/* inlined export .Q */89.25)-e.pitch-e.fov/2,r=maplibre_gl_shared_yt((15-n)/15,0,1),i=Math.max(500,t??0);return e.elevation+r*i}function maplibre_gl_Ao(e,t,n){let r=e.planes[1],i=e.points.map(e=>{let i=r[0]*e[0]+r[1]*e[1]+r[2]*e[2]+r[3];if(Math.abs(i)>1e-6)return e;let a=[e[0]-n[0],e[1]-n[1],e[2]-n[2]],o=r[0]*a[0]+r[1]*a[1]+r[2]*a[2];if(o>=-1e-9)return e;let s=t/-o;return[e[0]+a[0]*s,e[1]+a[1]*s,e[2]+a[2]*s,e[3]]}),a=e.planes.map((e,n)=>n===1?[e[0],e[1],e[2],e[3]+t]:e),o=[1/0,1/0,1/0],s=[-1/0,-1/0,-1/0];for(let e of i)for(let t=0;t<3;t++)o[t]=Math.min(o[t],e[t]),s[t]=Math.max(s[t],e[t]);return new maplibre_gl_yo(i,a,new maplibre_gl_vo(o,s))}function maplibre_gl_jo(e,t){let n=e.getCameraFrustum(),r=e.getClippingPlane();if(r&&t.maxContentElevation>0){let i=Math.hypot(r[0],r[1],r[2]);if(i>0){let a=1+t.maxContentElevation/maplibre_gl_shared_jp,o=maplibre_gl_shared_yt(-r[3]/i,-1,1),s=Math.cos(Math.acos(o)+Math.acos(1/a));r=[r[0],r[1],r[2],-s*i],n=maplibre_gl_Ao(n,Math.sqrt(a*a-1),e.cameraPosition)}}let i=maplibre_gl_shared_Zp(e),a=maplibre_gl_shared_Hp.fromLngLat(e.center,e.elevation),o=maplibre_gl_ko(e,t.maxContentElevation),s=e.getCoveringTilesDetailsProvider(),c=s.allowVariableZoom(e,t),l=maplibre_gl_Oo(e,t),u=t.minzoom||0,d=t.maxzoom===void 0?e.maxZoom:t.maxzoom,f=Math.min(Math.max(0,l),d),p=2**f,m=[p*i.x,p*i.y,0],h=[p*a.x,p*a.y,0],g=Math.hypot(a.x-i.x,a.y-i.y),_=Math.abs(a.z-i.z),v=Math.hypot(g,_),y=e=>({zoom:0,x:0,y:0,wrap:e,fullyVisible:!1}),b=[],x=[];if(e.renderWorldCopies&&s.allowWorldCopies())for(let e=1;e<=3;e++)b.push(y(-e)),b.push(y(e));for(b.push(y(0));b.length>0;){let p=b.pop(),g=p.x,y=p.y,S=p.fullyVisible,C={x:g,y,z:p.zoom},w=s.getTileBoundingVolume(C,p.wrap,o,t);if(!S){let e=maplibre_gl_wo(n,w,r);if(e===0)continue;S=e===2}let T=s.distanceToTile2d(i.x,i.y,C,w),E=l;c&&(E=(t.calculateTileZoom||maplibre_gl_Do)(e.zoom+maplibre_gl_shared_Ot(e.tileSize/t.tileSize),T,_,v,e.fov)),E=(t.roundZoom?Math.round:Math.floor)(E),E=Math.max(0,E);let ee=Math.min(E,d);if(p.wrap=s.getWrap(a,C,p.wrap),p.zoom>=ee){if(p.zoom<u)continue;let e=f-p.zoom,n=m[0]-.5-(g<<e),r=m[1]-.5-(y<<e),i=t.reparseOverscaled?Math.max(p.zoom,E):p.zoom;x.push({tileID:new maplibre_gl_shared_fb(p.zoom===d?i:p.zoom,p.wrap,p.zoom,g,y),distanceSq:maplibre_gl_shared_Xe([h[0]-.5-g,h[1]-.5-y]),tileDistanceToCamera:Math.sqrt(n*n+r*r)});continue}for(let e=0;e<4;e++){let t=(g<<1)+e%2,n=(y<<1)+(e>>1),r=p.zoom+1;b.push({zoom:r,x:t,y:n,wrap:p.wrap,fullyVisible:S})}}return x.sort((e,t)=>e.distanceSq-t.distanceSq).map(e=>e.tileID)}function maplibre_gl_Mo(e){return e===`raster`||e===`image`||e===`video`}function maplibre_gl_No(e,t,n,r,i,a,o){let s=maplibre_gl_U(),c=maplibre_gl_shared_ht(t);for(let l of t){let t=e.getTileById(l.key);(t.fadingDirection===0||t.fadeOpacity===0)&&t.resetFadeLogic(),!maplibre_gl_Po(e,t,n,s,r,i,o)&&(maplibre_gl_Fo(e,t,n,s,a,o)||maplibre_gl_Lo(t,c,s,o)||t.resetFadeLogic())}}function maplibre_gl_Po(e,t,n,r,i,a,o){if(!t.hasData())return!1;let{tileID:s,fadingRole:c,fadingDirection:l,fadingParentID:u}=t;if(c===0&&l===1&&u)return n[u.key]=u,!0;let d=Math.max(s.overscaledZ-i,a);for(let i=s.overscaledZ-1;i>=d;i--){let a=s.scaledTo(i),c=e.getLoadedTile(a);if(c)return t.setCrossFadeLogic({fadingRole:0,fadingDirection:1,fadingParentID:c.tileID,fadeEndTime:r+o}),c.setCrossFadeLogic({fadingRole:1,fadingDirection:0,fadeEndTime:r+o}),n[a.key]=a,!0}return!1}function maplibre_gl_Fo(e,t,n,r,i,a){if(!t.hasData())return!1;let o=t.tileID.children(i),s=maplibre_gl_Io(e,t,o,n,r,i,a);if(s)return!0;for(let c of o)maplibre_gl_Io(e,t,c.children(i),n,r,i,a)&&(s=!0);return s}function maplibre_gl_Io(e,t,n,r,i,a,o){if(n[0].overscaledZ>=a)return!1;let s=!1;for(let a of n){let n=e.getLoadedTile(a);if(!n)continue;let{fadingRole:c,fadingDirection:l,fadingParentID:u}=n;(c!==0||l!==0||!u)&&(n.setCrossFadeLogic({fadingRole:0,fadingDirection:0,fadingParentID:t.tileID,fadeEndTime:i+o}),t.setCrossFadeLogic({fadingRole:1,fadingDirection:1,fadeEndTime:i+o})),r[a.key]=a,s=!0}return s}function maplibre_gl_Lo(e,t,n,r){let i=e.tileID;if(e.selfFading)return!0;if(e.hasData())return!1;if(t.has(i)){let t=n+r;return e.setSelfFadeLogic(t),!0}return!1}function maplibre_gl_Ro(e,t){if(t<=0)return!1;let n=maplibre_gl_U();for(let t of e.getAllTiles())if(t.fadeEndTime>=n)return!0;return!1}function maplibre_gl_zo(e,t){let n=t.getRenderableIds();for(let r of n){if(!e.neighboringTiles?.[r])continue;let n=t.getTileById(r);e.neighboringTiles[r].backfilled||maplibre_gl_Bo(e,n),!n.neighboringTiles?.[e.tileID.key]?.backfilled&&maplibre_gl_Bo(n,e)}}function maplibre_gl_Bo(e,t){e.needsHillshadePrepare=!0,e.needsTerrainPrepare=!0,e.needsColorReliefPrepare=!0;let n=t.tileID.canonical.x-e.tileID.canonical.x,r=t.tileID.canonical.y-e.tileID.canonical.y,i=2**e.tileID.canonical.z,a=t.tileID.key;(n!==0||r!==0)&&(Math.abs(r)>1||(Math.abs(n)>1&&(Math.abs(n+i)===1?n+=i:Math.abs(n-i)===1&&(n-=i)),t.dem&&e.dem&&(e.dem.backfillBorder(t.dem,n,r),e.neighboringTiles?.[a]&&(e.neighboringTiles[a].backfilled=!0))))}var maplibre_gl_Vo=class{constructor(){this._tiles={}}handleWrapJump(e){let t={};for(let n in this._tiles){let r=this._tiles[n];r.tileID=r.tileID.unwrapTo(r.tileID.wrap+e),t[r.tileID.key]=r}this._tiles=t}setFeatureState(e,t,n){for(let r in this._tiles)this._tiles[r].setFeatureState(e,t,n)}getAllTiles(){return Object.values(this._tiles)}getAllIds(e=!1){return e?Object.values(this._tiles).map(e=>e.tileID).sort(maplibre_gl_shared_vb).map(e=>e.key):Object.keys(this._tiles)}getTileById(e){return this._tiles[e]}setTile(e,t){this._tiles[e]=t}deleteTileById(e){delete this._tiles[e]}getLoadedTile(e){let t=this.getTileById(e.key);return t?.hasData()?t:null}isIdRenderable(e,t=!1){return this.getTileById(e)?.isRenderable(t)}getRenderableIds(e=0,t){let n=[];for(let e of this.getAllIds())this.isIdRenderable(e,t)&&n.push(this.getTileById(e));return t?n.sort((t,n)=>{let r=t.tileID,i=n.tileID,a=new maplibre_gl_shared_l(r.canonical.x,r.canonical.y)._rotate(-e),o=new maplibre_gl_shared_l(i.canonical.x,i.canonical.y)._rotate(-e);return r.overscaledZ-i.overscaledZ||o.y-a.y||o.x-a.x}).map(e=>e.tileID.key):n.map(e=>e.tileID).sort(maplibre_gl_shared_vb).map(e=>e.key)}},maplibre_gl_Ho=class e extends maplibre_gl_shared_Fn{static{this.maxUnderzooming=10}static{this.maxOverzooming=3}constructor(e,t,n){super(),this._maxContentElevationSeen=0,this.id=e,this.dispatcher=n,this.on(`data`,e=>{this._dataHandler(e)}),this.on(`dataloading`,()=>{this._sourceErrored=!1}),this.on(`error`,()=>{this._sourceErrored=this._source.loaded()}),this._source=maplibre_gl_ao(e,t,n,this),this._inViewTiles=new maplibre_gl_Vo,this._outOfViewCache=new sT(0,e=>this._unloadTile(e)),this._timers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._rasterFadeDuration=0,this._maxFadingAncestorLevels=5,this._state=new maplibre_gl_o,this._didEmitContent=!1,this._updated=!1}onAdd(e){this.map=e,this._maxTileCacheSize=e?e._maxTileCacheSize:null,this._maxTileCacheZoomLevels=e?e._maxTileCacheZoomLevels:null,this._source?.onAdd&&this._source.onAdd(e)}onRemove(e){for(let e of this._inViewTiles.getAllTiles())e.unloadVectorData();this.clearTiles(),this._source?.onRemove&&this._source.onRemove(e),this._inViewTiles=new maplibre_gl_Vo}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(let e of this._inViewTiles.getAllTiles())if(e.state!==`loaded`&&e.state!==`errored`)return!1;return!0}getSource(){return this._source}getState(){return this._state}pause(){this._paused=!0}resume(){if(!this._paused)return;let e=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,e&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}async _loadTile(e,n,r,i){try{let t=await this._source.loadTile(e);this._tileLoaded(e,n,r,i,t)}catch(n){e.state=`errored`,n.status===404?this.update(this.transform,this.terrain):this._source.fire(new maplibre_gl_shared_Pn(maplibre_gl_shared_Qe(n),{tile:e}))}}_unloadTile(e){this._source.unloadTile&&this._source.unloadTile(e)}_abortTile(e){this._source.abortTile&&this._source.abortTile(e),this._source.fire(new maplibre_gl_K(`dataabort`,{tile:e,coord:e.tileID}))}serialize(){return this._source.serialize()}prepare(e){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._inViewTiles,this.map?this.map.painter:null);for(let t of this._inViewTiles.getAllTiles())t.upload(e),t.prepare(this.map.style.imageManager)}getIds(){return this._inViewTiles.getAllIds(!0)}getRenderableIds(e){return this._inViewTiles.getRenderableIds(this.transform?.bearingInRadians,e)}hasRenderableParent(e){let t=e.overscaledZ-1;if(t>=this._source.minzoom){let n=this.getLoadedTile(e.scaledTo(t));if(n)return this._inViewTiles.isIdRenderable(n.tileID.key)}return!1}reload(e,t=void 0){if(this._paused){this._shouldReloadOnResume=!0;return}this._outOfViewCache.reset();for(let n of this._inViewTiles.getAllIds()){let r=this._inViewTiles.getTileById(n);(!t||this._source.shouldReloadTile(r,t))&&(e?this._reloadTile(n,r.state===`errored`?`loading`:`expired`):r.state!==`errored`&&this._reloadTile(n,`reloading`))}}async _reloadTile(e,t){let n=this._inViewTiles.getTileById(e);if(!n)return;let r=n.hasData();n.state!==`loading`&&(n.state=t),await this._loadTile(n,e,t,r)}_tileLoaded(e,t,n,r,i){r||(e.timeAdded=maplibre_gl_U(),e.selfFading&&(e.fadeEndTime=e.timeAdded+this._rasterFadeDuration)),n===`expired`&&(e.refreshedUponExpiration=!0),this._setTileReloadTimer(t,e),!i?.unmodified&&(this.getSource().type===`raster-dem`&&e.dem&&maplibre_gl_zo(e,this._inViewTiles),e.featureStateRevision=-1,this._state.initializeTileState(e,this.map?this.map.painter:null),e.aborted||this._source.fire(new maplibre_gl_K(`data`,{tile:e,coord:e.tileID})))}getTile(e){return this.getTileByID(e.key)}getTileByID(e){return this._inViewTiles.getTileById(e)}_retainLoadedChildren(t,n){let r=this._getLoadedDescendents(n),i=new Set;for(let a of n){let n=r[a.key];if(!n?.length){i.add(a);continue}let o=a.overscaledZ+e.maxOverzooming,s=n.filter(e=>e.tileID.overscaledZ<=o);if(!s.length){i.add(a);continue}let c=Math.min(...s.map(e=>e.tileID.overscaledZ)),l=s.filter(e=>e.tileID.overscaledZ===c).map(e=>e.tileID);for(let e of l)t[e.key]=e;this._areDescendentsComplete(l,c,a.overscaledZ)||i.add(a)}return i}_getLoadedDescendents(e){let t={};for(let n of this._inViewTiles.getAllTiles().filter(e=>e.hasData()))for(let r of e)n.tileID.isChildOf(r)&&(t[r.key]||=[],t[r.key].push(n));return t}_areDescendentsComplete(e,t,n){return e.length===1&&e[0].isOverscaled()?e[0].overscaledZ===t:4**(t-n)===e.length}getLoadedTile(e){return this._inViewTiles.getLoadedTile(e)}updateCacheSize(e){let t=(Math.ceil(e.width/this._source.tileSize)+1)*(Math.ceil(e.height/this._source.tileSize)+1),n=this._maxTileCacheZoomLevels===null?maplibre_gl_shared_gn.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels,r=Math.floor(t*n),i=typeof this._maxTileCacheSize==`number`?Math.min(this._maxTileCacheSize,r):r;this._outOfViewCache.setMaxSize(i)}handleWrapJump(e){let t=(e-(this._prevLng===void 0?e:this._prevLng))/360,n=Math.round(t);this._prevLng=e,n&&(this._inViewTiles.handleWrapJump(n),this._resetTileReloadTimers())}_updateMaxContentElevation(){let e=this._maxContentElevationSeen,t=this.map?.style?._layers;if(!t)return e;let n=this._inViewTiles.getAllTiles();for(let r in t){let i=t[r];if(i.type!==`symbol`||i.source!==this.id||i.isHidden(this.transform.zoom))continue;let a=i;if(a.layout){e=Math.max(e,a.layout.get(`symbol-height-offset`).constantOr(0));for(let t of n){let n=t.getBucket(i);n&&n.maxHeightOffset>e&&(e=n.maxHeightOffset)}}}return this._maxContentElevationSeen=e,e}update(e,t){if(!this._sourceLoaded||this._paused)return;this.transform=e,this.terrain=t,this.updateCacheSize(e),this.handleWrapJump(this.transform.center.lng);let n;!this.used&&!this.usedForTerrain?n=[]:this._source.tileID?n=e.getVisibleUnwrappedCoordinates(this._source.tileID).map(e=>new maplibre_gl_shared_fb(e.canonical.z,e.wrap,e.canonical.z,e.canonical.x,e.canonical.y)):(n=maplibre_gl_jo(e,{tileSize:this.usedForTerrain?this.tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.type===`vector`&&this.map._zoomLevelsToOverscale!==void 0?Math.max(this._source.maxzoom,e.maxZoom-this.map._zoomLevelsToOverscale):this._source.maxzoom,roundZoom:!this.usedForTerrain&&this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled,terrain:t,calculateTileZoom:this._source.calculateTileZoom,maxContentElevation:this._updateMaxContentElevation()}),this._source.hasTile&&(n=n.filter(e=>this._source.hasTile(e)))),this.usedForTerrain&&(n=this._addTerrainIdealTiles(n));let r=n.length===0&&!this._updated&&this._didEmitContent;this._updated=!0,r&&this.fire(new maplibre_gl_K(`data`,{sourceDataType:`idle`,sourceId:this.id}));let i=maplibre_gl_Oo(e,this._source),a=this._updateRetainedTiles(n,i),o=maplibre_gl_Mo(this._source.type);o&&this._rasterFadeDuration>0&&!t&&maplibre_gl_No(this._inViewTiles,n,a,this._maxFadingAncestorLevels,this._source.minzoom,this._source.maxzoom,this._rasterFadeDuration),o?this._cleanUpRasterTiles(a):this._cleanUpVectorTiles(a)}_cleanUpRasterTiles(e){for(let t of this._inViewTiles.getAllIds())e[t]||this._removeTile(t)}_cleanUpVectorTiles(e){for(let t of this._inViewTiles.getAllIds()){let n=this._inViewTiles.getTileById(t);if(e[t]){n.clearSymbolFadeHold();continue}if(!n.hasSymbolBuckets){this._removeTile(t);continue}n.holdingForSymbolFade()?n.symbolFadeFinished()&&this._removeTile(t):n.setSymbolHoldDuration(this.map._fadeDuration)}}_addTerrainIdealTiles(e){let t=[];for(let n of e)if(n.canonical.z>this._source.minzoom){let e=n.scaledTo(n.canonical.z-1);t.push(e);let r=n.scaledTo(Math.max(this._source.minzoom,Math.min(n.canonical.z,5)));t.push(r)}return e.concat(t)}releaseSymbolFadeTiles(){for(let e of this._inViewTiles.getAllIds())this._inViewTiles.getTileById(e).holdingForSymbolFade()&&this._removeTile(e)}_updateRetainedTiles(t,n){let r=new Set;for(let e of t)this._addTile(e).hasData()||r.add(e);let i=t.reduce((e,t)=>(e[t.key]=t,e),{}),a=this._retainLoadedChildren(i,r),o={},s=Math.max(n-e.maxUnderzooming,this._source.minzoom);for(let e of a){let t=this._inViewTiles.getTileById(e.key),n=t?.wasRequested();for(let r=e.overscaledZ-1;r>=s;--r){let a=e.scaledTo(r);if(o[a.key])break;if(o[a.key]=!0,t=this.getTile(a),!t&&n&&(t=this._addTile(a)),t){let e=t.hasData();if((e||!this.map?.cancelPendingTileRequestsWhileZooming||n)&&(i[a.key]=a),n=t.wasRequested(),e)break}}}return i}_addTile(e){let t=this._inViewTiles.getTileById(e.key);if(t)return t;t=this._outOfViewCache.getAndRemove(e),t&&(t.resetFadeLogic(),this._setTileReloadTimer(e.key,t),t.tileID=e,this._state.initializeTileState(t,this.map?this.map.painter:null));let n=t;return t||(t=new maplibre_gl_ho(e,this._source.tileSize*e.overscaleFactor()),this._loadTile(t,e.key,t.state,!1)),t.uses++,this._inViewTiles.setTile(e.key,t),n||this._source.fire(new maplibre_gl_K(`dataloading`,{tile:t,coord:t.tileID})),t}_setTileReloadTimer(e,t){this._clearTileReloadTimer(e);let n=t.getExpiryTimeout();if(n){let t=()=>{this._reloadTile(e,`expired`),delete this._timers[e]};this._timers[e]=setTimeout(t,n)}}_clearTileReloadTimer(e){let t=this._timers[e];t&&(clearTimeout(t),delete this._timers[e])}_resetTileReloadTimers(){for(let e in this._timers)clearTimeout(this._timers[e]),delete this._timers[e];for(let e of this._inViewTiles.getAllIds()){let t=this._inViewTiles.getTileById(e);this._setTileReloadTimer(e,t)}}refreshTiles(e){for(let t of this._inViewTiles.getAllIds()){let n=this._inViewTiles.getTileById(t);(this._inViewTiles.isIdRenderable(t)||n.state==`errored`)&&e.some(e=>e.equals(n.tileID.canonical))&&this._reloadTile(t,`expired`)}}_removeTile(e){let t=this._inViewTiles.getTileById(e);t&&(t.uses--,this._inViewTiles.deleteTileById(e),this._clearTileReloadTimer(e),!(t.uses>0)&&(t.hasData()&&t.state!==`reloading`?this._outOfViewCache.add(t.tileID,t,t.getExpiryTimeout()):(t.aborted=!0,this._abortTile(t),this._unloadTile(t))))}_dataHandler(e){if(e.dataType===`source`){if(e.sourceDataType===`metadata`){this._sourceLoaded=!0;return}e.sourceDataType===`content`&&this._sourceLoaded&&!this._paused&&(this.reload(e.sourceDataChanged,e.shouldReloadTileOptions),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0)}}resetMaxContentElevation(){this._maxContentElevationSeen=0}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1,this.resetMaxContentElevation();for(let e of this._inViewTiles.getAllIds())this._removeTile(e);this._outOfViewCache.reset()}tilesIn(e,t,n){let r=[],i=this.transform;if(!i)return r;let a=i.getCoveringTilesDetailsProvider().allowWorldCopies(),o=n?i.getCameraQueryGeometry(e):e,s=e=>i.screenPointToMercatorCoordinate(e,this.terrain),c=this.transformBbox(e,s,!a),l=this.transformBbox(o,s,!a),u=this.getIds(),d=maplibre_gl_shared_xp.fromPoints(l);for(let e of u){let n=this._inViewTiles.getTileById(e);if(n.holdingForSymbolFade())continue;let o=a?[n.tileID]:[n.tileID.unwrapTo(-1),n.tileID.unwrapTo(0)],s=2**(i.zoom-n.tileID.overscaledZ),u=t*n.queryPadding*(/* inlined export .Rr */8192)/n.tileSize/s;for(let e of o){let t=d.map(t=>e.getTilePoint(new maplibre_gl_shared_Hp(t.x,t.y)));if(t.expandBy(u),t.intersects(maplibre_gl_shared_Sp)){let t=c.map(t=>e.getTilePoint(t)),i=l.map(t=>e.getTilePoint(t));r.push({tile:n,tileID:a?e:e.unwrapTo(0),queryGeometry:t,cameraQueryGeometry:i,scale:s})}}}return r}transformBbox(e,t,n){let r=e.map(t);if(n){let n=maplibre_gl_shared_xp.fromPoints(e);n.shrinkBy(Math.min(n.width(),n.height())*.001);let i=n.map(t);maplibre_gl_shared_xp.fromPoints(r).covers(i)||(r=r.map(e=>e.x>.5?new maplibre_gl_shared_Hp(e.x-1,e.y,e.z):e))}return r}getVisibleCoordinates(e){let t=this.getRenderableIds(e).map(e=>this._inViewTiles.getTileById(e).tileID);return this.transform&&this.transform.populateCache(t),t}hasTransition(){return this._source.hasTransition()?!0:maplibre_gl_Mo(this._source.type)&&maplibre_gl_Ro(this._inViewTiles,this._rasterFadeDuration)}setRasterFadeDuration(e){this._rasterFadeDuration=e}setFeatureState(e,t,n){e||=maplibre_gl_shared_bb,this._state.updateState(e,t,n)}removeFeatureState(e,t,n){e||=maplibre_gl_shared_bb,this._state.removeFeatureState(e,t,n)}getFeatureState(e,t){return e||=maplibre_gl_shared_bb,this._state.getState(e,t)}setDependencies(e,t,n){let r=this._inViewTiles.getTileById(e);r&&r.setDependencies(t,n)}reloadTilesForDependencies(e,t){for(let n of this._inViewTiles.getAllIds())this._inViewTiles.getTileById(n).hasDependency(e,t)&&this._reloadTile(n,`reloading`);this._outOfViewCache.filter(n=>!n.hasDependency(e,t))}areTilesLoaded(){for(let e of this._inViewTiles.getAllTiles())if(e.state!==`loaded`&&e.state!==`errored`)return!1;return!0}},maplibre_gl_Uo=class{constructor(e,t){this.reset(e,t)}reset(e,t){this.points=e||[],this._distances=[0];for(let e=1;e<this.points.length;e++)this._distances[e]=this._distances[e-1]+this.points[e].dist(this.points[e-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(t||0,this.length*.5),this.paddedLength=this.length-this.padding*2}lerp(e){if(this.points.length===1)return this.points[0];e=maplibre_gl_shared_yt(e,0,1);let t=1,n=this._distances[t],r=e*this.paddedLength+this.padding;for(;n<r&&t<this._distances.length;)n=this._distances[++t];let i=t-1,a=this._distances[i],o=n-a,s=o>0?(r-a)/o:0;return this.points[i].mult(1-s).add(this.points[t].mult(s))}};function maplibre_gl_Wo(e,t,n,r,i){return i?e?e(t,n)+r:r===0?void 0:r:r}function maplibre_gl_Go(e,t){let n=!0;return e===`always`||(e===`never`||t===`never`)&&(n=!1),n}var maplibre_gl_Ko=class{constructor(e,t,n){let r=this.boxCells=[],i=this.circleCells=[];this.xCellCount=Math.ceil(e/n),this.yCellCount=Math.ceil(t/n);for(let e=0;e<this.xCellCount*this.yCellCount;e++)r.push([]),i.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=e,this.height=t,this.xScale=this.xCellCount/e,this.yScale=this.yCellCount/t,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(e,t,n,r,i){this._forEachCell(t,n,r,i,this._insertBoxCell,this.boxUid++),this.boxKeys.push(e),this.bboxes.push(t),this.bboxes.push(n),this.bboxes.push(r),this.bboxes.push(i)}insertCircle(e,t,n,r){this._forEachCell(t-r,n-r,t+r,n+r,this._insertCircleCell,this.circleUid++),this.circleKeys.push(e),this.circles.push(t),this.circles.push(n),this.circles.push(r)}_insertBoxCell(e,t,n,r,i,a){this.boxCells[i].push(a)}_insertCircleCell(e,t,n,r,i,a){this.circleCells[i].push(a)}_query(e,t,n,r,i,a,o){if(n<0||e>this.width||r<0||t>this.height)return[];let s=[];if(e<=0&&t<=0&&this.width<=n&&this.height<=r){if(i)return[{key:null,x1:e,y1:t,x2:n,y2:r}];for(let e=0;e<this.boxKeys.length;e++)s.push({key:this.boxKeys[e],x1:this.bboxes[e*4],y1:this.bboxes[e*4+1],x2:this.bboxes[e*4+2],y2:this.bboxes[e*4+3]});for(let e=0;e<this.circleKeys.length;e++){let t=this.circles[e*3],n=this.circles[e*3+1],r=this.circles[e*3+2];s.push({key:this.circleKeys[e],x1:t-r,y1:n-r,x2:t+r,y2:n+r})}}else{let c={hitTest:i,overlapMode:a,seenUids:{box:{},circle:{}}};this._forEachCell(e,t,n,r,this._queryCell,s,c,o)}return s}query(e,t,n,r){return this._query(e,t,n,r,!1,null)}hitTest(e,t,n,r,i,a){return this._query(e,t,n,r,!0,i,a).length>0}hitTestCircle(e,t,n,r,i){let a=e-n,o=e+n,s=t-n,c=t+n;if(o<0||a>this.width||c<0||s>this.height)return!1;let l=[],u={hitTest:!0,overlapMode:r,circle:{x:e,y:t,radius:n},seenUids:{box:{},circle:{}}};return this._forEachCell(a,s,o,c,this._queryCellCircle,l,u,i),l.length>0}_queryCell(e,t,n,r,i,a,o,s){let{seenUids:c,hitTest:l,overlapMode:u}=o,d=this.boxCells[i],f=1e-6;if(d!==null){let i=this.bboxes;for(let o of d)if(!c.box[o]){c.box[o]=!0;let d=o*4,p=this.boxKeys[o];if(e<=i[d+2]+f&&t<=i[d+3]+f&&n>=i[d+0]-f&&r>=i[d+1]-f&&(!s||s(p))&&(!l||!maplibre_gl_Go(u,p.overlapMode))&&(a.push({key:p,x1:i[d],y1:i[d+1],x2:i[d+2],y2:i[d+3]}),l))return!0}}let p=this.circleCells[i];if(p!==null){let i=this.circles;for(let o of p)if(!c.circle[o]){c.circle[o]=!0;let d=o*3,f=this.circleKeys[o];if(this._circleAndRectCollide(i[d],i[d+1],i[d+2],e,t,n,r)&&(!s||s(f))&&(!l||!maplibre_gl_Go(u,f.overlapMode))){let e=i[d],t=i[d+1],n=i[d+2];if(a.push({key:f,x1:e-n,y1:t-n,x2:e+n,y2:t+n}),l)return!0}}}return!1}_queryCellCircle(e,t,n,r,i,a,o,s){let{circle:c,seenUids:l,overlapMode:u}=o,d=this.boxCells[i];if(d!==null){let e=this.bboxes;for(let t of d)if(!l.box[t]){l.box[t]=!0;let n=t*4,r=this.boxKeys[t];if(this._circleAndRectCollide(c.x,c.y,c.radius,e[n+0],e[n+1],e[n+2],e[n+3])&&(!s||s(r))&&!maplibre_gl_Go(u,r.overlapMode))return a.push(!0),!0}}let f=this.circleCells[i];if(f!==null){let e=this.circles;for(let t of f)if(!l.circle[t]){l.circle[t]=!0;let n=t*3,r=this.circleKeys[t];if(this._circlesCollide(e[n],e[n+1],e[n+2],c.x,c.y,c.radius)&&(!s||s(r))&&!maplibre_gl_Go(u,r.overlapMode))return a.push(!0),!0}}}_forEachCell(e,t,n,r,i,a,o,s){let c=this._convertToXCellCoord(e),l=this._convertToYCellCoord(t),u=this._convertToXCellCoord(n),d=this._convertToYCellCoord(r);for(let f=c;f<=u;f++)for(let c=l;c<=d;c++){let l=this.xCellCount*c+f;if(i.call(this,e,t,n,r,l,a,o,s))return}}_convertToXCellCoord(e){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(e*this.xScale)))}_convertToYCellCoord(e){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(e*this.yScale)))}_circlesCollide(e,t,n,r,i,a){let o=r-e,s=i-t,c=n+a;return c*c>o*o+s*s}_circleAndRectCollide(e,t,n,r,i,a,o){let s=(a-r)/2,c=Math.abs(e-(r+s));if(c>s+n)return!1;let l=(o-i)/2,u=Math.abs(t-(i+l));if(u>l+n)return!1;if(c<=s||u<=l)return!0;let d=c-s,f=u-l;return d*d+f*f<=n*n}};function maplibre_gl_qo(e,t){let n=1/(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]),r=1/(t[8]*t[8]+t[9]*t[9]+t[10]*t[10]),i=t[0]*n,a=t[4]*n,o=t[8]*r,s=t[1]*n,c=t[5]*n,l=t[9]*r,u=t[2]*n,d=t[6]*n,f=t[10]*r;e[0]=i,e[1]=a,e[2]=o,e[4]=s,e[5]=c,e[6]=l,e[8]=u,e[9]=d,e[10]=f;let p=t[12],m=t[13],h=t[14];return e[12]=-i*p-s*m-u*h,e[13]=-a*p-c*m-d*h,e[14]=-o*p-l*m-f*h,e[3]=0,e[7]=0,e[11]=0,e[15]=1,e}function maplibre_gl_Jo(e,t){return e[0]=1/t[0],e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1/t[5],e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=0,e[11]=1/t[14],e[12]=0,e[13]=0,e[14]=-1,e[15]=t[10]/t[14],e}function maplibre_gl_Yo(e,t){let n=1/(t[0]*t[5]-t[1]*t[4]);return e[0]=t[5]*n,e[1]=-t[1]*n,e[2]=0,e[3]=0,e[4]=-t[4]*n,e[5]=t[0]*n,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1/t[10],e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1/t[15],e}const maplibre_gl_Xo=maplibre_gl_shared_b();function maplibre_gl_Zo(e,t,n){let r=maplibre_gl_shared_b();if(!e){let{vecSouth:e,vecEast:n}=maplibre_gl_$o(t),i=maplibre_gl_Nr();i[0]=n[0],i[1]=n[1],i[2]=e[0],i[3]=e[1],maplibre_gl_Pr(i,i),r[0]=i[0],r[1]=i[1],r[4]=i[2],r[5]=i[3]}return maplibre_gl_shared_D(r,r,[1/n,1/n,1]),r}function maplibre_gl_Qo(e,t,n,r){if(e){let e=maplibre_gl_shared_b();if(!t){let{vecSouth:t,vecEast:r}=maplibre_gl_$o(n);e[0]=r[0],e[1]=r[1],e[4]=t[0],e[5]=t[1]}return maplibre_gl_shared_D(e,e,[r,r,1]),e}return n.pixelsToClipSpaceMatrix}function maplibre_gl_$o(e){let t=Math.cos(e.rollInRadians),n=Math.sin(e.rollInRadians),r=Math.cos(e.pitchInRadians),i=Math.cos(e.bearingInRadians),a=Math.sin(e.bearingInRadians),o=maplibre_gl_shared_Ue();o[0]=-i*r*n-a*t,o[1]=-a*r*n+i*t;let s=maplibre_gl_shared_Ke(o);s<1e-9?maplibre_gl_shared_Ye(o):maplibre_gl_shared_Ge(o,o,1/s);let c=maplibre_gl_shared_Ue();c[0]=i*r*t-a*n,c[1]=a*r*t+i*n;let l=maplibre_gl_shared_Ke(c);return l<1e-9?maplibre_gl_shared_Ye(c):maplibre_gl_shared_Ge(c,c,1/l),{vecEast:c,vecSouth:o}}function maplibre_gl_es(e,t,n){return maplibre_gl_Wo(e.getElevation,t,n,e.heightOffset??0,e.heightAnchorGround??!0)}function maplibre_gl_ts(e,t,n,r){let i;r==null?(i=[e,t,0,1],maplibre_gl_vs(i,i,n)):(i=[e,t,r,1],maplibre_gl_shared_Ne(i,i,n));let a=i[3];return{point:new maplibre_gl_shared_l(i[0]/a,i[1]/a),signedDistanceFromCamera:a,isOccluded:!1}}function maplibre_gl_ns(e,t){return .5+e/t*.5}function maplibre_gl_rs(e,t){return e.x>=-t[0]&&e.x<=t[0]&&e.y>=-t[1]&&e.y<=t[1]}function maplibre_gl_is(e,t,n,r,a,o,s,c,l,u,d,f,p){let m=n?e.textSizeData:e.iconSizeData,h=Hv(m,t.transform.zoom),g=[256/t.width*2+1,256/t.height*2+1],_=n?e.text.dynamicLayoutVertexArray:e.icon.dynamicLayoutVertexArray;_.clear();let v=e.lineVertexArray,y=n?e.text.placedSymbolArray:e.icon.placedSymbolArray,b=t.transform.width/t.transform.height,x=!1;for(let n=0;n<y.length;n++){let i=y.get(n);if(i.hidden||i.writingMode===2&&!x){maplibre_gl_s(i.numGlyphs,_);continue}x=!1;let S=new maplibre_gl_shared_l(i.anchorX,i.anchorY),C={getElevation:p,pitchedLabelPlaneMatrix:r,lineVertexArray:v,pitchWithMap:o,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},transform:t.transform,tileAnchorPoint:S,unwrappedTileID:l,width:u,height:d,translation:f},w=maplibre_gl_fs(i.anchorX,i.anchorY,C);if(!maplibre_gl_rs(w.point,g)){maplibre_gl_s(i.numGlyphs,_);continue}let T=w.signedDistanceFromCamera,E=maplibre_gl_ns(t.transform.cameraToCenterDistance,T),ee=Vv(m,h,i),D=o?ee*t.transform.getPitchedTextCorrection(i.anchorX,i.anchorY,l)/E:ee*E,O=maplibre_gl_ss({projectionContext:C,pitchedLabelPlaneMatrixInverse:a,symbol:i,fontSize:D,flip:!1,keepUpright:s,glyphOffsetArray:e.glyphOffsetArray,dynamicLayoutVertexArray:_,aspectRatio:b,rotateToLine:c});x=O.useVertical,(O.notEnoughRoom||x||O.needsFlipping&&maplibre_gl_ss({projectionContext:C,pitchedLabelPlaneMatrixInverse:a,symbol:i,fontSize:D,flip:!0,keepUpright:s,glyphOffsetArray:e.glyphOffsetArray,dynamicLayoutVertexArray:_,aspectRatio:b,rotateToLine:c}).notEnoughRoom)&&maplibre_gl_s(i.numGlyphs,_)}n?e.text.dynamicLayoutVertexBuffer.updateData(_):e.icon.dynamicLayoutVertexBuffer.updateData(_)}function maplibre_gl_as(e,t,n,r,i,a,o,s){let c=a.glyphStartIndex+a.numGlyphs,l=a.lineStartIndex,u=a.lineStartIndex+a.lineLength,d=t.getoffsetX(a.glyphStartIndex),f=t.getoffsetX(c-1),p=maplibre_gl_hs(e*d,n,r,i,a.segment,l,u,s,o);if(!p)return null;let m=maplibre_gl_hs(e*f,n,r,i,a.segment,l,u,s,o);return!m||s.projectionCache.anyProjectionOccluded?null:{first:p,last:m}}function maplibre_gl_os(e,t,n,r){return e===1&&Math.abs(n.y-t.y)>Math.abs(n.x-t.x)*r?{useVertical:!0}:(e===2?t.y<n.y:t.x>n.x)?{needsFlipping:!0}:null}function maplibre_gl_ss(e){let{projectionContext:t,pitchedLabelPlaneMatrixInverse:n,symbol:r,fontSize:i,flip:a,keepUpright:o,glyphOffsetArray:s,dynamicLayoutVertexArray:c,aspectRatio:l,rotateToLine:u}=e,d=i/24,f=r.lineOffsetX*d,m=r.lineOffsetY*d,h;if(r.numGlyphs>1){let e=r.glyphStartIndex+r.numGlyphs,i=r.lineStartIndex,c=r.lineStartIndex+r.lineLength,p=maplibre_gl_as(d,s,f,m,a,r,u,t);if(!p)return{notEnoughRoom:!0};let g=maplibre_gl_ds(p.first.point.x,p.first.point.y,t,n),_=maplibre_gl_ds(p.last.point.x,p.last.point.y,t,n);if(o&&!a){let e=maplibre_gl_os(r.writingMode,g,_,l);if(e)return e}h=[p.first];for(let n=r.glyphStartIndex+1;n<e-1;n++){let e=maplibre_gl_hs(d*s.getoffsetX(n),f,m,a,r.segment,i,c,t,u);if(!e)return{notEnoughRoom:!0};h.push(e)}h.push(p.last)}else{if(o&&!a){let e=maplibre_gl_us(t.tileAnchorPoint.x,t.tileAnchorPoint.y,t).point,i=r.lineStartIndex+r.segment+1,a=new maplibre_gl_shared_l(t.lineVertexArray.getx(i),t.lineVertexArray.gety(i)),o=maplibre_gl_us(a.x,a.y,t),s=o.signedDistanceFromCamera>0?o.point:maplibre_gl_cs(t.tileAnchorPoint,a,e,1,t),c=maplibre_gl_ds(e.x,e.y,t,n),u=maplibre_gl_ds(s.x,s.y,t,n),d=maplibre_gl_os(r.writingMode,c,u,l);if(d)return d}let e=maplibre_gl_hs(d*s.getoffsetX(r.glyphStartIndex),f,m,a,r.segment,r.lineStartIndex,r.lineStartIndex+r.lineLength,t,u);if(!e||t.projectionCache.anyProjectionOccluded)return{notEnoughRoom:!0};h=[e]}for(let e of h)Fy(c,e.point,e.angle);return{}}function maplibre_gl_cs(e,t,n,r,i){let a=e.add(e.sub(t)._unit()),o=maplibre_gl_us(a.x,a.y,i).point,s=n.sub(o);return n.add(s._mult(r/s.mag()))}function maplibre_gl_ls(e,t,n){let r=t.projectionCache;if(r.projections[e])return r.projections[e];let i=new maplibre_gl_shared_l(t.lineVertexArray.getx(e),t.lineVertexArray.gety(e)),a=maplibre_gl_us(i.x,i.y,t);if(a.signedDistanceFromCamera>0)return r.projections[e]=a.point,r.anyProjectionOccluded||=a.isOccluded,a.point;let o=e-n.direction,s=n.distanceFromAnchor===0?t.tileAnchorPoint:new maplibre_gl_shared_l(t.lineVertexArray.getx(o),t.lineVertexArray.gety(o)),c=n.absOffsetX-n.distanceFromAnchor+1;return maplibre_gl_cs(s,i,n.previousVertex,c,t)}function maplibre_gl_us(e,t,n){let r=e+n.translation[0],i=t+n.translation[1],a;return n.pitchWithMap?(a=maplibre_gl_ts(r,i,n.pitchedLabelPlaneMatrix,maplibre_gl_es(n,r,i)),a.isOccluded=!1):(a=n.transform.projectTileCoordinates(r,i,n.unwrappedTileID,maplibre_gl_es(n,r,i)),a.point.x=(a.point.x*.5+.5)*n.width,a.point.y=(-a.point.y*.5+.5)*n.height),a}function maplibre_gl_ds(e,t,n,r){if(n.pitchWithMap){let i=[e,t,0,1];maplibre_gl_shared_Ne(i,i,r);let a=i[0]/i[3],o=i[1]/i[3];return n.transform.projectTileCoordinates(a,o,n.unwrappedTileID,maplibre_gl_es(n,a,o)).point}return{x:e/n.width*2-1,y:1-t/n.height*2}}function maplibre_gl_fs(e,t,n){return n.transform.projectTileCoordinates(e,t,n.unwrappedTileID,maplibre_gl_es(n,e,t))}function maplibre_gl_ps(e,t,n){return e._unit()._perp()._mult(t*n)}function maplibre_gl_ms(e,t,n,r,i,a,o,s,c){if(s.projectionCache.offsets[e])return s.projectionCache.offsets[e];let l=n.add(t);if(e+c.direction<r||e+c.direction>=i)return s.projectionCache.offsets[e]=l,l;let u=maplibre_gl_ls(e+c.direction,s,c),d=maplibre_gl_ps(u.sub(n),o,c.direction),f=n.add(d),p=u.add(d);return s.projectionCache.offsets[e]=maplibre_gl_shared_Lt(a,l,f,p)||l,s.projectionCache.offsets[e]}function maplibre_gl_hs(e,t,n,r,i,a,o,s,c){let l=r?e-t:e+t,u=l>0?1:-1,d=0;r&&(u*=-1,d=Math.PI),u<0&&(d+=Math.PI);let f=u>0?a+i:a+i+1,p;s.projectionCache.cachedAnchorPoint?p=s.projectionCache.cachedAnchorPoint:(p=maplibre_gl_us(s.tileAnchorPoint.x,s.tileAnchorPoint.y,s).point,s.projectionCache.cachedAnchorPoint=p);let m=p,h=p,g,_,v=0,y=0,b=Math.abs(l),x=[],S;for(;v+y<=b;){if(f+=u,f<a||f>=o)return null;v+=y,h=m,_=g;let e={absOffsetX:b,direction:u,distanceFromAnchor:v,previousVertex:h};if(m=maplibre_gl_ls(f,s,e),n===0)x.push(h),S=m.sub(h);else{let t,r=m.sub(h);t=r.mag()===0?maplibre_gl_ps(maplibre_gl_ls(f+u,s,e).sub(m),n,u):maplibre_gl_ps(r,n,u),_||=h.add(t),g=maplibre_gl_ms(f,t,m,a,o,_,n,s,e),x.push(_),S=g.sub(_)}y=S.mag()}let C=(b-v)/y,w=S._mult(C)._add(_||h),T=d+Math.atan2(m.y-h.y,m.x-h.x);return x.push(w),{point:w,angle:c?T:0,path:x}}const maplibre_gl_gs=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function maplibre_gl_s(e,t){for(let n=0;n<e;n++){let e=t.length;t.resize(e+4),t.float32.set(maplibre_gl_gs,e*3)}}function maplibre_gl_vs(e,t,n){let r=t[0],i=t[1];return e[0]=n[0]*r+n[4]*i+n[12],e[1]=n[1]*r+n[5]*i+n[13],e[3]=n[3]*r+n[7]*i+n[15],e}function maplibre_gl_ys(e,t){let n=maplibre_gl_Xo;return maplibre_gl_Yo(n,t.pitchedLabelPlaneMatrix),e.map(e=>{let r=maplibre_gl_ts(e.x,e.y,n,maplibre_gl_es(t,e.x,e.y)),i=t.transform.projectTileCoordinates(r.point.x,r.point.y,t.unwrappedTileID,maplibre_gl_es(t,r.point.x,r.point.y));return i.point.x=(i.point.x*.5+.5)*t.width,i.point.y=(-i.point.y*.5+.5)*t.height,i})}function maplibre_gl_bs(e){let t=0,n=0,r=0,i=0;for(let a=0;a<e.length;a++)e[a].isOccluded?(r=a+1,i=0):(i++,i>n&&(n=i,t=r));return e.slice(t,t+n)}var maplibre_gl_xs=class{constructor(e,t=new maplibre_gl_Ko(e.width+200,e.height+200,25),n=new maplibre_gl_Ko(e.width+200,e.height+200,25)){this.transform=e,this.grid=t,this.ignoredGrid=n,this.pitchFactor=Math.cos(e.pitch*Math.PI/180)*e.cameraToCenterDistance,this.screenRightBoundary=e.width+100,this.screenBottomBoundary=e.height+100,this.gridRightBoundary=e.width+200,this.gridBottomBoundary=e.height+200,this.perspectiveRatioCutoff=.6}placeCollisionBox(e,t,n,r,i,a,o,s,c,l,u,d,f=0,p=!0){let m=e.anchorPointX+s[0],h=e.anchorPointY+s[1],g=this.projectAndGetPerspectiveRatio(m,h,i,maplibre_gl_Wo(l,m,h,f,p),d),_=n*g.perspectiveRatio,v;if(!a&&!o){let t=g.x+(u?u.x*_:0),n=g.y+(u?u.y*_:0);v={allPointsOccluded:!1,box:[t+e.x1*_,n+e.y1*_,t+e.x2*_,n+e.y2*_]}}else v=this._projectCollisionBox(e,_,r,i,a,o,s,g,l,u,d,f,p);let[y,b,x,S]=v.box,C=a?v.allPointsOccluded:g.isOccluded,w=C;return w||=g.perspectiveRatio<this.perspectiveRatioCutoff,w||=!this.isInsideGrid(y,b,x,S),w||t!==`always`&&this.grid.hitTest(y,b,x,S,t,c)?{box:[y,b,x,S],placeable:!1,offscreen:!1,occluded:C}:{box:[y,b,x,S],placeable:!0,offscreen:this.isOffscreen(y,b,x,S),occluded:C}}placeCollisionCircles(e,t,n,r,i,a,o,s,c,l,u,d,f,p){let m=[],h=new maplibre_gl_shared_l(t.anchorX,t.anchorY),g=this.getPerspectiveRatio(h.x,h.y,a,p?.(h.x,h.y)),_=(c?i*this.transform.getPitchedTextCorrection(t.anchorX,t.anchorY,a)/g:i*g)/24,v={projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},y=t.lineOffsetX*_,b=t.lineOffsetY*_,x={getElevation:p,pitchedLabelPlaneMatrix:o,lineVertexArray:n,pitchWithMap:c,projectionCache:v,transform:this.transform,tileAnchorPoint:h,unwrappedTileID:a,width:this.transform.width,height:this.transform.height,translation:f},S=maplibre_gl_as(_,r,y,b,!1,t,!1,x),C=!1,w=!1,T=!0;if(S){let t=u*.5*g+d,n=new maplibre_gl_shared_l(-100,-100),r=new maplibre_gl_shared_l(this.screenRightBoundary,this.screenBottomBoundary),i=new maplibre_gl_Uo,a=S.first,o=S.last,f=[];for(let e=a.path.length-1;e>=1;e--)f.push(a.path[e]);for(let e=1;e<o.path.length;e++)f.push(o.path[e]);let p=t*2.5;if(c){let e=this.projectPathToScreenSpace(f,x);f=e.some(e=>e.signedDistanceFromCamera<=0)?[]:e.map(e=>e.point)}let h=[];if(f.length>0){let e=f[0].clone(),t=f[0].clone();for(let n=1;n<f.length;n++)e.x=Math.min(e.x,f[n].x),e.y=Math.min(e.y,f[n].y),t.x=Math.max(t.x,f[n].x),t.y=Math.max(t.y,f[n].y);h=e.x>=n.x&&t.x<=r.x&&e.y>=n.y&&t.y<=r.y?[f]:t.x<n.x||e.x>r.x||t.y<n.y||e.y>r.y?[]:$v([f],n.x,n.y,r.x,r.y)}for(let n of h){i.reset(n,t*.25);let r=0;r=i.length<=.5*t?1:Math.ceil(i.paddedLength/p)+1;for(let n=0;n<r;n++){let a=n/Math.max(r-1,1),o=i.lerp(a),c=o.x+100,u=o.y+100;m.push(c,u,t,0);let d=c-t,f=u-t,p=c+t,h=u+t;if(T&&=this.isOffscreen(d,f,p,h),w||=this.isInsideGrid(d,f,p,h),e!==`always`&&this.grid.hitTestCircle(c,u,t,e,l)&&(C=!0,!s))return{circles:[],offscreen:!1,collisionDetected:C}}}}return{circles:!s&&C||!w||g<this.perspectiveRatioCutoff?[]:m,offscreen:T,collisionDetected:C}}projectPathToScreenSpace(e,t){return maplibre_gl_bs(maplibre_gl_ys(e,t))}queryRenderedSymbols(e){if(e.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};let t=[],n=new maplibre_gl_shared_xp;for(let r of e){let e=new maplibre_gl_shared_l(r.x+100,r.y+100);n.extend(e),t.push(e)}let{minX:r,minY:i,maxX:a,maxY:o}=n,s=this.grid.query(r,i,a,o).concat(this.ignoredGrid.query(r,i,a,o)),c={},l={};for(let e of s){let n=e.key;if(c[n.bucketInstanceId]===void 0&&(c[n.bucketInstanceId]={}),c[n.bucketInstanceId][n.featureIndex])continue;let r=[new maplibre_gl_shared_l(e.x1,e.y1),new maplibre_gl_shared_l(e.x2,e.y1),new maplibre_gl_shared_l(e.x2,e.y2),new maplibre_gl_shared_l(e.x1,e.y2)];maplibre_gl_shared_Wu(t,r)&&(c[n.bucketInstanceId][n.featureIndex]=!0,l[n.bucketInstanceId]===void 0&&(l[n.bucketInstanceId]=[]),l[n.bucketInstanceId].push(n.featureIndex))}return l}insertCollisionBox(e,t,n,r,i,a){let o=n?this.ignoredGrid:this.grid,s={bucketInstanceId:r,featureIndex:i,collisionGroupID:a,overlapMode:t};o.insert(s,e[0],e[1],e[2],e[3])}insertCollisionCircles(e,t,n,r,i,a){let o=n?this.ignoredGrid:this.grid,s={bucketInstanceId:r,featureIndex:i,collisionGroupID:a,overlapMode:t};for(let t=0;t<e.length;t+=4)o.insertCircle(s,e[t],e[t+1],e[t+2])}projectAndGetPerspectiveRatio(e,t,n,r,i){if(i){let n;r==null?(n=[e,t,0,1],maplibre_gl_vs(n,n,i)):(n=[e,t,r,1],maplibre_gl_shared_Ne(n,n,i));let a=n[3];return{x:(n[0]/a+1)/2*this.transform.width+100,y:(-n[1]/a+1)/2*this.transform.height+100,perspectiveRatio:.5+.5*(this.transform.cameraToCenterDistance/a),isOccluded:!1,signedDistanceFromCamera:a}}{let i=this.transform.projectTileCoordinates(e,t,n,r);return{x:(i.point.x+1)/2*this.transform.width+100,y:(-i.point.y+1)/2*this.transform.height+100,perspectiveRatio:.5+.5*(this.transform.cameraToCenterDistance/i.signedDistanceFromCamera),isOccluded:i.isOccluded,signedDistanceFromCamera:i.signedDistanceFromCamera}}}getPerspectiveRatio(e,t,n,r){let i=this.transform.projectTileCoordinates(e,t,n,r);return .5+.5*(this.transform.cameraToCenterDistance/i.signedDistanceFromCamera)}isOffscreen(e,t,n,r){return n<100||e>=this.screenRightBoundary||r<100||t>this.screenBottomBoundary}isInsideGrid(e,t,n,r){return n>=0&&e<this.gridRightBoundary&&r>=0&&t<this.gridBottomBoundary}getViewportMatrix(){let e=maplibre_gl_shared_C([]);return maplibre_gl_shared_E(e,e,[-100,-100,0]),e}_projectCollisionBox(e,t,n,r,i,a,o,s,c,l,u,d=0,f=!0){let p=1,m=0,h=0,g=1,_=e.anchorPointX+o[0],v=e.anchorPointY+o[1];if(a&&!i){let e=this.projectAndGetPerspectiveRatio(_+1,v,r,maplibre_gl_Wo(c,_+1,v,d,f),u),t=e.x-s.x,n=e.y-s.y,i=Math.atan(n/t)+(t<0?Math.PI:0),a=Math.sin(i),o=Math.cos(i);p=o,m=a,h=-a,g=o}else if(!a&&i){let e=maplibre_gl_$o(this.transform);p=e.vecEast[0],m=e.vecEast[1],h=e.vecSouth[0],g=e.vecSouth[1]}let y=s.x,b=s.y,x=t;if(i&&(y=_,b=v,x=2**-(this.transform.zoom-n.overscaledZ),x*=this.transform.getPitchedTextCorrection(_,v,r),!l)){let e=s.signedDistanceFromCamera/this.transform.cameraToCenterDistance,t=maplibre_gl_shared_yt(.5+.5*e,0,4);x*=t}l&&(y+=p*l.x*x+h*l.y*x,b+=m*l.x*x+g*l.y*x);let S=e.x1*x,C=e.x2*x,w=(S+C)/2,T=e.y1*x,E=e.y2*x,ee=(T+E)/2,D=[{offsetX:S,offsetY:T},{offsetX:w,offsetY:T},{offsetX:C,offsetY:T},{offsetX:C,offsetY:ee},{offsetX:C,offsetY:E},{offsetX:w,offsetY:E},{offsetX:S,offsetY:E},{offsetX:S,offsetY:ee}],O=[];for(let{offsetX:e,offsetY:t}of D)O.push(new maplibre_gl_shared_l(y+p*e+h*t,b+m*e+g*t));let te=!1;if(i){let e=O.map(e=>this.projectAndGetPerspectiveRatio(e.x,e.y,r,maplibre_gl_Wo(c,e.x,e.y,d,f),u));te=e.some(e=>!e.isOccluded),O=e.map(e=>new maplibre_gl_shared_l(e.x,e.y))}else te=!0;return{box:maplibre_gl_shared_mt(O),allPointsOccluded:!te}}},maplibre_gl_Ss=class{constructor(e,t,n,r){this.opacity=e?Math.max(0,Math.min(1,e.opacity+(e.placed?t:-t))):r&&n?1:0,this.placed=n}isHidden(){return this.opacity===0&&!this.placed}},maplibre_gl_Cs=class{constructor(e,t,n,r,i){this.text=new maplibre_gl_Ss(e?e.text:null,t,n,i),this.icon=new maplibre_gl_Ss(e?e.icon:null,t,r,i)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}},maplibre_gl_ws=class{constructor(e,t,n){this.text=e,this.icon=t,this.skipFade=n}},maplibre_gl_Ts=class{constructor(e,t,n,r,i){this.bucketInstanceId=e,this.featureIndex=t,this.sourceLayerIndex=n,this.bucketIndex=r,this.tileID=i}},maplibre_gl_Es=class{constructor(e){this.crossSourceCollisions=e,this.maxGroupID=0,this.collisionGroups={}}get(e){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[e]){let t=++this.maxGroupID;this.collisionGroups[e]={ID:t,predicate:e=>e.collisionGroupID===t}}return this.collisionGroups[e]}};function maplibre_gl_Ds(e,t,n,r,i){let{horizontalAlign:a,verticalAlign:o}=_v(e),s=-(a-.5)*t,c=-(o-.5)*n;return new maplibre_gl_shared_l(s+r[0]*i,c+r[1]*i)}var maplibre_gl_Os=class{constructor(e,t,n,r,i){this.transform=e.clone(),this.terrain=t,this.collisionIndex=new maplibre_gl_xs(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=n,this.retainedQueryData={},this.collisionGroups=new maplibre_gl_Es(r),this.collisionCircleArrays={},this.collisionBoxArrays=new Map,this.prevPlacement=i,i&&(i.prevPlacement=void 0),this.placedOrientations={}}_getTerrainElevationFunc(e){let t=this.terrain;if(t)return(n,r)=>t.getElevation(e,n,r)}getBucketParts(e,t,n,r){let a=n.getBucket(t),o=n.latestFeatureIndex;if(!a||!o||t.id!==a.layerIds[0])return;let s=n.collisionBoxArray,c=a.layers[0].layout,l=a.layers[0].paint,u=2**(this.transform.zoom-n.tileID.overscaledZ),d=n.tileSize/(/* inlined export .Rr */8192),f=n.tileID.toUnwrapped(),p=c.get(`text-rotation-alignment`)===`map`,m=maplibre_gl_shared_N(n,1,this.transform.zoom),h=maplibre_gl_shared_it(this.collisionIndex.transform,n,l.get(`text-translate`),l.get(`text-translate-anchor`)),g=maplibre_gl_shared_it(this.collisionIndex.transform,n,l.get(`icon-translate`),l.get(`icon-translate-anchor`)),_=maplibre_gl_Zo(p,this.transform,m);this.retainedQueryData[a.bucketInstanceId]=new maplibre_gl_Ts(a.bucketInstanceId,o,a.sourceLayerIndex,a.index,n.tileID);let v={bucket:a,layout:c,translationText:h,translationIcon:g,unwrappedTileID:f,pitchedLabelPlaneMatrix:_,scale:u,textPixelRatio:d,holdingForFade:n.holdingForSymbolFade(),collisionBoxArray:s,partiallyEvaluatedTextSize:Hv(a.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(a.sourceID)};if(r)for(let t of a.sortKeyRanges){let{sortKey:n,symbolInstanceStart:r,symbolInstanceEnd:i}=t;e.push({sortKey:n,symbolInstanceStart:r,symbolInstanceEnd:i,parameters:v})}else e.push({symbolInstanceStart:0,symbolInstanceEnd:a.symbolInstances.length,parameters:v})}attemptAnchorPlacement(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b,x){let C=by[e.textAnchor],w=[e.textOffset0,e.textOffset1],T=maplibre_gl_Ds(C,n,r,w,i),E=this.collisionIndex.placeCollisionBox(t,d,s,c,l,o,a,h,u.predicate,v,T,y,b,x);if((!_||this.collisionIndex.placeCollisionBox(_,d,s,c,l,o,a,g,u.predicate,v,T,y,b,x).placeable)&&E.placeable){let e;if(this.prevPlacement?.variableOffsets[f.crossTileID]&&this.prevPlacement?.placements[f.crossTileID]?.text&&(e=this.prevPlacement.variableOffsets[f.crossTileID].anchor),f.crossTileID===0)throw Error(`symbolInstance.crossTileID can't be 0`);return this.variableOffsets[f.crossTileID]={textOffset:w,width:n,height:r,anchor:C,textBoxScale:i,prevAnchor:e},this.markUsedJustification(p,C,f,m),p.allowVerticalPlacement&&(this.markUsedOrientation(p,m,f),this.placedOrientations[f.crossTileID]=m),{shift:T,placedGlyphBoxes:E}}}placeLayerBucketPart(e,t,n){let{bucket:r,layout:i,translationText:a,translationIcon:o,unwrappedTileID:s,pitchedLabelPlaneMatrix:c,textPixelRatio:l,holdingForFade:u,collisionBoxArray:d,partiallyEvaluatedTextSize:f,collisionGroup:p}=e.parameters,m=i.get(`text-optional`),h=i.get(`icon-optional`),g=My(i,`text-overlap`,`text-allow-overlap`),_=g===`always`,v=My(i,`icon-overlap`,`icon-allow-overlap`),y=v===`always`,b=i.get(`text-rotation-alignment`)===`map`,x=i.get(`text-pitch-alignment`)===`map`,C=i.get(`icon-text-fit`)!==`none`,w=i.get(`symbol-z-order`)===`viewport-y`,T=i.get(`symbol-height-anchor`)===`ground`,E=_&&(y||!r.hasIconData()||h),ee=y&&(_||!r.hasTextData()||m);!r.collisionArrays&&d&&r.deserializeCollisionBoxes(d);let D=this.retainedQueryData[r.bucketInstanceId].tileID,O=this._getTerrainElevationFunc(D),te=this.transform.getFastPathSimpleProjectionMatrix(D),k=(e,d,y)=>{if(t[e.crossTileID])return;if(u){this.placements[e.crossTileID]=new maplibre_gl_ws(!1,!1,!1);return}let w=e.heightOffset,k=!1,ne=!1,re=!0,ie=null,ae={box:null,placeable:!1,offscreen:null,occluded:!1},oe={box:null,placeable:!1,offscreen:null},se=null,ce=null,le=null,ue=0,de=0,fe=0;d.textFeatureIndex?ue=d.textFeatureIndex:e.useRuntimeCollisionCircles&&(ue=e.featureIndex),d.verticalTextFeatureIndex&&(de=d.verticalTextFeatureIndex);let pe=d.textBox;if(pe){let t=t=>{let n=1;if(r.allowVerticalPlacement&&!t&&this.prevPlacement){let t=this.prevPlacement.placedOrientations[e.crossTileID];t&&(this.placedOrientations[e.crossTileID]=t,n=t,this.markUsedOrientation(r,n,e))}return n},i=(t,n)=>{if(r.allowVerticalPlacement&&e.numVerticalGlyphVertices>0&&d.verticalTextBox){for(let e of r.writingModes)if(e===2?(ae=n(),oe=ae):ae=t(),ae?.placeable)break}else ae=t()},c=e.textAnchorOffsetStartIndex,u=e.textAnchorOffsetEndIndex;if(u===c){let n=(t,n)=>{let i=this.collisionIndex.placeCollisionBox(t,g,l,D,s,x,b,a,p.predicate,O,void 0,te,w,T);return i?.placeable&&(this.markUsedOrientation(r,n,e),this.placedOrientations[e.crossTileID]=n),i};i(()=>n(pe,1),()=>{let t=d.verticalTextBox;return r.allowVerticalPlacement&&e.numVerticalGlyphVertices>0&&t?n(t,2):{box:null,offscreen:null}}),t(ae?.placeable)}else{let f=by[this.prevPlacement?.variableOffsets[e.crossTileID]?.anchor],m=(t,i,d)=>{let m=t.x2-t.x1,h=t.y2-t.y1,_=e.textBoxScale,y=C&&v===`never`?i:null,S=null,E=g===`never`?1:2,ee=`never`;f&&E++;for(let n=0;n<E;n++){for(let n=c;n<u;n++){let i=r.textAnchorOffsets.get(n);if(f&&i.textAnchor!==f)continue;let c=this.attemptAnchorPlacement(i,t,m,h,_,b,x,l,D,s,p,ee,e,r,d,a,o,y,O,te,w,T);if(c&&(S=c.placedGlyphBoxes,S?.placeable))return k=!0,ie=c.shift,S}f?f=null:ee=g}return n&&!S&&(S={box:this.collisionIndex.placeCollisionBox(pe,`always`,l,D,s,x,b,a,p.predicate,O,void 0,te,w,T).box,offscreen:!1,placeable:!1,occluded:!1}),S};i(()=>m(pe,d.iconBox,1),()=>{let t=d.verticalTextBox,n=ae?.placeable;return r.allowVerticalPlacement&&!n&&e.numVerticalGlyphVertices>0&&t?m(t,d.verticalIconBox,2):{box:null,occluded:!0,offscreen:null}}),ae&&(k=ae.placeable,re=ae.offscreen);let h=t(ae?.placeable);if(!k&&this.prevPlacement){let t=this.prevPlacement.variableOffsets[e.crossTileID];t&&(this.variableOffsets[e.crossTileID]=t,this.markUsedJustification(r,t.anchor,e,h))}}}if(se=ae,k=se?.placeable,re=se?.offscreen,e.useRuntimeCollisionCircles&&e.centerJustifiedTextSymbolIndex>=0){let t=r.text.placedSymbolArray.get(e.centerJustifiedTextSymbolIndex),o=Vv(r.textSizeData,f,t),l=i.get(`text-padding`),u=e.collisionCircleDiameter;ce=this.collisionIndex.placeCollisionCircles(g,t,r.lineVertexArray,r.glyphOffsetArray,o,s,c,n,x,p.predicate,u,l,a,O),ce.circles.length&&ce.collisionDetected&&!n&&maplibre_gl_shared_Ft(`Collisions detected, but collision boxes are not shown`),k=_||ce.circles.length>0&&!ce.collisionDetected,re&&=ce.offscreen}if(d.iconFeatureIndex&&(fe=d.iconFeatureIndex),d.iconBox){let e=e=>this.collisionIndex.placeCollisionBox(e,v,l,D,s,x,b,o,p.predicate,O,C&&ie?ie:void 0,te,w,T);oe&&oe.placeable&&d.verticalIconBox?(le=e(d.verticalIconBox),ne=le.placeable):(le=e(d.iconBox),ne=le.placeable),re&&=le.offscreen}let me=m||e.numHorizontalGlyphVertices===0&&e.numVerticalGlyphVertices===0,he=h||e.numIconVertices===0;!me&&!he?ne=k=ne&&k:he?me||(ne&&=k):k=ne&&k;let ge=k&&se.placeable,A=ne&&le.placeable;if(ge&&(oe&&oe.placeable&&de?this.collisionIndex.insertCollisionBox(se.box,g,i.get(`text-ignore-placement`),r.bucketInstanceId,de,p.ID):this.collisionIndex.insertCollisionBox(se.box,g,i.get(`text-ignore-placement`),r.bucketInstanceId,ue,p.ID)),A&&this.collisionIndex.insertCollisionBox(le.box,v,i.get(`icon-ignore-placement`),r.bucketInstanceId,fe,p.ID),ce&&k&&this.collisionIndex.insertCollisionCircles(ce.circles,g,i.get(`text-ignore-placement`),r.bucketInstanceId,ue,p.ID),n&&this.storeCollisionData(r.bucketInstanceId,y,d,se,le,ce),e.crossTileID===0)throw Error(`symbolInstance.crossTileID can't be 0`);if(r.bucketInstanceId===0)throw Error(`bucket.bucketInstanceId can't be 0`);let _e=(k||E)&&!se?.occluded,ve=(ne||ee)&&!le?.occluded;this.placements[e.crossTileID]=new maplibre_gl_ws(_e,ve,re||r.justReloaded),t[e.crossTileID]=!0};if(w){if(e.symbolInstanceStart!==0)throw Error(`bucket.bucketInstanceId should be 0`);let t=r.getSortedSymbolIndexes(-this.transform.bearingInRadians);for(let e=t.length-1;e>=0;--e){let n=t[e];k(r.symbolInstances.get(n),r.collisionArrays[n],n)}}else for(let t=e.symbolInstanceStart;t<e.symbolInstanceEnd;t++)k(r.symbolInstances.get(t),r.collisionArrays[t],t);r.justReloaded=!1}storeCollisionData(e,t,n,r,i,a){if(n.textBox||n.iconBox){let a;this.collisionBoxArrays.has(e)?a=this.collisionBoxArrays.get(e):(a=new Map,this.collisionBoxArrays.set(e,a));let o;a.has(t)?o=a.get(t):(o={text:null,icon:null},a.set(t,o)),n.textBox&&(o.text=r.box),n.iconBox&&(o.icon=i.box)}if(a){let t=this.collisionCircleArrays[e];t===void 0&&(t=this.collisionCircleArrays[e]=[]);for(let e=0;e<a.circles.length;e+=4)t.push(a.circles[e+0]-100),t.push(a.circles[e+1]-100),t.push(a.circles[e+2]),t.push(+!!a.collisionDetected)}}markUsedJustification(e,t,n,r){let i={left:n.leftJustifiedTextSymbolIndex,center:n.centerJustifiedTextSymbolIndex,right:n.rightJustifiedTextSymbolIndex},a;a=r===2?n.verticalPlacedTextSymbolIndex:i[Ty(t)];let o=[n.leftJustifiedTextSymbolIndex,n.centerJustifiedTextSymbolIndex,n.rightJustifiedTextSymbolIndex,n.verticalPlacedTextSymbolIndex];for(let t of o)t>=0&&(a>=0&&t!==a?e.text.placedSymbolArray.get(t).crossTileID=0:e.text.placedSymbolArray.get(t).crossTileID=n.crossTileID)}markUsedOrientation(e,t,n){let r=t===1||t===3?t:0,i=t===2?t:0,a=[n.leftJustifiedTextSymbolIndex,n.centerJustifiedTextSymbolIndex,n.rightJustifiedTextSymbolIndex];for(let t of a)e.text.placedSymbolArray.get(t).placedOrientation=r;n.verticalPlacedTextSymbolIndex&&(e.text.placedSymbolArray.get(n.verticalPlacedTextSymbolIndex).placedOrientation=i)}commit(e){this.commitTime=e,this.zoomAtLastRecencyCheck=this.transform.zoom;let t=this.prevPlacement,n=!1;this.prevZoomAdjustment=t?t.zoomAdjustment(this.transform.zoom):0;let r=t?t.symbolFadeChange(e):1,i=t?t.opacities:{},a=t?t.variableOffsets:{},o=t?t.placedOrientations:{};for(let e in this.placements){let t=this.placements[e],a=i[e];a?(this.opacities[e]=new maplibre_gl_Cs(a,r,t.text,t.icon),n||=t.text!==a.text.placed,n||=t.icon!==a.icon.placed):(this.opacities[e]=new maplibre_gl_Cs(null,r,t.text,t.icon,t.skipFade),n||=t.text||t.icon)}for(let e in i){let t=i[e];if(!this.opacities[e]){let i=new maplibre_gl_Cs(t,r,!1,!1);i.isHidden()||(this.opacities[e]=i,n||=t.text.placed,n||=t.icon.placed)}}for(let e in a)!this.variableOffsets[e]&&this.opacities[e]&&!this.opacities[e].isHidden()&&(this.variableOffsets[e]=a[e]);for(let e in o)!this.placedOrientations[e]&&this.opacities[e]&&!this.opacities[e].isHidden()&&(this.placedOrientations[e]=o[e]);if(t&&t.lastPlacementChangeTime===void 0)throw Error(`Last placement time for previous placement is not defined`);n?this.lastPlacementChangeTime=e:typeof this.lastPlacementChangeTime!=`number`&&(this.lastPlacementChangeTime=t?t.lastPlacementChangeTime:e)}updateLayerOpacities(e,t){let n={};for(let r of t){let t=r.getBucket(e);t&&r.latestFeatureIndex&&e.id===t.layerIds[0]&&this.updateBucketOpacities(t,r.tileID,n,r.collisionBoxArray)}}updateBucketOpacities(e,t,n,r){e.hasTextData()&&(e.text.opacityVertexArray.clear(),e.text.hasVisibleVertices=!1),e.hasIconData()&&(e.icon.opacityVertexArray.clear(),e.icon.hasVisibleVertices=!1),e.hasIconCollisionBoxData()&&e.iconCollisionBox.collisionVertexArray.clear(),e.hasTextCollisionBoxData()&&e.textCollisionBox.collisionVertexArray.clear();let i=e.layers[0],a=i.layout,o=new maplibre_gl_Cs(null,0,!1,!1,!0),s=a.get(`text-allow-overlap`),c=a.get(`icon-allow-overlap`),l=i._unevaluatedLayout.hasValue(`text-variable-anchor`)||i._unevaluatedLayout.hasValue(`text-variable-anchor-offset`),u=a.get(`text-rotation-alignment`)===`map`,d=a.get(`text-pitch-alignment`)===`map`,f=a.get(`icon-text-fit`)!==`none`,p=new maplibre_gl_Cs(null,0,s&&(c||!e.hasIconData()||a.get(`icon-optional`)),c&&(s||!e.hasTextData()||a.get(`text-optional`)),!0);!e.collisionArrays&&r&&(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData())&&e.deserializeCollisionBoxes(r);let m=(e,t,n)=>{for(let r=0;r<t/4;r++)e.opacityVertexArray.emplaceBack(n);e.hasVisibleVertices||=n!==maplibre_gl_Fs},h=this.collisionBoxArrays.get(e.bucketInstanceId);for(let t=0;t<e.symbolInstances.length;t++){let r=e.symbolInstances.get(t),{numHorizontalGlyphVertices:i,numVerticalGlyphVertices:a,crossTileID:s}=r,c=n[s],g=this.opacities[s];c?g=o:g||(g=p,this.opacities[s]=g),n[s]=!0;let _=i>0||a>0,v=r.numIconVertices>0,y=this.placedOrientations[r.crossTileID],b=y===2,x=y===1||y===3;if(_){let t=maplibre_gl_Ps(g.text),n=b?maplibre_gl_Fs:t;m(e.text,i,n);let o=x?maplibre_gl_Fs:t;m(e.text,a,o);let s=g.text.isHidden(),c=[r.rightJustifiedTextSymbolIndex,r.centerJustifiedTextSymbolIndex,r.leftJustifiedTextSymbolIndex];for(let t of c)t>=0&&(e.text.placedSymbolArray.get(t).hidden=s||b?1:0);r.verticalPlacedTextSymbolIndex>=0&&(e.text.placedSymbolArray.get(r.verticalPlacedTextSymbolIndex).hidden=s||x?1:0);let l=this.variableOffsets[r.crossTileID];l&&this.markUsedJustification(e,l.anchor,r,y);let u=this.placedOrientations[r.crossTileID];u&&(this.markUsedJustification(e,`left`,r,u),this.markUsedOrientation(e,u,r))}if(v){let t=maplibre_gl_Ps(g.icon),n=!(f&&r.verticalPlacedIconSymbolIndex&&b);if(r.placedIconSymbolIndex>=0){let i=n?t:maplibre_gl_Fs;m(e.icon,r.numIconVertices,i),e.icon.placedSymbolArray.get(r.placedIconSymbolIndex).hidden=g.icon.isHidden()}if(r.verticalPlacedIconSymbolIndex>=0){let i=n?maplibre_gl_Fs:t;m(e.icon,r.numVerticalIconVertices,i),e.icon.placedSymbolArray.get(r.verticalPlacedIconSymbolIndex).hidden=g.icon.isHidden()}}let S=h?.has(t)?h.get(t):{text:null,icon:null};if(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData()){let n=e.collisionArrays[t];if(n){let t=new maplibre_gl_shared_l(0,0);if(n.textBox||n.verticalTextBox){let r=!0;if(l){let e=this.variableOffsets[s];e?(t=maplibre_gl_Ds(e.anchor,e.width,e.height,e.textOffset,e.textBoxScale),u&&t._rotate(d?-this.transform.bearingInRadians:this.transform.bearingInRadians)):r=!1}if(n.textBox||n.verticalTextBox){let i;n.textBox&&(i=b),n.verticalTextBox&&(i=x),maplibre_gl_ks(e.textCollisionBox.collisionVertexArray,g.text.placed,!r||i,S.text,t.x,t.y)}}if(n.iconBox||n.verticalIconBox){let r=!(x||!n.verticalIconBox),i;n.iconBox&&(i=r),n.verticalIconBox&&(i=!r),maplibre_gl_ks(e.iconCollisionBox.collisionVertexArray,g.icon.placed,i,S.icon,f?t.x:0,f?t.y:0)}}}}if(e.sortFeatures(-this.transform.bearingInRadians),this.retainedQueryData[e.bucketInstanceId]&&(this.retainedQueryData[e.bucketInstanceId].featureSortOrder=e.featureSortOrder),e.hasTextData()&&e.text.opacityVertexBuffer&&e.text.opacityVertexBuffer.updateData(e.text.opacityVertexArray),e.hasIconData()&&e.icon.opacityVertexBuffer&&e.icon.opacityVertexBuffer.updateData(e.icon.opacityVertexArray),e.hasIconCollisionBoxData()&&e.iconCollisionBox.collisionVertexBuffer&&e.iconCollisionBox.collisionVertexBuffer.updateData(e.iconCollisionBox.collisionVertexArray),e.hasTextCollisionBoxData()&&e.textCollisionBox.collisionVertexBuffer&&e.textCollisionBox.collisionVertexBuffer.updateData(e.textCollisionBox.collisionVertexArray),e.text.opacityVertexArray.length!==e.text.layoutVertexArray.length/4)throw Error(`bucket.text.opacityVertexArray.length (= ${e.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${e.text.layoutVertexArray.length}) / 4`);if(e.icon.opacityVertexArray.length!==e.icon.layoutVertexArray.length/4)throw Error(`bucket.icon.opacityVertexArray.length (= ${e.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${e.icon.layoutVertexArray.length}) / 4`);e.bucketInstanceId in this.collisionCircleArrays&&(e.collisionCircleArray=this.collisionCircleArrays[e.bucketInstanceId],delete this.collisionCircleArrays[e.bucketInstanceId])}symbolFadeChange(e){return this.fadeDuration===0?1:(e-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(e){return Math.max(0,(this.transform.zoom-e)/1.5)}hasTransitions(e){return this.stale||e-this.lastPlacementChangeTime<this.fadeDuration}stillRecent(e,t){let n=this.zoomAtLastRecencyCheck===t?1-this.zoomAdjustment(t):1;return this.zoomAtLastRecencyCheck=t,this.commitTime+this.fadeDuration*n>e}setStale(){this.stale=!0}};function maplibre_gl_ks(e,t,n,r,i,a){(!r||r.length===0)&&(r=[0,0,0,0]);let o=r[0]-100,s=r[1]-100,c=r[2]-100,l=r[3]-100;e.emplaceBack(+!!t,+!!n,i||0,a||0,o,s),e.emplaceBack(+!!t,+!!n,i||0,a||0,c,s),e.emplaceBack(+!!t,+!!n,i||0,a||0,c,l),e.emplaceBack(+!!t,+!!n,i||0,a||0,o,l)}const maplibre_gl_As=2**25,maplibre_gl_js=2**24,maplibre_gl_Ms=2**17,maplibre_gl_Ns=2**16;function maplibre_gl_Ps(e){if(e.opacity===0&&!e.placed)return 0;if(e.opacity===1&&e.placed)return 4294967295;let t=+!!e.placed,n=Math.floor(e.opacity*127);return n*maplibre_gl_As+t*maplibre_gl_js+n*maplibre_gl_Ms+t*maplibre_gl_Ns+n*512+t*256+n*2+t}const maplibre_gl_Fs=0;var maplibre_gl_Is=class{constructor(e){this._sortAcrossTiles=e.layout.get(`symbol-z-order`)!==`viewport-y`&&!e.layout.get(`symbol-sort-key`).isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(e,t,n,r,i){let a=this._bucketParts;for(;this._currentTileIndex<e.length;){let n=e[this._currentTileIndex];if(t.getBucketParts(a,r,n,this._sortAcrossTiles),this._currentTileIndex++,i())return!0}for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,a.sort((e,t)=>e.sortKey-t.sortKey));this._currentPartIndex<a.length;){let e=a[this._currentPartIndex];if(t.placeLayerBucketPart(e,this._seenCrossTileIDs,n),this._currentPartIndex++,i())return!0}return!1}},maplibre_gl_Ls=class{constructor(e,t,n,r,i,a,o,s){this.placement=new maplibre_gl_Os(e,t,a,o,s),this._currentPlacementIndex=n.length-1,this._forceFullPlacement=r,this._showCollisionBoxes=i,this._done=!1}isDone(){return this._done}continuePlacement(e,t,n){let r=maplibre_gl_U(),i=()=>!this._forceFullPlacement&&maplibre_gl_U()-r>2;for(;this._currentPlacementIndex>=0;){let r=t[e[this._currentPlacementIndex]],a=this.placement.collisionIndex.transform.zoom;if(qy(r)&&r.layout&&(!r.minzoom||r.minzoom<=a)&&(!r.maxzoom||r.maxzoom>a)){if(this._inProgressLayer||=new maplibre_gl_Is(r),this._inProgressLayer.continuePlacement(n[r.source],this.placement,this._showCollisionBoxes,r,i))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(e){return this.placement.commit(e),this.placement}};const maplibre_gl_Rs=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],maplibre_gl_J=new Uint32Array(96);var maplibre_gl_zs=class e{static from(t){if(!t||t.byteLength===void 0||t.buffer)throw Error(`Data must be an instance of ArrayBuffer or SharedArrayBuffer.`);let[n,r]=new Uint8Array(t,0,2);if(n!==219)throw Error(`Data does not appear to be in a KDBush format.`);let i=r>>4;if(i!==1)throw Error(`Got v${i} data when expected v1.`);let a=maplibre_gl_Rs[r&15];if(!a)throw Error(`Unrecognized array type.`);let[o]=new Uint16Array(t,2,1),[s]=new Uint32Array(t,4,1);return new e(s,o,a,void 0,t)}constructor(e,t=64,n=Float64Array,r=ArrayBuffer,i){if(isNaN(e)||e<0)throw Error(`Unexpected numItems value: ${e}.`);this.numItems=+e,this.nodeSize=Math.min(Math.max(+t,2),65535),this.ArrayType=n,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;let a=maplibre_gl_Rs.indexOf(this.ArrayType),o=e*2*this.ArrayType.BYTES_PER_ELEMENT,s=e*this.IndexArrayType.BYTES_PER_ELEMENT,c=(8-s%8)%8;if(a<0)throw Error(`Unexpected typed array class: ${n}.`);if(i)this.data=i,this.ids=new this.IndexArrayType(i,8,e),this.coords=new n(i,8+s+c,e*2),this._pos=e*2,this._finished=!0;else{let i=this.data=new r(8+o+s+c);this.ids=new this.IndexArrayType(i,8,e),this.coords=new n(i,8+s+c,e*2),this._pos=0,this._finished=!1,new Uint8Array(i,0,2).set([219,16+a]),new Uint16Array(i,2,1)[0]=t,new Uint32Array(i,4,1)[0]=e}}add(e,t){let n=this._pos>>1;return this.ids[n]=n,this.coords[this._pos++]=e,this.coords[this._pos++]=t,n}finish(){let e=this._pos>>1;if(e!==this.numItems)throw Error(`Added ${e} items when expected ${this.numItems}.`);return maplibre_gl_Bs(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(e,t,n,r){if(!this._finished)throw Error(`Data not yet indexed - call index.finish().`);let{ids:i,coords:a,nodeSize:o}=this;maplibre_gl_J[0]=0,maplibre_gl_J[1]=i.length-1,maplibre_gl_J[2]=0;let s=3,c=[];for(;s>0;){let l=maplibre_gl_J[--s],u=maplibre_gl_J[--s],d=maplibre_gl_J[--s];if(u-d<=o){for(let o=d;o<=u;o++){let s=a[2*o],l=a[2*o+1];s>=e&&s<=n&&l>=t&&l<=r&&c.push(i[o])}continue}let f=d+u>>1,p=a[2*f],m=a[2*f+1];p>=e&&p<=n&&m>=t&&m<=r&&c.push(i[f]),(l===0?e<=p:t<=m)&&(maplibre_gl_J[s++]=d,maplibre_gl_J[s++]=f-1,maplibre_gl_J[s++]=1-l),(l===0?n>=p:r>=m)&&(maplibre_gl_J[s++]=f+1,maplibre_gl_J[s++]=u,maplibre_gl_J[s++]=1-l)}return c}within(e,t,n){let r=[];return this.withinInto(e,t,n,r),r}withinInto(e,t,n,r){if(!this._finished)throw Error(`Data not yet indexed - call index.finish().`);let{ids:i,coords:a,nodeSize:o}=this;maplibre_gl_J[0]=0,maplibre_gl_J[1]=i.length-1,maplibre_gl_J[2]=0;let s=3,c=0,l=n*n;for(;s>0;){let u=maplibre_gl_J[--s],d=maplibre_gl_J[--s],f=maplibre_gl_J[--s];if(d-f<=o){for(let n=f;n<=d;n++)maplibre_gl_Ws(a[2*n],a[2*n+1],e,t)<=l&&(r[c++]=i[n]);continue}let p=f+d>>1,m=a[2*p],h=a[2*p+1];maplibre_gl_Ws(m,h,e,t)<=l&&(r[c++]=i[p]),(u===0?e-n<=m:t-n<=h)&&(maplibre_gl_J[s++]=f,maplibre_gl_J[s++]=p-1,maplibre_gl_J[s++]=1-u),(u===0?e+n>=m:t+n>=h)&&(maplibre_gl_J[s++]=p+1,maplibre_gl_J[s++]=d,maplibre_gl_J[s++]=1-u)}return c}};function maplibre_gl_Bs(e,t,n,r,i,a){if(i-r<=n)return;let o=r+i>>1;maplibre_gl_Vs(e,t,o,r,i,a),maplibre_gl_Bs(e,t,n,r,o-1,1-a),maplibre_gl_Bs(e,t,n,o+1,i,1-a)}function maplibre_gl_Vs(e,t,n,r,i,a){for(;i>r;){if(i-r>600){let o=i-r+1,s=n-r+1,c=Math.log(o),l=.5*Math.exp(2*c/3),u=.5*Math.sqrt(c*l*(o-l)/o)*(s-o/2<0?-1:1);maplibre_gl_Vs(e,t,n,Math.max(r,Math.floor(n-s*l/o+u)),Math.min(i,Math.floor(n+(o-s)*l/o+u)),a)}let o=t[2*n+a],s=r,c=i;for(maplibre_gl_Hs(e,t,r,n),t[2*i+a]>o&&maplibre_gl_Hs(e,t,r,i);s<c;){for(maplibre_gl_Hs(e,t,s,c),s++,c--;t[2*s+a]<o;)s++;for(;t[2*c+a]>o;)c--}t[2*r+a]===o?maplibre_gl_Hs(e,t,r,c):(c++,maplibre_gl_Hs(e,t,c,i)),c<=n&&(r=c+1),n<=c&&(i=c-1)}}function maplibre_gl_Hs(e,t,n,r){maplibre_gl_Us(e,n,r),maplibre_gl_Us(t,2*n,2*r),maplibre_gl_Us(t,2*n+1,2*r+1)}function maplibre_gl_Us(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}function maplibre_gl_Ws(e,t,n,r){let i=e-n,a=t-r;return i*i+a*a}const maplibre_gl_Gs=512/(/* inlined export .Rr */8192)/2;var maplibre_gl_Ks=class{constructor(e,t,n){this.tileID=e,this.bucketInstanceId=n,this._symbolsByKey={};let r=new Map;for(let e=0;e<t.length;e++){let n=t.get(e),i=n.key,a=r.get(i);a?a.push(n):r.set(i,[n])}for(let[e,t]of r){let n={positions:t.map(e=>({x:Math.floor(e.anchorX*maplibre_gl_Gs),y:Math.floor(e.anchorY*maplibre_gl_Gs)})),crossTileIDs:t.map(e=>e.crossTileID)};if(n.positions.length>128){let e=new maplibre_gl_zs(n.positions.length,16,Uint16Array);for(let{x:t,y:r}of n.positions)e.add(t,r);e.finish(),delete n.positions,n.index=e}this._symbolsByKey[e]=n}}getScaledCoordinates(e,t){let{x:n,y:r,z:i}=this.tileID.canonical,{x:a,y:o,z:s}=t.canonical,c=s-i,l=maplibre_gl_Gs/2**c,u=(a*(/* inlined export .Rr */8192)+e.anchorX)*l,d=(o*(/* inlined export .Rr */8192)+e.anchorY)*l,f=n*(/* inlined export .Rr */8192)*maplibre_gl_Gs,p=r*(/* inlined export .Rr */8192)*maplibre_gl_Gs;return{x:Math.floor(u-f),y:Math.floor(d-p)}}findMatches(e,t,n){let r=this.tileID.canonical.z<t.canonical.z?1:2**(this.tileID.canonical.z-t.canonical.z);for(let i=0;i<e.length;i++){let a=e.get(i);if(a.crossTileID)continue;let o=this._symbolsByKey[a.key];if(!o)continue;let s=this.getScaledCoordinates(a,t);o.index?this.findMatchesForIndexedEntry(o,a,s,r,n):o.positions&&this.findMatchesForNonIndexedEntry(o,a,s,r,n)}}findMatchesForIndexedEntry(e,t,n,r,i){let a=e.index.range(n.x-r,n.y-r,n.x+r,n.y+r),o=1/0;for(let t of a)t<o&&!i[e.crossTileIDs[t]]&&(o=t);if(o!==1/0){let n=e.crossTileIDs[o];i[n]=!0,t.crossTileID=n}}findMatchesForNonIndexedEntry(e,t,n,r,i){for(let a=0;a<e.positions.length;a++){let o=e.positions[a],s=e.crossTileIDs[a];if(Math.abs(o.x-n.x)<=r&&Math.abs(o.y-n.y)<=r&&!i[s]){i[s]=!0,t.crossTileID=s;break}}}getCrossTileIDsLists(){return Object.values(this._symbolsByKey).map(({crossTileIDs:e})=>e)}},maplibre_gl_qs=class{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}},maplibre_gl_Js=class{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(e){let t=Math.round((e-this.lng)/360);if(t!==0)for(let e in this.indexes){let n=this.indexes[e],r={};for(let e in n){let i=n[e];i.tileID=i.tileID.unwrapTo(i.tileID.wrap+t),r[i.tileID.key]=i}this.indexes[e]=r}this.lng=e}addBucket(e,t,n){if(this.indexes[e.overscaledZ]?.[e.key]){if(this.indexes[e.overscaledZ][e.key].bucketInstanceId===t.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(e.overscaledZ,this.indexes[e.overscaledZ][e.key])}for(let e=0;e<t.symbolInstances.length;e++){let n=t.symbolInstances.get(e);n.crossTileID=0}this.usedCrossTileIDs[e.overscaledZ]||={};let r=this.usedCrossTileIDs[e.overscaledZ];for(let n in this.indexes){let i=this.indexes[n];if(Number(n)>e.overscaledZ)for(let n in i){let a=i[n];a.tileID.isChildOf(e)&&a.findMatches(t.symbolInstances,e,r)}else{let a=i[e.scaledTo(Number(n)).key];a&&a.findMatches(t.symbolInstances,e,r)}}for(let e=0;e<t.symbolInstances.length;e++){let i=t.symbolInstances.get(e);i.crossTileID||(i.crossTileID=n.generate(),r[i.crossTileID]=!0)}return this.indexes[e.overscaledZ]===void 0&&(this.indexes[e.overscaledZ]={}),this.indexes[e.overscaledZ][e.key]=new maplibre_gl_Ks(e,t.symbolInstances,t.bucketInstanceId),!0}removeBucketCrossTileIDs(e,t){for(let n of t.getCrossTileIDsLists())for(let t of n)delete this.usedCrossTileIDs[e][t]}removeStaleBuckets(e){let t=!1;for(let n in this.indexes){let r=this.indexes[n];for(let i in r)e[r[i].bucketInstanceId]||(this.removeBucketCrossTileIDs(n,r[i]),delete r[i],t=!0)}return t}},maplibre_gl_Ys=class{constructor(){this.layerIndexes={},this.crossTileIDs=new maplibre_gl_qs,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(e,t,n){let r=this.layerIndexes[e.id];r===void 0&&(r=this.layerIndexes[e.id]=new maplibre_gl_Js);let i=!1,a={};r.handleWrapJump(n);for(let n of t){let t=n.getBucket(e);e.id===t?.layerIds[0]&&(t.bucketInstanceId||=(this.maxBucketInstanceId+=1,this.maxBucketInstanceId),r.addBucket(n.tileID,t,this.crossTileIDs)&&(i=!0),a[t.bucketInstanceId]=!0)}return r.removeStaleBuckets(a)&&(i=!0),i}pruneUnusedLayers(e){let t={};for(let n of e)t[n]=!0;for(let e in this.layerIndexes)t[e]||delete this.layerIndexes[e]}},maplibre_gl_Xs=`#ifdef GL_ES
11402
+ var maplibre_gl_Mr=`6.9.0`;function maplibre_gl_Nr(){var e=new maplibre_gl_shared_h(4);return maplibre_gl_shared_h!=Float32Array&&(e[1]=0,e[2]=0),e[0]=1,e[3]=1,e}function maplibre_gl_Pr(e,t){var n=t[0],r=t[1],i=t[2],a=t[3],o=n*a-i*r;return o?(o=1/o,e[0]=a*o,e[1]=-r*o,e[2]=-i*o,e[3]=n*o,e):null}function maplibre_gl_Fr(e){return e[0]*e[3]-e[2]*e[1]}function maplibre_gl_Ir(e,t,n){var r=t[0],i=t[1],a=t[2],o=t[3],s=Math.sin(n),c=Math.cos(n);return e[0]=r*c+a*s,e[1]=i*c+o*s,e[2]=r*-s+a*c,e[3]=i*-s+o*c,e}let maplibre_gl_Lr,maplibre_gl_Rr,maplibre_gl_zr;const maplibre_gl_Br={frame(e,t,n,r){let i=r||window,a=i.requestAnimationFrame(e=>{o(),t(e)}),{unsubscribe:o}=maplibre_gl_shared_Qt(e.signal,`abort`,()=>{o(),i.cancelAnimationFrame(a),n(new maplibre_gl_shared_pn(e.signal.reason))},!1)},frameAsync(e,t){return new Promise((n,r)=>{this.frame(e,n,r,t)})},getImageData(e,t=0){return this.getImageCanvasContext(e).getImageData(-t,-t,e.width+2*t,e.height+2*t)},getImageCanvasContext(e){let t;if(maplibre_gl_shared_f()&&!maplibre_gl_shared_m())t=new OffscreenCanvas(e.width,e.height).getContext(`2d`,{willReadFrequently:!0});else{let n=window.document.createElement(`canvas`);n.width=e.width,n.height=e.height,t=n.getContext(`2d`,{willReadFrequently:!0})}if(!t)throw Error(`failed to create canvas 2d context`);return t.drawImage(e,0,0,e.width,e.height),t},resolveURL(e){return maplibre_gl_Lr||=document.createElement(`a`),maplibre_gl_Lr.href=e,maplibre_gl_Lr.href},get hardwareConcurrency(){return typeof navigator<`u`&&navigator.hardwareConcurrency||4},get prefersReducedMotion(){return maplibre_gl_zr===void 0?matchMedia?(maplibre_gl_Rr??=matchMedia(`(prefers-reduced-motion: reduce)`),maplibre_gl_Rr.matches):!1:maplibre_gl_zr},set prefersReducedMotion(e){maplibre_gl_zr=e}},maplibre_gl_Vr=new class{constructor(){this._frozenAt=null}getCurrentTime(){return this._frozenAt===null?performance.now():this._frozenAt}setNow(e){this._frozenAt=e}restoreNow(){this._frozenAt=null}isFrozen(){return this._frozenAt!==null}};function maplibre_gl_U(){return maplibre_gl_Vr.getCurrentTime()}function maplibre_gl_Hr(e){maplibre_gl_Vr.setNow(e)}function maplibre_gl_Ur(){maplibre_gl_Vr.restoreNow()}function maplibre_gl_Wr(){return maplibre_gl_Vr.isFrozen()}var maplibre_gl_W=class e{static{this.docStyle=typeof window<`u`&&window.document?.documentElement.style}static{this.selectProp=!e.docStyle||`userSelect`in e.docStyle?`userSelect`:`webkitUserSelect`}static create(e,t,n){let r=window.document.createElement(e);return t!==void 0&&(r.className=t),n&&n.appendChild(r),r}static createNS(e,t){return window.document.createElementNS(e,t)}static disableDrag(){e.docStyle&&e.selectProp&&(e.userSelect=e.docStyle[e.selectProp],e.docStyle[e.selectProp]=`none`)}static enableDrag(){e.docStyle&&e.selectProp&&(e.docStyle[e.selectProp]=e.userSelect)}static suppressClickInternal(t){t.preventDefault(),t.stopPropagation(),window.removeEventListener(`click`,e.suppressClickInternal,!0)}static suppressClick(){window.addEventListener(`click`,e.suppressClickInternal,!0),window.setTimeout(()=>{window.removeEventListener(`click`,e.suppressClickInternal,!0)},0)}static getScale(e){let t=e.getBoundingClientRect();return{x:t.width/e.offsetWidth||1,y:t.height/e.offsetHeight||1,boundingClientRect:t}}static getPoint(e,t,n){let r=t.boundingClientRect;return new maplibre_gl_shared_l((n.clientX-r.left)/t.x-e.clientLeft,(n.clientY-r.top)/t.y-e.clientTop)}static mousePos(t,n){let r=e.getScale(t);return e.getPoint(t,r,n)}static touchPos(t,n){let r=[],i=e.getScale(t);for(let a of n)r.push(e.getPoint(t,i,a));return r}static sanitize(t){let n=new DOMParser().parseFromString(t,`text/html`).body||document.createElement(`body`),r=n.querySelectorAll(`script, iframe`);for(let e of r)e.remove();return e.clean(n),n.innerHTML}static isPossiblyDangerous(e,t){let n=t.replace(/\s+/g,``).toLowerCase();if([`src`,`href`,`xlink:href`].includes(e)&&(n.includes(`javascript:`)||n.includes(`data:`))||e===`srcdoc`||e.startsWith(`on`))return!0}static clean(t){let n=t.children;for(let t of n)e.removeAttributes(t),e.clean(t)}static removeAttributes(t){for(let{name:n,value:r}of Array.from(t.attributes))e.isPossiblyDangerous(n,r)&&t.removeAttribute(n)}};let maplibre_gl_Gr;(function(e){let n,r,i,a;e.resetRequestQueue=()=>{n=[],r=0,i=0,a={}},e.addThrottleControl=e=>{let t=i++;return a[t]=e,t},e.removeThrottleControl=e=>{delete a[e],u()};let o=()=>{for(let e of Object.keys(a))if(a[e]())return!0;return!1};async function s(e,t,n,r,i=!0,a){let o=await e.transformRequest(t,n);return maplibre_gl_shared_hn(r.signal),maplibre_gl_Gr.getImage(o,r,i,a)}e.transformAndGetImage=s,e.getImage=(e,t,r=!0,i)=>new Promise((a,o)=>{e.headers||={},e.headers.accept=`image/webp,*/*`,maplibre_gl_shared_xt(e,{type:`image`});let s={abortController:t,requestParameters:e,supportImageRefresh:r,imageBitmapOptions:i,state:`queued`,onError:e=>{o(e)},onSuccess:e=>{a(e)}};n.push(s),u()});let c=(e,t)=>typeof createImageBitmap==`function`?maplibre_gl_shared_Wt(e,t):maplibre_gl_shared_Gt(e),l=async e=>{e.state=`running`;let{requestParameters:n,supportImageRefresh:i,imageBitmapOptions:a,onError:o,onSuccess:s,abortController:l}=e,f=i===!1&&!a&&!maplibre_gl_shared_zt(self)&&!dist_maplibre_gl_shared_n(n.url)&&(!n.headers||Object.keys(n.headers).reduce((e,t)=>e&&t===`accept`,!0));r++;let p=f?d(n,l):maplibre_gl_shared_En(n,l);try{let t=await p;delete e.abortController,e.state=`completed`,t.data instanceof HTMLImageElement||maplibre_gl_shared_Ut(t.data)?s(t):!t.data||t.data.byteLength===0?s({data:null,cacheControl:t.cacheControl,expires:t.expires}):s({data:await c(t.data,a),cacheControl:t.cacheControl,expires:t.expires})}catch(n){delete e.abortController,o(maplibre_gl_shared_Qe(n))}finally{r--,u()}},u=()=>{let e=o()?maplibre_gl_shared_gn.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:maplibre_gl_shared_gn.MAX_PARALLEL_IMAGE_REQUESTS;for(let t=r;t<e&&n.length>0;t++){let e=n.shift();if(e.abortController.signal.aborted){t--;continue}l(e)}},d=(e,t)=>new Promise((n,r)=>{let i=new Image,a=e.url,o=e.credentials;o&&o===`include`?i.crossOrigin=`use-credentials`:(o&&o===`same-origin`||!maplibre_gl_shared_kn(a))&&(i.crossOrigin=`anonymous`),t.signal.addEventListener(`abort`,()=>{i.src=``,r(new maplibre_gl_shared_pn(t.signal.reason))}),i.fetchPriority=`high`,i.onload=()=>{i.onerror=i.onload=null,n({data:i})},i.onerror=()=>{i.onerror=i.onload=null,!t.signal.aborted&&r(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.`))},i.src=a})})(maplibre_gl_Gr||={}),maplibre_gl_Gr.resetRequestQueue();var maplibre_gl_Kr=class{constructor(e){this._transformRequestFn=e??null}transformRequest(e,t){return this._transformRequestFn&&this._transformRequestFn(e,t)||{url:e}}setTransformRequest(e){this._transformRequestFn=e}},maplibre_gl_qr=class extends maplibre_gl_shared_Nn{},maplibre_gl_G=class extends maplibre_gl_qr{},maplibre_gl_Jr=class extends maplibre_gl_qr{constructor(e={}){super(`style.load`,e)}},maplibre_gl_Yr=class extends maplibre_gl_qr{constructor(e,t={}){super(e,t),this.dataType=`style`}},maplibre_gl_K=class extends maplibre_gl_qr{constructor(e,t={}){super(e,t),this.dataType=`source`}},maplibre_gl_Xr=class extends maplibre_gl_qr{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,t,n,r={}){n=n instanceof MouseEvent?n:new MouseEvent(e,n);let i=maplibre_gl_W.mousePos(t.getCanvas(),n),a=t.unproject(i);super(e,maplibre_gl_shared_xt({point:i,lngLat:a,originalEvent:n},r)),this._defaultPrevented=!1,this.target=t}},maplibre_gl_Zr=class extends maplibre_gl_qr{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,t,n){let r=e===`touchend`?n.changedTouches:n.touches,i=maplibre_gl_W.touchPos(t.getCanvasContainer(),r),a=i.map(e=>t.unproject(e)),o=i.reduce((e,t,n,r)=>e.add(t.div(r.length)),new maplibre_gl_shared_l(0,0)),s=t.unproject(o);super(e,{points:i,point:o,lngLats:a,lngLat:s,originalEvent:n}),this._defaultPrevented=!1}},maplibre_gl_Qr=class extends maplibre_gl_qr{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,t){super(`wheel`,{originalEvent:t}),this._defaultPrevented=!1}},maplibre_gl_$r=class extends maplibre_gl_qr{},maplibre_gl_ei=class extends maplibre_gl_qr{constructor(e={}){super(`terrain`,e)}},maplibre_gl_ti=class extends maplibre_gl_qr{constructor(e={}){super(`projectiontransition`,e)}},maplibre_gl_ni=class extends maplibre_gl_qr{},maplibre_gl_ri=class extends maplibre_gl_qr{constructor(e={}){super(`styleimagemissing`,e)}};function maplibre_gl_ii(e,t){let n={};for(let t in e)t!==`ref`&&(n[t]=e[t]);return maplibre_gl_shared_Ln.forEach(e=>{e in t&&(n[e]=t[e])}),n}function maplibre_gl_ai(e){e=e.slice();let t=Object.create(null);for(let n=0;n<e.length;n++)t[e[n].id]=e[n];for(let n=0;n<e.length;n++)`ref`in e[n]&&(e[n]=maplibre_gl_ii(e[n],t[e[n].ref]));return e}function maplibre_gl_q(e,t){if(Array.isArray(e)){if(!Array.isArray(t)||e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!maplibre_gl_q(e[n],t[n]))return!1;return!0}if(typeof e==`object`&&e&&t!==null){if(typeof t!=`object`||Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(!maplibre_gl_q(e[n],t[n]))return!1;return!0}return e===t}function maplibre_gl_oi(e,t){e.push(t)}function maplibre_gl_si(e,t,n){maplibre_gl_oi(n,{command:`addSource`,args:[e,t[e]]})}function maplibre_gl_ci(e,t,n){maplibre_gl_oi(t,{command:`removeSource`,args:[e]}),n[e]=!0}function maplibre_gl_li(e,t,n,r){maplibre_gl_ci(e,n,r),maplibre_gl_si(e,t,n)}function maplibre_gl_ui(e,t,n){let r;for(r in e[n])if(Object.prototype.hasOwnProperty.call(e[n],r)&&r!==`data`&&!maplibre_gl_q(e[n][r],t[n][r]))return!1;for(r in t[n])if(Object.prototype.hasOwnProperty.call(t[n],r)&&r!==`data`&&!maplibre_gl_q(e[n][r],t[n][r]))return!1;return!0}function maplibre_gl_di(e,t,n,r){e||={},t||={};let i;for(i in e)Object.prototype.hasOwnProperty.call(e,i)&&(Object.prototype.hasOwnProperty.call(t,i)||maplibre_gl_ci(i,n,r));for(i in t)Object.prototype.hasOwnProperty.call(t,i)&&(Object.prototype.hasOwnProperty.call(e,i)?maplibre_gl_q(e[i],t[i])||(e[i].type===`geojson`&&t[i].type===`geojson`&&maplibre_gl_ui(e,t,i)?maplibre_gl_oi(n,{command:`setGeoJSONSourceData`,args:[i,t[i].data]}):maplibre_gl_li(i,t,n,r)):maplibre_gl_si(i,t,n))}function maplibre_gl_fi(e,t,n,r,i,a){e||={},t||={};for(let o in e)Object.prototype.hasOwnProperty.call(e,o)&&(maplibre_gl_q(e[o],t[o])||n.push({command:a,args:[r,o,t[o],i]}));for(let o in t)Object.prototype.hasOwnProperty.call(t,o)&&!Object.prototype.hasOwnProperty.call(e,o)&&(maplibre_gl_q(e[o],t[o])||n.push({command:a,args:[r,o,t[o],i]}))}function maplibre_gl_pi(e){return e.id}function maplibre_gl_mi(e,t){return e[t.id]=t,e}function maplibre_gl_hi(e,t,n){e||=[],t||=[];let r=e.map(maplibre_gl_pi),i=t.map(maplibre_gl_pi),a=e.reduce(maplibre_gl_mi,{}),o=t.reduce(maplibre_gl_mi,{}),s=r.slice(),c=Object.create(null),l,u,d,f,p;for(let e=0,t=0;e<r.length;e++)l=r[e],Object.prototype.hasOwnProperty.call(o,l)?t++:(maplibre_gl_oi(n,{command:`removeLayer`,args:[l]}),s.splice(s.indexOf(l,t),1));for(let e=0,t=0;e<i.length;e++)l=i[i.length-1-e],s[s.length-1-e]!==l&&(Object.prototype.hasOwnProperty.call(a,l)?(maplibre_gl_oi(n,{command:`removeLayer`,args:[l]}),s.splice(s.lastIndexOf(l,s.length-t),1)):t++,f=s[s.length-e],maplibre_gl_oi(n,{command:`addLayer`,args:[o[l],f]}),s.splice(s.length-e,0,l),c[l]=!0);for(let e=0;e<i.length;e++)if(l=i[e],u=a[l],d=o[l],!(c[l]||maplibre_gl_q(u,d))){if(!maplibre_gl_q(u.source,d.source)||!maplibre_gl_q(u[`source-layer`],d[`source-layer`])||!maplibre_gl_q(u.type,d.type)){maplibre_gl_oi(n,{command:`removeLayer`,args:[l]}),f=s[s.lastIndexOf(l)+1],maplibre_gl_oi(n,{command:`addLayer`,args:[d,f]});continue}for(p in maplibre_gl_fi(u.layout,d.layout,n,l,null,`setLayoutProperty`),maplibre_gl_fi(u.paint,d.paint,n,l,null,`setPaintProperty`),maplibre_gl_q(u.filter,d.filter)||maplibre_gl_oi(n,{command:`setFilter`,args:[l,d.filter]}),(!maplibre_gl_q(u.minzoom,d.minzoom)||!maplibre_gl_q(u.maxzoom,d.maxzoom))&&maplibre_gl_oi(n,{command:`setLayerZoomRange`,args:[l,d.minzoom,d.maxzoom]}),u)Object.prototype.hasOwnProperty.call(u,p)&&p!==`layout`&&p!==`paint`&&p!==`filter`&&p!==`metadata`&&p!==`minzoom`&&p!==`maxzoom`&&(p.indexOf(`paint.`)===0?maplibre_gl_fi(u[p],d[p],n,l,p.slice(6),`setPaintProperty`):maplibre_gl_q(u[p],d[p])||maplibre_gl_oi(n,{command:`setLayerProperty`,args:[l,p,d[p]]}));for(p in d)Object.prototype.hasOwnProperty.call(d,p)&&!Object.prototype.hasOwnProperty.call(u,p)&&p!==`layout`&&p!==`paint`&&p!==`filter`&&p!==`metadata`&&p!==`minzoom`&&p!==`maxzoom`&&(p.indexOf(`paint.`)===0?maplibre_gl_fi(u[p],d[p],n,l,p.slice(6),`setPaintProperty`):maplibre_gl_q(u[p],d[p])||maplibre_gl_oi(n,{command:`setLayerProperty`,args:[l,p,d[p]]}))}}function maplibre_gl_gi(e,t){if(!e)return[{command:`setStyle`,args:[t]}];let n=[];try{if(!maplibre_gl_q(e.version,t.version))return[{command:`setStyle`,args:[t]}];maplibre_gl_q(e.center,t.center)||n.push({command:`setCenter`,args:[t.center]}),maplibre_gl_q(e.state,t.state)||n.push({command:`setGlobalState`,args:[t.state]}),maplibre_gl_q(e.centerAltitude,t.centerAltitude)||n.push({command:`setCenterAltitude`,args:[t.centerAltitude]}),maplibre_gl_q(e.zoom,t.zoom)||n.push({command:`setZoom`,args:[t.zoom]}),maplibre_gl_q(e.bearing,t.bearing)||n.push({command:`setBearing`,args:[t.bearing]}),maplibre_gl_q(e.pitch,t.pitch)||n.push({command:`setPitch`,args:[t.pitch]}),maplibre_gl_q(e.roll,t.roll)||n.push({command:`setRoll`,args:[t.roll]}),maplibre_gl_q(e.sprite,t.sprite)||n.push({command:`setSprite`,args:[t.sprite]}),maplibre_gl_q(e.glyphs,t.glyphs)||n.push({command:`setGlyphs`,args:[t.glyphs]}),maplibre_gl_q(e[`font-faces`],t[`font-faces`])||n.push({command:`setFontFaces`,args:[t[`font-faces`]]}),maplibre_gl_q(e.transition,t.transition)||n.push({command:`setTransition`,args:[t.transition]}),maplibre_gl_q(e.light,t.light)||n.push({command:`setLight`,args:[t.light]}),maplibre_gl_q(e.terrain,t.terrain)||n.push({command:`setTerrain`,args:[t.terrain]}),maplibre_gl_q(e.sky,t.sky)||n.push({command:`setSky`,args:[t.sky]}),maplibre_gl_q(e.projection,t.projection)||n.push({command:`setProjection`,args:[t.projection]});let r={},i=[];maplibre_gl_di(e.sources,t.sources,i,r);let a=[];e.layers&&e.layers.forEach(e=>{`source`in e&&r[e.source]?n.push({command:`removeLayer`,args:[e.id]}):a.push(e)}),n=n.concat(i),maplibre_gl_hi(a,t.layers,n)}catch(e){console.warn(`Unable to compute style diff:`,e),n=[{command:`setStyle`,args:[t]}]}return n}function maplibre_gl_i(){let e={},t=maplibre_gl_shared_P.$version;for(let n in maplibre_gl_shared_P.$root){let r=maplibre_gl_shared_P.$root[n];if(r.required){let i=null;i=n===`version`?t:r.type===`array`?[]:{},i!=null&&(e[n]=i)}}return e}function maplibre_gl_vi(e){let t=[];if(typeof e==`string`)t.push({id:`default`,url:e});else if(e&&e.length>0){let n=[];for(let{id:r,url:i}of e){let e=`${r}${i}`;n.includes(e)||(n.push(e),t.push({id:r,url:i}))}}return t}function maplibre_gl_yi(e,t,n){try{let r=new URL(e);return r.pathname+=`${t}${n}`,r.toString()}catch{throw Error(`Invalid sprite URL "${e}", must be absolute. Modify style specification directly or use TransformStyleFunction to correct the issue dynamically`)}}async function maplibre_gl_bi(e,t,n,r){let i=maplibre_gl_vi(e),a=n>1?`@2x`:``,o={},s={};for(let{id:e,url:n}of i){let i=await t.transformRequest(maplibre_gl_yi(n,a,`.json`),`SpriteJSON`);o[e]=maplibre_gl_shared_Dn(i,r);let c=await t.transformRequest(maplibre_gl_yi(n,a,`.png`),`SpriteImage`);s[e]=maplibre_gl_Gr.getImage(c,r)}return await Promise.all([...Object.values(o),...Object.values(s)]),maplibre_gl_xi(o,s)}async function maplibre_gl_xi(e,t){let n={};for(let r in e){n[r]={};let i=(await t[r]).data;if(!i)throw Error(`Could not load sprite image for ${r}: the response is empty`);let a=maplibre_gl_Br.getImageCanvasContext(i),o=(await e[r]).data;for(let e in o){let{width:t,height:i,x:s,y:c,sdf:l,pixelRatio:u,stretchX:d,stretchY:f,content:p,textFitWidth:m,textFitHeight:h}=o[e],g={width:t,height:i,x:s,y:c,context:a};n[r][e]={data:null,pixelRatio:u,sdf:l,stretchX:d,stretchY:f,content:p,textFitWidth:m,textFitHeight:h,spriteData:g}}}return n}var maplibre_gl_Si=class extends maplibre_gl_shared_Fn{constructor(){super(),this.images={},this.updateVersion=0,this.loaded=!1,this.requestors=[],this.missingImageResolver=null,this._spriteImagesIds={},this._imagesIds=null,this._renderCallbacksDispatchedThisFrame={}}destroy(){for(let e of Object.keys(this.images))this.removeImage(e);this._spriteImagesIds={}}isLoaded(){return this.loaded}setLoaded(e){if(this.loaded!==e&&(this.loaded=e,e)){for(let{ids:e,promiseResolve:t}of this.requestors)t(this._getImagesForIds(e));this.requestors=[]}}getImage(e){let t=this.images[e];if(t&&!t.data&&t.spriteData){let e=t.spriteData;t.data=new Ad({width:e.width,height:e.height},e.context.getImageData(e.x,e.y,e.width,e.height).data),t.spriteData=null}return t}addImage(e,t){if(this.images[e])throw Error(`Image id ${e} already exist, use updateImage instead`);this._validate(e,t)&&(this.images[e]=t,this._imagesIds=null,t.isWebGLImage&&this.updateImage(e,t,!1))}_validate(e,t){let n=!0,r=t.data||t.spriteData;return this._validateStretch(t.stretchX,r?.width)||(this.fire(new maplibre_gl_shared_Pn(Error(`Image "${e}" has invalid "stretchX" value`))),n=!1),this._validateStretch(t.stretchY,r?.height)||(this.fire(new maplibre_gl_shared_Pn(Error(`Image "${e}" has invalid "stretchY" value`))),n=!1),this._validateContent(t.content,t)||(this.fire(new maplibre_gl_shared_Pn(Error(`Image "${e}" has invalid "content" value`))),n=!1),n}_validateStretch(e,t){if(!e)return!0;let n=0;for(let r of e){if(r[0]<n||r[1]<r[0]||t<r[1])return!1;n=r[1]}return!0}_validateContent(e,t){if(!e)return!0;if(e.length!==4)return!1;let n=t.spriteData,r=n?.width||t.data.width,i=n?.height||t.data.height;return e[0]<0||r<e[0]||e[1]<0||i<e[1]||e[2]<0||r<e[2]||e[3]<0||i<e[3]||e[2]<e[0]?!1:e[3]>=e[1]}updateImage(e,t,n=!0){let r=this.images[e];if(n){let e=r.data||r.spriteData;if(e.width!==t.data.width||e.height!==t.data.height)throw Error(`size mismatch between old image (${e.width}x${e.height}) and new image (${t.data.width}x${t.data.height}).`)}t.version=(r.version??0)+1,this.images[e]=t,this.updateVersion++}removeImage(e){let t=this.images[e];t&&(delete this.images[e],this._imagesIds=null,t.userImage?.onRemove&&t.userImage.onRemove())}listImages(){return this._imagesIds??=Object.keys(this.images),this._imagesIds}_getSpriteImageId(e,t){return e==="default"?t:`${e}:${t}`}setSpriteImages(e,t){let n=this._spriteImagesIds[e]??[],r=[];for(let n in t){let i=this._getSpriteImageId(e,n);r.push(i),i in this.images?this.updateImage(i,t[n],!1):this.addImage(i,t[n])}let i=new Set(r),a=n.filter(e=>!i.has(e));for(let e of a)this.removeImage(e);return this._spriteImagesIds[e]=r,{loaded:r,removed:a}}removeSpriteImages(e){let t=this._spriteImagesIds[e]??[];for(let e of t)this.removeImage(e);return delete this._spriteImagesIds[e],t}removeAllSpriteImages(){let e=Object.values(this._spriteImagesIds).flat();for(let t of e)this.removeImage(t);return this._spriteImagesIds={},e}setMissingImageResolver(e){this.missingImageResolver=e}getImages(e){return new Promise((t,n)=>{let r=!0;if(!this.isLoaded())for(let t of e)this.images[t]||(r=!1);this.isLoaded()||r?t(this._getImagesForIds(e)):this.requestors.push({ids:e,promiseResolve:t})})}async _getImagesForIds(e){let t=new Set(e.filter(e=>!this.getImage(e))),n=this.missingImageResolver;n&&await Promise.allSettled(Array.from(t,e=>n(e)));let r={};for(let n of e){let e=this.getImage(n);e&&(t.delete(n),r[n]={data:e.data.clone(),pixelRatio:e.pixelRatio,sdf:e.sdf,version:e.version,stretchX:e.stretchX,stretchY:e.stretchY,content:e.content,textFitWidth:e.textFitWidth,textFitHeight:e.textFitHeight,hasRenderCallback:!!e.userImage?.render,isWebGLImage:e.isWebGLImage})}for(let e of t)this.fire(new maplibre_gl_ri({id:e})),maplibre_gl_shared_Ft(`Image "${e}" could not be loaded. Please make sure you have added the image before it is needed with map.addImage(), resolved it with map.setMissingStyleImageResolver(), or included it in a "sprite" property in your style.`);return r}beginFrame(){this._renderCallbacksDispatchedThisFrame={}}dispatchRenderCallbacks(e){for(let t of e){if(this._renderCallbacksDispatchedThisFrame[t])continue;this._renderCallbacksDispatchedThisFrame[t]=!0;let e=this.getImage(t);e||maplibre_gl_shared_Ft(`Image with ID: "${t}" was not found`),nv(e)&&this.updateImage(t,e)}}cloneImages(){let e={};for(let t in this.images){let n=this.images[t];e[t]={...n,data:n.data?n.data.clone():null}}return e}},maplibre_gl_Ci=class{constructor(e){this._imageManager=e,this._entries={},this._image=new Ad({width:1,height:1}),this._dirty=!0}destroy(){this._texture&&=(this._texture.destroy(),null),this._entries={},this._image=new Ad({width:1,height:1}),this._dirty=!0}getPixelSize(){let{width:e,height:t}=this._image;return{width:e,height:t}}getPattern(e){let t=this._imageManager.getImage(e);if(!t)return null;let n=this._entries[e];if(n?.image!==t){let n={w:t.data.width+2,h:t.data.height+2,x:0,y:0};this._entries[e]={bin:n,position:new iv(n,t),image:t}}else if(n.position.version!==t.version)n.position.version=t.version;else return n.position;return this._update(),this._entries[e].position}bind(e){let t=e.gl;this._texture?this._dirty&&=(this._texture.update(this._image),!1):(this._texture=new Gd(e,this._image,t.RGBA),this._dirty=!1),this._texture.bind(t.LINEAR,t.CLAMP_TO_EDGE)}_update(){for(let e in this._entries)this._imageManager.getImage(e)||delete this._entries[e];let e=[];for(let t in this._entries)e.push(this._entries[t].bin);let{w:t,h:n}=rv(e),r=this._image;r.resize({width:t||1,height:n||1});for(let e in this._entries){let{bin:t}=this._entries[e],n=t.x+1,i=t.y+1,a=this._entries[e].image.data,o=a.width,s=a.height;Ad.copy(a,r,{x:0,y:0},{x:n,y:i},{width:o,height:s}),Ad.copy(a,r,{x:0,y:s-1},{x:n,y:i-1},{width:o,height:1}),Ad.copy(a,r,{x:0,y:0},{x:n,y:i+s},{width:o,height:1}),Ad.copy(a,r,{x:o-1,y:0},{x:n-1,y:i},{width:1,height:s}),Ad.copy(a,r,{x:0,y:0},{x:n+o,y:i},{width:1,height:s})}this._dirty=!0}};const maplibre_gl_wi=1114111,maplibre_gl_Ti={start:0,end:maplibre_gl_wi};let maplibre_gl_Ei=0;function maplibre_gl_Di(e){let t=/^u\+([0-9a-f]*)(\?+)$/i.exec(e);if(t){let[,e,n]=t;return e.length+n.length>6?null:maplibre_gl_Oi(parseInt(`${e}${`0`.repeat(n.length)}`,16),parseInt(`${e}${`f`.repeat(n.length)}`,16))}let n=/^u\+([0-9a-f]{1,6})(?:-([0-9a-f]{1,6}))?$/i.exec(e);if(!n)return null;let r=parseInt(n[1],16);return maplibre_gl_Oi(r,n[2]===void 0?r:parseInt(n[2],16))}function maplibre_gl_Oi(e,t){return e>t||e>maplibre_gl_wi?null:{start:e,end:Math.min(t,maplibre_gl_wi)}}function maplibre_gl_ki(e,t){return e.ranges.some(({start:e,end:n})=>t>=e&&t<=n)}var maplibre_gl_Ai=class{constructor(e){this.requestManager=e,this._faces={},this._registered=new Set}setFontFaces(e){this._unregisterAll(),this._faces={};for(let[t,n]of Object.entries(e??{})){let e=Array.isArray(n)?n:[n];this._faces[t]=e.map(e=>this._declareFontFace(t,e)).filter(e=>e!==null)}}hasFontFaces(){return Object.keys(this._faces).length>0}async getFontFamily(e,t){for(let n of e.split(`,`))for(let e of this._faces[n.trim()]??[])if(maplibre_gl_ki(e,t)&&(e.loaded??=this._loadFontFace(e),await e.loaded))return e.family;return null}_declareFontFace(e,t){let n=typeof t==`string`?{url:t}:t;if(typeof n?.url!=`string`)return maplibre_gl_shared_Ft(`Ignoring the font face declared for "${e}": it has no URL.`),null;let r=`maplibre-gl-font-face-${maplibre_gl_Ei++}`,i=n[`unicode-range`];if(!i?.length)return{url:n.url,ranges:[maplibre_gl_Ti],family:r};let a=[];for(let e of i){let t=maplibre_gl_Di(e);if(!t){maplibre_gl_shared_Ft(`Ignoring the unicode range "${e}" of the font face at ${n.url}: it is not a valid range.`);continue}a.push(t)}return a.length?{url:n.url,ranges:a,family:r}:null}async _loadFontFace(e){if(typeof FontFace>`u`||typeof document>`u`||!document.fonts)return maplibre_gl_shared_Ft(`Ignoring the font face at ${e.url}: this environment has no CSS Font Loading API.`),!1;let n;try{return n=new FontFace(e.family,await this._downloadFontFile(e.url)),Object.values(this._faces).some(t=>t.includes(e))?(document.fonts.add(n),this._registered.add(n),await n.load(),!0):!1}catch(r){return n&&this._unregister(n),maplibre_gl_shared_Ft(`Ignoring the font face at ${e.url}: ${maplibre_gl_shared_Qe(r).message}`),!1}}async _downloadFontFile(e){let t=await this.requestManager.transformRequest(e,`Glyphs`),n=await maplibre_gl_shared_On(t,new AbortController);if(!n?.data)throw Error(`the response was empty for the font file at ${e}`);return n.data}_unregister(e){document.fonts?.delete(e),this._registered.delete(e)}_unregisterAll(){for(let e of this._registered)document.fonts?.delete(e);this._registered.clear()}destroy(){this._unregisterAll(),this._faces={}}};const maplibre_gl_ji=0x56bc75e2d63100000,maplibre_gl_Mi=new Float64Array(256);for(let e=0;e<256;e++){let t=.5-(e/255)**(1/2.2);maplibre_gl_Mi[e]=t*Math.abs(t)}maplibre_gl_Mi[255]=-0x56bc75e2d63100000;var maplibre_gl_Ni=class{constructor({fontSize:e=24,buffer:t=3,radius:n=8,cutoff:r=.25,fontFamily:i=`sans-serif`,fontWeight:a=`normal`,fontStyle:o=`normal`,lang:s=null}={}){this.buffer=t,this.radius=n,this.cutoff=r,this.lang=s;let c=this.size=e+t*4,l=this._createCanvas(c),u=this.ctx=l.getContext(`2d`,{willReadFrequently:!0});u.font=`${o} ${a} ${e}px ${i}`,u.textBaseline=`alphabetic`,u.textAlign=`left`,u.fillStyle=`black`,this.gridOuter=new Float64Array(c*c),this.gridInner=new Float64Array(c*c),this.f=new Float64Array(c),this.z=new Float64Array(c+1),this.v=new Uint16Array(c)}_createCanvas(e){if(typeof OffscreenCanvas<`u`)return new OffscreenCanvas(e,e);let t=document.createElement(`canvas`);return t.width=t.height=e,t}draw(e){let{width:t,actualBoundingBoxAscent:n,actualBoundingBoxDescent:r,actualBoundingBoxLeft:i,actualBoundingBoxRight:a}=this.ctx.measureText(e),o=Math.ceil(n),s=Math.floor(-i),c=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(a)-s)),l=Math.max(0,Math.min(this.size-this.buffer,o+Math.ceil(r))),u=c+2*this.buffer,d=l+2*this.buffer,f=Math.max(u*d,0),p=new Uint8ClampedArray(f),m={data:p,width:u,height:d,glyphWidth:c,glyphHeight:l,glyphTop:o,glyphLeft:s,glyphAdvance:t};if(c===0||l===0)return m;let{ctx:h,buffer:g,gridInner:_,gridOuter:v}=this;this.lang&&(h.lang=this.lang),h.clearRect(g,g,c,l),h.fillText(e,g-s,g+o);let y=h.getImageData(g,g,c,l);v.fill(maplibre_gl_ji,0,f),_.fill(0,0,f);let b=3;for(let e=0;e<l;e++){let t=(e+g)*u+g;for(let e=0;e<c;e++,b+=4,t++){let e=y.data[b];if(e===0)continue;let n=maplibre_gl_Mi[e];v[t]=Math.max(0,n),_[t]=Math.max(0,-n)}}maplibre_gl_Pi(v,0,0,u,d,u,this.f,this.v,this.z);let x=Math.min(g,1);maplibre_gl_Pi(_,g-x,g-x,c+2*x,l+2*x,u,this.f,this.v,this.z);let S=255/this.radius,C=255*(1-this.cutoff);for(let e=0;e<f;e++){let t=Math.sqrt(v[e])-Math.sqrt(_[e]);p[e]=Math.round(C-S*t)}return m}};function maplibre_gl_Pi(e,t,n,r,i,a,o,s,c){for(let l=t;l<t+r;l++)maplibre_gl_Fi(e,n*a+l,a,i,o,s,c);for(let l=n;l<n+i;l++)maplibre_gl_Fi(e,l*a+t,1,r,o,s,c)}function maplibre_gl_Fi(e,t,n,r,i,a,o){a[0]=0,o[0]=-0x56bc75e2d63100000,o[1]=maplibre_gl_ji,i[0]=e[t];for(let s=1,c=0,l=0;s<r;s++){i[s]=e[t+s*n];let r=s*s;do{let e=a[c];l=(i[s]-i[e]+r-e*e)/(s-e)/2}while(l<=o[c]&&--c>-1);c++,a[c]=s,o[c]=l,o[c+1]=maplibre_gl_ji}for(let s=0,c=0;s<r;s++){for(;o[c+1]<s;)c++;let r=a[c],l=s-r;e[t+s*n]=i[r]+l*l}}const maplibre_gl_Ii=maplibre_gl_shared_P.layout_symbol[`text-font`].default.join(`,`),maplibre_gl_Li=(e,t)=>{let n=new maplibre_gl_Ni(e);return n.buffer=t,n};var maplibre_gl_Ri=class{constructor(e,t,n,r=maplibre_gl_Li){this.requestManager=e,this.localIdeographFontFamily=t,this.entries={},this.lang=n,this.fontFaceManager=new maplibre_gl_Ai(e),this.createRasterizer=r}setURL(e){this.url=e}setFontFaces(e){this.fontFaceManager.setFontFaces(e),this.entries={}}async getGlyphs(e){let t=[];for(let n in e)for(let r of e[n])t.push(this._getAndCacheGlyphsPromise(n,r));let n=await Promise.all(t),r={};for(let{stack:e,id:t,glyph:i}of n)r[e]||={},r[e][t]=i&&{id:i.id,bitmap:i.bitmap.clone(),metrics:i.metrics};return r}async _getAndCacheGlyphsPromise(e,t){this.entries[e]??={glyphs:{},requests:{},ranges:{}};let n=this.entries[e],r=n.glyphs[t];if(r!==void 0)return{stack:e,id:t,glyph:r};let i=t.codePointAt(0),a=this.fontFaceManager.hasFontFaces()?await this.fontFaceManager.getFontFamily(e,i):null;return a?(r=n.glyphs[t]=await this._drawGlyph(n,e,t,a),{stack:e,id:t,glyph:r}):!this.url||Jg(t)||this._charUsesLocalIdeographFontFamily(i)?(r=n.glyphs[t]=await this._drawGlyph(n,e,t),{stack:e,id:t,glyph:r}):await this._downloadAndCacheRangePromise(e,t)}async _downloadAndCacheRangePromise(e,n){let r=n.codePointAt(0),i=this.entries[e],a=Math.floor(r/256);if(i.ranges[a])return{stack:e,id:n,glyph:null};i.requests[a]||=this._loadGlyphRange(e,a);try{let t=await i.requests[a];for(let e in t)i.glyphs[String.fromCodePoint(+e)]=t[+e];return i.ranges[a]=!0,{stack:e,id:n,glyph:t[r]||null}}catch(o){let s=i.glyphs[n]=await this._drawGlyph(i,e,n);return this._warnOnMissingGlyphRange(s,a,r,maplibre_gl_shared_Qe(o)),{stack:e,id:n,glyph:s}}}async _loadGlyphRange(e,t){let n=t*256,r=n+255,i=await this.requestManager.transformRequest(this.url.replace(`{fontstack}`,e).replace(`{range}`,`${n}-${r}`),`Glyphs`),a=await maplibre_gl_shared_On(i,new AbortController);if(!a?.data)throw Error(`Could not load glyph range. range: ${t}, ${n}-${r}`);let o={};for(let e of ev(a.data))o[e.id]=e;return o}_warnOnMissingGlyphRange(e,t,n,r){let i=t*256,a=i+255,o=n.toString(16).padStart(4,`0`).toUpperCase();maplibre_gl_shared_Ft(`Unable to load glyph range ${t}, ${i}-${a}. Rendering codepoint U+${o} locally instead. ${r}`)}_charUsesLocalIdeographFontFamily(e){return!!this.localIdeographFontFamily&&gg(e)}async _drawGlyph(e,t,n,r){let i=(await this._getTinySDF(e,t,n,r)).draw(n),a=/^\p{gc=Cf}+$/u.test(n);return{id:n.codePointAt(0),bitmap:new kd({width:i.width||60,height:i.height||60},i.data),metrics:{width:a?0:i.glyphWidth/2||24,height:i.glyphHeight/2||24,left:i.glyphLeft/2+.5||0,top:i.glyphTop/2-27.5||-8,advance:a?0:i.glyphAdvance/2||24,isDoubleResolution:!0}}}_getTinySDF(e,t,n,r){let i=Jg(n);if(r){let t=i?`clusterTinySDFs`:`fontFaceTinySDFs`;return e[t]??={},e[t][r]||=this._createTinySDF(r,!1,i?3:1),e[t][r]}let a=t===maplibre_gl_Ii&&this.localIdeographFontFamily!==``&&this._charUsesLocalIdeographFontFamily(n.codePointAt(0)),o=a?this.localIdeographFontFamily:t;if(i)return e.clusterTinySDFs??={},e.clusterTinySDFs[o]||=this._createTinySDF(o,!0,3),e.clusterTinySDFs[o];let s=a?`ideographTinySDF`:`tinySDF`;return e[s]||=this._createTinySDF(o),e[s]}async _createTinySDF(e,n=!0,r=1){let i=e?e.split(`,`):[];i.push(`sans-serif`);let a=i.map(e=>/[-\w]+/.test(e)?e:`'${CSS.escape(e)}'`).join(`,`),o=n?this._fontWeight(i[0]):void 0,s=n?this._fontStyle(i[0]):`normal`;if(typeof document<`u`&&document.fonts?.load)try{await document.fonts.load(`${s} ${o||`normal`} 48px ${a}`)}catch(e){maplibre_gl_shared_Ft(`Failed to load font "${a}": ${maplibre_gl_shared_Qe(e).message}`)}return this.createRasterizer({fontSize:48,buffer:Math.max(6,Math.ceil(48*(r-1)/4)),radius:16,cutoff:.25,fontFamily:a,fontWeight:o,fontStyle:s,lang:this.lang},6)}_fontStyle(e){return/italic/i.test(e)?`italic`:/oblique/i.test(e)?`oblique`:`normal`}_fontWeight(e){let t={thin:100,hairline:100,"extra light":200,"ultra light":200,light:300,normal:400,regular:400,medium:500,semibold:600,demibold:600,bold:700,"extra bold":800,"ultra bold":800,black:900,heavy:900,"extra black":950,"ultra black":950},n;for(let[r,i]of Object.entries(t))RegExp(`\\b${r}\\b`,`i`).test(e)&&(n=`${i}`);return n}destroy(){for(let e in this.entries){let t=this.entries[e];t.tinySDF=null,t.ideographTinySDF=null,t.fontFaceTinySDFs={},t.glyphs={},t.requests={},t.ranges={}}this.entries={},this.fontFaceManager.destroy()}};let maplibre_gl_zi;const maplibre_gl_Bi=()=>maplibre_gl_zi||=new maplibre_gl_shared_Rc({anchor:new maplibre_gl_shared_K(maplibre_gl_shared_P.light.anchor,`anchor`),position:new maplibre_gl_shared_K(maplibre_gl_shared_P.light.position,`position`),color:new maplibre_gl_shared_K(maplibre_gl_shared_P.light.color,`color`),intensity:new maplibre_gl_shared_K(maplibre_gl_shared_P.light.intensity,`intensity`)});var maplibre_gl_Vi=class extends maplibre_gl_shared_Fn{constructor(e,t){super(),this._transitionable=new maplibre_gl_shared_Dc(maplibre_gl_Bi(),`light`,t),this.setLight(e),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}getCartesianPosition(){return maplibre_gl_shared_Rt(this.properties.get(`position`))}setLight(e,t={}){if(!this._validate(maplibre_gl_shared_lc.light,e,t))for(let t in e){let n=e[t];t.endsWith(`-transition`)?this._transitionable.setTransition(t.slice(0,-maplibre_gl_shared_wc.length),n):this._transitionable.setValue(t,n)}}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}_validate(e,t,n){return maplibre_gl_shared_mc(this,e,{value:t},n)}};let maplibre_gl_Hi;const maplibre_gl_Ui=()=>maplibre_gl_Hi||=new maplibre_gl_shared_Rc({"sky-color":new maplibre_gl_shared_K(maplibre_gl_shared_P.sky[`sky-color`],`sky-color`),"horizon-color":new maplibre_gl_shared_K(maplibre_gl_shared_P.sky[`horizon-color`],`horizon-color`),"fog-color":new maplibre_gl_shared_K(maplibre_gl_shared_P.sky[`fog-color`],`fog-color`),"fog-ground-blend":new maplibre_gl_shared_K(maplibre_gl_shared_P.sky[`fog-ground-blend`],`fog-ground-blend`),"horizon-fog-blend":new maplibre_gl_shared_K(maplibre_gl_shared_P.sky[`horizon-fog-blend`],`horizon-fog-blend`),"sky-horizon-blend":new maplibre_gl_shared_K(maplibre_gl_shared_P.sky[`sky-horizon-blend`],`sky-horizon-blend`),"atmosphere-blend":new maplibre_gl_shared_K(maplibre_gl_shared_P.sky[`atmosphere-blend`],`atmosphere-blend`)});var maplibre_gl_Wi=class extends maplibre_gl_shared_Fn{constructor(e,t){super(),this._transitionable=new maplibre_gl_shared_Dc(maplibre_gl_Ui(),`sky`,t),this.setSky(e),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new maplibre_gl_shared_G(0))}setSky(e,t={}){if(!this._validate(maplibre_gl_shared_lc.sky,e,t)){e||={"sky-color":`transparent`,"horizon-color":`transparent`,"fog-color":`transparent`,"fog-ground-blend":1,"atmosphere-blend":0};for(let t in e){let n=e[t];t.endsWith(`-transition`)?this._transitionable.setTransition(t.slice(0,-maplibre_gl_shared_wc.length),n):this._transitionable.setValue(t,n)}}}getSky(){return this._transitionable.serialize()}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}_validate(e,t,n={}){return maplibre_gl_shared_mc(this,e,{value:t},n)}calculateFogBlendOpacity(e){return e<60?0:e<70?(e-60)/10:1}},maplibre_gl_Gi=class{constructor(e,t){this.width=e,this.height=t,this.nextRow=0,this.data=new Uint8Array(this.width*this.height),this.dashEntry={}}getDash(e,t){let n=e.join(`,`)+String(t);return this.dashEntry[n]||=this.addDash(e,t),this.dashEntry[n]}getDashRanges(e,t,n){let r=e.length%2==1,i=[],a=r?-e[e.length-1]*n:0,o=e[0]*n,s=!0;i.push({left:a,right:o,isDash:s,zeroLength:e[0]===0});let c=e[0];for(let t=1;t<e.length;t++){s=!s;let r=e[t];a=c*n,c+=r,o=c*n,i.push({left:a,right:o,isDash:s,zeroLength:r===0})}return i}addRoundDash(e,t,n){let r=t/2;for(let t=-n;t<=n;t++){let i=this.nextRow+n+t,a=this.width*i,o=0,s=e[o];for(let i=0;i<this.width;i++){i/s.right>1&&(s=e[++o]);let c=Math.abs(i-s.left),l=Math.abs(i-s.right),u=Math.min(c,l),d,f=t/n*(r+1);if(s.isDash){let e=r-Math.abs(f);d=Math.sqrt(u*u+e*e)}else d=r-Math.sqrt(u*u+f*f);this.data[a+i]=Math.max(0,Math.min(255,d+128))}}}addRegularDash(e){for(let t=e.length-1;t>=0;--t){let n=e[t],r=e[t+1];n.zeroLength?e.splice(t,1):r?.isDash===n.isDash&&(r.left=n.left,e.splice(t,1))}let t=e[0],n=e[e.length-1];t.isDash===n.isDash&&(t.left=n.left-this.width,n.right=t.right+this.width);let r=this.width*this.nextRow,i=0,a=e[i];for(let t=0;t<this.width;t++){t/a.right>1&&(a=e[++i]);let n=Math.abs(t-a.left),o=Math.abs(t-a.right),s=Math.min(n,o),c=a.isDash?s:-s;this.data[r+t]=Math.max(0,Math.min(255,c+128))}}addDash(e,t){let n=t?7:0,r=2*n+1;if(this.nextRow+r>this.height)return maplibre_gl_shared_Ft(`LineAtlas out of space`),null;let i=0;for(let t of e)i+=t;if(i!==0){let r=this.width/i,a=this.getDashRanges(e,this.width,r);t?this.addRoundDash(a,r,n):this.addRegularDash(a)}let a={y:this.nextRow+n,height:2*n,width:i};return this.nextRow+=r,this.dirty=!0,a}bind(e){let t=e.gl;this.texture?(t.bindTexture(t.TEXTURE_2D,this.texture),this.dirty&&(this.dirty=!1,t.texSubImage2D(t.TEXTURE_2D,0,0,0,this.width,this.height,t.ALPHA,t.UNSIGNED_BYTE,this.data))):(this.texture=t.createTexture(),t.bindTexture(t.TEXTURE_2D,this.texture),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.REPEAT),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.REPEAT),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texImage2D(t.TEXTURE_2D,0,t.ALPHA,this.width,this.height,0,t.ALPHA,t.UNSIGNED_BYTE,this.data))}};function maplibre_gl_Ki(e){if(!e)return!1;let t=globalThis.location;if(!t)return!1;try{return new URL(e,t.href).origin!==t.origin}catch{return!1}}function maplibre_gl_qi(){let e="file:///";if(!/^https?:/.test(e))return``;let t=e.endsWith(`-dev.mjs`)?`maplibre-gl-worker-dev.mjs`:`maplibre-gl-worker.mjs`;return new URL(`./${t}`,e).href}function maplibre_gl_Ji(e,t){if(t)try{return new Worker(e,{type:`module`})}catch(e){console.warn(`Module worker not supported, falling back to classic worker`,e)}return new Worker(e)}async function maplibre_gl_Yi(e){let t=await fetch(e);if(!t.ok)throw Error(`Failed to fetch worker script (${t.status}): ${e}`);let n=await t.text(),r=new Blob([n],{type:`text/javascript`});return URL.createObjectURL(r)}function maplibre_gl_Xi(e){let t=new Blob([`import ${JSON.stringify(__webpack_require__(586)(e).href)}`],{type:`text/javascript`});return URL.createObjectURL(t)}async function maplibre_gl_Zi(){let e=maplibre_gl_shared_gn.WORKER_URL||maplibre_gl_qi(),t=!e?.endsWith(`.cjs`);if(!maplibre_gl_Ki(e))return maplibre_gl_Ji(e,t);if(t){let n=maplibre_gl_Xi(e);try{return maplibre_gl_Ji(n,t)}finally{URL.revokeObjectURL(n)}}let n=await maplibre_gl_Yi(e);try{return maplibre_gl_Ji(n,t)}finally{URL.revokeObjectURL(n)}}const maplibre_gl_Qi=`maplibre_preloaded_worker_pool`;var maplibre_gl_$i=class e{constructor(){this.active={},this.workersPromise=null}async acquire(t){if(this.active[t]=!0,!this.workersPromise){let t=[];for(;t.length<e.workerCount;)t.push(maplibre_gl_Zi());this.workersPromise=Promise.all(t)}return(await this.workersPromise).slice()}release(e){if(delete this.active[e],this.numActive()===0&&this.workersPromise){let e=this.workersPromise;this.workersPromise=null,e.then(e=>{for(let t of e)t.terminate()})}}isPreloaded(){return!!this.active[maplibre_gl_Qi]}numActive(){return Object.keys(this.active).length}};const maplibre_gl_ea=Math.floor(maplibre_gl_Br.hardwareConcurrency/2);maplibre_gl_$i.workerCount=maplibre_gl_shared_Ht(globalThis)?Math.max(Math.min(maplibre_gl_ea,3),1):1;let maplibre_gl_ta;function maplibre_gl_na(){return maplibre_gl_ta||=new maplibre_gl_$i,maplibre_gl_ta}function maplibre_gl_ra(){maplibre_gl_na().acquire(maplibre_gl_Qi)}function maplibre_gl_ia(){let e=maplibre_gl_ta;e&&(e.isPreloaded()&&e.numActive()===1?(e.release(maplibre_gl_Qi),maplibre_gl_ta=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()`))}var maplibre_gl_aa=class{constructor(e,t){this.workerPool=e,this.actors=[],this.currentActor=0,this.id=t,this.removed=!1,this.actorsPromise=this.initActors(t)}async initActors(e){let t=await this.workerPool.acquire(e);if(this.removed)return[];if(this.actors=t.map((t,n)=>{let r=new maplibre_gl_shared_sb(t,e);return r.name=`Worker ${n}`,r}),!this.actors.length)throw Error(`No actors found`);return this.actors}async broadcast(e,t){let n=await this.actorsPromise;return Promise.all(n.map(n=>n.sendAsync({type:e,data:t})))}async getActor(){let e=await this.actorsPromise;return this.currentActor=(this.currentActor+1)%e.length,e[this.currentActor]}async waitForInitComplete(){this.actors.length===0&&await this.actorsPromise}getReadyActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(e=!0){this.removed=!0;for(let e of this.actors)e.remove();this.actors=[],e&&this.workerPool.release(this.id)}async registerMessageHandler(e,t){let n=await this.actorsPromise;for(let r of n)r.registerMessageHandler(e,t)}async unregisterMessageHandler(e){let t=await this.actorsPromise;for(let n of t)n.unregisterMessageHandler(e)}};let maplibre_gl_oa;function maplibre_gl_sa(){return maplibre_gl_oa||(maplibre_gl_oa=new maplibre_gl_aa(maplibre_gl_na(),maplibre_gl_shared_bn),maplibre_gl_oa.registerMessageHandler(`GR`,(e,t,n)=>maplibre_gl_shared_En(t,n))),maplibre_gl_oa}function maplibre_gl_ca(e,t){let n=maplibre_gl_shared_b();return maplibre_gl_shared_E(n,n,[1,1,0]),maplibre_gl_shared_D(n,n,[e.width*.5,e.height*.5,1]),e.calculatePosMatrix?maplibre_gl_shared_T(n,n,e.calculatePosMatrix(t.toUnwrapped())):n}function maplibre_gl_la(e,t,n){if(e)for(let r of e){let e=t[r];if(e?.source===n&&e.type===`fill-extrusion`)return!0}else for(let e in t){let r=t[e];if(r.source===n&&r.type===`fill-extrusion`)return!0}return!1}function maplibre_gl_ua(e,t,n,r,i,a,o){let s=maplibre_gl_la(i?.layers??null,t,e.id),c=a.maxPitchScaleFactor(),l=e.tilesIn(r,c,s);l.sort(maplibre_gl_pa);let u=[];for(let r of l)u.push({wrappedTileID:r.tileID.wrapped().key,queryResults:r.tile.queryRenderedFeatures(t,n,e.getState(),r.queryGeometry,r.cameraQueryGeometry,r.scale,i,a,c,maplibre_gl_ca(a,r.tileID),o?(e,t)=>o(r.tileID,e,t):void 0)});return maplibre_gl_ha(maplibre_gl_ma(u),e)}function maplibre_gl_da(e,t,n,r,i,a,o){let s={},c=a.queryRenderedSymbols(r),l=[];for(let e of Object.keys(c).map(Number))l.push(o[e]);l.sort(maplibre_gl_pa);for(let n of l){let r=n.featureIndex.lookupSymbolFeatures(c[n.bucketInstanceId],t,n.bucketIndex,n.sourceLayerIndex,{filterSpec:i.filter,globalState:i.globalState},i.layers,i.availableImages,e);for(let e in r){s[e]||=[];let t=r[e];t.sort((e,t)=>{let r=n.featureSortOrder;if(r){let n=r.indexOf(e.featureIndex);return r.indexOf(t.featureIndex)-n}return t.featureIndex-e.featureIndex});for(let n of t)s[e].push(n)}}return maplibre_gl_ga(s,e,n)}function maplibre_gl_fa(e,t){let n=e.getRenderableIds().map(t=>e.getTileByID(t)),r=[],i={};for(let e of n){let n=e.tileID.canonical.key;i[n]||(i[n]=!0,e.querySourceFeatures(r,t))}return r}function maplibre_gl_pa(e,t){let n=e.tileID,r=t.tileID;return n.overscaledZ-r.overscaledZ||n.canonical.y-r.canonical.y||n.wrap-r.wrap||n.canonical.x-r.canonical.x}function maplibre_gl_ma(e){let t={},n={};for(let{queryResults:r,wrappedTileID:i}of e){n[i]||={};let e=n[i];for(let n in r){let i=r[n];e[n]||={};let a=e[n];t[n]||=[];for(let e of i)a[e.featureIndex]||(a[e.featureIndex]=!0,t[n].push(e))}}return t}function maplibre_gl_ha(e,t){for(let n in e)for(let r of e[n])maplibre_gl_a(r,t);return e}function maplibre_gl_ga(e,t,n){for(let r in e)for(let i of e[r]){let e=n[t[r].source];maplibre_gl_a(i,e)}return e}function maplibre_gl_a(e,t){let n=e.feature,r=t.getFeatureState(n.layer[`source-layer`],n.id);n.source=n.layer.source,n.layer[`source-layer`]&&(n.sourceLayer=n.layer[`source-layer`]),n.state=r}async function maplibre_gl_va(e,t,n,r){let i=e;if(e.url?i=(await maplibre_gl_shared_Dn(await t.transformRequest(e.url,`Source`),n)).data:await maplibre_gl_Br.frameAsync(n,r),!i)return null;let a=maplibre_gl_shared_St(maplibre_gl_shared_xt(i,e),[`tiles`,`minzoom`,`maxzoom`,`attribution`,`bounds`,`scheme`,`tileSize`,`encoding`]);return`vector_layers`in i&&i.vector_layers&&(a.vectorLayerIds=i.vector_layers.map(e=>e.id)),a}var maplibre_gl_ya=class e{constructor(e,t){e&&(t?this.setSouthWest(e).setNorthEast(t):Array.isArray(e)&&(e.length===4?this.setSouthWest([e[0],e[1]]).setNorthEast([e[2],e[3]]):this.setSouthWest(e[0]).setNorthEast(e[1])))}setNorthEast(e){return this._ne=e instanceof maplibre_gl_shared_Mp?new maplibre_gl_shared_Mp(e.lng,e.lat):maplibre_gl_shared_Mp.convert(e),this}setSouthWest(e){return this._sw=e instanceof maplibre_gl_shared_Mp?new maplibre_gl_shared_Mp(e.lng,e.lat):maplibre_gl_shared_Mp.convert(e),this}extend(t){let n=this._sw,r=this._ne,i,a;if(t instanceof maplibre_gl_shared_Mp)i=t,a=t;else if(t instanceof e){if(i=t._sw,a=t._ne,!i||!a)return this}else{if(Array.isArray(t)){if(t.length===4||t.every(Array.isArray)){let n=t;return this.extend(e.convert(n))}{let e=t;return this.extend(maplibre_gl_shared_Mp.convert(e))}}return t&&(`lng`in t||`lon`in t)&&`lat`in t?this.extend(maplibre_gl_shared_Mp.convert(t)):this}return!n&&!r?(this._sw=new maplibre_gl_shared_Mp(i.lng,i.lat),this._ne=new maplibre_gl_shared_Mp(a.lng,a.lat)):(n.lng=Math.min(i.lng,n.lng),n.lat=Math.min(i.lat,n.lat),r.lng=Math.max(a.lng,r.lng),r.lat=Math.max(a.lat,r.lat)),this}getCenter(){return new maplibre_gl_shared_Mp((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 maplibre_gl_shared_Mp(this.getWest(),this.getNorth())}getSouthEast(){return new maplibre_gl_shared_Mp(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(e){let{lng:t,lat:n}=maplibre_gl_shared_Mp.convert(e),r=this._sw.lat<=n&&n<=this._ne.lat,i=this._sw.lng<=t&&t<=this._ne.lng;return this._sw.lng>this._ne.lng&&(i=this._sw.lng>=t&&t>=this._ne.lng),r&&i}intersects(t){if(t=e.convert(t),!(t.getNorth()>=this.getSouth()&&t.getSouth()<=this.getNorth()))return!1;let n=Math.abs(this.getEast()-this.getWest()),r=Math.abs(t.getEast()-t.getWest());if(n>=360||r>=360)return!0;let i=maplibre_gl_shared_bt(this.getWest(),-180,180),a=maplibre_gl_shared_bt(this.getEast(),-180,180),o=maplibre_gl_shared_bt(t.getWest(),-180,180),s=maplibre_gl_shared_bt(t.getEast(),-180,180),c=i>a,l=o>s;return c&&l?!0:c?s>=i||o<=a:l?a>=o||i<=s:o<=a&&s>=i}static convert(t){return t instanceof e||!t?t:new e(t)}static fromLngLat(t,n=0){let r=360*n/40075017,i=r/Math.cos(Math.PI/180*t.lat);return new e(new maplibre_gl_shared_Mp(t.lng-i,t.lat-r),new maplibre_gl_shared_Mp(t.lng+i,t.lat+r))}adjustAntiMeridian(){let t=new maplibre_gl_shared_Mp(this._sw.lng,this._sw.lat),n=new maplibre_gl_shared_Mp(this._ne.lng,this._ne.lat);return t.lng>n.lng?new e(t,new maplibre_gl_shared_Mp(n.lng+360,n.lat)):new e(t,n)}},maplibre_gl_ba=class{constructor(e,t,n){this.bounds=maplibre_gl_ya.convert(this.validateBounds(e)),this.minzoom=t||0,this.maxzoom=n||24}validateBounds(e){return!Array.isArray(e)||e.length!==4?[-180,-90,180,90]:[Math.max(-180,e[0]),Math.max(-90,e[1]),Math.min(180,e[2]),Math.min(90,e[3])]}contains(e){let t=2**e.z,n={minX:Math.floor(maplibre_gl_shared_Fp(this.bounds.getWest())*t),minY:Math.floor(maplibre_gl_shared_Ip(this.bounds.getNorth())*t),maxX:Math.ceil(maplibre_gl_shared_Fp(this.bounds.getEast())*t),maxY:Math.ceil(maplibre_gl_shared_Ip(this.bounds.getSouth())*t)};return e.x>=n.minX&&e.x<n.maxX&&e.y>=n.minY&&e.y<n.maxY}},maplibre_gl_xa=class extends maplibre_gl_shared_Fn{constructor(e,t,n,r){if(super(),this.id=e,this.dispatcher=n,this.type=`vector`,this.minzoom=0,this.maxzoom=22,this.scheme=`xyz`,this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,maplibre_gl_shared_xt(this,maplibre_gl_shared_St(t,[`url`,`scheme`,`tileSize`,`promoteId`,`encoding`])),this._options=maplibre_gl_shared_xt({type:`vector`},t),this._collectResourceTiming=t.collectResourceTiming,this.tileSize!==512)throw Error(`vector tile sources must have a tileSize of 512`);this.setEventedParent(r)}async load(e=!1){this._loaded=!1,this.fire(new maplibre_gl_K(`dataloading`)),this._tileJSONRequest=new AbortController;try{let t=await maplibre_gl_va(this._options,this.map._requestManager,this._tileJSONRequest,this.map._ownerWindow);this._tileJSONRequest=null,this._loaded=!0,t&&(maplibre_gl_shared_xt(this,t),t.bounds&&(this.tileBounds=new maplibre_gl_ba(t.bounds,this.minzoom,this.maxzoom)),this.fire(new maplibre_gl_K(`data`,{sourceDataType:`metadata`})),this.fire(new maplibre_gl_K(`data`,{sourceDataType:`content`,sourceDataChanged:e})))}catch(e){this._tileJSONRequest=null,this._loaded=!0,maplibre_gl_shared_mn(e)||this.fire(new maplibre_gl_shared_Pn(maplibre_gl_shared_Qe(e)))}}loaded(){return this._loaded}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}onAdd(e){this.map=e,this.load()}setSourceProperty(e){this._tileJSONRequest&&this._tileJSONRequest.abort(),e(),this.load(!0)}setTiles(e){return this.setSourceProperty(()=>{this.tiles=e,this._options.tiles=e}),this}setUrl(e){return this.setSourceProperty(()=>{this.url=e,this._options.url=e}),this}onRemove(){this._tileJSONRequest&&=(this._tileJSONRequest.abort(),null)}serialize(){return maplibre_gl_shared_xt({},this._options)}async loadTile(e){let t=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),n={request:await this.map._requestManager.transformRequest(t,`Tile`),uid:e.uid,tileID:e.tileID,zoom:e.tileID.overscaledZ,tileSize:this.tileSize*e.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,subdivisionGranularity:this.map.style.projection.subdivisionGranularity,encoding:this.encoding,overzoomParameters:await this._getOverzoomParameters(e),etag:e.etag};n.request.collectResourceTiming=this._collectResourceTiming,await this.dispatcher.waitForInitComplete();let r=`RT`;if(!e.actor||e.state===`expired`)e.actor=this.dispatcher.getReadyActor(),r=`LT`;else if(e.state===`loading`)return new Promise((t,n)=>{e.reloadPromise={resolve:t,reject:n}});e.abortController=new AbortController;try{let t=await e.actor.sendAsync({type:r,data:n},e.abortController);if(delete e.abortController,e.aborted)return;this._afterTileLoadWorkerResponse(e,t);let i={};return t?.etagUnmodified&&(i.unmodified=!0),i}catch(t){if(delete e.abortController,e.aborted||maplibre_gl_shared_mn(t))return;if(t&&t.status!==404)throw t;this._afterTileLoadWorkerResponse(e,null)}}async _getOverzoomParameters(e){if(e.tileID.canonical.z<=this.maxzoom||this.map._zoomLevelsToOverscale===void 0)return;let t=e.tileID.scaledTo(this.maxzoom).canonical,n=t.url(this.tiles,this.map.getPixelRatio(),this.scheme);return{maxZoomTileID:t,overzoomRequest:await this.map._requestManager.transformRequest(n,`Tile`)}}_afterTileLoadWorkerResponse(e,t){if(t?.resourceTiming&&(e.resourceTiming=t.resourceTiming),t&&this.map._refreshExpiredTiles&&e.setExpiryData(t),e.etag=t?.etag,e.loadVectorData(t,this.map.painter),e.reloadPromise){let t=e.reloadPromise;e.reloadPromise=null,this.loadTile(e).then(t.resolve).catch(t.reject)}}async abortTile(e){e.abortController&&(e.abortController.abort(),delete e.abortController),e.actor&&await e.actor.sendAsync({type:`AT`,data:{uid:e.uid,type:this.type,source:this.id}})}async unloadTile(e){e.unloadVectorData(),e.actor&&await e.actor.sendAsync({type:`RMT`,data:{uid:e.uid,type:this.type,source:this.id}})}hasTransition(){return!1}},maplibre_gl_Sa=class extends maplibre_gl_shared_Fn{constructor(e,t,n,r){super(),this.id=e,this.dispatcher=n,this.setEventedParent(r),this.type=`raster`,this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme=`xyz`,this.tileSize=512,this._loaded=!1,this._premultiplyAlpha=!0,this._options=maplibre_gl_shared_xt({type:`raster`},t),maplibre_gl_shared_xt(this,maplibre_gl_shared_St(t,[`url`,`scheme`,`tileSize`]))}async load(e=!1){this._loaded=!1,this.fire(new maplibre_gl_K(`dataloading`)),this._tileJSONRequest=new AbortController;try{let t=await maplibre_gl_va(this._options,this.map._requestManager,this._tileJSONRequest,this.map._ownerWindow);this._tileJSONRequest=null,this._loaded=!0,t&&(maplibre_gl_shared_xt(this,t),t.bounds&&(this.tileBounds=new maplibre_gl_ba(t.bounds,this.minzoom,this.maxzoom)),this.fire(new maplibre_gl_K(`data`,{sourceDataType:`metadata`})),this.fire(new maplibre_gl_K(`data`,{sourceDataType:`content`,sourceDataChanged:e})))}catch(e){this._tileJSONRequest=null,this._loaded=!0,maplibre_gl_shared_mn(e)||this.fire(new maplibre_gl_shared_Pn(maplibre_gl_shared_Qe(e)))}}loaded(){return this._loaded}onAdd(e){this.map=e,this.load()}onRemove(){this._tileJSONRequest&&=(this._tileJSONRequest.abort(),null)}setSourceProperty(e){this._tileJSONRequest&&=(this._tileJSONRequest.abort(),null),e(),this.load(!0)}setTiles(e){return this.setSourceProperty(()=>{this.tiles=e,this._options.tiles=e}),this}setUrl(e){return this.setSourceProperty(()=>{this.url=e,this._options.url=e}),this}serialize(){return maplibre_gl_shared_xt({},this._options)}setPremultiplyAlpha(e){return this._premultiplyAlpha===e||this.setSourceProperty(()=>{this._premultiplyAlpha=e}),this}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}async loadTile(e){let t=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),n=this._premultiplyAlpha,r=n?void 0:{premultiplyAlpha:`none`};e.abortController=new AbortController;try{let i=await maplibre_gl_Gr.transformAndGetImage(this.map._requestManager,t,`Tile`,e.abortController,this.map._refreshExpiredTiles,r);if(delete e.abortController,e.aborted){e.state=`unloaded`;return}if(i){this.map._refreshExpiredTiles&&(i.cacheControl||i.expires)&&e.setExpiryData({cacheControl:i.cacheControl,expires:i.expires});let t=this.map.painter.context,r=t.gl,a=i.data??new Ad({width:1,height:1},new Uint8Array(4));e.texture=this.map.painter.getTileTexture(a.width),e.texture?e.texture.update(a,{useMipmap:!0,premultiply:n}):(e.texture=new Gd(t,a,r.RGBA,{useMipmap:!0,premultiply:n}),e.texture.bind(r.LINEAR,r.CLAMP_TO_EDGE,r.LINEAR_MIPMAP_NEAREST)),e.state=`loaded`}}catch(t){if(delete e.abortController,e.aborted)e.state=`unloaded`;else if(t)throw e.state=`errored`,t}}async abortTile(e){e.abortController&&(e.abortController.abort(),delete e.abortController)}async unloadTile(e){e.texture&&this.map.painter.saveTileTexture(e.texture)}hasTransition(){return!1}},maplibre_gl_Ca=class extends maplibre_gl_Sa{constructor(e,t,n,r){super(e,t,n,r),this.type=`raster-dem`,this.maxzoom=22,this._options=maplibre_gl_shared_xt({type:`raster-dem`},t),this.encoding=t.encoding||`mapbox`,this.redFactor=t.redFactor,this.greenFactor=t.greenFactor,this.blueFactor=t.blueFactor,this.baseShift=t.baseShift}async loadTile(e){let t=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);e.neighboringTiles=this._getNeighboringTiles(e.tileID),e.abortController=new AbortController;try{let n=await maplibre_gl_Gr.transformAndGetImage(this.map._requestManager,t,`Tile`,e.abortController,this.map._refreshExpiredTiles,{colorSpaceConversion:`none`});if(delete e.abortController,e.aborted){e.state=`unloaded`;return}if(n){if(this.map._refreshExpiredTiles&&(n.cacheControl||n.expires)&&e.setExpiryData({cacheControl:n.cacheControl,expires:n.expires}),!n.data){e.state=`loaded`;return}let t=n.data,r=maplibre_gl_shared_Ut(t)&&maplibre_gl_shared_f()?t:await this.readImageNow(t),i={type:this.type,uid:e.uid,source:this.id,rawImageData:r,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};if(e.actor&&e.state!==`expired`&&e.state!==`reloading`)return;await this.dispatcher.waitForInitComplete(),(!e.actor||e.state===`expired`)&&(e.actor=this.dispatcher.getReadyActor()),e.dem=await e.actor.sendAsync({type:`LDT`,data:i}),e.needsHillshadePrepare=!0,e.needsTerrainPrepare=!0,e.needsColorReliefPrepare=!0,e.state=`loaded`}}catch(t){if(delete e.abortController,e.aborted)e.state=`unloaded`;else if(t)throw e.state=`errored`,t}}async readImageNow(e){if(typeof VideoFrame<`u`&&maplibre_gl_shared_m()){let t=e.width+4,n=e.height+4;try{return new Ad({width:t,height:n},await maplibre_gl_shared_qt(e,-2,-2,t,n))}catch{}}return maplibre_gl_Br.getImageData(e,2)}_getNeighboringTiles(e){let t=e.canonical,n=2**t.z,r=(t.x-1+n)%n,i=t.x===0?e.wrap-1:e.wrap,a=(t.x+1+n)%n,o=t.x+1===n?e.wrap+1:e.wrap,s={};return s[new maplibre_gl_shared_fb(e.overscaledZ,i,t.z,r,t.y).key]={backfilled:!1},s[new maplibre_gl_shared_fb(e.overscaledZ,o,t.z,a,t.y).key]={backfilled:!1},t.y>0&&(s[new maplibre_gl_shared_fb(e.overscaledZ,i,t.z,r,t.y-1).key]={backfilled:!1},s[new maplibre_gl_shared_fb(e.overscaledZ,e.wrap,t.z,t.x,t.y-1).key]={backfilled:!1},s[new maplibre_gl_shared_fb(e.overscaledZ,o,t.z,a,t.y-1).key]={backfilled:!1}),t.y+1<n&&(s[new maplibre_gl_shared_fb(e.overscaledZ,i,t.z,r,t.y+1).key]={backfilled:!1},s[new maplibre_gl_shared_fb(e.overscaledZ,e.wrap,t.z,t.x,t.y+1).key]={backfilled:!1},s[new maplibre_gl_shared_fb(e.overscaledZ,o,t.z,a,t.y+1).key]={backfilled:!1}),s}async unloadTile(e){e.demTexture&&this.map.painter.saveTileTexture(e.demTexture),e.fbo&&(e.fbo.destroy(),delete e.fbo),e.dem&&delete e.dem,delete e.neighboringTiles,e.state=`unloaded`,e.actor&&await e.actor.sendAsync({type:`RDT`,data:{type:this.type,uid:e.uid,source:this.id}})}};function maplibre_gl_wa(e,t){return t?e.properties[t]:e.id}function maplibre_gl_Ta(e,t){let n=new Map;if(e==null||e.type==null)return n;if(e.type===`Feature`){let r=maplibre_gl_wa(e,t);return r==null?void 0:(n.set(r,e),n)}if(e.type===`FeatureCollection`){let r=new Set;for(let i of e.features){let e=maplibre_gl_wa(i,t);if(e==null||r.has(e))return;r.add(e),n.set(e,i)}return n}}function maplibre_gl_Ea(e,t,n){let r=[];if(t.removeAll)e.clear();else if(t.remove)for(let n of t.remove){let t=e.get(n);t&&(r.push(t.geometry),e.delete(n))}if(t.add)for(let i of t.add){let t=maplibre_gl_wa(i,n);if(t==null)continue;let a=e.get(t);a&&r.push(a.geometry),r.push(i.geometry),e.set(t,i)}if(t.update)for(let n of t.update){let t=e.get(n.id);if(!t)continue;let i=!!n.newGeometry,a=n.removeAllProperties||n.removeProperties?.length>0||n.addOrUpdateProperties?.length>0;if(!i&&!a)continue;r.push(t.geometry);let o={...t};if(e.set(n.id,o),i&&(r.push(n.newGeometry),o.geometry=n.newGeometry),a){if(o.properties=n.removeAllProperties?{}:{...o.properties||{}},n.removeProperties)for(let e of n.removeProperties)delete o.properties[e];if(n.addOrUpdateProperties)for(let{key:e,value:t}of n.addOrUpdateProperties)o.properties[e]=t}}return r}function maplibre_gl_Da(e,t,n){if(!e)return t||{};if(!t)return e||{};n&&(maplibre_gl_Aa(e.add,n),maplibre_gl_Aa(t.add,n));let r=maplibre_gl_Ma(e),i=maplibre_gl_Ma(t);maplibre_gl_Oa(r,i);let a={};if((r.removeAll||i.removeAll)&&(a.removeAll=!0),a.remove=new Set([...r.remove,...i.remove]),a.add=new Map([...r.add,...i.add]),a.update=new Map([...r.update,...i.update]),a.remove.size&&a.add.size)for(let e of a.add.keys())a.remove.delete(e);let o=maplibre_gl_Na(a);return n&&maplibre_gl_ja(o.add,n),o}function maplibre_gl_Oa(e,t){t.removeAll&&(e.add.clear(),e.update.clear(),e.remove.clear(),t.remove.clear());for(let n of t.remove)e.add.delete(n),e.update.delete(n);for(let[n,r]of t.update){let i=e.update.get(n);i&&(t.update.set(n,maplibre_gl_ka(i,r)),e.update.delete(n))}}function maplibre_gl_ka(e,t){let n={id:e.id};if(t.removeAllProperties&&(delete e.removeProperties,delete e.addOrUpdateProperties,delete t.removeProperties),t.removeProperties&&e.addOrUpdateProperties){let n=new Set(t.removeProperties);e.addOrUpdateProperties=e.addOrUpdateProperties.filter(e=>!n.has(e.key))}return(e.removeAllProperties||t.removeAllProperties)&&(n.removeAllProperties=!0),(e.removeProperties||t.removeProperties)&&(n.removeProperties=[...e.removeProperties||[],...t.removeProperties||[]]),(e.addOrUpdateProperties||t.addOrUpdateProperties)&&(n.addOrUpdateProperties=[...e.addOrUpdateProperties||[],...t.addOrUpdateProperties||[]]),(e.newGeometry||t.newGeometry)&&(n.newGeometry=t.newGeometry||e.newGeometry),n}function maplibre_gl_Aa(e,t){if(e)for(let n of e){let e=maplibre_gl_wa(n,t);e!=null&&(n.id=e)}}function maplibre_gl_ja(e,t){if(e)for(let n of e)maplibre_gl_wa(n,t)!=null&&delete n.id}function maplibre_gl_Ma(e){if(!e)return{};let t={};return t.removeAll=e.removeAll,t.remove=new Set(e.remove||[]),t.add=new Map(e.add?.map(e=>[e.id,e])),t.update=new Map(e.update?.map(e=>[e.id,e])),t}function maplibre_gl_Na(e){let t={};return e.removeAll&&(t.removeAll=e.removeAll),e.remove&&(t.remove=Array.from(e.remove)),e.add&&(t.add=Array.from(e.add.values())),e.update&&(t.update=Array.from(e.update.values())),t}function maplibre_gl_Pa(e){return!e||e.length===0?[]:typeof e[0]==`number`?[e]:e.flatMap(e=>maplibre_gl_Pa(e))}function maplibre_gl_Fa(e){return e.type===`GeometryCollection`?e.geometries.flatMap(e=>maplibre_gl_Fa(e)):maplibre_gl_Pa(e.coordinates)}function maplibre_gl_Ia(e){let t=new maplibre_gl_ya,n;switch(e.type){case`FeatureCollection`:n=e.features.flatMap(e=>maplibre_gl_Fa(e.geometry));break;case`Feature`:n=maplibre_gl_Fa(e.geometry);break;default:n=maplibre_gl_Fa(e)}if(n.length===0)return t;for(let e of n){let[n,r]=e;t.extend([n,r])}return t}function maplibre_gl_La({x:e,y:t,z:n},r=0){let i=maplibre_gl_shared_Rp((e-r)/2**n),a=maplibre_gl_shared_zp((t+1+r)/2**n),o=maplibre_gl_shared_Rp((e+1+r)/2**n),s=maplibre_gl_shared_zp((t-r)/2**n);return new maplibre_gl_ya([i,a],[o,s])}var maplibre_gl_Ra=class extends maplibre_gl_shared_Fn{constructor(e,t,n,r){super(),this.id=e,this.type=`geojson`,this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._removed=!1,this._isUpdatingWorker=!1,this._pendingWorkerUpdate={data:t.data},this.actorPromise=n.getActor(),this.setEventedParent(r),this._data=typeof t.data==`string`?{url:t.data}:{geojson:t.data},this._options=maplibre_gl_shared_xt({},t),this._collectResourceTiming=t.collectResourceTiming,t.maxzoom!==void 0&&(this.maxzoom=t.maxzoom),t.type&&(this.type=t.type),t.attribution&&(this.attribution=t.attribution),this.promoteId=t.promoteId,t.clusterMaxZoom!==void 0&&this.maxzoom<=t.clusterMaxZoom&&maplibre_gl_shared_Ft(`The maxzoom value "${this.maxzoom}" is expected to be greater than the clusterMaxZoom value "${t.clusterMaxZoom}".`),this.workerOptions=maplibre_gl_shared_xt({source:this.id,geojsonVtOptions:{buffer:this._pixelsToTileUnits(t.buffer===void 0?128:t.buffer),tolerance:this._pixelsToTileUnits(t.tolerance===void 0?.375:t.tolerance),extent:(/* inlined export .Rr */8192),maxZoom:this.maxzoom,lineMetrics:t.lineMetrics||!1,generateId:t.generateId||!1,promoteId:typeof t.promoteId==`string`?t.promoteId:void 0,cluster:t.cluster||!1,clusterOptions:{maxZoom:this._getClusterMaxZoom(t.clusterMaxZoom),minPoints:Math.max(2,t.clusterMinPoints||2),extent:(/* inlined export .Rr */8192),radius:this._pixelsToTileUnits(t.clusterRadius||50),log:!1,generateId:t.generateId||!1}},clusterProperties:t.clusterProperties,filter:t.filter},t.workerOptions)}_hasPendingWorkerUpdate(){return this._pendingWorkerUpdate.data!==void 0||this._pendingWorkerUpdate.diff!==void 0||this._pendingWorkerUpdate.updateCluster}_pixelsToTileUnits(e){return e*((/* inlined export .Rr */8192)/this.tileSize)}_tileUnitsToPixels(e){return e/((/* inlined export .Rr */8192)/this.tileSize)}_getClusterMaxZoom(e){let t=e?Math.round(e):this.maxzoom-1;return Number.isInteger(e)||e===void 0||maplibre_gl_shared_Ft(`Integer expected for option 'clusterMaxZoom': provided value "${e}" rounded to "${t}"`),t}async load(){await this._updateWorkerData()}onAdd(e){this.map=e,this.load()}setData(e){return this._data=typeof e==`string`?{url:e}:{geojson:e},this._pendingWorkerUpdate={data:e},this._updateWorkerData()}updateData(e){return this._pendingWorkerUpdate.diff=maplibre_gl_Da(this._pendingWorkerUpdate.diff,e),this._updateWorkerData()}async getData(){return this._data.url&&await this.once(`data`),this._data.geojson?this._data.geojson:{type:`FeatureCollection`,features:Array.from(this._data.updateable.values())}}async getBounds(){return maplibre_gl_Ia(await this.getData())}setClusterOptions(e){return this.workerOptions.geojsonVtOptions.cluster=e.cluster,e.clusterRadius!==void 0&&(this.workerOptions.geojsonVtOptions.clusterOptions.radius=this._pixelsToTileUnits(e.clusterRadius)),e.clusterMaxZoom!==void 0&&(this.workerOptions.geojsonVtOptions.clusterOptions.maxZoom=this._getClusterMaxZoom(e.clusterMaxZoom)),this._pendingWorkerUpdate.updateCluster=!0,this._updateWorkerData()}getClusterOptions(){let{cluster:e,clusterOptions:t}=this.workerOptions.geojsonVtOptions;return{cluster:e,clusterMaxZoom:t.maxZoom,clusterRadius:this._tileUnitsToPixels(t.radius)}}async getClusterExpansionZoom(e){return(await this.actorPromise).sendAsync({type:`GCEZ`,data:{type:this.type,clusterId:e,source:this.id}})}async getClusterChildren(e){return(await this.actorPromise).sendAsync({type:`GCC`,data:{type:this.type,clusterId:e,source:this.id}})}async getClusterLeaves(e,t,n){return(await this.actorPromise).sendAsync({type:`GCL`,data:{type:this.type,source:this.id,clusterId:e,limit:t,offset:n}})}async _updateWorkerData(){if(this._isUpdatingWorker)return this._updatePromise;if(!this._hasPendingWorkerUpdate()){maplibre_gl_shared_Ft(`No pending worker updates for GeoJSONSource ${this.id}.`);return}let{data:e,diff:t,updateCluster:n}=this._pendingWorkerUpdate,r=this._getLoadGeoJSONParameters(e,t,n);e===void 0?t?this._pendingWorkerUpdate.diff=void 0:n&&(this._pendingWorkerUpdate.updateCluster=void 0):this._pendingWorkerUpdate.data=void 0,this._updatePromise=this._dispatchWorkerUpdate(r),await this._updatePromise}async _getLoadGeoJSONParameters(e,t,n){let r=maplibre_gl_shared_xt({type:this.type,source:this.id},this.workerOptions);if(typeof e==`string`)return r.request=await this.map._requestManager.transformRequest(maplibre_gl_Br.resolveURL(e),`Source`),r.request.collectResourceTiming=this._collectResourceTiming,r;if(e!==void 0)return r.data=e,r;if(t)return r.dataDiff=t,r;if(n)return r.updateCluster=!0,r}async _dispatchWorkerUpdate(e){this._isUpdatingWorker=!0,this.fire(new maplibre_gl_K(`dataloading`));try{let t=await e,n=await(await this.actorPromise).sendAsync({type:`LD`,data:t});if(this._isUpdatingWorker=!1,this._removed||n.abandoned){this.fire(new maplibre_gl_K(`dataabort`));return}n.data&&(this._data={geojson:n.data});let r=this._applyDiffToSource(t.dataDiff),i=this._getShouldReloadTileOptions(r),a={};this._applyResourceTiming(a,n),this.fire(new maplibre_gl_K(`data`,{...a,sourceDataType:`metadata`})),this.fire(new maplibre_gl_K(`data`,{...a,sourceDataType:`content`,shouldReloadTileOptions:i}))}catch(e){if(this._isUpdatingWorker=!1,this._removed){this.fire(new maplibre_gl_K(`dataabort`));return}this.fire(new maplibre_gl_shared_Pn(maplibre_gl_shared_Qe(e)))}finally{this._hasPendingWorkerUpdate()&&await this._updateWorkerData()}}_applyResourceTiming(e,t){if(!this._collectResourceTiming)return;let n=t.resourceTiming?.[this.id];if(!n)return;let r=n.slice(0);r?.length&&maplibre_gl_shared_xt(e,{resourceTiming:r})}_applyDiffToSource(e){if(!e)return;let t=typeof this.promoteId==`string`?this.promoteId:void 0;if(!this._data.url&&!this._data.updateable){let e=maplibre_gl_Ta(this._data.geojson,t);if(!e)throw Error(`GeoJSONSource "${this.id}": GeoJSON data is not compatible with updateData`);this._data={updateable:e}}if(!this._data.updateable)return;let n=maplibre_gl_Ea(this._data.updateable,e,t);if(!(e.removeAll||this._options.cluster))return n}_getShouldReloadTileOptions(e){if(e)return{affectedBounds:e.filter(Boolean).map(e=>maplibre_gl_Ia(e))}}shouldReloadTile(e,{affectedBounds:t}){if(e.state===`loading`)return!0;if(e.state===`unloaded`)return!1;let{buffer:n,extent:r}=this.workerOptions.geojsonVtOptions,i=maplibre_gl_La(e.tileID.canonical,n/r);for(let e of t)if(i.intersects(e))return!0;return!1}loaded(){return!this._isUpdatingWorker&&!this._hasPendingWorkerUpdate()}async loadTile(e){let t=e.actor?`RT`:`LT`;e.actor=await this.actorPromise;let n={type:this.type,uid:e.uid,tileID:e.tileID,zoom:e.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,subdivisionGranularity:this.map.style.projection.subdivisionGranularity};e.abortController=new AbortController;try{let r=await(await this.actorPromise).sendAsync({type:t,data:n},e.abortController);delete e.abortController,e.unloadVectorData(),e.aborted||e.loadVectorData(r,this.map.painter,t===`RT`)}catch(t){if(delete e.abortController,e.aborted||maplibre_gl_shared_mn(t))return;throw t}}async abortTile(e){e.abortController&&(e.abortController.abort(),delete e.abortController),e.aborted=!0}async unloadTile(e){e.unloadVectorData(),await(await this.actorPromise).sendAsync({type:`RMT`,data:{uid:e.uid,type:this.type,source:this.id}})}onRemove(){this._removed=!0,this.actorPromise.then(e=>e.sendAsync({type:`RS`,data:{type:this.type,source:this.id}}))}serialize(){return maplibre_gl_shared_xt({},this._options,{type:this.type,data:this._data.updateable?{type:`FeatureCollection`,features:Array.from(this._data.updateable.values())}:this._data.url||this._data.geojson})}hasTransition(){return!1}};const maplibre_gl_za=[0,0,1],maplibre_gl_Ba=(e,t)=>({u_tl_parent:new maplibre_gl_shared_gu(e,t.u_tl_parent),u_scale_parent:new maplibre_gl_shared_hu(e,t.u_scale_parent),u_buffer_scale:new maplibre_gl_shared_hu(e,t.u_buffer_scale),u_image_warp:new dist_maplibre_gl_shared_u(e,t.u_image_warp),u_fade_t:new maplibre_gl_shared_hu(e,t.u_fade_t),u_opacity:new maplibre_gl_shared_hu(e,t.u_opacity),u_image0:new maplibre_gl_shared_mu(e,t.u_image0),u_image1:new maplibre_gl_shared_mu(e,t.u_image1),u_brightness_low:new maplibre_gl_shared_hu(e,t.u_brightness_low),u_brightness_high:new maplibre_gl_shared_hu(e,t.u_brightness_high),u_saturation_factor:new maplibre_gl_shared_hu(e,t.u_saturation_factor),u_contrast_factor:new maplibre_gl_shared_hu(e,t.u_contrast_factor),u_spin_weights:new dist_maplibre_gl_shared_u(e,t.u_spin_weights),u_coords_top:new maplibre_gl_shared_vu(e,t.u_coords_top),u_coords_bottom:new maplibre_gl_shared_vu(e,t.u_coords_bottom)}),maplibre_gl_Va=(e,t,n,r,i,a)=>({u_tl_parent:e,u_scale_parent:t,u_buffer_scale:1,u_image_warp:a,u_fade_t:n.mix,u_opacity:n.opacity*r.paint.get(`raster-opacity`),u_image0:0,u_image1:1,u_brightness_low:r.paint.get(`raster-brightness-min`),u_brightness_high:r.paint.get(`raster-brightness-max`),u_saturation_factor:maplibre_gl_Wa(r.paint.get(`raster-saturation`)),u_contrast_factor:maplibre_gl_Ua(r.paint.get(`raster-contrast`)),u_spin_weights:maplibre_gl_Ha(r.paint.get(`raster-hue-rotate`)),u_coords_top:[i[0].x,i[0].y,i[1].x,i[1].y],u_coords_bottom:[i[3].x,i[3].y,i[2].x,i[2].y]});function maplibre_gl_Ha(e){e*=Math.PI/180;let t=Math.sin(e),n=Math.cos(e);return[(2*n+1)/3,(-Math.sqrt(3)*t-n+1)/3,(Math.sqrt(3)*t-n+1)/3]}function maplibre_gl_Ua(e){return e>0?1/(1-e):1+e}function maplibre_gl_Wa(e){return e>0?1-1/(1.001-e):-e}var maplibre_gl_Ga=class{constructor(e,t,n){this.vertexBuffer=e,this.indexBuffer=t,this.segments=n}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.vertexBuffer=null,this.indexBuffer=null,this.segments=null}};const maplibre_gl_Ka=maplibre_gl_shared_Yc([{name:`a_pos`,type:`Int16`,components:2}]),maplibre_gl_qa=(/* inlined export .Rr */8192)/128;function maplibre_gl_Ja(e,t){let n=maplibre_gl_Ya(t,`16bit`),r=maplibre_gl_shared_Pl.deserialize({arrayBuffer:n.vertices,length:n.vertices.byteLength/2/2}),i=maplibre_gl_shared_Zl.deserialize({arrayBuffer:n.indices,length:n.indices.byteLength/2/3});return new maplibre_gl_Ga(e.createVertexBuffer(r,maplibre_gl_Ka.members),e.createIndexBuffer(i),maplibre_gl_shared_nu.simpleSegment(0,0,r.length,i.length))}function maplibre_gl_Ya(e,t){let n=e.granularity===void 0?1:Math.max(e.granularity,1),r=n+(e.generateBorders?2:0),i=n+(e.extendToNorthPole||e.generateBorders?1:0)+(e.extendToSouthPole||e.generateBorders?1:0),a=r+1,o=i+1,s=e.generateBorders?-1:0,c=e.generateBorders||e.extendToNorthPole?-1:0,l=n+ +!!e.generateBorders,u=n+(e.generateBorders||e.extendToSouthPole?1:0),d=a*o,f=r*i*6,p=a*o>65536;if(p&&t===`16bit`)throw Error(`Granularity is too large and meshes would not fit inside 16 bit vertex indices.`);let m=p||t===`32bit`,h=new Int16Array(d*2),g=0;for(let t=c;t<=u;t++)for(let r=s;r<=l;r++){let i=r/n*(/* inlined export .Rr */8192);r===-1&&(i=-maplibre_gl_qa),r===n+1&&(i=(/* inlined export .Rr */8192)+maplibre_gl_qa);let a=t/n*(/* inlined export .Rr */8192);t===-1&&(a=e.extendToNorthPole?(/* inlined export .ht */-32768):-maplibre_gl_qa),t===n+1&&(a=e.extendToSouthPole?(/* inlined export .gt */32767):(/* inlined export .Rr */8192)+maplibre_gl_qa),h[g++]=i,h[g++]=a}let _=m?new Uint32Array(f):new Uint16Array(f),v=0;for(let e=0;e<i;e++)for(let t=0;t<r;t++){let n=t+e*a,r=t+1+e*a,i=t+(e+1)*a,o=t+1+(e+1)*a;_[v++]=n,_[v++]=i,_[v++]=r,_[v++]=r,_[v++]=i,_[v++]=o}return{vertices:h.buffer.slice(0),indices:_.buffer.slice(0),uses32bitIndices:m}}var maplibre_gl_Xa=class extends maplibre_gl_shared_Fn{constructor(e,t,n,r){super(),this.imageWarp=maplibre_gl_za,this.flippedWindingOrder=!1,this._warp=`auto`,this._imageDirty=!1,this._subdividedQuad=!1,this._subdividedMesh=null,this.id=e,this.dispatcher=n,this.coordinates=t.coordinates,this.type=`image`,this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(r),this.options=t}async load(e){if(this.options.url===void 0){this._loaded=!0,this._finishLoading();return}this._loaded=!1,this.fire(new maplibre_gl_K(`dataloading`)),this.url=this.options.url,this._abortController=new AbortController;try{let t=await maplibre_gl_Gr.transformAndGetImage(this.map._requestManager,this.url,`Image`,this._abortController);this._abortController=null,this._loaded=!0,t?.data?(this._setImage(t.data),e&&(this.coordinates=e),this._finishLoading()):this.fire(new maplibre_gl_shared_Pn(Error(`Could not load image ${this.url}: the response is empty`)))}catch(e){if(maplibre_gl_shared_mn(e))return;this._abortController=null,this._loaded=!0,this.fire(new maplibre_gl_shared_Pn(maplibre_gl_shared_Qe(e)))}}loaded(){return this._loaded}updateImage(e){return this._abortController&&=(this._abortController.abort(),null),`image`in e?(this._loaded=!0,this._setImage(e.image),e.coordinates&&(this.coordinates=e.coordinates),this._finishLoading(),this):e.url?(this.options.url=e.url,this.load(e.coordinates),this):this}_setImage(e){this.image=e,this._imageDirty=!0}getMesh(e,t){return!this._subdividedQuad||t?null:(this._subdividedMesh??=maplibre_gl_Ja(e,{granularity:16}),this._subdividedMesh)}_disposeTexture(){this.texture?.destroy(),this.texture=null}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new maplibre_gl_K(`data`,{sourceDataType:`metadata`})))}onAdd(e){this.map=e,this.load()}onRemove(){this._abortController&&=(this._abortController.abort(),null),this._disposeTexture(),this._subdividedMesh?.destroy(),this._subdividedMesh=null,this.image=null,this.tiles={}}setWarp(e){return this._warp===e?this:(this._warp=e,this.tileCoords&&this.setCoordinates(this.coordinates),this)}getWarp(){return this._warp}setCoordinates(e){this.coordinates=e;let t=e.map(maplibre_gl_shared_Hp.fromLngLat);return this.tileID=maplibre_gl_Za(t),this.terrainTileRanges=this._getOverlappingTileRanges(t),this.minzoom=this.maxzoom=this.tileID.z,this.tileCoords=t.map(e=>this.tileID.getTilePoint(e)._round()),this.imageWarp=maplibre_gl_$a(this.tileCoords,this._warp),this._subdividedQuad=this.imageWarp[2]>0&&!maplibre_gl_to(this.tileCoords),this.flippedWindingOrder=maplibre_gl_Qa(this.tileCoords),this.fire(new maplibre_gl_K(`data`,{sourceDataType:`content`})),this}prepare(){if(Object.keys(this.tiles).length===0||!this.image)return;let e=this.map.painter.context,t=e.gl;this.texture?this._imageDirty&&(this.texture.update(this.image),this.texture.bind(t.LINEAR,t.CLAMP_TO_EDGE)):(this.texture=new Gd(e,this.image,t.RGBA),this.texture.bind(t.LINEAR,t.CLAMP_TO_EDGE)),this._imageDirty=!1;let n=!1;for(let e in this.tiles){let t=this.tiles[e];t.state!==`loaded`&&(t.state=`loaded`,t.texture=this.texture,n=!0)}n&&this.fire(new maplibre_gl_K(`data`,{sourceDataType:`idle`,sourceId:this.id}))}async loadTile(e){this.tileID?.equals(e.tileID.canonical)?(this.tiles[String(e.tileID.wrap)]=e,e.buckets={}):e.state=`errored`}serialize(){let e={type:`image`,coordinates:this.coordinates};return this.options.url!==void 0&&(e.url=this.options.url),e}hasTransition(){return!1}_getOverlappingTileRanges(e){let{minX:t,minY:n,maxX:r,maxY:i}=maplibre_gl_shared_xp.fromPoints(e),a={};for(let e=0;e<=25;e++){let o=2**e,s=Math.floor(t*o),c=Math.floor(n*o),l=Math.floor(r*o),u=Math.floor(i*o),d=(s%o+o)%o,f=l%o,p=Math.floor(s/o),m=Math.floor(l/o);a[e]={minWrap:p,maxWrap:m,minTileXWrapped:d,maxTileXWrapped:f,minTileY:c,maxTileY:u}}return a}};function maplibre_gl_Za(e){let t=maplibre_gl_shared_xp.fromPoints(e),n=t.width(),r=t.height(),i=Math.max(0,Math.floor(-Math.log(Math.max(n,r))/Math.LN2)),a=2**i;return new maplibre_gl_shared_ub(i,Math.floor((t.minX+t.maxX)/2*a),Math.floor((t.minY+t.maxY)/2*a))}function maplibre_gl_Qa(e){let t=e[1].x-e[0].x,n=e[1].y-e[0].y,r=e[2].x-e[0].x;return t*(e[2].y-e[0].y)-n*r<0}function maplibre_gl_$a(e,t){if(t===`flat`||maplibre_gl_to(e))return maplibre_gl_za;let[n,r,i,a]=e,o=n.x-r.x+i.x-a.x,s=n.y-r.y+i.y-a.y,c=[r.x-i.x,r.y-i.y,a.x-i.x,a.y-i.y],[l,u,d,f]=c,p=maplibre_gl_Fr(c),m=(o*f-d*s)/p,h=(l*s-o*u)/p,g=[1,1+m,1+m+h,1+h],_=Math.max(...g)/Math.min(...g),v=t===`perspective`?0:maplibre_gl_eo(_);return!(_>=1&&_<=512)||v>=1?maplibre_gl_za:[m,h,v]}function maplibre_gl_eo(e){let t=(1-4/e)/(1-4/512);return Math.max(0,t)}function maplibre_gl_to(e){let[t,n,r,i]=e;return t.x+r.x===n.x+i.x&&t.y+r.y===n.y+i.y}var maplibre_gl_no=class extends maplibre_gl_Xa{constructor(e,t,n,r){super(e,t,n,r),this._onPlayingHandler=()=>{this.map?.triggerRepaint()},this.roundZoom=!0,this.type=`video`,this.options=t}async load(){this._loaded=!1;let e=this.options;this.urls=[];for(let t of e.urls)this.urls.push((await this.map._requestManager.transformRequest(t,`Source`)).url);try{let e=await maplibre_gl_shared_An(this.urls);if(this._loaded=!0,!e)return;this.video=e,this.video.loop=!0,this.video.addEventListener(`playing`,this._onPlayingHandler),this.map&&this.video.play(),this._finishLoading()}catch(e){this.fire(new maplibre_gl_shared_Pn(maplibre_gl_shared_Qe(e)))}}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(e){if(this.video){let t=this.video.seekable;e<t.start(0)||e>t.end(0)?this.fire(new maplibre_gl_shared_Pn(new maplibre_gl_shared_F(`sources.${this.id}`,null,`Playback for this video can be set only between the ${t.start(0)} and ${t.end(0)}-second mark.`))):this.video.currentTime=e}}getVideo(){return this.video}onAdd(e){this.map||(this.map=e,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}onRemove(){super.onRemove(),this.video&&(this.video.removeEventListener(`playing`,this._onPlayingHandler),this.video.pause())}prepare(){if(Object.keys(this.tiles).length===0||this.video.readyState<2)return;let e=this.map.painter.context,t=e.gl;this.texture?this.video.paused||(this.texture.bind(t.LINEAR,t.CLAMP_TO_EDGE),t.texSubImage2D(t.TEXTURE_2D,0,0,0,t.RGBA,t.UNSIGNED_BYTE,this.video)):(this.texture=new Gd(e,this.video,t.RGBA),this.texture.bind(t.LINEAR,t.CLAMP_TO_EDGE));let n=!1;for(let e in this.tiles){let t=this.tiles[e];t.state!==`loaded`&&(t.state=`loaded`,t.texture=this.texture,n=!0)}n&&this.fire(new maplibre_gl_K(`data`,{sourceDataType:`idle`,sourceId:this.id}))}serialize(){return{type:`video`,urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}},maplibre_gl_ro=class extends maplibre_gl_Xa{constructor(e,t,n,r){super(e,t,n,r),t.coordinates?(!Array.isArray(t.coordinates)||t.coordinates.length!==4||t.coordinates.some(e=>!Array.isArray(e)||e.length!==2||e.some(e=>typeof e!=`number`)))&&this.fire(new maplibre_gl_shared_Pn(new maplibre_gl_shared_F(`sources.${e}`,null,`"coordinates" property must be an array of 4 longitude/latitude array pairs`))):this.fire(new maplibre_gl_shared_Pn(new maplibre_gl_shared_F(`sources.${e}`,null,`missing required property "coordinates"`))),t.animate&&typeof t.animate!=`boolean`&&this.fire(new maplibre_gl_shared_Pn(new maplibre_gl_shared_F(`sources.${e}`,null,`optional "animate" property must be a boolean value`))),t.canvas?typeof t.canvas!=`string`&&!(t.canvas instanceof HTMLCanvasElement)&&this.fire(new maplibre_gl_shared_Pn(new maplibre_gl_shared_F(`sources.${e}`,null,`"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance`))):this.fire(new maplibre_gl_shared_Pn(new maplibre_gl_shared_F(`sources.${e}`,null,`missing required property "canvas"`))),this.options=t,this.animate=t.animate===void 0||t.animate}async load(){if(this._loaded=!0,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 maplibre_gl_shared_Pn(Error(`Canvas dimensions cannot be less than or equal to zero.`)));return}this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&=(this.prepare(),!1)},this._finishLoading()}getCanvas(){return this.canvas}onAdd(e){this.map=e,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this._playing=!1,super.onRemove()}prepare(){let e=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,e=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,e=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;let t=this.map.painter.context,n=t.gl;this.texture?(e||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):(this.texture=new Gd(t,this.canvas,n.RGBA,{premultiply:!0}),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE));let r=!1;for(let e in this.tiles){let t=this.tiles[e];t.state!==`loaded`&&(t.state=`loaded`,t.texture=this.texture,r=!0)}r&&this.fire(new maplibre_gl_K(`data`,{sourceDataType:`idle`,sourceId:this.id}))}serialize(){return{type:`canvas`,animate:this.animate,canvas:this.options.canvas,coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(let e of[this.canvas.width,this.canvas.height])if(isNaN(e)||e<=0)return!0;return!1}};const maplibre_gl_io={},maplibre_gl_ao=(e,t,n,r)=>{let i=new(maplibre_gl_oo(t.type))(e,t,n,r);if(i.id!==e)throw Error(`Expected Source id to be ${e} instead of ${i.id}`);return i},maplibre_gl_oo=e=>{switch(e){case`geojson`:return maplibre_gl_Ra;case`image`:return maplibre_gl_Xa;case`raster`:return maplibre_gl_Sa;case`raster-dem`:return maplibre_gl_Ca;case`vector`:return maplibre_gl_xa;case`video`:return maplibre_gl_no;case`canvas`:return maplibre_gl_ro}return maplibre_gl_io[e]},maplibre_gl_so=(e,t)=>{maplibre_gl_io[e]=t},maplibre_gl_co=async(e,t)=>{if(maplibre_gl_oo(e))throw Error(`A source type called "${e}" already exists.`);maplibre_gl_so(e,t)};function maplibre_gl_lo(e,t){let n={};if(!t)return n;for(let r of e){let e=r.layerIds.map(e=>t.getLayer(e)).filter(Boolean);if(e.length!==0){r.layers=e,r.stateDependentLayerIds&&(r.stateDependentLayers=r.stateDependentLayerIds.map(t=>e.filter(e=>e.id===t)[0]));for(let t of e)n[t.id]=r}}return n}const maplibre_gl_uo=`RTLPluginLoaded`;var maplibre_gl_fo=class extends maplibre_gl_shared_Fn{constructor(...e){super(...e),this.status=`unavailable`,this.url=null,this.dispatcher=maplibre_gl_sa()}_syncState(e){return this.status=e,this.dispatcher.broadcast(`SRPS`,{pluginStatus:e,pluginURL:this.url}).catch(e=>{throw this.status=`error`,e})}getRTLTextPluginStatus(){return this.status}clearRTLTextPlugin(){this.status=`unavailable`,this.url=null}async setRTLTextPlugin(e,t=!1){if(this.url)throw Error(`setRTLTextPlugin cannot be called multiple times.`);if(this.url=maplibre_gl_Br.resolveURL(e),!this.url)throw Error(`requested url ${e} is invalid`);if(this.status===`unavailable`){if(t)this.status=`deferred`,this._syncState(this.status);else return this._requestImport()}else if(this.status===`requested`)return this._requestImport()}async _requestImport(){await this._syncState(`loading`),this.status=`loaded`,this.fire(new maplibre_gl_shared_Nn(maplibre_gl_uo))}lazyLoad(){this.status===`unavailable`?this.status=`requested`:this.status===`deferred`&&this._requestImport()}};let maplibre_gl_po=null;function maplibre_gl_mo(){return maplibre_gl_po||=new maplibre_gl_fo,maplibre_gl_po}var maplibre_gl_ho=class{constructor(e,t){this.timeAdded=0,this.fadeEndTime=0,this.fadeOpacity=1,this.tileID=e,this.uid=maplibre_gl_shared_wt(),this.uses=0,this.tileSize=t,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.rttObjects=[],this.rttFingerprint={},this.expiredRequestCount=0,this.state=`loading`,this.featureStateRevision=-1}isRenderable(e){return this.hasData()&&(!this.fadeEndTime||this.fadeOpacity>0)&&(e||!this.holdingForSymbolFade())}setCrossFadeLogic({fadingRole:e,fadingDirection:t,fadingParentID:n,fadeEndTime:r}){this.resetFadeLogic(),this.fadingRole=e,this.fadingDirection=t,this.fadingParentID=n,this.fadeEndTime=r}setSelfFadeLogic(e){this.resetFadeLogic(),this.selfFading=!0,this.fadeEndTime=e}resetFadeLogic(){this.fadingRole=null,this.fadingDirection=null,this.fadingParentID=null,this.selfFading=!1,this.timeAdded=maplibre_gl_U(),this.fadeEndTime=0,this.fadeOpacity=1}wasRequested(){return this.state===`errored`||this.state===`loaded`||this.state===`reloading`}clearTextures(e){this.demTexture&&e.saveTileTexture(this.demTexture),this.demTexture=null}getRTT(e){return this.rttObjects[e]}acquireRTT(e,t,n){return this.rttObjects[t]=e.acquireRTT(n)}releaseRTT(e){if(this.rttObjects.length!==0){for(let t of this.rttObjects)t&&e.releaseRTT(t);this.rttObjects.length=0}}loadVectorData(e,t,n){if(e?.etagUnmodified===!0){this.state=`loaded`;return}if(this.hasData()&&this.unloadVectorData(),this.state=`loaded`,!e){this.collisionBoxArray=new maplibre_gl_shared_Cl;return}e.featureIndex&&(this.latestFeatureIndex=e.featureIndex,e.rawTileData?(this.latestRawTileData=e.rawTileData,this.latestEncoding=e.encoding,this.latestFeatureIndex.rawTileData=e.rawTileData,this.latestFeatureIndex.encoding=e.encoding):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData,this.latestFeatureIndex.encoding=this.latestEncoding)),this.collisionBoxArray=e.collisionBoxArray,this.buckets=maplibre_gl_lo(e.buckets,t?.style),this.hasSymbolBuckets=!1;for(let e in this.buckets){let t=this.buckets[e];if(t instanceof zy){if(this.hasSymbolBuckets=!0,n)t.justReloaded=!0;else break}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(let e in this.buckets){let t=this.buckets[e];if(t instanceof zy&&t.hasRTLText){this.hasRTLText=!0,maplibre_gl_mo().lazyLoad();break}}this.queryPadding=0;for(let e in this.buckets){let n=this.buckets[e];this.queryPadding=Math.max(this.queryPadding,t.style.getLayer(e).queryRadius(n))}e.imageAtlas&&(this.imageAtlas=e.imageAtlas),e.glyphAtlasImage&&(this.glyphAtlasImage=e.glyphAtlasImage),this.dashPositions=e.dashPositions}unloadVectorData(){for(let e in this.buckets)this.buckets[e].destroy();this.buckets={},this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.imageAtlas=null,this.dashPositions=null,this.latestFeatureIndex=null,this.state=`unloaded`}getBucket(e){return this.buckets[e.id]}upload(e){for(let t in this.buckets){let n=this.buckets[t];n.uploadPending()&&n.upload(e)}let t=e.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new Gd(e,this.imageAtlas.image,t.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&=(this.glyphAtlasTexture=new Gd(e,this.glyphAtlasImage,t.ALPHA),null)}prepare(e){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(e,this.imageAtlasTexture)}queryRenderedFeatures(e,t,n,r,i,a,o,s,c,l,u){return this.latestFeatureIndex?.rawTileData?this.latestFeatureIndex.query({queryGeometry:r,cameraQueryGeometry:i,scale:a,tileSize:this.tileSize,pixelPosMatrix:l,transform:s,params:o,queryPadding:this.queryPadding*c,getElevation:u},e,t,n):{}}querySourceFeatures(e,t){let n=this.latestFeatureIndex;if(!n?.rawTileData)return;let r=n.loadVTLayers(),i=t?.sourceLayer?t.sourceLayer:``,a=r._geojsonTileLayer||r[i];if(!a)return;let o=maplibre_gl_shared_es(t?.filter,`querySourceFeatures[${i}].filter`,t?.globalState),{z:s,x:l,y:u}=this.tileID.canonical,d={z:s,x:l,y:u};for(let t=0;t<a.length;t++){let r=a.feature(t);if(o.needGeometry){let e=maplibre_gl_shared_Bu(r,!0);if(!o.filter(new maplibre_gl_shared_G(this.tileID.overscaledZ),e,this.tileID.canonical))continue}else if(!o.filter(new maplibre_gl_shared_G(this.tileID.overscaledZ),r))continue;let f=n.getId(r,i),p=new maplibre_gl_shared_Mb(r,s,l,u,f);p.tile=d,e.push(p)}}hasData(){return this.state===`loaded`||this.state===`reloading`||this.state===`expired`}patternsLoaded(){return this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length}setExpiryData(e){let t=this.expirationTime;if(e.cacheControl){let t=maplibre_gl_shared_Bt(e.cacheControl);t[`max-age`]&&(this.expirationTime=Date.now()+t[`max-age`]*1e3)}else e.expires&&(this.expirationTime=new Date(e.expires).getTime());if(this.expirationTime){let e=Date.now(),n=!1;if(this.expirationTime>e)n=!1;else if(!t)n=!0;else if(this.expirationTime<t)n=!0;else{let r=this.expirationTime-t;r?this.expirationTime=e+Math.max(r,3e4):n=!0}n?(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(),2**31-1)}setFeatureState(e,t,n){if(!this.latestFeatureIndex?.rawTileData||Object.keys(e).length===0||this.featureStateRevision===n)return;this.featureStateRevision=n;let r=this.latestFeatureIndex.loadVTLayers();for(let n in this.buckets){if(!t.style.hasLayer(n))continue;let i=this.buckets[n],a=i.layers[0].sourceLayer||`_geojsonTileLayer`,o=r[a],s=e[a];if(!o||!s||s.length===0)continue;i.update(s,o,this.imageAtlas?.patternPositions||{},this.dashPositions||{});let c=t?.style?.getLayer(n);c&&(this.queryPadding=Math.max(this.queryPadding,c.queryRadius(i)))}}holdingForSymbolFade(){return this.symbolFadeHoldUntil!==void 0}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<maplibre_gl_U()}clearSymbolFadeHold(){this.symbolFadeHoldUntil=void 0}setSymbolHoldDuration(e){this.symbolFadeHoldUntil=maplibre_gl_U()+e}setDependencies(e,t){let n={};for(let e of t)n[e]=!0;this.dependencies[e]=n}hasDependency(e,t){for(let n of e){let e=this.dependencies[n];if(e){for(let n of t)if(e[n])return!0}}return!1}};function maplibre_gl_go(e){let t=[];for(let n in e)t.push({id:n,state:e[n]});return t}var maplibre_gl_o=class{constructor(){this.state={},this.stateChanges={},this.deletedStates={},this.revision=0}updateState(e,t,n){let r=String(t);if(this.stateChanges[e]||={},this.stateChanges[e][r]||={},maplibre_gl_shared_xt(this.stateChanges[e][r],n),this.deletedStates[e]===null){this.deletedStates[e]={};for(let t in this.state[e])if(t===r){this.deletedStates[e][r]={};for(let i in this.state[e][t])n[i]===void 0&&(this.deletedStates[e][r][i]=null)}else this.deletedStates[e][t]=null}else if(this.deletedStates[e]?.[r]===null){this.deletedStates[e][r]={};for(let t in this.state[e][r])n[t]===void 0&&(this.deletedStates[e][r][t]=null)}else for(let t in n)this.deletedStates[e]?.[r]?.[t]===null&&delete this.deletedStates[e][r][t]}removeFeatureState(e,t,n){if(this.deletedStates[e]===null)return;let r=String(t);if(this.deletedStates[e]||={},n&&t!==void 0)this.deletedStates[e][r]!==null&&(this.deletedStates[e][r]||={},this.deletedStates[e][r][n]=null);else if(t!==void 0){if(this.stateChanges[e]?.[r])for(n in this.deletedStates[e][r]={},this.stateChanges[e][r])this.deletedStates[e][r][n]=null;else this.deletedStates[e][r]=null}else this.deletedStates[e]=null}getState(e,t){let n=String(t),r=this.state[e]||{},i=this.stateChanges[e]||{},a=maplibre_gl_shared_xt({},r[n],i[n]);if(this.deletedStates[e]===null)return{};if(this.deletedStates[e]){let n=this.deletedStates[e][t];if(n===null)return{};for(let e in n)delete a[e]}return a}initializeTileState(e,t){let n={};for(let e in this.state)n[e]=maplibre_gl_go(this.state[e]);e.setFeatureState(n,t,this.revision)}coalesceChanges(e,t){let n={};for(let e in this.stateChanges){this.state[e]||={},n[e]||={};for(let t in this.stateChanges[e])this.state[e][t]||={},maplibre_gl_shared_xt(this.state[e][t],this.stateChanges[e][t]),n[e][t]=this.state[e][t]}for(let e in this.deletedStates)if(this.state[e]||={},n[e]||={},this.deletedStates[e]===null)for(let t in this.state[e])this.state[e][t]={},n[e][t]={};else for(let t in this.deletedStates[e]){if(this.deletedStates[e][t]===null)this.state[e][t]={};else for(let n of Object.keys(this.deletedStates[e][t]))delete this.state[e][t][n];n[e][t]=this.state[e][t]}if(this.stateChanges={},this.deletedStates={},Object.keys(n).length===0)return;this.revision++;let r={};for(let e in n)r[e]=maplibre_gl_go(n[e]);e.setFeatureState(r,t,this.revision)}},maplibre_gl_vo=class e{constructor(e,t){this.min=e,this.max=t,this.center=maplibre_gl_shared_pe([],maplibre_gl_shared_de([],this.min,this.max),.5)}quadrant(t){let n=[t%2==0,t<2],r=maplibre_gl_shared_ce(this.min),i=maplibre_gl_shared_ce(this.max);for(let e=0;e<n.length;e++)r[e]=n[e]?this.min[e]:this.center[e],i[e]=n[e]?this.center[e]:this.max[e];return i[2]=this.max[2],new e(r,i)}distanceX(e){return Math.max(Math.min(this.max[0],e[0]),this.min[0])-e[0]}distanceY(e){return Math.max(Math.min(this.max[1],e[1]),this.min[1])-e[1]}intersectsFrustum(e){let t=!0;for(let n of e.planes){let e=this.intersectsPlane(n);if(e===0)return 0;e===1&&(t=!1)}return t?2:e.aabb.min[0]>this.max[0]||e.aabb.min[1]>this.max[1]||e.aabb.min[2]>this.max[2]||e.aabb.max[0]<this.min[0]||e.aabb.max[1]<this.min[1]||e.aabb.max[2]<this.min[2]?0:1}intersectsPlane(e){let t=e[3],n=e[3];for(let r=0;r<3;r++)e[r]>0?(t+=e[r]*this.min[r],n+=e[r]*this.max[r]):(n+=e[r]*this.min[r],t+=e[r]*this.max[r]);return t>=0?2:n<0?0:1}},maplibre_gl_yo=class e{constructor(e,t,n){this.points=e,this.planes=t,this.aabb=n}static fromInvProjectionMatrix(t,r=1,i=0,a,o){let s=[[-1,1,-1,1],[1,1,-1,1],[1,-1,-1,1],[-1,-1,-1,1],[-1,1,1,1],[1,1,1,1],[1,-1,1,1],[-1,-1,1,1]],c=o?[[6,5,4],[0,1,2],[0,3,7],[2,1,5],[3,2,6],[0,4,5]]:[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]],l=2**i,u=s.map(e=>maplibre_gl_bo(e,t,r,l));a&&maplibre_gl_xo(u,c[0],a,o);let d=c.map(e=>{let t=maplibre_gl_shared_Ee([],u[e[0]],u[e[1]]),r=maplibre_gl_shared_Ee([],u[e[2]],u[e[1]]),i=maplibre_gl_shared_j([],maplibre_gl_shared_ve([],t,r)),a=-dist_maplibre_gl_shared_e(i,u[e[1]]);return i.concat(a)}),f=[1/0,1/0,1/0],p=[-1/0,-1/0,-1/0];for(let e of u)for(let t=0;t<3;t++)f[t]=Math.min(f[t],e[t]),p[t]=Math.max(p[t],e[t]);return new e(u,d,new maplibre_gl_vo(f,p))}};function maplibre_gl_bo(e,t,n,r){let i=maplibre_gl_shared_Ne([],e,t),a=1/i[3]/n*r;return maplibre_gl_shared_Pe(i,i,[a,a,1/i[3],a])}function maplibre_gl_xo(e,t,n,r){let i=r?4:0,a=r?0:4,o=0,s=[],c=[];for(let t=0;t<4;t++){let n=maplibre_gl_shared_Ee([],e[t+a],e[t+i]),r=maplibre_gl_shared_le(n);maplibre_gl_shared_pe(n,n,1/r),s.push(r),c.push(n)}for(let t=0;t<4;t++){let r=maplibre_gl_shared_st(e[t+i],c[t],n);o=r!==null&&r>=0?Math.max(o,r):Math.max(o,s[t])}let l=maplibre_gl_So(e,t),u=maplibre_gl_Co(n,l);if(u!==null){let e=u/dist_maplibre_gl_shared_e(c[0],l);o=Math.min(o,e)}for(let t=0;t<4;t++){let n=Math.min(o,s[t]);e[t+a]=[e[t+i][0]+c[t][0]*n,e[t+i][1]+c[t][1]*n,e[t+i][2]+c[t][2]*n,1]}}function maplibre_gl_So(e,t){let r=maplibre_gl_shared_Ee([],e[t[0]],e[t[1]]),i=maplibre_gl_shared_Ee([],e[t[2]],e[t[1]]),a=[0,0,0,0];return maplibre_gl_shared_j(a,maplibre_gl_shared_ve([],r,i)),a[3]=-dist_maplibre_gl_shared_e(a,e[t[0]]),a}function maplibre_gl_Co(e,t){let n=maplibre_gl_shared_De(e),r=maplibre_gl_shared_je([],e,1/n),i=maplibre_gl_shared_Ee([],t,maplibre_gl_shared_pe([],r,dist_maplibre_gl_shared_e(t,r))),a=maplibre_gl_shared_De(i);if(a>0){let e=Math.sqrt(1-r[3]*r[3]),n=maplibre_gl_shared_pe([],r,-r[3]),o=maplibre_gl_shared_de([],n,maplibre_gl_shared_pe([],i,e/a));return maplibre_gl_shared_at(t,o)}return null}function maplibre_gl_wo(e,t,n){let r=t.intersectsFrustum(e);if(!n||r===0)return r;let i=t.intersectsPlane(n);return i===0?0:r===2&&i===2?2:1}function maplibre_gl_To(e,t,n){let r=0,i=(n-t)/10;for(let a=0;a<10;a++){let o=t+(a+.5)/10*(n-t);r+=i*Math.cos(o)**+e}return r}function maplibre_gl_Eo(e,t){return function(n,r,i,a,o){let s=2*((e-1)/maplibre_gl_shared_Ot(Math.cos(maplibre_gl_shared_$t((/* inlined export .Q */89.25)-o))/Math.cos(maplibre_gl_shared_$t((/* inlined export .Q */89.25))))-1),c=Math.acos(i/a),l=2*maplibre_gl_To(s-1,0,maplibre_gl_shared_$t(o/2)),u=Math.min(maplibre_gl_shared_$t((/* inlined export .Q */89.25)),c+maplibre_gl_shared_$t(o/2)),d=Math.min(u,c-maplibre_gl_shared_$t(o/2)),f=maplibre_gl_To(s-1,d,u),p=Math.atan(r/i),m=Math.hypot(r,i),h=n;return h+=maplibre_gl_shared_Ot(a/m/Math.max(.5,Math.cos(maplibre_gl_shared_$t(o/2)))),h+=s*maplibre_gl_shared_Ot(Math.cos(p))/2,h-=maplibre_gl_shared_Ot(Math.max(1,f/l/t))/2,h}}const maplibre_gl_Do=maplibre_gl_Eo(9.314,3);function maplibre_gl_Oo(e,t){let n=(t.roundZoom?Math.round:Math.floor)(e.zoom+maplibre_gl_shared_Ot(e.tileSize/t.tileSize));return Math.max(0,n)}function maplibre_gl_ko(e,t){let n=(/* inlined export .Q */89.25)-e.pitch-e.fov/2,r=maplibre_gl_shared_yt((15-n)/15,0,1),i=Math.max(500,t??0);return e.elevation+r*i}function maplibre_gl_Ao(e,t,n){let r=e.planes[1],i=e.points.map(e=>{let i=r[0]*e[0]+r[1]*e[1]+r[2]*e[2]+r[3];if(Math.abs(i)>1e-6)return e;let a=[e[0]-n[0],e[1]-n[1],e[2]-n[2]],o=r[0]*a[0]+r[1]*a[1]+r[2]*a[2];if(o>=-1e-9)return e;let s=t/-o;return[e[0]+a[0]*s,e[1]+a[1]*s,e[2]+a[2]*s,e[3]]}),a=e.planes.map((e,n)=>n===1?[e[0],e[1],e[2],e[3]+t]:e),o=[1/0,1/0,1/0],s=[-1/0,-1/0,-1/0];for(let e of i)for(let t=0;t<3;t++)o[t]=Math.min(o[t],e[t]),s[t]=Math.max(s[t],e[t]);return new maplibre_gl_yo(i,a,new maplibre_gl_vo(o,s))}function maplibre_gl_jo(e,t){let n=e.getCameraFrustum(),r=e.getClippingPlane();if(r&&t.maxContentElevation>0){let i=Math.hypot(r[0],r[1],r[2]);if(i>0){let a=1+t.maxContentElevation/maplibre_gl_shared_jp,o=maplibre_gl_shared_yt(-r[3]/i,-1,1),s=Math.cos(Math.acos(o)+Math.acos(1/a));r=[r[0],r[1],r[2],-s*i],n=maplibre_gl_Ao(n,Math.sqrt(a*a-1),e.cameraPosition)}}let i=maplibre_gl_shared_Zp(e),a=maplibre_gl_shared_Hp.fromLngLat(e.center,e.elevation),o=maplibre_gl_ko(e,t.maxContentElevation),s=e.getCoveringTilesDetailsProvider(),c=s.allowVariableZoom(e,t),l=maplibre_gl_Oo(e,t),u=t.minzoom||0,d=t.maxzoom===void 0?e.maxZoom:t.maxzoom,f=Math.min(Math.max(0,l),d),p=2**f,m=[p*i.x,p*i.y,0],h=[p*a.x,p*a.y,0],g=Math.hypot(a.x-i.x,a.y-i.y),_=Math.abs(a.z-i.z),v=Math.hypot(g,_),y=e=>({zoom:0,x:0,y:0,wrap:e,fullyVisible:!1}),b=[],x=[];if(e.renderWorldCopies&&s.allowWorldCopies())for(let e=1;e<=3;e++)b.push(y(-e)),b.push(y(e));for(b.push(y(0));b.length>0;){let p=b.pop(),g=p.x,y=p.y,S=p.fullyVisible,C={x:g,y,z:p.zoom},w=s.getTileBoundingVolume(C,p.wrap,o,t);if(!S){let e=maplibre_gl_wo(n,w,r);if(e===0)continue;S=e===2}let T=s.distanceToTile2d(i.x,i.y,C,w),E=l;c&&(E=(t.calculateTileZoom||maplibre_gl_Do)(e.zoom+maplibre_gl_shared_Ot(e.tileSize/t.tileSize),T,_,v,e.fov)),E=(t.roundZoom?Math.round:Math.floor)(E),E=Math.max(0,E);let ee=Math.min(E,d);if(p.wrap=s.getWrap(a,C,p.wrap),p.zoom>=ee){if(p.zoom<u)continue;let e=f-p.zoom,n=m[0]-.5-(g<<e),r=m[1]-.5-(y<<e),i=t.reparseOverscaled?Math.max(p.zoom,E):p.zoom;x.push({tileID:new maplibre_gl_shared_fb(p.zoom===d?i:p.zoom,p.wrap,p.zoom,g,y),distanceSq:maplibre_gl_shared_Xe([h[0]-.5-g,h[1]-.5-y]),tileDistanceToCamera:Math.sqrt(n*n+r*r)});continue}for(let e=0;e<4;e++){let t=(g<<1)+e%2,n=(y<<1)+(e>>1),r=p.zoom+1;b.push({zoom:r,x:t,y:n,wrap:p.wrap,fullyVisible:S})}}return x.sort((e,t)=>e.distanceSq-t.distanceSq).map(e=>e.tileID)}function maplibre_gl_Mo(e){return e===`raster`||e===`image`||e===`video`}function maplibre_gl_No(e,t,n,r,i,a,o){let s=maplibre_gl_U(),c=maplibre_gl_shared_ht(t);for(let l of t){let t=e.getTileById(l.key);(t.fadingDirection===0||t.fadeOpacity===0)&&t.resetFadeLogic(),!maplibre_gl_Po(e,t,n,s,r,i,o)&&(maplibre_gl_Fo(e,t,n,s,a,o)||maplibre_gl_Lo(t,c,s,o)||t.resetFadeLogic())}}function maplibre_gl_Po(e,t,n,r,i,a,o){if(!t.hasData())return!1;let{tileID:s,fadingRole:c,fadingDirection:l,fadingParentID:u}=t;if(c===0&&l===1&&u)return n[u.key]=u,!0;let d=Math.max(s.overscaledZ-i,a);for(let i=s.overscaledZ-1;i>=d;i--){let a=s.scaledTo(i),c=e.getLoadedTile(a);if(c)return t.setCrossFadeLogic({fadingRole:0,fadingDirection:1,fadingParentID:c.tileID,fadeEndTime:r+o}),c.setCrossFadeLogic({fadingRole:1,fadingDirection:0,fadeEndTime:r+o}),n[a.key]=a,!0}return!1}function maplibre_gl_Fo(e,t,n,r,i,a){if(!t.hasData())return!1;let o=t.tileID.children(i),s=maplibre_gl_Io(e,t,o,n,r,i,a);if(s)return!0;for(let c of o)maplibre_gl_Io(e,t,c.children(i),n,r,i,a)&&(s=!0);return s}function maplibre_gl_Io(e,t,n,r,i,a,o){if(n[0].overscaledZ>=a)return!1;let s=!1;for(let a of n){let n=e.getLoadedTile(a);if(!n)continue;let{fadingRole:c,fadingDirection:l,fadingParentID:u}=n;(c!==0||l!==0||!u)&&(n.setCrossFadeLogic({fadingRole:0,fadingDirection:0,fadingParentID:t.tileID,fadeEndTime:i+o}),t.setCrossFadeLogic({fadingRole:1,fadingDirection:1,fadeEndTime:i+o})),r[a.key]=a,s=!0}return s}function maplibre_gl_Lo(e,t,n,r){let i=e.tileID;if(e.selfFading)return!0;if(e.hasData())return!1;if(t.has(i)){let t=n+r;return e.setSelfFadeLogic(t),!0}return!1}function maplibre_gl_Ro(e,t){if(t<=0)return!1;let n=maplibre_gl_U();for(let t of e.getAllTiles())if(t.fadeEndTime>=n)return!0;return!1}function maplibre_gl_zo(e,t){let n=t.getRenderableIds();for(let r of n){if(!e.neighboringTiles?.[r])continue;let n=t.getTileById(r);e.neighboringTiles[r].backfilled||maplibre_gl_Bo(e,n),!n.neighboringTiles?.[e.tileID.key]?.backfilled&&maplibre_gl_Bo(n,e)}}function maplibre_gl_Bo(e,t){e.needsHillshadePrepare=!0,e.needsTerrainPrepare=!0,e.needsColorReliefPrepare=!0;let n=t.tileID.canonical.x-e.tileID.canonical.x,r=t.tileID.canonical.y-e.tileID.canonical.y,i=2**e.tileID.canonical.z,a=t.tileID.key;(n!==0||r!==0)&&(Math.abs(r)>1||(Math.abs(n)>1&&(Math.abs(n+i)===1?n+=i:Math.abs(n-i)===1&&(n-=i)),t.dem&&e.dem&&(e.dem.backfillBorder(t.dem,n,r),e.neighboringTiles?.[a]&&(e.neighboringTiles[a].backfilled=!0))))}var maplibre_gl_Vo=class{constructor(){this._tiles={}}handleWrapJump(e){let t={};for(let n in this._tiles){let r=this._tiles[n];r.tileID=r.tileID.unwrapTo(r.tileID.wrap+e),t[r.tileID.key]=r}this._tiles=t}setFeatureState(e,t,n){for(let r in this._tiles)this._tiles[r].setFeatureState(e,t,n)}getAllTiles(){return Object.values(this._tiles)}getAllIds(e=!1){return e?Object.values(this._tiles).map(e=>e.tileID).sort(maplibre_gl_shared_vb).map(e=>e.key):Object.keys(this._tiles)}getTileById(e){return this._tiles[e]}setTile(e,t){this._tiles[e]=t}deleteTileById(e){delete this._tiles[e]}getLoadedTile(e){let t=this.getTileById(e.key);return t?.hasData()?t:null}isIdRenderable(e,t=!1){return this.getTileById(e)?.isRenderable(t)}getRenderableIds(e=0,t){let n=[];for(let e of this.getAllIds())this.isIdRenderable(e,t)&&n.push(this.getTileById(e));return t?n.sort((t,n)=>{let r=t.tileID,i=n.tileID,a=new maplibre_gl_shared_l(r.canonical.x,r.canonical.y)._rotate(-e),o=new maplibre_gl_shared_l(i.canonical.x,i.canonical.y)._rotate(-e);return r.overscaledZ-i.overscaledZ||o.y-a.y||o.x-a.x}).map(e=>e.tileID.key):n.map(e=>e.tileID).sort(maplibre_gl_shared_vb).map(e=>e.key)}},maplibre_gl_Ho=class e extends maplibre_gl_shared_Fn{static{this.maxUnderzooming=10}static{this.maxOverzooming=3}constructor(e,t,n){super(),this._maxContentElevationSeen=0,this.id=e,this.dispatcher=n,this.on(`data`,e=>{this._dataHandler(e)}),this.on(`dataloading`,()=>{this._sourceErrored=!1}),this.on(`error`,()=>{this._sourceErrored=this._source.loaded()}),this._source=maplibre_gl_ao(e,t,n,this),this._inViewTiles=new maplibre_gl_Vo,this._outOfViewCache=new sT(0,e=>this._unloadTile(e)),this._timers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._rasterFadeDuration=0,this._maxFadingAncestorLevels=5,this._state=new maplibre_gl_o,this._didEmitContent=!1,this._updated=!1}onAdd(e){this.map=e,this._maxTileCacheSize=e?e._maxTileCacheSize:null,this._maxTileCacheZoomLevels=e?e._maxTileCacheZoomLevels:null,this._source?.onAdd&&this._source.onAdd(e)}onRemove(e){for(let e of this._inViewTiles.getAllTiles())e.unloadVectorData();this.clearTiles(),this._source?.onRemove&&this._source.onRemove(e),this._inViewTiles=new maplibre_gl_Vo}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(let e of this._inViewTiles.getAllTiles())if(e.state!==`loaded`&&e.state!==`errored`)return!1;return!0}getSource(){return this._source}getState(){return this._state}pause(){this._paused=!0}resume(){if(!this._paused)return;let e=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,e&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}async _loadTile(e,n,r,i){try{let t=await this._source.loadTile(e);this._tileLoaded(e,n,r,i,t)}catch(n){e.state=`errored`,n.status===404?this.update(this.transform,this.terrain):this._source.fire(new maplibre_gl_shared_Pn(maplibre_gl_shared_Qe(n),{tile:e}))}}_unloadTile(e){this._source.unloadTile&&this._source.unloadTile(e)}_abortTile(e){this._source.abortTile&&this._source.abortTile(e),this._source.fire(new maplibre_gl_K(`dataabort`,{tile:e,coord:e.tileID}))}serialize(){return this._source.serialize()}prepare(e){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._inViewTiles,this.map?this.map.painter:null);for(let t of this._inViewTiles.getAllTiles())t.upload(e),t.prepare(this.map.style.imageManager)}getIds(){return this._inViewTiles.getAllIds(!0)}getRenderableIds(e){return this._inViewTiles.getRenderableIds(this.transform?.bearingInRadians,e)}hasRenderableParent(e){let t=e.overscaledZ-1;if(t>=this._source.minzoom){let n=this.getLoadedTile(e.scaledTo(t));if(n)return this._inViewTiles.isIdRenderable(n.tileID.key)}return!1}reload(e,t=void 0){if(this._paused){this._shouldReloadOnResume=!0;return}this._outOfViewCache.reset();for(let n of this._inViewTiles.getAllIds()){let r=this._inViewTiles.getTileById(n);(!t||this._source.shouldReloadTile(r,t))&&(e?this._reloadTile(n,r.state===`errored`?`loading`:`expired`):r.state!==`errored`&&this._reloadTile(n,`reloading`))}}async _reloadTile(e,t){let n=this._inViewTiles.getTileById(e);if(!n)return;let r=n.hasData();n.state!==`loading`&&(n.state=t),await this._loadTile(n,e,t,r)}_tileLoaded(e,t,n,r,i){r||(e.timeAdded=maplibre_gl_U(),e.selfFading&&(e.fadeEndTime=e.timeAdded+this._rasterFadeDuration)),n===`expired`&&(e.refreshedUponExpiration=!0),this._setTileReloadTimer(t,e),!i?.unmodified&&(this.getSource().type===`raster-dem`&&e.dem&&maplibre_gl_zo(e,this._inViewTiles),e.featureStateRevision=-1,this._state.initializeTileState(e,this.map?this.map.painter:null),e.aborted||this._source.fire(new maplibre_gl_K(`data`,{tile:e,coord:e.tileID})))}getTile(e){return this.getTileByID(e.key)}getTileByID(e){return this._inViewTiles.getTileById(e)}_retainLoadedChildren(t,n){let r=this._getLoadedDescendents(n),i=new Set;for(let a of n){let n=r[a.key];if(!n?.length){i.add(a);continue}let o=a.overscaledZ+e.maxOverzooming,s=n.filter(e=>e.tileID.overscaledZ<=o);if(!s.length){i.add(a);continue}let c=Math.min(...s.map(e=>e.tileID.overscaledZ)),l=s.filter(e=>e.tileID.overscaledZ===c).map(e=>e.tileID);for(let e of l)t[e.key]=e;this._areDescendentsComplete(l,c,a.overscaledZ)||i.add(a)}return i}_getLoadedDescendents(e){let t={};for(let n of this._inViewTiles.getAllTiles().filter(e=>e.hasData()))for(let r of e)n.tileID.isChildOf(r)&&(t[r.key]||=[],t[r.key].push(n));return t}_areDescendentsComplete(e,t,n){return e.length===1&&e[0].isOverscaled()?e[0].overscaledZ===t:4**(t-n)===e.length}getLoadedTile(e){return this._inViewTiles.getLoadedTile(e)}updateCacheSize(e){let t=(Math.ceil(e.width/this._source.tileSize)+1)*(Math.ceil(e.height/this._source.tileSize)+1),n=this._maxTileCacheZoomLevels===null?maplibre_gl_shared_gn.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels,r=Math.floor(t*n),i=typeof this._maxTileCacheSize==`number`?Math.min(this._maxTileCacheSize,r):r;this._outOfViewCache.setMaxSize(i)}handleWrapJump(e){let t=(e-(this._prevLng===void 0?e:this._prevLng))/360,n=Math.round(t);this._prevLng=e,n&&(this._inViewTiles.handleWrapJump(n),this._resetTileReloadTimers())}_updateMaxContentElevation(){let e=this._maxContentElevationSeen,t=this.map?.style?._layers;if(!t)return e;let n=this._inViewTiles.getAllTiles();for(let r in t){let i=t[r];if(i.type!==`symbol`||i.source!==this.id||i.isHidden(this.transform.zoom))continue;let a=i;if(a.layout){e=Math.max(e,a.layout.get(`symbol-height-offset`).constantOr(0));for(let t of n){let n=t.getBucket(i);n&&n.maxHeightOffset>e&&(e=n.maxHeightOffset)}}}return this._maxContentElevationSeen=e,e}update(e,t){if(!this._sourceLoaded||this._paused)return;this.transform=e,this.terrain=t,this.updateCacheSize(e),this.handleWrapJump(this.transform.center.lng);let n;!this.used&&!this.usedForTerrain?n=[]:this._source.tileID?n=e.getVisibleUnwrappedCoordinates(this._source.tileID).map(e=>new maplibre_gl_shared_fb(e.canonical.z,e.wrap,e.canonical.z,e.canonical.x,e.canonical.y)):(n=maplibre_gl_jo(e,{tileSize:this.usedForTerrain?this.tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.type===`vector`&&this.map._zoomLevelsToOverscale!==void 0?Math.max(this._source.maxzoom,e.maxZoom-this.map._zoomLevelsToOverscale):this._source.maxzoom,roundZoom:!this.usedForTerrain&&this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled,terrain:t,calculateTileZoom:this._source.calculateTileZoom,maxContentElevation:this._updateMaxContentElevation()}),this._source.hasTile&&(n=n.filter(e=>this._source.hasTile(e)))),this.usedForTerrain&&(n=this._addTerrainIdealTiles(n));let r=n.length===0&&!this._updated&&this._didEmitContent;this._updated=!0,r&&this.fire(new maplibre_gl_K(`data`,{sourceDataType:`idle`,sourceId:this.id}));let i=maplibre_gl_Oo(e,this._source),a=this._updateRetainedTiles(n,i),o=maplibre_gl_Mo(this._source.type);o&&this._rasterFadeDuration>0&&!t&&maplibre_gl_No(this._inViewTiles,n,a,this._maxFadingAncestorLevels,this._source.minzoom,this._source.maxzoom,this._rasterFadeDuration),o?this._cleanUpRasterTiles(a):this._cleanUpVectorTiles(a)}_cleanUpRasterTiles(e){for(let t of this._inViewTiles.getAllIds())e[t]||this._removeTile(t)}_cleanUpVectorTiles(e){for(let t of this._inViewTiles.getAllIds()){let n=this._inViewTiles.getTileById(t);if(e[t]){n.clearSymbolFadeHold();continue}if(!n.hasSymbolBuckets){this._removeTile(t);continue}n.holdingForSymbolFade()?n.symbolFadeFinished()&&this._removeTile(t):n.setSymbolHoldDuration(this.map._fadeDuration)}}_addTerrainIdealTiles(e){let t=[];for(let n of e)if(n.canonical.z>this._source.minzoom){let e=n.scaledTo(n.canonical.z-1);t.push(e);let r=n.scaledTo(Math.max(this._source.minzoom,Math.min(n.canonical.z,5)));t.push(r)}return e.concat(t)}releaseSymbolFadeTiles(){for(let e of this._inViewTiles.getAllIds())this._inViewTiles.getTileById(e).holdingForSymbolFade()&&this._removeTile(e)}_updateRetainedTiles(t,n){let r=new Set;for(let e of t)this._addTile(e).hasData()||r.add(e);let i=t.reduce((e,t)=>(e[t.key]=t,e),{}),a=this._retainLoadedChildren(i,r),o={},s=Math.max(n-e.maxUnderzooming,this._source.minzoom);for(let e of a){let t=this._inViewTiles.getTileById(e.key),n=t?.wasRequested();for(let r=e.overscaledZ-1;r>=s;--r){let a=e.scaledTo(r);if(o[a.key])break;if(o[a.key]=!0,t=this.getTile(a),!t&&n&&(t=this._addTile(a)),t){let e=t.hasData();if((e||!this.map?.cancelPendingTileRequestsWhileZooming||n)&&(i[a.key]=a),n=t.wasRequested(),e)break}}}return i}_addTile(e){let t=this._inViewTiles.getTileById(e.key);if(t)return t;t=this._outOfViewCache.getAndRemove(e),t&&(t.resetFadeLogic(),this._setTileReloadTimer(e.key,t),t.tileID=e,this._state.initializeTileState(t,this.map?this.map.painter:null));let n=t;return t||(t=new maplibre_gl_ho(e,this._source.tileSize*e.overscaleFactor()),this._loadTile(t,e.key,t.state,!1)),t.uses++,this._inViewTiles.setTile(e.key,t),n||this._source.fire(new maplibre_gl_K(`dataloading`,{tile:t,coord:t.tileID})),t}_setTileReloadTimer(e,t){this._clearTileReloadTimer(e);let n=t.getExpiryTimeout();if(n){let t=()=>{this._reloadTile(e,`expired`),delete this._timers[e]};this._timers[e]=setTimeout(t,n)}}_clearTileReloadTimer(e){let t=this._timers[e];t&&(clearTimeout(t),delete this._timers[e])}_resetTileReloadTimers(){for(let e in this._timers)clearTimeout(this._timers[e]),delete this._timers[e];for(let e of this._inViewTiles.getAllIds()){let t=this._inViewTiles.getTileById(e);this._setTileReloadTimer(e,t)}}refreshTiles(e){for(let t of this._inViewTiles.getAllIds()){let n=this._inViewTiles.getTileById(t);(this._inViewTiles.isIdRenderable(t)||n.state==`errored`)&&e.some(e=>e.equals(n.tileID.canonical))&&this._reloadTile(t,`expired`)}}_removeTile(e){let t=this._inViewTiles.getTileById(e);t&&(t.uses--,this._inViewTiles.deleteTileById(e),this._clearTileReloadTimer(e),!(t.uses>0)&&(t.hasData()&&t.state!==`reloading`?this._outOfViewCache.add(t.tileID,t,t.getExpiryTimeout()):(t.aborted=!0,this._abortTile(t),this._unloadTile(t))))}_dataHandler(e){if(e.dataType===`source`){if(e.sourceDataType===`metadata`){this._sourceLoaded=!0;return}e.sourceDataType===`content`&&this._sourceLoaded&&!this._paused&&(this.reload(e.sourceDataChanged,e.shouldReloadTileOptions),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0)}}resetMaxContentElevation(){this._maxContentElevationSeen=0}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1,this.resetMaxContentElevation();for(let e of this._inViewTiles.getAllIds())this._removeTile(e);this._outOfViewCache.reset()}tilesIn(e,t,n){let r=[],i=this.transform;if(!i)return r;let a=i.getCoveringTilesDetailsProvider().allowWorldCopies(),o=n?i.getCameraQueryGeometry(e):e,s=e=>i.screenPointToMercatorCoordinate(e,this.terrain),c=this.transformBbox(e,s,!a),l=this.transformBbox(o,s,!a),u=this.getIds(),d=maplibre_gl_shared_xp.fromPoints(l);for(let e of u){let n=this._inViewTiles.getTileById(e);if(n.holdingForSymbolFade())continue;let o=a?[n.tileID]:[n.tileID.unwrapTo(-1),n.tileID.unwrapTo(0)],s=2**(i.zoom-n.tileID.overscaledZ),u=t*n.queryPadding*(/* inlined export .Rr */8192)/n.tileSize/s;for(let e of o){let t=d.map(t=>e.getTilePoint(new maplibre_gl_shared_Hp(t.x,t.y)));if(t.expandBy(u),t.intersects(maplibre_gl_shared_Sp)){let t=c.map(t=>e.getTilePoint(t)),i=l.map(t=>e.getTilePoint(t));r.push({tile:n,tileID:a?e:e.unwrapTo(0),queryGeometry:t,cameraQueryGeometry:i,scale:s})}}}return r}transformBbox(e,t,n){let r=e.map(t);if(n){let n=maplibre_gl_shared_xp.fromPoints(e);n.shrinkBy(Math.min(n.width(),n.height())*.001);let i=n.map(t);maplibre_gl_shared_xp.fromPoints(r).covers(i)||(r=r.map(e=>e.x>.5?new maplibre_gl_shared_Hp(e.x-1,e.y,e.z):e))}return r}getVisibleCoordinates(e){let t=this.getRenderableIds(e).map(e=>this._inViewTiles.getTileById(e).tileID);return this.transform&&this.transform.populateCache(t),t}hasTransition(){return this._source.hasTransition()?!0:maplibre_gl_Mo(this._source.type)&&maplibre_gl_Ro(this._inViewTiles,this._rasterFadeDuration)}setRasterFadeDuration(e){this._rasterFadeDuration=e}setFeatureState(e,t,n){e||=maplibre_gl_shared_bb,this._state.updateState(e,t,n)}removeFeatureState(e,t,n){e||=maplibre_gl_shared_bb,this._state.removeFeatureState(e,t,n)}getFeatureState(e,t){return e||=maplibre_gl_shared_bb,this._state.getState(e,t)}setDependencies(e,t,n){let r=this._inViewTiles.getTileById(e);r&&r.setDependencies(t,n)}reloadTilesForDependencies(e,t){for(let n of this._inViewTiles.getAllIds())this._inViewTiles.getTileById(n).hasDependency(e,t)&&this._reloadTile(n,`reloading`);this._outOfViewCache.filter(n=>!n.hasDependency(e,t))}areTilesLoaded(){for(let e of this._inViewTiles.getAllTiles())if(e.state!==`loaded`&&e.state!==`errored`)return!1;return!0}},maplibre_gl_Uo=class{constructor(e,t){this.reset(e,t)}reset(e,t){this.points=e||[],this._distances=[0];for(let e=1;e<this.points.length;e++)this._distances[e]=this._distances[e-1]+this.points[e].dist(this.points[e-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(t||0,this.length*.5),this.paddedLength=this.length-this.padding*2}lerp(e){if(this.points.length===1)return this.points[0];e=maplibre_gl_shared_yt(e,0,1);let t=1,n=this._distances[t],r=e*this.paddedLength+this.padding;for(;n<r&&t<this._distances.length;)n=this._distances[++t];let i=t-1,a=this._distances[i],o=n-a,s=o>0?(r-a)/o:0;return this.points[i].mult(1-s).add(this.points[t].mult(s))}};function maplibre_gl_Wo(e,t,n,r,i){return i?e?e(t,n)+r:r===0?void 0:r:r}function maplibre_gl_Go(e,t){let n=!0;return e===`always`||(e===`never`||t===`never`)&&(n=!1),n}var maplibre_gl_Ko=class{constructor(e,t,n){let r=this.boxCells=[],i=this.circleCells=[];this.xCellCount=Math.ceil(e/n),this.yCellCount=Math.ceil(t/n);for(let e=0;e<this.xCellCount*this.yCellCount;e++)r.push([]),i.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=e,this.height=t,this.xScale=this.xCellCount/e,this.yScale=this.yCellCount/t,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(e,t,n,r,i){this._forEachCell(t,n,r,i,this._insertBoxCell,this.boxUid++),this.boxKeys.push(e),this.bboxes.push(t),this.bboxes.push(n),this.bboxes.push(r),this.bboxes.push(i)}insertCircle(e,t,n,r){this._forEachCell(t-r,n-r,t+r,n+r,this._insertCircleCell,this.circleUid++),this.circleKeys.push(e),this.circles.push(t),this.circles.push(n),this.circles.push(r)}_insertBoxCell(e,t,n,r,i,a){this.boxCells[i].push(a)}_insertCircleCell(e,t,n,r,i,a){this.circleCells[i].push(a)}_query(e,t,n,r,i,a,o){if(n<0||e>this.width||r<0||t>this.height)return[];let s=[];if(e<=0&&t<=0&&this.width<=n&&this.height<=r){if(i)return[{key:null,x1:e,y1:t,x2:n,y2:r}];for(let e=0;e<this.boxKeys.length;e++)s.push({key:this.boxKeys[e],x1:this.bboxes[e*4],y1:this.bboxes[e*4+1],x2:this.bboxes[e*4+2],y2:this.bboxes[e*4+3]});for(let e=0;e<this.circleKeys.length;e++){let t=this.circles[e*3],n=this.circles[e*3+1],r=this.circles[e*3+2];s.push({key:this.circleKeys[e],x1:t-r,y1:n-r,x2:t+r,y2:n+r})}}else{let c={hitTest:i,overlapMode:a,seenUids:{box:{},circle:{}}};this._forEachCell(e,t,n,r,this._queryCell,s,c,o)}return s}query(e,t,n,r){return this._query(e,t,n,r,!1,null)}hitTest(e,t,n,r,i,a){return this._query(e,t,n,r,!0,i,a).length>0}hitTestCircle(e,t,n,r,i){let a=e-n,o=e+n,s=t-n,c=t+n;if(o<0||a>this.width||c<0||s>this.height)return!1;let l=[],u={hitTest:!0,overlapMode:r,circle:{x:e,y:t,radius:n},seenUids:{box:{},circle:{}}};return this._forEachCell(a,s,o,c,this._queryCellCircle,l,u,i),l.length>0}_queryCell(e,t,n,r,i,a,o,s){let{seenUids:c,hitTest:l,overlapMode:u}=o,d=this.boxCells[i],f=1e-6;if(d!==null){let i=this.bboxes;for(let o of d)if(!c.box[o]){c.box[o]=!0;let d=o*4,p=this.boxKeys[o];if(e<=i[d+2]+f&&t<=i[d+3]+f&&n>=i[d+0]-f&&r>=i[d+1]-f&&(!s||s(p))&&(!l||!maplibre_gl_Go(u,p.overlapMode))&&(a.push({key:p,x1:i[d],y1:i[d+1],x2:i[d+2],y2:i[d+3]}),l))return!0}}let p=this.circleCells[i];if(p!==null){let i=this.circles;for(let o of p)if(!c.circle[o]){c.circle[o]=!0;let d=o*3,f=this.circleKeys[o];if(this._circleAndRectCollide(i[d],i[d+1],i[d+2],e,t,n,r)&&(!s||s(f))&&(!l||!maplibre_gl_Go(u,f.overlapMode))){let e=i[d],t=i[d+1],n=i[d+2];if(a.push({key:f,x1:e-n,y1:t-n,x2:e+n,y2:t+n}),l)return!0}}}return!1}_queryCellCircle(e,t,n,r,i,a,o,s){let{circle:c,seenUids:l,overlapMode:u}=o,d=this.boxCells[i];if(d!==null){let e=this.bboxes;for(let t of d)if(!l.box[t]){l.box[t]=!0;let n=t*4,r=this.boxKeys[t];if(this._circleAndRectCollide(c.x,c.y,c.radius,e[n+0],e[n+1],e[n+2],e[n+3])&&(!s||s(r))&&!maplibre_gl_Go(u,r.overlapMode))return a.push(!0),!0}}let f=this.circleCells[i];if(f!==null){let e=this.circles;for(let t of f)if(!l.circle[t]){l.circle[t]=!0;let n=t*3,r=this.circleKeys[t];if(this._circlesCollide(e[n],e[n+1],e[n+2],c.x,c.y,c.radius)&&(!s||s(r))&&!maplibre_gl_Go(u,r.overlapMode))return a.push(!0),!0}}}_forEachCell(e,t,n,r,i,a,o,s){let c=this._convertToXCellCoord(e),l=this._convertToYCellCoord(t),u=this._convertToXCellCoord(n),d=this._convertToYCellCoord(r);for(let f=c;f<=u;f++)for(let c=l;c<=d;c++){let l=this.xCellCount*c+f;if(i.call(this,e,t,n,r,l,a,o,s))return}}_convertToXCellCoord(e){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(e*this.xScale)))}_convertToYCellCoord(e){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(e*this.yScale)))}_circlesCollide(e,t,n,r,i,a){let o=r-e,s=i-t,c=n+a;return c*c>o*o+s*s}_circleAndRectCollide(e,t,n,r,i,a,o){let s=(a-r)/2,c=Math.abs(e-(r+s));if(c>s+n)return!1;let l=(o-i)/2,u=Math.abs(t-(i+l));if(u>l+n)return!1;if(c<=s||u<=l)return!0;let d=c-s,f=u-l;return d*d+f*f<=n*n}};function maplibre_gl_qo(e,t){let n=1/(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]),r=1/(t[8]*t[8]+t[9]*t[9]+t[10]*t[10]),i=t[0]*n,a=t[4]*n,o=t[8]*r,s=t[1]*n,c=t[5]*n,l=t[9]*r,u=t[2]*n,d=t[6]*n,f=t[10]*r;e[0]=i,e[1]=a,e[2]=o,e[4]=s,e[5]=c,e[6]=l,e[8]=u,e[9]=d,e[10]=f;let p=t[12],m=t[13],h=t[14];return e[12]=-i*p-s*m-u*h,e[13]=-a*p-c*m-d*h,e[14]=-o*p-l*m-f*h,e[3]=0,e[7]=0,e[11]=0,e[15]=1,e}function maplibre_gl_Jo(e,t){return e[0]=1/t[0],e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1/t[5],e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=0,e[11]=1/t[14],e[12]=0,e[13]=0,e[14]=-1,e[15]=t[10]/t[14],e}function maplibre_gl_Yo(e,t){let n=1/(t[0]*t[5]-t[1]*t[4]);return e[0]=t[5]*n,e[1]=-t[1]*n,e[2]=0,e[3]=0,e[4]=-t[4]*n,e[5]=t[0]*n,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1/t[10],e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1/t[15],e}const maplibre_gl_Xo=maplibre_gl_shared_b();function maplibre_gl_Zo(e,t,n){let r=maplibre_gl_shared_b();if(!e){let{vecSouth:e,vecEast:n}=maplibre_gl_$o(t),i=maplibre_gl_Nr();i[0]=n[0],i[1]=n[1],i[2]=e[0],i[3]=e[1],maplibre_gl_Pr(i,i),r[0]=i[0],r[1]=i[1],r[4]=i[2],r[5]=i[3]}return maplibre_gl_shared_D(r,r,[1/n,1/n,1]),r}function maplibre_gl_Qo(e,t,n,r){if(e){let e=maplibre_gl_shared_b();if(!t){let{vecSouth:t,vecEast:r}=maplibre_gl_$o(n);e[0]=r[0],e[1]=r[1],e[4]=t[0],e[5]=t[1]}return maplibre_gl_shared_D(e,e,[r,r,1]),e}return n.pixelsToClipSpaceMatrix}function maplibre_gl_$o(e){let t=Math.cos(e.rollInRadians),n=Math.sin(e.rollInRadians),r=Math.cos(e.pitchInRadians),i=Math.cos(e.bearingInRadians),a=Math.sin(e.bearingInRadians),o=maplibre_gl_shared_Ue();o[0]=-i*r*n-a*t,o[1]=-a*r*n+i*t;let s=maplibre_gl_shared_Ke(o);s<1e-9?maplibre_gl_shared_Ye(o):maplibre_gl_shared_Ge(o,o,1/s);let c=maplibre_gl_shared_Ue();c[0]=i*r*t-a*n,c[1]=a*r*t+i*n;let l=maplibre_gl_shared_Ke(c);return l<1e-9?maplibre_gl_shared_Ye(c):maplibre_gl_shared_Ge(c,c,1/l),{vecEast:c,vecSouth:o}}function maplibre_gl_es(e,t,n){return maplibre_gl_Wo(e.getElevation,t,n,e.heightOffset??0,e.heightAnchorGround??!0)}function maplibre_gl_ts(e,t,n,r){let i;r==null?(i=[e,t,0,1],maplibre_gl_vs(i,i,n)):(i=[e,t,r,1],maplibre_gl_shared_Ne(i,i,n));let a=i[3];return{point:new maplibre_gl_shared_l(i[0]/a,i[1]/a),signedDistanceFromCamera:a,isOccluded:!1}}function maplibre_gl_ns(e,t){return .5+e/t*.5}function maplibre_gl_rs(e,t){return e.x>=-t[0]&&e.x<=t[0]&&e.y>=-t[1]&&e.y<=t[1]}function maplibre_gl_is(e,t,n,r,a,o,s,c,l,u,d,f,p){let m=n?e.textSizeData:e.iconSizeData,h=Hv(m,t.transform.zoom),g=[256/t.width*2+1,256/t.height*2+1],_=n?e.text.dynamicLayoutVertexArray:e.icon.dynamicLayoutVertexArray;_.clear();let v=e.lineVertexArray,y=n?e.text.placedSymbolArray:e.icon.placedSymbolArray,b=t.transform.width/t.transform.height,x=!1;for(let n=0;n<y.length;n++){let i=y.get(n);if(i.hidden||i.writingMode===2&&!x){maplibre_gl_s(i.numGlyphs,_);continue}x=!1;let S=new maplibre_gl_shared_l(i.anchorX,i.anchorY),C={getElevation:p,pitchedLabelPlaneMatrix:r,lineVertexArray:v,pitchWithMap:o,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},transform:t.transform,tileAnchorPoint:S,unwrappedTileID:l,width:u,height:d,translation:f},w=maplibre_gl_fs(i.anchorX,i.anchorY,C);if(!maplibre_gl_rs(w.point,g)){maplibre_gl_s(i.numGlyphs,_);continue}let T=w.signedDistanceFromCamera,E=maplibre_gl_ns(t.transform.cameraToCenterDistance,T),ee=Vv(m,h,i),D=o?ee*t.transform.getPitchedTextCorrection(i.anchorX,i.anchorY,l)/E:ee*E,O=maplibre_gl_ss({projectionContext:C,pitchedLabelPlaneMatrixInverse:a,symbol:i,fontSize:D,flip:!1,keepUpright:s,glyphOffsetArray:e.glyphOffsetArray,dynamicLayoutVertexArray:_,aspectRatio:b,rotateToLine:c});x=O.useVertical,(O.notEnoughRoom||x||O.needsFlipping&&maplibre_gl_ss({projectionContext:C,pitchedLabelPlaneMatrixInverse:a,symbol:i,fontSize:D,flip:!0,keepUpright:s,glyphOffsetArray:e.glyphOffsetArray,dynamicLayoutVertexArray:_,aspectRatio:b,rotateToLine:c}).notEnoughRoom)&&maplibre_gl_s(i.numGlyphs,_)}n?e.text.dynamicLayoutVertexBuffer.updateData(_):e.icon.dynamicLayoutVertexBuffer.updateData(_)}function maplibre_gl_as(e,t,n,r,i,a,o,s){let c=a.glyphStartIndex+a.numGlyphs,l=a.lineStartIndex,u=a.lineStartIndex+a.lineLength,d=t.getoffsetX(a.glyphStartIndex),f=t.getoffsetX(c-1),p=maplibre_gl_hs(e*d,n,r,i,a.segment,l,u,s,o);if(!p)return null;let m=maplibre_gl_hs(e*f,n,r,i,a.segment,l,u,s,o);return!m||s.projectionCache.anyProjectionOccluded?null:{first:p,last:m}}function maplibre_gl_os(e,t,n,r){return e===1&&Math.abs(n.y-t.y)>Math.abs(n.x-t.x)*r?{useVertical:!0}:(e===2?t.y<n.y:t.x>n.x)?{needsFlipping:!0}:null}function maplibre_gl_ss(e){let{projectionContext:t,pitchedLabelPlaneMatrixInverse:n,symbol:r,fontSize:i,flip:a,keepUpright:o,glyphOffsetArray:s,dynamicLayoutVertexArray:c,aspectRatio:l,rotateToLine:u}=e,d=i/24,f=r.lineOffsetX*d,m=r.lineOffsetY*d,h;if(r.numGlyphs>1){let e=r.glyphStartIndex+r.numGlyphs,i=r.lineStartIndex,c=r.lineStartIndex+r.lineLength,p=maplibre_gl_as(d,s,f,m,a,r,u,t);if(!p)return{notEnoughRoom:!0};let g=maplibre_gl_ds(p.first.point.x,p.first.point.y,t,n),_=maplibre_gl_ds(p.last.point.x,p.last.point.y,t,n);if(o&&!a){let e=maplibre_gl_os(r.writingMode,g,_,l);if(e)return e}h=[p.first];for(let n=r.glyphStartIndex+1;n<e-1;n++){let e=maplibre_gl_hs(d*s.getoffsetX(n),f,m,a,r.segment,i,c,t,u);if(!e)return{notEnoughRoom:!0};h.push(e)}h.push(p.last)}else{if(o&&!a){let e=maplibre_gl_us(t.tileAnchorPoint.x,t.tileAnchorPoint.y,t).point,i=r.lineStartIndex+r.segment+1,a=new maplibre_gl_shared_l(t.lineVertexArray.getx(i),t.lineVertexArray.gety(i)),o=maplibre_gl_us(a.x,a.y,t),s=o.signedDistanceFromCamera>0?o.point:maplibre_gl_cs(t.tileAnchorPoint,a,e,1,t),c=maplibre_gl_ds(e.x,e.y,t,n),u=maplibre_gl_ds(s.x,s.y,t,n),d=maplibre_gl_os(r.writingMode,c,u,l);if(d)return d}let e=maplibre_gl_hs(d*s.getoffsetX(r.glyphStartIndex),f,m,a,r.segment,r.lineStartIndex,r.lineStartIndex+r.lineLength,t,u);if(!e||t.projectionCache.anyProjectionOccluded)return{notEnoughRoom:!0};h=[e]}for(let e of h)Fy(c,e.point,e.angle);return{}}function maplibre_gl_cs(e,t,n,r,i){let a=e.add(e.sub(t)._unit()),o=maplibre_gl_us(a.x,a.y,i).point,s=n.sub(o);return n.add(s._mult(r/s.mag()))}function maplibre_gl_ls(e,t,n){let r=t.projectionCache;if(r.projections[e])return r.projections[e];let i=new maplibre_gl_shared_l(t.lineVertexArray.getx(e),t.lineVertexArray.gety(e)),a=maplibre_gl_us(i.x,i.y,t);if(a.signedDistanceFromCamera>0)return r.projections[e]=a.point,r.anyProjectionOccluded||=a.isOccluded,a.point;let o=e-n.direction,s=n.distanceFromAnchor===0?t.tileAnchorPoint:new maplibre_gl_shared_l(t.lineVertexArray.getx(o),t.lineVertexArray.gety(o)),c=n.absOffsetX-n.distanceFromAnchor+1;return maplibre_gl_cs(s,i,n.previousVertex,c,t)}function maplibre_gl_us(e,t,n){let r=e+n.translation[0],i=t+n.translation[1],a;return n.pitchWithMap?(a=maplibre_gl_ts(r,i,n.pitchedLabelPlaneMatrix,maplibre_gl_es(n,r,i)),a.isOccluded=!1):(a=n.transform.projectTileCoordinates(r,i,n.unwrappedTileID,maplibre_gl_es(n,r,i)),a.point.x=(a.point.x*.5+.5)*n.width,a.point.y=(-a.point.y*.5+.5)*n.height),a}function maplibre_gl_ds(e,t,n,r){if(n.pitchWithMap){let i=[e,t,0,1];maplibre_gl_shared_Ne(i,i,r);let a=i[0]/i[3],o=i[1]/i[3];return n.transform.projectTileCoordinates(a,o,n.unwrappedTileID,maplibre_gl_es(n,a,o)).point}return{x:e/n.width*2-1,y:1-t/n.height*2}}function maplibre_gl_fs(e,t,n){return n.transform.projectTileCoordinates(e,t,n.unwrappedTileID,maplibre_gl_es(n,e,t))}function maplibre_gl_ps(e,t,n){return e._unit()._perp()._mult(t*n)}function maplibre_gl_ms(e,t,n,r,i,a,o,s,c){if(s.projectionCache.offsets[e])return s.projectionCache.offsets[e];let l=n.add(t);if(e+c.direction<r||e+c.direction>=i)return s.projectionCache.offsets[e]=l,l;let u=maplibre_gl_ls(e+c.direction,s,c),d=maplibre_gl_ps(u.sub(n),o,c.direction),f=n.add(d),p=u.add(d);return s.projectionCache.offsets[e]=maplibre_gl_shared_Lt(a,l,f,p)||l,s.projectionCache.offsets[e]}function maplibre_gl_hs(e,t,n,r,i,a,o,s,c){let l=r?e-t:e+t,u=l>0?1:-1,d=0;r&&(u*=-1,d=Math.PI),u<0&&(d+=Math.PI);let f=u>0?a+i:a+i+1,p;s.projectionCache.cachedAnchorPoint?p=s.projectionCache.cachedAnchorPoint:(p=maplibre_gl_us(s.tileAnchorPoint.x,s.tileAnchorPoint.y,s).point,s.projectionCache.cachedAnchorPoint=p);let m=p,h=p,g,_,v=0,y=0,b=Math.abs(l),x=[],S;for(;v+y<=b;){if(f+=u,f<a||f>=o)return null;v+=y,h=m,_=g;let e={absOffsetX:b,direction:u,distanceFromAnchor:v,previousVertex:h};if(m=maplibre_gl_ls(f,s,e),n===0)x.push(h),S=m.sub(h);else{let t,r=m.sub(h);t=r.mag()===0?maplibre_gl_ps(maplibre_gl_ls(f+u,s,e).sub(m),n,u):maplibre_gl_ps(r,n,u),_||=h.add(t),g=maplibre_gl_ms(f,t,m,a,o,_,n,s,e),x.push(_),S=g.sub(_)}y=S.mag()}let C=(b-v)/y,w=S._mult(C)._add(_||h),T=d+Math.atan2(m.y-h.y,m.x-h.x);return x.push(w),{point:w,angle:c?T:0,path:x}}const maplibre_gl_gs=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function maplibre_gl_s(e,t){for(let n=0;n<e;n++){let e=t.length;t.resize(e+4),t.float32.set(maplibre_gl_gs,e*3)}}function maplibre_gl_vs(e,t,n){let r=t[0],i=t[1];return e[0]=n[0]*r+n[4]*i+n[12],e[1]=n[1]*r+n[5]*i+n[13],e[3]=n[3]*r+n[7]*i+n[15],e}function maplibre_gl_ys(e,t){let n=maplibre_gl_Xo;return maplibre_gl_Yo(n,t.pitchedLabelPlaneMatrix),e.map(e=>{let r=maplibre_gl_ts(e.x,e.y,n,maplibre_gl_es(t,e.x,e.y)),i=t.transform.projectTileCoordinates(r.point.x,r.point.y,t.unwrappedTileID,maplibre_gl_es(t,r.point.x,r.point.y));return i.point.x=(i.point.x*.5+.5)*t.width,i.point.y=(-i.point.y*.5+.5)*t.height,i})}function maplibre_gl_bs(e){let t=0,n=0,r=0,i=0;for(let a=0;a<e.length;a++)e[a].isOccluded?(r=a+1,i=0):(i++,i>n&&(n=i,t=r));return e.slice(t,t+n)}var maplibre_gl_xs=class{constructor(e,t=new maplibre_gl_Ko(e.width+200,e.height+200,25),n=new maplibre_gl_Ko(e.width+200,e.height+200,25)){this.transform=e,this.grid=t,this.ignoredGrid=n,this.pitchFactor=Math.cos(e.pitch*Math.PI/180)*e.cameraToCenterDistance,this.screenRightBoundary=e.width+100,this.screenBottomBoundary=e.height+100,this.gridRightBoundary=e.width+200,this.gridBottomBoundary=e.height+200,this.perspectiveRatioCutoff=.6}placeCollisionBox(e,t,n,r,i,a,o,s,c,l,u,d,f=0,p=!0){let m=e.anchorPointX+s[0],h=e.anchorPointY+s[1],g=this.projectAndGetPerspectiveRatio(m,h,i,maplibre_gl_Wo(l,m,h,f,p),d),_=n*g.perspectiveRatio,v;if(!a&&!o){let t=g.x+(u?u.x*_:0),n=g.y+(u?u.y*_:0);v={allPointsOccluded:!1,box:[t+e.x1*_,n+e.y1*_,t+e.x2*_,n+e.y2*_]}}else v=this._projectCollisionBox(e,_,r,i,a,o,s,g,l,u,d,f,p);let[y,b,x,S]=v.box,C=a?v.allPointsOccluded:g.isOccluded,w=C;return w||=g.perspectiveRatio<this.perspectiveRatioCutoff,w||=!this.isInsideGrid(y,b,x,S),w||t!==`always`&&this.grid.hitTest(y,b,x,S,t,c)?{box:[y,b,x,S],placeable:!1,offscreen:!1,occluded:C}:{box:[y,b,x,S],placeable:!0,offscreen:this.isOffscreen(y,b,x,S),occluded:C}}placeCollisionCircles(e,t,n,r,i,a,o,s,c,l,u,d,f,p){let m=[],h=new maplibre_gl_shared_l(t.anchorX,t.anchorY),g=this.getPerspectiveRatio(h.x,h.y,a,p?.(h.x,h.y)),_=(c?i*this.transform.getPitchedTextCorrection(t.anchorX,t.anchorY,a)/g:i*g)/24,v={projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},y=t.lineOffsetX*_,b=t.lineOffsetY*_,x={getElevation:p,pitchedLabelPlaneMatrix:o,lineVertexArray:n,pitchWithMap:c,projectionCache:v,transform:this.transform,tileAnchorPoint:h,unwrappedTileID:a,width:this.transform.width,height:this.transform.height,translation:f},S=maplibre_gl_as(_,r,y,b,!1,t,!1,x),C=!1,w=!1,T=!0;if(S){let t=u*.5*g+d,n=new maplibre_gl_shared_l(-100,-100),r=new maplibre_gl_shared_l(this.screenRightBoundary,this.screenBottomBoundary),i=new maplibre_gl_Uo,a=S.first,o=S.last,f=[];for(let e=a.path.length-1;e>=1;e--)f.push(a.path[e]);for(let e=1;e<o.path.length;e++)f.push(o.path[e]);let p=t*2.5;if(c){let e=this.projectPathToScreenSpace(f,x);f=e.some(e=>e.signedDistanceFromCamera<=0)?[]:e.map(e=>e.point)}let h=[];if(f.length>0){let e=f[0].clone(),t=f[0].clone();for(let n=1;n<f.length;n++)e.x=Math.min(e.x,f[n].x),e.y=Math.min(e.y,f[n].y),t.x=Math.max(t.x,f[n].x),t.y=Math.max(t.y,f[n].y);h=e.x>=n.x&&t.x<=r.x&&e.y>=n.y&&t.y<=r.y?[f]:t.x<n.x||e.x>r.x||t.y<n.y||e.y>r.y?[]:$v([f],n.x,n.y,r.x,r.y)}for(let n of h){i.reset(n,t*.25);let r=0;r=i.length<=.5*t?1:Math.ceil(i.paddedLength/p)+1;for(let n=0;n<r;n++){let a=n/Math.max(r-1,1),o=i.lerp(a),c=o.x+100,u=o.y+100;m.push(c,u,t,0);let d=c-t,f=u-t,p=c+t,h=u+t;if(T&&=this.isOffscreen(d,f,p,h),w||=this.isInsideGrid(d,f,p,h),e!==`always`&&this.grid.hitTestCircle(c,u,t,e,l)&&(C=!0,!s))return{circles:[],offscreen:!1,collisionDetected:C}}}}return{circles:!s&&C||!w||g<this.perspectiveRatioCutoff?[]:m,offscreen:T,collisionDetected:C}}projectPathToScreenSpace(e,t){return maplibre_gl_bs(maplibre_gl_ys(e,t))}queryRenderedSymbols(e){if(e.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};let t=[],n=new maplibre_gl_shared_xp;for(let r of e){let e=new maplibre_gl_shared_l(r.x+100,r.y+100);n.extend(e),t.push(e)}let{minX:r,minY:i,maxX:a,maxY:o}=n,s=this.grid.query(r,i,a,o).concat(this.ignoredGrid.query(r,i,a,o)),c={},l={};for(let e of s){let n=e.key;if(c[n.bucketInstanceId]===void 0&&(c[n.bucketInstanceId]={}),c[n.bucketInstanceId][n.featureIndex])continue;let r=[new maplibre_gl_shared_l(e.x1,e.y1),new maplibre_gl_shared_l(e.x2,e.y1),new maplibre_gl_shared_l(e.x2,e.y2),new maplibre_gl_shared_l(e.x1,e.y2)];maplibre_gl_shared_Wu(t,r)&&(c[n.bucketInstanceId][n.featureIndex]=!0,l[n.bucketInstanceId]===void 0&&(l[n.bucketInstanceId]=[]),l[n.bucketInstanceId].push(n.featureIndex))}return l}insertCollisionBox(e,t,n,r,i,a){let o=n?this.ignoredGrid:this.grid,s={bucketInstanceId:r,featureIndex:i,collisionGroupID:a,overlapMode:t};o.insert(s,e[0],e[1],e[2],e[3])}insertCollisionCircles(e,t,n,r,i,a){let o=n?this.ignoredGrid:this.grid,s={bucketInstanceId:r,featureIndex:i,collisionGroupID:a,overlapMode:t};for(let t=0;t<e.length;t+=4)o.insertCircle(s,e[t],e[t+1],e[t+2])}projectAndGetPerspectiveRatio(e,t,n,r,i){if(i){let n;r==null?(n=[e,t,0,1],maplibre_gl_vs(n,n,i)):(n=[e,t,r,1],maplibre_gl_shared_Ne(n,n,i));let a=n[3];return{x:(n[0]/a+1)/2*this.transform.width+100,y:(-n[1]/a+1)/2*this.transform.height+100,perspectiveRatio:.5+.5*(this.transform.cameraToCenterDistance/a),isOccluded:!1,signedDistanceFromCamera:a}}{let i=this.transform.projectTileCoordinates(e,t,n,r);return{x:(i.point.x+1)/2*this.transform.width+100,y:(-i.point.y+1)/2*this.transform.height+100,perspectiveRatio:.5+.5*(this.transform.cameraToCenterDistance/i.signedDistanceFromCamera),isOccluded:i.isOccluded,signedDistanceFromCamera:i.signedDistanceFromCamera}}}getPerspectiveRatio(e,t,n,r){let i=this.transform.projectTileCoordinates(e,t,n,r);return .5+.5*(this.transform.cameraToCenterDistance/i.signedDistanceFromCamera)}isOffscreen(e,t,n,r){return n<100||e>=this.screenRightBoundary||r<100||t>this.screenBottomBoundary}isInsideGrid(e,t,n,r){return n>=0&&e<this.gridRightBoundary&&r>=0&&t<this.gridBottomBoundary}getViewportMatrix(){let e=maplibre_gl_shared_C([]);return maplibre_gl_shared_E(e,e,[-100,-100,0]),e}_projectCollisionBox(e,t,n,r,i,a,o,s,c,l,u,d=0,f=!0){let p=1,m=0,h=0,g=1,_=e.anchorPointX+o[0],v=e.anchorPointY+o[1];if(a&&!i){let e=this.projectAndGetPerspectiveRatio(_+1,v,r,maplibre_gl_Wo(c,_+1,v,d,f),u),t=e.x-s.x,n=e.y-s.y,i=Math.atan(n/t)+(t<0?Math.PI:0),a=Math.sin(i),o=Math.cos(i);p=o,m=a,h=-a,g=o}else if(!a&&i){let e=maplibre_gl_$o(this.transform);p=e.vecEast[0],m=e.vecEast[1],h=e.vecSouth[0],g=e.vecSouth[1]}let y=s.x,b=s.y,x=t;if(i&&(y=_,b=v,x=2**-(this.transform.zoom-n.overscaledZ),x*=this.transform.getPitchedTextCorrection(_,v,r),!l)){let e=s.signedDistanceFromCamera/this.transform.cameraToCenterDistance,t=maplibre_gl_shared_yt(.5+.5*e,0,4);x*=t}l&&(y+=p*l.x*x+h*l.y*x,b+=m*l.x*x+g*l.y*x);let S=e.x1*x,C=e.x2*x,w=(S+C)/2,T=e.y1*x,E=e.y2*x,ee=(T+E)/2,D=[{offsetX:S,offsetY:T},{offsetX:w,offsetY:T},{offsetX:C,offsetY:T},{offsetX:C,offsetY:ee},{offsetX:C,offsetY:E},{offsetX:w,offsetY:E},{offsetX:S,offsetY:E},{offsetX:S,offsetY:ee}],O=[];for(let{offsetX:e,offsetY:t}of D)O.push(new maplibre_gl_shared_l(y+p*e+h*t,b+m*e+g*t));let te=!1;if(i){let e=O.map(e=>this.projectAndGetPerspectiveRatio(e.x,e.y,r,maplibre_gl_Wo(c,e.x,e.y,d,f),u));te=e.some(e=>!e.isOccluded),O=e.map(e=>new maplibre_gl_shared_l(e.x,e.y))}else te=!0;return{box:maplibre_gl_shared_mt(O),allPointsOccluded:!te}}},maplibre_gl_Ss=class{constructor(e,t,n,r){this.opacity=e?Math.max(0,Math.min(1,e.opacity+(e.placed?t:-t))):r&&n?1:0,this.placed=n}isHidden(){return this.opacity===0&&!this.placed}},maplibre_gl_Cs=class{constructor(e,t,n,r,i){this.text=new maplibre_gl_Ss(e?e.text:null,t,n,i),this.icon=new maplibre_gl_Ss(e?e.icon:null,t,r,i)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}},maplibre_gl_ws=class{constructor(e,t,n){this.text=e,this.icon=t,this.skipFade=n}},maplibre_gl_Ts=class{constructor(e,t,n,r,i){this.bucketInstanceId=e,this.featureIndex=t,this.sourceLayerIndex=n,this.bucketIndex=r,this.tileID=i}},maplibre_gl_Es=class{constructor(e){this.crossSourceCollisions=e,this.maxGroupID=0,this.collisionGroups={}}get(e){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[e]){let t=++this.maxGroupID;this.collisionGroups[e]={ID:t,predicate:e=>e.collisionGroupID===t}}return this.collisionGroups[e]}};function maplibre_gl_Ds(e,t,n,r,i){let{horizontalAlign:a,verticalAlign:o}=_v(e),s=-(a-.5)*t,c=-(o-.5)*n;return new maplibre_gl_shared_l(s+r[0]*i,c+r[1]*i)}var maplibre_gl_Os=class{constructor(e,t,n,r,i){this.transform=e.clone(),this.terrain=t,this.collisionIndex=new maplibre_gl_xs(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=n,this.retainedQueryData={},this.collisionGroups=new maplibre_gl_Es(r),this.collisionCircleArrays={},this.collisionBoxArrays=new Map,this.prevPlacement=i,i&&(i.prevPlacement=void 0),this.placedOrientations={}}_getTerrainElevationFunc(e){let t=this.terrain;if(t)return(n,r)=>t.getElevation(e,n,r)}getBucketParts(e,t,n,r){let a=n.getBucket(t),o=n.latestFeatureIndex;if(!a||!o||t.id!==a.layerIds[0])return;let s=n.collisionBoxArray,c=a.layers[0].layout,l=a.layers[0].paint,u=2**(this.transform.zoom-n.tileID.overscaledZ),d=n.tileSize/(/* inlined export .Rr */8192),f=n.tileID.toUnwrapped(),p=c.get(`text-rotation-alignment`)===`map`,m=maplibre_gl_shared_N(n,1,this.transform.zoom),h=maplibre_gl_shared_it(this.collisionIndex.transform,n,l.get(`text-translate`),l.get(`text-translate-anchor`)),g=maplibre_gl_shared_it(this.collisionIndex.transform,n,l.get(`icon-translate`),l.get(`icon-translate-anchor`)),_=maplibre_gl_Zo(p,this.transform,m);this.retainedQueryData[a.bucketInstanceId]=new maplibre_gl_Ts(a.bucketInstanceId,o,a.sourceLayerIndex,a.index,n.tileID);let v={bucket:a,layout:c,translationText:h,translationIcon:g,unwrappedTileID:f,pitchedLabelPlaneMatrix:_,scale:u,textPixelRatio:d,holdingForFade:n.holdingForSymbolFade(),collisionBoxArray:s,partiallyEvaluatedTextSize:Hv(a.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(a.sourceID)};if(r)for(let t of a.sortKeyRanges){let{sortKey:n,symbolInstanceStart:r,symbolInstanceEnd:i}=t;e.push({sortKey:n,symbolInstanceStart:r,symbolInstanceEnd:i,parameters:v})}else e.push({symbolInstanceStart:0,symbolInstanceEnd:a.symbolInstances.length,parameters:v})}attemptAnchorPlacement(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b,x){let C=by[e.textAnchor],w=[e.textOffset0,e.textOffset1],T=maplibre_gl_Ds(C,n,r,w,i),E=this.collisionIndex.placeCollisionBox(t,d,s,c,l,o,a,h,u.predicate,v,T,y,b,x);if((!_||this.collisionIndex.placeCollisionBox(_,d,s,c,l,o,a,g,u.predicate,v,T,y,b,x).placeable)&&E.placeable){let e;if(this.prevPlacement?.variableOffsets[f.crossTileID]&&this.prevPlacement?.placements[f.crossTileID]?.text&&(e=this.prevPlacement.variableOffsets[f.crossTileID].anchor),f.crossTileID===0)throw Error(`symbolInstance.crossTileID can't be 0`);return this.variableOffsets[f.crossTileID]={textOffset:w,width:n,height:r,anchor:C,textBoxScale:i,prevAnchor:e},this.markUsedJustification(p,C,f,m),p.allowVerticalPlacement&&(this.markUsedOrientation(p,m,f),this.placedOrientations[f.crossTileID]=m),{shift:T,placedGlyphBoxes:E}}}placeLayerBucketPart(e,t,n){let{bucket:r,layout:i,translationText:a,translationIcon:o,unwrappedTileID:s,pitchedLabelPlaneMatrix:c,textPixelRatio:l,holdingForFade:u,collisionBoxArray:d,partiallyEvaluatedTextSize:f,collisionGroup:p}=e.parameters,m=i.get(`text-optional`),h=i.get(`icon-optional`),g=My(i,`text-overlap`,`text-allow-overlap`),_=g===`always`,v=My(i,`icon-overlap`,`icon-allow-overlap`),y=v===`always`,b=i.get(`text-rotation-alignment`)===`map`,x=i.get(`text-pitch-alignment`)===`map`,C=i.get(`icon-text-fit`)!==`none`,w=i.get(`symbol-z-order`)===`viewport-y`,T=i.get(`symbol-height-anchor`)===`ground`,E=_&&(y||!r.hasIconData()||h),ee=y&&(_||!r.hasTextData()||m);!r.collisionArrays&&d&&r.deserializeCollisionBoxes(d);let D=this.retainedQueryData[r.bucketInstanceId].tileID,O=this._getTerrainElevationFunc(D),te=this.transform.getFastPathSimpleProjectionMatrix(D),k=(e,d,y)=>{if(t[e.crossTileID])return;if(u){this.placements[e.crossTileID]=new maplibre_gl_ws(!1,!1,!1);return}let w=e.heightOffset,k=!1,ne=!1,re=!0,ie=null,ae={box:null,placeable:!1,offscreen:null,occluded:!1},oe={box:null,placeable:!1,offscreen:null},se=null,ce=null,le=null,ue=0,de=0,fe=0;d.textFeatureIndex?ue=d.textFeatureIndex:e.useRuntimeCollisionCircles&&(ue=e.featureIndex),d.verticalTextFeatureIndex&&(de=d.verticalTextFeatureIndex);let pe=d.textBox;if(pe){let t=t=>{let n=1;if(r.allowVerticalPlacement&&!t&&this.prevPlacement){let t=this.prevPlacement.placedOrientations[e.crossTileID];t&&(this.placedOrientations[e.crossTileID]=t,n=t,this.markUsedOrientation(r,n,e))}return n},i=(t,n)=>{if(r.allowVerticalPlacement&&e.numVerticalGlyphVertices>0&&d.verticalTextBox){for(let e of r.writingModes)if(e===2?(ae=n(),oe=ae):ae=t(),ae?.placeable)break}else ae=t()},c=e.textAnchorOffsetStartIndex,u=e.textAnchorOffsetEndIndex;if(u===c){let n=(t,n)=>{let i=this.collisionIndex.placeCollisionBox(t,g,l,D,s,x,b,a,p.predicate,O,void 0,te,w,T);return i?.placeable&&(this.markUsedOrientation(r,n,e),this.placedOrientations[e.crossTileID]=n),i};i(()=>n(pe,1),()=>{let t=d.verticalTextBox;return r.allowVerticalPlacement&&e.numVerticalGlyphVertices>0&&t?n(t,2):{box:null,offscreen:null}}),t(ae?.placeable)}else{let f=by[this.prevPlacement?.variableOffsets[e.crossTileID]?.anchor],m=(t,i,d)=>{let m=t.x2-t.x1,h=t.y2-t.y1,_=e.textBoxScale,y=C&&v===`never`?i:null,S=null,E=g===`never`?1:2,ee=`never`;f&&E++;for(let n=0;n<E;n++){for(let n=c;n<u;n++){let i=r.textAnchorOffsets.get(n);if(f&&i.textAnchor!==f)continue;let c=this.attemptAnchorPlacement(i,t,m,h,_,b,x,l,D,s,p,ee,e,r,d,a,o,y,O,te,w,T);if(c&&(S=c.placedGlyphBoxes,S?.placeable))return k=!0,ie=c.shift,S}f?f=null:ee=g}return n&&!S&&(S={box:this.collisionIndex.placeCollisionBox(pe,`always`,l,D,s,x,b,a,p.predicate,O,void 0,te,w,T).box,offscreen:!1,placeable:!1,occluded:!1}),S};i(()=>m(pe,d.iconBox,1),()=>{let t=d.verticalTextBox,n=ae?.placeable;return r.allowVerticalPlacement&&!n&&e.numVerticalGlyphVertices>0&&t?m(t,d.verticalIconBox,2):{box:null,occluded:!0,offscreen:null}}),ae&&(k=ae.placeable,re=ae.offscreen);let h=t(ae?.placeable);if(!k&&this.prevPlacement){let t=this.prevPlacement.variableOffsets[e.crossTileID];t&&(this.variableOffsets[e.crossTileID]=t,this.markUsedJustification(r,t.anchor,e,h))}}}if(se=ae,k=se?.placeable,re=se?.offscreen,e.useRuntimeCollisionCircles&&e.centerJustifiedTextSymbolIndex>=0){let t=r.text.placedSymbolArray.get(e.centerJustifiedTextSymbolIndex),o=Vv(r.textSizeData,f,t),l=i.get(`text-padding`),u=e.collisionCircleDiameter;ce=this.collisionIndex.placeCollisionCircles(g,t,r.lineVertexArray,r.glyphOffsetArray,o,s,c,n,x,p.predicate,u,l,a,O),ce.circles.length&&ce.collisionDetected&&!n&&maplibre_gl_shared_Ft(`Collisions detected, but collision boxes are not shown`),k=_||ce.circles.length>0&&!ce.collisionDetected,re&&=ce.offscreen}if(d.iconFeatureIndex&&(fe=d.iconFeatureIndex),d.iconBox){let e=e=>this.collisionIndex.placeCollisionBox(e,v,l,D,s,x,b,o,p.predicate,O,C&&ie?ie:void 0,te,w,T);oe&&oe.placeable&&d.verticalIconBox?(le=e(d.verticalIconBox),ne=le.placeable):(le=e(d.iconBox),ne=le.placeable),re&&=le.offscreen}let me=m||e.numHorizontalGlyphVertices===0&&e.numVerticalGlyphVertices===0,he=h||e.numIconVertices===0;!me&&!he?ne=k=ne&&k:he?me||(ne&&=k):k=ne&&k;let ge=k&&se.placeable,A=ne&&le.placeable;if(ge&&(oe&&oe.placeable&&de?this.collisionIndex.insertCollisionBox(se.box,g,i.get(`text-ignore-placement`),r.bucketInstanceId,de,p.ID):this.collisionIndex.insertCollisionBox(se.box,g,i.get(`text-ignore-placement`),r.bucketInstanceId,ue,p.ID)),A&&this.collisionIndex.insertCollisionBox(le.box,v,i.get(`icon-ignore-placement`),r.bucketInstanceId,fe,p.ID),ce&&k&&this.collisionIndex.insertCollisionCircles(ce.circles,g,i.get(`text-ignore-placement`),r.bucketInstanceId,ue,p.ID),n&&this.storeCollisionData(r.bucketInstanceId,y,d,se,le,ce),e.crossTileID===0)throw Error(`symbolInstance.crossTileID can't be 0`);if(r.bucketInstanceId===0)throw Error(`bucket.bucketInstanceId can't be 0`);let _e=(k||E)&&!se?.occluded,ve=(ne||ee)&&!le?.occluded;this.placements[e.crossTileID]=new maplibre_gl_ws(_e,ve,re||r.justReloaded),t[e.crossTileID]=!0};if(w){if(e.symbolInstanceStart!==0)throw Error(`bucket.bucketInstanceId should be 0`);let t=r.getSortedSymbolIndexes(-this.transform.bearingInRadians);for(let e=t.length-1;e>=0;--e){let n=t[e];k(r.symbolInstances.get(n),r.collisionArrays[n],n)}}else for(let t=e.symbolInstanceStart;t<e.symbolInstanceEnd;t++)k(r.symbolInstances.get(t),r.collisionArrays[t],t);r.justReloaded=!1}storeCollisionData(e,t,n,r,i,a){if(n.textBox||n.iconBox){let a;this.collisionBoxArrays.has(e)?a=this.collisionBoxArrays.get(e):(a=new Map,this.collisionBoxArrays.set(e,a));let o;a.has(t)?o=a.get(t):(o={text:null,icon:null},a.set(t,o)),n.textBox&&(o.text=r.box),n.iconBox&&(o.icon=i.box)}if(a){let t=this.collisionCircleArrays[e];t===void 0&&(t=this.collisionCircleArrays[e]=[]);for(let e=0;e<a.circles.length;e+=4)t.push(a.circles[e+0]-100),t.push(a.circles[e+1]-100),t.push(a.circles[e+2]),t.push(+!!a.collisionDetected)}}markUsedJustification(e,t,n,r){let i={left:n.leftJustifiedTextSymbolIndex,center:n.centerJustifiedTextSymbolIndex,right:n.rightJustifiedTextSymbolIndex},a;a=r===2?n.verticalPlacedTextSymbolIndex:i[Ty(t)];let o=[n.leftJustifiedTextSymbolIndex,n.centerJustifiedTextSymbolIndex,n.rightJustifiedTextSymbolIndex,n.verticalPlacedTextSymbolIndex];for(let t of o)t>=0&&(a>=0&&t!==a?e.text.placedSymbolArray.get(t).crossTileID=0:e.text.placedSymbolArray.get(t).crossTileID=n.crossTileID)}markUsedOrientation(e,t,n){let r=t===1||t===3?t:0,i=t===2?t:0,a=[n.leftJustifiedTextSymbolIndex,n.centerJustifiedTextSymbolIndex,n.rightJustifiedTextSymbolIndex];for(let t of a)e.text.placedSymbolArray.get(t).placedOrientation=r;n.verticalPlacedTextSymbolIndex&&(e.text.placedSymbolArray.get(n.verticalPlacedTextSymbolIndex).placedOrientation=i)}commit(e){this.commitTime=e,this.zoomAtLastRecencyCheck=this.transform.zoom;let t=this.prevPlacement,n=!1;this.prevZoomAdjustment=t?t.zoomAdjustment(this.transform.zoom):0;let r=t?t.symbolFadeChange(e):1,i=t?t.opacities:{},a=t?t.variableOffsets:{},o=t?t.placedOrientations:{};for(let e in this.placements){let t=this.placements[e],a=i[e];a?(this.opacities[e]=new maplibre_gl_Cs(a,r,t.text,t.icon),n||=t.text!==a.text.placed,n||=t.icon!==a.icon.placed):(this.opacities[e]=new maplibre_gl_Cs(null,r,t.text,t.icon,t.skipFade),n||=t.text||t.icon)}for(let e in i){let t=i[e];if(!this.opacities[e]){let i=new maplibre_gl_Cs(t,r,!1,!1);i.isHidden()||(this.opacities[e]=i,n||=t.text.placed,n||=t.icon.placed)}}for(let e in a)!this.variableOffsets[e]&&this.opacities[e]&&!this.opacities[e].isHidden()&&(this.variableOffsets[e]=a[e]);for(let e in o)!this.placedOrientations[e]&&this.opacities[e]&&!this.opacities[e].isHidden()&&(this.placedOrientations[e]=o[e]);if(t&&t.lastPlacementChangeTime===void 0)throw Error(`Last placement time for previous placement is not defined`);n?this.lastPlacementChangeTime=e:typeof this.lastPlacementChangeTime!=`number`&&(this.lastPlacementChangeTime=t?t.lastPlacementChangeTime:e)}updateLayerOpacities(e,t){let n={};for(let r of t){let t=r.getBucket(e);t&&r.latestFeatureIndex&&e.id===t.layerIds[0]&&this.updateBucketOpacities(t,r.tileID,n,r.collisionBoxArray)}}updateBucketOpacities(e,t,n,r){e.hasTextData()&&(e.text.opacityVertexArray.clear(),e.text.hasVisibleVertices=!1),e.hasIconData()&&(e.icon.opacityVertexArray.clear(),e.icon.hasVisibleVertices=!1),e.hasIconCollisionBoxData()&&e.iconCollisionBox.collisionVertexArray.clear(),e.hasTextCollisionBoxData()&&e.textCollisionBox.collisionVertexArray.clear();let i=e.layers[0],a=i.layout,o=new maplibre_gl_Cs(null,0,!1,!1,!0),s=a.get(`text-allow-overlap`),c=a.get(`icon-allow-overlap`),l=i._unevaluatedLayout.hasValue(`text-variable-anchor`)||i._unevaluatedLayout.hasValue(`text-variable-anchor-offset`),u=a.get(`text-rotation-alignment`)===`map`,d=a.get(`text-pitch-alignment`)===`map`,f=a.get(`icon-text-fit`)!==`none`,p=new maplibre_gl_Cs(null,0,s&&(c||!e.hasIconData()||a.get(`icon-optional`)),c&&(s||!e.hasTextData()||a.get(`text-optional`)),!0);!e.collisionArrays&&r&&(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData())&&e.deserializeCollisionBoxes(r);let m=(e,t,n)=>{for(let r=0;r<t/4;r++)e.opacityVertexArray.emplaceBack(n);e.hasVisibleVertices||=n!==maplibre_gl_Fs},h=this.collisionBoxArrays.get(e.bucketInstanceId);for(let t=0;t<e.symbolInstances.length;t++){let r=e.symbolInstances.get(t),{numHorizontalGlyphVertices:i,numVerticalGlyphVertices:a,crossTileID:s}=r,c=n[s],g=this.opacities[s];c?g=o:g||(g=p,this.opacities[s]=g),n[s]=!0;let _=i>0||a>0,v=r.numIconVertices>0,y=this.placedOrientations[r.crossTileID],b=y===2,x=y===1||y===3;if(_){let t=maplibre_gl_Ps(g.text),n=b?maplibre_gl_Fs:t;m(e.text,i,n);let o=x?maplibre_gl_Fs:t;m(e.text,a,o);let s=g.text.isHidden(),c=[r.rightJustifiedTextSymbolIndex,r.centerJustifiedTextSymbolIndex,r.leftJustifiedTextSymbolIndex];for(let t of c)t>=0&&(e.text.placedSymbolArray.get(t).hidden=s||b?1:0);r.verticalPlacedTextSymbolIndex>=0&&(e.text.placedSymbolArray.get(r.verticalPlacedTextSymbolIndex).hidden=s||x?1:0);let l=this.variableOffsets[r.crossTileID];l&&this.markUsedJustification(e,l.anchor,r,y);let u=this.placedOrientations[r.crossTileID];u&&(this.markUsedJustification(e,`left`,r,u),this.markUsedOrientation(e,u,r))}if(v){let t=maplibre_gl_Ps(g.icon),n=!(f&&r.verticalPlacedIconSymbolIndex&&b);if(r.placedIconSymbolIndex>=0){let i=n?t:maplibre_gl_Fs;m(e.icon,r.numIconVertices,i),e.icon.placedSymbolArray.get(r.placedIconSymbolIndex).hidden=g.icon.isHidden()}if(r.verticalPlacedIconSymbolIndex>=0){let i=n?maplibre_gl_Fs:t;m(e.icon,r.numVerticalIconVertices,i),e.icon.placedSymbolArray.get(r.verticalPlacedIconSymbolIndex).hidden=g.icon.isHidden()}}let S=h?.has(t)?h.get(t):{text:null,icon:null};if(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData()){let n=e.collisionArrays[t];if(n){let t=new maplibre_gl_shared_l(0,0);if(n.textBox||n.verticalTextBox){let r=!0;if(l){let e=this.variableOffsets[s];e?(t=maplibre_gl_Ds(e.anchor,e.width,e.height,e.textOffset,e.textBoxScale),u&&t._rotate(d?-this.transform.bearingInRadians:this.transform.bearingInRadians)):r=!1}if(n.textBox||n.verticalTextBox){let i;n.textBox&&(i=b),n.verticalTextBox&&(i=x),maplibre_gl_ks(e.textCollisionBox.collisionVertexArray,g.text.placed,!r||i,S.text,t.x,t.y)}}if(n.iconBox||n.verticalIconBox){let r=!(x||!n.verticalIconBox),i;n.iconBox&&(i=r),n.verticalIconBox&&(i=!r),maplibre_gl_ks(e.iconCollisionBox.collisionVertexArray,g.icon.placed,i,S.icon,f?t.x:0,f?t.y:0)}}}}if(e.sortFeatures(-this.transform.bearingInRadians),this.retainedQueryData[e.bucketInstanceId]&&(this.retainedQueryData[e.bucketInstanceId].featureSortOrder=e.featureSortOrder),e.hasTextData()&&e.text.opacityVertexBuffer&&e.text.opacityVertexBuffer.updateData(e.text.opacityVertexArray),e.hasIconData()&&e.icon.opacityVertexBuffer&&e.icon.opacityVertexBuffer.updateData(e.icon.opacityVertexArray),e.hasIconCollisionBoxData()&&e.iconCollisionBox.collisionVertexBuffer&&e.iconCollisionBox.collisionVertexBuffer.updateData(e.iconCollisionBox.collisionVertexArray),e.hasTextCollisionBoxData()&&e.textCollisionBox.collisionVertexBuffer&&e.textCollisionBox.collisionVertexBuffer.updateData(e.textCollisionBox.collisionVertexArray),e.text.opacityVertexArray.length!==e.text.layoutVertexArray.length/4)throw Error(`bucket.text.opacityVertexArray.length (= ${e.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${e.text.layoutVertexArray.length}) / 4`);if(e.icon.opacityVertexArray.length!==e.icon.layoutVertexArray.length/4)throw Error(`bucket.icon.opacityVertexArray.length (= ${e.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${e.icon.layoutVertexArray.length}) / 4`);e.bucketInstanceId in this.collisionCircleArrays&&(e.collisionCircleArray=this.collisionCircleArrays[e.bucketInstanceId],delete this.collisionCircleArrays[e.bucketInstanceId])}symbolFadeChange(e){return this.fadeDuration===0?1:(e-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(e){return Math.max(0,(this.transform.zoom-e)/1.5)}hasTransitions(e){return this.stale||e-this.lastPlacementChangeTime<this.fadeDuration}stillRecent(e,t){let n=this.zoomAtLastRecencyCheck===t?1-this.zoomAdjustment(t):1;return this.zoomAtLastRecencyCheck=t,this.commitTime+this.fadeDuration*n>e}setStale(){this.stale=!0}};function maplibre_gl_ks(e,t,n,r,i,a){(!r||r.length===0)&&(r=[0,0,0,0]);let o=r[0]-100,s=r[1]-100,c=r[2]-100,l=r[3]-100;e.emplaceBack(+!!t,+!!n,i||0,a||0,o,s),e.emplaceBack(+!!t,+!!n,i||0,a||0,c,s),e.emplaceBack(+!!t,+!!n,i||0,a||0,c,l),e.emplaceBack(+!!t,+!!n,i||0,a||0,o,l)}const maplibre_gl_As=2**25,maplibre_gl_js=2**24,maplibre_gl_Ms=2**17,maplibre_gl_Ns=2**16;function maplibre_gl_Ps(e){if(e.opacity===0&&!e.placed)return 0;if(e.opacity===1&&e.placed)return 4294967295;let t=+!!e.placed,n=Math.floor(e.opacity*127);return n*maplibre_gl_As+t*maplibre_gl_js+n*maplibre_gl_Ms+t*maplibre_gl_Ns+n*512+t*256+n*2+t}const maplibre_gl_Fs=0;var maplibre_gl_Is=class{constructor(e){this._sortAcrossTiles=e.layout.get(`symbol-z-order`)!==`viewport-y`&&!e.layout.get(`symbol-sort-key`).isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(e,t,n,r,i){let a=this._bucketParts;for(;this._currentTileIndex<e.length;){let n=e[this._currentTileIndex];if(t.getBucketParts(a,r,n,this._sortAcrossTiles),this._currentTileIndex++,i())return!0}for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,a.sort((e,t)=>e.sortKey-t.sortKey));this._currentPartIndex<a.length;){let e=a[this._currentPartIndex];if(t.placeLayerBucketPart(e,this._seenCrossTileIDs,n),this._currentPartIndex++,i())return!0}return!1}},maplibre_gl_Ls=class{constructor(e,t,n,r,i,a,o,s){this.placement=new maplibre_gl_Os(e,t,a,o,s),this._currentPlacementIndex=n.length-1,this._forceFullPlacement=r,this._showCollisionBoxes=i,this._done=!1}isDone(){return this._done}continuePlacement(e,t,n){let r=maplibre_gl_U(),i=()=>!this._forceFullPlacement&&maplibre_gl_U()-r>2;for(;this._currentPlacementIndex>=0;){let r=t[e[this._currentPlacementIndex]],a=this.placement.collisionIndex.transform.zoom;if(qy(r)&&r.layout&&(!r.minzoom||r.minzoom<=a)&&(!r.maxzoom||r.maxzoom>a)){if(this._inProgressLayer||=new maplibre_gl_Is(r),this._inProgressLayer.continuePlacement(n[r.source],this.placement,this._showCollisionBoxes,r,i))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(e){return this.placement.commit(e),this.placement}};const maplibre_gl_Rs=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],maplibre_gl_J=new Uint32Array(96);var maplibre_gl_zs=class e{static from(t){if(!t||t.byteLength===void 0||t.buffer)throw Error(`Data must be an instance of ArrayBuffer or SharedArrayBuffer.`);let[n,r]=new Uint8Array(t,0,2);if(n!==219)throw Error(`Data does not appear to be in a KDBush format.`);let i=r>>4;if(i!==1)throw Error(`Got v${i} data when expected v1.`);let a=maplibre_gl_Rs[r&15];if(!a)throw Error(`Unrecognized array type.`);let[o]=new Uint16Array(t,2,1),[s]=new Uint32Array(t,4,1);return new e(s,o,a,void 0,t)}constructor(e,t=64,n=Float64Array,r=ArrayBuffer,i){if(isNaN(e)||e<0)throw Error(`Unexpected numItems value: ${e}.`);this.numItems=+e,this.nodeSize=Math.min(Math.max(+t,2),65535),this.ArrayType=n,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;let a=maplibre_gl_Rs.indexOf(this.ArrayType),o=e*2*this.ArrayType.BYTES_PER_ELEMENT,s=e*this.IndexArrayType.BYTES_PER_ELEMENT,c=(8-s%8)%8;if(a<0)throw Error(`Unexpected typed array class: ${n}.`);if(i)this.data=i,this.ids=new this.IndexArrayType(i,8,e),this.coords=new n(i,8+s+c,e*2),this._pos=e*2,this._finished=!0;else{let i=this.data=new r(8+o+s+c);this.ids=new this.IndexArrayType(i,8,e),this.coords=new n(i,8+s+c,e*2),this._pos=0,this._finished=!1,new Uint8Array(i,0,2).set([219,16+a]),new Uint16Array(i,2,1)[0]=t,new Uint32Array(i,4,1)[0]=e}}add(e,t){let n=this._pos>>1;return this.ids[n]=n,this.coords[this._pos++]=e,this.coords[this._pos++]=t,n}finish(){let e=this._pos>>1;if(e!==this.numItems)throw Error(`Added ${e} items when expected ${this.numItems}.`);return maplibre_gl_Bs(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(e,t,n,r){if(!this._finished)throw Error(`Data not yet indexed - call index.finish().`);let{ids:i,coords:a,nodeSize:o}=this;maplibre_gl_J[0]=0,maplibre_gl_J[1]=i.length-1,maplibre_gl_J[2]=0;let s=3,c=[];for(;s>0;){let l=maplibre_gl_J[--s],u=maplibre_gl_J[--s],d=maplibre_gl_J[--s];if(u-d<=o){for(let o=d;o<=u;o++){let s=a[2*o],l=a[2*o+1];s>=e&&s<=n&&l>=t&&l<=r&&c.push(i[o])}continue}let f=d+u>>1,p=a[2*f],m=a[2*f+1];p>=e&&p<=n&&m>=t&&m<=r&&c.push(i[f]),(l===0?e<=p:t<=m)&&(maplibre_gl_J[s++]=d,maplibre_gl_J[s++]=f-1,maplibre_gl_J[s++]=1-l),(l===0?n>=p:r>=m)&&(maplibre_gl_J[s++]=f+1,maplibre_gl_J[s++]=u,maplibre_gl_J[s++]=1-l)}return c}within(e,t,n){let r=[];return this.withinInto(e,t,n,r),r}withinInto(e,t,n,r){if(!this._finished)throw Error(`Data not yet indexed - call index.finish().`);let{ids:i,coords:a,nodeSize:o}=this;maplibre_gl_J[0]=0,maplibre_gl_J[1]=i.length-1,maplibre_gl_J[2]=0;let s=3,c=0,l=n*n;for(;s>0;){let u=maplibre_gl_J[--s],d=maplibre_gl_J[--s],f=maplibre_gl_J[--s];if(d-f<=o){for(let n=f;n<=d;n++)maplibre_gl_Ws(a[2*n],a[2*n+1],e,t)<=l&&(r[c++]=i[n]);continue}let p=f+d>>1,m=a[2*p],h=a[2*p+1];maplibre_gl_Ws(m,h,e,t)<=l&&(r[c++]=i[p]),(u===0?e-n<=m:t-n<=h)&&(maplibre_gl_J[s++]=f,maplibre_gl_J[s++]=p-1,maplibre_gl_J[s++]=1-u),(u===0?e+n>=m:t+n>=h)&&(maplibre_gl_J[s++]=p+1,maplibre_gl_J[s++]=d,maplibre_gl_J[s++]=1-u)}return c}};function maplibre_gl_Bs(e,t,n,r,i,a){if(i-r<=n)return;let o=r+i>>1;maplibre_gl_Vs(e,t,o,r,i,a),maplibre_gl_Bs(e,t,n,r,o-1,1-a),maplibre_gl_Bs(e,t,n,o+1,i,1-a)}function maplibre_gl_Vs(e,t,n,r,i,a){for(;i>r;){if(i-r>600){let o=i-r+1,s=n-r+1,c=Math.log(o),l=.5*Math.exp(2*c/3),u=.5*Math.sqrt(c*l*(o-l)/o)*(s-o/2<0?-1:1);maplibre_gl_Vs(e,t,n,Math.max(r,Math.floor(n-s*l/o+u)),Math.min(i,Math.floor(n+(o-s)*l/o+u)),a)}let o=t[2*n+a],s=r,c=i;for(maplibre_gl_Hs(e,t,r,n),t[2*i+a]>o&&maplibre_gl_Hs(e,t,r,i);s<c;){for(maplibre_gl_Hs(e,t,s,c),s++,c--;t[2*s+a]<o;)s++;for(;t[2*c+a]>o;)c--}t[2*r+a]===o?maplibre_gl_Hs(e,t,r,c):(c++,maplibre_gl_Hs(e,t,c,i)),c<=n&&(r=c+1),n<=c&&(i=c-1)}}function maplibre_gl_Hs(e,t,n,r){maplibre_gl_Us(e,n,r),maplibre_gl_Us(t,2*n,2*r),maplibre_gl_Us(t,2*n+1,2*r+1)}function maplibre_gl_Us(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}function maplibre_gl_Ws(e,t,n,r){let i=e-n,a=t-r;return i*i+a*a}const maplibre_gl_Gs=512/(/* inlined export .Rr */8192)/2;var maplibre_gl_Ks=class{constructor(e,t,n){this.tileID=e,this.bucketInstanceId=n,this._symbolsByKey={};let r=new Map;for(let e=0;e<t.length;e++){let n=t.get(e),i=n.key,a=r.get(i);a?a.push(n):r.set(i,[n])}for(let[e,t]of r){let n={positions:t.map(e=>({x:Math.floor(e.anchorX*maplibre_gl_Gs),y:Math.floor(e.anchorY*maplibre_gl_Gs)})),crossTileIDs:t.map(e=>e.crossTileID)};if(n.positions.length>128){let e=new maplibre_gl_zs(n.positions.length,16,Uint16Array);for(let{x:t,y:r}of n.positions)e.add(t,r);e.finish(),delete n.positions,n.index=e}this._symbolsByKey[e]=n}}getScaledCoordinates(e,t){let{x:n,y:r,z:i}=this.tileID.canonical,{x:a,y:o,z:s}=t.canonical,c=s-i,l=maplibre_gl_Gs/2**c,u=(a*(/* inlined export .Rr */8192)+e.anchorX)*l,d=(o*(/* inlined export .Rr */8192)+e.anchorY)*l,f=n*(/* inlined export .Rr */8192)*maplibre_gl_Gs,p=r*(/* inlined export .Rr */8192)*maplibre_gl_Gs;return{x:Math.floor(u-f),y:Math.floor(d-p)}}findMatches(e,t,n){let r=this.tileID.canonical.z<t.canonical.z?1:2**(this.tileID.canonical.z-t.canonical.z);for(let i=0;i<e.length;i++){let a=e.get(i);if(a.crossTileID)continue;let o=this._symbolsByKey[a.key];if(!o)continue;let s=this.getScaledCoordinates(a,t);o.index?this.findMatchesForIndexedEntry(o,a,s,r,n):o.positions&&this.findMatchesForNonIndexedEntry(o,a,s,r,n)}}findMatchesForIndexedEntry(e,t,n,r,i){let a=e.index.range(n.x-r,n.y-r,n.x+r,n.y+r),o=1/0;for(let t of a)t<o&&!i[e.crossTileIDs[t]]&&(o=t);if(o!==1/0){let n=e.crossTileIDs[o];i[n]=!0,t.crossTileID=n}}findMatchesForNonIndexedEntry(e,t,n,r,i){for(let a=0;a<e.positions.length;a++){let o=e.positions[a],s=e.crossTileIDs[a];if(Math.abs(o.x-n.x)<=r&&Math.abs(o.y-n.y)<=r&&!i[s]){i[s]=!0,t.crossTileID=s;break}}}getCrossTileIDsLists(){return Object.values(this._symbolsByKey).map(({crossTileIDs:e})=>e)}},maplibre_gl_qs=class{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}},maplibre_gl_Js=class{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(e){let t=Math.round((e-this.lng)/360);if(t!==0)for(let e in this.indexes){let n=this.indexes[e],r={};for(let e in n){let i=n[e];i.tileID=i.tileID.unwrapTo(i.tileID.wrap+t),r[i.tileID.key]=i}this.indexes[e]=r}this.lng=e}addBucket(e,t,n){if(this.indexes[e.overscaledZ]?.[e.key]){if(this.indexes[e.overscaledZ][e.key].bucketInstanceId===t.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(e.overscaledZ,this.indexes[e.overscaledZ][e.key])}for(let e=0;e<t.symbolInstances.length;e++){let n=t.symbolInstances.get(e);n.crossTileID=0}this.usedCrossTileIDs[e.overscaledZ]||={};let r=this.usedCrossTileIDs[e.overscaledZ];for(let n in this.indexes){let i=this.indexes[n];if(Number(n)>e.overscaledZ)for(let n in i){let a=i[n];a.tileID.isChildOf(e)&&a.findMatches(t.symbolInstances,e,r)}else{let a=i[e.scaledTo(Number(n)).key];a&&a.findMatches(t.symbolInstances,e,r)}}for(let e=0;e<t.symbolInstances.length;e++){let i=t.symbolInstances.get(e);i.crossTileID||(i.crossTileID=n.generate(),r[i.crossTileID]=!0)}return this.indexes[e.overscaledZ]===void 0&&(this.indexes[e.overscaledZ]={}),this.indexes[e.overscaledZ][e.key]=new maplibre_gl_Ks(e,t.symbolInstances,t.bucketInstanceId),!0}removeBucketCrossTileIDs(e,t){for(let n of t.getCrossTileIDsLists())for(let t of n)delete this.usedCrossTileIDs[e][t]}removeStaleBuckets(e){let t=!1;for(let n in this.indexes){let r=this.indexes[n];for(let i in r)e[r[i].bucketInstanceId]||(this.removeBucketCrossTileIDs(n,r[i]),delete r[i],t=!0)}return t}},maplibre_gl_Ys=class{constructor(){this.layerIndexes={},this.crossTileIDs=new maplibre_gl_qs,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(e,t,n){let r=this.layerIndexes[e.id];r===void 0&&(r=this.layerIndexes[e.id]=new maplibre_gl_Js);let i=!1,a={};r.handleWrapJump(n);for(let n of t){let t=n.getBucket(e);e.id===t?.layerIds[0]&&(t.bucketInstanceId||=(this.maxBucketInstanceId+=1,this.maxBucketInstanceId),r.addBucket(n.tileID,t,this.crossTileIDs)&&(i=!0),a[t.bucketInstanceId]=!0)}return r.removeStaleBuckets(a)&&(i=!0),i}pruneUnusedLayers(e){let t={};for(let n of e)t[n]=!0;for(let e in this.layerIndexes)t[e]||delete this.layerIndexes[e]}},maplibre_gl_Xs=`#ifdef GL_ES
11400
11403
  precision mediump float;
11401
11404
  #else
11402
11405
  #if !defined(lowp)
@@ -12209,7 +12212,7 @@ uniform ${n} ${r} u_${i};
12209
12212
  #endif
12210
12213
  `}),{fragmentSource:e,vertexSource:t,staticAttributes:r,staticUniforms:o}}const maplibre_gl_oc=`#define PROJECTION_MERCATOR`,maplibre_gl_sc=`mercator`;var maplibre_gl_cc=class{constructor(){this._cachedMesh=null}get name(){return`mercator`}get useSubdivision(){return!1}get shaderVariantName(){return maplibre_gl_sc}get shaderDefine(){return maplibre_gl_oc}get shaderPreludeCode(){return maplibre_gl_ac.projectionMercator}get vertexShaderPreludeCode(){return maplibre_gl_ac.projectionMercator.vertexSource}get subdivisionGranularity(){return Zf.noSubdivision}get useGlobeControls(){return!1}get transitionState(){return 0}destroy(){}getMeshFromTileID(e,t,n,r,i){if(this._cachedMesh)return this._cachedMesh;let a=new maplibre_gl_shared_Pl;a.emplaceBack(0,0),a.emplaceBack((/* inlined export .Rr */8192),0),a.emplaceBack(0,(/* inlined export .Rr */8192)),a.emplaceBack((/* inlined export .Rr */8192),(/* inlined export .Rr */8192));let o=e.createVertexBuffer(a,maplibre_gl_Ka.members),s=maplibre_gl_shared_nu.simpleSegment(0,0,4,2),c=new maplibre_gl_shared_Zl;c.emplaceBack(1,0,2),c.emplaceBack(1,2,3);let l=e.createIndexBuffer(c);return this._cachedMesh=new maplibre_gl_Ga(o,l,s),this._cachedMesh}recalculate(){}hasTransition(){return!1}},maplibre_gl_lc=class e{constructor(e=0,t=0,n=0,r=0){if(isNaN(e)||e<0||isNaN(t)||t<0||isNaN(n)||n<0||isNaN(r)||r<0)throw Error(`Invalid value for edge-insets, top, bottom, left and right must all be numbers`);this.top=e,this.bottom=t,this.left=n,this.right=r}interpolate(e,t,n){return t.top!=null&&e.top!=null&&(this.top=maplibre_gl_shared_$r.number(e.top,t.top,n)),t.bottom!=null&&e.bottom!=null&&(this.bottom=maplibre_gl_shared_$r.number(e.bottom,t.bottom,n)),t.left!=null&&e.left!=null&&(this.left=maplibre_gl_shared_$r.number(e.left,t.left,n)),t.right!=null&&e.right!=null&&(this.right=maplibre_gl_shared_$r.number(e.right,t.right,n)),this}getCenter(e,t){let n=maplibre_gl_shared_yt((this.left+e-this.right)/2,0,e),r=maplibre_gl_shared_yt((this.top+t-this.bottom)/2,0,t);return new maplibre_gl_shared_l(n,r)}equals(e){return this.top===e.top&&this.bottom===e.bottom&&this.left===e.left&&this.right===e.right}clone(){return new e(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}};function maplibre_gl_uc(e,t){if(!e.renderWorldCopies||e.lngRange)return;let n=t.lng-e.center.lng;t.lng+=n>180?-360:n<-180?360:0}function maplibre_gl_dc(e){return Math.max(0,Math.floor(e))}var maplibre_gl_fc=class{constructor(e,t){this.applyConstrain=(e,t)=>this._constrainOverride===null?this._callbacks.defaultConstrain(e,t):this._constrainOverride(e,t),this._callbacks=e,this._tileSize=512,this._renderWorldCopies=t?.renderWorldCopies===void 0||!!t?.renderWorldCopies,this._minZoom=t?.minZoom||0,this._maxZoom=t?.maxZoom||22,this._minPitch=t?.minPitch===void 0||t?.minPitch===null?0:t?.minPitch,this._maxPitch=t?.maxPitch===void 0||t?.maxPitch===null?60:t?.maxPitch,this._constrainOverride=t?.constrainOverride??null,this.setMaxBounds(),this._width=0,this._height=0,this._center=new maplibre_gl_shared_Mp(0,0),this._elevation=0,this._zoom=0,this._tileZoom=maplibre_gl_dc(this._zoom),this._scale=maplibre_gl_shared_Dt(this._zoom),this._bearingInRadians=0,this._fovInRadians=.6435011087932844,this._pitchInRadians=0,this._rollInRadians=0,this._unmodified=!0,this._edgeInsets=new maplibre_gl_lc,this._minElevationForCurrentTile=0,this._autoCalculateNearFarZ=!0}apply(e,t,n){this._constrainOverride=e.constrainOverride,this._latRange=e.latRange,this._lngRange=e.lngRange,this._width=e.width,this._height=e.height,this._center=e.center,this._elevation=e.elevation,this._minElevationForCurrentTile=e.minElevationForCurrentTile,this._zoom=e.zoom,this._tileZoom=maplibre_gl_dc(this._zoom),this._scale=maplibre_gl_shared_Dt(this._zoom),this._bearingInRadians=e.bearingInRadians,this._fovInRadians=e.fovInRadians,this._pitchInRadians=e.pitchInRadians,this._rollInRadians=e.rollInRadians,this._unmodified=e.unmodified,this._edgeInsets=new maplibre_gl_lc(e.padding.top,e.padding.bottom,e.padding.left,e.padding.right),this._minZoom=e.minZoom,this._maxZoom=e.maxZoom,this._minPitch=e.minPitch,this._maxPitch=e.maxPitch,this._renderWorldCopies=e.renderWorldCopies,this._cameraToCenterDistance=e.cameraToCenterDistance,this._nearZ=e.nearZ,this._farZ=e.farZ,this._autoCalculateNearFarZ=!n&&e.autoCalculateNearFarZ,t&&this.constrainInternal(),this._calcMatrices()}get pixelsToClipSpaceMatrix(){return this._pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._clipSpaceToPixelsMatrix}get minElevationForCurrentTile(){return this._minElevationForCurrentTile}setMinElevationForCurrentTile(e){this._minElevationForCurrentTile=e}get tileSize(){return this._tileSize}get tileZoom(){return this._tileZoom}get scale(){return this._scale}get width(){return this._width}get height(){return this._height}get bearingInRadians(){return this._bearingInRadians}get lngRange(){return this._lngRange}get latRange(){return this._latRange}get pixelsToGLUnits(){return this._pixelsToGLUnits}get minZoom(){return this._minZoom}setMinZoom(e){if(this._minZoom===e)return;this._minZoom=e;let t=this._unmodified;this.setZoom(this.applyConstrain(this._center,this.zoom).zoom),this._unmodified=t}get maxZoom(){return this._maxZoom}setMaxZoom(e){if(this._maxZoom===e)return;this._maxZoom=e;let t=this._unmodified;this.setZoom(this.applyConstrain(this._center,this.zoom).zoom),this._unmodified=t}get minPitch(){return this._minPitch}setMinPitch(e){if(this._minPitch===e)return;this._minPitch=e;let t=this._unmodified;this.setPitch(Math.max(this.pitch,e)),this._unmodified=t}get maxPitch(){return this._maxPitch}setMaxPitch(e){if(this._maxPitch===e)return;this._maxPitch=e;let t=this._unmodified;this.setPitch(Math.min(this.pitch,e)),this._unmodified=t}get renderWorldCopies(){return this._renderWorldCopies}setRenderWorldCopies(e){e===void 0?e=!0:e===null&&(e=!1),this._renderWorldCopies=e}get constrainOverride(){return this._constrainOverride}setConstrainOverride(e){e===void 0&&(e=null),this._constrainOverride!==e&&(this._constrainOverride=e,this.constrainInternal(),this._calcMatrices())}get worldSize(){return this._tileSize*this._scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new maplibre_gl_shared_l(this._width,this._height)}get bearing(){return this._bearingInRadians/Math.PI*180}setBearing(e){let t=maplibre_gl_shared_bt(e,-180,180)*Math.PI/180;this._bearingInRadians!==t&&(this._unmodified=!1,this._bearingInRadians=t,this._calcMatrices(),this._rotationMatrix=maplibre_gl_Nr(),maplibre_gl_Ir(this._rotationMatrix,this._rotationMatrix,-this._bearingInRadians))}get rotationMatrix(){return this._rotationMatrix}get pitchInRadians(){return this._pitchInRadians}get pitch(){return this._pitchInRadians/Math.PI*180}setPitch(e){let t=maplibre_gl_shared_yt(e,this.minPitch,this.maxPitch)/180*Math.PI;this._pitchInRadians!==t&&(this._unmodified=!1,this._pitchInRadians=t,this._calcMatrices())}get rollInRadians(){return this._rollInRadians}get roll(){return this._rollInRadians/Math.PI*180}setRoll(e){let t=e/180*Math.PI;this._rollInRadians!==t&&(this._unmodified=!1,this._rollInRadians=t,this._calcMatrices())}get fovInRadians(){return this._fovInRadians}get fov(){return maplibre_gl_shared_en(this._fovInRadians)}setFov(e){e=maplibre_gl_shared_yt(e,.1,150),this.fov!==e&&(this._unmodified=!1,this._fovInRadians=maplibre_gl_shared_$t(e),this._calcMatrices())}get zoom(){return this._zoom}setZoom(e){let t=this.applyConstrain(this._center,e).zoom;this._zoom!==t&&(this._unmodified=!1,this._zoom=t,this._tileZoom=Math.max(0,Math.floor(t)),this._scale=maplibre_gl_shared_Dt(t),this.constrainInternal(),this._calcMatrices())}get center(){return this._center}setCenter(e){(e.lat!==this._center.lat||e.lng!==this._center.lng)&&(this._unmodified=!1,this._center=e,this.constrainInternal(),this._calcMatrices())}get elevation(){return this._elevation}setElevation(e){e!==this._elevation&&(this._elevation=e,this.constrainInternal(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}setPadding(e){this._edgeInsets.equals(e)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,e,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this._width,this._height)}get pixelsPerMeter(){return this._pixelPerMeter}get unmodified(){return this._unmodified}get cameraToCenterDistance(){return this._cameraToCenterDistance}get nearZ(){return this._nearZ}get farZ(){return this._farZ}get autoCalculateNearFarZ(){return this._autoCalculateNearFarZ}overrideNearFarZ(e,t){this._autoCalculateNearFarZ=!1,this._nearZ=e,this._farZ=t,this._calcMatrices()}clearNearFarZOverride(){this._autoCalculateNearFarZ=!0,this._calcMatrices()}isPaddingEqual(e){return this._edgeInsets.equals(e)}interpolatePadding(e,t,n){this._unmodified=!1,this._edgeInsets.interpolate(e,t,n),this.constrainInternal(),this._calcMatrices()}resize(e,t,n=!0){this._width=e,this._height=t,n&&this.constrainInternal(),this._calcMatrices()}getMaxBounds(){return this._latRange?.length!==2||this._lngRange?.length!==2?null:new maplibre_gl_ya([this._lngRange[0],this._latRange[0]],[this._lngRange[1],this._latRange[1]])}setMaxBounds(e){e?(this._lngRange=[e.getWest(),e.getEast()],this._latRange=[e.getSouth(),e.getNorth()],this.constrainInternal()):(this._lngRange=null,this._latRange=[-maplibre_gl_shared_on,maplibre_gl_shared_on])}getCameraQueryGeometry(e,t){if(t.length===1)return[t[0],e];{let{minX:n,minY:r,maxX:i,maxY:a}=maplibre_gl_shared_xp.fromPoints(t).extend(e);return[new maplibre_gl_shared_l(n,r),new maplibre_gl_shared_l(i,r),new maplibre_gl_shared_l(i,a),new maplibre_gl_shared_l(n,a),new maplibre_gl_shared_l(n,r)]}}constrainInternal(){if(!this.center||!this._width||!this._height||this._constraining)return;this._constraining=!0;let e=this._unmodified,{center:t,zoom:n}=this.applyConstrain(this.center,this.zoom);this.setCenter(t),this.setZoom(n),this._unmodified=e,this._constraining=!1}_calcMatrices(){if(this._pixelPerMeter=maplibre_gl_shared_Lp(1,this.center.lat)*this.worldSize,!this._width||!this._height)return;this._pixelsToGLUnits=[2/this._width,-2/this._height];let e=maplibre_gl_shared_C(new Float64Array(16));maplibre_gl_shared_D(e,e,[this._width/2,-this._height/2,1]),maplibre_gl_shared_E(e,e,[1,-1,0]),this._clipSpaceToPixelsMatrix=e,e=maplibre_gl_shared_C(new Float64Array(16)),maplibre_gl_shared_D(e,e,[1,-1,1]),maplibre_gl_shared_E(e,e,[-1,-1,0]),maplibre_gl_shared_D(e,e,[2/this._width,2/this._height,1]),this._pixelsToClipSpaceMatrix=e;let t=this.fovInRadians/2;this._cameraToCenterDistance=.5/Math.tan(t)*this._height,this._callbacks.calcMatrices()}calculateCenterFromCameraLngLatAlt(e,t,n,r){let i=n===void 0?this.bearing:n,a=r=r===void 0?this.pitch:r,{distanceToCenter:o,clampedElevation:s}=this._distanceToCenterFromAltElevationPitch(t,this.elevation,a),{x:c,y:l}=maplibre_gl_shared_Qp(a,i),u=maplibre_gl_shared_Hp.fromLngLat(e,t),d=maplibre_gl_shared_Bp(1,u.y),f,p,m=0;do{if(m+=1,m>10)break;p=o/d;let e=c*p,t=l*p;f=new maplibre_gl_shared_Hp(u.x+e,u.y+t),d=1/f.meterInMercatorCoordinateUnits()}while(Math.abs(o-p*d)>1e-12);return{center:f.toLngLat(),elevation:s,zoom:maplibre_gl_shared_Ot(this.height/2/Math.tan(this.fovInRadians/2)/p/this.tileSize)}}recalculateZoomAndCenter(e){if(this.elevation-e===0)return;let t=1/this.worldSize,n=maplibre_gl_shared_Lp(1,this.center.lat)*this.worldSize,r=maplibre_gl_shared_Hp.fromLngLat(this.center,this.elevation),i=r.x/t,a=r.y/t,o=r.z/t,s=this.pitch,c=this.bearing,{x:l,y:u,z:d}=maplibre_gl_shared_Qp(s,c),f=this.cameraToCenterDistance,p=i+f*-l,m=a+f*-u,h=o+f*d,{distanceToCenter:g,clampedElevation:_}=this._distanceToCenterFromAltElevationPitch(h/n,e,s),v=g*n,y=p+l*v,b=m+u*v,x=new maplibre_gl_shared_Hp(y*t,b*t,0).toLngLat(),S=maplibre_gl_shared_Lp(1,x.lat),C=maplibre_gl_shared_Ot(this.height/2/Math.tan(this.fovInRadians/2)/g/S/this.tileSize);this._elevation=_,this._center=x,this.setZoom(C)}_distanceToCenterFromAltElevationPitch(e,t,n){let r=-Math.cos(maplibre_gl_shared_$t(n)),i=e-t,a,o=t;return r*i>=0||Math.abs(r)<.1?(a=1e4,o=e+a*r):a=-i/r,{distanceToCenter:a,clampedElevation:o}}getCameraPoint(){let e=this.pitchInRadians,t=Math.tan(e)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new maplibre_gl_shared_l(t*Math.sin(this.rollInRadians),t*Math.cos(this.rollInRadians)))}getMercatorTileCoordinates(e){if(!e)return[0,0,1,1];let t=e.canonical.z>=0?1<<e.canonical.z:2**e.canonical.z;return[e.canonical.x/t,e.canonical.y/t,1/t/(/* inlined export .Rr */8192),1/t/(/* inlined export .Rr */8192)]}},maplibre_gl_pc=class{distanceToTile2d(e,t,n,r){let i=r,a=i.distanceX([e,t]),o=i.distanceY([e,t]);return Math.hypot(a,o)}getWrap(e,t,n){return n}getTileBoundingVolume(e,t,n,r){let i=Math.min(0,n),a=Math.max(0,n);if(r?.terrain){let n=new maplibre_gl_shared_fb(e.z,t,e.z,e.x,e.y),o=r.terrain.getMinMaxElevation(n);i=o.minElevation??i,a=o.maxElevation??a}let o=1<<e.z;return new maplibre_gl_vo([t+e.x/o,e.y/o,i],[t+(e.x+1)/o,(e.y+1)/o,a])}allowVariableZoom(e,t){let n=e.fov*(Math.abs(Math.cos(e.rollInRadians))*e.height+Math.abs(Math.sin(e.rollInRadians))*e.width)/e.height,r=maplibre_gl_shared_yt(78.5-n/2,0,60);return!!t.terrain||e.pitch>r}allowWorldCopies(){return!0}prepareNextFrame(){}};const maplibre_gl_mc=maplibre_gl_shared_Yc([{name:`a_pos3d`,type:`Int16`,components:3}]);var maplibre_gl_hc=class extends maplibre_gl_shared_Fn{constructor(e){super(),this._lastTilesetChange=maplibre_gl_U(),this.tileManager=e,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.deltaZoom=1,this.tileSize=e._source.tileSize*2**this.deltaZoom,e.usedForTerrain=!0,e.tileSize=this.tileSize}destruct(){this.tileManager.usedForTerrain=!1,this.tileManager.tileSize=null,this.releaseAllRTT()}getSource(){return this.tileManager._source}update(e,t){this.tileManager.update(e,t),this._renderableTilesKeys=[];let n={},r=!1;for(let i of maplibre_gl_jo(e,{tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:t,calculateTileZoom:this.tileManager._source.calculateTileZoom}))n[i.key]=!0,this._renderableTilesKeys.push(i.key),this._tiles[i.key]||(i.terrainRttPosMatrix32f=new Float32Array(16),maplibre_gl_shared_ie(i.terrainRttPosMatrix32f,0,(/* inlined export .Rr */8192),(/* inlined export .Rr */8192),0,0,1),this._tiles[i.key]=new maplibre_gl_ho(i,this.tileSize),this._lastTilesetChange=maplibre_gl_U(),r=!0);for(let e in this._tiles)n[e]||(this._tiles[e].releaseRTT(this.tileManager.map.painter),delete this._tiles[e],r=!0);return r}releaseRTT(e){for(let t in this._tiles){let n=this._tiles[t];(n.tileID.equals(e)||n.tileID.isChildOf(e)||e.isChildOf(n.tileID))&&n.releaseRTT(this.tileManager.map.painter)}}releaseAllRTT(){for(let e in this._tiles)this._tiles[e].releaseRTT(this.tileManager.map.painter)}getRenderableTiles(){return this._renderableTilesKeys.map(e=>this.getTileByID(e))}getTileByID(e){return this._tiles[e]}getTerrainCoords(e,t){return t?this._getTerrainCoordsForTileRanges(e,t):this._getTerrainCoordsForRegularTile(e)}_getTerrainCoordsForRegularTile(e){let t={};for(let n of this._renderableTilesKeys){let r=this._tiles[n].tileID,i=e.clone(),a=maplibre_gl_shared_tt();if(r.canonical.equals(e.canonical))maplibre_gl_shared_ie(a,0,(/* inlined export .Rr */8192),(/* inlined export .Rr */8192),0,0,1);else if(r.canonical.isChildOf(e.canonical)){let t=r.canonical.z-e.canonical.z,n=r.canonical.x-(r.canonical.x>>t<<t),i=r.canonical.y-(r.canonical.y>>t<<t),o=(/* inlined export .Rr */8192)>>t;maplibre_gl_shared_ie(a,0,o,o,0,0,1),maplibre_gl_shared_E(a,a,[-n*o,-i*o,0])}else if(e.canonical.isChildOf(r.canonical)){let t=e.canonical.z-r.canonical.z,n=e.canonical.x-(e.canonical.x>>t<<t),i=e.canonical.y-(e.canonical.y>>t<<t),o=(/* inlined export .Rr */8192)>>t;maplibre_gl_shared_ie(a,0,(/* inlined export .Rr */8192),(/* inlined export .Rr */8192),0,0,1),maplibre_gl_shared_E(a,a,[n*o,i*o,0]),maplibre_gl_shared_D(a,a,[1/2**t,1/2**t,0])}else continue;i.terrainRttPosMatrix32f=new Float32Array(a),t[n]=i}return t}_getTerrainCoordsForTileRanges(e,t){let n={};for(let r of this._renderableTilesKeys){let i=this._tiles[r].tileID;if(!this._isWithinTileRanges(i,t))continue;let a=e.clone(),o=maplibre_gl_shared_tt();if(i.canonical.z===e.canonical.z){let t=e.canonical.x-i.canonical.x+e.wrap*(1<<e.canonical.z),n=e.canonical.y-i.canonical.y;maplibre_gl_shared_ie(o,0,(/* inlined export .Rr */8192),(/* inlined export .Rr */8192),0,0,1),maplibre_gl_shared_E(o,o,[t*(/* inlined export .Rr */8192),n*(/* inlined export .Rr */8192),0])}else if(i.canonical.z>e.canonical.z){let t=i.canonical.z-e.canonical.z,n=i.canonical.x-(i.canonical.x>>t<<t)+e.wrap*(1<<i.canonical.z),r=i.canonical.y-(i.canonical.y>>t<<t),a=e.canonical.x-(i.canonical.x>>t),s=e.canonical.y-(i.canonical.y>>t),c=(/* inlined export .Rr */8192)>>t;maplibre_gl_shared_ie(o,0,c,c,0,0,1),maplibre_gl_shared_E(o,o,[-n*c+a*(/* inlined export .Rr */8192),-r*c+s*(/* inlined export .Rr */8192),0])}else{let t=e.canonical.z-i.canonical.z,n=e.canonical.x-(e.canonical.x>>t<<t)+e.wrap*(1<<e.canonical.z),r=e.canonical.y-(e.canonical.y>>t<<t),a=(e.canonical.x>>t)-i.canonical.x,s=(e.canonical.y>>t)-i.canonical.y,c=(/* inlined export .Rr */8192)<<t;maplibre_gl_shared_ie(o,0,c,c,0,0,1),maplibre_gl_shared_E(o,o,[n*(/* inlined export .Rr */8192)+a*c,r*(/* inlined export .Rr */8192)+s*c,0])}a.terrainRttPosMatrix32f=new Float32Array(o),n[r]=a}return n}getSourceTile(e,t){let n=this.tileManager._source,r=e.overscaledZ-this.deltaZoom;if(r>n.maxzoom&&(r=n.maxzoom),r<n.minzoom)return;this._sourceTileCache[e.key]||=e.scaledTo(r).key;let i=this.findTileInCaches(this._sourceTileCache[e.key]);if(!i?.dem&&t)for(;r>=n.minzoom&&!i?.dem;)i=this.findTileInCaches(e.scaledTo(r--).key);return i}findTileInCaches(e){let t=this.tileManager.getTileByID(e);return t||(t=this.tileManager._outOfViewCache.getByKey(e),t)}anyTilesAfterTime(e=maplibre_gl_U()){return this._lastTilesetChange>=e}_isWithinTileRanges(e,t){let n=t[e.canonical.z];return!!n&&(e.wrap>n.minWrap||e.wrap<n.maxWrap||e.canonical.x>=n.minTileXWrapped&&e.canonical.x<=n.maxTileXWrapped&&e.canonical.y>=n.minTileY&&e.canonical.y<=n.maxTileY)}};const maplibre_gl_gc=(/* inlined export .Rr */8192)*(1-1e-12);var maplibre_gl_c=class{constructor(e,t,n,r=`auto`){this._meshCache={},this.painter=e,this.tileManager=new maplibre_gl_hc(t),this.options=n,this.exaggeration=typeof n.exaggeration==`number`?n.exaggeration:1,this._terrainSkirtLength=r,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache=new Map,this._elevationSamplerCache=new Map}destroy(){this._fbo&&=(this._fbo.destroy(),null),this._fboDepthTexture&&=(this._fboDepthTexture.destroy(),null),this._emptyDemTexture&&=(this._emptyDemTexture.destroy(),null),this._emptyDepthTexture&&=(this._emptyDepthTexture.destroy(),null);for(let e in this._meshCache)this._meshCache[e].destroy();this._meshCache={},this.tileManager.destruct()}getDEMElevation(e,t,n,r=(/* inlined export .Rr */8192)){let i=e.normalizeCoordinates(t,n,r);if(!i)return 0;let a=this.getElevationSampler(i.tileID);return a?a(i.x,i.y,r):0}getElevationForLngLatZoom(e,t){if(!maplibre_gl_shared_lb(t,e.wrap()))return 0;let{tileID:n,mercatorX:r,mercatorY:i}=this._getOverscaledTileIDFromLngLatZoom(e,t);return this.getElevation(n,r%(/* inlined export .Rr */8192),i%(/* inlined export .Rr */8192),(/* inlined export .Rr */8192))}getElevationForLngLat(e,t){let n=this.getCoverageIndex();if(n){let t=maplibre_gl_shared_Hp.fromLngLat(e),r=maplibre_gl_yc(n,this.exaggeration,t.x,t.y);if(r.demLoaded)return r.elevation}let r=maplibre_gl_jo(t,{maxzoom:this.tileManager.maxzoom,minzoom:this.tileManager.minzoom,tileSize:512,terrain:this}),i=0;for(let e of r)e.canonical.z>i&&(i=Math.min(e.canonical.z,this.tileManager.maxzoom));return this.getElevationForLngLatZoom(e,i)}getElevation(e,t,n,r=(/* inlined export .Rr */8192)){return this.getDEMElevation(e,t,n,r)*this.exaggeration}resetElevationCache(){this._elevationSamplerCache.clear(),this._coverageIndex=void 0}getCoverageIndex(){return this._coverageIndex===void 0&&(this._coverageIndex=this._buildCoverageIndex()),this._coverageIndex}_buildCoverageIndex(){let e=[],t=new Map,n=0,r=0;for(let i of this.tileManager.getRenderableTiles()){if(!i)continue;let{canonical:a,wrap:o}=i.tileID;e.includes(a.z)||e.push(a.z);let s=this.getElevationSampler(i.tileID);t.set(`${o}/${a.z}/${a.x}/${a.y}`,s);let{minElevation:c,maxElevation:l}=this.getMinMaxElevation(i.tileID);n=Math.min(n,c??0),r=Math.max(r,l??0)}return t.size===0?null:(e.sort((e,t)=>t-e),{zooms:e,samplerPerTile:t,minElevation:n-10,maxElevation:r+10})}getElevationSampler(e){let t=e.key,n=this._elevationSamplerCache.get(t);if(n)return n;let r=this.tileManager.getSourceTile(e,!0),i=r?.dem;if(!r||!i)return null;let a=this._getDEMTileMatrix(e,r),o=a[0]*i.dim,s=a[5]*i.dim,c=a[12]*i.dim,l=a[13]*i.dim,u=(e,t,n)=>{let r=n===8192?1:(/* inlined export .Rr */8192)/n;return i.sampleBilinear(e*r*o+c,t*r*s+l)};return this._elevationSamplerCache.set(t,u),u}_getDEMTileMatrix(e,t){let n=`${t.tileID.key}/${e.key}`,r=this._demMatrixCache.get(n);if(r)return r;let i=this.tileManager.getSource().maxzoom,a=e.canonical.z-t.tileID.canonical.z;e.overscaledZ>e.canonical.z&&(e.canonical.z>=i?a=e.canonical.z-i:maplibre_gl_shared_Ft(`cannot calculate elevation if elevation maxzoom > source.maxzoom`));let o=e.canonical.x-(e.canonical.x>>a<<a),s=e.canonical.y-(e.canonical.y>>a<<a),c=maplibre_gl_shared_ee(new Float64Array(16),[1/((/* inlined export .Rr */8192)<<a),1/((/* inlined export .Rr */8192)<<a),0]);return maplibre_gl_shared_E(c,c,[o*(/* inlined export .Rr */8192),s*(/* inlined export .Rr */8192),0]),this._demMatrixCache.set(n,c),c}getTerrainData(e){if(!this._emptyDemTexture){let e=this.painter.context,t=new Ad({width:1,height:1},new Uint8Array(4));this._emptyDepthTexture=new Gd(e,t,e.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new Gd(e,new Ad({width:1,height:1}),e.gl.RGBA,{premultiply:!1}),this._emptyDemTexture.bind(e.gl.NEAREST,e.gl.CLAMP_TO_EDGE),this._emptyDemMatrix=maplibre_gl_shared_C([])}let t=this.tileManager.getSourceTile(e,!0);if(t?.dem&&(!t.demTexture||t.needsTerrainPrepare)){let e=this.painter.context;t.demTexture||=this.painter.getTileTexture(t.dem.stride),t.demTexture?t.demTexture.update(t.dem.getPixels(),{premultiply:!1}):t.demTexture=new Gd(e,t.dem.getPixels(),e.gl.RGBA,{premultiply:!1}),t.demTexture.bind(e.gl.NEAREST,e.gl.CLAMP_TO_EDGE),t.needsTerrainPrepare=!1}let n=t?this._getDEMTileMatrix(e,t):this._emptyDemMatrix;return{u_depth:2,u_terrain:3,u_terrain_dim:t?.dem?.dim||1,u_terrain_matrix:n,u_terrain_unpack:t?.dem?.getUnpackVector()||this._emptyDemUnpack,u_terrain_exaggeration:this.exaggeration,texture:(t?.demTexture||this._emptyDemTexture).texture,depthTexture:(this._fboDepthTexture||this._emptyDepthTexture).texture,tile:t}}getFramebuffer(){let e=this.painter,t=e.width/devicePixelRatio,n=e.height/devicePixelRatio;return this._fbo&&(this._fbo.width!==t||this._fbo.height!==n)&&(this._fbo.destroy(),this._fboDepthTexture.destroy(),delete this._fbo,delete this._fboDepthTexture),this._fboDepthTexture||(this._fboDepthTexture=new Gd(e.context,{width:t,height:n,data:null},e.context.gl.RGBA,{premultiply:!1}),this._fboDepthTexture.bind(e.context.gl.NEAREST,e.context.gl.CLAMP_TO_EDGE)),this._fbo||(this._fbo=e.context.createFramebuffer(t,n,!0,!1),this._fbo.depthAttachment.set(e.context.createRenderbuffer(e.context.gl.DEPTH_COMPONENT16,t,n))),this._fbo.colorAttachment.set(this._fboDepthTexture.texture),this._fbo}depthAtPoint(e){let t=new Uint8Array(4),n=this.painter.context,r=n.gl;return n.bindFramebuffer.set(this.getFramebuffer().framebuffer),r.readPixels(e.x,this.painter.height/devicePixelRatio-e.y-1,1,1,r.RGBA,r.UNSIGNED_BYTE,t),n.bindFramebuffer.set(null),(t[0]/16777216+t[1]/65536+t[2]/256+t[3])/256}getTerrainMesh(e){let t=this.painter.style.projection?.transitionState>0,n=t&&e.canonical.y===0,r=t&&e.canonical.y===(1<<e.canonical.z)-1,i=`m_${n?`n`:``}_${r?`s`:``}`;if(this._meshCache[i])return this._meshCache[i];let a=this.painter.context,o=new maplibre_gl_shared_Fl,s=new maplibre_gl_shared_Zl,c=this.meshSize,l=(/* inlined export .Rr */8192)/c,u=c*c;for(let e=0;e<=c;e++)for(let t=0;t<=c;t++)o.emplaceBack(t*l,e*l,0);for(let e=0;e<u;e+=c+1)for(let t=0;t<c;t++)s.emplaceBack(t+e,c+t+e+1,c+t+e+2),s.emplaceBack(t+e,c+t+e+2,t+e+1);this._terrainSkirtLength!==`none`&&this._buildSkirts(o,s,c,l,n,r);let d=new maplibre_gl_Ga(a.createVertexBuffer(o,maplibre_gl_mc.members),a.createIndexBuffer(s),maplibre_gl_shared_nu.simpleSegment(0,0,o.length,s.length));return this._meshCache[i]=d,d}getSkirtLength(e){return 2*Math.PI*maplibre_gl_shared_jp/2**Math.max(e,0)/5}getMinTileElevationForLngLatZoom(e,t){if(!maplibre_gl_shared_lb(t,e.wrap()))return 0;let{tileID:n}=this._getOverscaledTileIDFromLngLatZoom(e,t);return this.getMinMaxElevation(n).minElevation??0}getMinMaxElevation(e){let t=this.tileManager.getSourceTile(e,!0),n={minElevation:null,maxElevation:null};return t?.dem&&(n.minElevation=t.dem.min*this.exaggeration,n.maxElevation=t.dem.max*this.exaggeration),n}_getOverscaledTileIDFromLngLatZoom(e,t){let n=maplibre_gl_shared_Hp.fromLngLat(e.wrap()),r=(1<<t)*(/* inlined export .Rr */8192),i=n.x*r,a=n.y*r,o=Math.floor(i/(/* inlined export .Rr */8192)),s=Math.floor(a/(/* inlined export .Rr */8192));return{tileID:new maplibre_gl_shared_fb(t,0,t,o,s),mercatorX:i,mercatorY:a}}_buildSkirts(e,t,n,r,i,a){let o=e.length,s=o+(n+1),c=(n+1)*n,l=i?(/* inlined export .ht */-32768):0,u=+!i,d=a?(/* inlined export .gt */32767):(/* inlined export .Rr */8192),f=+!a;for(let t=0;t<=n;t++)e.emplaceBack(t*r,l,u);for(let t=0;t<=n;t++)e.emplaceBack(t*r,d,f);for(let e=0;e<n;e++)t.emplaceBack(c+e,s+e,s+e+1),t.emplaceBack(c+e,s+e+1,c+e+1),t.emplaceBack(0+e,o+e+1,o+e),t.emplaceBack(0+e,0+e+1,o+e+1);let p=e.length,m=p+(n+1)*2;for(let t of[0,1])for(let i=0;i<=n;i++)for(let n of[0,1])e.emplaceBack(t*(/* inlined export .Rr */8192),i*r,n);for(let e=0;e<n*2;e+=2)t.emplaceBack(p+e,p+e+1,p+e+3),t.emplaceBack(p+e,p+e+3,p+e+2),t.emplaceBack(m+e,m+e+3,m+e+1),t.emplaceBack(m+e,m+e+2,m+e+3)}};const maplibre_gl_vc={covered:!1,demLoaded:!1,elevation:0};function maplibre_gl_yc(e,t,n,r){if(r<0||r>=1)return maplibre_gl_vc;let i=Math.floor(n),a=n-i;for(let n of e.zooms){let o=1<<n,s=a*o,c=r*o,l=Math.floor(s),u=Math.floor(c),d=`${i}/${n}/${l}/${u}`;if(!e.samplerPerTile.has(d))continue;let f=e.samplerPerTile.get(d);return f?{covered:!0,demLoaded:!0,elevation:f(Math.min((s-l)*(/* inlined export .Rr */8192),maplibre_gl_gc),Math.min((c-u)*(/* inlined export .Rr */8192),maplibre_gl_gc),(/* inlined export .Rr */8192))*t}:{covered:!0,demLoaded:!1,elevation:0}}return maplibre_gl_vc}function maplibre_gl_bc(e,t){return e.covered&&t<=e.elevation+1e-6}function maplibre_gl_xc(e,t,n,r,i){for(let a=0;a<40&&r-n>i;a++){let i=(n+r)/2;t(e,i)?r=i:n=i}return{lo:n,hi:r}}var maplibre_gl_Sc=class t{get pixelsToClipSpaceMatrix(){return this._helper.pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._helper.clipSpaceToPixelsMatrix}get pixelsToGLUnits(){return this._helper.pixelsToGLUnits}get centerOffset(){return this._helper.centerOffset}get size(){return this._helper.size}get rotationMatrix(){return this._helper.rotationMatrix}get centerPoint(){return this._helper.centerPoint}get pixelsPerMeter(){return this._helper.pixelsPerMeter}setMinZoom(e){this._helper.setMinZoom(e)}setMaxZoom(e){this._helper.setMaxZoom(e)}setMinPitch(e){this._helper.setMinPitch(e)}setMaxPitch(e){this._helper.setMaxPitch(e)}setRenderWorldCopies(e){this._helper.setRenderWorldCopies(e)}setBearing(e){this._helper.setBearing(e)}setPitch(e){this._helper.setPitch(e)}setRoll(e){this._helper.setRoll(e)}setFov(e){this._helper.setFov(e)}setZoom(e){this._helper.setZoom(e)}setCenter(e){this._helper.setCenter(e)}setElevation(e){this._helper.setElevation(e)}setMinElevationForCurrentTile(e){this._helper.setMinElevationForCurrentTile(e)}setPadding(e){this._helper.setPadding(e)}interpolatePadding(e,t,n){this._helper.interpolatePadding(e,t,n)}isPaddingEqual(e){return this._helper.isPaddingEqual(e)}resize(e,t,n=!0){this._helper.resize(e,t,n)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(e){this._helper.setMaxBounds(e)}setConstrainOverride(e){this._helper.setConstrainOverride(e)}overrideNearFarZ(e,t){this._helper.overrideNearFarZ(e,t)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(e){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),e)}get tileSize(){return this._helper.tileSize}get tileZoom(){return this._helper.tileZoom}get scale(){return this._helper.scale}get worldSize(){return this._helper.worldSize}get width(){return this._helper.width}get height(){return this._helper.height}get lngRange(){return this._helper.lngRange}get latRange(){return this._helper.latRange}get minZoom(){return this._helper.minZoom}get maxZoom(){return this._helper.maxZoom}get zoom(){return this._helper.zoom}get center(){return this._helper.center}get minPitch(){return this._helper.minPitch}get maxPitch(){return this._helper.maxPitch}get pitch(){return this._helper.pitch}get pitchInRadians(){return this._helper.pitchInRadians}get roll(){return this._helper.roll}get rollInRadians(){return this._helper.rollInRadians}get bearing(){return this._helper.bearing}get bearingInRadians(){return this._helper.bearingInRadians}get fov(){return this._helper.fov}get fovInRadians(){return this._helper.fovInRadians}get elevation(){return this._helper.elevation}get minElevationForCurrentTile(){return this._helper.minElevationForCurrentTile}get padding(){return this._helper.padding}get unmodified(){return this._helper.unmodified}get renderWorldCopies(){return this._helper.renderWorldCopies}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}get constrainOverride(){return this._helper.constrainOverride}get nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}setTransitionState(e){}constructor(t){this._posMatrixCache=new Map,this._alignedPosMatrixCache=new Map,this._fogMatrixCacheF32=new Map,this.defaultConstrain=(t,n)=>{n=maplibre_gl_shared_yt(+n,this.minZoom,this.maxZoom);let r={center:new maplibre_gl_shared_Mp(t.lng,t.lat),zoom:n},i=this._helper._lngRange;!this._helper._renderWorldCopies&&i===null&&(i=[-179.9999999999,180-1e-10]);let a=this.tileSize*maplibre_gl_shared_Dt(r.zoom),o=0,s=a,c=0,l=a,u=0,d=0,{x:f,y:p}=this.size;if(this._helper._latRange){let e=this._helper._latRange;o=maplibre_gl_shared_Ip(e[1])*a,s=maplibre_gl_shared_Ip(e[0])*a,s-o<p&&(u=p/(s-o))}i&&(c=maplibre_gl_shared_bt(maplibre_gl_shared_Fp(i[0])*a,0,a),l=maplibre_gl_shared_bt(maplibre_gl_shared_Fp(i[1])*a,0,a),l<c&&(l+=a),l-c<f&&(d=f/(l-c)));let{x:m,y:h}=maplibre_gl_shared_Kp(a,t),g,_,v=Math.max(d||0,u||0);if(v){let e=new maplibre_gl_shared_l(d?(l+c)/2:m,u?(s+o)/2:h);return r.center=maplibre_gl_shared_qp(a,e).wrap(),r.zoom+=maplibre_gl_shared_Ot(v),r}if(this._helper._latRange){let e=p/2;h-e<o&&(_=o+e),h+e>s&&(_=s-e)}if(i){let e=(c+l)/2,t=m;this._helper._renderWorldCopies&&(t=maplibre_gl_shared_bt(m,e-a/2,e+a/2));let n=f/2;t-n<c&&(g=c+n),t+n>l&&(g=l-n)}if(g!==void 0||_!==void 0){let e=new maplibre_gl_shared_l(g??m,_??h);r.center=maplibre_gl_shared_qp(a,e).wrap()}return r},this.applyConstrain=(e,t)=>this._helper.applyConstrain(e,t),this._helper=new maplibre_gl_fc({calcMatrices:()=>this._calcMatrices(),defaultConstrain:(e,t)=>this.defaultConstrain(e,t)},t),this._coveringTilesDetailsProvider=new maplibre_gl_pc}clone(){let e=new t;return e.apply(this,!1),e}apply(e,t,n){this._helper.apply(e,t,n)}get cameraPosition(){return this._cameraPosition}get projectionMatrix(){return this._projectionMatrix}get modelViewProjectionMatrix(){return this._viewProjMatrix}get inverseProjectionMatrix(){return this._invProjMatrix}get mercatorMatrix(){return this._mercatorMatrix}getVisibleUnwrappedCoordinates(e){let t=[new maplibre_gl_shared_db(0,e)];if(this._helper._renderWorldCopies){let n=this.screenPointToMercatorCoordinate(new maplibre_gl_shared_l(0,0)),r=this.screenPointToMercatorCoordinate(new maplibre_gl_shared_l(this._helper._width,0)),i=this.screenPointToMercatorCoordinate(new maplibre_gl_shared_l(this._helper._width,this._helper._height)),a=this.screenPointToMercatorCoordinate(new maplibre_gl_shared_l(0,this._helper._height)),o=Math.floor(Math.min(n.x,r.x,i.x,a.x)),s=Math.floor(Math.max(n.x,r.x,i.x,a.x));for(let n=o-1;n<=s+1;n++)n!==0&&t.push(new maplibre_gl_shared_db(n,e))}return t}getCameraFrustum(){return maplibre_gl_yo.fromInvProjectionMatrix(this._invViewProjMatrix,this.worldSize)}getClippingPlane(){return null}getCoveringTilesDetailsProvider(){return this._coveringTilesDetailsProvider}recalculateZoomAndCenter(e){let t=this.screenPointToLocation(this.centerPoint,e),n=e?e.getElevationForLngLat(t,this):0;this._helper.recalculateZoomAndCenter(n)}setLocationAtPoint(e,t,n=this.elevation){let r=n-this.elevation,i=this.screenPointToMercatorCoordinateAtZ(t,r),a=this.screenPointToMercatorCoordinateAtZ(this.centerPoint,0),o=maplibre_gl_shared_Hp.fromLngLat(e),s=new maplibre_gl_shared_Hp(o.x-(i.x-a.x),o.y-(i.y-a.y));this.setCenter(s?.toLngLat()),this._helper._renderWorldCopies&&this.setCenter(this.center.wrap())}locationToScreenPoint(e,t){return t?this.coordinatePoint(maplibre_gl_shared_Hp.fromLngLat(e),t.getElevationForLngLat(e,this),this._pixelMatrix3D):this.coordinatePoint(maplibre_gl_shared_Hp.fromLngLat(e))}screenPointToLocation(e,t){return this.screenPointToMercatorCoordinate(e,t)?.toLngLat()}screenPointToLocationAtElevation(e,t){return this.screenPointToMercatorCoordinateAtZ(e,t-this.elevation)?.toLngLat()}screenPointToMercatorCoordinate(e,t){if(t){let n=this.screenTerrainPointToMercatorCoordinate(e,t);if(n!=null)return n}return this.screenPointToMercatorCoordinateAtZ(e)}screenTerrainPointToMercatorCoordinate(e,t){let n=t.getCoverageIndex();if(!n)return null;let{near:r,far:i}=this.getRaySegmentFromPixel(e),a=this.worldSize,o=i[0]-r[0],s=i[1]-r[1],c=i[2]-r[2],l={index:n,exaggeration:t.exaggeration,near:r,dx:o,dy:s,dz:c,worldSize:a},u=0,d=1;if(c===0){if(r[2]>n.maxElevation||r[2]<n.minElevation)return null}else{let e=(n.maxElevation-r[2])/c,t=(n.minElevation-r[2])/c;if(u=Math.max(u,Math.min(e,t)),d=Math.min(d,Math.max(e,t)),u>d)return null}let f=Math.hypot(o,s),p=maplibre_gl_shared_yt(Math.ceil(f*(d-u)/4),1,512),m=0,h=!maplibre_gl_wc(l,0);for(let e=0;e<=p;e++){let t=u+(d-u)*e/p;if(!h)h=!maplibre_gl_wc(l,t);else if(maplibre_gl_wc(l,t)){let{lo:e,hi:n}=maplibre_gl_xc(l,maplibre_gl_wc,m,t,.001/f),i=maplibre_gl_Cc(l,e),u=maplibre_gl_Cc(l,n),d=r[2]+e*c-i.elevation,p=r[2]+n*c-u.elevation,h=i.covered&&d>p?maplibre_gl_shared_yt(e+d*(n-e)/(d-p),e,n):n;return new maplibre_gl_shared_Hp((r[0]+h*o)/a,(r[1]+h*s)/a,maplibre_gl_Cc(l,h).elevation)}m=t}return null}getRaySegmentFromPixel(e){let t=[e.x,e.y,0,1],n=[e.x,e.y,1,1];maplibre_gl_shared_Ne(t,t,this._pixelMatrixInverse),maplibre_gl_shared_Ne(n,n,this._pixelMatrixInverse);let r=t[3],i=n[3],a=this.elevation;return{near:[t[0]/r,t[1]/r,t[2]/r+a],far:[n[0]/i,n[1]/i,n[2]/i+a]}}screenPointToMercatorCoordinateAtZ(e,t){let n=t||0,{near:r,far:i}=this.getRaySegmentFromPixel(e),a=r[2]===i[2]?0:(n+this.elevation-r[2])/(i[2]-r[2]);return new maplibre_gl_shared_Hp(maplibre_gl_shared_$r.number(r[0],i[0],a)/this.worldSize,maplibre_gl_shared_$r.number(r[1],i[1],a)/this.worldSize,n)}coordinatePoint(e,t=0,n=this._pixelMatrix){let r=[e.x*this.worldSize,e.y*this.worldSize,t,1];return maplibre_gl_shared_Ne(r,r,n),new maplibre_gl_shared_l(r[0]/r[3],r[1]/r[3])}getBounds(){let e=Math.max(0,this._helper._height/2-maplibre_gl_shared_Jp(this));return new maplibre_gl_ya().extend(this.screenPointToLocation(new maplibre_gl_shared_l(0,e))).extend(this.screenPointToLocation(new maplibre_gl_shared_l(this._helper._width,e))).extend(this.screenPointToLocation(new maplibre_gl_shared_l(this._helper._width,this._helper._height))).extend(this.screenPointToLocation(new maplibre_gl_shared_l(0,this._helper._height)))}isPointOnMapSurface(e,t){return t?this.screenTerrainPointToMercatorCoordinate(e,t)!=null:e.y>this.height/2-maplibre_gl_shared_Jp(this)}calculatePosMatrix(e,t=!1,n=!1){let r=e.key??maplibre_gl_shared_pb(e.wrap,e.canonical.z,e.canonical.z,e.canonical.x,e.canonical.y),i=t?this._alignedPosMatrixCache:this._posMatrixCache;if(i.has(r)){let e=i.get(r);return n?e.f32:e.f64}let a=maplibre_gl_shared_Yp(e,this.worldSize);maplibre_gl_shared_T(a,t?this._alignedProjMatrix:this._viewProjMatrix,a);let o={f64:a,f32:new Float32Array(a)};return i.set(r,o),n?o.f32:o.f64}calculateFogMatrix(e){let t=e.key,n=this._fogMatrixCacheF32;if(n.has(t))return n.get(t);let r=maplibre_gl_shared_Yp(e,this.worldSize);return maplibre_gl_shared_T(r,this._fogMatrix,r),n.set(t,new Float32Array(r)),n.get(t)}calculateCenterFromCameraLngLatAlt(e,t,n,r){return this._helper.calculateCenterFromCameraLngLatAlt(e,t,n,r)}calculateCameraOptionsFromTo(e,t,n,r){let i=maplibre_gl_shared_Hp.fromLngLat(e,t),a=maplibre_gl_shared_Hp.fromLngLat(n,r),o=a.x-i.x,s=a.y-i.y,c=a.z-i.z,l=Math.hypot(o,s,c);if(l===0)throw Error(`Can't calculate camera options with same From and To`);let u=Math.hypot(o,s),d=maplibre_gl_shared_Ot(this.cameraToCenterDistance/l/this.tileSize),f=maplibre_gl_shared_en(Math.atan2(o,-s)),p=maplibre_gl_shared_en(Math.acos(u/l));return p=c<0?90-p:90+p,{center:a.toLngLat(),elevation:r,zoom:d,pitch:p,bearing:f}}_calculateNearFarZIfNeeded(e,t,n){if(!this._helper.autoCalculateNearFarZ)return;let r=Math.min(this.elevation,this.minElevationForCurrentTile,this.getCameraAltitude()-100),i=e-r*this._helper._pixelPerMeter/Math.cos(t),a=r<0?i:e,o=Math.PI/2+this.pitchInRadians,s=maplibre_gl_shared_$t(this.fov)*(Math.abs(Math.cos(maplibre_gl_shared_$t(this.roll)))*this.height+Math.abs(Math.sin(maplibre_gl_shared_$t(this.roll)))*this.width)/this.height*(.5+n.y/this.height),c=Math.sin(s)*a/Math.sin(maplibre_gl_shared_yt(Math.PI-o-s,.01,Math.PI-.01)),l=maplibre_gl_shared_Jp(this),u=Math.atan(l/this._helper.cameraToCenterDistance),d=maplibre_gl_shared_$t(90-(/* inlined export .Q */89.25)),f=u>d?2*u*(.5+n.y/(l*2)):d,p=Math.sin(f)*a/Math.sin(maplibre_gl_shared_yt(Math.PI-o-f,.01,Math.PI-.01)),m=Math.min(c,p);this._helper._farZ=(Math.cos(Math.PI/2-t)*m+a)*1.01,this._helper._nearZ=this._helper._height/50}_calcMatrices(){let t=this.centerOffset,n=maplibre_gl_shared_Kp(this.worldSize,this.center),r=n.x,i=n.y,o=maplibre_gl_shared_$t(Math.min(this.pitch,(/* inlined export .Q */89.25))),s=Math.max(this._helper.cameraToCenterDistance/2,this._helper.cameraToCenterDistance+this._helper._elevation*this._helper._pixelPerMeter/Math.cos(o));this._calculateNearFarZIfNeeded(s,o,t);let c;c=new Float64Array(16),maplibre_gl_shared_ne(c,this.fovInRadians,this._helper._width/this._helper._height,this._helper._nearZ,this._helper._farZ),this._invProjMatrix=new Float64Array(16),maplibre_gl_Jo(this._invProjMatrix,c),c[8]=-t.x*2/this._helper._width,c[9]=t.y*2/this._helper._height,this._projectionMatrix=maplibre_gl_shared_x(c),maplibre_gl_shared_D(c,c,[1,-1,1]),maplibre_gl_shared_E(c,c,[0,0,-this._helper.cameraToCenterDistance]),maplibre_gl_shared_A(c,c,-this.rollInRadians),maplibre_gl_shared_O(c,c,this.pitchInRadians),maplibre_gl_shared_A(c,c,-this.bearingInRadians),maplibre_gl_shared_E(c,c,[-r,-i,0]),this._mercatorMatrix=maplibre_gl_shared_D([],c,[this.worldSize,this.worldSize,this.worldSize]),maplibre_gl_shared_D(c,c,[1,1,this._helper._pixelPerMeter]),this._pixelMatrix=maplibre_gl_shared_T(new Float64Array(16),this.clipSpaceToPixelsMatrix,c),maplibre_gl_shared_E(c,c,[0,0,-this.elevation]),this._viewProjMatrix=c,this._invViewProjMatrix=maplibre_gl_shared_w([],c);let l=[0,0,-1,1];maplibre_gl_shared_Ne(l,l,this._invViewProjMatrix),this._cameraPosition=[l[0]/l[3],l[1]/l[3],l[2]/l[3]],this._fogMatrix=new Float64Array(16),maplibre_gl_shared_ne(this._fogMatrix,this.fovInRadians,this.width/this.height,s,this._helper._farZ),this._fogMatrix[8]=-t.x*2/this.width,this._fogMatrix[9]=t.y*2/this.height,maplibre_gl_shared_D(this._fogMatrix,this._fogMatrix,[1,-1,1]),maplibre_gl_shared_E(this._fogMatrix,this._fogMatrix,[0,0,-this.cameraToCenterDistance]),maplibre_gl_shared_A(this._fogMatrix,this._fogMatrix,-this.rollInRadians),maplibre_gl_shared_O(this._fogMatrix,this._fogMatrix,this.pitchInRadians),maplibre_gl_shared_A(this._fogMatrix,this._fogMatrix,-this.bearingInRadians),maplibre_gl_shared_E(this._fogMatrix,this._fogMatrix,[-r,-i,0]),maplibre_gl_shared_D(this._fogMatrix,this._fogMatrix,[1,1,this._helper._pixelPerMeter]),maplibre_gl_shared_E(this._fogMatrix,this._fogMatrix,[0,0,-this.elevation]),this._pixelMatrix3D=maplibre_gl_shared_T(new Float64Array(16),this.clipSpaceToPixelsMatrix,c);let u=this._helper._width%2/2,d=this._helper._height%2/2,f=Math.cos(this.bearingInRadians),p=Math.sin(-this.bearingInRadians),m=r-Math.round(r)+f*u+p*d,h=i-Math.round(i)+f*d+p*u,g=new Float64Array(c);if(maplibre_gl_shared_E(g,g,[m>.5?m-1:m,h>.5?h-1:h,0]),this._alignedProjMatrix=g,c=maplibre_gl_shared_w(new Float64Array(16),this._pixelMatrix),!c)throw Error(`failed to invert matrix`);this._pixelMatrixInverse=c,this._clearMatrixCaches()}_clearMatrixCaches(){this._posMatrixCache.clear(),this._alignedPosMatrixCache.clear(),this._fogMatrixCacheF32.clear()}maxPitchScaleFactor(){if(!this._pixelMatrixInverse)return 1;let e=this.screenPointToMercatorCoordinate(new maplibre_gl_shared_l(0,0)),t=[e.x*this.worldSize,e.y*this.worldSize,0,1];return maplibre_gl_shared_Ne(t,t,this._pixelMatrix)[3]/this._helper.cameraToCenterDistance}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return Math.cos(this.pitchInRadians)*this.cameraToCenterDistance/this.pixelsPerMeter+this.elevation}getCameraLngLat(){let e=maplibre_gl_shared_Lp(1,this.center.lat)*this.worldSize,t=this._helper.cameraToCenterDistance/e;return maplibre_gl_shared_Xp(this.center,this.elevation,this.pitch,this.bearing,t).toLngLat()}lngLatToCameraDepth(e,t){let n=maplibre_gl_shared_Hp.fromLngLat(e),r=[n.x*this.worldSize,n.y*this.worldSize,t,1];return maplibre_gl_shared_Ne(r,r,this._viewProjMatrix),r[2]/r[3]}getProjectionData(e){let{overscaledTileID:t,aligned:n,applyTerrainMatrix:r}=e,i=this._helper.getMercatorTileCoordinates(t),a=t?this.calculatePosMatrix(t,n,!0):null,o;return o=t?.terrainRttPosMatrix32f&&r?t.terrainRttPosMatrix32f:a||maplibre_gl_shared_rt(),{mainMatrix:o,tileMercatorCoords:i,clippingPlane:[0,0,0,0],projectionTransition:0,fallbackMatrix:o,clipAntimeridian:!1}}isLocationOccluded(e){return!1}getPixelScale(){return 1}getCircleRadiusCorrection(){return 1}getPitchedTextCorrection(e,t,n){return 1}transformLightDirection(e){return maplibre_gl_shared_ce(e)}getRayDirectionFromPixel(e){throw Error(`Not implemented.`)}projectTileCoordinates(e,t,n,r){let i=this.calculatePosMatrix(n),a;r==null?(a=[e,t,0,1],maplibre_gl_vs(a,a,i)):(a=[e,t,r,1],maplibre_gl_shared_Ne(a,a,i));let o=a[3];return{point:new maplibre_gl_shared_l(a[0]/o,a[1]/o),signedDistanceFromCamera:o,isOccluded:!1}}populateCache(e){for(let t of e)this.calculatePosMatrix(t)}getProjectionDataForCustomLayer(e=!0){let t=new maplibre_gl_shared_fb(0,0,0,0,0),n=this.getProjectionData({overscaledTileID:t,applyGlobeMatrix:e}),r=maplibre_gl_shared_Yp(t,this.worldSize);maplibre_gl_shared_T(r,this._viewProjMatrix,r);let i=[(/* inlined export .Rr */8192),(/* inlined export .Rr */8192),this.worldSize/this._helper.pixelsPerMeter],a=maplibre_gl_shared_tt();return maplibre_gl_shared_D(a,r,i),{...n,tileMercatorCoords:[0,0,1,1],fallbackMatrix:a,mainMatrix:a}}getFastPathSimpleProjectionMatrix(e){return this.calculatePosMatrix(e)}};function maplibre_gl_Cc(e,t){return maplibre_gl_yc(e.index,e.exaggeration,(e.near[0]+t*e.dx)/e.worldSize,(e.near[1]+t*e.dy)/e.worldSize)}function maplibre_gl_wc(e,t){return maplibre_gl_bc(maplibre_gl_Cc(e,t),e.near[2]+t*e.dz)}function maplibre_gl_Tc(){maplibre_gl_shared_Ft(`Map cannot fit within canvas with the given bounds, padding, and/or offset.`)}function maplibre_gl_Ec(e){if(e.useSlerp){if(e.k<1){let t=maplibre_gl_shared_an(e.startEulerAngles.roll,e.startEulerAngles.pitch,e.startEulerAngles.bearing),n=maplibre_gl_shared_an(e.endEulerAngles.roll,e.endEulerAngles.pitch,e.endEulerAngles.bearing),r=new Float64Array(4);maplibre_gl_shared_Re(r,t,n,e.k);let i=maplibre_gl_shared_nn(r);e.tr.setRoll(i.roll),e.tr.setPitch(i.pitch),e.tr.setBearing(i.bearing)}else e.tr.setRoll(e.endEulerAngles.roll),e.tr.setPitch(e.endEulerAngles.pitch),e.tr.setBearing(e.endEulerAngles.bearing)}else e.tr.setRoll(maplibre_gl_shared_$r.number(e.startEulerAngles.roll,e.endEulerAngles.roll,e.k)),e.tr.setPitch(maplibre_gl_shared_$r.number(e.startEulerAngles.pitch,e.endEulerAngles.pitch,e.k)),e.tr.setBearing(maplibre_gl_shared_$r.number(e.startEulerAngles.bearing,e.endEulerAngles.bearing,e.k))}function maplibre_gl_Dc(t,n,r,i,a){let o=a.padding,s=maplibre_gl_shared_Kp(a.worldSize,r.getNorthWest()),c=maplibre_gl_shared_Kp(a.worldSize,r.getNorthEast()),l=maplibre_gl_shared_Kp(a.worldSize,r.getSouthEast()),u=maplibre_gl_shared_Kp(a.worldSize,r.getSouthWest()),d=maplibre_gl_shared_$t(-i),f=s.rotate(d),p=c.rotate(d),m=l.rotate(d),h=u.rotate(d),g=new maplibre_gl_shared_l(Math.max(f.x,p.x,h.x,m.x),Math.max(f.y,p.y,h.y,m.y)),_=new maplibre_gl_shared_l(Math.min(f.x,p.x,h.x,m.x),Math.min(f.y,p.y,h.y,m.y)),v=g.sub(_),y=a.width-(o.left+o.right+n.left+n.right),b=a.height-(o.top+o.bottom+n.top+n.bottom),x=y/v.x,S=b/v.y;if(S<0||x<0){maplibre_gl_Tc();return}let C=Math.min(maplibre_gl_shared_Ot(a.scale*Math.min(x,S)),t.maxZoom),w=maplibre_gl_shared_l.convert(t.offset),T=(n.left-n.right)/2,E=(n.top-n.bottom)/2,ee=new maplibre_gl_shared_l(T,E).rotate(maplibre_gl_shared_$t(i)),D=w.add(ee).mult(a.scale/maplibre_gl_shared_Dt(C));return{center:maplibre_gl_shared_qp(a.worldSize,s.add(l).div(2).sub(D)),zoom:C,bearing:i}}var maplibre_gl_Oc=class{get useGlobeControls(){return!1}handlePanInertia(e,t){let n=e.mag(),r=Math.abs(maplibre_gl_shared_Jp(t));return{easingOffset:e.mult(Math.min(r*.75/n,1)),easingCenter:t.center}}handleMapControlsRollPitchBearingZoom(e,t){e.bearingDelta&&t.setBearing(t.bearing+e.bearingDelta),e.pitchDelta&&t.setPitch(t.pitch+e.pitchDelta),e.rollDelta&&t.setRoll(t.roll+e.rollDelta),e.zoomDelta&&t.setZoom(t.zoom+e.zoomDelta)}handleMapControlsPan(e,t,n){e.around.distSqr(t.centerPoint)<.01||t.setLocationAtPoint(n,e.around,e.aroundElevation)}cameraForBoxAndBearing(e,t,n,r,i){return maplibre_gl_Dc(e,t,n,r,i)}handleJumpToCenterZoom(e,t){let n=t.zoom===void 0?e.zoom:+t.zoom;e.zoom!==n&&e.setZoom(+t.zoom),t.center!==void 0&&e.setCenter(maplibre_gl_shared_Mp.convert(t.center))}handleEaseTo(t,n){let r=t.zoom,i=t.padding,a={roll:t.roll,pitch:t.pitch,bearing:t.bearing},o={roll:n.roll===void 0?t.roll:n.roll,pitch:n.pitch===void 0?t.pitch:n.pitch,bearing:n.bearing===void 0?t.bearing:n.bearing},s=n.zoom!==void 0,c=!t.isPaddingEqual(n.padding),l=!1,u=s?+n.zoom:t.zoom,d=t.centerPoint.add(n.offsetAsPoint),f=t.screenPointToLocation(d),{center:p,zoom:m}=t.applyConstrain(maplibre_gl_shared_Mp.convert(n.center||f),u??r);maplibre_gl_uc(t,p);let h=maplibre_gl_shared_Kp(t.worldSize,f),g=maplibre_gl_shared_Kp(t.worldSize,p).sub(h),_=maplibre_gl_shared_Dt(m-r);return l=m!==r,{easeFunc:e=>{if(l&&t.setZoom(maplibre_gl_shared_$r.number(r,m,e)),maplibre_gl_shared_tn(a,o)||maplibre_gl_Ec({startEulerAngles:a,endEulerAngles:o,tr:t,k:e,useSlerp:a.roll!=o.roll}),c&&(t.interpolatePadding(i,n.padding,e),d=t.centerPoint.add(n.offsetAsPoint)),n.around)t.setLocationAtPoint(n.around,n.aroundPoint);else{let n=maplibre_gl_shared_Dt(t.zoom-r),i=(m>r?Math.min(2,_):Math.max(.5,_))**(1-e),a=maplibre_gl_shared_qp(t.worldSize,h.add(g.mult(e*i)).mult(n));t.setLocationAtPoint(t.renderWorldCopies?a.wrap():a,d)}},isZooming:l,elevationCenter:p}}handleFlyTo(t,n){let r=n.zoom!==void 0,i=t.zoom,a=t.applyConstrain(maplibre_gl_shared_Mp.convert(n.center||n.locationAtOffset),r?+n.zoom:i),o=a.center,s=a.zoom;maplibre_gl_uc(t,o);let c=t.worldSize,l=maplibre_gl_shared_Kp(c,n.locationAtOffset),u=maplibre_gl_shared_Kp(c,o).sub(l),d=u.mag(),f=maplibre_gl_shared_Dt(s-i),p=n.minZoom===void 0?t.minZoom:+n.minZoom,m=Math.max(p,t.minZoom),h=Math.min(m,i,s),g=t.applyConstrain(o,h).zoom;return{easeFunc:(e,n,r,a)=>{t.setZoom(e===1?s:i+maplibre_gl_shared_Ot(n));let d=e===1?o:maplibre_gl_shared_qp(c,l.add(u.mult(r)));t.setLocationAtPoint(t.renderWorldCopies?d.wrap():d,a)},scaleOfZoom:f,targetCenter:o,scaleOfMinZoom:maplibre_gl_shared_Dt(g-i),pixelPathLength:d}}};let maplibre_gl_kc;const maplibre_gl_Ac=()=>maplibre_gl_kc||=new maplibre_gl_shared_Rc({type:new maplibre_gl_shared_K(maplibre_gl_shared_P.projection.type,`type`)}),maplibre_gl_jc=new Zf({fill:new Xf(128,2),line:new Xf(512,0),tile:new Xf(128,32),stencil:new Xf(128,1),circle:3});var maplibre_gl_Mc=class{constructor(){this._tileMeshCache={}}get name(){return`vertical-perspective`}get transitionState(){return 1}get useSubdivision(){return!0}get shaderVariantName(){return`globe`}get shaderDefine(){return`#define GLOBE`}get shaderPreludeCode(){return maplibre_gl_ac.projectionGlobe}get vertexShaderPreludeCode(){return maplibre_gl_ac.projectionMercator.vertexSource}get subdivisionGranularity(){return maplibre_gl_jc}get useGlobeControls(){return!0}destroy(){}_getMeshKey(e){return`${e.granularity.toString(36)}_${e.generateBorders?`b`:``}${e.extendToNorthPole?`n`:``}${e.extendToSouthPole?`s`:``}`}getMeshFromTileID(e,t,n,r,i){let a=(i===`stencil`?maplibre_gl_jc.stencil:maplibre_gl_jc.tile).getGranularityForZoomLevel(t.z),o=t.y===0&&r,s=t.y===(1<<t.z)-1&&r;return this._getMesh(e,{granularity:a,generateBorders:n,extendToNorthPole:o,extendToSouthPole:s})}_getMesh(e,t){let n=this._getMeshKey(t);if(n in this._tileMeshCache)return this._tileMeshCache[n];let r=maplibre_gl_Ja(e,t);return this._tileMeshCache[n]=r,r}recalculate(e){}hasTransition(){return!1}},maplibre_gl_Nc=class extends maplibre_gl_shared_Fn{constructor(e,t){super(),this._transitionable=new maplibre_gl_shared_Dc(maplibre_gl_Ac(),`projection`,t),this.setProjection(e),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new maplibre_gl_shared_G(0)),this._mercatorProjection=new maplibre_gl_cc,this._verticalPerspectiveProjection=new maplibre_gl_Mc}get transitionState(){let e=this.properties.get(`type`);if(typeof e==`string`&&e===`mercator`)return 0;if(typeof e==`string`&&e===`vertical-perspective`)return 1;if(e instanceof maplibre_gl_shared_zr){if(e.from===e.to)return e.from===`mercator`?0:1;if(e.from===`vertical-perspective`&&e.to===`mercator`)return 1-e.transition;if(e.from===`mercator`&&e.to===`vertical-perspective`)return e.transition}return 1}get useGlobeRendering(){return this.transitionState>0}get currentProjection(){return this.useGlobeRendering?this._verticalPerspectiveProjection:this._mercatorProjection}get name(){return`globe`}get useSubdivision(){return this.currentProjection.useSubdivision}get shaderVariantName(){return this.currentProjection.shaderVariantName}get shaderDefine(){return this.currentProjection.shaderDefine}get shaderPreludeCode(){return this.currentProjection.shaderPreludeCode}get vertexShaderPreludeCode(){return this.currentProjection.vertexShaderPreludeCode}get subdivisionGranularity(){return this.currentProjection.subdivisionGranularity}get useGlobeControls(){return this.transitionState>0}destroy(){this._mercatorProjection.destroy(),this._verticalPerspectiveProjection.destroy()}getMeshFromTileID(e,t,n,r,i){return this.currentProjection.getMeshFromTileID(e,t,n,r,i)}setProjection(e){this._transitionable.setValue(`type`,e?.type||`mercator`)}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()||this.currentProjection.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}};function maplibre_gl_Pc(e){let t=maplibre_gl_Bc(e.worldSize,e.center.lat);return 2*Math.PI*t}function maplibre_gl_Fc(e,t,n){let r=maplibre_gl_zc(t),i=maplibre_gl_zc(n),a=dist_maplibre_gl_shared_e(r,i),o=Math.acos(a),s=maplibre_gl_Pc(e);return o/(2*Math.PI)*s}function maplibre_gl_Ic(e,t){return[maplibre_gl_shared_dt(e*Math.PI*2+Math.PI,Math.PI*2),2*Math.atan(Math.exp(Math.PI-t*Math.PI*2))-Math.PI*.5]}function maplibre_gl_Lc(e,t){let n=Math.cos(t),r=new Float64Array(3);return r[0]=Math.sin(e)*n,r[1]=Math.sin(t),r[2]=Math.cos(e)*n,r}function maplibre_gl_Rc(e,t,n,r,i){let a=1/(1<<i),o=e/(/* inlined export .Rr */8192)*a+n*a,s=t/(/* inlined export .Rr */8192)*a+r*a,c=maplibre_gl_shared_dt(o*Math.PI*2+Math.PI,Math.PI*2),l=2*Math.atan(Math.exp(Math.PI-s*Math.PI*2))-Math.PI*.5,u=Math.cos(l),d=new Float64Array(3);return d[0]=Math.sin(c)*u,d[1]=Math.sin(l),d[2]=Math.cos(c)*u,d}function maplibre_gl_zc(e){return maplibre_gl_Lc(e.lng*Math.PI/180,e.lat*Math.PI/180)}function maplibre_gl_Bc(e,t){return e/(2*Math.PI)/Math.cos(t*Math.PI/180)}function maplibre_gl_Vc(e){let t=maplibre_gl_shared_Ne(maplibre_gl_shared_$e(),[0,0,0,1],e.modelViewProjectionMatrix);return maplibre_gl_shared_Ne(t,t,e.inverseProjectionMatrix),[t[0]/t[3],t[1]/t[3],t[2]/t[3]]}function maplibre_gl_Hc(e){let t=Math.asin(e[1])/Math.PI*180,n=Math.sqrt(e[0]*e[0]+e[2]*e[2]);if(n>1e-6){let r=e[0]/n,i=e[2]/n,a=Math.acos(i),o=(r>0?a:-a)/Math.PI*180;return new maplibre_gl_shared_Mp(maplibre_gl_shared_bt(o,-180,180),t)}return new maplibre_gl_shared_Mp(0,t)}function maplibre_gl_Uc(e,t){return maplibre_gl_shared_Be(maplibre_gl_shared_$e(),-e.lng,-e.lat,t)}function maplibre_gl_Wc(e){let t=e[0],n=e[1],r=e[2],i=e[3];return{lng:-Math.atan2(2*(i*t+n*r),1-2*(t*t+n*n))*180/Math.PI,lat:-Math.asin(maplibre_gl_shared_yt(2*(i*n-r*t),-1,1))*180/Math.PI,bearing:Math.atan2(2*(i*r+t*n),1-2*(n*n+r*r))*180/Math.PI}}const maplibre_gl_Gc=Math.PI*.98;function maplibre_gl_Kc(e,t){let n=e.cameraPosition,r=maplibre_gl_shared_le(n);if(r<=1)return e.screenPointToLocation(t);let i=maplibre_gl_shared_et();maplibre_gl_shared_j(i,n);let a=e.getRayDirectionFromPixel(t),o=-dist_maplibre_gl_shared_e(a,i),s=maplibre_gl_shared_et();maplibre_gl_shared_me(s,a,i,o);let c=maplibre_gl_shared_le(s);if(c<1e-9)return e.screenPointToLocation(t);let l=Math.atan2(c,o),u=Math.asin(1/r)*.9;if(l<u)return e.screenPointToLocation(t);let d=r*Math.sin(u),f=Math.asin(maplibre_gl_shared_yt(d,-1,1))-u,p=r*Math.cos(u)/Math.sqrt(Math.max(1-d*d,1e-12))-1,m=maplibre_gl_Gc-f,h=l-u,g=f+p*h*m/(m+p*h),_=maplibre_gl_shared_et();maplibre_gl_shared_pe(_,s,1/c);let v=maplibre_gl_shared_et();return maplibre_gl_shared_pe(v,i,Math.cos(maplibre_gl_shared_yt(g,0,maplibre_gl_Gc))),maplibre_gl_shared_me(v,v,_,Math.sin(maplibre_gl_shared_yt(g,0,maplibre_gl_Gc))),maplibre_gl_shared_j(v,v),maplibre_gl_Hc(v)}function maplibre_gl_qc(e,t,r,i,a=!0){let o=maplibre_gl_Kc(e,r),s=t;if(i)s=maplibre_gl_Kc(e,r.sub(i));else if(!e.isPointOnMapSurface(r))return;let c=maplibre_gl_zc(o),l=maplibre_gl_zc(s),u=maplibre_gl_Uc(e.center,e.bearing),d=maplibre_gl_shared_ve(maplibre_gl_shared_et(),l,c),f=Math.sqrt(dist_maplibre_gl_shared_e(d,d)),p=Math.acos(maplibre_gl_shared_yt(dist_maplibre_gl_shared_e(l,c),-1,1))/2,m=Math.sin(p),h=f?maplibre_gl_shared_Ve(d[1]/f*m,-d[0]/f*m,d[2]/f*m,Math.cos(p)):maplibre_gl_shared_Ve(0,0,0,1),{lng:g,lat:_,bearing:v}=maplibre_gl_Wc(maplibre_gl_shared_Le(maplibre_gl_shared_$e(),u,h)),y=e.center.lat,b=e.zoom,x=maplibre_gl_shared_yt(_,-90,90),S=a?maplibre_gl_Jc(e,r,i,g):g;e.setCenter(new maplibre_gl_shared_Mp(maplibre_gl_shared_bt(S,-180,180),x)),a||e.setBearing(v),e.setZoom(b+maplibre_gl_Qc(y,e.center.lat))}function maplibre_gl_Jc(e,t,n,r){let i=e.center.lng,a=e.center.lat,o=a>=0?90:-90,s=e.locationToScreenPoint(new maplibre_gl_shared_Mp(0,o)),c=t.x-s.x,l=t.y-s.y,u=c*c+l*l,d=maplibre_gl_shared_yt(1-(maplibre_gl_shared_on-Math.abs(a))/12,0,1),f=d*d*(3-2*d),p=maplibre_gl_shared_dt(r-i+180,360)-180,m=0;if(f>0&&n){let e=(c*n.y-l*n.x)/Math.max(u,400);m=(o>0?1:-1)*e*180/Math.PI}return i+(1-f)*p+f*m}function maplibre_gl_Yc(e){let t=maplibre_gl_shared_et();return t[0]=e[0]*-e[3],t[1]=e[1]*-e[3],t[2]=e[2]*-e[3],{center:t,radius:Math.sqrt(1-e[3]*e[3])}}function maplibre_gl_Xc(e,t,n){let r=maplibre_gl_shared_et();maplibre_gl_shared_Ee(r,n,e);let i=maplibre_gl_shared_et();return maplibre_gl_shared_me(i,e,r,t/maplibre_gl_shared_De(r)),i}function maplibre_gl_Zc(e){return Math.cos(e*Math.PI/180)}function maplibre_gl_Qc(e,t){let n=maplibre_gl_Zc(e),r=maplibre_gl_Zc(t);return maplibre_gl_shared_Ot(r/n)}function maplibre_gl_$c(e,t){return 360/maplibre_gl_Pc({worldSize:e,center:{lat:t}})}function maplibre_gl_el(e,t){let n=e.rotate(t.bearingInRadians),r=t.zoom+maplibre_gl_Qc(t.center.lat,0),i=maplibre_gl_shared_pt(1/maplibre_gl_Zc(t.center.lat),1/maplibre_gl_Zc(Math.min(Math.abs(t.center.lat),60)),maplibre_gl_shared_ft(r,7,3,0,1)),a=maplibre_gl_$c(t.worldSize,t.center.lat);return new maplibre_gl_shared_Mp(t.center.lng-n.x*a*i,maplibre_gl_shared_yt(t.center.lat+n.y*a,-maplibre_gl_shared_on,maplibre_gl_shared_on))}function maplibre_gl_tl(e){let t=.5*e,n=Math.sin(t),r=Math.cos(t);return Math.log(n+r)-Math.log(r-n)}function maplibre_gl_nl(e,t,n,r){let i=e.lat+n*r;if(Math.abs(n)>1){let a=e.lat+n,o=(Math.sign(a)===Math.sign(e.lat)?Math.abs(e.lat):-Math.abs(e.lat))*Math.PI/180,s=Math.abs(e.lat+n)*Math.PI/180,c=maplibre_gl_tl(o+r*(s-o)),l=maplibre_gl_tl(o),u=maplibre_gl_tl(s),d=(c-l)/(u-l),f=e.lng+t*d;return new maplibre_gl_shared_Mp(f,i)}{let n=e.lng+t*r;return new maplibre_gl_shared_Mp(n,i)}}function maplibre_gl_rl(e,t,n=1){let r=dist_maplibre_gl_shared_e(e,t),i=n*n,a=maplibre_gl_shared_et(),o=maplibre_gl_shared_et();maplibre_gl_shared_pe(o,t,r),maplibre_gl_shared_Ee(a,e,o);let s=i-dist_maplibre_gl_shared_e(a,a);if(s<0)return null;let c=dist_maplibre_gl_shared_e(e,e)-i,l=-r+(r<0?1:-1)*Math.sqrt(s),u=c/l,d=l;return{tMin:Math.min(u,d),tMax:Math.max(u,d)}}var maplibre_gl_il=class{constructor(e){this._cachePrevious=new Map,this._cache=new Map,this._hadAnyChanges=!1,this._boundingVolumeFactory=e}swapBuffers(){if(!this._hadAnyChanges)return;let e=this._cachePrevious;this._cachePrevious=this._cache,this._cache=e,this._cache.clear(),this._hadAnyChanges=!1}getTileBoundingVolume(e,t,n,r){let i=`${e.z}_${e.x}_${e.y}_${r?.terrain?`t`:``}_${Math.round(n)}`,a=this._cache.get(i);if(a)return a;let o=this._cachePrevious.get(i);if(o)return this._cache.set(i,o),o;let s=this._boundingVolumeFactory(e,t,n,r);return this._cache.set(i,s),this._hadAnyChanges=!0,s}},maplibre_gl_al=class e{constructor(e,t,n,r){this.min=n,this.max=r,this.points=e,this.planes=t}static fromAabb(t,n){let r=[];for(let e=0;e<8;e++)r.push([(e>>0&1)==1?n[0]:t[0],(e>>1&1)==1?n[1]:t[1],(e>>2&1)==1?n[2]:t[2]]);return new e(r,[[-1,0,0,n[0]],[1,0,0,-t[0]],[0,-1,0,n[1]],[0,1,0,-t[1]],[0,0,-1,n[2]],[0,0,1,-t[2]]],t,n)}static fromCenterSizeAngles(t,n,r){let i=maplibre_gl_shared_Be([],r[0],r[1],r[2]),a=maplibre_gl_shared_xe([],[n[0],0,0],i),o=maplibre_gl_shared_xe([],[0,n[1],0],i),s=maplibre_gl_shared_xe([],[0,0,n[2]],i),c=[...t],l=[...t];for(let e=0;e<8;e++)for(let n=0;n<3;n++){let r=t[n]+a[n]*((e>>0&1)==1?1:-1)+o[n]*((e>>1&1)==1?1:-1)+s[n]*((e>>2&1)==1?1:-1);c[n]=Math.min(c[n],r),l[n]=Math.max(l[n],r)}let u=[];for(let e=0;e<8;e++){let n=[...t];maplibre_gl_shared_de(n,n,maplibre_gl_shared_pe([],a,(e>>0&1)==1?1:-1)),maplibre_gl_shared_de(n,n,maplibre_gl_shared_pe([],o,(e>>1&1)==1?1:-1)),maplibre_gl_shared_de(n,n,maplibre_gl_shared_pe([],s,(e>>2&1)==1?1:-1)),u.push(n)}return new e(u,[[...a,-dist_maplibre_gl_shared_e(a,u[0])],[...o,-dist_maplibre_gl_shared_e(o,u[0])],[...s,-dist_maplibre_gl_shared_e(s,u[0])],[-a[0],-a[1],-a[2],-dist_maplibre_gl_shared_e(a,u[7])],[-o[0],-o[1],-o[2],-dist_maplibre_gl_shared_e(o,u[7])],[-s[0],-s[1],-s[2],-dist_maplibre_gl_shared_e(s,u[7])]],c,l)}intersectsFrustum(e){let t=!0,n=this.points.length,r=this.planes.length,i=e.planes.length,a=e.points.length;for(let r=0;r<i;r++){let i=e.planes[r],a=0;for(let e=0;e<n;e++){let t=this.points[e];i[0]*t[0]+i[1]*t[1]+i[2]*t[2]+i[3]>=0&&a++}if(a===0)return 0;a<n&&(t=!1)}if(t)return 2;for(let t=0;t<r;t++){let n=this.planes[t],r=0;for(let t=0;t<a;t++){let i=e.points[t];n[0]*i[0]+n[1]*i[1]+n[2]*i[2]+n[3]>=0&&r++}if(r===0)return 0}return 1}intersectsPlane(e){let t=this.points.length,n=0;for(let r=0;r<t;r++){let t=this.points[r];e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]>=0&&n++}return n===t?2:n===0?0:1}};function maplibre_gl_ol(e,t,n){let r=e-t;return r<0?-r:Math.max(0,r-n)}function maplibre_gl_sl(e,t,n,r,i){let a=e-n,o;return o=a<0?Math.min(-a,1+a-i):a>i?Math.min(Math.max(a-i,0),1-a):0,Math.max(o,maplibre_gl_ol(t,r,i))}var maplibre_gl_cl=class{constructor(){this._boundingVolumeCache=new maplibre_gl_il(this._computeTileBoundingVolume)}prepareNextFrame(){this._boundingVolumeCache.swapBuffers()}distanceToTile2d(e,t,n,r){let i=1<<n.z,a=1/i,o=n.x/i,s=n.y/i,c=.5,l=2;return l=Math.min(l,maplibre_gl_sl(e,t,o,s,a)),l=Math.min(l,maplibre_gl_sl(e,t,o+c,-s-a,a)),l=Math.min(l,maplibre_gl_sl(e,t,o+c,2-s-a,a)),l}getWrap(e,t,n){let r=1<<t.z,i=1/r,a=t.x/r,o=maplibre_gl_ol(e.x,a,i),s=maplibre_gl_ol(e.x,a-1,i),c=maplibre_gl_ol(e.x,a+1,i),l=Math.min(o,s,c);return l===c?1:l===s?-1:0}allowVariableZoom(e,t){return maplibre_gl_Oo(e,t)>4}allowWorldCopies(){return!1}getTileBoundingVolume(e,t,n,r){return this._boundingVolumeCache.getTileBoundingVolume(e,t,n,r)}_computeTileBoundingVolume(e,t,r,i){let a=Math.min(0,r),o=Math.max(0,r);if(i?.terrain){let n=new maplibre_gl_shared_fb(e.z,t,e.z,e.x,e.y),r=i.terrain.getMinMaxElevation(n);a=r.minElevation??a,o=Math.max(r.maxElevation??o,o)}if(a/=maplibre_gl_shared_jp,o/=maplibre_gl_shared_jp,a+=1,o+=1,e.z<=0)return maplibre_gl_al.fromAabb([-o,-o,-o],[o,o,o]);if(e.z===1)return maplibre_gl_al.fromAabb([e.x===0?-o:0,e.y===0?0:-o,-o],[e.x===0?0:o,e.y===0?o:0,o]);{let t=[maplibre_gl_Rc(0,0,e.x,e.y,e.z),maplibre_gl_Rc((/* inlined export .Rr */8192),0,e.x,e.y,e.z),maplibre_gl_Rc((/* inlined export .Rr */8192),(/* inlined export .Rr */8192),e.x,e.y,e.z),maplibre_gl_Rc(0,(/* inlined export .Rr */8192),e.x,e.y,e.z)],r=[];for(let e of t)r.push(maplibre_gl_shared_pe([],e,o));if(o!==a)for(let e of t)r.push(maplibre_gl_shared_pe([],e,a));e.y===0&&r.push([0,1,0]),e.y===(1<<e.z)-1&&r.push([0,-1,0]);let i=[1,1,1],s=[-1,-1,-1];for(let e of r)for(let t=0;t<3;t++)i[t]=Math.min(i[t],e[t]),s[t]=Math.max(s[t],e[t]);let c=maplibre_gl_Rc((/* inlined export .Rr */8192)/2,(/* inlined export .Rr */8192)/2,e.x,e.y,e.z),l=maplibre_gl_shared_ve([],[0,1,0],c);maplibre_gl_shared_j(l,l);let u=maplibre_gl_shared_ve([],c,l);maplibre_gl_shared_j(u,u);let d=maplibre_gl_shared_ve([],t[2],t[1]);maplibre_gl_shared_j(d,d);let f=maplibre_gl_shared_ve([],t[0],t[3]);maplibre_gl_shared_j(f,f),r.push(maplibre_gl_shared_pe([],c,o)),e.y>=(1<<e.z)/2&&r.push(maplibre_gl_shared_pe([],maplibre_gl_Rc((/* inlined export .Rr */8192)/2,0,e.x,e.y,e.z),o)),e.y<(1<<e.z)/2&&r.push(maplibre_gl_shared_pe([],maplibre_gl_Rc((/* inlined export .Rr */8192)/2,(/* inlined export .Rr */8192),e.x,e.y,e.z),o));let p=maplibre_gl_ll(c,r),m=maplibre_gl_ll(u,r),h=[-c[0],-c[1],-c[2],p.max],g=[c[0],c[1],c[2],-p.min],_=[-u[0],-u[1],-u[2],m.max],v=[u[0],u[1],u[2],-m.min],y=[...d,0],b=[...f,0],x=[];return e.y===0?x.push(maplibre_gl_shared_ot(b,y,h),maplibre_gl_shared_ot(b,y,g)):x.push(maplibre_gl_shared_ot(_,y,h),maplibre_gl_shared_ot(_,y,g),maplibre_gl_shared_ot(_,b,h),maplibre_gl_shared_ot(_,b,g)),e.y===(1<<e.z)-1?x.push(maplibre_gl_shared_ot(b,y,h),maplibre_gl_shared_ot(b,y,g)):x.push(maplibre_gl_shared_ot(v,y,h),maplibre_gl_shared_ot(v,y,g),maplibre_gl_shared_ot(v,b,h),maplibre_gl_shared_ot(v,b,g)),new maplibre_gl_al(x,[h,g,_,v,y,b],i,s)}}};function maplibre_gl_ll(e,t){let n=1/0,r=-1/0;for(let i of t){let t=dist_maplibre_gl_shared_e(e,i);n=Math.min(n,t),r=Math.max(r,t)}return{min:n,max:r}}const maplibre_gl_ul=1e-12;var maplibre_gl_dl=class e{get pixelsToClipSpaceMatrix(){return this._helper.pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._helper.clipSpaceToPixelsMatrix}get pixelsToGLUnits(){return this._helper.pixelsToGLUnits}get centerOffset(){return this._helper.centerOffset}get size(){return this._helper.size}get rotationMatrix(){return this._helper.rotationMatrix}get centerPoint(){return this._helper.centerPoint}get pixelsPerMeter(){return this._helper.pixelsPerMeter}setMinZoom(e){this._helper.setMinZoom(e)}setMaxZoom(e){this._helper.setMaxZoom(e)}setMinPitch(e){this._helper.setMinPitch(e)}setMaxPitch(e){this._helper.setMaxPitch(e)}setRenderWorldCopies(e){this._helper.setRenderWorldCopies(e)}setBearing(e){this._helper.setBearing(e)}setPitch(e){this._helper.setPitch(e)}setRoll(e){this._helper.setRoll(e)}setFov(e){this._helper.setFov(e)}setZoom(e){this._helper.setZoom(e)}setCenter(e){this._helper.setCenter(e)}setElevation(e){this._helper.setElevation(e)}setMinElevationForCurrentTile(e){this._helper.setMinElevationForCurrentTile(e)}setPadding(e){this._helper.setPadding(e)}interpolatePadding(e,t,n){this._helper.interpolatePadding(e,t,n)}isPaddingEqual(e){return this._helper.isPaddingEqual(e)}resize(e,t){this._helper.resize(e,t)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(e){this._helper.setMaxBounds(e)}setConstrainOverride(e){this._helper.setConstrainOverride(e)}overrideNearFarZ(e,t){this._helper.overrideNearFarZ(e,t)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(e){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),e)}get tileSize(){return this._helper.tileSize}get tileZoom(){return this._helper.tileZoom}get scale(){return this._helper.scale}get worldSize(){return this._helper.worldSize}get width(){return this._helper.width}get height(){return this._helper.height}get lngRange(){return this._helper.lngRange}get latRange(){return this._helper.latRange}get minZoom(){return this._helper.minZoom}get maxZoom(){return this._helper.maxZoom}get zoom(){return this._helper.zoom}get center(){return this._helper.center}get minPitch(){return this._helper.minPitch}get maxPitch(){return this._helper.maxPitch}get pitch(){return this._helper.pitch}get pitchInRadians(){return this._helper.pitchInRadians}get roll(){return this._helper.roll}get rollInRadians(){return this._helper.rollInRadians}get bearing(){return this._helper.bearing}get bearingInRadians(){return this._helper.bearingInRadians}get fov(){return this._helper.fov}get fovInRadians(){return this._helper.fovInRadians}get elevation(){return this._helper.elevation}get minElevationForCurrentTile(){return this._helper.minElevationForCurrentTile}get padding(){return this._helper.padding}get unmodified(){return this._helper.unmodified}get renderWorldCopies(){return this._helper.renderWorldCopies}get constrainOverride(){return this._helper.constrainOverride}get nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}setTransitionState(e){}constructor(e){this._cachedClippingPlane=maplibre_gl_shared_$e(),this._projectionMatrix=maplibre_gl_shared_nt(),this._globeViewProjMatrix32f=maplibre_gl_shared_rt(),this._globeViewProjMatrixF64=maplibre_gl_shared_nt(),this._globeViewProjMatrixF64Inverted=maplibre_gl_shared_nt(),this._globeProjMatrixInverted=maplibre_gl_shared_nt(),this._cameraPosition=maplibre_gl_shared_et(),this.defaultConstrain=(e,t)=>{let n=maplibre_gl_shared_yt(e.lat,-maplibre_gl_shared_on,maplibre_gl_shared_on),r=maplibre_gl_shared_yt(+t,this.minZoom+maplibre_gl_Qc(0,n),this.maxZoom);return{center:new maplibre_gl_shared_Mp(e.lng,n),zoom:r}},this.applyConstrain=(e,t)=>this._helper.applyConstrain(e,t),this._helper=new maplibre_gl_fc({calcMatrices:()=>this._calcMatrices(),defaultConstrain:(e,t)=>this.defaultConstrain(e,t)},e),this._coveringTilesDetailsProvider=new maplibre_gl_cl}clone(){let t=new e;return t.apply(this,!1),t}apply(e,t){this._helper.apply(e,t)}get projectionMatrix(){return this._projectionMatrix}get modelViewProjectionMatrix(){return this._globeViewProjMatrixF64}get inverseProjectionMatrix(){return this._globeProjMatrixInverted}get cameraPosition(){let e=maplibre_gl_shared_et();return e[0]=this._cameraPosition[0],e[1]=this._cameraPosition[1],e[2]=this._cameraPosition[2],e}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}getProjectionData(e){let{overscaledTileID:t,applyGlobeMatrix:n}=e,r=this._helper.getMercatorTileCoordinates(t);return{mainMatrix:this._globeViewProjMatrix32f,tileMercatorCoords:r,clippingPlane:this._cachedClippingPlane,projectionTransition:+!!n,fallbackMatrix:this._globeViewProjMatrix32f,clipAntimeridian:t?.canonical.z===0}}_computeClippingPlane(e){let t=this.pitchInRadians,n=this.cameraToCenterDistance/e,r=Math.sin(t)*n,i=Math.cos(t)*n+1,a=1/Math.sqrt(r*r+i*i)*1,o=-r,s=i,c=Math.sqrt(o*o+s*s);o/=c,s/=c;let l=[0,o,s];maplibre_gl_shared_we(l,l,[0,0,0],-this.bearingInRadians),maplibre_gl_shared_Se(l,l,[0,0,0],-1*this.center.lat*Math.PI/180),maplibre_gl_shared_Ce(l,l,[0,0,0],this.center.lng*Math.PI/180);let u=1/maplibre_gl_shared_le(l);return maplibre_gl_shared_pe(l,l,u),[...l,-a*u]}isLocationOccluded(e){return!this.isSurfacePointVisible(maplibre_gl_zc(e))}transformLightDirection(e){let t=this._helper._center.lng*Math.PI/180,r=this._helper._center.lat*Math.PI/180,i=Math.cos(r),a=[Math.sin(t)*i,Math.sin(r),Math.cos(t)*i],o=[a[2],0,-a[0]],s=[0,0,0];maplibre_gl_shared_ve(s,o,a),maplibre_gl_shared_j(o,o),maplibre_gl_shared_j(s,s);let c=[o[0]*e[0]+s[0]*e[1]+a[0]*e[2],o[1]*e[0]+s[1]*e[1]+a[1]*e[2],o[2]*e[0]+s[2]*e[1]+a[2]*e[2]],l=[0,0,0];return maplibre_gl_shared_j(l,c),l}getPixelScale(){return 1/Math.cos(this._helper._center.lat*Math.PI/180)}getCircleRadiusCorrection(){return Math.cos(this._helper._center.lat*Math.PI/180)}getPitchedTextCorrection(e,t,n){let r=maplibre_gl_shared_Wp(e,t,n.canonical),i=maplibre_gl_Ic(r.x,r.y);return this.getCircleRadiusCorrection()/Math.cos(i[1])}projectTileCoordinates(e,t,n,r){let i=n.canonical,a=maplibre_gl_Rc(e,t,i.x,i.y,i.z),o=1+(r??0)/maplibre_gl_shared_jp,s=a[0]*o,c=a[1]*o,l=a[2]*o,u=[s,c,l,1];maplibre_gl_shared_Ne(u,u,this._globeViewProjMatrixF64);let d;if(o<=1){let e=this._cachedClippingPlane;d=e[0]*a[0]+e[1]*a[1]+e[2]*a[2]+e[3]<0}else d=this._isLineOfSightBlocked(s,c,l);return{point:new maplibre_gl_shared_l(u[0]/u[3],u[1]/u[3]),signedDistanceFromCamera:u[3],isOccluded:d}}_isLineOfSightBlocked(e,t,n){let r=this._cameraPosition,i=e-r[0],a=t-r[1],o=n-r[2],s=i*i+a*a+o*o;if(s===0)return!1;let c=maplibre_gl_shared_yt(-(r[0]*i+r[1]*a+r[2]*o)/s,0,1),l=r[0]+c*i,u=r[1]+c*a,d=r[2]+c*o;return l*l+u*u+d*d<1}_calcMatrices(){let e=maplibre_gl_Bc(this.worldSize,this.center.lat),t=maplibre_gl_shared_tt();this._helper.autoCalculateNearFarZ&&(this._helper._nearZ=.5,this._helper._farZ=this.cameraToCenterDistance+e*2),maplibre_gl_shared_ne(t,this.fovInRadians,this.width/this.height,this._helper._nearZ,this._helper._farZ);let n=this.centerOffset;t[8]=-n.x*2/this._helper._width,t[9]=n.y*2/this._helper._height,this._projectionMatrix=maplibre_gl_shared_x(t),this._globeProjMatrixInverted=maplibre_gl_shared_tt(),maplibre_gl_shared_w(this._globeProjMatrixInverted,t),maplibre_gl_shared_E(t,t,[0,0,-this.cameraToCenterDistance]),maplibre_gl_shared_A(t,t,this.rollInRadians),maplibre_gl_shared_O(t,t,-this.pitchInRadians),maplibre_gl_shared_A(t,t,this.bearingInRadians),maplibre_gl_shared_E(t,t,[0,0,-e]);let r=maplibre_gl_shared_et();r[0]=e,r[1]=e,r[2]=e,maplibre_gl_shared_O(t,t,this.center.lat*Math.PI/180),maplibre_gl_shared_k(t,t,-this.center.lng*Math.PI/180),maplibre_gl_shared_D(t,t,r),this._globeViewProjMatrixF64=t,this._globeViewProjMatrix32f=new Float32Array(t),this._globeViewProjMatrixF64Inverted=maplibre_gl_shared_tt(),maplibre_gl_shared_w(this._globeViewProjMatrixF64Inverted,t);let i=maplibre_gl_shared_et();this._cameraPosition=maplibre_gl_shared_et(),this._cameraPosition[2]=this.cameraToCenterDistance/e,maplibre_gl_shared_we(this._cameraPosition,this._cameraPosition,i,-this.rollInRadians),maplibre_gl_shared_Se(this._cameraPosition,this._cameraPosition,i,this.pitchInRadians),maplibre_gl_shared_we(this._cameraPosition,this._cameraPosition,i,-this.bearingInRadians),maplibre_gl_shared_de(this._cameraPosition,this._cameraPosition,[0,0,1]),maplibre_gl_shared_Se(this._cameraPosition,this._cameraPosition,i,-this.center.lat*Math.PI/180),maplibre_gl_shared_Ce(this._cameraPosition,this._cameraPosition,i,this.center.lng*Math.PI/180),this._cachedClippingPlane=this._computeClippingPlane(e);let o=maplibre_gl_shared_x(this._globeViewProjMatrixF64Inverted);maplibre_gl_shared_D(o,o,[1,1,-1]),this._cachedFrustum=maplibre_gl_yo.fromInvProjectionMatrix(o,1,0,this._cachedClippingPlane,!0)}calculateFogMatrix(e){maplibre_gl_shared_Ft(`calculateFogMatrix is not supported on globe projection.`);let t=maplibre_gl_shared_tt();return maplibre_gl_shared_C(t),t}getVisibleUnwrappedCoordinates(e){return[new maplibre_gl_shared_db(0,e)]}getCameraFrustum(){return this._cachedFrustum}getClippingPlane(){return this._cachedClippingPlane}getCoveringTilesDetailsProvider(){return this._coveringTilesDetailsProvider}recalculateZoomAndCenter(e){if(e){maplibre_gl_shared_Ft(`terrain is not fully supported on vertical perspective projection.`);return}this._helper.recalculateZoomAndCenter(0)}maxPitchScaleFactor(){return 1}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return(maplibre_gl_shared_le(this._cameraPosition)-1)*maplibre_gl_shared_jp}getCameraLngLat(){let e=maplibre_gl_shared_et();return maplibre_gl_shared_j(e,this._cameraPosition),maplibre_gl_Hc(e)}lngLatToCameraDepth(e,t){let n=maplibre_gl_zc(e);maplibre_gl_shared_pe(n,n,1+t/maplibre_gl_shared_jp);let r=maplibre_gl_shared_$e();return maplibre_gl_shared_Ne(r,[n[0],n[1],n[2],1],this._globeViewProjMatrixF64),r[2]/r[3]}populateCache(e){}getBounds(){let e=this.width*.5,t=this.height*.5,n=[new maplibre_gl_shared_l(0,0),new maplibre_gl_shared_l(e,0),new maplibre_gl_shared_l(this.width,0),new maplibre_gl_shared_l(this.width,t),new maplibre_gl_shared_l(this.width,this.height),new maplibre_gl_shared_l(e,this.height),new maplibre_gl_shared_l(0,this.height),new maplibre_gl_shared_l(0,t)],r=[];for(let e of n)r.push(this.unprojectScreenPoint(e));let i=0,a=0,o=0,s=0,c=this.center;for(let e of r){let t=maplibre_gl_shared_lt(c.lng,e.lng),n=maplibre_gl_shared_lt(c.lat,e.lat);t<a&&(a=t),t>i&&(i=t),n<s&&(s=n),n>o&&(o=n)}let l=[c.lng+a,c.lat+s,c.lng+i,c.lat+o];return this.isSurfacePointOnScreen([0,1,0])&&(l[3]=90,l[0]=-180,l[2]=180),this.isSurfacePointOnScreen([0,-1,0])&&(l[1]=-90,l[0]=-180,l[2]=180),new maplibre_gl_ya(l)}calculateCenterFromCameraLngLatAlt(e,t,n,r){return this._helper.calculateCenterFromCameraLngLatAlt(e,t,n,r)}calculateCameraOptionsFromTo(e,t,n,r){let i=maplibre_gl_shared_Mp.convert(n),a=maplibre_gl_zc(maplibre_gl_shared_Mp.convert(e));maplibre_gl_shared_pe(a,a,1+t/maplibre_gl_shared_jp);let o=maplibre_gl_zc(i),s=maplibre_gl_shared_pe(maplibre_gl_shared_et(),o,1+r/maplibre_gl_shared_jp),c=maplibre_gl_shared_fe(maplibre_gl_shared_et(),a,o),l=maplibre_gl_shared_le(c);if(l<maplibre_gl_ul||maplibre_gl_shared_he(a,s)<maplibre_gl_ul)throw Error(`Can't calculate camera options with same From and To`);let u=maplibre_gl_shared_et();maplibre_gl_shared_Ce(c,c,u,-maplibre_gl_shared_$t(i.lng)),maplibre_gl_shared_Se(c,c,u,maplibre_gl_shared_$t(i.lat));let d=maplibre_gl_shared_en(Math.acos(maplibre_gl_shared_yt(c[2]/l,-1,1))),f=Math.hypot(c[0],c[1])<l*1e-9?this.bearing:maplibre_gl_shared_en(Math.atan2(-c[0],-c[1]));return{center:i,elevation:r,zoom:maplibre_gl_shared_Ot(this.cameraToCenterDistance/l/maplibre_gl_Bc(this.tileSize,i.lat)),pitch:d,bearing:f}}setLocationAtPoint(e,t,n){let r=maplibre_gl_zc(this.unprojectScreenPoint(t)),i=maplibre_gl_zc(e),a=maplibre_gl_shared_et();maplibre_gl_shared_Te(a);let o=maplibre_gl_shared_et();maplibre_gl_shared_Ce(o,r,a,-this.center.lng*Math.PI/180),maplibre_gl_shared_Se(o,o,a,this.center.lat*Math.PI/180);let s=i[0]*i[0]+i[2]*i[2],c=o[0]*o[0];if(s<c)return;let l=Math.sqrt(s-c),u=-l,d=maplibre_gl_shared_ct(i[0],i[2],o[0],l),f=maplibre_gl_shared_ct(i[0],i[2],o[0],u),p=maplibre_gl_shared_et();maplibre_gl_shared_Ce(p,i,a,-d);let m=maplibre_gl_shared_ct(p[1],p[2],o[1],o[2]),h=maplibre_gl_shared_et();maplibre_gl_shared_Ce(h,i,a,-f);let g=maplibre_gl_shared_ct(h[1],h[2],o[1],o[2]),_=Math.PI*.5,v=m>=-_&&m<=_,y=g>=-_&&g<=_,b,x;if(v&&y){let e=this.center.lng*Math.PI/180,t=this.center.lat*Math.PI/180,n=maplibre_gl_shared_ut(d,e),r=maplibre_gl_shared_ut(m,t),i=maplibre_gl_shared_ut(f,e),a=maplibre_gl_shared_ut(g,t);n+r<i+a?(b=d,x=m):(b=f,x=g)}else if(v)b=d,x=m;else if(y)b=f,x=g;else return;let S=b/Math.PI*180,C=x/Math.PI*180,w=this.center.lat;this.setCenter(new maplibre_gl_shared_Mp(S,maplibre_gl_shared_yt(C,-90,90))),this.setZoom(this.zoom+maplibre_gl_Qc(w,this.center.lat))}locationToScreenPoint(e,t){let n=maplibre_gl_zc(e);if(t){let r=t.getElevationForLngLatZoom(e,this._helper._tileZoom);maplibre_gl_shared_pe(n,n,1+r/maplibre_gl_shared_jp)}return this._projectSurfacePointToScreen(n)}_projectSurfacePointToScreen(e){let t=maplibre_gl_shared_$e();return maplibre_gl_shared_Ne(t,[...e,1],this._globeViewProjMatrixF64),t[0]/=t[3],t[1]/=t[3],new maplibre_gl_shared_l((t[0]*.5+.5)*this.width,(-t[1]*.5+.5)*this.height)}screenPointToMercatorCoordinate(e,t){if(t){let n=this.screenTerrainPointToMercatorCoordinate(e,t);if(n)return n}return maplibre_gl_shared_Hp.fromLngLat(this.unprojectScreenPoint(e))}screenTerrainPointToMercatorCoordinate(e,t){let n=t.getCoverageIndex();if(!n)return null;let r=this.cameraPosition,i=this.getRayDirectionFromPixel(e),a=maplibre_gl_rl(r,i,1+n.maxElevation/maplibre_gl_shared_jp);if(!a)return null;let o=maplibre_gl_rl(r,i,1+n.minElevation/maplibre_gl_shared_jp),s=Math.max(a.tMin,0),c=o?o.tMin:a.tMax;if(c<=s)return null;let l={index:n,exaggeration:t.exaggeration,origin:r,direction:i},u=0;for(let e=0;e<=256;e++){let t=s+(c-s)*e/256;if(maplibre_gl_pl(l,t)){let{hi:e}=maplibre_gl_xc(l,maplibre_gl_pl,u,t,1e-12),{sample:n,mercator:r}=maplibre_gl_fl(l,e);return new maplibre_gl_shared_Hp(r.x,r.y,n.elevation)}u=t}return null}screenPointToLocation(e,t){return this.screenPointToMercatorCoordinate(e,t)?.toLngLat()}screenPointToLocationAtElevation(e,t){return this.screenPointToLocation(e)}isPointOnMapSurface(e,t){let n=this._cameraPosition;return!!maplibre_gl_rl(n,this.getRayDirectionFromPixel(e))}getRayDirectionFromPixel(e){let t=maplibre_gl_shared_$e();t[0]=e.x/this.width*2-1,t[1]=(e.y/this.height*2-1)*-1,t[2]=1,t[3]=1,maplibre_gl_shared_Ne(t,t,this._globeViewProjMatrixF64Inverted),t[0]/=t[3],t[1]/=t[3],t[2]/=t[3];let n=maplibre_gl_shared_et();n[0]=t[0]-this._cameraPosition[0],n[1]=t[1]-this._cameraPosition[1],n[2]=t[2]-this._cameraPosition[2];let r=maplibre_gl_shared_et();return maplibre_gl_shared_j(r,n),r}isSurfacePointVisible(e){let t=this._cachedClippingPlane;return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]>=0}isSurfacePointOnScreen(e){if(!this.isSurfacePointVisible(e))return!1;let t=maplibre_gl_shared_$e();return maplibre_gl_shared_Ne(t,[...e,1],this._globeViewProjMatrixF64),t[0]/=t[3],t[1]/=t[3],t[2]/=t[3],t[0]>-1&&t[0]<1&&t[1]>-1&&t[1]<1&&t[2]>-1&&t[2]<1}unprojectScreenPoint(e){let t=this._cameraPosition,n=this.getRayDirectionFromPixel(e),r=maplibre_gl_rl(t,n);if(r){let e=maplibre_gl_shared_et();maplibre_gl_shared_de(e,t,[n[0]*r.tMin,n[1]*r.tMin,n[2]*r.tMin]);let i=maplibre_gl_shared_et();return maplibre_gl_shared_j(i,e),maplibre_gl_Hc(i)}let i=this._cachedClippingPlane,a=i[0]*n[0]+i[1]*n[1]+i[2]*n[2],o=-maplibre_gl_shared_at(i,t)/a,s=maplibre_gl_shared_et();if(o>0)maplibre_gl_shared_de(s,t,[n[0]*o,n[1]*o,n[2]*o]);else{let e=maplibre_gl_shared_et();maplibre_gl_shared_de(e,t,[n[0]*2,n[1]*2,n[2]*2]);let r=maplibre_gl_shared_at(this._cachedClippingPlane,e);maplibre_gl_shared_Ee(s,e,[this._cachedClippingPlane[0]*r,this._cachedClippingPlane[1]*r,this._cachedClippingPlane[2]*r])}let c=maplibre_gl_Yc(i);return maplibre_gl_Hc(maplibre_gl_Xc(c.center,c.radius,s))}getProjectionDataForCustomLayer(e=!0){let t=this.getProjectionData({overscaledTileID:new maplibre_gl_shared_fb(0,0,0,0,0),applyGlobeMatrix:e});return t.tileMercatorCoords=[0,0,1,1],t}getFastPathSimpleProjectionMatrix(e){}};function maplibre_gl_fl(e,t){let n=maplibre_gl_shared_et();maplibre_gl_shared_me(n,e.origin,e.direction,t);let r=maplibre_gl_shared_le(n),i=maplibre_gl_shared_et();maplibre_gl_shared_pe(i,n,1/r);let a=maplibre_gl_Hc(i),o=maplibre_gl_shared_Hp.fromLngLat(a),s=new maplibre_gl_shared_Hp(o.x,maplibre_gl_shared_yt(o.y,0,.999999999)),c=maplibre_gl_yc(e.index,e.exaggeration,s.x,s.y),l=Math.abs(a.lat)>85.051129?0:c.elevation;return{sample:{...c,elevation:l},radius:r,mercator:s}}function maplibre_gl_pl(e,t){let{sample:n,radius:r}=maplibre_gl_fl(e,t);return maplibre_gl_bc(n,(r-1)*maplibre_gl_shared_jp)}var maplibre_gl_ml=class e{get pixelsToClipSpaceMatrix(){return this._helper.pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._helper.clipSpaceToPixelsMatrix}get pixelsToGLUnits(){return this._helper.pixelsToGLUnits}get centerOffset(){return this._helper.centerOffset}get size(){return this._helper.size}get rotationMatrix(){return this._helper.rotationMatrix}get centerPoint(){return this._helper.centerPoint}get pixelsPerMeter(){return this._helper.pixelsPerMeter}setMinZoom(e){this._helper.setMinZoom(e)}setMaxZoom(e){this._helper.setMaxZoom(e)}setMinPitch(e){this._helper.setMinPitch(e)}setMaxPitch(e){this._helper.setMaxPitch(e)}setRenderWorldCopies(e){this._helper.setRenderWorldCopies(e)}setBearing(e){this._helper.setBearing(e)}setPitch(e){this._helper.setPitch(e)}setRoll(e){this._helper.setRoll(e)}setFov(e){this._helper.setFov(e)}setZoom(e){this._helper.setZoom(e)}setCenter(e){this._helper.setCenter(e)}setElevation(e){this._helper.setElevation(e)}setMinElevationForCurrentTile(e){this._helper.setMinElevationForCurrentTile(e)}setPadding(e){this._helper.setPadding(e)}interpolatePadding(e,t,n){this._helper.interpolatePadding(e,t,n)}isPaddingEqual(e){return this._helper.isPaddingEqual(e)}resize(e,t,n=!0){this._helper.resize(e,t,n)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(e){this._helper.setMaxBounds(e)}setConstrainOverride(e){this._helper.setConstrainOverride(e)}overrideNearFarZ(e,t){this._helper.overrideNearFarZ(e,t)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(e){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),e)}get tileSize(){return this._helper.tileSize}get tileZoom(){return this._helper.tileZoom}get scale(){return this._helper.scale}get worldSize(){return this._helper.worldSize}get width(){return this._helper.width}get height(){return this._helper.height}get lngRange(){return this._helper.lngRange}get latRange(){return this._helper.latRange}get minZoom(){return this._helper.minZoom}get maxZoom(){return this._helper.maxZoom}get zoom(){return this._helper.zoom}get center(){return this._helper.center}get minPitch(){return this._helper.minPitch}get maxPitch(){return this._helper.maxPitch}get pitch(){return this._helper.pitch}get pitchInRadians(){return this._helper.pitchInRadians}get roll(){return this._helper.roll}get rollInRadians(){return this._helper.rollInRadians}get bearing(){return this._helper.bearing}get bearingInRadians(){return this._helper.bearingInRadians}get fov(){return this._helper.fov}get fovInRadians(){return this._helper.fovInRadians}get elevation(){return this._helper.elevation}get minElevationForCurrentTile(){return this._helper.minElevationForCurrentTile}get padding(){return this._helper.padding}get unmodified(){return this._helper.unmodified}get renderWorldCopies(){return this._helper.renderWorldCopies}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}get constrainOverride(){return this._helper.constrainOverride}get nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}get isGlobeRendering(){return this._globeness>0}setTransitionState(e){this._globeness=e,this._calcMatrices(),this._verticalPerspectiveTransform.getCoveringTilesDetailsProvider().prepareNextFrame(),this._mercatorTransform.getCoveringTilesDetailsProvider().prepareNextFrame()}get currentTransform(){return this.isGlobeRendering?this._verticalPerspectiveTransform:this._mercatorTransform}constructor(e){this._globeness=1,this.defaultConstrain=(e,t)=>this.currentTransform.defaultConstrain(e,t),this.applyConstrain=(e,t)=>this._helper.applyConstrain(e,t),this._helper=new maplibre_gl_fc({calcMatrices:()=>this._calcMatrices(),defaultConstrain:(e,t)=>this.defaultConstrain(e,t)},e),this._globeness=1,this._mercatorTransform=new maplibre_gl_Sc,this._verticalPerspectiveTransform=new maplibre_gl_dl}clone(){let t=new e;return t._globeness=this._globeness,t.apply(this,!1),t}apply(e,t){this._helper.apply(e,t),this._mercatorTransform.apply(this,!1),this._verticalPerspectiveTransform.apply(this,!1)}get projectionMatrix(){return this.currentTransform.projectionMatrix}get modelViewProjectionMatrix(){return this.currentTransform.modelViewProjectionMatrix}get inverseProjectionMatrix(){return this.currentTransform.inverseProjectionMatrix}get cameraPosition(){return this.currentTransform.cameraPosition}getProjectionData(e){let t=this._mercatorTransform.getProjectionData(e),n=this._verticalPerspectiveTransform.getProjectionData(e);return{mainMatrix:this.isGlobeRendering?n.mainMatrix:t.mainMatrix,clippingPlane:n.clippingPlane,tileMercatorCoords:n.tileMercatorCoords,projectionTransition:e.applyGlobeMatrix?this._globeness:0,fallbackMatrix:t.fallbackMatrix,clipAntimeridian:n.clipAntimeridian}}isLocationOccluded(e){return this.currentTransform.isLocationOccluded(e)}transformLightDirection(e){return this.currentTransform.transformLightDirection(e)}getPixelScale(){return maplibre_gl_shared_pt(this._mercatorTransform.getPixelScale(),this._verticalPerspectiveTransform.getPixelScale(),this._globeness)}getCircleRadiusCorrection(){return maplibre_gl_shared_pt(this._mercatorTransform.getCircleRadiusCorrection(),this._verticalPerspectiveTransform.getCircleRadiusCorrection(),this._globeness)}getPitchedTextCorrection(e,t,n){let r=this._mercatorTransform.getPitchedTextCorrection(e,t,n),i=this._verticalPerspectiveTransform.getPitchedTextCorrection(e,t,n);return maplibre_gl_shared_pt(r,i,this._globeness)}projectTileCoordinates(e,t,n,r){return this.currentTransform.projectTileCoordinates(e,t,n,r)}_calcMatrices(){this._helper._width&&this._helper._height&&(this._verticalPerspectiveTransform.apply(this,!1),this._helper._nearZ=this._verticalPerspectiveTransform.nearZ,this._helper._farZ=this._verticalPerspectiveTransform.farZ,this._mercatorTransform.apply(this,!0,this.isGlobeRendering),this._helper._nearZ=this._mercatorTransform.nearZ,this._helper._farZ=this._mercatorTransform.farZ)}calculateFogMatrix(e){return this.currentTransform.calculateFogMatrix(e)}getVisibleUnwrappedCoordinates(e){return this.currentTransform.getVisibleUnwrappedCoordinates(e)}getCameraFrustum(){return this.currentTransform.getCameraFrustum()}getClippingPlane(){return this.currentTransform.getClippingPlane()}getCoveringTilesDetailsProvider(){return this.currentTransform.getCoveringTilesDetailsProvider()}recalculateZoomAndCenter(e){this.currentTransform.recalculateZoomAndCenter(e)}maxPitchScaleFactor(){return this._mercatorTransform.maxPitchScaleFactor()}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return this.currentTransform.getCameraAltitude()}getCameraLngLat(){return this.currentTransform.getCameraLngLat()}lngLatToCameraDepth(e,t){return this.currentTransform.lngLatToCameraDepth(e,t)}populateCache(e){this._mercatorTransform.populateCache(e),this._verticalPerspectiveTransform.populateCache(e)}getBounds(){return this.currentTransform.getBounds()}calculateCenterFromCameraLngLatAlt(e,t,n,r){return this._helper.calculateCenterFromCameraLngLatAlt(e,t,n,r)}calculateCameraOptionsFromTo(e,t,n,r){return this.currentTransform.calculateCameraOptionsFromTo(e,t,n,r)}setLocationAtPoint(e,t,n){if(!this.isGlobeRendering){this._mercatorTransform.setLocationAtPoint(e,t,n),this.apply(this._mercatorTransform,!1);return}this._verticalPerspectiveTransform.setLocationAtPoint(e,t,n),this.apply(this._verticalPerspectiveTransform,!1)}locationToScreenPoint(e,t){return this.currentTransform.locationToScreenPoint(e,t)}screenPointToMercatorCoordinate(e,t){return this.currentTransform.screenPointToMercatorCoordinate(e,t)}screenTerrainPointToMercatorCoordinate(e,t){return this.currentTransform.screenTerrainPointToMercatorCoordinate(e,t)}screenPointToLocation(e,t){return this.currentTransform.screenPointToLocation(e,t)}screenPointToLocationAtElevation(e,t){return this.currentTransform.screenPointToLocationAtElevation(e,t)}isPointOnMapSurface(e,t){return this.currentTransform.isPointOnMapSurface(e,t)}getRayDirectionFromPixel(e){return this._verticalPerspectiveTransform.getRayDirectionFromPixel(e)}getProjectionDataForCustomLayer(e=!0){let t=this._mercatorTransform.getProjectionDataForCustomLayer(e);if(!this.isGlobeRendering)return t;let n=this._verticalPerspectiveTransform.getProjectionDataForCustomLayer(e);return n.fallbackMatrix=t.mainMatrix,n.projectionTransition=this._globeness,n}getFastPathSimpleProjectionMatrix(e){return this.currentTransform.getFastPathSimpleProjectionMatrix(e)}},maplibre_gl_hl=class e{get useGlobeControls(){return!0}handlePanInertia(e,t){let n=maplibre_gl_el(e,t);return Math.abs(n.lng-t.center.lng)>180&&(n.lng=t.center.lng+179.5*Math.sign(n.lng-t.center.lng)),{easingCenter:n,easingOffset:new maplibre_gl_shared_l(0,0)}}handleMapControlsRollPitchBearingZoom(e,t){let n=e.around,r=t.screenPointToLocation(n);e.bearingDelta&&t.setBearing(t.bearing+e.bearingDelta),e.pitchDelta&&t.setPitch(t.pitch+e.pitchDelta),e.rollDelta&&t.setRoll(t.roll+e.rollDelta);let i=t.zoom;e.zoomDelta&&t.setZoom(t.zoom+e.zoomDelta);let a=t.zoom-i;if(a===0)return;let o=maplibre_gl_shared_lt(t.center.lng,r.lng),s=o/(Math.abs(o/180)+1),c=maplibre_gl_shared_lt(t.center.lat,r.lat),l=t.getRayDirectionFromPixel(n),u=t.cameraPosition,d=dist_maplibre_gl_shared_e(u,l)*-1,f=maplibre_gl_shared_et();maplibre_gl_shared_de(f,u,[l[0]*d,l[1]*d,l[2]*d]);let p=maplibre_gl_shared_le(f),m=p-1,h=Math.exp(-Math.max(m-.3,0)*.5),g=maplibre_gl_shared_ft(p,.95,.999,0,1),_=maplibre_gl_Bc(t.worldSize,t.center.lat)/Math.min(t.width,t.height),v=maplibre_gl_shared_ft(_,.9,.5,1,.25),y=Math.min(h,maplibre_gl_shared_pt(1,v,g)),b=(1-maplibre_gl_shared_Dt(-a))*y,x=t.center.lat,S=t.zoom,C=new maplibre_gl_shared_Mp(t.center.lng+s*b,maplibre_gl_shared_yt(t.center.lat+c*b,-maplibre_gl_shared_on,maplibre_gl_shared_on));t.setLocationAtPoint(r,n);let w=t.center,T=maplibre_gl_shared_ft(Math.abs(o),45,85,0,1),E=Math.max(T,g)**.25,ee=maplibre_gl_shared_lt(w.lng,C.lng),D=maplibre_gl_shared_lt(w.lat,C.lat);t.setCenter(new maplibre_gl_shared_Mp(w.lng+ee*E,w.lat+D*E).wrap()),t.setZoom(S+maplibre_gl_Qc(x,t.center.lat))}handleMapControlsPan(e,t,n){e.panDelta&&maplibre_gl_qc(t,n,t.isPointOnMapSurface(e.around)?e.around:t.centerPoint,e.panDelta)}cameraForBoxAndBearing(t,n,r,i,a){let o=maplibre_gl_Dc(t,n,r,i,a),s=n.left/a.width*2-1,c=(a.width-n.right)/a.width*2-1,l=n.top/a.height*-2+1,u=(a.height-n.bottom)/a.height*-2+1,d=maplibre_gl_shared_lt(r.getWest(),r.getEast())<0,f=d?r.getEast():r.getWest(),p=d?r.getWest():r.getEast(),m=Math.max(r.getNorth(),r.getSouth()),h=Math.min(r.getNorth(),r.getSouth()),g=f+maplibre_gl_shared_lt(f,p)*.5,_=m+maplibre_gl_shared_lt(m,h)*.5,v=a.clone();v.setCenter(o.center),v.setBearing(o.bearing),v.setPitch(0),v.setRoll(0),v.setZoom(o.zoom);let y=v.modelViewProjectionMatrix,b=[maplibre_gl_zc(r.getNorthWest()),maplibre_gl_zc(r.getNorthEast()),maplibre_gl_zc(r.getSouthWest()),maplibre_gl_zc(r.getSouthEast()),maplibre_gl_zc(new maplibre_gl_shared_Mp(p,_)),maplibre_gl_zc(new maplibre_gl_shared_Mp(f,_)),maplibre_gl_zc(new maplibre_gl_shared_Mp(g,m)),maplibre_gl_zc(new maplibre_gl_shared_Mp(g,h))],x=maplibre_gl_zc(o.center),S=1/0;for(let t of b)s<0&&(S=e.getLesserNonNegativeNonNull(S,e.solveVectorScale(t,x,y,`x`,s))),c>0&&(S=e.getLesserNonNegativeNonNull(S,e.solveVectorScale(t,x,y,`x`,c))),l>0&&(S=e.getLesserNonNegativeNonNull(S,e.solveVectorScale(t,x,y,`y`,l))),u<0&&(S=e.getLesserNonNegativeNonNull(S,e.solveVectorScale(t,x,y,`y`,u)));if(!Number.isFinite(S)||S===0){maplibre_gl_Tc();return}return o.zoom=Math.min(v.zoom+maplibre_gl_shared_Ot(S),t.maxZoom),o}handleJumpToCenterZoom(e,t){let n=e.center.lat,r=e.applyConstrain(t.center?maplibre_gl_shared_Mp.convert(t.center):e.center,e.zoom).center;e.setCenter(r.wrap());let i=t.zoom===void 0?e.zoom+maplibre_gl_Qc(n,r.lat):+t.zoom;e.zoom!==i&&e.setZoom(i)}handleEaseTo(e,t){let n=e.zoom,r=e.center,i=e.padding,a={roll:e.roll,pitch:e.pitch,bearing:e.bearing},o={roll:t.roll===void 0?e.roll:t.roll,pitch:t.pitch===void 0?e.pitch:t.pitch,bearing:t.bearing===void 0?e.bearing:t.bearing},s=t.zoom!==void 0,c=!e.isPaddingEqual(t.padding),l=!1,u=t.center?maplibre_gl_shared_Mp.convert(t.center):r,d=e.applyConstrain(u,n).center;maplibre_gl_uc(e,d);let f=e.clone();f.setCenter(d),f.setZoom(s?+t.zoom:n+maplibre_gl_Qc(r.lat,u.lat)),f.setBearing(t.bearing);let p=new maplibre_gl_shared_l(maplibre_gl_shared_yt(e.centerPoint.x+t.offsetAsPoint.x,0,e.width),maplibre_gl_shared_yt(e.centerPoint.y+t.offsetAsPoint.y,0,e.height));f.setLocationAtPoint(d,p);let m=(t.offset&&t.offsetAsPoint.mag())>0?f.center:d,h=s?+t.zoom:n+maplibre_gl_Qc(r.lat,m.lat),g=n+maplibre_gl_Qc(r.lat,0),_=h+maplibre_gl_Qc(m.lat,0),v=maplibre_gl_shared_lt(r.lng,m.lng),y=maplibre_gl_shared_lt(r.lat,m.lat),b=maplibre_gl_shared_Dt(_-g);return l=h!==n,{easeFunc:n=>{if(maplibre_gl_shared_tn(a,o)||maplibre_gl_Ec({startEulerAngles:a,endEulerAngles:o,tr:e,k:n,useSlerp:a.roll!=o.roll}),c&&e.interpolatePadding(i,t.padding,n),t.around)maplibre_gl_shared_Ft(`Easing around a point is not supported under globe projection.`),e.setLocationAtPoint(t.around,t.aroundPoint);else{let t=n*(_>g?Math.min(2,b):Math.max(.5,b))**(1-n),i=maplibre_gl_nl(r,v,y,t);e.setCenter(i.wrap())}if(l){let t=maplibre_gl_shared_$r.number(g,_,n)+maplibre_gl_Qc(0,e.center.lat);e.setZoom(t)}},isZooming:l,elevationCenter:m}}handleFlyTo(e,t){let n=t.zoom!==void 0,r=e.center,i=e.zoom,a=e.padding,o=!e.isPaddingEqual(t.padding),s=e.applyConstrain(maplibre_gl_shared_Mp.convert(t.center||t.locationAtOffset),i).center,c=n?+t.zoom:e.zoom+maplibre_gl_Qc(e.center.lat,s.lat),l=e.clone();l.setCenter(s),l.setZoom(c),l.setBearing(t.bearing);let u=new maplibre_gl_shared_l(maplibre_gl_shared_yt(e.centerPoint.x+t.offsetAsPoint.x,0,e.width),maplibre_gl_shared_yt(e.centerPoint.y+t.offsetAsPoint.y,0,e.height));l.setLocationAtPoint(s,u);let d=l.center;maplibre_gl_uc(e,d);let f=maplibre_gl_Fc(e,r,d),p=i+maplibre_gl_Qc(r.lat,0),m=c+maplibre_gl_Qc(d.lat,0),h=maplibre_gl_shared_Dt(m-p),g=typeof t.minZoom==`number`?+t.minZoom:e.minZoom,_=Math.max(g,e.minZoom)+maplibre_gl_Qc(d.lat,0),v=Math.min(_,p,m)+maplibre_gl_Qc(0,d.lat),y=e.applyConstrain(d,v).zoom+maplibre_gl_Qc(d.lat,0),b=maplibre_gl_shared_Dt(y-p),x=maplibre_gl_shared_lt(r.lng,d.lng),S=maplibre_gl_shared_lt(r.lat,d.lat);return{easeFunc:(n,i,s,l)=>{let u=maplibre_gl_nl(r,x,S,s);o&&e.interpolatePadding(a,t.padding,n);let f=n===1?d:u;e.setCenter(f.wrap());let m=p+maplibre_gl_shared_Ot(i);e.setZoom(n===1?c:m+maplibre_gl_Qc(0,f.lat))},scaleOfZoom:h,targetCenter:d,scaleOfMinZoom:b,pixelPathLength:f}}static solveVectorScale(e,t,n,r,i){let a=i,o=r===`x`?[n[0],n[4],n[8],n[12]]:[n[1],n[5],n[9],n[13]],s=[n[3],n[7],n[11],n[15]],c=e[0]*o[0]+e[1]*o[1]+e[2]*o[2],l=e[0]*s[0]+e[1]*s[1]+e[2]*s[2],u=t[0]*o[0]+t[1]*o[1]+t[2]*o[2],d=t[0]*s[0]+t[1]*s[1]+t[2]*s[2],f=(u+o[3]-a*d-a*s[3])/(u-c-a*d+a*l);return u+a*l===c+a*d||s[3]*(c-u)+o[3]*(d-l)+c*d===u*l?null:f}static getLesserNonNegativeNonNull(e,t){return t!==null&&t>=0&&t<e?t:e}},maplibre_gl_gl=class{constructor(e){this._globe=e,this._mercatorCameraHelper=new maplibre_gl_Oc,this._verticalPerspectiveCameraHelper=new maplibre_gl_hl}get useGlobeControls(){return this._globe.useGlobeRendering}get currentHelper(){return this.useGlobeControls?this._verticalPerspectiveCameraHelper:this._mercatorCameraHelper}handlePanInertia(e,t){return this.currentHelper.handlePanInertia(e,t)}handleMapControlsRollPitchBearingZoom(e,t){this.currentHelper.handleMapControlsRollPitchBearingZoom(e,t)}handleMapControlsPan(e,t,n){this.currentHelper.handleMapControlsPan(e,t,n)}cameraForBoxAndBearing(e,t,n,r,i){return this.currentHelper.cameraForBoxAndBearing(e,t,n,r,i)}handleJumpToCenterZoom(e,t){this.currentHelper.handleJumpToCenterZoom(e,t)}handleEaseTo(e,t){return this.currentHelper.handleEaseTo(e,t)}handleFlyTo(e,t){return this.currentHelper.handleFlyTo(e,t)}};function maplibre_gl_l(e,t,n){let r={constrainOverride:t};if(Array.isArray(e)){let t=new maplibre_gl_Nc({type:e},n);return{projection:t,transform:new maplibre_gl_ml(r),cameraHelper:new maplibre_gl_gl(t)}}switch(e){case`mercator`:return{projection:new maplibre_gl_cc,transform:new maplibre_gl_Sc(r),cameraHelper:new maplibre_gl_Oc};case`globe`:{let e=new maplibre_gl_Nc({type:[`interpolate`,[`linear`],[`zoom`],11,`vertical-perspective`,12,`mercator`]},{});return{projection:e,transform:new maplibre_gl_ml(r),cameraHelper:new maplibre_gl_gl(e)}}case`vertical-perspective`:return{projection:new maplibre_gl_Mc,transform:new maplibre_gl_dl(r),cameraHelper:new maplibre_gl_hl};default:return maplibre_gl_shared_Ft(`Unknown projection name: ${e}. Falling back to mercator projection.`),{projection:new maplibre_gl_cc,transform:new maplibre_gl_Sc(r),cameraHelper:new maplibre_gl_Oc}}}const maplibre_gl_vl=maplibre_gl_i();var maplibre_gl_yl=class extends maplibre_gl_shared_Fn{constructor(e,t={}){super(),this._rtlPluginLoaded=()=>{for(let e in this.tileManagers){let t=this.tileManagers[e].getSource().type;(t===`vector`||t===`geojson`)&&this.tileManagers[e].reload()}},this.map=e,this.dispatcher=new maplibre_gl_aa(maplibre_gl_na(),e._getMapId()),this.dispatcher.registerMessageHandler(`GG`,(e,t)=>this.getGlyphs(e,t)),this.dispatcher.registerMessageHandler(`GI`,(e,t)=>this.getImages(e,t)),this.dispatcher.registerMessageHandler(`GDA`,(e,t)=>this.getDashes(e,t)),this.imageManager=new maplibre_gl_Si,this.imageManager.setEventedParent(this),this.imageManager.setMissingImageResolver(e._missingStyleImageResolver),this.patternAtlas=new maplibre_gl_Ci(this.imageManager);let n=e._container?.lang||typeof document<`u`&&document.documentElement?.lang||void 0;this.glyphManager=new maplibre_gl_Ri(e._requestManager,t.localIdeographFontFamily,n),this.lineAtlas=new maplibre_gl_Gi(256,512),this.crossTileSymbolIndex=new maplibre_gl_Ys,this._setInitialValues(),this._resetUpdates(),this.dispatcher.broadcast(`SR`,maplibre_gl_shared_Sn()),maplibre_gl_mo().on(maplibre_gl_uo,this._rtlPluginLoaded),this.on(`data`,e=>{if(e.dataType!==`source`||e.sourceDataType!==`metadata`)return;let t=this.tileManagers[e.sourceId];if(!t)return;let n=t.getSource();if(n?.vectorLayerIds)for(let e in this._layers){let t=this._layers[e];t.source===n.id&&this._validateLayer(t)}})}_setInitialValues(){this._layers={},this._order=[],this.tileManagers={},this.zoomHistory=new maplibre_gl_shared_Cc,this._imagesListDirty=!1,this._globalState={},this._serializedLayers={},this.stylesheet=null,this.light=null,this.sky=null,this.projection&&(this.projection.destroy(),delete this.projection),this._loaded=!1,this._changed=!1,this._updatedLayers={},this._updatedSources={},this._changedImages={},this._glyphsDidChange=!1,this._updatedPaintProps={},this._layerOrderChanged=!1,this._symbolPlacementTriggered=!1,this._placedProjectionTransition=void 0,this.crossTileSymbolIndex=new((this.crossTileSymbolIndex?.constructor)||Object),this.pauseablePlacement=void 0,this.placement=void 0,this.z=0}setGlobalStateProperty(e,t){this._checkLoaded();let n=t===null?this.stylesheet.state?.[e]?.default??null:t;if(maplibre_gl_shared_Mt(n,this._globalState[e]))return this;this._globalState[e]=n,this._applyGlobalStateChanges([e])}getGlobalState(){return this._globalState}setGlobalState(e){this._checkLoaded();let t=[];for(let n in e)maplibre_gl_shared_Mt(this._globalState[n],e[n].default)||(t.push(n),this._globalState[n]=e[n].default);this._applyGlobalStateChanges(t)}_applyGlobalStateChanges(e){if(e.length===0)return;let t=new Set,n={};for(let r of e){n[r]=this._globalState[r];for(let e in this._layers){let n=this._layers[e],i=n.getLayoutAffectingGlobalStateRefs(),a=n.getPaintAffectingGlobalStateRefs(),o=n.getVisibilityAffectingGlobalStateRefs();if(i.has(r)&&t.add(n.source),a.has(r))for(let{name:e,value:t}of a.get(r))this._updatePaintProperty(n,e,t);o?.has(r)&&(n.recalculateVisibility(),this._updateLayer(n))}}this.dispatcher.broadcast(`UGS`,n);for(let e in this.tileManagers)t.has(e)&&(this._reloadSource(e),this._changed=!0)}async loadURL(e,n={},r){this.fire(new maplibre_gl_Yr(`dataloading`)),n.validate=typeof n.validate!=`boolean`||n.validate,this._loadStyleRequest=new AbortController;let i=this._loadStyleRequest;try{let t=await this.map._requestManager.transformRequest(e,`Style`);maplibre_gl_shared_hn(i.signal);let a=await maplibre_gl_shared_Dn(t,i);this._loadStyleRequest===i&&(this._loadStyleRequest=null),this._load(a.data,n,r)}catch(e){this._loadStyleRequest===i&&(this._loadStyleRequest=null),e&&!i.signal.aborted&&this.fire(new maplibre_gl_shared_Pn(maplibre_gl_shared_Qe(e)))}}loadJSON(e,t={},n){this.fire(new maplibre_gl_Yr(`dataloading`)),this._frameRequest=new AbortController,maplibre_gl_Br.frameAsync(this._frameRequest,this.map._ownerWindow).then(()=>{this._frameRequest=null,t.validate=t.validate!==!1,this._load(e,t,n)}).catch(()=>{})}loadEmpty(){this.fire(new maplibre_gl_Yr(`dataloading`)),this._load(maplibre_gl_vl,{validate:!1})}_load(e,t,n){let r=t.transformStyle?t.transformStyle(n,e):e;if(!(t.validate&&maplibre_gl_shared_fc(this,r))){r={...r},this._loaded=!0,this.stylesheet=r;for(let e in r.sources)this.addSource(e,r.sources[e],{validate:!1});r.sprite?this._loadSprite(r.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(r.glyphs),this.glyphManager.setFontFaces(r[`font-faces`]),this._createLayers(),this.light=new maplibre_gl_Vi(this.stylesheet.light??{},this._globalState),this._setProjectionInternal(this.stylesheet.projection?.type||`mercator`),this.sky=new maplibre_gl_Wi(this.stylesheet.sky,this._globalState),this.map.setTerrain(this.stylesheet.terrain??null,{validate:!1}),this.fire(new maplibre_gl_Yr(`data`)),this.fire(new maplibre_gl_Jr)}}_createLayers(){let e=maplibre_gl_ai(this.stylesheet.layers);this.setGlobalState(this.stylesheet.state??null),this.dispatcher.broadcast(`SL`,e),this._order=e.map(e=>e.id),this._layers={},this._serializedLayers=null;for(let t of e){let e=maplibre_gl_shared_ib(t,this._globalState);if(e.setEventedParent(this,{layer:{id:t.id}}),this._layers[t.id]=e,maplibre_gl_shared_Gc(e)&&this.tileManagers[e.source]){let n=t.paint?.[`raster-fade-duration`]??e.paint.get(`raster-fade-duration`);this.tileManagers[e.source].setRasterFadeDuration(n)}}}async _loadSprite(e,t=!1,n=void 0){this.imageManager.setLoaded(!1);let r=new AbortController;this._spriteRequest=r;let i;try{let n=await maplibre_gl_bi(e,this.map._requestManager,this.map.getPixelRatio(),r);if(!n)return;for(let e in n){let{loaded:r,removed:i}=this.imageManager.setSpriteImages(e,n[e]);this._markImagesChanged(i),t&&this._markImagesChanged(r)}}catch(e){i=e,r.signal.aborted||this.fire(new maplibre_gl_shared_Pn(i))}finally{this._spriteRequest=null,this.imageManager.setLoaded(!0),t&&(this._changed=!0),this.dispatcher.broadcast(`SI`,this.imageManager.listImages()),this.fire(new maplibre_gl_Yr(`data`)),n?.(i)}}_unloadSprite(){this._markImagesChanged(this.imageManager.removeAllSpriteImages()),this._imagesListDirty=!0,this._changed=!0,this.fire(new maplibre_gl_Yr(`data`))}_validateLayer(e){let t=this.tileManagers[e.source];if(!t)return;let n=e.sourceLayer;if(!n)return;let r=t.getSource();(r.type===`geojson`||r.vectorLayerIds&&!r.vectorLayerIds.includes(n))&&this.fire(new maplibre_gl_shared_Pn(Error(`Source layer "${n}" does not exist on source "${r.id}" as specified by style layer "${e.id}".`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(let e in this.tileManagers)if(!this.tileManagers[e].loaded())return!1;return this.imageManager.isLoaded()}_serializeByIds(e,t=!1){let n=this._serializedAllLayers();if(!e||e.length===0)return Object.values(t?maplibre_gl_shared_Nt(n):n);let r=[];for(let i of e)if(n[i]){let e=t?maplibre_gl_shared_Nt(n[i]):n[i];r.push(e)}return r}_serializedAllLayers(){let e=this._serializedLayers;if(e)return e;e=this._serializedLayers={};let t=Object.keys(this._layers);for(let n of t){let t=this._layers[n];t.type!==`custom`&&(e[n]=t.serialize())}return e}hasTransitions(){if(this.light?.hasTransition()||this.sky?.hasTransition()||this.projection?.hasTransition())return!0;for(let e in this.tileManagers)if(this.tileManagers[e].hasTransition())return!0;for(let e in this._layers)if(this._layers[e].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw Error(`Style is not done loading.`)}update(e){if(!this._loaded)return;let t=this._changed;if(t){this._imagesListDirty&&=(this.dispatcher.broadcast(`SI`,this.imageManager.listImages()),!1);let t=Object.keys(this._updatedLayers),n=Object.keys(this._removedLayers);(t.length||n.length)&&this._updateWorkerLayers(t,n);for(let e in this._updatedSources){let t=this._updatedSources[e];if(t===`reload`)this._reloadSource(e);else if(t===`clear`)this._clearSource(e);else throw Error(`Invalid action ${t}`)}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(let t in this._updatedPaintProps)this._layers[t].updateTransitions(e);this._resetUpdates()}let n={};for(let e in this.tileManagers){let t=this.tileManagers[e];n[e]=t.used,t.used=!1}let r=this.imageManager.listImages();for(let t of this._order){let n=this._layers[t];n.recalculate(e,r),!n.isHidden(e.zoom)&&n.source&&(this.tileManagers[n.source].used=!0)}for(let e in n){let t=this.tileManagers[e];!!n[e]!=!!t.used&&t.fire(new maplibre_gl_K(`data`,{sourceDataType:`visibility`,sourceId:e}))}this.light.recalculate(e),this.sky.recalculate(e),this.projection.recalculate(e),this.z=e.zoom,t&&this.fire(new maplibre_gl_Yr(`data`))}_updateTilesForChangedImages(){let e=Object.keys(this._changedImages);if(e.length){for(let t in this.tileManagers)this.tileManagers[t].reloadTilesForDependencies([`icons`,`patterns`],e);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(let e in this.tileManagers)this.tileManagers[e].reloadTilesForDependencies([`glyphs`],[``]);this._glyphsDidChange=!1}}_updateWorkerLayers(e,t){this.dispatcher.broadcast(`UL`,{layers:this._serializeByIds(e,!1),removedIds:t})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(e,t={}){this._checkLoaded();let n=this.serialize();if(e=t.transformStyle?t.transformStyle(n,e):e,(t.validate??!0)&&maplibre_gl_shared_fc(this,e))return!1;e=maplibre_gl_shared_Nt(e),e.layers=maplibre_gl_ai(e.layers);let r=maplibre_gl_gi(n,e),i=this._getOperationsToPerform(r);if(i.unimplemented.length>0)throw Error(`Unimplemented: ${i.unimplemented.join(`, `)}.`);if(i.operations.length===0)return!1;for(let e of i.operations)e();return this.stylesheet=e,this._serializedLayers=null,this.fire(new maplibre_gl_Jr({style:this})),!0}_getOperationsToPerform(e){let t=[],n=[];for(let r of e)switch(r.command){case`setCenter`:case`setZoom`:case`setBearing`:case`setPitch`:case`setRoll`:continue;case`addLayer`:t.push(()=>this.addLayer.apply(this,r.args));break;case`removeLayer`:t.push(()=>this.removeLayer.apply(this,r.args));break;case`setPaintProperty`:t.push(()=>this.setPaintProperty.apply(this,r.args));break;case`setLayoutProperty`:t.push(()=>this.setLayoutProperty.apply(this,r.args));break;case`setFilter`:t.push(()=>this.setFilter.apply(this,r.args));break;case`addSource`:t.push(()=>this.addSource.apply(this,r.args));break;case`removeSource`:t.push(()=>this.removeSource.apply(this,r.args));break;case`setLayerZoomRange`:t.push(()=>this.setLayerZoomRange.apply(this,r.args));break;case`setLight`:t.push(()=>this.setLight.apply(this,r.args));break;case`setGeoJSONSourceData`:t.push(()=>this.setGeoJSONSourceData.apply(this,r.args));break;case`setGlyphs`:t.push(()=>this.setGlyphs.apply(this,r.args));break;case`setFontFaces`:t.push(()=>this.setFontFaces.apply(this,r.args));break;case`setSprite`:t.push(()=>this.setSprite.apply(this,r.args));break;case`setTerrain`:t.push(()=>this.map.setTerrain.apply(this,r.args));break;case`setSky`:t.push(()=>this.setSky.apply(this,r.args));break;case`setProjection`:this.setProjection.apply(this,r.args);break;case`setGlobalState`:t.push(()=>this.setGlobalState.apply(this,r.args));break;case`setTransition`:t.push(()=>{});break;default:n.push(r.command)}return{operations:t,unimplemented:n}}addImage(e,t){if(this.getImage(e)){this.fire(new maplibre_gl_shared_Pn(Error(`An image named "${e}" already exists.`)));return}this.imageManager.addImage(e,t),this._afterImageUpdated(e)}updateImage(e,t){this.imageManager.updateImage(e,t)}getImage(e){return this.imageManager.getImage(e)}setMissingImageResolver(e){this.imageManager.setMissingImageResolver(e)}removeImage(e){if(!this.getImage(e)){this.fire(new maplibre_gl_shared_Pn(Error(`An image named "${e}" does not exist.`)));return}this.imageManager.removeImage(e),this._afterImageUpdated(e)}_markImagesChanged(e){for(let t of e)this._changedImages[t]=!0}_afterImageUpdated(e){this._changedImages[e]=!0,this._imagesListDirty=!0,this._changed=!0,this.fire(new maplibre_gl_Yr(`data`))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(e,t,n={}){if(this._checkLoaded(),this.tileManagers[e]!==void 0)throw Error(`Source "${e}" already exists.`);if(!t.type)throw Error(`The type property must be defined, but only the following properties were given: ${Object.keys(t).join(`, `)}.`);if(maplibre_gl_shared_uc.has(t.type)&&this._validate(maplibre_gl_shared_lc.source,`sources.${e}`,t,null,n))return;this.map?._collectResourceTiming&&(t.collectResourceTiming=!0);let r=this.tileManagers[e]=new maplibre_gl_Ho(e,t,this.dispatcher);r.style=this,r.setEventedParent(this,()=>({isSourceLoaded:r.loaded(),source:r.serialize(),sourceId:e})),r.onAdd(this.map),this._changed=!0}removeSource(e){if(this._checkLoaded(),this.tileManagers[e]===void 0)throw Error(`There is no source with this ID=${e}`);for(let t in this._layers)if(this._layers[t].source===e)return this.fire(new maplibre_gl_shared_Pn(Error(`Source "${e}" cannot be removed while layer "${t}" is using it.`)));let t=this.tileManagers[e];delete this.tileManagers[e],delete this._updatedSources[e],t.fire(new maplibre_gl_K(`data`,{sourceDataType:`metadata`,sourceId:e})),t.setEventedParent(null),t.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(e,t){if(this._checkLoaded(),this.tileManagers[e]===void 0)throw Error(`There is no source with this ID=${e}`);let n=this.tileManagers[e].getSource();if(n.type!==`geojson`)throw Error(`geojsonSource.type is ${n.type}, which is !== 'geojson`);n.setData(t),this._changed=!0}getSource(e){return this.tileManagers[e]?.getSource()}addLayer(e,t,n={}){this._checkLoaded();let r=e.id;if(this.getLayer(r)){this.fire(new maplibre_gl_shared_Pn(Error(`Layer "${r}" already exists on this map.`)));return}let i;if(e.type===`custom`){if(maplibre_gl_shared_pc(this,maplibre_gl_shared_tb(e)))return;i=maplibre_gl_shared_ib(e,this._globalState)}else{if(`source`in e&&typeof e.source==`object`&&(this.addSource(r,e.source),e=maplibre_gl_shared_Nt(e),e=maplibre_gl_shared_xt(e,{source:r})),this._validate(maplibre_gl_shared_lc.layer,`layers.${r}`,e,{arrayIndex:-1},n))return;i=maplibre_gl_shared_ib(e,this._globalState),this._validateLayer(i),i.setEventedParent(this,{layer:{id:r}})}let a=t?this._order.indexOf(t):this._order.length;if(t&&a===-1){this.fire(new maplibre_gl_shared_Pn(Error(`Cannot add layer "${r}" before non-existing layer "${t}".`)));return}if(this._order.splice(a,0,r),this._layerOrderChanged=!0,this._layers[r]=i,this._removedLayers[r]&&i.source&&i.type!==`custom`){let e=this._removedLayers[r];delete this._removedLayers[r],e.type===i.type?(this._updatedSources[i.source]=`reload`,this.tileManagers[i.source].pause()):this._updatedSources[i.source]=`clear`}this._updateLayer(i),i.onAdd&&i.onAdd(this.map)}moveLayer(e,t){if(this._checkLoaded(),this._changed=!0,!this._layers[e]){this.fire(new maplibre_gl_shared_Pn(Error(`The layer '${e}' does not exist in the map's style and cannot be moved.`)));return}if(e===t)return;if(t&&!this._order.includes(t)){this.fire(new maplibre_gl_shared_Pn(Error(`Cannot move layer "${e}" before non-existing layer "${t}".`)));return}let n=this._order.indexOf(e);this._order.splice(n,1);let r=t?this._order.indexOf(t):this._order.length;this._order.splice(r,0,e),this._layerOrderChanged=!0}removeLayer(e){this._checkLoaded();let t=this._layers[e];if(!t){this.fire(new maplibre_gl_shared_Pn(Error(`Cannot remove non-existing layer "${e}".`)));return}t.setEventedParent(null);let n=this._order.indexOf(e);this._order.splice(n,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[e]=t,delete this._layers[e],this._serializedLayers&&delete this._serializedLayers[e],delete this._updatedLayers[e],delete this._updatedPaintProps[e],t.type===`symbol`&&t.source&&this.tileManagers[t.source]?.resetMaxContentElevation(),t.onRemove&&t.onRemove(this.map)}getLayer(e){return this._layers[e]}getLayersOrder(){return[...this._order]}hasLayer(e){return e in this._layers}setLayerZoomRange(e,t,n){this._checkLoaded();let r=this.getLayer(e);if(!r){this.fire(new maplibre_gl_shared_Pn(Error(`Cannot set the zoom range of non-existing layer "${e}".`)));return}(r.minzoom!==t||r.maxzoom!==n)&&(t!=null&&(r.minzoom=t),n!=null&&(r.maxzoom=n),this._updateLayer(r))}setFilter(e,t,n={}){this._checkLoaded();let r=this.getLayer(e);if(!r){this.fire(new maplibre_gl_shared_Pn(Error(`Cannot filter non-existing layer "${e}".`)));return}if(!maplibre_gl_shared_Mt(r.filter,t)){if(t==null){r.setFilter(void 0),this._updateLayer(r);return}this._validate(maplibre_gl_shared_lc.filter,`layers.${r.id}.filter`,t,null,n)||(r.setFilter(maplibre_gl_shared_Nt(t)),this._updateLayer(r))}}getFilter(e){return maplibre_gl_shared_Nt(this.getLayer(e).filter)}setLayoutProperty(e,t,n,r={}){this._checkLoaded();let i=this.getLayer(e);if(!i){this.fire(new maplibre_gl_shared_Pn(Error(`Cannot style non-existing layer "${e}".`)));return}maplibre_gl_shared_Mt(i.getLayoutProperty(t),n)||(i.setLayoutProperty(t,n,r),this._updateLayer(i))}getLayoutProperty(e,t){let n=this.getLayer(e);if(!n){this.fire(new maplibre_gl_shared_Pn(Error(`Cannot get style of non-existing layer "${e}".`)));return}return n.getLayoutProperty(t)}setPaintProperty(e,t,n,r={}){this._checkLoaded();let i=this.getLayer(e);if(!i){this.fire(new maplibre_gl_shared_Pn(Error(`Cannot style non-existing layer "${e}".`)));return}maplibre_gl_shared_Mt(i.getPaintProperty(t),n)||this._updatePaintProperty(i,t,n,r)}_updatePaintProperty(e,t,n,r={}){e.setPaintProperty(t,n,r)&&this._updateLayer(e),maplibre_gl_shared_Gc(e)&&t===`raster-fade-duration`&&this.tileManagers[e.source].setRasterFadeDuration(n),this._changed=!0,this._updatedPaintProps[e.id]=!0,e.type===`symbol`&&this.triggerSymbolPlacement(),this._serializedLayers=null}getPaintProperty(e,t){return this.getLayer(e).getPaintProperty(t)}setFeatureState(e,t){this._checkLoaded();let n=e.source,r=e.sourceLayer,i=this.tileManagers[n];if(i===void 0){this.fire(new maplibre_gl_shared_Pn(Error(`The source '${n}' does not exist in the map's style.`)));return}let a=i.getSource().type;if(a===`geojson`&&r){this.fire(new maplibre_gl_shared_Pn(Error(`GeoJSON sources cannot have a sourceLayer parameter.`)));return}if(a===`vector`&&!r){this.fire(new maplibre_gl_shared_Pn(Error(`The sourceLayer parameter must be provided for vector source types.`)));return}if(e.id===void 0){this.fire(new maplibre_gl_shared_Pn(Error(`The feature id parameter must be provided.`)));return}let o=[`__proto__`,`constructor`,`prototype`];if(t&&Object.keys(t).some(e=>o.includes(e))){this.fire(new maplibre_gl_shared_Pn(Error(`The feature state should not include one of the following keys: ${o}`)));return}i.setFeatureState(r,e.id,t)}removeFeatureState(e,t){this._checkLoaded();let n=e.source,r=this.tileManagers[n];if(r===void 0){this.fire(new maplibre_gl_shared_Pn(Error(`The source '${n}' does not exist in the map's style.`)));return}let i=r.getSource().type,a=i===`vector`?e.sourceLayer:void 0;if(i===`vector`&&!a){this.fire(new maplibre_gl_shared_Pn(Error(`The sourceLayer parameter must be provided for vector source types.`)));return}if(t&&typeof e.id!=`string`&&typeof e.id!=`number`){this.fire(new maplibre_gl_shared_Pn(Error(`A feature id is required to remove its specific state property.`)));return}r.removeFeatureState(a,e.id,t)}getFeatureState(e){this._checkLoaded();let t=e.source,n=e.sourceLayer,r=this.tileManagers[t];if(r===void 0){this.fire(new maplibre_gl_shared_Pn(Error(`The source '${t}' does not exist in the map's style.`)));return}if(r.getSource().type===`vector`&&!n){this.fire(new maplibre_gl_shared_Pn(Error(`The sourceLayer parameter must be provided for vector source types.`)));return}return e.id===void 0&&this.fire(new maplibre_gl_shared_Pn(Error(`The feature id parameter must be provided.`))),r.getFeatureState(n,e.id)}getTransition(){return maplibre_gl_shared_xt({duration:300,delay:0},this.stylesheet?.transition)}serialize(){if(!this._loaded)return;let e=maplibre_gl_shared_At(this.tileManagers,e=>e.serialize()),t=this._serializeByIds(this._order,!0),n=this.map.getTerrain()||void 0,r=this.stylesheet;return maplibre_gl_shared_jt({version:r.version,name:r.name,metadata:r.metadata,light:r.light,sky:r.sky,center:r.center,zoom:r.zoom,bearing:r.bearing,pitch:r.pitch,sprite:r.sprite,glyphs:r.glyphs,"font-faces":r[`font-faces`],transition:r.transition,projection:r.projection,state:r.state,sources:e,layers:t,terrain:n},e=>e!==void 0)}_updateLayer(e){this._updatedLayers[e.id]=!0,e.source&&!this._updatedSources[e.source]&&this.tileManagers[e.source].getSource().type!==`raster`&&(this._updatedSources[e.source]=`reload`,this.tileManagers[e.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(e){let t=e=>this._layers[e].type===`fill-extrusion`,n={},r=[];for(let i=this._order.length-1;i>=0;i--){let a=this._order[i];if(t(a)){n[a]=i;for(let t of e){let e=t[a];if(e)for(let t of e)r.push(t)}}}r.sort((e,t)=>t.intersectionZ-e.intersectionZ);let i=[];for(let a=this._order.length-1;a>=0;a--){let o=this._order[a];if(t(o))for(let e=r.length-1;e>=0;e--){let t=r[e].feature;if(n[t.layer.id]<a)break;i.push(t),r.pop()}else for(let t of e){let e=t[o];if(e)for(let t of e)i.push(t.feature)}}return i}queryRenderedFeatures(e,t,n){t?.filter&&this._validate(maplibre_gl_shared_lc.filter,`queryRenderedFeatures.filter`,t.filter,null,t);let r={};if(t?.layers){if(!(Array.isArray(t.layers)||t.layers instanceof Set))return this.fire(new maplibre_gl_shared_Pn(Error(`parameters.layers must be an Array or a Set of strings`))),[];for(let e of t.layers){let t=this._layers[e];if(!t)return this.fire(new maplibre_gl_shared_Pn(Error(`The layer '${e}' does not exist in the map's style and cannot be queried for features.`))),[];r[t.source]=!0}}let i=[];t.availableImages=this.imageManager.listImages();let a=this._serializedAllLayers(),o=t.layers instanceof Set?t.layers:Array.isArray(t.layers)?new Set(t.layers):null,s={...t,layers:o,globalState:this._globalState};for(let o in this.tileManagers)(!t.layers||r[o])&&i.push(maplibre_gl_ua(this.tileManagers[o],this._layers,a,e,s,n,this.map.terrain?(e,t,n)=>this.map.terrain.getElevation(e,t,n):void 0));return this.placement&&i.push(maplibre_gl_da(this._layers,a,this.tileManagers,e,s,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(i)}querySourceFeatures(e,t){t?.filter&&this._validate(maplibre_gl_shared_lc.filter,`querySourceFeatures.filter`,t.filter,null,t);let n=this.tileManagers[e];return n?maplibre_gl_fa(n,t?{...t,globalState:this._globalState}:{globalState:this._globalState}):[]}getLight(){return this.light.getLight()}setLight(e,t={}){this._checkLoaded();let n=this.light.getLight(),r=!1;for(let t in e)if(!maplibre_gl_shared_Mt(e[t],n[t])){r=!0;break}if(!r)return;let i={now:maplibre_gl_U(),transition:maplibre_gl_shared_xt({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(e,t),this.light.updateTransitions(i)}getProjection(){return this.stylesheet?.projection}setProjection(e){this._checkLoaded();let t=e??{type:`mercator`};if(this.stylesheet.projection=e,this.projection){if(this.projection.name===t.type)return;this.projection.destroy(),delete this.projection}this._setProjectionInternal(t.type)}getSky(){return this.stylesheet?.sky}setSky(e,t={}){this._checkLoaded();let n=this.getSky(),r=!1;if(!e&&!n)return;if(e&&!n)r=!0;else if(!e&&n)r=!0;else for(let t in e)if(!maplibre_gl_shared_Mt(e[t],n[t])){r=!0;break}if(!r)return;let i={now:maplibre_gl_U(),transition:maplibre_gl_shared_xt({duration:300,delay:0},this.stylesheet.transition)};this.stylesheet.sky=e,this.sky.setSky(e,t),this.sky.updateTransitions(i)}_setProjectionInternal(e){let t=maplibre_gl_l(e,this.map._camera?.transform.constrainOverride,this._globalState);this.projection=t.projection,this.map.migrateProjection(t.transform,t.cameraHelper);for(let e in this.tileManagers)this.tileManagers[e].reload()}_validate(e,t,n,r,i={}){return i.validate!==!1&&maplibre_gl_shared_mc(this,e,{key:t,style:this.serialize(),value:n,...r},i)}_remove(e=!0){this._frameRequest&&=(this._frameRequest.abort(),null),this._loadStyleRequest&&=(this._loadStyleRequest.abort(),null),this._spriteRequest&&=(this._spriteRequest.abort(),null),maplibre_gl_mo().off(maplibre_gl_uo,this._rtlPluginLoaded);for(let e in this._layers)this._layers[e].setEventedParent(null);for(let e in this.tileManagers){let t=this.tileManagers[e];t.setEventedParent(null),t.onRemove(this.map)}this.imageManager.setEventedParent(null),this.setEventedParent(null),e&&this.dispatcher.broadcast(`RM`,void 0),this.dispatcher.remove(e)}_clearSource(e){this.tileManagers[e].clearTiles()}_reloadSource(e){this.tileManagers[e].resume(),this.tileManagers[e].reload()}_updateSources(e){for(let t in this.tileManagers)this.tileManagers[t].update(e,this.map.terrain)}_generateCollisionBoxes(){for(let e in this.tileManagers)this._reloadSource(e)}triggerSymbolPlacement(){this._symbolPlacementTriggered=!0}_placementInputsChanged(e,t,n){let r=this.pauseablePlacement;return!r||this._symbolPlacementTriggered||this._placedProjectionTransition!==this.projection?.transitionState||r._showCollisionBoxes!==t||r.placement.collisionGroups.crossSourceCollisions!==n||r.placement.transform.renderWorldCopies!==e.renderWorldCopies||!maplibre_gl_shared_ae(r.placement.transform.modelViewProjectionMatrix,e.modelViewProjectionMatrix)}_updatePlacement(e,t,n,r,i=!1){let a=!1,o=!1,s={};for(let t of this._order){let n=this._layers[t];if(n.type!==`symbol`)continue;if(!s[n.source]){let e=this.tileManagers[n.source];s[n.source]=e.getRenderableIds(!0).map(t=>e.getTileByID(t)).sort((e,t)=>t.tileID.overscaledZ-e.tileID.overscaledZ||(e.tileID.isLessThan(t.tileID)?-1:1))}let r=this.crossTileSymbolIndex.addLayer(n,s[n.source],e.center.lng);a||=r}this.crossTileSymbolIndex.pruneUnusedLayers(this._order),i||=this._layerOrderChanged||n===0;let c=a||this._placementInputsChanged(e,t,r),l=this.pauseablePlacement?.isDone()&&!this.placement.stillRecent(maplibre_gl_U(),e.zoom);if((i||!this.pauseablePlacement||l&&(c||this.placement.stale))&&(this._symbolPlacementTriggered=!1,this._placedProjectionTransition=this.projection?.transitionState,this.pauseablePlacement=new maplibre_gl_Ls(e,this.map.terrain,this._order,i,t,n,r,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?c&&this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,s),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(maplibre_gl_U()),o=!0),a&&this.pauseablePlacement.placement.setStale()),o||a)for(let e of this._order){let t=this._layers[e];t.type===`symbol`&&this.placement.updateLayerOpacities(t,s[t.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(maplibre_gl_U())}_releaseSymbolFadeTiles(){for(let e in this.tileManagers)this.tileManagers[e].releaseSymbolFadeTiles()}async getImages(e,t){let n=await this.imageManager.getImages(t.icons);this._updateTilesForChangedImages();let r=this.tileManagers[t.source];return r&&r.setDependencies(t.tileID.key,t.type,t.icons),n}async getGlyphs(e,t){let n=await this.glyphManager.getGlyphs(t.stacks),r=this.tileManagers[t.source];return r&&r.setDependencies(t.tileID.key,t.type,[``]),n}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(e,t={}){this._checkLoaded(),!(e&&this._validate(maplibre_gl_shared_lc.glyphs,`glyphs`,e,null,t))&&(this._changed=!0,this._glyphsDidChange=!0,this.stylesheet.glyphs=e,this.glyphManager.entries={},this.glyphManager.setURL(e))}getFontFaces(){return this.stylesheet[`font-faces`]||null}setFontFaces(e){this._checkLoaded(),this._changed=!0,this._glyphsDidChange=!0,this.stylesheet[`font-faces`]=e,this.glyphManager.setFontFaces(e)}async getDashes(e,t){let n={};for(let[e,r]of Object.entries(t.dashes))n[e]=this.lineAtlas.getDash(r.dasharray,r.round);return n}addSprite(e,t,n={},r){this._checkLoaded();let i=[{id:e,url:t}],a=[...maplibre_gl_vi(this.stylesheet.sprite),...i];this._validate(maplibre_gl_shared_lc.sprite,`sprite`,a,null,n)||(this.stylesheet.sprite=a,this._loadSprite(i,!0,r))}removeSprite(e){this._checkLoaded();let t=maplibre_gl_vi(this.stylesheet.sprite);if(!t.find(t=>t.id===e)){this.fire(new maplibre_gl_shared_Pn(Error(`Sprite "${e}" doesn't exists on this map.`)));return}let n=this.imageManager.removeSpriteImages(e);this._markImagesChanged(n),t.splice(t.findIndex(t=>t.id===e),1),this.stylesheet.sprite=t.length>0?t:void 0,this._imagesListDirty=!0,this._changed=!0,this.fire(new maplibre_gl_Yr(`data`))}getSprite(){return maplibre_gl_vi(this.stylesheet.sprite)}setSprite(e,t={},n){this._checkLoaded(),!(e&&this._validate(maplibre_gl_shared_lc.sprite,`sprite`,e,null,t))&&(this.stylesheet.sprite=e,e?this._loadSprite(e,!0,n):(this._unloadSprite(),n&&n(null)))}destroy(){this._frameRequest&&=(this._frameRequest.abort(),null),this._loadStyleRequest&&=(this._loadStyleRequest.abort(),null),this._spriteRequest&&=(this._spriteRequest.abort(),null);for(let e in this.tileManagers){let t=this.tileManagers[e];t.setEventedParent(null),t.onRemove(this.map)}this.tileManagers={},this.imageManager&&(this.imageManager.setEventedParent(null),this.imageManager.destroy(),this.patternAtlas.destroy()),this.glyphManager&&this.glyphManager.destroy();for(let e in this._layers){let t=this._layers[e];t.setEventedParent(null),t.onRemove&&t.onRemove(this.map)}this._setInitialValues(),this.setEventedParent(null),this.dispatcher.unregisterMessageHandler(`GG`),this.dispatcher.unregisterMessageHandler(`GI`),this.dispatcher.unregisterMessageHandler(`GDA`),this.dispatcher.remove(!0),this._listeners={},this._oneTimeListeners={}}};const maplibre_gl_bl=maplibre_gl_shared_Yc([{name:`a_pos`,type:`Int16`,components:2},{name:`a_texture_pos`,type:`Int16`,components:2}]);var maplibre_gl_xl=class{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(e,t,n,r,i,a,o,s,c){this.context=e;let l=this.boundPaintVertexBuffers.length!==r.length;for(let e=0;!l&&e<r.length;e++)this.boundPaintVertexBuffers[e]!==r[e]&&(l=!0);!this.vao||this.boundProgram!==t||this.boundLayoutVertexBuffer!==n||l||this.boundIndexBuffer!==i||this.boundVertexOffset!==a||this.boundDynamicVertexBuffer!==o||this.boundDynamicVertexBuffer2!==s||this.boundDynamicVertexBuffer3!==c?this.freshBind(t,n,r,i,a,o,s,c):e.bindVertexArray.set(this.vao)}freshBind(e,t,n,r,i,a,o,s){let c=e.numAttributes,l=this.context,u=l.gl;this.vao&&this.destroy(),this.vao=l.createVertexArray(),l.bindVertexArray.set(this.vao),this.boundProgram=e,this.boundLayoutVertexBuffer=t,this.boundPaintVertexBuffers=n,this.boundIndexBuffer=r,this.boundVertexOffset=i,this.boundDynamicVertexBuffer=a,this.boundDynamicVertexBuffer2=o,this.boundDynamicVertexBuffer3=s,t.enableAttributes(u,e);for(let t of n)t.enableAttributes(u,e);a&&a.enableAttributes(u,e),o&&o.enableAttributes(u,e),s&&s.enableAttributes(u,e),t.bind(),t.setVertexAttribPointers(u,e,i);for(let t of n)t.bind(),t.setVertexAttribPointers(u,e,i);a&&(a.bind(),a.setVertexAttribPointers(u,e,i)),r&&r.bind(),o&&(o.bind(),o.setVertexAttribPointers(u,e,i)),s&&(s.bind(),s.setVertexAttribPointers(u,e,i)),l.currentNumAttributes=c}destroy(){this.vao&&=(this.context.deleteVertexArray(this.vao),null)}};const maplibre_gl_Sl=(e,t)=>({u_depth:new maplibre_gl_shared_mu(e,t.u_depth),u_terrain:new maplibre_gl_shared_mu(e,t.u_terrain)}),maplibre_gl_Cl=(e,t)=>({u_texture:new maplibre_gl_shared_mu(e,t.u_texture),u_ele_delta:new maplibre_gl_shared_hu(e,t.u_ele_delta),u_fog_matrix:new maplibre_gl_shared_Cu(e,t.u_fog_matrix),u_fog_color:new maplibre_gl_shared_yu(e,t.u_fog_color),u_fog_ground_blend:new maplibre_gl_shared_hu(e,t.u_fog_ground_blend),u_fog_ground_blend_opacity:new maplibre_gl_shared_hu(e,t.u_fog_ground_blend_opacity),u_horizon_color:new maplibre_gl_shared_yu(e,t.u_horizon_color),u_horizon_fog_blend:new maplibre_gl_shared_hu(e,t.u_horizon_fog_blend),u_is_globe_mode:new maplibre_gl_shared_hu(e,t.u_is_globe_mode)}),maplibre_gl_wl=(e,t)=>({u_ele_delta:new maplibre_gl_shared_hu(e,t.u_ele_delta)}),maplibre_gl_Tl=(e,t,n,r,i)=>({u_texture:0,u_ele_delta:e,u_fog_matrix:t,u_fog_color:n?n.properties.get(`fog-color`):maplibre_gl_shared_V.white,u_fog_ground_blend:n?n.properties.get(`fog-ground-blend`):1,u_fog_ground_blend_opacity:i?0:n?n.calculateFogBlendOpacity(r):0,u_horizon_color:n?n.properties.get(`horizon-color`):maplibre_gl_shared_V.white,u_horizon_fog_blend:n?n.properties.get(`horizon-fog-blend`):1,u_is_globe_mode:+!!i}),maplibre_gl_El=e=>({u_ele_delta:e}),maplibre_gl_Dl={ProjectionUBO:0,TerrainUBO:1,FrameUBO:2};function maplibre_gl_Ol(e,t){for(let[n,r]of Object.entries(maplibre_gl_Dl)){let i=e.getUniformBlockIndex(t,n);i!==e.INVALID_INDEX&&e.uniformBlockBinding(t,i,r)}}const maplibre_gl_kl={float:[1,1],int:[1,1],vec2:[2,2],vec4:[4,4],mat4:[16,4]};function maplibre_gl_Al(e){let t={},n=0;for(let{name:r,type:i}of e){let[e,a]=maplibre_gl_kl[i];n=Math.ceil(n/a)*a,t[r]=n,n+=e}return{offsets:t,contentWords:n,sizeWords:Math.ceil(n/4)*4}}var maplibre_gl_jl=class{constructor(e,t,n){this.context=e,this.binding=t,this.contentWords=n.contentWords;let r=e.gl;this.buffer=r.createBuffer(),r.bindBuffer(r.UNIFORM_BUFFER,this.buffer),r.bufferData(r.UNIFORM_BUFFER,n.sizeWords*4,r.DYNAMIC_DRAW),r.bindBufferBase(r.UNIFORM_BUFFER,t,this.buffer),this.uploaded=new Float32Array(n.sizeWords),this.pending=new Float32Array(n.sizeWords),this.uploadedWords=new Uint32Array(this.uploaded.buffer),this.pendingWords=new Uint32Array(this.pending.buffer),this.hasData=!1,this.bindingDirty=!1}upload(){let e=this.context.gl,t=!this.hasData;if(!t){let e=this.pendingWords,n=this.uploadedWords;for(let r=0;r<this.contentWords;r++)if(e[r]!==n[r]){t=!0;break}}this.bindingDirty&&=(e.bindBufferBase(e.UNIFORM_BUFFER,this.binding,this.buffer),!1),t&&(e.bindBuffer(e.UNIFORM_BUFFER,this.buffer),e.bufferSubData(e.UNIFORM_BUFFER,0,this.pending),this.uploaded.set(this.pending),this.hasData=!0)}destroy(){let e=this.context.gl;this.buffer&&(e.deleteBuffer(this.buffer),delete this.buffer)}};const maplibre_gl_Ml=maplibre_gl_Al([{name:`u_projection_matrix`,type:`mat4`},{name:`u_projection_fallback_matrix`,type:`mat4`},{name:`u_projection_tile_mercator_coords`,type:`vec4`},{name:`u_projection_clipping_plane`,type:`vec4`},{name:`u_projection_transition`,type:`float`},{name:`u_projection_clip_antimeridian`,type:`int`}]),maplibre_gl_Nl=maplibre_gl_Ml.offsets;function maplibre_gl_Pl(e){return new maplibre_gl_jl(e,maplibre_gl_Dl.ProjectionUBO,maplibre_gl_Ml)}function maplibre_gl_Fl(e,t){let n=e.pending;n.set(t.mainMatrix,maplibre_gl_Nl.u_projection_matrix),n.set(t.fallbackMatrix,maplibre_gl_Nl.u_projection_fallback_matrix),n.set(t.tileMercatorCoords,maplibre_gl_Nl.u_projection_tile_mercator_coords),n.set(t.clippingPlane,maplibre_gl_Nl.u_projection_clipping_plane),n[maplibre_gl_Nl.u_projection_transition]=t.projectionTransition,e.pendingWords[maplibre_gl_Nl.u_projection_clip_antimeridian]=+!!t.clipAntimeridian,e.upload()}const maplibre_gl_Il=maplibre_gl_Al([{name:`u_terrain_matrix`,type:`mat4`},{name:`u_terrain_unpack`,type:`vec4`},{name:`u_terrain_dim`,type:`float`},{name:`u_terrain_exaggeration`,type:`float`}]),maplibre_gl_Ll=maplibre_gl_Il.offsets;function maplibre_gl_Rl(e){return new maplibre_gl_jl(e,maplibre_gl_Dl.TerrainUBO,maplibre_gl_Il)}function maplibre_gl_zl(e,t){let n=e.pending;n.set(t.u_terrain_matrix,maplibre_gl_Ll.u_terrain_matrix),n.set(t.u_terrain_unpack,maplibre_gl_Ll.u_terrain_unpack),n[maplibre_gl_Ll.u_terrain_dim]=t.u_terrain_dim,n[maplibre_gl_Ll.u_terrain_exaggeration]=t.u_terrain_exaggeration,e.upload()}function maplibre_gl_Bl(e){let t=[];for(let n of e){if(n===null)continue;let e=n.split(` `);t.push(e.pop())}return t}function maplibre_gl_Vl(e,t){let n=new Set([e.INT,e.INT_VEC2,e.INT_VEC3,e.INT_VEC4,e.UNSIGNED_INT,e.UNSIGNED_INT_VEC2,e.UNSIGNED_INT_VEC3,e.UNSIGNED_INT_VEC4]),r=new Set,i=e.getProgramParameter(t,e.ACTIVE_ATTRIBUTES);for(let a=0;a<i;a++){let i=e.getActiveAttrib(t,a);i&&n.has(i.type)&&r.add(i.name)}return r}var maplibre_gl_Hl=class{constructor(e,t,n,r,i,a,o,s,c=[]){let l=e.gl;this.program=l.createProgram();let u=maplibre_gl_Bl(t.staticAttributes),d=n?n.getBinderAttributes():[],f=u.concat(d),p=maplibre_gl_ac.prelude.staticUniforms?maplibre_gl_Bl(maplibre_gl_ac.prelude.staticUniforms):[],m=t.staticUniforms?maplibre_gl_Bl(t.staticUniforms):[],h=n?n.getBinderUniforms():[],g=p.concat(m).concat(h),_=[];for(let e of g)_.includes(e)||_.push(e);let v=n?n.defines():[];v.unshift(`#version 300 es`),i&&v.push(`#define OVERDRAW_INSPECTOR;`),a&&v.push(`#define TERRAIN3D;`),s&&v.push(s),c&&v.push(...c);let y=v.concat(maplibre_gl_ac.prelude.fragmentSource,o.fragmentSource,t.fragmentSource).join(`
12211
12214
  `),b=v.concat(maplibre_gl_ac.prelude.vertexSource,o.vertexSource,t.vertexSource).join(`
12212
- `),x=l.createShader(l.FRAGMENT_SHADER);if(l.isContextLost()){this.failedToCreate=!0;return}l.shaderSource(x,y),l.compileShader(x),l.attachShader(this.program,x);let S=l.createShader(l.VERTEX_SHADER);if(l.isContextLost()){this.failedToCreate=!0;return}l.shaderSource(S,b),l.compileShader(S),l.attachShader(this.program,S),this.attributes={};let C={};if(this.numAttributes=f.length,l.linkProgram(this.program),!l.getProgramParameter(this.program,l.LINK_STATUS)){if(l.isContextLost()){this.failedToCreate=!0;return}throw l.getShaderParameter(x,l.COMPILE_STATUS)?l.getShaderParameter(S,l.COMPILE_STATUS)?Error(`Program failed to link: ${l.getProgramInfoLog(this.program)}`):Error(`Could not compile vertex shader: ${l.getShaderInfoLog(S)}`):Error(`Could not compile fragment shader: ${l.getShaderInfoLog(x)}`)}maplibre_gl_Ol(l,this.program);let w=maplibre_gl_Vl(l,this.program);for(let e of f){if(!e)continue;let t=l.getAttribLocation(this.program,e);t>=0&&(this.attributes[e]={location:t,isInteger:w.has(e)})}l.deleteShader(S),l.deleteShader(x);for(let e of _)if(e&&!C[e]){let t=l.getUniformLocation(this.program,e);t&&(C[e]=t)}this.fixedUniforms=r(e,C),this.terrainUniforms=maplibre_gl_Sl(e,C),this.binderUniforms=n?n.getUniforms(e,C):[]}draw(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v){let y=e.gl;if(this.failedToCreate)return;if(e.program.set(this.program),e.setDepthMode(n),e.setStencilMode(r),e.setColorMode(i),e.setCullFace(a),s){e.activeTexture.set(y.TEXTURE2),y.bindTexture(y.TEXTURE_2D,s.depthTexture),e.activeTexture.set(y.TEXTURE3),y.bindTexture(y.TEXTURE_2D,s.texture);for(let e in this.terrainUniforms)this.terrainUniforms[e].set(s[e]);maplibre_gl_zl(e.terrainUniformBuffer,s)}if(c&&maplibre_gl_Fl(e.projectionUniformBuffer,c),o)for(let e in this.fixedUniforms)this.fixedUniforms[e].set(o[e]);h&&h.setUniforms(e,this.binderUniforms,p,{zoom:m});let b=0;switch(t){case y.LINES:b=2;break;case y.TRIANGLES:b=3;break;case y.LINE_STRIP:b=1}for(let n of f.get())n.vaos||={},n.vaos[l]||=new maplibre_gl_xl,n.vaos[l].bind(e,this,u,h?h.getPaintVertexBuffers():[],d,n.vertexOffset,g,_,v),y.drawElements(t,n.primitiveLength*b,y.UNSIGNED_SHORT,n.primitiveOffset*b*2)}};function maplibre_gl_Ul(e,t,n){let r=1/maplibre_gl_shared_N(n,1,t.transform.tileZoom),i=2**n.tileID.overscaledZ,a=n.tileSize*2**t.transform.tileZoom/i,o=a*(n.tileID.canonical.x+n.tileID.wrap*i),s=a*n.tileID.canonical.y;return{u_image:0,u_texsize:n.imageAtlasTexture.size,u_scale:[r,e.fromScale,e.toScale],u_fade:e.t,u_pixel_coord_upper:[o>>16,s>>16],u_pixel_coord_lower:[o&65535,s&65535]}}function maplibre_gl_Wl(e,t,n,r){let i=n.patternAtlas.getPattern(e.from.toString()),a=n.patternAtlas.getPattern(e.to.toString()),{width:o,height:s}=n.patternAtlas.getPixelSize(),c=2**r.tileID.overscaledZ,l=r.tileSize*2**n.transform.tileZoom/c,u=l*(r.tileID.canonical.x+r.tileID.wrap*c),d=l*r.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:i.tl,u_pattern_br_a:i.br,u_pattern_tl_b:a.tl,u_pattern_br_b:a.br,u_texsize:[o,s],u_mix:t.t,u_pattern_size_a:i.displaySize,u_pattern_size_b:a.displaySize,u_scale_a:t.fromScale,u_scale_b:t.toScale,u_tile_units_to_pixels:1/maplibre_gl_shared_N(r,1,n.transform.tileZoom),u_pixel_coord_upper:[u>>16,d>>16],u_pixel_coord_lower:[u&65535,d&65535]}}const maplibre_gl_Gl=(e,t)=>({u_lightpos:new dist_maplibre_gl_shared_u(e,t.u_lightpos),u_lightpos_globe:new dist_maplibre_gl_shared_u(e,t.u_lightpos_globe),u_lightintensity:new maplibre_gl_shared_hu(e,t.u_lightintensity),u_lightcolor:new dist_maplibre_gl_shared_u(e,t.u_lightcolor),u_vertical_gradient:new maplibre_gl_shared_hu(e,t.u_vertical_gradient),u_opacity:new maplibre_gl_shared_hu(e,t.u_opacity),u_fill_translate:new maplibre_gl_shared_gu(e,t.u_fill_translate)}),maplibre_gl_Kl=(e,t)=>({u_lightpos:new dist_maplibre_gl_shared_u(e,t.u_lightpos),u_lightpos_globe:new dist_maplibre_gl_shared_u(e,t.u_lightpos_globe),u_lightintensity:new maplibre_gl_shared_hu(e,t.u_lightintensity),u_lightcolor:new dist_maplibre_gl_shared_u(e,t.u_lightcolor),u_vertical_gradient:new maplibre_gl_shared_hu(e,t.u_vertical_gradient),u_height_factor:new maplibre_gl_shared_hu(e,t.u_height_factor),u_opacity:new maplibre_gl_shared_hu(e,t.u_opacity),u_fill_translate:new maplibre_gl_shared_gu(e,t.u_fill_translate),u_image:new maplibre_gl_shared_mu(e,t.u_image),u_texsize:new maplibre_gl_shared_gu(e,t.u_texsize),u_pixel_coord_upper:new maplibre_gl_shared_gu(e,t.u_pixel_coord_upper),u_pixel_coord_lower:new maplibre_gl_shared_gu(e,t.u_pixel_coord_lower),u_scale:new dist_maplibre_gl_shared_u(e,t.u_scale),u_fade:new maplibre_gl_shared_hu(e,t.u_fade)}),maplibre_gl_ql=(e,t,n,r)=>{let i=e.style.light,a=i.getCartesianPosition(),o=maplibre_gl_shared_g();i.properties.get(`anchor`)===`viewport`&&maplibre_gl_shared_v(o,e.transform.bearingInRadians),maplibre_gl_shared_be(a,a,o);let s=e.transform.transformLightDirection(a),c=i.properties.get(`color`);return{u_lightpos:a,u_lightpos_globe:s,u_lightintensity:i.properties.get(`intensity`),u_lightcolor:[c.r,c.g,c.b],u_vertical_gradient:+t,u_opacity:n,u_fill_translate:r}},maplibre_gl_Jl=(e,t,n,r,i,a,o)=>maplibre_gl_shared_xt(maplibre_gl_ql(e,t,n,r),maplibre_gl_Ul(a,e,o),{u_height_factor:-(2**i.overscaledZ)/o.tileSize/8}),maplibre_gl_Yl=(e,t)=>({u_fill_translate:new maplibre_gl_shared_gu(e,t.u_fill_translate)}),maplibre_gl_Xl=(e,t)=>({u_image:new maplibre_gl_shared_mu(e,t.u_image),u_texsize:new maplibre_gl_shared_gu(e,t.u_texsize),u_pixel_coord_upper:new maplibre_gl_shared_gu(e,t.u_pixel_coord_upper),u_pixel_coord_lower:new maplibre_gl_shared_gu(e,t.u_pixel_coord_lower),u_scale:new dist_maplibre_gl_shared_u(e,t.u_scale),u_fade:new maplibre_gl_shared_hu(e,t.u_fade),u_sdf_pattern:new maplibre_gl_shared_mu(e,t.u_sdf_pattern),u_fill_translate:new maplibre_gl_shared_gu(e,t.u_fill_translate)}),maplibre_gl_Zl=(e,t)=>({u_fill_translate:new maplibre_gl_shared_gu(e,t.u_fill_translate)}),maplibre_gl_Ql=(e,t)=>({u_image:new maplibre_gl_shared_mu(e,t.u_image),u_texsize:new maplibre_gl_shared_gu(e,t.u_texsize),u_pixel_coord_upper:new maplibre_gl_shared_gu(e,t.u_pixel_coord_upper),u_pixel_coord_lower:new maplibre_gl_shared_gu(e,t.u_pixel_coord_lower),u_scale:new dist_maplibre_gl_shared_u(e,t.u_scale),u_fade:new maplibre_gl_shared_hu(e,t.u_fade),u_sdf_pattern:new maplibre_gl_shared_mu(e,t.u_sdf_pattern),u_fill_translate:new maplibre_gl_shared_gu(e,t.u_fill_translate)}),maplibre_gl_$l=(e,t,n,r,i)=>maplibre_gl_shared_xt(maplibre_gl_Ul(t,e,n),{u_fill_translate:r,u_sdf_pattern:+!!i}),maplibre_gl_eu=e=>({u_fill_translate:e}),maplibre_gl_tu=e=>({u_fill_translate:e}),maplibre_gl_nu=(e,t,n,r,i)=>maplibre_gl_$l(e,t,n,r,i),maplibre_gl_ru=(e,t)=>({u_scale_with_map:new maplibre_gl_shared_mu(e,t.u_scale_with_map),u_pitch_with_map:new maplibre_gl_shared_mu(e,t.u_pitch_with_map),u_extrude_scale:new maplibre_gl_shared_gu(e,t.u_extrude_scale),u_globe_extrude_scale:new maplibre_gl_shared_hu(e,t.u_globe_extrude_scale),u_translate:new maplibre_gl_shared_gu(e,t.u_translate)}),maplibre_gl_iu=(e,t,n,r,i)=>{let a=e.transform,o,s,c=0;if(n.paint.get(`circle-pitch-alignment`)===`map`){let e=maplibre_gl_shared_N(t,1,a.zoom);o=!0,s=[e,e],c=e/((/* inlined export .Rr */8192)*2**t.tileID.overscaledZ)*2*Math.PI*i}else o=!1,s=a.pixelsToGLUnits;return{u_scale_with_map:+(n.paint.get(`circle-pitch-scale`)===`map`),u_pitch_with_map:+o,u_extrude_scale:s,u_globe_extrude_scale:c,u_translate:r}},maplibre_gl_au=(e,t)=>({u_color:new maplibre_gl_shared_yu(e,t.u_color),u_overlay:new maplibre_gl_shared_mu(e,t.u_overlay),u_overlay_scale:new maplibre_gl_shared_hu(e,t.u_overlay_scale)}),maplibre_gl_ou=(e,t=1)=>({u_color:e,u_overlay:0,u_overlay_scale:t}),maplibre_gl_su=(e,t)=>({u_extrude_scale:new maplibre_gl_shared_hu(e,t.u_extrude_scale),u_intensity:new maplibre_gl_shared_hu(e,t.u_intensity),u_globe_extrude_scale:new maplibre_gl_shared_hu(e,t.u_globe_extrude_scale)}),maplibre_gl_cu=(e,t)=>({u_matrix:new maplibre_gl_shared_Cu(e,t.u_matrix),u_image:new maplibre_gl_shared_mu(e,t.u_image),u_color_ramp:new maplibre_gl_shared_mu(e,t.u_color_ramp),u_opacity:new maplibre_gl_shared_hu(e,t.u_opacity)}),maplibre_gl_lu=(e,t,n,r)=>{let i=maplibre_gl_shared_N(e,1,t)/((/* inlined export .Rr */8192)*2**e.tileID.overscaledZ)*2*Math.PI*r;return{u_extrude_scale:maplibre_gl_shared_N(e,1,t),u_intensity:n,u_globe_extrude_scale:i}},maplibre_gl_uu=(e,t,n,r)=>{let i=maplibre_gl_shared_b();return maplibre_gl_shared_ie(i,0,e.width,e.height,0,0,1),{u_matrix:i,u_image:n,u_color_ramp:r,u_opacity:t.paint.get(`heatmap-opacity`)}},maplibre_gl_du=(e,t)=>({u_image:new maplibre_gl_shared_mu(e,t.u_image),u_latrange:new maplibre_gl_shared_gu(e,t.u_latrange),u_exaggeration:new maplibre_gl_shared_hu(e,t.u_exaggeration),u_altitudes:new maplibre_gl_shared_xu(e,t.u_altitudes),u_azimuths:new maplibre_gl_shared_xu(e,t.u_azimuths),u_accent:new maplibre_gl_shared_yu(e,t.u_accent),u_method:new maplibre_gl_shared_mu(e,t.u_method),u_shadows:new maplibre_gl_shared_bu(e,t.u_shadows),u_highlights:new maplibre_gl_shared_bu(e,t.u_highlights)}),maplibre_gl_fu=(e,t)=>({u_matrix:new maplibre_gl_shared_Cu(e,t.u_matrix),u_image:new maplibre_gl_shared_mu(e,t.u_image),u_dimension:new maplibre_gl_shared_gu(e,t.u_dimension),u_zoom:new maplibre_gl_shared_hu(e,t.u_zoom),u_unpack:new maplibre_gl_shared_vu(e,t.u_unpack)}),maplibre_gl_pu=(e,t,n)=>{let r=n.paint.get(`hillshade-accent-color`),i;switch(n.paint.get(`hillshade-method`)){case`basic`:i=4;break;case`combined`:i=1;break;case`igor`:i=2;break;case`multidirectional`:i=3;break;default:i=0}let a=n.getIlluminationProperties();for(let t=0;t<a.directionRadians.length;t++)n.paint.get(`hillshade-illumination-anchor`)===`viewport`&&(a.directionRadians[t]+=e.transform.bearingInRadians);return{u_image:0,u_latrange:maplibre_gl_hu(e,t.tileID),u_exaggeration:n.paint.get(`hillshade-exaggeration`),u_altitudes:a.altitudeRadians,u_azimuths:a.directionRadians,u_accent:r,u_method:i,u_highlights:a.highlightColor,u_shadows:a.shadowColor}},maplibre_gl_mu=(e,t)=>{let n=t.stride,r=maplibre_gl_shared_b();return maplibre_gl_shared_ie(r,0,(/* inlined export .Rr */8192),-(/* inlined export .Rr */8192),0,0,1),maplibre_gl_shared_E(r,r,[0,-(/* inlined export .Rr */8192),0]),{u_matrix:r,u_image:1,u_dimension:[n,n],u_zoom:e.overscaledZ,u_unpack:t.getUnpackVector()}};function maplibre_gl_hu(e,t){let n=2**t.canonical.z,r=t.canonical.y;return[new maplibre_gl_shared_Hp(0,r/n).toLngLat().lat,new maplibre_gl_shared_Hp(0,(r+1)/n).toLngLat().lat]}const maplibre_gl_gu=(e,t)=>({u_image:new maplibre_gl_shared_mu(e,t.u_image),u_unpack:new maplibre_gl_shared_vu(e,t.u_unpack),u_dimension:new maplibre_gl_shared_gu(e,t.u_dimension),u_elevation_stops:new maplibre_gl_shared_mu(e,t.u_elevation_stops),u_color_stops:new maplibre_gl_shared_mu(e,t.u_color_stops),u_color_ramp_size:new maplibre_gl_shared_mu(e,t.u_color_ramp_size),u_opacity:new maplibre_gl_shared_hu(e,t.u_opacity)}),maplibre_gl_u=(e,t,n=0)=>({u_image:0,u_unpack:t.getUnpackVector(),u_dimension:[t.stride,t.stride],u_elevation_stops:1,u_color_stops:4,u_color_ramp_size:n,u_opacity:e.paint.get(`color-relief-opacity`)}),maplibre_gl_vu=(e,t)=>({u_translation:new maplibre_gl_shared_gu(e,t.u_translation),u_ratio:new maplibre_gl_shared_hu(e,t.u_ratio)}),maplibre_gl_yu=(e,t)=>({u_translation:new maplibre_gl_shared_gu(e,t.u_translation),u_ratio:new maplibre_gl_shared_hu(e,t.u_ratio),u_image:new maplibre_gl_shared_mu(e,t.u_image),u_image_height:new maplibre_gl_shared_hu(e,t.u_image_height)}),maplibre_gl_bu=(e,t)=>({u_translation:new maplibre_gl_shared_gu(e,t.u_translation),u_texsize:new maplibre_gl_shared_gu(e,t.u_texsize),u_ratio:new maplibre_gl_shared_hu(e,t.u_ratio),u_image:new maplibre_gl_shared_mu(e,t.u_image),u_scale:new dist_maplibre_gl_shared_u(e,t.u_scale),u_fade:new maplibre_gl_shared_hu(e,t.u_fade)}),maplibre_gl_xu=(e,t)=>({u_translation:new maplibre_gl_shared_gu(e,t.u_translation),u_ratio:new maplibre_gl_shared_hu(e,t.u_ratio),u_image:new maplibre_gl_shared_mu(e,t.u_image),u_mix:new maplibre_gl_shared_hu(e,t.u_mix),u_tileratio:new maplibre_gl_shared_hu(e,t.u_tileratio),u_crossfade_from:new maplibre_gl_shared_hu(e,t.u_crossfade_from),u_crossfade_to:new maplibre_gl_shared_hu(e,t.u_crossfade_to),u_lineatlas_width:new maplibre_gl_shared_hu(e,t.u_lineatlas_width),u_lineatlas_height:new maplibre_gl_shared_hu(e,t.u_lineatlas_height)}),maplibre_gl_Su=(e,t)=>({u_translation:new maplibre_gl_shared_gu(e,t.u_translation),u_ratio:new maplibre_gl_shared_hu(e,t.u_ratio),u_image:new maplibre_gl_shared_mu(e,t.u_image),u_image_height:new maplibre_gl_shared_hu(e,t.u_image_height),u_tileratio:new maplibre_gl_shared_hu(e,t.u_tileratio),u_crossfade_from:new maplibre_gl_shared_hu(e,t.u_crossfade_from),u_crossfade_to:new maplibre_gl_shared_hu(e,t.u_crossfade_to),u_image_dash:new maplibre_gl_shared_mu(e,t.u_image_dash),u_mix:new maplibre_gl_shared_hu(e,t.u_mix),u_lineatlas_width:new maplibre_gl_shared_hu(e,t.u_lineatlas_width),u_lineatlas_height:new maplibre_gl_shared_hu(e,t.u_lineatlas_height)}),maplibre_gl_Cu=(e,t,n,r)=>{let i=e.transform;return{u_translation:maplibre_gl_ku(e,t,n),u_ratio:r/maplibre_gl_shared_N(t,1,i.zoom)}},maplibre_gl_wu=(e,t,n,r,i)=>maplibre_gl_shared_xt(maplibre_gl_Cu(e,t,n,r),{u_image:0,u_image_height:i}),maplibre_gl_Tu=(e,t,n,r,i)=>{let a=e.transform,o=maplibre_gl_Ou(t,a);return{u_translation:maplibre_gl_ku(e,t,n),u_texsize:t.imageAtlasTexture.size,u_ratio:r/maplibre_gl_shared_N(t,1,a.zoom),u_image:0,u_scale:[o,i.fromScale,i.toScale],u_fade:i.t}},maplibre_gl_Eu=(e,t,n,r,i)=>{let a=e.transform,o=maplibre_gl_Ou(t,a);return maplibre_gl_shared_xt(maplibre_gl_Cu(e,t,n,r),{u_tileratio:o,u_crossfade_from:i.fromScale,u_crossfade_to:i.toScale,u_image:0,u_mix:i.t,u_lineatlas_width:e.lineAtlas.width,u_lineatlas_height:e.lineAtlas.height})},maplibre_gl_Du=(e,t,n,r,i,a)=>{let o=e.transform,s=maplibre_gl_Ou(t,o);return maplibre_gl_shared_xt(maplibre_gl_Cu(e,t,n,r),{u_image:0,u_image_height:a,u_tileratio:s,u_crossfade_from:i.fromScale,u_crossfade_to:i.toScale,u_image_dash:1,u_mix:i.t,u_lineatlas_width:e.lineAtlas.width,u_lineatlas_height:e.lineAtlas.height})};function maplibre_gl_Ou(e,t){return 1/maplibre_gl_shared_N(e,1,t.tileZoom)}function maplibre_gl_ku(e,t,n){return maplibre_gl_shared_it(e.transform,t,n.paint.get(`line-translate`),n.paint.get(`line-translate-anchor`))}const maplibre_gl_Au=(e,t)=>({u_image:new maplibre_gl_shared_mu(e,t.u_image),u_opacity:new maplibre_gl_shared_hu(e,t.u_opacity)}),maplibre_gl_ju=(e,t)=>({u_image:t,u_opacity:e}),maplibre_gl_Mu=(e,t)=>({u_is_size_zoom_constant:new maplibre_gl_shared_mu(e,t.u_is_size_zoom_constant),u_is_size_feature_constant:new maplibre_gl_shared_mu(e,t.u_is_size_feature_constant),u_size_t:new maplibre_gl_shared_hu(e,t.u_size_t),u_size:new maplibre_gl_shared_hu(e,t.u_size),u_rotate_symbol:new maplibre_gl_shared_mu(e,t.u_rotate_symbol),u_label_plane_matrix:new maplibre_gl_shared_Cu(e,t.u_label_plane_matrix),u_coord_matrix:new maplibre_gl_shared_Cu(e,t.u_coord_matrix),u_is_text:new maplibre_gl_shared_mu(e,t.u_is_text),u_pitch_with_map:new maplibre_gl_shared_mu(e,t.u_pitch_with_map),u_is_along_line:new maplibre_gl_shared_mu(e,t.u_is_along_line),u_is_variable_anchor:new maplibre_gl_shared_mu(e,t.u_is_variable_anchor),u_texsize:new maplibre_gl_shared_gu(e,t.u_texsize),u_texture:new maplibre_gl_shared_mu(e,t.u_texture),u_translation:new maplibre_gl_shared_gu(e,t.u_translation),u_pitched_scale:new maplibre_gl_shared_hu(e,t.u_pitched_scale),u_is_offset:new maplibre_gl_shared_mu(e,t.u_is_offset),u_height_anchor_ground:new maplibre_gl_shared_mu(e,t.u_height_anchor_ground)}),maplibre_gl_Nu=(e,t)=>({u_is_size_zoom_constant:new maplibre_gl_shared_mu(e,t.u_is_size_zoom_constant),u_is_size_feature_constant:new maplibre_gl_shared_mu(e,t.u_is_size_feature_constant),u_size_t:new maplibre_gl_shared_hu(e,t.u_size_t),u_size:new maplibre_gl_shared_hu(e,t.u_size),u_rotate_symbol:new maplibre_gl_shared_mu(e,t.u_rotate_symbol),u_label_plane_matrix:new maplibre_gl_shared_Cu(e,t.u_label_plane_matrix),u_coord_matrix:new maplibre_gl_shared_Cu(e,t.u_coord_matrix),u_is_text:new maplibre_gl_shared_mu(e,t.u_is_text),u_pitch_with_map:new maplibre_gl_shared_mu(e,t.u_pitch_with_map),u_is_along_line:new maplibre_gl_shared_mu(e,t.u_is_along_line),u_is_variable_anchor:new maplibre_gl_shared_mu(e,t.u_is_variable_anchor),u_texsize:new maplibre_gl_shared_gu(e,t.u_texsize),u_texture:new maplibre_gl_shared_mu(e,t.u_texture),u_gamma_scale:new maplibre_gl_shared_hu(e,t.u_gamma_scale),u_is_halo:new maplibre_gl_shared_mu(e,t.u_is_halo),u_is_plain:new maplibre_gl_shared_mu(e,t.u_is_plain),u_translation:new maplibre_gl_shared_gu(e,t.u_translation),u_pitched_scale:new maplibre_gl_shared_hu(e,t.u_pitched_scale),u_is_offset:new maplibre_gl_shared_mu(e,t.u_is_offset),u_height_anchor_ground:new maplibre_gl_shared_mu(e,t.u_height_anchor_ground)}),maplibre_gl_Pu=(e,t)=>({u_is_size_zoom_constant:new maplibre_gl_shared_mu(e,t.u_is_size_zoom_constant),u_is_size_feature_constant:new maplibre_gl_shared_mu(e,t.u_is_size_feature_constant),u_size_t:new maplibre_gl_shared_hu(e,t.u_size_t),u_size:new maplibre_gl_shared_hu(e,t.u_size),u_rotate_symbol:new maplibre_gl_shared_mu(e,t.u_rotate_symbol),u_label_plane_matrix:new maplibre_gl_shared_Cu(e,t.u_label_plane_matrix),u_coord_matrix:new maplibre_gl_shared_Cu(e,t.u_coord_matrix),u_is_text:new maplibre_gl_shared_mu(e,t.u_is_text),u_pitch_with_map:new maplibre_gl_shared_mu(e,t.u_pitch_with_map),u_is_along_line:new maplibre_gl_shared_mu(e,t.u_is_along_line),u_is_variable_anchor:new maplibre_gl_shared_mu(e,t.u_is_variable_anchor),u_texsize:new maplibre_gl_shared_gu(e,t.u_texsize),u_texsize_icon:new maplibre_gl_shared_gu(e,t.u_texsize_icon),u_texture:new maplibre_gl_shared_mu(e,t.u_texture),u_texture_icon:new maplibre_gl_shared_mu(e,t.u_texture_icon),u_gamma_scale:new maplibre_gl_shared_hu(e,t.u_gamma_scale),u_is_halo:new maplibre_gl_shared_mu(e,t.u_is_halo),u_translation:new maplibre_gl_shared_gu(e,t.u_translation),u_pitched_scale:new maplibre_gl_shared_hu(e,t.u_pitched_scale),u_is_offset:new maplibre_gl_shared_mu(e,t.u_is_offset),u_height_anchor_ground:new maplibre_gl_shared_mu(e,t.u_height_anchor_ground)}),maplibre_gl_Fu=(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m)=>({u_is_size_zoom_constant:+(e===`constant`||e===`source`),u_is_size_feature_constant:+(e===`constant`||e===`camera`),u_size_t:t?t.uSizeT:0,u_size:t?t.uSize:0,u_rotate_symbol:+n,u_label_plane_matrix:s,u_coord_matrix:c,u_is_text:+u,u_pitch_with_map:+r,u_is_along_line:i,u_is_variable_anchor:a,u_texsize:d,u_texture:0,u_translation:l,u_pitched_scale:f,u_is_offset:p,u_height_anchor_ground:+m}),maplibre_gl_Iu=(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h)=>{let g=o.transform;return maplibre_gl_shared_xt(maplibre_gl_Fu(e,t,n,r,i,a,o,s,c,l,u,d,p,m,h),{u_gamma_scale:r?Math.cos(g.pitch*Math.PI/180)*g.cameraToCenterDistance:1,u_is_halo:+!!f,u_is_plain:1})},maplibre_gl_Lu=(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m)=>maplibre_gl_shared_xt(maplibre_gl_Iu(e,t,n,r,i,a,o,s,c,l,!0,u,!0,f,p,m),{u_texsize_icon:d,u_texture_icon:1}),maplibre_gl_Ru=(e,t)=>({u_opacity:new maplibre_gl_shared_hu(e,t.u_opacity),u_color:new maplibre_gl_shared_yu(e,t.u_color)}),maplibre_gl_zu=(e,t)=>({u_opacity:new maplibre_gl_shared_hu(e,t.u_opacity),u_image:new maplibre_gl_shared_mu(e,t.u_image),u_pattern_tl_a:new maplibre_gl_shared_gu(e,t.u_pattern_tl_a),u_pattern_br_a:new maplibre_gl_shared_gu(e,t.u_pattern_br_a),u_pattern_tl_b:new maplibre_gl_shared_gu(e,t.u_pattern_tl_b),u_pattern_br_b:new maplibre_gl_shared_gu(e,t.u_pattern_br_b),u_texsize:new maplibre_gl_shared_gu(e,t.u_texsize),u_mix:new maplibre_gl_shared_hu(e,t.u_mix),u_pattern_size_a:new maplibre_gl_shared_gu(e,t.u_pattern_size_a),u_pattern_size_b:new maplibre_gl_shared_gu(e,t.u_pattern_size_b),u_scale_a:new maplibre_gl_shared_hu(e,t.u_scale_a),u_scale_b:new maplibre_gl_shared_hu(e,t.u_scale_b),u_pixel_coord_upper:new maplibre_gl_shared_gu(e,t.u_pixel_coord_upper),u_pixel_coord_lower:new maplibre_gl_shared_gu(e,t.u_pixel_coord_lower),u_tile_units_to_pixels:new maplibre_gl_shared_hu(e,t.u_tile_units_to_pixels)}),maplibre_gl_Bu=(e,t)=>({u_opacity:e,u_color:t}),maplibre_gl_Vu=(e,t,n,r,i)=>maplibre_gl_shared_xt(maplibre_gl_Wl(n,i,t,r),{u_opacity:e}),maplibre_gl_Hu=(e,t)=>({u_sun_pos:new dist_maplibre_gl_shared_u(e,t.u_sun_pos),u_atmosphere_blend:new maplibre_gl_shared_hu(e,t.u_atmosphere_blend),u_globe_position:new dist_maplibre_gl_shared_u(e,t.u_globe_position),u_globe_radius:new maplibre_gl_shared_hu(e,t.u_globe_radius),u_inv_proj_matrix:new maplibre_gl_shared_Cu(e,t.u_inv_proj_matrix)}),maplibre_gl_Uu=(e,t,n,r,i)=>({u_sun_pos:e,u_atmosphere_blend:t,u_globe_position:n,u_globe_radius:r,u_inv_proj_matrix:i}),maplibre_gl_Wu=(e,t)=>({u_sky_color:new maplibre_gl_shared_yu(e,t.u_sky_color),u_horizon_color:new maplibre_gl_shared_yu(e,t.u_horizon_color),u_horizon:new maplibre_gl_shared_gu(e,t.u_horizon),u_horizon_normal:new maplibre_gl_shared_gu(e,t.u_horizon_normal),u_sky_horizon_blend:new maplibre_gl_shared_hu(e,t.u_sky_horizon_blend),u_sky_blend:new maplibre_gl_shared_hu(e,t.u_sky_blend),u_inv_proj_matrix:new maplibre_gl_shared_Cu(e,t.u_inv_proj_matrix),u_globe_position:new dist_maplibre_gl_shared_u(e,t.u_globe_position),u_globe_radius:new maplibre_gl_shared_hu(e,t.u_globe_radius)}),maplibre_gl_Gu=(e,t,n)=>{let r=Math.cos(t.rollInRadians),i=Math.sin(t.rollInRadians),a=maplibre_gl_shared_Jp(t),o=t.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}).projectionTransition;return{u_sky_color:e.properties.get(`sky-color`),u_horizon_color:e.properties.get(`horizon-color`),u_horizon:[(t.width/2-a*i)*n,(t.height/2+a*r)*n],u_horizon_normal:[-i,r],u_sky_horizon_blend:e.properties.get(`sky-horizon-blend`)*t.height/2*n,u_sky_blend:o,u_inv_proj_matrix:t.inverseProjectionMatrix,u_globe_position:maplibre_gl_Vc(t),u_globe_radius:maplibre_gl_Bc(t.worldSize,t.center.lat)}},maplibre_gl_Ku=(e,t)=>({}),maplibre_gl_qu={fillExtrusion:maplibre_gl_Gl,fillExtrusionPattern:maplibre_gl_Kl,fill:maplibre_gl_Yl,fillPattern:maplibre_gl_Xl,fillOutline:maplibre_gl_Zl,fillOutlinePattern:maplibre_gl_Ql,circle:maplibre_gl_ru,collisionBox:maplibre_gl_Ku,collisionCircle:maplibre_gl_Ku,debug:maplibre_gl_au,depth:maplibre_gl_Ku,clippingMask:maplibre_gl_Ku,heatmap:maplibre_gl_su,heatmapTexture:maplibre_gl_cu,hillshade:maplibre_gl_du,hillshadePrepare:maplibre_gl_fu,colorRelief:maplibre_gl_gu,line:maplibre_gl_vu,lineGradient:maplibre_gl_yu,linePattern:maplibre_gl_bu,lineSDF:maplibre_gl_xu,lineGradientSDF:maplibre_gl_Su,layerOpacity:maplibre_gl_Au,raster:maplibre_gl_Ba,symbolIcon:maplibre_gl_Mu,symbolSDF:maplibre_gl_Nu,symbolTextAndIcon:maplibre_gl_Pu,background:maplibre_gl_Ru,backgroundPattern:maplibre_gl_zu,terrain:maplibre_gl_Cl,terrainDepth:maplibre_gl_wl,atmosphere:maplibre_gl_Hu,sky:maplibre_gl_Wu};var maplibre_gl_Ju=class{constructor(e,t,n){this.context=e;let r=e.gl;this.buffer=r.createBuffer(),this.dynamicDraw=!!n,this.context.unbindVAO(),e.bindElementBuffer.set(this.buffer),r.bufferData(r.ELEMENT_ARRAY_BUFFER,t.arrayBuffer,this.dynamicDraw?r.DYNAMIC_DRAW:r.STATIC_DRAW),this.dynamicDraw||t.freeBufferAfterUpload()}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(e){let t=this.context.gl;if(!this.dynamicDraw)throw Error(`Attempted to update data while not in dynamic mode.`);this.context.unbindVAO(),this.bind(),t.bufferSubData(t.ELEMENT_ARRAY_BUFFER,0,e.arrayBuffer)}destroy(){let e=this.context.gl;this.buffer&&(e.deleteBuffer(this.buffer),delete this.buffer)}};const maplibre_gl_Yu={Int8:`BYTE`,Uint8:`UNSIGNED_BYTE`,Int16:`SHORT`,Uint16:`UNSIGNED_SHORT`,Int32:`INT`,Uint32:`UNSIGNED_INT`,Float32:`FLOAT`};var maplibre_gl_Xu=class{constructor(e,t,n,r){this.length=t.length,this.attributes=n,this.itemSize=t.bytesPerElement,this.dynamicDraw=r,this.context=e;let i=e.gl;this.buffer=i.createBuffer(),e.bindVertexBuffer.set(this.buffer),i.bufferData(i.ARRAY_BUFFER,t.arrayBuffer,this.dynamicDraw?i.DYNAMIC_DRAW:i.STATIC_DRAW),this.dynamicDraw||t.freeBufferAfterUpload()}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(e){if(e.length!==this.length)throw Error(`Length of new data is ${e.length}, which doesn't match current length of ${this.length}`);let t=this.context.gl;this.bind(),t.bufferSubData(t.ARRAY_BUFFER,0,e.arrayBuffer)}enableAttributes(e,t){for(let n of this.attributes){let r=t.attributes[n.name];r!==void 0&&e.enableVertexAttribArray(r.location)}}setVertexAttribPointers(e,t,n){for(let r of this.attributes){let i=t.attributes[r.name];if(i!==void 0){let t=r.offset+this.itemSize*(n||0);i.isInteger?e.vertexAttribIPointer(i.location,r.components,e[maplibre_gl_Yu[r.type]],this.itemSize,t):e.vertexAttribPointer(i.location,r.components,e[maplibre_gl_Yu[r.type]],!1,this.itemSize,t)}}}destroy(){let e=this.context.gl;this.buffer&&(e.deleteBuffer(this.buffer),delete this.buffer)}},maplibre_gl_X=class{constructor(e){this.gl=e.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(e){}getDefault(){return this.default}setDefault(){this.set(this.default)}},maplibre_gl_Zu=class extends maplibre_gl_X{getDefault(){return maplibre_gl_shared_V.transparent}set(e){let t=this.current;(e.r!==t.r||e.g!==t.g||e.b!==t.b||e.a!==t.a||this.dirty)&&(this.gl.clearColor(e.r,e.g,e.b,e.a),this.current=e,this.dirty=!1)}},maplibre_gl_Qu=class extends maplibre_gl_X{getDefault(){return 1}set(e){(e!==this.current||this.dirty)&&(this.gl.clearDepth(e),this.current=e,this.dirty=!1)}},maplibre_gl_$u=class extends maplibre_gl_X{getDefault(){return 0}set(e){(e!==this.current||this.dirty)&&(this.gl.clearStencil(e),this.current=e,this.dirty=!1)}},maplibre_gl_ed=class extends maplibre_gl_X{getDefault(){return[!0,!0,!0,!0]}set(e){let t=this.current;(e[0]!==t[0]||e[1]!==t[1]||e[2]!==t[2]||e[3]!==t[3]||this.dirty)&&(this.gl.colorMask(e[0],e[1],e[2],e[3]),this.current=e,this.dirty=!1)}},maplibre_gl_td=class extends maplibre_gl_X{getDefault(){return!0}set(e){(e!==this.current||this.dirty)&&(this.gl.depthMask(e),this.current=e,this.dirty=!1)}},maplibre_gl_nd=class extends maplibre_gl_X{getDefault(){return 255}set(e){(e!==this.current||this.dirty)&&(this.gl.stencilMask(e),this.current=e,this.dirty=!1)}},maplibre_gl_rd=class extends maplibre_gl_X{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(e){let t=this.current;(e.func!==t.func||e.ref!==t.ref||e.mask!==t.mask||this.dirty)&&(this.gl.stencilFunc(e.func,e.ref,e.mask),this.current=e,this.dirty=!1)}},maplibre_gl_id=class extends maplibre_gl_X{getDefault(){let e=this.gl;return[e.KEEP,e.KEEP,e.KEEP]}set(e){let t=this.current;(e[0]!==t[0]||e[1]!==t[1]||e[2]!==t[2]||this.dirty)&&(this.gl.stencilOp(e[0],e[1],e[2]),this.current=e,this.dirty=!1)}},maplibre_gl_ad=class extends maplibre_gl_X{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;e?t.enable(t.STENCIL_TEST):t.disable(t.STENCIL_TEST),this.current=e,this.dirty=!1}},maplibre_gl_od=class extends maplibre_gl_X{getDefault(){return[0,1]}set(e){let t=this.current;(e[0]!==t[0]||e[1]!==t[1]||this.dirty)&&(this.gl.depthRange(e[0],e[1]),this.current=e,this.dirty=!1)}},maplibre_gl_sd=class extends maplibre_gl_X{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;e?t.enable(t.DEPTH_TEST):t.disable(t.DEPTH_TEST),this.current=e,this.dirty=!1}},maplibre_gl_cd=class extends maplibre_gl_X{getDefault(){return this.gl.LESS}set(e){(e!==this.current||this.dirty)&&(this.gl.depthFunc(e),this.current=e,this.dirty=!1)}},maplibre_gl_ld=class extends maplibre_gl_X{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;e?t.enable(t.BLEND):t.disable(t.BLEND),this.current=e,this.dirty=!1}},maplibre_gl_ud=class extends maplibre_gl_X{getDefault(){let e=this.gl;return[e.ONE,e.ZERO]}set(e){let t=this.current;(e[0]!==t[0]||e[1]!==t[1]||this.dirty)&&(this.gl.blendFunc(e[0],e[1]),this.current=e,this.dirty=!1)}},maplibre_gl_dd=class extends maplibre_gl_X{getDefault(){return maplibre_gl_shared_V.transparent}set(e){let t=this.current;(e.r!==t.r||e.g!==t.g||e.b!==t.b||e.a!==t.a||this.dirty)&&(this.gl.blendColor(e.r,e.g,e.b,e.a),this.current=e,this.dirty=!1)}},maplibre_gl_fd=class extends maplibre_gl_X{getDefault(){return this.gl.FUNC_ADD}set(e){(e!==this.current||this.dirty)&&(this.gl.blendEquation(e),this.current=e,this.dirty=!1)}},maplibre_gl_pd=class extends maplibre_gl_X{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;e?t.enable(t.CULL_FACE):t.disable(t.CULL_FACE),this.current=e,this.dirty=!1}},maplibre_gl_md=class extends maplibre_gl_X{getDefault(){return this.gl.BACK}set(e){(e!==this.current||this.dirty)&&(this.gl.cullFace(e),this.current=e,this.dirty=!1)}},maplibre_gl_hd=class extends maplibre_gl_X{getDefault(){return this.gl.CCW}set(e){(e!==this.current||this.dirty)&&(this.gl.frontFace(e),this.current=e,this.dirty=!1)}},maplibre_gl_gd=class extends maplibre_gl_X{getDefault(){return null}set(e){(e!==this.current||this.dirty)&&(this.gl.useProgram(e),this.current=e,this.dirty=!1)}},maplibre_gl_d=class extends maplibre_gl_X{getDefault(){return this.gl.TEXTURE0}set(e){(e!==this.current||this.dirty)&&(this.gl.activeTexture(e),this.current=e,this.dirty=!1)}},maplibre_gl_vd=class extends maplibre_gl_X{getDefault(){let e=this.gl;return[0,0,e.drawingBufferWidth,e.drawingBufferHeight]}set(e){let t=this.current;(e[0]!==t[0]||e[1]!==t[1]||e[2]!==t[2]||e[3]!==t[3]||this.dirty)&&(this.gl.viewport(e[0],e[1],e[2],e[3]),this.current=e,this.dirty=!1)}},maplibre_gl_yd=class extends maplibre_gl_X{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;t.bindFramebuffer(t.FRAMEBUFFER,e),this.current=e,this.dirty=!1}},maplibre_gl_bd=class extends maplibre_gl_X{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;t.bindRenderbuffer(t.RENDERBUFFER,e),this.current=e,this.dirty=!1}},maplibre_gl_xd=class extends maplibre_gl_X{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;t.bindTexture(t.TEXTURE_2D,e),this.current=e,this.dirty=!1}},maplibre_gl_Sd=class extends maplibre_gl_X{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;t.bindBuffer(t.ARRAY_BUFFER,e),this.current=e,this.dirty=!1}},maplibre_gl_Cd=class extends maplibre_gl_X{getDefault(){return null}set(e){let t=this.gl;t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,e),this.current=e,this.dirty=!1}},maplibre_gl_wd=class extends maplibre_gl_X{getDefault(){return null}set(e){(e!==this.current||this.dirty)&&(this.gl.bindVertexArray(e),this.current=e,this.dirty=!1)}},maplibre_gl_Td=class extends maplibre_gl_X{getDefault(){return 4}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;t.pixelStorei(t.UNPACK_ALIGNMENT,e),this.current=e,this.dirty=!1}},maplibre_gl_Ed=class extends maplibre_gl_X{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e),this.current=e,this.dirty=!1}},maplibre_gl_Dd=class extends maplibre_gl_X{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,e),this.current=e,this.dirty=!1}},maplibre_gl_Od=class extends maplibre_gl_X{constructor(e,t){super(e),this.context=e,this.parent=t}getDefault(){return null}},maplibre_gl_kd=class extends maplibre_gl_Od{setDirty(){this.dirty=!0}set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let t=this.gl;t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,e,0),this.current=e,this.dirty=!1}},maplibre_gl_Ad=class extends maplibre_gl_Od{set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let t=this.gl;t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.RENDERBUFFER,e),this.current=e,this.dirty=!1}},maplibre_gl_jd=class extends maplibre_gl_Od{set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let t=this.gl;t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.RENDERBUFFER,e),this.current=e,this.dirty=!1}},maplibre_gl_Md=class{constructor(e,t,n,r,i){this.context=e,this.width=t,this.height=n;let a=e.gl,o=this.framebuffer=a.createFramebuffer();if(this.colorAttachment=new maplibre_gl_kd(e,o),r)this.depthAttachment=i?new maplibre_gl_jd(e,o):new maplibre_gl_Ad(e,o);else if(i)throw Error(`Stencil cannot be set without depth`)}destroy(){let e=this.context.gl,t=this.colorAttachment.get();if(t&&e.deleteTexture(t),this.depthAttachment){let t=this.depthAttachment.get();t&&e.deleteRenderbuffer(t)}e.deleteFramebuffer(this.framebuffer)}};const maplibre_gl_Nd=maplibre_gl_Al([{name:`u_units_to_pixels`,type:`vec2`},{name:`u_world_size`,type:`vec2`},{name:`u_camera_to_center_distance`,type:`float`},{name:`u_symbol_fade_change`,type:`float`},{name:`u_aspect_ratio`,type:`float`},{name:`u_device_pixel_ratio`,type:`float`},{name:`u_viewport_size`,type:`vec2`},{name:`u_pixel_extrude_scale`,type:`vec2`},{name:`u_pitch`,type:`float`}]),maplibre_gl_Pd=maplibre_gl_Nd.offsets;function maplibre_gl_Fd(e){return new maplibre_gl_jl(e,maplibre_gl_Dl.FrameUBO,maplibre_gl_Nd)}function maplibre_gl_Id(e,t){let n=e.pending,{transform:r}=t,i=t.context.gl;n[maplibre_gl_Pd.u_units_to_pixels]=1/r.pixelsToGLUnits[0],n[maplibre_gl_Pd.u_units_to_pixels+1]=1/r.pixelsToGLUnits[1],n[maplibre_gl_Pd.u_world_size]=i.drawingBufferWidth,n[maplibre_gl_Pd.u_world_size+1]=i.drawingBufferHeight,n[maplibre_gl_Pd.u_camera_to_center_distance]=r.cameraToCenterDistance,n[maplibre_gl_Pd.u_symbol_fade_change]=t.options.fadeDuration?t.symbolFadeChange:1,n[maplibre_gl_Pd.u_aspect_ratio]=r.width/r.height,n[maplibre_gl_Pd.u_device_pixel_ratio]=t.pixelRatio,n[maplibre_gl_Pd.u_viewport_size]=r.width,n[maplibre_gl_Pd.u_viewport_size+1]=r.height,n[maplibre_gl_Pd.u_pixel_extrude_scale]=1/r.width,n[maplibre_gl_Pd.u_pixel_extrude_scale+1]=1/r.height,n[maplibre_gl_Pd.u_pitch]=r.pitch/360*2*Math.PI,e.upload()}var maplibre_gl_Ld=class{constructor(e,t,n){this.blendFunction=e,this.blendColor=t,this.mask=n}};maplibre_gl_Ld.Replace=[1,0],maplibre_gl_Ld.disabled=new maplibre_gl_Ld(maplibre_gl_Ld.Replace,maplibre_gl_shared_V.transparent,[!1,!1,!1,!1]),maplibre_gl_Ld.unblended=new maplibre_gl_Ld(maplibre_gl_Ld.Replace,maplibre_gl_shared_V.transparent,[!0,!0,!0,!0]),maplibre_gl_Ld.alphaBlended=new maplibre_gl_Ld([1,771],maplibre_gl_shared_V.transparent,[!0,!0,!0,!0]);var maplibre_gl_Rd=class{constructor(e){this.gl=e,this.clearColor=new maplibre_gl_Zu(this),this.clearDepth=new maplibre_gl_Qu(this),this.clearStencil=new maplibre_gl_$u(this),this.colorMask=new maplibre_gl_ed(this),this.depthMask=new maplibre_gl_td(this),this.stencilMask=new maplibre_gl_nd(this),this.stencilFunc=new maplibre_gl_rd(this),this.stencilOp=new maplibre_gl_id(this),this.stencilTest=new maplibre_gl_ad(this),this.depthRange=new maplibre_gl_od(this),this.depthTest=new maplibre_gl_sd(this),this.depthFunc=new maplibre_gl_cd(this),this.blend=new maplibre_gl_ld(this),this.blendFunc=new maplibre_gl_ud(this),this.blendColor=new maplibre_gl_dd(this),this.blendEquation=new maplibre_gl_fd(this),this.cullFace=new maplibre_gl_pd(this),this.cullFaceSide=new maplibre_gl_md(this),this.frontFace=new maplibre_gl_hd(this),this.program=new maplibre_gl_gd(this),this.activeTexture=new maplibre_gl_d(this),this.viewport=new maplibre_gl_vd(this),this.bindFramebuffer=new maplibre_gl_yd(this),this.bindRenderbuffer=new maplibre_gl_bd(this),this.bindTexture=new maplibre_gl_xd(this),this.bindVertexBuffer=new maplibre_gl_Sd(this),this.bindElementBuffer=new maplibre_gl_Cd(this),this.bindVertexArray=new maplibre_gl_wd(this),this.pixelStoreUnpack=new maplibre_gl_Td(this),this.pixelStoreUnpackPremultiplyAlpha=new maplibre_gl_Ed(this),this.pixelStoreUnpackFlipY=new maplibre_gl_Dd(this),this.extTextureFilterAnisotropic=e.getExtension(`EXT_texture_filter_anisotropic`),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=e.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),this.maxTextureSize=e.getParameter(e.MAX_TEXTURE_SIZE),e.getExtension(`EXT_color_buffer_half_float`),e.getExtension(`EXT_color_buffer_float`),this.projectionUniformBuffer=maplibre_gl_Pl(this),this.terrainUniformBuffer=maplibre_gl_Rl(this),this.frameUniformBuffer=maplibre_gl_Fd(this)}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,this.projectionUniformBuffer.bindingDirty=!0,this.terrainUniformBuffer.bindingDirty=!0,this.frameUniformBuffer.bindingDirty=!0}setCustomLayerDefaults(){this.unbindVAO(),this.cullFace.setDefault(),this.activeTexture.setDefault(),this.pixelStoreUnpack.setDefault(),this.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.pixelStoreUnpackFlipY.setDefault()}createIndexBuffer(e,t){return new maplibre_gl_Ju(this,e,t)}createVertexBuffer(e,t,n){return new maplibre_gl_Xu(this,e,t,n)}createRenderbuffer(e,t,n){let r=this.gl,i=r.createRenderbuffer();return this.bindRenderbuffer.set(i),r.renderbufferStorage(r.RENDERBUFFER,e,t,n),this.bindRenderbuffer.set(null),i}createFramebuffer(e,t,n,r){return new maplibre_gl_Md(this,e,t,n,r)}clear({color:e,depth:t,stencil:n}){let r=this.gl,i=0;e&&(i|=r.COLOR_BUFFER_BIT,this.clearColor.set(e),this.colorMask.set([!0,!0,!0,!0])),t!==void 0&&(i|=r.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(t),this.depthMask.set(!0)),n!==void 0&&(i|=r.STENCIL_BUFFER_BIT,this.clearStencil.set(n),this.stencilMask.set(255)),r.clear(i)}setCullFace(e){e.enable===!1?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(e.mode),this.frontFace.set(e.frontFace))}setDepthMode(e){e.func===this.gl.ALWAYS&&!e.mask?this.depthTest.set(!1):(this.depthTest.set(!0),this.depthFunc.set(e.func),this.depthMask.set(e.mask),this.depthRange.set(e.range))}setStencilMode(e){e.test.func===this.gl.ALWAYS&&!e.mask?this.stencilTest.set(!1):(this.stencilTest.set(!0),this.stencilMask.set(e.mask),this.stencilOp.set([e.fail,e.depthFail,e.pass]),this.stencilFunc.set({func:e.test.func,ref:e.ref,mask:e.test.mask}))}setColorMode(e){maplibre_gl_shared_Mt(e.blendFunction,maplibre_gl_Ld.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(e.blendFunction),this.blendColor.set(e.blendColor)),this.colorMask.set(e.mask)}createVertexArray(){return this.gl.createVertexArray()}deleteVertexArray(e){this.gl.deleteVertexArray(e)}unbindVAO(){this.bindVertexArray.set(null)}},maplibre_gl_Z=class{constructor(e,t,n){this.func=e,this.mask=t,this.range=n}};maplibre_gl_Z.ReadOnly=!1,maplibre_gl_Z.ReadWrite=!0,maplibre_gl_Z.disabled=new maplibre_gl_Z(519,maplibre_gl_Z.ReadOnly,[0,1]);const maplibre_gl_zd=7680;var maplibre_gl_Q=class{constructor(e,t,n,r,i,a){this.test=e,this.ref=t,this.mask=n,this.fail=r,this.depthFail=i,this.pass=a}};maplibre_gl_Q.disabled=new maplibre_gl_Q({func:519,mask:0},0,0,maplibre_gl_zd,maplibre_gl_zd,maplibre_gl_zd);const maplibre_gl_Bd=1029,maplibre_gl_Vd=2305;var maplibre_gl_$=class{constructor(e,t,n){this.enable=e,this.mode=t,this.frontFace=n}};maplibre_gl_$.disabled=new maplibre_gl_$(!1,maplibre_gl_Bd,maplibre_gl_Vd),maplibre_gl_$.backCCW=new maplibre_gl_$(!0,maplibre_gl_Bd,maplibre_gl_Vd),maplibre_gl_$.frontCCW=new maplibre_gl_$(!0,1028,maplibre_gl_Vd);let maplibre_gl_Hd;function maplibre_gl_Ud(e,t,n,r,i){let a=e.context,o=e.transform,s=a.gl,c=e.useProgram(`collisionBox`),l=[],u=0,d=0;for(let f of r){let r=t.getTile(f).getBucket(n);if(!r)continue;let p=i?r.textCollisionBox:r.iconCollisionBox,m=r.collisionCircleArray;m.length>0&&(l.push({circleArray:m,circleOffset:d,coord:f}),u+=m.length/4,d=u),p&&c.draw(a,s.LINES,maplibre_gl_Z.disabled,maplibre_gl_Q.disabled,e.colorModeForRenderPass(),maplibre_gl_$.disabled,null,e.style.map.terrain?.getTerrainData(f),o.getProjectionData({overscaledTileID:f,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),n.id,p.layoutVertexBuffer,p.indexBuffer,p.segments,null,e.transform.zoom,null,null,p.collisionVertexBuffer)}if(!i||!l.length)return;let p=e.useProgram(`collisionCircle`),m=new maplibre_gl_shared_Jl;m.resize(u*4),m._trim();let h=0;for(let e of l)for(let t=0;t<e.circleArray.length/4;t++){let n=t*4,r=e.circleArray[n+0],i=e.circleArray[n+1],a=e.circleArray[n+2],o=e.circleArray[n+3];m.emplace(h++,r,i,a,o,0),m.emplace(h++,r,i,a,o,1),m.emplace(h++,r,i,a,o,2),m.emplace(h++,r,i,a,o,3)}(!maplibre_gl_Hd||maplibre_gl_Hd.length<u*2)&&(maplibre_gl_Hd=maplibre_gl_Wd(u));let g=a.createIndexBuffer(maplibre_gl_Hd,!0),_=a.createVertexBuffer(m,fg.members,!0);for(let t of l)p.draw(a,s.TRIANGLES,maplibre_gl_Z.disabled,maplibre_gl_Q.disabled,e.colorModeForRenderPass(),maplibre_gl_$.disabled,null,e.style.map.terrain?.getTerrainData(t.coord),null,n.id,_,g,maplibre_gl_shared_nu.simpleSegment(0,t.circleOffset*2,t.circleArray.length,t.circleArray.length/2),null,e.transform.zoom,null,null,null);_.destroy(),g.destroy()}function maplibre_gl_Wd(e){let t=e*2,n=new maplibre_gl_shared_Xl;n.resize(t),n._trim();for(let e=0;e<t;e++){let t=e*6;n.uint16[t+0]=e*4+0,n.uint16[t+1]=e*4+1,n.uint16[t+2]=e*4+2,n.uint16[t+3]=e*4+2,n.uint16[t+4]=e*4+3,n.uint16[t+5]=e*4+0}return n}const maplibre_gl_Gd=maplibre_gl_shared_C(new Float32Array(16));function maplibre_gl_Kd(e,t,n,r,i,a){if(a.currentPass!==`translucent`)return;let{isRenderingToTexture:o}=a,s=maplibre_gl_Q.disabled,c=e.colorModeForRenderPass();(n._unevaluatedLayout.hasValue(`text-variable-anchor`)||n._unevaluatedLayout.hasValue(`text-variable-anchor-offset`))&&maplibre_gl_Jd(r,e,n,t,n.layout.get(`text-rotation-alignment`),n.layout.get(`text-pitch-alignment`),n.paint.get(`text-translate`),n.paint.get(`text-translate-anchor`),i),n.paint.get(`icon-opacity`).constantOr(1)!==0&&maplibre_gl_Qd(e,t,n,r,!1,n.paint.get(`icon-translate`),n.paint.get(`icon-translate-anchor`),n.layout.get(`icon-rotation-alignment`).constantOr(`viewport`),n.layout.get(`icon-pitch-alignment`),n.layout.get(`icon-keep-upright`),s,c,o),n.paint.get(`text-opacity`).constantOr(1)!==0&&maplibre_gl_Qd(e,t,n,r,!0,n.paint.get(`text-translate`),n.paint.get(`text-translate-anchor`),n.layout.get(`text-rotation-alignment`),n.layout.get(`text-pitch-alignment`),n.layout.get(`text-keep-upright`),s,c,o),t.map.showCollisionBoxes&&(maplibre_gl_Ud(e,t,n,r,!0),maplibre_gl_Ud(e,t,n,r,!1))}function maplibre_gl_qd(e,t,n,r,i,a){let{horizontalAlign:o,verticalAlign:s}=_v(e),c=-(o-.5)*t,l=-(s-.5)*n;return new maplibre_gl_shared_l((c/i+r[0])*a,(l/i+r[1])*a)}function maplibre_gl_Jd(e,t,n,r,a,o,s,c,l){let u=t.transform,d=t.style.map.terrain,f=a===`map`,p=o===`map`;for(let a of e){let e=r.getTile(a),o=e.getBucket(n);if(!o?.text?.segments.get().length)continue;let m=o.textSizeData,h=Hv(m,u.zoom),g=maplibre_gl_shared_N(e,1,t.transform.zoom),_=maplibre_gl_Zo(f,t.transform,g),v=n.layout.get(`icon-text-fit`)!==`none`&&o.hasIconData();if(h){let t=2**(u.zoom-e.tileID.overscaledZ),r=d?(e,t)=>d.getElevation(a,e,t):void 0;maplibre_gl_Xd(o,f,p,l,u,_,t,h,v,maplibre_gl_shared_it(u,e,s,c),a.toUnwrapped(),r,n.layout.get(`symbol-height-anchor`)===`ground`)}}}function maplibre_gl_Yd(e,t,n,r,i,a){let o=t.tileAnchorPoint.add(new maplibre_gl_shared_l(t.translation[0],t.translation[1]));if(t.pitchWithMap){let e=r.mult(a);n||(e=e.rotate(-i));let s=o.add(e);return maplibre_gl_ts(s.x,s.y,t.pitchedLabelPlaneMatrix,maplibre_gl_es(t,s.x,s.y)).point}if(n){let n=maplibre_gl_us(t.tileAnchorPoint.x+1,t.tileAnchorPoint.y,t).point.sub(e),i=Math.atan(n.y/n.x)+(n.x<0?Math.PI:0);return e.add(r.rotate(i))}return e.add(r)}function maplibre_gl_Xd(e,t,n,r,i,a,o,s,c,l,u,d,f){let m=e.text.placedSymbolArray,h=e.text.dynamicLayoutVertexArray,g=e.icon.dynamicLayoutVertexArray,_={};h.clear();for(let g=0;g<m.length;g++){let v=m.get(g),y=e.allowVerticalPlacement&&!v.placedOrientation,b=!v.hidden&&v.crossTileID&&!y?r[v.crossTileID]:null;if(!b)maplibre_gl_s(v.numGlyphs,h);else{let r=new maplibre_gl_shared_l(v.anchorX,v.anchorY),m={getElevation:d,heightOffset:v.heightOffset,heightAnchorGround:f,width:i.width,height:i.height,pitchedLabelPlaneMatrix:a,lineVertexArray:null,pitchWithMap:n,transform:i,projectionCache:null,tileAnchorPoint:r,translation:l,unwrappedTileID:u},g=n?maplibre_gl_fs(r.x,r.y,m):maplibre_gl_us(r.x,r.y,m),y=maplibre_gl_ns(i.cameraToCenterDistance,g.signedDistanceFromCamera),x=Vv(e.textSizeData,s,v)*y/24;n&&(x*=e.tilePixelRatio/o);let{width:S,height:C,anchor:w,textOffset:T,textBoxScale:E}=b,ee=maplibre_gl_qd(w,S,C,T,E,x),D=i.getPitchedTextCorrection(r.x+l[0],r.y+l[1],u),O=maplibre_gl_Yd(g.point,m,t,ee,-i.bearingInRadians,D),te=e.allowVerticalPlacement&&v.placedOrientation===2?Math.PI/2:0;for(let e=0;e<v.numGlyphs;e++)Fy(h,O,te);c&&v.associatedIconIndex>=0&&(_[v.associatedIconIndex]={shiftedAnchor:O,angle:te})}}if(c){g.clear();let t=e.icon.placedSymbolArray;for(let e=0;e<t.length;e++){let n=t.get(e);if(n.hidden)maplibre_gl_s(n.numGlyphs,g);else{let t=_[e];if(!t)maplibre_gl_s(n.numGlyphs,g);else for(let e=0;e<n.numGlyphs;e++)Fy(g,t.shiftedAnchor,t.angle)}}e.icon.dynamicLayoutVertexBuffer.updateData(g)}e.text.dynamicLayoutVertexBuffer.updateData(h)}function maplibre_gl_Zd(e,t,n){return n.iconsInText&&t?`symbolTextAndIcon`:e?`symbolSDF`:`symbolIcon`}function maplibre_gl_Qd(e,t,n,r,a,o,s,c,l,u,d,p,m){let h=e.context,g=h.gl,_=e.transform,v=c===`map`,y=l===`map`,b=c!==`viewport`&&n.layout.get(`symbol-placement`)!==`point`,x=v&&!y&&!b,S=!n.layout.get(`symbol-sort-key`).isConstant(),C=!1,w=e.getDepthModeForSublayer(0,maplibre_gl_Z.ReadOnly),T=n._unevaluatedLayout.hasValue(`text-variable-anchor`)||n._unevaluatedLayout.hasValue(`text-variable-anchor-offset`),E=[],ee=_.getCircleRadiusCorrection();for(let c of r){let r=t.getTile(c),l=r.getBucket(n);if(!l)continue;let d=a?l.text:l.icon;if(!d?.segments.get().length||!d.hasVisibleVertices)continue;let p=d.programConfigurations.get(n.id),h=a||l.sdfIcons,w=a?l.textSizeData:l.iconSizeData,D=y||_.pitch!==0,O=e.useProgram(maplibre_gl_Zd(h,a,l),p),te=Hv(w,_.zoom),k=e.style.map.terrain?.getTerrainData(c),ne,re=[0,0],ie,ae,oe=null,se;if(a){if(ie=r.glyphAtlasTexture,ae=g.LINEAR,ne=r.glyphAtlasTexture.size,l.iconsInText){re=r.imageAtlasTexture.size,oe=r.imageAtlasTexture;let t=w.kind===`composite`||w.kind===`camera`;se=D||e.options.rotating||e.options.zooming||t?g.LINEAR:g.NEAREST}}else{let t=n.layout.get(`icon-size`).constantOr(0)!==1||l.iconsNeedLinear;ie=r.imageAtlasTexture,ae=h||e.options.rotating||e.options.zooming||t||D?g.LINEAR:g.NEAREST,ne=r.imageAtlasTexture.size}let ce=maplibre_gl_shared_N(r,1,e.transform.zoom),le=maplibre_gl_Zo(v,e.transform,ce),ue=maplibre_gl_Qo(y,v,e.transform,ce),de=maplibre_gl_shared_it(_,r,o,s),fe=_.getProjectionData({overscaledTileID:c,applyGlobeMatrix:!m,applyTerrainMatrix:!0}),pe=T&&l.hasTextData(),me=n.layout.get(`icon-text-fit`)!==`none`&&pe&&l.hasIconData(),he=n._unevaluatedLayout.hasValue(`icon-offset`),ge=n.layout.get(`symbol-height-anchor`)===`ground`;if(b){let t=maplibre_gl_shared_b();maplibre_gl_qo(t,le);let r=e.style.map.terrain?(t,n)=>e.style.map.terrain.getElevation(c,t,n):void 0;maplibre_gl_is(l,e,a,le,t,y,u,n.layout.get(`text-rotation-alignment`)===`map`,c.toUnwrapped(),_.width,_.height,de,r)}let A=a&&T||me,_e=y?le:e.transform.clipSpaceToPixelsMatrix,ve=b||A?maplibre_gl_Gd:_e,ye=h&&n.paint.get(a?`text-halo-width`:`icon-halo-width`).constantOr(1)!==0,be;be=h?l.iconsInText?maplibre_gl_Lu(w.kind,te,x,y,b,A,e,ve,ue,de,ne,re,ee,he,ge):maplibre_gl_Iu(w.kind,te,x,y,b,A,e,ve,ue,de,a,ne,ye,ee,he,ge):maplibre_gl_Fu(w.kind,te,x,y,b,A,e,ve,ue,de,a,ne,ee,he,ge);let xe={program:O,buffers:d,uniformValues:be,projectionData:fe,atlasTexture:ie,atlasTextureIcon:oe,atlasInterpolation:ae,atlasInterpolationIcon:se,isSDF:h,hasHalo:ye};if(S&&l.canOverlap){C=!0;let e=d.segments.get();for(let t of e)E.push({segments:new maplibre_gl_shared_nu([t]),sortKey:t.sortKey,state:xe,terrainData:k})}else E.push({segments:d.segments,sortKey:0,state:xe,terrainData:k})}C&&E.sort((e,t)=>e.sortKey-t.sortKey);let D=n.paint.get(a?`text-halo-width`:`icon-halo-width`).constantOr(null)??1/0,O=n.layout.get(`text-letter-spacing`).constantOr(0)*24<0||D>1;for(let t of E){let r=t.state;h.activeTexture.set(g.TEXTURE0),r.atlasTexture.bind(r.atlasInterpolation,g.CLAMP_TO_EDGE),r.atlasTextureIcon&&(h.activeTexture.set(g.TEXTURE1),r.atlasTextureIcon&&r.atlasTextureIcon.bind(r.atlasInterpolationIcon,g.CLAMP_TO_EDGE));let i=r.isSDF&&r.hasHalo;if(i){let i=r.uniformValues;i.u_is_halo=1,O&&(i.u_is_plain=0,maplibre_gl_$d(r.buffers,t.segments,n,e,r.program,w,d,p,i,r.projectionData,t.terrainData),i.u_is_halo=0,i.u_is_plain=1)}maplibre_gl_$d(r.buffers,t.segments,n,e,r.program,w,d,p,r.uniformValues,r.projectionData,t.terrainData),i&&!O&&(r.uniformValues.u_is_halo=0)}}function maplibre_gl_$d(e,t,n,r,i,a,o,s,c,l,u){let d=r.context,f=d.gl;i.draw(d,f.TRIANGLES,a,o,s,maplibre_gl_$.backCCW,c,u,l,n.id,e.layoutVertexBuffer,e.indexBuffer,t,n.paint,r.transform.zoom,e.programConfigurations.get(n.id),e.dynamicLayoutVertexBuffer,e.opacityVertexBuffer)}function maplibre_gl_ef(e,t,n,r,i){if(i.currentPass!==`translucent`)return;let{isRenderingToTexture:a}=i,o=n.paint.get(`circle-opacity`),s=n.paint.get(`circle-stroke-width`),c=n.paint.get(`circle-stroke-opacity`),l=!n.layout.get(`circle-sort-key`).isConstant();if(o.constantOr(1)===0&&(s.constantOr(1)===0||c.constantOr(1)===0))return;let u=e.context,d=u.gl,p=e.transform,m=e.getDepthModeForSublayer(0,maplibre_gl_Z.ReadOnly),h=maplibre_gl_Q.disabled,g=e.colorModeForRenderPass(),_=[],v=p.getCircleRadiusCorrection();for(let i of r){let r=t.getTile(i),o=r.getBucket(n);if(!o)continue;let s=n.paint.get(`circle-translate`),c=n.paint.get(`circle-translate-anchor`),u=maplibre_gl_shared_it(p,r,s,c),d=o.programConfigurations.get(n.id),m=e.useProgram(`circle`,d),h=o.layoutVertexBuffer,g=o.indexBuffer,y=e.style.map.terrain?.getTerrainData(i),b={programConfiguration:d,program:m,layoutVertexBuffer:h,indexBuffer:g,uniformValues:maplibre_gl_iu(e,r,n,u,v),terrainData:y,projectionData:p.getProjectionData({overscaledTileID:i,applyGlobeMatrix:!a,applyTerrainMatrix:!0})};if(l){let e=o.segments.get();for(let t of e)_.push({segments:new maplibre_gl_shared_nu([t]),sortKey:t.sortKey,state:b})}else _.push({segments:o.segments,sortKey:0,state:b})}l&&_.sort((e,t)=>e.sortKey-t.sortKey);for(let t of _){let{programConfiguration:r,program:i,layoutVertexBuffer:a,indexBuffer:o,uniformValues:s,terrainData:c,projectionData:l}=t.state,f=t.segments;i.draw(u,d.TRIANGLES,m,h,g,maplibre_gl_$.backCCW,s,c,l,n.id,a,o,f,n.paint,e.transform.zoom,r)}}function maplibre_gl_tf(e,t,n,r,i){if(n.paint.get(`heatmap-opacity`)===0)return;let a=e.context,{isRenderingToTexture:o,isRenderingGlobe:s}=i;if(e.style.map.terrain){for(let a of r){let r=t.getTile(a);t.hasRenderableParent(a)||(i.currentPass===`offscreen`?maplibre_gl_af(e,r,n,a,s):i.currentPass===`translucent`&&maplibre_gl_of(e,n,a,o,s))}a.viewport.set([0,0,e.width,e.height])}else i.currentPass===`offscreen`?maplibre_gl_nf(e,t,n,r):i.currentPass===`translucent`&&maplibre_gl_rf(e,n)}function maplibre_gl_nf(e,t,n,r){let i=e.context,a=i.gl,o=e.transform,s=maplibre_gl_Q.disabled,c=new maplibre_gl_Ld([a.ONE,a.ONE],maplibre_gl_shared_V.transparent,[!0,!0,!0,!0]);maplibre_gl_sf(i,e,n),i.clear({color:maplibre_gl_shared_V.transparent});for(let l of r){if(t.hasRenderableParent(l))continue;let r=t.getTile(l),u=r.getBucket(n);if(!u)continue;let d=u.programConfigurations.get(n.id),f=e.useProgram(`heatmap`,d),p=o.getProjectionData({overscaledTileID:l,applyGlobeMatrix:!0,applyTerrainMatrix:!1}),m=o.getCircleRadiusCorrection();f.draw(i,a.TRIANGLES,maplibre_gl_Z.disabled,s,c,maplibre_gl_$.backCCW,maplibre_gl_lu(r,o.zoom,n.paint.get(`heatmap-intensity`),m),null,p,n.id,u.layoutVertexBuffer,u.indexBuffer,u.segments,n.paint,o.zoom,d)}i.viewport.set([0,0,e.width,e.height])}function maplibre_gl_rf(e,t){let n=e.context,r=n.gl;n.setColorMode(e.colorModeForRenderPass());let i=t.heatmapFbos.get((/* inlined export .Ct */"big-fb"));i&&(n.activeTexture.set(r.TEXTURE0),r.bindTexture(r.TEXTURE_2D,i.colorAttachment.get()),n.activeTexture.set(r.TEXTURE1),maplibre_gl_lf(n,t).bind(r.LINEAR,r.CLAMP_TO_EDGE),e.useProgram(`heatmapTexture`).draw(n,r.TRIANGLES,maplibre_gl_Z.disabled,maplibre_gl_Q.disabled,e.colorModeForRenderPass(),maplibre_gl_$.disabled,maplibre_gl_uu(e,t,0,1),null,null,t.id,e.viewportBuffer,e.quadTriangleIndexBuffer,e.viewportSegments,t.paint,e.transform.zoom))}function maplibre_gl_af(e,t,n,r,i){let a=e.context,o=a.gl,s=maplibre_gl_Q.disabled,c=new maplibre_gl_Ld([o.ONE,o.ONE],maplibre_gl_shared_V.transparent,[!0,!0,!0,!0]),l=t.getBucket(n);if(!l)return;let u=r.key,d=n.heatmapFbos.get(u);d||(d=maplibre_gl_cf(a,t.tileSize,t.tileSize),n.heatmapFbos.set(u,d)),a.bindFramebuffer.set(d.framebuffer),a.viewport.set([0,0,t.tileSize,t.tileSize]),a.clear({color:maplibre_gl_shared_V.transparent});let f=l.programConfigurations.get(n.id),p=e.useProgram(`heatmap`,f,!i),m=e.transform.getProjectionData({overscaledTileID:t.tileID,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),h=e.style.map.terrain.getTerrainData(r);p.draw(a,o.TRIANGLES,maplibre_gl_Z.disabled,s,c,maplibre_gl_$.disabled,maplibre_gl_lu(t,e.transform.zoom,n.paint.get(`heatmap-intensity`),1),h,m,n.id,l.layoutVertexBuffer,l.indexBuffer,l.segments,n.paint,e.transform.zoom,f)}function maplibre_gl_of(e,t,n,r,i){let a=e.context,o=a.gl,s=e.transform;a.setColorMode(e.colorModeForRenderPass());let c=maplibre_gl_lf(a,t),l=n.key,u=t.heatmapFbos.get(l);if(!u)return;a.activeTexture.set(o.TEXTURE0),o.bindTexture(o.TEXTURE_2D,u.colorAttachment.get()),a.activeTexture.set(o.TEXTURE1),c.bind(o.LINEAR,o.CLAMP_TO_EDGE);let d=s.getProjectionData({overscaledTileID:n,applyTerrainMatrix:i,applyGlobeMatrix:!r});e.useProgram(`heatmapTexture`).draw(a,o.TRIANGLES,maplibre_gl_Z.disabled,maplibre_gl_Q.disabled,e.colorModeForRenderPass(),maplibre_gl_$.disabled,maplibre_gl_uu(e,t,0,1),null,d,t.id,e.rasterBoundsBuffer,e.quadTriangleIndexBuffer,e.rasterBoundsSegments,t.paint,s.zoom),u.destroy(),t.heatmapFbos.delete(l)}function maplibre_gl_sf(e,t,n){let r=e.gl;e.activeTexture.set(r.TEXTURE1),e.viewport.set([0,0,t.width/4,t.height/4]);let i=n.heatmapFbos.get((/* inlined export .Ct */"big-fb"));i?(r.bindTexture(r.TEXTURE_2D,i.colorAttachment.get()),e.bindFramebuffer.set(i.framebuffer)):(i=maplibre_gl_cf(e,t.width/4,t.height/4),n.heatmapFbos.set((/* inlined export .Ct */"big-fb"),i))}function maplibre_gl_cf(e,t,n){let r=e.gl,i=r.createTexture();r.bindTexture(r.TEXTURE_2D,i),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.LINEAR),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,r.LINEAR),r.texStorage2D(r.TEXTURE_2D,1,r.RGBA16F,t,n);let a=e.createFramebuffer(t,n,!1,!1);return a.colorAttachment.set(i),a}function maplibre_gl_lf(e,t){return t.colorRampTexture||=new Gd(e,t.colorRamp,e.gl.RGBA),t.colorRampTexture}function maplibre_gl_uf(e,t,n,r){let i=e.context,a=i.bindFramebuffer.get(),o=i.viewport.get(),[,,s,c]=o;return maplibre_gl_df(e,s,c),i.viewport.set([0,0,s,c]),i.clear({color:maplibre_gl_shared_V.transparent,depth:1,stencil:0}),e.currentStencilSource=void 0,e.renderTileClippingMasks(t,n,r),{compositeTarget:a,compositeViewport:o}}function maplibre_gl_df(e,t,n){let r=e.context.gl;if(!e.layerOpacityFbo){let i=e.context.createFramebuffer(t,n,!0,!0),a=r.createTexture();r.bindTexture(r.TEXTURE_2D,a),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.LINEAR),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,r.LINEAR),r.texImage2D(r.TEXTURE_2D,0,r.RGBA,t,n,0,r.RGBA,r.UNSIGNED_BYTE,null),i.colorAttachment.set(a),i.depthAttachment.set(e.context.createRenderbuffer(r.DEPTH_STENCIL,t,n)),e.layerOpacityFbo=i,e.context.bindFramebuffer.set(e.layerOpacityFbo.framebuffer);return}if(e.layerOpacityFbo.width===t&&e.layerOpacityFbo.height===n){e.context.bindFramebuffer.set(e.layerOpacityFbo.framebuffer);return}let i=e.layerOpacityFbo;r.bindTexture(r.TEXTURE_2D,i.colorAttachment.get()),r.texImage2D(r.TEXTURE_2D,0,r.RGBA,t,n,0,r.RGBA,r.UNSIGNED_BYTE,null),e.context.bindRenderbuffer.set(i.depthAttachment.get()),r.renderbufferStorage(r.RENDERBUFFER,r.DEPTH_STENCIL,t,n),e.context.bindRenderbuffer.set(null),i.width=t,i.height=n,e.context.bindFramebuffer.set(i.framebuffer)}function maplibre_gl_ff(e,t,n,r){let i=e.context,a=i.gl;i.bindFramebuffer.set(n.compositeTarget),i.viewport.set(n.compositeViewport),i.activeTexture.set(a.TEXTURE0),a.bindTexture(a.TEXTURE_2D,e.layerOpacityFbo.colorAttachment.get()),e.useProgram(`layerOpacity`).draw(i,a.TRIANGLES,maplibre_gl_Z.disabled,maplibre_gl_Q.disabled,e.colorModeForRenderPass(),maplibre_gl_$.disabled,maplibre_gl_ju(t,0),null,null,r.id,e.viewportBuffer,e.quadTriangleIndexBuffer,e.viewportSegments,r.paint,e.transform.zoom),e.currentStencilSource=void 0}function maplibre_gl_pf(e,t,n,r,i,a,o,s){let c=256;if(i.stepInterpolant){let r=t.getSource().maxzoom,i=o.canonical.z===r?Math.ceil(1<<e.transform.maxZoom-o.canonical.z):1,s=a.maxLineLength/(/* inlined export .Rr */8192)*1024*i;c=maplibre_gl_shared_yt(maplibre_gl_shared_Et(s),256,n.maxTextureSize)}return s.gradient=Md({expression:i.gradientExpression(),evaluationKey:`lineProgress`,resolution:c,image:s.gradient||void 0,clips:a.lineClipsArray}),s.texture?s.texture.update(s.gradient):s.texture=new Gd(n,s.gradient,r.RGBA),s.version=i.gradientVersion,s.texture}function maplibre_gl_mf(e,t,n,r,i){e.activeTexture.set(t.TEXTURE0),n.imageAtlasTexture.bind(t.LINEAR,t.CLAMP_TO_EDGE),r.updatePaintBuffers(i)}function maplibre_gl_hf(e,t,n,r,i,a){(i||e.lineAtlas.dirty)&&(t.activeTexture.set(n.TEXTURE0),e.lineAtlas.bind(t)),r.updatePaintBuffers(a)}function maplibre_gl_gf(e,t,n,r,i,a,o){let s=a.gradients[i.id],c=s.texture;i.gradientVersion!==s.version&&(c=maplibre_gl_pf(e,t,n,r,i,a,o,s)),n.activeTexture.set(r.TEXTURE0),c.bind(i.stepInterpolant?r.NEAREST:r.LINEAR,r.CLAMP_TO_EDGE)}function maplibre_gl_f(e,t,n,r,i,a,o,s,c){let l=a.gradients[i.id],u=l.texture;i.gradientVersion!==l.version&&(u=maplibre_gl_pf(e,t,n,r,i,a,o,l)),n.activeTexture.set(r.TEXTURE0),u.bind(i.stepInterpolant?r.NEAREST:r.LINEAR,r.CLAMP_TO_EDGE),n.activeTexture.set(r.TEXTURE1),e.lineAtlas.bind(n),s.updatePaintBuffers(c)}function maplibre_gl_vf(e,t,n,r,i){if(i.currentPass!==`translucent`)return;let a=n.paint.get(`line-opacity`),o=n.paint.get(`line-width`),s=n.paint.get(`line-layer-opacity`);if(a.constantOr(1)===0||o.constantOr(1)===0||s===0)return;let c=!!e.style.map.terrain;if(s<1){let a=maplibre_gl_uf(e,n,r,c);maplibre_gl_yf(e,t,n,r,i,c),maplibre_gl_ff(e,s,a,n);return}maplibre_gl_yf(e,t,n,r,i,c)}function maplibre_gl_yf(e,t,n,r,i,a){let{isRenderingToTexture:o}=i,s=e.getDepthModeForSublayer(0,maplibre_gl_Z.ReadOnly),c=e.colorModeForRenderPass(),l=n.paint.get(`line-dasharray`),u=l.constantOr(1),d=n.paint.get(`line-pattern`),f=d.constantOr(1),p=n.paint.get(`line-gradient`),m=n.getCrossfadeParameters(),h;h=f?`linePattern`:u&&p?`lineGradientSDF`:u?`lineSDF`:p?`lineGradient`:`line`;let g=e.context,_=g.gl,v=e.transform,y=!0;for(let i of r){let r=t.getTile(i);if(f&&!r.patternsLoaded())continue;let b=r.getBucket(n);if(!b)continue;let x=b.programConfigurations.get(n.id),S=e.context.program.get(),C=e.useProgram(h,x),w=y||C.program!==S,T=a?e.getTerrainDataForTile(i,o):null,E=d.constantOr(null),ee=l?.constantOr(null);if(E&&r.imageAtlas){let e=r.imageAtlas,t=e.patternPositions[E.to.toString()],n=e.patternPositions[E.from.toString()];t&&n&&x.setConstantPatternPositions(t,n)}else if(ee){let t=n.layout.get(`line-cap`).constantOr(null)===`round`,r=e.lineAtlas.getDash(ee.to,t),i=e.lineAtlas.getDash(ee.from,t);x.setConstantDashPositions(r,i)}let D=v.getProjectionData({overscaledTileID:i,applyGlobeMatrix:!o,applyTerrainMatrix:!0}),O=v.getPixelScale(),te;f?(te=maplibre_gl_Tu(e,r,n,O,m),maplibre_gl_mf(g,_,r,x,m)):u&&p?(te=maplibre_gl_Du(e,r,n,O,m,b.lineClipsArray.length),maplibre_gl_f(e,t,g,_,n,b,i,x,m)):u?(te=maplibre_gl_Eu(e,r,n,O,m),maplibre_gl_hf(e,g,_,x,w,m)):p?(te=maplibre_gl_wu(e,r,n,O,b.lineClipsArray.length),maplibre_gl_gf(e,t,g,_,n,b,i)):te=maplibre_gl_Cu(e,r,n,O);let k=e.stencilModeForClipping(i);C.draw(g,_.TRIANGLES,s,k,c,maplibre_gl_$.disabled,te,T,D,n.id,b.layoutVertexBuffer,b.indexBuffer,b.segments,n.paint,e.transform.zoom,x,b.layoutVertexBuffer2),y=!1}}function maplibre_gl_bf(e,t,n,r,i){if(!n||!r?.imageAtlas)return;let a=r.imageAtlas.patternPositions,o=a[n.to.toString()],s=a[n.from.toString()];if(!o&&s&&(o=s),!s&&o&&(s=o),!o||!s){let e=i.getPaintProperty(t);o=a[e],s=a[e]}o&&s&&e.setConstantPatternPositions(o,s)}function maplibre_gl_xf(e,t,n,r,i){let a=n.paint.get(`fill-color`),o=n.paint.get(`fill-opacity`),s=n.paint.get(`fill-layer-opacity`);if(o.constantOr(1)===0||s===0)return;if(s<1){if(i.currentPass!==`translucent`)return;let a=maplibre_gl_uf(e,n,r,!!e.style.map.terrain);maplibre_gl_Sf(e,t,n,r,i),maplibre_gl_ff(e,s,a,n);return}let c=n.paint.get(`fill-pattern`),l=e.opaquePassEnabledForLayer()&&!c.constantOr(1)&&a.constantOr(maplibre_gl_shared_V.transparent).a===1&&o.constantOr(0)===1;if(l&&i.currentPass===`opaque`){let{isRenderingToTexture:a}=i,o=e.colorModeForRenderPass();maplibre_gl_wf(e,t,n,r,e.getDepthModeForSublayer(1,maplibre_gl_Z.ReadWrite),o,!1,a);return}if(l&&i.currentPass===`translucent`){maplibre_gl_Cf(e,t,n,r,i);return}i.currentPass===`translucent`&&maplibre_gl_Sf(e,t,n,r,i)}function maplibre_gl_Sf(e,t,n,r,i){let{isRenderingToTexture:a}=i,o=e.colorModeForRenderPass();maplibre_gl_wf(e,t,n,r,e.getDepthModeForSublayer(1,maplibre_gl_Z.ReadOnly),o,!1,a),maplibre_gl_Cf(e,t,n,r,i)}function maplibre_gl_Cf(e,t,n,r,i){if(!n.paint.get(`fill-antialias`))return;let{isRenderingToTexture:a}=i,o=e.colorModeForRenderPass();maplibre_gl_wf(e,t,n,r,e.getDepthModeForSublayer(n.getPaintProperty(`fill-outline-color`)?2:0,maplibre_gl_Z.ReadOnly),o,!0,a)}function maplibre_gl_wf(e,t,n,r,i,a,o,s){let c=e.context.gl,l=`fill-pattern`,u=n.paint.get(l),d=u?.constantOr(1),f=n.getCrossfadeParameters(),p,m,h,g,_,v=e.transform,y=n.paint.get(`fill-translate`),b=n.paint.get(`fill-translate-anchor`);o?(m=d&&!n.getPaintProperty(`fill-outline-color`)?`fillOutlinePattern`:`fillOutline`,p=c.LINES):(m=d?`fillPattern`:`fill`,p=c.TRIANGLES);let x=u.constantOr(null);for(let u of r){let r=t.getTile(u);if(d&&!r.patternsLoaded())continue;let S=r.getBucket(n);if(!S)continue;let C=S.sdfPatterns[n.id]??!1,w=S.programConfigurations.get(n.id),T=e.useProgram(m,w),E=e.getTerrainDataForTile(u,s);d&&(e.context.activeTexture.set(c.TEXTURE0),r.imageAtlasTexture.bind(c.LINEAR,c.CLAMP_TO_EDGE),w.updatePaintBuffers(f)),maplibre_gl_bf(w,l,x,r,n);let ee=v.getProjectionData({overscaledTileID:u,applyGlobeMatrix:!s,applyTerrainMatrix:!0}),D=maplibre_gl_shared_it(v,r,y,b);o?(g=S.indexBuffer2,_=S.segments2,h=m===`fillOutlinePattern`&&d?maplibre_gl_nu(e,f,r,D,C):maplibre_gl_tu(D)):(g=S.indexBuffer,_=S.segments,h=d?maplibre_gl_$l(e,f,r,D,C):maplibre_gl_eu(D));let O=e.stencilModeForClipping(u);T.draw(e.context,p,i,O,a,maplibre_gl_$.backCCW,h,E,ee,n.id,S.layoutVertexBuffer,g,_,n.paint,e.transform.zoom,w)}}function maplibre_gl_Tf(e,t,n,r,i){let a=n.paint.get(`fill-extrusion-opacity`);if(a===0)return;let{isRenderingToTexture:o}=i;if(i.currentPass===`translucent`){let s=new maplibre_gl_Z(e.context.gl.LEQUAL,maplibre_gl_Z.ReadWrite,i.depthRangeFor3D);if(a===1&&!n.paint.get(`fill-extrusion-pattern`).constantOr(1)){let i=e.colorModeForRenderPass();maplibre_gl_Ef(e,t,n,r,s,maplibre_gl_Q.disabled,i,o)}else maplibre_gl_Ef(e,t,n,r,s,maplibre_gl_Q.disabled,maplibre_gl_Ld.disabled,o),maplibre_gl_Ef(e,t,n,r,s,e.stencilModeFor3D(),e.colorModeForRenderPass(),o)}}function maplibre_gl_Ef(e,t,n,r,i,a,o,s){let c=e.context,l=c.gl,u=`fill-extrusion-pattern`,d=n.paint.get(u),f=d.constantOr(1),p=n.getCrossfadeParameters(),m=n.paint.get(`fill-extrusion-opacity`),h=d.constantOr(null),g=e.transform;for(let d of r){let r=t.getTile(d),_=r.getBucket(n);if(!_)continue;let v=e.style.map.terrain?.getTerrainData(d),y=_.programConfigurations.get(n.id),b=e.useProgram(f?`fillExtrusionPattern`:`fillExtrusion`,y);f&&(e.context.activeTexture.set(l.TEXTURE0),r.imageAtlasTexture.bind(l.LINEAR,l.CLAMP_TO_EDGE),y.updatePaintBuffers(p));let x=g.getProjectionData({overscaledTileID:d,applyGlobeMatrix:!s,applyTerrainMatrix:!0});maplibre_gl_bf(y,u,h,r,n);let S=maplibre_gl_shared_it(g,r,n.paint.get(`fill-extrusion-translate`),n.paint.get(`fill-extrusion-translate-anchor`)),C=n.paint.get(`fill-extrusion-vertical-gradient`),w=f?maplibre_gl_Jl(e,C,m,S,d,p,r):maplibre_gl_ql(e,C,m,S);b.draw(c,c.gl.TRIANGLES,i,a,o,maplibre_gl_$.backCCW,w,v,x,n.id,_.layoutVertexBuffer,_.indexBuffer,_.segments,n.paint,e.transform.zoom,y,e.style.map.terrain&&_.centroidVertexBuffer)}}function maplibre_gl_Df(e,t,n,r,i){if(i.currentPass!==`offscreen`&&i.currentPass!==`translucent`)return;let{isRenderingToTexture:a}=i,o=e.context,s=e.style.projection.useSubdivision,c=e.getDepthModeForSublayer(0,maplibre_gl_Z.ReadOnly),l=e.colorModeForRenderPass();if(i.currentPass===`offscreen`)maplibre_gl_kf(e,t,r,n,c,maplibre_gl_Q.disabled,l),o.viewport.set([0,0,e.width,e.height]);else if(i.currentPass===`translucent`){if(s){let[i,o,s]=e.stencilConfigForOverlapTwoPass(r);maplibre_gl_Of(e,t,n,s,i,c,l,!1,a),maplibre_gl_Of(e,t,n,s,o,c,l,!0,a)}else{let[i,o]=e.getStencilConfigForOverlapAndUpdateStencilID(r);maplibre_gl_Of(e,t,n,o,i,c,l,!1,a)}}}function maplibre_gl_Of(e,t,n,r,i,a,o,s,c){let l=e.style.projection,u=e.context,d=e.transform,f=u.gl,p=[`#define NUM_ILLUMINATION_SOURCES ${n.paint.get(`hillshade-highlight-color`).values.length}`],m=e.useProgram(`hillshade`,null,!1,p),h=!e.options.moving;for(let p of r){let r=t.getTile(p),g=r.fbo;if(!g)continue;let _=l.getMeshFromTileID(u,p.canonical,s,!0,`raster`),v=e.getTerrainDataForTile(p,c);u.activeTexture.set(f.TEXTURE0),f.bindTexture(f.TEXTURE_2D,g.colorAttachment.get());let y=d.getProjectionData({overscaledTileID:p,aligned:h,applyGlobeMatrix:!c,applyTerrainMatrix:!0});m.draw(u,f.TRIANGLES,a,i[p.overscaledZ],o,maplibre_gl_$.backCCW,maplibre_gl_pu(e,r,n),v,y,n.id,_.vertexBuffer,_.indexBuffer,_.segments)}}function maplibre_gl_kf(e,t,n,r,i,a,o){let s=e.context,c=s.gl,l=r.paint.get(`resampling`)===`nearest`?c.NEAREST:c.LINEAR;for(let u of n){let n=t.getTile(u),d=n.dem;if(!d?.data||!n.needsHillshadePrepare)continue;let f=d.dim+2,p=d.stride,m=d.getPixels();if(s.activeTexture.set(c.TEXTURE1),s.pixelStoreUnpackPremultiplyAlpha.set(!1),n.demTexture||=e.getTileTexture(p),n.demTexture){let e=n.demTexture;e.update(m,{premultiply:!1}),e.bind(c.NEAREST,c.CLAMP_TO_EDGE)}else n.demTexture=new Gd(s,m,c.RGBA,{premultiply:!1}),n.demTexture.bind(c.NEAREST,c.CLAMP_TO_EDGE);s.activeTexture.set(c.TEXTURE0);let h=n.fbo;if(!h){let e=new Gd(s,{width:f,height:f,data:null},c.RGBA);e.bind(l,c.CLAMP_TO_EDGE),h=n.fbo=s.createFramebuffer(f,f,!0,!1),h.colorAttachment.set(e.texture)}s.bindFramebuffer.set(h.framebuffer),s.viewport.set([0,0,f,f]),e.useProgram(`hillshadePrepare`).draw(s,c.TRIANGLES,i,a,o,maplibre_gl_$.disabled,maplibre_gl_mu(n.tileID,d),null,null,r.id,e.rasterBoundsBuffer,e.quadTriangleIndexBuffer,e.rasterBoundsSegments),n.needsHillshadePrepare=!1}}function maplibre_gl_Af(e,t,n,r,i){if(i.currentPass!==`translucent`||!r.length)return;let{isRenderingToTexture:a}=i,o=e.style.projection.useSubdivision,s=e.getDepthModeForSublayer(0,maplibre_gl_Z.ReadOnly),c=e.colorModeForRenderPass();if(o){let[i,o,l]=e.stencilConfigForOverlapTwoPass(r);maplibre_gl_Mf(e,t,n,l,i,s,c,!1,a),maplibre_gl_Mf(e,t,n,l,o,s,c,!0,a)}else{let[i,o]=e.getStencilConfigForOverlapAndUpdateStencilID(r);maplibre_gl_Mf(e,t,n,o,i,s,c,!1,a)}}let maplibre_gl_jf=0;function maplibre_gl_Mf(e,t,n,r,i,a,o,s,c){let l=e.style.projection,u=e.context,d=e.transform,f=u.gl,p=e.useProgram(`colorRelief`),m=!e.options.moving,h=n.paint.get(`resampling`)===`nearest`?f.NEAREST:f.LINEAR,g=!0,_=0;for(let v of r){let r=t.getTile(v),y=r.dem;if(!y?.data)continue;if(g){maplibre_gl_jf||=f.getParameter(f.MAX_TEXTURE_SIZE);let e=maplibre_gl_jf,{elevationTexture:t,colorTexture:r}=n.getColorRampTextures(u,e,y.getUnpackVector());u.activeTexture.set(f.TEXTURE1),t.bind(f.NEAREST,f.CLAMP_TO_EDGE),u.activeTexture.set(f.TEXTURE4),r.bind(f.LINEAR,f.CLAMP_TO_EDGE),g=!1,_=t.size[0]}let b=y.stride;u.activeTexture.set(f.TEXTURE0),(!r.demTexture||r.needsColorReliefPrepare)&&(u.pixelStoreUnpackPremultiplyAlpha.set(!1),r.demTexture||=e.getTileTexture(b)??new Gd(u,{width:b,height:b,data:null},f.RGBA),r.demTexture.update(y.getPixels(),{premultiply:!1}),r.needsColorReliefPrepare=!1),r.demTexture.bind(h,f.CLAMP_TO_EDGE);let x=l.getMeshFromTileID(u,v.canonical,s,!0,`raster`),S=e.getTerrainDataForTile(v,c),C=d.getProjectionData({overscaledTileID:v,aligned:m,applyGlobeMatrix:!c,applyTerrainMatrix:!0});p.draw(u,f.TRIANGLES,a,i[v.overscaledZ],o,maplibre_gl_$.backCCW,maplibre_gl_u(n,r.dem,_),S,C,n.id,x.vertexBuffer,x.indexBuffer,x.segments)}}const maplibre_gl_Nf=[new maplibre_gl_shared_l(0,0),new maplibre_gl_shared_l((/* inlined export .Rr */8192),0),new maplibre_gl_shared_l((/* inlined export .Rr */8192),(/* inlined export .Rr */8192)),new maplibre_gl_shared_l(0,(/* inlined export .Rr */8192))];function maplibre_gl_Pf(e,t,n,r,i){if(i.currentPass!==`translucent`||n.paint.get(`raster-opacity`)===0||!r.length)return;let{isRenderingToTexture:a}=i,o=t.getSource(),s=e.style.projection.useSubdivision;if(o instanceof maplibre_gl_Xa)maplibre_gl_Ff(e,t,n,r,null,!1,!1,o.tileCoords,o.imageWarp,o.flippedWindingOrder,a,o.getMesh(e.context,s));else if(s){let[i,o,s]=e.stencilConfigForOverlapTwoPass(r);maplibre_gl_Ff(e,t,n,s,i,!1,!0,maplibre_gl_Nf,maplibre_gl_za,!1,a),maplibre_gl_Ff(e,t,n,s,o,!0,!0,maplibre_gl_Nf,maplibre_gl_za,!1,a)}else{let[i,o]=e.getStencilConfigForOverlapAndUpdateStencilID(r);maplibre_gl_Ff(e,t,n,o,i,!1,!0,maplibre_gl_Nf,maplibre_gl_za,!1,a)}}function maplibre_gl_Ff(e,t,n,r,i,a,o,s,c,l=!1,u=!1,d=null){let f=r[r.length-1].overscaledZ,p=e.context,m=p.gl,h=e.useProgram(`raster`),g=e.transform,_=e.style.projection,v=e.colorModeForRenderPass(),y=!e.options.moving,b=n.paint.get(`raster-opacity`),x=n.paint.get(`resampling`)===`nearest`||n.paint.get(`raster-resampling`)===`nearest`?m.NEAREST:m.LINEAR,S=n.paint.get(`raster-fade-duration`),C=!!e.style.map.terrain;for(let w of r){let r=e.getDepthModeForSublayer(w.overscaledZ-f,b===1?maplibre_gl_Z.ReadWrite:maplibre_gl_Z.ReadOnly,m.LESS),T=t.getTile(w);p.activeTexture.set(m.TEXTURE0),T.texture.bind(x,m.CLAMP_TO_EDGE,m.LINEAR_MIPMAP_NEAREST),p.activeTexture.set(m.TEXTURE1);let{parentTile:E,parentScaleBy:ee,parentTopLeft:D,fadeValues:O}=maplibre_gl_If(T,t,S,C);T.fadeOpacity=O.tileOpacity,E?(E.fadeOpacity=O.parentTileOpacity,E.texture.bind(x,m.CLAMP_TO_EDGE,m.LINEAR_MIPMAP_NEAREST)):T.texture.bind(x,m.CLAMP_TO_EDGE,m.LINEAR_MIPMAP_NEAREST),T.texture.useMipmap&&p.extTextureFilterAnisotropic&&e.transform.pitch>e.options.anisotropicFilterPitch&&m.texParameterf(m.TEXTURE_2D,p.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,p.extTextureFilterAnisotropicMax);let te=e.getTerrainDataForTile(w,u),k=g.getProjectionData({overscaledTileID:w,aligned:y,applyGlobeMatrix:!u,applyTerrainMatrix:!0}),ne=maplibre_gl_Va(D,ee,O.fadeMix,n,s,c),re=d??_.getMeshFromTileID(p,w.canonical,a,o,`raster`),ie=i?i[w.overscaledZ]:maplibre_gl_Q.disabled;h.draw(p,m.TRIANGLES,r,ie,v,l?maplibre_gl_$.frontCCW:maplibre_gl_$.backCCW,ne,te,k,n.id,re.vertexBuffer,re.indexBuffer,re.segments)}}function maplibre_gl_If(e,t,n,r){let i={parentTile:null,parentScaleBy:1,parentTopLeft:[0,0],fadeValues:{tileOpacity:1,parentTileOpacity:1,fadeMix:{opacity:1,mix:0}}};if(n===0||r)return i;if(e.fadingParentID){let r=t.getLoadedTile(e.fadingParentID);if(!r)return i;let a=2**(r.tileID.overscaledZ-e.tileID.overscaledZ);return{parentTile:r,parentScaleBy:a,parentTopLeft:[e.tileID.canonical.x*a%1,e.tileID.canonical.y*a%1],fadeValues:maplibre_gl_Lf(e,r,n)}}return e.selfFading?{parentTile:null,parentScaleBy:1,parentTopLeft:[0,0],fadeValues:maplibre_gl_Rf(e,n)}:i}function maplibre_gl_Lf(e,t,n){let r=maplibre_gl_U(),i=(r-e.timeAdded)/n,a=(r-t.timeAdded)/n,o=e.fadingDirection===1,s=maplibre_gl_shared_yt(i,0,1),c=maplibre_gl_shared_yt(1-a,0,1),l=o?s:c;return{tileOpacity:l,parentTileOpacity:o?c:s,fadeMix:{opacity:1,mix:1-l}}}function maplibre_gl_Rf(e,t){let n=(maplibre_gl_U()-e.timeAdded)/t,r=maplibre_gl_shared_yt(n,0,1);return{tileOpacity:r,fadeMix:{opacity:r,mix:0}}}function maplibre_gl_zf(e,t,n,r,i){let a=n.paint.get(`background-color`),o=n.paint.get(`background-opacity`);if(o===0)return;let{isRenderingToTexture:s}=i,c=e.context,l=c.gl,u=e.style.projection,d=e.transform,f=d.tileSize,p=n.paint.get(`background-pattern`);if(e.isPatternMissing(p))return;let m=!p&&a.a===1&&o===1&&e.opaquePassEnabledForLayer()?`opaque`:`translucent`;if(i.currentPass!==m)return;let h=maplibre_gl_Q.disabled,g=e.getDepthModeForSublayer(0,m===`opaque`?maplibre_gl_Z.ReadWrite:maplibre_gl_Z.ReadOnly),_=e.colorModeForRenderPass(),v=e.useProgram(p?`backgroundPattern`:`background`),y=r||maplibre_gl_jo(d,{tileSize:f,terrain:e.style.map.terrain});p&&(c.activeTexture.set(l.TEXTURE0),e.patternAtlas.bind(e.context));let b=n.getCrossfadeParameters();for(let t of y){let r=d.getProjectionData({overscaledTileID:t,applyGlobeMatrix:!s,applyTerrainMatrix:!0}),i=p?maplibre_gl_Vu(o,e,p,{tileID:t,tileSize:f},b):maplibre_gl_Bu(o,a),m=e.getTerrainDataForTile(t,s),y=u.getMeshFromTileID(c,t.canonical,!1,!0,`raster`);v.draw(c,l.TRIANGLES,g,h,_,maplibre_gl_$.backCCW,i,m,r,n.id,y.vertexBuffer,y.indexBuffer,y.segments)}}const maplibre_gl_Bf=new maplibre_gl_shared_V(1,0,0,1),maplibre_gl_Vf=new maplibre_gl_shared_V(0,1,0,1),maplibre_gl_Hf=new maplibre_gl_shared_V(0,0,1,1),maplibre_gl_Uf=new maplibre_gl_shared_V(1,0,1,1),maplibre_gl_Wf=new maplibre_gl_shared_V(0,1,1,1);function maplibre_gl_Gf(e){let t=e.transform.padding;maplibre_gl_qf(e,e.transform.height-(t.top||0),3,maplibre_gl_Bf),maplibre_gl_qf(e,t.bottom||0,3,maplibre_gl_Vf),maplibre_gl_Jf(e,t.left||0,3,maplibre_gl_Hf),maplibre_gl_Jf(e,e.transform.width-(t.right||0),3,maplibre_gl_Uf);let n=e.transform.centerPoint;maplibre_gl_Kf(e,n.x,e.transform.height-n.y,maplibre_gl_Wf)}function maplibre_gl_Kf(e,t,n,r){maplibre_gl_Yf(e,t-1,n-10,2,20,r),maplibre_gl_Yf(e,t-10,n-1,20,2,r)}function maplibre_gl_qf(e,t,n,r){maplibre_gl_Yf(e,0,t+n/2,e.transform.width,n,r)}function maplibre_gl_Jf(e,t,n,r){maplibre_gl_Yf(e,t-n/2,0,n,e.transform.height,r)}function maplibre_gl_Yf(e,t,n,r,i,a){let o=e.context,s=o.gl;s.enable(s.SCISSOR_TEST),s.scissor(t*e.pixelRatio,n*e.pixelRatio,r*e.pixelRatio,i*e.pixelRatio),o.clear({color:a}),s.disable(s.SCISSOR_TEST)}function maplibre_gl_Xf(e,t,n){for(let r of n)maplibre_gl_Zf(e,t,r)}function maplibre_gl_Zf(e,t,n){let r=e.context,i=r.gl,a=e.useProgram(`debug`),o=maplibre_gl_Z.disabled,s=maplibre_gl_Q.disabled,c=e.colorModeForRenderPass(),l=`$debug`,u=e.style.map.terrain?.getTerrainData(n);r.activeTexture.set(i.TEXTURE0);let d=t.getTileByID(n.key).latestRawTileData?.byteLength||0,f=Math.floor(d/1024),p=t.getTile(n).tileSize,m=512/Math.min(p,512)*(n.overscaledZ/e.transform.zoom)*.5,h=n.canonical.toString();n.overscaledZ!==n.canonical.z&&(h+=` => ${n.overscaledZ}`),maplibre_gl_Qf(e,`${h} ${f}kB`);let g=e.transform.getProjectionData({overscaledTileID:n,applyGlobeMatrix:!0,applyTerrainMatrix:!0});a.draw(r,i.TRIANGLES,o,s,maplibre_gl_Ld.alphaBlended,maplibre_gl_$.disabled,maplibre_gl_ou(maplibre_gl_shared_V.transparent,m),null,g,l,e.debugBuffer,e.quadTriangleIndexBuffer,e.debugSegments),a.draw(r,i.LINE_STRIP,o,s,c,maplibre_gl_$.disabled,maplibre_gl_ou(maplibre_gl_shared_V.red),u,g,l,e.debugBuffer,e.tileBorderIndexBuffer,e.debugSegments)}function maplibre_gl_Qf(e,t){e.initDebugOverlayCanvas();let n=e.debugOverlayCanvas,r=e.context.gl,i=e.debugOverlayCanvas.getContext(`2d`);i.clearRect(0,0,n.width,n.height),i.shadowColor=`white`,i.shadowBlur=2,i.lineWidth=1.5,i.strokeStyle=`white`,i.textBaseline=`top`,i.font=`bold 36px Open Sans, sans-serif`,i.fillText(t,5,5),i.strokeText(t,5,5),e.debugOverlayTexture.update(n),e.debugOverlayTexture.bind(r.LINEAR,r.CLAMP_TO_EDGE)}function maplibre_gl_$f(e,t){let n=null,r=Object.values(e._layers).flatMap(n=>n.source&&!n.isHidden(t)?[e.tileManagers[n.source]]:[]),i=r.filter(e=>e.getSource().type===`vector`),a=r.filter(e=>e.getSource().type!==`vector`),o=e=>{(!n||n.getSource().maxzoom<e.getSource().maxzoom)&&(n=e)};for(let e of i)o(e);if(!n)for(let e of a)o(e);return n}function maplibre_gl_ep(e,t,n,r){let{isRenderingGlobe:i}=r,a=e.context,o=n.implementation,s=e.style.projection,c=e.transform,l=c.getProjectionDataForCustomLayer(i),u={farZ:c.farZ,nearZ:c.nearZ,fov:c.fov*Math.PI/180,modelViewProjectionMatrix:c.modelViewProjectionMatrix,projectionMatrix:c.projectionMatrix,shaderData:{variantName:s.shaderVariantName,vertexShaderPrelude:`const float PI = 3.141592653589793;\nuniform mat4 u_projection_matrix;\n${s.shaderPreludeCode.vertexSource}`,define:s.shaderDefine},defaultProjectionData:l,getProjectionData:e=>c.getProjectionData({overscaledTileID:new maplibre_gl_shared_fb(e.tileID.canonical.z,e.tileID.wrap??0,e.tileID.canonical.z,e.tileID.canonical.x,e.tileID.canonical.y),aligned:e.aligned,applyGlobeMatrix:e.applyGlobeMatrix,applyTerrainMatrix:e.applyTerrainMatrix})},d=o.renderingMode?o.renderingMode:`2d`;if(r.currentPass===`offscreen`){let t=o.prerender;t&&(e.setCustomLayerDefaults(),a.setColorMode(e.colorModeForRenderPass()),t.call(o,a.gl,u),a.setDirty(),e.setBaseState())}else if(r.currentPass===`translucent`){e.setCustomLayerDefaults(),a.setColorMode(e.colorModeForRenderPass()),a.setStencilMode(maplibre_gl_Q.disabled);let t=d===`3d`?e.getDepthModeFor3D():e.getDepthModeForSublayer(0,maplibre_gl_Z.ReadOnly);a.setDepthMode(t),o.render(a.gl,u),a.setDirty(),e.setBaseState(),a.bindFramebuffer.set(null)}}function maplibre_gl_tp(e,t){let n=e.context,r=n.gl,i=e.transform,a=maplibre_gl_Ld.unblended,o=new maplibre_gl_Z(r.LEQUAL,maplibre_gl_Z.ReadWrite,[0,1]),s=t.tileManager.getRenderableTiles(),c=e.useProgram(`terrainDepth`);n.bindFramebuffer.set(t.getFramebuffer().framebuffer),n.viewport.set([0,0,e.width/devicePixelRatio,e.height/devicePixelRatio]),n.clear({color:maplibre_gl_shared_V.white,depth:1});for(let e of s){let s=t.getTerrainMesh(e.tileID),l=t.getTerrainData(e.tileID),u=i.getProjectionData({overscaledTileID:e.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0}),d=maplibre_gl_El(t.getSkirtLength(i.zoom));c.draw(n,r.TRIANGLES,o,maplibre_gl_Q.disabled,a,maplibre_gl_$.backCCW,d,l,u,`terrain`,s.vertexBuffer,s.indexBuffer,s.segments)}n.bindFramebuffer.set(null),n.viewport.set([0,0,e.width,e.height])}function maplibre_gl_np(e,t,n,r){let{isRenderingGlobe:i}=r,a=e.context,o=a.gl,s=e.transform,c=e.colorModeForRenderPass(),l=e.getDepthModeFor3D(),u=e.useProgram(`terrain`);a.bindFramebuffer.set(null),a.viewport.set([0,0,e.width,e.height]);for(let r of n){let n=t.getTerrainMesh(r.tileID),d=e.renderToTexture.getTexture(r),f=t.getTerrainData(r.tileID);a.activeTexture.set(o.TEXTURE0),d.bind(o.LINEAR,o.CLAMP_TO_EDGE,o.LINEAR_MIPMAP_LINEAR);let p=t.getSkirtLength(s.zoom),m=s.calculateFogMatrix(r.tileID.toUnwrapped()),h=maplibre_gl_Tl(p,m,e.style.sky,s.pitch,i),g=s.getProjectionData({overscaledTileID:r.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0});u.draw(a,o.TRIANGLES,l,maplibre_gl_Q.disabled,c,maplibre_gl_$.backCCW,h,f,g,`terrain`,n.vertexBuffer,n.indexBuffer,n.segments)}}function maplibre_gl_rp(e,t){if(!t.mesh){let n=new maplibre_gl_shared_Pl;n.emplaceBack(-1,-1),n.emplaceBack(1,-1),n.emplaceBack(1,1),n.emplaceBack(-1,1);let r=new maplibre_gl_shared_Zl;r.emplaceBack(0,1,2),r.emplaceBack(0,2,3),t.mesh=new maplibre_gl_Ga(e.createVertexBuffer(n,maplibre_gl_Ka.members),e.createIndexBuffer(r),maplibre_gl_shared_nu.simpleSegment(0,0,n.length,r.length))}return t.mesh}function maplibre_gl_ip(e,t){let n=e.context,r=n.gl,i=maplibre_gl_Gu(t,e.transform,e.pixelRatio),a=new maplibre_gl_Z(r.LEQUAL,maplibre_gl_Z.ReadWrite,[0,1]),o=maplibre_gl_Q.disabled,s=e.colorModeForRenderPass(),c=e.useProgram(`sky`),l=maplibre_gl_rp(n,t);c.draw(n,r.TRIANGLES,a,o,s,maplibre_gl_$.disabled,i,null,void 0,`sky`,l.vertexBuffer,l.indexBuffer,l.segments)}function maplibre_gl_ap(e,t){let n=e.getCartesianPosition();maplibre_gl_shared_ge(n,n);let r=maplibre_gl_shared_C(new Float64Array(16));return e.properties.get(`anchor`)===`map`&&(maplibre_gl_shared_A(r,r,t.rollInRadians),maplibre_gl_shared_O(r,r,-t.pitchInRadians),maplibre_gl_shared_A(r,r,t.bearingInRadians),maplibre_gl_shared_O(r,r,t.center.lat*Math.PI/180),maplibre_gl_shared_k(r,r,-t.center.lng*Math.PI/180)),maplibre_gl_shared_ye(n,n,r),n}function maplibre_gl_op(e,t,n){let r=e.context,i=r.gl,a=e.useProgram(`atmosphere`),o=new maplibre_gl_Z(i.LEQUAL,maplibre_gl_Z.ReadOnly,[0,1]),s=e.transform,c=maplibre_gl_ap(n,e.transform),l=s.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),u=t.properties.get(`atmosphere-blend`)*l.projectionTransition;if(u===0)return;let d=maplibre_gl_Bc(s.worldSize,s.center.lat),f=maplibre_gl_Vc(s),p=maplibre_gl_Uu(c,u,f,d,s.inverseProjectionMatrix),m=maplibre_gl_rp(r,t);a.draw(r,i.TRIANGLES,o,maplibre_gl_Q.disabled,maplibre_gl_Ld.alphaBlended,maplibre_gl_$.disabled,p,null,null,`atmosphere`,m.vertexBuffer,m.indexBuffer,m.segments)}const maplibre_gl_sp={symbol:maplibre_gl_Kd,circle:maplibre_gl_ef,heatmap:maplibre_gl_tf,line:maplibre_gl_vf,fill:maplibre_gl_xf,fillExtrusion:maplibre_gl_Tf,hillshade:maplibre_gl_Df,colorRelief:maplibre_gl_Af,raster:maplibre_gl_Pf,background:maplibre_gl_zf,sky:maplibre_gl_ip,atmosphere:maplibre_gl_op,custom:maplibre_gl_ep,debug:maplibre_gl_Xf,debugPadding:maplibre_gl_Gf,terrainDepth:maplibre_gl_tp};function maplibre_gl_cp(e,t,n){let r=t?.transitionState??0;return{currentPass:`offscreen`,currentLayer:0,opaquePassCutoff:1/0,depthRangeFor3D:[0,1],isRenderingToTexture:!1,transform:e,terrain:n,projectionTransition:r,isRenderingGlobe:r>0}}var maplibre_gl_lp=class e{constructor(e,t){this.drawFunctions=maplibre_gl_sp,this.context=new maplibre_gl_Rd(e),this.transform=t,this.layerOpacityFbo=null,this._tileTextures={},this._rttObjectRecyclePool=[],this._rttSharedFbo=null,this.terrainFacilitator={depthDirty:!0,matrix:maplibre_gl_shared_C(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=maplibre_gl_Ho.maxOverzooming+maplibre_gl_Ho.maxUnderzooming+1,this.depthEpsilon=1/2**16,this.crossTileSymbolIndex=new maplibre_gl_Ys}resize(e,t,n){if(this.width=Math.floor(e*n),this.height=Math.floor(t*n),this.pixelRatio=n,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(let e of this.style._order)this.style._layers[e].resize()}setup(){let e=this.context,t=new maplibre_gl_shared_Pl;t.emplaceBack(0,0),t.emplaceBack((/* inlined export .Rr */8192),0),t.emplaceBack(0,(/* inlined export .Rr */8192)),t.emplaceBack((/* inlined export .Rr */8192),(/* inlined export .Rr */8192)),this.tileExtentBuffer=e.createVertexBuffer(t,maplibre_gl_Ka.members),this.tileExtentSegments=maplibre_gl_shared_nu.simpleSegment(0,0,4,2);let n=new maplibre_gl_shared_Pl;n.emplaceBack(0,0),n.emplaceBack((/* inlined export .Rr */8192),0),n.emplaceBack(0,(/* inlined export .Rr */8192)),n.emplaceBack((/* inlined export .Rr */8192),(/* inlined export .Rr */8192)),this.debugBuffer=e.createVertexBuffer(n,maplibre_gl_Ka.members),this.debugSegments=maplibre_gl_shared_nu.simpleSegment(0,0,4,5);let r=new maplibre_gl_shared_Il;r.emplaceBack(0,0,0,0),r.emplaceBack((/* inlined export .Rr */8192),0,(/* inlined export .Rr */8192),0),r.emplaceBack(0,(/* inlined export .Rr */8192),0,(/* inlined export .Rr */8192)),r.emplaceBack((/* inlined export .Rr */8192),(/* inlined export .Rr */8192),(/* inlined export .Rr */8192),(/* inlined export .Rr */8192)),this.rasterBoundsBuffer=e.createVertexBuffer(r,maplibre_gl_bl.members),this.rasterBoundsSegments=maplibre_gl_shared_nu.simpleSegment(0,0,4,2);let i=new maplibre_gl_shared_Pl;i.emplaceBack(0,0),i.emplaceBack((/* inlined export .Rr */8192),0),i.emplaceBack(0,(/* inlined export .Rr */8192)),i.emplaceBack((/* inlined export .Rr */8192),(/* inlined export .Rr */8192)),this.rasterBoundsBufferPosOnly=e.createVertexBuffer(i,maplibre_gl_Ka.members),this.rasterBoundsSegmentsPosOnly=maplibre_gl_shared_nu.simpleSegment(0,0,4,5);let a=new maplibre_gl_shared_Pl;a.emplaceBack(0,0),a.emplaceBack(1,0),a.emplaceBack(0,1),a.emplaceBack(1,1),this.viewportBuffer=e.createVertexBuffer(a,maplibre_gl_Ka.members),this.viewportSegments=maplibre_gl_shared_nu.simpleSegment(0,0,4,2);let o=new maplibre_gl_shared_$l;o.emplaceBack(0),o.emplaceBack(1),o.emplaceBack(3),o.emplaceBack(2),o.emplaceBack(0),this.tileBorderIndexBuffer=e.createIndexBuffer(o);let s=new maplibre_gl_shared_Zl;s.emplaceBack(1,0,2),s.emplaceBack(1,2,3),this.quadTriangleIndexBuffer=e.createIndexBuffer(s);let c=this.context.gl;this.stencilClearMode=new maplibre_gl_Q({func:c.ALWAYS,mask:0},0,255,c.ZERO,c.ZERO,c.ZERO),this.tileExtentMesh=new maplibre_gl_Ga(this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}clearStencil(){let e=this.context,t=e.gl;this.nextStencilID=1,this.currentStencilSource=void 0;let n=maplibre_gl_shared_b();maplibre_gl_shared_ie(n,0,this.width,this.height,0,0,1),maplibre_gl_shared_D(n,n,[t.drawingBufferWidth,t.drawingBufferHeight,0]);let r={mainMatrix:n,tileMercatorCoords:[0,0,1,1],clippingPlane:[0,0,0,0],projectionTransition:0,fallbackMatrix:n,clipAntimeridian:!1};this.useProgram(`clippingMask`,null,!0).draw(e,t.TRIANGLES,maplibre_gl_Z.disabled,this.stencilClearMode,maplibre_gl_Ld.disabled,maplibre_gl_$.disabled,null,null,r,`$clipping`,this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}renderTileClippingMasks(e,t,n){if(this.currentStencilSource===e.source||!e.isTileClipped()||!t?.length)return;this.currentStencilSource=e.source,this.nextStencilID+t.length>256&&this.clearStencil();let r=this.context;r.setColorMode(maplibre_gl_Ld.disabled),r.setDepthMode(maplibre_gl_Z.disabled);let i={};for(let e of t)i[e.key]=this.nextStencilID++;this.style.projection.useSubdivision&&this._renderTileMasks(i,t,n,!0),this._renderTileMasks(i,t,n,!1),this._tileClippingMaskIDs=i}_renderTileMasks(e,t,n,r){let i=this.context,a=i.gl,o=this.style.projection,s=this.transform,c=this.useProgram(`clippingMask`);for(let l of t){let t=e[l.key],u=this.getTerrainDataForTile(l,n),d=o.getMeshFromTileID(this.context,l.canonical,r,!0,`stencil`),f=s.getProjectionData({overscaledTileID:l,applyGlobeMatrix:!n,applyTerrainMatrix:!0});c.draw(i,a.TRIANGLES,maplibre_gl_Z.disabled,new maplibre_gl_Q({func:a.ALWAYS,mask:0},t,255,a.KEEP,a.KEEP,a.REPLACE),maplibre_gl_Ld.disabled,n?maplibre_gl_$.disabled:maplibre_gl_$.backCCW,null,u,f,`$clipping`,d.vertexBuffer,d.indexBuffer,d.segments)}}getTerrainDataForTile(e,t){return t&&this.style.projection?.name===`mercator`?null:this.style.map.terrain?.getTerrainData(e)||null}_renderTilesDepthBuffer(){let e=this.context,t=e.gl,n=this.style.projection,r=this.transform,i=this.useProgram(`depth`),a=this.getDepthModeFor3D(),o=maplibre_gl_jo(r,{tileSize:r.tileSize});for(let s of o){let o=this.style.map.terrain?.getTerrainData(s),c=n.getMeshFromTileID(this.context,s.canonical,!0,!0,`raster`),l=r.getProjectionData({overscaledTileID:s,applyGlobeMatrix:!0,applyTerrainMatrix:!0});i.draw(e,t.TRIANGLES,a,maplibre_gl_Q.disabled,maplibre_gl_Ld.disabled,maplibre_gl_$.backCCW,null,o,l,`$clipping`,c.vertexBuffer,c.indexBuffer,c.segments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();let e=this.nextStencilID++,t=this.context.gl;return new maplibre_gl_Q({func:t.NOTEQUAL,mask:255},e,255,t.KEEP,t.KEEP,t.REPLACE)}stencilModeForClipping(e){let t=this.context.gl;return new maplibre_gl_Q({func:t.EQUAL,mask:255},this._tileClippingMaskIDs[e.key],0,t.KEEP,t.KEEP,t.REPLACE)}getStencilConfigForOverlapAndUpdateStencilID(e){let t=this.context.gl,n=e.sort((e,t)=>t.overscaledZ-e.overscaledZ),r=n[n.length-1].overscaledZ,i=n[0].overscaledZ-r+1;if(i>1){this.currentStencilSource=void 0,this.nextStencilID+i>256&&this.clearStencil();let e={};for(let n=0;n<i;n++)e[n+r]=new maplibre_gl_Q({func:t.GEQUAL,mask:255},n+this.nextStencilID,255,t.KEEP,t.KEEP,t.REPLACE);return this.nextStencilID+=i,[e,n]}return[{[r]:maplibre_gl_Q.disabled},n]}stencilConfigForOverlapTwoPass(e){let t=this.context.gl,n=e.sort((e,t)=>t.overscaledZ-e.overscaledZ),r=n[n.length-1].overscaledZ,i=n[0].overscaledZ-r+1;if(this.clearStencil(),i>1){let e={},a={};for(let n=0;n<i;n++)e[n+r]=new maplibre_gl_Q({func:t.GREATER,mask:255},i+1+n,255,t.KEEP,t.KEEP,t.REPLACE),a[n+r]=new maplibre_gl_Q({func:t.GREATER,mask:255},1+n,255,t.KEEP,t.KEEP,t.REPLACE);return this.nextStencilID=i*2+1,[e,a,n]}return this.nextStencilID=3,[{[r]:new maplibre_gl_Q({func:t.GREATER,mask:255},2,255,t.KEEP,t.KEEP,t.REPLACE)},{[r]:new maplibre_gl_Q({func:t.GREATER,mask:255},1,255,t.KEEP,t.KEEP,t.REPLACE)},n]}colorModeForRenderPass(){let e=this.context.gl;if(this._showOverdrawInspector){let t=1/8;return new maplibre_gl_Ld([e.CONSTANT_COLOR,e.ONE],new maplibre_gl_shared_V(t,t,t,0),[!0,!0,!0,!0])}return this.renderOptions.currentPass===`opaque`?maplibre_gl_Ld.unblended:maplibre_gl_Ld.alphaBlended}getDepthModeForSublayer(e,t,n){if(!this.opaquePassEnabledForLayer())return maplibre_gl_Z.disabled;let r=1-((1+this.renderOptions.currentLayer)*this.numSublayers+e)*this.depthEpsilon;return new maplibre_gl_Z(n||this.context.gl.LEQUAL,t,[r,r])}getDepthModeFor3D(){return new maplibre_gl_Z(this.context.gl.LEQUAL,maplibre_gl_Z.ReadWrite,this.renderOptions.depthRangeFor3D)}opaquePassEnabledForLayer(){return this.renderOptions.currentLayer<this.renderOptions.opaquePassCutoff}render(e,t){this.style=e,this.options=t;let n=this.renderOptions=maplibre_gl_cp(this.transform,e.projection,e.map.terrain??null);this.lineAtlas=e.lineAtlas,this.imageManager=e.imageManager,this.patternAtlas=e.patternAtlas,this.glyphManager=e.glyphManager,this.symbolFadeChange=e.placement.symbolFadeChange(maplibre_gl_U()),maplibre_gl_Id(this.context.frameUniformBuffer,this),this.imageManager.beginFrame();let r=this.style._order,i=this.style.tileManagers,a={},o={},s={};for(let e in i){let t=i[e];t.used&&t.prepare(this.context),a[e]=t.getVisibleCoordinates(!1),o[e]=a[e].slice().reverse(),s[e]=t.getVisibleCoordinates(!0).reverse()}n.opaquePassCutoff=1/0;for(let e=0;e<r.length;e++){let t=r[e];if(this.style._layers[t].is3D()){n.opaquePassCutoff=e;break}}this.maybeDrawDepth(),this.renderToTexture&&(this.renderToTexture.prepareForRender(this.style,this.transform.zoom),n.opaquePassCutoff=0),n.currentPass=`offscreen`;for(let e of r){let t=this.style._layers[e];if(!t.hasOffscreenPass()||t.isHidden(this.transform.zoom))continue;let r=o[t.source];(t.type===`custom`||r.length)&&this.renderLayer(this,i[t.source],t,r,n)}if(this.context.viewport.set([0,0,this.width,this.height]),this.context.bindFramebuffer.set(null),this.context.clear({color:t.showOverdrawInspector?maplibre_gl_shared_V.black:maplibre_gl_shared_V.transparent,depth:1}),this.clearStencil(),this.style.sky&&this.drawFunctions.sky(this,this.style.sky),this._showOverdrawInspector=t.showOverdrawInspector,n.depthRangeFor3D=[0,1-(e._order.length+2)*this.numSublayers*this.depthEpsilon],!this.renderToTexture)for(n.currentPass=`opaque`,n.currentLayer=r.length-1;n.currentLayer>=0;n.currentLayer--){let e=this.style._layers[r[n.currentLayer]];if(e.isHidden(this.transform.zoom))continue;let t=i[e.source],o=a[e.source];this.renderTileClippingMasks(e,o,!1),this.renderLayer(this,t,e,o,n)}n.currentPass=`translucent`;let c=!1;for(n.currentLayer=0;n.currentLayer<r.length;n.currentLayer++){let e=this.style._layers[r[n.currentLayer]];if(e.isHidden(this.transform.zoom))continue;let t=i[e.source];if(this.renderToTexture?.renderLayer(e,n))continue;!this.opaquePassEnabledForLayer()&&!c&&(c=!0,n.isRenderingGlobe&&!this.style.map.terrain&&this._renderTilesDepthBuffer());let l=(e.type===`symbol`?s:o)[e.source];this.renderTileClippingMasks(e,a[e.source],!!this.renderToTexture),this.renderLayer(this,t,e,l,n)}if(n.isRenderingGlobe&&this.drawFunctions.atmosphere(this,this.style.sky,this.style.light),this.options.showTileBoundaries){let e=maplibre_gl_$f(this.style,this.transform.zoom);e&&this.drawFunctions.debug(this,e,e.getVisibleCoordinates())}this.options.showPadding&&this.drawFunctions.debugPadding(this),this.context.setDefault()}maybeDrawDepth(){if(!this.style?.projection||!this.style.map?.terrain)return;let e=this.terrainFacilitator.matrix,t=this.transform.modelViewProjectionMatrix,n=this.terrainFacilitator.depthDirty;n||=!maplibre_gl_shared_oe(e,t),n||=this.style.map.terrain.tileManager.anyTilesAfterTime(this.terrainFacilitator.renderTime),n&&(maplibre_gl_shared_S(e,t),this.terrainFacilitator.renderTime=maplibre_gl_U(),this.terrainFacilitator.depthDirty=!1,this.drawFunctions.terrainDepth(this,this.style.map.terrain))}renderLayer(e,t,n,r,i){if(n.isHidden(this.transform.zoom)||n.type!==`background`&&n.type!==`custom`&&!(r||[]).length)return;this.id=n.id;let a=this.drawFunctions;qy(n)?a.symbol(e,t,n,r,this.style.placement.variableOffsets,i):bd(n)?a.circle(e,t,n,r,i):Pd(n)?a.heatmap(e,t,n,r,i):ag(n)?a.line(e,t,n,r,i):maplibre_gl_shared_gp(n)?a.fill(e,t,n,r,i):pm(n)?a.fillExtrusion(e,t,n,r,i):zd(n)?a.hillshade(e,t,n,r,i):Jd(n)?a.colorRelief(e,t,n,r,i):maplibre_gl_shared_Gc(n)?a.raster(e,t,n,r,i):$y(n)?a.background(e,t,n,r,i):maplibre_gl_shared_nb(n)&&a.custom(e,t,n,i)}static{this.MAX_TEXTURE_POOL_SIZE_PER_BUCKET=50}saveTileTexture(t){let n=this._tileTextures[t.size[0]];n?n.length<e.MAX_TEXTURE_POOL_SIZE_PER_BUCKET?n.push(t):t.destroy():this._tileTextures[t.size[0]]=[t]}getTileTexture(e){let t=this._tileTextures[e];return t&&t.length>0?t.pop():null}acquireRTT(e){let t=this.context.gl,n=this._rttObjectRecyclePool.pop();if(n)return n.size!==e&&(n.texture.update({width:e,height:e,data:null},{premultiply:!1,useMipmap:!0}),n.texture.bind(t.LINEAR,t.CLAMP_TO_EDGE,t.LINEAR_MIPMAP_LINEAR),this.context.extTextureFilterAnisotropic&&t.texParameterf(t.TEXTURE_2D,this.context.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,this.context.extTextureFilterAnisotropicMax),n.size=e),n;let r=new Gd(this.context,{width:e,height:e,data:null},t.RGBA,{premultiply:!1,useMipmap:!0});return r.bind(t.LINEAR,t.CLAMP_TO_EDGE,t.LINEAR_MIPMAP_LINEAR),this.context.extTextureFilterAnisotropic&&t.texParameterf(t.TEXTURE_2D,this.context.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,this.context.extTextureFilterAnisotropicMax),{texture:r,size:e}}bindRTT(e){let t=this.context.gl,n=e.size;if(!this._rttSharedFbo){let e=this.context.createFramebuffer(n,n,!0,!0),r=this.context.createRenderbuffer(t.DEPTH_STENCIL,n,n);e.depthAttachment.set(r),this._rttSharedFbo={fbo:e,depthRenderbuffer:r,size:n}}this._rttSharedFbo.size!==n&&(this.context.bindRenderbuffer.set(this._rttSharedFbo.depthRenderbuffer),t.renderbufferStorage(t.RENDERBUFFER,t.DEPTH_STENCIL,n,n),this.context.bindRenderbuffer.set(null),this._rttSharedFbo.fbo.width=n,this._rttSharedFbo.fbo.height=n,this._rttSharedFbo.size=n),this._rttSharedFbo.fbo.colorAttachment.set(e.texture.texture),this.context.bindFramebuffer.set(this._rttSharedFbo.fbo.framebuffer)}releaseRTT(e){this._rttObjectRecyclePool.push(e)}isPatternMissing(e){if(!e)return!1;if(!e.from||!e.to)return!0;let t=this.patternAtlas.getPattern(e.from.toString()),n=this.patternAtlas.getPattern(e.to.toString());return!t||!n}useProgram(e,t,n=!1,r=[]){this.cache||={};let i=!!this.style.map.terrain,a=this.style.projection,o=n?maplibre_gl_ac.projectionMercator:a.shaderPreludeCode,s=n?maplibre_gl_oc:a.shaderDefine,c=`/${n?maplibre_gl_sc:a.shaderVariantName}`,l=t?t.cacheKey:``,u=this._showOverdrawInspector?`/overdraw`:``,d=i?`/terrain`:``,f=r?`/${r.join(`/`)}`:``,p=e+l+c+u+d+f;return this.cache[p]||=new maplibre_gl_Hl(this.context,maplibre_gl_ac[e],t,maplibre_gl_qu[e],this._showOverdrawInspector,i,o,s,r),this.cache[p]}setCustomLayerDefaults(){this.context.setCustomLayerDefaults()}setBaseState(){let e=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(e.FUNC_ADD)}initDebugOverlayCanvas(){if(this.debugOverlayCanvas==null){this.debugOverlayCanvas=document.createElement(`canvas`),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512;let e=this.context.gl;this.debugOverlayTexture=new Gd(this.context,this.debugOverlayCanvas,e.RGBA)}}destroy(){if(this._tileTextures){for(let e in this._tileTextures){let t=this._tileTextures[e];if(t)for(let e of t)e.destroy()}this._tileTextures={}}for(let e of this._rttObjectRecyclePool)e.texture.destroy();if(this._rttObjectRecyclePool=[],this._rttSharedFbo){this._rttSharedFbo.fbo.colorAttachment.set(null),this._rttSharedFbo.fbo.depthAttachment.set(null);let e=this.context.gl;e.deleteRenderbuffer(this._rttSharedFbo.depthRenderbuffer),e.deleteFramebuffer(this._rttSharedFbo.fbo.framebuffer),this._rttSharedFbo=null}if(this.layerOpacityFbo?.destroy(),this.layerOpacityFbo=null,this.tileExtentBuffer&&this.tileExtentBuffer.destroy(),this.debugBuffer&&this.debugBuffer.destroy(),this.rasterBoundsBuffer&&this.rasterBoundsBuffer.destroy(),this.rasterBoundsBufferPosOnly&&this.rasterBoundsBufferPosOnly.destroy(),this.viewportBuffer&&this.viewportBuffer.destroy(),this.tileBorderIndexBuffer&&this.tileBorderIndexBuffer.destroy(),this.quadTriangleIndexBuffer&&this.quadTriangleIndexBuffer.destroy(),this.tileExtentMesh&&this.tileExtentMesh.vertexBuffer?.destroy(),this.tileExtentMesh&&this.tileExtentMesh.indexBuffer?.destroy(),this.debugOverlayTexture&&this.debugOverlayTexture.destroy(),this.context.projectionUniformBuffer.destroy(),this.context.terrainUniformBuffer.destroy(),this.context.frameUniformBuffer.destroy(),this.cache){for(let e in this.cache){let t=this.cache[e];t?.program&&this.context.gl.deleteProgram(t.program)}this.cache={}}this.context&&this.context.setDefault()}overLimit(){let{drawingBufferWidth:e,drawingBufferHeight:t}=this.context.gl;return this.width!==e||this.height!==t}},maplibre_gl_up=class extends Error{constructor(e,t){super(`WebGL2 is required to display this map. We are sorry, but it seems that your browser does not support WebGL2, a technology for rendering 3D graphics on the web. Read more on https://wiki.openstreetmap.org/wiki/This_map_requires_WebGL`),this.name=`GPUInitializationError`,this.requestedAttributes=e,this.statusMessage=t?.statusMessage??null}};function maplibre_gl_dp(e,t){let n=!1,r=null,i,a=()=>{r=null,n&&=(e(...i),r=setTimeout(a,t),!1)};return(...e)=>(n=!0,i=e,r||a(),r)}var maplibre_gl_fp=class{constructor(e){this._getHashParams=()=>new URLSearchParams(window.location.hash.replace(`#`,``)),this._getCurrentHash=()=>{let e=this._getHashParams();return this._hashName?(e.get(this._hashName)||``).split(`/`):([...e.keys()][0]??``).split(`/`)},this._onHashChange=()=>{let e=this._getCurrentHash();if(!this._isValidHash(e))return!1;let t=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(e[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+e[2],+e[1]],zoom:+e[0],bearing:t,pitch:+(e[4]||0)}),!0},this._updateHashUnthrottled=()=>{let e=window.location.href.replace(/(#.*)?$/,this.getHashString());window.history.replaceState(window.history.state,null,e)},this._removeHash=()=>{let e=this._getHashParams();if(this._hashName)e.delete(this._hashName);else{let t=Array.from(e.keys());t.length>0&&e.delete(t[0])}let t=decodeURIComponent(e.toString()).replace(/=&/g,`&`).replace(/=$/g,``),n=t?`#${t}`:``,r=window.location.href.replace(/(#.+)?$/,n);r=r.replace(`&&`,`&`),window.history.replaceState(window.history.state,null,r)},this._updateHash=maplibre_gl_dp(this._updateHashUnthrottled,300),this._hashName=e&&encodeURIComponent(e)}addTo(e){return this._map=e,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(e){let t=this._map.getCenter(),n=Math.round(this._map.getZoom()*100)/100,r=10**Math.ceil((n*Math.LN2+Math.log(512/360/.5))/Math.LN10),i=Math.round(t.lng*r)/r,a=Math.round(t.lat*r)/r,o=this._map.getBearing(),s=this._map.getPitch(),c=``;if(c+=e?`/${i}/${a}/${n}`:`${n}/${a}/${i}`,(o||s)&&(c+=`/${Math.round(o*10)/10}`),s&&(c+=`/${Math.round(s)}`),this._hashName){let e=this._getHashParams();return e.set(this._hashName,c),`#${decodeURIComponent(e.toString()).replace(/=&/g,`&`).replace(/=$/g,``)}`}return`#${c}`}_isValidHash(e){if(e.length<3||e.some(e=>isNaN(+e)))return!1;try{new maplibre_gl_shared_Mp(+e[2],+e[1])}catch{return!1}let t=+e[0],n=+(e[3]||0),r=+(e[4]||0);return t>=this._map.getMinZoom()&&t<=this._map.getMaxZoom()&&n>=-180&&n<=180&&r>=this._map.getMinPitch()&&r<=this._map.getMaxPitch()}};const maplibre_gl_pp={linearity:.3,easing:dist_maplibre_gl_shared_t(0,0,.3,1)},maplibre_gl_mp=maplibre_gl_shared_xt({deceleration:2500,maxSpeed:1400},maplibre_gl_pp),maplibre_gl_hp=maplibre_gl_shared_xt({deceleration:20,maxSpeed:1400},maplibre_gl_pp),maplibre_gl_gp=maplibre_gl_shared_xt({deceleration:1e3,maxSpeed:360},maplibre_gl_pp),maplibre_gl_p=maplibre_gl_shared_xt({deceleration:1e3,maxSpeed:90},maplibre_gl_pp),maplibre_gl_vp=maplibre_gl_shared_xt({deceleration:1e3,maxSpeed:360},maplibre_gl_pp);var maplibre_gl_yp=class{constructor(e){this._map=e,this.clear()}clear(){this._inertiaBuffer=[]}record(e){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:maplibre_gl_U(),settings:e})}_drainInertiaBuffer(){let e=this._inertiaBuffer,t=maplibre_gl_U();for(;e.length>0&&t-e[0].time>160;)e.shift()}_getVelocityEntries(){let e=this._inertiaBuffer,t=maplibre_gl_U()-60,n=Math.max(0,e.length-2);for(;n>0&&e[n-1].time>=t;)n--;return e.slice(n)}_onMoveEnd(e){this._drainInertiaBuffer();let t=this._getVelocityEntries();if(t.length<2){this.clear();return}let n={zoom:0,bearing:0,pitch:0,roll:0,pan:new maplibre_gl_shared_l(0,0),pinchAround:void 0,around:void 0};for(let{settings:e}of t)e.around&&(n.around=e.around),e.pinchAround&&(n.pinchAround=e.pinchAround);for(let{settings:e}of t.slice(1))n.zoom+=e.zoomDelta||0,n.bearing+=e.bearingDelta||0,n.pitch+=e.pitchDelta||0,n.roll+=e.rollDelta||0,e.panDelta&&n.pan._add(e.panDelta);if(!n.pan.mag()&&!n.zoom&&!n.bearing&&!n.pitch&&!n.roll){this.clear();return}let r=maplibre_gl_U()-t[0].time,i={};if(n.pan.mag()){let t=maplibre_gl_xp(n.pan.mag(),r,maplibre_gl_shared_xt({},maplibre_gl_mp,e||{})),a=n.pan.mult(t.amount/n.pan.mag()),o=this._map._camera.cameraHelper.handlePanInertia(a,this._map._camera.transform);i.center=o.easingCenter,i.offset=o.easingOffset,maplibre_gl_bp(i,t)}if(n.zoom){let e=maplibre_gl_xp(n.zoom,r,maplibre_gl_hp);i.zoom=maplibre_gl_shared_kt(this._map.getZoom()+e.amount,this._map.getZoomSnap(),e.amount),maplibre_gl_bp(i,e)}if(n.bearing){let e=maplibre_gl_xp(n.bearing,r,maplibre_gl_gp);i.bearing=this._map.getBearing()+maplibre_gl_shared_yt(e.amount,-179,179),maplibre_gl_bp(i,e)}if(n.pitch){let e=maplibre_gl_xp(n.pitch,r,maplibre_gl_p);i.pitch=this._map.getPitch()+e.amount,maplibre_gl_bp(i,e)}if(n.roll){let e=maplibre_gl_xp(n.roll,r,maplibre_gl_vp);i.roll=this._map.getRoll()+maplibre_gl_shared_yt(e.amount,-179,179),maplibre_gl_bp(i,e)}if(i.zoom||i.bearing){let e=n.pinchAround===void 0?n.around:n.pinchAround;i.around=e?this._map.unproject(e):this._map.getCenter()}return this.clear(),maplibre_gl_shared_xt(i,{noMoveStart:!0})}};function maplibre_gl_bp(e,t){(!e.duration||e.duration<t.duration)&&(e.duration=t.duration,e.easing=t.easing)}function maplibre_gl_xp(e,t,n){let{maxSpeed:r,linearity:i,deceleration:a}=n,o=maplibre_gl_shared_yt(e*i/(t/1e3),-r,r),s=Math.abs(o)/(a*i);return{easing:n.easing,duration:s*1e3,amount:s/2*o}}var maplibre_gl_Sp=class{constructor(e,t){this._map=e,this._clickTolerance=t.clickTolerance}reset(){delete this._mousedownPos}wheel(e){return this._firePreventable(new maplibre_gl_Qr(this._map,e))}mousedown(e,t){return this._mousedownPos=t,this._firePreventable(new maplibre_gl_Xr(e.type,this._map,e))}mouseup(e){this._map.fire(new maplibre_gl_Xr(e.type,this._map,e))}click(e,t){this._mousedownPos&&this._mousedownPos.dist(t)>=this._clickTolerance||this._map.fire(new maplibre_gl_Xr(e.type,this._map,e))}dblclick(e){return this._firePreventable(new maplibre_gl_Xr(e.type,this._map,e))}mouseover(e){this._map.fire(new maplibre_gl_Xr(e.type,this._map,e))}mouseout(e){this._map.fire(new maplibre_gl_Xr(e.type,this._map,e))}touchstart(e){return this._firePreventable(new maplibre_gl_Zr(e.type,this._map,e))}touchmove(e){this._map.fire(new maplibre_gl_Zr(e.type,this._map,e))}touchend(e){this._map.fire(new maplibre_gl_Zr(e.type,this._map,e))}touchcancel(e){this._map.fire(new maplibre_gl_Zr(e.type,this._map,e))}_firePreventable(e){if(this._map.fire(e),e.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}},maplibre_gl_Cp=class{constructor(e){this._map=e}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(e){this._map.fire(new maplibre_gl_Xr(e.type,this._map,e))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new maplibre_gl_Xr(`contextmenu`,this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(e){this._delayContextMenu?this._contextMenuEvent=e:this._ignoreContextMenu||this._map.fire(new maplibre_gl_Xr(e.type,this._map,e)),this._map.listens(`contextmenu`)&&e.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}},maplibre_gl_wp=class{constructor(e,t,n){this._map=e,this._tr=n,this._el=e.getCanvasContainer(),this._container=e.getContainer(),this._clickTolerance=t.clickTolerance||1,t.boxZoom&&typeof t.boxZoom==`object`&&(this._boxZoomEnd=t.boxZoom.boxZoomEnd)}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(e,t){this.isEnabled()&&e.shiftKey&&e.button===0&&(maplibre_gl_W.disableDrag(),this._startPos=this._lastPos=t,this._active=!0)}mousemoveWindow(e,t){if(!this._active)return;let n=t;if(this._lastPos.equals(n)||!this._box&&n.dist(this._startPos)<this._clickTolerance)return;let r=this._startPos;this._lastPos=n,this._box||(this._box=maplibre_gl_W.create(`div`,`maplibregl-boxzoom`,this._container),this._container.classList.add(`maplibregl-crosshair`),this._fireEvent(`boxzoomstart`,e));let i=Math.min(r.x,n.x),a=Math.max(r.x,n.x),o=Math.min(r.y,n.y),s=Math.max(r.y,n.y);this._box.style.transform=`translate(${i}px,${o}px)`,this._box.style.width=`${a-i}px`,this._box.style.height=`${s-o}px`}mouseupWindow(e,t){if(!this._active||e.button!==0)return;let n=this._startPos,r=t;if(this.reset(),maplibre_gl_W.suppressClick(),n.x===r.x&&n.y===r.y)this._fireEvent(`boxzoomcancel`,e);else{if(this._map.fire(new maplibre_gl_$r(`boxzoomend`,{originalEvent:e})),this._boxZoomEnd){this._boxZoomEnd(this._map,n,r,e);return}return{cameraAnimation:e=>e.fitScreenCoordinates(n,r,this._tr.bearing,{linear:!0})}}}keydown(e){this._active&&e.keyCode===27&&(this.reset(),this._fireEvent(`boxzoomcancel`,e))}reset(){this._active=!1,this._container.classList.remove(`maplibregl-crosshair`),this._box&&=(this._box.remove(),null),maplibre_gl_W.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(e,t){return this._map.fire(new maplibre_gl_$r(e,{originalEvent:t}))}};function maplibre_gl_Tp(e,t){if(e.length!==t.length)throw Error(`The number of touches and points are not equal - touches ${e.length}, points ${t.length}`);let n={};for(let r=0;r<e.length;r++)n[e[r].identifier]=t[r];return n}function maplibre_gl_Ep(e){let t=new maplibre_gl_shared_l(0,0);for(let n of e)t._add(n);return t.div(e.length)}var maplibre_gl_Dp=class{constructor(e){this.reset(),this.numTouches=e.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(e,t,n){(this.centroid||n.length>this.numTouches)&&(this.aborted=!0),!this.aborted&&(this.startTime===void 0&&(this.startTime=e.timeStamp),n.length===this.numTouches&&(this.centroid=maplibre_gl_Ep(t),this.touches=maplibre_gl_Tp(n,t)))}touchmove(e,t,n){if(this.aborted||!this.centroid)return;let r=maplibre_gl_Tp(n,t);for(let e in this.touches){let t=this.touches[e],n=r[e];(!n||n.dist(t)>30)&&(this.aborted=!0)}}touchend(e,t,n){if((!this.centroid||e.timeStamp-this.startTime>500)&&(this.aborted=!0),n.length===0){let e=!this.aborted&&this.centroid;if(this.reset(),e)return e}}},maplibre_gl_Op=class{constructor(e){this.singleTap=new maplibre_gl_Dp(e),this.numTaps=e.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(e,t,n){this.singleTap.touchstart(e,t,n)}touchmove(e,t,n){this.singleTap.touchmove(e,t,n)}touchend(e,t,n){let r=this.singleTap.touchend(e,t,n);if(r){let t=e.timeStamp-this.lastTime<500,n=!this.lastTap||this.lastTap.dist(r)<30;if((!t||!n)&&this.reset(),this.count++,this.lastTime=e.timeStamp,this.lastTap=r,this.count===this.numTaps)return this.reset(),r}}},maplibre_gl_kp=class{constructor(e,t){this._tr=t,this._zoomIn=new maplibre_gl_Op({numTouches:1,numTaps:2}),this._zoomOut=new maplibre_gl_Op({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(e,t,n){this._zoomIn.touchstart(e,t,n),this._zoomOut.touchstart(e,t,n)}touchmove(e,t,n){this._zoomIn.touchmove(e,t,n),this._zoomOut.touchmove(e,t,n)}touchend(e,t,n){let r=this._zoomIn.touchend(e,t,n),i=this._zoomOut.touchend(e,t,n),a=this._tr;if(r)return this._active=!0,e.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:t=>t.easeTo({duration:300,zoom:maplibre_gl_shared_kt(a.zoom+1,t.getZoomSnap()),around:a.unproject(r)},{originalEvent:e})};if(i)return this._active=!0,e.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:t=>t.easeTo({duration:300,zoom:maplibre_gl_shared_kt(a.zoom-1,t.getZoomSnap()),around:a.unproject(i)},{originalEvent:e})}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}},maplibre_gl_Ap=class{constructor(e){this._enabled=!!e.enable,this._moveStateManager=e.moveStateManager,this._clickTolerance=e.clickTolerance||1,this._moveFunction=e.move,this._activateOnStart=!!e.activateOnStart,e.assignEvents(this),this.reset()}reset(e){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(e)}_move(...e){let t=this._moveFunction(...e);if(t.bearingDelta||t.pitchDelta||t.rollDelta||t.around||t.panDelta)return this._active=!0,t}dragStart(e,t){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(e)&&(this._moveStateManager.startMove(e),this._lastPoint=Array.isArray(t)?t[0]:t,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(e,t){if(!this.isEnabled())return;let n=this._lastPoint;if(!n)return;if(e.preventDefault(),!this._moveStateManager.isValidMoveEvent(e)){this.reset(e);return}let r=Array.isArray(t)?t[0]:t;if(!(!this._moved&&r.dist(n)<this._clickTolerance))return this._moved=!0,this._lastPoint=r,this._move(n,r)}dragEnd(e){this.isEnabled()&&this._lastPoint&&this._moveStateManager.isValidEndEvent(e)&&(this._moved&&maplibre_gl_W.suppressClick(),this.reset(e))}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}getClickTolerance(){return this._clickTolerance}};const maplibre_gl_jp={0:1,2:2};function maplibre_gl_Mp(e,t){let n=maplibre_gl_jp[t];return e.buttons===void 0||(e.buttons&n)!==n}var maplibre_gl_Np=class{constructor(e){this._correctEvent=e.checkCorrectEvent}startMove(e){this._eventButton=e.button}endMove(e){delete this._eventButton}isValidStartEvent(e){return this._correctEvent(e)}isValidMoveEvent(e){return!maplibre_gl_Mp(e,this._eventButton)}isValidEndEvent(e){return e.button===this._eventButton}},maplibre_gl_Pp=class{constructor(){this._firstTouch=void 0}_isOneFingerTouch(e){return e.targetTouches.length===1}_isSameTouchEvent(e){return e.targetTouches[0].identifier===this._firstTouch}startMove(e){this._firstTouch=e.targetTouches[0].identifier}endMove(e){delete this._firstTouch}isValidStartEvent(e){return this._isOneFingerTouch(e)}isValidMoveEvent(e){return this._isOneFingerTouch(e)&&this._isSameTouchEvent(e)}isValidEndEvent(e){return this._isOneFingerTouch(e)&&this._isSameTouchEvent(e)}},maplibre_gl_Fp=class{constructor(e=new maplibre_gl_Np({checkCorrectEvent:()=>!0}),t=new maplibre_gl_Pp){this.mouseMoveStateManager=e,this.oneFingerTouchMoveStateManager=t}_executeRelevantHandler(e,t,n){if(e instanceof MouseEvent)return t(e);if(typeof TouchEvent<`u`&&e instanceof TouchEvent)return n(e)}startMove(e){this._executeRelevantHandler(e,e=>{this.mouseMoveStateManager.startMove(e)},e=>{this.oneFingerTouchMoveStateManager.startMove(e)})}endMove(e){this._executeRelevantHandler(e,e=>{this.mouseMoveStateManager.endMove(e)},e=>{this.oneFingerTouchMoveStateManager.endMove(e)})}isValidStartEvent(e){return!!this._executeRelevantHandler(e,e=>this.mouseMoveStateManager.isValidStartEvent(e),e=>this.oneFingerTouchMoveStateManager.isValidStartEvent(e))}isValidMoveEvent(e){return!!this._executeRelevantHandler(e,e=>this.mouseMoveStateManager.isValidMoveEvent(e),e=>this.oneFingerTouchMoveStateManager.isValidMoveEvent(e))}isValidEndEvent(e){return!!this._executeRelevantHandler(e,e=>this.mouseMoveStateManager.isValidEndEvent(e),e=>this.oneFingerTouchMoveStateManager.isValidEndEvent(e))}};const maplibre_gl_Ip=e=>{e.mousedown=e.dragStart,e.mousemoveWindow=e.dragMove,e.mouseup=e.dragEnd,e.contextmenu=e=>{e.preventDefault()}};function maplibre_gl_Lp({enable:e,clickTolerance:t}){return new maplibre_gl_Ap({clickTolerance:t,move:(e,t)=>({around:t,panDelta:t.sub(e)}),activateOnStart:!0,moveStateManager:new maplibre_gl_Np({checkCorrectEvent:e=>e.button===0&&!e.ctrlKey}),enable:e,assignEvents:maplibre_gl_Ip})}function maplibre_gl_Rp({enable:e,clickTolerance:t,aroundCenter:n=!0,minPixelCenterThreshold:r=100,rotateSpeed:i=.8},a){return new maplibre_gl_Ap({clickTolerance:t,move:(e,t)=>{let o=a();if(n&&Math.abs(o.y-e.y)>r)return{bearingDelta:maplibre_gl_shared_rn(new maplibre_gl_shared_l(e.x,t.y),t,o)};let s=(t.x-e.x)*i;return n&&t.y<o.y&&(s=-s),{bearingDelta:s}},moveStateManager:new maplibre_gl_Np({checkCorrectEvent:e=>e.button===0&&e.ctrlKey||e.button===2&&!e.ctrlKey}),enable:e,assignEvents:maplibre_gl_Ip})}function maplibre_gl_zp({enable:e,clickTolerance:t,pitchSpeed:n=-.5}){return new maplibre_gl_Ap({clickTolerance:t,move:(e,t)=>({pitchDelta:(t.y-e.y)*n}),moveStateManager:new maplibre_gl_Np({checkCorrectEvent:e=>e.button===0&&e.ctrlKey||e.button===2}),enable:e,assignEvents:maplibre_gl_Ip})}function maplibre_gl_Bp({enable:e,clickTolerance:t,rollDegreesPerPixelMoved:n=.3},r){return new maplibre_gl_Ap({clickTolerance:t,move:(e,t)=>{let i=r(),a=(t.x-e.x)*n;return t.y<i.y&&(a=-a),{rollDelta:a}},moveStateManager:new maplibre_gl_Np({checkCorrectEvent:e=>e.button===2&&e.ctrlKey}),enable:e,assignEvents:maplibre_gl_Ip})}var maplibre_gl_Vp=class{constructor(e,t){this._clickTolerance=e.clickTolerance||1,this._map=t,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new maplibre_gl_shared_l(0,0)}_shouldBePrevented(e){return e<(this._map.cooperativeGestures.isEnabled()?2:1)}touchstart(e,t,n){return this._calculateTransform(e,t,n)}touchmove(e,t,n){if(this._active){if(this._shouldBePrevented(n.length)){this._map.cooperativeGestures.notifyGestureBlocked(`touch_pan`,e);return}return e.preventDefault(),this._calculateTransform(e,t,n)}}touchend(e,t,n){this._calculateTransform(e,t,n),this._active&&this._shouldBePrevented(n.length)&&this.reset()}touchcancel(){this.reset()}_calculateTransform(e,t,n){n.length>0&&(this._active=!0);let r=maplibre_gl_Tp(n,t),i=new maplibre_gl_shared_l(0,0),a=new maplibre_gl_shared_l(0,0),o=0;for(let e in r){let t=r[e],n=this._touches[e];n&&(i._add(t),a._add(t.sub(n)),o++,r[e]=t)}if(this._touches=r,this._shouldBePrevented(o)||!a.mag())return;let s=a.div(o);if(this._sum._add(s),!(this._sum.mag()<this._clickTolerance))return{around:i.div(o),panDelta:s}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}},maplibre_gl_Hp=class{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}touchstart(e,t,n){this._firstTwoTouches||n.length<2||(this._firstTwoTouches=[n[0].identifier,n[1].identifier],this._start([t[0],t[1]]))}touchmove(e,t,n){if(!this._firstTwoTouches)return;e.preventDefault();let[r,i]=this._firstTwoTouches,a=maplibre_gl_Up(n,t,r),o=maplibre_gl_Up(n,t,i);if(!a||!o)return;let s=this._aroundCenter?null:a.add(o).div(2);return this._move([a,o],s,e)}touchend(e,t,n){if(!this._firstTwoTouches)return;let[r,i]=this._firstTwoTouches,a=maplibre_gl_Up(n,t,r),o=maplibre_gl_Up(n,t,i);a&&o||(this._active&&maplibre_gl_W.suppressClick(),this.reset())}touchcancel(){this.reset()}enable(e){this._enabled=!0,this._aroundCenter=!!e&&e.around===`center`}disable(){this._enabled=!1,this.reset()}isEnabled(){return!!this._enabled}isActive(){return!!this._active}};function maplibre_gl_Up(e,t,n){for(let r=0;r<e.length;r++)if(e[r].identifier===n)return t[r]}const maplibre_gl_Wp=.1;function maplibre_gl_Gp(e,t){return Math.log(e/t)/Math.LN2}var maplibre_gl_Kp=class extends maplibre_gl_Hp{constructor(){super(),this._zoomRate=1,this._zoomThreshold=maplibre_gl_Wp}setZoomRate(e){this._zoomRate=e??1}setZoomThreshold(e){this._zoomThreshold=e??maplibre_gl_Wp}reset(){super.reset(),delete this._distance,delete this._startDistance}_start(e){this._startDistance=this._distance=e[0].dist(e[1])}_move(e,t){let n=this._distance;if(this._distance=e[0].dist(e[1]),!(!this._active&&Math.abs(maplibre_gl_Gp(this._distance,this._startDistance))<this._zoomThreshold))return this._active=!0,{zoomDelta:maplibre_gl_Gp(this._distance,n)*this._zoomRate,pinchAround:t}}};function maplibre_gl_qp(e,t){return e.angleWith(t)*180/Math.PI}var maplibre_gl_Jp=class extends maplibre_gl_Hp{reset(){super.reset(),delete this._minDiameter,delete this._startVector,delete this._vector}_start(e){this._startVector=this._vector=e[0].sub(e[1]),this._minDiameter=e[0].dist(e[1])}_move(e,t,n){let r=this._vector;if(this._vector=e[0].sub(e[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:maplibre_gl_qp(this._vector,r),pinchAround:t}}_isBelowThreshold(e){this._minDiameter=Math.min(this._minDiameter,e.mag());let t=25/(Math.PI*this._minDiameter)*360,n=maplibre_gl_qp(e,this._startVector);return Math.abs(n)<t}};function maplibre_gl_Yp(e){return Math.abs(e.y)>Math.abs(e.x)}var maplibre_gl_Xp=class extends maplibre_gl_Hp{constructor(e){super(),this._currentTouchCount=0,this._map=e}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(e,t,n){super.touchstart(e,t,n),this._currentTouchCount=n.length}_start(e){this._lastPoints=e,maplibre_gl_Yp(e[0].sub(e[1]))&&(this._valid=!1)}_move(e,t,n){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;let r=e[0].sub(this._lastPoints[0]),i=e[1].sub(this._lastPoints[1]);if(this._valid=this.gestureBeginsVertically(r,i,n.timeStamp),this._valid)return this._lastPoints=e,this._active=!0,{pitchDelta:(r.y+i.y)/2*-.5}}gestureBeginsVertically(e,t,n){if(this._valid!==void 0)return this._valid;let r=e.mag()>=2,i=t.mag()>=2;if(!r&&!i)return;if(!r||!i)return this._firstMove===void 0&&(this._firstMove=n),n-this._firstMove<100&&void 0;let a=e.y>0==t.y>0;return maplibre_gl_Yp(e)&&maplibre_gl_Yp(t)&&a}};const maplibre_gl_Zp={panStep:100,bearingStep:15,pitchStep:10};var maplibre_gl_Qp=class{constructor(e,t){this._tr=t;let n=maplibre_gl_Zp;this._panStep=n.panStep,this._bearingStep=n.bearingStep,this._pitchStep=n.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(e){if(e.altKey||e.ctrlKey||e.metaKey)return;let t=0,n=0,r=0,i=0,a=0;switch(e.keyCode){case 61:case 107:case 171:case 187:t=1;break;case 189:case 109:case 173:t=-1;break;case 37:e.shiftKey?n=-1:(e.preventDefault(),i=-1);break;case 39:e.shiftKey?n=1:(e.preventDefault(),i=1);break;case 38:e.shiftKey?r=1:(e.preventDefault(),a=-1);break;case 40:e.shiftKey?r=-1:(e.preventDefault(),a=1);break;default:return}return this._rotationDisabled&&(n=0,r=0),{cameraAnimation:o=>{let s=this._tr;o.easeTo({duration:300,easeId:`keyboardHandler`,easing:maplibre_gl_$p,zoom:t?maplibre_gl_shared_kt(s.zoom+t*(e.shiftKey?2:1),o.getZoomSnap()):s.zoom,bearing:s.bearing+n*this._bearingStep,pitch:s.pitch+r*this._pitchStep,offset:[-i*this._panStep,-a*this._panStep],center:s.center},{originalEvent:e})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}};function maplibre_gl_$p(e){return e*(2-e)}const maplibre_gl_em=4.000244140625;var maplibre_gl_tm=class{constructor(e,t,n){this._onTimeout=e=>{this._type=`wheel`,this._delta-=this._lastValue,this._active||this._start(e)},this._map=e,this._tr=n,this._triggerRenderFrame=t,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222}setZoomRate(e){this._defaultZoomRate=e}setWheelZoomRate(e){this._wheelZoomRate=e}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(e){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!e&&e.around===`center`)}disable(){this.isEnabled()&&(this._enabled=!1)}_shouldBePrevented(e){return this._map.cooperativeGestures.isEnabled()?!(e.ctrlKey||this._map.cooperativeGestures.isBypassed(e)):!1}wheel(e){if(!this.isEnabled())return;if(this._shouldBePrevented(e)){this._map.cooperativeGestures.notifyGestureBlocked(`wheel_zoom`,e);return}let t=e.deltaMode===WheelEvent.DOM_DELTA_LINE?e.deltaY*40:e.deltaY,n=maplibre_gl_U(),r=n-(this._lastWheelEventTime||0);this._lastWheelEventTime=n,t!==0&&t%maplibre_gl_em==0?this._type=`wheel`:t!==0&&Math.abs(t)<4?this._type=`trackpad`:r>400?(this._type=null,this._lastValue=t,this._timeout=setTimeout(this._onTimeout,40,e)):this._type||(this._type=Math.abs(r*t)<200?`trackpad`:`wheel`,this._timeout&&(clearTimeout(this._timeout),this._timeout=null,t+=this._lastValue)),e.shiftKey&&t&&(t/=4),this._type&&(this._lastWheelEvent=e,this._delta-=t,this._active||this._start(e)),e.preventDefault()}_start(e){if(!this._delta)return;this._needsRerender=!1,this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);let t=maplibre_gl_W.mousePos(this._map.getCanvas(),e),n=this._tr;this._aroundPoint=this._aroundCenter?n.transform.locationToScreenPoint(maplibre_gl_shared_Mp.convert(n.center)):t,this._needsRerender||(this._needsRerender=!0,this._triggerRenderFrame())}renderFrame(){if(!this._needsRerender||(this._needsRerender=!1,!this.isActive()))return;let e=this._tr.transform;if(typeof this._lastExpectedZoom==`number`){let t=e.zoom-this._lastExpectedZoom;typeof this._startZoom==`number`&&(this._startZoom+=t),typeof this._targetZoom==`number`&&(this._targetZoom+=t)}if(this._delta!==0){let t=this._type===`wheel`&&Math.abs(this._delta)>maplibre_gl_em?this._wheelZoomRate:this._defaultZoomRate,n=2/(1+Math.exp(-Math.abs(this._delta*t)));this._delta<0&&n!==0&&(n=1/n);let r=typeof this._targetZoom==`number`?maplibre_gl_shared_Dt(this._targetZoom):e.scale,i=e.applyConstrain(e.getCameraLngLat(),maplibre_gl_shared_Ot(r*n)).zoom,a=this._map.getZoomSnap();if(this._type===`wheel`&&a>0){let t=maplibre_gl_shared_kt(e.zoom,a);this._targetZoom=maplibre_gl_shared_kt(i,a,i-t)}else this._targetZoom=i;this._type===`wheel`&&(this._startZoom=e.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}let t=typeof this._targetZoom==`number`?this._targetZoom:e.zoom,n=this._startZoom,r=this._easing,i=!1,a;if(this._type===`wheel`&&n&&r){let e=maplibre_gl_U()-this._lastWheelEventTime,o=Math.min((e+5)/200,1),s=r(o);a=maplibre_gl_shared_$r.number(n,t,s),o<1?this._needsRerender=!0:i=!0}else a=t,i=!0;return this._active=!0,i&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._lastExpectedZoom,delete this._finishTimeout},200)),this._lastExpectedZoom=a,{noInertia:!0,needsRenderFrame:!i,zoomDelta:a-e.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(e){let t=maplibre_gl_shared_vt;if(this._prevEase){let e=this._prevEase,n=(maplibre_gl_U()-e.start)/e.duration,r=e.easing(n+.01)-e.easing(n),i=.27/Math.sqrt(r*r+1e-4)*.01,a=Math.sqrt(.0729-i*i);t=dist_maplibre_gl_shared_t(i,a,.25,1)}return this._prevEase={start:maplibre_gl_U(),duration:e,easing:t},t}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,delete this._lastExpectedZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}},maplibre_gl_nm=class{constructor(e,t){this._clickZoom=e,this._tapZoom=t}enable(){this._clickZoom.enable(),this._tapZoom.enable()}disable(){this._clickZoom.disable(),this._tapZoom.disable()}isEnabled(){return this._clickZoom.isEnabled()&&this._tapZoom.isEnabled()}isActive(){return this._clickZoom.isActive()||this._tapZoom.isActive()}},maplibre_gl_rm=class{constructor(e,t){this._tr=t,this.reset()}reset(){this._active=!1}dblclick(e,t){return e.preventDefault(),{cameraAnimation:n=>{n.easeTo({duration:300,zoom:maplibre_gl_shared_kt(this._tr.zoom+(e.shiftKey?-1:1),n.getZoomSnap()),around:this._tr.unproject(t)},{originalEvent:e})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}},maplibre_gl_im=class{constructor(){this._tap=new maplibre_gl_Op({numTouches:1,numTaps:1}),this._zoomRate=1,this.reset()}setZoomRate(e){this._zoomRate=e??1}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,delete this._tapPoint,this._tap.reset()}touchstart(e,t,n){if(!this._swipePoint){if(!this._tapTime)this._tap.touchstart(e,t,n);else{let r=t[0],i=e.timeStamp-this._tapTime<500,a=this._tapPoint.dist(r)<30;!i||!a?this.reset():n.length>0&&(this._swipePoint=r,this._swipeTouch=n[0].identifier)}}}touchmove(e,t,n){if(!this._tapTime)this._tap.touchmove(e,t,n);else if(this._swipePoint){if(n[0].identifier!==this._swipeTouch)return;let r=t[0],i=r.y-this._swipePoint.y;return this._swipePoint=r,e.preventDefault(),this._active=!0,{zoomDelta:i/128*this._zoomRate}}}touchend(e,t,n){if(this._tapTime)this._swipePoint&&n.length===0&&this.reset();else{let r=this._tap.touchend(e,t,n);r&&(this._tapTime=e.timeStamp,this._tapPoint=r)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}},maplibre_gl_am=class{constructor(e,t,n){this._el=e,this._mousePan=t,this._touchPan=n}enable(e){this._inertiaOptions=e||{},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()}},maplibre_gl_om=class{constructor(e,t,n,r){this._pitchWithRotate=e.pitchWithRotate,this._rollEnabled=e.rollEnabled,this._mouseRotate=t,this._mousePitch=n,this._mouseRoll=r}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable(),this._rollEnabled&&this._mouseRoll.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable(),this._mouseRoll.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())&&(!this._rollEnabled||this._mouseRoll.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()||this._mouseRoll.isActive()}},maplibre_gl_sm=class{constructor(e,t,n,r){this._el=e,this._touchZoom=t,this._touchRotate=n,this._tapDragZoom=r,this._rotationDisabled=!1,this._enabled=!0}enable(e){this._touchZoom.enable(e),this._rotationDisabled||this._touchRotate.enable(e),this._tapDragZoom.enable(),this._el.classList.add(`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()}setZoomRate(e){this._touchZoom.setZoomRate(e),this._tapDragZoom.setZoomRate(e)}setZoomThreshold(e){this._touchZoom.setZoomThreshold(e)}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}},maplibre_gl_cm=class{constructor(e,t){this._bypassKey=navigator.userAgent.includes(`Mac`)?`metaKey`:`ctrlKey`,this._map=e,this._options=t,this._enabled=!1}isActive(){return!1}reset(){}_setupUI(){if(this._container)return;let e=this._map.getCanvasContainer();e.classList.add(`maplibregl-cooperative-gestures`),this._container=maplibre_gl_W.create(`div`,`maplibregl-cooperative-gesture-screen`,e);let t=this._map._getUIString(`CooperativeGesturesHandler.WindowsHelpText`);this._bypassKey===`metaKey`&&(t=this._map._getUIString(`CooperativeGesturesHandler.MacHelpText`));let n=this._map._getUIString(`CooperativeGesturesHandler.MobileHelpText`),r=document.createElement(`div`);r.className=`maplibregl-desktop-message`,r.textContent=t,this._container.appendChild(r);let i=document.createElement(`div`);i.className=`maplibregl-mobile-message`,i.textContent=n,this._container.appendChild(i),this._container.setAttribute(`aria-hidden`,`true`)}_destroyUI(){this._container&&(this._container.remove(),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(e){return e[this._bypassKey]}notifyGestureBlocked(e,t){this._enabled&&(this._map.fire(new maplibre_gl_qr(`cooperativegestureprevented`,{gestureType:e,originalEvent:t})),this._container.classList.add(`maplibregl-show`),setTimeout(()=>{this._container.classList.remove(`maplibregl-show`)},100))}},maplibre_gl_lm=class{constructor(e){this._camera=e}get transform(){return this._camera._requestedCameraState||this._camera.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(e){return this.transform.screenPointToLocation(maplibre_gl_shared_l.convert(e),this._camera.terrain)}};const maplibre_gl_um=e=>e.zoom||e.drag||e.roll||e.pitch||e.rotate;var maplibre_gl_dm=class extends maplibre_gl_shared_Nn{};function maplibre_gl_fm(e){return e.panDelta?.mag()||e.zoomDelta||e.bearingDelta||e.pitchDelta||e.rollDelta}var maplibre_gl_pm=class{get _ownerDocument(){return this._el?.ownerDocument||document}get _ownerWindow(){return this._el?.ownerDocument?.defaultView||window}constructor(e,t,n){this._terrainGestureAnchorElevation=null,this.handleWindowEvent=e=>{this.handleEvent(e,`${e.type}Window`)},this.handleEvent=(e,t)=>{if(e.type===`blur`){this.stop(!0);return}this._updatingCamera=!0;let n=e.type===`renderFrame`?void 0:e,r={needsRenderFrame:!1},i={},a={};for(let{handlerName:o,handler:s,allowed:c}of this._handlers){if(!s.isEnabled())continue;let l;if(this._blockedByActive(a,c,o))s.reset();else if(s[t||e.type]){if(maplibre_gl_shared_un(e,t||e.type)){let n=maplibre_gl_W.mousePos(this._map.getCanvas(),e);l=s[t||e.type](e,n)}else if(maplibre_gl_shared_ln(e,t||e.type)){let n=e.touches,r=this._getMapTouches(n),i=maplibre_gl_W.touchPos(this._map.getCanvas(),r);l=s[t||e.type](e,i,r)}else maplibre_gl_shared_dn(t||e.type)||(l=s[t||e.type](e));this.mergeHandlerResult(r,i,l,o,n),l?.needsRenderFrame&&this._triggerRenderFrame()}(l||s.isActive())&&(a[o]=s)}let o={};for(let e in this._previousActiveHandlers)a[e]||(o[e]=n);this._previousActiveHandlers=a,(Object.keys(o).length||maplibre_gl_fm(r))&&(this._changes.push([r,i,o]),this._triggerRenderFrame()),(Object.keys(a).length||maplibre_gl_fm(r))&&this._camera.stop(!0),this._updatingCamera=!1;let{cameraAnimation:s}=r;s&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],s(this._map))},this._map=e,this._camera=t,this._transformProvider=new maplibre_gl_lm(this._camera),this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new maplibre_gl_yp(e),this._bearingSnap=n.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(n);let r=this._el;this._listeners=[[r,`touchstart`,{passive:!0}],[r,`touchmove`,{passive:!1}],[r,`touchend`,void 0],[r,`touchcancel`,void 0],[r,`mousedown`,void 0],[r,`mousemove`,void 0],[r,`mouseup`,void 0],[this._ownerDocument,`mousemove`,{capture:!0}],[this._ownerDocument,`mouseup`,void 0],[r,`mouseover`,void 0],[r,`mouseout`,void 0],[r,`dblclick`,void 0],[r,`click`,void 0],[r,`keydown`,{capture:!1}],[r,`keyup`,void 0],[r,`wheel`,{passive:!1}],[r,`contextmenu`,void 0],[this._ownerWindow,`blur`,void 0]];for(let[e,t,n]of this._listeners)e.addEventListener(t,e===this._ownerDocument?this.handleWindowEvent:this.handleEvent,n)}destroy(){for(let[e,t,n]of this._listeners)e.removeEventListener(t,e===this._ownerDocument?this.handleWindowEvent:this.handleEvent,n)}_addDefaultHandlers(e){let t=this._map,n=t.getCanvasContainer();this._add(`mapEvent`,new maplibre_gl_Sp(t,e));let r=t.boxZoom=new maplibre_gl_wp(t,e,this._transformProvider);this._add(`boxZoom`,r),e.interactive&&e.boxZoom&&r.enable();let i=t.cooperativeGestures=new maplibre_gl_cm(t,e.cooperativeGestures);this._add(`cooperativeGestures`,i),e.cooperativeGestures&&i.enable();let a=new maplibre_gl_kp(t,this._transformProvider),o=new maplibre_gl_rm(t,this._transformProvider);t.doubleClickZoom=new maplibre_gl_nm(o,a),this._add(`tapZoom`,a),this._add(`clickZoom`,o),e.interactive&&e.doubleClickZoom&&t.doubleClickZoom.enable();let s=new maplibre_gl_im;this._add(`tapDragZoom`,s);let c=t.touchPitch=new maplibre_gl_Xp(t);this._add(`touchPitch`,c),e.interactive&&e.touchPitch&&t.touchPitch.enable(e.touchPitch);let l=()=>t.project(t.getCenter()),u=maplibre_gl_Rp(e,l),d=maplibre_gl_zp(e),f=maplibre_gl_Bp(e,l);t.dragRotate=new maplibre_gl_om(e,u,d,f),this._add(`mouseRotate`,u,[`mousePitch`]),this._add(`mousePitch`,d,[`mouseRotate`,`mouseRoll`]),this._add(`mouseRoll`,f,[`mousePitch`]),e.interactive&&e.dragRotate&&t.dragRotate.enable();let p=maplibre_gl_Lp(e),m=new maplibre_gl_Vp(e,t);t.dragPan=new maplibre_gl_am(n,p,m),this._add(`mousePan`,p),this._add(`touchPan`,m,[`touchZoom`,`touchRotate`]),e.interactive&&e.dragPan&&t.dragPan.enable(e.dragPan);let h=new maplibre_gl_Jp,g=new maplibre_gl_Kp;t.touchZoomRotate=new maplibre_gl_sm(n,g,h,s),this._add(`touchRotate`,h,[`touchPan`,`touchZoom`]),this._add(`touchZoom`,g,[`touchPan`,`touchRotate`]),e.interactive&&e.touchZoomRotate&&t.touchZoomRotate.enable(e.touchZoomRotate),this._add(`blockableMapEvent`,new maplibre_gl_Cp(t));let _=t.scrollZoom=new maplibre_gl_tm(t,()=>this._triggerRenderFrame(),this._transformProvider);this._add(`scrollZoom`,_,[`mousePan`]),e.interactive&&e.scrollZoom&&t.scrollZoom.enable(e.scrollZoom);let v=t.keyboard=new maplibre_gl_Qp(t,this._transformProvider);this._add(`keyboard`,v),e.interactive&&e.keyboard&&t.keyboard.enable()}_add(e,t,n){this._handlers.push({handlerName:e,handler:t,allowed:n}),this._handlersById[e]=t}stop(e){if(!this._updatingCamera){for(let{handler:e}of this._handlers)e.reset();this._inertia.clear(),this._fireEvents({},{},e),this._changes=[]}}isActive(){for(let{handler:e}of this._handlers)if(e.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!maplibre_gl_um(this._eventsInProgress)||this.isZooming()}_blockedByActive(e,t,n){for(let r in e)if(r!==n&&!t?.includes(r))return!0;return!1}_getMapTouches(e){let t=[];for(let n of e){let e=n.target;this._el.contains(e)&&t.push(n)}return t}mergeHandlerResult(e,t,n,r,i){if(!n)return;maplibre_gl_shared_xt(e,n);let a={handlerName:r,originalEvent:n.originalEvent||i};n.zoomDelta!==void 0&&(t.zoom=a),n.panDelta!==void 0&&(t.drag=a),n.rollDelta!==void 0&&(t.roll=a),n.pitchDelta!==void 0&&(t.pitch=a),n.bearingDelta!==void 0&&(t.rotate=a)}_applyChanges(){let e={},t={},n={};for(let[r,i,a]of this._changes)r.panDelta&&(e.panDelta=(e.panDelta||new maplibre_gl_shared_l(0,0))._add(r.panDelta)),r.zoomDelta&&(e.zoomDelta=(e.zoomDelta||0)+r.zoomDelta),r.bearingDelta&&(e.bearingDelta=(e.bearingDelta||0)+r.bearingDelta),r.pitchDelta&&(e.pitchDelta=(e.pitchDelta||0)+r.pitchDelta),r.rollDelta&&(e.rollDelta=(e.rollDelta||0)+r.rollDelta),r.around!==void 0&&(e.around=r.around),r.pinchAround!==void 0&&(e.pinchAround=r.pinchAround),r.noInertia&&(e.noInertia=r.noInertia),maplibre_gl_shared_xt(t,i),maplibre_gl_shared_xt(n,a);this._updateMapTransform(e,t,n),this._changes=[]}_updateMapTransform(e,t,n){let r=this._map,i=this._camera.getTransformForUpdate(),a=r.terrain;if(!maplibre_gl_fm(e)&&!(a&&this._terrainMovement)){this._fireEvents(t,n,!0);return}this._camera.stop(!0);let{panDelta:o,zoomDelta:s,bearingDelta:c,pitchDelta:l,rollDelta:u}=e,{around:d,aroundOnSurface:f}=this._resolveAround(e,a,i),p=a?this._terrainGestureElevation(a,d,f,i,t):void 0,m={panDelta:o,zoomDelta:s,rollDelta:u,pitchDelta:l,bearingDelta:c,around:d,aroundElevation:p};this._camera.cameraHelper.useGlobeControls&&!i.isPointOnMapSurface(d)&&(d=i.centerPoint);let h=this._computePreZoomAroundLoc(i,d,o,p);this._handleMapControls({terrain:a,tr:i,deltasForHelper:m,preZoomAroundLoc:h,combinedEventsInProgress:t,panDelta:o}),this._camera.applyUpdatedTransform(i),this._map._update(),e.noInertia||this._inertia.record(e),this._fireEvents(t,n,!0)}_resolveAround(e,t,n){let r=e.pinchAround===void 0?e.around:e.pinchAround;return r||=this._camera.transform.centerPoint,t&&!n.isPointOnMapSurface(r)?{around:n.centerPoint,aroundOnSurface:!1}:{around:r,aroundOnSurface:!0}}_terrainGestureElevation(e,t,n,r,i){if(!n)return;if(!this._terrainMovement&&(i.drag||i.zoom)){let n=r.screenTerrainPointToMercatorCoordinate(t,e);this._terrainGestureAnchorElevation=n?n.z:null}if(this._terrainGestureAnchorElevation===null)return;let a=this._terrainGestureAnchorElevation;if(!(t.distSqr(r.centerPoint)<.01)&&!(a-r.elevation>=.9*(r.getCameraAltitude()-r.elevation)))return a}_computePreZoomAroundLoc(e,t,n,r){if(t.distSqr(e.centerPoint)<.01)return e.center;let i=n?t.sub(n):t;return r===void 0?e.screenPointToLocation(i):e.screenPointToLocationAtElevation(i,r)}_handleMapControls({terrain:e,tr:t,deltasForHelper:n,preZoomAroundLoc:r,combinedEventsInProgress:i,panDelta:a}){let o=this._camera.cameraHelper;if(o.handleMapControlsRollPitchBearingZoom(n,t),!e){o.handleMapControlsPan(n,t,r);return}if(o.useGlobeControls){!this._terrainMovement&&(i.drag||i.zoom)&&(this._terrainMovement=!0,this._camera.elevationFreeze=!0),o.handleMapControlsPan(n,t,r);return}if(!this._terrainMovement&&(i.drag||i.zoom)){this._terrainMovement=!0,this._camera.elevationFreeze=!0,o.handleMapControlsPan(n,t,r);return}if(n.aroundElevation===void 0&&i.drag&&this._terrainMovement&&a){t.setCenter(t.screenPointToLocation(t.centerPoint.sub(a)));return}o.handleMapControlsPan(n,t,r)}_fireEvents(e,t,n){let r=maplibre_gl_um(this._eventsInProgress),i=maplibre_gl_um(e),a={};for(let t in e){let{originalEvent:n}=e[t];this._eventsInProgress[t]||(a[`${t}start`]=n),this._eventsInProgress[t]=e[t]}!r&&i&&this._fireEvent(`movestart`,i.originalEvent);for(let e in a)this._fireEvent(e,a[e]);i&&this._fireEvent(`move`,i.originalEvent);for(let t in e){let{originalEvent:n}=e[t];this._fireEvent(t,n)}let o={},s;for(let e in this._eventsInProgress){let{handlerName:n,originalEvent:r}=this._eventsInProgress[e];this._handlersById[n].isActive()||(delete this._eventsInProgress[e],s=t[n]||r,o[`${e}end`]=s)}for(let e in o)this._fireEvent(e,o[e]);let c=maplibre_gl_um(this._eventsInProgress),l=(r||i)&&!c;if(l&&this._terrainMovement){this._camera.elevationFreeze=!1,this._terrainMovement=!1,this._terrainGestureAnchorElevation=null;let e=this._camera.getTransformForUpdate();this._map.getCenterClampedToGround()&&e.recalculateZoomAndCenter(this._map.terrain),this._camera.applyUpdatedTransform(e)}if(n&&l){this._updatingCamera=!0;let e=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),t=e=>e!==0&&-this._bearingSnap<e&&e<this._bearingSnap;e&&(e.essential||!maplibre_gl_Br.prefersReducedMotion)?(t(e.bearing||this._map.getBearing())&&(e.bearing=0),e.freezeElevation=!0,this._map.easeTo(e,{originalEvent:s})):(this._map.fire(new maplibre_gl_G(`moveend`,{originalEvent:s})),t(this._map.getBearing())&&this._map.resetNorth()),this._updatingCamera=!1}}_fireEvent(e,t){this._map.fire(new maplibre_gl_G(e,t?{originalEvent:t}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(e=>{delete this._frameId,this.handleEvent(new maplibre_gl_dm(`renderFrame`,{timeStamp:e})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}},maplibre_gl_mm=class extends maplibre_gl_shared_Fn{constructor(e){super(),this._renderFrameCallback=()=>{let e=Math.min((maplibre_gl_U()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(e)),e<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this.transform=new maplibre_gl_Sc,this.cameraHelper=new maplibre_gl_Oc,e.minZoom!==void 0&&this.transform.setMinZoom(e.minZoom),e.maxZoom!==void 0&&this.transform.setMaxZoom(e.maxZoom),e.minPitch!==void 0&&this.transform.setMinPitch(e.minPitch),e.maxPitch!==void 0&&this.transform.setMaxPitch(e.maxPitch),e.renderWorldCopies!==void 0&&this.transform.setRenderWorldCopies(e.renderWorldCopies),e.transformConstrain!==null&&this.transform.setConstrainOverride(e.transformConstrain),this._moving=!1,this._zooming=!1,this._bearingSnap=e.bearingSnap,this._zoomSnap=e.zoomSnap,this._requestRenderFrame=e.requestRenderFrame,this._cancelRenderFrame=e.cancelRenderFrame,this.terrain=e.terrain,this._centerClampedToGround=e.centerClampedToGround??!0,this.transformCameraUpdate=e.transformCameraUpdate??null,this._stopHandlers=e.stopHandlers??(()=>{}),this.on(`moveend`,()=>{delete this._requestedCameraState})}migrateProjection(e,t){if(e.apply(this.transform,!0),this.transform=e,this.cameraHelper=t,this._requestedCameraState){let t=e.clone();t.apply(this._requestedCameraState,!0),this._requestedCameraState=t}}getCenter(){return new maplibre_gl_shared_Mp(this.transform.center.lng,this.transform.center.lat)}setCenter(e,t){return this.jumpTo({center:e},t)}getCenterElevation(){return this.transform.elevation}setCenterElevation(e,t){return this.jumpTo({elevation:e},t),this}getCenterClampedToGround(){return this._centerClampedToGround}setCenterClampedToGround(e){this._centerClampedToGround=e}panBy(e,t,n){return e=maplibre_gl_shared_l.convert(e).mult(-1),this.panTo(this.transform.center,maplibre_gl_shared_xt({offset:e},t),n)}panTo(e,t,n){return this.easeTo(maplibre_gl_shared_xt({center:e},t),n)}getZoom(){return this.transform.zoom}setZoom(e,t){return this.jumpTo({zoom:e},t),this}zoomTo(e,t,n){return this.easeTo(maplibre_gl_shared_xt({zoom:e},t),n)}zoomIn(e,t){return this.zoomTo(maplibre_gl_shared_kt(this.getZoom()+1,this._zoomSnap),e,t),this}zoomOut(e,t){return this.zoomTo(maplibre_gl_shared_kt(this.getZoom()-1,this._zoomSnap),e,t),this}getVerticalFieldOfView(){return this.transform.fov}setVerticalFieldOfView(e,t){return e!=this.transform.fov&&(this.transform.setFov(e),this.fire(new maplibre_gl_G(`movestart`,t)).fire(new maplibre_gl_G(`move`,t)).fire(new maplibre_gl_G(`moveend`,t))),this}getBearing(){return this.transform.bearing}setZoomSnap(e){return this._zoomSnap=e,this}getZoomSnap(){return this._zoomSnap}setBearing(e,t){return this.jumpTo({bearing:e},t),this}getPadding(){return this.transform.padding}setPadding(e,t){return this.jumpTo({padding:e},t),this}rotateTo(e,t,n){return this.easeTo(maplibre_gl_shared_xt({bearing:e},t),n)}resetNorth(e,t){return this.rotateTo(0,maplibre_gl_shared_xt({duration:1e3},e),t),this}resetNorthPitch(e,t){return this.easeTo(maplibre_gl_shared_xt({bearing:0,pitch:0,roll:0,duration:1e3},e),t),this}snapToNorth(e,t){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(e,t):this}getPitch(){return this.transform.pitch}setPitch(e,t){return this.jumpTo({pitch:e},t),this}getRoll(){return this.transform.roll}setRoll(e,t){return this.jumpTo({roll:e},t),this}cameraForBounds(e,t){e=maplibre_gl_ya.convert(e).adjustAntiMeridian();let n=t?.bearing||0;return this._cameraForBoxAndBearing(e.getNorthWest(),e.getSouthEast(),n,t)}_cameraForBoxAndBearing(e,t,n,r){let i={top:0,bottom:0,right:0,left:0};if(r=maplibre_gl_shared_xt({padding:i,offset:[0,0],maxZoom:this.transform.maxZoom},r),typeof r.padding==`number`){let e=r.padding;r.padding={top:e,bottom:e,right:e,left:e}}let a=maplibre_gl_shared_xt(i,r.padding);r.padding=a;let o=this.transform,s=new maplibre_gl_ya(e,t),c=this.cameraHelper.cameraForBoxAndBearing(r,a,s,n,o);return c&&this._zoomSnap&&(c.zoom=maplibre_gl_shared_kt(c.zoom,this._zoomSnap,-1)),c}fitBounds(e,t,n){return this._fitInternal(this.cameraForBounds(e,t),t,n)}fitScreenCoordinates(e,t,n,r,i){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.screenPointToLocation(maplibre_gl_shared_l.convert(e)),this.transform.screenPointToLocation(maplibre_gl_shared_l.convert(t)),n,r),r,i)}_fitInternal(e,t,n){return e?(t=maplibre_gl_shared_xt(e,t),delete t.padding,t.linear?this.easeTo(t,n):this.flyTo(t,n)):this}jumpTo(e,t){this.stop(),e.zoom!==void 0&&this._zoomSnap&&(e.zoom=maplibre_gl_shared_kt(e.zoom,this._zoomSnap));let n=this.getTransformForUpdate(),r=!1,i=!1,a=!1,o=n.zoom;this.terrain&&n.setElevation(this.terrain.getElevationForLngLat(e.center?maplibre_gl_shared_Mp.convert(e.center):n.center,n)),this.cameraHelper.handleJumpToCenterZoom(n,e);let s=n.zoom!==o;return e.elevation!==void 0&&n.elevation!==+e.elevation&&n.setElevation(+e.elevation),e.bearing!==void 0&&n.bearing!==+e.bearing&&(r=!0,n.setBearing(+e.bearing)),e.pitch!==void 0&&n.pitch!==+e.pitch&&(i=!0,n.setPitch(+e.pitch)),e.roll!==void 0&&n.roll!==+e.roll&&(a=!0,n.setRoll(+e.roll)),e.padding!=null&&!n.isPaddingEqual(e.padding)&&n.setPadding(e.padding),this.applyUpdatedTransform(n),this.fire(new maplibre_gl_G(`movestart`,t)).fire(new maplibre_gl_G(`move`,t)),s&&this.fire(new maplibre_gl_G(`zoomstart`,t)).fire(new maplibre_gl_G(`zoom`,t)).fire(new maplibre_gl_G(`zoomend`,t)),r&&this.fire(new maplibre_gl_G(`rotatestart`,t)).fire(new maplibre_gl_G(`rotate`,t)).fire(new maplibre_gl_G(`rotateend`,t)),i&&this.fire(new maplibre_gl_G(`pitchstart`,t)).fire(new maplibre_gl_G(`pitch`,t)).fire(new maplibre_gl_G(`pitchend`,t)),a&&this.fire(new maplibre_gl_G(`rollstart`,t)).fire(new maplibre_gl_G(`roll`,t)).fire(new maplibre_gl_G(`rollend`,t)),this.fire(new maplibre_gl_G(`moveend`,t))}calculateCameraOptionsFromCameraLngLatAltRotation(e,t,n,r,i){let a=this.transform.calculateCenterFromCameraLngLatAlt(e,t,n,r);return{center:a.center,elevation:a.elevation,zoom:a.zoom,bearing:n,pitch:r,roll:i}}easeTo(e,t){this._stop(!1,e.easeId),e=maplibre_gl_shared_xt({offset:[0,0],duration:500,easing:maplibre_gl_shared_vt},e),e.zoom!==void 0&&this._zoomSnap&&(e.zoom=maplibre_gl_shared_kt(e.zoom,this._zoomSnap)),(e.animate===!1||!e.essential&&maplibre_gl_Br.prefersReducedMotion)&&(e.duration=0);let n=this.getTransformForUpdate(),r=this.getBearing(),i=n.pitch,a=n.roll,o=e.bearing===void 0?r:this._normalizeBearing(e.bearing,r),s=e.pitch===void 0?i:+e.pitch,c=e.roll===void 0?a:this._normalizeBearing(e.roll,a),l=e.padding===void 0?n.padding:e.padding,u=maplibre_gl_shared_l.convert(e.offset),d,f;e.around&&(d=maplibre_gl_shared_Mp.convert(e.around),f=n.locationToScreenPoint(d));let p={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching,rolling:this._rolling},m=this.cameraHelper.handleEaseTo(n,{bearing:o,pitch:s,roll:c,padding:l,around:d,aroundPoint:f,offsetAsPoint:u,offset:e.offset,zoom:e.zoom,center:e.center});return this._rotating||=r!==o,this._pitching||=s!==i,this._rolling||=c!==a,this._padding=!n.isPaddingEqual(l),this._zooming||=m.isZooming,this._easeId=e.easeId,this._prepareEase(t,e.noMoveStart,p),this.terrain&&this._prepareElevation(m.elevationCenter),this._ease(r=>{m.easeFunc(r),this.terrain&&!e.freezeElevation&&this._updateElevation(r),this.applyUpdatedTransform(n),this._fireMoveEvents(t)},n=>{this.terrain&&e.freezeElevation&&this._finalizeElevation(),this._afterEase(t,n)},e),this}_prepareEase(e,t,n={}){this._moving=!0,!t&&!n.moving&&this.fire(new maplibre_gl_G(`movestart`,e)),this._zooming&&!n.zooming&&this.fire(new maplibre_gl_G(`zoomstart`,e)),this._rotating&&!n.rotating&&this.fire(new maplibre_gl_G(`rotatestart`,e)),this._pitching&&!n.pitching&&this.fire(new maplibre_gl_G(`pitchstart`,e)),this._rolling&&!n.rolling&&this.fire(new maplibre_gl_G(`rollstart`,e))}_prepareElevation(e){this._elevationCenter=e,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLat(e,this.transform),this.elevationFreeze=!0}_updateElevation(e){(this._elevationStart===void 0||this._elevationCenter===void 0)&&this._prepareElevation(this.transform.center),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom));let t=this.terrain.getElevationForLngLat(this._elevationCenter,this.transform);if(e<1&&t!==this._elevationTarget){let n=this._elevationTarget-this._elevationStart,r=(t-(n*e+this._elevationStart))/(1-e);this._elevationStart+=e*(n-r),this._elevationTarget=t}this.transform.setElevation(maplibre_gl_shared_$r.number(this._elevationStart,this._elevationTarget,e))}_finalizeElevation(){this.elevationFreeze=!1,this.getCenterClampedToGround()&&this.transform.recalculateZoomAndCenter(this.terrain)}getTransformForUpdate(){return!this.transformCameraUpdate&&!this.terrain?this.transform:(this._requestedCameraState||=this.transform.clone(),this._requestedCameraState)}_elevateCameraIfInsideTerrain(e){if(!this.terrain&&e.elevation>=0&&e.pitch<=90)return{};let t=e.getCameraLngLat(),n=e.getCameraAltitude(),r=this.terrain?this.terrain.getElevationForLngLatZoom(t,e.zoom):0;if(n<r){let n=e.calculateCameraOptionsFromTo(t,r,e.center,e.elevation);return{pitch:n.pitch,zoom:n.zoom}}return{}}applyUpdatedTransform(e){let t=[];if(t.push(e=>this._elevateCameraIfInsideTerrain(e)),this.transformCameraUpdate&&t.push(e=>this.transformCameraUpdate(e)),!t.length)return;let n=e.clone();for(let e of t){let t=n.clone(),{center:r,zoom:i,roll:a,pitch:o,bearing:s,elevation:c}=e(t);r&&t.setCenter(r),c!==void 0&&t.setElevation(c),i!==void 0&&t.setZoom(i),a!==void 0&&t.setRoll(a),o!==void 0&&t.setPitch(o),s!==void 0&&t.setBearing(s),n.apply(t,!1)}this.transform.apply(n,!1)}_fireMoveEvents(e){this.fire(new maplibre_gl_G(`move`,e)),this._zooming&&this.fire(new maplibre_gl_G(`zoom`,e)),this._rotating&&this.fire(new maplibre_gl_G(`rotate`,e)),this._pitching&&this.fire(new maplibre_gl_G(`pitch`,e)),this._rolling&&this.fire(new maplibre_gl_G(`roll`,e))}_afterEase(e,t){if(this._easeId&&t&&this._easeId===t)return;delete this._easeId;let n=this._zooming,r=this._rotating,i=this._pitching,a=this._rolling;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._rolling=!1,this._padding=!1,n&&this.fire(new maplibre_gl_G(`zoomend`,e)),r&&this.fire(new maplibre_gl_G(`rotateend`,e)),i&&this.fire(new maplibre_gl_G(`pitchend`,e)),a&&this.fire(new maplibre_gl_G(`rollend`,e)),this.fire(new maplibre_gl_G(`moveend`,e))}flyTo(e,t){if(!e.essential&&maplibre_gl_Br.prefersReducedMotion){let n=maplibre_gl_shared_St(e,[`center`,`zoom`,`bearing`,`pitch`,`roll`,`elevation`,`padding`]);return this.jumpTo(n,t)}this.stop(),e=maplibre_gl_shared_xt({offset:[0,0],speed:1.2,curve:1.42,easing:maplibre_gl_shared_vt},e),e.zoom!==void 0&&this._zoomSnap&&(e.zoom=maplibre_gl_shared_kt(e.zoom,this._zoomSnap));let n=this.getTransformForUpdate(),r=n.bearing,i=n.pitch,a=n.roll,o=n.padding,s=e.bearing===void 0?r:this._normalizeBearing(e.bearing,r),c=e.pitch===void 0?i:+e.pitch,l=e.roll===void 0?a:this._normalizeBearing(e.roll,a),u=e.padding===void 0?n.padding:e.padding,d=maplibre_gl_shared_l.convert(e.offset),f=n.centerPoint.add(d),p=n.screenPointToLocation(f),m=this.cameraHelper.handleFlyTo(n,{bearing:s,pitch:c,roll:l,padding:u,locationAtOffset:p,offsetAsPoint:d,center:e.center,minZoom:e.minZoom,zoom:e.zoom}),h=e.curve,g=Math.max(n.width,n.height),_=g/m.scaleOfZoom,v=m.pixelPathLength,y=g/m.scaleOfMinZoom;h=Math.min(h,Math.sqrt(y/v*2));let b=h*h;function x(e){let t=(_*_-g*g+(e?-1:1)*b*b*v*v)/(2*(e?_:g)*b*v);return Math.log(Math.sqrt(t*t+1)-t)}function S(e){return(Math.exp(e)-Math.exp(-e))/2}function C(e){return(Math.exp(e)+Math.exp(-e))/2}function w(e){return S(e)/C(e)}let T=x(!1),E=function(e){return C(T)/C(T+h*e)},ee=function(e){return g*((C(T)*w(T+h*e)-S(T))/b)/v},D=(x(!0)-T)/h;if(Math.abs(v)<2e-6||!isFinite(D)){if(Math.abs(g-_)<1e-6)return this.easeTo(e,t);let n=_<g?-1:1;D=Math.abs(Math.log(_/g))/h,ee=()=>0,E=e=>Math.exp(n*h*e)}if(e.duration!==void 0)e.duration=+e.duration;else{let t=e.screenSpeed===void 0?+e.speed:+e.screenSpeed/h;e.duration=1e3*D/t}return e.maxDuration&&e.duration>e.maxDuration&&(e.duration=0),this._zooming=!0,this._rotating=r!==s,this._pitching=c!==i,this._rolling=l!==a,this._padding=!n.isPaddingEqual(u),this._prepareEase(t,!1),this.terrain&&this._prepareElevation(m.targetCenter),this._ease(p=>{let h=p*D,g=1/E(h),_=ee(h);this._rotating&&n.setBearing(maplibre_gl_shared_$r.number(r,s,p)),this._pitching&&n.setPitch(maplibre_gl_shared_$r.number(i,c,p)),this._rolling&&n.setRoll(maplibre_gl_shared_$r.number(a,l,p)),this._padding&&(n.interpolatePadding(o,u,p),f=n.centerPoint.add(d)),m.easeFunc(p,g,_,f),this.terrain&&!e.freezeElevation&&this._updateElevation(p),this.applyUpdatedTransform(n),this._fireMoveEvents(t)},()=>{this.terrain&&e.freezeElevation&&this._finalizeElevation(),this._afterEase(t)},e),this}isEasing(){return!!this._easeFrameId}stop(e){return this._stop(e)}_stop(e,t){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){let e=this._onEaseEnd;delete this._onEaseEnd,e.call(this,t)}return e||this._stopHandlers(),this}_ease(e,t,n){n.animate===!1||n.duration===0?(e(1),t()):(this._easeStart=maplibre_gl_U(),this._easeOptions=n,this._onEaseFrame=e,this._onEaseEnd=t,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(e,t){e=maplibre_gl_shared_bt(e,-180,180);let n=Math.abs(e-t);return Math.abs(e-360-t)<n&&(e-=360),Math.abs(e+360-t)<n&&(e+=360),e}isMoving(){return this._moving}isZooming(){return this._zooming}isRotating(){return this._rotating}};const maplibre_gl_hm={compact:!0,customAttribution:`<a href="https://maplibre.org/" target="_blank">MapLibre</a>`};var maplibre_gl_gm=class{constructor(e=maplibre_gl_hm){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=e=>{e&&(e.type===`terrain`||e.dataType===`style`||e.dataType===`source`&&(e.sourceDataType===`metadata`||e.sourceDataType===`visibility`))&&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=e}getDefaultPosition(){return`bottom-right`}onAdd(e){return this._map=e,this._compact=this.options.compact,this._container=maplibre_gl_W.create(`details`,`maplibregl-ctrl maplibregl-ctrl-attrib`),this._compactButton=maplibre_gl_W.create(`summary`,`maplibregl-ctrl-attrib-button`,this._container),this._compactButton.addEventListener(`click`,this._toggleAttribution),this._setElementTitle(this._compactButton,`ToggleAttribution`),this._innerContainer=maplibre_gl_W.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(){this._container.remove(),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(e,t){let n=this._map._getUIString(`AttributionControl.${t}`);e.title=n,e.setAttribute(`aria-label`,n)}_updateAttributions(){if(!this._map.style)return;let e=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?e=e.concat(this.options.customAttribution.map(e=>typeof e==`string`?e:``)):typeof this.options.customAttribution==`string`&&e.push(this.options.customAttribution)),this._map.style.stylesheet){let e=this._map.style.stylesheet;this.styleOwner=e.owner,this.styleId=e.id}let t=this._map.style.tileManagers;for(let n in t){let r=t[n];if(r.used||r.usedForTerrain){let t=r.getSource();t.attribution&&!e.includes(t.attribution)&&e.push(t.attribution)}}e=e.filter(e=>String(e).trim()),e.sort((e,t)=>e.length-t.length),e=e.filter((t,n)=>{for(let r=n+1;r<e.length;r++)if(e[r].includes(t))return!1;return!0});let n=e.join(` | `);n!==this._attribHTML&&(this._attribHTML=n,e.length?(this._innerContainer.innerHTML=maplibre_gl_W.sanitize(n),this._container.classList.remove(`maplibregl-attrib-empty`)):this._container.classList.add(`maplibregl-attrib-empty`),this._updateCompact(),this._editLink=null)}},maplibre_gl_m=class{constructor(e={}){this._updateCompact=()=>{let e=this._container.children;if(e.length){let t=e[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&t.classList.add(`maplibregl-compact`):t.classList.remove(`maplibregl-compact`)}},this.options=e}getDefaultPosition(){return`bottom-left`}onAdd(e){this._map=e,this._compact=this.options?.compact,this._container=maplibre_gl_W.create(`div`,`maplibregl-ctrl`);let t=maplibre_gl_W.create(`a`,`maplibregl-ctrl-logo`);return t.target=`_blank`,t.rel=`noopener nofollow`,t.href=`https://maplibre.org/`,t.setAttribute(`aria-label`,this._map._getUIString(`LogoControl.Title`)),t.setAttribute(`rel`,`noopener nofollow`),this._container.appendChild(t),this._container.style.display=`block`,this._map.on(`resize`,this._updateCompact),this._updateCompact(),this._container}onRemove(){this._container.remove(),this._map.off(`resize`,this._updateCompact),this._map=void 0,this._compact=void 0}},maplibre_gl_vm=class{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(e){let t=++this._id;return this._queue.push({callback:e,id:t,cancelled:!1}),t}remove(e){let t=this._currentlyRunning,n=t?this._queue.concat(t):this._queue;for(let t of n)if(t.id===e){t.cancelled=!0;return}}run(e=0){if(this._currentlyRunning)throw Error(`Attempting to run(), but is already running.`);let t=this._currentlyRunning=this._queue;this._queue=[];let n=!1,r;for(let i of t)if(!i.cancelled){try{i.callback(e)}catch(e){n||(n=!0,r=e)}if(this._cleared)break}if(this._cleared=!1,this._currentlyRunning=!1,n)throw r}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}};const maplibre_gl_ym=[`none`,`zoom`,`sourceTiles`,`visibleLayers`,`revision`];var maplibre_gl_bm=class{constructor(e,t,n,r){this._tileKeys=e.map(e=>e.key).sort().join(),this._revision=t,this._zoom=n,this._visibleLayerIds=r}difference(e){return this._revision===e?._revision?this._visibleLayerIds===e._visibleLayerIds?this._tileKeys===e._tileKeys?this._zoom===e._zoom?`none`:`zoom`:`sourceTiles`:`visibleLayers`:`revision`}};const maplibre_gl_xm={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0,"color-relief":!0};var maplibre_gl_Sm=class{constructor(e,t){this.needsFollowUpFrame=!1,this.painter=e,this.terrain=t,this.rttSize=t.tileManager.tileSize*t.qualityFactor}getTexture(e){return e.getRTT(this._stacks.length-1).texture}prepareForRender(e,t){let n=t!==this._lastPrepareZoom;this._lastPrepareZoom=t,this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.tileManager.getRenderableTiles(),this._renderableLayerIds=e._order.filter(n=>!e._layers[n].isHidden(t));let r=this._renderableLayerIds.join(),i=new Set;for(let t of this._renderableLayerIds){let n=e._layers[t],r=n.source;r&&maplibre_gl_xm[n.type]&&i.add(r)}this._coordsAscending={},this._rttFingerprints={};for(let n of i){let i=e.tileManagers[n];if(!i)continue;this._coordsAscending[n]={};let a=this._coordsAscending[n],o=i.getSource(),s=o instanceof maplibre_gl_Xa?o.terrainTileRanges:null;for(let e of i.getVisibleCoordinates()){let t=this.terrain.tileManager.getTerrainCoords(e,s);for(let e in t)a[e]||=[],a[e].push(t[e])}this._rttFingerprints[n]={};let c=this._rttFingerprints[n],l=i.getState().revision;for(let e in a)c[e]=new maplibre_gl_bm(a[e],l,t,r)}this.needsFollowUpFrame=!1;let a=n||this.painter.options.moving,o=!1;for(let e of this._renderableTiles){let t=this._textureDifference(e);t!==`none`&&(t===`zoom`&&a||t===`visibleLayers`&&n?this.needsFollowUpFrame=!0:t===`zoom`||t===`sourceTiles`?(o?this.needsFollowUpFrame=!0:e.releaseRTT(this.painter),o=!0):e.releaseRTT(this.painter))}}_textureDifference(e){let t=`none`;for(let n in this._rttFingerprints){let r=this._rttFingerprints[n][e.tileID.key];if(!r)continue;let i=r.difference(e.rttFingerprint[n]);maplibre_gl_ym.indexOf(i)>maplibre_gl_ym.indexOf(t)&&(t=i)}return t}renderLayer(e,t){if(e.isHidden(this.painter.transform.zoom))return!1;let n={...t,isRenderingToTexture:!0},r=e.type,i=this.painter,a=this._renderableLayerIds[this._renderableLayerIds.length-1]===e.id;if(maplibre_gl_xm[r]&&((!this._prevType||!maplibre_gl_xm[this._prevType])&&this._stacks.push([]),this._prevType=r,this._stacks[this._stacks.length-1].push(e.id),!a))return!0;if(maplibre_gl_xm[this._prevType]||maplibre_gl_xm[r]&&a){this._prevType=r;let e=this._stacks.length-1,t=this._stacks[e]||[];for(let r of this._renderableTiles){if(this._rttTiles.push(r),r.getRTT(e))continue;let a=r.acquireRTT(i,e,this.rttSize);i.bindRTT(a),i.context.clear({color:maplibre_gl_shared_V.transparent,stencil:0}),i.currentStencilSource=void 0;for(let e of t){let t=i.style._layers[e],a=t.source?this._coordsAscending[t.source][r.tileID.key]:[r.tileID];i.context.viewport.set([0,0,this.rttSize,this.rttSize]),i.renderTileClippingMasks(t,a,!0),i.renderLayer(i,i.style.tileManagers[t.source],t,a,n),t.source&&(r.rttFingerprint[t.source]=this._rttFingerprints[t.source][r.tileID.key])}a.texture.generateMipmap()}return maplibre_gl_np(this.painter,this.terrain,this._rttTiles,n),this._rttTiles=[],maplibre_gl_xm[r]}return!1}};const maplibre_gl_Cm={"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":`Drag to rotate map, click to reset 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`,"GlobeControl.Enable":`Enable globe`,"GlobeControl.Disable":`Disable globe`,"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`},maplibre_gl_wm=maplibre_gl_Mr,maplibre_gl_Tm={hash:!1,interactive:!0,bearingSnap:7,zoomSnap:0,attributionControl:maplibre_gl_hm,maplibreLogo:!1,refreshExpiredTiles:!0,canvasContextAttributes:{antialias:!1,preserveDrawingBuffer:!1,powerPreference:`high-performance`,failIfMajorPerformanceCaveat:!1,desynchronized:!1,contextType:void 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],elevation:0,zoom:0,bearing:0,pitch:0,roll:0,renderWorldCopies:!0,maxTileCacheSize:null,maxTileCacheZoomLevels:maplibre_gl_shared_gn.MAX_TILE_CACHE_ZOOM_LEVELS,transformRequest:null,transformCameraUpdate:null,transformConstrain:null,fadeDuration:300,crossSourceCollisions:!0,clickTolerance:3,localIdeographFontFamily:`sans-serif`,pitchWithRotate:!0,rollEnabled:!1,rotateSpeed:.8,pitchSpeed:-.5,reduceMotion:void 0,validateStyle:!0,maxCanvasSize:[4096,4096],cancelPendingTileRequestsWhileZooming:!0,centerClampedToGround:!0,terrainSkirtLength:`auto`,zoomLevelsToOverscale:4,anisotropicFilterPitch:20};var maplibre_gl_Em=class extends maplibre_gl_shared_Fn{get _ownerWindow(){return this._container?.ownerDocument?.defaultView||window}constructor(e){super(),this._idleTriggered=!1,this._crossFadingFactor=1,this._renderTaskQueue=new maplibre_gl_vm,this._controls=[],this._mapId=maplibre_gl_shared_wt(),this._styleUrl=null,this._missingStyleImageResolver=null,this._lostContextStyle={style:null,images:null},this._contextLost=e=>{if(e.preventDefault(),this._frameRequest&&=(this._frameRequest.abort(),null),this.painter.destroy(),this._lostContextStyle=this._getStyleAndImages(),!this.style){this.fire(new maplibre_gl_ni(`webglcontextlost`,{originalEvent:e}));return}for(let e of Object.values(this.style._layers))if(e.type===`custom`&&console.warn(`Custom layer with id '${e.id}' cannot be restored after WebGL context loss. You will need to re-add it manually after context restoration.`),e._listeners)for(let[t]of Object.entries(e._listeners))console.warn(`Custom layer with id '${e.id}' had event listeners for event '${t}' which cannot be restored after WebGL context loss. You will need to re-add them manually after context restoration.`);this.style.destroy(),this.style=null,this.fire(new maplibre_gl_ni(`webglcontextlost`,{originalEvent:e}))},this._contextRestored=e=>{if(this._lostContextStyle.style&&this.setStyle(this._lostContextStyle.style,{diff:!1}),this._lostContextStyle.images&&this.style){this.style.imageManager.images=this._lostContextStyle.images;for(let e in this._lostContextStyle.images){let t=this._lostContextStyle.images[e];t.isWebGLImage&&this.style.imageManager.updateImage(e,t,!1)}}this._lostContextStyle={style:null,images:null};try{this._setupPainter()}catch(e){this.fire(new maplibre_gl_shared_Pn(e));return}this.resize(),this._update(),this._resizeInternal(),this.fire(new maplibre_gl_ni(`webglcontextrestored`,{originalEvent:e}))},this._onMapScroll=e=>{if(e.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()};let t={...maplibre_gl_Tm,...e,canvasContextAttributes:{...maplibre_gl_Tm.canvasContextAttributes,...e.canvasContextAttributes}};if(t.minZoom!=null&&t.maxZoom!=null&&t.minZoom>t.maxZoom)throw Error(`maxZoom must be greater than or equal to minZoom`);if(t.minPitch!=null&&t.maxPitch!=null&&t.minPitch>t.maxPitch)throw Error(`maxPitch must be greater than or equal to minPitch`);if(t.minPitch!=null&&t.minPitch<0)throw Error(`minPitch must be greater than or equal to 0`);if(t.maxPitch!=null&&t.maxPitch>180)throw Error(`maxPitch must be less than or equal to 180`);this._camera=new maplibre_gl_mm({minZoom:t.minZoom,maxZoom:t.maxZoom,minPitch:t.minPitch,maxPitch:t.maxPitch,bearingSnap:t.bearingSnap,zoomSnap:t.zoomSnap,renderWorldCopies:t.renderWorldCopies,centerClampedToGround:t.centerClampedToGround,terrain:this.terrain,transformConstrain:t.transformConstrain,requestRenderFrame:e=>this._requestRenderFrame(e),cancelRenderFrame:e=>this._cancelRenderFrame(e),transformCameraUpdate:t.transformCameraUpdate,stopHandlers:()=>this._handlers?.stop(!1)}),this._camera.setEventedParent(this),this._interactive=t.interactive,this._maxTileCacheSize=t.maxTileCacheSize,this._maxTileCacheZoomLevels=t.maxTileCacheZoomLevels,this._canvasContextAttributes={...t.canvasContextAttributes},this._trackResize=t.trackResize===!0,this._terrainSkirtLength=t.terrainSkirtLength,this._refreshExpiredTiles=t.refreshExpiredTiles===!0,this._fadeDuration=t.fadeDuration,this._crossSourceCollisions=t.crossSourceCollisions===!0,this._collectResourceTiming=t.collectResourceTiming===!0,this._locale={...maplibre_gl_Cm,...t.locale},this._clickTolerance=t.clickTolerance,this._overridePixelRatio=t.pixelRatio,this._maxCanvasSize=t.maxCanvasSize,this._zoomLevelsToOverscale=t.zoomLevelsToOverscale,this.cancelPendingTileRequestsWhileZooming=t.cancelPendingTileRequestsWhileZooming===!0,this.setAnisotropicFilterPitch(t.anisotropicFilterPitch),t.reduceMotion!==void 0&&(maplibre_gl_Br.prefersReducedMotion=t.reduceMotion),this._requestManager=new maplibre_gl_Kr(t.transformRequest),this._container=this._resolveContainer(t.container),t.maxBounds&&this.setMaxBounds(t.maxBounds),this._setupContainer();try{this._setupPainter()}catch(e){throw this._cleanupContainer(),e}this._imageQueueHandle=maplibre_gl_Gr.addThrottleControl(()=>this.isMoving()),this.on(`move`,()=>this._update(!1)),this.on(`moveend`,()=>this._update(!1)),this.on(`zoom`,()=>this._update(!0)),this.on(`terrain`,()=>{this.painter.terrainFacilitator.depthDirty=!0,this._update(!0)}),this.once(`idle`,()=>this._idleTriggered=!0),this._handlers=new maplibre_gl_pm(this,this._camera,t),typeof window<`u`&&(this._ownerWindow.addEventListener(`online`,this._onWindowOnline,!1),this._setupResizeObserver());let n=typeof t.hash==`string`&&t.hash||void 0;this._hash=t.hash?new maplibre_gl_fp(n).addTo(this):void 0,this._hash?._onHashChange()||(this.jumpTo({center:t.center,elevation:t.elevation,zoom:t.zoom,bearing:t.bearing,pitch:t.pitch,roll:t.roll}),t.bounds&&(this.resize(),this.fitBounds(t.bounds,maplibre_gl_shared_xt({},t.fitBoundsOptions,{duration:0}))));let r=typeof t.style==`string`||t.style?.projection?.type!==`globe`;this.resize(null,r),this._localIdeographFontFamily=t.localIdeographFontFamily,this._validateStyle=t.validateStyle,t.style&&this.setStyle(t.style,{localIdeographFontFamily:t.localIdeographFontFamily}),t.attributionControl&&this.addControl(new maplibre_gl_gm(typeof t.attributionControl==`boolean`?void 0:t.attributionControl)),t.maplibreLogo&&this.addControl(new maplibre_gl_m,t.logoPosition),this.on(`style.load`,()=>{if(r||this._resizeTransform(),this._camera.transform.unmodified){let e=maplibre_gl_shared_St(this.style.stylesheet,[`center`,`zoom`,`bearing`,`pitch`,`roll`]);this.jumpTo(e)}}),this.on(`data`,e=>{this._update(e.dataType===`style`),this.fire(e.dataType===`style`?new maplibre_gl_Yr(`styledata`,e):new maplibre_gl_K(`sourcedata`,e))}),this.on(`dataloading`,e=>{this.fire(e.dataType===`style`?new maplibre_gl_Yr(`styledataloading`,e):new maplibre_gl_K(`sourcedataloading`,e))}),this.on(`dataabort`,e=>{this.fire(new maplibre_gl_K(`sourcedataabort`,e))})}_getMapId(){return this._mapId}setGlobalStateProperty(e,t){return this.style.setGlobalStateProperty(e,t),this._update(!0)}getGlobalState(){return this.style.getGlobalState()}addControl(e,t){if(t===void 0&&(t=e.getDefaultPosition?e.getDefaultPosition():`top-right`),!e?.onAdd)return this.fire(new maplibre_gl_shared_Pn(Error(`Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.`)));let n=e.onAdd(this);this._controls.push(e);let r=this._controlPositions[t];return t.includes(`bottom`)?r.insertBefore(n,r.firstChild):r.appendChild(n),this}removeControl(e){if(!e?.onRemove)return this.fire(new maplibre_gl_shared_Pn(Error(`Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.`)));let t=this._controls.indexOf(e);return t>-1&&this._controls.splice(t,1),e.onRemove(this),this}hasControl(e){return this._controls.includes(e)}coveringTiles(e){return maplibre_gl_jo(this._camera.transform,e)}setTransformCameraUpdate(e){this._camera.transformCameraUpdate=e}getCenter(){return new maplibre_gl_shared_Mp(this._camera.transform.center.lng,this._camera.transform.center.lat)}setCenter(e,t){return this._camera.setCenter(e,t),this}getCenterElevation(){return this._camera.transform.elevation}setCenterElevation(e,t){return this._camera.setCenterElevation(e,t),this}setCenterClampedToGround(e){this._camera.setCenterClampedToGround(e)}panBy(e,t,n){return this._camera.panBy(e,t,n),this}panTo(e,t,n){return this._camera.panTo(e,t,n),this}getZoom(){return this._camera.transform.zoom}setZoom(e,t){return this._camera.setZoom(e,t),this}zoomTo(e,t,n){return this._camera.zoomTo(e,t,n),this}zoomIn(e,t){return this._camera.zoomIn(e,t),this}zoomOut(e,t){return this._camera.zoomOut(e,t),this}getVerticalFieldOfView(){return this._camera.transform.fov}setVerticalFieldOfView(e,t){return this._camera.setVerticalFieldOfView(e,t),this}getBearing(){return this._camera.transform.bearing}setBearing(e,t){return this._camera.setBearing(e,t),this}getZoomSnap(){return this._camera.getZoomSnap()}setZoomSnap(e){return this._camera.setZoomSnap(e),this}getPadding(){return this._camera.transform.padding}setPadding(e,t){return this._camera.setPadding(e,t),this}rotateTo(e,t,n){return this._camera.rotateTo(e,t,n),this}resetNorth(e,t){return this._camera.resetNorth(e,t),this}resetNorthPitch(e,t){return this._camera.resetNorthPitch(e,t),this}snapToNorth(e,t){return this._camera.snapToNorth(e,t),this}getPitch(){return this._camera.transform.pitch}setPitch(e,t){return this._camera.setPitch(e,t),this}getRoll(){return this._camera.transform.roll}setRoll(e,t){return this._camera.setRoll(e,t),this}cameraForBounds(e,t){return this._camera.cameraForBounds(e,t)}fitBounds(e,t,n){return this._camera.fitBounds(e,t,n),this}fitScreenCoordinates(e,t,n,r,i){return this._camera.fitScreenCoordinates(e,t,n,r,i),this}jumpTo(e,t){return this._camera.jumpTo(e,t),this}calculateCameraOptionsFromCameraLngLatAltRotation(e,t,n,r,i){return this._camera.calculateCameraOptionsFromCameraLngLatAltRotation(e,t,n,r,i)}easeTo(e,t){return this._camera.easeTo(e,t),this}flyTo(e,t){return this._camera.flyTo(e,t),this}stop(){return this._camera.stop(),this}queryTerrainElevation(e){return this.terrain?this.terrain.getElevationForLngLat(maplibre_gl_shared_Mp.convert(e),this._camera.transform):null}getCenterClampedToGround(){return this._camera.getCenterClampedToGround()}calculateCameraOptionsFromTo(e,t,n,r){return r==null&&this.terrain&&(r=this.terrain.getElevationForLngLat(n,this._camera.transform)),this._camera.transform.calculateCameraOptionsFromTo(e,t,n,r??0)}resize(e,t=!0){if(this._lostContextStyle.style!==null)return this;this._resizeInternal(t);let n=!this._camera._moving;return n&&(this.stop(),this.fire(new maplibre_gl_G(`movestart`,e)).fire(new maplibre_gl_G(`move`,e))),this.fire(new maplibre_gl_qr(`resize`,e)),n&&this.fire(new maplibre_gl_G(`moveend`,e)),this}_resizeInternal(e=!0){let[t,n]=this._containerDimensions(),r=this._getClampedPixelRatio(t,n);if(this._resizeCanvas(t,n,r),this.painter.resize(t,n,r),this.painter.overLimit()){let e=this.painter.context.gl;this._maxCanvasSize=[e.drawingBufferWidth,e.drawingBufferHeight];let r=this._getClampedPixelRatio(t,n);this._resizeCanvas(t,n,r),this.painter.resize(t,n,r)}this._resizeTransform(e)}_resizeTransform(e=!0){let[t,n]=this._containerDimensions();this._camera.transform.resize(t,n,e),this._camera._requestedCameraState?.resize(t,n,e)}_getClampedPixelRatio(e,t){let{0:n,1:r}=this._maxCanvasSize,i=this.getPixelRatio(),a=e*i,o=t*i,s=a>n?n/a:1,c=o>r?r/o:1,l=Math.min(s,c);return l<1&&maplibre_gl_shared_Ft(`The canvas is larger than maxCanvasSize and is rendered at a lower pixel ratio to fit. Increase maxCanvasSize, within MAX_TEXTURE_SIZE, to render at full resolution.`),l*i}getPixelRatio(){return this._overridePixelRatio??devicePixelRatio}setPixelRatio(e){this._overridePixelRatio=e,this.resize()}getBounds(){return this._camera.transform.getBounds()}getMaxBounds(){return this._camera.transform.getMaxBounds()}setMaxBounds(e){return this._camera.transform.setMaxBounds(maplibre_gl_ya.convert(e)),this._update()}setMinZoom(e){if(e??=-2,e>=-2&&e<=this._camera.transform.maxZoom){let t=this._camera.transform.zoom,n=this._camera.getTransformForUpdate();return n.setMinZoom(e),this._camera.applyUpdatedTransform(n),this._update(),t!==this._camera.transform.zoom&&this.fire(new maplibre_gl_G(`zoomstart`)).fire(new maplibre_gl_G(`zoom`)).fire(new maplibre_gl_G(`zoomend`)).fire(new maplibre_gl_G(`movestart`)).fire(new maplibre_gl_G(`move`)).fire(new maplibre_gl_G(`moveend`)),this}throw Error(`minZoom must be between -2 and the current maxZoom, inclusive`)}getMinZoom(e=!1){let t=this._camera.transform;return e?t.applyConstrain(t.center,t.minZoom).zoom:t.minZoom}setMaxZoom(e){if(e??=22,e>=this._camera.transform.minZoom){let t=this._camera.transform.zoom,n=this._camera.getTransformForUpdate();return n.setMaxZoom(e),this._camera.applyUpdatedTransform(n),this._update(),t!==this._camera.transform.zoom&&this.fire(new maplibre_gl_G(`zoomstart`)).fire(new maplibre_gl_G(`zoom`)).fire(new maplibre_gl_G(`zoomend`)).fire(new maplibre_gl_G(`movestart`)).fire(new maplibre_gl_G(`move`)).fire(new maplibre_gl_G(`moveend`)),this}throw Error(`maxZoom must be greater than the current minZoom`)}getMaxZoom(){return this._camera.transform.maxZoom}setMinPitch(e){if(e??=0,e<0)throw Error(`minPitch must be greater than or equal to 0`);if(e>=0&&e<=this._camera.transform.maxPitch){let t=this._camera.transform.pitch,n=this._camera.getTransformForUpdate();return n.setMinPitch(e),this._camera.applyUpdatedTransform(n),this._update(),t!==this._camera.transform.pitch&&this.fire(new maplibre_gl_G(`pitchstart`)).fire(new maplibre_gl_G(`pitch`)).fire(new maplibre_gl_G(`pitchend`)).fire(new maplibre_gl_G(`movestart`)).fire(new maplibre_gl_G(`move`)).fire(new maplibre_gl_G(`moveend`)),this}throw Error(`minPitch must be between 0 and the current maxPitch, inclusive`)}getMinPitch(){return this._camera.transform.minPitch}setMaxPitch(e){if(e??=60,e>180)throw Error(`maxPitch must be less than or equal to 180`);if(e>=this._camera.transform.minPitch){let t=this._camera.transform.pitch,n=this._camera.getTransformForUpdate();return n.setMaxPitch(e),this._camera.applyUpdatedTransform(n),this._update(),t!==this._camera.transform.pitch&&this.fire(new maplibre_gl_G(`pitchstart`)).fire(new maplibre_gl_G(`pitch`)).fire(new maplibre_gl_G(`pitchend`)).fire(new maplibre_gl_G(`movestart`)).fire(new maplibre_gl_G(`move`)).fire(new maplibre_gl_G(`moveend`)),this}throw Error(`maxPitch must be greater than the current minPitch`)}getMaxPitch(){return this._camera.transform.maxPitch}getAnisotropicFilterPitch(){return this._anisotropicFilterPitch}setAnisotropicFilterPitch(e){if(e??=20,e>180)throw Error(`anisotropicFilterPitch must be less than or equal to 180`);if(e<0)throw Error(`anisotropicFilterPitch must be greater than or equal to 0`);return this._anisotropicFilterPitch=e,this._update()}getRenderWorldCopies(){return this._camera.transform.renderWorldCopies}setRenderWorldCopies(e){return this._camera.transform.setRenderWorldCopies(e),this._update()}setTransformConstrain(e){return this._camera.transform.setConstrainOverride(e),this._update()}project(e){return this._camera.transform.locationToScreenPoint(maplibre_gl_shared_Mp.convert(e),this.style&&this.terrain)}unproject(e){return this._camera.transform.screenPointToLocation(maplibre_gl_shared_l.convert(e),this.terrain)}isMoving(){return this._camera.isMoving()||this._handlers?.isMoving()||!1}isZooming(){return this._camera.isZooming()||this._handlers?.isZooming()||!1}isRotating(){return this._camera.isRotating()||this._handlers?.isRotating()||!1}_createDelegatedListener(e,t,n){if(e===`mouseenter`||e===`mouseover`){let r=!1;return{layers:t,listener:n,delegates:{mousemove:i=>{let a=t.filter(e=>this.getLayer(e)),o=a.length===0?[]:this.queryRenderedFeatures(i.point,{layers:a});o.length?r||(r=!0,n.call(this,new maplibre_gl_Xr(e,this,i.originalEvent,{features:o}))):r=!1},mouseout:()=>{r=!1}}}}if(e===`mouseleave`||e===`mouseout`){let r=!1;return{layers:t,listener:n,delegates:{mousemove:i=>{let a=t.filter(e=>this.getLayer(e));(a.length===0?[]:this.queryRenderedFeatures(i.point,{layers:a})).length?r=!0:r&&(r=!1,n.call(this,new maplibre_gl_Xr(e,this,i.originalEvent)))},mouseout:t=>{r&&(r=!1,n.call(this,new maplibre_gl_Xr(e,this,t.originalEvent)))}}}}{let r=e=>{let r=t.filter(e=>this.getLayer(e)),i=r.length===0?[]:this.queryRenderedFeatures(e.point,{layers:r});i.length&&(e.features=i,n.call(this,e),delete e.features)};return{layers:t,listener:n,delegates:{[e]:r}}}}_saveDelegatedListener(e,t){this._delegatedListeners||={},this._delegatedListeners[e]||=[],this._delegatedListeners[e].push(t)}_removeDelegatedListener(e,t,n){if(!this._delegatedListeners?.[e])return;let r=this._delegatedListeners[e];for(let e=0;e<r.length;e++){let i=r[e];if(i.listener===n&&i.layers.length===t.length&&i.layers.every(e=>t.includes(e))){for(let e in i.delegates)this.off(e,i.delegates[e]);r.splice(e,1);return}}}on(e,t,n){if(n===void 0)return super.on(e,t);let r=typeof t==`string`?[t]:t,i=this._createDelegatedListener(e,r,n);this._saveDelegatedListener(e,i);for(let e in i.delegates)this.on(e,i.delegates[e]);return{unsubscribe:()=>{this._removeDelegatedListener(e,r,n)}}}once(e,t,n){if(n===void 0)return super.once(e,t);let r=typeof t==`string`?[t]:t,i=this._createDelegatedListener(e,r,n);for(let t in i.delegates){let a=i.delegates[t];i.delegates[t]=(...t)=>{this._removeDelegatedListener(e,r,n),a(...t)}}this._saveDelegatedListener(e,i);for(let e in i.delegates)this.once(e,i.delegates[e]);return this}off(e,t,n){if(n===void 0)return super.off(e,t);let r=typeof t==`string`?[t]:t;return this._removeDelegatedListener(e,r,n),this}queryRenderedFeatures(e,t){if(!this.style)return[];let n,r=e instanceof maplibre_gl_shared_l||Array.isArray(e),i=r?e:[[0,0],[this._camera.transform.width,this._camera.transform.height]];if(t||=(r?{}:e)||{},i instanceof maplibre_gl_shared_l||typeof i[0]==`number`)n=[maplibre_gl_shared_l.convert(i)];else{let e=maplibre_gl_shared_l.convert(i[0]),t=maplibre_gl_shared_l.convert(i[1]);n=[e,new maplibre_gl_shared_l(t.x,e.y),t,new maplibre_gl_shared_l(e.x,t.y),e]}return this.style.queryRenderedFeatures(n,t,this._camera.transform)}querySourceFeatures(e,t){return this.style.querySourceFeatures(e,t)}setStyle(e,t){return t=maplibre_gl_shared_xt({},{localIdeographFontFamily:this._localIdeographFontFamily,validate:this._validateStyle},t),this._styleUrl=typeof e==`string`?e:null,t.diff!==!1&&t.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&e?(this._diffStyle(e,t),this):(this._localIdeographFontFamily=t.localIdeographFontFamily,this._updateStyle(e,t))}setTransformRequest(e){return this._requestManager.setTransformRequest(e),this}_getUIString(e){let t=this._locale[e];if(t==null)throw Error(`Missing UI string '${e}'`);return t}_updateStyle(e,t){if(this._diffStyleRequest?.abort(),this._diffStyleRequest=null,t.transformStyle&&this.style&&!this.style._loaded){this.style.once(`style.load`,()=>this._updateStyle(e,t));return}let n=this.style&&t.transformStyle?this.style.serialize():void 0;if(this.style&&(this.style.setEventedParent(null),this.style._remove(!e)),e)this.style=new maplibre_gl_yl(this,t||{});else return this._frameRequest&&=(this._frameRequest.abort(),null),this.style?.projection?.destroy(),delete this.style,this;return this.style.setEventedParent(this,{style:this.style}),typeof e==`string`?this.style.loadURL(e,t,n):this.style.loadJSON(e,t,n),this}_lazyInitEmptyStyle(){this.style||(this.style=new maplibre_gl_yl(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}async _diffStyle(e,n){if(this._diffStyleRequest?.abort(),typeof e==`string`){let r=e;this._diffStyleRequest=new AbortController;let i=this._diffStyleRequest;try{let e=await this._requestManager.transformRequest(r,`Style`);if(i.signal.aborted){this._diffStyleRequest=null;return}let t=await maplibre_gl_shared_Dn(e,i);this._diffStyleRequest=null,this._updateDiff(t.data,n)}catch(e){this._diffStyleRequest=null,maplibre_gl_shared_mn(e)||this.fire(new maplibre_gl_shared_Pn(maplibre_gl_shared_Qe(e)))}}else typeof e==`object`&&(this._diffStyleRequest=null,this._updateDiff(e,n))}_updateDiff(e,n){try{this.style.setState(e,n)&&this._update(!0)}catch(r){maplibre_gl_shared_Ft(`Unable to perform style diff: ${maplibre_gl_shared_Qe(r).message}. Rebuilding the style from scratch.`),this._updateStyle(e,n)}}getStyle(){if(this.style)return this.style.serialize()}getStyleUrl(){return this._styleUrl}_getStyleAndImages(){return this.style?{style:this.style.serialize(),images:this.style.imageManager.cloneImages()}:{style:null,images:{}}}isStyleLoaded(){if(!this.style){maplibre_gl_shared_Ft(`There is no style added to the map.`);return}return this.style.loaded()}addSource(e,t){return this._lazyInitEmptyStyle(),this.style.addSource(e,t),this._update(!0)}isSourceLoaded(e){let t=this.style?.tileManagers[e];if(t===void 0){this.fire(new maplibre_gl_shared_Pn(Error(`There is no tile manager with ID '${e}'`)));return}return t.loaded()}setTerrain(e,t={}){if(this.style._checkLoaded(),e&&maplibre_gl_shared_mc(this,maplibre_gl_shared_lc.terrain,{value:e},t))return this;if(this._terrainDataCallback&&this.style.off(`data`,this._terrainDataCallback),!e)this.terrain&&this.terrain.destroy(),this.terrain=null,this.painter.renderToTexture=null,this._camera.terrain=null,this._camera.transform.setMinElevationForCurrentTile(0),this.getCenterClampedToGround()&&this._camera.transform.setElevation(0);else{let t=this.style.tileManagers[e.source];if(!t)throw Error(`cannot load terrain, because there exists no source with ID: ${e.source}`);this.terrain===null&&t.reload();for(let t in this.style._layers){let n=this.style._layers[t];n.type===`hillshade`&&n.source===e.source&&maplibre_gl_shared_Ft(`You are using the same source for a hillshade layer and for 3D terrain. Please consider using two separate sources to improve rendering quality.`),n.type===`color-relief`&&n.source===e.source&&maplibre_gl_shared_Ft(`You are using the same source for a color-relief layer and for 3D terrain. Please consider using two separate sources to improve rendering quality.`)}this.terrain&&this.terrain.destroy(),this.terrain=new maplibre_gl_c(this.painter,t,e,this._terrainSkirtLength),this.painter.renderToTexture=new maplibre_gl_Sm(this.painter,this.terrain),this._camera.terrain=this.terrain,this._camera.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this._camera.transform.center,this._camera.transform.tileZoom)),this._camera.transform.setElevation(this.terrain.getElevationForLngLat(this._camera.transform.center,this._camera.transform)),this._terrainDataCallback=t=>this._handleTerrainDataEvent(t,e.source),this.style.on(`data`,this._terrainDataCallback)}return this.style.triggerSymbolPlacement(),this.fire(new maplibre_gl_ei({terrain:e})),this}_handleTerrainDataEvent(e,t){if(e.dataType===`style`){this.terrain.tileManager.releaseAllRTT();return}let n=e.sourceId===t;if(n&&(this.terrain.resetElevationCache(),this.style.triggerSymbolPlacement()),n&&e.tile&&!this._camera.elevationFreeze&&(this._camera.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this._camera.transform.center,this._camera.transform.tileZoom)),this.getCenterClampedToGround()&&this._camera.transform.setElevation(this.terrain.getElevationForLngLat(this._camera.transform.center,this._camera.transform))),e.tile){if(e.source?.type===`image`){this.terrain.tileManager.releaseAllRTT();return}this.terrain.tileManager.releaseRTT(e.tile.tileID)}}getTerrain(){return this.terrain?.options??null}areTilesLoaded(){let e=this.style?.tileManagers;for(let t of Object.values(e))if(!t.areTilesLoaded())return!1;return!0}removeSource(e){return this.style.removeSource(e),this._update(!0)}getSource(e){return this.style?.getSource(e)}setSourceTileLodParams(e,t,n){if(n){let r=this.getSource(n);if(!r)throw Error(`There is no source with ID "${n}", cannot set LOD parameters`);r.calculateTileZoom=maplibre_gl_Eo(Math.max(1,e),Math.max(1,t))}else for(let n in this.style.tileManagers)this.style.tileManagers[n].getSource().calculateTileZoom=maplibre_gl_Eo(Math.max(1,e),Math.max(1,t));return this._update(!0),this}refreshTiles(e,t){let n=this.style.tileManagers[e];if(!n)throw Error(`There is no tile manager with ID "${e}", cannot refresh tile`);t===void 0?n.reload(!0):n.refreshTiles(t.map(e=>new maplibre_gl_shared_ub(e.z,e.x,e.y)))}addImage(e,t,n={}){this._lazyInitEmptyStyle();let r=this._createStyleImage(t,n);return r?(this.style.addImage(e,r),r.userImage?.onAdd&&r.userImage.onAdd(this,e),this):this}setMissingStyleImageResolver(e){return this._missingStyleImageResolver=e,this.style?.setMissingImageResolver(e),this}_createStyleImage(e,t={}){let{pixelRatio:n=1,sdf:r=!1,stretchX:i,stretchY:a,content:o,textFitWidth:s,textFitHeight:c}=t;if(e instanceof HTMLImageElement||maplibre_gl_shared_Ut(e)){let{width:t,height:l,data:u}=maplibre_gl_Br.getImageData(e);return{data:new Ad({width:t,height:l},u),pixelRatio:n,stretchX:i,stretchY:a,content:o,textFitWidth:s,textFitHeight:c,sdf:r,version:0}}if(e.width===void 0||e.height===void 0)return this.fire(new maplibre_gl_shared_Pn(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`"))),null;{let{width:t,height:l,data:u}=e,d=e,f=tv(d.data);return{data:f?new Ad({width:t,height:l}):new Ad({width:t,height:l},new Uint8Array(u)),pixelRatio:n,stretchX:i,stretchY:a,content:o,textFitWidth:s,textFitHeight:c,sdf:r,version:0,isWebGLImage:f,userImage:d}}}updateImage(e,t){let n=this.style.getImage(e);if(!n)return this.fire(new maplibre_gl_shared_Pn(Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));let{width:r,height:i,data:a}=t instanceof HTMLImageElement||maplibre_gl_shared_Ut(t)?maplibre_gl_Br.getImageData(t):t;if(r===void 0||i===void 0)return this.fire(new maplibre_gl_shared_Pn(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(r!==n.data.width||i!==n.data.height)return this.fire(new maplibre_gl_shared_Pn(Error(`The width and height of the updated image must be that same as the previous version of the image`)));if(n.isWebGLImage=tv(a),n.isWebGLImage)n.userImage=t;else{let e=!(t instanceof HTMLImageElement||maplibre_gl_shared_Ut(t));n.data.replace(a,e)}return this.style.updateImage(e,n),this}getImage(e){return this.style.getImage(e)}hasImage(e){return e?!!this.style.getImage(e):(this.fire(new maplibre_gl_shared_Pn(Error(`Missing required image id`))),!1)}removeImage(e){this.style.removeImage(e)}async loadImage(e){let t=await maplibre_gl_Gr.getImage(await this._requestManager.transformRequest(e,`Image`),new AbortController);if(!t.data)throw Error(`Could not load image ${e}: the response is empty`);return t}listImages(){return this.style?.listImages()??[]}addLayer(e,t){return this._lazyInitEmptyStyle(),this.style.addLayer(e,t),this._update(!0)}moveLayer(e,t){return this.style.moveLayer(e,t),this._update(!0)}removeLayer(e){return this.style.removeLayer(e),this._update(!0)}getLayer(e){return this.style?.getLayer(e)}getLayersOrder(){return this.style?.getLayersOrder()??[]}setLayerZoomRange(e,t,n){return this.style.setLayerZoomRange(e,t,n),this._update(!0)}setFilter(e,t,n={}){return this.style?.setFilter(e,t,n),this._update(!0)}getFilter(e){return this.style.getFilter(e)}setPaintProperty(e,t,n,r={}){return this.style?.setPaintProperty(e,t,n,r),this._update(!0)}getPaintProperty(e,t){return this.style.getPaintProperty(e,t)}setLayoutProperty(e,t,n,r={}){return this.style.setLayoutProperty(e,t,n,r),this._update(!0)}getLayoutProperty(e,t){return this.style.getLayoutProperty(e,t)}setGlyphs(e,t={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(e,t),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}setFontFaces(e){return this._lazyInitEmptyStyle(),this.style.setFontFaces(e),this._update(!0)}getFontFaces(){return this.style.getFontFaces()}addSprite(e,t,n={}){return this._lazyInitEmptyStyle(),this.style.addSprite(e,t,n,e=>{e||this._update(!0)}),this}removeSprite(e){return this._lazyInitEmptyStyle(),this.style.removeSprite(e),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(e,t={}){return this._lazyInitEmptyStyle(),this.style.setSprite(e,t,e=>{e||this._update(!0)}),this}setLight(e,t={}){return this._lazyInitEmptyStyle(),this.style.setLight(e,t),this._update(!0)}getLight(){return this.style.getLight()}setSky(e,t={}){return this._lazyInitEmptyStyle(),this.style.setSky(e,t),this._update(!0)}getSky(){return this.style.getSky()}setFeatureState(e,t){return this.style.setFeatureState(e,t),this._update()}removeFeatureState(e,t){return this.style.removeFeatureState(e,t),this._update()}getFeatureState(e){return this.style.getFeatureState(e)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let e=0,t=0;return this._container&&(e=this._container.clientWidth||400,t=this._container.clientHeight||300),[e,t]}_shouldHandleInitialResize(){if(!this._container?.clientWidth||!this._container.clientHeight)return!1;let[e,t]=this._containerDimensions();return e!==this._camera.transform.width||t!==this._camera.transform.height}_setupResizeObserver(){let e=!1,t=maplibre_gl_dp(e=>{this._trackResize&&!this._removed&&(this.resize(e),this.redraw())},50),n=this._ownerWindow.ResizeObserver??ResizeObserver;this._resizeObserver=new n(n=>{!e&&(e=!0,!this._shouldHandleInitialResize())||t(n)}),this._resizeObserver.observe(this._container)}_resolveContainer(e){if(typeof e==`string`){let t=document.getElementById(e);if(!t)throw Error(`Container '${e}' not found.`);return t}if(e instanceof HTMLElement||e&&typeof e==`object`&&e.nodeType===1)return e;throw Error(`Invalid type: 'container' must be a String or HTMLElement.`)}_setupContainer(){let e=this._container;e.classList.add(`maplibregl-map`);let t=this._canvasContainer=maplibre_gl_W.create(`div`,`maplibregl-canvas-container`,e);this._interactive&&t.classList.add(`maplibregl-interactive`),this._canvas=maplibre_gl_W.create(`canvas`,`maplibregl-canvas`,t),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`);let n=this._containerDimensions(),r=this._getClampedPixelRatio(n[0],n[1]);this._resizeCanvas(n[0],n[1],r);let i=this._controlContainer=maplibre_gl_W.create(`div`,`maplibregl-control-container`,e),a=this._controlPositions={};for(let e of[`top-left`,`top-right`,`bottom-left`,`bottom-right`])a[e]=maplibre_gl_W.create(`div`,`maplibregl-ctrl-${e} `,i);this._container.addEventListener(`scroll`,this._onMapScroll,!1)}_cleanupContainer(){this._canvas.removeEventListener(`webglcontextrestored`,this._contextRestored,!1),this._canvas.removeEventListener(`webglcontextlost`,this._contextLost,!1),this._canvasContainer.remove(),this._controlContainer.remove(),this._container.removeEventListener(`scroll`,this._onMapScroll,!1),this._container.classList.remove(`maplibregl-map`)}_resizeCanvas(e,t,n){this._canvas.width=Math.floor(n*e),this._canvas.height=Math.floor(n*t),this._canvas.style.width=`${e}px`,this._canvas.style.height=`${t}px`}_setupPainter(){let e={...this._canvasContextAttributes,alpha:!0,depth:!0,stencil:!0,premultipliedAlpha:!0},t=null;this._canvas.addEventListener(`webglcontextcreationerror`,e=>{t=e},{once:!0});let n=this._canvas.getContext(`webgl2`,e);if(!n)throw new maplibre_gl_up(e,t);this.painter=new maplibre_gl_lp(n,this._camera.transform)}migrateProjection(e,t){this._camera.migrateProjection(e,t),this.painter.transform=e,this.fire(new maplibre_gl_ti({newProjection:this.style.projection.name}))}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(e){return this.style?._loaded?(this._styleDirty||=e,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(e){return this._update(),this._renderTaskQueue.add(e)}_cancelRenderFrame(e){this._renderTaskQueue.remove(e)}_render(e){let t=this._idleTriggered?this._fadeDuration:0,n=this.style.projection?.transitionState>0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(e),this._removed)return;let r=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;let e=this._camera.transform.zoom,n=maplibre_gl_U();this.style.zoomHistory.update(e,n);let i=new maplibre_gl_shared_G(e,{now:n,fadeDuration:t,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),a=i.crossFadingFactor();(a!==1||a!==this._crossFadingFactor)&&(r=!0,this._crossFadingFactor=a),this.style.update(i)}let i=this.style.projection?.transitionState>0!==n;this._camera.transform.setTransitionState(this.style.projection?.transitionState),this.style&&(this._sourcesDirty||i)&&(this._sourcesDirty=!1,this.style._updateSources(this._camera.transform)),this.terrain?(this.terrain.tileManager.update(this._camera.transform,this.terrain)&&this.terrain.resetElevationCache(),this._camera.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this._camera.transform.center,this._camera.transform.tileZoom)),!this._camera.elevationFreeze&&this.getCenterClampedToGround()&&this._camera.transform.setElevation(this.terrain.getElevationForLngLat(this._camera.transform.center,this._camera.transform))):(this._camera.transform.setMinElevationForCurrentTile(0),this.getCenterClampedToGround()&&this._camera.transform.setElevation(0)),this._placementDirty=this.style?._updatePlacement(this._camera.transform,this.showCollisionBoxes,t,this._crossSourceCollisions,i),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:t,showPadding:this.showPadding,anisotropicFilterPitch:this.getAnisotropicFilterPitch()}),this.fire(new maplibre_gl_qr(`render`)),this.loaded()&&!this._loaded&&(this._loaded=!0,this.fire(new maplibre_gl_qr(`load`))),this.style&&(this.style.hasTransitions()||r)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();let a=this._sourcesDirty||this._styleDirty||this._placementDirty||this.painter.renderToTexture?.needsFollowUpFrame;return a||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new maplibre_gl_qr(`idle`)),this._loaded&&!this._fullyLoaded&&!a&&(this._fullyLoaded=!0),this}redraw(){return this.style&&(this._frameRequest&&=(this._frameRequest.abort(),null),this._render(0)),this}remove(){this._hash&&this._hash.remove();for(let e of this._controls)e.onRemove(this);this._controls=[],this._frameRequest&&=(this._frameRequest.abort(),null),this._renderTaskQueue.clear(),this._diffStyleRequest?.abort(),this.painter.destroy(),this._handlers.destroy(),this.setStyle(null),typeof window<`u`&&this._ownerWindow.removeEventListener(`online`,this._onWindowOnline,!1),maplibre_gl_Gr.removeThrottleControl(this._imageQueueHandle),this._resizeObserver?.disconnect();let e=this.painter.context.gl.getExtension(`WEBGL_lose_context`);e?.loseContext&&e.loseContext(),this._cleanupContainer(),this._removed=!0,this.fire(new maplibre_gl_qr(`remove`))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,maplibre_gl_Br.frame(this._frameRequest,e=>{this._frameRequest=null;try{this._render(e)}catch(e){if(!maplibre_gl_shared_mn(e))throw e}},()=>{},this._ownerWindow))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(e){this._showTileBoundaries!==e&&(this._showTileBoundaries=e,this._update())}get showPadding(){return!!this._showPadding}set showPadding(e){this._showPadding!==e&&(this._showPadding=e,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(e){this._showCollisionBoxes!==e&&(this._showCollisionBoxes=e,e?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(e){this._showOverdrawInspector!==e&&(this._showOverdrawInspector=e,this._update())}get repaint(){return!!this._repaint}set repaint(e){this._repaint!==e&&(this._repaint=e,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(e){this._vertices=e,this._update()}get version(){return maplibre_gl_wm}getCameraTargetElevation(){return this._camera.transform.elevation}getProjection(){return this.style.getProjection()}setProjection(e){return this._lazyInitEmptyStyle(),this.style.setProjection(e),this._update(!0)}};const maplibre_gl_Dm={showCompass:!0,showZoom:!0,visualizePitch:!1,visualizeRoll:!0};var maplibre_gl_Om=class{constructor(e){this._updateZoomButtons=()=>{let e=this._map.getZoom(),t=e===this._map.getMaxZoom(),n=e===this._map.getMinZoom(!0);this._zoomInButton.disabled=t,this._zoomOutButton.disabled=n,this._zoomInButton.setAttribute(`aria-disabled`,t.toString()),this._zoomOutButton.setAttribute(`aria-disabled`,n.toString())},this._rotateCompassArrow=()=>{let e=this._map.getPitch(),t=this._map.getRoll(),n=this._map.getBearing(),r=1/Math.cos(maplibre_gl_shared_$t(e))**.5;if(this.options.visualizePitch&&this.options.visualizeRoll){this._compassIcon.style.transform=`scale(${r}) rotateZ(${-t}deg) rotateX(${e}deg) rotateZ(${-n}deg)`;return}if(this.options.visualizePitch){this._compassIcon.style.transform=`scale(${r}) rotateX(${e}deg) rotateZ(${-n}deg)`;return}if(this.options.visualizeRoll){this._compassIcon.style.transform=`rotate(${-n-t}deg)`;return}this._compassIcon.style.transform=`rotate(${-n}deg)`},this._setButtonTitle=(e,t)=>{let n=this._map._getUIString(`NavigationControl.${t}`);e.title=n,e.setAttribute(`aria-label`,n)},this.options=maplibre_gl_shared_xt({},maplibre_gl_Dm,e),this._container=maplibre_gl_W.create(`div`,`maplibregl-ctrl maplibregl-ctrl-group`),this._container.addEventListener(`contextmenu`,e=>e.preventDefault()),this.options.showZoom&&(this._zoomInButton=this._createButton(`maplibregl-ctrl-zoom-in`,e=>this._map.zoomIn({},{originalEvent:e})),maplibre_gl_W.create(`span`,`maplibregl-ctrl-icon`,this._zoomInButton).setAttribute(`aria-hidden`,`true`),this._zoomOutButton=this._createButton(`maplibregl-ctrl-zoom-out`,e=>this._map.zoomOut({},{originalEvent:e})),maplibre_gl_W.create(`span`,`maplibregl-ctrl-icon`,this._zoomOutButton).setAttribute(`aria-hidden`,`true`)),this.options.showCompass&&(this._compass=this._createButton(`maplibregl-ctrl-compass`,e=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:e}):this._map.resetNorth({},{originalEvent:e})}),this._compassIcon=maplibre_gl_W.create(`span`,`maplibregl-ctrl-icon`,this._compass),this._compassIcon.setAttribute(`aria-hidden`,`true`))}onAdd(e){return this._map=e,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,`ZoomIn`),this._setButtonTitle(this._zoomOutButton,`ZoomOut`),this._map.on(`move`,this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,`ResetBearing`),this.options.visualizePitch&&this._map.on(`pitch`,this._rotateCompassArrow),this.options.visualizeRoll&&this._map.on(`roll`,this._rotateCompassArrow),this._map.on(`rotate`,this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new maplibre_gl_km(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){this._container.remove(),this.options.showZoom&&this._map.off(`move`,this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&this._map.off(`pitch`,this._rotateCompassArrow),this.options.visualizeRoll&&this._map.off(`roll`,this._rotateCompassArrow),this._map.off(`rotate`,this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(e,t){let n=maplibre_gl_W.create(`button`,e,this._container);return n.type=`button`,n.addEventListener(`click`,t),n}},maplibre_gl_km=class{constructor(e,t,n=!1){this.mousedown=e=>{this.startMove(e,maplibre_gl_W.mousePos(this.element,e)),window.addEventListener(`mousemove`,this.mousemove),window.addEventListener(`mouseup`,this.mouseup)},this.mousemove=e=>{this.move(e,maplibre_gl_W.mousePos(this.element,e))},this.mouseup=e=>{this._rotatePitchHandler.dragEnd(e),this.offTemp()},this.touchstart=e=>{e.targetTouches.length===1?(this._startPos=this._lastPos=maplibre_gl_W.touchPos(this.element,e.targetTouches)[0],this.startMove(e,this._startPos),window.addEventListener(`touchmove`,this.touchmove,{passive:!1}),window.addEventListener(`touchend`,this.touchend)):this.reset()},this.touchmove=e=>{e.targetTouches.length===1?(this._lastPos=maplibre_gl_W.touchPos(this.element,e.targetTouches)[0],this.move(e,this._lastPos)):this.reset()},this.touchend=e=>{e.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._rotatePitchHandler.reset(),delete this._startPos,delete this._lastPos,this.offTemp()},this._clickTolerance=10,this.element=t;let r=new maplibre_gl_Fp;this._rotatePitchHandler=new maplibre_gl_Ap({clickTolerance:3,move:(e,r)=>{let i=t.getBoundingClientRect(),a=new maplibre_gl_shared_l((i.bottom-i.top)/2,(i.right-i.left)/2);return{bearingDelta:maplibre_gl_shared_rn(new maplibre_gl_shared_l(e.x,r.y),r,a),pitchDelta:n?(r.y-e.y)*-.5:void 0}},moveStateManager:r,enable:!0,assignEvents:()=>{}}),this.map=e,t.addEventListener(`mousedown`,this.mousedown),t.addEventListener(`touchstart`,this.touchstart,{passive:!1}),t.addEventListener(`touchcancel`,this.reset)}startMove(e,t){this._rotatePitchHandler.dragStart(e,t),maplibre_gl_W.disableDrag()}move(e,t){let n=this.map,{bearingDelta:r,pitchDelta:i}=this._rotatePitchHandler.dragMove(e,t)||{};r&&n.setBearing(n.getBearing()+r),i&&n.setPitch(n.getPitch()+i)}off(){let e=this.element;e.removeEventListener(`mousedown`,this.mousedown),e.removeEventListener(`touchstart`,this.touchstart),window.removeEventListener(`touchmove`,this.touchmove),window.removeEventListener(`touchend`,this.touchend),e.removeEventListener(`touchcancel`,this.reset),this.offTemp()}offTemp(){maplibre_gl_W.enableDrag(),window.removeEventListener(`mousemove`,this.mousemove),window.removeEventListener(`mouseup`,this.mouseup),window.removeEventListener(`touchmove`,this.touchmove),window.removeEventListener(`touchend`,this.touchend)}};let maplibre_gl_Am;async function maplibre_gl_jm(e=!1){if(maplibre_gl_Am!==void 0&&!e)return maplibre_gl_Am;if(window.navigator.permissions===void 0)return maplibre_gl_Am=!!window.navigator.geolocation,maplibre_gl_Am;try{maplibre_gl_Am=(await window.navigator.permissions.query({name:`geolocation`})).state!==`denied`}catch{maplibre_gl_Am=!!window.navigator.geolocation}return maplibre_gl_Am}function maplibre_gl_Mm(e,t,n,r=!1){if(r||!n.getCoveringTilesDetailsProvider().allowWorldCopies())return e?.wrap();let i=new maplibre_gl_shared_Mp(e.lng,e.lat);if(e=new maplibre_gl_shared_Mp(e.lng,e.lat),t){let r=new maplibre_gl_shared_Mp(e.lng-360,e.lat),i=new maplibre_gl_shared_Mp(e.lng+360,e.lat),a=n.locationToScreenPoint(e).distSqr(t);n.locationToScreenPoint(r).distSqr(t)<a?e=r:n.locationToScreenPoint(i).distSqr(t)<a&&(e=i)}for(;Math.abs(e.lng-n.center.lng)>180;){let t=n.locationToScreenPoint(e);if(t.x>=0&&t.y>=0&&t.x<=n.width&&t.y<=n.height)break;e.lng>n.center.lng?e.lng-=360:e.lng+=360}return e.lng!==i.lng&&n.isPointOnMapSurface(n.locationToScreenPoint(e))?e:i}const maplibre_gl_Nm={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 maplibre_gl_Pm(e,t,n){let r=e.classList;for(let e in maplibre_gl_Nm)r.remove(`maplibregl-${n}-anchor-${e}`);r.add(`maplibregl-${n}-anchor-${t}`)}const maplibre_gl_Fm={ArrowLeft:[-1,0],ArrowRight:[1,0],ArrowUp:[0,-1],ArrowDown:[0,1]},maplibre_gl_Im=`#3FB1CE`;function maplibre_gl_Lm(e,t,n=[]){let r=maplibre_gl_W.createNS(`http://www.w3.org/2000/svg`,e);for(let e in t)r.setAttributeNS(null,e,t[e]);for(let e of n)r.appendChild(e);return r}let maplibre_gl_Rm;function maplibre_gl_zm(){return maplibre_gl_Rm||(maplibre_gl_Rm=maplibre_gl_Lm(`svg`,{display:`block`,height:`41px`,width:`27px`,viewBox:`0 0 27 41`},[maplibre_gl_Lm(`g`,{"fill-rule":`nonzero`},[maplibre_gl_Lm(`g`,{transform:`translate(3.0, 29.0)`,fill:`#000000`},[[`10.5`,`5.25002273`],[`10.5`,`5.25002273`],[`9.5`,`4.77275007`],[`8.5`,`4.29549936`],[`7.5`,`3.81822308`],[`6.5`,`3.34094679`],[`5.5`,`2.86367051`],[`4.5`,`2.38636864`]].map(([e,t])=>maplibre_gl_Lm(`ellipse`,{opacity:`0.04`,cx:`10.5`,cy:`5.80029008`,rx:e,ry:t}))),maplibre_gl_Lm(`g`,{fill:maplibre_gl_Im},[maplibre_gl_Lm(`path`,{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`})]),maplibre_gl_Lm(`g`,{opacity:`0.25`,fill:`#000000`},[maplibre_gl_Lm(`path`,{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`})]),maplibre_gl_Lm(`g`,{transform:`translate(6.0, 7.0)`,fill:`#FFFFFF`}),maplibre_gl_Lm(`g`,{transform:`translate(8.0, 8.0)`},[maplibre_gl_Lm(`circle`,{fill:`#000000`,opacity:`0.25`,cx:`5.5`,cy:`5.5`,r:`5.4999962`}),maplibre_gl_Lm(`circle`,{fill:`#FFFFFF`,cx:`5.5`,cy:`5.5`,r:`5.4999962`})])])]),maplibre_gl_Rm)}function maplibre_gl_Bm(e){return e.firstElementChild.children[1]}var maplibre_gl_Vm=class extends maplibre_gl_shared_Nn{},maplibre_gl_Hm=class extends maplibre_gl_shared_Nn{},maplibre_gl_Um=class extends maplibre_gl_shared_Fn{constructor(e){if(super(),this._onClick=e=>{this.fire(new maplibre_gl_Hm(`click`,{originalEvent:e}))},this._onKeyPress=e=>{(e.code===`Space`||e.code===`Enter`)&&this.togglePopup()},this._onKeyDown=e=>{if(!this._defaultMarker||!this._draggable||!this._map||!this._lngLat||e.composedPath()[0]!==this._element||e.altKey||e.ctrlKey||e.metaKey)return;let t=maplibre_gl_Fm[e.key];if(!t)return;e.preventDefault(),e.stopPropagation();let n=e.shiftKey?10:1,r=this._map.project(this._lngLat);this.setLngLat(this._map.unproject(new maplibre_gl_shared_l(r.x+t[0]*n,r.y+t[1]*n))),this._keyboardDragActive||(this._keyboardDragActive=!0,this.fire(new maplibre_gl_Vm(`dragstart`))),this.fire(new maplibre_gl_Vm(`drag`))},this._onKeyUp=e=>{maplibre_gl_Fm[e.key]&&this._endKeyboardDrag()},this._onBlur=()=>{this._endKeyboardDrag()},this._onMapClick=e=>{let t=e.originalEvent.target,n=this._element;this._popup&&(t===n||n.contains(t))&&this.togglePopup()},this._update=e=>{if(!this._map)return;let t=this._map.loaded()&&!this._map.isMoving();(e?.type===`terrain`||e?.type===`render`&&!t)&&this._map.once(`render`,this._update),this._lngLat=maplibre_gl_Mm(this._lngLat,this._flatPos,this._map._camera.transform),this._flatPos=this._pos=this._map.project(this._lngLat)._add(this._offset),this._map.terrain&&(this._flatPos=this._map._camera.transform.locationToScreenPoint(this._lngLat)._add(this._offset));let n=``;this._rotationAlignment===`viewport`||this._rotationAlignment===`auto`?n=`rotateZ(${this._rotation}deg)`:this._rotationAlignment===`map`&&(n=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let r=``;this._pitchAlignment===`viewport`||this._pitchAlignment===`auto`?r=`rotateX(0deg)`:this._pitchAlignment===`map`&&(r=`rotateX(${this._map.getPitch()}deg)`),!this._subpixelPositioning&&(!e||e.type===`moveend`)&&(this._pos=this._pos.round()),this._element.style.transform=`${maplibre_gl_Nm[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${r} ${n}`,maplibre_gl_Br.frameAsync(new AbortController,this._map._ownerWindow).then(()=>{this._updateOpacity(e?.type===`moveend`)}).catch(()=>{})},this._onMove=e=>{if(!this._isDragging){let t=this._clickTolerance||this._map._clickTolerance;this._isDragging=e.point.dist(this._pointerdownPos)>=t}this._isDragging&&(this._pos=e.point.sub(this._positionDelta),this._lngLat=this._map.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents=`none`,this._state===`pending`&&(this._state=`active`,this.fire(new maplibre_gl_Vm(`dragstart`))),this.fire(new maplibre_gl_Vm(`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 maplibre_gl_Vm(`dragend`)),this._state=`inactive`},this._addDragHandler=e=>{this._element.contains(e.originalEvent.target)&&(e.preventDefault(),this._positionDelta=e.point.sub(this._pos).add(this._offset),this._pointerdownPos=e.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=e?.anchor||`center`,this._color=e?.color||maplibre_gl_Im,this._scale=e?.scale||1,this._draggable=e?.draggable||!1,this._clickTolerance=e?.clickTolerance||0,this._subpixelPositioning=e?.subpixelPositioning||!1,this._isDragging=!1,this._roleManaged=!1,this._tabIndexManaged=!1,this._keyboardDragActive=!1,this._state=`inactive`,this._rotation=e?.rotation||0,this._rotationAlignment=e?.rotationAlignment||`auto`,this._pitchAlignment=e?.pitchAlignment&&e.pitchAlignment!==`auto`?e.pitchAlignment:this._rotationAlignment,this.setOpacity(e?.opacity,e?.opacityWhenCovered),e?.element)this._element=e.element,this._offset=maplibre_gl_shared_l.convert(e?.offset||[0,0]);else{this._defaultMarker=!0,this._element=maplibre_gl_W.create(`div`);let t=maplibre_gl_zm().cloneNode(!0);t.setAttributeNS(null,`height`,`${41*this._scale}px`),t.setAttributeNS(null,`width`,`${27*this._scale}px`),maplibre_gl_Bm(t).setAttributeNS(null,`fill`,this._color),this._element.appendChild(t),this._offset=maplibre_gl_shared_l.convert(e?.offset||[0,-14])}if(this._element.classList.add(`maplibregl-marker`),this._element.addEventListener(`dragstart`,e=>{e.preventDefault()}),this._element.addEventListener(`mousedown`,e=>{e.preventDefault()}),maplibre_gl_Pm(this._element,this._anchor,`marker`),e?.className)for(let t of e.className.split(` `))this._element.classList.add(t);this._popup=null}addTo(e){return this.remove(),this._map=e,this._defaultMarker&&!this._element.hasAttribute(`aria-label`)&&this._element.setAttribute(`aria-label`,e._getUIString(`Marker.Title`)),this._updateAccessibilityRole(),e.getCanvasContainer().appendChild(this._element),e.on(`move`,this._update),e.on(`moveend`,this._update),e.on(`terrain`,this._update),e.on(`projectiontransition`,this._update),this._element.addEventListener(`click`,this._onClick),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(`projectiontransition`,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),this._element.removeEventListener(`click`,this._onClick),this._element.removeEventListener(`keydown`,this._onKeyDown),this._element.removeEventListener(`keyup`,this._onKeyUp),this._element.removeEventListener(`blur`,this._onBlur),this._element.removeEventListener(`keypress`,this._onKeyPress),this._keyboardDragActive=!1,this._element.remove(),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(e){return this._lngLat=maplibre_gl_shared_Mp.convert(e),this._pos=null,this._update(),this._popup&&this._popup.setLngLat(this._lngLat),this}getElement(){return this._element}setPopup(e){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener(`keypress`,this._onKeyPress)),e){if(!(`offset`in e.options)){let t=13.5/Math.SQRT2;e.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[t,(24.6+t)*-1],"bottom-right":[-t,(24.6+t)*-1],left:[13.5,-24.6],right:[-13.5,-24.6]}:this._offset}this._popup=e,this._element.addEventListener(`keypress`,this._onKeyPress)}return this._updateTabIndex(),this._updateAccessibilityRole(),this}setSubpixelPositioning(e){return this._subpixelPositioning=e,this}_endKeyboardDrag(){this._keyboardDragActive&&(this._keyboardDragActive=!1,this.fire(new maplibre_gl_Vm(`dragend`)))}getPopup(){return this._popup}togglePopup(){let e=this._popup;if(this._element.style.opacity===this._opacityWhenCovered)return this;if(e)e.isOpen()?e.remove():(e.setLngLat(this._lngLat),e.addTo(this._map));else return this;return this}_updateOpacity(e=!1){let t=this._map?.terrain,n=this._map._camera.transform.isLocationOccluded(this._lngLat);if(!t||n){let e=n?this._opacityWhenCovered:this._opacity;this._element.style.opacity!==e&&(this._element.style.opacity=e,this._element.classList.toggle(`maplibregl-marker-covered`,n));return}if(e)this._opacityTimeout=null;else{if(this._opacityTimeout)return;this._opacityTimeout=setTimeout(()=>{this._opacityTimeout=null},100)}let r=this._map,i=r.terrain.depthAtPoint(this._pos),a=r.terrain.getElevationForLngLat(this._lngLat,r._camera.transform),o=r._camera.transform.lngLatToCameraDepth(this._lngLat,a),s=.006;if(o-i<s){this._element.style.opacity=this._opacity,this._element.classList.remove(`maplibregl-marker-covered`);return}let c=-this._offset.y/r._camera.transform.pixelsPerMeter,l=Math.sin(r.getPitch()*Math.PI/180)*c,u=r.terrain.depthAtPoint(new maplibre_gl_shared_l(this._pos.x,this._pos.y-this._offset.y)),d=r._camera.transform.lngLatToCameraDepth(this._lngLat,a+l)-u>s;this._popup?.isOpen()&&d&&this._popup.remove(),this._element.style.opacity=d?this._opacityWhenCovered:this._opacity,this._element.classList.toggle(`maplibregl-marker-covered`,d)}getOffset(){return this._offset}setOffset(e){return this._offset=maplibre_gl_shared_l.convert(e),this._update(),this}addClassName(e){this._element.classList.add(e)}removeClassName(e){this._element.classList.remove(e)}toggleClassName(e){return this._element.classList.toggle(e)}setDraggable(e){return this._draggable=!!e,this._element.classList.toggle(`maplibregl-marker-draggable`,this._draggable),this._map&&(e?(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._defaultMarker&&(this._draggable?(this._element.addEventListener(`keydown`,this._onKeyDown),this._element.addEventListener(`keyup`,this._onKeyUp),this._element.addEventListener(`blur`,this._onBlur)):(this._element.removeEventListener(`keydown`,this._onKeyDown),this._element.removeEventListener(`keyup`,this._onKeyUp),this._element.removeEventListener(`blur`,this._onBlur),this._endKeyboardDrag())),this._updateTabIndex(),this._updateAccessibilityRole(),this}isDraggable(){return this._draggable}_updateTabIndex(){this._popup||this._defaultMarker&&this._draggable?this._element.hasAttribute(`tabindex`)||(this._element.setAttribute(`tabindex`,`0`),this._tabIndexManaged=!0):this._tabIndexManaged&&=(this._element.getAttribute(`tabindex`)===`0`&&this._element.removeAttribute(`tabindex`),!1)}_updateAccessibilityRole(){if(!this._defaultMarker||this._element.hasAttribute(`role`)&&!this._roleManaged)return;let e=this._draggable||this._popup?`button`:`img`;this._element.setAttribute(`role`,e),this._roleManaged=!0}setRotation(e){return this._rotation=e||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(e){return this._rotationAlignment=e||`auto`,this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(e){return this._pitchAlignment=e&&e!==`auto`?e:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}setOpacity(e,t){return(this._opacity===void 0||e===void 0&&t===void 0)&&(this._opacity=`1`,this._opacityWhenCovered=`0.2`),e!==void 0&&(this._opacity=String(e)),t!==void 0&&(this._opacityWhenCovered=String(t)),this._map&&this._updateOpacity(!0),this}};const maplibre_gl_Wm={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let maplibre_gl_Gm=0,maplibre_gl_Km=!1;var maplibre_gl_qm=class extends maplibre_gl_shared_Nn{},maplibre_gl_Jm=class extends maplibre_gl_shared_Nn{},maplibre_gl_Ym=class extends maplibre_gl_shared_Nn{},maplibre_gl_Xm=class extends maplibre_gl_shared_Fn{constructor(e){super(),this._onSuccess=e=>{if(this._map){if(this._isOutOfMapMaxBounds(e)){this._setErrorState(),this.fire(new maplibre_gl_Jm(`outofmaxbounds`,e)),this._updateMarker(),this._finish();return}if(this.options.trackUserLocation)switch(this._lastKnownPosition=e,this._watchState){case`WAITING_ACTIVE`:case`ACTIVE_LOCK`:case`ACTIVE_ERROR`:this._watchState=`ACTIVE_LOCK`,this._geolocateButton.classList.remove(`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 Error(`Unexpected watchState ${this._watchState}`)}this.options.showUserLocation&&this._watchState!==`OFF`&&this._updateMarker(e),(!this.options.trackUserLocation||this._watchState===`ACTIVE_LOCK`)&&this._updateCamera(e),this.options.showUserLocation&&this._dotElement.classList.remove(`maplibregl-user-location-dot-stale`),this.fire(new maplibre_gl_Jm(`geolocate`,e)),this._finish()}},this._updateCamera=e=>{let t=new maplibre_gl_shared_Mp(e.coords.longitude,e.coords.latitude),n=e.coords.accuracy,r=this._map.getBearing(),i=maplibre_gl_shared_xt({bearing:r},this.options.fitBoundsOptions),a=maplibre_gl_ya.fromLngLat(t,n);this._map.fitBounds(a,i,{geolocateSource:!0})},this._updateMarker=e=>{if(e){let t=new maplibre_gl_shared_Mp(e.coords.longitude,e.coords.latitude);this._accuracyCircleMarker.setLngLat(t).addTo(this._map),this._userLocationDotMarker.setLngLat(t).addTo(this._map),this._accuracy=e.coords.accuracy,this._updateCircleRadiusIfNeeded()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()},this._onUpdate=()=>{this._updateCircleRadiusIfNeeded()},this._onError=e=>{if(this._map){if(e.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;let e=this._map._getUIString(`GeolocateControl.LocationNotAvailable`);this._geolocateButton.title=e,this._geolocateButton.setAttribute(`aria-label`,e),this._geolocationWatchID!==void 0&&this._clearWatch()}else if(e.code===3&&maplibre_gl_Km)return;else this._setErrorState();this._watchState!==`OFF`&&this.options.showUserLocation&&this._dotElement.classList.add(`maplibregl-user-location-dot-stale`),this.fire(new maplibre_gl_Ym(`error`,e)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._onMoveStart=e=>{if(!this._map)return;let t=e?.[0]instanceof ResizeObserverEntry;!e.geolocateSource&&this._watchState===`ACTIVE_LOCK`&&!t&&!this._map.isZooming()&&(this._watchState=`BACKGROUND`,this._geolocateButton.classList.add(`maplibregl-ctrl-geolocate-background`),this._geolocateButton.classList.remove(`maplibregl-ctrl-geolocate-active`),this.fire(new maplibre_gl_qm(`trackuserlocationend`)),this.fire(new maplibre_gl_qm(`userlocationlostfocus`)))},this._setupUI=()=>{this._map&&(this._container.addEventListener(`contextmenu`,e=>{e.preventDefault()}),this._geolocateButton=maplibre_gl_W.create(`button`,`maplibregl-ctrl-geolocate`,this._container),maplibre_gl_W.create(`span`,`maplibregl-ctrl-icon`,this._geolocateButton).setAttribute(`aria-hidden`,`true`),this._geolocateButton.type=`button`,this._geolocateButton.disabled=!0)},this._finishSetupUI=e=>{if(this._map){if(e===!1){maplibre_gl_shared_Ft(`Geolocation support is not available so the GeolocateControl will be disabled.`);let e=this._map._getUIString(`GeolocateControl.LocationNotAvailable`);this._geolocateButton.disabled=!0,this._geolocateButton.title=e,this._geolocateButton.setAttribute(`aria-label`,e)}else{let e=this._map._getUIString(`GeolocateControl.FindMyLocation`);this._geolocateButton.disabled=!1,this._geolocateButton.title=e,this._geolocateButton.setAttribute(`aria-label`,e)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute(`aria-pressed`,`false`),this._watchState=`OFF`),this.options.showUserLocation&&(this._dotElement=maplibre_gl_W.create(`div`,`maplibregl-user-location-dot`),this._userLocationDotMarker=new maplibre_gl_Um({element:this._dotElement}),this._circleElement=maplibre_gl_W.create(`div`,`maplibregl-user-location-accuracy-circle`),this._accuracyCircleMarker=new maplibre_gl_Um({element:this._circleElement,pitchAlignment:`map`}),this.options.trackUserLocation&&(this._watchState=`OFF`),this._map.on(`zoom`,this._onUpdate),this._map.on(`move`,this._onUpdate),this._map.on(`rotate`,this._onUpdate),this._map.on(`pitch`,this._onUpdate)),this._geolocateButton.addEventListener(`click`,()=>this.trigger()),this._setup=!0,this.options.trackUserLocation&&this._map.on(`movestart`,this._onMoveStart)}},this.options=maplibre_gl_shared_xt({},maplibre_gl_Wm,e)}onAdd(e){return this._map=e,this._container=maplibre_gl_W.create(`div`,`maplibregl-ctrl maplibregl-ctrl-group`),this._setupUI(),maplibre_gl_jm().then(e=>this._finishSetupUI(e)),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(),this._container.remove(),this._map.off(`movestart`,this._onMoveStart),this._map.off(`zoom`,this._onUpdate),this._map.off(`move`,this._onUpdate),this._map.off(`rotate`,this._onUpdate),this._map.off(`pitch`,this._onUpdate),this._map=void 0,maplibre_gl_Gm=0,maplibre_gl_Km=!1}_isOutOfMapMaxBounds(e){let t=this._map.getMaxBounds(),n=e.coords;return t&&(n.longitude<t.getWest()||n.longitude>t.getEast()||n.latitude<t.getSouth()||n.latitude>t.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`:case`BACKGROUND_ERROR`:break;case`OFF`:case void 0:break;default:throw Error(`Unexpected watchState ${this._watchState}`)}}_updateCircleRadiusIfNeeded(){let e=this._userLocationDotMarker.getLngLat();if(!this.options.showUserLocation||!this.options.showAccuracyCircle||!this._accuracy||!e)return;let t=this._map.project(e),n=this._map.unproject([t.x+100,t.y]),r=e.distanceTo(n)/100,i=2*this._accuracy/r;this._circleElement.style.width=`${i.toFixed(2)}px`,this._circleElement.style.height=`${i.toFixed(2)}px`}trigger(){if(!this._setup)return maplibre_gl_shared_Ft(`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 maplibre_gl_qm(`trackuserlocationstart`));break;case`WAITING_ACTIVE`:case`ACTIVE_LOCK`:case`ACTIVE_ERROR`:case`BACKGROUND_ERROR`:maplibre_gl_Gm--,maplibre_gl_Km=!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 maplibre_gl_qm(`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 maplibre_gl_qm(`trackuserlocationstart`)),this.fire(new maplibre_gl_qm(`userlocationfocus`));break;default:throw 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 Error(`Unexpected watchState ${this._watchState}`)}if(this._watchState===`OFF`&&this._geolocationWatchID!==void 0)this._clearWatch();else if(this._geolocationWatchID===void 0){this._geolocateButton.classList.add(`maplibregl-ctrl-geolocate-waiting`),this._geolocateButton.setAttribute(`aria-pressed`,`true`),maplibre_gl_Gm++;let e;maplibre_gl_Gm>1?(e={maximumAge:6e5,timeout:0},maplibre_gl_Km=!0):(e=this.options.positionOptions,maplibre_gl_Km=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,e)}}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)}};const maplibre_gl_Zm=(/* unused pure expression or super */ null && ({maxWidth:100,unit:`metric`}));var maplibre_gl_Qm=class{constructor(e){this._onMove=()=>{maplibre_gl_$m(this._map,this._container,this.options)},this.setUnit=e=>{this.options.unit=e,maplibre_gl_$m(this._map,this._container,this.options)},this.options={...maplibre_gl_Zm,...e}}getDefaultPosition(){return`bottom-left`}onAdd(e){return this._map=e,this._container=maplibre_gl_W.create(`div`,`maplibregl-ctrl maplibregl-ctrl-scale`,e.getContainer()),this._map.on(`move`,this._onMove),this._onMove(),this._container}onRemove(){this._container.remove(),this._map.off(`move`,this._onMove),this._map=void 0}};function maplibre_gl_$m(e,t,n){let r=n?.maxWidth||100,i=e._container.clientHeight/2,a=e._container.clientWidth/2,o=e.unproject([a-r/2,i]),s=e.unproject([a+r/2,i]),c=Math.round(e.project(s).x-e.project(o).x),l=Math.min(r,c,e._container.clientWidth),u=o.distanceTo(s);if(n?.unit===`imperial`){let n=3.2808*u;n>5280?maplibre_gl_eh(t,l,n/5280,e._getUIString(`ScaleControl.Miles`)):maplibre_gl_eh(t,l,n,e._getUIString(`ScaleControl.Feet`))}else n?.unit===`nautical`?maplibre_gl_eh(t,l,u/1852,e._getUIString(`ScaleControl.NauticalMiles`)):u>=1e3?maplibre_gl_eh(t,l,u/1e3,e._getUIString(`ScaleControl.Kilometers`)):maplibre_gl_eh(t,l,u,e._getUIString(`ScaleControl.Meters`))}function maplibre_gl_eh(e,t,n,r){let i=maplibre_gl_nh(n),a=i/n;e.style.width=`${t*a}px`,e.innerHTML=`${i}&nbsp;${r}`}function maplibre_gl_th(e){let t=10**Math.ceil(-Math.log(e)/Math.LN10);return Math.round(e*t)/t}function maplibre_gl_nh(e){let t=10**(`${Math.floor(e)}`.length-1),n=e/t;return n=n>=10?10:n>=5?5:n>=3?3:n>=2?2:n>=1?1:maplibre_gl_th(n),t*n}var maplibre_gl_rh=class extends maplibre_gl_shared_Nn{},maplibre_gl_ih=class extends maplibre_gl_shared_Fn{constructor(e={}){super(),this._onFullscreenChange=()=>{let e=window.document.fullscreenElement||window.document.webkitFullscreenElement;for(;e?.shadowRoot?.fullscreenElement;)e=e.shadowRoot.fullscreenElement;e===this._container!==this._fullscreen&&this._handleFullscreenChange()},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},this._fullscreen=!1,this._pseudo=e.pseudo??!1,e?.container&&(e.container instanceof HTMLElement?this._container=e.container:maplibre_gl_shared_Ft(`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(e){return this._map=e,this._container||=this._map.getContainer(),this._controlContainer=maplibre_gl_W.create(`div`,`maplibregl-ctrl maplibregl-ctrl-group`),this._setupUI(),this._controlContainer}onRemove(){this._controlContainer.remove(),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){let e=this._fullscreenButton=maplibre_gl_W.create(`button`,`maplibregl-ctrl-fullscreen`,this._controlContainer);maplibre_gl_W.create(`span`,`maplibregl-ctrl-icon`,e).setAttribute(`aria-hidden`,`true`),e.type=`button`,this._updateTitle(),this._fullscreenButton.addEventListener(`click`,this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){let e=this._getTitle();this._fullscreenButton.setAttribute(`aria-label`,e),this._fullscreenButton.title=e}_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 maplibre_gl_rh(`fullscreenstart`)),this._prevCooperativeGesturesEnabled=this._map.cooperativeGestures.isEnabled(),this._map.cooperativeGestures.disable()):(this.fire(new maplibre_gl_rh(`fullscreenend`)),this._prevCooperativeGesturesEnabled&&this._map.cooperativeGestures.enable())}_exitFullscreen(){this._pseudo?this._togglePseudoFullScreen():window.document.exitFullscreen?window.document.exitFullscreen():window.document.webkitCancelFullScreen?window.document.webkitCancelFullScreen():this._togglePseudoFullScreen()}_requestFullscreen(){this._pseudo?this._togglePseudoFullScreen():this._container.requestFullscreen?this._container.requestFullscreen():this._container.webkitRequestFullscreen?this._container.webkitRequestFullscreen():this._togglePseudoFullScreen()}_togglePseudoFullScreen(){this._container.classList.toggle(`maplibregl-pseudo-fullscreen`),this._handleFullscreenChange(),this._map.resize()}},maplibre_gl_ah=class{constructor(e){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=e}onAdd(e){return this._map=e,this._container=maplibre_gl_W.create(`div`,`maplibregl-ctrl maplibregl-ctrl-group`),this._terrainButton=maplibre_gl_W.create(`button`,`maplibregl-ctrl-terrain`,this._container),maplibre_gl_W.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(){this._container.remove(),this._map.off(`terrain`,this._updateTerrainIcon),this._map=void 0}},maplibre_gl_oh=class{constructor(){this._toggleProjection=()=>{let e=this._map.getProjection()?.type;e===`mercator`||!e?this._map.setProjection({type:`globe`}):this._map.setProjection({type:`mercator`}),this._updateGlobeIcon()},this._updateGlobeIcon=()=>{this._globeButton.classList.remove(`maplibregl-ctrl-globe`),this._globeButton.classList.remove(`maplibregl-ctrl-globe-enabled`),this._map.getProjection()?.type===`globe`?(this._globeButton.classList.add(`maplibregl-ctrl-globe-enabled`),this._globeButton.title=this._map._getUIString(`GlobeControl.Disable`)):(this._globeButton.classList.add(`maplibregl-ctrl-globe`),this._globeButton.title=this._map._getUIString(`GlobeControl.Enable`))}}onAdd(e){return this._map=e,this._container=maplibre_gl_W.create(`div`,`maplibregl-ctrl maplibregl-ctrl-group`),this._globeButton=maplibre_gl_W.create(`button`,`maplibregl-ctrl-globe`,this._container),maplibre_gl_W.create(`span`,`maplibregl-ctrl-icon`,this._globeButton).setAttribute(`aria-hidden`,`true`),this._globeButton.type=`button`,this._globeButton.addEventListener(`click`,this._toggleProjection),this._updateGlobeIcon(),this._map.on(`styledata`,this._updateGlobeIcon),this._map.on(`projectiontransition`,this._updateGlobeIcon),this._container}onRemove(){this._container.remove(),this._map.off(`styledata`,this._updateGlobeIcon),this._map.off(`projectiontransition`,this._updateGlobeIcon),this._globeButton.removeEventListener(`click`,this._toggleProjection),this._map=void 0}};const maplibre_gl_sh={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:``,maxWidth:`240px`,subpixelPositioning:!1,locationOccludedOpacity:void 0,padding:void 0},maplibre_gl_ch=[`a[href]`,`[tabindex]:not([tabindex='-1'])`,`[contenteditable]:not([contenteditable='false'])`,`button:not([disabled])`,`input:not([disabled])`,`select:not([disabled])`,`textarea:not([disabled])`].join(`, `);var maplibre_gl_lh=class extends maplibre_gl_shared_Nn{},maplibre_gl_uh=class extends maplibre_gl_shared_Fn{constructor(e){super(),this._updateOpacity=()=>{this.options.locationOccludedOpacity!==void 0&&(this._map._camera.transform.isLocationOccluded(this.getLngLat())?this._container.style.opacity=`${this.options.locationOccludedOpacity}`:this._container.style.opacity=``)},this.remove=()=>(this._content&&this._content.remove(),this._container&&(this._container.remove(),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(`terrain`,this._update),this._map.off(`projectiontransition`,this._update),this._map.off(`mousemove`,this._update),this._map.off(`mouseup`,this._update),this._map.off(`drag`,this._update),this._map._canvasContainer.classList.remove(`maplibregl-track-pointer`),delete this._map,this.fire(new maplibre_gl_lh(`close`))),this),this._update=e=>{let t=this._lngLat||this._trackPointer;if(!this._map||!t||!this._content)return;if(!this._container){if(this._container=maplibre_gl_W.create(`div`,`maplibregl-popup`,this._map.getContainer()),this._tip=maplibre_gl_W.create(`div`,`maplibregl-popup-tip`,this._container),this._container.appendChild(this._content),this.options.className)for(let e of this.options.className.split(` `))this._container.classList.add(e);this._closeButton&&this._closeButton.setAttribute(`aria-label`,this._map._getUIString(`Popup.Close`)),this._trackPointer&&this._container.classList.add(`maplibregl-popup-track-pointer`)}this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._lngLat=maplibre_gl_Mm(this._lngLat,this._flatPos,this._map._camera.transform,this._trackPointer);let n;if(e&&`point`in e&&e.point&&(n=e.point),this._trackPointer&&!n)return;let r=this._flatPos=this._pos=this._trackPointer&&n?n:this._map.project(this._lngLat);this._map.terrain&&(this._flatPos=this._trackPointer&&n?n:this._map._camera.transform.locationToScreenPoint(this._lngLat));let i=this.options.anchor,a=maplibre_gl_dh(this.options.offset);if(!i){let e=this._container.offsetWidth,t=this._container.offsetHeight,n=maplibre_gl_fh(this.options.padding),o;o=r.y+a.bottom.y<t+n.top?[`top`]:r.y>this._map._camera.transform.height-t-n.bottom?[`bottom`]:[],r.x<e/2+n.left?o.push(`left`):r.x>this._map._camera.transform.width-e/2-n.right&&o.push(`right`),i=o.length===0?`bottom`:o.join(`-`)}let o=r.add(a[i]);this.options.subpixelPositioning||(o=o.round()),this._container.style.transform=`${maplibre_gl_Nm[i]} translate(${o.x}px,${o.y}px)`,maplibre_gl_Pm(this._container,i,`popup`),this._updateOpacity()},this._onClose=()=>{this.remove()},this.options=maplibre_gl_shared_xt(Object.create(maplibre_gl_sh),e)}addTo(e){return this._map&&this.remove(),this._map=e,this.options.closeOnClick&&this._map.on(`click`,this._onClose),this.options.closeOnMove&&this._map.on(`move`,this._onClose),this._map.on(`remove`,this.remove),this._map.on(`terrain`,this._update),this._map.on(`projectiontransition`,this._update),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on(`mousemove`,this._update),this._map.on(`mouseup`,this._update),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 maplibre_gl_lh(`open`)),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(e){return this._lngLat=maplibre_gl_shared_Mp.convert(e),this._pos=null,this._flatPos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on(`move`,this._update),this._map.off(`mousemove`,this._update),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._update),this._map.on(`drag`,this._update),this._container&&this._container.classList.add(`maplibregl-popup-track-pointer`),this._map._canvasContainer.classList.add(`maplibregl-track-pointer`)),this}getElement(){return this._container}setText(e){return this.setDOMContent(document.createTextNode(e))}setHTML(e){let t=document.createDocumentFragment(),n=document.createElement(`body`),r;for(n.innerHTML=e;r=n.firstChild,r;)t.appendChild(r);return this.setDOMContent(t)}getMaxWidth(){return this._container?.style.maxWidth}setMaxWidth(e){return this.options.maxWidth=e,this._update(),this}setDOMContent(e){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=maplibre_gl_W.create(`div`,`maplibregl-popup-content`,this._container);return this._content.appendChild(e),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(e){return this._container&&this._container.classList.add(e),this}removeClassName(e){return this._container&&this._container.classList.remove(e),this}setOffset(e){return this.options.offset=e,this._update(),this}toggleClassName(e){if(this._container)return this._container.classList.toggle(e)}setSubpixelPositioning(e){this.options.subpixelPositioning=e}setPadding(e){this.options.padding=e,this._update()}_createCloseButton(){this.options.closeButton&&(this._closeButton=maplibre_gl_W.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;let e=this._container.querySelector(maplibre_gl_ch);e&&e.focus()}};function maplibre_gl_dh(e){if(!e)return maplibre_gl_dh(new maplibre_gl_shared_l(0,0));if(typeof e==`number`){let t=Math.round(Math.abs(e)/Math.SQRT2);return{center:new maplibre_gl_shared_l(0,0),top:new maplibre_gl_shared_l(0,e),"top-left":new maplibre_gl_shared_l(t,t),"top-right":new maplibre_gl_shared_l(-t,t),bottom:new maplibre_gl_shared_l(0,-e),"bottom-left":new maplibre_gl_shared_l(t,-t),"bottom-right":new maplibre_gl_shared_l(-t,-t),left:new maplibre_gl_shared_l(e,0),right:new maplibre_gl_shared_l(-e,0)}}if(e instanceof maplibre_gl_shared_l||Array.isArray(e)){let t=maplibre_gl_shared_l.convert(e);return{center:t,top:t,"top-left":t,"top-right":t,bottom:t,"bottom-left":t,"bottom-right":t,left:t,right:t}}return{center:maplibre_gl_shared_l.convert(e.center||[0,0]),top:maplibre_gl_shared_l.convert(e.top||[0,0]),"top-left":maplibre_gl_shared_l.convert(e[`top-left`]||[0,0]),"top-right":maplibre_gl_shared_l.convert(e[`top-right`]||[0,0]),bottom:maplibre_gl_shared_l.convert(e.bottom||[0,0]),"bottom-left":maplibre_gl_shared_l.convert(e[`bottom-left`]||[0,0]),"bottom-right":maplibre_gl_shared_l.convert(e[`bottom-right`]||[0,0]),left:maplibre_gl_shared_l.convert(e.left||[0,0]),right:maplibre_gl_shared_l.convert(e.right||[0,0])}}function maplibre_gl_fh(e){return e?{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}:{top:0,right:0,bottom:0,left:0}}const maplibre_gl_ph=(/* unused pure expression or super */ null && (maplibre_gl_Mr));function maplibre_gl_mh(e,t){return maplibre_gl_mo().setRTLTextPlugin(e,t)}function maplibre_gl_hh(){return maplibre_gl_mo().getRTLTextPluginStatus()}function maplibre_gl_gh(){return maplibre_gl_ph}function maplibre_gl_h(){return maplibre_gl_$i.workerCount}function maplibre_gl_vh(e){maplibre_gl_$i.workerCount=e}function maplibre_gl_yh(){return maplibre_gl_vn.MAX_PARALLEL_IMAGE_REQUESTS}function maplibre_gl_bh(e){maplibre_gl_vn.MAX_PARALLEL_IMAGE_REQUESTS=e}function maplibre_gl_xh(){return maplibre_gl_vn.WORKER_URL}function maplibre_gl_Sh(e){maplibre_gl_vn.WORKER_URL=e}async function maplibre_gl_Ch(e){await maplibre_gl_sa().broadcast(`IS`,e)}
12215
+ `),x=l.createShader(l.FRAGMENT_SHADER);if(l.isContextLost()){this.failedToCreate=!0;return}l.shaderSource(x,y),l.compileShader(x),l.attachShader(this.program,x);let S=l.createShader(l.VERTEX_SHADER);if(l.isContextLost()){this.failedToCreate=!0;return}l.shaderSource(S,b),l.compileShader(S),l.attachShader(this.program,S),this.attributes={};let C={};if(this.numAttributes=f.length,l.linkProgram(this.program),!l.getProgramParameter(this.program,l.LINK_STATUS)){if(l.isContextLost()){this.failedToCreate=!0;return}throw l.getShaderParameter(x,l.COMPILE_STATUS)?l.getShaderParameter(S,l.COMPILE_STATUS)?Error(`Program failed to link: ${l.getProgramInfoLog(this.program)}`):Error(`Could not compile vertex shader: ${l.getShaderInfoLog(S)}`):Error(`Could not compile fragment shader: ${l.getShaderInfoLog(x)}`)}maplibre_gl_Ol(l,this.program);let w=maplibre_gl_Vl(l,this.program);for(let e of f){if(!e)continue;let t=l.getAttribLocation(this.program,e);t>=0&&(this.attributes[e]={location:t,isInteger:w.has(e)})}l.deleteShader(S),l.deleteShader(x);for(let e of _)if(e&&!C[e]){let t=l.getUniformLocation(this.program,e);t&&(C[e]=t)}this.fixedUniforms=r(e,C),this.terrainUniforms=maplibre_gl_Sl(e,C),this.binderUniforms=n?n.getUniforms(e,C):[]}draw(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v){let y=e.gl;if(this.failedToCreate)return;if(e.program.set(this.program),e.setDepthMode(n),e.setStencilMode(r),e.setColorMode(i),e.setCullFace(a),s){e.activeTexture.set(y.TEXTURE2),y.bindTexture(y.TEXTURE_2D,s.depthTexture),e.activeTexture.set(y.TEXTURE3),y.bindTexture(y.TEXTURE_2D,s.texture);for(let e in this.terrainUniforms)this.terrainUniforms[e].set(s[e]);maplibre_gl_zl(e.terrainUniformBuffer,s)}if(c&&maplibre_gl_Fl(e.projectionUniformBuffer,c),o)for(let e in this.fixedUniforms)this.fixedUniforms[e].set(o[e]);h&&h.setUniforms(e,this.binderUniforms,p,{zoom:m});let b=0;switch(t){case y.LINES:b=2;break;case y.TRIANGLES:b=3;break;case y.LINE_STRIP:b=1}for(let n of f.get())n.vaos||={},n.vaos[l]||=new maplibre_gl_xl,n.vaos[l].bind(e,this,u,h?h.getPaintVertexBuffers():[],d,n.vertexOffset,g,_,v),y.drawElements(t,n.primitiveLength*b,y.UNSIGNED_SHORT,n.primitiveOffset*b*2)}};function maplibre_gl_Ul(e,t,n){let r=1/maplibre_gl_shared_N(n,1,t.transform.tileZoom),i=2**n.tileID.overscaledZ,a=n.tileSize*2**t.transform.tileZoom/i,o=a*(n.tileID.canonical.x+n.tileID.wrap*i),s=a*n.tileID.canonical.y;return{u_image:0,u_texsize:n.imageAtlasTexture.size,u_scale:[r,e.fromScale,e.toScale],u_fade:e.t,u_pixel_coord_upper:[o>>16,s>>16],u_pixel_coord_lower:[o&65535,s&65535]}}function maplibre_gl_Wl(e,t,n,r){let i=n.patternAtlas.getPattern(e.from.toString()),a=n.patternAtlas.getPattern(e.to.toString()),{width:o,height:s}=n.patternAtlas.getPixelSize(),c=2**r.tileID.overscaledZ,l=r.tileSize*2**n.transform.tileZoom/c,u=l*(r.tileID.canonical.x+r.tileID.wrap*c),d=l*r.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:i.tl,u_pattern_br_a:i.br,u_pattern_tl_b:a.tl,u_pattern_br_b:a.br,u_texsize:[o,s],u_mix:t.t,u_pattern_size_a:i.displaySize,u_pattern_size_b:a.displaySize,u_scale_a:t.fromScale,u_scale_b:t.toScale,u_tile_units_to_pixels:1/maplibre_gl_shared_N(r,1,n.transform.tileZoom),u_pixel_coord_upper:[u>>16,d>>16],u_pixel_coord_lower:[u&65535,d&65535]}}const maplibre_gl_Gl=(e,t)=>({u_lightpos:new dist_maplibre_gl_shared_u(e,t.u_lightpos),u_lightpos_globe:new dist_maplibre_gl_shared_u(e,t.u_lightpos_globe),u_lightintensity:new maplibre_gl_shared_hu(e,t.u_lightintensity),u_lightcolor:new dist_maplibre_gl_shared_u(e,t.u_lightcolor),u_vertical_gradient:new maplibre_gl_shared_hu(e,t.u_vertical_gradient),u_opacity:new maplibre_gl_shared_hu(e,t.u_opacity),u_fill_translate:new maplibre_gl_shared_gu(e,t.u_fill_translate)}),maplibre_gl_Kl=(e,t)=>({u_lightpos:new dist_maplibre_gl_shared_u(e,t.u_lightpos),u_lightpos_globe:new dist_maplibre_gl_shared_u(e,t.u_lightpos_globe),u_lightintensity:new maplibre_gl_shared_hu(e,t.u_lightintensity),u_lightcolor:new dist_maplibre_gl_shared_u(e,t.u_lightcolor),u_vertical_gradient:new maplibre_gl_shared_hu(e,t.u_vertical_gradient),u_height_factor:new maplibre_gl_shared_hu(e,t.u_height_factor),u_opacity:new maplibre_gl_shared_hu(e,t.u_opacity),u_fill_translate:new maplibre_gl_shared_gu(e,t.u_fill_translate),u_image:new maplibre_gl_shared_mu(e,t.u_image),u_texsize:new maplibre_gl_shared_gu(e,t.u_texsize),u_pixel_coord_upper:new maplibre_gl_shared_gu(e,t.u_pixel_coord_upper),u_pixel_coord_lower:new maplibre_gl_shared_gu(e,t.u_pixel_coord_lower),u_scale:new dist_maplibre_gl_shared_u(e,t.u_scale),u_fade:new maplibre_gl_shared_hu(e,t.u_fade)}),maplibre_gl_ql=(e,t,n,r)=>{let i=e.style.light,a=i.getCartesianPosition(),o=maplibre_gl_shared_g();i.properties.get(`anchor`)===`viewport`&&maplibre_gl_shared_v(o,e.transform.bearingInRadians),maplibre_gl_shared_be(a,a,o);let s=e.transform.transformLightDirection(a),c=i.properties.get(`color`);return{u_lightpos:a,u_lightpos_globe:s,u_lightintensity:i.properties.get(`intensity`),u_lightcolor:[c.r,c.g,c.b],u_vertical_gradient:+t,u_opacity:n,u_fill_translate:r}},maplibre_gl_Jl=(e,t,n,r,i,a,o)=>maplibre_gl_shared_xt(maplibre_gl_ql(e,t,n,r),maplibre_gl_Ul(a,e,o),{u_height_factor:-(2**i.overscaledZ)/o.tileSize/8}),maplibre_gl_Yl=(e,t)=>({u_fill_translate:new maplibre_gl_shared_gu(e,t.u_fill_translate)}),maplibre_gl_Xl=(e,t)=>({u_image:new maplibre_gl_shared_mu(e,t.u_image),u_texsize:new maplibre_gl_shared_gu(e,t.u_texsize),u_pixel_coord_upper:new maplibre_gl_shared_gu(e,t.u_pixel_coord_upper),u_pixel_coord_lower:new maplibre_gl_shared_gu(e,t.u_pixel_coord_lower),u_scale:new dist_maplibre_gl_shared_u(e,t.u_scale),u_fade:new maplibre_gl_shared_hu(e,t.u_fade),u_sdf_pattern:new maplibre_gl_shared_mu(e,t.u_sdf_pattern),u_fill_translate:new maplibre_gl_shared_gu(e,t.u_fill_translate)}),maplibre_gl_Zl=(e,t)=>({u_fill_translate:new maplibre_gl_shared_gu(e,t.u_fill_translate)}),maplibre_gl_Ql=(e,t)=>({u_image:new maplibre_gl_shared_mu(e,t.u_image),u_texsize:new maplibre_gl_shared_gu(e,t.u_texsize),u_pixel_coord_upper:new maplibre_gl_shared_gu(e,t.u_pixel_coord_upper),u_pixel_coord_lower:new maplibre_gl_shared_gu(e,t.u_pixel_coord_lower),u_scale:new dist_maplibre_gl_shared_u(e,t.u_scale),u_fade:new maplibre_gl_shared_hu(e,t.u_fade),u_sdf_pattern:new maplibre_gl_shared_mu(e,t.u_sdf_pattern),u_fill_translate:new maplibre_gl_shared_gu(e,t.u_fill_translate)}),maplibre_gl_$l=(e,t,n,r,i)=>maplibre_gl_shared_xt(maplibre_gl_Ul(t,e,n),{u_fill_translate:r,u_sdf_pattern:+!!i}),maplibre_gl_eu=e=>({u_fill_translate:e}),maplibre_gl_tu=e=>({u_fill_translate:e}),maplibre_gl_nu=(e,t,n,r,i)=>maplibre_gl_$l(e,t,n,r,i),maplibre_gl_ru=(e,t)=>({u_scale_with_map:new maplibre_gl_shared_mu(e,t.u_scale_with_map),u_pitch_with_map:new maplibre_gl_shared_mu(e,t.u_pitch_with_map),u_extrude_scale:new maplibre_gl_shared_gu(e,t.u_extrude_scale),u_globe_extrude_scale:new maplibre_gl_shared_hu(e,t.u_globe_extrude_scale),u_translate:new maplibre_gl_shared_gu(e,t.u_translate)}),maplibre_gl_iu=(e,t,n,r,i)=>{let a=e.transform,o,s,c=0;if(n.paint.get(`circle-pitch-alignment`)===`map`){let e=maplibre_gl_shared_N(t,1,a.zoom);o=!0,s=[e,e],c=e/((/* inlined export .Rr */8192)*2**t.tileID.overscaledZ)*2*Math.PI*i}else o=!1,s=a.pixelsToGLUnits;return{u_scale_with_map:+(n.paint.get(`circle-pitch-scale`)===`map`),u_pitch_with_map:+o,u_extrude_scale:s,u_globe_extrude_scale:c,u_translate:r}},maplibre_gl_au=(e,t)=>({u_color:new maplibre_gl_shared_yu(e,t.u_color),u_overlay:new maplibre_gl_shared_mu(e,t.u_overlay),u_overlay_scale:new maplibre_gl_shared_hu(e,t.u_overlay_scale)}),maplibre_gl_ou=(e,t=1)=>({u_color:e,u_overlay:0,u_overlay_scale:t}),maplibre_gl_su=(e,t)=>({u_extrude_scale:new maplibre_gl_shared_hu(e,t.u_extrude_scale),u_intensity:new maplibre_gl_shared_hu(e,t.u_intensity),u_globe_extrude_scale:new maplibre_gl_shared_hu(e,t.u_globe_extrude_scale)}),maplibre_gl_cu=(e,t)=>({u_matrix:new maplibre_gl_shared_Cu(e,t.u_matrix),u_image:new maplibre_gl_shared_mu(e,t.u_image),u_color_ramp:new maplibre_gl_shared_mu(e,t.u_color_ramp),u_opacity:new maplibre_gl_shared_hu(e,t.u_opacity)}),maplibre_gl_lu=(e,t,n,r)=>{let i=maplibre_gl_shared_N(e,1,t)/((/* inlined export .Rr */8192)*2**e.tileID.overscaledZ)*2*Math.PI*r;return{u_extrude_scale:maplibre_gl_shared_N(e,1,t),u_intensity:n,u_globe_extrude_scale:i}},maplibre_gl_uu=(e,t,n,r)=>{let i=maplibre_gl_shared_b();return maplibre_gl_shared_ie(i,0,e.width,e.height,0,0,1),{u_matrix:i,u_image:n,u_color_ramp:r,u_opacity:t.paint.get(`heatmap-opacity`)}},maplibre_gl_du=(e,t)=>({u_image:new maplibre_gl_shared_mu(e,t.u_image),u_latrange:new maplibre_gl_shared_gu(e,t.u_latrange),u_exaggeration:new maplibre_gl_shared_hu(e,t.u_exaggeration),u_altitudes:new maplibre_gl_shared_xu(e,t.u_altitudes),u_azimuths:new maplibre_gl_shared_xu(e,t.u_azimuths),u_accent:new maplibre_gl_shared_yu(e,t.u_accent),u_method:new maplibre_gl_shared_mu(e,t.u_method),u_shadows:new maplibre_gl_shared_bu(e,t.u_shadows),u_highlights:new maplibre_gl_shared_bu(e,t.u_highlights)}),maplibre_gl_fu=(e,t)=>({u_matrix:new maplibre_gl_shared_Cu(e,t.u_matrix),u_image:new maplibre_gl_shared_mu(e,t.u_image),u_dimension:new maplibre_gl_shared_gu(e,t.u_dimension),u_zoom:new maplibre_gl_shared_hu(e,t.u_zoom),u_unpack:new maplibre_gl_shared_vu(e,t.u_unpack)}),maplibre_gl_pu=(e,t,n)=>{let r=n.paint.get(`hillshade-accent-color`),i;switch(n.paint.get(`hillshade-method`)){case`basic`:i=4;break;case`combined`:i=1;break;case`igor`:i=2;break;case`multidirectional`:i=3;break;default:i=0}let a=n.getIlluminationProperties();for(let t=0;t<a.directionRadians.length;t++)n.paint.get(`hillshade-illumination-anchor`)===`viewport`&&(a.directionRadians[t]+=e.transform.bearingInRadians);return{u_image:0,u_latrange:maplibre_gl_hu(e,t.tileID),u_exaggeration:n.paint.get(`hillshade-exaggeration`),u_altitudes:a.altitudeRadians,u_azimuths:a.directionRadians,u_accent:r,u_method:i,u_highlights:a.highlightColor,u_shadows:a.shadowColor}},maplibre_gl_mu=(e,t)=>{let n=t.stride,r=maplibre_gl_shared_b();return maplibre_gl_shared_ie(r,0,(/* inlined export .Rr */8192),-(/* inlined export .Rr */8192),0,0,1),maplibre_gl_shared_E(r,r,[0,-(/* inlined export .Rr */8192),0]),{u_matrix:r,u_image:1,u_dimension:[n,n],u_zoom:e.overscaledZ,u_unpack:t.getUnpackVector()}};function maplibre_gl_hu(e,t){let n=2**t.canonical.z,r=t.canonical.y;return[new maplibre_gl_shared_Hp(0,r/n).toLngLat().lat,new maplibre_gl_shared_Hp(0,(r+1)/n).toLngLat().lat]}const maplibre_gl_gu=(e,t)=>({u_image:new maplibre_gl_shared_mu(e,t.u_image),u_unpack:new maplibre_gl_shared_vu(e,t.u_unpack),u_dimension:new maplibre_gl_shared_gu(e,t.u_dimension),u_elevation_stops:new maplibre_gl_shared_mu(e,t.u_elevation_stops),u_color_stops:new maplibre_gl_shared_mu(e,t.u_color_stops),u_color_ramp_size:new maplibre_gl_shared_mu(e,t.u_color_ramp_size),u_opacity:new maplibre_gl_shared_hu(e,t.u_opacity)}),maplibre_gl_u=(e,t,n=0)=>({u_image:0,u_unpack:t.getUnpackVector(),u_dimension:[t.stride,t.stride],u_elevation_stops:1,u_color_stops:4,u_color_ramp_size:n,u_opacity:e.paint.get(`color-relief-opacity`)}),maplibre_gl_vu=(e,t)=>({u_translation:new maplibre_gl_shared_gu(e,t.u_translation),u_ratio:new maplibre_gl_shared_hu(e,t.u_ratio)}),maplibre_gl_yu=(e,t)=>({u_translation:new maplibre_gl_shared_gu(e,t.u_translation),u_ratio:new maplibre_gl_shared_hu(e,t.u_ratio),u_image:new maplibre_gl_shared_mu(e,t.u_image),u_image_height:new maplibre_gl_shared_hu(e,t.u_image_height)}),maplibre_gl_bu=(e,t)=>({u_translation:new maplibre_gl_shared_gu(e,t.u_translation),u_texsize:new maplibre_gl_shared_gu(e,t.u_texsize),u_ratio:new maplibre_gl_shared_hu(e,t.u_ratio),u_image:new maplibre_gl_shared_mu(e,t.u_image),u_scale:new dist_maplibre_gl_shared_u(e,t.u_scale),u_fade:new maplibre_gl_shared_hu(e,t.u_fade)}),maplibre_gl_xu=(e,t)=>({u_translation:new maplibre_gl_shared_gu(e,t.u_translation),u_ratio:new maplibre_gl_shared_hu(e,t.u_ratio),u_image:new maplibre_gl_shared_mu(e,t.u_image),u_mix:new maplibre_gl_shared_hu(e,t.u_mix),u_tileratio:new maplibre_gl_shared_hu(e,t.u_tileratio),u_crossfade_from:new maplibre_gl_shared_hu(e,t.u_crossfade_from),u_crossfade_to:new maplibre_gl_shared_hu(e,t.u_crossfade_to),u_lineatlas_width:new maplibre_gl_shared_hu(e,t.u_lineatlas_width),u_lineatlas_height:new maplibre_gl_shared_hu(e,t.u_lineatlas_height)}),maplibre_gl_Su=(e,t)=>({u_translation:new maplibre_gl_shared_gu(e,t.u_translation),u_ratio:new maplibre_gl_shared_hu(e,t.u_ratio),u_image:new maplibre_gl_shared_mu(e,t.u_image),u_image_height:new maplibre_gl_shared_hu(e,t.u_image_height),u_tileratio:new maplibre_gl_shared_hu(e,t.u_tileratio),u_crossfade_from:new maplibre_gl_shared_hu(e,t.u_crossfade_from),u_crossfade_to:new maplibre_gl_shared_hu(e,t.u_crossfade_to),u_image_dash:new maplibre_gl_shared_mu(e,t.u_image_dash),u_mix:new maplibre_gl_shared_hu(e,t.u_mix),u_lineatlas_width:new maplibre_gl_shared_hu(e,t.u_lineatlas_width),u_lineatlas_height:new maplibre_gl_shared_hu(e,t.u_lineatlas_height)}),maplibre_gl_Cu=(e,t,n,r)=>{let i=e.transform;return{u_translation:maplibre_gl_ku(e,t,n),u_ratio:r/maplibre_gl_shared_N(t,1,i.zoom)}},maplibre_gl_wu=(e,t,n,r,i)=>maplibre_gl_shared_xt(maplibre_gl_Cu(e,t,n,r),{u_image:0,u_image_height:i}),maplibre_gl_Tu=(e,t,n,r,i)=>{let a=e.transform,o=maplibre_gl_Ou(t,a);return{u_translation:maplibre_gl_ku(e,t,n),u_texsize:t.imageAtlasTexture.size,u_ratio:r/maplibre_gl_shared_N(t,1,a.zoom),u_image:0,u_scale:[o,i.fromScale,i.toScale],u_fade:i.t}},maplibre_gl_Eu=(e,t,n,r,i)=>{let a=e.transform,o=maplibre_gl_Ou(t,a);return maplibre_gl_shared_xt(maplibre_gl_Cu(e,t,n,r),{u_tileratio:o,u_crossfade_from:i.fromScale,u_crossfade_to:i.toScale,u_image:0,u_mix:i.t,u_lineatlas_width:e.lineAtlas.width,u_lineatlas_height:e.lineAtlas.height})},maplibre_gl_Du=(e,t,n,r,i,a)=>{let o=e.transform,s=maplibre_gl_Ou(t,o);return maplibre_gl_shared_xt(maplibre_gl_Cu(e,t,n,r),{u_image:0,u_image_height:a,u_tileratio:s,u_crossfade_from:i.fromScale,u_crossfade_to:i.toScale,u_image_dash:1,u_mix:i.t,u_lineatlas_width:e.lineAtlas.width,u_lineatlas_height:e.lineAtlas.height})};function maplibre_gl_Ou(e,t){return 1/maplibre_gl_shared_N(e,1,t.tileZoom)}function maplibre_gl_ku(e,t,n){return maplibre_gl_shared_it(e.transform,t,n.paint.get(`line-translate`),n.paint.get(`line-translate-anchor`))}const maplibre_gl_Au=(e,t)=>({u_image:new maplibre_gl_shared_mu(e,t.u_image),u_opacity:new maplibre_gl_shared_hu(e,t.u_opacity)}),maplibre_gl_ju=(e,t)=>({u_image:t,u_opacity:e}),maplibre_gl_Mu=(e,t)=>({u_is_size_zoom_constant:new maplibre_gl_shared_mu(e,t.u_is_size_zoom_constant),u_is_size_feature_constant:new maplibre_gl_shared_mu(e,t.u_is_size_feature_constant),u_size_t:new maplibre_gl_shared_hu(e,t.u_size_t),u_size:new maplibre_gl_shared_hu(e,t.u_size),u_rotate_symbol:new maplibre_gl_shared_mu(e,t.u_rotate_symbol),u_label_plane_matrix:new maplibre_gl_shared_Cu(e,t.u_label_plane_matrix),u_coord_matrix:new maplibre_gl_shared_Cu(e,t.u_coord_matrix),u_is_text:new maplibre_gl_shared_mu(e,t.u_is_text),u_pitch_with_map:new maplibre_gl_shared_mu(e,t.u_pitch_with_map),u_is_along_line:new maplibre_gl_shared_mu(e,t.u_is_along_line),u_is_variable_anchor:new maplibre_gl_shared_mu(e,t.u_is_variable_anchor),u_texsize:new maplibre_gl_shared_gu(e,t.u_texsize),u_texture:new maplibre_gl_shared_mu(e,t.u_texture),u_translation:new maplibre_gl_shared_gu(e,t.u_translation),u_pitched_scale:new maplibre_gl_shared_hu(e,t.u_pitched_scale),u_is_offset:new maplibre_gl_shared_mu(e,t.u_is_offset),u_height_anchor_ground:new maplibre_gl_shared_mu(e,t.u_height_anchor_ground)}),maplibre_gl_Nu=(e,t)=>({u_is_size_zoom_constant:new maplibre_gl_shared_mu(e,t.u_is_size_zoom_constant),u_is_size_feature_constant:new maplibre_gl_shared_mu(e,t.u_is_size_feature_constant),u_size_t:new maplibre_gl_shared_hu(e,t.u_size_t),u_size:new maplibre_gl_shared_hu(e,t.u_size),u_rotate_symbol:new maplibre_gl_shared_mu(e,t.u_rotate_symbol),u_label_plane_matrix:new maplibre_gl_shared_Cu(e,t.u_label_plane_matrix),u_coord_matrix:new maplibre_gl_shared_Cu(e,t.u_coord_matrix),u_is_text:new maplibre_gl_shared_mu(e,t.u_is_text),u_pitch_with_map:new maplibre_gl_shared_mu(e,t.u_pitch_with_map),u_is_along_line:new maplibre_gl_shared_mu(e,t.u_is_along_line),u_is_variable_anchor:new maplibre_gl_shared_mu(e,t.u_is_variable_anchor),u_texsize:new maplibre_gl_shared_gu(e,t.u_texsize),u_texture:new maplibre_gl_shared_mu(e,t.u_texture),u_gamma_scale:new maplibre_gl_shared_hu(e,t.u_gamma_scale),u_is_halo:new maplibre_gl_shared_mu(e,t.u_is_halo),u_is_plain:new maplibre_gl_shared_mu(e,t.u_is_plain),u_translation:new maplibre_gl_shared_gu(e,t.u_translation),u_pitched_scale:new maplibre_gl_shared_hu(e,t.u_pitched_scale),u_is_offset:new maplibre_gl_shared_mu(e,t.u_is_offset),u_height_anchor_ground:new maplibre_gl_shared_mu(e,t.u_height_anchor_ground)}),maplibre_gl_Pu=(e,t)=>({u_is_size_zoom_constant:new maplibre_gl_shared_mu(e,t.u_is_size_zoom_constant),u_is_size_feature_constant:new maplibre_gl_shared_mu(e,t.u_is_size_feature_constant),u_size_t:new maplibre_gl_shared_hu(e,t.u_size_t),u_size:new maplibre_gl_shared_hu(e,t.u_size),u_rotate_symbol:new maplibre_gl_shared_mu(e,t.u_rotate_symbol),u_label_plane_matrix:new maplibre_gl_shared_Cu(e,t.u_label_plane_matrix),u_coord_matrix:new maplibre_gl_shared_Cu(e,t.u_coord_matrix),u_is_text:new maplibre_gl_shared_mu(e,t.u_is_text),u_pitch_with_map:new maplibre_gl_shared_mu(e,t.u_pitch_with_map),u_is_along_line:new maplibre_gl_shared_mu(e,t.u_is_along_line),u_is_variable_anchor:new maplibre_gl_shared_mu(e,t.u_is_variable_anchor),u_texsize:new maplibre_gl_shared_gu(e,t.u_texsize),u_texsize_icon:new maplibre_gl_shared_gu(e,t.u_texsize_icon),u_texture:new maplibre_gl_shared_mu(e,t.u_texture),u_texture_icon:new maplibre_gl_shared_mu(e,t.u_texture_icon),u_gamma_scale:new maplibre_gl_shared_hu(e,t.u_gamma_scale),u_is_halo:new maplibre_gl_shared_mu(e,t.u_is_halo),u_translation:new maplibre_gl_shared_gu(e,t.u_translation),u_pitched_scale:new maplibre_gl_shared_hu(e,t.u_pitched_scale),u_is_offset:new maplibre_gl_shared_mu(e,t.u_is_offset),u_height_anchor_ground:new maplibre_gl_shared_mu(e,t.u_height_anchor_ground)}),maplibre_gl_Fu=(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m)=>({u_is_size_zoom_constant:+(e===`constant`||e===`source`),u_is_size_feature_constant:+(e===`constant`||e===`camera`),u_size_t:t?t.uSizeT:0,u_size:t?t.uSize:0,u_rotate_symbol:+n,u_label_plane_matrix:s,u_coord_matrix:c,u_is_text:+u,u_pitch_with_map:+r,u_is_along_line:i,u_is_variable_anchor:a,u_texsize:d,u_texture:0,u_translation:l,u_pitched_scale:f,u_is_offset:p,u_height_anchor_ground:+m}),maplibre_gl_Iu=(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h)=>{let g=o.transform;return maplibre_gl_shared_xt(maplibre_gl_Fu(e,t,n,r,i,a,o,s,c,l,u,d,p,m,h),{u_gamma_scale:r?Math.cos(g.pitch*Math.PI/180)*g.cameraToCenterDistance:1,u_is_halo:+!!f,u_is_plain:1})},maplibre_gl_Lu=(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m)=>maplibre_gl_shared_xt(maplibre_gl_Iu(e,t,n,r,i,a,o,s,c,l,!0,u,!0,f,p,m),{u_texsize_icon:d,u_texture_icon:1}),maplibre_gl_Ru=(e,t)=>({u_opacity:new maplibre_gl_shared_hu(e,t.u_opacity),u_color:new maplibre_gl_shared_yu(e,t.u_color)}),maplibre_gl_zu=(e,t)=>({u_opacity:new maplibre_gl_shared_hu(e,t.u_opacity),u_image:new maplibre_gl_shared_mu(e,t.u_image),u_pattern_tl_a:new maplibre_gl_shared_gu(e,t.u_pattern_tl_a),u_pattern_br_a:new maplibre_gl_shared_gu(e,t.u_pattern_br_a),u_pattern_tl_b:new maplibre_gl_shared_gu(e,t.u_pattern_tl_b),u_pattern_br_b:new maplibre_gl_shared_gu(e,t.u_pattern_br_b),u_texsize:new maplibre_gl_shared_gu(e,t.u_texsize),u_mix:new maplibre_gl_shared_hu(e,t.u_mix),u_pattern_size_a:new maplibre_gl_shared_gu(e,t.u_pattern_size_a),u_pattern_size_b:new maplibre_gl_shared_gu(e,t.u_pattern_size_b),u_scale_a:new maplibre_gl_shared_hu(e,t.u_scale_a),u_scale_b:new maplibre_gl_shared_hu(e,t.u_scale_b),u_pixel_coord_upper:new maplibre_gl_shared_gu(e,t.u_pixel_coord_upper),u_pixel_coord_lower:new maplibre_gl_shared_gu(e,t.u_pixel_coord_lower),u_tile_units_to_pixels:new maplibre_gl_shared_hu(e,t.u_tile_units_to_pixels)}),maplibre_gl_Bu=(e,t)=>({u_opacity:e,u_color:t}),maplibre_gl_Vu=(e,t,n,r,i)=>maplibre_gl_shared_xt(maplibre_gl_Wl(n,i,t,r),{u_opacity:e}),maplibre_gl_Hu=(e,t)=>({u_sun_pos:new dist_maplibre_gl_shared_u(e,t.u_sun_pos),u_atmosphere_blend:new maplibre_gl_shared_hu(e,t.u_atmosphere_blend),u_globe_position:new dist_maplibre_gl_shared_u(e,t.u_globe_position),u_globe_radius:new maplibre_gl_shared_hu(e,t.u_globe_radius),u_inv_proj_matrix:new maplibre_gl_shared_Cu(e,t.u_inv_proj_matrix)}),maplibre_gl_Uu=(e,t,n,r,i)=>({u_sun_pos:e,u_atmosphere_blend:t,u_globe_position:n,u_globe_radius:r,u_inv_proj_matrix:i}),maplibre_gl_Wu=(e,t)=>({u_sky_color:new maplibre_gl_shared_yu(e,t.u_sky_color),u_horizon_color:new maplibre_gl_shared_yu(e,t.u_horizon_color),u_horizon:new maplibre_gl_shared_gu(e,t.u_horizon),u_horizon_normal:new maplibre_gl_shared_gu(e,t.u_horizon_normal),u_sky_horizon_blend:new maplibre_gl_shared_hu(e,t.u_sky_horizon_blend),u_sky_blend:new maplibre_gl_shared_hu(e,t.u_sky_blend),u_inv_proj_matrix:new maplibre_gl_shared_Cu(e,t.u_inv_proj_matrix),u_globe_position:new dist_maplibre_gl_shared_u(e,t.u_globe_position),u_globe_radius:new maplibre_gl_shared_hu(e,t.u_globe_radius)}),maplibre_gl_Gu=(e,t,n)=>{let r=Math.cos(t.rollInRadians),i=Math.sin(t.rollInRadians),a=maplibre_gl_shared_Jp(t),o=t.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}).projectionTransition;return{u_sky_color:e.properties.get(`sky-color`),u_horizon_color:e.properties.get(`horizon-color`),u_horizon:[(t.width/2-a*i)*n,(t.height/2+a*r)*n],u_horizon_normal:[-i,r],u_sky_horizon_blend:e.properties.get(`sky-horizon-blend`)*t.height/2*n,u_sky_blend:o,u_inv_proj_matrix:t.inverseProjectionMatrix,u_globe_position:maplibre_gl_Vc(t),u_globe_radius:maplibre_gl_Bc(t.worldSize,t.center.lat)}},maplibre_gl_Ku=(e,t)=>({}),maplibre_gl_qu={fillExtrusion:maplibre_gl_Gl,fillExtrusionPattern:maplibre_gl_Kl,fill:maplibre_gl_Yl,fillPattern:maplibre_gl_Xl,fillOutline:maplibre_gl_Zl,fillOutlinePattern:maplibre_gl_Ql,circle:maplibre_gl_ru,collisionBox:maplibre_gl_Ku,collisionCircle:maplibre_gl_Ku,debug:maplibre_gl_au,depth:maplibre_gl_Ku,clippingMask:maplibre_gl_Ku,heatmap:maplibre_gl_su,heatmapTexture:maplibre_gl_cu,hillshade:maplibre_gl_du,hillshadePrepare:maplibre_gl_fu,colorRelief:maplibre_gl_gu,line:maplibre_gl_vu,lineGradient:maplibre_gl_yu,linePattern:maplibre_gl_bu,lineSDF:maplibre_gl_xu,lineGradientSDF:maplibre_gl_Su,layerOpacity:maplibre_gl_Au,raster:maplibre_gl_Ba,symbolIcon:maplibre_gl_Mu,symbolSDF:maplibre_gl_Nu,symbolTextAndIcon:maplibre_gl_Pu,background:maplibre_gl_Ru,backgroundPattern:maplibre_gl_zu,terrain:maplibre_gl_Cl,terrainDepth:maplibre_gl_wl,atmosphere:maplibre_gl_Hu,sky:maplibre_gl_Wu};var maplibre_gl_Ju=class{constructor(e,t,n){this.context=e;let r=e.gl;this.buffer=r.createBuffer(),this.dynamicDraw=!!n,this.context.unbindVAO(),e.bindElementBuffer.set(this.buffer),r.bufferData(r.ELEMENT_ARRAY_BUFFER,t.arrayBuffer,this.dynamicDraw?r.DYNAMIC_DRAW:r.STATIC_DRAW),this.dynamicDraw||t.freeBufferAfterUpload()}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(e){let t=this.context.gl;if(!this.dynamicDraw)throw Error(`Attempted to update data while not in dynamic mode.`);this.context.unbindVAO(),this.bind(),t.bufferSubData(t.ELEMENT_ARRAY_BUFFER,0,e.arrayBuffer)}destroy(){let e=this.context.gl;this.buffer&&(e.deleteBuffer(this.buffer),delete this.buffer)}};const maplibre_gl_Yu={Int8:`BYTE`,Uint8:`UNSIGNED_BYTE`,Int16:`SHORT`,Uint16:`UNSIGNED_SHORT`,Int32:`INT`,Uint32:`UNSIGNED_INT`,Float32:`FLOAT`};var maplibre_gl_Xu=class{constructor(e,t,n,r){this.length=t.length,this.attributes=n,this.itemSize=t.bytesPerElement,this.dynamicDraw=r,this.context=e;let i=e.gl;this.buffer=i.createBuffer(),e.bindVertexBuffer.set(this.buffer),i.bufferData(i.ARRAY_BUFFER,t.arrayBuffer,this.dynamicDraw?i.DYNAMIC_DRAW:i.STATIC_DRAW),this.dynamicDraw||t.freeBufferAfterUpload()}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(e){if(e.length!==this.length)throw Error(`Length of new data is ${e.length}, which doesn't match current length of ${this.length}`);let t=this.context.gl;this.bind(),t.bufferSubData(t.ARRAY_BUFFER,0,e.arrayBuffer)}enableAttributes(e,t){for(let n of this.attributes){let r=t.attributes[n.name];r!==void 0&&e.enableVertexAttribArray(r.location)}}setVertexAttribPointers(e,t,n){for(let r of this.attributes){let i=t.attributes[r.name];if(i!==void 0){let t=r.offset+this.itemSize*(n||0);i.isInteger?e.vertexAttribIPointer(i.location,r.components,e[maplibre_gl_Yu[r.type]],this.itemSize,t):e.vertexAttribPointer(i.location,r.components,e[maplibre_gl_Yu[r.type]],!1,this.itemSize,t)}}}destroy(){let e=this.context.gl;this.buffer&&(e.deleteBuffer(this.buffer),delete this.buffer)}},maplibre_gl_X=class{constructor(e){this.gl=e.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(e){}getDefault(){return this.default}setDefault(){this.set(this.default)}},maplibre_gl_Zu=class extends maplibre_gl_X{getDefault(){return maplibre_gl_shared_V.transparent}set(e){let t=this.current;(e.r!==t.r||e.g!==t.g||e.b!==t.b||e.a!==t.a||this.dirty)&&(this.gl.clearColor(e.r,e.g,e.b,e.a),this.current=e,this.dirty=!1)}},maplibre_gl_Qu=class extends maplibre_gl_X{getDefault(){return 1}set(e){(e!==this.current||this.dirty)&&(this.gl.clearDepth(e),this.current=e,this.dirty=!1)}},maplibre_gl_$u=class extends maplibre_gl_X{getDefault(){return 0}set(e){(e!==this.current||this.dirty)&&(this.gl.clearStencil(e),this.current=e,this.dirty=!1)}},maplibre_gl_ed=class extends maplibre_gl_X{getDefault(){return[!0,!0,!0,!0]}set(e){let t=this.current;(e[0]!==t[0]||e[1]!==t[1]||e[2]!==t[2]||e[3]!==t[3]||this.dirty)&&(this.gl.colorMask(e[0],e[1],e[2],e[3]),this.current=e,this.dirty=!1)}},maplibre_gl_td=class extends maplibre_gl_X{getDefault(){return!0}set(e){(e!==this.current||this.dirty)&&(this.gl.depthMask(e),this.current=e,this.dirty=!1)}},maplibre_gl_nd=class extends maplibre_gl_X{getDefault(){return 255}set(e){(e!==this.current||this.dirty)&&(this.gl.stencilMask(e),this.current=e,this.dirty=!1)}},maplibre_gl_rd=class extends maplibre_gl_X{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(e){let t=this.current;(e.func!==t.func||e.ref!==t.ref||e.mask!==t.mask||this.dirty)&&(this.gl.stencilFunc(e.func,e.ref,e.mask),this.current=e,this.dirty=!1)}},maplibre_gl_id=class extends maplibre_gl_X{getDefault(){let e=this.gl;return[e.KEEP,e.KEEP,e.KEEP]}set(e){let t=this.current;(e[0]!==t[0]||e[1]!==t[1]||e[2]!==t[2]||this.dirty)&&(this.gl.stencilOp(e[0],e[1],e[2]),this.current=e,this.dirty=!1)}},maplibre_gl_ad=class extends maplibre_gl_X{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;e?t.enable(t.STENCIL_TEST):t.disable(t.STENCIL_TEST),this.current=e,this.dirty=!1}},maplibre_gl_od=class extends maplibre_gl_X{getDefault(){return[0,1]}set(e){let t=this.current;(e[0]!==t[0]||e[1]!==t[1]||this.dirty)&&(this.gl.depthRange(e[0],e[1]),this.current=e,this.dirty=!1)}},maplibre_gl_sd=class extends maplibre_gl_X{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;e?t.enable(t.DEPTH_TEST):t.disable(t.DEPTH_TEST),this.current=e,this.dirty=!1}},maplibre_gl_cd=class extends maplibre_gl_X{getDefault(){return this.gl.LESS}set(e){(e!==this.current||this.dirty)&&(this.gl.depthFunc(e),this.current=e,this.dirty=!1)}},maplibre_gl_ld=class extends maplibre_gl_X{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;e?t.enable(t.BLEND):t.disable(t.BLEND),this.current=e,this.dirty=!1}},maplibre_gl_ud=class extends maplibre_gl_X{getDefault(){let e=this.gl;return[e.ONE,e.ZERO]}set(e){let t=this.current;(e[0]!==t[0]||e[1]!==t[1]||this.dirty)&&(this.gl.blendFunc(e[0],e[1]),this.current=e,this.dirty=!1)}},maplibre_gl_dd=class extends maplibre_gl_X{getDefault(){return maplibre_gl_shared_V.transparent}set(e){let t=this.current;(e.r!==t.r||e.g!==t.g||e.b!==t.b||e.a!==t.a||this.dirty)&&(this.gl.blendColor(e.r,e.g,e.b,e.a),this.current=e,this.dirty=!1)}},maplibre_gl_fd=class extends maplibre_gl_X{getDefault(){return this.gl.FUNC_ADD}set(e){(e!==this.current||this.dirty)&&(this.gl.blendEquation(e),this.current=e,this.dirty=!1)}},maplibre_gl_pd=class extends maplibre_gl_X{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;e?t.enable(t.CULL_FACE):t.disable(t.CULL_FACE),this.current=e,this.dirty=!1}},maplibre_gl_md=class extends maplibre_gl_X{getDefault(){return this.gl.BACK}set(e){(e!==this.current||this.dirty)&&(this.gl.cullFace(e),this.current=e,this.dirty=!1)}},maplibre_gl_hd=class extends maplibre_gl_X{getDefault(){return this.gl.CCW}set(e){(e!==this.current||this.dirty)&&(this.gl.frontFace(e),this.current=e,this.dirty=!1)}},maplibre_gl_gd=class extends maplibre_gl_X{getDefault(){return null}set(e){(e!==this.current||this.dirty)&&(this.gl.useProgram(e),this.current=e,this.dirty=!1)}},maplibre_gl_d=class extends maplibre_gl_X{getDefault(){return this.gl.TEXTURE0}set(e){(e!==this.current||this.dirty)&&(this.gl.activeTexture(e),this.current=e,this.dirty=!1)}},maplibre_gl_vd=class extends maplibre_gl_X{getDefault(){let e=this.gl;return[0,0,e.drawingBufferWidth,e.drawingBufferHeight]}set(e){let t=this.current;(e[0]!==t[0]||e[1]!==t[1]||e[2]!==t[2]||e[3]!==t[3]||this.dirty)&&(this.gl.viewport(e[0],e[1],e[2],e[3]),this.current=e,this.dirty=!1)}},maplibre_gl_yd=class extends maplibre_gl_X{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;t.bindFramebuffer(t.FRAMEBUFFER,e),this.current=e,this.dirty=!1}},maplibre_gl_bd=class extends maplibre_gl_X{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;t.bindRenderbuffer(t.RENDERBUFFER,e),this.current=e,this.dirty=!1}},maplibre_gl_xd=class extends maplibre_gl_X{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;t.bindTexture(t.TEXTURE_2D,e),this.current=e,this.dirty=!1}},maplibre_gl_Sd=class extends maplibre_gl_X{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;t.bindBuffer(t.ARRAY_BUFFER,e),this.current=e,this.dirty=!1}},maplibre_gl_Cd=class extends maplibre_gl_X{getDefault(){return null}set(e){let t=this.gl;t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,e),this.current=e,this.dirty=!1}},maplibre_gl_wd=class extends maplibre_gl_X{getDefault(){return null}set(e){(e!==this.current||this.dirty)&&(this.gl.bindVertexArray(e),this.current=e,this.dirty=!1)}},maplibre_gl_Td=class extends maplibre_gl_X{getDefault(){return 4}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;t.pixelStorei(t.UNPACK_ALIGNMENT,e),this.current=e,this.dirty=!1}},maplibre_gl_Ed=class extends maplibre_gl_X{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e),this.current=e,this.dirty=!1}},maplibre_gl_Dd=class extends maplibre_gl_X{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,e),this.current=e,this.dirty=!1}},maplibre_gl_Od=class extends maplibre_gl_X{constructor(e,t){super(e),this.context=e,this.parent=t}getDefault(){return null}},maplibre_gl_kd=class extends maplibre_gl_Od{setDirty(){this.dirty=!0}set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let t=this.gl;t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,e,0),this.current=e,this.dirty=!1}},maplibre_gl_Ad=class extends maplibre_gl_Od{set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let t=this.gl;t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.RENDERBUFFER,e),this.current=e,this.dirty=!1}},maplibre_gl_jd=class extends maplibre_gl_Od{set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let t=this.gl;t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.RENDERBUFFER,e),this.current=e,this.dirty=!1}},maplibre_gl_Md=class{constructor(e,t,n,r,i){this.context=e,this.width=t,this.height=n;let a=e.gl,o=this.framebuffer=a.createFramebuffer();if(this.colorAttachment=new maplibre_gl_kd(e,o),r)this.depthAttachment=i?new maplibre_gl_jd(e,o):new maplibre_gl_Ad(e,o);else if(i)throw Error(`Stencil cannot be set without depth`)}destroy(){let e=this.context.gl,t=this.colorAttachment.get();if(t&&e.deleteTexture(t),this.depthAttachment){let t=this.depthAttachment.get();t&&e.deleteRenderbuffer(t)}e.deleteFramebuffer(this.framebuffer)}};const maplibre_gl_Nd=maplibre_gl_Al([{name:`u_units_to_pixels`,type:`vec2`},{name:`u_world_size`,type:`vec2`},{name:`u_camera_to_center_distance`,type:`float`},{name:`u_symbol_fade_change`,type:`float`},{name:`u_aspect_ratio`,type:`float`},{name:`u_device_pixel_ratio`,type:`float`},{name:`u_viewport_size`,type:`vec2`},{name:`u_pixel_extrude_scale`,type:`vec2`},{name:`u_pitch`,type:`float`}]),maplibre_gl_Pd=maplibre_gl_Nd.offsets;function maplibre_gl_Fd(e){return new maplibre_gl_jl(e,maplibre_gl_Dl.FrameUBO,maplibre_gl_Nd)}function maplibre_gl_Id(e,t){let n=e.pending,{transform:r}=t,i=t.context.gl;n[maplibre_gl_Pd.u_units_to_pixels]=1/r.pixelsToGLUnits[0],n[maplibre_gl_Pd.u_units_to_pixels+1]=1/r.pixelsToGLUnits[1],n[maplibre_gl_Pd.u_world_size]=i.drawingBufferWidth,n[maplibre_gl_Pd.u_world_size+1]=i.drawingBufferHeight,n[maplibre_gl_Pd.u_camera_to_center_distance]=r.cameraToCenterDistance,n[maplibre_gl_Pd.u_symbol_fade_change]=t.options.fadeDuration?t.symbolFadeChange:1,n[maplibre_gl_Pd.u_aspect_ratio]=r.width/r.height,n[maplibre_gl_Pd.u_device_pixel_ratio]=t.pixelRatio,n[maplibre_gl_Pd.u_viewport_size]=r.width,n[maplibre_gl_Pd.u_viewport_size+1]=r.height,n[maplibre_gl_Pd.u_pixel_extrude_scale]=1/r.width,n[maplibre_gl_Pd.u_pixel_extrude_scale+1]=1/r.height,n[maplibre_gl_Pd.u_pitch]=r.pitch/360*2*Math.PI,e.upload()}var maplibre_gl_Ld=class{constructor(e,t,n){this.blendFunction=e,this.blendColor=t,this.mask=n}};maplibre_gl_Ld.Replace=[1,0],maplibre_gl_Ld.disabled=new maplibre_gl_Ld(maplibre_gl_Ld.Replace,maplibre_gl_shared_V.transparent,[!1,!1,!1,!1]),maplibre_gl_Ld.unblended=new maplibre_gl_Ld(maplibre_gl_Ld.Replace,maplibre_gl_shared_V.transparent,[!0,!0,!0,!0]),maplibre_gl_Ld.alphaBlended=new maplibre_gl_Ld([1,771],maplibre_gl_shared_V.transparent,[!0,!0,!0,!0]);var maplibre_gl_Rd=class{constructor(e){this.gl=e,this.clearColor=new maplibre_gl_Zu(this),this.clearDepth=new maplibre_gl_Qu(this),this.clearStencil=new maplibre_gl_$u(this),this.colorMask=new maplibre_gl_ed(this),this.depthMask=new maplibre_gl_td(this),this.stencilMask=new maplibre_gl_nd(this),this.stencilFunc=new maplibre_gl_rd(this),this.stencilOp=new maplibre_gl_id(this),this.stencilTest=new maplibre_gl_ad(this),this.depthRange=new maplibre_gl_od(this),this.depthTest=new maplibre_gl_sd(this),this.depthFunc=new maplibre_gl_cd(this),this.blend=new maplibre_gl_ld(this),this.blendFunc=new maplibre_gl_ud(this),this.blendColor=new maplibre_gl_dd(this),this.blendEquation=new maplibre_gl_fd(this),this.cullFace=new maplibre_gl_pd(this),this.cullFaceSide=new maplibre_gl_md(this),this.frontFace=new maplibre_gl_hd(this),this.program=new maplibre_gl_gd(this),this.activeTexture=new maplibre_gl_d(this),this.viewport=new maplibre_gl_vd(this),this.bindFramebuffer=new maplibre_gl_yd(this),this.bindRenderbuffer=new maplibre_gl_bd(this),this.bindTexture=new maplibre_gl_xd(this),this.bindVertexBuffer=new maplibre_gl_Sd(this),this.bindElementBuffer=new maplibre_gl_Cd(this),this.bindVertexArray=new maplibre_gl_wd(this),this.pixelStoreUnpack=new maplibre_gl_Td(this),this.pixelStoreUnpackPremultiplyAlpha=new maplibre_gl_Ed(this),this.pixelStoreUnpackFlipY=new maplibre_gl_Dd(this),this.extTextureFilterAnisotropic=e.getExtension(`EXT_texture_filter_anisotropic`),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=e.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),this.maxTextureSize=e.getParameter(e.MAX_TEXTURE_SIZE),e.getExtension(`EXT_color_buffer_half_float`),e.getExtension(`EXT_color_buffer_float`),this.projectionUniformBuffer=maplibre_gl_Pl(this),this.terrainUniformBuffer=maplibre_gl_Rl(this),this.frameUniformBuffer=maplibre_gl_Fd(this)}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,this.projectionUniformBuffer.bindingDirty=!0,this.terrainUniformBuffer.bindingDirty=!0,this.frameUniformBuffer.bindingDirty=!0}setCustomLayerDefaults(){this.unbindVAO(),this.cullFace.setDefault(),this.activeTexture.setDefault(),this.pixelStoreUnpack.setDefault(),this.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.pixelStoreUnpackFlipY.setDefault()}createIndexBuffer(e,t){return new maplibre_gl_Ju(this,e,t)}createVertexBuffer(e,t,n){return new maplibre_gl_Xu(this,e,t,n)}createRenderbuffer(e,t,n){let r=this.gl,i=r.createRenderbuffer();return this.bindRenderbuffer.set(i),r.renderbufferStorage(r.RENDERBUFFER,e,t,n),this.bindRenderbuffer.set(null),i}createFramebuffer(e,t,n,r){return new maplibre_gl_Md(this,e,t,n,r)}clear({color:e,depth:t,stencil:n}){let r=this.gl,i=0;e&&(i|=r.COLOR_BUFFER_BIT,this.clearColor.set(e),this.colorMask.set([!0,!0,!0,!0])),t!==void 0&&(i|=r.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(t),this.depthMask.set(!0)),n!==void 0&&(i|=r.STENCIL_BUFFER_BIT,this.clearStencil.set(n),this.stencilMask.set(255)),r.clear(i)}setCullFace(e){e.enable===!1?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(e.mode),this.frontFace.set(e.frontFace))}setDepthMode(e){e.func===this.gl.ALWAYS&&!e.mask?this.depthTest.set(!1):(this.depthTest.set(!0),this.depthFunc.set(e.func),this.depthMask.set(e.mask),this.depthRange.set(e.range))}setStencilMode(e){e.test.func===this.gl.ALWAYS&&!e.mask?this.stencilTest.set(!1):(this.stencilTest.set(!0),this.stencilMask.set(e.mask),this.stencilOp.set([e.fail,e.depthFail,e.pass]),this.stencilFunc.set({func:e.test.func,ref:e.ref,mask:e.test.mask}))}setColorMode(e){maplibre_gl_shared_Mt(e.blendFunction,maplibre_gl_Ld.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(e.blendFunction),this.blendColor.set(e.blendColor)),this.colorMask.set(e.mask)}createVertexArray(){return this.gl.createVertexArray()}deleteVertexArray(e){this.gl.deleteVertexArray(e)}unbindVAO(){this.bindVertexArray.set(null)}},maplibre_gl_Z=class{constructor(e,t,n){this.func=e,this.mask=t,this.range=n}};maplibre_gl_Z.ReadOnly=!1,maplibre_gl_Z.ReadWrite=!0,maplibre_gl_Z.disabled=new maplibre_gl_Z(519,maplibre_gl_Z.ReadOnly,[0,1]);const maplibre_gl_zd=7680;var maplibre_gl_Q=class{constructor(e,t,n,r,i,a){this.test=e,this.ref=t,this.mask=n,this.fail=r,this.depthFail=i,this.pass=a}};maplibre_gl_Q.disabled=new maplibre_gl_Q({func:519,mask:0},0,0,maplibre_gl_zd,maplibre_gl_zd,maplibre_gl_zd);const maplibre_gl_Bd=1029,maplibre_gl_Vd=2305;var maplibre_gl_$=class{constructor(e,t,n){this.enable=e,this.mode=t,this.frontFace=n}};maplibre_gl_$.disabled=new maplibre_gl_$(!1,maplibre_gl_Bd,maplibre_gl_Vd),maplibre_gl_$.backCCW=new maplibre_gl_$(!0,maplibre_gl_Bd,maplibre_gl_Vd),maplibre_gl_$.frontCCW=new maplibre_gl_$(!0,1028,maplibre_gl_Vd);let maplibre_gl_Hd;function maplibre_gl_Ud(e,t,n,r,i){let a=e.context,o=e.transform,s=a.gl,c=e.useProgram(`collisionBox`),l=[],u=0,d=0;for(let f of r){let r=t.getTile(f).getBucket(n);if(!r)continue;let p=i?r.textCollisionBox:r.iconCollisionBox,m=r.collisionCircleArray;m.length>0&&(l.push({circleArray:m,circleOffset:d,coord:f}),u+=m.length/4,d=u),p&&c.draw(a,s.LINES,maplibre_gl_Z.disabled,maplibre_gl_Q.disabled,e.colorModeForRenderPass(),maplibre_gl_$.disabled,null,e.style.map.terrain?.getTerrainData(f),o.getProjectionData({overscaledTileID:f,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),n.id,p.layoutVertexBuffer,p.indexBuffer,p.segments,null,e.transform.zoom,null,null,p.collisionVertexBuffer)}if(!i||!l.length)return;let p=e.useProgram(`collisionCircle`),m=new maplibre_gl_shared_Jl;m.resize(u*4),m._trim();let h=0;for(let e of l)for(let t=0;t<e.circleArray.length/4;t++){let n=t*4,r=e.circleArray[n+0],i=e.circleArray[n+1],a=e.circleArray[n+2],o=e.circleArray[n+3];m.emplace(h++,r,i,a,o,0),m.emplace(h++,r,i,a,o,1),m.emplace(h++,r,i,a,o,2),m.emplace(h++,r,i,a,o,3)}(!maplibre_gl_Hd||maplibre_gl_Hd.length<u*2)&&(maplibre_gl_Hd=maplibre_gl_Wd(u));let g=a.createIndexBuffer(maplibre_gl_Hd,!0),_=a.createVertexBuffer(m,fg.members,!0);for(let t of l)p.draw(a,s.TRIANGLES,maplibre_gl_Z.disabled,maplibre_gl_Q.disabled,e.colorModeForRenderPass(),maplibre_gl_$.disabled,null,e.style.map.terrain?.getTerrainData(t.coord),null,n.id,_,g,maplibre_gl_shared_nu.simpleSegment(0,t.circleOffset*2,t.circleArray.length,t.circleArray.length/2),null,e.transform.zoom,null,null,null);_.destroy(),g.destroy()}function maplibre_gl_Wd(e){let t=e*2,n=new maplibre_gl_shared_Xl;n.resize(t),n._trim();for(let e=0;e<t;e++){let t=e*6;n.uint16[t+0]=e*4+0,n.uint16[t+1]=e*4+1,n.uint16[t+2]=e*4+2,n.uint16[t+3]=e*4+2,n.uint16[t+4]=e*4+3,n.uint16[t+5]=e*4+0}return n}const maplibre_gl_Gd=maplibre_gl_shared_C(new Float32Array(16));function maplibre_gl_Kd(e,t,n,r,i,a){if(a.currentPass!==`translucent`)return;let{isRenderingToTexture:o}=a,s=maplibre_gl_Q.disabled,c=e.colorModeForRenderPass();(n._unevaluatedLayout.hasValue(`text-variable-anchor`)||n._unevaluatedLayout.hasValue(`text-variable-anchor-offset`))&&maplibre_gl_Jd(r,e,n,t,n.layout.get(`text-rotation-alignment`),n.layout.get(`text-pitch-alignment`),n.paint.get(`text-translate`),n.paint.get(`text-translate-anchor`),i),n.paint.get(`icon-opacity`).constantOr(1)!==0&&maplibre_gl_Qd(e,t,n,r,!1,n.paint.get(`icon-translate`),n.paint.get(`icon-translate-anchor`),n.layout.get(`icon-rotation-alignment`).constantOr(`viewport`),n.layout.get(`icon-pitch-alignment`),n.layout.get(`icon-keep-upright`),s,c,o),n.paint.get(`text-opacity`).constantOr(1)!==0&&maplibre_gl_Qd(e,t,n,r,!0,n.paint.get(`text-translate`),n.paint.get(`text-translate-anchor`),n.layout.get(`text-rotation-alignment`),n.layout.get(`text-pitch-alignment`),n.layout.get(`text-keep-upright`),s,c,o),t.map.showCollisionBoxes&&(maplibre_gl_Ud(e,t,n,r,!0),maplibre_gl_Ud(e,t,n,r,!1))}function maplibre_gl_qd(e,t,n,r,i,a){let{horizontalAlign:o,verticalAlign:s}=_v(e),c=-(o-.5)*t,l=-(s-.5)*n;return new maplibre_gl_shared_l((c/i+r[0])*a,(l/i+r[1])*a)}function maplibre_gl_Jd(e,t,n,r,a,o,s,c,l){let u=t.transform,d=t.style.map.terrain,f=a===`map`,p=o===`map`;for(let a of e){let e=r.getTile(a),o=e.getBucket(n);if(!o?.text?.segments.get().length)continue;let m=o.textSizeData,h=Hv(m,u.zoom),g=maplibre_gl_shared_N(e,1,t.transform.zoom),_=maplibre_gl_Zo(f,t.transform,g),v=n.layout.get(`icon-text-fit`)!==`none`&&o.hasIconData();if(h){let t=2**(u.zoom-e.tileID.overscaledZ),r=d?(e,t)=>d.getElevation(a,e,t):void 0;maplibre_gl_Xd(o,f,p,l,u,_,t,h,v,maplibre_gl_shared_it(u,e,s,c),a.toUnwrapped(),r,n.layout.get(`symbol-height-anchor`)===`ground`)}}}function maplibre_gl_Yd(e,t,n,r,i,a){let o=t.tileAnchorPoint.add(new maplibre_gl_shared_l(t.translation[0],t.translation[1]));if(t.pitchWithMap){let e=r.mult(a);n||(e=e.rotate(-i));let s=o.add(e);return maplibre_gl_ts(s.x,s.y,t.pitchedLabelPlaneMatrix,maplibre_gl_es(t,s.x,s.y)).point}if(n){let n=maplibre_gl_us(t.tileAnchorPoint.x+1,t.tileAnchorPoint.y,t).point.sub(e),i=Math.atan(n.y/n.x)+(n.x<0?Math.PI:0);return e.add(r.rotate(i))}return e.add(r)}function maplibre_gl_Xd(e,t,n,r,i,a,o,s,c,l,u,d,f){let m=e.text.placedSymbolArray,h=e.text.dynamicLayoutVertexArray,g=e.icon.dynamicLayoutVertexArray,_={};h.clear();for(let g=0;g<m.length;g++){let v=m.get(g),y=e.allowVerticalPlacement&&!v.placedOrientation,b=!v.hidden&&v.crossTileID&&!y?r[v.crossTileID]:null;if(!b)maplibre_gl_s(v.numGlyphs,h);else{let r=new maplibre_gl_shared_l(v.anchorX,v.anchorY),m={getElevation:d,heightOffset:v.heightOffset,heightAnchorGround:f,width:i.width,height:i.height,pitchedLabelPlaneMatrix:a,lineVertexArray:null,pitchWithMap:n,transform:i,projectionCache:null,tileAnchorPoint:r,translation:l,unwrappedTileID:u},g=n?maplibre_gl_fs(r.x,r.y,m):maplibre_gl_us(r.x,r.y,m),y=maplibre_gl_ns(i.cameraToCenterDistance,g.signedDistanceFromCamera),x=Vv(e.textSizeData,s,v)*y/24;n&&(x*=e.tilePixelRatio/o);let{width:S,height:C,anchor:w,textOffset:T,textBoxScale:E}=b,ee=maplibre_gl_qd(w,S,C,T,E,x),D=i.getPitchedTextCorrection(r.x+l[0],r.y+l[1],u),O=maplibre_gl_Yd(g.point,m,t,ee,-i.bearingInRadians,D),te=e.allowVerticalPlacement&&v.placedOrientation===2?Math.PI/2:0;for(let e=0;e<v.numGlyphs;e++)Fy(h,O,te);c&&v.associatedIconIndex>=0&&(_[v.associatedIconIndex]={shiftedAnchor:O,angle:te})}}if(c){g.clear();let t=e.icon.placedSymbolArray;for(let e=0;e<t.length;e++){let n=t.get(e);if(n.hidden)maplibre_gl_s(n.numGlyphs,g);else{let t=_[e];if(!t)maplibre_gl_s(n.numGlyphs,g);else for(let e=0;e<n.numGlyphs;e++)Fy(g,t.shiftedAnchor,t.angle)}}e.icon.dynamicLayoutVertexBuffer.updateData(g)}e.text.dynamicLayoutVertexBuffer.updateData(h)}function maplibre_gl_Zd(e,t,n){return n.iconsInText&&t?`symbolTextAndIcon`:e?`symbolSDF`:`symbolIcon`}function maplibre_gl_Qd(e,t,n,r,a,o,s,c,l,u,d,p,m){let h=e.context,g=h.gl,_=e.transform,v=c===`map`,y=l===`map`,b=c!==`viewport`&&n.layout.get(`symbol-placement`)!==`point`,x=v&&!y&&!b,S=!n.layout.get(`symbol-sort-key`).isConstant(),C=!1,w=e.getDepthModeForSublayer(0,maplibre_gl_Z.ReadOnly),T=n._unevaluatedLayout.hasValue(`text-variable-anchor`)||n._unevaluatedLayout.hasValue(`text-variable-anchor-offset`),E=[],ee=_.getCircleRadiusCorrection();for(let c of r){let r=t.getTile(c),l=r.getBucket(n);if(!l)continue;let d=a?l.text:l.icon;if(!d?.segments.get().length||!d.hasVisibleVertices)continue;let p=d.programConfigurations.get(n.id),h=a||l.sdfIcons,w=a?l.textSizeData:l.iconSizeData,D=y||_.pitch!==0,O=e.useProgram(maplibre_gl_Zd(h,a,l),p),te=Hv(w,_.zoom),k=e.style.map.terrain?.getTerrainData(c),ne,re=[0,0],ie,ae,oe=null,se;if(a){if(ie=r.glyphAtlasTexture,ae=g.LINEAR,ne=r.glyphAtlasTexture.size,l.iconsInText){re=r.imageAtlasTexture.size,oe=r.imageAtlasTexture;let t=w.kind===`composite`||w.kind===`camera`;se=D||e.options.rotating||e.options.zooming||t?g.LINEAR:g.NEAREST}}else{let t=n.layout.get(`icon-size`).constantOr(0)!==1||l.iconsNeedLinear;ie=r.imageAtlasTexture,ae=h||e.options.rotating||e.options.zooming||t||D?g.LINEAR:g.NEAREST,ne=r.imageAtlasTexture.size}let ce=maplibre_gl_shared_N(r,1,e.transform.zoom),le=maplibre_gl_Zo(v,e.transform,ce),ue=maplibre_gl_Qo(y,v,e.transform,ce),de=maplibre_gl_shared_it(_,r,o,s),fe=_.getProjectionData({overscaledTileID:c,applyGlobeMatrix:!m,applyTerrainMatrix:!0}),pe=T&&l.hasTextData(),me=n.layout.get(`icon-text-fit`)!==`none`&&pe&&l.hasIconData(),he=n._unevaluatedLayout.hasValue(`icon-offset`),ge=n.layout.get(`symbol-height-anchor`)===`ground`;if(b){let t=maplibre_gl_shared_b();maplibre_gl_qo(t,le);let r=e.style.map.terrain?(t,n)=>e.style.map.terrain.getElevation(c,t,n):void 0;maplibre_gl_is(l,e,a,le,t,y,u,n.layout.get(`text-rotation-alignment`)===`map`,c.toUnwrapped(),_.width,_.height,de,r)}let A=a&&T||me,_e=y?le:e.transform.clipSpaceToPixelsMatrix,ve=b||A?maplibre_gl_Gd:_e,ye=h&&n.paint.get(a?`text-halo-width`:`icon-halo-width`).constantOr(1)!==0,be;be=h?l.iconsInText?maplibre_gl_Lu(w.kind,te,x,y,b,A,e,ve,ue,de,ne,re,ee,he,ge):maplibre_gl_Iu(w.kind,te,x,y,b,A,e,ve,ue,de,a,ne,ye,ee,he,ge):maplibre_gl_Fu(w.kind,te,x,y,b,A,e,ve,ue,de,a,ne,ee,he,ge);let xe={program:O,buffers:d,uniformValues:be,projectionData:fe,atlasTexture:ie,atlasTextureIcon:oe,atlasInterpolation:ae,atlasInterpolationIcon:se,isSDF:h,hasHalo:ye};if(S&&l.canOverlap){C=!0;let e=d.segments.get();for(let t of e)E.push({segments:new maplibre_gl_shared_nu([t]),sortKey:t.sortKey,state:xe,terrainData:k})}else E.push({segments:d.segments,sortKey:0,state:xe,terrainData:k})}C&&E.sort((e,t)=>e.sortKey-t.sortKey);let D=n.paint.get(a?`text-halo-width`:`icon-halo-width`).constantOr(null)??1/0,O=n.layout.get(`text-letter-spacing`).constantOr(0)*24<0||D>1;for(let t of E){let r=t.state;h.activeTexture.set(g.TEXTURE0),r.atlasTexture.bind(r.atlasInterpolation,g.CLAMP_TO_EDGE),r.atlasTextureIcon&&(h.activeTexture.set(g.TEXTURE1),r.atlasTextureIcon&&r.atlasTextureIcon.bind(r.atlasInterpolationIcon,g.CLAMP_TO_EDGE));let i=r.isSDF&&r.hasHalo;if(i){let i=r.uniformValues;i.u_is_halo=1,O&&(i.u_is_plain=0,maplibre_gl_$d(r.buffers,t.segments,n,e,r.program,w,d,p,i,r.projectionData,t.terrainData),i.u_is_halo=0,i.u_is_plain=1)}maplibre_gl_$d(r.buffers,t.segments,n,e,r.program,w,d,p,r.uniformValues,r.projectionData,t.terrainData),i&&!O&&(r.uniformValues.u_is_halo=0)}}function maplibre_gl_$d(e,t,n,r,i,a,o,s,c,l,u){let d=r.context,f=d.gl;i.draw(d,f.TRIANGLES,a,o,s,maplibre_gl_$.backCCW,c,u,l,n.id,e.layoutVertexBuffer,e.indexBuffer,t,n.paint,r.transform.zoom,e.programConfigurations.get(n.id),e.dynamicLayoutVertexBuffer,e.opacityVertexBuffer)}function maplibre_gl_ef(e,t,n,r,i){if(i.currentPass!==`translucent`)return;let{isRenderingToTexture:a}=i,o=n.paint.get(`circle-opacity`),s=n.paint.get(`circle-stroke-width`),c=n.paint.get(`circle-stroke-opacity`),l=!n.layout.get(`circle-sort-key`).isConstant();if(o.constantOr(1)===0&&(s.constantOr(1)===0||c.constantOr(1)===0))return;let u=e.context,d=u.gl,p=e.transform,m=e.getDepthModeForSublayer(0,maplibre_gl_Z.ReadOnly),h=maplibre_gl_Q.disabled,g=e.colorModeForRenderPass(),_=[],v=p.getCircleRadiusCorrection();for(let i of r){let r=t.getTile(i),o=r.getBucket(n);if(!o)continue;let s=n.paint.get(`circle-translate`),c=n.paint.get(`circle-translate-anchor`),u=maplibre_gl_shared_it(p,r,s,c),d=o.programConfigurations.get(n.id),m=e.useProgram(`circle`,d),h=o.layoutVertexBuffer,g=o.indexBuffer,y=e.style.map.terrain?.getTerrainData(i),b={programConfiguration:d,program:m,layoutVertexBuffer:h,indexBuffer:g,uniformValues:maplibre_gl_iu(e,r,n,u,v),terrainData:y,projectionData:p.getProjectionData({overscaledTileID:i,applyGlobeMatrix:!a,applyTerrainMatrix:!0})};if(l){let e=o.segments.get();for(let t of e)_.push({segments:new maplibre_gl_shared_nu([t]),sortKey:t.sortKey,state:b})}else _.push({segments:o.segments,sortKey:0,state:b})}l&&_.sort((e,t)=>e.sortKey-t.sortKey);for(let t of _){let{programConfiguration:r,program:i,layoutVertexBuffer:a,indexBuffer:o,uniformValues:s,terrainData:c,projectionData:l}=t.state,f=t.segments;i.draw(u,d.TRIANGLES,m,h,g,maplibre_gl_$.backCCW,s,c,l,n.id,a,o,f,n.paint,e.transform.zoom,r)}}function maplibre_gl_tf(e,t,n,r,i){if(n.paint.get(`heatmap-opacity`)===0)return;let a=e.context,{isRenderingToTexture:o,isRenderingGlobe:s}=i;if(e.style.map.terrain){for(let a of r){let r=t.getTile(a);t.hasRenderableParent(a)||(i.currentPass===`offscreen`?maplibre_gl_af(e,r,n,a,s):i.currentPass===`translucent`&&maplibre_gl_of(e,n,a,o,s))}a.viewport.set([0,0,e.width,e.height])}else i.currentPass===`offscreen`?maplibre_gl_nf(e,t,n,r):i.currentPass===`translucent`&&maplibre_gl_rf(e,n)}function maplibre_gl_nf(e,t,n,r){let i=e.context,a=i.gl,o=e.transform,s=maplibre_gl_Q.disabled,c=new maplibre_gl_Ld([a.ONE,a.ONE],maplibre_gl_shared_V.transparent,[!0,!0,!0,!0]);maplibre_gl_sf(i,e,n),i.clear({color:maplibre_gl_shared_V.transparent});for(let l of r){if(t.hasRenderableParent(l))continue;let r=t.getTile(l),u=r.getBucket(n);if(!u)continue;let d=u.programConfigurations.get(n.id),f=e.useProgram(`heatmap`,d),p=o.getProjectionData({overscaledTileID:l,applyGlobeMatrix:!0,applyTerrainMatrix:!1}),m=o.getCircleRadiusCorrection();f.draw(i,a.TRIANGLES,maplibre_gl_Z.disabled,s,c,maplibre_gl_$.backCCW,maplibre_gl_lu(r,o.zoom,n.paint.get(`heatmap-intensity`),m),null,p,n.id,u.layoutVertexBuffer,u.indexBuffer,u.segments,n.paint,o.zoom,d)}i.viewport.set([0,0,e.width,e.height])}function maplibre_gl_rf(e,t){let n=e.context,r=n.gl;n.setColorMode(e.colorModeForRenderPass());let i=t.heatmapFbos.get((/* inlined export .Ct */"big-fb"));i&&(n.activeTexture.set(r.TEXTURE0),r.bindTexture(r.TEXTURE_2D,i.colorAttachment.get()),n.activeTexture.set(r.TEXTURE1),maplibre_gl_lf(n,t).bind(r.LINEAR,r.CLAMP_TO_EDGE),e.useProgram(`heatmapTexture`).draw(n,r.TRIANGLES,maplibre_gl_Z.disabled,maplibre_gl_Q.disabled,e.colorModeForRenderPass(),maplibre_gl_$.disabled,maplibre_gl_uu(e,t,0,1),null,null,t.id,e.viewportBuffer,e.quadTriangleIndexBuffer,e.viewportSegments,t.paint,e.transform.zoom))}function maplibre_gl_af(e,t,n,r,i){let a=e.context,o=a.gl,s=maplibre_gl_Q.disabled,c=new maplibre_gl_Ld([o.ONE,o.ONE],maplibre_gl_shared_V.transparent,[!0,!0,!0,!0]),l=t.getBucket(n);if(!l)return;let u=r.key,d=n.heatmapFbos.get(u);d||(d=maplibre_gl_cf(a,t.tileSize,t.tileSize),n.heatmapFbos.set(u,d)),a.bindFramebuffer.set(d.framebuffer),a.viewport.set([0,0,t.tileSize,t.tileSize]),a.clear({color:maplibre_gl_shared_V.transparent});let f=l.programConfigurations.get(n.id),p=e.useProgram(`heatmap`,f,!i),m=e.transform.getProjectionData({overscaledTileID:t.tileID,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),h=e.style.map.terrain.getTerrainData(r);p.draw(a,o.TRIANGLES,maplibre_gl_Z.disabled,s,c,maplibre_gl_$.disabled,maplibre_gl_lu(t,e.transform.zoom,n.paint.get(`heatmap-intensity`),1),h,m,n.id,l.layoutVertexBuffer,l.indexBuffer,l.segments,n.paint,e.transform.zoom,f)}function maplibre_gl_of(e,t,n,r,i){let a=e.context,o=a.gl,s=e.transform;a.setColorMode(e.colorModeForRenderPass());let c=maplibre_gl_lf(a,t),l=n.key,u=t.heatmapFbos.get(l);if(!u)return;a.activeTexture.set(o.TEXTURE0),o.bindTexture(o.TEXTURE_2D,u.colorAttachment.get()),a.activeTexture.set(o.TEXTURE1),c.bind(o.LINEAR,o.CLAMP_TO_EDGE);let d=s.getProjectionData({overscaledTileID:n,applyTerrainMatrix:i,applyGlobeMatrix:!r});e.useProgram(`heatmapTexture`).draw(a,o.TRIANGLES,maplibre_gl_Z.disabled,maplibre_gl_Q.disabled,e.colorModeForRenderPass(),maplibre_gl_$.disabled,maplibre_gl_uu(e,t,0,1),null,d,t.id,e.rasterBoundsBuffer,e.quadTriangleIndexBuffer,e.rasterBoundsSegments,t.paint,s.zoom),u.destroy(),t.heatmapFbos.delete(l)}function maplibre_gl_sf(e,t,n){let r=e.gl;e.activeTexture.set(r.TEXTURE1),e.viewport.set([0,0,t.width/4,t.height/4]);let i=n.heatmapFbos.get((/* inlined export .Ct */"big-fb"));i?(r.bindTexture(r.TEXTURE_2D,i.colorAttachment.get()),e.bindFramebuffer.set(i.framebuffer)):(i=maplibre_gl_cf(e,t.width/4,t.height/4),n.heatmapFbos.set((/* inlined export .Ct */"big-fb"),i))}function maplibre_gl_cf(e,t,n){let r=e.gl,i=r.createTexture();r.bindTexture(r.TEXTURE_2D,i),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.LINEAR),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,r.LINEAR),r.texStorage2D(r.TEXTURE_2D,1,r.RGBA16F,t,n);let a=e.createFramebuffer(t,n,!1,!1);return a.colorAttachment.set(i),a}function maplibre_gl_lf(e,t){return t.colorRampTexture||=new Gd(e,t.colorRamp,e.gl.RGBA),t.colorRampTexture}function maplibre_gl_uf(e,t,n,r){let i=e.context,a=i.bindFramebuffer.get(),o=i.viewport.get(),[,,s,c]=o;return maplibre_gl_df(e,s,c),i.viewport.set([0,0,s,c]),i.clear({color:maplibre_gl_shared_V.transparent,depth:1,stencil:0}),e.currentStencilSource=void 0,e.renderTileClippingMasks(t,n,r),{compositeTarget:a,compositeViewport:o}}function maplibre_gl_df(e,t,n){let r=e.context.gl;if(!e.layerOpacityFbo){let i=e.context.createFramebuffer(t,n,!0,!0),a=r.createTexture();r.bindTexture(r.TEXTURE_2D,a),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.LINEAR),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,r.LINEAR),r.texImage2D(r.TEXTURE_2D,0,r.RGBA,t,n,0,r.RGBA,r.UNSIGNED_BYTE,null),i.colorAttachment.set(a),i.depthAttachment.set(e.context.createRenderbuffer(r.DEPTH_STENCIL,t,n)),e.layerOpacityFbo=i,e.context.bindFramebuffer.set(e.layerOpacityFbo.framebuffer);return}if(e.layerOpacityFbo.width===t&&e.layerOpacityFbo.height===n){e.context.bindFramebuffer.set(e.layerOpacityFbo.framebuffer);return}let i=e.layerOpacityFbo;r.bindTexture(r.TEXTURE_2D,i.colorAttachment.get()),r.texImage2D(r.TEXTURE_2D,0,r.RGBA,t,n,0,r.RGBA,r.UNSIGNED_BYTE,null),e.context.bindRenderbuffer.set(i.depthAttachment.get()),r.renderbufferStorage(r.RENDERBUFFER,r.DEPTH_STENCIL,t,n),e.context.bindRenderbuffer.set(null),i.width=t,i.height=n,e.context.bindFramebuffer.set(i.framebuffer)}function maplibre_gl_ff(e,t,n,r){let i=e.context,a=i.gl;i.bindFramebuffer.set(n.compositeTarget),i.viewport.set(n.compositeViewport),i.activeTexture.set(a.TEXTURE0),a.bindTexture(a.TEXTURE_2D,e.layerOpacityFbo.colorAttachment.get()),e.useProgram(`layerOpacity`).draw(i,a.TRIANGLES,maplibre_gl_Z.disabled,maplibre_gl_Q.disabled,e.colorModeForRenderPass(),maplibre_gl_$.disabled,maplibre_gl_ju(t,0),null,null,r.id,e.viewportBuffer,e.quadTriangleIndexBuffer,e.viewportSegments,r.paint,e.transform.zoom),e.currentStencilSource=void 0}function maplibre_gl_pf(e,t,n,r,i,a,o,s){let c=256;if(i.stepInterpolant){let r=t.getSource().maxzoom,i=o.canonical.z===r?Math.ceil(1<<e.transform.maxZoom-o.canonical.z):1,s=a.maxLineLength/(/* inlined export .Rr */8192)*1024*i;c=maplibre_gl_shared_yt(maplibre_gl_shared_Et(s),256,n.maxTextureSize)}return s.gradient=Md({expression:i.gradientExpression(),evaluationKey:`lineProgress`,resolution:c,image:s.gradient||void 0,clips:a.lineClipsArray}),s.texture?s.texture.update(s.gradient):s.texture=new Gd(n,s.gradient,r.RGBA),s.version=i.gradientVersion,s.texture}function maplibre_gl_mf(e,t,n,r,i){e.activeTexture.set(t.TEXTURE0),n.imageAtlasTexture.bind(t.LINEAR,t.CLAMP_TO_EDGE),r.updatePaintBuffers(i)}function maplibre_gl_hf(e,t,n,r,i,a){(i||e.lineAtlas.dirty)&&(t.activeTexture.set(n.TEXTURE0),e.lineAtlas.bind(t)),r.updatePaintBuffers(a)}function maplibre_gl_gf(e,t,n,r,i,a,o){let s=a.gradients[i.id],c=s.texture;i.gradientVersion!==s.version&&(c=maplibre_gl_pf(e,t,n,r,i,a,o,s)),n.activeTexture.set(r.TEXTURE0),c.bind(i.stepInterpolant?r.NEAREST:r.LINEAR,r.CLAMP_TO_EDGE)}function maplibre_gl_f(e,t,n,r,i,a,o,s,c){let l=a.gradients[i.id],u=l.texture;i.gradientVersion!==l.version&&(u=maplibre_gl_pf(e,t,n,r,i,a,o,l)),n.activeTexture.set(r.TEXTURE0),u.bind(i.stepInterpolant?r.NEAREST:r.LINEAR,r.CLAMP_TO_EDGE),n.activeTexture.set(r.TEXTURE1),e.lineAtlas.bind(n),s.updatePaintBuffers(c)}function maplibre_gl_vf(e,t,n,r,i){if(i.currentPass!==`translucent`)return;let a=n.paint.get(`line-opacity`),o=n.paint.get(`line-width`),s=n.paint.get(`line-layer-opacity`);if(a.constantOr(1)===0||o.constantOr(1)===0||s===0)return;let c=!!e.style.map.terrain;if(s<1){let a=maplibre_gl_uf(e,n,r,c);maplibre_gl_yf(e,t,n,r,i,c),maplibre_gl_ff(e,s,a,n);return}maplibre_gl_yf(e,t,n,r,i,c)}function maplibre_gl_yf(e,t,n,r,i,a){let{isRenderingToTexture:o}=i,s=e.getDepthModeForSublayer(0,maplibre_gl_Z.ReadOnly),c=e.colorModeForRenderPass(),l=n.paint.get(`line-dasharray`),u=l.constantOr(1),d=n.paint.get(`line-pattern`),f=d.constantOr(1),p=n.paint.get(`line-gradient`),m=n.getCrossfadeParameters(),h;h=f?`linePattern`:u&&p?`lineGradientSDF`:u?`lineSDF`:p?`lineGradient`:`line`;let g=e.context,_=g.gl,v=e.transform,y=!0;for(let i of r){let r=t.getTile(i);if(f&&!r.patternsLoaded())continue;let b=r.getBucket(n);if(!b)continue;let x=b.programConfigurations.get(n.id),S=e.context.program.get(),C=e.useProgram(h,x),w=y||C.program!==S,T=a?e.getTerrainDataForTile(i,o):null,E=d.constantOr(null),ee=l?.constantOr(null);if(E&&r.imageAtlas){let e=r.imageAtlas,t=e.patternPositions[E.to.toString()],n=e.patternPositions[E.from.toString()];t&&n&&x.setConstantPatternPositions(t,n)}else if(ee){let t=n.layout.get(`line-cap`).constantOr(null)===`round`,r=e.lineAtlas.getDash(ee.to,t),i=e.lineAtlas.getDash(ee.from,t);x.setConstantDashPositions(r,i)}let D=v.getProjectionData({overscaledTileID:i,applyGlobeMatrix:!o,applyTerrainMatrix:!0}),O=v.getPixelScale(),te;f?(te=maplibre_gl_Tu(e,r,n,O,m),maplibre_gl_mf(g,_,r,x,m)):u&&p?(te=maplibre_gl_Du(e,r,n,O,m,b.lineClipsArray.length),maplibre_gl_f(e,t,g,_,n,b,i,x,m)):u?(te=maplibre_gl_Eu(e,r,n,O,m),maplibre_gl_hf(e,g,_,x,w,m)):p?(te=maplibre_gl_wu(e,r,n,O,b.lineClipsArray.length),maplibre_gl_gf(e,t,g,_,n,b,i)):te=maplibre_gl_Cu(e,r,n,O);let k=e.stencilModeForClipping(i);C.draw(g,_.TRIANGLES,s,k,c,maplibre_gl_$.disabled,te,T,D,n.id,b.layoutVertexBuffer,b.indexBuffer,b.segments,n.paint,e.transform.zoom,x,b.layoutVertexBuffer2),y=!1}}function maplibre_gl_bf(e,t,n,r,i){if(!n||!r?.imageAtlas)return;let a=r.imageAtlas.patternPositions,o=a[n.to.toString()],s=a[n.from.toString()];if(!o&&s&&(o=s),!s&&o&&(s=o),!o||!s){let e=i.getPaintProperty(t);o=a[e],s=a[e]}o&&s&&e.setConstantPatternPositions(o,s)}function maplibre_gl_xf(e,t,n,r,i){let a=n.paint.get(`fill-color`),o=n.paint.get(`fill-opacity`),s=n.paint.get(`fill-layer-opacity`);if(o.constantOr(1)===0||s===0)return;if(s<1){if(i.currentPass!==`translucent`)return;let a=maplibre_gl_uf(e,n,r,!!e.style.map.terrain);maplibre_gl_Sf(e,t,n,r,i),maplibre_gl_ff(e,s,a,n);return}let c=n.paint.get(`fill-pattern`),l=e.opaquePassEnabledForLayer()&&!c.constantOr(1)&&a.constantOr(maplibre_gl_shared_V.transparent).a===1&&o.constantOr(0)===1;if(l&&i.currentPass===`opaque`){let{isRenderingToTexture:a}=i,o=e.colorModeForRenderPass();maplibre_gl_wf(e,t,n,r,e.getDepthModeForSublayer(1,maplibre_gl_Z.ReadWrite),o,!1,a);return}if(l&&i.currentPass===`translucent`){maplibre_gl_Cf(e,t,n,r,i);return}i.currentPass===`translucent`&&maplibre_gl_Sf(e,t,n,r,i)}function maplibre_gl_Sf(e,t,n,r,i){let{isRenderingToTexture:a}=i,o=e.colorModeForRenderPass();maplibre_gl_wf(e,t,n,r,e.getDepthModeForSublayer(1,maplibre_gl_Z.ReadOnly),o,!1,a),maplibre_gl_Cf(e,t,n,r,i)}function maplibre_gl_Cf(e,t,n,r,i){if(!n.paint.get(`fill-antialias`))return;let{isRenderingToTexture:a}=i,o=e.colorModeForRenderPass();maplibre_gl_wf(e,t,n,r,e.getDepthModeForSublayer(n.getPaintProperty(`fill-outline-color`)?2:0,maplibre_gl_Z.ReadOnly),o,!0,a)}function maplibre_gl_wf(e,t,n,r,i,a,o,s){let c=e.context.gl,l=`fill-pattern`,u=n.paint.get(l),d=u?.constantOr(1),f=n.getCrossfadeParameters(),p,m,h,g,_,v=e.transform,y=n.paint.get(`fill-translate`),b=n.paint.get(`fill-translate-anchor`);o?(m=d&&!n.getPaintProperty(`fill-outline-color`)?`fillOutlinePattern`:`fillOutline`,p=c.LINES):(m=d?`fillPattern`:`fill`,p=c.TRIANGLES);let x=u.constantOr(null);for(let u of r){let r=t.getTile(u);if(d&&!r.patternsLoaded())continue;let S=r.getBucket(n);if(!S)continue;let C=S.sdfPatterns[n.id]??!1,w=S.programConfigurations.get(n.id),T=e.useProgram(m,w),E=e.getTerrainDataForTile(u,s);d&&(e.context.activeTexture.set(c.TEXTURE0),r.imageAtlasTexture.bind(c.LINEAR,c.CLAMP_TO_EDGE),w.updatePaintBuffers(f)),maplibre_gl_bf(w,l,x,r,n);let ee=v.getProjectionData({overscaledTileID:u,applyGlobeMatrix:!s,applyTerrainMatrix:!0}),D=maplibre_gl_shared_it(v,r,y,b);o?(g=S.indexBuffer2,_=S.segments2,h=m===`fillOutlinePattern`&&d?maplibre_gl_nu(e,f,r,D,C):maplibre_gl_tu(D)):(g=S.indexBuffer,_=S.segments,h=d?maplibre_gl_$l(e,f,r,D,C):maplibre_gl_eu(D));let O=e.stencilModeForClipping(u);T.draw(e.context,p,i,O,a,maplibre_gl_$.backCCW,h,E,ee,n.id,S.layoutVertexBuffer,g,_,n.paint,e.transform.zoom,w)}}function maplibre_gl_Tf(e,t,n,r,i){let a=n.paint.get(`fill-extrusion-opacity`);if(a===0)return;let{isRenderingToTexture:o}=i;if(i.currentPass===`translucent`){let s=new maplibre_gl_Z(e.context.gl.LEQUAL,maplibre_gl_Z.ReadWrite,i.depthRangeFor3D);if(a===1&&!n.paint.get(`fill-extrusion-pattern`).constantOr(1)){let i=e.colorModeForRenderPass();maplibre_gl_Ef(e,t,n,r,s,maplibre_gl_Q.disabled,i,o)}else maplibre_gl_Ef(e,t,n,r,s,maplibre_gl_Q.disabled,maplibre_gl_Ld.disabled,o),maplibre_gl_Ef(e,t,n,r,s,e.stencilModeFor3D(),e.colorModeForRenderPass(),o)}}function maplibre_gl_Ef(e,t,n,r,i,a,o,s){let c=e.context,l=c.gl,u=`fill-extrusion-pattern`,d=n.paint.get(u),f=d.constantOr(1),p=n.getCrossfadeParameters(),m=n.paint.get(`fill-extrusion-opacity`),h=d.constantOr(null),g=e.transform;for(let d of r){let r=t.getTile(d),_=r.getBucket(n);if(!_)continue;let v=e.style.map.terrain?.getTerrainData(d),y=_.programConfigurations.get(n.id),b=e.useProgram(f?`fillExtrusionPattern`:`fillExtrusion`,y);f&&(e.context.activeTexture.set(l.TEXTURE0),r.imageAtlasTexture.bind(l.LINEAR,l.CLAMP_TO_EDGE),y.updatePaintBuffers(p));let x=g.getProjectionData({overscaledTileID:d,applyGlobeMatrix:!s,applyTerrainMatrix:!0});maplibre_gl_bf(y,u,h,r,n);let S=maplibre_gl_shared_it(g,r,n.paint.get(`fill-extrusion-translate`),n.paint.get(`fill-extrusion-translate-anchor`)),C=n.paint.get(`fill-extrusion-vertical-gradient`),w=f?maplibre_gl_Jl(e,C,m,S,d,p,r):maplibre_gl_ql(e,C,m,S);b.draw(c,c.gl.TRIANGLES,i,a,o,maplibre_gl_$.backCCW,w,v,x,n.id,_.layoutVertexBuffer,_.indexBuffer,_.segments,n.paint,e.transform.zoom,y,e.style.map.terrain&&_.centroidVertexBuffer)}}function maplibre_gl_Df(e,t,n,r,i){if(i.currentPass!==`offscreen`&&i.currentPass!==`translucent`)return;let{isRenderingToTexture:a}=i,o=e.context,s=e.style.projection.useSubdivision,c=e.getDepthModeForSublayer(0,maplibre_gl_Z.ReadOnly),l=e.colorModeForRenderPass();if(i.currentPass===`offscreen`)maplibre_gl_kf(e,t,r,n,c,maplibre_gl_Q.disabled,l),o.viewport.set([0,0,e.width,e.height]);else if(i.currentPass===`translucent`){if(s){let[i,o,s]=e.stencilConfigForOverlapTwoPass(r);maplibre_gl_Of(e,t,n,s,i,c,l,!1,a),maplibre_gl_Of(e,t,n,s,o,c,l,!0,a)}else{let[i,o]=e.getStencilConfigForOverlapAndUpdateStencilID(r);maplibre_gl_Of(e,t,n,o,i,c,l,!1,a)}}}function maplibre_gl_Of(e,t,n,r,i,a,o,s,c){let l=e.style.projection,u=e.context,d=e.transform,f=u.gl,p=[`#define NUM_ILLUMINATION_SOURCES ${n.paint.get(`hillshade-highlight-color`).values.length}`],m=e.useProgram(`hillshade`,null,!1,p),h=!e.options.moving;for(let p of r){let r=t.getTile(p),g=r.fbo;if(!g)continue;let _=l.getMeshFromTileID(u,p.canonical,s,!0,`raster`),v=e.getTerrainDataForTile(p,c);u.activeTexture.set(f.TEXTURE0),f.bindTexture(f.TEXTURE_2D,g.colorAttachment.get());let y=d.getProjectionData({overscaledTileID:p,aligned:h,applyGlobeMatrix:!c,applyTerrainMatrix:!0});m.draw(u,f.TRIANGLES,a,i[p.overscaledZ],o,maplibre_gl_$.backCCW,maplibre_gl_pu(e,r,n),v,y,n.id,_.vertexBuffer,_.indexBuffer,_.segments)}}function maplibre_gl_kf(e,t,n,r,i,a,o){let s=e.context,c=s.gl,l=r.paint.get(`resampling`)===`nearest`?c.NEAREST:c.LINEAR;for(let u of n){let n=t.getTile(u),d=n.dem;if(!d?.data||!n.needsHillshadePrepare)continue;let f=d.dim+2,p=d.stride,m=d.getPixels();if(s.activeTexture.set(c.TEXTURE1),s.pixelStoreUnpackPremultiplyAlpha.set(!1),n.demTexture||=e.getTileTexture(p),n.demTexture){let e=n.demTexture;e.update(m,{premultiply:!1}),e.bind(c.NEAREST,c.CLAMP_TO_EDGE)}else n.demTexture=new Gd(s,m,c.RGBA,{premultiply:!1}),n.demTexture.bind(c.NEAREST,c.CLAMP_TO_EDGE);s.activeTexture.set(c.TEXTURE0);let h=n.fbo;if(!h){let e=new Gd(s,{width:f,height:f,data:null},c.RGBA);e.bind(l,c.CLAMP_TO_EDGE),h=n.fbo=s.createFramebuffer(f,f,!0,!1),h.colorAttachment.set(e.texture)}s.bindFramebuffer.set(h.framebuffer),s.viewport.set([0,0,f,f]),e.useProgram(`hillshadePrepare`).draw(s,c.TRIANGLES,i,a,o,maplibre_gl_$.disabled,maplibre_gl_mu(n.tileID,d),null,null,r.id,e.rasterBoundsBuffer,e.quadTriangleIndexBuffer,e.rasterBoundsSegments),n.needsHillshadePrepare=!1}}function maplibre_gl_Af(e,t,n,r,i){if(i.currentPass!==`translucent`||!r.length)return;let{isRenderingToTexture:a}=i,o=e.style.projection.useSubdivision,s=e.getDepthModeForSublayer(0,maplibre_gl_Z.ReadOnly),c=e.colorModeForRenderPass();if(o){let[i,o,l]=e.stencilConfigForOverlapTwoPass(r);maplibre_gl_Mf(e,t,n,l,i,s,c,!1,a),maplibre_gl_Mf(e,t,n,l,o,s,c,!0,a)}else{let[i,o]=e.getStencilConfigForOverlapAndUpdateStencilID(r);maplibre_gl_Mf(e,t,n,o,i,s,c,!1,a)}}let maplibre_gl_jf=0;function maplibre_gl_Mf(e,t,n,r,i,a,o,s,c){let l=e.style.projection,u=e.context,d=e.transform,f=u.gl,p=e.useProgram(`colorRelief`),m=!e.options.moving,h=n.paint.get(`resampling`)===`nearest`?f.NEAREST:f.LINEAR,g=!0,_=0;for(let v of r){let r=t.getTile(v),y=r.dem;if(!y?.data)continue;if(g){maplibre_gl_jf||=f.getParameter(f.MAX_TEXTURE_SIZE);let e=maplibre_gl_jf,{elevationTexture:t,colorTexture:r}=n.getColorRampTextures(u,e,y.getUnpackVector());u.activeTexture.set(f.TEXTURE1),t.bind(f.NEAREST,f.CLAMP_TO_EDGE),u.activeTexture.set(f.TEXTURE4),r.bind(f.LINEAR,f.CLAMP_TO_EDGE),g=!1,_=t.size[0]}let b=y.stride;u.activeTexture.set(f.TEXTURE0),(!r.demTexture||r.needsColorReliefPrepare)&&(u.pixelStoreUnpackPremultiplyAlpha.set(!1),r.demTexture||=e.getTileTexture(b)??new Gd(u,{width:b,height:b,data:null},f.RGBA),r.demTexture.update(y.getPixels(),{premultiply:!1}),r.needsColorReliefPrepare=!1),r.demTexture.bind(h,f.CLAMP_TO_EDGE);let x=l.getMeshFromTileID(u,v.canonical,s,!0,`raster`),S=e.getTerrainDataForTile(v,c),C=d.getProjectionData({overscaledTileID:v,aligned:m,applyGlobeMatrix:!c,applyTerrainMatrix:!0});p.draw(u,f.TRIANGLES,a,i[v.overscaledZ],o,maplibre_gl_$.backCCW,maplibre_gl_u(n,r.dem,_),S,C,n.id,x.vertexBuffer,x.indexBuffer,x.segments)}}const maplibre_gl_Nf=[new maplibre_gl_shared_l(0,0),new maplibre_gl_shared_l((/* inlined export .Rr */8192),0),new maplibre_gl_shared_l((/* inlined export .Rr */8192),(/* inlined export .Rr */8192)),new maplibre_gl_shared_l(0,(/* inlined export .Rr */8192))];function maplibre_gl_Pf(e,t,n,r,i){if(i.currentPass!==`translucent`||n.paint.get(`raster-opacity`)===0||!r.length)return;let{isRenderingToTexture:a}=i,o=t.getSource(),s=e.style.projection.useSubdivision;if(o instanceof maplibre_gl_Xa)maplibre_gl_Ff(e,t,n,r,null,!1,!1,o.tileCoords,o.imageWarp,o.flippedWindingOrder,a,o.getMesh(e.context,s));else if(s){let[i,o,s]=e.stencilConfigForOverlapTwoPass(r);maplibre_gl_Ff(e,t,n,s,i,!1,!0,maplibre_gl_Nf,maplibre_gl_za,!1,a),maplibre_gl_Ff(e,t,n,s,o,!0,!0,maplibre_gl_Nf,maplibre_gl_za,!1,a)}else{let[i,o]=e.getStencilConfigForOverlapAndUpdateStencilID(r);maplibre_gl_Ff(e,t,n,o,i,!1,!0,maplibre_gl_Nf,maplibre_gl_za,!1,a)}}function maplibre_gl_Ff(e,t,n,r,i,a,o,s,c,l=!1,u=!1,d=null){let f=r[r.length-1].overscaledZ,p=e.context,m=p.gl,h=e.useProgram(`raster`),g=e.transform,_=e.style.projection,v=e.colorModeForRenderPass(),y=!e.options.moving,b=n.paint.get(`raster-opacity`),x=n.paint.get(`resampling`)===`nearest`||n.paint.get(`raster-resampling`)===`nearest`?m.NEAREST:m.LINEAR,S=n.paint.get(`raster-fade-duration`),C=!!e.style.map.terrain;for(let w of r){let r=e.getDepthModeForSublayer(w.overscaledZ-f,b===1?maplibre_gl_Z.ReadWrite:maplibre_gl_Z.ReadOnly,m.LESS),T=t.getTile(w);p.activeTexture.set(m.TEXTURE0),T.texture.bind(x,m.CLAMP_TO_EDGE,m.LINEAR_MIPMAP_NEAREST),p.activeTexture.set(m.TEXTURE1);let{parentTile:E,parentScaleBy:ee,parentTopLeft:D,fadeValues:O}=maplibre_gl_If(T,t,S,C);T.fadeOpacity=O.tileOpacity,E?(E.fadeOpacity=O.parentTileOpacity,E.texture.bind(x,m.CLAMP_TO_EDGE,m.LINEAR_MIPMAP_NEAREST)):T.texture.bind(x,m.CLAMP_TO_EDGE,m.LINEAR_MIPMAP_NEAREST),T.texture.useMipmap&&p.extTextureFilterAnisotropic&&e.transform.pitch>e.options.anisotropicFilterPitch&&m.texParameterf(m.TEXTURE_2D,p.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,p.extTextureFilterAnisotropicMax);let te=e.getTerrainDataForTile(w,u),k=g.getProjectionData({overscaledTileID:w,aligned:y,applyGlobeMatrix:!u,applyTerrainMatrix:!0}),ne=maplibre_gl_Va(D,ee,O.fadeMix,n,s,c),re=d??_.getMeshFromTileID(p,w.canonical,a,o,`raster`),ie=i?i[w.overscaledZ]:maplibre_gl_Q.disabled;h.draw(p,m.TRIANGLES,r,ie,v,l?maplibre_gl_$.frontCCW:maplibre_gl_$.backCCW,ne,te,k,n.id,re.vertexBuffer,re.indexBuffer,re.segments)}}function maplibre_gl_If(e,t,n,r){let i={parentTile:null,parentScaleBy:1,parentTopLeft:[0,0],fadeValues:{tileOpacity:1,parentTileOpacity:1,fadeMix:{opacity:1,mix:0}}};if(n===0||r)return i;if(e.fadingParentID){let r=t.getLoadedTile(e.fadingParentID);if(!r)return i;let a=2**(r.tileID.overscaledZ-e.tileID.overscaledZ);return{parentTile:r,parentScaleBy:a,parentTopLeft:[e.tileID.canonical.x*a%1,e.tileID.canonical.y*a%1],fadeValues:maplibre_gl_Lf(e,r,n)}}return e.selfFading?{parentTile:null,parentScaleBy:1,parentTopLeft:[0,0],fadeValues:maplibre_gl_Rf(e,n)}:i}function maplibre_gl_Lf(e,t,n){let r=maplibre_gl_U(),i=(r-e.timeAdded)/n,a=(r-t.timeAdded)/n,o=e.fadingDirection===1,s=maplibre_gl_shared_yt(i,0,1),c=maplibre_gl_shared_yt(1-a,0,1),l=o?s:c;return{tileOpacity:l,parentTileOpacity:o?c:s,fadeMix:{opacity:1,mix:1-l}}}function maplibre_gl_Rf(e,t){let n=(maplibre_gl_U()-e.timeAdded)/t,r=maplibre_gl_shared_yt(n,0,1);return{tileOpacity:r,fadeMix:{opacity:r,mix:0}}}function maplibre_gl_zf(e,t,n,r,i){let a=n.paint.get(`background-color`),o=n.paint.get(`background-opacity`);if(o===0)return;let{isRenderingToTexture:s}=i,c=e.context,l=c.gl,u=e.style.projection,d=e.transform,f=d.tileSize,p=n.paint.get(`background-pattern`);if(e.isPatternMissing(p))return;let m=!p&&a.a===1&&o===1&&e.opaquePassEnabledForLayer()?`opaque`:`translucent`;if(i.currentPass!==m)return;let h=maplibre_gl_Q.disabled,g=e.getDepthModeForSublayer(0,m===`opaque`?maplibre_gl_Z.ReadWrite:maplibre_gl_Z.ReadOnly),_=e.colorModeForRenderPass(),v=e.useProgram(p?`backgroundPattern`:`background`),y=r||maplibre_gl_jo(d,{tileSize:f,terrain:e.style.map.terrain});p&&(c.activeTexture.set(l.TEXTURE0),e.patternAtlas.bind(e.context));let b=n.getCrossfadeParameters();for(let t of y){let r=d.getProjectionData({overscaledTileID:t,applyGlobeMatrix:!s,applyTerrainMatrix:!0}),i=p?maplibre_gl_Vu(o,e,p,{tileID:t,tileSize:f},b):maplibre_gl_Bu(o,a),m=e.getTerrainDataForTile(t,s),y=u.getMeshFromTileID(c,t.canonical,!1,!0,`raster`);v.draw(c,l.TRIANGLES,g,h,_,maplibre_gl_$.backCCW,i,m,r,n.id,y.vertexBuffer,y.indexBuffer,y.segments)}}const maplibre_gl_Bf=new maplibre_gl_shared_V(1,0,0,1),maplibre_gl_Vf=new maplibre_gl_shared_V(0,1,0,1),maplibre_gl_Hf=new maplibre_gl_shared_V(0,0,1,1),maplibre_gl_Uf=new maplibre_gl_shared_V(1,0,1,1),maplibre_gl_Wf=new maplibre_gl_shared_V(0,1,1,1);function maplibre_gl_Gf(e){let t=e.transform.padding;maplibre_gl_qf(e,e.transform.height-(t.top||0),3,maplibre_gl_Bf),maplibre_gl_qf(e,t.bottom||0,3,maplibre_gl_Vf),maplibre_gl_Jf(e,t.left||0,3,maplibre_gl_Hf),maplibre_gl_Jf(e,e.transform.width-(t.right||0),3,maplibre_gl_Uf);let n=e.transform.centerPoint;maplibre_gl_Kf(e,n.x,e.transform.height-n.y,maplibre_gl_Wf)}function maplibre_gl_Kf(e,t,n,r){maplibre_gl_Yf(e,t-1,n-10,2,20,r),maplibre_gl_Yf(e,t-10,n-1,20,2,r)}function maplibre_gl_qf(e,t,n,r){maplibre_gl_Yf(e,0,t+n/2,e.transform.width,n,r)}function maplibre_gl_Jf(e,t,n,r){maplibre_gl_Yf(e,t-n/2,0,n,e.transform.height,r)}function maplibre_gl_Yf(e,t,n,r,i,a){let o=e.context,s=o.gl;s.enable(s.SCISSOR_TEST),s.scissor(t*e.pixelRatio,n*e.pixelRatio,r*e.pixelRatio,i*e.pixelRatio),o.clear({color:a}),s.disable(s.SCISSOR_TEST)}function maplibre_gl_Xf(e,t,n){for(let r of n)maplibre_gl_Zf(e,t,r)}function maplibre_gl_Zf(e,t,n){let r=e.context,i=r.gl,a=e.useProgram(`debug`),o=maplibre_gl_Z.disabled,s=maplibre_gl_Q.disabled,c=e.colorModeForRenderPass(),l=`$debug`,u=e.style.map.terrain?.getTerrainData(n);r.activeTexture.set(i.TEXTURE0);let d=t.getTileByID(n.key).latestRawTileData?.byteLength||0,f=Math.floor(d/1024),p=t.getTile(n).tileSize,m=512/Math.min(p,512)*(n.overscaledZ/e.transform.zoom)*.5,h=n.canonical.toString();n.overscaledZ!==n.canonical.z&&(h+=` => ${n.overscaledZ}`),maplibre_gl_Qf(e,`${h} ${f}kB`);let g=e.transform.getProjectionData({overscaledTileID:n,applyGlobeMatrix:!0,applyTerrainMatrix:!0});a.draw(r,i.TRIANGLES,o,s,maplibre_gl_Ld.alphaBlended,maplibre_gl_$.disabled,maplibre_gl_ou(maplibre_gl_shared_V.transparent,m),null,g,l,e.debugBuffer,e.quadTriangleIndexBuffer,e.debugSegments),a.draw(r,i.LINE_STRIP,o,s,c,maplibre_gl_$.disabled,maplibre_gl_ou(maplibre_gl_shared_V.red),u,g,l,e.debugBuffer,e.tileBorderIndexBuffer,e.debugSegments)}function maplibre_gl_Qf(e,t){e.initDebugOverlayCanvas();let n=e.debugOverlayCanvas,r=e.context.gl,i=e.debugOverlayCanvas.getContext(`2d`);i.clearRect(0,0,n.width,n.height),i.shadowColor=`white`,i.shadowBlur=2,i.lineWidth=1.5,i.strokeStyle=`white`,i.textBaseline=`top`,i.font=`bold 36px Open Sans, sans-serif`,i.fillText(t,5,5),i.strokeText(t,5,5),e.debugOverlayTexture.update(n),e.debugOverlayTexture.bind(r.LINEAR,r.CLAMP_TO_EDGE)}function maplibre_gl_$f(e,t){let n=null,r=Object.values(e._layers).flatMap(n=>n.source&&!n.isHidden(t)?[e.tileManagers[n.source]]:[]),i=r.filter(e=>e.getSource().type===`vector`),a=r.filter(e=>e.getSource().type!==`vector`),o=e=>{(!n||n.getSource().maxzoom<e.getSource().maxzoom)&&(n=e)};for(let e of i)o(e);if(!n)for(let e of a)o(e);return n}function maplibre_gl_ep(e,t,n,r){let{isRenderingGlobe:i}=r,a=e.context,o=n.implementation,s=e.style.projection,c=e.transform,l=c.getProjectionDataForCustomLayer(i),u={farZ:c.farZ,nearZ:c.nearZ,fov:c.fov*Math.PI/180,modelViewProjectionMatrix:c.modelViewProjectionMatrix,projectionMatrix:c.projectionMatrix,shaderData:{variantName:s.shaderVariantName,vertexShaderPrelude:`const float PI = 3.141592653589793;\nuniform mat4 u_projection_matrix;\n${s.shaderPreludeCode.vertexSource}`,define:s.shaderDefine},defaultProjectionData:l,getProjectionData:e=>c.getProjectionData({overscaledTileID:new maplibre_gl_shared_fb(e.tileID.canonical.z,e.tileID.wrap??0,e.tileID.canonical.z,e.tileID.canonical.x,e.tileID.canonical.y),aligned:e.aligned,applyGlobeMatrix:e.applyGlobeMatrix,applyTerrainMatrix:e.applyTerrainMatrix})},d=o.renderingMode?o.renderingMode:`2d`;if(r.currentPass===`offscreen`){let t=o.prerender;t&&(e.setCustomLayerDefaults(),a.setColorMode(e.colorModeForRenderPass()),t.call(o,a.gl,u),a.setDirty(),e.setBaseState())}else if(r.currentPass===`translucent`){e.setCustomLayerDefaults(),a.setColorMode(e.colorModeForRenderPass()),a.setStencilMode(maplibre_gl_Q.disabled);let t=d===`3d`?e.getDepthModeFor3D():e.getDepthModeForSublayer(0,maplibre_gl_Z.ReadOnly);a.setDepthMode(t),o.render(a.gl,u),a.setDirty(),e.setBaseState(),a.bindFramebuffer.set(null)}}function maplibre_gl_tp(e,t){let n=e.context,r=n.gl,i=e.transform,a=maplibre_gl_Ld.unblended,o=new maplibre_gl_Z(r.LEQUAL,maplibre_gl_Z.ReadWrite,[0,1]),s=t.tileManager.getRenderableTiles(),c=e.useProgram(`terrainDepth`);n.bindFramebuffer.set(t.getFramebuffer().framebuffer),n.viewport.set([0,0,e.width/devicePixelRatio,e.height/devicePixelRatio]),n.clear({color:maplibre_gl_shared_V.white,depth:1});for(let e of s){let s=t.getTerrainMesh(e.tileID),l=t.getTerrainData(e.tileID),u=i.getProjectionData({overscaledTileID:e.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0}),d=maplibre_gl_El(t.getSkirtLength(i.zoom));c.draw(n,r.TRIANGLES,o,maplibre_gl_Q.disabled,a,maplibre_gl_$.backCCW,d,l,u,`terrain`,s.vertexBuffer,s.indexBuffer,s.segments)}n.bindFramebuffer.set(null),n.viewport.set([0,0,e.width,e.height])}function maplibre_gl_np(e,t,n,r){let{isRenderingGlobe:i}=r,a=e.context,o=a.gl,s=e.transform,c=e.colorModeForRenderPass(),l=e.getDepthModeFor3D(),u=e.useProgram(`terrain`);a.bindFramebuffer.set(null),a.viewport.set([0,0,e.width,e.height]);for(let r of n){let n=t.getTerrainMesh(r.tileID),d=e.renderToTexture.getTexture(r),f=t.getTerrainData(r.tileID);a.activeTexture.set(o.TEXTURE0),d.bind(o.LINEAR,o.CLAMP_TO_EDGE,o.LINEAR_MIPMAP_LINEAR);let p=t.getSkirtLength(s.zoom),m=s.calculateFogMatrix(r.tileID.toUnwrapped()),h=maplibre_gl_Tl(p,m,e.style.sky,s.pitch,i),g=s.getProjectionData({overscaledTileID:r.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0});u.draw(a,o.TRIANGLES,l,maplibre_gl_Q.disabled,c,maplibre_gl_$.backCCW,h,f,g,`terrain`,n.vertexBuffer,n.indexBuffer,n.segments)}}function maplibre_gl_rp(e,t){if(!t.mesh){let n=new maplibre_gl_shared_Pl;n.emplaceBack(-1,-1),n.emplaceBack(1,-1),n.emplaceBack(1,1),n.emplaceBack(-1,1);let r=new maplibre_gl_shared_Zl;r.emplaceBack(0,1,2),r.emplaceBack(0,2,3),t.mesh=new maplibre_gl_Ga(e.createVertexBuffer(n,maplibre_gl_Ka.members),e.createIndexBuffer(r),maplibre_gl_shared_nu.simpleSegment(0,0,n.length,r.length))}return t.mesh}function maplibre_gl_ip(e,t){let n=e.context,r=n.gl,i=maplibre_gl_Gu(t,e.transform,e.pixelRatio),a=new maplibre_gl_Z(r.LEQUAL,maplibre_gl_Z.ReadWrite,[0,1]),o=maplibre_gl_Q.disabled,s=e.colorModeForRenderPass(),c=e.useProgram(`sky`),l=maplibre_gl_rp(n,t);c.draw(n,r.TRIANGLES,a,o,s,maplibre_gl_$.disabled,i,null,void 0,`sky`,l.vertexBuffer,l.indexBuffer,l.segments)}function maplibre_gl_ap(e,t){let n=e.getCartesianPosition();maplibre_gl_shared_ge(n,n);let r=maplibre_gl_shared_C(new Float64Array(16));return e.properties.get(`anchor`)===`map`&&(maplibre_gl_shared_A(r,r,t.rollInRadians),maplibre_gl_shared_O(r,r,-t.pitchInRadians),maplibre_gl_shared_A(r,r,t.bearingInRadians),maplibre_gl_shared_O(r,r,t.center.lat*Math.PI/180),maplibre_gl_shared_k(r,r,-t.center.lng*Math.PI/180)),maplibre_gl_shared_ye(n,n,r),n}function maplibre_gl_op(e,t,n){let r=e.context,i=r.gl,a=e.useProgram(`atmosphere`),o=new maplibre_gl_Z(i.LEQUAL,maplibre_gl_Z.ReadOnly,[0,1]),s=e.transform,c=maplibre_gl_ap(n,e.transform),l=s.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),u=t.properties.get(`atmosphere-blend`)*l.projectionTransition;if(u===0)return;let d=maplibre_gl_Bc(s.worldSize,s.center.lat),f=maplibre_gl_Vc(s),p=maplibre_gl_Uu(c,u,f,d,s.inverseProjectionMatrix),m=maplibre_gl_rp(r,t);a.draw(r,i.TRIANGLES,o,maplibre_gl_Q.disabled,maplibre_gl_Ld.alphaBlended,maplibre_gl_$.disabled,p,null,null,`atmosphere`,m.vertexBuffer,m.indexBuffer,m.segments)}const maplibre_gl_sp={symbol:maplibre_gl_Kd,circle:maplibre_gl_ef,heatmap:maplibre_gl_tf,line:maplibre_gl_vf,fill:maplibre_gl_xf,fillExtrusion:maplibre_gl_Tf,hillshade:maplibre_gl_Df,colorRelief:maplibre_gl_Af,raster:maplibre_gl_Pf,background:maplibre_gl_zf,sky:maplibre_gl_ip,atmosphere:maplibre_gl_op,custom:maplibre_gl_ep,debug:maplibre_gl_Xf,debugPadding:maplibre_gl_Gf,terrainDepth:maplibre_gl_tp};function maplibre_gl_cp(e,t,n){let r=t?.transitionState??0;return{currentPass:`offscreen`,currentLayer:0,opaquePassCutoff:1/0,depthRangeFor3D:[0,1],isRenderingToTexture:!1,transform:e,terrain:n,projectionTransition:r,isRenderingGlobe:r>0}}var maplibre_gl_lp=class e{constructor(e,t){this.drawFunctions=maplibre_gl_sp,this.context=new maplibre_gl_Rd(e),this.transform=t,this.layerOpacityFbo=null,this._tileTextures={},this._rttObjectRecyclePool=[],this._rttSharedFbo=null,this.terrainFacilitator={depthDirty:!0,matrix:maplibre_gl_shared_C(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=maplibre_gl_Ho.maxOverzooming+maplibre_gl_Ho.maxUnderzooming+1,this.depthEpsilon=1/2**16,this.crossTileSymbolIndex=new maplibre_gl_Ys}resize(e,t,n){if(this.width=Math.floor(e*n),this.height=Math.floor(t*n),this.pixelRatio=n,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(let e of this.style._order)this.style._layers[e].resize()}setup(){let e=this.context,t=new maplibre_gl_shared_Pl;t.emplaceBack(0,0),t.emplaceBack((/* inlined export .Rr */8192),0),t.emplaceBack(0,(/* inlined export .Rr */8192)),t.emplaceBack((/* inlined export .Rr */8192),(/* inlined export .Rr */8192)),this.tileExtentBuffer=e.createVertexBuffer(t,maplibre_gl_Ka.members),this.tileExtentSegments=maplibre_gl_shared_nu.simpleSegment(0,0,4,2);let n=new maplibre_gl_shared_Pl;n.emplaceBack(0,0),n.emplaceBack((/* inlined export .Rr */8192),0),n.emplaceBack(0,(/* inlined export .Rr */8192)),n.emplaceBack((/* inlined export .Rr */8192),(/* inlined export .Rr */8192)),this.debugBuffer=e.createVertexBuffer(n,maplibre_gl_Ka.members),this.debugSegments=maplibre_gl_shared_nu.simpleSegment(0,0,4,5);let r=new maplibre_gl_shared_Il;r.emplaceBack(0,0,0,0),r.emplaceBack((/* inlined export .Rr */8192),0,(/* inlined export .Rr */8192),0),r.emplaceBack(0,(/* inlined export .Rr */8192),0,(/* inlined export .Rr */8192)),r.emplaceBack((/* inlined export .Rr */8192),(/* inlined export .Rr */8192),(/* inlined export .Rr */8192),(/* inlined export .Rr */8192)),this.rasterBoundsBuffer=e.createVertexBuffer(r,maplibre_gl_bl.members),this.rasterBoundsSegments=maplibre_gl_shared_nu.simpleSegment(0,0,4,2);let i=new maplibre_gl_shared_Pl;i.emplaceBack(0,0),i.emplaceBack((/* inlined export .Rr */8192),0),i.emplaceBack(0,(/* inlined export .Rr */8192)),i.emplaceBack((/* inlined export .Rr */8192),(/* inlined export .Rr */8192)),this.rasterBoundsBufferPosOnly=e.createVertexBuffer(i,maplibre_gl_Ka.members),this.rasterBoundsSegmentsPosOnly=maplibre_gl_shared_nu.simpleSegment(0,0,4,5);let a=new maplibre_gl_shared_Pl;a.emplaceBack(0,0),a.emplaceBack(1,0),a.emplaceBack(0,1),a.emplaceBack(1,1),this.viewportBuffer=e.createVertexBuffer(a,maplibre_gl_Ka.members),this.viewportSegments=maplibre_gl_shared_nu.simpleSegment(0,0,4,2);let o=new maplibre_gl_shared_$l;o.emplaceBack(0),o.emplaceBack(1),o.emplaceBack(3),o.emplaceBack(2),o.emplaceBack(0),this.tileBorderIndexBuffer=e.createIndexBuffer(o);let s=new maplibre_gl_shared_Zl;s.emplaceBack(1,0,2),s.emplaceBack(1,2,3),this.quadTriangleIndexBuffer=e.createIndexBuffer(s);let c=this.context.gl;this.stencilClearMode=new maplibre_gl_Q({func:c.ALWAYS,mask:0},0,255,c.ZERO,c.ZERO,c.ZERO),this.tileExtentMesh=new maplibre_gl_Ga(this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}clearStencil(){let e=this.context,t=e.gl;this.nextStencilID=1,this.currentStencilSource=void 0;let n=maplibre_gl_shared_b();maplibre_gl_shared_ie(n,0,this.width,this.height,0,0,1),maplibre_gl_shared_D(n,n,[t.drawingBufferWidth,t.drawingBufferHeight,0]);let r={mainMatrix:n,tileMercatorCoords:[0,0,1,1],clippingPlane:[0,0,0,0],projectionTransition:0,fallbackMatrix:n,clipAntimeridian:!1};this.useProgram(`clippingMask`,null,!0).draw(e,t.TRIANGLES,maplibre_gl_Z.disabled,this.stencilClearMode,maplibre_gl_Ld.disabled,maplibre_gl_$.disabled,null,null,r,`$clipping`,this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}renderTileClippingMasks(e,t,n){if(this.currentStencilSource===e.source||!e.isTileClipped()||!t?.length)return;this.currentStencilSource=e.source,this.nextStencilID+t.length>256&&this.clearStencil();let r=this.context;r.setColorMode(maplibre_gl_Ld.disabled),r.setDepthMode(maplibre_gl_Z.disabled);let i={};for(let e of t)i[e.key]=this.nextStencilID++;this.style.projection.useSubdivision&&this._renderTileMasks(i,t,n,!0),this._renderTileMasks(i,t,n,!1),this._tileClippingMaskIDs=i}_renderTileMasks(e,t,n,r){let i=this.context,a=i.gl,o=this.style.projection,s=this.transform,c=this.useProgram(`clippingMask`);for(let l of t){let t=e[l.key],u=this.getTerrainDataForTile(l,n),d=o.getMeshFromTileID(this.context,l.canonical,r,!0,`stencil`),f=s.getProjectionData({overscaledTileID:l,applyGlobeMatrix:!n,applyTerrainMatrix:!0});c.draw(i,a.TRIANGLES,maplibre_gl_Z.disabled,new maplibre_gl_Q({func:a.ALWAYS,mask:0},t,255,a.KEEP,a.KEEP,a.REPLACE),maplibre_gl_Ld.disabled,n?maplibre_gl_$.disabled:maplibre_gl_$.backCCW,null,u,f,`$clipping`,d.vertexBuffer,d.indexBuffer,d.segments)}}getTerrainDataForTile(e,t){return t&&this.style.projection?.name===`mercator`?null:this.style.map.terrain?.getTerrainData(e)||null}_renderTilesDepthBuffer(){let e=this.context,t=e.gl,n=this.style.projection,r=this.transform,i=this.useProgram(`depth`),a=this.getDepthModeFor3D(),o=maplibre_gl_jo(r,{tileSize:r.tileSize});for(let s of o){let o=this.style.map.terrain?.getTerrainData(s),c=n.getMeshFromTileID(this.context,s.canonical,!0,!0,`raster`),l=r.getProjectionData({overscaledTileID:s,applyGlobeMatrix:!0,applyTerrainMatrix:!0});i.draw(e,t.TRIANGLES,a,maplibre_gl_Q.disabled,maplibre_gl_Ld.disabled,maplibre_gl_$.backCCW,null,o,l,`$clipping`,c.vertexBuffer,c.indexBuffer,c.segments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();let e=this.nextStencilID++,t=this.context.gl;return new maplibre_gl_Q({func:t.NOTEQUAL,mask:255},e,255,t.KEEP,t.KEEP,t.REPLACE)}stencilModeForClipping(e){let t=this.context.gl;return new maplibre_gl_Q({func:t.EQUAL,mask:255},this._tileClippingMaskIDs[e.key],0,t.KEEP,t.KEEP,t.REPLACE)}getStencilConfigForOverlapAndUpdateStencilID(e){let t=this.context.gl,n=e.sort((e,t)=>t.overscaledZ-e.overscaledZ),r=n[n.length-1].overscaledZ,i=n[0].overscaledZ-r+1;if(i>1){this.currentStencilSource=void 0,this.nextStencilID+i>256&&this.clearStencil();let e={};for(let n=0;n<i;n++)e[n+r]=new maplibre_gl_Q({func:t.GEQUAL,mask:255},n+this.nextStencilID,255,t.KEEP,t.KEEP,t.REPLACE);return this.nextStencilID+=i,[e,n]}return[{[r]:maplibre_gl_Q.disabled},n]}stencilConfigForOverlapTwoPass(e){let t=this.context.gl,n=e.sort((e,t)=>t.overscaledZ-e.overscaledZ),r=n[n.length-1].overscaledZ,i=n[0].overscaledZ-r+1;if(this.clearStencil(),i>1){let e={},a={};for(let n=0;n<i;n++)e[n+r]=new maplibre_gl_Q({func:t.GREATER,mask:255},i+1+n,255,t.KEEP,t.KEEP,t.REPLACE),a[n+r]=new maplibre_gl_Q({func:t.GREATER,mask:255},1+n,255,t.KEEP,t.KEEP,t.REPLACE);return this.nextStencilID=i*2+1,[e,a,n]}return this.nextStencilID=3,[{[r]:new maplibre_gl_Q({func:t.GREATER,mask:255},2,255,t.KEEP,t.KEEP,t.REPLACE)},{[r]:new maplibre_gl_Q({func:t.GREATER,mask:255},1,255,t.KEEP,t.KEEP,t.REPLACE)},n]}colorModeForRenderPass(){let e=this.context.gl;if(this._showOverdrawInspector){let t=1/8;return new maplibre_gl_Ld([e.CONSTANT_COLOR,e.ONE],new maplibre_gl_shared_V(t,t,t,0),[!0,!0,!0,!0])}return this.renderOptions.currentPass===`opaque`?maplibre_gl_Ld.unblended:maplibre_gl_Ld.alphaBlended}getDepthModeForSublayer(e,t,n){if(!this.opaquePassEnabledForLayer())return maplibre_gl_Z.disabled;let r=1-((1+this.renderOptions.currentLayer)*this.numSublayers+e)*this.depthEpsilon;return new maplibre_gl_Z(n||this.context.gl.LEQUAL,t,[r,r])}getDepthModeFor3D(){return new maplibre_gl_Z(this.context.gl.LEQUAL,maplibre_gl_Z.ReadWrite,this.renderOptions.depthRangeFor3D)}opaquePassEnabledForLayer(){return this.renderOptions.currentLayer<this.renderOptions.opaquePassCutoff}render(e,t){this.style=e,this.options=t;let n=this.renderOptions=maplibre_gl_cp(this.transform,e.projection,e.map.terrain??null);this.lineAtlas=e.lineAtlas,this.imageManager=e.imageManager,this.patternAtlas=e.patternAtlas,this.glyphManager=e.glyphManager,this.symbolFadeChange=e.placement.symbolFadeChange(maplibre_gl_U()),maplibre_gl_Id(this.context.frameUniformBuffer,this),this.imageManager.beginFrame();let r=this.style._order,i=this.style.tileManagers,a={},o={},s={};for(let e in i){let t=i[e];t.used&&t.prepare(this.context),a[e]=t.getVisibleCoordinates(!1),o[e]=a[e].slice().reverse(),s[e]=t.getVisibleCoordinates(!0).reverse()}n.opaquePassCutoff=1/0;for(let e=0;e<r.length;e++){let t=r[e];if(this.style._layers[t].is3D()){n.opaquePassCutoff=e;break}}this.maybeDrawDepth(),this.renderToTexture&&(this.renderToTexture.prepareForRender(this.style,this.transform.zoom),n.opaquePassCutoff=0),n.currentPass=`offscreen`;for(let e of r){let t=this.style._layers[e];if(!t.hasOffscreenPass()||t.isHidden(this.transform.zoom))continue;let r=o[t.source];(t.type===`custom`||r.length)&&this.renderLayer(this,i[t.source],t,r,n)}if(this.context.viewport.set([0,0,this.width,this.height]),this.context.bindFramebuffer.set(null),this.context.clear({color:t.showOverdrawInspector?maplibre_gl_shared_V.black:maplibre_gl_shared_V.transparent,depth:1}),this.clearStencil(),this.style.sky&&this.drawFunctions.sky(this,this.style.sky),this._showOverdrawInspector=t.showOverdrawInspector,n.depthRangeFor3D=[0,1-(e._order.length+2)*this.numSublayers*this.depthEpsilon],!this.renderToTexture)for(n.currentPass=`opaque`,n.currentLayer=r.length-1;n.currentLayer>=0;n.currentLayer--){let e=this.style._layers[r[n.currentLayer]];if(e.isHidden(this.transform.zoom))continue;let t=i[e.source],o=a[e.source];this.renderTileClippingMasks(e,o,!1),this.renderLayer(this,t,e,o,n)}n.currentPass=`translucent`;let c=!1;for(n.currentLayer=0;n.currentLayer<r.length;n.currentLayer++){let e=this.style._layers[r[n.currentLayer]];if(e.isHidden(this.transform.zoom))continue;let t=i[e.source];if(this.renderToTexture?.renderLayer(e,n))continue;!this.opaquePassEnabledForLayer()&&!c&&(c=!0,n.isRenderingGlobe&&!this.style.map.terrain&&this._renderTilesDepthBuffer());let l=(e.type===`symbol`?s:o)[e.source];this.renderTileClippingMasks(e,a[e.source],!!this.renderToTexture),this.renderLayer(this,t,e,l,n)}if(n.isRenderingGlobe&&this.drawFunctions.atmosphere(this,this.style.sky,this.style.light),this.options.showTileBoundaries){let e=maplibre_gl_$f(this.style,this.transform.zoom);e&&this.drawFunctions.debug(this,e,e.getVisibleCoordinates())}this.options.showPadding&&this.drawFunctions.debugPadding(this),this.context.setDefault()}maybeDrawDepth(){if(!this.style?.projection||!this.style.map?.terrain)return;let e=this.terrainFacilitator.matrix,t=this.transform.modelViewProjectionMatrix,n=this.terrainFacilitator.depthDirty;n||=!maplibre_gl_shared_oe(e,t),n||=this.style.map.terrain.tileManager.anyTilesAfterTime(this.terrainFacilitator.renderTime),n&&(maplibre_gl_shared_S(e,t),this.terrainFacilitator.renderTime=maplibre_gl_U(),this.terrainFacilitator.depthDirty=!1,this.drawFunctions.terrainDepth(this,this.style.map.terrain))}renderLayer(e,t,n,r,i){if(n.isHidden(this.transform.zoom)||n.type!==`background`&&n.type!==`custom`&&!(r||[]).length)return;this.id=n.id;let a=this.drawFunctions;qy(n)?a.symbol(e,t,n,r,this.style.placement.variableOffsets,i):bd(n)?a.circle(e,t,n,r,i):Pd(n)?a.heatmap(e,t,n,r,i):ag(n)?a.line(e,t,n,r,i):maplibre_gl_shared_gp(n)?a.fill(e,t,n,r,i):pm(n)?a.fillExtrusion(e,t,n,r,i):zd(n)?a.hillshade(e,t,n,r,i):Jd(n)?a.colorRelief(e,t,n,r,i):maplibre_gl_shared_Gc(n)?a.raster(e,t,n,r,i):$y(n)?a.background(e,t,n,r,i):maplibre_gl_shared_nb(n)&&a.custom(e,t,n,i)}static{this.MAX_TEXTURE_POOL_SIZE_PER_BUCKET=50}saveTileTexture(t){let n=this._tileTextures[t.size[0]];n?n.length<e.MAX_TEXTURE_POOL_SIZE_PER_BUCKET?n.push(t):t.destroy():this._tileTextures[t.size[0]]=[t]}getTileTexture(e){let t=this._tileTextures[e];return t&&t.length>0?t.pop():null}acquireRTT(e){let t=this.context.gl,n=this._rttObjectRecyclePool.pop();if(n)return n.size!==e&&(n.texture.update({width:e,height:e,data:null},{premultiply:!1,useMipmap:!0}),n.texture.bind(t.LINEAR,t.CLAMP_TO_EDGE,t.LINEAR_MIPMAP_LINEAR),this.context.extTextureFilterAnisotropic&&t.texParameterf(t.TEXTURE_2D,this.context.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,this.context.extTextureFilterAnisotropicMax),n.size=e),n;let r=new Gd(this.context,{width:e,height:e,data:null},t.RGBA,{premultiply:!1,useMipmap:!0});return r.bind(t.LINEAR,t.CLAMP_TO_EDGE,t.LINEAR_MIPMAP_LINEAR),this.context.extTextureFilterAnisotropic&&t.texParameterf(t.TEXTURE_2D,this.context.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,this.context.extTextureFilterAnisotropicMax),{texture:r,size:e}}bindRTT(e){let t=this.context.gl,n=e.size;if(!this._rttSharedFbo){let e=this.context.createFramebuffer(n,n,!0,!0),r=this.context.createRenderbuffer(t.DEPTH_STENCIL,n,n);e.depthAttachment.set(r),this._rttSharedFbo={fbo:e,depthRenderbuffer:r,size:n}}this._rttSharedFbo.size!==n&&(this.context.bindRenderbuffer.set(this._rttSharedFbo.depthRenderbuffer),t.renderbufferStorage(t.RENDERBUFFER,t.DEPTH_STENCIL,n,n),this.context.bindRenderbuffer.set(null),this._rttSharedFbo.fbo.width=n,this._rttSharedFbo.fbo.height=n,this._rttSharedFbo.size=n),this._rttSharedFbo.fbo.colorAttachment.set(e.texture.texture),this.context.bindFramebuffer.set(this._rttSharedFbo.fbo.framebuffer)}releaseRTT(e){this._rttObjectRecyclePool.push(e)}isPatternMissing(e){if(!e)return!1;if(!e.from||!e.to)return!0;let t=this.patternAtlas.getPattern(e.from.toString()),n=this.patternAtlas.getPattern(e.to.toString());return!t||!n}useProgram(e,t,n=!1,r=[]){this.cache||={};let i=!!this.style.map.terrain,a=this.style.projection,o=n?maplibre_gl_ac.projectionMercator:a.shaderPreludeCode,s=n?maplibre_gl_oc:a.shaderDefine,c=`/${n?maplibre_gl_sc:a.shaderVariantName}`,l=t?t.cacheKey:``,u=this._showOverdrawInspector?`/overdraw`:``,d=i?`/terrain`:``,f=r?`/${r.join(`/`)}`:``,p=e+l+c+u+d+f;return this.cache[p]||=new maplibre_gl_Hl(this.context,maplibre_gl_ac[e],t,maplibre_gl_qu[e],this._showOverdrawInspector,i,o,s,r),this.cache[p]}setCustomLayerDefaults(){this.context.setCustomLayerDefaults()}setBaseState(){let e=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(e.FUNC_ADD)}initDebugOverlayCanvas(){if(this.debugOverlayCanvas==null){this.debugOverlayCanvas=document.createElement(`canvas`),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512;let e=this.context.gl;this.debugOverlayTexture=new Gd(this.context,this.debugOverlayCanvas,e.RGBA)}}destroy(){if(this._tileTextures){for(let e in this._tileTextures){let t=this._tileTextures[e];if(t)for(let e of t)e.destroy()}this._tileTextures={}}for(let e of this._rttObjectRecyclePool)e.texture.destroy();if(this._rttObjectRecyclePool=[],this._rttSharedFbo){this._rttSharedFbo.fbo.colorAttachment.set(null),this._rttSharedFbo.fbo.depthAttachment.set(null);let e=this.context.gl;e.deleteRenderbuffer(this._rttSharedFbo.depthRenderbuffer),e.deleteFramebuffer(this._rttSharedFbo.fbo.framebuffer),this._rttSharedFbo=null}if(this.layerOpacityFbo?.destroy(),this.layerOpacityFbo=null,this.tileExtentBuffer&&this.tileExtentBuffer.destroy(),this.debugBuffer&&this.debugBuffer.destroy(),this.rasterBoundsBuffer&&this.rasterBoundsBuffer.destroy(),this.rasterBoundsBufferPosOnly&&this.rasterBoundsBufferPosOnly.destroy(),this.viewportBuffer&&this.viewportBuffer.destroy(),this.tileBorderIndexBuffer&&this.tileBorderIndexBuffer.destroy(),this.quadTriangleIndexBuffer&&this.quadTriangleIndexBuffer.destroy(),this.tileExtentMesh&&this.tileExtentMesh.vertexBuffer?.destroy(),this.tileExtentMesh&&this.tileExtentMesh.indexBuffer?.destroy(),this.debugOverlayTexture&&this.debugOverlayTexture.destroy(),this.context.projectionUniformBuffer.destroy(),this.context.terrainUniformBuffer.destroy(),this.context.frameUniformBuffer.destroy(),this.cache){for(let e in this.cache){let t=this.cache[e];t?.program&&this.context.gl.deleteProgram(t.program)}this.cache={}}this.context&&this.context.setDefault()}overLimit(){let{drawingBufferWidth:e,drawingBufferHeight:t}=this.context.gl;return this.width!==e||this.height!==t}},maplibre_gl_up=class extends Error{constructor(e,t){super(`WebGL2 is required to display this map. We are sorry, but it seems that your browser does not support WebGL2, a technology for rendering 3D graphics on the web. Read more on https://wiki.openstreetmap.org/wiki/This_map_requires_WebGL`),this.name=`GPUInitializationError`,this.requestedAttributes=e,this.statusMessage=t?.statusMessage??null}};function maplibre_gl_dp(e,t){let n=!1,r=null,i,a=()=>{r=null,n&&=(e(...i),r=setTimeout(a,t),!1)};return(...e)=>(n=!0,i=e,r||a(),r)}var maplibre_gl_fp=class{constructor(e){this._getHashParams=()=>new URLSearchParams(window.location.hash.replace(`#`,``)),this._getCurrentHash=()=>{let e=this._getHashParams();return this._hashName?(e.get(this._hashName)||``).split(`/`):([...e.keys()][0]??``).split(`/`)},this._onHashChange=()=>{let e=this._getCurrentHash();if(!this._isValidHash(e))return!1;let t=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(e[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+e[2],+e[1]],zoom:+e[0],bearing:t,pitch:+(e[4]||0)}),!0},this._updateHashUnthrottled=()=>{let e=window.location.href.replace(/(#.*)?$/,this.getHashString());window.history.replaceState(window.history.state,null,e)},this._removeHash=()=>{let e=this._getHashParams();if(this._hashName)e.delete(this._hashName);else{let t=Array.from(e.keys());t.length>0&&e.delete(t[0])}let t=decodeURIComponent(e.toString()).replace(/=&/g,`&`).replace(/=$/g,``),n=t?`#${t}`:``,r=window.location.href.replace(/(#.+)?$/,n);r=r.replace(`&&`,`&`),window.history.replaceState(window.history.state,null,r)},this._updateHash=maplibre_gl_dp(this._updateHashUnthrottled,300),this._hashName=e&&encodeURIComponent(e)}addTo(e){return this._map=e,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(e){let t=this._map.getCenter(),n=Math.round(this._map.getZoom()*100)/100,r=10**Math.ceil((n*Math.LN2+Math.log(512/360/.5))/Math.LN10),i=Math.round(t.lng*r)/r,a=Math.round(t.lat*r)/r,o=this._map.getBearing(),s=this._map.getPitch(),c=``;if(c+=e?`/${i}/${a}/${n}`:`${n}/${a}/${i}`,(o||s)&&(c+=`/${Math.round(o*10)/10}`),s&&(c+=`/${Math.round(s)}`),this._hashName){let e=this._getHashParams();return e.set(this._hashName,c),`#${decodeURIComponent(e.toString()).replace(/=&/g,`&`).replace(/=$/g,``)}`}return`#${c}`}_isValidHash(e){if(e.length<3||e.some(e=>isNaN(+e)))return!1;try{new maplibre_gl_shared_Mp(+e[2],+e[1])}catch{return!1}let t=+e[0],n=+(e[3]||0),r=+(e[4]||0);return t>=this._map.getMinZoom()&&t<=this._map.getMaxZoom()&&n>=-180&&n<=180&&r>=this._map.getMinPitch()&&r<=this._map.getMaxPitch()}};const maplibre_gl_pp={linearity:.3,easing:dist_maplibre_gl_shared_t(0,0,.3,1)},maplibre_gl_mp=maplibre_gl_shared_xt({deceleration:2500,maxSpeed:1400},maplibre_gl_pp),maplibre_gl_hp=maplibre_gl_shared_xt({deceleration:20,maxSpeed:1400},maplibre_gl_pp),maplibre_gl_gp=maplibre_gl_shared_xt({deceleration:1e3,maxSpeed:360},maplibre_gl_pp),maplibre_gl_p=maplibre_gl_shared_xt({deceleration:1e3,maxSpeed:90},maplibre_gl_pp),maplibre_gl_vp=maplibre_gl_shared_xt({deceleration:1e3,maxSpeed:360},maplibre_gl_pp);var maplibre_gl_yp=class{constructor(e){this._map=e,this.clear()}clear(){this._inertiaBuffer=[]}record(e){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:maplibre_gl_U(),settings:e})}_drainInertiaBuffer(){let e=this._inertiaBuffer,t=maplibre_gl_U();for(;e.length>0&&t-e[0].time>160;)e.shift()}_getVelocityEntries(){let e=this._inertiaBuffer,t=maplibre_gl_U()-60,n=Math.max(0,e.length-2);for(;n>0&&e[n-1].time>=t;)n--;return e.slice(n)}_onMoveEnd(e){this._drainInertiaBuffer();let t=this._getVelocityEntries();if(t.length<2){this.clear();return}let n={zoom:0,bearing:0,pitch:0,roll:0,pan:new maplibre_gl_shared_l(0,0),pinchAround:void 0,around:void 0};for(let{settings:e}of t)e.around&&(n.around=e.around),e.pinchAround&&(n.pinchAround=e.pinchAround);for(let{settings:e}of t.slice(1))n.zoom+=e.zoomDelta||0,n.bearing+=e.bearingDelta||0,n.pitch+=e.pitchDelta||0,n.roll+=e.rollDelta||0,e.panDelta&&n.pan._add(e.panDelta);if(!n.pan.mag()&&!n.zoom&&!n.bearing&&!n.pitch&&!n.roll){this.clear();return}let r=maplibre_gl_U()-t[0].time,i={};if(n.pan.mag()){let t=maplibre_gl_xp(n.pan.mag(),r,maplibre_gl_shared_xt({},maplibre_gl_mp,e||{})),a=n.pan.mult(t.amount/n.pan.mag()),o=this._map._camera.cameraHelper.handlePanInertia(a,this._map._camera.transform);i.center=o.easingCenter,i.offset=o.easingOffset,maplibre_gl_bp(i,t)}if(n.zoom){let e=maplibre_gl_xp(n.zoom,r,maplibre_gl_hp);i.zoom=maplibre_gl_shared_kt(this._map.getZoom()+e.amount,this._map.getZoomSnap(),e.amount),maplibre_gl_bp(i,e)}if(n.bearing){let e=maplibre_gl_xp(n.bearing,r,maplibre_gl_gp);i.bearing=this._map.getBearing()+maplibre_gl_shared_yt(e.amount,-179,179),maplibre_gl_bp(i,e)}if(n.pitch){let e=maplibre_gl_xp(n.pitch,r,maplibre_gl_p);i.pitch=this._map.getPitch()+e.amount,maplibre_gl_bp(i,e)}if(n.roll){let e=maplibre_gl_xp(n.roll,r,maplibre_gl_vp);i.roll=this._map.getRoll()+maplibre_gl_shared_yt(e.amount,-179,179),maplibre_gl_bp(i,e)}if(i.zoom||i.bearing){let e=n.pinchAround===void 0?n.around:n.pinchAround;i.around=e?this._map.unproject(e):this._map.getCenter()}return this.clear(),maplibre_gl_shared_xt(i,{noMoveStart:!0})}};function maplibre_gl_bp(e,t){(!e.duration||e.duration<t.duration)&&(e.duration=t.duration,e.easing=t.easing)}function maplibre_gl_xp(e,t,n){let{maxSpeed:r,linearity:i,deceleration:a}=n,o=maplibre_gl_shared_yt(e*i/(t/1e3),-r,r),s=Math.abs(o)/(a*i);return{easing:n.easing,duration:s*1e3,amount:s/2*o}}var maplibre_gl_Sp=class{constructor(e,t){this._map=e,this._clickTolerance=t.clickTolerance}reset(){delete this._mousedownPos}wheel(e){return this._firePreventable(new maplibre_gl_Qr(this._map,e))}mousedown(e,t){return this._mousedownPos=t,this._firePreventable(new maplibre_gl_Xr(e.type,this._map,e))}mouseup(e){this._map.fire(new maplibre_gl_Xr(e.type,this._map,e))}click(e,t){this._mousedownPos&&this._mousedownPos.dist(t)>=this._clickTolerance||this._map.fire(new maplibre_gl_Xr(e.type,this._map,e))}dblclick(e){return this._firePreventable(new maplibre_gl_Xr(e.type,this._map,e))}mouseover(e){this._map.fire(new maplibre_gl_Xr(e.type,this._map,e))}mouseout(e){this._map.fire(new maplibre_gl_Xr(e.type,this._map,e))}touchstart(e){return this._firePreventable(new maplibre_gl_Zr(e.type,this._map,e))}touchmove(e){this._map.fire(new maplibre_gl_Zr(e.type,this._map,e))}touchend(e){this._map.fire(new maplibre_gl_Zr(e.type,this._map,e))}touchcancel(e){this._map.fire(new maplibre_gl_Zr(e.type,this._map,e))}_firePreventable(e){if(this._map.fire(e),e.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}},maplibre_gl_Cp=class{constructor(e){this._map=e}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(e){this._map.fire(new maplibre_gl_Xr(e.type,this._map,e))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new maplibre_gl_Xr(`contextmenu`,this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(e){this._delayContextMenu?this._contextMenuEvent=e:this._ignoreContextMenu||this._map.fire(new maplibre_gl_Xr(e.type,this._map,e)),this._map.listens(`contextmenu`)&&e.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}},maplibre_gl_wp=class{constructor(e,t,n){this._map=e,this._tr=n,this._el=e.getCanvasContainer(),this._container=e.getContainer(),this._clickTolerance=t.clickTolerance||1,t.boxZoom&&typeof t.boxZoom==`object`&&(this._boxZoomEnd=t.boxZoom.boxZoomEnd)}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(e,t){this.isEnabled()&&e.shiftKey&&e.button===0&&(maplibre_gl_W.disableDrag(),this._startPos=this._lastPos=t,this._active=!0)}mousemoveWindow(e,t){if(!this._active)return;let n=t;if(this._lastPos.equals(n)||!this._box&&n.dist(this._startPos)<this._clickTolerance)return;let r=this._startPos;this._lastPos=n,this._box||(this._box=maplibre_gl_W.create(`div`,`maplibregl-boxzoom`,this._container),this._container.classList.add(`maplibregl-crosshair`),this._fireEvent(`boxzoomstart`,e));let i=Math.min(r.x,n.x),a=Math.max(r.x,n.x),o=Math.min(r.y,n.y),s=Math.max(r.y,n.y);this._box.style.transform=`translate(${i}px,${o}px)`,this._box.style.width=`${a-i}px`,this._box.style.height=`${s-o}px`}mouseupWindow(e,t){if(!this._active||e.button!==0)return;let n=this._startPos,r=t;if(this.reset(),maplibre_gl_W.suppressClick(),n.x===r.x&&n.y===r.y)this._fireEvent(`boxzoomcancel`,e);else{if(this._map.fire(new maplibre_gl_$r(`boxzoomend`,{originalEvent:e})),this._boxZoomEnd){this._boxZoomEnd(this._map,n,r,e);return}return{cameraAnimation:e=>e.fitScreenCoordinates(n,r,this._tr.bearing,{linear:!0})}}}keydown(e){this._active&&e.keyCode===27&&(this.reset(),this._fireEvent(`boxzoomcancel`,e))}reset(){this._active=!1,this._container.classList.remove(`maplibregl-crosshair`),this._box&&=(this._box.remove(),null),maplibre_gl_W.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(e,t){return this._map.fire(new maplibre_gl_$r(e,{originalEvent:t}))}};function maplibre_gl_Tp(e,t){if(e.length!==t.length)throw Error(`The number of touches and points are not equal - touches ${e.length}, points ${t.length}`);let n={};for(let r=0;r<e.length;r++)n[e[r].identifier]=t[r];return n}function maplibre_gl_Ep(e){let t=new maplibre_gl_shared_l(0,0);for(let n of e)t._add(n);return t.div(e.length)}var maplibre_gl_Dp=class{constructor(e){this.reset(),this.numTouches=e.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(e,t,n){(this.centroid||n.length>this.numTouches)&&(this.aborted=!0),!this.aborted&&(this.startTime===void 0&&(this.startTime=e.timeStamp),n.length===this.numTouches&&(this.centroid=maplibre_gl_Ep(t),this.touches=maplibre_gl_Tp(n,t)))}touchmove(e,t,n){if(this.aborted||!this.centroid)return;let r=maplibre_gl_Tp(n,t);for(let e in this.touches){let t=this.touches[e],n=r[e];(!n||n.dist(t)>30)&&(this.aborted=!0)}}touchend(e,t,n){if((!this.centroid||e.timeStamp-this.startTime>500)&&(this.aborted=!0),n.length===0){let e=!this.aborted&&this.centroid;if(this.reset(),e)return e}}},maplibre_gl_Op=class{constructor(e){this.singleTap=new maplibre_gl_Dp(e),this.numTaps=e.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(e,t,n){this.singleTap.touchstart(e,t,n)}touchmove(e,t,n){this.singleTap.touchmove(e,t,n)}touchend(e,t,n){let r=this.singleTap.touchend(e,t,n);if(r){let t=e.timeStamp-this.lastTime<500,n=!this.lastTap||this.lastTap.dist(r)<30;if((!t||!n)&&this.reset(),this.count++,this.lastTime=e.timeStamp,this.lastTap=r,this.count===this.numTaps)return this.reset(),r}}},maplibre_gl_kp=class{constructor(e,t){this._tr=t,this._zoomIn=new maplibre_gl_Op({numTouches:1,numTaps:2}),this._zoomOut=new maplibre_gl_Op({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(e,t,n){this._zoomIn.touchstart(e,t,n),this._zoomOut.touchstart(e,t,n)}touchmove(e,t,n){this._zoomIn.touchmove(e,t,n),this._zoomOut.touchmove(e,t,n)}touchend(e,t,n){let r=this._zoomIn.touchend(e,t,n),i=this._zoomOut.touchend(e,t,n),a=this._tr;if(r)return this._active=!0,e.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:t=>t.easeTo({duration:300,zoom:maplibre_gl_shared_kt(a.zoom+1,t.getZoomSnap()),around:a.unproject(r)},{originalEvent:e})};if(i)return this._active=!0,e.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:t=>t.easeTo({duration:300,zoom:maplibre_gl_shared_kt(a.zoom-1,t.getZoomSnap()),around:a.unproject(i)},{originalEvent:e})}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}},maplibre_gl_Ap=class{constructor(e){this._enabled=!!e.enable,this._moveStateManager=e.moveStateManager,this._clickTolerance=e.clickTolerance||1,this._moveFunction=e.move,this._activateOnStart=!!e.activateOnStart,e.assignEvents(this),this.reset()}reset(e){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(e)}_move(...e){let t=this._moveFunction(...e);if(t.bearingDelta||t.pitchDelta||t.rollDelta||t.around||t.panDelta)return this._active=!0,t}dragStart(e,t){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(e)&&(this._moveStateManager.startMove(e),this._lastPoint=Array.isArray(t)?t[0]:t,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(e,t){if(!this.isEnabled())return;let n=this._lastPoint;if(!n)return;if(e.preventDefault(),!this._moveStateManager.isValidMoveEvent(e)){this.reset(e);return}let r=Array.isArray(t)?t[0]:t;if(!(!this._moved&&r.dist(n)<this._clickTolerance))return this._moved=!0,this._lastPoint=r,this._move(n,r)}dragEnd(e){this.isEnabled()&&this._lastPoint&&this._moveStateManager.isValidEndEvent(e)&&(this._moved&&maplibre_gl_W.suppressClick(),this.reset(e))}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}getClickTolerance(){return this._clickTolerance}};const maplibre_gl_jp={0:1,2:2};function maplibre_gl_Mp(e,t){let n=maplibre_gl_jp[t];return e.buttons===void 0||(e.buttons&n)!==n}var maplibre_gl_Np=class{constructor(e){this._correctEvent=e.checkCorrectEvent}startMove(e){this._eventButton=e.button}endMove(e){delete this._eventButton}isValidStartEvent(e){return this._correctEvent(e)}isValidMoveEvent(e){return!maplibre_gl_Mp(e,this._eventButton)}isValidEndEvent(e){return e.button===this._eventButton}},maplibre_gl_Pp=class{constructor(){this._firstTouch=void 0}_isOneFingerTouch(e){return e.targetTouches.length===1}_isSameTouchEvent(e){return e.targetTouches[0].identifier===this._firstTouch}startMove(e){this._firstTouch=e.targetTouches[0].identifier}endMove(e){delete this._firstTouch}isValidStartEvent(e){return this._isOneFingerTouch(e)}isValidMoveEvent(e){return this._isOneFingerTouch(e)&&this._isSameTouchEvent(e)}isValidEndEvent(e){return this._isOneFingerTouch(e)&&this._isSameTouchEvent(e)}},maplibre_gl_Fp=class{constructor(e=new maplibre_gl_Np({checkCorrectEvent:()=>!0}),t=new maplibre_gl_Pp){this.mouseMoveStateManager=e,this.oneFingerTouchMoveStateManager=t}_executeRelevantHandler(e,t,n){if(e instanceof MouseEvent)return t(e);if(typeof TouchEvent<`u`&&e instanceof TouchEvent)return n(e)}startMove(e){this._executeRelevantHandler(e,e=>{this.mouseMoveStateManager.startMove(e)},e=>{this.oneFingerTouchMoveStateManager.startMove(e)})}endMove(e){this._executeRelevantHandler(e,e=>{this.mouseMoveStateManager.endMove(e)},e=>{this.oneFingerTouchMoveStateManager.endMove(e)})}isValidStartEvent(e){return!!this._executeRelevantHandler(e,e=>this.mouseMoveStateManager.isValidStartEvent(e),e=>this.oneFingerTouchMoveStateManager.isValidStartEvent(e))}isValidMoveEvent(e){return!!this._executeRelevantHandler(e,e=>this.mouseMoveStateManager.isValidMoveEvent(e),e=>this.oneFingerTouchMoveStateManager.isValidMoveEvent(e))}isValidEndEvent(e){return!!this._executeRelevantHandler(e,e=>this.mouseMoveStateManager.isValidEndEvent(e),e=>this.oneFingerTouchMoveStateManager.isValidEndEvent(e))}};const maplibre_gl_Ip=e=>{e.mousedown=e.dragStart,e.mousemoveWindow=e.dragMove,e.mouseup=e.dragEnd,e.contextmenu=e=>{e.preventDefault()}};function maplibre_gl_Lp({enable:e,clickTolerance:t}){return new maplibre_gl_Ap({clickTolerance:t,move:(e,t)=>({around:t,panDelta:t.sub(e)}),activateOnStart:!0,moveStateManager:new maplibre_gl_Np({checkCorrectEvent:e=>e.button===0&&!e.ctrlKey}),enable:e,assignEvents:maplibre_gl_Ip})}function maplibre_gl_Rp({enable:e,clickTolerance:t,aroundCenter:n=!0,minPixelCenterThreshold:r=100,rotateSpeed:i=.8},a){return new maplibre_gl_Ap({clickTolerance:t,move:(e,t)=>{let o=a();if(n&&Math.abs(o.y-e.y)>r)return{bearingDelta:maplibre_gl_shared_rn(new maplibre_gl_shared_l(e.x,t.y),t,o)};let s=(t.x-e.x)*i;return n&&t.y<o.y&&(s=-s),{bearingDelta:s}},moveStateManager:new maplibre_gl_Np({checkCorrectEvent:e=>e.button===0&&e.ctrlKey||e.button===2&&!e.ctrlKey}),enable:e,assignEvents:maplibre_gl_Ip})}function maplibre_gl_zp({enable:e,clickTolerance:t,pitchSpeed:n=-.5}){return new maplibre_gl_Ap({clickTolerance:t,move:(e,t)=>({pitchDelta:(t.y-e.y)*n}),moveStateManager:new maplibre_gl_Np({checkCorrectEvent:e=>e.button===0&&e.ctrlKey||e.button===2}),enable:e,assignEvents:maplibre_gl_Ip})}function maplibre_gl_Bp({enable:e,clickTolerance:t,rollDegreesPerPixelMoved:n=.3},r){return new maplibre_gl_Ap({clickTolerance:t,move:(e,t)=>{let i=r(),a=(t.x-e.x)*n;return t.y<i.y&&(a=-a),{rollDelta:a}},moveStateManager:new maplibre_gl_Np({checkCorrectEvent:e=>e.button===2&&e.ctrlKey}),enable:e,assignEvents:maplibre_gl_Ip})}var maplibre_gl_Vp=class{constructor(e,t){this._clickTolerance=e.clickTolerance||1,this._map=t,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new maplibre_gl_shared_l(0,0)}_shouldBePrevented(e){return e<(this._map.cooperativeGestures.isEnabled()?2:1)}touchstart(e,t,n){return this._calculateTransform(e,t,n)}touchmove(e,t,n){if(this._active){if(this._shouldBePrevented(n.length)){this._map.cooperativeGestures.notifyGestureBlocked(`touch_pan`,e);return}return e.preventDefault(),this._calculateTransform(e,t,n)}}touchend(e,t,n){this._calculateTransform(e,t,n),this._active&&this._shouldBePrevented(n.length)&&this.reset()}touchcancel(){this.reset()}_calculateTransform(e,t,n){n.length>0&&(this._active=!0);let r=maplibre_gl_Tp(n,t),i=new maplibre_gl_shared_l(0,0),a=new maplibre_gl_shared_l(0,0),o=0;for(let e in r){let t=r[e],n=this._touches[e];n&&(i._add(t),a._add(t.sub(n)),o++,r[e]=t)}if(this._touches=r,this._shouldBePrevented(o)||!a.mag())return;let s=a.div(o);if(this._sum._add(s),!(this._sum.mag()<this._clickTolerance))return{around:i.div(o),panDelta:s}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}},maplibre_gl_Hp=class{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}touchstart(e,t,n){this._firstTwoTouches||n.length<2||(this._firstTwoTouches=[n[0].identifier,n[1].identifier],this._start([t[0],t[1]]))}touchmove(e,t,n){if(!this._firstTwoTouches)return;e.preventDefault();let[r,i]=this._firstTwoTouches,a=maplibre_gl_Up(n,t,r),o=maplibre_gl_Up(n,t,i);if(!a||!o)return;let s=this._aroundCenter?null:a.add(o).div(2);return this._move([a,o],s,e)}touchend(e,t,n){if(!this._firstTwoTouches)return;let[r,i]=this._firstTwoTouches,a=maplibre_gl_Up(n,t,r),o=maplibre_gl_Up(n,t,i);a&&o||(this._active&&maplibre_gl_W.suppressClick(),this.reset())}touchcancel(){this.reset()}enable(e){this._enabled=!0,this._aroundCenter=!!e&&e.around===`center`}disable(){this._enabled=!1,this.reset()}isEnabled(){return!!this._enabled}isActive(){return!!this._active}};function maplibre_gl_Up(e,t,n){for(let r=0;r<e.length;r++)if(e[r].identifier===n)return t[r]}const maplibre_gl_Wp=.1;function maplibre_gl_Gp(e,t){return Math.log(e/t)/Math.LN2}var maplibre_gl_Kp=class extends maplibre_gl_Hp{constructor(){super(),this._zoomRate=1,this._zoomThreshold=maplibre_gl_Wp}setZoomRate(e){this._zoomRate=e??1}setZoomThreshold(e){this._zoomThreshold=e??maplibre_gl_Wp}reset(){super.reset(),delete this._distance,delete this._startDistance}_start(e){this._startDistance=this._distance=e[0].dist(e[1])}_move(e,t){let n=this._distance;if(this._distance=e[0].dist(e[1]),!(!this._active&&Math.abs(maplibre_gl_Gp(this._distance,this._startDistance))<this._zoomThreshold))return this._active=!0,{zoomDelta:maplibre_gl_Gp(this._distance,n)*this._zoomRate,pinchAround:t}}};function maplibre_gl_qp(e,t){return e.angleWith(t)*180/Math.PI}var maplibre_gl_Jp=class extends maplibre_gl_Hp{reset(){super.reset(),delete this._minDiameter,delete this._startVector,delete this._vector}_start(e){this._startVector=this._vector=e[0].sub(e[1]),this._minDiameter=e[0].dist(e[1])}_move(e,t,n){let r=this._vector;if(this._vector=e[0].sub(e[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:maplibre_gl_qp(this._vector,r),pinchAround:t}}_isBelowThreshold(e){this._minDiameter=Math.min(this._minDiameter,e.mag());let t=25/(Math.PI*this._minDiameter)*360,n=maplibre_gl_qp(e,this._startVector);return Math.abs(n)<t}};function maplibre_gl_Yp(e){return Math.abs(e.y)>Math.abs(e.x)}var maplibre_gl_Xp=class extends maplibre_gl_Hp{constructor(e){super(),this._currentTouchCount=0,this._map=e}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(e,t,n){super.touchstart(e,t,n),this._currentTouchCount=n.length}_start(e){this._lastPoints=e,maplibre_gl_Yp(e[0].sub(e[1]))&&(this._valid=!1)}_move(e,t,n){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;let r=e[0].sub(this._lastPoints[0]),i=e[1].sub(this._lastPoints[1]);if(this._valid=this.gestureBeginsVertically(r,i,n.timeStamp),this._valid)return this._lastPoints=e,this._active=!0,{pitchDelta:(r.y+i.y)/2*-.5}}gestureBeginsVertically(e,t,n){if(this._valid!==void 0)return this._valid;let r=e.mag()>=2,i=t.mag()>=2;if(!r&&!i)return;if(!r||!i)return this._firstMove===void 0&&(this._firstMove=n),n-this._firstMove<100&&void 0;let a=e.y>0==t.y>0;return maplibre_gl_Yp(e)&&maplibre_gl_Yp(t)&&a}};const maplibre_gl_Zp={panStep:100,bearingStep:15,pitchStep:10};var maplibre_gl_Qp=class{constructor(e,t){this._tr=t;let n=maplibre_gl_Zp;this._panStep=n.panStep,this._bearingStep=n.bearingStep,this._pitchStep=n.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(e){if(e.altKey||e.ctrlKey||e.metaKey)return;let t=0,n=0,r=0,i=0,a=0;switch(e.keyCode){case 61:case 107:case 171:case 187:t=1;break;case 189:case 109:case 173:t=-1;break;case 37:e.shiftKey?n=-1:(e.preventDefault(),i=-1);break;case 39:e.shiftKey?n=1:(e.preventDefault(),i=1);break;case 38:e.shiftKey?r=1:(e.preventDefault(),a=-1);break;case 40:e.shiftKey?r=-1:(e.preventDefault(),a=1);break;default:return}return this._rotationDisabled&&(n=0,r=0),{cameraAnimation:o=>{let s=this._tr;o.easeTo({duration:300,easeId:`keyboardHandler`,easing:maplibre_gl_$p,zoom:t?maplibre_gl_shared_kt(s.zoom+t*(e.shiftKey?2:1),o.getZoomSnap()):s.zoom,bearing:s.bearing+n*this._bearingStep,pitch:s.pitch+r*this._pitchStep,offset:[-i*this._panStep,-a*this._panStep],center:s.center},{originalEvent:e})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}};function maplibre_gl_$p(e){return e*(2-e)}const maplibre_gl_em=4.000244140625;var maplibre_gl_tm=class{constructor(e,t,n){this._onTimeout=e=>{this._type=`wheel`,this._delta-=this._lastValue,this._active||this._start(e)},this._map=e,this._tr=n,this._triggerRenderFrame=t,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222}setZoomRate(e){this._defaultZoomRate=e}setWheelZoomRate(e){this._wheelZoomRate=e}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(e){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!e&&e.around===`center`)}disable(){this.isEnabled()&&(this._enabled=!1)}_shouldBePrevented(e){return this._map.cooperativeGestures.isEnabled()?!(e.ctrlKey||this._map.cooperativeGestures.isBypassed(e)):!1}wheel(e){if(!this.isEnabled())return;if(this._shouldBePrevented(e)){this._map.cooperativeGestures.notifyGestureBlocked(`wheel_zoom`,e);return}let t=e.deltaMode===WheelEvent.DOM_DELTA_LINE?e.deltaY*40:e.deltaY,n=maplibre_gl_U(),r=n-(this._lastWheelEventTime||0);this._lastWheelEventTime=n,t!==0&&t%maplibre_gl_em==0?this._type=`wheel`:t!==0&&Math.abs(t)<4?this._type=`trackpad`:r>400?(this._type=null,this._lastValue=t,this._timeout=setTimeout(this._onTimeout,40,e)):this._type||(this._type=Math.abs(r*t)<200?`trackpad`:`wheel`,this._timeout&&(clearTimeout(this._timeout),this._timeout=null,t+=this._lastValue)),e.shiftKey&&t&&(t/=4),this._type&&(this._lastWheelEvent=e,this._delta-=t,this._active||this._start(e)),e.preventDefault()}_start(e){if(!this._delta)return;this._needsRerender=!1,this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);let t=maplibre_gl_W.mousePos(this._map.getCanvas(),e),n=this._tr;this._aroundPoint=this._aroundCenter?n.transform.locationToScreenPoint(maplibre_gl_shared_Mp.convert(n.center)):t,this._needsRerender||(this._needsRerender=!0,this._triggerRenderFrame())}renderFrame(){if(!this._needsRerender||(this._needsRerender=!1,!this.isActive()))return;let e=this._tr.transform;if(typeof this._lastExpectedZoom==`number`){let t=e.zoom-this._lastExpectedZoom;typeof this._startZoom==`number`&&(this._startZoom+=t),typeof this._targetZoom==`number`&&(this._targetZoom+=t)}if(this._delta!==0){let t=this._type===`wheel`&&Math.abs(this._delta)>maplibre_gl_em?this._wheelZoomRate:this._defaultZoomRate,n=2/(1+Math.exp(-Math.abs(this._delta*t)));this._delta<0&&n!==0&&(n=1/n);let r=typeof this._targetZoom==`number`?maplibre_gl_shared_Dt(this._targetZoom):e.scale,i=e.applyConstrain(e.getCameraLngLat(),maplibre_gl_shared_Ot(r*n)).zoom,a=this._map.getZoomSnap();if(this._type===`wheel`&&a>0){let t=maplibre_gl_shared_kt(e.zoom,a);this._targetZoom=maplibre_gl_shared_kt(i,a,i-t)}else this._targetZoom=i;this._type===`wheel`&&(this._startZoom=e.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}let t=typeof this._targetZoom==`number`?this._targetZoom:e.zoom,n=this._startZoom,r=this._easing,i=!1,a;if(this._type===`wheel`&&n&&r){let e=maplibre_gl_U()-this._lastWheelEventTime,o=Math.min((e+5)/200,1),s=r(o);a=maplibre_gl_shared_$r.number(n,t,s),o<1?this._needsRerender=!0:i=!0}else a=t,i=!0;return this._active=!0,i&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._lastExpectedZoom,delete this._finishTimeout},200)),this._lastExpectedZoom=a,{noInertia:!0,needsRenderFrame:!i,zoomDelta:a-e.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(e){let t=maplibre_gl_shared_vt;if(this._prevEase){let e=this._prevEase,n=(maplibre_gl_U()-e.start)/e.duration,r=e.easing(n+.01)-e.easing(n),i=.27/Math.sqrt(r*r+1e-4)*.01,a=Math.sqrt(.0729-i*i);t=dist_maplibre_gl_shared_t(i,a,.25,1)}return this._prevEase={start:maplibre_gl_U(),duration:e,easing:t},t}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,delete this._lastExpectedZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}},maplibre_gl_nm=class{constructor(e,t){this._clickZoom=e,this._tapZoom=t}enable(){this._clickZoom.enable(),this._tapZoom.enable()}disable(){this._clickZoom.disable(),this._tapZoom.disable()}isEnabled(){return this._clickZoom.isEnabled()&&this._tapZoom.isEnabled()}isActive(){return this._clickZoom.isActive()||this._tapZoom.isActive()}},maplibre_gl_rm=class{constructor(e,t){this._tr=t,this.reset()}reset(){this._active=!1}dblclick(e,t){return e.preventDefault(),{cameraAnimation:n=>{n.easeTo({duration:300,zoom:maplibre_gl_shared_kt(this._tr.zoom+(e.shiftKey?-1:1),n.getZoomSnap()),around:this._tr.unproject(t)},{originalEvent:e})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}},maplibre_gl_im=class{constructor(){this._tap=new maplibre_gl_Op({numTouches:1,numTaps:1}),this._zoomRate=1,this.reset()}setZoomRate(e){this._zoomRate=e??1}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,delete this._tapPoint,this._tap.reset()}touchstart(e,t,n){if(!this._swipePoint){if(!this._tapTime)this._tap.touchstart(e,t,n);else{let r=t[0],i=e.timeStamp-this._tapTime<500,a=this._tapPoint.dist(r)<30;!i||!a?this.reset():n.length>0&&(this._swipePoint=r,this._swipeTouch=n[0].identifier)}}}touchmove(e,t,n){if(!this._tapTime)this._tap.touchmove(e,t,n);else if(this._swipePoint){if(n[0].identifier!==this._swipeTouch)return;let r=t[0],i=r.y-this._swipePoint.y;return this._swipePoint=r,e.preventDefault(),this._active=!0,{zoomDelta:i/128*this._zoomRate}}}touchend(e,t,n){if(this._tapTime)this._swipePoint&&n.length===0&&this.reset();else{let r=this._tap.touchend(e,t,n);r&&(this._tapTime=e.timeStamp,this._tapPoint=r)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}},maplibre_gl_am=class{constructor(e,t,n){this._el=e,this._mousePan=t,this._touchPan=n}enable(e){this._inertiaOptions=e||{},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()}},maplibre_gl_om=class{constructor(e,t,n,r){this._pitchWithRotate=e.pitchWithRotate,this._rollEnabled=e.rollEnabled,this._mouseRotate=t,this._mousePitch=n,this._mouseRoll=r}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable(),this._rollEnabled&&this._mouseRoll.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable(),this._mouseRoll.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())&&(!this._rollEnabled||this._mouseRoll.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()||this._mouseRoll.isActive()}},maplibre_gl_sm=class{constructor(e,t,n,r){this._el=e,this._touchZoom=t,this._touchRotate=n,this._tapDragZoom=r,this._rotationDisabled=!1,this._enabled=!0}enable(e){this._touchZoom.enable(e),this._rotationDisabled||this._touchRotate.enable(e),this._tapDragZoom.enable(),this._el.classList.add(`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()}setZoomRate(e){this._touchZoom.setZoomRate(e),this._tapDragZoom.setZoomRate(e)}setZoomThreshold(e){this._touchZoom.setZoomThreshold(e)}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}},maplibre_gl_cm=class{constructor(e,t){this._bypassKey=navigator.userAgent.includes(`Mac`)?`metaKey`:`ctrlKey`,this._map=e,this._options=t,this._enabled=!1}isActive(){return!1}reset(){}_setupUI(){if(this._container)return;let e=this._map.getCanvasContainer();e.classList.add(`maplibregl-cooperative-gestures`),this._container=maplibre_gl_W.create(`div`,`maplibregl-cooperative-gesture-screen`,e);let t=this._map._getUIString(`CooperativeGesturesHandler.WindowsHelpText`);this._bypassKey===`metaKey`&&(t=this._map._getUIString(`CooperativeGesturesHandler.MacHelpText`));let n=this._map._getUIString(`CooperativeGesturesHandler.MobileHelpText`),r=document.createElement(`div`);r.className=`maplibregl-desktop-message`,r.textContent=t,this._container.appendChild(r);let i=document.createElement(`div`);i.className=`maplibregl-mobile-message`,i.textContent=n,this._container.appendChild(i),this._container.setAttribute(`aria-hidden`,`true`)}_destroyUI(){this._container&&(this._container.remove(),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(e){return e[this._bypassKey]}notifyGestureBlocked(e,t){this._enabled&&(this._map.fire(new maplibre_gl_qr(`cooperativegestureprevented`,{gestureType:e,originalEvent:t})),this._container.classList.add(`maplibregl-show`),setTimeout(()=>{this._container.classList.remove(`maplibregl-show`)},100))}},maplibre_gl_lm=class{constructor(e){this._camera=e}get transform(){return this._camera._requestedCameraState||this._camera.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(e){return this.transform.screenPointToLocation(maplibre_gl_shared_l.convert(e),this._camera.terrain)}};const maplibre_gl_um=e=>e.zoom||e.drag||e.roll||e.pitch||e.rotate;var maplibre_gl_dm=class extends maplibre_gl_shared_Nn{};function maplibre_gl_fm(e){return e.panDelta?.mag()||e.zoomDelta||e.bearingDelta||e.pitchDelta||e.rollDelta}var maplibre_gl_pm=class{get _ownerDocument(){return this._el?.ownerDocument||document}get _ownerWindow(){return this._el?.ownerDocument?.defaultView||window}constructor(e,t,n){this._terrainGestureAnchorElevation=null,this.handleWindowEvent=e=>{this.handleEvent(e,`${e.type}Window`)},this.handleEvent=(e,t)=>{if(e.type===`blur`){this.stop(!0);return}this._updatingCamera=!0;let n=e.type===`renderFrame`?void 0:e,r={needsRenderFrame:!1},i={},a={};for(let{handlerName:o,handler:s,allowed:c}of this._handlers){if(!s.isEnabled())continue;let l;if(this._blockedByActive(a,c,o))s.reset();else if(s[t||e.type]){if(maplibre_gl_shared_un(e,t||e.type)){let n=maplibre_gl_W.mousePos(this._map.getCanvas(),e);l=s[t||e.type](e,n)}else if(maplibre_gl_shared_ln(e,t||e.type)){let n=e.touches,r=this._getMapTouches(n),i=maplibre_gl_W.touchPos(this._map.getCanvas(),r);l=s[t||e.type](e,i,r)}else maplibre_gl_shared_dn(t||e.type)||(l=s[t||e.type](e));this.mergeHandlerResult(r,i,l,o,n),l?.needsRenderFrame&&this._triggerRenderFrame()}(l||s.isActive())&&(a[o]=s)}let o={};for(let e in this._previousActiveHandlers)a[e]||(o[e]=n);this._previousActiveHandlers=a,(Object.keys(o).length||maplibre_gl_fm(r))&&(this._changes.push([r,i,o]),this._triggerRenderFrame()),(Object.keys(a).length||maplibre_gl_fm(r))&&this._camera.stop(!0),this._updatingCamera=!1;let{cameraAnimation:s}=r;s&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],s(this._map))},this._map=e,this._camera=t,this._transformProvider=new maplibre_gl_lm(this._camera),this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new maplibre_gl_yp(e),this._bearingSnap=n.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(n);let r=this._el;this._listeners=[[r,`touchstart`,{passive:!0}],[r,`touchmove`,{passive:!1}],[r,`touchend`,void 0],[r,`touchcancel`,void 0],[r,`mousedown`,void 0],[r,`mousemove`,void 0],[r,`mouseup`,void 0],[this._ownerDocument,`mousemove`,{capture:!0}],[this._ownerDocument,`mouseup`,void 0],[r,`mouseover`,void 0],[r,`mouseout`,void 0],[r,`dblclick`,void 0],[r,`click`,void 0],[r,`keydown`,{capture:!1}],[r,`keyup`,void 0],[r,`wheel`,{passive:!1}],[r,`contextmenu`,void 0],[this._ownerWindow,`blur`,void 0]];for(let[e,t,n]of this._listeners)e.addEventListener(t,e===this._ownerDocument?this.handleWindowEvent:this.handleEvent,n)}destroy(){for(let[e,t,n]of this._listeners)e.removeEventListener(t,e===this._ownerDocument?this.handleWindowEvent:this.handleEvent,n)}_addDefaultHandlers(e){let t=this._map,n=t.getCanvasContainer();this._add(`mapEvent`,new maplibre_gl_Sp(t,e));let r=t.boxZoom=new maplibre_gl_wp(t,e,this._transformProvider);this._add(`boxZoom`,r),e.interactive&&e.boxZoom&&r.enable();let i=t.cooperativeGestures=new maplibre_gl_cm(t,e.cooperativeGestures);this._add(`cooperativeGestures`,i),e.cooperativeGestures&&i.enable();let a=new maplibre_gl_kp(t,this._transformProvider),o=new maplibre_gl_rm(t,this._transformProvider);t.doubleClickZoom=new maplibre_gl_nm(o,a),this._add(`tapZoom`,a),this._add(`clickZoom`,o),e.interactive&&e.doubleClickZoom&&t.doubleClickZoom.enable();let s=new maplibre_gl_im;this._add(`tapDragZoom`,s);let c=t.touchPitch=new maplibre_gl_Xp(t);this._add(`touchPitch`,c),e.interactive&&e.touchPitch&&t.touchPitch.enable(e.touchPitch);let l=()=>t.project(t.getCenter()),u=maplibre_gl_Rp(e,l),d=maplibre_gl_zp(e),f=maplibre_gl_Bp(e,l);t.dragRotate=new maplibre_gl_om(e,u,d,f),this._add(`mouseRotate`,u,[`mousePitch`]),this._add(`mousePitch`,d,[`mouseRotate`,`mouseRoll`]),this._add(`mouseRoll`,f,[`mousePitch`]),e.interactive&&e.dragRotate&&t.dragRotate.enable();let p=maplibre_gl_Lp(e),m=new maplibre_gl_Vp(e,t);t.dragPan=new maplibre_gl_am(n,p,m),this._add(`mousePan`,p),this._add(`touchPan`,m,[`touchZoom`,`touchRotate`]),e.interactive&&e.dragPan&&t.dragPan.enable(e.dragPan);let h=new maplibre_gl_Jp,g=new maplibre_gl_Kp;t.touchZoomRotate=new maplibre_gl_sm(n,g,h,s),this._add(`touchRotate`,h,[`touchPan`,`touchZoom`]),this._add(`touchZoom`,g,[`touchPan`,`touchRotate`]),e.interactive&&e.touchZoomRotate&&t.touchZoomRotate.enable(e.touchZoomRotate),this._add(`blockableMapEvent`,new maplibre_gl_Cp(t));let _=t.scrollZoom=new maplibre_gl_tm(t,()=>this._triggerRenderFrame(),this._transformProvider);this._add(`scrollZoom`,_,[`mousePan`]),e.interactive&&e.scrollZoom&&t.scrollZoom.enable(e.scrollZoom);let v=t.keyboard=new maplibre_gl_Qp(t,this._transformProvider);this._add(`keyboard`,v),e.interactive&&e.keyboard&&t.keyboard.enable()}_add(e,t,n){this._handlers.push({handlerName:e,handler:t,allowed:n}),this._handlersById[e]=t}stop(e){if(!this._updatingCamera){for(let{handler:e}of this._handlers)e.reset();this._inertia.clear(),this._fireEvents({},{},e),this._changes=[]}}isActive(){for(let{handler:e}of this._handlers)if(e.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!maplibre_gl_um(this._eventsInProgress)||this.isZooming()}_blockedByActive(e,t,n){for(let r in e)if(r!==n&&!t?.includes(r))return!0;return!1}_getMapTouches(e){let t=[];for(let n of e){let e=n.target;this._el.contains(e)&&t.push(n)}return t}mergeHandlerResult(e,t,n,r,i){if(!n)return;maplibre_gl_shared_xt(e,n);let a={handlerName:r,originalEvent:n.originalEvent||i};n.zoomDelta!==void 0&&(t.zoom=a),n.panDelta!==void 0&&(t.drag=a),n.rollDelta!==void 0&&(t.roll=a),n.pitchDelta!==void 0&&(t.pitch=a),n.bearingDelta!==void 0&&(t.rotate=a)}_applyChanges(){let e={},t={},n={};for(let[r,i,a]of this._changes)r.panDelta&&(e.panDelta=(e.panDelta||new maplibre_gl_shared_l(0,0))._add(r.panDelta)),r.zoomDelta&&(e.zoomDelta=(e.zoomDelta||0)+r.zoomDelta),r.bearingDelta&&(e.bearingDelta=(e.bearingDelta||0)+r.bearingDelta),r.pitchDelta&&(e.pitchDelta=(e.pitchDelta||0)+r.pitchDelta),r.rollDelta&&(e.rollDelta=(e.rollDelta||0)+r.rollDelta),r.around!==void 0&&(e.around=r.around),r.pinchAround!==void 0&&(e.pinchAround=r.pinchAround),r.noInertia&&(e.noInertia=r.noInertia),maplibre_gl_shared_xt(t,i),maplibre_gl_shared_xt(n,a);this._updateMapTransform(e,t,n),this._changes=[]}_updateMapTransform(e,t,n){let r=this._map,i=this._camera.getTransformForUpdate(),a=r.terrain;if(!maplibre_gl_fm(e)&&!(a&&this._terrainMovement)){this._fireEvents(t,n,!0);return}this._camera.stop(!0);let{panDelta:o,zoomDelta:s,bearingDelta:c,pitchDelta:l,rollDelta:u}=e,{around:d,aroundOnSurface:f}=this._resolveAround(e,a,i),p=a?this._terrainGestureElevation(a,d,f,i,t):void 0,m={panDelta:o,zoomDelta:s,rollDelta:u,pitchDelta:l,bearingDelta:c,around:d,aroundElevation:p};this._camera.cameraHelper.useGlobeControls&&!i.isPointOnMapSurface(d)&&(d=i.centerPoint);let h=this._computePreZoomAroundLoc(i,d,o,p);this._handleMapControls({terrain:a,tr:i,deltasForHelper:m,preZoomAroundLoc:h,combinedEventsInProgress:t,panDelta:o}),this._camera.applyUpdatedTransform(i),this._map._update(),e.noInertia||this._inertia.record(e),this._fireEvents(t,n,!0)}_resolveAround(e,t,n){let r=e.pinchAround===void 0?e.around:e.pinchAround;return r||=this._camera.transform.centerPoint,t&&!n.isPointOnMapSurface(r)?{around:n.centerPoint,aroundOnSurface:!1}:{around:r,aroundOnSurface:!0}}_terrainGestureElevation(e,t,n,r,i){if(!n)return;if(!this._terrainMovement&&(i.drag||i.zoom)){let n=r.screenTerrainPointToMercatorCoordinate(t,e);this._terrainGestureAnchorElevation=n?n.z:null}if(this._terrainGestureAnchorElevation===null)return;let a=this._terrainGestureAnchorElevation;if(!(t.distSqr(r.centerPoint)<.01)&&!(a-r.elevation>=.9*(r.getCameraAltitude()-r.elevation)))return a}_computePreZoomAroundLoc(e,t,n,r){if(t.distSqr(e.centerPoint)<.01)return e.center;let i=n?t.sub(n):t;return r===void 0?e.screenPointToLocation(i):e.screenPointToLocationAtElevation(i,r)}_handleMapControls({terrain:e,tr:t,deltasForHelper:n,preZoomAroundLoc:r,combinedEventsInProgress:i,panDelta:a}){let o=this._camera.cameraHelper;if(o.handleMapControlsRollPitchBearingZoom(n,t),!e){o.handleMapControlsPan(n,t,r);return}if(o.useGlobeControls){!this._terrainMovement&&(i.drag||i.zoom)&&(this._terrainMovement=!0,this._camera.elevationFreeze=!0),o.handleMapControlsPan(n,t,r);return}if(!this._terrainMovement&&(i.drag||i.zoom)){this._terrainMovement=!0,this._camera.elevationFreeze=!0,o.handleMapControlsPan(n,t,r);return}if(n.aroundElevation===void 0&&i.drag&&this._terrainMovement&&a){t.setCenter(t.screenPointToLocation(t.centerPoint.sub(a)));return}o.handleMapControlsPan(n,t,r)}_fireEvents(e,t,n){let r=maplibre_gl_um(this._eventsInProgress),i=maplibre_gl_um(e),a={};for(let t in e){let{originalEvent:n}=e[t];this._eventsInProgress[t]||(a[`${t}start`]=n),this._eventsInProgress[t]=e[t]}!r&&i&&this._fireEvent(`movestart`,i.originalEvent);for(let e in a)this._fireEvent(e,a[e]);i&&this._fireEvent(`move`,i.originalEvent);for(let t in e){let{originalEvent:n}=e[t];this._fireEvent(t,n)}let o={},s;for(let e in this._eventsInProgress){let{handlerName:n,originalEvent:r}=this._eventsInProgress[e];this._handlersById[n].isActive()||(delete this._eventsInProgress[e],s=t[n]||r,o[`${e}end`]=s)}for(let e in o)this._fireEvent(e,o[e]);let c=maplibre_gl_um(this._eventsInProgress),l=(r||i)&&!c;if(l&&this._terrainMovement){this._camera.elevationFreeze=!1,this._terrainMovement=!1,this._terrainGestureAnchorElevation=null;let e=this._camera.getTransformForUpdate();this._map.getCenterClampedToGround()&&e.recalculateZoomAndCenter(this._map.terrain),this._camera.applyUpdatedTransform(e)}if(n&&l){this._updatingCamera=!0;let e=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),t=e=>e!==0&&-this._bearingSnap<e&&e<this._bearingSnap;e&&(e.essential||!maplibre_gl_Br.prefersReducedMotion)?(t(e.bearing||this._map.getBearing())&&(e.bearing=0),e.freezeElevation=!0,this._map.easeTo(e,{originalEvent:s})):(this._map.fire(new maplibre_gl_G(`moveend`,{originalEvent:s})),t(this._map.getBearing())&&this._map.resetNorth()),this._updatingCamera=!1}}_fireEvent(e,t){this._map.fire(new maplibre_gl_G(e,t?{originalEvent:t}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(e=>{delete this._frameId,this.handleEvent(new maplibre_gl_dm(`renderFrame`,{timeStamp:e})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}},maplibre_gl_mm=class extends maplibre_gl_shared_Fn{constructor(e){super(),this._renderFrameCallback=()=>{let e=Math.min((maplibre_gl_U()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(e)),e<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this.transform=new maplibre_gl_Sc,this.cameraHelper=new maplibre_gl_Oc,e.minZoom!==void 0&&this.transform.setMinZoom(e.minZoom),e.maxZoom!==void 0&&this.transform.setMaxZoom(e.maxZoom),e.minPitch!==void 0&&this.transform.setMinPitch(e.minPitch),e.maxPitch!==void 0&&this.transform.setMaxPitch(e.maxPitch),e.renderWorldCopies!==void 0&&this.transform.setRenderWorldCopies(e.renderWorldCopies),e.transformConstrain!==null&&this.transform.setConstrainOverride(e.transformConstrain),this._moving=!1,this._zooming=!1,this._bearingSnap=e.bearingSnap,this._zoomSnap=e.zoomSnap,this._requestRenderFrame=e.requestRenderFrame,this._cancelRenderFrame=e.cancelRenderFrame,this.terrain=e.terrain,this._centerClampedToGround=e.centerClampedToGround??!0,this.transformCameraUpdate=e.transformCameraUpdate??null,this._stopHandlers=e.stopHandlers??(()=>{}),this.on(`moveend`,()=>{delete this._requestedCameraState})}migrateProjection(e,t){if(e.apply(this.transform,!0),this.transform=e,this.cameraHelper=t,this._requestedCameraState){let t=e.clone();t.apply(this._requestedCameraState,!0),this._requestedCameraState=t}}getCenter(){return new maplibre_gl_shared_Mp(this.transform.center.lng,this.transform.center.lat)}setCenter(e,t){return this.jumpTo({center:e},t)}getCenterElevation(){return this.transform.elevation}setCenterElevation(e,t){return this.jumpTo({elevation:e},t),this}getCenterClampedToGround(){return this._centerClampedToGround}setCenterClampedToGround(e){this._centerClampedToGround=e}panBy(e,t,n){return e=maplibre_gl_shared_l.convert(e).mult(-1),this.panTo(this.transform.center,maplibre_gl_shared_xt({offset:e},t),n)}panTo(e,t,n){return this.easeTo(maplibre_gl_shared_xt({center:e},t),n)}getZoom(){return this.transform.zoom}setZoom(e,t){return this.jumpTo({zoom:e},t),this}zoomTo(e,t,n){return this.easeTo(maplibre_gl_shared_xt({zoom:e},t),n)}zoomIn(e,t){return this.zoomTo(maplibre_gl_shared_kt(this.getZoom()+1,this._zoomSnap),e,t),this}zoomOut(e,t){return this.zoomTo(maplibre_gl_shared_kt(this.getZoom()-1,this._zoomSnap),e,t),this}getVerticalFieldOfView(){return this.transform.fov}setVerticalFieldOfView(e,t){return e!=this.transform.fov&&(this.transform.setFov(e),this.fire(new maplibre_gl_G(`movestart`,t)).fire(new maplibre_gl_G(`move`,t)).fire(new maplibre_gl_G(`moveend`,t))),this}getBearing(){return this.transform.bearing}setZoomSnap(e){return this._zoomSnap=e,this}getZoomSnap(){return this._zoomSnap}setBearing(e,t){return this.jumpTo({bearing:e},t),this}getPadding(){return this.transform.padding}setPadding(e,t){return this.jumpTo({padding:e},t),this}rotateTo(e,t,n){return this.easeTo(maplibre_gl_shared_xt({bearing:e},t),n)}resetNorth(e,t){return this.rotateTo(0,maplibre_gl_shared_xt({duration:1e3},e),t),this}resetNorthPitch(e,t){return this.easeTo(maplibre_gl_shared_xt({bearing:0,pitch:0,roll:0,duration:1e3},e),t),this}snapToNorth(e,t){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(e,t):this}getPitch(){return this.transform.pitch}setPitch(e,t){return this.jumpTo({pitch:e},t),this}getRoll(){return this.transform.roll}setRoll(e,t){return this.jumpTo({roll:e},t),this}cameraForBounds(e,t){e=maplibre_gl_ya.convert(e).adjustAntiMeridian();let n=t?.bearing||0;return this._cameraForBoxAndBearing(e.getNorthWest(),e.getSouthEast(),n,t)}_cameraForBoxAndBearing(e,t,n,r){let i={top:0,bottom:0,right:0,left:0};if(r=maplibre_gl_shared_xt({padding:i,offset:[0,0],maxZoom:this.transform.maxZoom},r),typeof r.padding==`number`){let e=r.padding;r.padding={top:e,bottom:e,right:e,left:e}}let a=maplibre_gl_shared_xt(i,r.padding);r.padding=a;let o=this.transform,s=new maplibre_gl_ya(e,t),c=this.cameraHelper.cameraForBoxAndBearing(r,a,s,n,o);return c&&this._zoomSnap&&(c.zoom=maplibre_gl_shared_kt(c.zoom,this._zoomSnap,-1)),c}fitBounds(e,t,n){return this._fitInternal(this.cameraForBounds(e,t),t,n)}fitScreenCoordinates(e,t,n,r,i){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.screenPointToLocation(maplibre_gl_shared_l.convert(e)),this.transform.screenPointToLocation(maplibre_gl_shared_l.convert(t)),n,r),r,i)}_fitInternal(e,t,n){return e?(t=maplibre_gl_shared_xt(e,t),delete t.padding,t.linear?this.easeTo(t,n):this.flyTo(t,n)):this}jumpTo(e,t){this.stop(),e.zoom!==void 0&&this._zoomSnap&&(e.zoom=maplibre_gl_shared_kt(e.zoom,this._zoomSnap));let n=this.getTransformForUpdate(),r=!1,i=!1,a=!1,o=n.zoom;this.terrain&&n.setElevation(this.terrain.getElevationForLngLat(e.center?maplibre_gl_shared_Mp.convert(e.center):n.center,n)),this.cameraHelper.handleJumpToCenterZoom(n,e);let s=n.zoom!==o;return e.elevation!==void 0&&n.elevation!==+e.elevation&&n.setElevation(+e.elevation),e.bearing!==void 0&&n.bearing!==+e.bearing&&(r=!0,n.setBearing(+e.bearing)),e.pitch!==void 0&&n.pitch!==+e.pitch&&(i=!0,n.setPitch(+e.pitch)),e.roll!==void 0&&n.roll!==+e.roll&&(a=!0,n.setRoll(+e.roll)),e.padding!=null&&!n.isPaddingEqual(e.padding)&&n.setPadding(e.padding),this.applyUpdatedTransform(n),this.fire(new maplibre_gl_G(`movestart`,t)).fire(new maplibre_gl_G(`move`,t)),s&&this.fire(new maplibre_gl_G(`zoomstart`,t)).fire(new maplibre_gl_G(`zoom`,t)).fire(new maplibre_gl_G(`zoomend`,t)),r&&this.fire(new maplibre_gl_G(`rotatestart`,t)).fire(new maplibre_gl_G(`rotate`,t)).fire(new maplibre_gl_G(`rotateend`,t)),i&&this.fire(new maplibre_gl_G(`pitchstart`,t)).fire(new maplibre_gl_G(`pitch`,t)).fire(new maplibre_gl_G(`pitchend`,t)),a&&this.fire(new maplibre_gl_G(`rollstart`,t)).fire(new maplibre_gl_G(`roll`,t)).fire(new maplibre_gl_G(`rollend`,t)),this.fire(new maplibre_gl_G(`moveend`,t))}calculateCameraOptionsFromCameraLngLatAltRotation(e,t,n,r,i){let a=this.transform.calculateCenterFromCameraLngLatAlt(e,t,n,r);return{center:a.center,elevation:a.elevation,zoom:a.zoom,bearing:n,pitch:r,roll:i}}easeTo(e,t){this._stop(!1,e.easeId),e=maplibre_gl_shared_xt({offset:[0,0],duration:500,easing:maplibre_gl_shared_vt},e),e.zoom!==void 0&&this._zoomSnap&&(e.zoom=maplibre_gl_shared_kt(e.zoom,this._zoomSnap)),(e.animate===!1||!e.essential&&maplibre_gl_Br.prefersReducedMotion)&&(e.duration=0);let n=this.getTransformForUpdate(),r=this.getBearing(),i=n.pitch,a=n.roll,o=e.bearing===void 0?r:this._normalizeBearing(e.bearing,r),s=e.pitch===void 0?i:+e.pitch,c=e.roll===void 0?a:this._normalizeBearing(e.roll,a),l=e.padding===void 0?n.padding:e.padding,u=maplibre_gl_shared_l.convert(e.offset),d,f;e.around&&(d=maplibre_gl_shared_Mp.convert(e.around),f=n.locationToScreenPoint(d));let p={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching,rolling:this._rolling},m=this.cameraHelper.handleEaseTo(n,{bearing:o,pitch:s,roll:c,padding:l,around:d,aroundPoint:f,offsetAsPoint:u,offset:e.offset,zoom:e.zoom,center:e.center});return this._rotating||=r!==o,this._pitching||=s!==i,this._rolling||=c!==a,this._padding=!n.isPaddingEqual(l),this._zooming||=m.isZooming,this._easeId=e.easeId,this._prepareEase(t,e.noMoveStart,p),this.terrain&&this._prepareElevation(m.elevationCenter),this._ease(r=>{m.easeFunc(r),this.terrain&&!e.freezeElevation&&this._updateElevation(r),this.applyUpdatedTransform(n),this._fireMoveEvents(t)},n=>{this.terrain&&e.freezeElevation&&this._finalizeElevation(),this._afterEase(t,n)},e),this}_prepareEase(e,t,n={}){this._moving=!0,!t&&!n.moving&&this.fire(new maplibre_gl_G(`movestart`,e)),this._zooming&&!n.zooming&&this.fire(new maplibre_gl_G(`zoomstart`,e)),this._rotating&&!n.rotating&&this.fire(new maplibre_gl_G(`rotatestart`,e)),this._pitching&&!n.pitching&&this.fire(new maplibre_gl_G(`pitchstart`,e)),this._rolling&&!n.rolling&&this.fire(new maplibre_gl_G(`rollstart`,e))}_prepareElevation(e){this._elevationCenter=e,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLat(e,this.transform),this.elevationFreeze=!0}_updateElevation(e){(this._elevationStart===void 0||this._elevationCenter===void 0)&&this._prepareElevation(this.transform.center),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom));let t=this.terrain.getElevationForLngLat(this._elevationCenter,this.transform);if(e<1&&t!==this._elevationTarget){let n=this._elevationTarget-this._elevationStart,r=(t-(n*e+this._elevationStart))/(1-e);this._elevationStart+=e*(n-r),this._elevationTarget=t}this.transform.setElevation(maplibre_gl_shared_$r.number(this._elevationStart,this._elevationTarget,e))}_finalizeElevation(){this.elevationFreeze=!1,this.getCenterClampedToGround()&&this.transform.recalculateZoomAndCenter(this.terrain)}getTransformForUpdate(){return!this.transformCameraUpdate&&!this.terrain?this.transform:(this._requestedCameraState||=this.transform.clone(),this._requestedCameraState)}_elevateCameraIfInsideTerrain(e){if(!this.terrain&&e.elevation>=0&&e.pitch<=90)return{};let t=e.getCameraLngLat(),n=e.getCameraAltitude(),r=this.terrain?this.terrain.getElevationForLngLatZoom(t,e.zoom):0;if(n<r){let n=e.calculateCameraOptionsFromTo(t,r,e.center,e.elevation);return{pitch:n.pitch,zoom:n.zoom}}return{}}applyUpdatedTransform(e){let t=[];if(t.push(e=>this._elevateCameraIfInsideTerrain(e)),this.transformCameraUpdate&&t.push(e=>this.transformCameraUpdate(e)),!t.length)return;let n=e.clone();for(let e of t){let t=n.clone(),{center:r,zoom:i,roll:a,pitch:o,bearing:s,elevation:c}=e(t);r&&t.setCenter(r),c!==void 0&&t.setElevation(c),i!==void 0&&t.setZoom(i),a!==void 0&&t.setRoll(a),o!==void 0&&t.setPitch(o),s!==void 0&&t.setBearing(s),n.apply(t,!1)}this.transform.apply(n,!1)}_fireMoveEvents(e){this.fire(new maplibre_gl_G(`move`,e)),this._zooming&&this.fire(new maplibre_gl_G(`zoom`,e)),this._rotating&&this.fire(new maplibre_gl_G(`rotate`,e)),this._pitching&&this.fire(new maplibre_gl_G(`pitch`,e)),this._rolling&&this.fire(new maplibre_gl_G(`roll`,e))}_afterEase(e,t){if(this._easeId&&t&&this._easeId===t)return;delete this._easeId;let n=this._zooming,r=this._rotating,i=this._pitching,a=this._rolling;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._rolling=!1,this._padding=!1,n&&this.fire(new maplibre_gl_G(`zoomend`,e)),r&&this.fire(new maplibre_gl_G(`rotateend`,e)),i&&this.fire(new maplibre_gl_G(`pitchend`,e)),a&&this.fire(new maplibre_gl_G(`rollend`,e)),this.fire(new maplibre_gl_G(`moveend`,e))}flyTo(e,t){if(!e.essential&&maplibre_gl_Br.prefersReducedMotion){let n=maplibre_gl_shared_St(e,[`center`,`zoom`,`bearing`,`pitch`,`roll`,`elevation`,`padding`]);return this.jumpTo(n,t)}this.stop(),e=maplibre_gl_shared_xt({offset:[0,0],speed:1.2,curve:1.42,easing:maplibre_gl_shared_vt},e),e.zoom!==void 0&&this._zoomSnap&&(e.zoom=maplibre_gl_shared_kt(e.zoom,this._zoomSnap));let n=this.getTransformForUpdate(),r=n.bearing,i=n.pitch,a=n.roll,o=n.padding,s=e.bearing===void 0?r:this._normalizeBearing(e.bearing,r),c=e.pitch===void 0?i:+e.pitch,l=e.roll===void 0?a:this._normalizeBearing(e.roll,a),u=e.padding===void 0?n.padding:e.padding,d=maplibre_gl_shared_l.convert(e.offset),f=n.centerPoint.add(d),p=n.screenPointToLocation(f),m=this.cameraHelper.handleFlyTo(n,{bearing:s,pitch:c,roll:l,padding:u,locationAtOffset:p,offsetAsPoint:d,center:e.center,minZoom:e.minZoom,zoom:e.zoom}),h=e.curve,g=Math.max(n.width,n.height),_=g/m.scaleOfZoom,v=m.pixelPathLength,y=g/m.scaleOfMinZoom;h=Math.min(h,Math.sqrt(y/v*2));let b=h*h;function x(e){let t=(_*_-g*g+(e?-1:1)*b*b*v*v)/(2*(e?_:g)*b*v);return Math.log(Math.sqrt(t*t+1)-t)}function S(e){return(Math.exp(e)-Math.exp(-e))/2}function C(e){return(Math.exp(e)+Math.exp(-e))/2}function w(e){return S(e)/C(e)}let T=x(!1),E=function(e){return C(T)/C(T+h*e)},ee=function(e){return g*((C(T)*w(T+h*e)-S(T))/b)/v},D=(x(!0)-T)/h;if(Math.abs(v)<2e-6||!isFinite(D)){if(Math.abs(g-_)<1e-6)return this.easeTo(e,t);let n=_<g?-1:1;D=Math.abs(Math.log(_/g))/h,ee=()=>0,E=e=>Math.exp(n*h*e)}if(e.duration!==void 0)e.duration=+e.duration;else{let t=e.screenSpeed===void 0?+e.speed:+e.screenSpeed/h;e.duration=1e3*D/t}return e.maxDuration&&e.duration>e.maxDuration&&(e.duration=0),this._zooming=!0,this._rotating=r!==s,this._pitching=c!==i,this._rolling=l!==a,this._padding=!n.isPaddingEqual(u),this._prepareEase(t,!1),this.terrain&&this._prepareElevation(m.targetCenter),this._ease(p=>{let h=p*D,g=1/E(h),_=ee(h);this._rotating&&n.setBearing(maplibre_gl_shared_$r.number(r,s,p)),this._pitching&&n.setPitch(maplibre_gl_shared_$r.number(i,c,p)),this._rolling&&n.setRoll(maplibre_gl_shared_$r.number(a,l,p)),this._padding&&(n.interpolatePadding(o,u,p),f=n.centerPoint.add(d)),m.easeFunc(p,g,_,f),this.terrain&&!e.freezeElevation&&this._updateElevation(p),this.applyUpdatedTransform(n),this._fireMoveEvents(t)},()=>{this.terrain&&e.freezeElevation&&this._finalizeElevation(),this._afterEase(t)},e),this}isEasing(){return!!this._easeFrameId}stop(e){return this._stop(e)}_stop(e,t){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){let e=this._onEaseEnd;delete this._onEaseEnd,e.call(this,t)}return e||this._stopHandlers(),this}_ease(e,t,n){n.animate===!1||n.duration===0?(e(1),t()):(this._easeStart=maplibre_gl_U(),this._easeOptions=n,this._onEaseFrame=e,this._onEaseEnd=t,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(e,t){e=maplibre_gl_shared_bt(e,-180,180);let n=Math.abs(e-t);return Math.abs(e-360-t)<n&&(e-=360),Math.abs(e+360-t)<n&&(e+=360),e}isMoving(){return this._moving}isZooming(){return this._zooming}isRotating(){return this._rotating}};const maplibre_gl_hm={compact:!0,customAttribution:`<a href="https://maplibre.org/" target="_blank">MapLibre</a>`};var maplibre_gl_gm=class{constructor(e=maplibre_gl_hm){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=e=>{e&&(e.type===`terrain`||e.dataType===`style`||e.dataType===`source`&&(e.sourceDataType===`metadata`||e.sourceDataType===`visibility`))&&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=e}getDefaultPosition(){return`bottom-right`}onAdd(e){return this._map=e,this._compact=this.options.compact,this._container=maplibre_gl_W.create(`details`,`maplibregl-ctrl maplibregl-ctrl-attrib`),this._compactButton=maplibre_gl_W.create(`summary`,`maplibregl-ctrl-attrib-button`,this._container),this._compactButton.addEventListener(`click`,this._toggleAttribution),this._setElementTitle(this._compactButton,`ToggleAttribution`),this._innerContainer=maplibre_gl_W.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(){this._container.remove(),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(e,t){let n=this._map._getUIString(`AttributionControl.${t}`);e.title=n,e.setAttribute(`aria-label`,n)}_updateAttributions(){if(!this._map.style)return;let e=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?e=e.concat(this.options.customAttribution.map(e=>typeof e==`string`?e:``)):typeof this.options.customAttribution==`string`&&e.push(this.options.customAttribution)),this._map.style.stylesheet){let e=this._map.style.stylesheet;this.styleOwner=e.owner,this.styleId=e.id}let t=this._map.style.tileManagers;for(let n in t){let r=t[n];if(r.used||r.usedForTerrain){let t=r.getSource();t.attribution&&!e.includes(t.attribution)&&e.push(t.attribution)}}e=e.filter(e=>String(e).trim()),e.sort((e,t)=>e.length-t.length),e=e.filter((t,n)=>{for(let r=n+1;r<e.length;r++)if(e[r].includes(t))return!1;return!0});let n=e.join(` | `);n!==this._attribHTML&&(this._attribHTML=n,e.length?(this._innerContainer.innerHTML=maplibre_gl_W.sanitize(n),this._container.classList.remove(`maplibregl-attrib-empty`)):this._container.classList.add(`maplibregl-attrib-empty`),this._updateCompact(),this._editLink=null)}},maplibre_gl_m=class{constructor(e={}){this._updateCompact=()=>{let e=this._container.children;if(e.length){let t=e[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&t.classList.add(`maplibregl-compact`):t.classList.remove(`maplibregl-compact`)}},this.options=e}getDefaultPosition(){return`bottom-left`}onAdd(e){this._map=e,this._compact=this.options?.compact,this._container=maplibre_gl_W.create(`div`,`maplibregl-ctrl`);let t=maplibre_gl_W.create(`a`,`maplibregl-ctrl-logo`);return t.target=`_blank`,t.rel=`noopener nofollow`,t.href=`https://maplibre.org/`,t.setAttribute(`aria-label`,this._map._getUIString(`LogoControl.Title`)),t.setAttribute(`rel`,`noopener nofollow`),this._container.appendChild(t),this._container.style.display=`block`,this._map.on(`resize`,this._updateCompact),this._updateCompact(),this._container}onRemove(){this._container.remove(),this._map.off(`resize`,this._updateCompact),this._map=void 0,this._compact=void 0}},maplibre_gl_vm=class{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(e){let t=++this._id;return this._queue.push({callback:e,id:t,cancelled:!1}),t}remove(e){let t=this._currentlyRunning,n=t?this._queue.concat(t):this._queue;for(let t of n)if(t.id===e){t.cancelled=!0;return}}run(e=0){if(this._currentlyRunning)throw Error(`Attempting to run(), but is already running.`);let t=this._currentlyRunning=this._queue;this._queue=[];let n=!1,r;for(let i of t)if(!i.cancelled){try{i.callback(e)}catch(e){n||(n=!0,r=e)}if(this._cleared)break}if(this._cleared=!1,this._currentlyRunning=!1,n)throw r}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}};const maplibre_gl_ym=[`none`,`zoom`,`sourceTiles`,`visibleLayers`,`revision`];var maplibre_gl_bm=class{constructor(e,t,n,r){this._tileKeys=e.map(e=>e.key).sort().join(),this._revision=t,this._zoom=n,this._visibleLayerIds=r}difference(e){return this._revision===e?._revision?this._visibleLayerIds===e._visibleLayerIds?this._tileKeys===e._tileKeys?this._zoom===e._zoom?`none`:`zoom`:`sourceTiles`:`visibleLayers`:`revision`}};const maplibre_gl_xm={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0,"color-relief":!0};var maplibre_gl_Sm=class{constructor(e,t){this.needsFollowUpFrame=!1,this.painter=e,this.terrain=t,this.rttSize=t.tileManager.tileSize*t.qualityFactor}getTexture(e){return e.getRTT(this._stacks.length-1).texture}prepareForRender(e,t){let n=t!==this._lastPrepareZoom;this._lastPrepareZoom=t,this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.tileManager.getRenderableTiles(),this._renderableLayerIds=e._order.filter(n=>!e._layers[n].isHidden(t));let r=this._renderableLayerIds.join(),i=new Set;for(let t of this._renderableLayerIds){let n=e._layers[t],r=n.source;r&&maplibre_gl_xm[n.type]&&i.add(r)}this._coordsAscending={},this._rttFingerprints={};for(let n of i){let i=e.tileManagers[n];if(!i)continue;this._coordsAscending[n]={};let a=this._coordsAscending[n],o=i.getSource(),s=o instanceof maplibre_gl_Xa?o.terrainTileRanges:null;for(let e of i.getVisibleCoordinates()){let t=this.terrain.tileManager.getTerrainCoords(e,s);for(let e in t)a[e]||=[],a[e].push(t[e])}this._rttFingerprints[n]={};let c=this._rttFingerprints[n],l=i.getState().revision;for(let e in a)c[e]=new maplibre_gl_bm(a[e],l,t,r)}this.needsFollowUpFrame=!1;let a=n||this.painter.options.moving,o=!1;for(let e of this._renderableTiles){let t=this._textureDifference(e);t!==`none`&&(t===`zoom`&&a||t===`visibleLayers`&&n?this.needsFollowUpFrame=!0:t===`zoom`||t===`sourceTiles`?(o?this.needsFollowUpFrame=!0:e.releaseRTT(this.painter),o=!0):e.releaseRTT(this.painter))}}_textureDifference(e){let t=`none`;for(let n in this._rttFingerprints){let r=this._rttFingerprints[n][e.tileID.key];if(!r)continue;let i=r.difference(e.rttFingerprint[n]);maplibre_gl_ym.indexOf(i)>maplibre_gl_ym.indexOf(t)&&(t=i)}return t}renderLayer(e,t){if(e.isHidden(this.painter.transform.zoom))return!1;let n={...t,isRenderingToTexture:!0},r=e.type,i=this.painter,a=this._renderableLayerIds[this._renderableLayerIds.length-1]===e.id;if(maplibre_gl_xm[r]&&((!this._prevType||!maplibre_gl_xm[this._prevType])&&this._stacks.push([]),this._prevType=r,this._stacks[this._stacks.length-1].push(e.id),!a))return!0;if(maplibre_gl_xm[this._prevType]||maplibre_gl_xm[r]&&a){this._prevType=r;let e=this._stacks.length-1,t=this._stacks[e]||[];for(let r of this._renderableTiles){if(this._rttTiles.push(r),r.getRTT(e))continue;let a=r.acquireRTT(i,e,this.rttSize);i.bindRTT(a),i.context.clear({color:maplibre_gl_shared_V.transparent,stencil:0}),i.currentStencilSource=void 0;for(let e of t){let t=i.style._layers[e],a=t.source?this._coordsAscending[t.source][r.tileID.key]:[r.tileID];i.context.viewport.set([0,0,this.rttSize,this.rttSize]),i.renderTileClippingMasks(t,a,!0),i.renderLayer(i,i.style.tileManagers[t.source],t,a,n),t.source&&(r.rttFingerprint[t.source]=this._rttFingerprints[t.source][r.tileID.key])}a.texture.generateMipmap()}return maplibre_gl_np(this.painter,this.terrain,this._rttTiles,n),this._rttTiles=[],maplibre_gl_xm[r]}return!1}};const maplibre_gl_Cm={"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":`Drag to rotate map, click to reset 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`,"GlobeControl.Enable":`Enable globe`,"GlobeControl.Disable":`Disable globe`,"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`},maplibre_gl_wm=maplibre_gl_Mr,maplibre_gl_Tm={hash:!1,interactive:!0,bearingSnap:7,zoomSnap:0,attributionControl:maplibre_gl_hm,maplibreLogo:!1,refreshExpiredTiles:!0,canvasContextAttributes:{antialias:!1,preserveDrawingBuffer:!1,powerPreference:`high-performance`,failIfMajorPerformanceCaveat:!1,desynchronized:!1,contextType:void 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],elevation:0,zoom:0,bearing:0,pitch:0,roll:0,renderWorldCopies:!0,maxTileCacheSize:null,maxTileCacheZoomLevels:maplibre_gl_shared_gn.MAX_TILE_CACHE_ZOOM_LEVELS,transformRequest:null,transformCameraUpdate:null,transformConstrain:null,fadeDuration:300,crossSourceCollisions:!0,clickTolerance:3,localIdeographFontFamily:`sans-serif`,pitchWithRotate:!0,rollEnabled:!1,rotateSpeed:.8,pitchSpeed:-.5,reduceMotion:void 0,validateStyle:!0,maxCanvasSize:[4096,4096],cancelPendingTileRequestsWhileZooming:!0,centerClampedToGround:!0,terrainSkirtLength:`auto`,zoomLevelsToOverscale:4,anisotropicFilterPitch:20};var maplibre_gl_Em=class extends maplibre_gl_shared_Fn{get _ownerWindow(){return this._container?.ownerDocument?.defaultView||window}constructor(e){super(),this._idleTriggered=!1,this._crossFadingFactor=1,this._renderTaskQueue=new maplibre_gl_vm,this._controls=[],this._mapId=maplibre_gl_shared_wt(),this._styleUrl=null,this._missingStyleImageResolver=null,this._lostContextStyle={style:null,images:null},this._contextLost=e=>{if(e.preventDefault(),this._frameRequest&&=(this._frameRequest.abort(),null),this.painter.destroy(),this._lostContextStyle=this._getStyleAndImages(),!this.style){this.fire(new maplibre_gl_ni(`webglcontextlost`,{originalEvent:e}));return}for(let e of Object.values(this.style._layers))if(e.type===`custom`&&console.warn(`Custom layer with id '${e.id}' cannot be restored after WebGL context loss. You will need to re-add it manually after context restoration.`),e._listeners)for(let[t]of Object.entries(e._listeners))console.warn(`Custom layer with id '${e.id}' had event listeners for event '${t}' which cannot be restored after WebGL context loss. You will need to re-add them manually after context restoration.`);this.style.destroy(),this.style=null,this.fire(new maplibre_gl_ni(`webglcontextlost`,{originalEvent:e}))},this._contextRestored=e=>{if(this._lostContextStyle.style&&this.setStyle(this._lostContextStyle.style,{diff:!1}),this._lostContextStyle.images&&this.style){this.style.imageManager.images=this._lostContextStyle.images;for(let e in this._lostContextStyle.images){let t=this._lostContextStyle.images[e];t.isWebGLImage&&this.style.imageManager.updateImage(e,t,!1)}}this._lostContextStyle={style:null,images:null};try{this._setupPainter()}catch(e){this.fire(new maplibre_gl_shared_Pn(e));return}this.resize(),this._update(),this._resizeInternal(),this.fire(new maplibre_gl_ni(`webglcontextrestored`,{originalEvent:e}))},this._onMapScroll=e=>{if(e.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()};let t={...maplibre_gl_Tm,...e,canvasContextAttributes:{...maplibre_gl_Tm.canvasContextAttributes,...e.canvasContextAttributes}};if(t.minZoom!=null&&t.maxZoom!=null&&t.minZoom>t.maxZoom)throw Error(`maxZoom must be greater than or equal to minZoom`);if(t.minPitch!=null&&t.maxPitch!=null&&t.minPitch>t.maxPitch)throw Error(`maxPitch must be greater than or equal to minPitch`);if(t.minPitch!=null&&t.minPitch<0)throw Error(`minPitch must be greater than or equal to 0`);if(t.maxPitch!=null&&t.maxPitch>180)throw Error(`maxPitch must be less than or equal to 180`);this._camera=new maplibre_gl_mm({minZoom:t.minZoom,maxZoom:t.maxZoom,minPitch:t.minPitch,maxPitch:t.maxPitch,bearingSnap:t.bearingSnap,zoomSnap:t.zoomSnap,renderWorldCopies:t.renderWorldCopies,centerClampedToGround:t.centerClampedToGround,terrain:this.terrain,transformConstrain:t.transformConstrain,requestRenderFrame:e=>this._requestRenderFrame(e),cancelRenderFrame:e=>this._cancelRenderFrame(e),transformCameraUpdate:t.transformCameraUpdate,stopHandlers:()=>this._handlers?.stop(!1)}),this._camera.setEventedParent(this),this._interactive=t.interactive,this._maxTileCacheSize=t.maxTileCacheSize,this._maxTileCacheZoomLevels=t.maxTileCacheZoomLevels,this._canvasContextAttributes={...t.canvasContextAttributes},this._trackResize=t.trackResize===!0,this._terrainSkirtLength=t.terrainSkirtLength,this._refreshExpiredTiles=t.refreshExpiredTiles===!0,this._fadeDuration=t.fadeDuration,this._crossSourceCollisions=t.crossSourceCollisions===!0,this._collectResourceTiming=t.collectResourceTiming===!0,this._locale={...maplibre_gl_Cm,...t.locale},this._clickTolerance=t.clickTolerance,this._overridePixelRatio=t.pixelRatio,this._maxCanvasSize=t.maxCanvasSize,this._zoomLevelsToOverscale=t.zoomLevelsToOverscale,this.cancelPendingTileRequestsWhileZooming=t.cancelPendingTileRequestsWhileZooming===!0,this.setAnisotropicFilterPitch(t.anisotropicFilterPitch),t.reduceMotion!==void 0&&(maplibre_gl_Br.prefersReducedMotion=t.reduceMotion),this._requestManager=new maplibre_gl_Kr(t.transformRequest),this._container=this._resolveContainer(t.container),t.maxBounds&&this.setMaxBounds(t.maxBounds),this._setupContainer();try{this._setupPainter()}catch(e){throw this._cleanupContainer(),e}this._imageQueueHandle=maplibre_gl_Gr.addThrottleControl(()=>this.isMoving()),this.on(`move`,()=>this._update(!1)),this.on(`moveend`,()=>this._update(!1)),this.on(`zoom`,()=>this._update(!0)),this.on(`terrain`,()=>{this.painter.terrainFacilitator.depthDirty=!0,this._update(!0)}),this.once(`idle`,()=>this._idleTriggered=!0),this._handlers=new maplibre_gl_pm(this,this._camera,t),typeof window<`u`&&(this._ownerWindow.addEventListener(`online`,this._onWindowOnline,!1),this._setupResizeObserver());let n=typeof t.hash==`string`&&t.hash||void 0;this._hash=t.hash?new maplibre_gl_fp(n).addTo(this):void 0,this._hash?._onHashChange()||(this.jumpTo({center:t.center,elevation:t.elevation,zoom:t.zoom,bearing:t.bearing,pitch:t.pitch,roll:t.roll}),t.bounds&&(this.resize(),this.fitBounds(t.bounds,maplibre_gl_shared_xt({},t.fitBoundsOptions,{duration:0}))));let r=typeof t.style==`string`||t.style?.projection?.type!==`globe`;this.resize(null,r),this._localIdeographFontFamily=t.localIdeographFontFamily,this._validateStyle=t.validateStyle,t.style&&this.setStyle(t.style,{localIdeographFontFamily:t.localIdeographFontFamily}),t.attributionControl&&this.addControl(new maplibre_gl_gm(typeof t.attributionControl==`boolean`?void 0:t.attributionControl)),t.maplibreLogo&&this.addControl(new maplibre_gl_m,t.logoPosition),this.on(`style.load`,()=>{if(r||this._resizeTransform(),this._camera.transform.unmodified){let e=maplibre_gl_shared_St(this.style.stylesheet,[`center`,`zoom`,`bearing`,`pitch`,`roll`]);this.jumpTo(e)}}),this.on(`data`,e=>{this._update(e.dataType===`style`),this.fire(e.dataType===`style`?new maplibre_gl_Yr(`styledata`,e):new maplibre_gl_K(`sourcedata`,e))}),this.on(`dataloading`,e=>{this.fire(e.dataType===`style`?new maplibre_gl_Yr(`styledataloading`,e):new maplibre_gl_K(`sourcedataloading`,e))}),this.on(`dataabort`,e=>{this.fire(new maplibre_gl_K(`sourcedataabort`,e))})}_getMapId(){return this._mapId}setGlobalStateProperty(e,t){return this.style.setGlobalStateProperty(e,t),this._update(!0)}getGlobalState(){return this.style.getGlobalState()}addControl(e,t){if(t===void 0&&(t=e.getDefaultPosition?e.getDefaultPosition():`top-right`),!e?.onAdd)return this.fire(new maplibre_gl_shared_Pn(Error(`Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.`)));let n=e.onAdd(this);this._controls.push(e);let r=this._controlPositions[t];return t.includes(`bottom`)?r.insertBefore(n,r.firstChild):r.appendChild(n),this}removeControl(e){if(!e?.onRemove)return this.fire(new maplibre_gl_shared_Pn(Error(`Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.`)));let t=this._controls.indexOf(e);return t>-1&&this._controls.splice(t,1),e.onRemove(this),this}hasControl(e){return this._controls.includes(e)}coveringTiles(e){return maplibre_gl_jo(this._camera.transform,e)}setTransformCameraUpdate(e){this._camera.transformCameraUpdate=e}getCenter(){return new maplibre_gl_shared_Mp(this._camera.transform.center.lng,this._camera.transform.center.lat)}setCenter(e,t){return this._camera.setCenter(e,t),this}getCenterElevation(){return this._camera.transform.elevation}setCenterElevation(e,t){return this._camera.setCenterElevation(e,t),this}setCenterClampedToGround(e){this._camera.setCenterClampedToGround(e)}panBy(e,t,n){return this._camera.panBy(e,t,n),this}panTo(e,t,n){return this._camera.panTo(e,t,n),this}getZoom(){return this._camera.transform.zoom}setZoom(e,t){return this._camera.setZoom(e,t),this}zoomTo(e,t,n){return this._camera.zoomTo(e,t,n),this}zoomIn(e,t){return this._camera.zoomIn(e,t),this}zoomOut(e,t){return this._camera.zoomOut(e,t),this}getVerticalFieldOfView(){return this._camera.transform.fov}setVerticalFieldOfView(e,t){return this._camera.setVerticalFieldOfView(e,t),this}getBearing(){return this._camera.transform.bearing}setBearing(e,t){return this._camera.setBearing(e,t),this}getZoomSnap(){return this._camera.getZoomSnap()}setZoomSnap(e){return this._camera.setZoomSnap(e),this}getPadding(){return this._camera.transform.padding}setPadding(e,t){return this._camera.setPadding(e,t),this}rotateTo(e,t,n){return this._camera.rotateTo(e,t,n),this}resetNorth(e,t){return this._camera.resetNorth(e,t),this}resetNorthPitch(e,t){return this._camera.resetNorthPitch(e,t),this}snapToNorth(e,t){return this._camera.snapToNorth(e,t),this}getPitch(){return this._camera.transform.pitch}setPitch(e,t){return this._camera.setPitch(e,t),this}getRoll(){return this._camera.transform.roll}setRoll(e,t){return this._camera.setRoll(e,t),this}cameraForBounds(e,t){return this._camera.cameraForBounds(e,t)}fitBounds(e,t,n){return this._camera.fitBounds(e,t,n),this}fitScreenCoordinates(e,t,n,r,i){return this._camera.fitScreenCoordinates(e,t,n,r,i),this}jumpTo(e,t){return this._camera.jumpTo(e,t),this}calculateCameraOptionsFromCameraLngLatAltRotation(e,t,n,r,i){return this._camera.calculateCameraOptionsFromCameraLngLatAltRotation(e,t,n,r,i)}easeTo(e,t){return this._camera.easeTo(e,t),this}flyTo(e,t){return this._camera.flyTo(e,t),this}stop(){return this._camera.stop(),this}queryTerrainElevation(e){return this.terrain?this.terrain.getElevationForLngLat(maplibre_gl_shared_Mp.convert(e),this._camera.transform):null}getCenterClampedToGround(){return this._camera.getCenterClampedToGround()}calculateCameraOptionsFromTo(e,t,n,r){return r==null&&this.terrain&&(r=this.terrain.getElevationForLngLat(n,this._camera.transform)),this._camera.transform.calculateCameraOptionsFromTo(e,t,n,r??0)}resize(e,t=!0){if(this._lostContextStyle.style!==null)return this;this._resizeInternal(t);let n=!this._camera._moving;return n&&(this.stop(),this.fire(new maplibre_gl_G(`movestart`,e)).fire(new maplibre_gl_G(`move`,e))),this.fire(new maplibre_gl_qr(`resize`,e)),n&&this.fire(new maplibre_gl_G(`moveend`,e)),this}_resizeInternal(e=!0){let[t,n]=this._containerDimensions(),r=this._getClampedPixelRatio(t,n);if(this._resizeCanvas(t,n,r),this.painter.resize(t,n,r),this.painter.overLimit()){let e=this.painter.context.gl;this._maxCanvasSize=[e.drawingBufferWidth,e.drawingBufferHeight];let r=this._getClampedPixelRatio(t,n);this._resizeCanvas(t,n,r),this.painter.resize(t,n,r)}this._resizeTransform(e)}_resizeTransform(e=!0){let[t,n]=this._containerDimensions();this._camera.transform.resize(t,n,e),this._camera._requestedCameraState?.resize(t,n,e)}_getClampedPixelRatio(e,t){let{0:n,1:r}=this._maxCanvasSize,i=this.getPixelRatio(),a=e*i,o=t*i,s=a>n?n/a:1,c=o>r?r/o:1,l=Math.min(s,c);return l<1&&maplibre_gl_shared_Ft(`The canvas is larger than maxCanvasSize and is rendered at a lower pixel ratio to fit. Increase maxCanvasSize, within MAX_TEXTURE_SIZE, to render at full resolution.`),l*i}getPixelRatio(){return this._overridePixelRatio??devicePixelRatio}setPixelRatio(e){this._overridePixelRatio=e,this.resize()}getBounds(){return this._camera.transform.getBounds()}getMaxBounds(){return this._camera.transform.getMaxBounds()}setMaxBounds(e){return this._camera.transform.setMaxBounds(maplibre_gl_ya.convert(e)),this._update()}setMinZoom(e){if(e??=-2,e>=-2&&e<=this._camera.transform.maxZoom){let t=this._camera.transform.zoom,n=this._camera.getTransformForUpdate();return n.setMinZoom(e),this._camera.applyUpdatedTransform(n),this._update(),t!==this._camera.transform.zoom&&this.fire(new maplibre_gl_G(`zoomstart`)).fire(new maplibre_gl_G(`zoom`)).fire(new maplibre_gl_G(`zoomend`)).fire(new maplibre_gl_G(`movestart`)).fire(new maplibre_gl_G(`move`)).fire(new maplibre_gl_G(`moveend`)),this}throw Error(`minZoom must be between -2 and the current maxZoom, inclusive`)}getMinZoom(e=!1){let t=this._camera.transform;return e?t.applyConstrain(t.center,t.minZoom).zoom:t.minZoom}setMaxZoom(e){if(e??=22,e>=this._camera.transform.minZoom){let t=this._camera.transform.zoom,n=this._camera.getTransformForUpdate();return n.setMaxZoom(e),this._camera.applyUpdatedTransform(n),this._update(),t!==this._camera.transform.zoom&&this.fire(new maplibre_gl_G(`zoomstart`)).fire(new maplibre_gl_G(`zoom`)).fire(new maplibre_gl_G(`zoomend`)).fire(new maplibre_gl_G(`movestart`)).fire(new maplibre_gl_G(`move`)).fire(new maplibre_gl_G(`moveend`)),this}throw Error(`maxZoom must be greater than the current minZoom`)}getMaxZoom(){return this._camera.transform.maxZoom}setMinPitch(e){if(e??=0,e<0)throw Error(`minPitch must be greater than or equal to 0`);if(e>=0&&e<=this._camera.transform.maxPitch){let t=this._camera.transform.pitch,n=this._camera.getTransformForUpdate();return n.setMinPitch(e),this._camera.applyUpdatedTransform(n),this._update(),t!==this._camera.transform.pitch&&this.fire(new maplibre_gl_G(`pitchstart`)).fire(new maplibre_gl_G(`pitch`)).fire(new maplibre_gl_G(`pitchend`)).fire(new maplibre_gl_G(`movestart`)).fire(new maplibre_gl_G(`move`)).fire(new maplibre_gl_G(`moveend`)),this}throw Error(`minPitch must be between 0 and the current maxPitch, inclusive`)}getMinPitch(){return this._camera.transform.minPitch}setMaxPitch(e){if(e??=60,e>180)throw Error(`maxPitch must be less than or equal to 180`);if(e>=this._camera.transform.minPitch){let t=this._camera.transform.pitch,n=this._camera.getTransformForUpdate();return n.setMaxPitch(e),this._camera.applyUpdatedTransform(n),this._update(),t!==this._camera.transform.pitch&&this.fire(new maplibre_gl_G(`pitchstart`)).fire(new maplibre_gl_G(`pitch`)).fire(new maplibre_gl_G(`pitchend`)).fire(new maplibre_gl_G(`movestart`)).fire(new maplibre_gl_G(`move`)).fire(new maplibre_gl_G(`moveend`)),this}throw Error(`maxPitch must be greater than the current minPitch`)}getMaxPitch(){return this._camera.transform.maxPitch}getAnisotropicFilterPitch(){return this._anisotropicFilterPitch}setAnisotropicFilterPitch(e){if(e??=20,e>180)throw Error(`anisotropicFilterPitch must be less than or equal to 180`);if(e<0)throw Error(`anisotropicFilterPitch must be greater than or equal to 0`);return this._anisotropicFilterPitch=e,this._update()}getRenderWorldCopies(){return this._camera.transform.renderWorldCopies}setRenderWorldCopies(e){return this._camera.transform.setRenderWorldCopies(e),this._update()}setTransformConstrain(e){return this._camera.transform.setConstrainOverride(e),this._update()}project(e){return this._camera.transform.locationToScreenPoint(maplibre_gl_shared_Mp.convert(e),this.style&&this.terrain)}unproject(e){return this._camera.transform.screenPointToLocation(maplibre_gl_shared_l.convert(e),this.terrain)}isMoving(){return this._camera.isMoving()||this._handlers?.isMoving()||!1}isZooming(){return this._camera.isZooming()||this._handlers?.isZooming()||!1}isRotating(){return this._camera.isRotating()||this._handlers?.isRotating()||!1}_createDelegatedListener(e,t,n){if(e===`mouseenter`||e===`mouseover`){let r=!1;return{layers:t,listener:n,delegates:{mousemove:i=>{let a=t.filter(e=>this.getLayer(e)),o=a.length===0?[]:this.queryRenderedFeatures(i.point,{layers:a});o.length?r||(r=!0,n.call(this,new maplibre_gl_Xr(e,this,i.originalEvent,{features:o}))):r=!1},mouseout:()=>{r=!1}}}}if(e===`mouseleave`||e===`mouseout`){let r=!1;return{layers:t,listener:n,delegates:{mousemove:i=>{let a=t.filter(e=>this.getLayer(e));(a.length===0?[]:this.queryRenderedFeatures(i.point,{layers:a})).length?r=!0:r&&(r=!1,n.call(this,new maplibre_gl_Xr(e,this,i.originalEvent)))},mouseout:t=>{r&&(r=!1,n.call(this,new maplibre_gl_Xr(e,this,t.originalEvent)))}}}}{let r=e=>{let r=t.filter(e=>this.getLayer(e)),i=r.length===0?[]:this.queryRenderedFeatures(e.point,{layers:r});i.length&&(e.features=i,n.call(this,e),delete e.features)};return{layers:t,listener:n,delegates:{[e]:r}}}}_saveDelegatedListener(e,t){this._delegatedListeners||={},this._delegatedListeners[e]||=[],this._delegatedListeners[e].push(t)}_removeDelegatedListener(e,t,n){if(!this._delegatedListeners?.[e])return;let r=this._delegatedListeners[e];for(let e=0;e<r.length;e++){let i=r[e];if(i.listener===n&&i.layers.length===t.length&&i.layers.every(e=>t.includes(e))){for(let e in i.delegates)this.off(e,i.delegates[e]);r.splice(e,1);return}}}on(e,t,n){if(n===void 0)return super.on(e,t);let r=typeof t==`string`?[t]:t,i=this._createDelegatedListener(e,r,n);this._saveDelegatedListener(e,i);for(let e in i.delegates)this.on(e,i.delegates[e]);return{unsubscribe:()=>{this._removeDelegatedListener(e,r,n)}}}once(e,t,n){if(n===void 0)return super.once(e,t);let r=typeof t==`string`?[t]:t,i=this._createDelegatedListener(e,r,n);for(let t in i.delegates){let a=i.delegates[t];i.delegates[t]=(...t)=>{this._removeDelegatedListener(e,r,n),a(...t)}}this._saveDelegatedListener(e,i);for(let e in i.delegates)this.once(e,i.delegates[e]);return this}off(e,t,n){if(n===void 0)return super.off(e,t);let r=typeof t==`string`?[t]:t;return this._removeDelegatedListener(e,r,n),this}queryRenderedFeatures(e,t){if(!this.style)return[];let n,r=e instanceof maplibre_gl_shared_l||Array.isArray(e),i=r?e:[[0,0],[this._camera.transform.width,this._camera.transform.height]];if(t||=(r?{}:e)||{},i instanceof maplibre_gl_shared_l||typeof i[0]==`number`)n=[maplibre_gl_shared_l.convert(i)];else{let e=maplibre_gl_shared_l.convert(i[0]),t=maplibre_gl_shared_l.convert(i[1]);n=[e,new maplibre_gl_shared_l(t.x,e.y),t,new maplibre_gl_shared_l(e.x,t.y),e]}return this.style.queryRenderedFeatures(n,t,this._camera.transform)}querySourceFeatures(e,t){return this.style.querySourceFeatures(e,t)}setStyle(e,t){return t=maplibre_gl_shared_xt({},{localIdeographFontFamily:this._localIdeographFontFamily,validate:this._validateStyle},t),this._styleUrl=typeof e==`string`?e:null,t.diff!==!1&&t.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&e?(this._diffStyle(e,t),this):(this._localIdeographFontFamily=t.localIdeographFontFamily,this._updateStyle(e,t))}setTransformRequest(e){return this._requestManager.setTransformRequest(e),this}_getUIString(e){let t=this._locale[e];if(t==null)throw Error(`Missing UI string '${e}'`);return t}_updateStyle(e,t){if(this._diffStyleRequest?.abort(),this._diffStyleRequest=null,t.transformStyle&&this.style&&!this.style._loaded){this.style.once(`style.load`,()=>this._updateStyle(e,t));return}let n=this.style&&t.transformStyle?this.style.serialize():void 0;if(this.style&&(this.style.setEventedParent(null),this.style._remove(!e)),e)this.style=new maplibre_gl_yl(this,t||{});else return this._frameRequest&&=(this._frameRequest.abort(),null),this.style?.projection?.destroy(),delete this.style,this;return this.style.setEventedParent(this,{style:this.style}),typeof e==`string`?this.style.loadURL(e,t,n):this.style.loadJSON(e,t,n),this}_lazyInitEmptyStyle(){this.style||(this.style=new maplibre_gl_yl(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}async _diffStyle(e,n){if(this._diffStyleRequest?.abort(),typeof e==`string`){let r=e;this._diffStyleRequest=new AbortController;let i=this._diffStyleRequest;try{let e=await this._requestManager.transformRequest(r,`Style`);if(i.signal.aborted){this._diffStyleRequest=null;return}let t=await maplibre_gl_shared_Dn(e,i);this._diffStyleRequest=null,this._updateDiff(t.data,n)}catch(e){this._diffStyleRequest=null,maplibre_gl_shared_mn(e)||this.fire(new maplibre_gl_shared_Pn(maplibre_gl_shared_Qe(e)))}}else typeof e==`object`&&(this._diffStyleRequest=null,this._updateDiff(e,n))}_updateDiff(e,n){try{this.style.setState(e,n)&&this._update(!0)}catch(r){maplibre_gl_shared_Ft(`Unable to perform style diff: ${maplibre_gl_shared_Qe(r).message}. Rebuilding the style from scratch.`),this._updateStyle(e,n)}}getStyle(){if(this.style)return this.style.serialize()}getStyleUrl(){return this._styleUrl}_getStyleAndImages(){return this.style?{style:this.style.serialize(),images:this.style.imageManager.cloneImages()}:{style:null,images:{}}}isStyleLoaded(){if(!this.style){maplibre_gl_shared_Ft(`There is no style added to the map.`);return}return this.style.loaded()}addSource(e,t){return this._lazyInitEmptyStyle(),this.style.addSource(e,t),this._update(!0)}isSourceLoaded(e){let t=this.style?.tileManagers[e];if(t===void 0){this.fire(new maplibre_gl_shared_Pn(Error(`There is no tile manager with ID '${e}'`)));return}return t.loaded()}setTerrain(e,t={}){if(this.style._checkLoaded(),e&&maplibre_gl_shared_mc(this,maplibre_gl_shared_lc.terrain,{value:e},t))return this;if(this._terrainDataCallback&&this.style.off(`data`,this._terrainDataCallback),!e)this.terrain&&this.terrain.destroy(),this.terrain=null,this.painter.renderToTexture=null,this._camera.terrain=null,this._camera.transform.setMinElevationForCurrentTile(0),this.getCenterClampedToGround()&&this._camera.transform.setElevation(0);else{let t=this.style.tileManagers[e.source];if(!t)throw Error(`cannot load terrain, because there exists no source with ID: ${e.source}`);this.terrain===null&&t.reload();for(let t in this.style._layers){let n=this.style._layers[t];n.type===`hillshade`&&n.source===e.source&&maplibre_gl_shared_Ft(`You are using the same source for a hillshade layer and for 3D terrain. Please consider using two separate sources to improve rendering quality.`),n.type===`color-relief`&&n.source===e.source&&maplibre_gl_shared_Ft(`You are using the same source for a color-relief layer and for 3D terrain. Please consider using two separate sources to improve rendering quality.`)}this.terrain&&this.terrain.destroy(),this.terrain=new maplibre_gl_c(this.painter,t,e,this._terrainSkirtLength),this.painter.renderToTexture=new maplibre_gl_Sm(this.painter,this.terrain),this._camera.terrain=this.terrain,this._camera.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this._camera.transform.center,this._camera.transform.tileZoom)),this._camera.transform.setElevation(this.terrain.getElevationForLngLat(this._camera.transform.center,this._camera.transform)),this._terrainDataCallback=t=>this._handleTerrainDataEvent(t,e.source),this.style.on(`data`,this._terrainDataCallback)}return this.style.triggerSymbolPlacement(),this.fire(new maplibre_gl_ei({terrain:e})),this}_handleTerrainDataEvent(e,t){if(e.dataType===`style`){this.terrain.tileManager.releaseAllRTT();return}let n=e.sourceId===t;if(n&&(this.terrain.resetElevationCache(),this.style.triggerSymbolPlacement()),n&&e.tile&&!this._camera.elevationFreeze&&(this._camera.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this._camera.transform.center,this._camera.transform.tileZoom)),this.getCenterClampedToGround()&&this._camera.transform.setElevation(this.terrain.getElevationForLngLat(this._camera.transform.center,this._camera.transform))),e.tile){if(e.source?.type===`image`){this.terrain.tileManager.releaseAllRTT();return}this.terrain.tileManager.releaseRTT(e.tile.tileID)}}getTerrain(){return this.terrain?.options??null}areTilesLoaded(){let e=this.style?.tileManagers;for(let t of Object.values(e))if(!t.areTilesLoaded())return!1;return!0}removeSource(e){return this.style.removeSource(e),this._update(!0)}getSource(e){return this.style?.getSource(e)}setSourceTileLodParams(e,t,n){if(n){let r=this.getSource(n);if(!r)throw Error(`There is no source with ID "${n}", cannot set LOD parameters`);r.calculateTileZoom=maplibre_gl_Eo(Math.max(1,e),Math.max(1,t))}else for(let n in this.style.tileManagers)this.style.tileManagers[n].getSource().calculateTileZoom=maplibre_gl_Eo(Math.max(1,e),Math.max(1,t));return this._update(!0),this}refreshTiles(e,t){let n=this.style.tileManagers[e];if(!n)throw Error(`There is no tile manager with ID "${e}", cannot refresh tile`);t===void 0?n.reload(!0):n.refreshTiles(t.map(e=>new maplibre_gl_shared_ub(e.z,e.x,e.y)))}addImage(e,t,n={}){this._lazyInitEmptyStyle();let r=this._createStyleImage(t,n);return r?(this.style.addImage(e,r),r.userImage?.onAdd&&r.userImage.onAdd(this,e),this):this}setMissingStyleImageResolver(e){return this._missingStyleImageResolver=e,this.style?.setMissingImageResolver(e),this}_createStyleImage(e,t={}){let{pixelRatio:n=1,sdf:r=!1,stretchX:i,stretchY:a,content:o,textFitWidth:s,textFitHeight:c}=t;if(e instanceof HTMLImageElement||maplibre_gl_shared_Ut(e)){let{width:t,height:l,data:u}=maplibre_gl_Br.getImageData(e);return{data:new Ad({width:t,height:l},u),pixelRatio:n,stretchX:i,stretchY:a,content:o,textFitWidth:s,textFitHeight:c,sdf:r,version:0}}if(e.width===void 0||e.height===void 0)return this.fire(new maplibre_gl_shared_Pn(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`"))),null;{let{width:t,height:l,data:u}=e,d=e,f=tv(d.data);return{data:f?new Ad({width:t,height:l}):new Ad({width:t,height:l},new Uint8Array(u)),pixelRatio:n,stretchX:i,stretchY:a,content:o,textFitWidth:s,textFitHeight:c,sdf:r,version:0,isWebGLImage:f,userImage:d}}}updateImage(e,t){let n=this.style.getImage(e);if(!n)return this.fire(new maplibre_gl_shared_Pn(Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));let{width:r,height:i,data:a}=t instanceof HTMLImageElement||maplibre_gl_shared_Ut(t)?maplibre_gl_Br.getImageData(t):t;if(r===void 0||i===void 0)return this.fire(new maplibre_gl_shared_Pn(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(r!==n.data.width||i!==n.data.height)return this.fire(new maplibre_gl_shared_Pn(Error(`The width and height of the updated image must be that same as the previous version of the image`)));if(n.isWebGLImage=tv(a),n.isWebGLImage)n.userImage=t;else{let e=!(t instanceof HTMLImageElement||maplibre_gl_shared_Ut(t));n.data.replace(a,e)}return this.style.updateImage(e,n),this}getImage(e){return this.style.getImage(e)}hasImage(e){return e?!!this.style.getImage(e):(this.fire(new maplibre_gl_shared_Pn(Error(`Missing required image id`))),!1)}removeImage(e){this.style.removeImage(e)}async loadImage(e){let t=await maplibre_gl_Gr.getImage(await this._requestManager.transformRequest(e,`Image`),new AbortController);if(!t.data)throw Error(`Could not load image ${e}: the response is empty`);return t}listImages(){return this.style?.listImages()??[]}addLayer(e,t){return this._lazyInitEmptyStyle(),this.style.addLayer(e,t),this._update(!0)}moveLayer(e,t){return this.style.moveLayer(e,t),this._update(!0)}removeLayer(e){return this.style.removeLayer(e),this._update(!0)}getLayer(e){return this.style?.getLayer(e)}getLayersOrder(){return this.style?.getLayersOrder()??[]}setLayerZoomRange(e,t,n){return this.style.setLayerZoomRange(e,t,n),this._update(!0)}setFilter(e,t,n={}){return this.style?.setFilter(e,t,n),this._update(!0)}getFilter(e){return this.style.getFilter(e)}setPaintProperty(e,t,n,r={}){return this.style?.setPaintProperty(e,t,n,r),this._update(!0)}getPaintProperty(e,t){return this.style.getPaintProperty(e,t)}setLayoutProperty(e,t,n,r={}){return this.style.setLayoutProperty(e,t,n,r),this._update(!0)}getLayoutProperty(e,t){return this.style.getLayoutProperty(e,t)}setGlyphs(e,t={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(e,t),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}setFontFaces(e){return this._lazyInitEmptyStyle(),this.style.setFontFaces(e),this._update(!0)}getFontFaces(){return this.style.getFontFaces()}addSprite(e,t,n={}){return this._lazyInitEmptyStyle(),this.style.addSprite(e,t,n,e=>{e||this._update(!0)}),this}removeSprite(e){return this._lazyInitEmptyStyle(),this.style.removeSprite(e),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(e,t={}){return this._lazyInitEmptyStyle(),this.style.setSprite(e,t,e=>{e||this._update(!0)}),this}setLight(e,t={}){return this._lazyInitEmptyStyle(),this.style.setLight(e,t),this._update(!0)}getLight(){return this.style.getLight()}setSky(e,t={}){return this._lazyInitEmptyStyle(),this.style.setSky(e,t),this._update(!0)}getSky(){return this.style.getSky()}setFeatureState(e,t){return this.style.setFeatureState(e,t),this._update()}removeFeatureState(e,t){return this.style.removeFeatureState(e,t),this._update()}getFeatureState(e){return this.style.getFeatureState(e)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let e=0,t=0;return this._container&&(e=this._container.clientWidth||400,t=this._container.clientHeight||300),[e,t]}_shouldHandleInitialResize(){if(!this._container?.clientWidth||!this._container.clientHeight)return!1;let[e,t]=this._containerDimensions();return e!==this._camera.transform.width||t!==this._camera.transform.height}_setupResizeObserver(){let e=!1,t=maplibre_gl_dp(e=>{this._trackResize&&!this._removed&&(this.resize(e),this.redraw())},50),n=this._ownerWindow.ResizeObserver??ResizeObserver;this._resizeObserver=new n(n=>{!e&&(e=!0,!this._shouldHandleInitialResize())||t(n)}),this._resizeObserver.observe(this._container)}_resolveContainer(e){if(typeof e==`string`){let t=document.getElementById(e);if(!t)throw Error(`Container '${e}' not found.`);return t}if(e instanceof HTMLElement||e&&typeof e==`object`&&e.nodeType===1)return e;throw Error(`Invalid type: 'container' must be a String or HTMLElement.`)}_setupContainer(){let e=this._container;e.classList.add(`maplibregl-map`);let t=this._canvasContainer=maplibre_gl_W.create(`div`,`maplibregl-canvas-container`,e);this._interactive&&t.classList.add(`maplibregl-interactive`),this._canvas=maplibre_gl_W.create(`canvas`,`maplibregl-canvas`,t),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`);let n=this._containerDimensions(),r=this._getClampedPixelRatio(n[0],n[1]);this._resizeCanvas(n[0],n[1],r);let i=this._controlContainer=maplibre_gl_W.create(`div`,`maplibregl-control-container`,e),a=this._controlPositions={};for(let e of[`top-left`,`top-right`,`bottom-left`,`bottom-right`])a[e]=maplibre_gl_W.create(`div`,`maplibregl-ctrl-${e} `,i);this._container.addEventListener(`scroll`,this._onMapScroll,!1)}_cleanupContainer(){this._canvas.removeEventListener(`webglcontextrestored`,this._contextRestored,!1),this._canvas.removeEventListener(`webglcontextlost`,this._contextLost,!1),this._canvasContainer.remove(),this._controlContainer.remove(),this._container.removeEventListener(`scroll`,this._onMapScroll,!1),this._container.classList.remove(`maplibregl-map`)}_resizeCanvas(e,t,n){this._canvas.width=Math.floor(n*e),this._canvas.height=Math.floor(n*t),this._canvas.style.width=`${e}px`,this._canvas.style.height=`${t}px`}_setupPainter(){let e={...this._canvasContextAttributes,alpha:!0,depth:!0,stencil:!0,premultipliedAlpha:!0},t=null;this._canvas.addEventListener(`webglcontextcreationerror`,e=>{t=e},{once:!0});let n=this._canvas.getContext(`webgl2`,e);if(!n)throw new maplibre_gl_up(e,t);this.painter=new maplibre_gl_lp(n,this._camera.transform)}migrateProjection(e,t){this._camera.migrateProjection(e,t),this.painter.transform=e,this.fire(new maplibre_gl_ti({newProjection:this.style.projection.name}))}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(e){return this.style?._loaded?(this._styleDirty||=e,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(e){return this._update(),this._renderTaskQueue.add(e)}_cancelRenderFrame(e){this._renderTaskQueue.remove(e)}_render(e){let t=this._idleTriggered?this._fadeDuration:0,n=this.style.projection?.transitionState>0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(e),this._removed)return;let r=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;let e=this._camera.transform.zoom,n=maplibre_gl_U();this.style.zoomHistory.update(e,n);let i=new maplibre_gl_shared_G(e,{now:n,fadeDuration:t,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),a=i.crossFadingFactor();(a!==1||a!==this._crossFadingFactor)&&(r=!0,this._crossFadingFactor=a),this.style.update(i)}let i=this.style.projection?.transitionState>0!==n;this._camera.transform.setTransitionState(this.style.projection?.transitionState),this.style&&(this._sourcesDirty||i)&&(this._sourcesDirty=!1,this.style._updateSources(this._camera.transform)),this.terrain?(this.terrain.tileManager.update(this._camera.transform,this.terrain)&&this.terrain.resetElevationCache(),this._camera.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this._camera.transform.center,this._camera.transform.tileZoom)),!this._camera.elevationFreeze&&this.getCenterClampedToGround()&&this._camera.transform.setElevation(this.terrain.getElevationForLngLat(this._camera.transform.center,this._camera.transform))):(this._camera.transform.setMinElevationForCurrentTile(0),this.getCenterClampedToGround()&&this._camera.transform.setElevation(0)),this._placementDirty=this.style?._updatePlacement(this._camera.transform,this.showCollisionBoxes,t,this._crossSourceCollisions,i),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:t,showPadding:this.showPadding,anisotropicFilterPitch:this.getAnisotropicFilterPitch()}),this.fire(new maplibre_gl_qr(`render`)),this.loaded()&&!this._loaded&&(this._loaded=!0,this.fire(new maplibre_gl_qr(`load`))),this.style&&(this.style.hasTransitions()||r)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();let a=this._sourcesDirty||this._styleDirty||this._placementDirty||this.painter.renderToTexture?.needsFollowUpFrame;return a||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new maplibre_gl_qr(`idle`)),this._loaded&&!this._fullyLoaded&&!a&&(this._fullyLoaded=!0),this}redraw(){return this.style&&(this._frameRequest&&=(this._frameRequest.abort(),null),this._render(0)),this}remove(){this._hash&&this._hash.remove();for(let e of this._controls)e.onRemove(this);this._controls=[],this._frameRequest&&=(this._frameRequest.abort(),null),this._renderTaskQueue.clear(),this._diffStyleRequest?.abort(),this.painter.destroy(),this._handlers.destroy(),this.setStyle(null),typeof window<`u`&&this._ownerWindow.removeEventListener(`online`,this._onWindowOnline,!1),maplibre_gl_Gr.removeThrottleControl(this._imageQueueHandle),this._resizeObserver?.disconnect();let e=this.painter.context.gl.getExtension(`WEBGL_lose_context`);e?.loseContext&&e.loseContext(),this._cleanupContainer(),this._removed=!0,this.fire(new maplibre_gl_qr(`remove`))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,maplibre_gl_Br.frame(this._frameRequest,e=>{this._frameRequest=null;try{this._render(e)}catch(e){if(!maplibre_gl_shared_mn(e))throw e}},()=>{},this._ownerWindow))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(e){this._showTileBoundaries!==e&&(this._showTileBoundaries=e,this._update())}get showPadding(){return!!this._showPadding}set showPadding(e){this._showPadding!==e&&(this._showPadding=e,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(e){this._showCollisionBoxes!==e&&(this._showCollisionBoxes=e,e?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(e){this._showOverdrawInspector!==e&&(this._showOverdrawInspector=e,this._update())}get repaint(){return!!this._repaint}set repaint(e){this._repaint!==e&&(this._repaint=e,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(e){this._vertices=e,this._update()}get version(){return maplibre_gl_wm}getCameraTargetElevation(){return this._camera.transform.elevation}getProjection(){return this.style.getProjection()}setProjection(e){return this._lazyInitEmptyStyle(),this.style.setProjection(e),this._update(!0)}};const maplibre_gl_Dm={showCompass:!0,showZoom:!0,visualizePitch:!1,visualizeRoll:!0};var maplibre_gl_Om=class{constructor(e){this._updateZoomButtons=()=>{let e=this._map.getZoom(),t=e===this._map.getMaxZoom(),n=e===this._map.getMinZoom(!0);this._zoomInButton.disabled=t,this._zoomOutButton.disabled=n,this._zoomInButton.setAttribute(`aria-disabled`,t.toString()),this._zoomOutButton.setAttribute(`aria-disabled`,n.toString())},this._rotateCompassArrow=()=>{let e=this._map.getPitch(),t=this._map.getRoll(),n=this._map.getBearing(),r=1/Math.cos(maplibre_gl_shared_$t(e))**.5;if(this.options.visualizePitch&&this.options.visualizeRoll){this._compassIcon.style.transform=`scale(${r}) rotateZ(${-t}deg) rotateX(${e}deg) rotateZ(${-n}deg)`;return}if(this.options.visualizePitch){this._compassIcon.style.transform=`scale(${r}) rotateX(${e}deg) rotateZ(${-n}deg)`;return}if(this.options.visualizeRoll){this._compassIcon.style.transform=`rotate(${-n-t}deg)`;return}this._compassIcon.style.transform=`rotate(${-n}deg)`},this._setButtonTitle=(e,t)=>{let n=this._map._getUIString(`NavigationControl.${t}`);e.title=n,e.setAttribute(`aria-label`,n)},this.options=maplibre_gl_shared_xt({},maplibre_gl_Dm,e),this._container=maplibre_gl_W.create(`div`,`maplibregl-ctrl maplibregl-ctrl-group`),this._container.addEventListener(`contextmenu`,e=>e.preventDefault()),this.options.showZoom&&(this._zoomInButton=this._createButton(`maplibregl-ctrl-zoom-in`,e=>this._map.zoomIn({},{originalEvent:e})),maplibre_gl_W.create(`span`,`maplibregl-ctrl-icon`,this._zoomInButton).setAttribute(`aria-hidden`,`true`),this._zoomOutButton=this._createButton(`maplibregl-ctrl-zoom-out`,e=>this._map.zoomOut({},{originalEvent:e})),maplibre_gl_W.create(`span`,`maplibregl-ctrl-icon`,this._zoomOutButton).setAttribute(`aria-hidden`,`true`)),this.options.showCompass&&(this._compass=this._createButton(`maplibregl-ctrl-compass`,e=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:e}):this._map.resetNorth({},{originalEvent:e})}),this._compassIcon=maplibre_gl_W.create(`span`,`maplibregl-ctrl-icon`,this._compass),this._compassIcon.setAttribute(`aria-hidden`,`true`))}onAdd(e){return this._map=e,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,`ZoomIn`),this._setButtonTitle(this._zoomOutButton,`ZoomOut`),this._map.on(`move`,this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,`ResetBearing`),this.options.visualizePitch&&this._map.on(`pitch`,this._rotateCompassArrow),this.options.visualizeRoll&&this._map.on(`roll`,this._rotateCompassArrow),this._map.on(`rotate`,this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new maplibre_gl_km(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){this._container.remove(),this.options.showZoom&&this._map.off(`move`,this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&this._map.off(`pitch`,this._rotateCompassArrow),this.options.visualizeRoll&&this._map.off(`roll`,this._rotateCompassArrow),this._map.off(`rotate`,this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(e,t){let n=maplibre_gl_W.create(`button`,e,this._container);return n.type=`button`,n.addEventListener(`click`,t),n}},maplibre_gl_km=class{constructor(e,t,n=!1){this.mousedown=e=>{this.startMove(e,maplibre_gl_W.mousePos(this.element,e)),window.addEventListener(`mousemove`,this.mousemove),window.addEventListener(`mouseup`,this.mouseup)},this.mousemove=e=>{this.move(e,maplibre_gl_W.mousePos(this.element,e))},this.mouseup=e=>{this._rotatePitchHandler.dragEnd(e),this.offTemp()},this.touchstart=e=>{e.targetTouches.length===1?(this._startPos=this._lastPos=maplibre_gl_W.touchPos(this.element,e.targetTouches)[0],this.startMove(e,this._startPos),window.addEventListener(`touchmove`,this.touchmove,{passive:!1}),window.addEventListener(`touchend`,this.touchend)):this.reset()},this.touchmove=e=>{e.targetTouches.length===1?(this._lastPos=maplibre_gl_W.touchPos(this.element,e.targetTouches)[0],this.move(e,this._lastPos)):this.reset()},this.touchend=e=>{e.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._rotatePitchHandler.reset(),delete this._startPos,delete this._lastPos,this.offTemp()},this._clickTolerance=10,this.element=t;let r=new maplibre_gl_Fp;this._rotatePitchHandler=new maplibre_gl_Ap({clickTolerance:3,move:(e,r)=>{let i=t.getBoundingClientRect(),a=new maplibre_gl_shared_l((i.bottom-i.top)/2,(i.right-i.left)/2);return{bearingDelta:maplibre_gl_shared_rn(new maplibre_gl_shared_l(e.x,r.y),r,a),pitchDelta:n?(r.y-e.y)*-.5:void 0}},moveStateManager:r,enable:!0,assignEvents:()=>{}}),this.map=e,t.addEventListener(`mousedown`,this.mousedown),t.addEventListener(`touchstart`,this.touchstart,{passive:!1}),t.addEventListener(`touchcancel`,this.reset)}startMove(e,t){this._rotatePitchHandler.dragStart(e,t),maplibre_gl_W.disableDrag()}move(e,t){let n=this.map,{bearingDelta:r,pitchDelta:i}=this._rotatePitchHandler.dragMove(e,t)||{};r&&n.setBearing(n.getBearing()+r),i&&n.setPitch(n.getPitch()+i)}off(){let e=this.element;e.removeEventListener(`mousedown`,this.mousedown),e.removeEventListener(`touchstart`,this.touchstart),window.removeEventListener(`touchmove`,this.touchmove),window.removeEventListener(`touchend`,this.touchend),e.removeEventListener(`touchcancel`,this.reset),this.offTemp()}offTemp(){maplibre_gl_W.enableDrag(),window.removeEventListener(`mousemove`,this.mousemove),window.removeEventListener(`mouseup`,this.mouseup),window.removeEventListener(`touchmove`,this.touchmove),window.removeEventListener(`touchend`,this.touchend)}};let maplibre_gl_Am;async function maplibre_gl_jm(e=!1){if(maplibre_gl_Am!==void 0&&!e)return maplibre_gl_Am;if(window.navigator.permissions===void 0)return maplibre_gl_Am=!!window.navigator.geolocation,maplibre_gl_Am;try{maplibre_gl_Am=(await window.navigator.permissions.query({name:`geolocation`})).state!==`denied`}catch{maplibre_gl_Am=!!window.navigator.geolocation}return maplibre_gl_Am}function maplibre_gl_Mm(e,t,n,r=!1){if(r||!n.getCoveringTilesDetailsProvider().allowWorldCopies())return e?.wrap();let i=new maplibre_gl_shared_Mp(e.lng,e.lat);if(e=new maplibre_gl_shared_Mp(e.lng,e.lat),t){let r=new maplibre_gl_shared_Mp(e.lng-360,e.lat),i=new maplibre_gl_shared_Mp(e.lng+360,e.lat),a=n.locationToScreenPoint(e).distSqr(t);n.locationToScreenPoint(r).distSqr(t)<a?e=r:n.locationToScreenPoint(i).distSqr(t)<a&&(e=i)}for(;Math.abs(e.lng-n.center.lng)>180;){let t=n.locationToScreenPoint(e);if(t.x>=0&&t.y>=0&&t.x<=n.width&&t.y<=n.height)break;e.lng>n.center.lng?e.lng-=360:e.lng+=360}return e.lng!==i.lng&&n.isPointOnMapSurface(n.locationToScreenPoint(e))?e:i}const maplibre_gl_Nm={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 maplibre_gl_Pm(e,t,n){let r=e.classList;for(let e in maplibre_gl_Nm)r.remove(`maplibregl-${n}-anchor-${e}`);r.add(`maplibregl-${n}-anchor-${t}`)}const maplibre_gl_Fm={ArrowLeft:[-1,0],ArrowRight:[1,0],ArrowUp:[0,-1],ArrowDown:[0,1]},maplibre_gl_Im=`#3FB1CE`;function maplibre_gl_Lm(e,t,n=[]){let r=maplibre_gl_W.createNS(`http://www.w3.org/2000/svg`,e);for(let e in t)r.setAttributeNS(null,e,t[e]);for(let e of n)r.appendChild(e);return r}let maplibre_gl_Rm;function maplibre_gl_zm(){return maplibre_gl_Rm||(maplibre_gl_Rm=maplibre_gl_Lm(`svg`,{display:`block`,height:`41px`,width:`27px`,viewBox:`0 0 27 41`},[maplibre_gl_Lm(`g`,{"fill-rule":`nonzero`},[maplibre_gl_Lm(`g`,{transform:`translate(3.0, 29.0)`,fill:`#000000`},[[`10.5`,`5.25002273`],[`10.5`,`5.25002273`],[`9.5`,`4.77275007`],[`8.5`,`4.29549936`],[`7.5`,`3.81822308`],[`6.5`,`3.34094679`],[`5.5`,`2.86367051`],[`4.5`,`2.38636864`]].map(([e,t])=>maplibre_gl_Lm(`ellipse`,{opacity:`0.04`,cx:`10.5`,cy:`5.80029008`,rx:e,ry:t}))),maplibre_gl_Lm(`g`,{fill:maplibre_gl_Im},[maplibre_gl_Lm(`path`,{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`})]),maplibre_gl_Lm(`g`,{opacity:`0.25`,fill:`#000000`},[maplibre_gl_Lm(`path`,{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`})]),maplibre_gl_Lm(`g`,{transform:`translate(6.0, 7.0)`,fill:`#FFFFFF`}),maplibre_gl_Lm(`g`,{transform:`translate(8.0, 8.0)`},[maplibre_gl_Lm(`circle`,{fill:`#000000`,opacity:`0.25`,cx:`5.5`,cy:`5.5`,r:`5.4999962`}),maplibre_gl_Lm(`circle`,{fill:`#FFFFFF`,cx:`5.5`,cy:`5.5`,r:`5.4999962`})])])]),maplibre_gl_Rm)}function maplibre_gl_Bm(e){return e.firstElementChild.children[1]}var maplibre_gl_Vm=class extends maplibre_gl_shared_Nn{},maplibre_gl_Hm=class extends maplibre_gl_shared_Nn{},maplibre_gl_Um=class extends maplibre_gl_shared_Fn{constructor(e){if(super(),this._onClick=e=>{this.fire(new maplibre_gl_Hm(`click`,{originalEvent:e}))},this._onKeyPress=e=>{(e.code===`Space`||e.code===`Enter`)&&this.togglePopup()},this._onKeyDown=e=>{if(!this._defaultMarker||!this._draggable||!this._map||!this._lngLat||e.composedPath()[0]!==this._element||e.altKey||e.ctrlKey||e.metaKey)return;let t=maplibre_gl_Fm[e.key];if(!t)return;e.preventDefault(),e.stopPropagation();let n=e.shiftKey?10:1,r=this._map.project(this._lngLat);this.setLngLat(this._map.unproject(new maplibre_gl_shared_l(r.x+t[0]*n,r.y+t[1]*n))),this._keyboardDragActive||(this._keyboardDragActive=!0,this.fire(new maplibre_gl_Vm(`dragstart`))),this.fire(new maplibre_gl_Vm(`drag`))},this._onKeyUp=e=>{maplibre_gl_Fm[e.key]&&this._endKeyboardDrag()},this._onBlur=()=>{this._endKeyboardDrag()},this._onMapClick=e=>{let t=e.originalEvent.target,n=this._element;this._popup&&(t===n||n.contains(t))&&this.togglePopup()},this._update=e=>{if(!this._map)return;let t=this._map.loaded()&&!this._map.isMoving();(e?.type===`terrain`||e?.type===`render`&&!t)&&this._map.once(`render`,this._update),this._lngLat=maplibre_gl_Mm(this._lngLat,this._flatPos,this._map._camera.transform),this._flatPos=this._pos=this._map.project(this._lngLat)._add(this._offset),this._map.terrain&&(this._flatPos=this._map._camera.transform.locationToScreenPoint(this._lngLat)._add(this._offset));let n=``;this._rotationAlignment===`viewport`||this._rotationAlignment===`auto`?n=`rotateZ(${this._rotation}deg)`:this._rotationAlignment===`map`&&(n=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let r=``;this._pitchAlignment===`viewport`||this._pitchAlignment===`auto`?r=`rotateX(0deg)`:this._pitchAlignment===`map`&&(r=`rotateX(${this._map.getPitch()}deg)`),!this._subpixelPositioning&&(!e||e.type===`moveend`)&&(this._pos=this._pos.round()),this._element.style.transform=`${maplibre_gl_Nm[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${r} ${n}`,maplibre_gl_Br.frameAsync(new AbortController,this._map._ownerWindow).then(()=>{this._updateOpacity(e?.type===`moveend`)}).catch(()=>{})},this._onMove=e=>{if(!this._isDragging){let t=this._clickTolerance||this._map._clickTolerance;this._isDragging=e.point.dist(this._pointerdownPos)>=t}this._isDragging&&(this._pos=e.point.sub(this._positionDelta),this._lngLat=this._map.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents=`none`,this._state===`pending`&&(this._state=`active`,this.fire(new maplibre_gl_Vm(`dragstart`))),this.fire(new maplibre_gl_Vm(`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 maplibre_gl_Vm(`dragend`)),this._state=`inactive`},this._addDragHandler=e=>{this._element.contains(e.originalEvent.target)&&(e.preventDefault(),this._positionDelta=e.point.sub(this._pos).add(this._offset),this._pointerdownPos=e.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=e?.anchor||`center`,this._color=e?.color||maplibre_gl_Im,this._scale=e?.scale||1,this._draggable=e?.draggable||!1,this._clickTolerance=e?.clickTolerance||0,this._subpixelPositioning=e?.subpixelPositioning||!1,this._isDragging=!1,this._roleManaged=!1,this._tabIndexManaged=!1,this._keyboardDragActive=!1,this._state=`inactive`,this._rotation=e?.rotation||0,this._rotationAlignment=e?.rotationAlignment||`auto`,this._pitchAlignment=e?.pitchAlignment&&e.pitchAlignment!==`auto`?e.pitchAlignment:this._rotationAlignment,this.setOpacity(e?.opacity,e?.opacityWhenCovered),e?.element)this._element=e.element,this._offset=maplibre_gl_shared_l.convert(e?.offset||[0,0]);else{this._defaultMarker=!0,this._element=maplibre_gl_W.create(`div`);let t=maplibre_gl_zm().cloneNode(!0);t.setAttributeNS(null,`height`,`${41*this._scale}px`),t.setAttributeNS(null,`width`,`${27*this._scale}px`),maplibre_gl_Bm(t).setAttributeNS(null,`fill`,this._color),this._element.appendChild(t),this._offset=maplibre_gl_shared_l.convert(e?.offset||[0,-14])}if(this._element.classList.add(`maplibregl-marker`),this._element.addEventListener(`dragstart`,e=>{e.preventDefault()}),this._element.addEventListener(`mousedown`,e=>{e.preventDefault()}),maplibre_gl_Pm(this._element,this._anchor,`marker`),e?.className)for(let t of e.className.split(` `))this._element.classList.add(t);this._popup=null}addTo(e){return this.remove(),this._map=e,this._defaultMarker&&!this._element.hasAttribute(`aria-label`)&&this._element.setAttribute(`aria-label`,e._getUIString(`Marker.Title`)),this._updateAccessibilityRole(),e.getCanvasContainer().appendChild(this._element),e.on(`move`,this._update),e.on(`moveend`,this._update),e.on(`terrain`,this._update),e.on(`projectiontransition`,this._update),this._element.addEventListener(`click`,this._onClick),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(`projectiontransition`,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),this._element.removeEventListener(`click`,this._onClick),this._element.removeEventListener(`keydown`,this._onKeyDown),this._element.removeEventListener(`keyup`,this._onKeyUp),this._element.removeEventListener(`blur`,this._onBlur),this._element.removeEventListener(`keypress`,this._onKeyPress),this._keyboardDragActive=!1,this._element.remove(),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(e){return this._lngLat=maplibre_gl_shared_Mp.convert(e),this._pos=null,this._update(),this._popup&&this._popup.setLngLat(this._lngLat),this}getElement(){return this._element}setPopup(e){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener(`keypress`,this._onKeyPress)),e){if(!(`offset`in e.options)){let t=13.5/Math.SQRT2;e.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[t,(24.6+t)*-1],"bottom-right":[-t,(24.6+t)*-1],left:[13.5,-24.6],right:[-13.5,-24.6]}:this._offset}this._popup=e,this._element.addEventListener(`keypress`,this._onKeyPress)}return this._updateTabIndex(),this._updateAccessibilityRole(),this}setSubpixelPositioning(e){return this._subpixelPositioning=e,this}_endKeyboardDrag(){this._keyboardDragActive&&(this._keyboardDragActive=!1,this.fire(new maplibre_gl_Vm(`dragend`)))}getPopup(){return this._popup}togglePopup(){let e=this._popup;if(this._element.style.opacity===this._opacityWhenCovered)return this;if(e)e.isOpen()?e.remove():(e.setLngLat(this._lngLat),e.addTo(this._map));else return this;return this}_updateOpacity(e=!1){let t=this._map?.terrain,n=this._map._camera.transform.isLocationOccluded(this._lngLat);if(!t||n){let e=n?this._opacityWhenCovered:this._opacity;this._element.style.opacity!==e&&(this._element.style.opacity=e,this._element.classList.toggle(`maplibregl-marker-covered`,n));return}if(e)this._opacityTimeout=null;else{if(this._opacityTimeout)return;this._opacityTimeout=setTimeout(()=>{this._opacityTimeout=null},100)}let r=this._map,i=r.terrain.depthAtPoint(this._pos),a=r.terrain.getElevationForLngLat(this._lngLat,r._camera.transform),o=r._camera.transform.lngLatToCameraDepth(this._lngLat,a),s=.006;if(o-i<s){this._element.style.opacity=this._opacity,this._element.classList.remove(`maplibregl-marker-covered`);return}let c=-this._offset.y/r._camera.transform.pixelsPerMeter,l=Math.sin(r.getPitch()*Math.PI/180)*c,u=r.terrain.depthAtPoint(new maplibre_gl_shared_l(this._pos.x,this._pos.y-this._offset.y)),d=r._camera.transform.lngLatToCameraDepth(this._lngLat,a+l)-u>s;this._popup?.isOpen()&&d&&this._popup.remove(),this._element.style.opacity=d?this._opacityWhenCovered:this._opacity,this._element.classList.toggle(`maplibregl-marker-covered`,d)}getOffset(){return this._offset}setOffset(e){return this._offset=maplibre_gl_shared_l.convert(e),this._update(),this}addClassName(e){this._element.classList.add(e)}removeClassName(e){this._element.classList.remove(e)}toggleClassName(e){return this._element.classList.toggle(e)}setDraggable(e){return this._draggable=!!e,this._element.classList.toggle(`maplibregl-marker-draggable`,this._draggable),this._map&&(e?(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._defaultMarker&&(this._draggable?(this._element.addEventListener(`keydown`,this._onKeyDown),this._element.addEventListener(`keyup`,this._onKeyUp),this._element.addEventListener(`blur`,this._onBlur)):(this._element.removeEventListener(`keydown`,this._onKeyDown),this._element.removeEventListener(`keyup`,this._onKeyUp),this._element.removeEventListener(`blur`,this._onBlur),this._endKeyboardDrag())),this._updateTabIndex(),this._updateAccessibilityRole(),this}isDraggable(){return this._draggable}_updateTabIndex(){this._popup||this._defaultMarker&&this._draggable?this._element.hasAttribute(`tabindex`)||(this._element.setAttribute(`tabindex`,`0`),this._tabIndexManaged=!0):this._tabIndexManaged&&=(this._element.getAttribute(`tabindex`)===`0`&&this._element.removeAttribute(`tabindex`),!1)}_updateAccessibilityRole(){if(!this._defaultMarker||this._element.hasAttribute(`role`)&&!this._roleManaged)return;let e=this._draggable||this._popup?`button`:`img`;this._element.setAttribute(`role`,e),this._roleManaged=!0}setRotation(e){return this._rotation=e||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(e){return this._rotationAlignment=e||`auto`,this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(e){return this._pitchAlignment=e&&e!==`auto`?e:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}setOpacity(e,t){return(this._opacity===void 0||e===void 0&&t===void 0)&&(this._opacity=`1`,this._opacityWhenCovered=`0.2`),e!==void 0&&(this._opacity=String(e)),t!==void 0&&(this._opacityWhenCovered=String(t)),this._map&&this._updateOpacity(!0),this}};const maplibre_gl_Wm={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let maplibre_gl_Gm=0,maplibre_gl_Km=!1;var maplibre_gl_qm=class extends maplibre_gl_shared_Nn{},maplibre_gl_Jm=class extends maplibre_gl_shared_Nn{},maplibre_gl_Ym=class extends maplibre_gl_shared_Nn{},maplibre_gl_Xm=class extends maplibre_gl_shared_Fn{constructor(e){super(),this._onSuccess=e=>{if(this._map){if(this._isOutOfMapMaxBounds(e)){this._setErrorState(),this.fire(new maplibre_gl_Jm(`outofmaxbounds`,e)),this._updateMarker(),this._finish();return}if(this.options.trackUserLocation)switch(this._lastKnownPosition=e,this._watchState){case`WAITING_ACTIVE`:case`ACTIVE_LOCK`:case`ACTIVE_ERROR`:this._watchState=`ACTIVE_LOCK`,this._geolocateButton.classList.remove(`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 Error(`Unexpected watchState ${this._watchState}`)}this.options.showUserLocation&&this._watchState!==`OFF`&&this._updateMarker(e),(!this.options.trackUserLocation||this._watchState===`ACTIVE_LOCK`)&&this._updateCamera(e),this.options.showUserLocation&&this._dotElement.classList.remove(`maplibregl-user-location-dot-stale`),this.fire(new maplibre_gl_Jm(`geolocate`,e)),this._finish()}},this._updateCamera=e=>{let t=new maplibre_gl_shared_Mp(e.coords.longitude,e.coords.latitude),n=e.coords.accuracy,r=this._map.getBearing(),i=maplibre_gl_shared_xt({bearing:r},this.options.fitBoundsOptions),a=maplibre_gl_ya.fromLngLat(t,n);this._map.fitBounds(a,i,{geolocateSource:!0})},this._updateMarker=e=>{if(e){let t=new maplibre_gl_shared_Mp(e.coords.longitude,e.coords.latitude);this._accuracyCircleMarker.setLngLat(t).addTo(this._map),this._userLocationDotMarker.setLngLat(t).addTo(this._map),this._accuracy=e.coords.accuracy,this._updateCircleRadiusIfNeeded()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()},this._onUpdate=()=>{this._updateCircleRadiusIfNeeded()},this._onError=e=>{if(this._map){if(e.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;let e=this._map._getUIString(`GeolocateControl.LocationNotAvailable`);this._geolocateButton.title=e,this._geolocateButton.setAttribute(`aria-label`,e),this._geolocationWatchID!==void 0&&this._clearWatch()}else if(e.code===3&&maplibre_gl_Km)return;else this._setErrorState();this._watchState!==`OFF`&&this.options.showUserLocation&&this._dotElement.classList.add(`maplibregl-user-location-dot-stale`),this.fire(new maplibre_gl_Ym(`error`,e)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._onMoveStart=e=>{if(!this._map)return;let t=e?.[0]instanceof ResizeObserverEntry;!e.geolocateSource&&this._watchState===`ACTIVE_LOCK`&&!t&&!this._map.isZooming()&&(this._watchState=`BACKGROUND`,this._geolocateButton.classList.add(`maplibregl-ctrl-geolocate-background`),this._geolocateButton.classList.remove(`maplibregl-ctrl-geolocate-active`),this.fire(new maplibre_gl_qm(`trackuserlocationend`)),this.fire(new maplibre_gl_qm(`userlocationlostfocus`)))},this._setupUI=()=>{this._map&&(this._container.addEventListener(`contextmenu`,e=>{e.preventDefault()}),this._geolocateButton=maplibre_gl_W.create(`button`,`maplibregl-ctrl-geolocate`,this._container),maplibre_gl_W.create(`span`,`maplibregl-ctrl-icon`,this._geolocateButton).setAttribute(`aria-hidden`,`true`),this._geolocateButton.type=`button`,this._geolocateButton.disabled=!0)},this._finishSetupUI=e=>{if(this._map){if(e===!1){maplibre_gl_shared_Ft(`Geolocation support is not available so the GeolocateControl will be disabled.`);let e=this._map._getUIString(`GeolocateControl.LocationNotAvailable`);this._geolocateButton.disabled=!0,this._geolocateButton.title=e,this._geolocateButton.setAttribute(`aria-label`,e)}else{let e=this._map._getUIString(`GeolocateControl.FindMyLocation`);this._geolocateButton.disabled=!1,this._geolocateButton.title=e,this._geolocateButton.setAttribute(`aria-label`,e)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute(`aria-pressed`,`false`),this._watchState=`OFF`),this.options.showUserLocation&&(this._dotElement=maplibre_gl_W.create(`div`,`maplibregl-user-location-dot`),this._userLocationDotMarker=new maplibre_gl_Um({element:this._dotElement}),this._circleElement=maplibre_gl_W.create(`div`,`maplibregl-user-location-accuracy-circle`),this._accuracyCircleMarker=new maplibre_gl_Um({element:this._circleElement,pitchAlignment:`map`}),this.options.trackUserLocation&&(this._watchState=`OFF`),this._map.on(`zoom`,this._onUpdate),this._map.on(`move`,this._onUpdate),this._map.on(`rotate`,this._onUpdate),this._map.on(`pitch`,this._onUpdate)),this._geolocateButton.addEventListener(`click`,()=>this.trigger()),this._setup=!0,this.options.trackUserLocation&&this._map.on(`movestart`,this._onMoveStart)}},this.options=maplibre_gl_shared_xt({},maplibre_gl_Wm,e)}onAdd(e){return this._map=e,this._container=maplibre_gl_W.create(`div`,`maplibregl-ctrl maplibregl-ctrl-group`),this._setupUI(),maplibre_gl_jm().then(e=>this._finishSetupUI(e)),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(),this._container.remove(),this._map.off(`movestart`,this._onMoveStart),this._map.off(`zoom`,this._onUpdate),this._map.off(`move`,this._onUpdate),this._map.off(`rotate`,this._onUpdate),this._map.off(`pitch`,this._onUpdate),this._map=void 0,maplibre_gl_Gm=0,maplibre_gl_Km=!1}_isOutOfMapMaxBounds(e){let t=this._map.getMaxBounds(),n=e.coords;return t&&(n.longitude<t.getWest()||n.longitude>t.getEast()||n.latitude<t.getSouth()||n.latitude>t.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`:case`BACKGROUND_ERROR`:break;case`OFF`:case void 0:break;default:throw Error(`Unexpected watchState ${this._watchState}`)}}_updateCircleRadiusIfNeeded(){let e=this._userLocationDotMarker.getLngLat();if(!this.options.showUserLocation||!this.options.showAccuracyCircle||!this._accuracy||!e)return;let t=this._map.project(e),n=this._map.unproject([t.x+100,t.y]),r=e.distanceTo(n)/100,i=2*this._accuracy/r;this._circleElement.style.width=`${i.toFixed(2)}px`,this._circleElement.style.height=`${i.toFixed(2)}px`}trigger(){if(!this._setup)return maplibre_gl_shared_Ft(`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 maplibre_gl_qm(`trackuserlocationstart`));break;case`WAITING_ACTIVE`:case`ACTIVE_LOCK`:case`ACTIVE_ERROR`:case`BACKGROUND_ERROR`:maplibre_gl_Gm--,maplibre_gl_Km=!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 maplibre_gl_qm(`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 maplibre_gl_qm(`trackuserlocationstart`)),this.fire(new maplibre_gl_qm(`userlocationfocus`));break;default:throw 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 Error(`Unexpected watchState ${this._watchState}`)}if(this._watchState===`OFF`&&this._geolocationWatchID!==void 0)this._clearWatch();else if(this._geolocationWatchID===void 0){this._geolocateButton.classList.add(`maplibregl-ctrl-geolocate-waiting`),this._geolocateButton.setAttribute(`aria-pressed`,`true`),maplibre_gl_Gm++;let e;maplibre_gl_Gm>1?(e={maximumAge:6e5,timeout:0},maplibre_gl_Km=!0):(e=this.options.positionOptions,maplibre_gl_Km=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,e)}}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)}};const maplibre_gl_Zm=(/* unused pure expression or super */ null && ({maxWidth:100,unit:`metric`}));var maplibre_gl_Qm=class{constructor(e){this._onMove=()=>{maplibre_gl_$m(this._map,this._container,this.options)},this.setUnit=e=>{this.options.unit=e,maplibre_gl_$m(this._map,this._container,this.options)},this.options={...maplibre_gl_Zm,...e}}getDefaultPosition(){return`bottom-left`}onAdd(e){return this._map=e,this._container=maplibre_gl_W.create(`div`,`maplibregl-ctrl maplibregl-ctrl-scale`,e.getContainer()),this._map.on(`move`,this._onMove),this._onMove(),this._container}onRemove(){this._container.remove(),this._map.off(`move`,this._onMove),this._map=void 0}};function maplibre_gl_$m(e,t,n){let r=n?.maxWidth||100,i=e._container.clientHeight/2,a=e._container.clientWidth/2,o=e.unproject([a-r/2,i]),s=e.unproject([a+r/2,i]),c=Math.round(e.project(s).x-e.project(o).x),l=Math.min(r,c,e._container.clientWidth),u=o.distanceTo(s);if(n?.unit===`imperial`){let n=3.2808*u;n>5280?maplibre_gl_eh(t,l,n/5280,e._getUIString(`ScaleControl.Miles`)):maplibre_gl_eh(t,l,n,e._getUIString(`ScaleControl.Feet`))}else n?.unit===`nautical`?maplibre_gl_eh(t,l,u/1852,e._getUIString(`ScaleControl.NauticalMiles`)):u>=1e3?maplibre_gl_eh(t,l,u/1e3,e._getUIString(`ScaleControl.Kilometers`)):maplibre_gl_eh(t,l,u,e._getUIString(`ScaleControl.Meters`))}function maplibre_gl_eh(e,t,n,r){let i=maplibre_gl_nh(n),a=i/n;e.style.width=`${t*a}px`,e.innerHTML=`${i}&nbsp;${r}`}function maplibre_gl_th(e){let t=10**Math.ceil(-Math.log(e)/Math.LN10);return Math.round(e*t)/t}function maplibre_gl_nh(e){let t=10**(`${Math.floor(e)}`.length-1),n=e/t;return n=n>=10?10:n>=5?5:n>=3?3:n>=2?2:n>=1?1:maplibre_gl_th(n),t*n}var maplibre_gl_rh=class extends maplibre_gl_shared_Nn{},maplibre_gl_ih=class extends maplibre_gl_shared_Fn{constructor(e={}){super(),this._onFullscreenChange=()=>{let e=window.document.fullscreenElement||window.document.webkitFullscreenElement;for(;e?.shadowRoot?.fullscreenElement;)e=e.shadowRoot.fullscreenElement;e===this._container!==this._fullscreen&&this._handleFullscreenChange()},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},this._fullscreen=!1,this._pseudo=e.pseudo??!1,e?.container&&(e.container instanceof HTMLElement?this._container=e.container:maplibre_gl_shared_Ft(`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(e){return this._map=e,this._container||=this._map.getContainer(),this._controlContainer=maplibre_gl_W.create(`div`,`maplibregl-ctrl maplibregl-ctrl-group`),this._setupUI(),this._controlContainer}onRemove(){this._controlContainer.remove(),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){let e=this._fullscreenButton=maplibre_gl_W.create(`button`,`maplibregl-ctrl-fullscreen`,this._controlContainer);maplibre_gl_W.create(`span`,`maplibregl-ctrl-icon`,e).setAttribute(`aria-hidden`,`true`),e.type=`button`,this._updateTitle(),this._fullscreenButton.addEventListener(`click`,this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){let e=this._getTitle();this._fullscreenButton.setAttribute(`aria-label`,e),this._fullscreenButton.title=e}_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 maplibre_gl_rh(`fullscreenstart`)),this._prevCooperativeGesturesEnabled=this._map.cooperativeGestures.isEnabled(),this._map.cooperativeGestures.disable()):(this.fire(new maplibre_gl_rh(`fullscreenend`)),this._prevCooperativeGesturesEnabled&&this._map.cooperativeGestures.enable())}_exitFullscreen(){this._pseudo?this._togglePseudoFullScreen():window.document.exitFullscreen?window.document.exitFullscreen():window.document.webkitCancelFullScreen?window.document.webkitCancelFullScreen():this._togglePseudoFullScreen()}_requestFullscreen(){this._pseudo?this._togglePseudoFullScreen():this._container.requestFullscreen?this._container.requestFullscreen():this._container.webkitRequestFullscreen?this._container.webkitRequestFullscreen():this._togglePseudoFullScreen()}_togglePseudoFullScreen(){this._container.classList.toggle(`maplibregl-pseudo-fullscreen`),this._handleFullscreenChange(),this._map.resize()}},maplibre_gl_ah=class{constructor(e){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=e}onAdd(e){return this._map=e,this._container=maplibre_gl_W.create(`div`,`maplibregl-ctrl maplibregl-ctrl-group`),this._terrainButton=maplibre_gl_W.create(`button`,`maplibregl-ctrl-terrain`,this._container),maplibre_gl_W.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(){this._container.remove(),this._map.off(`terrain`,this._updateTerrainIcon),this._map=void 0}},maplibre_gl_oh=class{constructor(){this._toggleProjection=()=>{let e=this._map.getProjection()?.type;e===`mercator`||!e?this._map.setProjection({type:`globe`}):this._map.setProjection({type:`mercator`}),this._updateGlobeIcon()},this._updateGlobeIcon=()=>{this._globeButton.classList.remove(`maplibregl-ctrl-globe`),this._globeButton.classList.remove(`maplibregl-ctrl-globe-enabled`),this._map.getProjection()?.type===`globe`?(this._globeButton.classList.add(`maplibregl-ctrl-globe-enabled`),this._globeButton.title=this._map._getUIString(`GlobeControl.Disable`)):(this._globeButton.classList.add(`maplibregl-ctrl-globe`),this._globeButton.title=this._map._getUIString(`GlobeControl.Enable`))}}onAdd(e){return this._map=e,this._container=maplibre_gl_W.create(`div`,`maplibregl-ctrl maplibregl-ctrl-group`),this._globeButton=maplibre_gl_W.create(`button`,`maplibregl-ctrl-globe`,this._container),maplibre_gl_W.create(`span`,`maplibregl-ctrl-icon`,this._globeButton).setAttribute(`aria-hidden`,`true`),this._globeButton.type=`button`,this._globeButton.addEventListener(`click`,this._toggleProjection),this._updateGlobeIcon(),this._map.on(`styledata`,this._updateGlobeIcon),this._map.on(`projectiontransition`,this._updateGlobeIcon),this._container}onRemove(){this._container.remove(),this._map.off(`styledata`,this._updateGlobeIcon),this._map.off(`projectiontransition`,this._updateGlobeIcon),this._globeButton.removeEventListener(`click`,this._toggleProjection),this._map=void 0}};const maplibre_gl_sh={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:``,maxWidth:`240px`,subpixelPositioning:!1,locationOccludedOpacity:void 0,padding:void 0},maplibre_gl_ch=[`a[href]`,`[tabindex]:not([tabindex='-1'])`,`[contenteditable]:not([contenteditable='false'])`,`button:not([disabled])`,`input:not([disabled])`,`select:not([disabled])`,`textarea:not([disabled])`].join(`, `);var maplibre_gl_lh=class extends maplibre_gl_shared_Nn{},maplibre_gl_uh=class extends maplibre_gl_shared_Fn{constructor(e){super(),this._updateOpacity=()=>{this.options.locationOccludedOpacity!==void 0&&(this._map._camera.transform.isLocationOccluded(this.getLngLat())?this._container.style.opacity=`${this.options.locationOccludedOpacity}`:this._container.style.opacity=``)},this.remove=()=>(this._content&&this._content.remove(),this._container&&(this._container.remove(),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(`terrain`,this._update),this._map.off(`projectiontransition`,this._update),this._map.off(`mousemove`,this._update),this._map.off(`mouseup`,this._update),this._map.off(`drag`,this._update),this._map._canvasContainer.classList.remove(`maplibregl-track-pointer`),delete this._map,this.fire(new maplibre_gl_lh(`close`))),this),this._update=e=>{let t=this._lngLat||this._trackPointer;if(!this._map||!t||!this._content)return;if(!this._container){if(this._container=maplibre_gl_W.create(`div`,`maplibregl-popup`,this._map.getContainer()),this._tip=maplibre_gl_W.create(`div`,`maplibregl-popup-tip`,this._container),this._container.appendChild(this._content),this.options.className)for(let e of this.options.className.split(` `))this._container.classList.add(e);this._closeButton&&this._closeButton.setAttribute(`aria-label`,this._map._getUIString(`Popup.Close`)),this._trackPointer&&this._container.classList.add(`maplibregl-popup-track-pointer`)}this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._lngLat=maplibre_gl_Mm(this._lngLat,this._flatPos,this._map._camera.transform,this._trackPointer);let n;if(e&&`point`in e&&e.point&&(n=e.point),this._trackPointer&&!n)return;let r=this._flatPos=this._pos=this._trackPointer&&n?n:this._map.project(this._lngLat);this._map.terrain&&(this._flatPos=this._trackPointer&&n?n:this._map._camera.transform.locationToScreenPoint(this._lngLat));let i=this.options.anchor,a=maplibre_gl_dh(this.options.offset);if(!i){let e=this._container.offsetWidth,t=this._container.offsetHeight,n=maplibre_gl_fh(this.options.padding),o;o=r.y+a.bottom.y<t+n.top?[`top`]:r.y>this._map._camera.transform.height-t-n.bottom?[`bottom`]:[],r.x<e/2+n.left?o.push(`left`):r.x>this._map._camera.transform.width-e/2-n.right&&o.push(`right`),i=o.length===0?`bottom`:o.join(`-`)}let o=r.add(a[i]);this.options.subpixelPositioning||(o=o.round()),this._container.style.transform=`${maplibre_gl_Nm[i]} translate(${o.x}px,${o.y}px)`,maplibre_gl_Pm(this._container,i,`popup`),this._updateOpacity()},this._onClose=()=>{this.remove()},this.options=maplibre_gl_shared_xt(Object.create(maplibre_gl_sh),e)}addTo(e){return this._map&&this.remove(),this._map=e,this.options.closeOnClick&&this._map.on(`click`,this._onClose),this.options.closeOnMove&&this._map.on(`move`,this._onClose),this._map.on(`remove`,this.remove),this._map.on(`terrain`,this._update),this._map.on(`projectiontransition`,this._update),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on(`mousemove`,this._update),this._map.on(`mouseup`,this._update),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 maplibre_gl_lh(`open`)),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(e){return this._lngLat=maplibre_gl_shared_Mp.convert(e),this._pos=null,this._flatPos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on(`move`,this._update),this._map.off(`mousemove`,this._update),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._update),this._map.on(`drag`,this._update),this._container&&this._container.classList.add(`maplibregl-popup-track-pointer`),this._map._canvasContainer.classList.add(`maplibregl-track-pointer`)),this}getElement(){return this._container}setText(e){return this.setDOMContent(document.createTextNode(e))}setHTML(e){let t=document.createDocumentFragment(),n=document.createElement(`body`),r;for(n.innerHTML=e;r=n.firstChild,r;)t.appendChild(r);return this.setDOMContent(t)}getMaxWidth(){return this._container?.style.maxWidth}setMaxWidth(e){return this.options.maxWidth=e,this._update(),this}setDOMContent(e){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=maplibre_gl_W.create(`div`,`maplibregl-popup-content`,this._container);return this._content.appendChild(e),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(e){return this._container&&this._container.classList.add(e),this}removeClassName(e){return this._container&&this._container.classList.remove(e),this}setOffset(e){return this.options.offset=e,this._update(),this}toggleClassName(e){if(this._container)return this._container.classList.toggle(e)}setSubpixelPositioning(e){this.options.subpixelPositioning=e}setPadding(e){this.options.padding=e,this._update()}_createCloseButton(){this.options.closeButton&&(this._closeButton=maplibre_gl_W.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;let e=this._container.querySelector(maplibre_gl_ch);e&&e.focus()}};function maplibre_gl_dh(e){if(!e)return maplibre_gl_dh(new maplibre_gl_shared_l(0,0));if(typeof e==`number`){let t=Math.round(Math.abs(e)/Math.SQRT2);return{center:new maplibre_gl_shared_l(0,0),top:new maplibre_gl_shared_l(0,e),"top-left":new maplibre_gl_shared_l(t,t),"top-right":new maplibre_gl_shared_l(-t,t),bottom:new maplibre_gl_shared_l(0,-e),"bottom-left":new maplibre_gl_shared_l(t,-t),"bottom-right":new maplibre_gl_shared_l(-t,-t),left:new maplibre_gl_shared_l(e,0),right:new maplibre_gl_shared_l(-e,0)}}if(e instanceof maplibre_gl_shared_l||Array.isArray(e)){let t=maplibre_gl_shared_l.convert(e);return{center:t,top:t,"top-left":t,"top-right":t,bottom:t,"bottom-left":t,"bottom-right":t,left:t,right:t}}return{center:maplibre_gl_shared_l.convert(e.center||[0,0]),top:maplibre_gl_shared_l.convert(e.top||[0,0]),"top-left":maplibre_gl_shared_l.convert(e[`top-left`]||[0,0]),"top-right":maplibre_gl_shared_l.convert(e[`top-right`]||[0,0]),bottom:maplibre_gl_shared_l.convert(e.bottom||[0,0]),"bottom-left":maplibre_gl_shared_l.convert(e[`bottom-left`]||[0,0]),"bottom-right":maplibre_gl_shared_l.convert(e[`bottom-right`]||[0,0]),left:maplibre_gl_shared_l.convert(e.left||[0,0]),right:maplibre_gl_shared_l.convert(e.right||[0,0])}}function maplibre_gl_fh(e){return e?{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}:{top:0,right:0,bottom:0,left:0}}const maplibre_gl_ph=maplibre_gl_Mr;function maplibre_gl_mh(e,t){return maplibre_gl_mo().setRTLTextPlugin(e,t)}function maplibre_gl_hh(){return maplibre_gl_mo().getRTLTextPluginStatus()}function maplibre_gl_gh(){return maplibre_gl_ph}function maplibre_gl_h(){return maplibre_gl_$i.workerCount}function maplibre_gl_vh(e){maplibre_gl_$i.workerCount=e}function maplibre_gl_yh(){return maplibre_gl_vn.MAX_PARALLEL_IMAGE_REQUESTS}function maplibre_gl_bh(e){maplibre_gl_vn.MAX_PARALLEL_IMAGE_REQUESTS=e}function maplibre_gl_xh(){return maplibre_gl_shared_gn.WORKER_URL}function maplibre_gl_Sh(e){maplibre_gl_shared_gn.WORKER_URL=e}async function maplibre_gl_Ch(e){await maplibre_gl_sa().broadcast(`IS`,e)}
12213
12216
  //# sourceMappingURL=maplibre-gl.mjs.map
12214
12217
  ;// ./src/utils/semaphore.ts
12215
12218
  function semaphore_typeof(o) { "@babel/helpers - typeof"; return semaphore_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, semaphore_typeof(o); }
@@ -12379,6 +12382,153 @@ var Semaphore = /*#__PURE__*/function () {
12379
12382
  }
12380
12383
  }]);
12381
12384
  }();
12385
+ ;// ./src/map/generated/maplibreWorkerSource.ts
12386
+ // GENERATED FILE - do not edit by hand.
12387
+ // Source: maplibre-gl@6.9.0 dist/maplibre-gl-worker.mjs, bundled with esbuild.
12388
+ // Regenerate with: pnpm run build:worker
12389
+ /** MapLibre version the worker below was bundled from. Checked against the running
12390
+ * MapLibre at install time so a version skew is reported rather than silently shipped. */var MAPLIBRE_WORKER_VERSION="6.9.0";/** Self-contained MapLibre worker, carried as a string so it can be handed to MapLibre
12391
+ * as a blob: URL instead of being resolved from disk.
12392
+ *
12393
+ * The `: string` annotation is load-bearing. Without it TypeScript infers a string *literal*
12394
+ * type and writes the entire worker into the emitted .d.ts, shipping a half-megabyte
12395
+ * declaration file that every consumer's editor then has to parse. */var MAPLIBRE_WORKER_SOURCE="/**\n* MapLibre GL JS\n* @license 3-Clause BSD. Full text of license: https://github.com/maplibre/maplibre-gl-js/blob/v6.9.0/LICENSE.txt\n*/var c1=Object.create,pp=Object.defineProperty,p1=Object.getOwnPropertyDescriptor,f1=Object.getOwnPropertyNames,d1=Object.getPrototypeOf,fp=Object.prototype.hasOwnProperty,hl=(t,e)=>()=>(e||(t((e={exports:{}}).exports,e),t=null),e.exports),y1=(t,e,r,i)=>{if(e&&typeof e==\"object\"||typeof e==\"function\")for(var n=f1(e),a=0,s=n.length,o;a<s;a++)o=n[a],!fp.call(t,o)&&o!==r&&pp(t,o,{get:(l=>e[l]).bind(null,o),enumerable:!(i=p1(e,o))||i.enumerable});return t},m1=(t,e,r)=>(r=t==null?{}:c1(d1(t)),y1(e||!t||!t.__esModule||!fp.call(t,\"default\")?pp(r,\"default\",{value:t,enumerable:!0}):r,t));function B(t,e){this.x=t,this.y=e}B.prototype={clone(){return new B(this.x,this.y)},add(t){return this.clone()._add(t)},sub(t){return this.clone()._sub(t)},multByPoint(t){return this.clone()._multByPoint(t)},divByPoint(t){return this.clone()._divByPoint(t)},mult(t){return this.clone()._mult(t)},div(t){return this.clone()._div(t)},rotate(t){return this.clone()._rotate(t)},rotateAround(t,e){return this.clone()._rotateAround(t,e)},matMult(t){return this.clone()._matMult(t)},unit(){return this.clone()._unit()},perp(){return this.clone()._perp()},round(){return this.clone()._round()},mag(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals(t){return this.x===t.x&&this.y===t.y},dist(t){return Math.sqrt(this.distSqr(t))},distSqr(t){let e=t.x-this.x,r=t.y-this.y;return e*e+r*r},angle(){return Math.atan2(this.y,this.x)},angleTo(t){return Math.atan2(this.y-t.y,this.x-t.x)},angleWith(t){return this.angleWithSep(t.x,t.y)},angleWithSep(t,e){return Math.atan2(this.x*e-this.y*t,this.x*t+this.y*e)},_matMult(t){let e=t[0]*this.x+t[1]*this.y,r=t[2]*this.x+t[3]*this.y;return this.x=e,this.y=r,this},_add(t){return this.x+=t.x,this.y+=t.y,this},_sub(t){return this.x-=t.x,this.y-=t.y,this},_mult(t){return this.x*=t,this.y*=t,this},_div(t){return this.x/=t,this.y/=t,this},_multByPoint(t){return this.x*=t.x,this.y*=t.y,this},_divByPoint(t){return this.x/=t.x,this.y/=t.y,this},_unit(){return this._div(this.mag()),this},_perp(){let t=this.y;return this.y=this.x,this.x=-t,this},_rotate(t){let e=Math.cos(t),r=Math.sin(t),i=e*this.x-r*this.y,n=r*this.x+e*this.y;return this.x=i,this.y=n,this},_rotateAround(t,e){let r=Math.cos(t),i=Math.sin(t),n=e.x+r*(this.x-e.x)-i*(this.y-e.y),a=e.y+i*(this.x-e.x)+r*(this.y-e.y);return this.x=n,this.y=a,this},_round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},constructor:B},B.convert=function(t){if(t instanceof B)return t;if(Array.isArray(t))return new B(+t[0],+t[1]);if(t.x!==void 0&&t.y!==void 0)return new B(+t.x,+t.y);throw Error(\"Expected [x, y] or {x, y} point format\")};function g1(t,e,r,i){let n=3*t,a=3*(r-t)-n,s=1-n-a,o=3*e,l=3*(i-e)-o,u=1-o-l;return function(h,c=1e-6){if(h<=0)return 0;if(h>=1)return 1;let p=h;for(let y=0;y<8;y++){let m=((s*p+a)*p+n)*p-h;if(Math.abs(m)<c)return((u*p+l)*p+o)*p;let g=(3*s*p+2*a)*p+n;if(Math.abs(g)<1e-6)break;p-=m/g}let f=0,d=1;p=h;for(let y=0;y<20;y++){let m=((s*p+a)*p+n)*p;if(Math.abs(m-h)<c)break;h>m?f=p:d=p,p=(f+d)*.5}return((u*p+l)*p+o)*p}}var Ds;function x1(){return Ds??(Ds=typeof OffscreenCanvas<\"u\"&&!!new OffscreenCanvas(1,1).getContext(\"2d\")&&typeof createImageBitmap==\"function\"),Ds}var On;function v1(){if(On==null&&(On=!1,x1())){let t=new OffscreenCanvas(5,5).getContext(\"2d\",{willReadFrequently:!0});if(t){for(let r=0;r<25;r++){let i=r*4;t.fillStyle=`rgb(${i},${i+1},${i+2})`,t.fillRect(r%5,Math.floor(r/5),1,1)}let e=t.getImageData(0,0,5,5).data;for(let r=0;r<100;r++)if(r%4!=3&&e[r]!==r){On=!0;break}}}return On||!1}var he=typeof Float32Array<\"u\"?Float32Array:Array;Math.PI/180,180/Math.PI;function b1(){var t=new he(9);return he!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[5]=0,t[6]=0,t[7]=0),t[0]=1,t[4]=1,t[8]=1,t}function dp(){var t=new he(3);return he!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function w1(t){var e=t[0],r=t[1],i=t[2];return Math.sqrt(e*e+r*r+i*i)}function eh(t,e,r){var i=new he(3);return i[0]=t,i[1]=e,i[2]=r,i}function D1(t,e){var r=e[0],i=e[1],n=e[2],a=r*r+i*i+n*n;return a>0&&(a=1/Math.sqrt(a)),t[0]=e[0]*a,t[1]=e[1]*a,t[2]=e[2]*a,t}function _1(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function _s(t,e,r){var i=e[0],n=e[1],a=e[2],s=r[0],o=r[1],l=r[2];return t[0]=n*l-a*o,t[1]=a*s-i*l,t[2]=i*o-n*s,t}var A1=w1;(function(){var t=dp();return function(e,r,i,n,a,s){var o,l;for(r||(r=3),i||(i=0),l=n?Math.min(n*r+i,e.length):e.length,o=i;o<l;o+=r)t[0]=e[o],t[1]=e[o+1],t[2]=e[o+2],a(t,t,s),e[o]=t[0],e[o+1]=t[1],e[o+2]=t[2];return e}})();function S1(){var t=new he(4);return he!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0),t}function E1(t,e){var r=e[0],i=e[1],n=e[2],a=e[3],s=r*r+i*i+n*n+a*a;return s>0&&(s=1/Math.sqrt(s)),t[0]=r*s,t[1]=i*s,t[2]=n*s,t[3]=a*s,t}function F1(t,e,r){var i=e[0],n=e[1],a=e[2],s=e[3];return t[0]=r[0]*i+r[4]*n+r[8]*a+r[12]*s,t[1]=r[1]*i+r[5]*n+r[9]*a+r[13]*s,t[2]=r[2]*i+r[6]*n+r[10]*a+r[14]*s,t[3]=r[3]*i+r[7]*n+r[11]*a+r[15]*s,t}(function(){var t=S1();return function(e,r,i,n,a,s){var o,l;for(r||(r=4),i||(i=0),l=n?Math.min(n*r+i,e.length):e.length,o=i;o<l;o+=r)t[0]=e[o],t[1]=e[o+1],t[2]=e[o+2],t[3]=e[o+3],a(t,t,s),e[o]=t[0],e[o+1]=t[1],e[o+2]=t[2],e[o+3]=t[3];return e}})();function rh(){var t=new he(4);return he!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}function T1(t,e,r){r*=.5;var i=Math.sin(r);return t[0]=i*e[0],t[1]=i*e[1],t[2]=i*e[2],t[3]=Math.cos(r),t}function As(t,e,r,i){var n=e[0],a=e[1],s=e[2],o=e[3],l=r[0],u=r[1],h=r[2],c=r[3],p,f=n*l+a*u+s*h+o*c,d,y,m;return f<0&&(f=-f,l=-l,u=-u,h=-h,c=-c),1-f>1e-6?(p=Math.acos(f),d=Math.sin(p),y=Math.sin((1-i)*p)/d,m=Math.sin(i*p)/d):(y=1-i,m=i),t[0]=y*n+m*l,t[1]=y*a+m*u,t[2]=y*s+m*h,t[3]=y*o+m*c,t}function k1(t,e){var r=e[0]+e[4]+e[8],i;if(r>0)i=Math.sqrt(r+1),t[3]=.5*i,i=.5/i,t[0]=(e[5]-e[7])*i,t[1]=(e[6]-e[2])*i,t[2]=(e[1]-e[3])*i;else{var n=0;e[4]>e[0]&&(n=1),e[8]>e[n*3+n]&&(n=2);var a=(n+1)%3,s=(n+2)%3;i=Math.sqrt(e[n*3+n]-e[a*3+a]-e[s*3+s]+1),t[n]=.5*i,i=.5/i,t[3]=(e[a*3+s]-e[s*3+a])*i,t[a]=(e[a*3+n]+e[n*3+a])*i,t[s]=(e[s*3+n]+e[n*3+s])*i}return t}var ih=E1;(function(){var t=dp(),e=eh(1,0,0),r=eh(0,1,0);return function(i,n,a){var s=_1(n,a);return s<-.999999?(_s(t,e,n),A1(t)<1e-6&&_s(t,r,n),D1(t,t),T1(i,t,Math.PI),i):s>.999999?(i[0]=0,i[1]=0,i[2]=0,i[3]=1,i):(_s(t,n,a),i[0]=t[0],i[1]=t[1],i[2]=t[2],i[3]=1+s,ih(i,i))}})(),(function(){var t=rh(),e=rh();return function(r,i,n,a,s,o){return As(t,i,s,o),As(e,n,a,o),As(r,t,e,2*o*(1-o)),r}})(),(function(){var t=b1();return function(e,r,i,n){return t[0]=i[0],t[3]=i[1],t[6]=i[2],t[1]=n[0],t[4]=n[1],t[7]=n[2],t[2]=-r[0],t[5]=-r[1],t[8]=-r[2],ih(e,k1(e,t))}})();function I1(){var t=new he(2);return he!=Float32Array&&(t[0]=0,t[1]=0),t}(function(){var t=I1();return function(e,r,i,n,a,s){var o,l;for(r||(r=2),i||(i=0),l=n?Math.min(n*r+i,e.length):e.length,o=i;o<l;o+=r)t[0]=e[o],t[1]=e[o+1],a(t,t,s),e[o]=t[0],e[o+1]=t[1];return e}})();var mt=8192;var yp=\"__$json__:\";function Wi(t){return t instanceof Error?t:Error(typeof t==\"string\"?t:String(t))}function C1(t){if(t<=0)return 0;if(t>=1)return 1;let e=t*t,r=e*t;return 4*(t<.5?r:3*(t-e)+r-.75)}function M1(t,e,r,i){return g1(t,e,r,i)}var i5=M1(.25,.1,.25,1);function Zi(t,e,r){return Math.min(r,Math.max(e,t))}function B1(t,e,r){let i=r-e,n=((t-e)%i+i)%i+e;return n===e?r:n}function qt(t,...e){for(let r of e)for(let i in r)t[i]=r[i];return t}function P1(t){return Math.log(t)/Math.LN2%1==0}function Aa(t,e,r){let i={};for(let n in t)i[n]=e.call(r||this,t[n],n,t);return i}function z1(t,e,r){let i={};for(let n in t)e.call(r||this,t[n],n,t)&&(i[n]=t[n]);return i}function Xe(t){return Array.isArray(t)?t.map(Xe):typeof t==\"object\"&&t?Aa(t,Xe):t}var nh={};function Mt(t){nh[t]||(typeof console<\"u\"&&console.warn(t),nh[t]=!0)}function We(t,e,r){return(r.y-t.y)*(e.x-t.x)>(e.y-t.y)*(r.x-t.x)}function dr(t){return typeof WorkerGlobalScope<\"u\"&&t!==void 0&&t instanceof WorkerGlobalScope}function Sa(t){return typeof ImageBitmap<\"u\"&&t instanceof ImageBitmap}function L1(t,e,r,i,n){let a=Math.max(-e,0)*4,s=(Math.max(0,r)-r)*i*4+a,o=i*4,l=Math.max(0,e),u=Math.max(0,r),h=Math.min(t.width,e+i),c=Math.min(t.height,r+n);return{rect:{x:l,y:u,width:h-l,height:c-u},layout:[{offset:s,stride:o}]}}async function V1(t,e,r,i,n){if(typeof VideoFrame>\"u\")throw Error(\"VideoFrame not supported\");let a=new VideoFrame(t,{timestamp:0});try{let s=a?.format;if(!s||!(s.startsWith(\"BGR\")||s.startsWith(\"RGB\")))throw Error(`Unrecognized format ${s}`);let o=s.startsWith(\"BGR\"),l=new Uint8ClampedArray(i*n*4);if(await a.copyTo(l,L1(t,e,r,i,n)),o)for(let u=0;u<l.length;u+=4){let h=l[u];l[u]=l[u+2],l[u+2]=h}return l}finally{a.close()}}var _i,Ai;function O1(t,e,r,i,n){let a=t.width,s=t.height;(!_i||!Ai)&&(_i=new OffscreenCanvas(a,s),Ai=_i.getContext(\"2d\",{willReadFrequently:!0})),_i.width=a,_i.height=s,Ai.drawImage(t,0,0,a,s);let o=Ai.getImageData(e,r,i,n);return Ai.clearRect(0,0,a,s),o.data}async function mp(t,e,r,i,n){if(v1())try{return await V1(t,e,r,i,n)}catch{}return O1(t,e,r,i,n)}function ah(t,e,r,i){return t.addEventListener(e,r,i),{unsubscribe:()=>{t.removeEventListener(e,r,i)}}}function sh(t){return t*Math.PI/180}var oh=\"AbortError\",cl=class extends Error{constructor(t=oh){super(t instanceof Error?t.message:t),this.name=oh,t instanceof Error&&t.stack&&(this.stack=t.stack)}};function pl(t){return t instanceof Error&&t.name===\"AbortError\"}function R1(t){if(t.aborted)throw new cl(t.reason)}var fl={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:\"\"};function $1(t){return fl.REGISTERED_PROTOCOLS[t.substring(0,t.indexOf(\"://\"))]}function gp(t,e){fl.REGISTERED_PROTOCOLS[t]=e}function xp(t){delete fl.REGISTERED_PROTOCOLS[t]}var lh=\"global-dispatcher\",ua=class extends Error{constructor(t,e,r,i){super(`AJAXError: ${e} (${t}): ${r}`),this.status=t,this.statusText=e,this.url=r,this.body=i}};function vp(){if(dr(self))return self.worker?.referrer;if(window.location.protocol===\"blob:\")try{return window.parent.location.href}catch{}return window.location.href}var N1=t=>t.startsWith(\"file:\")||vp()?.startsWith(\"file:\")&&!/^\\w+:/.test(t);async function U1(t,e){let r=new Request(t.url,{method:t.method||\"GET\",body:t.body,credentials:t.credentials,headers:t.headers,cache:t.cache,referrer:vp(),referrerPolicy:t.referrerPolicy,signal:e.signal});t.type===\"json\"&&!r.headers.has(\"Accept\")&&r.headers.set(\"Accept\",\"application/json\");let i;try{i=await fetch(r)}catch(s){throw pl(s)?s:new ua(0,Wi(s).message,t.url,new Blob)}if(!i.ok){let s=await i.blob();throw new ua(i.status,i.statusText,t.url,s)}let n;n=t.type===\"arrayBuffer\"||t.type===\"image\"?i.arrayBuffer():t.type===\"json\"?i.json():i.text();let a=await n;return R1(e.signal),{data:a,cacheControl:i.headers.get(\"Cache-Control\"),expires:i.headers.get(\"Expires\"),etag:i.headers.get(\"ETag\")}}function q1(t,e){return new Promise((r,i)=>{let n=new XMLHttpRequest;n.open(t.method||\"GET\",t.url,!0),(t.type===\"arrayBuffer\"||t.type===\"image\")&&(n.responseType=\"arraybuffer\");for(let a in t.headers)n.setRequestHeader(a,t.headers[a]);t.type===\"json\"&&(n.responseType=\"text\",t.headers?.Accept||n.setRequestHeader(\"Accept\",\"application/json\")),n.withCredentials=t.credentials===\"include\",n.onerror=()=>{i(Error(n.statusText))},n.onload=()=>{if(!e.signal.aborted)if((n.status>=200&&n.status<300||n.status===0)&&n.response!==null){let a=n.response;if(t.type===\"json\")try{a=JSON.parse(n.response)}catch(s){i(s);return}r({data:a,cacheControl:n.getResponseHeader(\"Cache-Control\"),expires:n.getResponseHeader(\"Expires\"),etag:n.getResponseHeader(\"ETag\")})}else{let a=new Blob([n.response],{type:n.getResponseHeader(\"Content-Type\")});i(new ua(n.status,n.statusText,t.url,a))}},e.signal.addEventListener(\"abort\",()=>{n.abort(),i(new cl(e.signal.reason))}),n.send(t.body)})}var Ea=async function(t,e){if(t.url.includes(\"://\")&&!/^https?:|^file:/.test(t.url)){let r=$1(t.url);if(r){let i=await r(t,e);return!i.data&&t.type===\"arrayBuffer\"?qt(i,{data:new ArrayBuffer(0)}):i}if(dr(self)&&self.worker?.actor)return self.worker.actor.sendAsync({type:\"GR\",data:t,targetMapId:lh},e)}if(!N1(t.url)){if(fetch&&Request&&AbortController&&Object.hasOwn(Request.prototype,\"signal\"))return U1(t,e);if(dr(self)&&self.worker?.actor)return self.worker.actor.sendAsync({type:\"GR\",data:t,mustQueue:!0,targetMapId:lh},e)}return q1(t,e)},bp=(t,e)=>Ea(qt(t,{type:\"json\"}),e),wp=(t,e)=>Ea(qt(t,{type:\"arrayBuffer\"}),e);function uh(t,e,r){r[t]?.includes(e)||(r[t]||(r[t]=[]),r[t].push(e))}function Ss(t,e,r){if(r?.[t]){let i=r[t].indexOf(e);i!==-1&&r[t].splice(i,1)}}var Dp=class{constructor(t,e={}){qt(this,e),this.type=t}},ha=class extends Dp{constructor(t,e={}){super(\"error\",qt({error:t},e))}},j1=class{on(t,e){return this._listeners||(this._listeners={}),uh(t,e,this._listeners),{unsubscribe:()=>{this.off(t,e)}}}off(t,e){return Ss(t,e,this._listeners),Ss(t,e,this._oneTimeListeners),this}once(t,e){return e?(this._oneTimeListeners||(this._oneTimeListeners={}),uh(t,e,this._oneTimeListeners),this):new Promise(r=>this.once(t,r))}fire(t,e){let r=typeof t==\"string\"?new Dp(t,e||{}):t,i=r.type;if(this.listens(i)){r.target=this;let n=this._listeners?.[i]?.slice()??[];for(let o of n)o.call(this,r);let a=this._oneTimeListeners?.[i]?.slice()??[];for(let o of a)Ss(i,o,this._oneTimeListeners),o.call(this,r);let s=this._eventedParent;s&&(qt(r,typeof this._eventedParentData==\"function\"?this._eventedParentData():this._eventedParentData),s.fire(r))}else r instanceof ha&&console.error(r.error);return this}listens(t){return!!(this._listeners?.[t]?.length||this._oneTimeListeners?.[t]?.length||this._eventedParent?.listens(t))}setEventedParent(t,e){return this._eventedParent=t,this._eventedParentData=e,this}},_p={$version:8,$root:{version:{required:!0,type:\"enum\",values:[8]},name:{type:\"string\"},metadata:{type:\"*\"},center:{type:\"array\",value:\"number\",length:2},centerAltitude:{type:\"number\"},zoom:{type:\"number\"},bearing:{type:\"number\",default:0,period:360,units:\"degrees\"},pitch:{type:\"number\",default:0,units:\"degrees\"},roll:{type:\"number\",default:0,units:\"degrees\"},state:{type:\"state\",default:{}},light:{type:\"light\"},sky:{type:\"sky\"},projection:{type:\"projection\"},terrain:{type:\"terrain\"},sources:{required:!0,type:\"sources\"},sprite:{type:\"sprite\"},glyphs:{type:\"string\"},\"font-faces\":{type:\"fontFaces\"},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},encoding:{type:\"enum\",values:{mvt:{},mlt:{}},default:\"mvt\"},\"*\":{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:\"filter\"},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:{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:{},\"color-relief\":{},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_color-relief\",\"layout_background\"],layout_background:{visibility:{type:\"enum\",values:{visible:{},none:{}},default:\"visible\",expression:{interpolated:!1,parameters:[\"global-state\"]},\"property-type\":\"data-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\",expression:{interpolated:!1,parameters:[\"global-state\"]},\"property-type\":\"data-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\",expression:{interpolated:!1,parameters:[\"global-state\"]},\"property-type\":\"data-constant\"}},layout_heatmap:{visibility:{type:\"enum\",values:{visible:{},none:{}},default:\"visible\",expression:{interpolated:!1,parameters:[\"global-state\"]},\"property-type\":\"data-constant\"}},\"layout_fill-extrusion\":{visibility:{type:\"enum\",values:{visible:{},none:{}},default:\"visible\",expression:{interpolated:!1,parameters:[\"global-state\"]},\"property-type\":\"data-constant\"},\"fill-extrusion-rounded-corner-distance\":{type:\"number\",default:0,minimum:0,units:\"meters\",\"property-type\":\"constant\"}},layout_line:{\"line-cap\":{type:\"enum\",values:{butt:{},round:{},square:{}},default:\"butt\",expression:{interpolated:!1,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"line-join\":{type:\"enum\",values:{bevel:{},round:{},miter:{}},default:\"miter\",expression:{interpolated:!1,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"line-miter-limit\":{type:\"number\",default:2,requires:[{\"line-join\":\"miter\"}],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"line-round-limit\":{type:\"number\",default:1.05,requires:[{\"line-join\":\"round\"}],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"line-sort-key\":{type:\"number\",expression:{interpolated:!1,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},visibility:{type:\"enum\",values:{visible:{},none:{}},default:\"visible\",expression:{interpolated:!1,parameters:[\"global-state\"]},\"property-type\":\"data-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\",\"feature\"]},\"property-type\":\"data-driven\"},\"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\"},\"symbol-height-offset\":{type:\"number\",default:0,units:\"meters\",requires:[{\"symbol-placement\":[\"point\"]}],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"symbol-height-anchor\":{type:\"enum\",values:{ground:{},absolute:{}},default:\"ground\",requires:[\"symbol-height-offset\"],expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},visibility:{type:\"enum\",values:{visible:{},none:{}},default:\"visible\",expression:{interpolated:!1,parameters:[\"global-state\"]},\"property-type\":\"data-constant\"}},layout_raster:{visibility:{type:\"enum\",values:{visible:{},none:{}},default:\"visible\",expression:{interpolated:!1,parameters:[\"global-state\"]},\"property-type\":\"data-constant\"}},layout_hillshade:{visibility:{type:\"enum\",values:{visible:{},none:{}},default:\"visible\",expression:{interpolated:!1,parameters:[\"global-state\"]},\"property-type\":\"data-constant\"}},\"layout_color-relief\":{visibility:{type:\"enum\",values:{visible:{},none:{}},default:\"visible\",expression:{interpolated:!1,parameters:[\"global-state\"]},\"property-type\":\"data-constant\"}},filter:{type:\"boolean\",expression:{interpolated:!1,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},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:\"expression_name\",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:\"projectionDefinition\",default:\"mercator\",\"property-type\":\"data-constant\",transition:!1,expression:{interpolated:!0,parameters:[\"zoom\"]}}},paint:[\"paint_fill\",\"paint_line\",\"paint_circle\",\"paint_heatmap\",\"paint_fill-extrusion\",\"paint_symbol\",\"paint_raster\",\"paint_hillshade\",\"paint_color-relief\",\"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-layer-opacity\":{type:\"number\",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:[\"zoom\",\"global-state\"]},\"property-type\":\"data-constant\"},\"fill-color\":{type:\"color\",default:\"#000000\",transition:!0,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,units:\"meters\",transition:!0,expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"fill-extrusion-base\":{type:\"number\",default: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-layer-opacity\":{type:\"number\",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:[\"zoom\",\"global-state\"]},\"property-type\":\"data-constant\"},\"line-color\":{type:\"color\",default:\"#000000\",transition:!0,requires:[{\"!\":\"line-pattern\"}],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"line-translate\":{type:\"array\",value:\"number\",length:2,default:[0,0],transition:!0,units:\"pixels\",expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"line-translate-anchor\":{type:\"enum\",values:{map:{},viewport:{}},default:\"map\",requires:[\"line-translate\"],expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"line-width\":{type:\"number\",default:1,minimum:0,transition:!0,units:\"pixels\",expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"line-gap-width\":{type:\"number\",default:0,minimum:0,transition:!0,units:\"pixels\",expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"line-offset\":{type:\"number\",default:0,transition:!0,units:\"pixels\",expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"line-blur\":{type:\"number\",default:0,minimum:0,transition:!0,units:\"pixels\",expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"line-dasharray\":{type:\"array\",value:\"number\",minimum:0,transition:!0,units:\"line widths\",requires:[{\"!\":\"line-pattern\"}],expression:{interpolated:!1,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"cross-faded-data-driven\"},\"line-pattern\":{type:\"resolvedImage\",transition:!0,expression:{interpolated:!1,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"cross-faded-data-driven\"},\"line-gradient\":{type:\"color\",transition:!1,requires:[{\"!\":\"line-dasharray\"},{\"!\":\"line-pattern\"},{source:\"geojson\",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:[\"line-progress\"]},\"property-type\":\"color-ramp\"}},paint_circle:{\"circle-radius\":{type:\"number\",default:5,minimum:0,transition:!0,units:\"pixels\",expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"circle-color\":{type:\"color\",default:\"#000000\",transition:!0,expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"circle-blur\":{type:\"number\",default:0,transition:!0,expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"circle-opacity\":{type:\"number\",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"circle-translate\":{type:\"array\",value:\"number\",length:2,default:[0,0],transition:!0,units:\"pixels\",expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"circle-translate-anchor\":{type:\"enum\",values:{map:{},viewport:{}},default:\"map\",requires:[\"circle-translate\"],expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"circle-pitch-scale\":{type:\"enum\",values:{map:{},viewport:{}},default:\"map\",expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"circle-pitch-alignment\":{type:\"enum\",values:{map:{},viewport:{}},default:\"viewport\",expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"circle-stroke-width\":{type:\"number\",default:0,minimum:0,transition:!0,units:\"pixels\",expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"circle-stroke-color\":{type:\"color\",default:\"#000000\",transition:!0,expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"circle-stroke-opacity\":{type:\"number\",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"}},paint_heatmap:{\"heatmap-radius\":{type:\"number\",default:30,minimum:1,transition:!0,units:\"pixels\",expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"heatmap-weight\":{type:\"number\",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"heatmap-intensity\":{type:\"number\",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"heatmap-color\":{type:\"color\",default:[\"interpolate\",[\"linear\"],[\"heatmap-density\"],0,\"rgba(0, 0, 255, 0)\",.1,\"royalblue\",.3,\"cyan\",.5,\"lime\",.7,\"yellow\",1,\"red\"],transition:!1,expression:{interpolated:!0,parameters:[\"heatmap-density\"]},\"property-type\":\"color-ramp\"},\"heatmap-opacity\":{type:\"number\",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"}},paint_symbol:{\"icon-opacity\":{type:\"number\",default:1,minimum:0,maximum:1,transition:!0,requires:[\"icon-image\"],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"icon-color\":{type:\"color\",default:\"#000000\",transition:!0,requires:[\"icon-image\"],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"icon-halo-color\":{type:\"color\",default:\"rgba(0, 0, 0, 0)\",transition:!0,requires:[\"icon-image\"],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"icon-halo-width\":{type:\"number\",default:0,minimum:0,transition:!0,units:\"pixels\",requires:[\"icon-image\"],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"icon-halo-blur\":{type:\"number\",default:0,minimum:0,transition:!0,units:\"pixels\",requires:[\"icon-image\"],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"icon-translate\":{type:\"array\",value:\"number\",length:2,default:[0,0],transition:!0,units:\"pixels\",requires:[\"icon-image\"],expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"icon-translate-anchor\":{type:\"enum\",values:{map:{},viewport:{}},default:\"map\",requires:[\"icon-image\",\"icon-translate\"],expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"text-opacity\":{type:\"number\",default:1,minimum:0,maximum:1,transition:!0,requires:[\"text-field\"],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"text-color\":{type:\"color\",default:\"#000000\",transition:!0,overridable:!0,requires:[\"text-field\"],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"text-halo-color\":{type:\"color\",default:\"rgba(0, 0, 0, 0)\",transition:!0,requires:[\"text-field\"],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"text-halo-width\":{type:\"number\",default:0,minimum:0,transition:!0,units:\"pixels\",requires:[\"text-field\"],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"text-halo-blur\":{type:\"number\",default:0,minimum:0,transition:!0,units:\"pixels\",requires:[\"text-field\"],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"text-translate\":{type:\"array\",value:\"number\",length:2,default:[0,0],transition:!0,units:\"pixels\",requires:[\"text-field\"],expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"text-translate-anchor\":{type:\"enum\",values:{map:{},viewport:{}},default:\"map\",requires:[\"text-field\",\"text-translate\"],expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"}},paint_raster:{\"raster-opacity\":{type:\"number\",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"raster-hue-rotate\":{type:\"number\",default:0,period:360,transition:!0,units:\"degrees\",expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"raster-brightness-min\":{type:\"number\",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"raster-brightness-max\":{type:\"number\",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"raster-saturation\":{type:\"number\",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"raster-contrast\":{type:\"number\",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},resampling:{type:\"enum\",values:{linear:{},nearest:{}},default:\"linear\",expression:{interpolated:!1,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:\"numberArray\",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"hillshade-illumination-altitude\":{type:\"numberArray\",default:45,minimum:0,maximum:90,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:\"colorArray\",default:\"#000000\",transition:!0,expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"hillshade-highlight-color\":{type:\"colorArray\",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\"},\"hillshade-method\":{type:\"enum\",values:{standard:{},basic:{},combined:{},igor:{},multidirectional:{}},default:\"standard\",expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},resampling:{type:\"enum\",values:{linear:{},nearest:{}},default:\"linear\",expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"}},\"paint_color-relief\":{\"color-relief-opacity\":{type:\"number\",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"color-relief-color\":{type:\"color\",transition:!1,expression:{interpolated:!0,parameters:[\"elevation\"]},\"property-type\":\"color-ramp\"},resampling:{type:\"enum\",values:{linear:{},nearest:{}},default:\"linear\",expression:{interpolated:!1,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\"}},interpolation:{type:\"array\",value:\"interpolation_name\",minimum:1},interpolation_name:{type:\"enum\",values:{linear:{syntax:{overloads:[{parameters:[],\"output-type\":\"interpolation\"}],parameters:[]}},exponential:{syntax:{overloads:[{parameters:[\"base\"],\"output-type\":\"interpolation\"}],parameters:[{name:\"base\",type:\"number literal\"}]}},\"cubic-bezier\":{syntax:{overloads:[{parameters:[\"x1\",\"y1\",\"x2\",\"y2\"],\"output-type\":\"interpolation\"}],parameters:[{name:\"x1\",type:\"number literal\"},{name:\"y1\",type:\"number literal\"},{name:\"x2\",type:\"number literal\"},{name:\"y2\",type:\"number literal\"}]}}}}},D=_p,Ap=[\"type\",\"source\",\"source-layer\",\"minzoom\",\"maxzoom\",\"filter\",\"layout\"],T=class{constructor(t,e,r,i,n=\"error\"){this.message=(t?`${t}: `:\"\")+r,i&&(this.identifier=i),this.severity=n,e!=null&&e.__line__&&(this.line=e.__line__)}},cn={kind:\"null\"},k={kind:\"number\"},X={kind:\"string\"},tt={kind:\"boolean\"},ue={kind:\"color\"},Fa={kind:\"projectionDefinition\"},cr={kind:\"object\"},H={kind:\"value\"},G1={kind:\"error\"},Ta={kind:\"collator\"},pn={kind:\"formatted\"},ka={kind:\"padding\"},Hi={kind:\"colorArray\"},Ia={kind:\"numberArray\"},fn={kind:\"resolvedImage\"},Ca={kind:\"variableAnchorOffsetCollection\"};function Nt(t,e){return{kind:\"array\",itemType:t,N:e}}function yt(t){if(t.kind===\"array\"){let e=yt(t.itemType);return typeof t.N==\"number\"?`array<${e}, ${t.N}>`:t.itemType.kind===\"value\"?\"array\":`array<${e}>`}return t.kind}var Y1=[cn,k,X,tt,ue,Fa,pn,cr,Nt(H),ka,Ia,Hi,fn,Ca];function Ki(t,e){if(e.kind===\"error\")return null;if(t.kind===\"array\"){if(e.kind===\"array\"&&(e.N===0&&e.itemType.kind===\"value\"||!Ki(t.itemType,e.itemType))&&(typeof t.N!=\"number\"||t.N===e.N))return null}else{if(t.kind===e.kind)return null;if(t.kind===\"value\"){for(let r of Y1)if(!Ki(r,e))return null}}return`Expected ${yt(t)} but found ${yt(e)} instead.`}function dl(t,e){return e.some(r=>r.kind===t.kind)}function pr(t,e){return e.some(r=>r===\"null\"?t===null:r===\"array\"?Array.isArray(t):r===\"object\"?t&&!Array.isArray(t)&&typeof t==\"object\":r===typeof t)}function Ue(t,e){return t.kind===\"array\"&&e.kind===\"array\"?t.itemType.kind===e.itemType.kind&&typeof t.N==\"number\":t.kind===e.kind}var Sp=.96422,Ep=.82521,Fp=4/29,Ws=6/29,Tp=3*Ws*Ws,X1=Math.PI/180,W1=180/Math.PI;function kp(t){return t%=360,t<0&&(t+=360),t}function Ip([t,e,r,i]){t=Es(t),e=Es(e),r=Es(r);let n,a,s=Fs((.2225045*t+.7168786*e+.0606169*r)/1);t===e&&e===r?n=a=s:(n=Fs((.4360747*t+.3850649*e+.1430804*r)/Sp),a=Fs((.0139322*t+.0971045*e+.7141733*r)/Ep));let o=116*s-16;return[o<0?0:o,500*(n-s),200*(s-a),i]}function Es(t){return t<=.04045?t/12.92:((t+.055)/1.055)**2.4}function Fs(t){return t>.008856451679035631?t**(1/3):t/Tp+Fp}function Cp([t,e,r,i]){let n=(t+16)/116,a=isNaN(e)?n:n+e/500,s=isNaN(r)?n:n-r/200;return n=1*ks(n),a=Sp*ks(a),s=Ep*ks(s),[Ts(3.1338561*a-1.6168667*n-.4906146*s),Ts(-.9787684*a+1.9161415*n+.033454*s),Ts(.0719453*a-.2289914*n+1.4052427*s),i]}function Ts(t){return t=t<=.00304?12.92*t:1.055*t**(1/2.4)-.055,t<0?0:t>1?1:t}function ks(t){return t>Ws?t*t*t:Tp*(t-Fp)}function Z1(t){let[e,r,i,n]=Ip(t),a=Math.sqrt(r*r+i*i);return[Math.round(a*1e4)?kp(Math.atan2(i,r)*W1):NaN,a,e,n]}function H1([t,e,r,i]){return t=isNaN(t)?0:t*X1,Cp([r,Math.cos(t)*e,Math.sin(t)*e,i])}function K1([t,e,r,i]){t=kp(t),e/=100,r/=100;function n(a){let s=(a+t/30)%12,o=e*Math.min(r,1-r);return r-o*Math.max(-1,Math.min(s-3,9-s,1))}return[n(0),n(8),n(4),i]}var J1=Object.hasOwn||function(t,e){return Object.prototype.hasOwnProperty.call(t,e)};function Ni(t,e){return J1(t,e)?t[e]:void 0}function Q1(t){if(t=t.toLowerCase().trim(),t===\"transparent\")return[0,0,0,0];let e=Ni(t0,t);if(e){let[i,n,a]=e;return[i/255,n/255,a/255,1]}if(t.startsWith(\"#\")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(t)){let i=t.length<6?1:2,n=1;return[Rn(t.slice(n,n+=i)),Rn(t.slice(n,n+=i)),Rn(t.slice(n,n+=i)),Rn(t.slice(n,n+i)||\"ff\")]}if(t.startsWith(\"rgb\")){let i=t.match(/^rgba?\\(\\s*([\\de.+-]+)(%)?(?:\\s+|\\s*(,)\\s*)([\\de.+-]+)(%)?(?:\\s+|\\s*(,)\\s*)([\\de.+-]+)(%)?(?:\\s*([,\\/])\\s*([\\de.+-]+)(%)?)?\\s*\\)$/);if(i){let[n,a,s,o,l,u,h,c,p,f,d,y]=i,m=[o||\" \",h||\" \",f].join(\"\");if(m===\" \"||m===\" /\"||m===\",,\"||m===\",,,\"){let g=[s,u,p].join(\"\"),x=g===\"%%%\"?100:g===\"\"?255:0;if(x){let b=[Vr(+a/x,0,1),Vr(+l/x,0,1),Vr(+c/x,0,1),d?hh(+d,y):1];if(ch(b))return b}}return}}let r=t.match(/^hsla?\\(\\s*([\\de.+-]+)(?:deg)?(?:\\s+|\\s*(,)\\s*)([\\de.+-]+)%(?:\\s+|\\s*(,)\\s*)([\\de.+-]+)%(?:\\s*([,\\/])\\s*([\\de.+-]+)(%)?)?\\s*\\)$/);if(r){let[i,n,a,s,o,l,u,h,c]=r,p=[a||\" \",o||\" \",u].join(\"\");if(p===\" \"||p===\" /\"||p===\",,\"||p===\",,,\"){let f=[+n,Vr(+s,0,100),Vr(+l,0,100),h?hh(+h,c):1];if(ch(f))return K1(f)}}}function Rn(t){return parseInt(t.padEnd(2,t),16)/255}function hh(t,e){return Vr(e?t/100:t,0,1)}function Vr(t,e,r){return Math.min(Math.max(e,t),r)}function ch(t){return!t.some(Number.isNaN)}var t0={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]};function He(t,e,r){return t+r*(e-t)}function Jr(t,e,r){return t.map((i,n)=>He(i,e[n],r))}function e0(t){return t===\"rgb\"||t===\"hcl\"||t===\"lab\"}var Bt,gt=(Bt=class{constructor(e,r,i,n=1,a=!0){this.r=e,this.g=r,this.b=i,this.a=n,a||(this.r*=n,this.g*=n,this.b*=n,n||this.overwriteGetter(\"rgb\",[e,r,i,n]))}static parse(e){if(e instanceof Bt)return e;if(typeof e!=\"string\")return;let r=Q1(e);if(r)return new Bt(...r,!1)}get rgb(){let{r:e,g:r,b:i,a:n}=this,a=n||1/0;return this.overwriteGetter(\"rgb\",[e/a,r/a,i/a,n])}get hcl(){return this.overwriteGetter(\"hcl\",Z1(this.rgb))}get lab(){return this.overwriteGetter(\"lab\",Ip(this.rgb))}overwriteGetter(e,r){return Object.defineProperty(this,e,{value:r}),r}toString(){let[e,r,i,n]=this.rgb;return`rgba(${[e,r,i].map(a=>Math.round(a*255)).join(\",\")},${n})`}static interpolate(e,r,i,n=\"rgb\"){switch(n){case\"rgb\":{let[a,s,o,l]=Jr(e.rgb,r.rgb,i);return new Bt(a,s,o,l,!1)}case\"hcl\":{let[a,s,o,l]=e.hcl,[u,h,c,p]=r.hcl,f,d;if(!isNaN(a)&&!isNaN(u)){let b=u-a;u>a&&b>180?b-=360:u<a&&a-u>180&&(b+=360),f=a+i*b}else isNaN(a)?isNaN(u)?f=NaN:(f=u,(o===1||o===0)&&(d=h)):(f=a,(c===1||c===0)&&(d=s));let[y,m,g,x]=H1([f,d??He(s,h,i),He(o,c,i),He(l,p,i)]);return new Bt(y,m,g,x,!1)}case\"lab\":{let[a,s,o,l]=Cp(Jr(e.lab,r.lab,i));return new Bt(a,s,o,l,!1)}}}},Bt.black=new Bt(0,0,0,1),Bt.white=new Bt(1,1,1,1),Bt.transparent=new Bt(0,0,0,0),Bt.red=new Bt(1,0,0,1),Bt),r0=[\"bottom\",\"center\",\"top\"],Zs=class{constructor(t,e,r,i,n,a){this.text=t,this.image=e,this.scale=r,this.fontStack=i,this.textColor=n,this.verticalAlign=a}},Be=class ra{constructor(e){this.sections=e}static fromString(e){return new ra([new Zs(e,null,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some(e=>e.text.length!==0||e.image&&e.image.name.length!==0)}static factory(e){return e instanceof ra?e:ra.fromString(e)}toString(){return this.sections.length===0?\"\":this.sections.map(e=>e.text).join(\"\")}},Ae=class Bi{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Bi)return e;if(typeof e==\"number\")return new Bi([e,e,e,e]);if(Array.isArray(e)&&!(e.length<1||e.length>4)){for(let r of e)if(typeof r!=\"number\")return;switch(e.length){case 1:e=[e[0],e[0],e[0],e[0]];break;case 2:e=[e[0],e[1],e[0],e[1]];break;case 3:e=[e[0],e[1],e[2],e[1]]}return new Bi(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,r,i){return new Bi(Jr(e.values,r.values,i))}},Se=class Pi{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Pi)return e;if(typeof e==\"number\")return new Pi([e]);if(Array.isArray(e)){for(let r of e)if(typeof r!=\"number\")return;return new Pi(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,r,i){return new Pi(Jr(e.values,r.values,i))}},se=class zi{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof zi)return e;if(typeof e==\"string\"){let i=gt.parse(e);return i?new zi([i]):void 0}if(!Array.isArray(e))return;let r=[];for(let i of e){if(typeof i!=\"string\")return;let n=gt.parse(i);if(!n)return;r.push(n)}return new zi(r)}toString(){return JSON.stringify(this.values)}static interpolate(e,r,i,n=\"rgb\"){let a=[];if(e.values.length!=r.values.length)throw Error(`colorArray: Arrays have mismatched length (${e.values.length} vs. ${r.values.length}), cannot interpolate.`);for(let s=0;s<e.values.length;s++)a.push(gt.interpolate(e.values[s],r.values[s],i,n));return new zi(a)}},ct=class extends Error{constructor(t,e){super(t),this.name=\"RuntimeError\",this.path=e}toJSON(){return this.message}},i0=new Set([\"center\",\"left\",\"right\",\"top\",\"bottom\",\"top-left\",\"top-right\",\"bottom-left\",\"bottom-right\"]),De=class ia{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof ia)return e;if(!(!Array.isArray(e)||e.length<1||e.length%2!=0)){for(let r=0;r<e.length;r+=2){let i=e[r],n=e[r+1];if(typeof i!=\"string\"||!i0.has(i)||!Array.isArray(n)||n.length!==2||typeof n[0]!=\"number\"||typeof n[1]!=\"number\")return}return new ia(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,r,i,n){let a=e.values,s=r.values;if(a.length!==s.length)throw new ct(`Cannot interpolate values of different length. from: ${e.toString()}, to: ${r.toString()}`,n);let o=[];for(let l=0;l<a.length;l+=2){if(a[l]!==s[l])throw new ct(`Cannot interpolate values containing mismatched anchors. from[${l}]: ${a[l]}, to[${l}]: ${s[l]}`,n);o.push(a[l]);let[u,h]=a[l+1],[c,p]=s[l+1];o.push([He(u,c,i),He(h,p,i)])}return new ia(o)}},_e=class Mp{constructor(e){this.name=e.name,this.available=e.available}toString(){return this.name}static fromString(e){return e?new Mp({name:e,available:!1}):null}},br=class Or{constructor(e,r,i){this.from=e,this.to=r,this.transition=i}toString(){return this.from===this.to&&this.transition===1?this.from:JSON.stringify([this.from,this.to,this.transition])}static interpolate(e,r,i){return new Or(e,r,i)}static parse(e){if(e instanceof Or)return e;if(Array.isArray(e)&&e.length===3&&typeof e[0]==\"string\"&&typeof e[1]==\"string\"&&typeof e[2]==\"number\")return new Or(e[0],e[1],e[2]);if(typeof e==\"object\"&&typeof e.from==\"string\"&&typeof e.to==\"string\"&&typeof e.transition==\"number\")return new Or(e.from,e.to,e.transition);if(typeof e==\"string\")return new Or(e,e,1)}},yl=class{constructor(t,e,r){this.sensitivity=t?e?\"variant\":\"case\":e?\"accent\":\"base\",this.locale=r,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:\"search\"})}compare(t,e){return this.collator.compare(t,e)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}};function Bp(t,e,r,i){return typeof t==\"number\"&&t>=0&&t<=255&&typeof e==\"number\"&&e>=0&&e<=255&&typeof r==\"number\"&&r>=0&&r<=255?i===void 0||typeof i==\"number\"&&i>=0&&i<=1?null:`Invalid rgba value [${[t,e,r,i].join(\", \")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof i==\"number\"?[t,e,r,i]:[t,e,r]).join(\", \")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function Qr(t){if(t===null||typeof t==\"string\"||typeof t==\"boolean\"||typeof t==\"number\"||t instanceof br||t instanceof gt||t instanceof yl||t instanceof Be||t instanceof Ae||t instanceof Se||t instanceof se||t instanceof De||t instanceof _e)return!0;if(Array.isArray(t)){for(let e of t)if(!Qr(e))return!1;return!0}if(typeof t==\"object\"){for(let e in t)if(!Qr(t[e]))return!1;return!0}return!1}function At(t){if(t===null)return cn;if(typeof t==\"string\")return X;if(typeof t==\"boolean\")return tt;if(typeof t==\"number\")return k;if(t instanceof gt)return ue;if(t instanceof br)return Fa;if(t instanceof yl)return Ta;if(t instanceof Be)return pn;if(t instanceof Ae)return ka;if(t instanceof Se)return Ia;if(t instanceof se)return Hi;if(t instanceof De)return Ca;if(t instanceof _e)return fn;if(Array.isArray(t)){let e=t.length,r;for(let i of t){let n=At(i);if(!r)r=n;else{if(r===n)continue;r=H;break}}return Nt(r||H,e)}return cr}function Ui(t){let e=typeof t;return t===null?\"\":e===\"string\"||e===\"number\"||e===\"boolean\"?String(t):t instanceof gt||t instanceof br||t instanceof Be||t instanceof Ae||t instanceof Se||t instanceof se||t instanceof De||t instanceof _e?t.toString():JSON.stringify(t)}var ti=class Pp{constructor(e,r){this.type=e,this.value=r}static parse(e,r){if(e.length!==2)return r.error(`'literal' expression requires exactly one argument, but found ${e.length-1} instead.`);if(!Qr(e[1]))return r.error(`invalid value of type \"${typeof e[1]}\"`);let i=e[1],n=At(i),a=r.expectedType;return n.kind===\"array\"&&n.N===0&&a&&a.kind===\"array\"&&(typeof a.N!=\"number\"||a.N===0)&&(n=a),new Pp(n,i)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}},n0=[\"Unknown\",\"Point\",\"LineString\",\"Polygon\"],zp=class{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache=new Map,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\"?n0[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&\"geometry\"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}parseColor(t){let e=this._parseColorCache.get(t);return e||(e=gt.parse(t),this._parseColorCache.set(t,e)),e}};function Ma(t,e,r){let i=t.length-1,n=0,a=i,s=0,o,l;for(;n<=a;)if(s=Math.floor((n+a)/2),o=t[s],l=t[s+1],o<=e){if(s===i||e<l)return s;n=s+1}else if(o>e)a=s-1;else throw new ct(\"Input is not a number.\",r);return 0}var ml=class Lp{constructor(e,r,i,n){this.type=e,this.input=r,this.key=n,this.labels=[],this.outputs=[];for(let[a,s]of i)this.labels.push(a),this.outputs.push(s)}static parse(e,r){if(e.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return r.error(\"Expected an even number of arguments.\");let i=r.parse(e[1],1,k);if(!i)return null;let n=[],a=null;r.expectedType&&r.expectedType.kind!==\"value\"&&(a=r.expectedType);for(let s=1;s<e.length;s+=2){let o=s===1?-1/0:e[s],l=e[s+1],u=s,h=s+1;if(typeof o!=\"number\")return r.error('Input/output pairs for \"step\" expressions must be defined using literal numeric values (not computed expressions) for the input values.',u);if(n.length&&n[n.length-1][0]>=o)return r.error('Input/output pairs for \"step\" expressions must be arranged with input values in strictly ascending order.',u);let c=r.parse(l,h,a);if(!c)return null;a||(a=c.type),n.push([o,c])}return new Lp(a,i,n,r.key)}evaluate(e){let r=this.labels,i=this.outputs;if(r.length===1)return i[0].evaluate(e);let n=this.input.evaluate(e);if(n<=r[0])return i[0].evaluate(e);let a=r.length;return n>=r[a-1]?i[a-1].evaluate(e):i[Ma(r,n,this.key)].evaluate(e)}eachChild(e){e(this.input);for(let r of this.outputs)e(r)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}};function a0(t,e,r,i){let n=3*t,a=3*(r-t)-n,s=1-n-a,o=3*e,l=3*(i-e)-o,u=1-o-l;return function(h,c=1e-6){if(h<=0)return 0;if(h>=1)return 1;let p=h;for(let y=0;y<8;y++){let m=((s*p+a)*p+n)*p-h;if(Math.abs(m)<c)return((u*p+l)*p+o)*p;let g=(3*s*p+2*a)*p+n;if(Math.abs(g)<1e-6)break;p-=m/g}let f=0,d=1;p=h;for(let y=0;y<20;y++){let m=((s*p+a)*p+n)*p;if(Math.abs(m-h)<c)break;h>m?f=p:d=p,p=(f+d)*.5}return((u*p+l)*p+o)*p}}var be=class Hs{constructor(e,r,i,n,a,s){this.type=e,this.operator=r,this.interpolation=i,this.input=n,this.key=s,this.labels=[],this.outputs=[];for(let[o,l]of a)this.labels.push(o),this.outputs.push(l)}static interpolationFactor(e,r,i,n){let a=0;if(e.name===\"exponential\")a=Is(r,e.base,i,n);else if(e.name===\"linear\")a=Is(r,1,i,n);else if(e.name===\"cubic-bezier\"){let s=e.controlPoints;a=a0(s[0],s[1],s[2],s[3])(Is(r,1,i,n))}return a}static parse(e,r){let[i,n,a,...s]=e;if(!Array.isArray(n)||n.length===0)return r.error(\"Expected an interpolation type expression.\",1);if(n[0]===\"linear\")n={name:\"linear\"};else if(n[0]===\"exponential\"){let u=n[1];if(typeof u!=\"number\")return r.error(\"Exponential interpolation requires a numeric base.\",1,1);n={name:\"exponential\",base:u}}else if(n[0]===\"cubic-bezier\"){let u=n.slice(1);if(u.length!==4||u.some(h=>typeof h!=\"number\"||h<0||h>1))return r.error(\"Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.\",1);n={name:\"cubic-bezier\",controlPoints:u}}else return r.error(`Unknown interpolation type ${String(n[0])}`,1,0);if(e.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return r.error(\"Expected an even number of arguments.\");if(a=r.parse(a,2,k),!a)return null;let o=[],l=null;(i===\"interpolate-hcl\"||i===\"interpolate-lab\")&&r.expectedType!=Hi?l=ue:r.expectedType&&r.expectedType.kind!==\"value\"&&(l=r.expectedType);for(let u=0;u<s.length;u+=2){let h=s[u],c=s[u+1],p=u+3,f=u+4;if(typeof h!=\"number\")return r.error('Input/output pairs for \"interpolate\" expressions must be defined using literal numeric values (not computed expressions) for the input values.',p);if(o.length&&o[o.length-1][0]>=h)return r.error('Input/output pairs for \"interpolate\" expressions must be arranged with input values in strictly ascending order.',p);let d=r.parse(c,f,l);if(!d)return null;l||(l=d.type),o.push([h,d])}return!Ue(l,k)&&!Ue(l,Fa)&&!Ue(l,ue)&&!Ue(l,ka)&&!Ue(l,Ia)&&!Ue(l,Hi)&&!Ue(l,Ca)&&!Ue(l,Nt(k))?r.error(`Type ${yt(l)} is not interpolatable.`):new Hs(l,i,n,a,o,r.key)}evaluate(e){let r=this.labels,i=this.outputs;if(r.length===1)return i[0].evaluate(e);let n=this.input.evaluate(e);if(n<=r[0])return i[0].evaluate(e);let a=r.length;if(n>=r[a-1])return i[a-1].evaluate(e);let s=Ma(r,n,this.key),o=r[s],l=r[s+1],u=Hs.interpolationFactor(this.interpolation,n,o,l),h=i[s].evaluate(e),c=i[s+1].evaluate(e);switch(this.operator){case\"interpolate\":switch(this.type.kind){case\"number\":return He(h,c,u);case\"color\":return gt.interpolate(h,c,u);case\"padding\":return Ae.interpolate(h,c,u);case\"colorArray\":return se.interpolate(h,c,u);case\"numberArray\":return Se.interpolate(h,c,u);case\"variableAnchorOffsetCollection\":return De.interpolate(h,c,u,this.key);case\"array\":return Jr(h,c,u);case\"projectionDefinition\":return br.interpolate(h,c,u)}case\"interpolate-hcl\":switch(this.type.kind){case\"color\":return gt.interpolate(h,c,u,\"hcl\");case\"colorArray\":return se.interpolate(h,c,u,\"hcl\")}case\"interpolate-lab\":switch(this.type.kind){case\"color\":return gt.interpolate(h,c,u,\"lab\");case\"colorArray\":return se.interpolate(h,c,u,\"lab\")}}}eachChild(e){e(this.input);for(let r of this.outputs)e(r)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}};function Is(t,e,r,i){let n=i-r,a=t-r;return n===0?0:e===1?a/n:(e**+a-1)/(e**+n-1)}var yr={color:gt.interpolate,number:He,padding:Ae.interpolate,numberArray:Se.interpolate,colorArray:se.interpolate,variableAnchorOffsetCollection:De.interpolate,array:Jr},Vp=class Op{constructor(e){this.type=pn,this.sections=e}static parse(e,r){if(e.length<2)return r.error(\"Expected at least one argument.\");let i=e[1];if(!Array.isArray(i)&&typeof i==\"object\")return r.error(\"First argument must be an image or text section.\");let n=[],a=!1;for(let s=1;s<=e.length-1;++s){let o=e[s];if(a&&typeof o==\"object\"&&!Array.isArray(o)){a=!1;let l=null;if(o[\"font-scale\"]&&(l=r.parse(o[\"font-scale\"],1,k),!l))return null;let u=null;if(o[\"text-font\"]&&(u=r.parse(o[\"text-font\"],1,Nt(X)),!u))return null;let h=null;if(o[\"text-color\"]&&(h=r.parse(o[\"text-color\"],1,ue),!h))return null;let c=null;if(o[\"vertical-align\"]){if(typeof o[\"vertical-align\"]==\"string\"&&!r0.includes(o[\"vertical-align\"]))return r.error(`'vertical-align' must be one of: 'bottom', 'center', 'top' but found '${o[\"vertical-align\"]}' instead.`);if(c=r.parse(o[\"vertical-align\"],1,X),!c)return null}let p=n[n.length-1];p.scale=l,p.font=u,p.textColor=h,p.verticalAlign=c}else{let l=r.parse(e[s],1,H);if(!l)return null;let u=l.type.kind;if(u!==\"string\"&&u!==\"value\"&&u!==\"null\"&&u!==\"resolvedImage\")return r.error(\"Formatted text type must be 'string', 'value', 'image' or 'null'.\");a=!0,n.push({content:l,scale:null,font:null,textColor:null,verticalAlign:null})}}return new Op(n)}evaluate(e){return new Be(this.sections.map(r=>{let i=r.content.evaluate(e);return At(i)===fn?new Zs(\"\",i,null,null,null,r.verticalAlign?r.verticalAlign.evaluate(e):null):new Zs(Ui(i),null,r.scale?r.scale.evaluate(e):null,r.font?r.font.evaluate(e).join(\",\"):null,r.textColor?r.textColor.evaluate(e):null,r.verticalAlign?r.verticalAlign.evaluate(e):null)}))}eachChild(e){for(let r of this.sections)e(r.content),r.scale&&e(r.scale),r.font&&e(r.font),r.textColor&&e(r.textColor),r.verticalAlign&&e(r.verticalAlign)}outputDefined(){return!1}};function Rp(t,e,r=0,i=t.length-1,n=s0){for(;i>r;){if(i-r>600){let l=i-r+1,u=e-r+1,h=Math.log(l),c=.5*Math.exp(2*h/3),p=.5*Math.sqrt(h*c*(l-c)/l)*(u-l/2<0?-1:1);Rp(t,e,Math.max(r,Math.floor(e-u*c/l+p)),Math.min(i,Math.floor(e+(l-u)*c/l+p)),n)}let a=t[e],s=r,o=i;for(Si(t,r,e),n(t[i],a)>0&&Si(t,r,i);s<o;){for(Si(t,s,o),s++,o--;n(t[s],a)<0;)s++;for(;n(t[o],a)>0;)o--}n(t[r],a)===0?Si(t,r,o):(o++,Si(t,o,i)),o<=e&&(r=o+1),e<=o&&(i=o-1)}}function Si(t,e,r){let i=t[e];t[e]=t[r],t[r]=i}function s0(t,e){return t<e?-1:+(t>e)}function Ba(t,e){if(t.length<=1)return[t];let r=[],i,n;for(let a of t){let s=l0(a);s!==0&&(a.area=Math.abs(s),n===void 0&&(n=s<0),n===s<0?(i&&r.push(i),i=[a]):i.push(a))}if(i&&r.push(i),e>1)for(let a=0;a<r.length;a++)r[a].length<=e||(Rp(r[a],e,1,r[a].length-1,o0),r[a]=r[a].slice(0,e));return r}function o0(t,e){return e.area-t.area}function l0(t){let e=0;for(let r=0,i=t.length,n=i-1,a,s;r<i;n=r++)a=t[r],s=t[n],e+=(s.x-a.x)*(a.y+s.y);return e}var $n={string:X,number:k,boolean:tt,object:cr},Ie=class $p{constructor(e,r,i){this.type=e,this.args=r,this.key=i}static parse(e,r){if(e.length<2)return r.error(\"Expected at least one argument.\");let i=1,n,a=e[0];if(a===\"array\"){let o;if(e.length>2){let u=e[1];if(typeof u!=\"string\"||!(u in $n)||u===\"object\")return r.error('The item type argument of \"array\" must be one of string, number, boolean',1);o=$n[u],i++}else o=H;let l;if(e.length>3){if(e[2]!==null&&(typeof e[2]!=\"number\"||e[2]<0||e[2]!==Math.floor(e[2])))return r.error('The length argument to \"array\" must be a positive integer literal',2);l=e[2],i++}n=Nt(o,l)}else{if(!$n[a])throw Error(`Types doesn't contain name = ${a}`);n=$n[a]}let s=[];for(;i<e.length;i++){let o=r.parse(e[i],i,H);if(!o)return null;s.push(o)}return new $p(n,s,r.key)}evaluate(e){for(let r=0;r<this.args.length;r++){let i=this.args[r].evaluate(e);if(!Ki(this.type,At(i)))return i;if(r===this.args.length-1)throw new ct(`Expected value to be of type ${yt(this.type)}, but found ${yt(At(i))} instead.`,this.key)}throw Error()}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}},ph={\"to-boolean\":tt,\"to-color\":ue,\"to-number\":k,\"to-string\":X},Ur=class Np{constructor(e,r,i){this.type=e,this.args=r,this.key=i}static parse(e,r){if(e.length<2)return r.error(\"Expected at least one argument.\");let i=e[0];if(!ph[i])throw Error(`Can't parse ${i} as it is not part of the known types`);if((i===\"to-boolean\"||i===\"to-string\")&&e.length!==2)return r.error(\"Expected one argument.\");let n=ph[i],a=[];for(let s=1;s<e.length;s++){let o=r.parse(e[s],s,H);if(!o)return null;a.push(o)}return new Np(n,a,r.key)}evaluate(e){switch(this.type.kind){case\"boolean\":return!!this.args[0].evaluate(e);case\"color\":{let r,i;for(let n of this.args){if(r=n.evaluate(e),i=null,r instanceof gt)return r;if(typeof r==\"string\"){let a=e.parseColor(r);if(a)return a}else if(Array.isArray(r)&&(i=r.length<3||r.length>4?`Invalid rgba value ${JSON.stringify(r)}: expected an array containing either three or four numeric values.`:Bp(r[0],r[1],r[2],r[3]),!i))return new gt(r[0]/255,r[1]/255,r[2]/255,r[3])}throw new ct(i||`Could not parse color from value '${typeof r==\"string\"?r:JSON.stringify(r)}'`,this.key)}case\"padding\":{let r;for(let i of this.args){r=i.evaluate(e);let n=Ae.parse(r);if(n)return n}throw new ct(`Could not parse padding from value '${typeof r==\"string\"?r:JSON.stringify(r)}'`,this.key)}case\"numberArray\":{let r;for(let i of this.args){r=i.evaluate(e);let n=Se.parse(r);if(n)return n}throw new ct(`Could not parse numberArray from value '${typeof r==\"string\"?r:JSON.stringify(r)}'`,this.key)}case\"colorArray\":{let r;for(let i of this.args){r=i.evaluate(e);let n=se.parse(r);if(n)return n}throw new ct(`Could not parse colorArray from value '${typeof r==\"string\"?r:JSON.stringify(r)}'`,this.key)}case\"variableAnchorOffsetCollection\":{let r;for(let i of this.args){r=i.evaluate(e);let n=De.parse(r);if(n)return n}throw new ct(`Could not parse variableAnchorOffsetCollection from value '${typeof r==\"string\"?r:JSON.stringify(r)}'`,this.key)}case\"number\":{let r=null;for(let i of this.args){if(r=i.evaluate(e),r===null)return 0;let n=Number(r);if(!isNaN(n))return n}throw new ct(`Could not convert ${JSON.stringify(r)} to number.`,this.key)}case\"formatted\":return Be.fromString(Ui(this.args[0].evaluate(e)));case\"resolvedImage\":return _e.fromString(Ui(this.args[0].evaluate(e)));case\"projectionDefinition\":{let r=this.args[0].evaluate(e);if(br.parse(r))return r;throw new ct(`Could not parse projectionDefinition from value '${typeof r==\"string\"?r:JSON.stringify(r)}'`,this.key)}default:return Ui(this.args[0].evaluate(e))}}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}},Up=class qp{constructor(e,r){this.type=r.type,this.bindings=[].concat(e),this.result=r}evaluate(e){return this.result.evaluate(e)}eachChild(e){for(let r of this.bindings)e(r[1]);e(this.result)}static parse(e,r){if(e.length<4)return r.error(`Expected at least 3 arguments, but found ${e.length-1} instead.`);let i=[];for(let a=1;a<e.length-1;a+=2){let s=e[a];if(typeof s!=\"string\")return r.error(`Expected string, but found ${typeof s} instead.`,a);if(/[^a-zA-Z0-9_]/.test(s))return r.error(\"Variable names must contain only alphanumeric characters or '_'.\",a);let o=r.parse(e[a+1],a+1);if(!o)return null;i.push([s,o])}let n=r.parse(e[e.length-1],e.length-1,r.expectedType,i);return n?new qp(i,n):null}outputDefined(){return this.result.outputDefined()}},jp=class Gp{constructor(e,r){this.type=r.type,this.name=e,this.boundExpression=r}static parse(e,r){if(e.length!==2||typeof e[1]!=\"string\")return r.error(\"'var' expression requires exactly one string literal argument.\");let i=e[1];return r.scope.has(i)?new Gp(i,r.scope.get(i)):r.error(`Unknown variable \"${i}\". Make sure \"${i}\" has been bound in an enclosing \"let\" expression before using it.`,1)}evaluate(e){return this.boundExpression.evaluate(e)}eachChild(){}outputDefined(){return!1}},u0=class Yp{constructor(e,r,i,n){this.type=e,this.index=r,this.input=i,this.key=n}static parse(e,r){if(e.length!==3)return r.error(`Expected 2 arguments, but found ${e.length-1} instead.`);let i=r.parse(e[1],1,k),n=r.parse(e[2],2,Nt(r.expectedType||H));if(!i||!n)return null;let a=n.type;return new Yp(a.itemType,i,n,r.key)}evaluate(e){let r=this.index.evaluate(e),i=this.input.evaluate(e);if(r<0)throw new ct(`Array index out of bounds: ${r} < 0.`,this.key);if(r>=i.length)throw new ct(`Array index out of bounds: ${r} > ${i.length-1}.`,this.key);if(r!==Math.floor(r))throw new ct(`Array index must be an integer, but found ${r} instead.`,this.key);return i[r]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}},h0=class Xp{constructor(e,r,i){this.needle=e,this.haystack=r,this.key=i,this.type=tt}static parse(e,r){if(e.length!==3)return r.error(`Expected 2 arguments, but found ${e.length-1} instead.`);let i=r.parse(e[1],1,H),n=r.parse(e[2],2,H);return!i||!n?null:dl(i.type,[tt,X,k,cn,H])?new Xp(i,n,r.key):r.error(`Expected first argument to be of type boolean, string, number or null, but found ${yt(i.type)} instead`)}evaluate(e){let r=this.needle.evaluate(e),i=this.haystack.evaluate(e);if(!i)return!1;if(!pr(r,[\"boolean\",\"string\",\"number\",\"null\"]))throw new ct(`Expected first argument to be of type boolean, string, number or null, but found ${yt(At(r))} instead.`,this.key);if(!pr(i,[\"string\",\"array\"]))throw new ct(`Expected second argument to be of type array or string, but found ${yt(At(i))} instead.`,this.key);return i.indexOf(r)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}},c0=class Ks{constructor(e,r,i,n){this.needle=e,this.haystack=r,this.key=i,this.fromIndex=n,this.type=k}static parse(e,r){if(e.length<=2||e.length>=5)return r.error(`Expected 2 or 3 arguments, but found ${e.length-1} instead.`);let i=r.parse(e[1],1,H),n=r.parse(e[2],2,H);if(!i||!n)return null;if(!dl(i.type,[tt,X,k,cn,H]))return r.error(`Expected first argument to be of type boolean, string, number or null, but found ${yt(i.type)} instead`);if(e.length===4){let a=r.parse(e[3],3,k);return a?new Ks(i,n,r.key,a):null}return new Ks(i,n,r.key)}evaluate(e){let r=this.needle.evaluate(e),i=this.haystack.evaluate(e);if(!pr(r,[\"boolean\",\"string\",\"number\",\"null\"]))throw new ct(`Expected first argument to be of type boolean, string, number or null, but found ${yt(At(r))} instead.`,this.key);let n;if(this.fromIndex&&(n=this.fromIndex.evaluate(e)),pr(i,[\"string\"])){let a=i.indexOf(r,n);return a===-1?-1:[...i.slice(0,a)].length}if(pr(i,[\"array\"]))return i.indexOf(r,n);throw new ct(`Expected second argument to be of type array or string, but found ${yt(At(i))} instead.`,this.key)}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}},p0=class Wp{constructor(e,r,i,n,a,s){this.inputType=e,this.type=r,this.input=i,this.cases=n,this.outputs=a,this.otherwise=s}static parse(e,r){if(e.length<5)return r.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length%2!=1)return r.error(\"Expected an even number of arguments.\");let i,n;r.expectedType&&r.expectedType.kind!==\"value\"&&(n=r.expectedType);let a={},s=[];for(let u=2;u<e.length-1;u+=2){let h=e[u],c=e[u+1];Array.isArray(h)||(h=[h]);let p=r.concat(u);if(h.length===0)return p.error(\"Expected at least one branch label.\");for(let d of h){if(typeof d!=\"number\"&&typeof d!=\"string\")return p.error(\"Branch labels must be numbers or strings.\");if(typeof d==\"number\"&&Math.abs(d)>2**53-1)return p.error(`Branch labels must be integers no larger than ${2**53-1}.`);if(typeof d==\"number\"&&Math.floor(d)!==d)return p.error(\"Numeric branch labels must be integer values.\");if(!i)i=At(d);else if(p.checkSubtype(i,At(d)))return null;if(a[String(d)]!==void 0)return p.error(\"Branch labels must be unique.\");a[String(d)]=s.length}let f=r.parse(c,u,n);if(!f)return null;n||(n=f.type),s.push(f)}let o=r.parse(e[1],1,H);if(!o)return null;let l=r.parse(e[e.length-1],e.length-1,n);return!l||o.type.kind!==\"value\"&&r.concat(1).checkSubtype(i,o.type)?null:new Wp(i,n,o,a,s,l)}evaluate(e){let r=this.input.evaluate(e);return(At(r)===this.inputType&&this.outputs[this.cases[r]]||this.otherwise).evaluate(e)}eachChild(e){e(this.input),this.outputs.forEach(e),e(this.otherwise)}outputDefined(){return this.outputs.every(e=>e.outputDefined())&&this.otherwise.outputDefined()}},f0=class Zp{constructor(e,r,i){this.type=e,this.branches=r,this.otherwise=i}static parse(e,r){if(e.length<4)return r.error(`Expected at least 3 arguments, but found only ${e.length-1}.`);if(e.length%2!=0)return r.error(\"Expected an odd number of arguments.\");let i;r.expectedType&&r.expectedType.kind!==\"value\"&&(i=r.expectedType);let n=[];for(let s=1;s<e.length-1;s+=2){let o=r.parse(e[s],s,tt);if(!o)return null;let l=r.parse(e[s+1],s+1,i);if(!l)return null;n.push([o,l]),i||(i=l.type)}let a=r.parse(e[e.length-1],e.length-1,i);if(!a)return null;if(!i)throw Error(\"Can't infer output type\");return new Zp(i,n,a)}evaluate(e){for(let[r,i]of this.branches)if(r.evaluate(e))return i.evaluate(e);return this.otherwise.evaluate(e)}eachChild(e){for(let[r,i]of this.branches)e(r),e(i);e(this.otherwise)}outputDefined(){return this.branches.every(([e,r])=>r.outputDefined())&&this.otherwise.outputDefined()}},d0=class Js{constructor(e,r,i,n,a){this.type=e,this.input=r,this.beginIndex=i,this.key=n,this.endIndex=a}static parse(e,r){if(e.length<=2||e.length>=5)return r.error(`Expected 2 or 3 arguments, but found ${e.length-1} instead.`);let i=r.parse(e[1],1,H),n=r.parse(e[2],2,k);if(!i||!n)return null;if(!dl(i.type,[Nt(H),X,H]))return r.error(`Expected first argument to be of type array or string, but found ${yt(i.type)} instead`);if(e.length===4){let a=r.parse(e[3],3,k);return a?new Js(i.type,i,n,r.key,a):null}return new Js(i.type,i,n,r.key)}evaluate(e){let r=this.input.evaluate(e),i=this.beginIndex.evaluate(e),n;if(this.endIndex&&(n=this.endIndex.evaluate(e)),pr(r,[\"string\"]))return[...r].slice(i,n).join(\"\");if(pr(r,[\"array\"]))return r.slice(i,n);throw new ct(`Expected first argument to be of type array or string, but found ${yt(At(r))} instead.`,this.key)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}},Hp=class Qs{constructor(e,r){this.type=e,this.args=r}static parse(e,r){if(e.length<2)return r.error(\"Expected at least one argument.\");let i=null,n=r.expectedType;n&&n.kind!==\"value\"&&(i=n);let a=[];for(let s of e.slice(1)){let o=r.parse(s,1+a.length,i,void 0,{typeAnnotation:\"omit\"});if(!o)return null;i||(i=o.type),a.push(o)}if(!i)throw Error(\"No output type\");return n&&a.some(s=>Ki(n,s.type))?new Qs(H,a):new Qs(i,a)}evaluate(e){let r=null,i=0,n;for(let a of this.args)if(i++,r=a.evaluate(e),r&&r instanceof _e&&!r.available&&(n||(n=r.name),r=null,i===this.args.length&&(r=n)),r!==null)break;return r}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}};function fh(t,e){return t===\"==\"||t===\"!=\"?e.kind===\"boolean\"||e.kind===\"string\"||e.kind===\"number\"||e.kind===\"null\"||e.kind===\"value\":e.kind===\"string\"||e.kind===\"number\"||e.kind===\"value\"}function y0(t,e,r){return e===r}function m0(t,e,r){return e!==r}function g0(t,e,r){return e<r}function x0(t,e,r){return e>r}function v0(t,e,r){return e<=r}function b0(t,e,r){return e>=r}function Kp(t,e,r,i){return i.compare(e,r)===0}function w0(t,e,r,i){return!Kp(t,e,r,i)}function D0(t,e,r,i){return i.compare(e,r)<0}function _0(t,e,r,i){return i.compare(e,r)>0}function A0(t,e,r,i){return i.compare(e,r)<=0}function S0(t,e,r,i){return i.compare(e,r)>=0}function si(t,e,r){let i=t!==\"==\"&&t!==\"!=\";return class Jp{constructor(a,s,o,l){this.lhs=a,this.rhs=s,this.key=o,this.collator=l,this.type=tt,this.hasUntypedArgument=a.type.kind===\"value\"||s.type.kind===\"value\"}static parse(a,s){if(a.length!==3&&a.length!==4)return s.error(\"Expected two or three arguments.\");let o=a[0],l=s.parse(a[1],1,H);if(!l)return null;if(!fh(o,l.type))return s.concat(1).error(`\"${o}\" comparisons are not supported for type '${yt(l.type)}'.`);let u=s.parse(a[2],2,H);if(!u)return null;if(!fh(o,u.type))return s.concat(2).error(`\"${o}\" comparisons are not supported for type '${yt(u.type)}'.`);if(l.type.kind!==u.type.kind&&l.type.kind!==\"value\"&&u.type.kind!==\"value\")return s.error(`Cannot compare types '${yt(l.type)}' and '${yt(u.type)}'.`);i&&(l.type.kind===\"value\"&&u.type.kind!==\"value\"?l=new Ie(u.type,[l],s.key):l.type.kind!==\"value\"&&u.type.kind===\"value\"&&(u=new Ie(l.type,[u],s.key)));let h=null;if(a.length===4){if(l.type.kind!==\"string\"&&u.type.kind!==\"string\"&&l.type.kind!==\"value\"&&u.type.kind!==\"value\")return s.error(\"Cannot use collator to compare non-string types.\");if(h=s.parse(a[3],3,Ta),!h)return null}return new Jp(l,u,s.key,h)}evaluate(a){let s=this.lhs.evaluate(a),o=this.rhs.evaluate(a);if(i&&this.hasUntypedArgument){let l=At(s),u=At(o);if(l.kind!==u.kind||l.kind!==\"string\"&&l.kind!==\"number\")throw new ct(`Expected arguments for \"${t}\" to be (string, string) or (number, number), but found (${l.kind}, ${u.kind}) instead.`,this.key)}if(this.collator&&!i&&this.hasUntypedArgument){let l=At(s),u=At(o);if(l.kind!==\"string\"||u.kind!==\"string\")return e(a,s,o)}return this.collator?r(a,s,o,this.collator.evaluate(a)):e(a,s,o)}eachChild(a){a(this.lhs),a(this.rhs),this.collator&&a(this.collator)}outputDefined(){return!0}}}var E0=si(\"==\",y0,Kp),F0=si(\"!=\",m0,w0),T0=si(\"<\",g0,D0),k0=si(\">\",x0,_0),I0=si(\"<=\",v0,A0),C0=si(\">=\",b0,S0),Qp=class tf{constructor(e,r,i){this.type=Ta,this.locale=i,this.caseSensitive=e,this.diacriticSensitive=r}static parse(e,r){if(e.length!==2)return r.error(\"Expected one argument.\");let i=e[1];if(typeof i!=\"object\"||Array.isArray(i))return r.error(\"Collator options argument must be an object.\");let n=r.parse(i[\"case-sensitive\"]!==void 0&&i[\"case-sensitive\"],1,tt);if(!n)return null;let a=r.parse(i[\"diacritic-sensitive\"]!==void 0&&i[\"diacritic-sensitive\"],1,tt);if(!a)return null;let s=null;return i.locale&&(s=r.parse(i.locale,1,X),!s)?null:new tf(n,a,s)}evaluate(e){return new yl(this.caseSensitive.evaluate(e),this.diacriticSensitive.evaluate(e),this.locale?this.locale.evaluate(e):null)}eachChild(e){e(this.caseSensitive),e(this.diacriticSensitive),this.locale&&e(this.locale)}outputDefined(){return!1}},M0=class ef{constructor(e,r,i,n,a,s){this.type=X,this.number=e,this.locale=r,this.currency=i,this.unit=n,this.minFractionDigits=a,this.maxFractionDigits=s}static parse(e,r){if(e.length!==3)return r.error(\"Expected two arguments.\");let i=r.parse(e[1],1,k);if(!i)return null;let n=e[2];if(typeof n!=\"object\"||Array.isArray(n))return r.error(\"NumberFormat options argument must be an object.\");let a=null;if(n.locale&&(a=r.parse(n.locale,1,X),!a))return null;let s=null;if(n.currency&&(s=r.parse(n.currency,1,X),!s))return null;let o=null;if(n.unit&&(o=r.parse(n.unit,1,X),!o))return null;if(s&&o)return r.error(\"NumberFormat options `currency` and `unit` are mutually exclusive\");let l=null;if(n[\"min-fraction-digits\"]&&(l=r.parse(n[\"min-fraction-digits\"],1,k),!l))return null;let u=null;return n[\"max-fraction-digits\"]&&(u=r.parse(n[\"max-fraction-digits\"],1,k),!u)?null:new ef(i,a,s,o,l,u)}evaluate(e){return new Intl.NumberFormat(this.locale?this.locale.evaluate(e):[],{style:this.currency?\"currency\":this.unit?\"unit\":\"decimal\",currency:this.currency?this.currency.evaluate(e):void 0,unit:this.unit?this.unit.evaluate(e):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(e):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(e):void 0}).format(this.number.evaluate(e))}eachChild(e){e(this.number),this.locale&&e(this.locale),this.currency&&e(this.currency),this.unit&&e(this.unit),this.minFractionDigits&&e(this.minFractionDigits),this.maxFractionDigits&&e(this.maxFractionDigits)}outputDefined(){return!1}},B0=class rf{constructor(e){this.type=fn,this.input=e}static parse(e,r){if(e.length!==2)return r.error(\"Expected two arguments.\");let i=r.parse(e[1],1,X);return i?new rf(i):r.error(\"No image name provided.\")}evaluate(e){let r=this.input.evaluate(e),i=_e.fromString(r);return i&&e.availableImages&&(i.available=e.availableImages.indexOf(r)>-1),i}eachChild(e){e(this.input)}outputDefined(){return!1}},P0=class nf{constructor(e,r){this.input=e,this.key=r,this.type=k}static parse(e,r){if(e.length!==2)return r.error(`Expected 1 argument, but found ${e.length-1} instead.`);let i=r.parse(e[1],1);return i?i.type.kind!==\"array\"&&i.type.kind!==\"string\"&&i.type.kind!==\"value\"?r.error(`Expected argument of type string or array, but found ${yt(i.type)} instead.`):new nf(i,r.key):null}evaluate(e){let r=this.input.evaluate(e);if(typeof r==\"string\")return[...r].length;if(Array.isArray(r))return r.length;throw new ct(`Expected value to be of type string or array, but found ${yt(At(r))} instead.`,this.key)}eachChild(e){e(this.input)}outputDefined(){return!1}},we=8192;function z0(t,e){let r=L0(t[0]),i=O0(t[1]),n=2**e.z;return[Math.round(r*n*we),Math.round(i*n*we)]}function gl(t,e){let r=2**e.z,i=(t[0]/we+e.x)/r,n=(t[1]/we+e.y)/r;return[V0(i),R0(n)]}function L0(t){return(180+t)/360}function V0(t){return t*360-180}function O0(t){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t*Math.PI/360)))/360}function R0(t){return 360/Math.PI*Math.atan(Math.exp((180-t*360)*Math.PI/180))-90}function dn(t,e){t[0]=Math.min(t[0],e[0]),t[1]=Math.min(t[1],e[1]),t[2]=Math.max(t[2],e[0]),t[3]=Math.max(t[3],e[1])}function Ji(t,e){return!(t[0]<=e[0]||t[2]>=e[2]||t[1]<=e[1]||t[3]>=e[3])}function $0(t,e,r){return e[1]>t[1]!=r[1]>t[1]&&t[0]<(r[0]-e[0])*(t[1]-e[1])/(r[1]-e[1])+e[0]}function N0(t,e,r){let i=t[0]-e[0],n=t[1]-e[1],a=t[0]-r[0],s=t[1]-r[1];return i*s-a*n===0&&i*a<=0&&n*s<=0}function Pa(t,e,r,i){let n=[e[0]-t[0],e[1]-t[1]];return G0([i[0]-r[0],i[1]-r[1]],n)!==0&&!!(dh(t,e,r,i)&&dh(r,i,t,e))}function U0(t,e,r){for(let i of r)for(let n=0;n<i.length-1;++n)if(Pa(t,e,i[n],i[n+1]))return!0;return!1}function oi(t,e,r=!1){let i=!1;for(let n of e)for(let a=0;a<n.length-1;a++){if(N0(t,n[a],n[a+1]))return r;$0(t,n[a],n[a+1])&&(i=!i)}return i}function q0(t,e){for(let r of e)if(oi(t,r))return!0;return!1}function af(t,e){for(let r of t)if(!oi(r,e))return!1;for(let r=0;r<t.length-1;++r)if(U0(t[r],t[r+1],e))return!1;return!0}function j0(t,e){for(let r of e)if(af(t,r))return!0;return!1}function G0(t,e){return t[0]*e[1]-t[1]*e[0]}function dh(t,e,r,i){let n=t[0]-r[0],a=t[1]-r[1],s=e[0]-r[0],o=e[1]-r[1],l=i[0]-r[0],u=i[1]-r[1],h=n*u-l*a,c=s*u-l*o;return h>0&&c<0||h<0&&c>0}function xl(t,e,r){let i=[];for(let n=0;n<t.length;n++){let a=[];for(let s=0;s<t[n].length;s++){let o=z0(t[n][s],r);dn(e,o),a.push(o)}i.push(a)}return i}function sf(t,e,r){let i=[];for(let n=0;n<t.length;n++){let a=xl(t[n],e,r);i.push(a)}return i}function of(t,e,r,i){if(t[0]<r[0]||t[0]>r[2]){let n=i*.5,a=t[0]-r[0]>n?-i:r[0]-t[0]>n?i:0;a===0&&(a=t[0]-r[2]>n?-i:r[2]-t[0]>n?i:0),t[0]+=a}dn(e,t)}function Y0(t){t[0]=t[1]=1/0,t[2]=t[3]=-1/0}function yh(t,e,r,i){let n=2**i.z*we,a=[i.x*we,i.y*we],s=[];for(let o of t)for(let l of o){let u=[l.x+a[0],l.y+a[1]];of(u,e,r,n),s.push(u)}return s}function mh(t,e,r,i){let n=2**i.z*we,a=[i.x*we,i.y*we],s=[];for(let o of t){let l=[];for(let u of o){let h=[u.x+a[0],u.y+a[1]];dn(e,h),l.push(h)}s.push(l)}if(e[2]-e[0]<=n/2){Y0(e);for(let o of s)for(let l of o)of(l,e,r,n)}return s}function X0(t,e){let r=[1/0,1/0,-1/0,-1/0],i=[1/0,1/0,-1/0,-1/0],n=t.canonicalID();if(e.type===\"Polygon\"){let a=xl(e.coordinates,i,n),s=yh(t.geometry(),r,i,n);if(!Ji(r,i))return!1;for(let o of s)if(!oi(o,a))return!1}if(e.type===\"MultiPolygon\"){let a=sf(e.coordinates,i,n),s=yh(t.geometry(),r,i,n);if(!Ji(r,i))return!1;for(let o of s)if(!q0(o,a))return!1}return!0}function W0(t,e){let r=[1/0,1/0,-1/0,-1/0],i=[1/0,1/0,-1/0,-1/0],n=t.canonicalID();if(e.type===\"Polygon\"){let a=xl(e.coordinates,i,n),s=mh(t.geometry(),r,i,n);if(!Ji(r,i))return!1;for(let o of s)if(!af(o,a))return!1}if(e.type===\"MultiPolygon\"){let a=sf(e.coordinates,i,n),s=mh(t.geometry(),r,i,n);if(!Ji(r,i))return!1;for(let o of s)if(!j0(o,a))return!1}return!0}var vl=class na{constructor(e,r){this.type=tt,this.geojson=e,this.geometries=r}static parse(e,r){if(e.length!==2)return r.error(`'within' expression requires exactly one argument, but found ${e.length-1} instead.`);if(Qr(e[1])){let i=e[1];if(i.type===\"FeatureCollection\"){let n=[];for(let a of i.features){let{type:s,coordinates:o}=a.geometry;s===\"Polygon\"&&n.push(o),s===\"MultiPolygon\"&&n.push(...o)}if(n.length)return new na(i,{type:\"MultiPolygon\",coordinates:n})}else if(i.type===\"Feature\"){let n=i.geometry.type;if(n===\"Polygon\"||n===\"MultiPolygon\")return new na(i,i.geometry)}else if(i.type===\"Polygon\"||i.type===\"MultiPolygon\")return new na(i,i)}return r.error(\"'within' expression requires valid geojson object that contains polygon geometry type.\")}evaluate(e){if(e.geometry()!=null&&e.canonicalID()!=null){if(e.geometryType()===\"Point\")return X0(e,this.geometries);if(e.geometryType()===\"LineString\")return W0(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}},lf=class{constructor(t=[],e=(r,i)=>r<i?-1:+(r>i)){if(this.data=t,this.length=this.data.length,this.compare=e,this.length>0)for(let r=(this.length>>1)-1;r>=0;r--)this._down(r)}push(t){this.data.push(t),this._up(this.length++)}pop(){if(this.length===0)return;let t=this.data[0],e=this.data.pop();return--this.length>0&&(this.data[0]=e,this._down(0)),t}peek(){return this.data[0]}_up(t){let{data:e,compare:r}=this,i=e[t];for(;t>0;){let n=t-1>>1,a=e[n];if(r(i,a)>=0)break;e[t]=a,t=n}e[t]=i}_down(t){let{data:e,compare:r}=this,i=this.length>>1,n=e[t];for(;t<i;){let a=(t<<1)+1,s=a+1;if(s<this.length&&r(e[s],e[a])<0&&(a=s),r(e[a],n)>=0)break;e[t]=e[a],t=a}e[t]=n}},gh=Math.PI/180,bl=class{constructor(t){let e=gh*6378.137*1e3,r=Math.cos(t*gh),i=1/(1-.0066943799901413165*(1-r*r)),n=Math.sqrt(i);this.kx=e*n*r,this.ky=e*n*i*.9933056200098587}distance(t,e){let r=this.wrap(t[0]-e[0])*this.kx,i=(t[1]-e[1])*this.ky;return Math.sqrt(r*r+i*i)}pointOnLine(t,e){let r=1/0,i,n,a,s;for(let o=0;o<t.length-1;o++){let l=t[o][0],u=t[o][1],h=this.wrap(t[o+1][0]-l)*this.kx,c=(t[o+1][1]-u)*this.ky,p=0;(h!==0||c!==0)&&(p=(this.wrap(e[0]-l)*this.kx*h+(e[1]-u)*this.ky*c)/(h*h+c*c),p>1?(l=t[o+1][0],u=t[o+1][1]):p>0&&(l+=h/this.kx*p,u+=c/this.ky*p)),h=this.wrap(e[0]-l)*this.kx,c=(e[1]-u)*this.ky;let f=h*h+c*c;f<r&&(r=f,i=l,n=u,a=o,s=p)}return{point:[i,n],index:a,t:Math.max(0,Math.min(1,s))}}wrap(t){for(;t<-180;)t+=360;for(;t>180;)t-=360;return t}};function uf(t,e){return e[0]-t[0]}function ca(t){return t[1]-t[0]+1}function Pe(t,e){return t[1]>=t[0]&&t[1]<e}function to(t,e){if(t[0]>t[1])return[null,null];let r=ca(t);if(e){if(r===2)return[t,null];let n=Math.floor(r/2);return[[t[0],t[0]+n],[t[0]+n,t[1]]]}if(r===1)return[t,null];let i=Math.floor(r/2)-1;return[[t[0],t[0]+i],[t[0]+i+1,t[1]]]}function eo(t,e){if(!Pe(e,t.length))return[1/0,1/0,-1/0,-1/0];let r=[1/0,1/0,-1/0,-1/0];for(let i=e[0];i<=e[1];++i)dn(r,t[i]);return r}function ro(t){let e=[1/0,1/0,-1/0,-1/0];for(let r of t)for(let i of r)dn(e,i);return e}function xh(t){return t[0]!==-1/0&&t[1]!==-1/0&&t[2]!==1/0&&t[3]!==1/0}function wl(t,e,r){if(!xh(t)||!xh(e))return NaN;let i=0,n=0;return t[2]<e[0]&&(i=e[0]-t[2]),t[0]>e[2]&&(i=t[0]-e[2]),t[1]>e[3]&&(n=t[1]-e[3]),t[3]<e[1]&&(n=e[1]-t[3]),r.distance([0,0],[i,n])}function ur(t,e,r){let i=r.pointOnLine(e,t);return r.distance(t,i.point)}function Dl(t,e,r,i,n){let a=Math.min(ur(t,[r,i],n),ur(e,[r,i],n)),s=Math.min(ur(r,[t,e],n),ur(i,[t,e],n));return Math.min(a,s)}function Z0(t,e,r,i,n){if(!(Pe(e,t.length)&&Pe(i,r.length)))return 1/0;let a=1/0;for(let s=e[0];s<e[1];++s){let o=t[s],l=t[s+1];for(let u=i[0];u<i[1];++u){let h=r[u],c=r[u+1];if(Pa(o,l,h,c))return 0;a=Math.min(a,Dl(o,l,h,c,n))}}return a}function H0(t,e,r,i,n){if(!(Pe(e,t.length)&&Pe(i,r.length)))return NaN;let a=1/0;for(let s=e[0];s<=e[1];++s)for(let o=i[0];o<=i[1];++o)if(a=Math.min(a,n.distance(t[s],r[o])),a===0)return a;return a}function K0(t,e,r){if(oi(t,e,!0))return 0;let i=1/0;for(let n of e){let a=n[0],s=n[n.length-1];if(a!==s&&(i=Math.min(i,ur(t,[s,a],r)),i===0))return i;let o=r.pointOnLine(n,t);if(i=Math.min(i,r.distance(t,o.point)),i===0)return i}return i}function J0(t,e,r,i){if(!Pe(e,t.length))return NaN;for(let a=e[0];a<=e[1];++a)if(oi(t[a],r,!0))return 0;let n=1/0;for(let a=e[0];a<e[1];++a){let s=t[a],o=t[a+1];for(let l of r)for(let u=0,h=l.length,c=h-1;u<h;c=u++){let p=l[c],f=l[u];if(Pa(s,o,p,f))return 0;n=Math.min(n,Dl(s,o,p,f,i))}}return n}function vh(t,e){for(let r of t)for(let i of r)if(oi(i,e,!0))return!0;return!1}function Q0(t,e,r,i=1/0){let n=ro(t),a=ro(e);if(i!==1/0&&wl(n,a,r)>=i)return i;if(Ji(n,a)){if(vh(t,e))return 0}else if(vh(e,t))return 0;let s=1/0;for(let o of t)for(let l=0,u=o.length,h=u-1;l<u;h=l++){let c=o[h],p=o[l];for(let f of e)for(let d=0,y=f.length,m=y-1;d<y;m=d++){let g=f[m],x=f[d];if(Pa(c,p,g,x))return 0;s=Math.min(s,Dl(c,p,g,x,r))}}return s}function bh(t,e,r,i,n,a){if(!a)return;let s=wl(eo(i,a),n,r);s<e&&t.push([s,a,[0,0]])}function Nn(t,e,r,i,n,a,s){if(!a||!s)return;let o=wl(eo(i,a),eo(n,s),r);o<e&&t.push([o,a,s])}function pa(t,e,r,i,n=1/0){let a=Math.min(i.distance(t[0],r[0][0]),n);if(a===0)return a;let s=new lf([[0,[0,t.length-1],[0,0]]],uf),o=ro(r);for(;s.length>0;){let l=s.pop();if(l[0]>=a)continue;let u=l[1],h=e?50:100;if(ca(u)<=h){if(!Pe(u,t.length))return NaN;if(e){let c=J0(t,u,r,i);if(isNaN(c)||c===0)return c;a=Math.min(a,c)}else for(let c=u[0];c<=u[1];++c){let p=K0(t[c],r,i);if(a=Math.min(a,p),a===0)return 0}}else{let c=to(u,e);bh(s,a,i,t,o,c[0]),bh(s,a,i,t,o,c[1])}}return a}function fa(t,e,r,i,n,a=1/0){let s=Math.min(a,n.distance(t[0],r[0]));if(s===0)return s;let o=new lf([[0,[0,t.length-1],[0,r.length-1]]],uf);for(;o.length>0;){let l=o.pop();if(l[0]>=s)continue;let u=l[1],h=l[2],c=e?50:100,p=i?50:100;if(ca(u)<=c&&ca(h)<=p){if(!Pe(u,t.length)&&Pe(h,r.length))return NaN;let f;if(e&&i)f=Z0(t,u,r,h,n),s=Math.min(s,f);else if(e&&!i){let d=t.slice(u[0],u[1]+1);for(let y=h[0];y<=h[1];++y)if(f=ur(r[y],d,n),s=Math.min(s,f),s===0)return s}else if(!e&&i){let d=r.slice(h[0],h[1]+1);for(let y=u[0];y<=u[1];++y)if(f=ur(t[y],d,n),s=Math.min(s,f),s===0)return s}else f=H0(t,u,r,h,n),s=Math.min(s,f)}else{let f=to(u,e),d=to(h,i);Nn(o,s,n,t,r,f[0],d[0]),Nn(o,s,n,t,r,f[0],d[1]),Nn(o,s,n,t,r,f[1],d[0]),Nn(o,s,n,t,r,f[1],d[1])}}return s}function tm(t,e){let r=t.geometry(),i=r.flat().map(s=>gl([s.x,s.y],t.canonical));if(r.length===0)return NaN;let n=new bl(i[0][1]),a=1/0;for(let s of e){switch(s.type){case\"Point\":a=Math.min(a,fa(i,!1,[s.coordinates],!1,n,a));break;case\"LineString\":a=Math.min(a,fa(i,!1,s.coordinates,!0,n,a));break;case\"Polygon\":a=Math.min(a,pa(i,!1,s.coordinates,n,a))}if(a===0)return a}return a}function em(t,e){let r=t.geometry(),i=r.flat().map(s=>gl([s.x,s.y],t.canonical));if(r.length===0)return NaN;let n=new bl(i[0][1]),a=1/0;for(let s of e){switch(s.type){case\"Point\":a=Math.min(a,fa(i,!0,[s.coordinates],!1,n,a));break;case\"LineString\":a=Math.min(a,fa(i,!0,s.coordinates,!0,n,a));break;case\"Polygon\":a=Math.min(a,pa(i,!0,s.coordinates,n,a))}if(a===0)return a}return a}function rm(t,e){let r=t.geometry();if(r.length===0||r[0].length===0)return NaN;let i=Ba(r,0).map(s=>s.map(o=>o.map(l=>gl([l.x,l.y],t.canonical)))),n=new bl(i[0][0][0][1]),a=1/0;for(let s of e)for(let o of i){switch(s.type){case\"Point\":a=Math.min(a,pa([s.coordinates],!1,o,n,a));break;case\"LineString\":a=Math.min(a,pa(s.coordinates,!0,o,n,a));break;case\"Polygon\":a=Math.min(a,Q0(o,s.coordinates,n,a))}if(a===0)return a}return a}function Cs(t){return t.type===\"MultiPolygon\"?t.coordinates.map(e=>({type:\"Polygon\",coordinates:e})):t.type===\"MultiLineString\"?t.coordinates.map(e=>({type:\"LineString\",coordinates:e})):t.type===\"MultiPoint\"?t.coordinates.map(e=>({type:\"Point\",coordinates:e})):[t]}var _l=class aa{constructor(e,r){this.type=k,this.geojson=e,this.geometries=r}static parse(e,r){if(e.length!==2)return r.error(`'distance' expression requires exactly one argument, but found ${e.length-1} instead.`);if(Qr(e[1])){let i=e[1];if(i.type===\"FeatureCollection\")return new aa(i,i.features.map(n=>Cs(n.geometry)).flat());if(i.type===\"Feature\")return new aa(i,Cs(i.geometry));if(\"type\"in i&&\"coordinates\"in i)return new aa(i,Cs(i))}return r.error(\"'distance' expression requires valid geojson object that contains polygon geometry type.\")}evaluate(e){if(e.geometry()!=null&&e.canonicalID()!=null){if(e.geometryType()===\"Point\")return tm(e,this.geometries);if(e.geometryType()===\"LineString\")return em(e,this.geometries);if(e.geometryType()===\"Polygon\")return rm(e,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}},im=class hf{constructor(e){let r=null;for(let i of e)if(!r)r=i.type;else{if(r===i.type)continue;r=H;break}this.type=Nt(r??H,e.length),this.arr=e}static parse(e,r){if(e.length!==2)return r.error(`'semiliteral' expression requires exactly one argument, but found ${e.length-1} instead.`);if(!Qr(e[1]))return r.error(`invalid value of type \"${typeof e[1]}\"`);let i=e[1],n=At(i);if(n.kind===\"array\"){let a=i.map(s=>r.parse(s,null,H));return new hf(a)}return new ti(n,i)}evaluate(e){return this.arr.map(r=>r.evaluate(e))}eachChild(e){this.arr.forEach(e)}outputDefined(){return this.arr.every(e=>e.outputDefined())}},Al=class cf{constructor(e){this.key=e,this.type=H}static parse(e,r){if(e.length!==2)return r.error(`Expected 1 argument, but found ${e.length-1} instead.`);let i=e[1];return i==null?r.error(\"Global state property must be defined.\"):typeof i==\"string\"?new cf(i):r.error(`Global state property must be string, but found ${typeof e[1]} instead.`)}evaluate(e){let r=e.globals?.globalState;return!r||Object.keys(r).length===0?null:Ni(r,this.key)??null}eachChild(){}outputDefined(){return!1}},Gr={\"==\":E0,\"!=\":F0,\">\":k0,\"<\":T0,\">=\":C0,\"<=\":I0,array:Ie,at:u0,boolean:Ie,case:f0,coalesce:Hp,collator:Qp,format:Vp,image:B0,in:h0,\"index-of\":c0,interpolate:be,\"interpolate-hcl\":be,\"interpolate-lab\":be,length:P0,let:Up,literal:ti,match:p0,number:Ie,\"number-format\":M0,object:Ie,semiliteral:im,slice:d0,step:ml,string:Ie,\"to-boolean\":Ur,\"to-color\":Ur,\"to-number\":Ur,\"to-string\":Ur,var:jp,within:vl,distance:_l,\"global-state\":Al},ge=class extends Error{constructor(t,e){super(e),this.message=e,this.key=t}},nm=class pf{constructor(e,r=[]){this.parent=e,this.bindings={};for(let[i,n]of r)this.bindings[i]=n}concat(e){return new pf(this,e)}get(e){if(this.bindings[e])return this.bindings[e];if(this.parent)return this.parent.get(e);throw Error(`${e} not found in scope.`)}has(e){return this.bindings[e]?!0:this.parent?this.parent.has(e):!1}},ff=class df{constructor(e,r,i=[],n,a=new nm,s=[]){this.registry=e,this.path=i,this.key=i.map(o=>`[${o}]`).join(\"\"),this.scope=a,this.errors=s,this.expectedType=n,this._isConstant=r}parse(e,r,i,n,a={}){return r?this.concat(r,i,n)._parse(e,a):this._parse(e,a)}_parse(e,r){(e===null||typeof e==\"string\"||typeof e==\"boolean\"||typeof e==\"number\")&&(e=[\"literal\",e]);let i=this.key;function n(a,s,o){return o===\"assert\"?new Ie(s,[a],i):o===\"coerce\"?new Ur(s,[a],i):a}if(Array.isArray(e)){if(e.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use [\"literal\", []].');let a=e[0];if(typeof a!=\"string\")return this.error(`Expression name must be a string, but found ${typeof a} instead. If you wanted a literal array, use [\"literal\", [...]].`,0),null;let s=this.registry[a];if(s){let o=s.parse(e,this);if(!o)return null;if(this.expectedType){let l=this.expectedType,u=o.type;if((l.kind===\"string\"||l.kind===\"number\"||l.kind===\"boolean\"||l.kind===\"object\"||l.kind===\"array\")&&u.kind===\"value\")o=n(o,l,r.typeAnnotation||\"assert\");else if(l.kind===\"projectionDefinition\"&&[\"string\",\"array\",\"value\"].includes(u.kind)||[\"color\",\"formatted\",\"resolvedImage\"].includes(l.kind)&&[\"value\",\"string\"].includes(u.kind)||[\"padding\",\"numberArray\"].includes(l.kind)&&[\"value\",\"number\",\"array\"].includes(u.kind)||l.kind===\"colorArray\"&&[\"value\",\"string\",\"array\"].includes(u.kind)||l.kind===\"variableAnchorOffsetCollection\"&&[\"value\",\"array\"].includes(u.kind))o=n(o,l,r.typeAnnotation||\"coerce\");else if(this.checkSubtype(l,u))return null}if(!(o instanceof ti)&&o.type.kind!==\"resolvedImage\"&&this._isConstant(o)){let l=new zp;try{o=new ti(o.type,o.evaluate(l))}catch(u){return this.error(u.message),null}}return o}return this.error(`Unknown expression \"${a}\". If you wanted a literal array, use [\"literal\", [...]].`,0)}return e===void 0?this.error(\"'undefined' value invalid. Use null instead.\"):typeof e==\"object\"?this.error('Bare objects invalid. Use [\"literal\", {...}] instead.'):this.error(`Expected an array, but found ${typeof e} instead.`)}concat(e,r,i){let n=typeof e==\"number\"?this.path.concat(e):this.path,a=i?this.scope.concat(i):this.scope;return new df(this.registry,this._isConstant,n,r||null,a,this.errors)}error(e,...r){let i=`${this.key}${r.map(n=>`[${n}]`).join(\"\")}`;this.errors.push(new ge(i,e))}checkSubtype(e,r){let i=Ki(e,r);return i&&this.error(i),i}},wr=class Li{constructor(e,r,i,n,a){this.name=e,this.type=r,this._evaluate=i,this.args=n,this.key=a}evaluate(e){return this._evaluate(e,this.args,this.key)}eachChild(e){this.args.forEach(e)}outputDefined(){return!1}static parse(e,r){let i=e[0],n=Li.definitions[i];if(!n)return r.error(`Unknown expression \"${i}\". If you wanted a literal array, use [\"literal\", [...]].`,0);let a=Array.isArray(n)?n[0]:n.type,s=Array.isArray(n)?[[n[1],n[2]]]:n.overloads,o=s.filter(([u])=>!Array.isArray(u)||u.length===e.length-1),l=null;for(let[u,h]of o){l=new ff(r.registry,da,r.path,null,r.scope);let c=[],p=!1;for(let f=1;f<e.length;f++){let d=e[f],y=Array.isArray(u)?u[f-1]:u.type,m=l.parse(d,1+c.length,y);if(!m){p=!0;break}c.push(m)}if(!p){if(Array.isArray(u)&&u.length!==c.length){l.error(`Expected ${u.length} arguments, but found ${c.length} instead.`);continue}for(let f=0;f<c.length;f++){let d=Array.isArray(u)?u[f]:u.type,y=c[f];l.concat(f+1).checkSubtype(d,y.type)}if(l.errors.length===0)return new Li(i,a,h,c,r.key)}}if(o.length===1)r.errors.push(...l.errors);else{let u=(o.length?o:s).map(([c])=>sm(c)).join(\" | \"),h=[];for(let c=1;c<e.length;c++){let p=r.parse(e[c],1+h.length);if(!p)return null;h.push(yt(p.type))}r.error(`Expected arguments of type ${u}, but found (${h.join(\", \")}) instead.`)}return null}static register(e,r){Li.definitions=r;for(let i in r)e[i]=Li}};function wh(t,[e,r,i,n],a){e=e.evaluate(t),r=r.evaluate(t),i=i.evaluate(t);let s=n?n.evaluate(t):1,o=Bp(e,r,i,s);if(o)throw new ct(o,a);return new gt(e/255,r/255,i/255,s,!1)}function Dh(t,e){return t in e&&e[t]!==void 0}function Ms(t,e){let r=e[t];return r===void 0?null:r}function am(t,e,r,i){for(;r<=i;){let n=r+i>>1;if(e[n]===t)return!0;e[n]>t?i=n-1:r=n+1}return!1}function ar(t){return{type:t}}wr.register(Gr,{error:[G1,[X],(t,[e],r)=>{throw new ct(e.evaluate(t),r)}],typeof:[X,[H],(t,[e])=>yt(At(e.evaluate(t)))],\"to-rgba\":[Nt(k,4),[ue],(t,[e])=>{let[r,i,n,a]=e.evaluate(t).rgb;return[r*255,i*255,n*255,a]}],rgb:[ue,[k,k,k],wh],rgba:[ue,[k,k,k,k],wh],has:{type:tt,overloads:[[[X],(t,[e])=>Dh(e.evaluate(t),t.properties())],[[X,cr],(t,[e,r])=>Dh(e.evaluate(t),r.evaluate(t))]]},get:{type:H,overloads:[[[X],(t,[e])=>Ms(e.evaluate(t),t.properties())],[[X,cr],(t,[e,r])=>Ms(e.evaluate(t),r.evaluate(t))]]},\"feature-state\":[H,[X],(t,[e])=>Ms(e.evaluate(t),t.featureState||{})],properties:[cr,[],t=>t.properties()],\"geometry-type\":[X,[],t=>t.geometryType()],id:[H,[],t=>t.id()],zoom:[k,[],t=>t.globals.zoom],\"heatmap-density\":[k,[],t=>t.globals.heatmapDensity||0],elevation:[k,[],t=>t.globals.elevation||0],\"line-progress\":[k,[],t=>t.globals.lineProgress||0],accumulated:[H,[],t=>t.globals.accumulated===void 0?null:t.globals.accumulated],\"+\":[k,ar(k),(t,e)=>{let r=0;for(let i of e)r+=i.evaluate(t);return r}],\"*\":[k,ar(k),(t,e)=>{let r=1;for(let i of e)r*=i.evaluate(t);return r}],\"-\":{type:k,overloads:[[[k,k],(t,[e,r])=>e.evaluate(t)-r.evaluate(t)],[[k],(t,[e])=>-e.evaluate(t)]]},\"/\":[k,[k,k],(t,[e,r])=>e.evaluate(t)/r.evaluate(t)],\"%\":[k,[k,k],(t,[e,r])=>e.evaluate(t)%r.evaluate(t)],ln2:[k,[],()=>Math.LN2],pi:[k,[],()=>Math.PI],e:[k,[],()=>Math.E],\"^\":[k,[k,k],(t,[e,r])=>e.evaluate(t)**+r.evaluate(t)],sqrt:[k,[k],(t,[e])=>Math.sqrt(e.evaluate(t))],log10:[k,[k],(t,[e])=>Math.log(e.evaluate(t))/Math.LN10],ln:[k,[k],(t,[e])=>Math.log(e.evaluate(t))],log2:[k,[k],(t,[e])=>Math.log(e.evaluate(t))/Math.LN2],sin:[k,[k],(t,[e])=>Math.sin(e.evaluate(t))],cos:[k,[k],(t,[e])=>Math.cos(e.evaluate(t))],tan:[k,[k],(t,[e])=>Math.tan(e.evaluate(t))],asin:[k,[k],(t,[e])=>Math.asin(e.evaluate(t))],acos:[k,[k],(t,[e])=>Math.acos(e.evaluate(t))],atan:[k,[k],(t,[e])=>Math.atan(e.evaluate(t))],min:[k,ar(k),(t,e)=>Math.min(...e.map(r=>r.evaluate(t)))],max:[k,ar(k),(t,e)=>Math.max(...e.map(r=>r.evaluate(t)))],abs:[k,[k],(t,[e])=>Math.abs(e.evaluate(t))],round:[k,[k],(t,[e])=>{let r=e.evaluate(t);return r<0?-Math.round(-r):Math.round(r)}],floor:[k,[k],(t,[e])=>Math.floor(e.evaluate(t))],ceil:[k,[k],(t,[e])=>Math.ceil(e.evaluate(t))],\"filter-==\":[tt,[X,H],(t,[e,r])=>t.properties()[e.value]===r.value],\"filter-id-==\":[tt,[H],(t,[e])=>t.id()===e.value],\"filter-type-==\":[tt,[X],(t,[e])=>t.geometryType()===e.value],\"filter-<\":[tt,[X,H],(t,[e,r])=>{let i=t.properties()[e.value],n=r.value;return typeof i==typeof n&&i<n}],\"filter-id-<\":[tt,[H],(t,[e])=>{let r=t.id(),i=e.value;return typeof r==typeof i&&r<i}],\"filter->\":[tt,[X,H],(t,[e,r])=>{let i=t.properties()[e.value],n=r.value;return typeof i==typeof n&&i>n}],\"filter-id->\":[tt,[H],(t,[e])=>{let r=t.id(),i=e.value;return typeof r==typeof i&&r>i}],\"filter-<=\":[tt,[X,H],(t,[e,r])=>{let i=t.properties()[e.value],n=r.value;return typeof i==typeof n&&i<=n}],\"filter-id-<=\":[tt,[H],(t,[e])=>{let r=t.id(),i=e.value;return typeof r==typeof i&&r<=i}],\"filter->=\":[tt,[X,H],(t,[e,r])=>{let i=t.properties()[e.value],n=r.value;return typeof i==typeof n&&i>=n}],\"filter-id->=\":[tt,[H],(t,[e])=>{let r=t.id(),i=e.value;return typeof r==typeof i&&r>=i}],\"filter-has\":[tt,[H],(t,[e])=>{let r=e.value,i=t.properties();return r in i&&i[r]!==void 0}],\"filter-has-id\":[tt,[],t=>t.id()!==null&&t.id()!==void 0],\"filter-type-in\":[tt,[Nt(X)],(t,[e])=>e.value.indexOf(t.geometryType())>=0],\"filter-id-in\":[tt,[Nt(H)],(t,[e])=>e.value.indexOf(t.id())>=0],\"filter-in-small\":[tt,[X,Nt(H)],(t,[e,r])=>r.value.indexOf(t.properties()[e.value])>=0],\"filter-in-large\":[tt,[X,Nt(H)],(t,[e,r])=>am(t.properties()[e.value],r.value,0,r.value.length-1)],all:{type:tt,overloads:[[[tt,tt],(t,[e,r])=>e.evaluate(t)&&r.evaluate(t)],[ar(tt),(t,e)=>{for(let r of e)if(!r.evaluate(t))return!1;return!0}]]},any:{type:tt,overloads:[[[tt,tt],(t,[e,r])=>e.evaluate(t)||r.evaluate(t)],[ar(tt),(t,e)=>{for(let r of e)if(r.evaluate(t))return!0;return!1}]]},\"!\":[tt,[tt],(t,[e])=>!e.evaluate(t)],\"is-supported-script\":[tt,[X],(t,[e])=>{let r=t.globals&&t.globals.isSupportedScript;return!r||r(e.evaluate(t))}],upcase:[X,[X],(t,[e])=>e.evaluate(t).toUpperCase()],downcase:[X,[X],(t,[e])=>e.evaluate(t).toLowerCase()],concat:[X,ar(H),(t,e)=>e.map(r=>Ui(r.evaluate(t))).join(\"\")],split:[Nt(X),[X,X],(t,[e,r])=>e.evaluate(t).split(r.evaluate(t))],join:[X,[Nt(X),X],(t,[e,r])=>e.evaluate(t).join(r.evaluate(t))],\"resolved-locale\":[X,[Ta],(t,[e])=>e.evaluate(t).resolvedLocale()]});function sm(t){return Array.isArray(t)?`(${t.map(yt).join(\", \")})`:`(${yt(t.type)}...)`}function da(t){if(t instanceof jp)return da(t.boundExpression);if(t instanceof wr&&t.name===\"error\"||t instanceof Qp||t instanceof vl||t instanceof _l||t instanceof Al)return!1;let e=t instanceof Ur||t instanceof Ie,r=!0;return t.eachChild(i=>{r&&(r=e?da(i):i instanceof ti)}),r?za(t)&&La(t,[\"zoom\",\"heatmap-density\",\"elevation\",\"line-progress\",\"accumulated\",\"is-supported-script\"]):!1}function za(t){if(t instanceof wr&&(t.name===\"get\"&&t.args.length===1||t.name===\"feature-state\"||t.name===\"has\"&&t.args.length===1||t.name===\"properties\"||t.name===\"geometry-type\"||t.name===\"id\"||/^filter-/.test(t.name))||t instanceof vl||t instanceof _l)return!1;let e=!0;return t.eachChild(r=>{e&&!za(r)&&(e=!1)}),e}function Qi(t){if(t instanceof wr&&t.name===\"feature-state\")return!1;let e=!0;return t.eachChild(r=>{e&&!Qi(r)&&(e=!1)}),e}function La(t,e){if(t instanceof wr&&e.indexOf(t.name)>=0)return!1;let r=!0;return t.eachChild(i=>{r&&!La(i,e)&&(r=!1)}),r}function ei(t){return t[\"property-type\"]===\"data-driven\"||t[\"property-type\"]===\"cross-faded-data-driven\"}function yf(t){return!!t.expression&&t.expression.parameters.indexOf(\"zoom\")>-1}function Sl(t){return!!t.expression&&t.expression.interpolated}var El=/^(.*)-transition$/;function tn(t,...e){for(let r of e)for(let i in r)t[i]=r[i];return t}function J(t){return t instanceof Number?\"number\":t instanceof String?\"string\":t instanceof Boolean?\"boolean\":Array.isArray(t)?\"array\":t===null?\"null\":typeof t}function Va(t){return typeof t==\"object\"&&!!t&&!Array.isArray(t)&&At(t)===cr}function om(t){return t}function lm(t){switch(t.type){case\"color\":return gt.parse;case\"padding\":return Ae.parse;case\"numberArray\":return Se.parse;case\"colorArray\":return se.parse;default:return null}}function um(t){switch(t){case\"exponential\":return gf;case\"interval\":return cm;case\"categorical\":return hm;case\"identity\":return pm;default:throw Error(`Unknown function type \"${t}\"`)}}function mf(t,e){let r=t.stops&&typeof t.stops[0][0]==\"object\",i=r||t.property!==void 0,n=r||!i,a=t.type||(Sl(e)?\"exponential\":\"interval\"),s=lm(e);if(s&&(t=tn({},t),t.stops&&(t.stops=t.stops.map(h=>[h[0],s(h[1])])),t.default?t.default=s(t.default):t.default=s(e.default)),t.colorSpace&&!e0(t.colorSpace))throw Error(`Unknown color space: \"${t.colorSpace}\"`);let o=um(a),l,u;if(a===\"categorical\"){l=Object.create(null);for(let h of t.stops)l[h[0]]=h[1];u=typeof t.stops[0][0]}if(r){let h={},c=[];for(let d=0;d<t.stops.length;d++){let y=t.stops[d],m=y[0].zoom;h[m]===void 0&&(h[m]={zoom:m,type:t.type,property:t.property,default:t.default,stops:[]},c.push(m)),h[m].stops.push([y[0].value,y[1]])}let p=[];for(let d of c)p.push([h[d].zoom,mf(h[d],e)]);let f={name:\"linear\"};return{kind:\"composite\",interpolationType:f,interpolationFactor:be.interpolationFactor.bind(void 0,f),zoomStops:p.map(d=>d[0]),evaluate({zoom:d},y){return gf({stops:p,base:t.base},e,d).evaluate(d,y)}}}if(n){let h=a===\"exponential\"?{name:\"exponential\",base:t.base===void 0?1:t.base}:null;return{kind:\"camera\",interpolationType:h,interpolationFactor:be.interpolationFactor.bind(void 0,h),zoomStops:t.stops.map(c=>c[0]),evaluate:({zoom:c})=>o(t,e,c,l,u)}}return{kind:\"source\",evaluate(h,c){let p=c&&c.properties?c.properties[t.property]:void 0;return p===void 0?yn(t.default,e.default):o(t,e,p,l,u)}}}function yn(t,e,r){if(t!==void 0)return t;if(e!==void 0)return e;if(r!==void 0)return r}function hm(t,e,r,i,n){return yn(typeof r===n?i[r]:void 0,t.default,e.default)}function cm(t,e,r){if(J(r)!==\"number\")return yn(t.default,e.default);let i=t.stops.length;if(i===1||r<=t.stops[0][0])return t.stops[0][1];if(r>=t.stops[i-1][0])return t.stops[i-1][1];let n=Ma(t.stops.map(a=>a[0]),r,\"\");return t.stops[n][1]}function gf(t,e,r){let i=t.base===void 0?1:t.base;if(J(r)!==\"number\")return yn(t.default,e.default);let n=t.stops.length;if(n===1||r<=t.stops[0][0])return t.stops[0][1];if(r>=t.stops[n-1][0])return t.stops[n-1][1];let a=Ma(t.stops.map(h=>h[0]),r,\"\"),s=fm(r,i,t.stops[a][0],t.stops[a+1][0]),o=t.stops[a][1],l=t.stops[a+1][1],u=yr[e.type]||om;return typeof o.evaluate==\"function\"?{evaluate(...h){let c=o.evaluate.apply(void 0,h),p=l.evaluate.apply(void 0,h);if(c!==void 0&&p!==void 0)return u(c,p,s,t.colorSpace)}}:u(o,l,s,t.colorSpace)}function pm(t,e,r){switch(e.type){case\"color\":r=gt.parse(r);break;case\"formatted\":r=Be.fromString(r.toString());break;case\"resolvedImage\":r=_e.fromString(r.toString());break;case\"padding\":r=Ae.parse(r);break;case\"colorArray\":r=se.parse(r);break;case\"numberArray\":r=Se.parse(r);break;default:J(r)!==e.type&&(e.type!==\"enum\"||!e.values[r])&&(r=void 0)}return yn(r,t.default,e.default)}function fm(t,e,r,i){let n=i-r,a=t-r;return n===0?0:e===1?a/n:(e**+a-1)/(e**+n-1)}function io(t){return{result:\"success\",value:t}}function Rr(t){return{result:\"error\",value:t}}var Fl=class{constructor(t,e,r,i){this.expression=t,this._warningHistory={},this._evaluator=new zp,this._defaultValue=r?_f(r):null,this._enumValues=r&&r.type===\"enum\"?r.values:null,this._globalState=i,this._rootKey=e}evaluateWithoutErrorHandling(t,e,r,i,n,a){return this._globalState&&(t=ri(t,this._globalState)),this._evaluator.globals=t,this._evaluator.feature=e,this._evaluator.featureState=r,this._evaluator.canonical=i,this._evaluator.availableImages=n||null,this._evaluator.formattedSection=a,this.expression.evaluate(this._evaluator)}evaluate(t,e,r,i,n,a){this._globalState&&(t=ri(t,this._globalState)),this._evaluator.globals=t,this._evaluator.feature=e||null,this._evaluator.featureState=r||null,this._evaluator.canonical=i,this._evaluator.availableImages=n||null,this._evaluator.formattedSection=a||null;try{let s=this.expression.evaluate(this._evaluator);if(s==null||typeof s==\"number\"&&s!==s)return this._defaultValue;if(this._enumValues&&!(s in this._enumValues))throw new ct(`Expected value to be one of ${Object.keys(this._enumValues).map(o=>JSON.stringify(o)).join(\", \")}, but found ${JSON.stringify(s)} instead.`,\"\");return s}catch(s){let o=s instanceof ct?s.path:\"\",l=`${o}|${s.message}`;return this._warningHistory[l]||(this._warningHistory[l]=!0,typeof console<\"u\"&&console.warn(xf(this._rootKey,o,s.message,this._defaultValue))),this._defaultValue}}};function xf(t,e,r,i){return`${t}${e}: ${r}${i==null?\"\":` Falling back to ${String(i)}.`}`}function vf(t){if(!t)throw Error('rootKey must identify the location of the expression in the style JSON, e.g. \"layers[3].paint.line-width\".')}function Oa(t){return Array.isArray(t)&&t.length>0&&typeof t[0]==\"string\"&&t[0]in Gr}function tr(t,e,r,i){vf(e);let n=new ff(Gr,da,[],r?mm(r):void 0),a=n.parse(t,void 0,void 0,void 0,r&&r.type===\"string\"?{typeAnnotation:\"coerce\"}:void 0);return a?io(new Fl(a,e,r,i)):Rr(n.errors)}var en=class{constructor(t,e,r){this.kind=t,this._styleExpression=e,this.isStateDependent=t!==\"constant\"&&!Qi(e.expression),this.globalStateRefs=mn(e.expression),this._globalState=r}evaluateWithoutErrorHandling(t,e,r,i,n,a){return this._globalState&&(t=ri(t,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(t,e,r,i,n,a)}evaluate(t,e,r,i,n,a){return this._globalState&&(t=ri(t,this._globalState)),this._styleExpression.evaluate(t,e,r,i,n,a)}},ya=class{constructor(t,e,r,i,n){this.kind=t,this.zoomStops=r,this._styleExpression=e,this.isStateDependent=t!==\"camera\"&&!Qi(e.expression),this.globalStateRefs=mn(e.expression),this.interpolationType=i,this._globalState=n}evaluateWithoutErrorHandling(t,e,r,i,n,a){return this._globalState&&(t=ri(t,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(t,e,r,i,n,a)}evaluate(t,e,r,i,n,a){return this._globalState&&(t=ri(t,this._globalState)),this._styleExpression.evaluate(t,e,r,i,n,a)}interpolationFactor(t,e,r){return this.interpolationType?be.interpolationFactor(this.interpolationType,t,e,r):0}};function dm(t){return t._styleExpression!==void 0}function bf(t,e,r,i){let n=tr(t,e,r,i);if(n.result===\"error\")return n;let a=n.value.expression,s=za(a);if(!s&&!ei(r))return Rr([new ge(\"\",\"data expressions not supported\")]);let o=La(a,[\"zoom\"]);if(!o&&!yf(r))return Rr([new ge(\"\",\"zoom expressions not supported\")]);let l=sa(a);if(!l&&!o)return Rr([new ge(\"\",'\"zoom\" expression may only be used as input to a top-level \"step\" or \"interpolate\" expression.')]);if(l instanceof ge)return Rr([l]);if(l instanceof be&&!Sl(r))return Rr([new ge(\"\",'\"interpolate\" expressions cannot be used with this property')]);if(!l)return io(s?new en(\"constant\",n.value,i):new en(\"source\",n.value,i));let u=l instanceof be?l.interpolation:void 0;return io(s?new ya(\"camera\",n.value,l.labels,u,i):new ya(\"composite\",n.value,l.labels,u,i))}var wf=class Df{constructor(e,r,i){this.isStateDependent=!1,this.globalStateRefs=new Set,this._globalState=null,vf(r),this._parameters=e,this._specification=i,this._rootKey=r,this._defaultValue=_f(i),this._warningHistory={};let n=mf(this._parameters,this._specification);this.kind=n.kind,this.interpolationFactor=n.interpolationFactor,this.zoomStops=n.zoomStops,this.interpolationType=n.interpolationType,this._innerEvaluate=n.evaluate}evaluate(e,r){try{return this._innerEvaluate(e,r)}catch(i){let n=i instanceof Error?i.message:String(i),a=`|${n}`;return this._warningHistory[a]||(this._warningHistory[a]=!0,typeof console<\"u\"&&console.warn(xf(this._rootKey,\"\",n,this._defaultValue))),this._defaultValue}}static deserialize(e){return new Df(e._parameters,e._rootKey,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification,_rootKey:e._rootKey}}};function ym(t,e,r,i){if(Va(t))return new wf(t,e,r);if(Oa(t)){let n=bf(t,e,r,i);if(n.result===\"error\")throw Error(n.value.map(a=>`${a.key}: ${a.message}`).join(\", \"));return n.value}{let n=t;return r.type===\"color\"&&typeof t==\"string\"?n=gt.parse(t):r.type===\"padding\"&&(typeof t==\"number\"||Array.isArray(t))?n=Ae.parse(t):r.type===\"numberArray\"&&(typeof t==\"number\"||Array.isArray(t))?n=Se.parse(t):r.type===\"colorArray\"&&(typeof t==\"string\"||Array.isArray(t))?n=se.parse(t):r.type===\"variableAnchorOffsetCollection\"&&Array.isArray(t)?n=De.parse(t):r.type===\"projectionDefinition\"&&typeof t==\"string\"&&(n=br.parse(t)),{globalStateRefs:new Set,_globalState:null,kind:\"constant\",evaluate:()=>n}}}function sa(t){let e=null;if(t instanceof Up)e=sa(t.result);else if(t instanceof Hp){for(let r of t.args)if(e=sa(r),e)break}else(t instanceof ml||t instanceof be)&&t.input instanceof wr&&t.input.name===\"zoom\"&&(e=t);return e instanceof ge||t.eachChild(r=>{let i=sa(r);i instanceof ge?e=i:!e&&i?e=new ge(\"\",'\"zoom\" expression may only be used as input to a top-level \"step\" or \"interpolate\" expression.'):e&&i&&e!==i&&(e=new ge(\"\",'Only one zoom-based \"step\" or \"interpolate\" subexpression may be used in an expression.'))}),e}function mn(t,e=new Set){return t instanceof Al&&e.add(t.key),t.eachChild(r=>{mn(r,e)}),e}function mm(t){let e={color:ue,string:X,number:k,enum:X,boolean:tt,formatted:pn,padding:ka,numberArray:Ia,colorArray:Hi,projectionDefinition:Fa,resolvedImage:fn,variableAnchorOffsetCollection:Ca};return t.type===\"array\"?Nt(e[t.value]||H,t.length):e[t.type]}function _f(t){if(t.type===\"color\"&&Va(t.default))return new gt(0,0,0,0);switch(t.type){case\"color\":return gt.parse(t.default)||null;case\"padding\":return Ae.parse(t.default)||null;case\"numberArray\":return Se.parse(t.default)||null;case\"colorArray\":return se.parse(t.default)||null;case\"variableAnchorOffsetCollection\":return De.parse(t.default)||null;case\"projectionDefinition\":return br.parse(t.default)||null;default:return t.default===void 0?null:t.default}}function ri(t,e){let{zoom:r,heatmapDensity:i,elevation:n,lineProgress:a,isSupportedScript:s,accumulated:o}=t??{};return{zoom:r,heatmapDensity:i,elevation:n,lineProgress:a,isSupportedScript:s,accumulated:o,globalState:e}}function gm(t){let e=!1;for(let r of t){let i=Af(r);if(i===\"expression\")return\"expression\";i===\"legacy\"&&(e=!0)}return e?\"legacy\":\"neutral\"}function Af(t){if(typeof t==\"boolean\")return\"neutral\";if(!Array.isArray(t)||t.length===0)return\"legacy\";switch(t[0]){case\"has\":return t.length<2||t[1]===\"$id\"||t[1]===\"$type\"?\"legacy\":t.length===2?\"neutral\":\"expression\";case\"in\":return t.length>=3&&(typeof t[1]!=\"string\"||Array.isArray(t[2]))?\"expression\":\"legacy\";case\"!in\":case\"!has\":return\"legacy\";case\"==\":case\"!=\":case\">\":case\">=\":case\"<\":case\"<=\":return t.length!==3||Array.isArray(t[1])||Array.isArray(t[2])?\"expression\":\"legacy\";case\"none\":return\"legacy\";case\"any\":case\"all\":return gm(t.slice(1));default:return\"expression\"}}function Tl(t){return Af(t)!==\"legacy\"}function _h(t){return t===\"$type\"?[\"geometry-type\"]:t===\"$id\"?[\"id\"]:[\"get\",t]}function xm(t){switch(t[0]){case\"==\":case\"!=\":case\"<\":case\"<=\":case\">\":case\">=\":return t.length!==3||typeof t[1]!=\"string\"?null:[t[0],_h(t[1]),t[2]];case\"in\":case\"!in\":{if(t.length<2||typeof t[1]!=\"string\")return null;let e=[\"in\",_h(t[1]),[\"literal\",t.slice(2)]];return t[0]===\"!in\"?[\"!\",e]:e}case\"has\":case\"!has\":{if(t.length!==2||typeof t[1]!=\"string\"||t[1]===\"$type\"||t[1]===\"$id\")return null;let e=[\"has\",t[1]];return t[0]===\"!has\"?[\"!\",e]:e}default:return null}}function Sf(t){if((t[0]===\"<\"||t[0]===\"<=\"||t[0]===\">\"||t[0]===\">=\")&&t[1]===\"$type\")return`\"$type\" cannot be use with operator \"${t[0]}\"`;let e=xm(t);return e?`Mixing deprecated filter syntax with expression syntax is not supported. Replace ${JSON.stringify(t)} with ${JSON.stringify(e)}.`:`Mixing deprecated filter syntax with expression syntax is not supported. Convert ${JSON.stringify(t)} to expression syntax.`}function Bs(t,e,r){let i=r[t];return Array.isArray(i)?Tl(i)?kl(i,e.concat(t)):{path:e.concat(t),legacyFilter:i}:null}function kl(t,e=[]){if(!Array.isArray(t)||t.length<1)return null;switch(t[0]){case\"all\":case\"any\":case\"none\":for(let r=1;r<t.length;r++){let i=Bs(r,e,t);if(i)return i}break;case\"!\":{let r=Bs(1,e,t);if(r)return r;break}case\"case\":for(let r=1;r<t.length-1;r+=2){let i=Bs(r,e,t);if(i)return i}}return null}function vm(t,e){let r=kl(t);if(!r||typeof console>\"u\")return;let i=r.path.map(n=>`[${n}]`).join(\"\");console.warn(`${e}${i}: ${Sf(r.legacyFilter)}`)}var bm={type:\"boolean\",default:!1,transition:!1,\"property-type\":\"data-driven\",expression:{interpolated:!1,parameters:[\"zoom\",\"feature\"]}};function ii(t,e,r){if(t==null)return{filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set};Tl(t)?vm(t,e):t=ma(t);let i=tr(t,e,bm,r);if(i.result===\"error\")throw Error(i.value.map(n=>`${n.key}: ${n.message}`).join(\", \"));return{filter:(n,a,s)=>i.value.evaluate(n,a,{},s),needGeometry:Ef(t),getGlobalStateRefs:()=>mn(i.value.expression)}}function wm(t,e){return t<e?-1:+(t>e)}function Ef(t){if(!Array.isArray(t))return!1;if(t[0]===\"within\"||t[0]===\"distance\")return!0;for(let e=1;e<t.length;e++)if(Ef(t[e]))return!0;return!1}function ma(t){if(!t)return!0;let e=t[0];return t.length<=1?e!==\"any\":e===\"==\"?Ps(t[1],t[2],\"==\"):e===\"!=\"?Un(Ps(t[1],t[2],\"==\")):e===\"<\"||e===\">\"||e===\"<=\"||e===\">=\"?Ps(t[1],t[2],e):e===\"any\"?Dm(t.slice(1)):e===\"all\"?[\"all\"].concat(t.slice(1).map(ma)):e===\"none\"?[\"all\"].concat(t.slice(1).map(ma).map(Un)):e===\"in\"?Ah(t[1],t.slice(2)):e===\"!in\"?Un(Ah(t[1],t.slice(2))):e===\"has\"?Sh(t[1]):e!==\"!has\"||Un(Sh(t[1]))}function Ps(t,e,r){switch(t){case\"$type\":return[`filter-type-${r}`,e];case\"$id\":return[`filter-id-${r}`,e];default:return[`filter-${r}`,t,e]}}function Dm(t){return[\"any\"].concat(t.map(ma))}function Ah(t,e){if(e.length===0)return!1;switch(t){case\"$type\":return[\"filter-type-in\",[\"literal\",e]];case\"$id\":return[\"filter-id-in\",[\"literal\",e]];default:return e.length>200&&!e.some(r=>typeof r!=typeof e[0])?[\"filter-in-large\",t,[\"literal\",e.sort(wm)]]:[\"filter-in-small\",t,[\"literal\",e]]}}function Sh(t){switch(t){case\"$type\":return!0;case\"$id\":return[\"filter-has-id\"];default:return[\"filter-has\",t]}}function Un(t){return[\"!\",t]}function Ff(t){let e=t.key,r=t.value;return r?[new T(e,r,\"constants have been deprecated as of v8\")]:[]}function Dt(t){return t instanceof Number||t instanceof String||t instanceof Boolean?t.valueOf():t}function mr(t){if(Array.isArray(t))return t.map(mr);if(t instanceof Object&&!(t instanceof Number||t instanceof String||t instanceof Boolean)){let e={};for(let r in t)e[r]=mr(t[r]);return e}return Dt(t)}function Jt(t){let e=t.key,r=t.value,i=t.valueSpec||{},n=t.objectElementValidators||{},a=t.style,s=t.styleSpec,o=t.validateSpec,l=[],u=J(r);if(u!==\"object\")return[new T(e,r,`object expected, ${u} found`)];for(let h in r){let c=h.split(\".\")[0],p=Ni(i,c)||i[\"*\"],f;if(Ni(n,c))f=n[c];else if(Ni(i,c)){if(r[h]===void 0)continue;f=o}else if(n[\"*\"])f=n[\"*\"];else if(i[\"*\"])f=o;else{l.push(new T(e,r[h],`unknown property \"${h}\"`));continue}l=l.concat(f({key:(e&&`${e}.`)+h,value:r[h],valueSpec:p,style:a,styleSpec:s,object:r,objectKey:h,validateSpec:o},r))}for(let h in i)n[h]||i[h].required&&i[h].default===void 0&&r[h]===void 0&&l.push(new T(e,r,`missing required property \"${h}\"`));return l}function Il(t){let e=t.value,r=t.valueSpec,i=t.validateSpec,n=t.style,a=t.styleSpec,s=t.key,o=t.arrayElementValidator||i;if(J(e)!==\"array\")return[new T(s,e,`array expected, ${J(e)} found`)];if(r.length&&e.length!==r.length)return[new T(s,e,`array length ${r.length} expected, length ${e.length} found`)];let l={type:r.value,values:r.values};a.$version<7&&(l.function=r.function),J(r.value)===\"object\"&&(l=r.value);let u=[];for(let h=0;h<e.length;h++)u=u.concat(o({array:e,arrayIndex:h,value:e[h],valueSpec:l,validateSpec:t.validateSpec,style:n,styleSpec:a,key:`${s}[${h}]`}));return u}function Ra(t){let e=t.key,r=t.value,i=t.valueSpec,n=J(r);return n===\"number\"&&r!==r&&(n=\"NaN\"),n===\"number\"?\"minimum\"in i&&r<i.minimum?[new T(e,r,`${r} is less than the minimum value ${i.minimum}`)]:\"maximum\"in i&&r>i.maximum?[new T(e,r,`${r} is greater than the maximum value ${i.maximum}`)]:[]:[new T(e,r,`number expected, ${n} found`)]}function Tf(t){let e=t.valueSpec,r=Dt(t.value.type),i,n={},a,s,o=r!==\"categorical\"&&t.value.property===void 0,l=!o,u=J(t.value.stops)===\"array\"&&J(t.value.stops[0])===\"array\"&&J(t.value.stops[0][0])===\"object\",h=Jt({key:t.key,value:t.value,valueSpec:t.styleSpec.function,validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{stops:c,default:d}});return r===\"identity\"&&o&&h.push(new T(t.key,t.value,'missing required property \"property\"')),r!==\"identity\"&&!t.value.stops&&h.push(new T(t.key,t.value,'missing required property \"stops\"')),r===\"exponential\"&&t.valueSpec.expression&&!Sl(t.valueSpec)&&h.push(new T(t.key,t.value,\"exponential functions not supported\")),t.styleSpec.$version>=8&&(l&&!ei(t.valueSpec)?h.push(new T(t.key,t.value,\"property functions not supported\")):o&&!yf(t.valueSpec)&&h.push(new T(t.key,t.value,\"zoom functions not supported\"))),(r===\"categorical\"||u)&&t.value.property===void 0&&h.push(new T(t.key,t.value,'\"property\" property is required')),h;function c(y){if(r===\"identity\")return[new T(y.key,y.value,'identity function may not have a \"stops\" property')];let m=[],g=y.value;return m=m.concat(Il({key:y.key,value:g,valueSpec:y.valueSpec,validateSpec:y.validateSpec,style:y.style,styleSpec:y.styleSpec,arrayElementValidator:p})),J(g)===\"array\"&&g.length===0&&m.push(new T(y.key,g,\"array must have at least one stop\")),m}function p(y){let m=[],g=y.value,x=y.key;if(J(g)!==\"array\")return[new T(x,g,`array expected, ${J(g)} found`)];if(g.length!==2)return[new T(x,g,`array length 2 expected, length ${g.length} found`)];if(u){if(J(g[0])!==\"object\")return[new T(x,g,`object expected, ${J(g[0])} found`)];if(g[0].zoom===void 0)return[new T(x,g,\"object stop key must have zoom\")];if(g[0].value===void 0)return[new T(x,g,\"object stop key must have value\")];if(s&&s>Dt(g[0].zoom))return[new T(x,g[0].zoom,\"stop zoom values must appear in ascending order\")];Dt(g[0].zoom)!==s&&(s=Dt(g[0].zoom),a=void 0,n={}),m=m.concat(Jt({key:`${x}[0]`,value:g[0],valueSpec:{zoom:{}},validateSpec:y.validateSpec,style:y.style,styleSpec:y.styleSpec,objectElementValidators:{zoom:Ra,value:f}}))}else m=m.concat(f({key:`${x}[0]`,value:g[0],valueSpec:{},validateSpec:y.validateSpec,style:y.style,styleSpec:y.styleSpec},g));return Oa(mr(g[1]))?m.concat([new T(`${x}[1]`,g[1],\"expressions are not allowed in function stops.\")]):m.concat(y.validateSpec({key:`${x}[1]`,value:g[1],valueSpec:e,validateSpec:y.validateSpec,style:y.style,styleSpec:y.styleSpec}))}function f(y,m){let g=J(y.value),x=Dt(y.value),b=y.value===null?m:y.value;if(!i)i=g;else if(g!==i)return[new T(y.key,b,`${g} stop domain type must match previous stop domain type ${i}`)];if(g!==\"number\"&&g!==\"string\"&&g!==\"boolean\")return[new T(y.key,b,\"stop domain value must be a number, string, or boolean\")];if(g!==\"number\"&&r!==\"categorical\"){let v=`number expected, ${g} found`;return ei(e)&&r===void 0&&(v+='\\nIf you intended to use a categorical function, specify `\"type\": \"categorical\"`.'),[new T(y.key,b,v)]}return r===\"categorical\"&&g===\"number\"&&(!isFinite(x)||Math.floor(x)!==x)?[new T(y.key,b,`integer expected, found ${x}`)]:r!==\"categorical\"&&g===\"number\"&&a!==void 0&&x<a?[new T(y.key,b,\"stop domain values must appear in ascending order\")]:(a=x,r===\"categorical\"&&x in n?[new T(y.key,b,\"stop domain values must be unique\")]:(n[x]=!0,[]))}function d(y){return y.validateSpec({key:y.key,value:y.value,valueSpec:e,validateSpec:y.validateSpec,style:y.style,styleSpec:y.styleSpec})}}function ni(t){let e=(t.expressionContext===\"property\"?bf:tr)(mr(t.value),t.key,t.valueSpec);if(e.result===\"error\")return e.value.map(i=>new T(`${t.key}${i.key}`,t.value,i.message));let r=e.value.expression||e.value._styleExpression.expression;if(t.expressionContext===\"property\"&&t.propertyKey===\"text-font\"&&!r.outputDefined())return[new T(t.key,t.value,`Invalid data expression for \"${t.propertyKey}\". Output values must be contained as literals within the expression.`)];if(t.expressionContext===\"property\"&&t.propertyType===\"layout\"&&!Qi(r))return[new T(t.key,t.value,'\"feature-state\" data expressions are not supported with layout properties.')];if(t.expressionContext===\"filter\"&&!Qi(r))return[new T(t.key,t.value,'\"feature-state\" data expressions are not supported with filters.')];if(t.expressionContext&&t.expressionContext.indexOf(\"cluster\")===0){if(!La(r,[\"zoom\",\"feature-state\"]))return[new T(t.key,t.value,'\"zoom\" and \"feature-state\" expressions are not supported with cluster properties.')];if(t.expressionContext===\"cluster-initial\"&&!za(r))return[new T(t.key,t.value,\"Feature data expressions are not supported with initial expression part of cluster properties.\")]}return[]}function _m(t){let e=t.value,r=t.key,i=J(e);return i===\"boolean\"?[]:[new T(r,e,`boolean expected, ${i} found`)]}function no(t){let e=t.key,r=t.value,i=J(r);return i===\"string\"?gt.parse(String(r))?[]:[new T(e,r,`color expected, \"${r}\" found`)]:[new T(e,r,`color expected, ${i} found`)]}function rn(t){let e=t.key,r=t.value,i=t.valueSpec,n=[];return Array.isArray(i.values)?i.values.indexOf(Dt(r))===-1&&n.push(new T(e,r,`expected one of [${i.values.join(\", \")}], ${JSON.stringify(r)} found`)):Object.keys(i.values).indexOf(Dt(r))===-1&&n.push(new T(e,r,`expected one of [${Object.keys(i.values).join(\", \")}], ${JSON.stringify(r)} found`)),n}function Am(t,e){let r=t;for(let i of e)r=r[i];return r}function Sm(t,e){let r=kl(e);return r?[new T(`${t.key}${r.path.map(i=>`[${i}]`).join(\"\")}`,Am(t.value,r.path),Sf(r.legacyFilter),null,\"warning\")]:[]}function Cl(t){let e=mr(t.value);return Tl(e)?[...Sm(t,e),...ni(tn({},t,{expressionContext:\"filter\",valueSpec:{value:\"boolean\"}}))]:kf(t)}function kf(t){let e=t.value,r=t.key;if(J(e)!==\"array\")return[new T(r,e,`array expected, ${J(e)} found`)];let i=t.styleSpec,n,a=[];if(e.length<1)return[new T(r,e,\"filter array must have at least 1 element\")];switch(a=a.concat(rn({key:`${r}[0]`,value:e[0],valueSpec:i.filter_operator,style:t.style,styleSpec:t.styleSpec})),Dt(e[0])){case\"<\":case\"<=\":case\">\":case\">=\":e.length>=2&&Dt(e[1])===\"$type\"&&a.push(new T(r,e,`\"$type\" cannot be use with operator \"${e[0]}\"`));case\"==\":case\"!=\":e.length!==3&&a.push(new T(r,e,`filter array for operator \"${e[0]}\" must have 3 elements`));case\"in\":case\"!in\":e.length>=2&&(n=J(e[1]),n!==\"string\"&&a.push(new T(`${r}[1]`,e[1],`string expected, ${n} found`)));for(let s=2;s<e.length;s++)n=J(e[s]),Dt(e[1])===\"$type\"?a=a.concat(rn({key:`${r}[${s}]`,value:e[s],valueSpec:i.geometry_type,style:t.style,styleSpec:t.styleSpec})):n!==\"string\"&&n!==\"number\"&&n!==\"boolean\"&&a.push(new T(`${r}[${s}]`,e[s],`string, number, or boolean expected, ${n} found`));break;case\"any\":case\"all\":case\"none\":for(let s=1;s<e.length;s++)a=a.concat(kf({key:`${r}[${s}]`,value:e[s],style:t.style,styleSpec:t.styleSpec}));break;case\"has\":case\"!has\":n=J(e[1]),e.length===2?n!==\"string\"&&a.push(new T(`${r}[1]`,e[1],`string expected, ${n} found`)):a.push(new T(r,e,`filter array for \"${e[0]}\" operator must have 2 elements`))}return a}function If(t,e){let r=t.key,i=t.validateSpec,n=t.style,a=t.styleSpec,s=t.value,o=t.objectKey,l=a[`${e}_${t.layerType}`];if(!l)return[];let u=o.match(El);if(e===\"paint\"&&u&&l[u[1]]&&l[u[1]].transition)return i({key:r,value:s,valueSpec:a.transition,style:n,styleSpec:a});let h=t.valueSpec||l[o];if(!h)return[new T(r,s,`unknown property \"${o}\"`)];let c;if(J(s)===\"string\"&&ei(h)&&!h.tokens&&(c=/^{([^}]+)}$/.exec(s)))return[new T(r,s,`\"${o}\" does not support interpolation syntax\nUse an identity property function instead: \\`{ \"type\": \"identity\", \"property\": ${JSON.stringify(c[1])} }\\`.`)];let p=[];return t.layerType===\"symbol\"&&o===\"text-font\"&&Va(mr(s))&&Dt(s.type)===\"identity\"&&p.push(new T(r,s,'\"text-font\" does not support identity functions')),p.concat(i({key:t.key,value:s,valueSpec:h,style:n,styleSpec:a,expressionContext:\"property\",propertyType:e,propertyKey:o}))}function Cf(t){return If(t,\"paint\")}function Mf(t){return If(t,\"layout\")}function Bf(t){let e=[],r=t.value,i=t.key,n=t.style,a=t.styleSpec;if(J(r)!==\"object\")return[new T(i,r,`object expected, ${J(r)} found`)];!r.type&&!r.ref&&e.push(new T(i,r,'either \"type\" or \"ref\" is required'));let s=Dt(r.type),o=Dt(r.ref);if(r.id){let l=Dt(r.id);for(let u=0;u<t.arrayIndex;u++){let h=n.layers[u];Dt(h.id)===l&&e.push(new T(i,r.id,`duplicate layer id \"${r.id}\", previously used at line ${h.id.__line__}`))}}if(\"ref\"in r){[\"type\",\"source\",\"source-layer\",\"filter\",\"layout\"].forEach(u=>{u in r&&e.push(new T(i,r[u],`\"${u}\" is prohibited for ref layers`))});let l;n.layers.forEach(u=>{Dt(u.id)===o&&(l=u)}),l?l.ref?e.push(new T(i,r.ref,\"ref cannot reference another ref layer\")):s=Dt(l.type):e.push(new T(i,r.ref,`ref layer \"${o}\" not found`))}else if(s!==\"background\")if(!r.source)e.push(new T(i,r,'missing required property \"source\"'));else{let l=n.sources&&n.sources[r.source],u=l&&Dt(l.type);l?u===\"vector\"&&s===\"raster\"?e.push(new T(i,r.source,`layer \"${r.id}\" requires a raster source`)):u!==\"raster-dem\"&&s===\"hillshade\"||u!==\"raster-dem\"&&s===\"color-relief\"?e.push(new T(i,r.source,`layer \"${r.id}\" requires a raster-dem source`)):u===\"raster\"&&s!==\"raster\"?e.push(new T(i,r.source,`layer \"${r.id}\" requires a vector source`)):u===\"vector\"&&!r[\"source-layer\"]?e.push(new T(i,r,`layer \"${r.id}\" must specify a \"source-layer\"`)):u===\"raster-dem\"&&s!==\"hillshade\"&&s!==\"color-relief\"?e.push(new T(i,r.source,\"raster-dem source can only be used with layer type 'hillshade' or 'color-relief'.\")):s===\"line\"&&r.paint&&r.paint[\"line-gradient\"]&&(u!==\"geojson\"||!l.lineMetrics)&&e.push(new T(i,r,`layer \"${r.id}\" specifies a line-gradient, which requires a GeoJSON source with \\`lineMetrics\\` enabled.`)):e.push(new T(i,r.source,`source \"${r.source}\" not found`))}return s===\"raster\"&&r.paint?.resampling&&r.paint?.[\"raster-resampling\"]&&e.push(new T(i,r.paint,`layer \"${r.id}\" redundantly specifies \"resampling\" and \"raster-resampling\" paint properties, but only one is allowed. It is advised to use \"resampling\".`)),e=e.concat(Jt({key:i,value:r,valueSpec:a.layer,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,objectElementValidators:{\"*\"(){return[]},type(){return t.validateSpec({key:`${i}.type`,value:r.type,valueSpec:a.layer.type,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,object:r,objectKey:\"type\"})},filter:Cl,layout(l){return Jt({layer:r,key:l.key,value:l.value,style:l.style,styleSpec:l.styleSpec,validateSpec:l.validateSpec,objectElementValidators:{\"*\"(u){return Mf(tn({layerType:s},u))}}})},paint(l){return Jt({layer:r,key:l.key,value:l.value,style:l.style,styleSpec:l.styleSpec,validateSpec:l.validateSpec,objectElementValidators:{\"*\"(u){return Cf(tn({layerType:s},u))}}})}}})),e}function Je(t){let e=t.value,r=t.key,i=J(e);return i===\"string\"?[]:[new T(r,e,`string expected, ${i} found`)]}function Em(t){let e=t.sourceName??\"\",r=t.value,i=t.styleSpec,n=i.source_raster_dem,a=t.style,s=[],o=J(r);if(r===void 0)return s;if(o!==\"object\")return s.push(new T(\"source_raster_dem\",r,`object expected, ${o} found`)),s;let l=Dt(r.encoding)===\"custom\",u=[\"redFactor\",\"greenFactor\",\"blueFactor\",\"baseShift\"],h=t.value.encoding?`\"${t.value.encoding}\"`:\"Default\";for(let c in r)!l&&u.includes(c)?s.push(new T(c,r[c],`In \"${e}\": \"${c}\" is only valid when \"encoding\" is set to \"custom\". ${h} encoding found`)):n[c]?s=s.concat(t.validateSpec({key:c,value:r[c],valueSpec:n[c],validateSpec:t.validateSpec,style:a,styleSpec:i})):s.push(new T(c,r[c],`unknown property \"${c}\"`));return s}var Eh={promoteId:Fm};function Pf(t){let e=t.value,r=t.key,i=t.styleSpec,n=t.style,a=t.validateSpec;if(!e.type)return[new T(r,e,'\"type\" is required')];let s=Dt(e.type),o;switch(s){case\"vector\":case\"raster\":return o=Jt({key:r,value:e,valueSpec:i[`source_${s.replace(\"-\",\"_\")}`],style:t.style,styleSpec:i,objectElementValidators:Eh,validateSpec:a}),o;case\"raster-dem\":return o=Em({sourceName:r,value:e,style:t.style,styleSpec:i,validateSpec:a}),o;case\"geojson\":if(o=Jt({key:r,value:e,valueSpec:i.source_geojson,style:n,styleSpec:i,validateSpec:a,objectElementValidators:Eh}),e.cluster)for(let l in e.clusterProperties){let[u,h]=e.clusterProperties[l],c=typeof u==\"string\"?[u,[\"accumulated\"],[\"get\",l]]:u;o.push(...ni({key:`${r}.${l}.map`,value:h,validateSpec:a,expressionContext:\"cluster-map\"})),o.push(...ni({key:`${r}.${l}.reduce`,value:c,validateSpec:a,expressionContext:\"cluster-reduce\"}))}return o;case\"video\":return Jt({key:r,value:e,valueSpec:i.source_video,style:n,validateSpec:a,styleSpec:i});case\"image\":return Jt({key:r,value:e,valueSpec:i.source_image,style:n,validateSpec:a,styleSpec:i});case\"canvas\":return[new T(r,null,\"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.\",\"source.canvas\")];default:return rn({key:`${r}.type`,value:e.type,valueSpec:{values:[\"vector\",\"raster\",\"raster-dem\",\"geojson\",\"video\",\"image\"]},style:n,validateSpec:a,styleSpec:i})}}function Fm({key:t,value:e}){if(J(e)===\"string\")return Je({key:t,value:e});{let r=[];for(let i in e)r.push(...Je({key:`${t}.${i}`,value:e[i]}));return r}}function zf(t){let e=t.value,r=t.styleSpec,i=r.light,n=t.style,a=[],s=J(e);if(e===void 0)return a;if(s!==\"object\")return a=a.concat([new T(\"light\",e,`object expected, ${s} found`)]),a;for(let o in e){let l=o.match(El);a=l&&i[l[1]]&&i[l[1]].transition?a.concat(t.validateSpec({key:o,value:e[o],valueSpec:r.transition,validateSpec:t.validateSpec,style:n,styleSpec:r})):i[o]?a.concat(t.validateSpec({key:o,value:e[o],valueSpec:i[o],validateSpec:t.validateSpec,style:n,styleSpec:r})):a.concat([new T(o,e[o],`unknown property \"${o}\"`)])}return a}function Lf(t){let e=t.value,r=t.styleSpec,i=r.sky,n=t.style,a=J(e);if(e===void 0)return[];if(a!==\"object\")return[new T(\"sky\",e,`object expected, ${a} found`)];let s=[];for(let o in e){let l=o.match(El);s=l&&i[l[1]]&&i[l[1]].transition?s.concat(t.validateSpec({key:o,value:e[o],valueSpec:r.transition,style:n,styleSpec:r})):i[o]?s.concat(t.validateSpec({key:o,value:e[o],valueSpec:i[o],style:n,styleSpec:r})):s.concat([new T(o,e[o],`unknown property \"${o}\"`)])}return s}function Vf(t){let e=t.value,r=t.styleSpec,i=r.terrain,n=t.style,a=[],s=J(e);if(e===void 0)return a;if(s!==\"object\")return a=a.concat([new T(\"terrain\",e,`object expected, ${s} found`)]),a;for(let o in e)a=i[o]?a.concat(t.validateSpec({key:o,value:e[o],valueSpec:i[o],validateSpec:t.validateSpec,style:n,styleSpec:r})):a.concat([new T(o,e[o],`unknown property \"${o}\"`)]);return a}function Tm(t){return Je(t).length===0?[]:ni(t)}function km(t){return Je(t).length===0?[]:ni(t)}function Im(t){let e=t.key,r=t.value;if(J(r)===\"array\"){if(r.length<1||r.length>4)return[new T(e,r,`padding requires 1 to 4 values; ${r.length} values found`)];let i={type:\"number\"},n=[];for(let a=0;a<r.length;a++)n=n.concat(t.validateSpec({key:`${e}[${a}]`,value:r[a],validateSpec:t.validateSpec,valueSpec:i}));return n}return Ra({key:e,value:r,valueSpec:{}})}function Cm(t){let e=t.key,r=t.value;if(J(r)===\"array\"){let i={type:\"number\"};if(r.length<1)return[new T(e,r,\"array length at least 1 expected, length 0 found\")];let n=[];for(let a=0;a<r.length;a++)n=n.concat(t.validateSpec({key:`${e}[${a}]`,value:r[a],validateSpec:t.validateSpec,valueSpec:i}));return n}return Ra({key:e,value:r,valueSpec:{}})}function Mm(t){let e=t.key,r=t.value;if(J(r)===\"array\"){if(r.length<1)return[new T(e,r,\"array length at least 1 expected, length 0 found\")];let i=[];for(let n=0;n<r.length;n++)i=i.concat(no({key:`${e}[${n}]`,value:r[n],valueSpec:{}}));return i}return no({key:e,value:r,valueSpec:{}})}function Bm(t){let e=t.key,r=t.value,i=J(r),n=t.styleSpec;if(i!==\"array\"||r.length<1||r.length%2!=0)return[new T(e,r,\"variableAnchorOffsetCollection requires a non-empty array of even length\")];let a=[];for(let s=0;s<r.length;s+=2)a=a.concat(rn({key:`${e}[${s}]`,value:r[s],valueSpec:n.layout_symbol[\"text-anchor\"]})),a=a.concat(Il({key:`${e}[${s+1}]`,value:r[s+1],valueSpec:{length:2,value:\"number\"},validateSpec:t.validateSpec,style:t.style,styleSpec:n}));return a}function Of(t){let e=[],r=t.value,i=t.key;if(Array.isArray(r)){let n=[],a=[];for(let s in r)r[s].id&&n.includes(r[s].id)&&e.push(new T(i,r,`all the sprites' ids must be unique, but ${r[s].id} is duplicated`)),n.push(r[s].id),r[s].url&&a.includes(r[s].url)&&e.push(new T(i,r,`all the sprites' URLs must be unique, but ${r[s].url} is duplicated`)),a.push(r[s].url),e=e.concat(Jt({key:`${i}[${s}]`,value:r[s],valueSpec:{id:{type:\"string\",required:!0},url:{type:\"string\",required:!0}},validateSpec:t.validateSpec}));return e}return Je({key:i,value:r})}function Pm(t){let e=t.value,r=t.styleSpec,i=r.projection,n=t.style,a=J(e);if(e===void 0)return[];if(a!==\"object\")return[new T(\"projection\",e,`object expected, ${a} found`)];let s=[];for(let o in e)s=i[o]?s.concat(t.validateSpec({key:o,value:e[o],valueSpec:i[o],style:n,styleSpec:r})):s.concat([new T(o,e[o],`unknown property \"${o}\"`)]);return s}function zm(t){let e=t.key,r=t.value;r=r instanceof String?r.valueOf():r;let i=J(r);return i===\"array\"&&!Vm(r)&&!Lm(r)?[new T(e,r,`projection expected, invalid array ${JSON.stringify(r)} found`)]:[\"array\",\"string\"].includes(i)?[]:[new T(e,r,`projection expected, invalid type \"${i}\" found`)]}function Lm(t){return!![\"interpolate\",\"step\",\"literal\"].includes(t[0])}function Vm(t){return Array.isArray(t)&&t.length===3&&typeof t[0]==\"string\"&&typeof t[1]==\"string\"&&typeof t[2]==\"number\"}function ao(t){return!!t&&t.constructor===Object}function Rf(t){return ao(t.value)?[]:[new T(t.key,t.value,`object expected, ${J(t.value)} found`)]}var Fh=1114111,Om=/^u\\+(?:([0-9a-f]{1,6})(?:-([0-9a-f]{1,6}))?|([0-9a-f]{0,5}\\?{1,6}))$/i;function Rm(t,e){if(J(e)!==\"string\")return[];let r=`${e}`,i=()=>[new T(t,e,'invalid unicode range, expected a value such as \"U+26\", \"U+0-10FFFF\" or \"U+4??\"')],n=r.match(Om);if(!n)return i();let[,a,s,o]=n;if(o!==void 0)return o.length>6?i():[];let l=parseInt(a,16),u=s===void 0?l:parseInt(s,16);return l>Fh||u>Fh?[new T(t,e,\"unicode range is out of bounds, the maximum code point is U+10FFFF\")]:l>u?[new T(t,e,`unicode range start must not be greater than its end, but ${r} is`)]:[]}function $f(t){let e=t.key??\"font-faces\",r=t.value,i=t.validateSpec,n=t.styleSpec??_p,a=t.style;if(!ao(r))return[new T(e,r,`object expected, ${J(r)} found`)];let s=[];for(let o in r){let l=r[o],u=J(l);if(u===\"string\")s.push(...Je({key:`${e}.${o}`,value:l}));else if(u===\"array\"){let h={url:{type:\"string\",required:!0},\"unicode-range\":{type:\"array\",value:\"string\"}};for(let[c,p]of l.entries()){let f=`${e}.${o}[${c}]`;s.push(...Jt({key:f,value:p,valueSpec:h,styleSpec:n,style:a,validateSpec:i}));let d=ao(p)?p[\"unicode-range\"]:void 0;if(J(d)===\"array\")for(let[y,m]of d.entries())s.push(...Rm(`${f}.unicode-range[${y}]`,m))}}else s.push(new T(`${e}.${o}`,l,`string or array expected, ${u} found`))}return s}var Th={\"*\"(){return[]},array:Il,boolean:_m,number:Ra,color:no,constants:Ff,enum:rn,filter:Cl,function:Tf,layer:Bf,object:Jt,source:Pf,light:zf,sky:Lf,terrain:Vf,projection:Pm,projectionDefinition:zm,string:Je,formatted:Tm,resolvedImage:km,padding:Im,numberArray:Cm,colorArray:Mm,variableAnchorOffsetCollection:Bm,sprite:Of,state:Rf,fontFaces:$f};function qi(t){let e=t.value,r=t.valueSpec,i=t.styleSpec;return t.validateSpec=qi,r.expression&&Va(Dt(e))?Tf(t):r.expression&&Oa(mr(e))?ni(t):r.type&&Th[r.type]?Th[r.type](t):Jt(tn({},t,{valueSpec:r.type?i[r.type]:r}))}function Nf(t){let e=t.value,r=t.key,i=Je(t);return i.length||(e.indexOf(\"{fontstack}\")===-1&&i.push(new T(r,e,'\"glyphs\" url must include a \"{fontstack}\" token')),e.indexOf(\"{range}\")===-1&&i.push(new T(r,e,'\"glyphs\" url must include a \"{range}\" token'))),i}function Kt(t,e=D){let r=[];return r=r.concat(qi({key:\"\",value:t,valueSpec:e.$root,styleSpec:e,style:t,validateSpec:qi,objectElementValidators:{glyphs:Nf,\"*\"(){return[]}}})),t.constants&&(r=r.concat(Ff({key:\"constants\",value:t.constants,style:t,styleSpec:e,validateSpec:qi}))),Uf(r)}Kt.source=re(ee(Pf)),Kt.sprite=re(ee(Of)),Kt.glyphs=re(ee(Nf)),Kt.fontFaces=re(ee($f)),Kt.light=re(ee(zf)),Kt.sky=re(ee(Lf)),Kt.terrain=re(ee(Vf)),Kt.state=re(ee(Rf)),Kt.layer=re(ee(Bf)),Kt.filter=re(ee(Cl)),Kt.paintProperty=re(ee(Cf)),Kt.layoutProperty=re(ee(Mf));function ee(t){return function(e){return t(Object.assign({},e,{validateSpec:qi}))}}function Uf(t){return[].concat(t).sort((e,r)=>e.line-r.line)}function re(t){return function(...e){return Uf(t.apply(this,e))}}var $m={type:\"enum\",\"property-type\":\"data-constant\",expression:{interpolated:!1,parameters:[\"global-state\"]},values:{visible:{},none:{}},transition:!1,default:\"visible\"},Nm=class{constructor(t,e,r){this._rootKey=e,this._globalState=r,this.setValue(t)}evaluate(){return this._literalValue??this._compiledValue.evaluate({})}setValue(t){if(t==null||t===\"visible\"||t===\"none\"){this._literalValue=t===\"none\"?\"none\":\"visible\",this._compiledValue=void 0,this._globalStateRefs=new Set;return}let e=tr(t,this._rootKey,$m,this._globalState);if(e.result===\"error\")throw this._literalValue=\"visible\",this._compiledValue=void 0,Error(e.value.map(r=>`${r.key}: ${r.message}`).join(\", \"));this._literalValue=void 0,this._compiledValue=e.value,this._globalStateRefs=mn(e.value.expression)}getGlobalStateRefs(){return this._globalStateRefs}};function Um(t,e,r){return new Nm(t,e,r)}var kh=Kt,n5=new Set(Object.keys(D).filter(t=>t.startsWith(\"source_\")).map(t=>t.slice(7).replaceAll(\"_\",\"-\")));function qm(t,e){let r=!1;for(let i of e){if(i.severity===\"warning\"){Mt(i.message);continue}t.fire(new ha(Error(i.message))),r=!0}return r}function jm(t,e,r,i){return i?.validate!==!1&&qm(t,e({styleSpec:D,...r}))}var so=class qf{constructor(e,r,i){let n=this.cells=[];if(e instanceof ArrayBuffer){this.arrayBuffer=e;let s=new Int32Array(this.arrayBuffer);e=s[0],r=s[1],i=s[2],this.d=r+2*i;for(let u=0;u<this.d*this.d;u++){let h=s[3+u],c=s[3+u+1];n.push(h===c?null:s.subarray(h,c))}let o=s[3+n.length],l=s[3+n.length+1];this.keys=s.subarray(o,l),this.bboxes=s.subarray(l),this.insert=this._insertReadonly}else{this.d=r+2*i;for(let s=0;s<this.d*this.d;s++)n.push([]);this.keys=[],this.bboxes=[]}this.n=r,this.extent=e,this.padding=i,this.scale=r/e,this.uid=0;let a=i/r*e;this.min=-a,this.max=e+a}insert(e,r,i,n,a){this._forEachCell(r,i,n,a,this._insertCell,this.uid++,void 0,void 0),this.keys.push(e),this.bboxes.push(r),this.bboxes.push(i),this.bboxes.push(n),this.bboxes.push(a)}_insertReadonly(){throw Error(\"Cannot insert into a GridIndex created from an ArrayBuffer.\")}_insertCell(e,r,i,n,a,s){this.cells[a].push(s)}query(e,r,i,n,a){let s=this.min,o=this.max;if(e<=s&&r<=s&&o<=i&&o<=n&&!a)return[...this.keys];{let l=[];return this._forEachCell(e,r,i,n,this._queryCell,l,{},a),l}}_queryCell(e,r,i,n,a,s,o,l){let u=this.cells[a];if(u!==null){let h=this.keys,c=this.bboxes;for(let p of u)if(o[p]===void 0){let f=p*4;(l?l(c[f+0],c[f+1],c[f+2],c[f+3]):e<=c[f+2]&&r<=c[f+3]&&i>=c[f+0]&&n>=c[f+1])?(o[p]=!0,s.push(h[p])):o[p]=!1}}}_forEachCell(e,r,i,n,a,s,o,l){let u=this._convertToCellCoord(e),h=this._convertToCellCoord(r),c=this._convertToCellCoord(i),p=this._convertToCellCoord(n);for(let f=u;f<=c;f++)for(let d=h;d<=p;d++){let y=this.d*d+f;if((!l||l(this._convertFromCellCoord(f),this._convertFromCellCoord(d),this._convertFromCellCoord(f+1),this._convertFromCellCoord(d+1)))&&a.call(this,e,r,i,n,y,s,o,l))return}}_convertFromCellCoord(e){return(e-this.padding)/this.scale}_convertToCellCoord(e){return Math.max(0,Math.min(this.d-1,Math.floor(e*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;let e=this.cells,r=3+this.cells.length+1+1,i=0;for(let s of this.cells)i+=s.length;let n=new Int32Array(r+i+this.keys.length+this.bboxes.length);n[0]=this.extent,n[1]=this.n,n[2]=this.padding;let a=r;for(let s=0;s<e.length;s++){let o=e[s];n[3+s]=a,n.set(o,a),a+=o.length}return n[3+e.length]=a,n.set(this.keys,a),a+=this.keys.length,n[3+e.length+1]=a,n.set(this.bboxes,a),a+=this.bboxes.length,n.buffer}static serialize(e,r){let i=e.toArrayBuffer();return r&&r.push(i),{buffer:i}}static deserialize(e){return new qf(e.buffer)}},Ce={};function I(t,e,r={}){if(Ce[t])throw Error(`${t} is already registered.`);Object.defineProperty(e,\"_classRegistryKey\",{value:t,writeable:!1}),Ce[t]={klass:e,omit:r.omit||[],shallow:r.shallow||[]}}I(\"Object\",Object),I(\"Set\",Set),I(\"TransferableGridIndex\",so),I(\"Color\",gt),I(\"Error\",Error),I(\"AJAXError\",ua),I(\"ResolvedImage\",_e),I(\"StylePropertyFunction\",wf),I(\"StyleExpression\",Fl,{omit:[\"_evaluator\"]}),I(\"ZoomDependentExpression\",ya),I(\"ZoomConstantExpression\",en),I(\"CompoundExpression\",wr,{omit:[\"_evaluate\"]});for(let t in Gr)Gr[t]._classRegistryKey||I(`Expression_${t}`,Gr[t]);function jf(t){return t&&typeof ArrayBuffer<\"u\"&&(t instanceof ArrayBuffer||t.constructor?.name===\"ArrayBuffer\")}function Ml(t){let e=t.constructor;return t.$name||e._classRegistryKey}function Gm(t){if(typeof t!=\"object\"||!t)return!1;let e=Ml(t);return e&&e!==\"Object\"}function Gf(t){return!Gm(t)&&(t==null||typeof t==\"boolean\"||typeof t==\"number\"||typeof t==\"string\"||t instanceof Boolean||t instanceof Number||t instanceof String||t instanceof Date||t instanceof RegExp||t instanceof Blob||t instanceof Error||jf(t)||Sa(t)||ArrayBuffer.isView(t)||t instanceof ImageData)}function ji(t,e){if(Gf(t))return(jf(t)||Sa(t))&&e&&e.push(t),ArrayBuffer.isView(t)&&e&&e.push(t.buffer),t instanceof ImageData&&e&&e.push(t.data.buffer),t;if(Array.isArray(t)){let a=[];for(let s of t)a.push(ji(s,e));return a}if(typeof t!=\"object\")throw Error(`can't serialize object of type ${typeof t}`);let r=Ml(t);if(!r)throw Error(`can't serialize object of unregistered class ${t.constructor.name}`);if(!Ce[r])throw Error(`${r} is not registered.`);let{klass:i}=Ce[r],n=i.serialize?i.serialize(t,e):{};if(i.serialize){if(n===e?.[e.length-1])throw Error(\"statically serialized object won't survive transfer of $name property\")}else{for(let a in t){if(!t.hasOwnProperty(a)||Ce[r].omit.includes(a))continue;let s=t[a];s!==void 0&&(n[a]=Ce[r].shallow.includes(a)?s:ji(s,e))}t instanceof Error&&(n.message=t.message)}if(n.$name)throw Error(\"$name property is reserved for worker serialization logic.\");return r!==\"Object\"&&(n.$name=r),n}function Gi(t){if(Gf(t))return t;if(Array.isArray(t))return t.map(Gi);if(typeof t!=\"object\")throw Error(`can't deserialize object of type ${typeof t}`);let e=Ml(t)||\"Object\";if(!Ce[e])throw Error(`can't deserialize unregistered class ${e}`);let{klass:r}=Ce[e];if(!r)throw Error(`can't deserialize unregistered class ${e}`);if(r.deserialize)return r.deserialize(t);let i=Object.create(r.prototype);for(let n of Object.keys(t)){if(n===\"$name\")continue;let a=t[n];i[n]=Ce[e].shallow.includes(n)?a:Gi(a)}return i}var Ih=class{constructor(){this.first=!0}update(t,e){let r=Math.floor(t);return this.first?(this.first=!1,this.lastIntegerZoom=r,this.lastIntegerZoomTime=0,this.lastZoom=t,this.lastFloorZoom=r,!0):(this.lastFloorZoom>r?(this.lastIntegerZoom=r+1,this.lastIntegerZoomTime=e):this.lastFloorZoom<r&&(this.lastIntegerZoom=r,this.lastIntegerZoomTime=e),t!==this.lastZoom&&(this.lastZoom=t,this.lastFloorZoom=r,!0))}},at=class{constructor(t,e){this.zoom=t,e?(this.now=e.now||0,this.fadeDuration=e.fadeDuration||0,this.zoomHistory=e.zoomHistory||new Ih,this.transition=e.transition||{}):(this.now=0,this.fadeDuration=0,this.zoomHistory=new Ih,this.transition={})}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){let t=this.zoom,e=t-Math.floor(t),r=this.crossFadingFactor();return t>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:e+(1-e)*r}:{fromScale:.5,toScale:1,t:1-(1-r)*e}}},Ym=\"-transition\",$a=class{constructor(t,e,r,i){this.property=t,this.value=e,this.expression=ym(e===void 0?t.specification.default:e,r,t.specification,i)}isDataDriven(){return this.expression.kind===\"source\"||this.expression.kind===\"composite\"}getGlobalStateRefs(){return this.expression.globalStateRefs||new Set}possiblyEvaluate(t,e,r){return this.property.possiblyEvaluate(this,t,e,r)}},oo=class{constructor(t,e,r){this.property=t,this.value=new $a(t,void 0,e,r)}transitioned(t,e){return new Ch(this.property,this.value,e,qt({},t.transition,this.transition),t.now)}untransitioned(){return new Ch(this.property,this.value,null,{},0)}},Xm=class{constructor(t,e,r){this._properties=t,this._values=Object.create(t.defaultTransitionablePropertyValues),this._globalState=r,this._rootKey=e}_propertyRootKey(t){return`${this._rootKey}.${String(t)}`}hasProperty(t){return t in this._properties.defaultTransitionablePropertyValues}getValue(t){return Xe(this._values[t].value.value)}setValue(t,e){Object.hasOwn(this._values,t)||(this._values[t]=new oo(this._values[t].property,this._propertyRootKey(t),this._globalState)),this._values[t].value=new $a(this._values[t].property,e===null?void 0:Xe(e),this._propertyRootKey(t),this._globalState)}getTransition(t){return Xe(this._values[t].transition)}setTransition(t,e){Object.hasOwn(this._values,t)||(this._values[t]=new oo(this._values[t].property,this._propertyRootKey(t),this._globalState)),this._values[t].transition=Xe(e)||void 0}serialize(){let t={};for(let e of Object.keys(this._values)){let r=this.getValue(e);r!==void 0&&(t[e]=r);let i=this.getTransition(e);i!==void 0&&(t[`${e}${Ym}`]=i)}return t}transitioned(t,e){let r=new Mh(this._properties);for(let i of Object.keys(this._values))r._values[i]=this._values[i].transitioned(t,e._values[i]);return r}untransitioned(){let t=new Mh(this._properties);for(let e of Object.keys(this._values))t._values[e]=this._values[e].untransitioned();return t}},Ch=class{constructor(t,e,r,i,n){this.property=t,this.value=e,this.begin=n+i.delay||0,this.end=this.begin+i.duration||0,t.specification.transition&&(i.delay||i.duration)&&(this.prior=r)}possiblyEvaluate(t,e,r){let i=t.now||0,n=this.value.possiblyEvaluate(t,e,r),a=this.prior;if(!a)return n;if(i>this.end||this.value.isDataDriven())return this.prior=null,n;if(i<this.begin)return a.possiblyEvaluate(t,e,r);{let s=(i-this.begin)/(this.end-this.begin);return this.property.interpolate(a.possiblyEvaluate(t,e,r),n,C1(s))}}},Mh=class{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitioningPropertyValues)}possiblyEvaluate(t,e,r){let i=new Na(this._properties);for(let n of Object.keys(this._values))i._values[n]=this._values[n].possiblyEvaluate(t,e,r);return i}hasTransition(){for(let t of Object.keys(this._values))if(this._values[t].prior)return!0;return!1}},Wm=class{constructor(t,e,r){this._properties=t,this._values=Object.create(t.defaultPropertyValues),this._globalState=r,this._rootKey=e}_propertyRootKey(t){return`${this._rootKey}.${String(t)}`}hasValue(t){return this._values[t].value!==void 0}hasProperty(t){return t in this._properties.defaultPropertyValues}getValue(t){return Xe(this._values[t].value)}setValue(t,e){this._values[t]=new $a(this._values[t].property,e===null?void 0:Xe(e),this._propertyRootKey(t),this._globalState)}serialize(){let t={};for(let e of Object.keys(this._values)){let r=this.getValue(e);r!==void 0&&(t[e]=r)}return t}possiblyEvaluate(t,e,r){let i=new Na(this._properties);for(let n of Object.keys(this._values))i._values[n]=this._values[n].possiblyEvaluate(t,e,r);return i}},ae=class{constructor(t,e,r){this.property=t,this.value=e,this.parameters=r}isConstant(){return this.value.kind===\"constant\"}constantOr(t){return this.value.kind===\"constant\"?this.value.value:t}evaluate(t,e,r,i){return this.property.evaluate(this.value,this.parameters,t,e,r,i)}},Na=class{constructor(t){this._properties=t,this._values=Object.create(t.defaultPossiblyEvaluatedValues)}get(t){return this._values[t]}};function Bh(t){if(Array.isArray(t))return t.length;let e=t?.values;return Array.isArray(e)?e.length:void 0}function Yf(t,e){let r=Bh(t),i=Bh(e);return r!==void 0&&i!==void 0&&r!==i}var z=class{constructor(t,e){this.specification=t,this.name=e}possiblyEvaluate(t,e){if(t.isDataDriven())throw Error(\"Value should not be data driven\");return t.expression.evaluate(e)}interpolate(t,e,r){if(Yf(t,e))return Mt(`Property \"${this.name}\" is trying to interpolate arrays of different lengths. Rendering may 'jump'.`),e;let i=this.specification.type,n=yr[i];return n?n(t,e,r):t}},U=class{constructor(t,e,r){this.specification=t,this.name=e,this.overrides=r}possiblyEvaluate(t,e,r,i){return t.expression.kind===\"constant\"||t.expression.kind===\"camera\"?new ae(this,{kind:\"constant\",value:t.expression.evaluate(e,null,{},r,i)},e):new ae(this,t.expression,e)}interpolate(t,e,r){if(t.value.kind!==\"constant\"||e.value.kind!==\"constant\")return t;if(t.value.value===void 0||e.value.value===void 0)return new ae(this,{kind:\"constant\",value:void 0},t.parameters);if(Yf(t.value.value,e.value.value))return Mt(`Property \"${this.name}\" is trying to interpolate arrays of different lengths. Rendering may 'jump'.`),e;let i=this.specification.type,n=yr[i];if(n){let a=n(t.value.value,e.value.value,r);return new ae(this,{kind:\"constant\",value:a},t.parameters)}return t}evaluate(t,e,r,i,n,a){return t.kind===\"constant\"?t.value:t.evaluate(e,r,i,n,a)}},nn=class extends U{possiblyEvaluate(t,e,r,i){if(t.value===void 0)return new ae(this,{kind:\"constant\",value:void 0},e);if(t.expression.kind===\"constant\"){let n=t.expression.evaluate(e,null,{},r,i),a=t.property.specification.type===\"resolvedImage\"&&typeof n!=\"string\"?n.name:n,s=this._calculate(a,a,a,e);return new ae(this,{kind:\"constant\",value:s},e)}if(t.expression.kind===\"camera\"){let n=this._calculate(t.expression.evaluate({zoom:e.zoom-1}),t.expression.evaluate({zoom:e.zoom}),t.expression.evaluate({zoom:e.zoom+1}),e);return new ae(this,{kind:\"constant\",value:n},e)}return new ae(this,t.expression,e)}evaluate(t,e,r,i,n,a){if(t.kind===\"source\"){let s=t.evaluate(e,r,i,n,a);return this._calculate(s,s,s,e)}return t.kind===\"composite\"?this._calculate(t.evaluate({zoom:Math.floor(e.zoom)-1},r,i),t.evaluate({zoom:Math.floor(e.zoom)},r,i),t.evaluate({zoom:Math.floor(e.zoom)+1},r,i),e):t.value}_calculate(t,e,r,i){return i.zoom>i.zoomHistory.lastIntegerZoom?{from:t,to:e}:{from:r,to:e}}interpolate(t){return t}},Xf=class{constructor(t,e){this.specification=t,this.name=e}possiblyEvaluate(t,e,r,i){if(t.value!==void 0){if(t.expression.kind===\"constant\"){let n=t.expression.evaluate(e,null,{},r,i);return this._calculate(n,n,n,e)}return this._calculate(t.expression.evaluate(new at(Math.floor(e.zoom-1),e)),t.expression.evaluate(new at(Math.floor(e.zoom),e)),t.expression.evaluate(new at(Math.floor(e.zoom+1),e)),e)}}_calculate(t,e,r,i){return i.zoom>i.zoomHistory.lastIntegerZoom?{from:t,to:e}:{from:r,to:e}}interpolate(t){return t}},Ua=class{constructor(t,e){this.specification=t,this.name=e}possiblyEvaluate(t,e,r,i){return!!t.expression.evaluate(e,null,{},r,i)}interpolate(){return!1}},jt=class{constructor(t){this.properties=t,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(let e in t){let r=t[e];r.specification.overridable&&this.overridableProperties.push(e);let i=this.defaultPropertyValues[e]=new $a(r,void 0,r.name,void 0),n=this.defaultTransitionablePropertyValues[e]=new oo(r,r.name,void 0);this.defaultTransitioningPropertyValues[e]=n.untransitioned(),this.defaultPossiblyEvaluatedValues[e]=i.possiblyEvaluate({})}}};I(\"DataDrivenProperty\",U),I(\"DataConstantProperty\",z),I(\"CrossFadedDataDrivenProperty\",nn),I(\"CrossFadedProperty\",Xf),I(\"ColorRampProperty\",Ua);var Ph=\" is a PAINT property not a LAYOUT property. Use get/setPaintProperty instead?\",zs=\" is a LAYOUT property not a PAINT property. Use get/setLayoutProperty instead?\",pe=class extends j1{constructor(t,e,r){if(super(),this.id=t.id,this.type=t.type,this._globalState=r,this._featureFilter={filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set},this._visibilityExpression=Um(this.visibility,`layers[${this.id}].layout.visibility`,r),t.type!==\"custom\"&&(this.metadata=t.metadata,this.minzoom=t.minzoom,this.maxzoom=t.maxzoom,t.type!==\"background\"&&(this.source=t.source,this.sourceLayer=t[\"source-layer\"],this.filter=t.filter,this._featureFilter=ii(t.filter,`layers[${this.id}].filter`,r)),e.layout&&(this._unevaluatedLayout=new Wm(e.layout,`layers[${this.id}].layout`,r)),e.paint)){this._transitionablePaint=new Xm(e.paint,`layers[${this.id}].paint`,r);for(let i in t.paint)this.setPaintProperty(i,t.paint[i],{validate:!1});for(let i in t.layout)this.setLayoutProperty(i,t.layout[i],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new Na(e.paint)}}setFilter(t){this.filter=t,this._featureFilter=ii(t,`layers[${this.id}].filter`,this._globalState)}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(t){if(t===\"visibility\")return this.visibility;if(this._transitionablePaint?.hasProperty(t))throw Error(t+Ph);if(!this._unevaluatedLayout)throw Error(`Cannot get layout property \"${t}\" on layer type \"${this.type}\" which has no layout properties.`);return this._unevaluatedLayout.getValue(t)}getLayoutAffectingGlobalStateRefs(){let t=new Set;for(let e of this._visibilityExpression.getGlobalStateRefs())t.add(e);if(this._unevaluatedLayout)for(let e in this._unevaluatedLayout._values){let r=this._unevaluatedLayout._values[e];for(let i of r.getGlobalStateRefs())t.add(i)}for(let e of this._featureFilter.getGlobalStateRefs())t.add(e);return t}getPaintAffectingGlobalStateRefs(){let t=new globalThis.Map;if(this._transitionablePaint)for(let e in this._transitionablePaint._values){let r=this._transitionablePaint._values[e].value;for(let i of r.getGlobalStateRefs()){let n=t.get(i)??[];n.push({name:e,value:r.value}),t.set(i,n)}}return t}getVisibilityAffectingGlobalStateRefs(){return this._visibilityExpression.getGlobalStateRefs()}setLayoutProperty(t,e,r={}){if(t===\"visibility\"){this.visibility=e,this._visibilityExpression.setValue(e),this.recalculateVisibility();return}if(this._transitionablePaint?.hasProperty(t)){this.fire(new ha(Error(t+Ph)));return}e!=null&&this._validate(kh.layoutProperty,`layers.${this.id}.layout.${t}`,t,e,r)||this._unevaluatedLayout.setValue(t,e)}getPaintProperty(t){if(t.endsWith(\"-transition\")){let e=t.slice(0,-11);if(e===\"visibility\"||this._unevaluatedLayout?.hasProperty(e))throw Error(t+zs);return this._transitionablePaint.getTransition(e)}if(t===\"visibility\"||this._unevaluatedLayout?.hasProperty(t))throw Error(t+zs);return this._transitionablePaint.getValue(t)}setPaintProperty(t,e,r={}){if(t===\"visibility\"||this._unevaluatedLayout?.hasProperty(t))return this.fire(new ha(Error(t+zs))),!1;if(e!=null&&this._validate(kh.paintProperty,`layers.${this.id}.paint.${t}`,t,e,r))return!1;if(t.endsWith(\"-transition\"))return this._transitionablePaint.setTransition(t.slice(0,-11),e||void 0),!1;{let i=this._transitionablePaint._values[t],n=i.property.specification[\"property-type\"]===\"cross-faded-data-driven\",a=i.value.isDataDriven(),s=i.value;this._transitionablePaint.setValue(t,e),this._handleSpecialPaintPropertyUpdate(t);let o=this._transitionablePaint._values[t].value;return o.isDataDriven()||a||n||this._handleOverridablePaintPropertyUpdate(t,s,o)}}_handleSpecialPaintPropertyUpdate(t){}_handleOverridablePaintPropertyUpdate(t,e,r){return!1}isHidden(t=this.minzoom,e=!1){return this.minzoom&&t<(e?Math.floor(this.minzoom):this.minzoom)||this.maxzoom&&t>=this.maxzoom?!0:this._evaluatedVisibility===\"none\"}updateTransitions(t){this._transitioningPaint=this._transitionablePaint.transitioned(t,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculateVisibility(){this._evaluatedVisibility=this._visibilityExpression.evaluate()}recalculate(t,e){t.getCrossfadeParameters&&(this._crossfadeParameters=t.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(t,void 0,e)),this.paint=this._transitioningPaint.possiblyEvaluate(t,void 0,e)}serialize(){let t={id:this.id,type:this.type,source:this.source,\"source-layer\":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout?.serialize(),paint:this._transitionablePaint?.serialize()};return this.visibility&&(t.layout||(t.layout={}),t.layout.visibility=this.visibility),z1(t,(e,r)=>e!==void 0&&!(r===\"layout\"&&!Object.keys(e).length)&&!(r===\"paint\"&&!Object.keys(e).length))}_validate(t,e,r,i,n={}){return jm(this,t,{key:e,layerType:this.type,objectKey:r,value:i},n)}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(let t in this.paint._values){let e=this.paint.get(t);if(e instanceof ae&&ei(e.property.specification)&&(e.value.kind===\"source\"||e.value.kind===\"composite\")&&e.value.isStateDependent)return!0}return!1}},zh,Zm=()=>zh||(zh=new jt({\"raster-opacity\":new z(D.paint_raster[\"raster-opacity\"],\"raster-opacity\"),\"raster-hue-rotate\":new z(D.paint_raster[\"raster-hue-rotate\"],\"raster-hue-rotate\"),\"raster-brightness-min\":new z(D.paint_raster[\"raster-brightness-min\"],\"raster-brightness-min\"),\"raster-brightness-max\":new z(D.paint_raster[\"raster-brightness-max\"],\"raster-brightness-max\"),\"raster-saturation\":new z(D.paint_raster[\"raster-saturation\"],\"raster-saturation\"),\"raster-contrast\":new z(D.paint_raster[\"raster-contrast\"],\"raster-contrast\"),resampling:new z(D.paint_raster.resampling,\"resampling\"),\"raster-resampling\":new z(D.paint_raster[\"raster-resampling\"],\"raster-resampling\"),\"raster-fade-duration\":new z(D.paint_raster[\"raster-fade-duration\"],\"raster-fade-duration\")})),Hm={get paint(){return Zm()}};var Km=class extends pe{constructor(t,e){super(t,Hm,e)}},Jm={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array},gn=class{constructor(t,e){this._structArray=t,this._pos1=e*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}},xt=class{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(t,e){return t._trim(),e&&(t.isTransferred=!0,e.push(t.arrayBuffer)),{length:t.length,arrayBuffer:t.arrayBuffer}}static deserialize(t){let e=Object.create(this.prototype);return e.arrayBuffer=t.arrayBuffer,e.length=t.length,e.capacity=t.arrayBuffer.byteLength/e.bytesPerElement,e._refreshViews(),e}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())}clear(){this.length=0}resize(t){this.reserve(t),this.length=t}reserve(t){if(t>this.capacity){this.capacity=Math.max(t,Math.floor(this.capacity*5),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);let e=this.uint8;this._refreshViews(),e&&this.uint8.set(e)}}_refreshViews(){throw Error(\"_refreshViews() must be implemented by each concrete StructArray layout\")}freeBufferAfterUpload(){this.arrayBuffer=new ArrayBuffer(0),this._refreshViews()}};function St(t,e=1){let r=0,i=0;return{members:t.map(n=>{let a=Qm(n.type),s=r=Lh(r,Math.max(e,a)),o=n.components||1;return i=Math.max(i,a),r+=a*o,{name:n.name,type:n.type,components:o,offset:s}}),size:Lh(r,Math.max(i,e)),alignment:e}}function Qm(t){return Jm[t].BYTES_PER_ELEMENT}function Lh(t,e){return Math.ceil(t/e)*e}var an=class extends xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e){let r=this.length;return this.resize(r+1),this.emplace(r,t,e)}emplace(t,e,r){let i=t*2;return this.int16[i+0]=e,this.int16[i+1]=r,t}};an.prototype.bytesPerElement=4,I(\"StructArrayLayout2i4\",an);var lo=class extends xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,r){let i=this.length;return this.resize(i+1),this.emplace(i,t,e,r)}emplace(t,e,r,i){let n=t*3;return this.int16[n+0]=e,this.int16[n+1]=r,this.int16[n+2]=i,t}};lo.prototype.bytesPerElement=6,I(\"StructArrayLayout3i6\",lo);var Vh=class extends xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,r,i){let n=this.length;return this.resize(n+1),this.emplace(n,t,e,r,i)}emplace(t,e,r,i,n){let a=t*4;return this.int16[a+0]=e,this.int16[a+1]=r,this.int16[a+2]=i,this.int16[a+3]=n,t}};Vh.prototype.bytesPerElement=8,I(\"StructArrayLayout4i8\",Vh);var uo=class extends xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,r,i,n,a){let s=this.length;return this.resize(s+1),this.emplace(s,t,e,r,i,n,a)}emplace(t,e,r,i,n,a,s){let o=t*6;return this.int16[o+0]=e,this.int16[o+1]=r,this.int16[o+2]=i,this.int16[o+3]=n,this.int16[o+4]=a,this.int16[o+5]=s,t}};uo.prototype.bytesPerElement=12,I(\"StructArrayLayout2i4i12\",uo);var ho=class extends xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,r,i,n,a){let s=this.length;return this.resize(s+1),this.emplace(s,t,e,r,i,n,a)}emplace(t,e,r,i,n,a,s){let o=t*4,l=t*8;return this.int16[o+0]=e,this.int16[o+1]=r,this.uint8[l+4]=i,this.uint8[l+5]=n,this.uint8[l+6]=a,this.uint8[l+7]=s,t}};ho.prototype.bytesPerElement=8,I(\"StructArrayLayout2i4ub8\",ho);var sn=class extends xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e){let r=this.length;return this.resize(r+1),this.emplace(r,t,e)}emplace(t,e,r){let i=t*2;return this.float32[i+0]=e,this.float32[i+1]=r,t}};sn.prototype.bytesPerElement=8,I(\"StructArrayLayout2f8\",sn);var co=class extends xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,r,i,n,a,s,o,l,u){let h=this.length;return this.resize(h+1),this.emplace(h,t,e,r,i,n,a,s,o,l,u)}emplace(t,e,r,i,n,a,s,o,l,u,h){let c=t*10;return this.uint16[c+0]=e,this.uint16[c+1]=r,this.uint16[c+2]=i,this.uint16[c+3]=n,this.uint16[c+4]=a,this.uint16[c+5]=s,this.uint16[c+6]=o,this.uint16[c+7]=l,this.uint16[c+8]=u,this.uint16[c+9]=h,t}};co.prototype.bytesPerElement=20,I(\"StructArrayLayout10ui20\",co);var po=class extends xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,r,i,n,a,s,o){let l=this.length;return this.resize(l+1),this.emplace(l,t,e,r,i,n,a,s,o)}emplace(t,e,r,i,n,a,s,o,l){let u=t*8;return this.uint16[u+0]=e,this.uint16[u+1]=r,this.uint16[u+2]=i,this.uint16[u+3]=n,this.uint16[u+4]=a,this.uint16[u+5]=s,this.uint16[u+6]=o,this.uint16[u+7]=l,t}};po.prototype.bytesPerElement=16,I(\"StructArrayLayout8ui16\",po);var fo=class extends xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,r,i,n,a,s,o,l,u,h,c,p){let f=this.length;return this.resize(f+1),this.emplace(f,t,e,r,i,n,a,s,o,l,u,h,c,p)}emplace(t,e,r,i,n,a,s,o,l,u,h,c,p,f){let d=t*14,y=t*7;return this.int16[d+0]=e,this.int16[d+1]=r,this.int16[d+2]=i,this.int16[d+3]=n,this.uint16[d+4]=a,this.uint16[d+5]=s,this.uint16[d+6]=o,this.uint16[d+7]=l,this.int16[d+8]=u,this.int16[d+9]=h,this.int16[d+10]=c,this.int16[d+11]=p,this.float32[y+6]=f,t}};fo.prototype.bytesPerElement=28,I(\"StructArrayLayout4i4ui4i1f28\",fo);var yo=class extends xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,r){let i=this.length;return this.resize(i+1),this.emplace(i,t,e,r)}emplace(t,e,r,i){let n=t*3;return this.float32[n+0]=e,this.float32[n+1]=r,this.float32[n+2]=i,t}};yo.prototype.bytesPerElement=12,I(\"StructArrayLayout3f12\",yo);var mo=class extends xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(t){let e=this.length;return this.resize(e+1),this.emplace(e,t)}emplace(t,e){let r=t*1;return this.uint32[r+0]=e,t}};mo.prototype.bytesPerElement=4,I(\"StructArrayLayout1ul4\",mo);var go=class extends xt{_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(t,e,r,i,n,a,s,o,l){let u=this.length;return this.resize(u+1),this.emplace(u,t,e,r,i,n,a,s,o,l)}emplace(t,e,r,i,n,a,s,o,l,u){let h=t*10,c=t*5;return this.int16[h+0]=e,this.int16[h+1]=r,this.int16[h+2]=i,this.int16[h+3]=n,this.int16[h+4]=a,this.int16[h+5]=s,this.uint32[c+3]=o,this.uint16[h+8]=l,this.uint16[h+9]=u,t}};go.prototype.bytesPerElement=20,I(\"StructArrayLayout6i1ul2ui20\",go);var xo=class extends xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,r,i,n,a){let s=this.length;return this.resize(s+1),this.emplace(s,t,e,r,i,n,a)}emplace(t,e,r,i,n,a,s){let o=t*6;return this.int16[o+0]=e,this.int16[o+1]=r,this.int16[o+2]=i,this.int16[o+3]=n,this.int16[o+4]=a,this.int16[o+5]=s,t}};xo.prototype.bytesPerElement=12,I(\"StructArrayLayout2i2i2i12\",xo);var Oh=class extends xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,r,i,n){let a=this.length;return this.resize(a+1),this.emplace(a,t,e,r,i,n)}emplace(t,e,r,i,n,a){let s=t*4,o=t*8;return this.float32[s+0]=e,this.float32[s+1]=r,this.float32[s+2]=i,this.int16[o+6]=n,this.int16[o+7]=a,t}};Oh.prototype.bytesPerElement=16,I(\"StructArrayLayout2f1f2i16\",Oh);var vo=class extends xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,r,i,n,a){let s=this.length;return this.resize(s+1),this.emplace(s,t,e,r,i,n,a)}emplace(t,e,r,i,n,a,s){let o=t*16,l=t*4,u=t*8;return this.uint8[o+0]=e,this.uint8[o+1]=r,this.float32[l+1]=i,this.float32[l+2]=n,this.int16[u+6]=a,this.int16[u+7]=s,t}};vo.prototype.bytesPerElement=16,I(\"StructArrayLayout2ub2f2i16\",vo);var bo=class extends xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,r){let i=this.length;return this.resize(i+1),this.emplace(i,t,e,r)}emplace(t,e,r,i){let n=t*3;return this.uint16[n+0]=e,this.uint16[n+1]=r,this.uint16[n+2]=i,t}};bo.prototype.bytesPerElement=6,I(\"StructArrayLayout3ui6\",bo);var wo=class extends xt{_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(t,e,r,i,n,a,s,o,l,u,h,c,p,f,d,y,m,g){let x=this.length;return this.resize(x+1),this.emplace(x,t,e,r,i,n,a,s,o,l,u,h,c,p,f,d,y,m,g)}emplace(t,e,r,i,n,a,s,o,l,u,h,c,p,f,d,y,m,g,x){let b=t*26,v=t*13,w=t*52;return this.int16[b+0]=e,this.int16[b+1]=r,this.uint16[b+2]=i,this.uint16[b+3]=n,this.uint32[v+2]=a,this.uint32[v+3]=s,this.uint32[v+4]=o,this.uint16[b+10]=l,this.uint16[b+11]=u,this.uint16[b+12]=h,this.float32[v+7]=c,this.float32[v+8]=p,this.uint8[w+36]=f,this.uint8[w+37]=d,this.uint8[w+38]=y,this.uint32[v+10]=m,this.int16[b+22]=g,this.float32[v+12]=x,t}};wo.prototype.bytesPerElement=52,I(\"StructArrayLayout2i2ui3ul3ui2f3ub1ul1i1f52\",wo);var Do=class extends xt{_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(t,e,r,i,n,a,s,o,l,u,h,c,p,f,d,y,m,g,x,b,v,w,_,A,S,F,L,V,P){let R=this.length;return this.resize(R+1),this.emplace(R,t,e,r,i,n,a,s,o,l,u,h,c,p,f,d,y,m,g,x,b,v,w,_,A,S,F,L,V,P)}emplace(t,e,r,i,n,a,s,o,l,u,h,c,p,f,d,y,m,g,x,b,v,w,_,A,S,F,L,V,P,R){let E=t*34,$=t*17;return this.int16[E+0]=e,this.int16[E+1]=r,this.int16[E+2]=i,this.int16[E+3]=n,this.int16[E+4]=a,this.int16[E+5]=s,this.int16[E+6]=o,this.int16[E+7]=l,this.uint16[E+8]=u,this.uint16[E+9]=h,this.uint16[E+10]=c,this.uint16[E+11]=p,this.uint16[E+12]=f,this.uint16[E+13]=d,this.uint16[E+14]=y,this.uint16[E+15]=m,this.uint16[E+16]=g,this.uint16[E+17]=x,this.uint16[E+18]=b,this.uint16[E+19]=v,this.uint16[E+20]=w,this.uint16[E+21]=_,this.uint16[E+22]=A,this.uint32[$+12]=S,this.float32[$+13]=F,this.float32[$+14]=L,this.uint16[E+30]=V,this.uint16[E+31]=P,this.float32[$+16]=R,t}};Do.prototype.bytesPerElement=68,I(\"StructArrayLayout8i15ui1ul2f2ui1f68\",Do);var ga=class extends xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t){let e=this.length;return this.resize(e+1),this.emplace(e,t)}emplace(t,e){let r=t*1;return this.float32[r+0]=e,t}};ga.prototype.bytesPerElement=4,I(\"StructArrayLayout1f4\",ga);var _o=class extends xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,r){let i=this.length;return this.resize(i+1),this.emplace(i,t,e,r)}emplace(t,e,r,i){let n=t*6,a=t*3;return this.uint16[n+0]=e,this.float32[a+1]=r,this.float32[a+2]=i,t}};_o.prototype.bytesPerElement=12,I(\"StructArrayLayout1ui2f12\",_o);var Ao=class extends xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,r){let i=this.length;return this.resize(i+1),this.emplace(i,t,e,r)}emplace(t,e,r,i){let n=t*2,a=t*4;return this.uint32[n+0]=e,this.uint16[a+2]=r,this.uint16[a+3]=i,t}};Ao.prototype.bytesPerElement=8,I(\"StructArrayLayout1ul2ui8\",Ao);var So=class extends xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e){let r=this.length;return this.resize(r+1),this.emplace(r,t,e)}emplace(t,e,r){let i=t*2;return this.uint16[i+0]=e,this.uint16[i+1]=r,t}};So.prototype.bytesPerElement=4,I(\"StructArrayLayout2ui4\",So);var Rh=class extends xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t){let e=this.length;return this.resize(e+1),this.emplace(e,t)}emplace(t,e){let r=t*1;return this.uint16[r+0]=e,t}};Rh.prototype.bytesPerElement=2,I(\"StructArrayLayout1ui2\",Rh);var Eo=class extends xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,r,i){let n=this.length;return this.resize(n+1),this.emplace(n,t,e,r,i)}emplace(t,e,r,i,n){let a=t*4;return this.float32[a+0]=e,this.float32[a+1]=r,this.float32[a+2]=i,this.float32[a+3]=n,t}};Eo.prototype.bytesPerElement=16,I(\"StructArrayLayout4f16\",Eo);var Wf=class extends gn{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 B(this.anchorPointX,this.anchorPointY)}};Wf.prototype.size=20;var Bl=class extends go{get(t){return new Wf(this,t)}};I(\"CollisionBoxArray\",Bl);var Zf=class extends gn{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(t){this._structArray.uint8[this._pos1+37]=t}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(t){this._structArray.uint8[this._pos1+38]=t}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(t){this._structArray.uint32[this._pos4+10]=t}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}get heightOffset(){return this._structArray.float32[this._pos4+12]}};Zf.prototype.size=52;var Hf=class extends wo{get(t){return new Zf(this,t)}};I(\"PlacedSymbolArray\",Hf);var Kf=class extends gn{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(t){this._structArray.uint32[this._pos4+12]=t}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]}get heightOffset(){return this._structArray.float32[this._pos4+16]}};Kf.prototype.size=68;var Jf=class extends Do{get(t){return new Kf(this,t)}};I(\"SymbolInstanceArray\",Jf);var Qf=class extends ga{getoffsetX(t){return this.float32[t*1+0]}};I(\"GlyphOffsetArray\",Qf);var td=class extends lo{getx(t){return this.int16[t*3+0]}gety(t){return this.int16[t*3+1]}gettileUnitDistanceFromAnchor(t){return this.int16[t*3+2]}};I(\"SymbolLineVertexArray\",td);var ed=class extends gn{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]}};ed.prototype.size=12;var rd=class extends _o{get(t){return new ed(this,t)}};I(\"TextAnchorOffsetArray\",rd);var id=class extends gn{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]}};id.prototype.size=8;var nd=class extends Ao{get(t){return new id(this,t)}};I(\"FeatureIndexArray\",nd);var tg=class extends an{};var eg=class extends an{},rg=class extends an{},ig=class extends uo{},ng=class extends ho{},ag=class extends sn{},zr=class extends co{},$h=class extends po{},sg=class extends fo{},og=class extends yo{},lg=class extends mo{},Nh=class extends xo{};var ug=class extends vo{};var xn=class extends bo{},Fo=class extends So{};var To=St([{name:\"a_pos\",components:2,type:\"Int16\"}],4),hg=To.members;To.size,To.alignment;var te=class $r{constructor(e=[]){this._forceNewSegmentOnNextPrepare=!1,this.segments=e}prepareSegment(e,r,i,n){let a=this.segments[this.segments.length-1];return e>$r.MAX_VERTEX_ARRAY_LENGTH&&Mt(`Max vertices per segment is ${$r.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${e}. Consider using the \\`fillLargeMeshArrays\\` function if you require meshes with more than ${$r.MAX_VERTEX_ARRAY_LENGTH} vertices.`),this._forceNewSegmentOnNextPrepare||!a||a.vertexLength+e>$r.MAX_VERTEX_ARRAY_LENGTH||a.sortKey!==n?this.createNewSegment(r,i,n):a}createNewSegment(e,r,i){let n={vertexOffset:e.length,primitiveOffset:r.length,vertexLength:0,primitiveLength:0,vaos:{}};return i!==void 0&&(n.sortKey=i),this._forceNewSegmentOnNextPrepare=!1,this.segments.push(n),n}getOrCreateLatestSegment(e,r,i){return this.prepareSegment(0,e,r,i)}forceNewSegmentOnNextPrepare(){this._forceNewSegmentOnNextPrepare=!0}get(){return this.segments}destroy(){for(let e of this.segments)for(let r in e.vaos)e.vaos[r].destroy()}static simpleSegment(e,r,i,n){return new $r([{vertexOffset:e,primitiveOffset:r,vertexLength:i,primitiveLength:n,vaos:{},sortKey:0}])}};te.MAX_VERTEX_ARRAY_LENGTH=2**16-1,I(\"SegmentVector\",te);function Uh(t,e){return t=Zi(Math.floor(t),0,255),e=Zi(Math.floor(e),0,255),256*t+e}var cg=St([{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\"}]),pg=St([{name:\"a_dasharray_from\",components:4,type:\"Uint16\"},{name:\"a_dasharray_to\",components:4,type:\"Uint16\"}]),fg=hl(((t,e)=>{function r(i,n){for(var a=i.length&3,s=i.length-a,o=n,l,u=3432918353,h=461845907,c,p=0;p<s;)c=i.charCodeAt(p)&255|(i.charCodeAt(++p)&255)<<8|(i.charCodeAt(++p)&255)<<16|(i.charCodeAt(++p)&255)<<24,++p,c=(c&65535)*u+(((c>>>16)*u&65535)<<16)&4294967295,c=c<<15|c>>>17,c=(c&65535)*h+(((c>>>16)*h&65535)<<16)&4294967295,o^=c,o=o<<13|o>>>19,l=(o&65535)*5+(((o>>>16)*5&65535)<<16)&4294967295,o=(l&65535)+27492+(((l>>>16)+58964&65535)<<16);switch(c=0,a){case 3:c^=(i.charCodeAt(p+2)&255)<<16;case 2:c^=(i.charCodeAt(p+1)&255)<<8;case 1:c^=i.charCodeAt(p)&255,c=(c&65535)*u+(((c>>>16)*u&65535)<<16)&4294967295,c=c<<15|c>>>17,c=(c&65535)*h+(((c>>>16)*h&65535)<<16)&4294967295,o^=c}return o^=i.length,o^=o>>>16,o=(o&65535)*2246822507+(((o>>>16)*2246822507&65535)<<16)&4294967295,o^=o>>>13,o=(o&65535)*3266489909+(((o>>>16)*3266489909&65535)<<16)&4294967295,o^=o>>>16,o>>>0}e!==void 0&&(e.exports=r)})),dg=hl(((t,e)=>{function r(i,n){for(var a=i.length,s=n^a,o=0,l;a>=4;)l=i.charCodeAt(o)&255|(i.charCodeAt(++o)&255)<<8|(i.charCodeAt(++o)&255)<<16|(i.charCodeAt(++o)&255)<<24,l=(l&65535)*1540483477+(((l>>>16)*1540483477&65535)<<16),l^=l>>>24,l=(l&65535)*1540483477+(((l>>>16)*1540483477&65535)<<16),s=(s&65535)*1540483477+(((s>>>16)*1540483477&65535)<<16)^l,a-=4,++o;switch(a){case 3:s^=(i.charCodeAt(o+2)&255)<<16;case 2:s^=(i.charCodeAt(o+1)&255)<<8;case 1:s^=i.charCodeAt(o)&255,s=(s&65535)*1540483477+(((s>>>16)*1540483477&65535)<<16)}return s^=s>>>13,s=(s&65535)*1540483477+(((s>>>16)*1540483477&65535)<<16),s^=s>>>15,s>>>0}e.exports=r})),ko=m1(hl(((t,e)=>{var r=fg(),i=dg();e.exports=r,e.exports.murmur3=r,e.exports.murmur2=i}))(),1),ad=class sd{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(e,r,i,n){this.ids.push(qh(e)),this.positions.push(r,i,n)}getPositions(e){if(!this.indexed)throw Error(\"Trying to get index, but feature positions are not indexed\");let r=qh(e),i=0,n=this.ids.length-1;for(;i<n;){let s=i+n>>1;this.ids[s]>=r?n=s:i=s+1}let a=[];for(;this.ids[i]===r;){let s=this.positions[3*i],o=this.positions[3*i+1],l=this.positions[3*i+2];a.push({index:s,start:o,end:l}),i++}return a}static serialize(e,r){let i=new Float64Array(e.ids),n=new Uint32Array(e.positions);return Io(i,n,0,i.length-1),r&&r.push(i.buffer,n.buffer),{ids:i,positions:n}}static deserialize(e){let r=new sd;return r.ids=e.ids,r.positions=e.positions,r.indexed=!0,r}};function qh(t){let e=+t;return!isNaN(e)&&e<=2**53-1?e:(0,ko.default)(String(t))}function Io(t,e,r,i){for(;r<i;){let n=t[r+i>>1],a=r-1,s=i+1;for(;;){do a++;while(t[a]<n);do s--;while(t[s]>n);if(a>=s)break;qn(t,a,s),qn(e,3*a,3*s),qn(e,3*a+1,3*s+1),qn(e,3*a+2,3*s+2)}s-r<i-s?(Io(t,e,r,s),r=s+1):(Io(t,e,s+1,i),i=s)}}function qn(t,e,r){let i=t[e];t[e]=t[r],t[r]=i}I(\"FeaturePositionMap\",ad);var Pl=class{constructor(t,e){this.gl=t.gl,this.location=e}};var zl=class extends Pl{constructor(t,e){super(t,e),this.current=0}set(t){this.current!==t&&(this.current=t,this.gl.uniform1f(this.location,t))}};var yg=class extends Pl{constructor(t,e){super(t,e),this.current=[0,0,0,0]}set(t){(t[0]!==this.current[0]||t[1]!==this.current[1]||t[2]!==this.current[2]||t[3]!==this.current[3])&&(this.current=t,this.gl.uniform4f(this.location,t[0],t[1],t[2],t[3]))}},mg=class extends Pl{constructor(t,e){super(t,e),this.current=gt.transparent}set(t){(t.r!==this.current.r||t.g!==this.current.g||t.b!==this.current.b||t.a!==this.current.a)&&(this.current=t,this.gl.uniform4f(this.location,t.r,t.g,t.b,t.a))}};var a5=new Float32Array(16);function Co(t){return[Uh(255*t.r,255*t.g),Uh(255*t.b,255*t.a)]}var Vi=class{constructor(t,e,r){this.value=t,this.uniformNames=e.map(i=>`u_${i}`),this.type=r}setUniform(t,e,r){t.set(r.constantOr(this.value))}getBinding(t,e,r){return this.type===\"color\"?new mg(t,e):new zl(t,e)}},lr=class{constructor(t,e){this.uniformNames=e.map(r=>`u_${r}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(t,e){this.pixelRatioFrom=e.pixelRatio,this.pixelRatioTo=t.pixelRatio,this.patternFrom=e.tlbr,this.patternTo=t.tlbr}setConstantDashPositions(t,e){this.dashTo=[0,t.y,t.height,t.width],this.dashFrom=[0,e.y,e.height,e.width]}setUniform(t,e,r,i){let n=null;i===\"u_pattern_to\"?n=this.patternTo:i===\"u_pattern_from\"?n=this.patternFrom:i===\"u_dasharray_to\"?n=this.dashTo:i===\"u_dasharray_from\"?n=this.dashFrom:i===\"u_pixel_ratio_to\"?n=this.pixelRatioTo:i===\"u_pixel_ratio_from\"&&(n=this.pixelRatioFrom),n!==null&&t.set(n)}getBinding(t,e,r){return r.startsWith(\"u_pattern\")||r.startsWith(\"u_dasharray_\")?new yg(t,e):new zl(t,e)}},Te=class{constructor(t,e,r,i){this.expression=t,this.type=r,this.maxValue=0,this.paintVertexAttributes=e.map(n=>({name:`a_${n}`,type:\"Float32\",components:r===\"color\"?2:1,offset:0})),this.paintVertexArray=new i}populatePaintArray(t,e,r){let i=this.paintVertexArray.length,n=this.expression.evaluate(new at(0,r),e,{},r.canonical,[],r.formattedSection);this.paintVertexArray.resize(t),this._setPaintValue(i,t,n)}updatePaintArray(t,e,r,i,n){let a=this.expression.evaluate(new at(0,n),r,i);this._setPaintValue(t,e,a)}_setPaintValue(t,e,r){if(this.type===\"color\"){let i=Co(r);for(let n=t;n<e;n++)this.paintVertexArray.emplace(n,i[0],i[1])}else{for(let i=t;i<e;i++)this.paintVertexArray.emplace(i,r);this.maxValue=Math.max(this.maxValue,Math.abs(r))}}upload(t){this.paintVertexArray?.arrayBuffer.byteLength&&(this.paintVertexBuffer?.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=t.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}},le=class{constructor(t,e,r,i,n,a){this.expression=t,this.uniformNames=e.map(s=>`u_${s}_t`),this.type=r,this.useIntegerZoom=i,this.zoom=n,this.maxValue=0,this.paintVertexAttributes=e.map(s=>({name:`a_${s}`,type:\"Float32\",components:r===\"color\"?4:2,offset:0})),this.paintVertexArray=new a}populatePaintArray(t,e,r){let i=this.expression.evaluate(new at(this.zoom,r),e,{},r.canonical,[],r.formattedSection),n=this.expression.evaluate(new at(this.zoom+1,r),e,{},r.canonical,[],r.formattedSection),a=this.paintVertexArray.length;this.paintVertexArray.resize(t),this._setPaintValue(a,t,i,n)}updatePaintArray(t,e,r,i,n){let a=this.expression.evaluate(new at(this.zoom,n),r,i),s=this.expression.evaluate(new at(this.zoom+1,n),r,i);this._setPaintValue(t,e,a,s)}_setPaintValue(t,e,r,i){if(this.type===\"color\"){let n=Co(r),a=Co(i);for(let s=t;s<e;s++)this.paintVertexArray.emplace(s,n[0],n[1],a[0],a[1])}else{for(let n=t;n<e;n++)this.paintVertexArray.emplace(n,r,i);this.maxValue=Math.max(this.maxValue,Math.abs(r),Math.abs(i))}}upload(t){this.paintVertexArray?.arrayBuffer.byteLength&&(this.paintVertexBuffer?.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=t.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(t,e){let r=this.useIntegerZoom?Math.floor(e.zoom):e.zoom,i=Zi(this.expression.interpolationFactor(r,this.zoom,this.zoom+1),0,1);t.set(i)}getBinding(t,e,r){return new zl(t,e)}},je=class{constructor(t,e,r,i,n,a){this.expression=t,this.type=e,this.useIntegerZoom=r,this.zoom=i,this.layerId=a,this.zoomInPaintVertexArray=new n,this.zoomOutPaintVertexArray=new n}populatePaintArray(t,e,r){let i=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(t),this.zoomOutPaintVertexArray.resize(t),this._setPaintValues(i,t,this.getPositionIds(e),r)}updatePaintArray(t,e,r,i,n){this._setPaintValues(t,e,this.getPositionIds(r),n)}_setPaintValues(t,e,r,i){let n=this.getPositions(i);if(!n||!r)return;let a=n[r.min],s=n[r.mid],o=n[r.max];if(a&&s&&o)for(let l=t;l<e;l++)this.emplace(this.zoomInPaintVertexArray,l,a,s),this.emplace(this.zoomOutPaintVertexArray,l,o,s)}upload(t){if(this.zoomInPaintVertexArray?.arrayBuffer.byteLength&&this.zoomOutPaintVertexArray?.arrayBuffer.byteLength){let e=this.getVertexAttributes();this.zoomInPaintVertexBuffer=t.createVertexBuffer(this.zoomInPaintVertexArray,e,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=t.createVertexBuffer(this.zoomOutPaintVertexArray,e,this.expression.isStateDependent)}}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}},od=class extends je{getPositions(t){return t.imagePositions}getPositionIds(t){return t.patterns?.[this.layerId]}getVertexAttributes(){return cg.members}emplace(t,e,r,i){t.emplace(e,r.tlbr[0],r.tlbr[1],r.tlbr[2],r.tlbr[3],i.tlbr[0],i.tlbr[1],i.tlbr[2],i.tlbr[3],r.pixelRatio,i.pixelRatio)}},ld=class extends je{getPositions(t){return t.dashPositions}getPositionIds(t){return t.dashes?.[this.layerId]}getVertexAttributes(){return pg.members}emplace(t,e,r,i){t.emplace(e,0,r.y,r.height,r.width,0,i.y,i.height,i.width)}},ud=class{constructor(t,e,r){this.binders={},this._buffers=[];let i=[];for(let n in t.paint._values){if(!r(n))continue;let a=t.paint.get(n);if(!(a instanceof ae)||!ei(a.property.specification))continue;let s=gg(n,t.type),o=a.value,l=a.property.specification.type,u=a.property.useIntegerZoom,h=a.property.specification[\"property-type\"],c=h===\"cross-faded\"||h===\"cross-faded-data-driven\";if(o.kind===\"constant\")this.binders[n]=c?new lr(o.value,s):new Vi(o.value,s,l),i.push(`/u_${n}`);else if(o.kind===\"source\"||c){let p=jh(n,l,\"source\");this.binders[n]=c?n===\"line-dasharray\"?new ld(o,l,u,e,p,t.id):new od(o,l,u,e,p,t.id):new Te(o,s,l,p),i.push(`/a_${n}`)}else{let p=jh(n,l,\"composite\");this.binders[n]=new le(o,s,l,u,e,p),i.push(`/z_${n}`)}}this.cacheKey=i.sort().join(\"\")}getMaxValue(t){let e=this.binders[t];return e instanceof Te||e instanceof le?e.maxValue:0}populatePaintArrays(t,e,r){for(let i in this.binders){let n=this.binders[i];(n instanceof Te||n instanceof le||n instanceof je)&&n.populatePaintArray(t,e,r)}}setConstantPatternPositions(t,e){for(let r in this.binders){let i=this.binders[r];i instanceof lr&&i.setConstantPatternPositions(t,e)}}setConstantDashPositions(t,e){for(let r in this.binders){let i=this.binders[r];i instanceof lr&&i.setConstantDashPositions(t,e)}}updatePaintArrays(t,e,r,i,n){let a=!1;for(let s of t){let o=e.getPositions(s.id);for(let l of o){let u=r.feature(l.index);for(let h in this.binders){let c=this.binders[h];(c instanceof Te||c instanceof le||c instanceof je)&&c.expression.isStateDependent===!0&&(c.expression=i.paint.get(h).value,c.updatePaintArray(l.start,l.end,u,s.state,n),a=!0)}}}return a}defines(){let t=[];for(let e in this.binders){let r=this.binders[e];(r instanceof Vi||r instanceof lr)&&t.push(...r.uniformNames.map(i=>`#define HAS_UNIFORM_${i}`))}return t}getBinderAttributes(){let t=[];for(let e in this.binders){let r=this.binders[e];if(r instanceof Te||r instanceof le)for(let i of r.paintVertexAttributes)t.push(i.name);else if(r instanceof je){let i=r.getVertexAttributes();for(let n of i)t.push(n.name)}}return t}getBinderUniforms(){let t=[];for(let e in this.binders){let r=this.binders[e];if(r instanceof Vi||r instanceof lr||r instanceof le)for(let i of r.uniformNames)t.push(i)}return t}getPaintVertexBuffers(){return this._buffers}getUniforms(t,e){let r=[];for(let i in this.binders){let n=this.binders[i];if(n instanceof Vi||n instanceof lr||n instanceof le){for(let a of n.uniformNames)if(e[a]){let s=n.getBinding(t,e[a],a);r.push({name:a,property:i,binding:s})}}}return r}setUniforms(t,e,r,i){for(let{name:n,property:a,binding:s}of e)this.binders[a].setUniform(s,i,r.get(a),n)}updatePaintBuffers(t){this._buffers=[];for(let e in this.binders){let r=this.binders[e];if(t&&r instanceof je){let i=t.fromScale===2?r.zoomInPaintVertexBuffer:r.zoomOutPaintVertexBuffer;i&&this._buffers.push(i)}else(r instanceof Te||r instanceof le)&&r.paintVertexBuffer&&this._buffers.push(r.paintVertexBuffer)}}upload(t){for(let e in this.binders){let r=this.binders[e];(r instanceof Te||r instanceof le||r instanceof je)&&r.upload(t)}this.updatePaintBuffers()}destroy(){for(let t in this.binders){let e=this.binders[t];(e instanceof Te||e instanceof le||e instanceof je)&&e.destroy()}}},gr=class{constructor(t,e,r=()=>!0){this.programConfigurations={};for(let i of t)this.programConfigurations[i.id]=new ud(i,e,r);this.needsUpload=!1,this._featureMap=new ad,this._bufferOffset=0}populatePaintArrays(t,e,r,i){for(let n in this.programConfigurations)this.programConfigurations[n].populatePaintArrays(t,e,i);e.id!==void 0&&this._featureMap.add(e.id,r,this._bufferOffset,t),this._bufferOffset=t,this.needsUpload=!0}updatePaintArrays(t,e,r,i){for(let n of r)this.needsUpload=this.programConfigurations[n.id].updatePaintArrays(t,this._featureMap,e,n,i)||this.needsUpload}get(t){return this.programConfigurations[t]}upload(t){if(this.needsUpload){for(let e in this.programConfigurations)this.programConfigurations[e].upload(t);this.needsUpload=!1}}destroy(){for(let t in this.programConfigurations)this.programConfigurations[t].destroy()}};function gg(t,e){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-dasharray\":[\"dasharray_to\",\"dasharray_from\"],\"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\"]}[t]||[t.replace(`${e}-`,\"\").replace(/-/g,\"_\")]}function xg(t){return{\"line-pattern\":{source:zr,composite:zr},\"fill-pattern\":{source:zr,composite:zr},\"fill-extrusion-pattern\":{source:zr,composite:zr},\"line-dasharray\":{source:$h,composite:$h}}[t]}function jh(t,e,r){let i={color:{source:sn,composite:Eo},number:{source:ga,composite:sn}};return xg(t)?.[r]||i[e][r]}I(\"ConstantBinder\",Vi),I(\"CrossFadedConstantBinder\",lr),I(\"SourceExpressionBinder\",Te),I(\"CrossFadedPatternBinder\",od),I(\"CrossFadedDasharrayBinder\",ld),I(\"CompositeExpressionBinder\",le),I(\"ProgramConfiguration\",ud,{omit:[\"_buffers\"]}),I(\"ProgramConfigurationSet\",gr);var Mo=2**14-1,Gh=-Mo-1;function Dr(t){let e=mt/t.extent,r=t.loadGeometry();for(let i of r)for(let n of i){let a=Math.round(n.x*e),s=Math.round(n.y*e);n.x=Zi(a,Gh,Mo),n.y=Zi(s,Gh,Mo),(a<n.x||a>n.x+1||s<n.y||s>n.y+1)&&Mt(\"Geometry exceeds allowed extent, reduce your vector tile buffer size\")}return r}function li(t,e){return{type:t.type,id:t.id,properties:t.properties,geometry:e?Dr(t):[]}}var Yh=-32768;function vg(t,e,r,i,n){t.emplaceBack(Yh+e*8+i,Yh+r*8+n)}var Ll=class{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(e=>e.id),this.index=t.index,this.hasDependencies=!1,this.layoutVertexArray=new eg,this.indexArray=new xn,this.segments=new te,this.programConfigurations=new gr(t.layers,t.zoom),this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id)}populate(t,e,r){let i=this.layers[0],n=[],a=null,s=!1,o=i.type===\"heatmap\";if(i.type===\"circle\"){let c=i;a=c.layout.get(\"circle-sort-key\"),s=!a.isConstant(),o||(o=c.paint.get(\"circle-pitch-alignment\")===\"map\")}let l=o?e.subdivisionGranularity.circle:1,u=new at(this.zoom),h=this.layers[0]._featureFilter.needGeometry;for(let{feature:c,id:p,index:f,sourceLayerIndex:d}of t){let y=li(c,h);if(!this.layers[0]._featureFilter.filter(u,y,r))continue;let m=s?a.evaluate(y,{},r):void 0,g={id:p,properties:c.properties,type:c.type,sourceLayerIndex:d,index:f,geometry:h?y.geometry:Dr(c),patterns:{},sortKey:m};n.push(g)}s&&n.sort((c,p)=>c.sortKey-p.sortKey);for(let c of n){let{geometry:p,index:f,sourceLayerIndex:d}=c,y=t[f].feature;this.addFeature(c,p,f,r,l),e.featureIndex.insert(y,p,f,d,this.index)}}update(t,e,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,{imagePositions:r})}addFeatures(t){}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,hg),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(t,e,r,i,n=1){let a;switch(n){case 1:a=[0,7];break;case 3:a=[0,2,5,7];break;case 5:a=[0,1,3,4,6,7];break;case 7:a=[0,1,2,3,4,5,6,7];break;default:throw Error(`Invalid circle bucket granularity: ${n}; valid values are 1, 3, 5, 7.`)}let s=a.length;for(let o of e)for(let l of o){let u=l.x,h=l.y;if(u<0||u>=8192||h<0||h>=8192)continue;let c=this.segments.prepareSegment(s*s,this.layoutVertexArray,this.indexArray,t.sortKey),p=c.vertexLength;for(let f=0;f<s;f++)for(let d=0;d<s;d++)vg(this.layoutVertexArray,u,h,a[d],a[f]);for(let f=0;f<s-1;f++)for(let d=0;d<s-1;d++){let y=p+f*s+d,m=p+(f+1)*s+d;this.indexArray.emplaceBack(y,m+1,y+1),this.indexArray.emplaceBack(y,m,m+1)}c.vertexLength+=s*s,c.primitiveLength+=(s-1)*(s-1)*2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,r,{imagePositions:{},canonical:i})}};I(\"CircleBucket\",Ll,{omit:[\"layers\"]});function bg(t,e){for(let r of t)if(ai(e,r))return!0;for(let r of e)if(ai(t,r))return!0;return Vl(t,e)}function qa(t,e,r){return ai(t,e)?!0:Bo(e,t,r)}function hd(t,e){if(t.length===1)return Xh(e,t[0]);for(let r of e)for(let i of r)if(ai(t,i))return!0;for(let r of t)if(Xh(e,r))return!0;for(let r of e)if(Vl(t,r))return!0;return!1}function wg(t,e,r){for(let i of e){if(t.length>=3){for(let n of i)if(ai(t,n))return!0}if(Dg(t,i,r))return!0}return!1}function Dg(t,e,r){if(t.length>1){if(Vl(t,e))return!0;for(let i of e)if(Bo(i,t,r))return!0}for(let i of t)if(Bo(i,e,r))return!0;return!1}function Vl(t,e){if(t.length===0||e.length===0)return!1;for(let r=0;r<t.length-1;r++){let i=t[r],n=t[r+1];for(let a=0;a<e.length-1;a++){let s=e[a],o=e[a+1];if(_g(i,n,s,o))return!0}}return!1}function _g(t,e,r,i){return We(t,r,i)!==We(e,r,i)&&We(t,e,r)!==We(t,e,i)}function Bo(t,e,r){let i=r*r;if(e.length===1)return t.distSqr(e[0])<i;for(let n=1;n<e.length;n++){let a=e[n-1],s=e[n];if(cd(t,a,s)<i)return!0}return!1}function cd(t,e,r){let i=e.distSqr(r);if(i===0)return t.distSqr(e);let n=((t.x-e.x)*(r.x-e.x)+(t.y-e.y)*(r.y-e.y))/i;return n<0?t.distSqr(e):n>1?t.distSqr(r):t.distSqr(r.sub(e)._mult(n)._add(e))}function Xh(t,e){let r=!1,i,n,a;for(let s of t){i=s;for(let o=0,l=i.length-1;o<i.length;l=o++)n=i[o],a=i[l],n.y>e.y!=a.y>e.y&&e.x<(a.x-n.x)*(e.y-n.y)/(a.y-n.y)+n.x&&(r=!r)}return r}function ai(t,e){let r=!1;for(let i=0,n=t.length-1;i<t.length;n=i++){let a=t[i],s=t[n];a.y>e.y!=s.y>e.y&&e.x<(s.x-a.x)*(e.y-a.y)/(s.y-a.y)+a.x&&(r=!r)}return r}function Ag(t,e,r,i,n){for(let s of t)if(e<=s.x&&r<=s.y&&i>=s.x&&n>=s.y)return!0;let a=[new B(e,r),new B(e,n),new B(i,n),new B(i,r)];if(t.length>2){for(let s of a)if(ai(t,s))return!0}for(let s=0;s<t.length-1;s++){let o=t[s],l=t[s+1];if(Sg(o,l,a))return!0}return!1}function Sg(t,e,r){let i=r[0],n=r[2];if(t.x<i.x&&e.x<i.x||t.x>n.x&&e.x>n.x||t.y<i.y&&e.y<i.y||t.y>n.y&&e.y>n.y)return!1;let a=We(t,e,r[0]);return a!==We(t,e,r[1])||a!==We(t,e,r[2])||a!==We(t,e,r[3])}function Yr(t,e,r){let i=e.paint.get(t).value;return i.kind===\"constant\"?i.value:r.programConfigurations.get(e.id).getMaxValue(t)}function ja(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function Ga(t,e,r,i,n){if(!e[0]&&!e[1])return t;let a=B.convert(e)._mult(n);r===\"viewport\"&&a._rotate(-i);let s=[];for(let o of t)s.push(o.sub(a));return s}function Eg(t){let e=[];for(let r=0;r<t.length;r++){let i=t[r],n=e.at(-1);(r===0||n&&!i.equals(n))&&e.push(i)}return e}function Fg(t,e){let r=[];for(let i of t){let n=Eg(i),a=[];for(let s=0;s<n.length;s++){let o=n[s],l=n[s-1],u=n[s+1],h=s===0?new B(0,0):o.sub(l)._unit()._perp(),c=s===n.length-1?new B(0,0):u.sub(o)._unit()._perp(),p=h._add(c)._unit(),f=p.x*c.x+p.y*c.y;f!==0&&p._mult(1/f),a.push(p._mult(e)._add(o))}r.push(a)}return r}function Tg({queryGeometry:t,size:e},r){return qa(t,r,e)}function kg({queryGeometry:t,size:e,transform:r,unwrappedTileID:i,getElevation:n},a){return qa(t,a,e*(r.projectTileCoordinates(a.x,a.y,i,n?.(a.x,a.y)).signedDistanceFromCamera/r.cameraToCenterDistance))}function Ig({queryGeometry:t,size:e,transform:r,unwrappedTileID:i,getElevation:n},a){let s=r.projectTileCoordinates(a.x,a.y,i,n?.(a.x,a.y)).signedDistanceFromCamera,o=e*(r.cameraToCenterDistance/s);return qa(t,Ol(a,r,i,n),o)}function Cg({queryGeometry:t,size:e,transform:r,unwrappedTileID:i,getElevation:n},a){return qa(t,Ol(a,r,i,n),e)}function pd({queryGeometry:t,size:e,transform:r,unwrappedTileID:i,getElevation:n,pitchAlignment:a=\"map\",pitchScale:s=\"map\"},o){let l=a===\"map\"?s===\"map\"?Tg:kg:s===\"map\"?Ig:Cg,u={queryGeometry:t,size:e,transform:r,unwrappedTileID:i,getElevation:n};for(let h of o)for(let c of h)if(l(u,c))return!0;return!1}function Ol(t,e,r,i){let n=e.projectTileCoordinates(t.x,t.y,r,i?.(t.x,t.y)).point;return new B((n.x*.5+.5)*e.width,(-n.y*.5+.5)*e.height)}function Mg(t,e,r,i){return t.map(n=>Ol(n,e,r,i))}var Wh,Bg=()=>Wh||(Wh=new jt({\"circle-sort-key\":new U(D.layout_circle[\"circle-sort-key\"],\"circle-sort-key\")})),Zh,Pg=()=>Zh||(Zh=new jt({\"circle-radius\":new U(D.paint_circle[\"circle-radius\"],\"circle-radius\"),\"circle-color\":new U(D.paint_circle[\"circle-color\"],\"circle-color\"),\"circle-blur\":new U(D.paint_circle[\"circle-blur\"],\"circle-blur\"),\"circle-opacity\":new U(D.paint_circle[\"circle-opacity\"],\"circle-opacity\"),\"circle-translate\":new z(D.paint_circle[\"circle-translate\"],\"circle-translate\"),\"circle-translate-anchor\":new z(D.paint_circle[\"circle-translate-anchor\"],\"circle-translate-anchor\"),\"circle-pitch-scale\":new z(D.paint_circle[\"circle-pitch-scale\"],\"circle-pitch-scale\"),\"circle-pitch-alignment\":new z(D.paint_circle[\"circle-pitch-alignment\"],\"circle-pitch-alignment\"),\"circle-stroke-width\":new U(D.paint_circle[\"circle-stroke-width\"],\"circle-stroke-width\"),\"circle-stroke-color\":new U(D.paint_circle[\"circle-stroke-color\"],\"circle-stroke-color\"),\"circle-stroke-opacity\":new U(D.paint_circle[\"circle-stroke-opacity\"],\"circle-stroke-opacity\")})),zg={get paint(){return Pg()},get layout(){return Bg()}};var Lg=class extends pe{constructor(t,e){super(t,zg,e)}createBucket(t){return new Ll(t)}queryRadius(t){let e=t;return Yr(\"circle-radius\",this,e)+Yr(\"circle-stroke-width\",this,e)+ja(this.paint.get(\"circle-translate\"))}queryIntersectsFeature({queryGeometry:t,feature:e,featureState:r,geometry:i,transform:n,pixelsToTileUnits:a,unwrappedTileID:s,getElevation:o}){let l=Ga(t,this.paint.get(\"circle-translate\"),this.paint.get(\"circle-translate-anchor\"),-n.bearingInRadians,a),u=this.paint.get(\"circle-radius\").evaluate(e,r)+this.paint.get(\"circle-stroke-width\").evaluate(e,r),h=this.paint.get(\"circle-pitch-scale\"),c=this.paint.get(\"circle-pitch-alignment\"),p,f;return c===\"map\"?(p=l,f=u*a):(p=Mg(l,n,s,o),f=u),pd({queryGeometry:p,size:f,transform:n,unwrappedTileID:s,getElevation:o,pitchAlignment:c,pitchScale:h},i)}},fd=class extends Ll{};I(\"HeatmapBucket\",fd,{omit:[\"layers\"]});var Hh,Vg=()=>Hh||(Hh=new jt({\"heatmap-radius\":new U(D.paint_heatmap[\"heatmap-radius\"],\"heatmap-radius\"),\"heatmap-weight\":new U(D.paint_heatmap[\"heatmap-weight\"],\"heatmap-weight\"),\"heatmap-intensity\":new z(D.paint_heatmap[\"heatmap-intensity\"],\"heatmap-intensity\"),\"heatmap-color\":new Ua(D.paint_heatmap[\"heatmap-color\"],\"heatmap-color\"),\"heatmap-opacity\":new z(D.paint_heatmap[\"heatmap-opacity\"],\"heatmap-opacity\")})),Og={get paint(){return Vg()}};function Rl(t,{width:e,height:r},i,n){if(!n)n=new Uint8Array(e*r*i);else if(n instanceof Uint8ClampedArray)n=new Uint8Array(n.buffer);else if(n.length!==e*r*i)throw RangeError(`mismatched image size. expected: ${n.length} but got: ${e*r*i}`);return t.width=e,t.height=r,t.data=n,t}function dd(t,{width:e,height:r},i){if(e===t.width&&r===t.height)return;let n=Rl({},{width:e,height:r},i);$l(t,n,{x:0,y:0},{x:0,y:0},{width:Math.min(t.width,e),height:Math.min(t.height,r)},i),t.width=e,t.height=r,t.data=n.data}function $l(t,e,r,i,n,a){if(n.width===0||n.height===0)return e;if(n.width>t.width||n.height>t.height||r.x>t.width-n.width||r.y>t.height-n.height)throw RangeError(\"out of range source coordinates for image copy\");if(n.width>e.width||n.height>e.height||i.x>e.width-n.width||i.y>e.height-n.height)throw RangeError(\"out of range destination coordinates for image copy\");let s=t.data,o=e.data;if(s===o)throw Error(\"srcData equals dstData, so image is already copied\");for(let l=0;l<n.height;l++){let u=((r.y+l)*t.width+r.x)*a,h=((i.y+l)*e.width+i.x)*a;for(let c=0;c<n.width*a;c++)o[h+c]=s[u+c]}return e}var Ya=class yd{constructor(e,r){Rl(this,e,1,r)}resize(e){dd(this,e,1)}clone(){return new yd({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,r,i,n,a){$l(e,r,i,n,a,1)}},Wt=class md{constructor(e,r){Rl(this,e,4,r)}resize(e){dd(this,e,4)}replace(e,r){r?this.data.set(e):this.data=e instanceof Uint8ClampedArray?new Uint8Array(e.buffer):e}clone(){return new md({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,r,i,n,a){$l(e,r,i,n,a,4)}setPixel(e,r,i){let n=(e*this.width+r)*4;this.data[n+0]=Math.round(i.r*255/i.a),this.data[n+1]=Math.round(i.g*255/i.a),this.data[n+2]=Math.round(i.b*255/i.a),this.data[n+3]=Math.round(i.a*255)}};function Ls(t){let e=new Uint8Array(t.length);for(let r=0;r<t.length;r+=4){let i=t[r+3];e[r+0]=Math.round(t[r+0]*i/255),e[r+1]=Math.round(t[r+1]*i/255),e[r+2]=Math.round(t[r+2]*i/255),e[r+3]=i}return e}I(\"AlphaImage\",Ya),I(\"RGBAImage\",Wt);function Rg(t){let e={},r=t.resolution||256,i=t.clips?t.clips.length:1,n=t.image||new Wt({width:r,height:i});if(!P1(r))throw Error(`width is not a power of 2 - ${r}`);let a=(s,o,l)=>{e[t.evaluationKey]=l;let u=t.expression.evaluate(e);n.setPixel(s/4/r,o/4,u)};if(t.clips)for(let s=0,o=0;s<i;++s,o+=r*4)for(let l=0,u=0;l<r;l++,u+=4){let h=l/(r-1),{start:c,end:p}=t.clips[s],f=c*(1-h)+p*h;a(o,u,f)}else for(let s=0,o=0;s<r;s++,o+=4){let l=s/(r-1);a(0,o,l)}return n}var $g=\"big-fb\";var Ng=class extends pe{createBucket(t){return new fd(t)}constructor(t,e){super(t,Og,e),this.heatmapFbos=new Map,this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(t){t===\"heatmap-color\"&&this._updateColorRamp()}_updateColorRamp(){let t=this._transitionablePaint._values[\"heatmap-color\"].value.expression;this.colorRamp=Rg({expression:t,evaluationKey:\"heatmapDensity\",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbos.has(\"big-fb\")&&this.heatmapFbos.delete($g)}queryRadius(t){return Yr(\"heatmap-radius\",this,t)}queryIntersectsFeature({queryGeometry:t,feature:e,featureState:r,geometry:i,transform:n,pixelsToTileUnits:a,unwrappedTileID:s,getElevation:o}){return pd({queryGeometry:t,size:this.paint.get(\"heatmap-radius\").evaluate(e,r)*a,transform:n,unwrappedTileID:s,getElevation:o},i)}hasOffscreenPass(){return this.paint.get(\"heatmap-opacity\")!==0&&!this.isHidden()}},Kh,Ug=()=>Kh||(Kh=new jt({\"hillshade-illumination-direction\":new z(D.paint_hillshade[\"hillshade-illumination-direction\"],\"hillshade-illumination-direction\"),\"hillshade-illumination-altitude\":new z(D.paint_hillshade[\"hillshade-illumination-altitude\"],\"hillshade-illumination-altitude\"),\"hillshade-illumination-anchor\":new z(D.paint_hillshade[\"hillshade-illumination-anchor\"],\"hillshade-illumination-anchor\"),\"hillshade-exaggeration\":new z(D.paint_hillshade[\"hillshade-exaggeration\"],\"hillshade-exaggeration\"),\"hillshade-shadow-color\":new z(D.paint_hillshade[\"hillshade-shadow-color\"],\"hillshade-shadow-color\"),\"hillshade-highlight-color\":new z(D.paint_hillshade[\"hillshade-highlight-color\"],\"hillshade-highlight-color\"),\"hillshade-accent-color\":new z(D.paint_hillshade[\"hillshade-accent-color\"],\"hillshade-accent-color\"),\"hillshade-method\":new z(D.paint_hillshade[\"hillshade-method\"],\"hillshade-method\"),resampling:new z(D.paint_hillshade.resampling,\"resampling\")})),qg={get paint(){return Ug()}};var jg=class extends pe{constructor(t,e){super(t,qg,e),this.recalculate({zoom:0,zoomHistory:{}},void 0)}getIlluminationProperties(){let t=this.paint.get(\"hillshade-illumination-direction\").values,e=this.paint.get(\"hillshade-illumination-altitude\").values,r=this.paint.get(\"hillshade-highlight-color\").values,i=this.paint.get(\"hillshade-shadow-color\").values,n=Math.max(t.length,e.length,r.length,i.length);t=t.concat(Array(n-t.length).fill(t.at(-1))),e=e.concat(Array(n-e.length).fill(e.at(-1))),r=r.concat(Array(n-r.length).fill(r.at(-1))),i=i.concat(Array(n-i.length).fill(i.at(-1)));let a=e.map(sh);return{directionRadians:t.map(sh),altitudeRadians:a,shadowColor:i,highlightColor:r}}hasOffscreenPass(){return this.paint.get(\"hillshade-exaggeration\")!==0&&!this.isHidden()}},Jh,Gg=()=>Jh||(Jh=new jt({\"color-relief-opacity\":new z(D[\"paint_color-relief\"][\"color-relief-opacity\"],\"color-relief-opacity\"),\"color-relief-color\":new Ua(D[\"paint_color-relief\"][\"color-relief-color\"],\"color-relief-color\"),resampling:new z(D[\"paint_color-relief\"].resampling,\"resampling\")})),Yg={get paint(){return Gg()}};function jn(t){return\"data\"in t}var Qh=class{constructor(t,e,r,i){this.context=t,this.format=r,this.texture=t.gl.createTexture(),this._ownedHandle=this.texture,this.update(e,i)}update(t,e,r){let{width:i,height:n}=t,a=(this.size?.[0]!==i||this.size[1]!==n)&&!r,{context:s}=this,{gl:o}=s;this.useMipmap=!!e?.useMipmap,a&&this.size&&this.format===o.RGBA&&(o.deleteTexture(this.texture),this.texture=o.createTexture(),this._ownedHandle=this.texture,this.magFilter=void 0,this.minFilter=void 0,this.wrap=void 0),o.bindTexture(o.TEXTURE_2D,this.texture),s.pixelStoreUnpackFlipY.set(!1),s.pixelStoreUnpack.set(1);let l=this.format===o.RGBA&&e?.premultiply!==!1;if(a)if(this.size=[i,n],this.format===o.RGBA&&i>0&&n>0){let u=this.useMipmap?Math.floor(Math.log2(Math.max(i,n)))+1:1;if(o.texStorage2D(o.TEXTURE_2D,u,o.RGBA8,i,n),jn(t)){s.pixelStoreUnpackPremultiplyAlpha.set(!1);let{data:h}=t;l&&h&&(h=Ls(h)),h&&o.texSubImage2D(o.TEXTURE_2D,0,0,0,i,n,o.RGBA,o.UNSIGNED_BYTE,h)}else s.pixelStoreUnpackPremultiplyAlpha.set(l),o.texSubImage2D(o.TEXTURE_2D,0,0,0,o.RGBA,o.UNSIGNED_BYTE,t)}else jn(t)?(s.pixelStoreUnpackPremultiplyAlpha.set(!1),this._uploadRawData(t,l,i,n,o)):(s.pixelStoreUnpackPremultiplyAlpha.set(l),this._uploadDomImage(t,o));else{let{x:u,y:h}=r||{x:0,y:0};jn(t)?(s.pixelStoreUnpackPremultiplyAlpha.set(!1),this._updateRawData(t,l,u,h,i,n,o)):(s.pixelStoreUnpackPremultiplyAlpha.set(l),this._updateDomImage(t,u,h,o))}this.useMipmap&&!(jn(t)&&t.data===null)&&o.generateMipmap(o.TEXTURE_2D),s.pixelStoreUnpackFlipY.setDefault(),s.pixelStoreUnpack.setDefault(),s.pixelStoreUnpackPremultiplyAlpha.setDefault()}_uploadDomImage(t,e){e.texImage2D(e.TEXTURE_2D,0,this.format,this.format,e.UNSIGNED_BYTE,t)}_uploadRawData(t,e,r,i,n){let{data:a}=t;e&&a&&(a=Ls(a)),n.texImage2D(n.TEXTURE_2D,0,this.format,r,i,0,this.format,n.UNSIGNED_BYTE,a)}_updateDomImage(t,e,r,i){i.texSubImage2D(i.TEXTURE_2D,0,e,r,i.RGBA,i.UNSIGNED_BYTE,t)}_updateRawData(t,e,r,i,n,a,s){let{data:o}=t;e&&o&&(o=Ls(o)),s.texSubImage2D(s.TEXTURE_2D,0,r,i,n,a,s.RGBA,s.UNSIGNED_BYTE,o)}bind(t,e,r){let{context:i}=this,{gl:n}=i;this.texture!==this._ownedHandle&&(this.texture=this._ownedHandle),n.bindTexture(n.TEXTURE_2D,this.texture),(r===n.LINEAR_MIPMAP_NEAREST||r===n.LINEAR_MIPMAP_LINEAR)&&!this.useMipmap&&(r=n.LINEAR);let a=r||t;t!==this.magFilter&&(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,t),this.magFilter=t),a!==this.minFilter&&(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,a),this.minFilter=a),e!==this.wrap&&(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,e),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,e),this.wrap=e)}generateMipmap(){if(!this.useMipmap)return;let{gl:t}=this.context;t.bindTexture(t.TEXTURE_2D,this.texture),t.generateMipmap(t.TEXTURE_2D)}destroy(){let{gl:t}=this.context;t.deleteTexture(this.texture),this.texture=null,this._ownedHandle=null}},Me,Nl=(Me=class{constructor(e,r,i,n=1,a=1,s=1,o=0){if(this.uid=e,r.height!==r.width)throw RangeError(\"DEM tiles must be square\");if(i&&![\"mapbox\",\"terrarium\",\"custom\"].includes(i)){Mt(`\"${i}\" is not a valid encoding type. Valid types include \"mapbox\", \"terrarium\" and \"custom\".`);return}this.stride=r.height;let l=this.dim=r.height-4;switch(this.data=new Uint32Array(r.data.buffer),Me.byteViewCache.set(this,new Uint8Array(this.data.buffer)),i){case\"terrarium\":this.redFactor=256,this.greenFactor=1,this.blueFactor=1/256,this.baseShift=32768;break;case\"custom\":this.redFactor=n,this.greenFactor=a,this.blueFactor=s,this.baseShift=o;break;default:this.redFactor=6553.6,this.greenFactor=25.6,this.blueFactor=.1,this.baseShift=1e4}for(let h=-2;h<l+2;h++){let c=this._idx(0,Math.max(0,Math.min(l-1,h)));(h<0||h>=l)&&this.data.copyWithin(this._idx(0,h),c,c+l),this.data.fill(this.data[c],this._idx(-2,h),this._idx(0,h)),this.data.fill(this.data[c+l-1],this._idx(l,h),this._idx(l+1,h)+1)}let u=this._getByteView();this.min=2**53-1,this.max=-(2**53-1);for(let h=0;h<l;h++)for(let c=0;c<l;c++){let p=this._idx(h,c)*4,f=this._unpackAtIndex(u,p);f>this.max&&(this.max=f),f<this.min&&(this.min=f)}}get(e,r){let i=this._getByteView(),n=this._idx(e,r)*4;return this._unpackAtIndex(i,n)}sampleBilinear(e,r){let i=Math.floor(e),n=Math.floor(r);if(i<-1||i>=this.dim||n<-1||n>=this.dim)throw RangeError(`Out of range source coordinates for DEM data. x: ${e}, y: ${r}, dim: ${this.dim}`);let a=this._getByteView(),s=((n+2)*this.stride+i+2)*4,o=this.stride*4,l=e-i,u=r-n,h=this._unpackAtIndex(a,s),c=this._unpackAtIndex(a,s+4),p=this._unpackAtIndex(a,s+o),f=this._unpackAtIndex(a,s+o+4);return h*(1-l)*(1-u)+c*l*(1-u)+p*(1-l)*u+f*l*u}getUnpackVector(){return[this.redFactor,this.greenFactor,this.blueFactor,this.baseShift]}_idx(e,r){if(e<-2||e>=this.dim+2||r<-2||r>=this.dim+2)throw RangeError(`Out of range source coordinates for DEM data. x: ${e}, y: ${r}, dim: ${this.dim}`);return(r+2)*this.stride+(e+2)}unpack(e,r,i){return e*this.redFactor+r*this.greenFactor+i*this.blueFactor-this.baseShift}pack(e){return gd(e,this.getUnpackVector())}getPixels(){return new Wt({width:this.stride,height:this.stride},this._getByteView())}backfillBorder(e,r,i){if(this.dim!==e.dim)throw Error(\"dem dimension mismatch\");let n=r*this.dim,a=r*this.dim+this.dim,s=i*this.dim,o=i*this.dim+this.dim;switch(r){case-1:n=a-2;break;case 1:a=n+2}switch(i){case-1:s=o-2;break;case 1:o=s+2}let l=-r*this.dim,u=-i*this.dim;for(let h=s;h<o;h++)for(let c=n;c<a;c++)this.data[this._idx(c,h)]=e.data[this._idx(c+l,h+u)]}_getByteView(){let e=Me.byteViewCache.get(this);return e?.buffer!==this.data.buffer&&(e=new Uint8Array(this.data.buffer),Me.byteViewCache.set(this,e)),e}_unpackAtIndex(e,r){return this.unpack(e[r],e[r+1],e[r+2])}},Me.byteViewCache=new WeakMap,Me);function gd(t,e){let r=e[0],i=e[1],n=e[2],a=e[3],s=Math.min(r,i,n),o=Math.round((t+a)/s);return{r:Math.floor(o*s/r)%256,g:Math.floor(o*s/i)%256,b:Math.floor(o*s/n)%256}}I(\"DEMData\",Nl);var Xg=class extends pe{constructor(t,e){super(t,Yg,e)}_createColorRamp(t){let e={elevationStops:[],colorStops:[]},r=this._transitionablePaint._values[\"color-relief-color\"].value.expression;if(r instanceof en&&r._styleExpression.expression instanceof be){this.colorRampExpression=r;let a=r._styleExpression.expression;e.elevationStops=a.labels,e.colorStops=[];for(let s of e.elevationStops)e.colorStops.push(a.evaluate({globals:{elevation:s}}))}if(e.elevationStops.length<1&&(e.elevationStops=[0],e.colorStops=[gt.transparent]),e.elevationStops.length<2&&(e.elevationStops.push(e.elevationStops[0]+1),e.colorStops.push(e.colorStops[0])),e.elevationStops.length<=t)return e;let i={elevationStops:[],colorStops:[]},n=(e.elevationStops.length-1)/(t-1);for(let a=0;a<e.elevationStops.length-.5;a+=n)i.elevationStops.push(e.elevationStops[Math.round(a)]),i.colorStops.push(e.colorStops[Math.round(a)]);return Mt(`Too many colors in specification of ${this.id} color-relief layer, may not render properly. Max possible colors: ${t}, provided: ${e.elevationStops.length}`),i}_colorRampChanged(){return this.colorRampExpression!=this._transitionablePaint._values[\"color-relief-color\"].value.expression}getColorRampTextures(t,e,r){if(this.colorRampTextures&&!this._colorRampChanged())return this.colorRampTextures;let i=this._createColorRamp(e),n=new Wt({width:i.colorStops.length,height:1}),a=new Wt({width:i.colorStops.length,height:1});for(let s=0;s<i.elevationStops.length;s++){let o=gd(i.elevationStops[s],r);a.setPixel(0,s,new gt(o.r/255,o.g/255,o.b/255,1)),n.setPixel(0,s,i.colorStops[s])}return this.colorRampTextures={elevationTexture:new Qh(t,a,t.gl.RGBA),colorTexture:new Qh(t,n,t.gl.RGBA)},this.colorRampTextures}hasOffscreenPass(){return!this.isHidden()&&!!this.colorRampTextures}},Po=St([{name:\"a_pos\",components:2,type:\"Int16\"}],4),Wg=Po.members;Po.size,Po.alignment;function xa(t,e,r){let i=r.patternDependencies,n=!1;for(let a of e){let s=a.paint.get(`${t}-pattern`);s.isConstant()||(n=!0);let o=s.constantOr(null);o&&(n=!0,i[o.to]=!0,i[o.from]=!0)}return n}function Ul(t,e,r,i,n){let{zoom:a}=i,s=n.patternDependencies;for(let o of e){let l=o.paint.get(`${t}-pattern`).value;if(l.kind!==\"constant\"){let u=l.evaluate({zoom:a-1},r,{},n.availableImages),h=l.evaluate({zoom:a},r,{},n.availableImages),c=l.evaluate({zoom:a+1},r,{},n.availableImages);u=u?.name?u.name:u,h=h?.name?h.name:h,c=c?.name?c.name:c,s[u]=!0,s[h]=!0,s[c]=!0,r.patterns[o.id]={min:u,mid:h,max:c}}}return r}var on=new Set,zo=!1;function Zg(t,e,r=2){let i=e&&e.length,n=i?e[0]*r:t.length;on.size&&on.clear();let a=xd(t,0,n,r,!0),s=[];if(!a||a.next===a.prev)return s;let o=0,l=0,u=0;if(i&&(a=tx(t,e,a,r)),t.length>80*r){o=t[0],l=t[1];let h=o,c=l;for(let p=r;p<n;p+=r){let f=t[p],d=t[p+1];f<o&&(o=f),d<l&&(l=d),f>h&&(h=f),d>c&&(c=d)}u=Math.max(h-o,c-l),u=u===0?0:32767/u}return Lo(a,s,o,l,u),s}function xd(t,e,r,i,n){let a=null;if(n===fx(t,e,r,i)>0)for(let s=e;s<r;s+=i)a=rc(s/i|0,t[s],t[s+1],a);else for(let s=r-i;s>=e;s-=i)a=rc(s/i|0,t[s],t[s+1],a);return a&&ln(a,a.next)&&(hn(a),a=a.next),a}function xr(t,e=t){let r=e===t,i=t,n;do n=!1,i!==i.next&&(on.size===0||!on.has(i))&&(ln(i,i.next)||Ft(i.prev,i,i.next)===0)?((r||i===e)&&(e=i.prev),zo=!0,hn(i),i=i.prev,n=!0):(r||i!==e)&&(i=i.next,n=!r);while(n||i!==e);return e}function Lo(t,e,r,i,n){n&&ox(t,r,i,n);let a=t,s=!1;for(;t.prev!==t.next;){let o=t.prev,l=t.next;if(Ft(o,t,l)<0&&(n?Kg(t,r,i,n):Hg(t))){e.push(o.i,t.i,l.i),hn(t),t=l,a=l;continue}if(t=l,t===a){if(zo=!1,t=xr(t),zo){a=t;continue}if(!s){t=Jg(t,e),a=t,s=!0;continue}Qg(t,e,r,i,n);break}}}function Hg(t){let e=t.prev,r=t,i=t.next,n=e.x,a=r.x,s=i.x,o=e.y,l=r.y,u=i.y,h=Math.min(n,a,s),c=Math.min(o,l,u),p=Math.max(n,a,s),f=Math.max(o,l,u),d=i.next;for(;d!==e;){if(d.x>=h&&d.x<=p&&d.y>=c&&d.y<=f&&(n!==d.x||o!==d.y)&&ba(n,o,a,l,s,u,d.x,d.y)&&Ft(d.prev,d,d.next)>=0)return!1;d=d.next}return!0}function Kg(t,e,r,i){let n=t.prev,a=t,s=t.next,o=n.x,l=a.x,u=s.x,h=n.y,c=a.y,p=s.y,f=Math.min(o,l,u),d=Math.min(h,c,p),y=Math.max(o,l,u),m=Math.max(h,c,p),g=$o(f,d,e,r,i),x=$o(y,m,e,r,i),b=t.prevZ;for(;b&&b.z>=g;){if(b.x>=f&&b.x<=y&&b.y>=d&&b.y<=m&&b!==s&&(o!==b.x||h!==b.y)&&ba(o,h,l,c,u,p,b.x,b.y)&&Ft(b.prev,b,b.next)>=0)return!1;b=b.prevZ}let v=t.nextZ;for(;v&&v.z<=x;){if(v.x>=f&&v.x<=y&&v.y>=d&&v.y<=m&&v!==s&&(o!==v.x||h!==v.y)&&ba(o,h,l,c,u,p,v.x,v.y)&&Ft(v.prev,v,v.next)>=0)return!1;v=v.nextZ}return!0}function Jg(t,e){let r=t,i=!1;do{let n=r.prev,a=r.next.next;bd(n,r,r.next,a,!1)&&un(n,a)&&un(a,n)&&(e.push(n.i,r.i,a.i),hn(r),hn(r.next),r=t=a,i=!0),r=r.next}while(r!==t);return i?xr(r):r}function Qg(t,e,r,i,n){let a=t;do{let s=a.next.next;for(;s!==a.prev;){if(a.i!==s.i&&hx(a,s)){let o=wd(a,s);a=xr(a,a.next),o=xr(o,o.next),Lo(a,e,r,i,n),Lo(o,e,r,i,n);return}s=s.next}a=a.next}while(a!==t)}var Vo=!1;function tx(t,e,r,i){let n=[];for(let a=0,s=e.length;a<s;a++){let o=xd(t,e[a]*i,a<s-1?e[a+1]*i:t.length,i,!1);o===o.next&&on.add(o),n.push(ux(o))}n.sort(ex),ix(t.length/i,e.length),vd(r,r),Vo=!0;for(let a=0;a<n.length;a++)r=rx(n[a],r);return Vo=!1,xr(r)}function ex(t,e){return t.x-e.x||t.y-e.y||(t.next.y-t.y)/(t.next.x-t.x)-(e.next.y-e.y)/(e.next.x-e.x)}function rx(t,e){let r=ax(t,e);if(!r)return e;let i=wd(r,t),n=i.next;return vd(r,n.next),xr(i,i.next),xr(r,r.next)}var wt=new Float64Array,va=0,Oo=[],Ro=[];function ix(t,e){let r=Math.ceil((t+2*e)/16)+e+2;wt.length<r*4&&(wt=new Float64Array(r*4)),va=0}function vd(t,e){let r=t;do{let i=va++;Oo[i]=r;let n=1/0,a=1/0,s=-1/0,o=-1/0,l=0;do{let h=r.next;r.z=i,r.x<n&&(n=r.x),r.x>s&&(s=r.x),r.y<a&&(a=r.y),r.y>o&&(o=r.y),h.x<n&&(n=h.x),h.x>s&&(s=h.x),h.y<a&&(a=h.y),h.y>o&&(o=h.y),r=h}while(++l<16&&r!==e);Ro[i]=r;let u=i*4;wt[u]=n,wt[u+1]=a,wt[u+2]=s,wt[u+3]=o}while(r!==e)}function nx(t,e){let r=t.z*4;e.x<wt[r]&&(wt[r]=e.x),e.y<wt[r+1]&&(wt[r+1]=e.y),e.x>wt[r+2]&&(wt[r+2]=e.x),e.y>wt[r+3]&&(wt[r+3]=e.y)}function tc(t){let e=Ro[t];for(;e.prev.next!==e;)e=e.next;return Ro[t]=e,e}function ec(t){let e=Oo[t];for(;e.prev.next!==e;)e=e.next;return Oo[t]=e,e}function ax(t,e){let r=e,i=t.x,n=t.y,a=-1/0,s;if(ln(t,r))return r;for(let p=0,f=0;p<va;p++,f+=4){if(n<wt[f+1]||n>wt[f+3]||wt[f]>i||wt[f+2]<=a)continue;let d=tc(p);r=ec(p);do{if(r.prev.next===r){if(ln(t,r.next))return r.next;if(n<=r.y&&n>=r.next.y&&r.next.y!==r.y){let y=r.x+(n-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(y<=i&&y>a&&(a=y,s=r.x<r.next.x?r:r.next,y===i))return s}}r=r.next}while(r!==d)}if(!s)return null;let o=s.x,l=s.y,u=Math.min(n,l),h=Math.max(n,l),c=1/0;for(let p=0,f=0;p<va;p++,f+=4){if(wt[f+2]<o||wt[f]>i||wt[f+3]<u||wt[f+1]>h)continue;let d=tc(p);r=ec(p);do{if(r.prev.next===r&&i>=r.x&&r.x>=o&&i!==r.x&&ba(n<l?i:a,n,o,l,n<l?a:i,n,r.x,r.y)){let y=Math.abs(n-r.y)/(i-r.x);(un(r,t)||r.y===n&&r.next.y===n&&r.next.x>i)&&(y<c||y===c&&(r.x>s.x||r.x===s.x&&sx(s,r)))&&(s=r,c=y)}r=r.next}while(r!==d)}return s}function sx(t,e){return Ft(t.prev,t,e.prev)<0&&Ft(e.next,t,t.next)<0}var ne=[],Ei=[],sr=new Uint32Array,Fi=new Uint32Array,Ti=new Uint32Array(256);function ox(t,e,r,i){let n=t,a=0;do n.z=$o(n.x,n.y,e,r,i),ne[a++]=n,n=n.next;while(n!==t);lx(a);let s=null;for(let o=0;o<a;o++){let l=ne[o];l.prevZ=s,s&&(s.nextZ=l),s=l}s.nextZ=null}function lx(t){if(t<=32){for(let e=1;e<t;e++){let r=ne[e],i=r.z,n=e-1;for(;n>=0&&ne[n].z>i;)ne[n+1]=ne[n],n--;ne[n+1]=r}return}sr.length<t&&(sr=new Uint32Array(t),Fi=new Uint32Array(t),Ei=Array(t));for(let e=0;e<t;e++)sr[e]=ne[e].z;Gn(t,ne,sr,Ei,Fi,0),Gn(t,Ei,Fi,ne,sr,8),Gn(t,ne,sr,Ei,Fi,16),Gn(t,Ei,Fi,ne,sr,24)}function Gn(t,e,r,i,n,a){Ti.fill(0);for(let o=0;o<t;o++)Ti[r[o]>>>a&255]++;let s=0;for(let o=0;o<256;o++){let l=Ti[o];Ti[o]=s,s+=l}for(let o=0;o<t;o++){let l=r[o],u=Ti[l>>>a&255]++;i[u]=e[o],n[u]=l}}function $o(t,e,r,i,n){return t=(t-r)*n|0,e=(e-i)*n|0,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,t|e<<1}function ux(t){let e=t,r=t;do(e.x<r.x||e.x===r.x&&e.y<r.y)&&(r=e),e=e.next;while(e!==t);return r}function ba(t,e,r,i,n,a,s,o){return(n-s)*(e-o)>=(t-s)*(a-o)&&(t-s)*(i-o)>=(r-s)*(e-o)&&(r-s)*(a-o)>=(n-s)*(i-o)}function hx(t,e){let r=ln(t,e)&&Ft(t.prev,t,t.next)>0&&Ft(e.prev,e,e.next)>0;return t.next.i!==e.i&&(r||un(t,e)&&un(e,t)&&(Ft(t.prev,t,e.prev)!==0||Ft(t,e.prev,e)!==0))&&!cx(t,e)&&(r||px(t,e))}function Ft(t,e,r){return(e.y-t.y)*(r.x-e.x)-(e.x-t.x)*(r.y-e.y)}function ln(t,e){return t.x===e.x&&t.y===e.y}function bd(t,e,r,i,n=!0){let a=Ft(t,e,r),s=Ft(t,e,i),o=Ft(r,i,t),l=Ft(r,i,e);return(a>0&&s<0||a<0&&s>0)&&(o>0&&l<0||o<0&&l>0)?!0:n?!!(a===0&&Yn(t,r,e)||s===0&&Yn(t,i,e)||o===0&&Yn(r,t,i)||l===0&&Yn(r,e,i)):!1}function Yn(t,e,r){return e.x<=Math.max(t.x,r.x)&&e.x>=Math.min(t.x,r.x)&&e.y<=Math.max(t.y,r.y)&&e.y>=Math.min(t.y,r.y)}function cx(t,e){let r=Math.min(t.x,e.x),i=Math.max(t.x,e.x),n=Math.min(t.y,e.y),a=Math.max(t.y,e.y),s=t;do{let o=s.next;if(s.x>i&&o.x>i||s.x<r&&o.x<r||s.y>a&&o.y>a||s.y<n&&o.y<n){s=o;continue}if(s.i!==t.i&&o.i!==t.i&&s.i!==e.i&&o.i!==e.i&&bd(s,o,t,e))return!0;s=o}while(s!==t);return!1}function un(t,e){return Ft(t.prev,t,t.next)<0?Ft(t,e,t.next)>=0&&Ft(t,t.prev,e)>=0:Ft(t,e,t.prev)<0||Ft(t,t.next,e)<0}function px(t,e){let r=t,i=!1,n=(t.x+e.x)/2,a=(t.y+e.y)/2;do{let s=r.next;r.y>a!=s.y>a&&n<(s.x-r.x)*(a-r.y)/(s.y-r.y)+r.x&&(i=!i),r=s}while(r!==t);return i}function wd(t,e){let r=No(t.i,t.x,t.y),i=No(e.i,e.x,e.y),n=t.next,a=e.prev;return t.next=e,e.prev=t,r.next=n,n.prev=r,i.next=r,r.prev=i,a.next=i,i.prev=a,i}function rc(t,e,r,i){let n=No(t,e,r);return i?(n.next=i.next,n.prev=i,i.next.prev=n,i.next=n):(n.prev=n,n.next=n),n}function hn(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ),Vo&&nx(t.prev,t.next)}function No(t,e,r){return{i:t,x:e,y:r,prev:null,next:null,z:0,prevZ:null,nextZ:null}}function fx(t,e,r,i){let n=0;for(let a=e,s=r-i;a<r;a+=i)n+=(t[s]-t[a])*(t[a+1]+t[s+1]),s=a;return n}var Oi=class{constructor(t,e){if(e>t)throw Error(\"Min granularity must not be greater than base granularity.\");this._baseZoomGranularity=t,this._minGranularity=e}getGranularityForZoomLevel(t){let e=1<<t;return Math.max(Math.floor(this._baseZoomGranularity/e),this._minGranularity,1)}},fr,dx=(fr=class{constructor(e){this.fill=e.fill,this.line=e.line,this.tile=e.tile,this.stencil=e.stencil,this.circle=e.circle}},fr.noSubdivision=new fr({fill:new Oi(0,0),line:new Oi(0,0),tile:new Oi(0,0),stencil:new Oi(0,0),circle:1}),fr);I(\"SubdivisionGranularityExpression\",Oi),I(\"SubdivisionGranularitySetting\",dx);var Vs=-32768,Os=32767,yx=class{constructor(t,e){this._vertexBuffer=[],this._vertexDictionary=new Map,this._used=!1,this._granularity=t,this._granularityCellSize=mt/t,this._canonical=e}_getKey(t,e){return t+=32768,e+=32768,t<<16|e<<0}_vertexToIndex(t,e){if(t<-32768||e<-32768||t>32767||e>32767)throw Error(\"Vertex coordinates are out of signed 16 bit integer range.\");let r=Math.round(t)|0,i=Math.round(e)|0,n=this._getKey(r,i);if(this._vertexDictionary.has(n))return this._vertexDictionary.get(n);let a=this._vertexBuffer.length/2;return this._vertexDictionary.set(n,a),this._vertexBuffer.push(r,i),a}_subdivideTrianglesScanline(t){if(this._granularity<2)return gx(this._vertexBuffer,t);let e=[],r=t.length;for(let i=0;i<r;i+=3){let n=[t[i+0],t[i+1],t[i+2]],a=[this._vertexBuffer[t[i+0]*2+0],this._vertexBuffer[t[i+0]*2+1],this._vertexBuffer[t[i+1]*2+0],this._vertexBuffer[t[i+1]*2+1],this._vertexBuffer[t[i+2]*2+0],this._vertexBuffer[t[i+2]*2+1]],s=1/0,o=1/0,l=-1/0,u=-1/0;for(let d=0;d<3;d++){let y=a[d*2],m=a[d*2+1];s=Math.min(s,y),l=Math.max(l,y),o=Math.min(o,m),u=Math.max(u,m)}if(s===l||o===u)continue;let h=Math.floor(s/this._granularityCellSize),c=Math.ceil(l/this._granularityCellSize),p=Math.floor(o/this._granularityCellSize),f=Math.ceil(u/this._granularityCellSize);if(h===c&&p===f){e.push(...n);continue}for(let d=p;d<f;d++){let y=this._scanlineGenerateVertexRingForCellRow(d,a,n);xx(this._vertexBuffer,y,e)}}return e}_scanlineGenerateVertexRingForCellRow(t,e,r){let i=t*this._granularityCellSize,n=i+this._granularityCellSize,a=[];for(let s=0;s<3;s++){let o=e[s*2],l=e[s*2+1],u=e[(s+1)*2%6],h=e[((s+1)*2+1)%6],c=e[(s+2)*2%6],p=e[((s+2)*2+1)%6],f=u-o,d=h-l,y=f===0,m=d===0,g=(i-l)/d,x=(n-l)/d,b=Math.min(g,x),v=Math.max(g,x);if(!m&&(b>=1||v<=0)||m&&(l<i||l>n)){h>=i&&h<=n&&a.push(r[(s+1)%3]);continue}if(!m&&b>0){let A=o+f*b,S=l+d*b;a.push(this._vertexToIndex(A,S))}let w=o+f*Math.max(b,0),_=o+f*Math.min(v,1);if(y||this._generateIntraEdgeVertices(a,o,l,u,h,w,_),!m&&v<1){let A=o+f*v,S=l+d*v;a.push(this._vertexToIndex(A,S))}(m||h>=i&&h<=n)&&a.push(r[(s+1)%3]),!m&&(h<=i||h>=n)&&this._generateInterEdgeVertices(a,o,l,u,h,c,p,_,i,n)}return a}_generateIntraEdgeVertices(t,e,r,i,n,a,s){let o=i-e,l=n-r,u=l===0,h=u?Math.min(e,i):Math.min(a,s),c=u?Math.max(e,i):Math.max(a,s),p=Math.floor(h/this._granularityCellSize)+1,f=Math.ceil(c/this._granularityCellSize)-1;if(u?e<i:a<s)for(let d=p;d<=f;d++){let y=d*this._granularityCellSize,m=r+l*(y-e)/o;t.push(this._vertexToIndex(y,m))}else for(let d=f;d>=p;d--){let y=d*this._granularityCellSize,m=r+l*(y-e)/o;t.push(this._vertexToIndex(y,m))}}_generateInterEdgeVertices(t,e,r,i,n,a,s,o,l,u){let h=n-r,c=a-i,p=s-n,f=(l-n)/p,d=(u-n)/p,y=Math.min(f,d),m=Math.max(f,d),g=i+c*y,x=Math.floor(Math.min(g,o)/this._granularityCellSize)+1,b=Math.ceil(Math.max(g,o)/this._granularityCellSize)-1,v=o<g,w=p===0;if(w&&(s===l||s===u))return;if(w||y>=1||m<=0){let A=e-a,S=r-s,F=(l-s)/S,L=(u-s)/S,V=a+A*Math.min(F,L);x=Math.floor(Math.min(V,o)/this._granularityCellSize)+1,b=Math.ceil(Math.max(V,o)/this._granularityCellSize)-1,v=o<V}let _=h>0?u:l;if(v)for(let A=x;A<=b;A++){let S=A*this._granularityCellSize;t.push(this._vertexToIndex(S,_))}else for(let A=b;A>=x;A--){let S=A*this._granularityCellSize;t.push(this._vertexToIndex(S,_))}}_generateOutline(t){let e=[];for(let r of t){let i=hr(r,this._granularity,!0),n=this._pointArrayToIndices(i),a=[];for(let s=1;s<n.length;s++)a.push(n[s-1]),a.push(n[s]);e.push(a)}return e}_handlePoles(t){let e=!1,r=!1;this._canonical&&(this._canonical.y===0&&(e=!0),this._canonical.y===(1<<this._canonical.z)-1&&(r=!0)),(e||r)&&this._fillPoles(t,e,r)}_ensureNoPoleVertices(){let t=this._vertexBuffer;for(let e=0;e<t.length;e+=2){let r=t[e+1];r===-32768&&(t[e+1]=-32767),r===32767&&(t[e+1]=32766)}}_generatePoleQuad(t,e,r,i,n,a){i>n==(a===-32768)?(t.push(r),t.push(e),t.push(this._vertexToIndex(i,a)),t.push(this._vertexToIndex(n,a)),t.push(r),t.push(this._vertexToIndex(i,a))):(t.push(e),t.push(r),t.push(this._vertexToIndex(i,a)),t.push(r),t.push(this._vertexToIndex(n,a)),t.push(this._vertexToIndex(i,a)))}_fillPoles(t,e,r){let i=this._vertexBuffer,n=mt,a=t.length;for(let s=2;s<a;s+=3){let o=t[s-2],l=t[s-1],u=t[s],h=i[o*2],c=i[o*2+1],p=i[l*2],f=i[l*2+1],d=i[u*2],y=i[u*2+1];e&&(c===0&&f===0&&this._generatePoleQuad(t,o,l,h,p,Vs),f===0&&y===0&&this._generatePoleQuad(t,l,u,p,d,Vs),y===0&&c===0&&this._generatePoleQuad(t,u,o,d,h,Vs)),r&&(c===n&&f===n&&this._generatePoleQuad(t,o,l,h,p,Os),f===n&&y===n&&this._generatePoleQuad(t,l,u,p,d,Os),y===n&&c===n&&this._generatePoleQuad(t,u,o,d,h,Os))}}_initializeVertices(t){for(let e=0;e<t.length;e+=2)this._vertexToIndex(t[e],t[e+1])}subdividePolygonInternal(t,e){if(this._used)throw Error(\"Subdivision: multiple use not allowed.\");this._used=!0;let{flattened:r,holeIndices:i}=mx(t);this._initializeVertices(r);let n;try{let s=Zg(r,i),o=this._convertIndices(r,s);n=this._subdivideTrianglesScanline(o)}catch(s){console.error(s)}let a=[];return e&&(a=this._generateOutline(t)),this._ensureNoPoleVertices(),this._handlePoles(n),this._granularity>=2&&this._canonical?.z===0&&(n=this._removeTrianglesOutsideTileX(n),a=a.map(s=>this._removeLinesOutsideTileX(s))),{verticesFlattened:this._vertexBuffer,indicesTriangles:n,indicesLineList:a}}_vertexOutsideTileX(t){let e=this._vertexBuffer[t*2];return e<0||e>8192}_removeTrianglesOutsideTileX(t){let e=[];for(let r=0;r<t.length;r+=3)this._vertexOutsideTileX(t[r])||this._vertexOutsideTileX(t[r+1])||this._vertexOutsideTileX(t[r+2])||e.push(t[r],t[r+1],t[r+2]);return e}_removeLinesOutsideTileX(t){let e=[];for(let r=0;r<t.length;r+=2)this._vertexOutsideTileX(t[r])||this._vertexOutsideTileX(t[r+1])||e.push(t[r],t[r+1]);return e}_convertIndices(t,e){let r=[];for(let i of e){let n=t[i*2],a=t[i*2+1];r.push(this._vertexToIndex(n,a))}return r}_pointArrayToIndices(t){let e=[];for(let r of t)e.push(this._vertexToIndex(r.x,r.y));return e}};function Dd(t,e,r,i=!0){return new yx(r,e).subdividePolygonInternal(t,i)}function hr(t,e,r=!1){if(!t||t.length<1||t.length<2)return[];let i=t[0],n=t[t.length-1],a=r&&(i.x!==n.x||i.y!==n.y);if(e<2)return a?[...t,t[0]]:[...t];let s=Math.floor(mt/e),o=[];o.push(new B(t[0].x,t[0].y));let l=t.length,u=a?l:l-1;for(let h=0;h<u;h++){let c=t[h],p=h<l-1?t[h+1]:t[0],f=c.x,d=c.y,y=p.x,m=p.y,g=f!==y,x=d!==m;if(!g&&!x)continue;let b=y-f,v=m-d,w=Math.abs(b),_=Math.abs(v),A=f,S=d;for(;;){let L=b>0?(Math.floor(A/s)+1)*s:(Math.ceil(A/s)-1)*s,V=v>0?(Math.floor(S/s)+1)*s:(Math.ceil(S/s)-1)*s,P=Math.abs(A-L),R=Math.abs(S-V),E=Math.abs(A-y),$=Math.abs(S-m),O=g?P/w:1/0,M=x?R/_:1/0;if((E<=P||!g)&&($<=R||!x))break;if(O<M&&g||!x){A=L,S+=v*O;let j=new B(A,Math.round(S));(o[o.length-1].x!==j.x||o[o.length-1].y!==j.y)&&o.push(j)}else{A+=b*M,S=V;let j=new B(Math.round(A),S);(o[o.length-1].x!==j.x||o[o.length-1].y!==j.y)&&o.push(j)}}let F=new B(y,m);(o[o.length-1].x!==F.x||o[o.length-1].y!==F.y)&&o.push(F)}return o}function mx(t){let e=[],r=[];for(let i of t)if(i.length!==0){i!==t[0]&&e.push(r.length/2);for(let n of i)r.push(n.x),r.push(n.y)}return{flattened:r,holeIndices:e}}function gx(t,e){let r=[];for(let i=0;i<e.length;i+=3){let n=e[i],a=e[i+1],s=e[i+2],o=t[n*2],l=t[n*2+1],u=t[a*2],h=t[a*2+1],c=t[s*2],p=t[s*2+1],f=u-o,d=h-l,y=c-o;f*(p-l)-d*y>0?(r.push(n),r.push(s),r.push(a)):(r.push(n),r.push(a),r.push(s))}return r}function xx(t,e,r){if(e.length===0)throw Error(\"Subdivision vertex ring is empty.\");let i=0,n=t[e[0]*2];for(let l=1;l<e.length;l++){let u=t[e[l]*2];u<n&&(n=u,i=l)}let a=e.length,s=i,o=(s+1)%a;for(;;){let l=s-1>=0?s-1:a-1,u=(o+1)%a,h=t[e[l]*2],c=t[e[l]*2+1],p=t[e[u]*2],f=t[e[u]*2+1],d=t[e[s]*2],y=t[e[s]*2+1],m=t[e[o]*2],g=t[e[o]*2+1],x=!1;if(h<p)x=!0;else if(h>p)x=!1;else{let b=g-y,v=-(m-d),w=y<g?1:-1;((h-d)*b+(c-y)*v)*w>((p-d)*b+(f-y)*v)*w&&(x=!0)}if(x){let b=e[l],v=e[s],w=e[o];b!==v&&b!==w&&v!==w&&r.push(w,v,b),s--,s<0&&(s=a-1)}else{let b=e[u],v=e[s],w=e[o];b!==v&&b!==w&&v!==w&&r.push(w,v,b),o++,o>=a&&(o=0)}if(l===u)break}}function _d(t,e,r,i,n,a,s,o,l){let u=n.length/2,h=s&&o&&l;if(u<te.MAX_VERTEX_ARRAY_LENGTH){let c=e.prepareSegment(u,r,i),p=c.vertexLength;for(let y=0;y<a.length;y+=3)i.emplaceBack(p+a[y],p+a[y+1],p+a[y+2]);c.vertexLength+=u,c.primitiveLength+=a.length/3;let f,d;h&&(d=s.prepareSegment(u,r,o),f=d.vertexLength,d.vertexLength+=u);for(let y=0;y<n.length;y+=2)t(n[y],n[y+1]);if(h)for(let y of l){for(let m=1;m<y.length;m+=2)o.emplaceBack(f+y[m-1],f+y[m]);d.primitiveLength+=y.length/2}}else vx(e,r,i,n,a,t),h&&bx(s,r,o,n,l,t),e.forceNewSegmentOnNextPrepare(),s?.forceNewSegmentOnNextPrepare()}function Yi(t,e,r,i,n,a,s){if(a){let o=i.count;return r(e[n*2],e[n*2+1]),t[n]=i.count,i.count++,s.vertexLength++,o}return t[n]}function vx(t,e,r,i,n,a){let s=[];for(let c=0;c<i.length/2;c++)s.push(-1);let o={count:0},l=0,u=t.getOrCreateLatestSegment(e,r),h=u.vertexLength;for(let c=2;c<n.length;c+=3){let p=n[c-2],f=n[c-1],d=n[c],y=s[p]<l,m=s[f]<l,g=s[d]<l,x=+!!y+ +!!m+ +!!g;u.vertexLength+x>te.MAX_VERTEX_ARRAY_LENGTH&&(u=t.createNewSegment(e,r),l=o.count,y=!0,m=!0,g=!0,h=0);let b=Yi(s,i,a,o,p,y,u),v=Yi(s,i,a,o,f,m,u),w=Yi(s,i,a,o,d,g,u);r.emplaceBack(h+b-l,h+v-l,h+w-l),u.primitiveLength++}}function bx(t,e,r,i,n,a){let s=[];for(let c=0;c<i.length/2;c++)s.push(-1);let o={count:0},l=0,u=t.getOrCreateLatestSegment(e,r),h=u.vertexLength;for(let c of n)for(let p=1;p<c.length;p+=2){let f=c[p-1],d=c[p],y=s[f]<l,m=s[d]<l,g=+!!y+ +!!m;u.vertexLength+g>te.MAX_VERTEX_ARRAY_LENGTH&&(u=t.createNewSegment(e,r),l=o.count,y=!0,m=!0,h=0);let x=Yi(s,i,a,o,f,y,u),b=Yi(s,i,a,o,d,m,u);r.emplaceBack(h+x-l,h+b-l),u.primitiveLength++}}var Ad=class{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(e=>e.id),this.index=t.index,this.hasDependencies=!1,this.sdfPatterns={},this.patternFeatures=[],this.layoutVertexArray=new rg,this.indexArray=new xn,this.indexArray2=new Fo,this.programConfigurations=new gr(t.layers,t.zoom),this.segments=new te,this.segments2=new te,this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id)}populate(t,e,r){this.hasDependencies=xa(\"fill\",this.layers,e);let i=this.layers[0].layout.get(\"fill-sort-key\"),n=!i.isConstant(),a=[],s=new at(this.zoom),o=this.layers[0]._featureFilter.needGeometry;for(let{feature:l,id:u,index:h,sourceLayerIndex:c}of t){let p=li(l,o);if(!this.layers[0]._featureFilter.filter(s,p,r))continue;let f=n?i.evaluate(p,{},r,e.availableImages):void 0,d={id:u,properties:l.properties,type:l.type,sourceLayerIndex:c,index:h,geometry:o?p.geometry:Dr(l),patterns:{},sortKey:f};a.push(d)}n&&a.sort((l,u)=>l.sortKey-u.sortKey);for(let l of a){let{geometry:u,index:h,sourceLayerIndex:c}=l;if(this.hasDependencies){let f=Ul(\"fill\",this.layers,l,{zoom:this.zoom},e);this.patternFeatures.push(f)}else this.addFeature(l,u,h,r,{},e.subdivisionGranularity);let p=t[h].feature;e.featureIndex.insert(p,u,h,c,this.index)}}update(t,e,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,{imagePositions:r})}addFeatures({options:t,canonical:e,patternPositions:r,patternMap:i}){this.detectSdfPatterns(i);for(let n of this.patternFeatures)this.addFeature(n,n.geometry,n.index,e,r,t.subdivisionGranularity)}detectSdfPatterns(t){for(let e of this.patternFeatures)for(let r in e.patterns){let i=e.patterns[r];this.recordSdfPattern(r,t[i.min]),this.recordSdfPattern(r,t[i.mid]),this.recordSdfPattern(r,t[i.max])}for(let e of this.layers){let r=e.paint.get(\"fill-pattern\").constantOr(null);r&&(this.recordSdfPattern(e.id,t[r.from.toString()]),this.recordSdfPattern(e.id,t[r.to.toString()]))}}recordSdfPattern(t,e){if(!e)return;let r=e.sdf===!0,i=this.sdfPatterns[t];i===void 0?this.sdfPatterns[t]=r:i!==r&&Mt(`Style sheet warning: Cannot mix SDF and non-SDF fill patterns in layer \"${t}\"`)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Wg),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.indexBuffer2=t.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy())}addFeature(t,e,r,i,n,a){for(let s of Ba(e,500)){let o=Dd(s,i,a.fill.getGranularityForZoomLevel(i.z)),l=this.layoutVertexArray;_d((u,h)=>{l.emplaceBack(u,h)},this.segments,this.layoutVertexArray,this.indexArray,o.verticesFlattened,o.indicesTriangles,this.segments2,this.indexArray2,o.indicesLineList)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,r,{imagePositions:n,canonical:i})}};I(\"FillBucket\",Ad,{omit:[\"layers\",\"patternFeatures\"]});var ic,wx=()=>ic||(ic=new jt({\"fill-sort-key\":new U(D.layout_fill[\"fill-sort-key\"],\"fill-sort-key\")})),nc,Dx=()=>nc||(nc=new jt({\"fill-antialias\":new z(D.paint_fill[\"fill-antialias\"],\"fill-antialias\"),\"fill-opacity\":new U(D.paint_fill[\"fill-opacity\"],\"fill-opacity\"),\"fill-layer-opacity\":new z(D.paint_fill[\"fill-layer-opacity\"],\"fill-layer-opacity\"),\"fill-color\":new U(D.paint_fill[\"fill-color\"],\"fill-color\"),\"fill-outline-color\":new U(D.paint_fill[\"fill-outline-color\"],\"fill-outline-color\"),\"fill-translate\":new z(D.paint_fill[\"fill-translate\"],\"fill-translate\"),\"fill-translate-anchor\":new z(D.paint_fill[\"fill-translate-anchor\"],\"fill-translate-anchor\"),\"fill-pattern\":new nn(D.paint_fill[\"fill-pattern\"],\"fill-pattern\")})),_x={get paint(){return Dx()},get layout(){return wx()}};var Ax=class extends pe{constructor(t,e){super(t,_x,e)}recalculate(t,e){super.recalculate(t,e);let r=this.paint._values[\"fill-outline-color\"];r.value.kind===\"constant\"&&r.value.value===void 0&&(this.paint._values[\"fill-outline-color\"]=this.paint._values[\"fill-color\"])}createBucket(t){return new Ad(t)}queryRadius(){return ja(this.paint.get(\"fill-translate\"))}queryIntersectsFeature({queryGeometry:t,geometry:e,transform:r,pixelsToTileUnits:i}){return hd(Ga(t,this.paint.get(\"fill-translate\"),this.paint.get(\"fill-translate-anchor\"),-r.bearingInRadians,i),e)}isTileClipped(){return!0}},Uo=St([{name:\"a_pos\",components:2,type:\"Int16\"},{name:\"a_normal_ed\",components:4,type:\"Int16\"}],4),Sx=St([{name:\"a_centroid\",components:2,type:\"Int16\"}],4),Ex=Uo.members;Uo.size,Uo.alignment;var wa=class qo{constructor(){this.minX=1/0,this.maxX=-1/0,this.minY=1/0,this.maxY=-1/0}extend(e){return this.minX=Math.min(this.minX,e.x),this.minY=Math.min(this.minY,e.y),this.maxX=Math.max(this.maxX,e.x),this.maxY=Math.max(this.maxY,e.y),this}expandBy(e){return this.minX-=e,this.minY-=e,this.maxX+=e,this.maxY+=e,(this.minX>this.maxX||this.minY>this.maxY)&&(this.minX=1/0,this.maxX=-1/0,this.minY=1/0,this.maxY=-1/0),this}shrinkBy(e){return this.expandBy(-e)}map(e){let r=new qo;return r.extend(e(new B(this.minX,this.minY))),r.extend(e(new B(this.maxX,this.minY))),r.extend(e(new B(this.minX,this.maxY))),r.extend(e(new B(this.maxX,this.maxY))),r}static fromPoints(e){let r=new qo;for(let i of e)r.extend(i);return r}contains(e){return e.x>=this.minX&&e.x<=this.maxX&&e.y>=this.minY&&e.y<=this.maxY}empty(){return this.minX>this.maxX}width(){return this.maxX-this.minX}height(){return this.maxY-this.minY}covers(e){return!this.empty()&&!e.empty()&&e.minX>=this.minX&&e.maxX<=this.maxX&&e.minY>=this.minY&&e.maxY<=this.maxY}intersects(e){return!this.empty()&&!e.empty()&&e.minX<=this.maxX&&e.maxX>=this.minX&&e.minY<=this.maxY&&e.maxY>=this.minY}},s5=wa.fromPoints([new B(0,0),new B(mt,mt)]);function jo(t,e){return t.x===e.x&&(t.x<0||t.x>8192)||t.y===e.y&&(t.y<0||t.y>8192)}function ac(t){return t.every(e=>e.x<0)||t.every(e=>e.x>8192)||t.every(e=>e.y<0)||t.every(e=>e.y>8192)}var vn=class{constructor(t,e,r,i,n){for(this.properties=Object.create(null),this.extent=r,this.type=0,this.id=void 0,this._pbf=t,this._geometry=-1,this._keys=i,this._values=n;t.pos<e;){let a=t.readVarint();if(a===8)this.id=t.readVarint();else if(a===18){let s=t.readVarint()+t.pos;for(;t.pos<s;){let o=i[t.readVarint()],l=n[t.readVarint()];this.properties[o]=l}}else a===24?this.type=t.readVarint():(a===34&&(this._geometry=t.pos),t.skip(a))}}loadGeometry(){if(this._geometry<0)throw Error(\"feature has no geometry\");let t=this._pbf;t.pos=this._geometry;let e=t.readVarint()+t.pos,r=[],i,n=1,a=0,s=0,o=0;for(;t.pos<e;){if(a<=0){let l=t.readVarint();if(n=l&7,a=l>>3,a===0)continue}if(a--,n===1)s+=t.readSVarint(),o+=t.readSVarint(),i&&r.push(i),i=[new B(s,o)];else if(n===2)s+=t.readSVarint(),o+=t.readSVarint(),i&&i.push(new B(s,o));else if(n===7)i&&i.push(i[0].clone());else throw Error(`unknown command ${n}`)}return i&&r.push(i),r}bbox(){if(this._geometry<0)throw Error(\"feature has no geometry\");let t=this._pbf;t.pos=this._geometry;let e=t.readVarint()+t.pos,r=1,i=0,n=0,a=0,s=1/0,o=-1/0,l=1/0,u=-1/0;for(;t.pos<e;){if(i<=0){let h=t.readVarint();if(r=h&7,i=h>>3,i===0)continue}if(i--,r===1||r===2)n+=t.readSVarint(),a+=t.readSVarint(),n<s&&(s=n),n>o&&(o=n),a<l&&(l=a),a>u&&(u=a);else if(r!==7)throw Error(`unknown command ${r}`)}return[s,l,o,u]}toGeoJSON(t,e,r){let i=this.extent*2**r,n=this.extent*t,a=this.extent*e,s=this.loadGeometry();function o(c){return[(c.x+n)*360/i-180,360/Math.PI*Math.atan(Math.exp((1-(c.y+a)*2/i)*Math.PI))-90]}function l(c){return c.map(o)}let u;if(this.type===1){let c=[];for(let f of s)c.push(f[0]);let p=l(c);u=c.length===1?{type:\"Point\",coordinates:p[0]}:{type:\"MultiPoint\",coordinates:p}}else if(this.type===2){let c=s.map(l);u=c.length===1?{type:\"LineString\",coordinates:c[0]}:{type:\"MultiLineString\",coordinates:c}}else if(this.type===3){let c=Sd(s),p=[];for(let f of c)p.push(f.map(l));u=p.length===1?{type:\"Polygon\",coordinates:p[0]}:{type:\"MultiPolygon\",coordinates:p}}else throw Error(\"unknown feature type\");let h={type:\"Feature\",geometry:u,properties:this.properties};return this.id!=null&&(h.id=this.id),h}};vn.types=[\"Unknown\",\"Point\",\"LineString\",\"Polygon\"];function Sd(t){let e=t.length;if(e<=1)return[t];let r=[],i,n;for(let a=0;a<e;a++){let s=Fx(t[a]);s!==0&&(n===void 0&&(n=s<0),n===s<0?(i&&r.push(i),i=[t[a]]):i&&i.push(t[a]))}return i&&r.push(i),r}function Fx(t){let e=0;for(let r=0,i=t.length,n=i-1,a,s;r<i;n=r++)a=t[r],s=t[n],e+=(s.x-a.x)*(a.y+s.y);return e}var Tx=class{constructor(t,e){for(this.version=1,this.name=\"\",this.extent=4096,this.length=0,this._pbf=t,this._keys=[],this._values=[],this._features=[],e===void 0&&(e=t.length);t.pos<e;){let r=t.readVarint();r===10?this.name=t.readString():r===18?(this._features.push(t.pos),t.skip(r)):r===26?this._keys.push(t.readString()):r===34?this._values.push(kx(t)):r===40?this.extent=t.readVarint():r===120?this.version=t.readVarint():t.skip(r)}this.length=this._features.length}feature(t){if(t<0||t>=this._features.length)throw Error(\"feature index out of bounds\");this._pbf.pos=this._features[t];let e=this._pbf.readVarint()+this._pbf.pos;return new vn(this._pbf,e,this.extent,this._keys,this._values)}};function kx(t){let e=null,r=t.readVarint()+t.pos;for(;t.pos<r;){let i=t.readVarint();e=i===10?t.readString():i===21?t.readFloat():i===25?t.readDouble():i===32?t.readVarint(!0):i===40?t.readVarint():i===48?t.readSVarint():i===56?t.readBoolean():(t.skip(i),null)}if(e==null)throw Error(\"unknown feature value\");return e}var ql=class{constructor(t,e=t.length){let r=Object.create(null);for(;t.pos<e;){let i=t.readVarint();if(i===26){let n=new Tx(t,t.readVarint()+t.pos);n.length&&(r[n.name]=n)}else t.skip(i)}this.layers=r}},Ed=63710088e-1,sc=class Ri{constructor(e,r){if(isNaN(e)||isNaN(r))throw Error(`Invalid LngLat object: (${e}, ${r})`);if(this.lng=+e,this.lat=+r,this.lat>90||this.lat<-90)throw Error(\"Invalid LngLat latitude value: must be between -90 and 90\")}wrap(){return new Ri(B1(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(e){let r=Math.PI/180,i=this.lat*r,n=e.lat*r,a=Math.sin(i)*Math.sin(n)+Math.cos(i)*Math.cos(n)*Math.cos((e.lng-this.lng)*r);return Ed*Math.acos(Math.min(a,1))}static convert(e){if(e instanceof Ri)return e;if(Array.isArray(e)&&(e.length===2||e.length===3))return new Ri(Number(e[0]),Number(e[1]));if(!Array.isArray(e)&&typeof e==\"object\"&&e)return new Ri(Number(\"lng\"in e?e.lng:e.lon),Number(e.lat));throw 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>]\")}},Fd=2*Math.PI*Ed;function Td(t){return Fd*Math.cos(t*Math.PI/180)}function Ix(t){return(180+t)/360}function Cx(t){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t*Math.PI/360)))/360}function Mx(t,e){return t/Td(e)}function Bx(t){return t*360-180}function Go(t){let e=180-t*360;return 360/Math.PI*Math.atan(Math.exp(e*Math.PI/180))-90}function Px(t,e){return t*Td(Go(e))}function zx(t){return 1/Math.cos(t*Math.PI/180)}var jl=class kd{constructor(e,r,i=0){this.x=+e,this.y=+r,this.z=+i}static fromLngLat(e,r=0){let i=sc.convert(e);return new kd(Ix(i.lng),Cx(i.lat),Mx(r,i.lat))}toLngLat(){return new sc(Bx(this.x),Go(this.y))}toAltitude(){return Px(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/Fd*zx(Go(this.y))}};function Lx(t,e,r){let i=1/(1<<r.z);return new jl(t/mt*i+r.x*i,e/mt*i+r.y*i)}function Vx(t,e,r){return Lx(t,e,r).toLngLat()}function oc(t,e,r){if(e<=0||!t||t.length===0)return t;let i=Ox(e,r);return t.map(n=>Rx(n,i))}function Ox(t,e){let r=Vx(mt/2,mt/2,e),i=jl.fromLngLat(r).meterInMercatorCoordinateUnits(),n=(1<<e.z)*mt;return t*i*n}function Rx(t,e){if(!t||t.length<3)return t;let r=t[0].x===t[t.length-1].x&&t[0].y===t[t.length-1].y,i=r?t.length-1:t.length;if(i<3)return t;let n=[];for(let s=0;s<i;s++){let o=t[(s-1+i)%i],l=t[s],u=t[(s+1)%i];if(jo(o,l)||jo(l,u)){n.push(l.clone());continue}Nx(n,o,l,u,e)}let a=$x(n);return a.length<3?t:(r&&a.push(a[0].clone()),a)}function $x(t){let e=[];for(let r of t){let i=r.round(),n=e[e.length-1];(n?.x!==i.x||n?.y!==i.y)&&e.push(i)}for(;e.length>1&&e[0].x===e[e.length-1].x&&e[0].y===e[e.length-1].y;)e.pop();return e}function Nx(t,e,r,i,n){let a=e.sub(r),s=i.sub(r),o=a.mag(),l=s.mag();if(o<1e-6||l<1e-6){t.push(r.clone());return}a._div(o),s._div(l);let u=a.x*s.x+a.y*s.y;if(Math.abs(u)>Math.cos(5*Math.PI/180)){t.push(r.clone());return}let h=.2,c=Math.min(n,o*h,l*h),p=r.add(a.mult(c)),f=r.add(s.mult(c)),d=Math.sqrt((1+u)/2),y=r.add(a.add(s)._unit()._mult(c/d)),m=p.sub(y).angleWith(f.sub(y)),g=Math.max(2,Math.ceil(Math.abs(m)/(Math.PI/6)-1e-6));for(let x=0;x<=g;x++)t.push(p.rotateAround(x/g*m,y))}var Rs=8192;function ki(t,e,r,i,n,a,s,o){t.emplaceBack(e,r,Math.floor(i*Rs)*2+s,n*Rs*2,a*Rs*2,Math.round(o))}var Id=class{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(e=>e.id),this.index=t.index,this.hasDependencies=!1,this.layoutVertexArray=new ig,this.centroidVertexArray=new tg,this.indexArray=new xn,this.programConfigurations=new gr(t.layers,t.zoom),this.segments=new te,this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id)}populate(t,e,r){this.features=[],this.hasDependencies=xa(\"fill-extrusion\",this.layers,e);let i=new at(this.zoom),n=this.layers[0],a=n.layout.get(\"fill-extrusion-rounded-corner-distance\"),s=n._featureFilter.needGeometry;for(let{feature:o,id:l,index:u,sourceLayerIndex:h}of t){let c=li(o,s);if(!n._featureFilter.filter(i,c,r))continue;let p=s?c.geometry:Dr(o),f={id:l,sourceLayerIndex:h,index:u,geometry:a>0?oc(p,a,r):p,properties:o.properties,type:o.type,patterns:{}};this.hasDependencies?this.features.push(Ul(\"fill-extrusion\",this.layers,f,{zoom:this.zoom},e)):this.addFeature(f,f.geometry,u,r,{},e.subdivisionGranularity),e.featureIndex.insert(o,f.geometry,u,h,this.index,!0)}}addFeatures({options:t,canonical:e,patternPositions:r}){for(let i of this.features){let{geometry:n}=i;this.addFeature(i,n,i.index,e,r,t.subdivisionGranularity)}}update(t,e,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,{imagePositions:r})}isEmpty(){return this.layoutVertexArray.length===0&&this.centroidVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Ex),this.centroidVertexBuffer=t.createVertexBuffer(this.centroidVertexArray,Sx.members,!0),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(t,e,r,i,n,a){let s=this.layers[0],o=s.layout?s.layout.get(\"fill-extrusion-rounded-corner-distance\"):0,l=o>0?oc(e,o,i):e;for(let u of Ba(l,500)){let h={x:0,y:0,sampleCount:0},c=this.layoutVertexArray.length;this.processPolygon(h,i,t,u,a);let p=this.layoutVertexArray.length-c,f=Math.floor(h.x/h.sampleCount),d=Math.floor(h.y/h.sampleCount);for(let y=0;y<p;y++)this.centroidVertexArray.emplaceBack(f,d)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,r,{imagePositions:n,canonical:i})}processPolygon(t,e,r,i,n){if(i.length<1||ac(i[0]))return;for(let h of i)h.length!==0&&Ux(t,h);let a={segment:this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray)},s=n.fill.getGranularityForZoomLevel(e.z),o=vn.types[r.type]===\"Polygon\";for(let h of i){if(h.length===0||ac(h))continue;let c=hr(h,s,o);this._generateSideFaces(c,a)}if(!o)return;let l=Dd(i,e,s,!1),u=this.layoutVertexArray;_d((h,c)=>{ki(u,h,c,0,0,1,1,0)},this.segments,this.layoutVertexArray,this.indexArray,l.verticesFlattened,l.indicesTriangles)}_generateSideFaces(t,e){let r=0;for(let i=1;i<t.length;i++){let n=t[i],a=t[i-1];if(jo(n,a))continue;e.segment.vertexLength+4>te.MAX_VERTEX_ARRAY_LENGTH&&(e.segment=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));let s=n.sub(a)._perp()._unit(),o=a.dist(n);r+o>32768&&(r=0),ki(this.layoutVertexArray,n.x,n.y,s.x,s.y,0,0,r),ki(this.layoutVertexArray,n.x,n.y,s.x,s.y,0,1,r),r+=o,ki(this.layoutVertexArray,a.x,a.y,s.x,s.y,0,0,r),ki(this.layoutVertexArray,a.x,a.y,s.x,s.y,0,1,r);let l=e.segment.vertexLength;this.indexArray.emplaceBack(l,l+2,l+1),this.indexArray.emplaceBack(l+1,l+2,l+3),e.segment.vertexLength+=4,e.segment.primitiveLength+=2}}};function Ux(t,e){for(let r=0;r<e.length;r++){let i=e[r];(r!==e.length-1||e[0].x!==i.x||e[0].y!==i.y)&&(t.x+=i.x,t.y+=i.y,t.sampleCount++)}}I(\"FillExtrusionBucket\",Id,{omit:[\"layers\",\"features\"]});var lc,qx=()=>lc||(lc=new jt({\"fill-extrusion-rounded-corner-distance\":new z(D[\"layout_fill-extrusion\"][\"fill-extrusion-rounded-corner-distance\"],\"fill-extrusion-rounded-corner-distance\")})),uc,jx=()=>uc||(uc=new jt({\"fill-extrusion-opacity\":new z(D[\"paint_fill-extrusion\"][\"fill-extrusion-opacity\"],\"fill-extrusion-opacity\"),\"fill-extrusion-color\":new U(D[\"paint_fill-extrusion\"][\"fill-extrusion-color\"],\"fill-extrusion-color\"),\"fill-extrusion-translate\":new z(D[\"paint_fill-extrusion\"][\"fill-extrusion-translate\"],\"fill-extrusion-translate\"),\"fill-extrusion-translate-anchor\":new z(D[\"paint_fill-extrusion\"][\"fill-extrusion-translate-anchor\"],\"fill-extrusion-translate-anchor\"),\"fill-extrusion-pattern\":new nn(D[\"paint_fill-extrusion\"][\"fill-extrusion-pattern\"],\"fill-extrusion-pattern\"),\"fill-extrusion-height\":new U(D[\"paint_fill-extrusion\"][\"fill-extrusion-height\"],\"fill-extrusion-height\"),\"fill-extrusion-base\":new U(D[\"paint_fill-extrusion\"][\"fill-extrusion-base\"],\"fill-extrusion-base\"),\"fill-extrusion-vertical-gradient\":new z(D[\"paint_fill-extrusion\"][\"fill-extrusion-vertical-gradient\"],\"fill-extrusion-vertical-gradient\")})),Gx={get paint(){return jx()},get layout(){return qx()}};var Yx=class extends pe{constructor(t,e){super(t,Gx,e)}createBucket(t){return new Id(t)}queryRadius(){return ja(this.paint.get(\"fill-extrusion-translate\"))}is3D(){return!0}queryIntersectsFeature({queryGeometry:t,feature:e,featureState:r,geometry:i,transform:n,pixelsToTileUnits:a,pixelPosMatrix:s}){let o=Ga(t,this.paint.get(\"fill-extrusion-translate\"),this.paint.get(\"fill-extrusion-translate-anchor\"),-n.bearingInRadians,a),l=this.paint.get(\"fill-extrusion-height\").evaluate(e,r),u=this.paint.get(\"fill-extrusion-base\").evaluate(e,r),h=Zx(o,s,0),c=Wx(i,u,l,s),p=c[0],f=c[1];return Xx(p,f,h)}};function Ii(t,e){return t.x*e.x+t.y*e.y}function hc(t,e){if(t.length===1){let r=0,i=e[r++],n;for(;!n||i.equals(n);)if(n=e[r++],!n)return 1/0;for(;r<e.length;r++){let a=e[r],s=t[0],o=n.sub(i),l=a.sub(i),u=s.sub(i),h=Ii(o,o),c=Ii(o,l),p=Ii(l,l),f=Ii(u,o),d=Ii(u,l),y=h*p-c*c,m=(p*f-c*d)/y,g=(h*d-c*f)/y,x=1-m-g,b=i.z*x+n.z*m+a.z*g;if(isFinite(b))return b}return 1/0}{let r=1/0;for(let i of e)r=Math.min(r,i.z);return r}}function Xx(t,e,r){let i=1/0;hd(r,e)&&(i=hc(r,e[0]));for(let n=0;n<e.length;n++){let a=e[n],s=t[n];for(let o=0;o<a.length-1;o++){let l=a[o],u=a[o+1],h=s[o],c=[l,u,s[o+1],h,l];bg(r,c)&&(i=Math.min(i,hc(r,c)))}}return i!==1/0&&i}function Wx(t,e,r,i){let n=[],a=[],s=i[8]*e,o=i[9]*e,l=i[10]*e,u=i[11]*e,h=i[8]*r,c=i[9]*r,p=i[10]*r,f=i[11]*r;for(let d of t){let y=[],m=[];for(let g of d){let x=g.x,b=g.y,v=i[0]*x+i[4]*b+i[12],w=i[1]*x+i[5]*b+i[13],_=i[2]*x+i[6]*b+i[14],A=i[3]*x+i[7]*b+i[15],S=v+s,F=w+o,L=_+l,V=A+u,P=v+h,R=w+c,E=_+p,$=A+f,O=new B(S/V,F/V);O.z=L/V,y.push(O);let M=new B(P/$,R/$);M.z=E/$,m.push(M)}n.push(y),a.push(m)}return[n,a]}function Zx(t,e,r){let i=[];for(let n of t){let a=[n.x,n.y,r,1];F1(a,a,e),i.push(new B(a[0]/a[3],a[1]/a[3]))}return i}function Yo(t,e,r,i){let n=i,a=e+(r-e>>1),s=r-e,o,l=t[e],u=t[e+1],h=t[r],c=t[r+1];for(let p=e+3;p<r;p+=3){let f=Hx(t[p],t[p+1],l,u,h,c);if(f>n){o=p,n=f;continue}if(f===n){let d=Math.abs(p-a);d<s&&(o=p,s=d)}}n>i&&(o-e>3&&Yo(t,e,o,i),t[o+2]=n,r-o>3&&Yo(t,o,r,i))}function Hx(t,e,r,i,n,a){let s=n-r,o=a-i;if(s!==0||o!==0){let l=((t-r)*s+(e-i)*o)/(s*s+o*o);l>1?(r=n,i=a):l>0&&(r+=s*l,i+=o*l)}return s=t-r,o=e-i,s*s+o*o}function Ct(t,e,r,i){let n={type:e,geom:r},a={id:t??null,type:n.type,geometry:n.geom,tags:i,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};switch(n.type){case\"Point\":case\"MultiPoint\":Ci(a,n.geom);break;case\"LineString\":Ci(a,n.geom.points);break;case\"Polygon\":Ci(a,n.geom[0].points);break;case\"MultiLineString\":for(let s of n.geom)Ci(a,s.points);break;case\"MultiPolygon\":for(let s of n.geom)Ci(a,s[0].points)}return a}function Gl(t){let e=t;t.points.length>64&&(e.points=new Float64Array(t.points))}function Ci(t,e){for(let r=0;r<e.length;r+=3)t.minX=Math.min(t.minX,e[r]),t.minY=Math.min(t.minY,e[r+1]),t.maxX=Math.max(t.maxX,e[r]),t.maxY=Math.max(t.maxY,e[r+1])}function Yl(t,e){let r=[];switch(t.type){case\"FeatureCollection\":for(let i=0;i<t.features.length;i++)oa(r,t.features[i],e,i);break;case\"Feature\":oa(r,t,e);break;default:oa(r,{type:\"Feature\",geometry:t,properties:void 0},e)}return r}function oa(t,e,r,i,n=0){if(!e.geometry)return;if(n>1024)throw Error(\"GeometryCollection nesting exceeds supported depth: 1024\");if(e.geometry.type===\"GeometryCollection\"){Jx(t,e,e.geometry,r,i,n+1);return}if(!e.geometry.coordinates?.length)return;let a=Kx(e,r,i),s=(r.tolerance/((1<<r.maxZoom)*r.extent))**2;switch(e.geometry.type){case\"Point\":Qx(t,a,e.geometry,e.properties);return;case\"MultiPoint\":t2(t,a,e.geometry,e.properties);return;case\"LineString\":e2(t,a,e.geometry,s,e.properties);return;case\"MultiLineString\":r2(t,a,e.geometry,s,r,e.properties);return;case\"Polygon\":i2(t,a,e.geometry,s,e.properties);return;case\"MultiPolygon\":n2(t,a,e.geometry,s,e.properties);return;default:throw Error(\"Input data is not a valid GeoJSON object.\")}}function Kx(t,e,r){return e.promoteId?t.properties?.[e.promoteId]:e.generateId?r||0:t.id}function Jx(t,e,r,i,n,a=0){for(let s of r.geometries)oa(t,{id:e.id,type:\"Feature\",geometry:s,properties:e.properties},i,n,a)}function Qx(t,e,r,i){let n=[];n.push(Xr(r.coordinates[0]),Wr(r.coordinates[1]),0),t.push(Ct(e,\"Point\",n,i))}function t2(t,e,r,i){let n=[];for(let a of r.coordinates)n.push(Xr(a[0]),Wr(a[1]),0);t.push(Ct(e,\"MultiPoint\",n,i))}function e2(t,e,r,i,n){let a={points:[]};Xl(r.coordinates,a,i,!1),t.push(Ct(e,\"LineString\",a,n))}function r2(t,e,r,i,n,a){if(n.lineMetrics)for(let s of r.coordinates){let o={points:[]};Xl(s,o,i,!1),t.push(Ct(e,\"LineString\",o,a))}else{let s=[];Wl(r.coordinates,s,i,!1),t.push(Ct(e,\"MultiLineString\",s,a))}}function i2(t,e,r,i,n){let a=[];Wl(r.coordinates,a,i,!0),t.push(Ct(e,\"Polygon\",a,n))}function n2(t,e,r,i,n){let a=[];for(let s of r.coordinates){let o=[];Wl(s,o,i,!0),a.push(o)}t.push(Ct(e,\"MultiPolygon\",a,n))}function Xl(t,e,r,i){let n,a,s=0;for(let l=0;l<t.length;l++){let u=Xr(t[l][0]),h=Wr(t[l][1]);e.points.push(u,h,0),l>0&&(s+=i?(n*h-u*a)/2:Math.sqrt((u-n)**2+(h-a)**2)),n=u,a=h}let o=e.points.length-3;e.points[2]=1,r>0&&Yo(e.points,0,o,r),e.points[o+2]=1,Gl(e),e.size=Math.abs(s),e.start=0,e.end=e.size}function Wl(t,e,r,i){for(let n=0;n<t.length;n++){let a={points:[]};Xl(t[n],a,r,i),e.push(a)}}function Xr(t){return t/360+.5}function Wr(t){let e=Math.sin(t*Math.PI/180),r=.5-.25*Math.log((1+e)/(1-e))/Math.PI;return r<0?0:r>1?1:r}function a2(t){return{type:\"FeatureCollection\",features:t.map(e=>Da(e))}}function Da(t){let e={type:\"Feature\",geometry:s2(t),properties:t.tags};return t.id!=null&&(e.id=t.id),e}function s2(t){let{type:e,geometry:r}=t;switch(e){case\"Point\":return{type:e,coordinates:Cd(r[0],r[1])};case\"MultiPoint\":return{type:e,coordinates:Xn(r)};case\"LineString\":return{type:e,coordinates:Xn(r.points)};case\"MultiLineString\":case\"Polygon\":return{type:e,coordinates:r.map(i=>Xn(i.points))};case\"MultiPolygon\":return{type:e,coordinates:r.map(i=>i.map(n=>Xn(n.points)))}}}function Xn(t){let e=[];for(let r=0;r<t.length;r+=3)e.push(Cd(t[r],t[r+1]));return e}function Cd(t,e){return[Md(t),Bd(e)]}function Md(t){return(t-.5)*360}function Bd(t){let e=(180-t*360)*Math.PI/180;return 360*Math.atan(Math.exp(e))/Math.PI-90}function ke(t,e,r,i,n,a,s,o){if(r/=e,i/=e,a>=r&&s<i)return t;if(s<r||a>=i)return null;let l=[];for(let u of t){let h=n===0?u.minX:u.minY,c=n===0?u.maxX:u.maxY;if(h>=r&&c<i){l.push(u);continue}if(!(c<r||h>=i))switch(u.type){case\"Point\":case\"MultiPoint\":o2(u,l,r,i,n);continue;case\"LineString\":l2(u,l,r,i,n,o);continue;case\"MultiLineString\":u2(u,l,r,i,n);continue;case\"Polygon\":h2(u,l,r,i,n);continue;case\"MultiPolygon\":c2(u,l,r,i,n);continue}}return l.length?l:null}function o2(t,e,r,i,n){let a=[];if(p2(t.geometry,a,r,i,n),!a.length)return;let s=a.length===3?\"Point\":\"MultiPoint\";e.push(Ct(t.id,s,a,t.tags))}function l2(t,e,r,i,n,a){let s=[];if(Pd(t.geometry,s,r,i,n,!1,a.lineMetrics),s.length){if(a.lineMetrics){for(let o of s)e.push(Ct(t.id,\"LineString\",o,t.tags));return}if(s.length>1){e.push(Ct(t.id,\"MultiLineString\",s,t.tags));return}e.push(Ct(t.id,\"LineString\",s[0],t.tags))}}function u2(t,e,r,i,n){let a=[];if(Zl(t.geometry,a,r,i,n,!1),a.length){if(a.length===1){e.push(Ct(t.id,\"LineString\",a[0],t.tags));return}e.push(Ct(t.id,\"MultiLineString\",a,t.tags))}}function h2(t,e,r,i,n){let a=[];Zl(t.geometry,a,r,i,n,!0),a.length&&e.push(Ct(t.id,\"Polygon\",a,t.tags))}function c2(t,e,r,i,n){let a=[];for(let s of t.geometry){let o=[];Zl(s,o,r,i,n,!0),o.length&&a.push(o)}a.length&&e.push(Ct(t.id,\"MultiPolygon\",a,t.tags))}function p2(t,e,r,i,n){for(let a=0;a<t.length;a+=3){let s=t[a+n];s>=r&&s<=i&&Zr(e,t[a],t[a+1],t[a+2])}}function Pd(t,e,r,i,n,a,s){let o=cc(t),l=n===0?f2:d2,u=t.start,h,c;for(let g=0;g<t.points.length-3;g+=3){let x=t.points[g],b=t.points[g+1],v=t.points[g+2],w=t.points[g+3],_=t.points[g+4],A=n===0?x:b,S=n===0?w:_,F=!1;s&&(h=Math.sqrt((x-w)**2+(b-_)**2)),A<r?S>r&&(c=l(o,x,b,w,_,r),s&&(o.start=u+h*c)):A>i?S<i&&(c=l(o,x,b,w,_,i),s&&(o.start=u+h*c)):Zr(o.points,x,b,v),S<r&&A>=r&&(c=l(o,x,b,w,_,r),F=!0),S>i&&A<=i&&(c=l(o,x,b,w,_,i),F=!0),!a&&F&&(s&&(o.end=u+h*c),e.push(o),o=cc(t)),s&&(u+=h)}let p=t.points.length-3,f=t.points[p],d=t.points[p+1],y=t.points[p+2],m=n===0?f:d;m>=r&&m<=i&&Zr(o.points,f,d,y),p=o.points.length-3,a&&p>=3&&(o.points[p]!==o.points[0]||o.points[p+1]!==o.points[1])&&Zr(o.points,o.points[0],o.points[1],o.points[2]),o.points.length&&(Gl(o),e.push(o))}function cc(t){return{points:[],size:t.size,start:t.start,end:t.end}}function Zl(t,e,r,i,n,a){for(let s of t)Pd(s,e,r,i,n,a,!1)}function Zr(t,e,r,i){t.push(e,r,i)}function f2(t,e,r,i,n,a){let s=(a-e)/(i-e);return Zr(t.points,a,r+(n-r)*s,1),s}function d2(t,e,r,i,n,a){let s=(a-r)/(n-r);return Zr(t.points,e+(i-e)*s,a,1),s}function Hl(t,e){let r=e.buffer/e.extent,i=t,n=ke(t,1,-1-r,r,0,-1,2,e),a=ke(t,1,1-r,2+r,0,-1,2,e);return!n&&!a||(i=ke(t,1,-r,1+r,0,-1,2,e)||[],n&&(i=pc(n,1).concat(i)),a&&(i=i.concat(pc(a,-1)))),i}function pc(t,e){let r=[];for(let i of t)switch(i.type){case\"Point\":case\"MultiPoint\":{let n=y2(i.geometry,e);r.push(Ct(i.id,i.type,n,i.tags));continue}case\"LineString\":{let n=$s(i.geometry,e);r.push(Ct(i.id,i.type,n,i.tags));continue}case\"MultiLineString\":case\"Polygon\":{let n=[];for(let a of i.geometry)n.push($s(a,e));r.push(Ct(i.id,i.type,n,i.tags));continue}case\"MultiPolygon\":{let n=[];for(let a of i.geometry){let s=[];for(let o of a)s.push($s(o,e));n.push(s)}r.push(Ct(i.id,i.type,n,i.tags));continue}}return r}function y2(t,e){let r=[];for(let i=0;i<t.length;i+=3)r.push(t[i]+e,t[i+1],t[i+2]);return r}function $s(t,e){let r={points:[],size:t.size};t.start!==void 0&&(r.start=t.start,r.end=t.end);for(let i=0;i<t.points.length;i+=3)r.points.push(t.points[i]+e,t.points[i+1],t.points[i+2]);return Gl(r),r}function m2(t,e,r){let i=x2(e,r),n=[];if(i.removeAll&&(n=t,t=[]),i.remove.size||i.add.size){let a=[];for(let s of t)(i.remove.has(s.id)||i.add.has(s.id))&&a.push(s);if(a.length){n=n.concat(a);let s=new Set(a.map(o=>o.id));t=t.filter(o=>!s.has(o.id))}if(i.add.size){let s=Yl({type:\"FeatureCollection\",features:Array.from(i.add.values())},r);s=Hl(s,r),n=n.concat(s),t=t.concat(s)}}if(i.update.size){let a=new Map,s=[];for(let o of t)i.update.has(o.id)?a.set(o.id,[...a.get(o.id)||[],o]):s.push(o);for(let[o,l]of i.update){let u=a.get(o);if(!u||u.length===0)continue;let h=g2(u,l,r);n=n.concat(u,h),s=s.concat(h)}t=s}return{affected:n,source:t}}function g2(t,e,r){let i=!!e.newGeometry,n=e.removeAllProperties||e.removeProperties?.length>0||e.addOrUpdateProperties?.length>0;if(i){let a=t[0],s=Yl({type:\"FeatureCollection\",features:[{type:\"Feature\",id:a.id,geometry:e.newGeometry,properties:n?fc(a.tags,e):a.tags}]},r);return s=Hl(s,r),s}if(n){let a=[];for(let s of t){let o={...s};o.tags=fc(o.tags,e),a.push(o)}return a}return t}function fc(t,e){if(e.removeAllProperties)return{};let r={...t||{}};if(e.removeProperties)for(let i of e.removeProperties)delete r[i];if(e.addOrUpdateProperties)for(let{key:i,value:n}of e.addOrUpdateProperties)r[i]=n;return r}function x2(t,e){return t?{removeAll:t.removeAll,remove:new Set(t.remove||[]),add:new Map(t.add?.map(r=>[e.promoteId?r.properties[e.promoteId]:r.id,r])),update:new Map(t.update?.map(r=>[r.id,r]))}:{remove:new Set,add:new Map,update:new Map}}var dc=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],dt=new Uint32Array(96),v2=class zd{static from(e){if(!e||e.byteLength===void 0||e.buffer)throw Error(\"Data must be an instance of ArrayBuffer or SharedArrayBuffer.\");let[r,i]=new Uint8Array(e,0,2);if(r!==219)throw Error(\"Data does not appear to be in a KDBush format.\");let n=i>>4;if(n!==1)throw Error(`Got v${n} data when expected v1.`);let a=dc[i&15];if(!a)throw Error(\"Unrecognized array type.\");let[s]=new Uint16Array(e,2,1),[o]=new Uint32Array(e,4,1);return new zd(o,s,a,void 0,e)}constructor(e,r=64,i=Float64Array,n=ArrayBuffer,a){if(isNaN(e)||e<0)throw Error(`Unexpected numItems value: ${e}.`);this.numItems=+e,this.nodeSize=Math.min(Math.max(+r,2),65535),this.ArrayType=i,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;let s=dc.indexOf(this.ArrayType),o=e*2*this.ArrayType.BYTES_PER_ELEMENT,l=e*this.IndexArrayType.BYTES_PER_ELEMENT,u=(8-l%8)%8;if(s<0)throw Error(`Unexpected typed array class: ${i}.`);if(a)this.data=a,this.ids=new this.IndexArrayType(a,8,e),this.coords=new i(a,8+l+u,e*2),this._pos=e*2,this._finished=!0;else{let h=this.data=new n(8+o+l+u);this.ids=new this.IndexArrayType(h,8,e),this.coords=new i(h,8+l+u,e*2),this._pos=0,this._finished=!1,new Uint8Array(h,0,2).set([219,16+s]),new Uint16Array(h,2,1)[0]=r,new Uint32Array(h,4,1)[0]=e}}add(e,r){let i=this._pos>>1;return this.ids[i]=i,this.coords[this._pos++]=e,this.coords[this._pos++]=r,i}finish(){let e=this._pos>>1;if(e!==this.numItems)throw Error(`Added ${e} items when expected ${this.numItems}.`);return Xo(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(e,r,i,n){if(!this._finished)throw Error(\"Data not yet indexed - call index.finish().\");let{ids:a,coords:s,nodeSize:o}=this;dt[0]=0,dt[1]=a.length-1,dt[2]=0;let l=3,u=[];for(;l>0;){let h=dt[--l],c=dt[--l],p=dt[--l];if(c-p<=o){for(let m=p;m<=c;m++){let g=s[2*m],x=s[2*m+1];g>=e&&g<=i&&x>=r&&x<=n&&u.push(a[m])}continue}let f=p+c>>1,d=s[2*f],y=s[2*f+1];d>=e&&d<=i&&y>=r&&y<=n&&u.push(a[f]),(h===0?e<=d:r<=y)&&(dt[l++]=p,dt[l++]=f-1,dt[l++]=1-h),(h===0?i>=d:n>=y)&&(dt[l++]=f+1,dt[l++]=c,dt[l++]=1-h)}return u}within(e,r,i){let n=[];return this.withinInto(e,r,i,n),n}withinInto(e,r,i,n){if(!this._finished)throw Error(\"Data not yet indexed - call index.finish().\");let{ids:a,coords:s,nodeSize:o}=this;dt[0]=0,dt[1]=a.length-1,dt[2]=0;let l=3,u=0,h=i*i;for(;l>0;){let c=dt[--l],p=dt[--l],f=dt[--l];if(p-f<=o){for(let g=f;g<=p;g++)yc(s[2*g],s[2*g+1],e,r)<=h&&(n[u++]=a[g]);continue}let d=f+p>>1,y=s[2*d],m=s[2*d+1];yc(y,m,e,r)<=h&&(n[u++]=a[d]),(c===0?e-i<=y:r-i<=m)&&(dt[l++]=f,dt[l++]=d-1,dt[l++]=1-c),(c===0?e+i>=y:r+i>=m)&&(dt[l++]=d+1,dt[l++]=p,dt[l++]=1-c)}return u}};function Xo(t,e,r,i,n,a){if(n-i<=r)return;let s=i+n>>1;Ld(t,e,s,i,n,a),Xo(t,e,r,i,s-1,1-a),Xo(t,e,r,s+1,n,1-a)}function Ld(t,e,r,i,n,a){for(;n>i;){if(n-i>600){let u=n-i+1,h=r-i+1,c=Math.log(u),p=.5*Math.exp(2*c/3),f=.5*Math.sqrt(c*p*(u-p)/u)*(h-u/2<0?-1:1);Ld(t,e,r,Math.max(i,Math.floor(r-h*p/u+f)),Math.min(n,Math.floor(r+(u-h)*p/u+f)),a)}let s=e[2*r+a],o=i,l=n;for(Mi(t,e,i,r),e[2*n+a]>s&&Mi(t,e,i,n);o<l;){for(Mi(t,e,o,l),o++,l--;e[2*o+a]<s;)o++;for(;e[2*l+a]>s;)l--}e[2*i+a]===s?Mi(t,e,i,l):(l++,Mi(t,e,l,n)),l<=r&&(i=l+1),r<=l&&(n=l-1)}}function Mi(t,e,r,i){Ns(t,r,i),Ns(e,2*r,2*i),Ns(e,2*r+1,2*i+1)}function Ns(t,e,r){let i=t[e];t[e]=t[r],t[r]=i}function yc(t,e,r,i){let n=t-r,a=e-i;return n*n+a*a}var Wo={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:t=>t},b2=class{constructor(t){this.options=Object.assign(Object.create(Wo),t),this.trees=Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[],this.points=[]}load(t){let e=[];for(let r of t){if(!r.geometry)continue;let[i,n]=r.geometry.coordinates,[a,s]=[Xr(i),Wr(n)],o={id:r.id,type:\"Point\",geometry:[a,s],tags:r.properties};e.push(o)}this.createIndex(e)}initialize(t){let e=[];for(let r of t)r.type===\"Point\"&&e.push(r);this.createIndex(e)}updateIndex(t,e,r){this.options=Object.assign(Object.create(Wo),r.clusterOptions),this.initialize(t)}createIndex(t){let{log:e,minZoom:r,maxZoom:i}=this.options;e&&console.time(\"total time\");let n=`prepare ${t.length} points`;e&&console.time(n),this.points=t;let a=[];for(let o=0;o<t.length;o++){let l=t[o];if(!l?.geometry)continue;let[u,h]=l.geometry;u=Math.fround(u),h=Math.fround(h),a.push(u,h,1/0,o,-1,1),this.options.reduce&&a.push(0)}let s=this.trees[i+1]=this.createTree(a);e&&console.timeEnd(n);for(let o=i;o>=r;o--){let l=Date.now();s=this.trees[o]=this.createTree(this.cluster(s,o)),e&&console.log(\"z%d: %d clusters in %dms\",o,s.numItems,Date.now()-l)}e&&console.timeEnd(\"total time\")}getClusters(t,e){return this.getClustersInternal(t,e).map(r=>Da(r))}getClustersInternal(t,e){let r=((t[0]+180)%360+360)%360-180,i=Math.max(-90,Math.min(90,t[1])),n=t[2]===180?180:((t[2]+180)%360+360)%360-180,a=Math.max(-90,Math.min(90,t[3]));if(t[2]-t[0]>=360)r=-180,n=180;else if(r>n){let h=this.getClustersInternal([r,i,180,a],e),c=this.getClustersInternal([-180,i,n,a],e);return h.concat(c)}let s=this.trees[this.limitZoom(e)],o=s.range(Xr(r),Wr(a),Xr(n),Wr(i)),l=s.flatData,u=[];for(let h of o){let c=this.stride*h;u.push(l[c+5]>1?w2(l,c,this.clusterProps):this.points[l[c+3]])}return u}getChildren(t){let e=this.getOriginId(t),r=this.getOriginZoom(t),i=Error(\"No cluster with the specified id: \"+t),n=this.trees[r];if(!n)throw i;let a=n.flatData;if(e*this.stride>=a.length)throw i;let s=this.options.radius/(this.options.extent*2**(r-1)),o=a[e*this.stride],l=a[e*this.stride+1],u=n.within(o,l,s),h=[];for(let c of u){let p=c*this.stride;a[p+4]===t&&h.push(a[p+5]>1?D2(a,p,this.clusterProps):Da(this.points[a[p+3]]))}if(h.length===0)throw i;return h}getLeaves(t,e,r){e||(e=10),r||(r=0);let i=[];return this.appendLeaves(i,t,e,r,0),i}getTile(t,e,r){let i=this.trees[this.limitZoom(t)];if(!i)return null;let n=2**t,{extent:a,radius:s}=this.options,o=s/a,l=(r-o)/n,u=(r+1+o)/n,h={transformed:!0,features:[],source:null,x:e,y:r,z:t};return this.addTileFeatures(i.range((e-o)/n,l,(e+1+o)/n,u),i.flatData,e,r,n,h),e===0&&this.addTileFeatures(i.range(1-o/n,l,1,u),i.flatData,n,r,n,h),e===n-1&&this.addTileFeatures(i.range(0,l,o/n,u),i.flatData,-1,r,n,h),h}getClusterExpansionZoom(t){return this.getOriginZoom(t)}appendLeaves(t,e,r,i,n){let a=this.getChildren(e);for(let s of a){let o=s.properties;if(o?.cluster?n+o.point_count<=i?n+=o.point_count:n=this.appendLeaves(t,o.cluster_id,r,i,n):n<i?n++:t.push(s),t.length===r)break}return n}createTree(t){let e=new v2(t.length/this.stride|0,this.options.nodeSize,Float32Array);for(let r=0;r<t.length;r+=this.stride)e.add(t[r],t[r+1]);return e.finish(),e.flatData=t,e.data=null,e}addTileFeatures(t,e,r,i,n,a){for(let s of t){let o=s*this.stride,l=e[o+5]>1,u,h,c;if(l)u=Kl(e,o,this.clusterProps),h=e[o],c=e[o+1];else{let d=this.points[e[o+3]];u=d.tags,[h,c]=d.geometry}let p={type:1,geometry:[[Math.round(this.options.extent*(h*n-r)),Math.round(this.options.extent*(c*n-i))]],tags:u},f;f=l||this.options.generateId?e[o+3]:this.points[e[o+3]].id,f!==void 0&&(p.id=f),a.features.push(p)}}limitZoom(t){return Math.max(this.options.minZoom,Math.min(Math.floor(+t),this.options.maxZoom+1))}cluster(t,e){let{radius:r,extent:i,reduce:n,minPoints:a}=this.options,s=r/(i*2**e),o=t.flatData,l=[],u=this.stride;for(let h=0;h<o.length;h+=u){if(o[h+2]<=e)continue;o[h+2]=e;let c=o[h],p=o[h+1],f=t.within(o[h],o[h+1],s),d=o[h+5],y=d;for(let m of f){let g=m*u;o[g+2]>e&&(y+=o[g+5])}if(y>d&&y>=a){let m=c*d,g=p*d,x,b=-1,v=((h/u|0)<<5)+(e+1)+this.points.length;for(let w of f){let _=w*u;if(o[_+2]<=e)continue;o[_+2]=e;let A=o[_+5];m+=o[_]*A,g+=o[_+1]*A,o[_+4]=v,n&&(x||(x=this.map(o,h,!0),b=this.clusterProps.length,this.clusterProps.push(x)),n(x,this.map(o,_)))}o[h+4]=v,l.push(m/y,g/y,1/0,v,-1,y),n&&l.push(b)}else{for(let m=0;m<u;m++)l.push(o[h+m]);if(y>1)for(let m of f){let g=m*u;if(!(o[g+2]<=e)){o[g+2]=e;for(let x=0;x<u;x++)l.push(o[g+x])}}}}return l}getOriginId(t){return t-this.points.length>>5}getOriginZoom(t){return(t-this.points.length)%32}map(t,e,r){if(t[e+5]>1){let a=this.clusterProps[t[e+6]];return r?Object.assign({},a):a}let i=this.points[t[e+3]].tags,n=this.options.map(i);return r&&n===i?Object.assign({},n):n}};function w2(t,e,r){return{id:t[e+3],type:\"Point\",tags:Kl(t,e,r),geometry:[t[e],t[e+1]]}}function D2(t,e,r){return{type:\"Feature\",id:t[e+3],properties:Kl(t,e,r),geometry:{type:\"Point\",coordinates:[Md(t[e]),Bd(t[e+1])]}}}function Kl(t,e,r){let i=t[e+5],n=i>=1e4?`${Math.round(i/1e3)}k`:i>=1e3?`${Math.round(i/100)/10}k`:i,a=t[e+6],s=a===-1?{}:Object.assign({},r[a]);return Object.assign(s,{cluster:!0,cluster_id:t[e+3],point_count:i,point_count_abbreviated:n})}var Vd=\"geojsonvt_clip_start\",Od=\"geojsonvt_clip_end\";function mc(t,e,r,i,n){let a=e===n.maxZoom?0:n.tolerance/((1<<e)*n.extent),s={transformed:!1,features:[],source:null,x:r,y:i,z:e,minX:2,minY:1,maxX:-1,maxY:0,numPoints:0,numSimplified:0,numFeatures:t.length};for(let o of t)_2(s,o,a,n);return s}function _2(t,e,r,i){switch(t.minX=Math.min(t.minX,e.minX),t.minY=Math.min(t.minY,e.minY),t.maxX=Math.max(t.maxX,e.maxX),t.maxY=Math.max(t.maxY,e.maxY),e.type){case\"Point\":case\"MultiPoint\":A2(t,e);return;case\"LineString\":S2(t,e,r,i);return;case\"MultiLineString\":case\"Polygon\":E2(t,e,r);return;case\"MultiPolygon\":F2(t,e,r);return}}function A2(t,e){let r=[];for(let n=0;n<e.geometry.length;n+=3)r.push(e.geometry[n],e.geometry[n+1]),t.numPoints++,t.numSimplified++;if(!r.length)return;let i={type:1,tags:e.tags||null,geometry:r};e.id!==null&&(i.id=e.id),t.features.push(i)}function S2(t,e,r,i){let n=[];if(Jl(n,e.geometry,t,r,!1,!1),!n.length)return;let a=e.tags||null;if(i.lineMetrics){a={};for(let o in e.tags)a[o]=e.tags[o];a[Vd]=e.geometry.start/e.geometry.size,a[Od]=e.geometry.end/e.geometry.size}let s={type:2,tags:a,geometry:n};e.id!==null&&(s.id=e.id),t.features.push(s)}function E2(t,e,r){let i=[];for(let a=0;a<e.geometry.length;a++)Jl(i,e.geometry[a],t,r,e.type===\"Polygon\",a===0);if(!i.length)return;let n={type:e.type===\"Polygon\"?3:2,tags:e.tags||null,geometry:i};e.id!==null&&(n.id=e.id),t.features.push(n)}function F2(t,e,r){let i=[];for(let a=0;a<e.geometry.length;a++){let s=e.geometry[a];for(let o=0;o<s.length;o++)Jl(i,s[o],t,r,!0,o===0)}if(!i.length)return;let n={type:3,tags:e.tags||null,geometry:i};e.id!==null&&(n.id=e.id),t.features.push(n)}function Jl(t,e,r,i,n,a){let s=i*i;if(i>0&&e.size<(n?s:i)){r.numPoints+=e.points.length/3;return}let o=[];for(let l=0;l<e.points.length;l+=3)(i===0||e.points[l+2]>s)&&(r.numSimplified++,o.push(e.points[l],e.points[l+1])),r.numPoints++;n&&T2(o,a),t.push(o)}function T2(t,e){let r=0;for(let i=0,n=t.length,a=n-2;i<n;a=i,i+=2)r+=(t[i]-t[a])*(t[i+1]+t[a+1]);if(r>0===e)for(let i=0,n=t.length;i<n/2;i+=2){let a=t[i],s=t[i+1];t[i]=t[n-2-i],t[i+1]=t[n-1-i],t[n-2-i]=a,t[n-1-i]=s}}function gc(t,e){if(t.transformed)return t;let r=1<<t.z,i=t.x,n=t.y;for(let a of t.features)a.type===1?k2(a,e,r,i,n):I2(a,e,r,i,n);return t.transformed=!0,t}function k2(t,e,r,i,n){let a=t,s=t.geometry,o=[];for(let l=0;l<s.length;l+=2)o.push(Rd(s[l],s[l+1],e,r,i,n));return a.geometry=o,a}function I2(t,e,r,i,n){let a=t,s=t.geometry,o=[];for(let l of s){let u=[];for(let h=0;h<l.length;h+=2)u.push(Rd(l[h],l[h+1],e,r,i,n));o.push(u)}return a.geometry=o,a}function Rd(t,e,r,i,n,a){return[Math.round(r*(t*i-n)),Math.round(r*(e*i-a))]}var C2=class{constructor(t){this.options=t,this.total=0,this.stats={},this.tiles={},this.tileCoords=[],this.stats={},this.total=0}initialize(t){this.splitTile(t,0,0,0),this.options.debug&&(t.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)))}updateIndex(t,e,r){r.debug>1&&(console.log(\"invalidating tiles\"),console.time(\"invalidating\")),this.invalidateTiles(e),r.debug>1&&console.timeEnd(\"invalidating\");let[i,n,a]=[0,0,0],s=mc(t,i,n,a,r);s.source=t;let o=Wn(i,n,a);if(this.tiles[o]=s,this.tileCoords.push({z:i,x:n,y:a,id:o}),r.debug){let l=`z${i}`;this.stats[l]=(this.stats[l]||0)+1,this.total++}}getClusterExpansionZoom(t){return null}getChildren(t){return null}getLeaves(t,e,r){return null}getTile(t,e,r){let{extent:i,debug:n}=this.options,a=1<<t;e=e+a&a-1;let s=Wn(t,e,r);if(this.tiles[s])return gc(this.tiles[s],i);n>1&&console.log(\"drilling down to z%d-%d-%d\",t,e,r);let o=t,l=e,u=r,h;for(;!h&&o>0;)o--,l>>=1,u>>=1,h=this.tiles[Wn(o,l,u)];return!h?.source||(n>1&&(console.log(\"found parent tile z%d-%d-%d\",o,l,u),console.time(\"drilling down\")),this.splitTile(h.source,o,l,u,t,e,r),n>1&&console.timeEnd(\"drilling down\"),!this.tiles[s])?null:gc(this.tiles[s],i)}splitTile(t,e,r,i,n,a,s){let o=[t,e,r,i],l=this.options,u=l.debug;for(;o.length;){i=o.pop(),r=o.pop(),e=o.pop(),t=o.pop();let h=1<<e,c=Wn(e,r,i),p=this.tiles[c];if(!p&&(u>1&&console.time(\"creation\"),p=this.tiles[c]=mc(t,e,r,i,l),this.tileCoords.push({z:e,x:r,y:i,id:c}),u)){u>1&&(console.log(\"tile z%d-%d-%d (features: %d, points: %d, simplified: %d)\",e,r,i,p.numFeatures,p.numPoints,p.numSimplified),console.timeEnd(\"creation\"));let A=`z${e}`;this.stats[A]=(this.stats[A]||0)+1,this.total++}if(p.source=t,n==null){if(e===l.indexMaxZoom||p.numPoints<=l.indexMaxPoints)continue}else{if(e===l.maxZoom||e===n)continue;if(n!=null){let A=n-e;if(r!==a>>A||i!==s>>A)continue}}if(p.source=null,!t.length)continue;u>1&&console.time(\"clipping\");let f=.5*l.buffer/l.extent,d=.5-f,y=.5+f,m=1+f,g=null,x=null,b=null,v=null,w=ke(t,h,r-f,r+y,0,p.minX,p.maxX,l),_=ke(t,h,r+d,r+m,0,p.minX,p.maxX,l);w&&(g=ke(w,h,i-f,i+y,1,p.minY,p.maxY,l),x=ke(w,h,i+d,i+m,1,p.minY,p.maxY,l)),_&&(b=ke(_,h,i-f,i+y,1,p.minY,p.maxY,l),v=ke(_,h,i+d,i+m,1,p.minY,p.maxY,l)),u>1&&console.timeEnd(\"clipping\"),o.push(g||[],e+1,r*2,i*2),o.push(x||[],e+1,r*2,i*2+1),o.push(b||[],e+1,r*2+1,i*2),o.push(v||[],e+1,r*2+1,i*2+1)}}invalidateTiles(t){if(!t.length)return;let e=this.options,{debug:r}=e,i=1/0,n=-1/0,a=1/0,s=-1/0;for(let u of t)i=Math.min(i,u.minX),n=Math.max(n,u.maxX),a=Math.min(a,u.minY),s=Math.max(s,u.maxY);let o=e.buffer/e.extent,l=new Set;for(let u in this.tiles){let h=this.tiles[u],c=1<<h.z,p=(h.x-o)/c,f=(h.x+1+o)/c,d=(h.y-o)/c,y=(h.y+1+o)/c;if(n<p||i>=f||s<d||a>=y)continue;let m=!1;for(let g of t)if(g.maxX>=p&&g.minX<f&&g.maxY>=d&&g.minY<y){m=!0;break}if(m){if(r){r>1&&console.log(\"invalidate tile z%d-%d-%d (features: %d, points: %d, simplified: %d)\",h.z,h.x,h.y,h.numFeatures,h.numPoints,h.numSimplified);let g=`z${h.z}`;this.stats[g]=(this.stats[g]||0)-1,this.total--}delete this.tiles[u],l.add(u)}}l.size&&(this.tileCoords=this.tileCoords.filter(u=>!l.has(u.id)))}};function Wn(t,e,r){return((1<<t)*r+e)*32+t}var M2={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,updateable:!1,cluster:!1,clusterOptions:Wo,debug:0},$d=class{constructor(t,e){e=this.options=Object.assign({},M2,e);let r=e.debug;if(r&&console.time(\"preprocess data\"),e.maxZoom<0||e.maxZoom>24)throw Error(\"maxZoom should be in the 0-24 range\");if(e.promoteId&&e.generateId)throw Error(\"promoteId and generateId cannot be used together.\");let i=Yl(t,e);r&&(console.timeEnd(\"preprocess data\"),console.log(\"index: maxZoom: %d, maxPoints: %d\",e.indexMaxZoom,e.indexMaxPoints),console.time(\"generate tiles\")),i=Hl(i,e),e.updateable&&(this.source=i),this.initializeIndex(i,e)}initializeIndex(t,e){this.tileIndex=e.cluster?new b2(e.clusterOptions):new C2(e),t.length&&this.tileIndex.initialize(t)}getTile(t,e,r){return t=+t,e=+e,r=+r,t<0||t>24?null:this.tileIndex.getTile(t,e,r)}updateData(t,e){let r=this.options;if(!r.updateable)throw Error(\"to update tile geojson `updateable` option must be set to true\");let{affected:i,source:n}=m2(this.source,t,r);e&&({affected:i,source:n}=this.filterUpdate(n,i,e)),i.length&&(this.source=n,this.tileIndex.updateIndex(n,i,r))}filterUpdate(t,e,r){let i=new Set;for(let n of t)n.id!=null&&(r(Da(n))||(e.push(n),i.add(n.id)));return t=t.filter(n=>!i.has(n.id)),{affected:e,source:t}}getData(){if(!this.options.updateable)throw Error(\"to retrieve data the `updateable` option must be set to true\");return a2(this.source)}updateClusterOptions(t,e){let r=this.options.cluster;if(this.options.cluster=t,this.options.clusterOptions=e,r==t){this.tileIndex.updateIndex(this.source,[],this.options);return}this.initializeIndex(this.source,this.options)}getClusterExpansionZoom(t){return this.tileIndex.getClusterExpansionZoom(t)}getClusterChildren(t){return this.tileIndex.getChildren(t)}getClusterLeaves(t,e,r){return this.tileIndex.getLeaves(t,e,r)}},Zo=St([{name:\"a_pos_normal\",components:2,type:\"Int16\"},{name:\"a_data\",components:4,type:\"Uint8\"}],4),B2=Zo.members;Zo.size,Zo.alignment;var Ho=St([{name:\"a_uv_x\",components:1,type:\"Float32\"},{name:\"a_split_index\",components:1,type:\"Float32\"}]),P2=Ho.members;Ho.size,Ho.alignment;var z2=Math.cos(75/2*(Math.PI/180)),Nd=1/2,xc=2**14/Nd,Ud=class{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(e=>e.id),this.index=t.index,this.hasDependencies=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={};for(let e of this.layers)this.gradients[e.id]={};this.layoutVertexArray=new ng,this.layoutVertexArray2=new ag,this.indexArray=new xn,this.programConfigurations=new gr(t.layers,t.zoom),this.segments=new te,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id)}populate(t,e,r){this.hasDependencies=xa(\"line\",this.layers,e)||this.hasLineDasharray(this.layers);let i=this.layers[0].layout.get(\"line-sort-key\"),n=!i.isConstant(),a=[],s=new at(this.zoom),o=this.layers[0]._featureFilter.needGeometry;for(let{feature:l,id:u,index:h,sourceLayerIndex:c}of t){let p=li(l,o);if(!this.layers[0]._featureFilter.filter(s,p,r))continue;let f=n?i.evaluate(p,{},r):void 0,d={id:u,properties:l.properties,type:l.type,sourceLayerIndex:c,index:h,geometry:o?p.geometry:Dr(l),patterns:{},dashes:{},sortKey:f};a.push(d)}n&&a.sort((l,u)=>l.sortKey-u.sortKey);for(let l of a){let{geometry:u,index:h,sourceLayerIndex:c}=l;this.hasDependencies?(xa(\"line\",this.layers,e)?Ul(\"line\",this.layers,l,{zoom:this.zoom},e):this.hasLineDasharray(this.layers)&&this.addLineDashDependencies(this.layers,l,this.zoom,e),this.patternFeatures.push(l)):this.addFeature(l,u,h,r,{},{},e.subdivisionGranularity);let p=t[h].feature;e.featureIndex.insert(p,u,h,c,this.index)}}update(t,e,r,i){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,{imagePositions:r,dashPositions:i})}addFeatures({options:t,canonical:e,patternPositions:r,dashPositions:i}){for(let n of this.patternFeatures)this.addFeature(n,n.geometry,n.index,e,r,i,t.subdivisionGranularity)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=t.createVertexBuffer(this.layoutVertexArray2,P2)),this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,B2),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(t){if(t.properties&&Object.hasOwn(t.properties,\"geojsonvt_clip_start\")&&Object.hasOwn(t.properties,\"geojsonvt_clip_end\"))return{start:+t.properties[Vd],end:+t.properties[Od]}}addFeature(t,e,r,i,n,a,s){let o=this.layers[0].layout,l=o.get(\"line-join\").evaluate(t,{}),u=o.get(\"line-cap\").evaluate(t,{}),h=o.get(\"line-miter-limit\").evaluate(t,{}),c=o.get(\"line-round-limit\").evaluate(t,{});this.lineClips=this.lineFeatureClips(t);for(let p of e)this.addLine(p,t,l,u,h,c,i,s);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,r,{imagePositions:n,dashPositions:a,canonical:i})}addLine(t,e,r,i,n,a,s,o){this.distance=0,this.scaledDistance=0,this.totalDistance=0;let l=s?o.line.getGranularityForZoomLevel(s.z):1;if(t=hr(t,l),this.lineClips){this.lineClipsArray.push(this.lineClips);for(let b=0;b<t.length-1;b++)this.totalDistance+=t[b].dist(t[b+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}let u=vn.types[e.type]===\"Polygon\",h=t.length;for(;h>=2&&t[h-1].equals(t[h-2]);)h--;let c=0;for(;c<h-1&&t[c].equals(t[c+1]);)c++;if(h-c<(u?3:2))return;r===\"bevel\"&&(n=1.05);let p=this.overscaling<=16?15*mt/(512*this.overscaling):0,f=this.segments.prepareSegment(h*10,this.layoutVertexArray,this.indexArray),d,y,m,g,x;this.e1=this.e2=-1,u&&(d=t[h-2],x=t[c].sub(d)._unit()._perp());for(let b=c;b<h;b++){if(m=b===h-1?u?t[c+1]:void 0:t[b+1],m&&t[b].equals(m))continue;x&&(g=x),d&&(y=d),d=t[b],x=m?m.sub(d)._unit()._perp():g,g||(g=x);let v=g.add(x);(v.x!==0||v.y!==0)&&v._unit();let w=g.x*x.x+g.y*x.y,_=v.x*x.x+v.y*x.y,A=_===0?1/0:1/_,S=2*Math.sqrt(2-2*_),F=_<z2&&y&&m,L=g.x*x.y-g.y*x.x>0;if(F&&b>c){let R=d.dist(y);if(R>2*p){let E=d.sub(d.sub(y)._mult(p/R)._round());this.updateDistance(y,E),this.addCurrentVertex(E,g,0,0,f),y=E}}let V=y&&m,P=V?r:u?\"butt\":i;if(V&&P===\"round\"&&(A<a?P=\"miter\":A<=2&&(P=\"fakeround\")),P===\"miter\"&&A>n&&(P=\"bevel\"),P===\"bevel\"&&(A>2&&(P=\"flipbevel\"),A<n&&(P=\"miter\")),y&&this.updateDistance(y,d),P===\"miter\")v._mult(A),this.addCurrentVertex(d,v,0,0,f);else if(P===\"flipbevel\"){if(A>100)v=x.mult(-1);else{let R=A*g.add(x).mag()/g.sub(x).mag();v._perp()._mult(R*(L?-1:1))}this.addCurrentVertex(d,v,0,0,f),this.addCurrentVertex(d,v.mult(-1),0,0,f)}else if(P===\"bevel\"||P===\"fakeround\"){let R=-Math.sqrt(A*A-1),E=L?R:0,$=L?0:R;if(y&&this.addCurrentVertex(d,g,E,$,f),P===\"fakeround\"){let O=Math.round(S*180/Math.PI/20);for(let M=1;M<O;M++){let j=M/O;if(j!==.5){let pt=j-.5,st=1.0904+w*(-3.2452+w*(3.55645-w*1.43519)),ft=.848013+w*(-1.06021+w*.215638);j+=j*pt*(j-1)*(st*pt*pt+ft)}let it=x.sub(g)._mult(j)._add(g)._unit()._mult(L?-1:1);this.addHalfVertex(d,it.x,it.y,!1,L,0,f)}}m&&this.addCurrentVertex(d,x,-E,-$,f)}else if(P===\"butt\")this.addCurrentVertex(d,v,0,0,f);else if(P===\"square\"){let R=y?1:-1;this.addCurrentVertex(d,v,R,R,f)}else P===\"round\"&&(y&&(this.addCurrentVertex(d,g,0,0,f),this.addCurrentVertex(d,g,1,1,f,!0)),m&&(this.addCurrentVertex(d,x,-1,-1,f,!0),this.addCurrentVertex(d,x,0,0,f)));if(F&&b<h-1){let R=d.dist(m);if(R>2*p){let E=d.add(m.sub(d)._mult(p/R)._round());this.updateDistance(d,E),this.addCurrentVertex(E,x,0,0,f),d=E}}}}addCurrentVertex(t,e,r,i,n,a=!1){let s=e.x+e.y*r,o=e.y-e.x*r,l=-e.x+e.y*i,u=-e.y-e.x*i;this.addHalfVertex(t,s,o,a,!1,r,n),this.addHalfVertex(t,l,u,a,!0,-i,n),this.distance>xc/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(t,e,r,i,n,a))}addHalfVertex({x:t,y:e},r,i,n,a,s,o){let l=(this.lineClips?this.scaledDistance*(xc-1):this.scaledDistance)*Nd;if(this.layoutVertexArray.emplaceBack((t<<1)+ +!!n,(e<<1)+ +!!a,Math.round(63*r)+128,Math.round(63*i)+128,(s===0?0:s<0?-1:1)+1|(l&63)<<2,l>>6),this.lineClips){let h=(this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start);this.layoutVertexArray2.emplaceBack(h,this.lineClipsArray.length)}let u=o.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,u,this.e2),o.primitiveLength++),a?this.e2=u:this.e1=u}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(t,e){this.distance+=t.dist(e),this.updateScaledDistance()}hasLineDasharray(t){for(let e of t){let r=e.paint.get(\"line-dasharray\");if(r&&!r.isConstant())return!0}return!1}addLineDashDependencies(t,e,r,i){for(let n of t){let a=n.paint.get(\"line-dasharray\");if(!a||a.value.kind===\"constant\")continue;let s=n.layout.get(\"line-cap\").evaluate(e,{})===\"round\",o={dasharray:a.value.evaluate({zoom:r-1},e,{}),round:s},l={dasharray:a.value.evaluate({zoom:r},e,{}),round:s},u={dasharray:a.value.evaluate({zoom:r+1},e,{}),round:s},h=`${o.dasharray.join(\",\")},${o.round}`,c=`${l.dasharray.join(\",\")},${l.round}`,p=`${u.dasharray.join(\",\")},${u.round}`;i.dashDependencies[h]=o,i.dashDependencies[c]=l,i.dashDependencies[p]=u,e.dashes[n.id]={min:h,mid:c,max:p}}}};I(\"LineBucket\",Ud,{omit:[\"layers\",\"patternFeatures\"]});var vc,L2=()=>vc||(vc=new jt({\"line-cap\":new U(D.layout_line[\"line-cap\"],\"line-cap\"),\"line-join\":new U(D.layout_line[\"line-join\"],\"line-join\"),\"line-miter-limit\":new U(D.layout_line[\"line-miter-limit\"],\"line-miter-limit\"),\"line-round-limit\":new U(D.layout_line[\"line-round-limit\"],\"line-round-limit\"),\"line-sort-key\":new U(D.layout_line[\"line-sort-key\"],\"line-sort-key\")})),bc,V2=()=>bc||(bc=new jt({\"line-opacity\":new U(D.paint_line[\"line-opacity\"],\"line-opacity\"),\"line-layer-opacity\":new z(D.paint_line[\"line-layer-opacity\"],\"line-layer-opacity\"),\"line-color\":new U(D.paint_line[\"line-color\"],\"line-color\"),\"line-translate\":new z(D.paint_line[\"line-translate\"],\"line-translate\"),\"line-translate-anchor\":new z(D.paint_line[\"line-translate-anchor\"],\"line-translate-anchor\"),\"line-width\":new U(D.paint_line[\"line-width\"],\"line-width\"),\"line-gap-width\":new U(D.paint_line[\"line-gap-width\"],\"line-gap-width\"),\"line-offset\":new U(D.paint_line[\"line-offset\"],\"line-offset\"),\"line-blur\":new U(D.paint_line[\"line-blur\"],\"line-blur\"),\"line-dasharray\":new nn(D.paint_line[\"line-dasharray\"],\"line-dasharray\"),\"line-pattern\":new nn(D.paint_line[\"line-pattern\"],\"line-pattern\"),\"line-gradient\":new Ua(D.paint_line[\"line-gradient\"],\"line-gradient\")})),wc={get paint(){return V2()},get layout(){return L2()}},O2=class extends U{possiblyEvaluate(t,e){return e=new at(Math.floor(e.zoom),{now:e.now,fadeDuration:e.fadeDuration,zoomHistory:e.zoomHistory,transition:e.transition}),super.possiblyEvaluate(t,e)}evaluate(t,e,r,i){return e=qt({},e,{zoom:Math.floor(e.zoom)}),super.evaluate(t,e,r,i)}},Zn;var R2=class extends pe{constructor(t,e){super(t,wc,e),this.gradientVersion=0,Zn||(Zn=new O2(wc.paint.properties[\"line-width\"].specification,\"line-floorwidth\"),Zn.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(t){if(t===\"line-gradient\"){let e=this.gradientExpression();this.stepInterpolant=dm(e)?e._styleExpression.expression instanceof ml:!1,this.gradientVersion=(this.gradientVersion+1)%(2**53-1)}}gradientExpression(){return this._transitionablePaint._values[\"line-gradient\"].value.expression}recalculate(t,e){super.recalculate(t,e),this.paint._values[\"line-floorwidth\"]=Zn.possiblyEvaluate(this._transitioningPaint._values[\"line-width\"].value,t)}createBucket(t){return new Ud(t)}queryRadius(t){let e=t,r=Dc(Yr(\"line-width\",this,e),Yr(\"line-gap-width\",this,e)),i=Yr(\"line-offset\",this,e);return r/2+Math.abs(i)+ja(this.paint.get(\"line-translate\"))}queryIntersectsFeature({queryGeometry:t,feature:e,featureState:r,geometry:i,transform:n,pixelsToTileUnits:a}){let s=Ga(t,this.paint.get(\"line-translate\"),this.paint.get(\"line-translate-anchor\"),-n.bearingInRadians,a),o=a/2*Dc(this.paint.get(\"line-width\").evaluate(e,r),this.paint.get(\"line-gap-width\").evaluate(e,r)),l=this.paint.get(\"line-offset\").evaluate(e,r);return l&&(i=Fg(i,l*a)),wg(s,i,o)}isTileClipped(){return!0}};function Dc(t,e){return e>0?e+2*t:t}var $2=St([{name:\"a_pos_offset\",components:4,type:\"Int16\"},{name:\"a_data\",components:4,type:\"Uint16\"},{name:\"a_pixeloffset\",components:4,type:\"Int16\"},{name:\"a_height_offset\",components:1,type:\"Float32\"}],4),N2=St([{name:\"a_projected_pos\",components:3,type:\"Float32\"}],4);St([{name:\"a_fade_opacity\",components:1,type:\"Uint32\"}],4);var U2=St([{name:\"a_placed\",components:2,type:\"Uint8\"},{name:\"a_shift\",components:2,type:\"Float32\"},{name:\"a_box_real\",components:2,type:\"Int16\"}]);St([{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\"}]);var _c=St([{name:\"a_pos\",components:2,type:\"Int16\"},{name:\"a_anchor_pos\",components:2,type:\"Int16\"},{name:\"a_extrude\",components:2,type:\"Int16\"}],4),o5=St([{name:\"a_pos\",components:2,type:\"Float32\"},{name:\"a_radius\",components:1,type:\"Float32\"},{name:\"a_flags\",components:2,type:\"Int16\"}],4);St([{name:\"triangle\",components:3,type:\"Uint16\"}]),St([{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\"},{type:\"Float32\",name:\"heightOffset\"}]),St([{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\"},{type:\"Float32\",name:\"heightOffset\"}]),St([{type:\"Float32\",name:\"offsetX\"}]),St([{type:\"Int16\",name:\"x\"},{type:\"Int16\",name:\"y\"},{type:\"Int16\",name:\"tileUnitDistanceFromAnchor\"}]),St([{type:\"Uint16\",name:\"textAnchor\"},{type:\"Float32\",components:2,name:\"textOffset\"}]);var vr=new class{constructor(){this.TIMEOUT=5e3,this.applyArabicShaping=null,this.processBidirectionalText=null,this.processStyledBidirectionalText=null,this.pluginStatus=\"unavailable\",this.pluginURL=null,this.loadScriptResolve=()=>{}}setState(t){this.pluginStatus=t.pluginStatus,this.pluginURL=t.pluginURL}getState(){return{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}}setMethods(t){if(vr.isParsed())throw Error(\"RTL text plugin already registered.\");this.applyArabicShaping=t.applyArabicShaping,this.processBidirectionalText=t.processBidirectionalText,this.processStyledBidirectionalText=t.processStyledBidirectionalText,this.loadScriptResolve()}isParsed(){return this.applyArabicShaping!=null&&this.processBidirectionalText!=null&&this.processStyledBidirectionalText!=null}getRTLTextPluginStatus(){return this.pluginStatus}async syncState(t,e){if(this.isParsed())return this.getState();if(t.pluginStatus!==\"loading\")return this.setState(t),t;let r=t.pluginURL,i=new Promise(a=>{this.loadScriptResolve=a}),n=new Promise(a=>setTimeout(()=>a(),this.TIMEOUT));if(await e(r),await Promise.race([i,n]),this.isParsed()){let a={pluginStatus:\"loaded\",pluginURL:r};return this.setState(a),a}throw this.setState({pluginStatus:\"error\",pluginURL:\"\"}),Error(`RTL Text Plugin failed to import scripts from ${r}`)}};function q2(t){return/[\\u0600-\\u0604\\u0606-\\u060B\\u060D-\\u061A\\u061C-\\u061E\\u0620-\\u063F\\u0641-\\u064A\\u0656-\\u066F\\u0671-\\u06DC\\u06DE-\\u070D\\u070F-\\u074A\\u074D-\\u077F\\u07C0-\\u07FA\\u07FD-\\u07FF\\u0840-\\u085B\\u085E\\u0860-\\u086A\\u0870-\\u0891\\u0897-\\u08E1\\u08E3-\\u08FF\\u1800\\u1801\\u1804\\u1806-\\u1819\\u1820-\\u1878\\u1880-\\u18AA\\uA840-\\uA877\\uFB50-\\uFD3D\\uFD40-\\uFDCF\\uFDF0-\\uFDFF\\uFE70-\\uFE74\\uFE76-\\uFEFC]|\\uD802[\\uDEC0-\\uDEE6\\uDEEB-\\uDEF6\\uDF80-\\uDF91\\uDF99-\\uDF9C\\uDFA9-\\uDFAF]|\\uD803[\\uDD00-\\uDD27\\uDD30-\\uDD39\\uDE60-\\uDE7E\\uDEC2-\\uDEC7\\uDED0-\\uDED8\\uDEFA-\\uDEFF\\uDF30-\\uDF59\\uDF70-\\uDF89\\uDFB0-\\uDFCB]|\\uD805[\\uDE60-\\uDE6C]|\\uD82F[\\uDC00-\\uDC6A\\uDC70-\\uDC7C\\uDC80-\\uDC88\\uDC90-\\uDC99\\uDC9C-\\uDC9F]|\\uD83A[\\uDD00-\\uDD4B\\uDD50-\\uDD59\\uDD5E\\uDD5F]|\\uD83B[\\uDE00-\\uDE03\\uDE05-\\uDE1F\\uDE21\\uDE22\\uDE24\\uDE27\\uDE29-\\uDE32\\uDE34-\\uDE37\\uDE39\\uDE3B\\uDE42\\uDE47\\uDE49\\uDE4B\\uDE4D-\\uDE4F\\uDE51\\uDE52\\uDE54\\uDE57\\uDE59\\uDE5B\\uDE5D\\uDE5F\\uDE61\\uDE62\\uDE64\\uDE67-\\uDE6A\\uDE6C-\\uDE72\\uDE74-\\uDE77\\uDE79-\\uDE7C\\uDE7E\\uDE80-\\uDE89\\uDE8B-\\uDE9B\\uDEA1-\\uDEA3\\uDEA5-\\uDEA9\\uDEAB-\\uDEBB\\uDEF0\\uDEF1]/gim.test(String.fromCodePoint(t))}function j2(t){return/[\\u0591-\\u05C7\\u05D0-\\u05EA\\u05EF-\\u05F4\\u0600-\\u0604\\u0606-\\u060B\\u060D-\\u061A\\u061C-\\u061E\\u0620-\\u063F\\u0641-\\u064A\\u0656-\\u066F\\u0671-\\u06DC\\u06DE-\\u070D\\u070F-\\u074A\\u074D-\\u07B1\\u07C0-\\u07FA\\u07FD-\\u082D\\u0830-\\u083E\\u0840-\\u085B\\u085E\\u0860-\\u086A\\u0870-\\u0891\\u0897-\\u08E1\\u08E3-\\u08FF\\uFB1D-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFD3D\\uFD40-\\uFDCF\\uFDF0-\\uFDFF\\uFE70-\\uFE74\\uFE76-\\uFEFC]|\\uD802[\\uDC00-\\uDC05\\uDC08\\uDC0A-\\uDC35\\uDC37\\uDC38\\uDC3C\\uDC3F-\\uDC55\\uDC57-\\uDC9E\\uDCA7-\\uDCAF\\uDCE0-\\uDCF2\\uDCF4\\uDCF5\\uDCFB-\\uDD1B\\uDD1F-\\uDD39\\uDD3F-\\uDD59\\uDD80-\\uDDB7\\uDDBC-\\uDDCF\\uDDD2-\\uDE03\\uDE05\\uDE06\\uDE0C-\\uDE13\\uDE15-\\uDE17\\uDE19-\\uDE35\\uDE38-\\uDE3A\\uDE3F-\\uDE48\\uDE50-\\uDE58\\uDE60-\\uDE9F\\uDEC0-\\uDEE6\\uDEEB-\\uDEF6\\uDF00-\\uDF35\\uDF39-\\uDF55\\uDF58-\\uDF72\\uDF78-\\uDF91\\uDF99-\\uDF9C\\uDFA9-\\uDFAF]|\\uD803[\\uDC00-\\uDC48\\uDC80-\\uDCB2\\uDCC0-\\uDCF2\\uDCFA-\\uDD27\\uDD30-\\uDD39\\uDD40-\\uDD65\\uDD69-\\uDD85\\uDD8E\\uDD8F\\uDE60-\\uDE7E\\uDE80-\\uDEA9\\uDEAB-\\uDEAD\\uDEB0\\uDEB1\\uDEC2-\\uDEC7\\uDED0-\\uDED8\\uDEFA-\\uDF27\\uDF30-\\uDF59\\uDF70-\\uDF89\\uDFB0-\\uDFCB\\uDFE0-\\uDFF6]|\\uD83A[\\uDC00-\\uDCC4\\uDCC7-\\uDCD6\\uDD00-\\uDD4B\\uDD50-\\uDD59\\uDD5E\\uDD5F]|\\uD83B[\\uDE00-\\uDE03\\uDE05-\\uDE1F\\uDE21\\uDE22\\uDE24\\uDE27\\uDE29-\\uDE32\\uDE34-\\uDE37\\uDE39\\uDE3B\\uDE42\\uDE47\\uDE49\\uDE4B\\uDE4D-\\uDE4F\\uDE51\\uDE52\\uDE54\\uDE57\\uDE59\\uDE5B\\uDE5D\\uDE5F\\uDE61\\uDE62\\uDE64\\uDE67-\\uDE6A\\uDE6C-\\uDE72\\uDE74-\\uDE77\\uDE79-\\uDE7C\\uDE7E\\uDE80-\\uDE89\\uDE8B-\\uDE9B\\uDEA1-\\uDEA3\\uDEA5-\\uDEA9\\uDEAB-\\uDEBB\\uDEF0\\uDEF1]/gim.test(String.fromCodePoint(t))}function G2(t){return/[\\u02EA\\u02EB\\u2E80-\\u2FDF\\u2FF0-\\u303F\\u3041-\\u3096\\u309D-\\u309F\\u30A1-\\u30FA\\u30FD-\\u30FF\\u3105-\\u312F\\u31A0-\\u4DBF\\u4E00-\\uA48C\\uA490-\\uA4C6\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFE10-\\uFE1F\\uFE30-\\uFE4F\\uFF00-\\uFFEF]|\\uD81B[\\uDFE0-\\uDFFF]|[\\uD81C-\\uD822\\uD840-\\uD868\\uD86A-\\uD86D\\uD86F-\\uD872\\uD874-\\uD879\\uD880-\\uD883\\uD885-\\uD88C][\\uDC00-\\uDFFF]|\\uD823[\\uDC00-\\uDCD5\\uDCFF-\\uDD1E\\uDD80-\\uDDF2]|\\uD82B[\\uDFF0-\\uDFFF]|\\uD82C[\\uDC00-\\uDEFB]|\\uD83C[\\uDE00-\\uDEFF]|\\uD869[\\uDC00-\\uDEDF\\uDF00-\\uDFFF]|\\uD86E[\\uDC00-\\uDC1D\\uDC20-\\uDFFF]|\\uD873[\\uDC00-\\uDEAD\\uDEB0-\\uDFFF]|\\uD87A[\\uDC00-\\uDFE0\\uDFF0-\\uDFFF]|\\uD87B[\\uDC00-\\uDE5D]|\\uD87E[\\uDC00-\\uDE1D]|\\uD884[\\uDC00-\\uDF4A\\uDF50-\\uDFFF]|\\uD88D[\\uDC00-\\uDC79]/gim.test(String.fromCodePoint(t))}function Xa(t){return/[\\u02EA\\u02EB\\u1100-\\u11FF\\u1401-\\u167F\\u18B0-\\u18FF\\u2065\\u20DD-\\u20E0\\u20E2-\\u20E4\\u2B97\\u2BF0-\\u2BFF\\u2E50\\u2E51\\u2E80-\\u3007\\u3012\\u3013\\u3020-\\u302F\\u3031-\\u30FB\\u30FD-\\uA4CF\\uA960-\\uA97F\\uAC00-\\uD7FF\\uF900-\\uFAFF\\uFE10-\\uFE1F\\uFE30-\\uFE48\\uFE50-\\uFE57\\uFE5F-\\uFE62\\uFE67-\\uFE6F\\uFF00-\\uFF07\\uFF0A-\\uFF0C\\uFF0E-\\uFF19\\uFF1F-\\uFF3A\\uFF3C\\uFF3E\\uFF40-\\uFF5A\\uFFE0-\\uFFE2\\uFFE4-\\uFFE7\\uFFF0-\\uFFF8]|\\uD802[\\uDD80-\\uDD9F]|\\uD805[\\uDD80-\\uDDFF]|\\uD806[\\uDE00-\\uDEBF]|[\\uD80C-\\uD810\\uD81C-\\uD822\\uD83C\\uD83D\\uD840-\\uD87E\\uD880-\\uD8BE][\\uDC00-\\uDFFF]|\\uD811[\\uDC00-\\uDE7F]|\\uD81B[\\uDFE0-\\uDFFF]|\\uD823[\\uDC00-\\uDDFF]|\\uD82B[\\uDFF0-\\uDFFF]|\\uD82C[\\uDC00-\\uDEFF]|\\uD833[\\uDEC0-\\uDFCF]|\\uD834[\\uDC00-\\uDDFF\\uDEE0-\\uDF7F]|\\uD836[\\uDC00-\\uDEAF]|\\uD83E[\\uDD00-\\uDEFF]|[\\uD87F\\uD8BF][\\uDC00-\\uDFFD]/gim.test(String.fromCodePoint(t))}function Y2(t){return/[\\xA7\\xA9\\xAE\\xB1\\xBC-\\xBE\\xD7\\xF7\\u2016\\u2020\\u2021\\u2030\\u2031\\u203B\\u203C\\u2042\\u2047-\\u2049\\u2051\\u2100-\\u218F\\u221E\\u2234\\u2235\\u2300-\\u2307\\u230C-\\u231F\\u2324-\\u2328\\u232B\\u237D-\\u239A\\u23BE-\\u23CD\\u23CF\\u23D1-\\u23DB\\u23E2-\\u2422\\u2424-\\u24FF\\u25A0-\\u2619\\u2620-\\u2767\\u2776-\\u2793\\u2B12-\\u2B2F\\u2B50-\\u2B59\\u2BB8-\\u2BEB\\u3000-\\u303F\\u30A0-\\u30FF\\uE000-\\uF8FF\\uFE30-\\uFE6F\\uFF00-\\uFFEF\\uFFFC\\uFFFD]|[\\uDB80-\\uDBFF][\\uDC00-\\uDFFF]/gim.test(String.fromCodePoint(t))}function X2(t){return/[\\r\\u0300-\\u036F\\u0483-\\u0489\\u0591-\\u05BD\\u05BF\\u05C1\\u05C2\\u05C4\\u05C5\\u05C7\\u0600-\\u0605\\u0610-\\u061A\\u064B-\\u065F\\u0670\\u06D6-\\u06DD\\u06DF-\\u06E4\\u06E7\\u06E8\\u06EA-\\u06ED\\u070F\\u0711\\u0730-\\u074A\\u07A6-\\u07B0\\u07EB-\\u07F3\\u07FD\\u0816-\\u0819\\u081B-\\u0823\\u0825-\\u0827\\u0829-\\u082D\\u0859-\\u085B\\u0890\\u0891\\u0897-\\u089F\\u08CA-\\u0903\\u093A-\\u093C\\u093E-\\u094F\\u0951-\\u0957\\u0962\\u0963\\u0981-\\u0983\\u09BC\\u09BE-\\u09C4\\u09C7\\u09C8\\u09CB-\\u09CD\\u09D7\\u09E2\\u09E3\\u09FE\\u0A01-\\u0A03\\u0A3C\\u0A3E-\\u0A42\\u0A47\\u0A48\\u0A4B-\\u0A4D\\u0A51\\u0A70\\u0A71\\u0A75\\u0A81-\\u0A83\\u0ABC\\u0ABE-\\u0AC5\\u0AC7-\\u0AC9\\u0ACB-\\u0ACD\\u0AE2\\u0AE3\\u0AFA-\\u0AFF\\u0B01-\\u0B03\\u0B3C\\u0B3E-\\u0B44\\u0B47\\u0B48\\u0B4B-\\u0B4D\\u0B55-\\u0B57\\u0B62\\u0B63\\u0B82\\u0BBE-\\u0BC2\\u0BC6-\\u0BC8\\u0BCA-\\u0BCD\\u0BD7\\u0C00-\\u0C04\\u0C3C\\u0C3E-\\u0C44\\u0C46-\\u0C48\\u0C4A-\\u0C4D\\u0C55\\u0C56\\u0C62\\u0C63\\u0C81-\\u0C83\\u0CBC\\u0CBE-\\u0CC4\\u0CC6-\\u0CC8\\u0CCA-\\u0CCD\\u0CD5\\u0CD6\\u0CE2\\u0CE3\\u0CF3\\u0D00-\\u0D03\\u0D3B\\u0D3C\\u0D3E-\\u0D44\\u0D46-\\u0D48\\u0D4A-\\u0D4E\\u0D57\\u0D62\\u0D63\\u0D81-\\u0D83\\u0DCA\\u0DCF-\\u0DD4\\u0DD6\\u0DD8-\\u0DDF\\u0DF2\\u0DF3\\u0E31\\u0E33-\\u0E3A\\u0E47-\\u0E4E\\u0EB1\\u0EB3-\\u0EBC\\u0EC8-\\u0ECE\\u0F18\\u0F19\\u0F35\\u0F37\\u0F39\\u0F3E\\u0F3F\\u0F71-\\u0F84\\u0F86\\u0F87\\u0F8D-\\u0F97\\u0F99-\\u0FBC\\u0FC6\\u102D-\\u1037\\u1039-\\u103E\\u1056-\\u1059\\u105E-\\u1060\\u1071-\\u1074\\u1082\\u1084-\\u1086\\u108D\\u109D\\u1100-\\u11FF\\u135D-\\u135F\\u1712-\\u1715\\u1732-\\u1734\\u1752\\u1753\\u1772\\u1773\\u17B4-\\u17D3\\u17DD\\u180B-\\u180D\\u180F\\u1885\\u1886\\u18A9\\u1920-\\u192B\\u1930-\\u193B\\u1A17-\\u1A1B\\u1A55-\\u1A5E\\u1A60\\u1A62\\u1A65-\\u1A7C\\u1A7F\\u1AB0-\\u1ADD\\u1AE0-\\u1AEB\\u1B00-\\u1B04\\u1B34-\\u1B44\\u1B6B-\\u1B73\\u1B80-\\u1B82\\u1BA1-\\u1BAD\\u1BE6-\\u1BF3\\u1C24-\\u1C37\\u1CD0-\\u1CD2\\u1CD4-\\u1CE8\\u1CED\\u1CF4\\u1CF7-\\u1CF9\\u1DC0-\\u1DFF\\u200C\\u200D\\u20D0-\\u20F0\\u2CEF-\\u2CF1\\u2D7F\\u2DE0-\\u2DFF\\u302A-\\u302F\\u3099\\u309A\\uA66F-\\uA672\\uA674-\\uA67D\\uA69E\\uA69F\\uA6F0\\uA6F1\\uA802\\uA806\\uA80B\\uA823-\\uA827\\uA82C\\uA880\\uA881\\uA8B4-\\uA8C5\\uA8E0-\\uA8F1\\uA8FF\\uA926-\\uA92D\\uA947-\\uA953\\uA960-\\uA97C\\uA980-\\uA983\\uA9B3-\\uA9C0\\uA9E5\\uAA29-\\uAA36\\uAA43\\uAA4C\\uAA4D\\uAA7C\\uAAB0\\uAAB2-\\uAAB4\\uAAB7\\uAAB8\\uAABE\\uAABF\\uAAC1\\uAAEB-\\uAAEF\\uAAF5\\uAAF6\\uABE3-\\uABEA\\uABEC\\uABED\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uFB1E\\uFE00-\\uFE0F\\uFE20-\\uFE2F\\uFF9E\\uFF9F]|\\uD800[\\uDDFD\\uDEE0\\uDF76-\\uDF7A]|\\uD802[\\uDE01-\\uDE03\\uDE05\\uDE06\\uDE0C-\\uDE0F\\uDE38-\\uDE3A\\uDE3F\\uDEE5\\uDEE6]|\\uD803[\\uDD24-\\uDD27\\uDD69-\\uDD6D\\uDEAB\\uDEAC\\uDEFA-\\uDEFF\\uDF46-\\uDF50\\uDF82-\\uDF85]|\\uD804[\\uDC00-\\uDC02\\uDC38-\\uDC46\\uDC70\\uDC73\\uDC74\\uDC7F-\\uDC82\\uDCB0-\\uDCBA\\uDCBD\\uDCC2\\uDCCD\\uDD00-\\uDD02\\uDD27-\\uDD34\\uDD45\\uDD46\\uDD73\\uDD80-\\uDD82\\uDDB3-\\uDDC0\\uDDC2\\uDDC3\\uDDC9-\\uDDCC\\uDDCE\\uDDCF\\uDE2C-\\uDE37\\uDE3E\\uDE41\\uDEDF-\\uDEEA\\uDF00-\\uDF03\\uDF3B\\uDF3C\\uDF3E-\\uDF44\\uDF47\\uDF48\\uDF4B-\\uDF4D\\uDF57\\uDF62\\uDF63\\uDF66-\\uDF6C\\uDF70-\\uDF74\\uDFB8-\\uDFC0\\uDFC2\\uDFC5\\uDFC7-\\uDFCA\\uDFCC-\\uDFD2\\uDFE1\\uDFE2]|\\uD805[\\uDC35-\\uDC46\\uDC5E\\uDCB0-\\uDCC3\\uDDAF-\\uDDB5\\uDDB8-\\uDDC0\\uDDDC\\uDDDD\\uDE30-\\uDE40\\uDEAB-\\uDEB7\\uDF1D-\\uDF1F\\uDF22-\\uDF2B]|\\uD806[\\uDC2C-\\uDC3A\\uDD30-\\uDD35\\uDD37\\uDD38\\uDD3B-\\uDD43\\uDDD1-\\uDDD7\\uDDDA-\\uDDE0\\uDDE4\\uDE01-\\uDE0A\\uDE33-\\uDE39\\uDE3B-\\uDE3E\\uDE47\\uDE51-\\uDE5B\\uDE84-\\uDE99\\uDF60-\\uDF67]|\\uD807[\\uDC2F-\\uDC36\\uDC38-\\uDC3F\\uDC92-\\uDCA7\\uDCA9-\\uDCB6\\uDD31-\\uDD36\\uDD3A\\uDD3C\\uDD3D\\uDD3F-\\uDD47\\uDD8A-\\uDD8E\\uDD90\\uDD91\\uDD93-\\uDD97\\uDEF3-\\uDEF6\\uDF00-\\uDF03\\uDF34-\\uDF3A\\uDF3E-\\uDF42\\uDF5A]|\\uD80D[\\uDC40\\uDC47-\\uDC55]|\\uD818[\\uDD1E-\\uDD2F]|\\uD81A[\\uDEF0-\\uDEF4\\uDF30-\\uDF36]|\\uD81B[\\uDD63\\uDD67-\\uDD6A\\uDF4F\\uDF51-\\uDF87\\uDF8F-\\uDF92\\uDFE4\\uDFF0\\uDFF1]|\\uD82F[\\uDC9D\\uDC9E]|\\uD833[\\uDF00-\\uDF2D\\uDF30-\\uDF46]|\\uD834[\\uDD65-\\uDD69\\uDD6D-\\uDD72\\uDD7B-\\uDD82\\uDD85-\\uDD8B\\uDDAA-\\uDDAD\\uDE42-\\uDE44]|\\uD836[\\uDE00-\\uDE36\\uDE3B-\\uDE6C\\uDE75\\uDE84\\uDE9B-\\uDE9F\\uDEA1-\\uDEAF]|\\uD838[\\uDC00-\\uDC06\\uDC08-\\uDC18\\uDC1B-\\uDC21\\uDC23\\uDC24\\uDC26-\\uDC2A\\uDC8F\\uDD30-\\uDD36\\uDEAE\\uDEEC-\\uDEEF]|\\uD839[\\uDCEC-\\uDCEF\\uDDEE\\uDDEF\\uDEE3\\uDEE6\\uDEEE\\uDEEF\\uDEF5]|\\uD83A[\\uDCD0-\\uDCD6\\uDD44-\\uDD4A]|\\uD83C[\\uDDE6-\\uDDFF\\uDFFB-\\uDFFF]|\\uDB40[\\uDC20-\\uDC7F\\uDD00-\\uDDEF]/.test(t)}function Ac(t){return/[\\u0E01-\\u0E3A\\u0E40-\\u0E4E\\u0E81\\u0E82\\u0E84\\u0E86-\\u0E8A\\u0E8C-\\u0EA3\\u0EA5\\u0EA7-\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EC8-\\u0ECE\\u0EDC-\\u0EDF\\u0F00-\\u0F47\\u0F49-\\u0F6C\\u0F71-\\u0F97\\u0F99-\\u0FBC\\u0FBE-\\u0FCC\\u0FCE-\\u0FD4\\u0FD9\\u0FDA\\u1000-\\u103F\\u1050-\\u108F\\u109A-\\u109F\\u1780-\\u17D3\\u17D7\\u17DC\\u17DD\\u1950-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19B0-\\u19C9\\u19DE\\u19DF\\u1A20-\\u1A5E\\u1A60-\\u1A7C\\u1AA0-\\u1AAD\\u1B00-\\u1B4C\\u1B4E-\\u1B7F\\uA980-\\uA9CD\\uA9D0-\\uA9D9\\uA9DE-\\uA9EF\\uA9FA-\\uA9FE\\uAA60-\\uAAC2\\uAADB-\\uAADF]|\\uD805[\\uDF00-\\uDF1A\\uDF1D-\\uDF2B\\uDF3A\\uDF3B\\uDF3F-\\uDF46]/gim.test(String.fromCodePoint(t))}function W2(t,e){return/(?:[\\u1039\\u17D2\\u1A60\\u1BAB\\u200D\\uAAF6]|\\uD802\\uDE3F|\\uD804[\\uDD33\\uDFD0]|\\uD806[\\uDD3E\\uDE47\\uDE99]|\\uD807[\\uDD45\\uDD97\\uDF42])$/.test(t)||/^\\p{gc=Mc}/u.test(e)}var Z2={C:\"18g,1;g2,3;4nb,1\",D:\"17k,1;5,1;1,1;1,5;4,d;1,7;1,2;z,2;8,g;i,12;1,2;9,1;1,1;1,2;14,3;2,1;28,9;3,f;2,4;1,1;2,3;2,6;7a,1;2,5;1,1;g,a;5,2;2,6;1,f\",R:\"17m,4;1,1;1,1;5,4;l,1;14,3;1,3;g,i;12,1;2,9;1,1;1,1;2,2;1,1;o,2;2x,3;f,2;4,1;1,2;3,2;6u,j;b,1;r,3;1,1;2,2;6,1\",T:\"174,b;1,1;1a,l;g,1;2t,7;2,6;2,2;1,4;bt,9;16,o;1,t;1clb,1\"},H2={1569:[65152,0,0,0],1570:[65153,65154,0,0],1571:[65155,65156,0,0],1572:[65157,65158,0,0],1573:[65159,65160,0,0],1574:[65161,65162,65163,65164],1575:[65165,65166,0,0],1576:[65167,65168,65169,65170],1577:[65171,65172,0,0],1578:[65173,65174,65175,65176],1579:[65177,65178,65179,65180],1580:[65181,65182,65183,65184],1581:[65185,65186,65187,65188],1582:[65189,65190,65191,65192],1583:[65193,65194,0,0],1584:[65195,65196,0,0],1585:[65197,65198,0,0],1586:[65199,65200,0,0],1587:[65201,65202,65203,65204],1588:[65205,65206,65207,65208],1589:[65209,65210,65211,65212],1590:[65213,65214,65215,65216],1591:[65217,65218,65219,65220],1592:[65221,65222,65223,65224],1593:[65225,65226,65227,65228],1594:[65229,65230,65231,65232],1601:[65233,65234,65235,65236],1602:[65237,65238,65239,65240],1603:[65241,65242,65243,65244],1604:[65245,65246,65247,65248],1605:[65249,65250,65251,65252],1606:[65253,65254,65255,65256],1607:[65257,65258,65259,65260],1608:[65261,65262,0,0],1609:[65263,65264,64488,64489],1610:[65265,65266,65267,65268],1611:[65136,0,0,65137],1612:[65138,0,0,0],1613:[65140,0,0,0],1614:[65142,0,0,65143],1615:[65144,0,0,65145],1616:[65146,0,0,65147],1617:[65148,0,0,65149],1618:[65150,0,0,65151],1649:[64336,64337,0,0],1655:[64477,0,0,0],1657:[64358,64359,64360,64361],1658:[64350,64351,64352,64353],1659:[64338,64339,64340,64341],1662:[64342,64343,64344,64345],1663:[64354,64355,64356,64357],1664:[64346,64347,64348,64349],1667:[64374,64375,64376,64377],1668:[64370,64371,64372,64373],1670:[64378,64379,64380,64381],1671:[64382,64383,64384,64385],1672:[64392,64393,0,0],1676:[64388,64389,0,0],1677:[64386,64387,0,0],1678:[64390,64391,0,0],1681:[64396,64397,0,0],1688:[64394,64395,0,0],1700:[64362,64363,64364,64365],1702:[64366,64367,64368,64369],1705:[64398,64399,64400,64401],1709:[64467,64468,64469,64470],1711:[64402,64403,64404,64405],1713:[64410,64411,64412,64413],1715:[64406,64407,64408,64409],1722:[64414,64415,0,0],1723:[64416,64417,64418,64419],1726:[64426,64427,64428,64429],1728:[64420,64421,0,0],1729:[64422,64423,64424,64425],1733:[64480,64481,0,0],1734:[64473,64474,0,0],1735:[64471,64472,0,0],1736:[64475,64476,0,0],1737:[64482,64483,0,0],1739:[64478,64479,0,0],1740:[64508,64509,64510,64511],1744:[64484,64485,64486,64487],1746:[64430,64431,0,0],1747:[64432,64433,0,0]},K2={\\u0644\\u0622:[65269,65270],\\u0644\\u0623:[65271,65272],\\u0644\\u0625:[65273,65274],\\u0644\\u0627:[65275,65276]},Sc=1604,J2=/[\\u0600-\\u06ff\\u0750-\\u077f\\u0870-\\u089f\\u08a0-\\u08ff\\ufb50-\\ufdff\\ufe70-\\ufeff]/;function Q2(t,e,r){let i=0;for(let n of t.split(\";\")){let[a,s]=n.split(\",\").map(l=>parseInt(l,36)),o=i+a;for(let l=o;l<o+s;l++)r.set(l,e);i=o+s}}var qd=new Map;for(let[t,e]of Object.entries(Z2))Q2(e,t,qd);function tv(t){return qd.get(t)??\"U\"}function ev(t){return t===\"D\"||t===\"L\"||t===\"C\"}function rv(t){return t===\"D\"||t===\"R\"||t===\"C\"}function iv(t,e,r){return t===\"D\"?e&&r?3:e?1:r?2:0:t===\"R\"?+!!e:t===\"L\"?r?2:0:null}function nv(t){return[...t].map(e=>{let r=e.codePointAt(0);return{codePoint:r,type:tv(r),form:null}})}function av(t){let e=t.filter(r=>r.type!==\"T\");for(let r=0;r<e.length;r++){let i=e[r],n=r>0&&ev(e[r-1].type),a=r+1<e.length&&rv(e[r+1].type);i.form=iv(i.type,n,a)}}function sv(t){let e=!1;for(let r of t)r.type===\"T\"?r.form=e?3:0:e=r.form===2||r.form===3}function ov(t){let e=[];for(let r=0;r<t.length;r++){let i=t[r];if(i.codePoint!==Sc){e.push(i);continue}let n=r+1;for(;n<t.length&&t[n].type===\"T\";)n++;let a=t[n],s=a&&K2[String.fromCodePoint(Sc,a.codePoint)];if(!s){e.push(i);continue}let o=i.form===3||i.form===1;e.push({codePoint:s[+!!o],type:\"R\",form:0}),e.push(...t.slice(r+1,n)),r=n}return e}function lv(t){if(t.form===null)return t.codePoint;let e=H2[t.codePoint];return e&&(e[t.form]||e[0])||t.codePoint}function uv(t){if(!J2.test(t))return t;let e=nv(t);return av(e),sv(e),ov(e).map(r=>String.fromCodePoint(lv(r))).join(\"\")}function hv(t,e,r){let i=e.layout.get(\"text-transform\").evaluate(r,{});return i===\"uppercase\"?t=t.toLocaleUpperCase():i===\"lowercase\"&&(t=t.toLocaleLowerCase()),(vr.applyArabicShaping??uv)(t)}function cv(t,e,r){for(let i of t.sections)i.text=hv(i.text,e,r);return t}function pv(t){let e={},r={},i=[],n=0;function a(u){i.push(t[u]),n++}function s(u,h,c){let p=r[u];return delete r[u],r[h]=p,i[p].geometry[0].pop(),i[p].geometry[0]=i[p].geometry[0].concat(c[0]),p}function o(u,h,c){let p=e[h];return delete e[h],e[u]=p,i[p].geometry[0].shift(),i[p].geometry[0]=c[0].concat(i[p].geometry[0]),p}function l(u,h,c){let p=c?h[0][h[0].length-1]:h[0][0];return`${u}:${p.x}:${p.y}`}for(let u=0;u<t.length;u++){let h=t[u],c=h.geometry,p=h.text?h.text.toString():null;if(!p){a(u);continue}let f=l(p,c),d=l(p,c,!0);if(f in r&&d in e&&r[f]!==e[d]){let y=o(f,d,c),m=s(f,d,i[y].geometry);delete e[f],delete r[d],r[l(p,i[m].geometry,!0)]=m,i[y].geometry=null}else f in r?s(f,d,c):d in e?o(f,d,c):(a(u),e[f]=n-1,r[d]=n-1)}return i.filter(u=>u.geometry)}var jd=typeof Intl<\"u\"&&\"Segmenter\"in Intl,Us,qs;function Ko(t){if(!jd||!X2(t))return[...t];Us??(Us=new Intl.Segmenter(void 0,{granularity:\"grapheme\"}));let e=[];for(let{segment:r}of Us.segment(t)){let i=e.length-1;i>=0&&W2(e[i],r)?e[i]+=r:e.push(r)}return e}function fv(t){let e=new Set;if(jd){qs??(qs=new Intl.Segmenter(void 0,{granularity:\"word\"}));for(let{index:i}of qs.segment(t))e.add(i);return e}let r=0;for(let i of t.split(/\\b|(?=\\p{Ideo})/u))e.add(r),r+=i.length;return e}function Gd(t){let e=t.codePointAt(0);return t.length>(e>65535?2:1)}function Ql(t){return/\\s/u.test(String.fromCodePoint(t))}function Jo(t){for(let e of t)if(Xa(e.codePointAt(0)))return!0;return!1}function dv(t){for(let e of t)if(!yv(e.codePointAt(0)))return!1;return!0}function yv(t){return!q2(t)}function Ec(t){return!(Xa(t)||Y2(t))}function Yd(t){return/\\p{sc=Arab}/u.test(String.fromCodePoint(t))}function Xd(t){return j2(t)}function Wd(t){for(let e of t)if(Xd(e.codePointAt(0)))return!0;return!1}var qr={\"!\":\"\\uFE15\",\"#\":\"\\uFF03\",$:\"\\uFF04\",\"%\":\"\\uFF05\",\"&\":\"\\uFF06\",\"(\":\"\\uFE35\",\")\":\"\\uFE36\",\"*\":\"\\uFF0A\",\"+\":\"\\uFF0B\",\",\":\"\\uFE10\",\"-\":\"\\uFE32\",\".\":\"\\u30FB\",\"/\":\"\\uFF0F\",\":\":\"\\uFE13\",\";\":\"\\uFE14\",\"<\":\"\\uFE3F\",\"=\":\"\\uFF1D\",\">\":\"\\uFE40\",\"?\":\"\\uFE16\",\"@\":\"\\uFF20\",\"[\":\"\\uFE47\",\"\\\\\":\"\\uFF3C\",\"]\":\"\\uFE48\",\"^\":\"\\uFF3E\",_:\"\\uFE33\",\"`\":\"\\uFF40\",\"{\":\"\\uFE37\",\"|\":\"\\u2015\",\"}\":\"\\uFE38\",\"~\":\"\\uFF5E\",\"\\xA2\":\"\\uFFE0\",\"\\xA3\":\"\\uFFE1\",\"\\xA5\":\"\\uFFE5\",\"\\xA6\":\"\\uFFE4\",\"\\xAC\":\"\\uFFE2\",\"\\xAF\":\"\\uFFE3\",\"\\u2013\":\"\\uFE32\",\"\\u2014\":\"\\uFE31\",\"\\u2018\":\"\\uFE43\",\"\\u2019\":\"\\uFE44\",\"\\u201C\":\"\\uFE41\",\"\\u201D\":\"\\uFE42\",\"\\u2026\":\"\\uFE19\",\"\\u22EF\":\"\\uFE19\",\"\\u2027\":\"\\u30FB\",\"\\u20A9\":\"\\uFFE6\",\"\\u3001\":\"\\uFE11\",\"\\u3002\":\"\\uFE12\",\"\\u3008\":\"\\uFE3F\",\"\\u3009\":\"\\uFE40\",\"\\u300A\":\"\\uFE3D\",\"\\u300B\":\"\\uFE3E\",\"\\u300C\":\"\\uFE41\",\"\\u300D\":\"\\uFE42\",\"\\u300E\":\"\\uFE43\",\"\\u300F\":\"\\uFE44\",\"\\u3010\":\"\\uFE3B\",\"\\u3011\":\"\\uFE3C\",\"\\u3014\":\"\\uFE39\",\"\\u3015\":\"\\uFE3A\",\"\\u3016\":\"\\uFE17\",\"\\u3017\":\"\\uFE18\",\"\\uFF01\":\"\\uFE15\",\"\\uFF08\":\"\\uFE35\",\"\\uFF09\":\"\\uFE36\",\"\\uFF0C\":\"\\uFE10\",\"\\uFF0D\":\"\\uFE32\",\"\\uFF0E\":\"\\u30FB\",\"\\uFF1A\":\"\\uFE13\",\"\\uFF1B\":\"\\uFE14\",\"\\uFF1C\":\"\\uFE3F\",\"\\uFF1E\":\"\\uFE40\",\"\\uFF1F\":\"\\uFE16\",\"\\uFF3B\":\"\\uFE47\",\"\\uFF3D\":\"\\uFE48\",\"\\uFF3F\":\"\\uFE33\",\"\\uFF5B\":\"\\uFE37\",\"\\uFF5C\":\"\\u2015\",\"\\uFF5D\":\"\\uFE38\",\"\\uFF5F\":\"\\uFE35\",\"\\uFF60\":\"\\uFE36\",\"\\uFF61\":\"\\uFE12\",\"\\uFF62\":\"\\uFE41\",\"\\uFF63\":\"\\uFE42\"};function mv(t){let e=\"\",r={premature:!0,value:void 0},i=t[Symbol.iterator](),n=i.next(),a=t[Symbol.iterator]();a.next();let s=a.next();for(;!n.done;)(s.done||!Ec(s.value.codePointAt(0))||qr[s.value])&&(r.premature||!Ec(r.value.codePointAt(0))||qr[r.value])&&qr[n.value]?e+=qr[n.value]:e+=n.value,r={value:n.value,premature:!1},n=i.next(),s=a.next();return e}var gv={10:!0,13:!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},xv={40:!0};function Fc(t,e,r,i,n,a){if(\"fontStack\"in e){let s=r[e.fontStack],o=s?.[t];if(o)return o.metrics.advance*e.scale+n;let l=0;for(let u of t){let h=s?.[u];h&&(l+=h.metrics.advance*e.scale+n)}return l}{let s=i[e.imageName];return s?s.displaySize[0]*e.scale*24/a+n:0}}function Tc(t,e,r,i){let n=(t-e)**2;return i?t<e?n/2:n*2:n+Math.abs(r)*r}function kc(t){return/^\\s+$/u.test(t)}function vv(t,e,r){let i=0;return(t===10||t===13)&&(i-=1e4),r&&(i+=150),(t===40||t===65288)&&(i+=50),(e===41||e===65289)&&(i+=50),i}function Ic(t,e,r,i,n,a){let s=null,o=Tc(e,r,n,a);for(let l of i){let u=Tc(e-l.x,r,n,a)+l.badness;u<=o&&(s=l,o=u)}return{index:t,x:e,priorBreak:s,badness:o}}function Zd(t){return t?Zd(t.priorBreak).concat(t.index):[]}var tu=class Qo{constructor(e=\"\",r=[],i=[]){this.text=e,this.sections=r,this.sectionIndex=i,this.imageSectionID=null,this._graphemes=null}graphemes(){return this._graphemes??(this._graphemes=Ko(this.text)),this._graphemes}static fromFeature(e,r){let i=new Qo;for(let n of e.sections)n.image?i.addImageSection(n):i.addTextSection(n,r);return i}length(){return this.graphemes().length}getSection(e){return this.sections[this.sectionIndex[e]]}getSectionIndex(e){return this.sectionIndex[e]}verticalizePunctuation(){this.text=mv(this.text),this._graphemes=null}hasZeroWidthSpaces(){return this.text.includes(\"\\u200B\")}trim(){let e=this.graphemes(),r=0;for(;r<e.length&&kc(e[r]);)r++;let i=e.length;for(;i>r&&kc(e[i-1]);)i--;this.text=e.slice(r,i).join(\"\"),this.sectionIndex=this.sectionIndex.slice(r,i),this._graphemes=null}substring(e,r){let i=this.graphemes().slice(e,r).join(\"\"),n=this.sectionIndex.slice(e,r);return new Qo(i,this.sections,n)}toCodeUnitIndex(e){return this.graphemes().slice(0,e).join(\"\").length}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((e,r)=>Math.max(e,this.sections[r].scale),0)}getMaxImageSize(e){let r=0,i=0;for(let n=0;n<this.length();n++){let a=this.getSection(n);if(\"imageName\"in a){let s=e[a.imageName];if(!s)continue;let o=s.displaySize;r=Math.max(r,o[0]),i=Math.max(i,o[1])}}return{maxImageWidth:r,maxImageHeight:i}}_appendSection(e,r){let i=this.graphemes(),n=i.length>0?i[i.length-1]:\"\",a=Ko(n+e);this.text+=e,this._graphemes=i.slice(0,n?-1:void 0).concat(a);let s=a.length-+!!n;for(let o=0;o<s;o++)this.sectionIndex.push(r)}addTextSection(e,r){this.sections.push({scale:e.scale||1,verticalAlign:e.verticalAlign||\"bottom\",fontStack:e.fontStack||r}),this._appendSection(e.text,this.sections.length-1)}addImageSection(e){let r=e.image?e.image.name:\"\";if(r.length===0){Mt(\"Can't add FormattedSection with an empty image.\");return}let i=this.getNextImageSectionCharCode();if(!i){Mt(\"Reached maximum number of images 6401\");return}this.sections.push({scale:1,verticalAlign:e.verticalAlign||\"bottom\",imageName:r}),this._appendSection(String.fromCharCode(i),this.sections.length-1)}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}determineLineBreaks(e,r,i,n,a){let s=[],o=this.determineAverageLineWidth(e,r,i,n,a),l=this.hasZeroWidthSpaces(),u=this.graphemes(),h=null,c=0,p=0;for(let f=0;f<u.length;f++){let d=u[f];if(f>0){let y=u[f-1].codePointAt(0),m=d.codePointAt(0),g=G2(y),x=Ac(y)&&Ac(m);(gv[y]||g||\"imageName\"in this.getSection(f-1)||u[f+1]!==void 0&&xv[m]||x&&(h??(h=fv(this.text))).has(p))&&s.push(Ic(f,c,o,s,vv(y,m,g&&l),!1))}Ql(d.codePointAt(0))||(c+=Fc(d,this.getSection(f),i,n,e,a)),p+=d.length}return Zd(Ic(this.length(),c,o,s,0,!0))}determineAverageLineWidth(e,r,i,n,a){let s=0,o=0;for(let u of this.graphemes()){let h=this.getSection(o);s+=Fc(u,h,i,n,e,a),o++}let l=Math.max(1,Math.ceil(s/r));return s/l}};function bv(){return(function(t){var e={R:\"13k,1a,2,3,3,2+1j,ch+16,a+1,5+2,2+n,5,a,4,6+16,4+3,h+1b,4mo,179q,2+9,2+11,2i9+7y,2+68,4,3+4,5+13,4+3,2+4k,3+29,8+cf,1t+7z,w+17,3+3m,1t+3z,16o1+5r,8+30,8+mc,29+1r,29+4v,75+73\",EN:\"1c+9,3d+1,6,187+9,513,4+5,7+9,sf+j,175h+9,qw+q,161f+1d,4xt+a,25i+9\",ES:\"17,2,6dp+1,f+1,av,16vr,mx+1,4o,2\",ET:\"z+2,3h+3,b+1,ym,3e+1,2o,p4+1,8,6u,7c,g6,1wc,1n9+4,30+1b,2n,6d,qhx+1,h0m,a+1,49+2,63+1,4+1,6bb+3,12jj\",AN:\"16o+5,2j+9,2+1,35,ed,1ff2+9,87+u\",CS:\"18,2+1,b,2u,12k,55v,l,17v0,2,3,53,2+1,b\",B:\"a,3,f+2,2v,690\",S:\"9,2,k\",WS:\"c,k,4f4,1vk+a,u,1j,335\",ON:\"x+1,4+4,h+5,r+5,r+3,z,5+3,2+1,2+1,5,2+2,3+4,o,w,ci+1,8+d,3+d,6+8,2+g,39+1,9,6+1,2,33,b8,3+1,3c+1,7+1,5r,b,7h+3,sa+5,2,3i+6,jg+3,ur+9,2v,ij+1,9g+9,7+a,8m,4+1,49+x,14u,2+2,c+2,e+2,e+2,e+1,i+n,e+e,2+p,u+2,e+2,36+1,2+3,2+1,b,2+2,6+5,2,2,2,h+1,5+4,6+3,3+f,16+2,5+3l,3+81,1y+p,2+40,q+a,m+13,2r+ch,2+9e,75+hf,3+v,2+2w,6e+5,f+6,75+2a,1a+p,2+2g,d+5x,r+b,6+3,4+o,g,6+1,6+2,2k+1,4,2j,5h+z,1m+1,1e+f,t+2,1f+e,d+3,4o+3,2s+1,w,535+1r,h3l+1i,93+2,2s,b+1,3l+x,2v,4g+3,21+3,kz+1,g5v+1,5a,j+9,n+v,2,3,2+8,2+1,3+2,2,3,46+1,4+4,h+5,r+5,r+a,3h+2,4+6,b+4,78,1r+24,4+c,4,1hb,ey+6,103+j,16j+c,1ux+7,5+g,fsh,jdq+1t,4,57+2e,p1,1m,1m,1m,1m,4kt+1,7j+17,5+2r,d+e,3+e,2+e,2+10,m+4,w,1n+5,1q,4z+5,4b+rb,9+c,4+c,4+37,d+2g,8+b,l+b,5+1j,9+9,7+13,9+t,3+1,27+3c,2+29,2+3q,d+d,3+4,4+2,6+6,a+o,8+6,a+2,e+6,16+42,2+1i\",BN:\"0+8,6+d,2s+5,2+p,e,4m9,1kt+2,2b+5,5+5,17q9+v,7k,6p+8,6+1,119d+3,440+7,96s+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+75,6p+2rz,1ben+1,1ekf+1,1ekf+1\",NSM:\"lc+33,7o+6,7c+18,2,2+1,2+1,2,21+a,1d+k,h,2u+6,3+5,3+1,2+3,10,v+q,2k+a,1n+8,a,p+3,2+8,2+2,2+4,18+2,3c+e,2+v,1k,2,5+7,5,4+6,b+1,u,1n,5+3,9,l+1,r,3+1,1m,5+1,5+1,3+2,4,v+1,4,c+1,1m,5+4,2+1,5,l+1,n+5,2,1n,3,2+3,9,8+1,c+1,v,1q,d,1f,4,1m+2,6+2,2+3,8+1,c+1,u,1n,g+1,l+1,t+1,1m+1,5+3,9,l+1,u,21,8+2,2,2j,3+6,d+7,2r,3+8,c+5,23+1,s,2,2,1k+d,2+4,2+1,6+a,2+z,a,2v+3,2+5,2+1,3+1,q+1,5+2,h+3,e,3+1,7,g,jk+2,qb+2,u+2,u+1,v+1,1t+1,2+6,9,3+a,a,1a+2,3c+1,z,3b+2,5+1,a,7+2,64+1,3,1n,2+6,2,2,3+7,7+9,3,1d+g,1s+3,1d,2+4,2,6,15+8,d+1,x+3,3+1,2+2,1l,2+1,4,2+2,1n+7,3+1,49+2,2+c,2+6,5,7,4+1,5j+1l,2+4,k1+w,2db+2,3y,2p+v,ff+3,30+1,n9x+3,2+9,x+1,29+1,7l,4,5,q+1,6,48+1,r+h,e,13+7,q+a,1b+2,1d,3+3,3+1,14,1w+5,3+1,3+1,d,9,1c,1g,2+2,3+1,6+1,2,17+1,9,6n,3,5,fn5,ki+f,h+f,r2,6b,46+4,1af+2,2+1,6+3,15+2,5,4m+1,fy+3,as+1,4a+a,4x,1j+e,1l+2,1e+3,3+1,1y+2,11+4,2+7,1r,d+1,1h+8,b+3,3,2o+2,3,2+1,7,4h,4+7,m+1,1m+1,4,12+6,4+4,5g+7,3+2,2,o,2d+5,2,5+1,2+1,6n+3,7+1,2+1,s+1,2e+7,3,2+1,2z,2,3+5,2,2u+2,3+3,2+4,78+8,2+1,75+1,2,5,41+3,3+1,5,x+5,3+1,15+5,3+3,9,a+5,3+2,1b+c,2+1,bb+6,2+5,2d+l,3+6,2+1,2+1,3f+5,4,2+1,2+6,2,21+1,4,2,9o+1,f0c+4,1o+6,t5,1s+3,2a,f5l+1,43t+2,i+7,3+6,v+3,45+2,1j0+1i,5+1d,9,f,n+4,2+e,11t+6,2+g,3+6,2+1,2+4,7a+6,c6+3,15t+6,32+6,gzhy+6n\",AL:\"16w,3,2,e+1b,z+2,2+2s,g+1,8+1,b+m,2+t,s+2i,c+e,4h+f,1d+1e,1bwe+dp,3+3z,x+c,2+1,35+3y,2rm+z,5+7,b+5,dt+l,c+u,17nl+27,1t+27,4x+6n,3+d\",LRO:\"6ct\",RLO:\"6cu\",LRE:\"6cq\",RLE:\"6cr\",PDF:\"6cs\",LRI:\"6ee\",RLI:\"6ef\",FSI:\"6eg\",PDI:\"6eh\"},r={},i={};r.L=1,i[1]=\"L\",Object.keys(e).forEach(function(N,Q){r[N]=1<<Q+1,i[r[N]]=N}),Object.freeze(r);var n=r.LRI|r.RLI|r.FSI,a=r.L|r.R|r.AL,s=r.B|r.S|r.WS|r.ON|r.FSI|r.LRI|r.RLI|r.PDI,o=r.BN|r.RLE|r.LRE|r.RLO|r.LRO|r.PDF,l=r.S|r.WS|r.B|n|r.PDI|o,u=null;function h(){if(!u){u=new Map;var N=0;for(var Q in e)if(e.hasOwnProperty(Q))for(var Z=e[Q],C=\"\",ut=void 0,Y=!1,G=0,K=0;K<=Z.length+1;K+=1){var $t=Z[K];if($t!==\",\"&&K!==Z.length)$t===\"+\"?(Y=!0,G=N=G+parseInt(C,36),C=\"\"):C+=$t;else{Y?ut=N+parseInt(C,36):(G=N=G+parseInt(C,36),ut=N),Y=!1,C=\"\",G=ut;for(var vt=N;vt<ut+1;vt+=1)u.set(vt,r[Q])}}}}function c(N){return h(),u.get(N.codePointAt(0))||r.L}function p(N){return i[c(N)]}var f={pairs:\"14>1,1e>2,u>2,2wt>1,1>1,1ge>1,1wp>1,1j>1,f>1,hm>1,1>1,u>1,u6>1,1>1,+5,28>1,w>1,1>1,+3,b8>1,1>1,+3,1>3,-1>-1,3>1,1>1,+2,1s>1,1>1,x>1,th>1,1>1,+2,db>1,1>1,+3,3>1,1>1,+2,14qm>1,1>1,+1,4q>1,1e>2,u>2,2>1,+1\",canonical:\"6f1>-6dx,6dy>-6dx,6ec>-6ed,6ee>-6ed,6ww>2jj,-2ji>2jj,14r4>-1e7l,1e7m>-1e7l,1e7m>-1e5c,1e5d>-1e5b,1e5c>-14qx,14qy>-14qx,14vn>-1ecg,1ech>-1ecg,1edu>-1ecg,1eci>-1ecg,1eda>-1ecg,1eci>-1ecg,1eci>-168q,168r>-168q,168s>-14ye,14yf>-14ye\"};function d(N,Q){var Z=0,C=new Map,ut=Q&&new Map,Y;return N.split(\",\").forEach(function G(K){if(K.indexOf(\"+\")!==-1)for(var $t=+K;$t--;)G(Y);else{Y=K;var vt=K.split(\">\"),nt=vt[0],kt=vt[1];nt=String.fromCodePoint(Z+=parseInt(nt,36)),kt=String.fromCodePoint(Z+=parseInt(kt,36)),C.set(nt,kt),Q&&ut.set(kt,nt)}}),{map:C,reverseMap:ut}}var y,m,g;function x(){if(!y){var N=d(f.pairs,!0),Q=N.map,Z=N.reverseMap;y=Q,m=Z,g=d(f.canonical,!1).map}}function b(N){return x(),y.get(N)||null}function v(N){return x(),m.get(N)||null}function w(N){return x(),g.get(N)||null}var _=r.L,A=r.R,S=r.EN,F=r.ES,L=r.ET,V=r.AN,P=r.CS,R=r.B,E=r.S,$=r.ON,O=r.BN,M=r.NSM,j=r.AL,it=r.LRO,pt=r.RLO,st=r.LRE,ft=r.RLE,Gt=r.PDF,ze=r.LRI,fe=r.RLI,Le=r.FSI,Zt=r.PDI;function Sr(N,Q){for(var Z=125,C=new Uint32Array(N.length),ut=0;ut<N.length;ut++)C[ut]=c(N[ut]);var Y=new Map;function G(Yt,oe){var Xt=C[Yt];C[Yt]=oe,Y.set(Xt,Y.get(Xt)-1),Xt&s&&Y.set(s,Y.get(s)-1),Y.set(oe,(Y.get(oe)||0)+1),oe&s&&Y.set(s,(Y.get(s)||0)+1)}for(var K=new Uint8Array(N.length),$t=new Map,vt=[],nt=null,kt=0;kt<N.length;kt++)nt||vt.push(nt={start:kt,end:N.length-1,level:Q===\"rtl\"?1:Q===\"ltr\"?0:Qu(kt,!1)}),C[kt]&R&&(nt.end=kt,nt=null);for(var pi=ft|st|pt|it|n|Zt|Gt|R,ir=function(Yt){return Yt+(Yt&1?1:2)},Ve=function(Yt){return Yt+(Yt&1?2:1)},Oe=0;Oe<vt.length;Oe++){nt=vt[Oe];var ot=[{_level:nt.level,_override:0,_isolate:0}],bt=void 0,Fe=0,Re=0,Ha=0;Y.clear();for(var zt=nt.start;zt<=nt.end;zt++){var Lt=C[zt];if(bt=ot[ot.length-1],Y.set(Lt,(Y.get(Lt)||0)+1),Lt&s&&Y.set(s,(Y.get(s)||0)+1),Lt&pi)if(Lt&(ft|st)){K[zt]=bt._level;var Fu=(Lt===ft?Ve:ir)(bt._level);Fu<=Z&&!Fe&&!Re?ot.push({_level:Fu,_override:0,_isolate:0}):Fe||Re++}else if(Lt&(pt|it)){K[zt]=bt._level;var Tu=(Lt===pt?Ve:ir)(bt._level);Tu<=Z&&!Fe&&!Re?ot.push({_level:Tu,_override:Lt&pt?A:_,_isolate:0}):Fe||Re++}else if(Lt&n){Lt&Le&&(Lt=Qu(zt+1,!0)===1?fe:ze),K[zt]=bt._level,bt._override&&G(zt,bt._override);var ku=(Lt===fe?Ve:ir)(bt._level);ku<=Z&&Fe===0&&Re===0?(Ha++,ot.push({_level:ku,_override:0,_isolate:1,_isolInitIndex:zt})):Fe++}else if(Lt&Zt){if(Fe>0)Fe--;else if(Ha>0){for(Re=0;!ot[ot.length-1]._isolate;)ot.pop();var Ka=ot[ot.length-1]._isolInitIndex;Ka!=null&&($t.set(Ka,zt),$t.set(zt,Ka)),ot.pop(),Ha--}bt=ot[ot.length-1],K[zt]=bt._level,bt._override&&G(zt,bt._override)}else Lt&Gt?(Fe===0&&(Re>0?Re--:!bt._isolate&&ot.length>1&&(ot.pop(),bt=ot[ot.length-1])),K[zt]=bt._level):Lt&R&&(K[zt]=nt.level);else K[zt]=bt._level,bt._override&&Lt!==O&&G(zt,bt._override)}for(var kr=[],de=null,nr=nt.start;nr<=nt.end;nr++){var Ja=C[nr];if(!(Ja&o)){var Iu=K[nr],Cu=Ja&n,a1=Ja===Zt;de&&Iu===de._level?(de._end=nr,de._endsWithIsolInit=Cu):kr.push(de={_start:nr,_end:nr,_level:Iu,_startsWithPDI:a1,_endsWithIsolInit:Cu})}}for(var Qa=[],Dn=0;Dn<kr.length;Dn++){var _n=kr[Dn];if(!_n._startsWithPDI||_n._startsWithPDI&&!$t.has(_n._start)){for(var ts=[de=_n],Mu=void 0;de&&de._endsWithIsolInit&&(Mu=$t.get(de._end))!=null;)for(var An=Dn+1;An<kr.length;An++)if(kr[An]._start===Mu){ts.push(de=kr[An]);break}for(var Ir=[],es=0;es<ts.length;es++)for(var Bu=ts[es],rs=Bu._start;rs<=Bu._end;rs++)Ir.push(rs);for(var s1=K[Ir[0]],Pu=nt.level,Sn=Ir[0]-1;Sn>=0;Sn--)if(!(C[Sn]&o)){Pu=K[Sn];break}var is=Ir[Ir.length-1],o1=K[is],zu=nt.level;if(!(C[is]&n)){for(var En=is+1;En<=nt.end;En++)if(!(C[En]&o)){zu=K[En];break}}Qa.push({_seqIndices:Ir,_sosType:Math.max(Pu,s1)%2?A:_,_eosType:Math.max(zu,o1)%2?A:_})}}for(var ns=0;ns<Qa.length;ns++){var as=Qa[ns],q=as._seqIndices,fi=as._sosType,l1=as._eosType,Cr=K[q[0]]&1?A:_;if(Y.get(M))for(var Fn=0;Fn<q.length;Fn++){var Lu=q[Fn];if(C[Lu]&M){for(var ss=fi,Tn=Fn-1;Tn>=0;Tn--)if(!(C[q[Tn]]&o)){ss=C[q[Tn]];break}G(Lu,ss&(n|Zt)?$:ss)}}if(Y.get(S))for(var kn=0;kn<q.length;kn++){var Vu=q[kn];if(C[Vu]&S)for(var In=kn-1;In>=-1;In--){var Ou=In===-1?fi:C[q[In]];if(Ou&a){Ou===j&&G(Vu,V);break}}}if(Y.get(j))for(var os=0;os<q.length;os++){var Ru=q[os];C[Ru]&j&&G(Ru,A)}if(Y.get(F)||Y.get(P))for(var di=1;di<q.length-1;di++){var ls=q[di];if(C[ls]&(F|P)){for(var Mr=0,us=0,hs=di-1;hs>=0&&(Mr=C[q[hs]],Mr&o);hs--);for(var cs=di+1;cs<q.length&&(us=C[q[cs]],us&o);cs++);Mr===us&&(C[ls]===F?Mr===S:Mr&(S|V))&&G(ls,Mr)}}if(Y.get(S)){for(var ye=0;ye<q.length;ye++)if(C[q[ye]]&S){for(var Cn=ye-1;Cn>=0&&C[q[Cn]]&(L|o);Cn--)G(q[Cn],S);for(ye++;ye<q.length&&C[q[ye]]&(L|o|S);ye++)C[q[ye]]!==S&&G(q[ye],S)}}if(Y.get(L)||Y.get(F)||Y.get(P))for(var yi=0;yi<q.length;yi++){var $u=q[yi];if(C[$u]&(L|F|P)){G($u,$);for(var Mn=yi-1;Mn>=0&&C[q[Mn]]&o;Mn--)G(q[Mn],$);for(var Bn=yi+1;Bn<q.length&&C[q[Bn]]&o;Bn++)G(q[Bn],$)}}if(Y.get(S))for(var ps=0,Nu=fi;ps<q.length;ps++){var Uu=q[ps],fs=C[Uu];fs&S?Nu===_&&G(Uu,_):fs&a&&(Nu=fs)}if(Y.get(s)){for(var mi=A|S|V,qu=mi|_,Pn=[],Br=[],Pr=0;Pr<q.length;Pr++)if(C[q[Pr]]&s){var gi=N[q[Pr]],ju=void 0;if(b(gi)!==null)if(Br.length<63)Br.push({char:gi,seqIndex:Pr});else break;else if((ju=v(gi))!==null)for(var xi=Br.length-1;xi>=0;xi--){var ds=Br[xi].char;if(ds===ju||ds===v(w(gi))||b(w(ds))===gi){Pn.push([Br[xi].seqIndex,Pr]),Br.length=xi;break}}}Pn.sort(function(Yt,oe){return Yt[0]-oe[0]});for(var ys=0;ys<Pn.length;ys++){for(var Gu=Pn[ys],zn=Gu[0],ms=Gu[1],Yu=!1,me=0,gs=zn+1;gs<ms;gs++){var Xu=q[gs];if(C[Xu]&qu){Yu=!0;var Wu=C[Xu]&mi?A:_;if(Wu===Cr){me=Wu;break}}}if(Yu&&!me){me=fi;for(var xs=zn-1;xs>=0;xs--){var Zu=q[xs];if(C[Zu]&qu){var Hu=C[Zu]&mi?A:_;me=Hu===Cr?Cr:Hu;break}}}if(me){if(C[q[zn]]=C[q[ms]]=me,me!==Cr){for(var vi=zn+1;vi<q.length;vi++)if(!(C[q[vi]]&o)){c(N[q[vi]])&M&&(C[q[vi]]=me);break}}if(me!==Cr){for(var bi=ms+1;bi<q.length;bi++)if(!(C[q[bi]]&o)){c(N[q[bi]])&M&&(C[q[bi]]=me);break}}}}for(var $e=0;$e<q.length;$e++)if(C[q[$e]]&s){for(var Ku=$e,vs=$e,bs=fi,wi=$e-1;wi>=0;wi--)if(C[q[wi]]&o)Ku=wi;else{bs=C[q[wi]]&mi?A:_;break}for(var Ju=l1,Di=$e+1;Di<q.length;Di++)if(C[q[Di]]&(s|o))vs=Di;else{Ju=C[q[Di]]&mi?A:_;break}for(var ws=Ku;ws<=vs;ws++)C[q[ws]]=bs===Ju?bs:Cr;$e=vs}}}for(var Ht=nt.start;Ht<=nt.end;Ht++){var u1=K[Ht],Ln=C[Ht];if(u1&1?Ln&(_|S|V)&&K[Ht]++:Ln&A?K[Ht]++:Ln&(V|S)&&(K[Ht]+=2),Ln&o&&(K[Ht]=Ht===0?nt.level:K[Ht-1]),Ht===nt.end||c(N[Ht])&(E|R))for(var Vn=Ht;Vn>=0&&c(N[Vn])&l;Vn--)K[Vn]=nt.level}}return{levels:K,paragraphs:vt};function Qu(Yt,oe){for(var Xt=Yt;Xt<N.length;Xt++){var Ne=C[Xt];if(Ne&(A|j))return 1;if(Ne&(R|_)||oe&&Ne===Zt)return 0;if(Ne&n){var th=h1(Xt);Xt=th===-1?N.length:th}}return 0}function h1(Yt){for(var oe=1,Xt=Yt+1;Xt<N.length;Xt++){var Ne=C[Xt];if(Ne&R)break;if(Ne&Zt){if(--oe===0)return Xt}else Ne&n&&oe++}return-1}}var Er=\"14>1,j>2,t>2,u>2,1a>g,2v3>1,1>1,1ge>1,1wd>1,b>1,1j>1,f>1,ai>3,-2>3,+1,8>1k0,-1jq>1y7,-1y6>1hf,-1he>1h6,-1h5>1ha,-1h8>1qi,-1pu>1,6>3u,-3s>7,6>1,1>1,f>1,1>1,+2,3>1,1>1,+13,4>1,1>1,6>1eo,-1ee>1,3>1mg,-1me>1mk,-1mj>1mi,-1mg>1mi,-1md>1,1>1,+2,1>10k,-103>1,1>1,4>1,5>1,1>1,+10,3>1,1>8,-7>8,+1,-6>7,+1,a>1,1>1,u>1,u6>1,1>1,+5,26>1,1>1,2>1,2>2,8>1,7>1,4>1,1>1,+5,b8>1,1>1,+3,1>3,-2>1,2>1,1>1,+2,c>1,3>1,1>1,+2,h>1,3>1,a>1,1>1,2>1,3>1,1>1,d>1,f>1,3>1,1a>1,1>1,6>1,7>1,13>1,k>1,1>1,+19,4>1,1>1,+2,2>1,1>1,+18,m>1,a>1,1>1,lk>1,1>1,4>1,2>1,f>1,3>1,1>1,+3,db>1,1>1,+3,3>1,1>1,+2,14qm>1,1>1,+1,6>1,4j>1,j>2,t>2,u>2,2>1,+1\",er;function ci(){if(!er){var N=d(Er,!0),Q=N.map;N.reverseMap.forEach(function(Z,C){Q.set(C,Z)}),er=Q}}function Tt(N){return ci(),er.get(N)||null}function Ee(N,Q,Z,C){var ut=N.length;Z=Math.max(0,Z==null?0:+Z),C=Math.min(ut-1,C==null?ut-1:+C);for(var Y=new Map,G=Z;G<=C;G++)if(Q[G]&1){var K=Tt(N[G]);K!==null&&Y.set(G,K)}return Y}function rr(N,Q,Z,C){var ut=N.length;Z=Math.max(0,Z==null?0:+Z),C=Math.min(ut-1,C==null?ut-1:+C);var Y=[];return Q.paragraphs.forEach(function(G){var K=Math.max(Z,G.start),$t=Math.min(C,G.end);if(K<$t){for(var vt=Q.levels.slice(K,$t+1),nt=$t;nt>=K&&c(N[nt])&l;nt--)vt[nt]=G.level;for(var kt=G.level,pi=1/0,ir=0;ir<vt.length;ir++){var Ve=vt[ir];Ve>kt&&(kt=Ve),Ve<pi&&(pi=Ve|1)}for(var Oe=kt;Oe>=pi;Oe--)for(var ot=0;ot<vt.length;ot++)if(vt[ot]>=Oe){for(var bt=ot;ot+1<vt.length&&vt[ot+1]>=Oe;)ot++;ot>bt&&Y.push([bt+K,ot+K])}}}),Y}function Fr(N,Q,Z,C){var ut=Tr(N,Q,Z,C),Y=[].concat(N);return ut.forEach(function(G,K){Y[K]=(Q.levels[G]&1?Tt(N[G]):null)||N[G]}),Y.join(\"\")}function Tr(N,Q,Z,C){for(var ut=rr(N,Q,Z,C),Y=[],G=0;G<N.length;G++)Y[G]=G;return ut.forEach(function(K){for(var $t=K[0],vt=K[1],nt=Y.slice($t,vt+1),kt=nt.length;kt--;)Y[vt-kt]=nt[kt]}),Y}return t.closingToOpeningBracket=v,t.getBidiCharType=c,t.getBidiCharTypeName=p,t.getCanonicalBracket=w,t.getEmbeddingLevels=Sr,t.getMirroredCharacter=Tt,t.getMirroredCharactersMap=Ee,t.getReorderSegments=rr,t.getReorderedIndices=Tr,t.getReorderedString=Fr,t.openingToClosingBracket=b,Object.defineProperty(t,\"__esModule\",{value:!0}),t})({})}var eu=bv(),wv=/[\\u061c\\u200e\\u200f\\u202a-\\u202e\\u2066-\\u2069]/,Dv=new Set([\"WS\",\"FSI\",\"LRI\",\"RLI\",\"PDI\"]),_v=new Set([\"S\",\"B\"]);function Av(t,e,r,i){let n=[],a=r;for(let s of Ko(t.slice(r,i)))n.push({index:a,text:s,level:e[a]}),a+=s.length;return n}function Sv(t,e){let r=!0;for(let i=t.length-1;i>=0;i--){let n=eu.getBidiCharTypeName(t[i].text[0]);_v.has(n)?(t[i].level=e,r=!0):r&&Dv.has(n)?t[i].level=e:r=!1}}function Ev(t,e){let r=e,i=1/0;for(let{level:a}of t)a>r&&(r=a),(a|1)<i&&(i=a|1);let n=t.slice();for(let a=r;a>=i;a--)for(let s=0;s<n.length;s++){if(n[s].level<a)continue;let o=s;for(;o+1<n.length&&n[o+1].level>=a;)o++;for(let l=s,u=o;l<u;l++,u--)[n[l],n[u]]=[n[u],n[l]];s=o}return n}function Fv(t){return t.level%2==0?t.text:eu.getMirroredCharacter(t.text)??t.text}function Tv(t,e){return t.find(r=>e>=r.start&&e<=r.end)?.level??0}function kv(t,e,r,i,n){let a=Av(t,e,i,n);Sv(a,r);let s=\"\",o=[];for(let l of Ev(a,r)){if(wv.test(l.text))continue;let u=Fv(l);s+=u,o.push(...Array(u.length).fill(l.index))}return{text:s,sourceIndices:o}}function Iv(t,e){let r=e.filter(a=>a>0&&a<t.length),i=[...new Set([0,...r,t.length])].sort((a,s)=>a-s),n=[];for(let a=0;a+1<i.length;a++)n.push([i[a],i[a+1]]);return n}function Hd(t,e){let{levels:r,paragraphs:i}=eu.getEmbeddingLevels(t);return Iv(t,e.concat(i.map(n=>n.start))).map(([n,a])=>kv(t,r,Tv(i,n),n,a))}function Cv(t,e){return Hd(t,e).map(r=>r.text)}function Mv(t,e,r){return Hd(t,r).map(i=>[i.text,i.sourceIndices.map(n=>e[n]??0)])}var tl=4294967296,Cc=1/tl,Mc=typeof TextDecoder>\"u\"?null:new TextDecoder(\"utf-8\"),ru=class{constructor(t){this.buf=ArrayBuffer.isView(t)?t:new Uint8Array(t),this.dataView=new DataView(this.buf.buffer,this.buf.byteOffset,this.buf.byteLength),this.pos=0,this.type=0,this._valueStart=-1,this.length=this.buf.length}readFields(t,e,r=this.length){let i;for(;i=this.nextField(r);)t(i,e,this);return e}readMessage(t,e){return this.readFields(t,e,this.readVarint()+this.pos)}readFixed32(){let t=this.dataView.getUint32(this.pos,!0);return this.pos+=4,t}readSFixed32(){let t=this.dataView.getInt32(this.pos,!0);return this.pos+=4,t}readFixed64(){let t=this.dataView.getUint32(this.pos,!0)+this.dataView.getUint32(this.pos+4,!0)*tl;return this.pos+=8,t}readSFixed64(){let t=this.dataView.getUint32(this.pos,!0)+this.dataView.getInt32(this.pos+4,!0)*tl;return this.pos+=8,t}readFloat(){let t=this.dataView.getFloat32(this.pos,!0);return this.pos+=4,t}readDouble(){let t=this.dataView.getFloat64(this.pos,!0);return this.pos+=8,t}readVarint(t){let e=this.buf,r=e[this.pos++];if(r<128)return r;let i=r&127,n;return n=e[this.pos++],i|=(n&127)<<7,n<128||(n=e[this.pos++],i|=(n&127)<<14,n<128)||(n=e[this.pos++],i|=(n&127)<<21,n<128)?i:(n=e[this.pos],i|=(n&15)<<28,Pv(i,t,this))}readSVarint(){let t=this.readVarint();return t%2==1?(t+1)/-2:t/2}readBoolean(){return!!this.readVarint()}readString(){let t=this.readVarint()+this.pos,e=this.pos;return this.pos=t,t-e>=12&&Mc?Mc.decode(this.buf.subarray(e,t)):Wv(this.buf,e,t)}readBytes(){let t=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,t);return this.pos=t,e}readPackedVarint(t=[],e){let r=this.readPackedEnd();for(;this.pos<r;)t.push(this.readVarint(e));return t}readPackedSVarint(t=[]){let e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readSVarint());return t}readPackedBoolean(t=[]){let e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readBoolean());return t}readPackedFloat(t=[]){let e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readFloat());return t}readPackedDouble(t=[]){let e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readDouble());return t}readPackedFixed32(t=[]){let e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readFixed32());return t}readPackedSFixed32(t=[]){let e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readSFixed32());return t}readPackedFixed64(t=[]){let e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readFixed64());return t}readPackedSFixed64(t=[]){let e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readSFixed64());return t}readPackedEnd(){return this.type===2?this.readVarint()+this.pos:this.pos+1}nextField(t=this.length){if(this.pos===this._valueStart&&this.skip(this.type),this.pos>=t)return 0;let e=this.readVarint();return this.type=e&7,this._valueStart=this.pos,e>>>3}skip(t){let e=t&7;if(e===0)for(;this.buf[this.pos++]>127;);else if(e===2)this.pos=this.readVarint()+this.pos;else if(e===5)this.pos+=4;else if(e===1)this.pos+=8;else throw Error(`Unimplemented type: ${e}`)}},Bv=class{constructor(t=new Uint8Array(16)){this.buf=ArrayBuffer.isView(t)?t:new Uint8Array(t),this.dataView=new DataView(this.buf.buffer,this.buf.byteOffset,this.buf.byteLength),this.pos=0,this.length=this.buf.length}writeTag(t,e){this.writeVarint(t<<3|e)}realloc(t){let e=this.length||16;for(;e<this.pos+t;)e*=2;if(e!==this.length){let r=new Uint8Array(e);r.set(this.buf),this.buf=r,this.dataView=new DataView(r.buffer),this.length=e}}finish(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)}writeFixed32(t){this.realloc(4),this.dataView.setInt32(this.pos,t,!0),this.pos+=4}writeSFixed32(t){this.realloc(4),this.dataView.setInt32(this.pos,t,!0),this.pos+=4}writeFixed64(t){this.realloc(8),this.dataView.setInt32(this.pos,t&-1,!0),this.dataView.setInt32(this.pos+4,Math.floor(t*Cc),!0),this.pos+=8}writeSFixed64(t){this.realloc(8),this.dataView.setInt32(this.pos,t&-1,!0),this.dataView.setInt32(this.pos+4,Math.floor(t*Cc),!0),this.pos+=8}writeVarint(t){if(t=+t||0,t>=0&&t<128){this.pos>=this.length&&this.realloc(1),this.buf[this.pos++]=t;return}if(t>268435455||t<0){Lv(t,this);return}this.realloc(4),this.buf[this.pos++]=t&127|(t>127?128:0),!(t<=127)&&(this.buf[this.pos++]=(t>>>=7)&127|(t>127?128:0),!(t<=127)&&(this.buf[this.pos++]=(t>>>=7)&127|(t>127?128:0),!(t<=127)&&(this.buf[this.pos++]=t>>>7&127)))}writeSVarint(t){this.writeVarint(t<0?-t*2-1:t*2)}writeBoolean(t){this.writeVarint(+t)}writeString(t){t=String(t),this.realloc(t.length*4),this.pos++;let e=this.pos;this.pos=Zv(this.buf,t,this.pos);let r=this.pos-e;r>=128&&Bc(e,r,this),this.pos=e-1,this.writeVarint(r),this.pos+=r}writeFloat(t){this.realloc(4),this.dataView.setFloat32(this.pos,t,!0),this.pos+=4}writeDouble(t){this.realloc(8),this.dataView.setFloat64(this.pos,t,!0),this.pos+=8}writeBytes(t){let e=t.length;this.writeVarint(e),this.realloc(e),this.buf.set(t,this.pos),this.pos+=e}writeRawMessage(t,e){this.pos++;let r=this.pos;t(e,this);let i=this.pos-r;i>=128&&Bc(r,i,this),this.pos=r-1,this.writeVarint(i),this.pos+=i}writeMessage(t,e,r){this.writeTag(t,2),this.writeRawMessage(e,r)}writePackedVarint(t,e){e.length&&this.writeMessage(t,Rv,e)}writePackedSVarint(t,e){e.length&&this.writeMessage(t,$v,e)}writePackedBoolean(t,e){e.length&&this.writeMessage(t,qv,e)}writePackedFloat(t,e){e.length&&this.writeMessage(t,Nv,e)}writePackedDouble(t,e){e.length&&this.writeMessage(t,Uv,e)}writePackedFixed32(t,e){e.length&&this.writeMessage(t,jv,e)}writePackedSFixed32(t,e){e.length&&this.writeMessage(t,Gv,e)}writePackedFixed64(t,e){e.length&&this.writeMessage(t,Yv,e)}writePackedSFixed64(t,e){e.length&&this.writeMessage(t,Xv,e)}writeBytesField(t,e){this.writeTag(t,2),this.writeBytes(e)}writeFixed32Field(t,e){this.writeTag(t,5),this.writeFixed32(e)}writeSFixed32Field(t,e){this.writeTag(t,5),this.writeSFixed32(e)}writeFixed64Field(t,e){this.writeTag(t,1),this.writeFixed64(e)}writeSFixed64Field(t,e){this.writeTag(t,1),this.writeSFixed64(e)}writeVarintField(t,e){this.writeTag(t,0),this.writeVarint(e)}writeSVarintField(t,e){this.writeTag(t,0),this.writeSVarint(e)}writeStringField(t,e){this.writeTag(t,2),this.writeString(e)}writeFloatField(t,e){this.writeTag(t,5),this.writeFloat(e)}writeDoubleField(t,e){this.writeTag(t,1),this.writeDouble(e)}writeBooleanField(t,e){this.writeVarintField(t,+e)}};function Pv(t,e,r){let i=r.buf,n,a;if(a=i[r.pos++],n=(a&112)>>4,a<128||(a=i[r.pos++],n|=(a&127)<<3,a<128)||(a=i[r.pos++],n|=(a&127)<<10,a<128)||(a=i[r.pos++],n|=(a&127)<<17,a<128)||(a=i[r.pos++],n|=(a&127)<<24,a<128)||(a=i[r.pos++],n|=(a&1)<<31,a<128))return zv(t,n,e);throw Error(\"Expected varint not more than 10 bytes\")}function zv(t,e,r){return r?e*4294967296+(t>>>0):(e>>>0)*4294967296+(t>>>0)}function Lv(t,e){let r,i;if(t>=0?(r=t%4294967296|0,i=t/4294967296|0):(r=~(-t%4294967296),i=~(-t/4294967296),r^4294967295?r=r+1|0:(r=0,i=i+1|0)),t>=18446744073709552e3||t<-18446744073709552e3)throw Error(\"Given varint doesn't fit into 10 bytes\");e.realloc(10),Vv(r,i,e),Ov(i,e)}function Vv(t,e,r){r.buf[r.pos++]=t&127|128,t>>>=7,r.buf[r.pos++]=t&127|128,t>>>=7,r.buf[r.pos++]=t&127|128,t>>>=7,r.buf[r.pos++]=t&127|128,t>>>=7,r.buf[r.pos]=t&127}function Ov(t,e){let r=(t&7)<<4;e.buf[e.pos++]|=r|((t>>>=3)?128:0),t&&(e.buf[e.pos++]=t&127|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=t&127|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=t&127|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=t&127|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=t&127)))))}function Bc(t,e,r){let i=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(Math.LN2*7));r.realloc(i),r.buf.copyWithin(t+i,t,r.pos)}function Rv(t,e){let r=t.length,i=e.buf,n=e.pos,a=e.length;for(let s=0;s<r;s++){let o=t[s];if(o<0||n+10>a){e.pos=n,e.writeVarint(o),i=e.buf,n=e.pos,a=e.length;continue}for(;o>127;)i[n++]=o%128|128,o=Math.floor(o/128);i[n++]=o}e.pos=n}function $v(t,e){for(let r=0;r<t.length;r++)e.writeSVarint(t[r])}function Nv(t,e){for(let r=0;r<t.length;r++)e.writeFloat(t[r])}function Uv(t,e){for(let r=0;r<t.length;r++)e.writeDouble(t[r])}function qv(t,e){for(let r=0;r<t.length;r++)e.writeBoolean(t[r])}function jv(t,e){for(let r=0;r<t.length;r++)e.writeFixed32(t[r])}function Gv(t,e){for(let r=0;r<t.length;r++)e.writeSFixed32(t[r])}function Yv(t,e){for(let r=0;r<t.length;r++)e.writeFixed64(t[r])}function Xv(t,e){for(let r=0;r<t.length;r++)e.writeSFixed64(t[r])}function Wv(t,e,r){let i=\"\",n=e;for(;n<r;){let a=t[n],s=null,o=a>239?4:a>223?3:a>191?2:1;if(n+o>r)break;let l,u,h;o===1?a<128&&(s=a):o===2?(l=t[n+1],(l&192)==128&&(s=(a&31)<<6|l&63,s<=127&&(s=null))):o===3?(l=t[n+1],u=t[n+2],(l&192)==128&&(u&192)==128&&(s=(a&15)<<12|(l&63)<<6|u&63,(s<=2047||s>=55296&&s<=57343)&&(s=null))):o===4&&(l=t[n+1],u=t[n+2],h=t[n+3],(l&192)==128&&(u&192)==128&&(h&192)==128&&(s=(a&15)<<18|(l&63)<<12|(u&63)<<6|h&63,(s<=65535||s>=1114112)&&(s=null))),s===null?(s=65533,o=1):s>65535&&(s-=65536,i+=String.fromCharCode(s>>>10&1023|55296),s=56320|s&1023),i+=String.fromCharCode(s),n+=o}return i}function Zv(t,e,r){for(let i=0,n,a;i<e.length;i++){if(n=e.charCodeAt(i),n>55295&&n<57344)if(a){if(n<56320){t[r++]=239,t[r++]=191,t[r++]=189,a=n;continue}n=a-55296<<10|n-56320|65536,a=null}else{n>56319||i+1===e.length?(t[r++]=239,t[r++]=191,t[r++]=189):a=n;continue}else a&&(a=(t[r++]=239,t[r++]=191,t[r++]=189,null));n<128?t[r++]=n:(n<2048?t[r++]=n>>6|192:(n<65536?t[r++]=n>>12|224:(t[r++]=n>>18|240,t[r++]=n>>12&63|128),t[r++]=n>>6&63|128),t[r++]=n&63|128)}return r}function Hv(t){return typeof t?.renderWithWebGL==\"function\"}function iu(t){let e=0,r=0;for(let s of t)e+=s.w*s.h,r=Math.max(r,s.w);t.sort((s,o)=>o.h-s.h);let i=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),r),h:1/0}],n=0,a=0;for(let s of t)for(let o=i.length-1;o>=0;o--){let l=i[o];if(!(s.w>l.w||s.h>l.h)){if(s.x=l.x,s.y=l.y,a=Math.max(a,s.y+s.h),n=Math.max(n,s.x+s.w),s.w===l.w&&s.h===l.h){let u=i.pop();u&&o<i.length&&(i[o]=u)}else s.h===l.h?(l.x+=s.w,l.w-=s.w):s.w===l.w?(l.y+=s.h,l.h-=s.h):(i.push({x:l.x+s.w,y:l.y,w:l.w-s.w,h:s.h}),l.y+=s.h,l.h-=s.h);break}}return{w:n,h:a,fill:e/(n*a)||0}}var Kd=class{constructor(t,{pixelRatio:e,version:r,isWebGLImage:i=!1,stretchX:n,stretchY:a,content:s,textFitWidth:o,textFitHeight:l}){this.paddedRect=t,this.pixelRatio=e,this.stretchX=n,this.stretchY=a,this.content=s,this.version=r,this.needsFirstWebGLRender=i,this.textFitWidth=o,this.textFitHeight=l}get tl(){return[this.paddedRect.x+1,this.paddedRect.y+1]}get br(){return[this.paddedRect.x+this.paddedRect.w-1,this.paddedRect.y+this.paddedRect.h-1]}get tlbr(){return this.tl.concat(this.br)}get displaySize(){return[(this.paddedRect.w-2)/this.pixelRatio,(this.paddedRect.h-2)/this.pixelRatio]}},nu=class{constructor(t,e){let r={},i={};this.haveRenderCallbacks=[],this.patchedUpdateVersion=-1;let n=[];this.addImages(t,r,n),this.addImages(e,i,n);let{w:a,h:s}=iu(n),o=new Wt({width:a||1,height:s||1});for(let l in t){let u=t[l];if(u.isWebGLImage)continue;let h=r[l].paddedRect;Wt.copy(u.data,o,{x:0,y:0},{x:h.x+1,y:h.y+1},u.data)}for(let l in e){let u=e[l],h=i[l].paddedRect,c=h.x+1,p=h.y+1,f=u.data.width,d=u.data.height;Wt.copy(u.data,o,{x:0,y:0},{x:c,y:p},u.data),Wt.copy(u.data,o,{x:0,y:d-1},{x:c,y:p-1},{width:f,height:1}),Wt.copy(u.data,o,{x:0,y:0},{x:c,y:p+d},{width:f,height:1}),Wt.copy(u.data,o,{x:f-1,y:0},{x:c-1,y:p},{width:1,height:d}),Wt.copy(u.data,o,{x:0,y:0},{x:c+f,y:p},{width:1,height:d})}this.image=o,this.iconPositions=r,this.patternPositions=i}addImages(t,e,r){for(let i in t){let n=t[i],a={x:0,y:0,w:n.data.width+2,h:n.data.height+2};r.push(a),e[i]=new Kd(a,n),n.hasRenderCallback&&this.haveRenderCallbacks.push(i)}}patchUpdatedImages(t,e){if(t.dispatchRenderCallbacks(this.haveRenderCallbacks),this.patchedUpdateVersion!==t.updateVersion){this.patchedUpdateVersion=t.updateVersion;for(let r in this.iconPositions)this.patchUpdatedImage(this.iconPositions[r],t.getImage(r),e);for(let r in this.patternPositions)this.patchUpdatedImage(this.patternPositions[r],t.getImage(r),e)}}patchUpdatedImage(t,e,r){if(!t||!e||!t.needsFirstWebGLRender&&t.version===e.version)return;t.needsFirstWebGLRender=!1,t.version=e.version;let[i,n]=t.tl,a=e.userImage?.data;if(!Hv(a)){r.update(e.data,void 0,{x:i,y:n});return}let{width:s,height:o}=e.data;r.context.setCustomLayerDefaults(),a.renderWithWebGL({gl:r.context.gl,texture:r.texture,x:i,y:n,width:s,height:o}),r.context.setDirty()}};I(\"ImagePosition\",Kd),I(\"ImageAtlas\",nu);var Jd=(function(t){return t[t.none=0]=\"none\",t[t.horizontal=1]=\"horizontal\",t[t.vertical=2]=\"vertical\",t[t.horizontalOnly=3]=\"horizontalOnly\",t})(Jd||{});function Kv(t){for(let e of t)if(e.positionedGlyphs.length!==0)return!1;return!0}function Jv(t,e){let r=[],i=0;for(let n of e)r.push(t.substring(i,n)),i=n;return i<t.length()&&r.push(t.substring(i,t.length())),r}var Pc=/^\\p{gc=M}$/u;function Qv(t){let e=[],r=0;for(;r<t.length;){if(!Pc.test(t[r])){e.push(r),r++;continue}let i=r;for(;i<t.length&&Pc.test(t[i]);)i++;let n=t[i];if(n!==void 0&&Xd(n.codePointAt(0))){e.push(i);for(let a=i-1;a>=r;a--)e.push(a);r=i+1}else{for(let a=r;a<i;a++)e.push(a);r=i}}return e}function tb(t){let e=[],r=0;for(let i of t.graphemes())e.push(...Array(i.length).fill(t.sectionIndex[r])),r++;return e}function eb(t,e){let r=e.map(a=>t.toCodeUnitIndex(a)),i=vr.isParsed()?vr:null;if(t.sections.length===1)return i?i.processBidirectionalText(t.toString(),r).map(a=>zc(a,t.sections,[...a].map(()=>0))):Cv(t.toString(),r).map(a=>el([...a],t.sections,[...a].map(()=>0)));let n=tb(t);return i?i.processStyledBidirectionalText(t.text,n,r).map(([a,s])=>zc(a,t.sections,s)):Mv(t.text,n,r).map(([a,s])=>{let o=[...a];return el(o,t.sections,Qd(o).map(l=>s[l]??0))})}function el(t,e,r){let i=new tu(t.join(\"\"),e,[]),n=0;for(let a of i.graphemes())i.sectionIndex.push(r[n]??0),n+=[...a].length;return i}function Qd(t){let e=[],r=0;for(let i of t)e.push(r),r+=i.length;return e}function zc(t,e,r){let i=[...t],n=Qd(i),a=Qv(i);return el(a.map(s=>i[s]),e,a.map(s=>r[n[s]]??0))}function Hn(t,e,r,i,n,a,s,o,l,u,h,c,p,f,d){let y=tu.fromFeature(t,n);c===2&&y.verticalizePunctuation();let m=y.determineLineBreaks(u,a,e,i,f),g=Wd(y.text)?eb(y,m):Jv(y,m),x=[],b={positionedLines:x,text:y.toString(),top:h[1],bottom:h[1],left:h[0],right:h[0],writingMode:c,iconsInText:!1,verticalizable:!1};return hb(b,e,r,i,g,s,o,l,c,u,p,d),!Kv(x)&&b}function ty(t){let e=.5,r=.5;switch(t){case\"right\":case\"top-right\":case\"bottom-right\":e=1;break;case\"left\":case\"top-left\":case\"bottom-left\":e=0}switch(t){case\"bottom\":case\"bottom-right\":case\"bottom-left\":r=1;break;case\"top\":case\"top-right\":case\"top-left\":r=0}return{horizontalAlign:e,verticalAlign:r}}function rb(t,e,r){let i=e.getMaxScale()*24,{maxImageWidth:n,maxImageHeight:a}=e.getMaxImageSize(t),s=Math.max(i,a*r);return{verticalLineContentWidth:Math.max(i,n*r),horizontalLineContentHeight:s}}function ey(t){switch(t){case\"top\":return 0;case\"center\":return .5;default:return 1}}function ib(t,e,r,i){if(t?.rect)return t;let n=e[r.fontStack]?.[i];return n?{rect:null,metrics:n.metrics}:null}function nb(t,e,r){return!(t===1||!e&&!Xa(r)||e&&(Ql(r)||Yd(r)))}function la(t){return/\\p{Nd}/u.test(String.fromCodePoint(t))}function ry(t){return/\\p{Lu}/u.test(String.fromCodePoint(t))}function ab(t){return/[\\p{P}\\p{S}]/u.test(String.fromCodePoint(t))}function sb(t){let e=t.some(la)&&t.every(i=>la(i)||ab(i)),r=t.length<=3&&t.every(i=>ry(i)||la(i));return e||r}function ob(t){return(la(t)||ry(t))&&!Yd(t)}function lb(t,e){let r=!1;for(let i=0;i<t.length;i++){if(e[i])continue;let n=qr[t[i]];n&&(i===0||e[i-1])&&(i===t.length-1||e[i+1])&&(t[i]=n,e[i]=!0,r=!0)}return r}function ub(t){let e=t.graphemes().slice(),r=e.map(a=>a.codePointAt(0)),i=r.map(Xa),n=a=>!i[a]&&!Ql(r[a])&&!(\"imageName\"in t.getSection(a));for(let a=0;a<r.length;a++){if(!n(a))continue;let s=a;for(;s+1<r.length&&n(s+1);)s++;if(sb(r.slice(a,s+1)))for(let o=a;o<=s;o++)i[o]=ob(r[o]);a=s}return lb(e,i)&&(t.text=e.join(\"\"),t._graphemes=null),i}function hb(t,e,r,i,n,a,s,o,l,u,h,c){let p=0,f=0,d=0,y=0,m=o===\"right\"?1:o===\"left\"?0:.5,g=24/c,x=0;for(let w of n){w.trim();let _=w.getMaxScale(),A={positionedGlyphs:[],lineOffset:0};t.positionedLines[x]=A;let S=A.positionedGlyphs,F=0;if(!w.length()){f+=a,++x;continue}let L=rb(i,w,g),V=l===2&&!h?ub(w):null,P=w.graphemes();for(let $=0;$<P.length;$++){let O=w.getSection($),M=P[$],j=M.codePointAt(0),it=V?V[$]:nb(l,h,j),pt=\"fontStack\"in O&&Gd(M)&&!e[O.fontStack]?.[M]?[...M]:[M];for(let st of pt){let ft={glyph:st.codePointAt(0),grapheme:st,imageName:null,x:p,y:f+-17,vertical:it,scale:1,fontStack:\"\",sectionIndex:w.getSectionIndex($),metrics:null,rect:null},Gt;if(\"fontStack\"in O){if(Gt=cb(O,st,it,L,e,r),!Gt)continue;ft.fontStack=O.fontStack}else{if(t.iconsInText=!0,O.scale*=g,Gt=pb(O,it,_,L,i),!Gt)continue;F=Math.max(F,Gt.imageOffset),ft.imageName=O.imageName}let{rect:ze,metrics:fe,baselineOffset:Le}=Gt;if(ft.y+=Le,ft.scale=O.scale,ft.metrics=fe,ft.rect=ze,S.push(ft),!it)p+=fe.advance*O.scale+u;else{t.verticalizable=!0;let Zt=\"imageName\"in O?fe.advance:24;p+=Zt*O.scale+u}}}if(S.length!==0){let $=p-u;d=Math.max($,d),fb(S,0,S.length-1,m)}p=0;let R=(_-1)*24;A.lineOffset=Math.max(F,R);let E=a*_+F;f+=E,y=Math.max(E,y),++x}let{horizontalAlign:b,verticalAlign:v}=ty(s);db(t.positionedLines,m,b,v,d,y,a,f,n.length),t.top+=-v*f,t.bottom=t.top+f,t.left+=-b*d,t.right=t.left+d}function cb(t,e,r,i,n,a){let s=a[t.fontStack]?.[e],o=ib(s,n,t,e);if(o===null)return null;let l;if(r)l=i.verticalLineContentWidth-t.scale*24;else{let u=ey(t.verticalAlign);l=(i.horizontalLineContentHeight-t.scale*24)*u}return{rect:o.rect,metrics:o.metrics,baselineOffset:l}}function pb(t,e,r,i,n){let a=n[t.imageName];if(!a)return null;let s=a.paddedRect,o=a.displaySize,l={width:o[0],height:o[1],left:1,top:-3,advance:e?o[1]:o[0]},u;if(e)u=i.verticalLineContentWidth-o[1]*t.scale;else{let c=ey(t.verticalAlign);u=(i.horizontalLineContentHeight-o[1]*t.scale)*c}let h=(e?o[0]:o[1])*t.scale-24*r;return{rect:s,metrics:l,baselineOffset:u,imageOffset:h}}function fb(t,e,r,i){if(i===0)return;let n=t[r],a=n.metrics.advance*n.scale,s=(t[r].x+a)*i;for(let o=e;o<=r;o++)t[o].x-=s}function db(t,e,r,i,n,a,s,o,l){let u=(e-r)*n,h=0;h=a===s?-i*l*s+.5*s:-o*i- -17;for(let c of t)for(let p of c.positionedGlyphs)p.x+=u,p.y+=h}function yb(t,e,r){let{horizontalAlign:i,verticalAlign:n}=ty(r),a=e[0],s=e[1],o=a-t.displaySize[0]*i,l=o+t.displaySize[0],u=s-t.displaySize[1]*n;return{image:t,top:u,bottom:u+t.displaySize[1],left:o,right:l}}function iy(t){let e=t.left,r=t.top,i=t.right-e,n=t.bottom-r,a=t.image.content[2]-t.image.content[0],s=t.image.content[3]-t.image.content[1],o=t.image.textFitWidth??\"stretchOrShrink\",l=t.image.textFitHeight??\"stretchOrShrink\",u=a/s;if(l===\"proportional\"){if(o===\"stretchOnly\"&&i/n<u||o===\"proportional\"){let h=Math.ceil(n*u);e*=h/i,i=h}}else if(o===\"proportional\"&&l===\"stretchOnly\"&&u!==0&&i/n>u){let h=Math.ceil(i/u);r*=h/n,n=h}return{x1:e,y1:r,x2:e+i,y2:r+n}}function Lc(t,e,r,i,n,a){let s=t.image,o;if(s.content){let m=s.content,g=s.pixelRatio||1;o=[m[0]/g,m[1]/g,s.displaySize[0]-m[2]/g,s.displaySize[1]-m[3]/g]}let l=e.left*a,u=e.right*a,h,c,p,f;r===\"width\"||r===\"both\"?(f=n[0]+l-i[3],c=n[0]+u+i[1]):(f=n[0]+(l+u-s.displaySize[0])/2,c=f+s.displaySize[0]);let d=e.top*a,y=e.bottom*a;return r===\"height\"||r===\"both\"?(h=n[1]+d-i[0],p=n[1]+y+i[2]):(h=n[1]+(d+y-s.displaySize[1])/2,p=h+s.displaySize[1]),{image:s,top:h,right:c,bottom:p,left:f,collisionPadding:o}}var Vc=32640;function Oc(t,e){let{expression:r}=e;if(r.kind===\"constant\")return{kind:\"constant\",layoutSize:r.evaluate(new at(t+1))};if(r.kind===\"source\")return{kind:\"source\"};if(r.kind===\"composite\"){let{minZoom:i,maxZoom:n}=mb(r.zoomStops,t);return{kind:\"composite\",minZoom:i,maxZoom:n,interpolationType:r.interpolationType}}{let i=gb(r),n=r.evaluate(new at(t+1));return{kind:\"camera\",zoomStops:r.zoomStops,sizes:i,layoutSize:n,interpolationType:r.interpolationType}}}function mb(t,e){let r=0;for(;r<t.length&&t[r]<=e;)r++;r=Math.max(0,r-1);let i=r;for(;i<t.length&&t[i]<e+1;)i++;return i=Math.min(t.length-1,i),{minZoom:t[r],maxZoom:t[i]}}function gb(t){return t.zoomStops.map(e=>t.evaluate(new at(e===-1/0?t.zoomStops[1]-1:e)))}var Hr=class ny extends B{constructor(e,r,i,n){super(e,r),this.angle=i,n!==void 0&&(this.segment=n)}clone(){return new ny(this.x,this.y,this.angle,this.segment)}};I(\"Anchor\",Hr);function ay(t,e,r,i,n){if(e.segment===void 0||r===0)return!0;let a=e,s=e.segment+1,o=0;for(;o>-r/2;){if(s--,s<0)return!1;o-=t[s].dist(a),a=t[s]}o+=t[s].dist(t[s+1]),s++;let l=[],u=0;for(;o<r/2;){let h=t[s-1],c=t[s],p=t[s+1];if(!p)return!1;let f=h.angleTo(c)-c.angleTo(p);for(f=Math.abs((f+3*Math.PI)%(Math.PI*2)-Math.PI),l.push({distance:o,angleDelta:f}),u+=f;o-l[0].distance>i;)u-=l.shift().angleDelta;if(u>n)return!1;s++,o+=c.dist(p)}return!0}function sy(t){let e=0;for(let r=0;r<t.length-1;r++)e+=t[r].dist(t[r+1]);return e}function oy(t,e,r){return t?3/5*e*r:0}function ly(t,e){return Math.max(t?t.right-t.left:0,e?e.right-e.left:0)}function xb(t,e,r,i,n,a){let s=oy(r,n,a),o=ly(r,i)*a,l=0,u=sy(t)/2;for(let h=0;h<t.length-1;h++){let c=t[h],p=t[h+1],f=c.dist(p);if(l+f>u){let d=(u-l)/f,y=new Hr(yr.number(c.x,p.x,d),yr.number(c.y,p.y,d),p.angleTo(c),h);return y._round(),!s||ay(t,y,o,s,e)?y:void 0}l+=f}}function vb(t,e,r,i,n,a,s,o,l){let u=oy(i,a,s),h=ly(i,n),c=h*s,p=t[0].x===0||t[0].x===l||t[0].y===0||t[0].y===l;e-c<e/4&&(e=c+e/4);let f=a*2;return uy(t,p?e/2*o%e:(h/2+f)*s*o%e,e,u,r,c,p,!1,l)}function uy(t,e,r,i,n,a,s,o,l){let u=a/2,h=sy(t),c=0,p=e-r,f=[];for(let d=0;d<t.length-1;d++){let y=t[d],m=t[d+1],g=y.dist(m),x=m.angleTo(y);for(;p+r<c+g;){p+=r;let b=(p-c)/g,v=yr.number(y.x,m.x,b),w=yr.number(y.y,m.y,b);if(v>=0&&v<l&&w>=0&&w<l&&p-u>=0&&p+u<=h){let _=new Hr(v,w,x,d);_._round(),(!i||ay(t,_,a,i,n))&&f.push(_)}}c+=g}return!o&&!f.length&&!s&&(f=uy(t,c/2,r,i,n,a,s,!0,l)),f}function bb(t,e,r,i,n){let a=[];for(let s of t){let o;for(let l=0;l<s.length-1;l++){let u=s[l],h=s[l+1];u.x<e&&h.x<e||(u.x<e?u=new B(e,u.y+(h.y-u.y)*((e-u.x)/(h.x-u.x)))._round():h.x<e&&(h=new B(e,u.y+(h.y-u.y)*((e-u.x)/(h.x-u.x)))._round()),!(u.y<r&&h.y<r)&&(u.y<r?u=new B(u.x+(h.x-u.x)*((r-u.y)/(h.y-u.y)),r)._round():h.y<r&&(h=new B(u.x+(h.x-u.x)*((r-u.y)/(h.y-u.y)),r)._round()),!(u.x>=i&&h.x>=i)&&(u.x>=i?u=new B(i,u.y+(h.y-u.y)*((i-u.x)/(h.x-u.x)))._round():h.x>=i&&(h=new B(i,u.y+(h.y-u.y)*((i-u.x)/(h.x-u.x)))._round()),!(u.y>=n&&h.y>=n)&&(u.y>=n?u=new B(u.x+(h.x-u.x)*((n-u.y)/(h.y-u.y)),n)._round():h.y>=n&&(h=new B(u.x+(h.x-u.x)*((n-u.y)/(h.y-u.y)),n)._round()),(!o||!u.equals(o[o.length-1]))&&(o=[u],a.push(o)),o.push(h)))))}}return a}function hy(t,e,r,i,n,a){let s=Rc(t,e,r,n,0);return s=Rc(s,e,i,a,1),s}function Rc(t,e,r,i,n){switch(e){case 1:return wb(t,r,i,n);case 2:return $c(t,r,i,n,!1);case 3:return $c(t,r,i,n,!0)}return[]}function wb(t,e,r,i){let n=[];for(let a of t)for(let s of a){let o=i===0?s.x:s.y;o>=e&&o<=r&&n.push([s])}return n}function Db(t,e,r,i,n){let a=i===0?_b:Ab,s=[],o=[];for(let h=0;h<t.length-1;h++){let c=t[h],p=t[h+1],f=i===0?c.x:c.y,d=i===0?p.x:p.y,y=!1;f<e?d>e&&s.push(a(c,p,e)):f>r?d<r&&s.push(a(c,p,r)):s.push(c),d<e&&f>=e&&(s.push(a(c,p,e)),y=!0),d>r&&f<=r&&(s.push(a(c,p,r)),y=!0),!n&&y&&(o.push(s),s=[])}let l=t.length-1,u=i===0?t[l].x:t[l].y;return u>=e&&u<=r&&s.push(t[l]),n&&s.length>0&&!s[0].equals(s[s.length-1])&&s.push(new B(s[0].x,s[0].y)),s.length>0&&o.push(s),o}function $c(t,e,r,i,n){let a=[];for(let s of t){let o=Db(s,e,r,i,n);o.length>0&&a.push(...o)}return a}function _b(t,e,r){let i=(r-t.x)/(e.x-t.x);return new B(r,t.y+(e.y-t.y)*i)}function Ab(t,e,r){let i=(r-t.y)/(e.y-t.y);return new B(t.x+(e.x-t.x)*i,r)}function Nc(t,e,r,i){let n=[],a=t.image,s=a.pixelRatio,o=a.paddedRect.w-2,l=a.paddedRect.h-2,u={x1:t.left,y1:t.top,x2:t.right,y2:t.bottom},h=a.stretchX||[[0,o]],c=a.stretchY||[[0,l]],p=(E,$)=>E+$[1]-$[0],f=h.reduce(p,0),d=c.reduce(p,0),y=o-f,m=l-d,g=0,x=f,b=0,v=d,w=0,_=y,A=0,S=m;if(a.content&&i){let E=a.content,$=E[2]-E[0],O=E[3]-E[1];(a.textFitWidth||a.textFitHeight)&&(u=iy(t)),g=Kn(h,0,E[0]),b=Kn(c,0,E[1]),x=Kn(h,E[0],E[2]),v=Kn(c,E[1],E[3]),w=E[0]-g,A=E[1]-b,_=$-x,S=O-v}let F=u.x1,L=u.y1,V=u.x2-F,P=u.y2-L,R=(E,$,O,M)=>{let j=Jn(E.stretch-g,x,V,F),it=Qn(E.fixed-w,_,E.stretch,f),pt=Jn($.stretch-b,v,P,L),st=Qn($.fixed-A,S,$.stretch,d),ft=Jn(O.stretch-g,x,V,F),Gt=Qn(O.fixed-w,_,O.stretch,f),ze=Jn(M.stretch-b,v,P,L),fe=Qn(M.fixed-A,S,M.stretch,d),Le=new B(j,pt),Zt=new B(ft,pt),Sr=new B(ft,ze),Er=new B(j,ze),er=new B(it/s,st/s),ci=new B(Gt/s,fe/s),Tt=e*Math.PI/180;if(Tt){let N=Math.sin(Tt),Q=Math.cos(Tt),Z=[Q,-N,N,Q];Le._matMult(Z),Zt._matMult(Z),Er._matMult(Z),Sr._matMult(Z)}let Ee=E.stretch+E.fixed,rr=O.stretch+O.fixed,Fr=$.stretch+$.fixed,Tr=M.stretch+M.fixed;return{tl:Le,tr:Zt,bl:Er,br:Sr,tex:{x:a.paddedRect.x+1+Ee,y:a.paddedRect.y+1+Fr,w:rr-Ee,h:Tr-Fr},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:er,pixelOffsetBR:ci,minFontScaleX:_/s/V,minFontScaleY:S/s/P,isSDF:r}};if(!i||!a.stretchX&&!a.stretchY)n.push(R({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:o+1},{fixed:0,stretch:l+1}));else{let E=Uc(h,y,f),$=Uc(c,m,d);for(let O=0;O<E.length-1;O++){let M=E[O],j=E[O+1];for(let it=0;it<$.length-1;it++){let pt=$[it],st=$[it+1];n.push(R(M,pt,j,st))}}}return n}function Kn(t,e,r){let i=0;for(let n of t)i+=Math.max(e,Math.min(r,n[1]))-Math.max(e,Math.min(r,n[0]));return i}function Uc(t,e,r){let i=[{fixed:-1,stretch:0}];for(let[n,a]of t){let s=i[i.length-1];i.push({fixed:n-s.stretch,stretch:s.stretch}),i.push({fixed:n-s.stretch,stretch:s.stretch+(a-n)})}return i.push({fixed:e+1,stretch:r}),i}function Jn(t,e,r,i){return t/e*r+i}function Qn(t,e,r,i){return t-e*r/i}function Sb(t,e,r,i,n,a,s,o){let l=i.layout.get(\"text-rotate\").evaluate(a,{})*Math.PI/180,u=[];for(let h of e.positionedLines)for(let c of h.positionedGlyphs){if(!c.rect)continue;let p=c.rect||{},f=4,d=!0,y=1,m=0,g=(n||o)&&c.vertical,x=c.metrics.advance*c.scale/2;if(o&&e.verticalizable){let M=(c.scale-1)*24,j=(24-c.metrics.width*c.scale)/2;m=h.lineOffset/2-(c.imageName?-j:M)}if(c.imageName){let M=s[c.imageName];d=M.sdf,y=M.pixelRatio,f=1/y}let b=n?[c.x+x,c.y]:[0,0],v=n?[0,0]:[c.x+x+r[0],c.y+r[1]-m],w=[0,0];g&&(w=v,v=[0,0]);let _=c.metrics.isDoubleResolution?2:1,A=(c.metrics.left-f)*c.scale-x+v[0],S=(-c.metrics.top-f)*c.scale+v[1],F=A+p.w/_*c.scale/y,L=S+p.h/_*c.scale/y,V=new B(A,S),P=new B(F,S),R=new B(A,L),E=new B(F,L);if(g){let M=new B(-x,x- -17),j=-Math.PI/2,it=12-x,pt=c.imageName?it:0,st=new B(22-it,-pt),ft=new B(...w);V._rotateAround(j,M)._add(st)._add(ft),P._rotateAround(j,M)._add(st)._add(ft),R._rotateAround(j,M)._add(st)._add(ft),E._rotateAround(j,M)._add(st)._add(ft)}if(l){let M=Math.sin(l),j=Math.cos(l),it=[j,-M,M,j];V._matMult(it),P._matMult(it),R._matMult(it),E._matMult(it)}let $=new B(0,0),O=new B(0,0);u.push({tl:V,tr:P,bl:R,br:E,tex:p,writingMode:e.writingMode,glyphOffset:b,sectionIndex:c.sectionIndex,isSDF:d,pixelOffsetTL:$,pixelOffsetBR:O,minFontScaleX:0,minFontScaleY:0})}return u}var ta=class{constructor(t,e,r,i,n,a,s,o,l,u){if(this.boxStartIndex=t.length,l){let h=a.top,c=a.bottom,p=a.collisionPadding;p&&(h-=p[1],c+=p[3]);let f=c-h;f>0&&(f=Math.max(10,f),this.circleDiameter=f)}else{let h=a.image?.content&&(a.image.textFitWidth||a.image.textFitHeight)?iy(a):{x1:a.left,y1:a.top,x2:a.right,y2:a.bottom};h.y1=h.y1*s-o[0],h.y2=h.y2*s+o[2],h.x1=h.x1*s-o[3],h.x2=h.x2*s+o[1];let c=a.collisionPadding;if(c&&(h.x1-=c[0]*s,h.y1-=c[1]*s,h.x2+=c[2]*s,h.y2+=c[3]*s),u){let p=new B(h.x1,h.y1),f=new B(h.x2,h.y1),d=new B(h.x1,h.y2),y=new B(h.x2,h.y2),m=u*Math.PI/180;p._rotate(m),f._rotate(m),d._rotate(m),y._rotate(m),h.x1=Math.min(p.x,f.x,d.x,y.x),h.x2=Math.max(p.x,f.x,d.x,y.x),h.y1=Math.min(p.y,f.y,d.y,y.y),h.y2=Math.max(p.y,f.y,d.y,y.y)}t.emplaceBack(e.x,e.y,h.x1,h.y1,h.x2,h.y2,r,i,n)}this.boxEndIndex=t.length}},Eb=class{constructor(t=[],e=(r,i)=>r<i?-1:+(r>i)){if(this.data=t,this.length=this.data.length,this.compare=e,this.length>0)for(let r=(this.length>>1)-1;r>=0;r--)this._down(r)}push(t){this.data.push(t),this._up(this.length++)}pop(){if(this.length===0)return;let t=this.data[0],e=this.data.pop();return--this.length>0&&(this.data[0]=e,this._down(0)),t}peek(){return this.data[0]}_up(t){let{data:e,compare:r}=this,i=e[t];for(;t>0;){let n=t-1>>1,a=e[n];if(r(i,a)>=0)break;e[t]=a,t=n}e[t]=i}_down(t){let{data:e,compare:r}=this,i=this.length>>1,n=e[t];for(;t<i;){let a=(t<<1)+1,s=a+1;if(s<this.length&&r(e[s],e[a])<0&&(a=s),r(e[a],n)>=0)break;e[t]=e[a],t=a}e[t]=n}};function Fb(t,e=1){let r=wa.fromPoints(t[0]),i=Math.min(r.width(),r.height()),n=i/2,a=new Eb([],Tb),{minX:s,minY:o,maxX:l,maxY:u}=r;if(i===0)return new B(s,o);for(let p=s;p<l;p+=i)for(let f=o;f<u;f+=i)a.push(new Nr(p+n,f+n,n,t));let h=Ib(t),c=h;for(;a.length;){let p=a.pop();(p.d>c.d||!c.d)&&(c=p),!(p.max-c.d<=e)&&(n=p.h/2,a.push(new Nr(p.p.x-n,p.p.y-n,n,t)),a.push(new Nr(p.p.x+n,p.p.y-n,n,t)),a.push(new Nr(p.p.x-n,p.p.y+n,n,t)),a.push(new Nr(p.p.x+n,p.p.y+n,n,t)))}return h.d>0&&c.d-h.d<=e?h.p:c.p}function Tb(t,e){return e.max-t.max}var Nr=class{constructor(t,e,r,i){this.p=new B(t,e),this.h=r,this.d=kb(this.p,i),this.max=this.d+this.h*Math.SQRT2}};function kb(t,e){let r=!1,i=1/0;for(let n of e)for(let a=0,s=n.length,o=s-1;a<s;o=a++){let l=n[a],u=n[o];l.y>t.y!=u.y>t.y&&t.x<(u.x-l.x)*(t.y-l.y)/(u.y-l.y)+l.x&&(r=!r),i=Math.min(i,cd(t,l,u))}return(r?1:-1)*Math.sqrt(i)}function Ib(t){let e=0,r=0,i=0,n=t[0];for(let a=0,s=n.length,o=s-1;a<s;o=a++){let l=n[a],u=n[o],h=l.x*u.y-u.x*l.y;r+=(l.x+u.x)*h,i+=(l.y+u.y)*h,e+=h*3}return new Nr(r/e,i/e,0,t)}var Cb=(function(t){return t[t.center=1]=\"center\",t[t.left=2]=\"left\",t[t.right=3]=\"right\",t[t.top=4]=\"top\",t[t.bottom=5]=\"bottom\",t[t[\"top-left\"]=6]=\"top-left\",t[t[\"top-right\"]=7]=\"top-right\",t[t[\"bottom-left\"]=8]=\"bottom-left\",t[t[\"bottom-right\"]=9]=\"bottom-right\",t})({}),au=1/0;function cy(t,e){function r(n,a){let s=0,o=0;a<0&&(a=0);let l=a/Math.SQRT2;switch(n){case\"top-right\":case\"top-left\":o=l-7;break;case\"bottom-right\":case\"bottom-left\":o=-l+7;break;case\"bottom\":o=-a+7;break;case\"top\":o=a-7}switch(n){case\"top-right\":case\"bottom-right\":s=-l;break;case\"top-left\":case\"bottom-left\":s=l;break;case\"left\":s=a;break;case\"right\":s=-a}return[s,o]}function i(n,a,s){let o=0,l=0;switch(a=Math.abs(a),s=Math.abs(s),n){case\"top-right\":case\"top-left\":case\"top\":l=s-7;break;case\"bottom-right\":case\"bottom-left\":case\"bottom\":l=-s+7}switch(n){case\"top-right\":case\"bottom-right\":case\"right\":o=-a;break;case\"top-left\":case\"bottom-left\":case\"left\":o=a}return[o,l]}return e[1]===au?r(t,e[0]):i(t,e[0],e[1])}function py(t,e,r){let i=t.layout,n=i.get(\"text-variable-anchor-offset\")?.evaluate(e,{},r);if(n){let s=n.values,o=[];for(let l=0;l<s.length;l+=2){let u=o[l]=s[l],h=s[l+1].map(c=>c*24);u.startsWith(\"top\")?h[1]-=7:u.startsWith(\"bottom\")&&(h[1]+=7),o[l+1]=h}return new De(o)}let a=i.get(\"text-variable-anchor\");if(a){let s;s=t._unevaluatedLayout.getValue(\"text-radial-offset\")===void 0?i.get(\"text-offset\").evaluate(e,{},r).map(l=>l*24):[i.get(\"text-radial-offset\").evaluate(e,{},r)*24,au];let o=[];for(let l of a)o.push(l,cy(l,s));return new De(o)}return null}function Mb(t){var h;t.bucket.createArrays();let e=512*t.bucket.overscaling;t.bucket.tilePixelRatio=mt/e,t.bucket.compareText={},t.bucket.iconsNeedLinear=!1;let r=t.bucket.layers[0],i=r.layout,n=r._unevaluatedLayout._values,a={layoutIconSize:n[\"icon-size\"].possiblyEvaluate(new at(t.bucket.zoom+1),t.canonical),layoutTextSize:n[\"text-size\"].possiblyEvaluate(new at(t.bucket.zoom+1),t.canonical),textMaxSize:n[\"text-size\"].possiblyEvaluate(new at(18))};if(t.bucket.textSizeData.kind===\"composite\"){let{minZoom:c,maxZoom:p}=t.bucket.textSizeData;a.compositeTextSizes=[n[\"text-size\"].possiblyEvaluate(new at(c),t.canonical),n[\"text-size\"].possiblyEvaluate(new at(p),t.canonical)]}if(t.bucket.iconSizeData.kind===\"composite\"){let{minZoom:c,maxZoom:p}=t.bucket.iconSizeData;a.compositeIconSizes=[n[\"icon-size\"].possiblyEvaluate(new at(c),t.canonical),n[\"icon-size\"].possiblyEvaluate(new at(p),t.canonical)]}let s=i.get(\"text-line-height\")*24,o=i.get(\"text-rotation-alignment\")!==\"viewport\"&&i.get(\"symbol-placement\")!==\"point\",l=i.get(\"text-keep-upright\"),u=i.get(\"text-size\");for(let c of t.bucket.features){let p=i.get(\"text-font\").evaluate(c,{},t.canonical).join(\",\"),f=u.evaluate(c,{},t.canonical),d=a.layoutTextSize.evaluate(c,{},t.canonical),y=a.layoutIconSize.evaluate(c,{},t.canonical),m={horizontal:{},vertical:void 0},g=c.text,x=[0,0];if(g){let _=g.toString(),A=i.get(\"text-letter-spacing\").evaluate(c,{},t.canonical)*24,S=dv(_)?A:0,F=i.get(\"text-anchor\").evaluate(c,{},t.canonical),L=py(r,c,t.canonical);if(!L){let E=i.get(\"text-radial-offset\").evaluate(c,{},t.canonical);x=E?cy(F,[E*24,au]):i.get(\"text-offset\").evaluate(c,{},t.canonical).map($=>$*24)}let V=o?\"center\":i.get(\"text-justify\").evaluate(c,{},t.canonical),P=i.get(\"symbol-placement\")===\"point\"?i.get(\"text-max-width\").evaluate(c,{},t.canonical)*24:1/0,R=()=>{t.bucket.allowVerticalPlacement&&Jo(_)&&(m.vertical=Hn(g,t.glyphMap,t.glyphPositions,t.imagePositions,p,P,s,F,\"left\",S,x,2,!0,d,f))};if(!o&&L){let E=new Set;if(V===\"auto\")for(let O=0;O<L.values.length;O+=2)E.add(qc(L.values[O]));else E.add(V);let $=!1;for(let O of E)if(!m.horizontal[O])if($)m.horizontal[O]=m.horizontal[0];else{let M=Hn(g,t.glyphMap,t.glyphPositions,t.imagePositions,p,P,s,\"center\",O,S,x,1,!1,d,f);M&&(m.horizontal[O]=M,$=M.positionedLines.length===1)}R()}else{V===\"auto\"&&(V=qc(F));let E=Hn(g,t.glyphMap,t.glyphPositions,t.imagePositions,p,P,s,F,V,S,x,1,!1,d,f);E&&(m.horizontal[V]=E),R(),Jo(_)&&o&&l&&(m.vertical=Hn(g,t.glyphMap,t.glyphPositions,t.imagePositions,p,P,s,F,V,S,x,2,!1,d,f))}}let b,v=!1;if(c.icon?.name){let _=t.imageMap[c.icon.name];_&&(b=yb(t.imagePositions[c.icon.name],i.get(\"icon-offset\").evaluate(c,{},t.canonical),i.get(\"icon-anchor\").evaluate(c,{},t.canonical)),v=!!_.sdf,t.bucket.sdfIcons===void 0?t.bucket.sdfIcons=v:t.bucket.sdfIcons!==v&&Mt(\"Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer\"),_.pixelRatio===t.bucket.pixelRatio?i.get(\"icon-rotate\").constantOr(1)!==0&&(t.bucket.iconsNeedLinear=!0):t.bucket.iconsNeedLinear=!0)}let w=fy(m.horizontal)||m.vertical;(h=t.bucket).iconsInText||(h.iconsInText=w?w.iconsInText:!1),(w||b)&&Bb(t.bucket,c,m,b,t.imageMap,a,d,y,x,v,t.canonical,t.subdivisionGranularity)}t.showCollisionBoxes&&t.bucket.generateCollisionDebugBuffers()}function qc(t){switch(t){case\"right\":case\"top-right\":case\"bottom-right\":return\"right\";case\"left\":case\"top-left\":case\"bottom-left\":return\"left\"}return\"center\"}function Bb(t,e,r,i,n,a,s,o,l,u,h,c){let p=a.textMaxSize.evaluate(e,{});p===void 0&&(p=s);let f=t.layers[0].layout,d=f.get(\"icon-offset\").evaluate(e,{},h),y=fy(r.horizontal),m=s/24,g=t.tilePixelRatio*m,x=t.tilePixelRatio*p/24,b=t.tilePixelRatio*o,v=t.tilePixelRatio*f.get(\"symbol-spacing\"),w=f.get(\"text-padding\")*t.tilePixelRatio,_=jb(f,e,h,t.tilePixelRatio),A=f.get(\"text-max-angle\")/180*Math.PI,S=f.get(\"text-rotation-alignment\")!==\"viewport\"&&f.get(\"symbol-placement\")!==\"point\",F=f.get(\"icon-rotation-alignment\").constantOr(\"viewport\")===\"map\"&&f.get(\"symbol-placement\")!==\"point\",L=f.get(\"symbol-placement\"),V=v/2,P=f.get(\"icon-text-fit\"),R;i&&P!==\"none\"&&(t.allowVerticalPlacement&&r.vertical&&(R=Lc(i,r.vertical,P,f.get(\"icon-text-fit-padding\"),d,m)),y&&(i=Lc(i,y,P,f.get(\"icon-text-fit-padding\"),d,m)));let E=h?c.line.getGranularityForZoomLevel(h.z):1,$=(O,M)=>{M.x<0||M.x>=8192||M.y<0||M.y>=8192||zb(t,M,O,r,i,n,R,t.layers[0],t.collisionBoxArray,e.index,e.sourceLayerIndex,t.index,g,[w,w,w,w],S,l,b,_,F,d,e,a,u,h,s)};if(L===\"line\")for(let O of bb(e.geometry,0,0,mt,mt)){let M=hr(O,E),j=vb(M,v,A,r.vertical||y,i,24,x,t.overscaling,mt);for(let it of j){let pt=y;(!pt||!Lb(t,pt.text,V,it))&&$(M,it)}}else if(L===\"line-center\"){for(let O of e.geometry)if(O.length>1){let M=hr(O,E),j=xb(M,A,r.vertical||y,i,24,x);j&&$(M,j)}}else if(e.type===\"Polygon\")for(let O of Ba(e.geometry,0)){let M=Fb(O,16);$(hr(O[0],E,!0),new Hr(M.x,M.y,0))}else if(e.type===\"LineString\")for(let O of e.geometry){let M=hr(O,E);$(M,new Hr(M[0].x,M[0].y,0))}else if(e.type===\"Point\")for(let O of e.geometry)for(let M of O)$([M],new Hr(M.x,M.y,0))}function Pb(t,e){let r=t.length,i=e?.values;if(i?.length>0)for(let n=0;n<i.length;n+=2){let a=Cb[i[n]],s=i[n+1];t.emplaceBack(a,s[0],s[1])}return[r,t.length]}function jc(t,e,r,i,n,a,s,o,l,u,h,c,p,f,d,y){let m=Sb(e,r,o,n,a,s,i,t.allowVerticalPlacement),g=t.textSizeData,x=null;g.kind===\"source\"?(x=[128*n.layout.get(\"text-size\").evaluate(s,{})],x[0]>32640&&Mt(`${t.layerIds[0]}: Value for \"text-size\" is >= 255. Reduce your \"text-size\".`)):g.kind===\"composite\"&&(x=[128*d.compositeTextSizes[0].evaluate(s,{},y),128*d.compositeTextSizes[1].evaluate(s,{},y)],(x[0]>32640||x[1]>32640)&&Mt(`${t.layerIds[0]}: Value for \"text-size\" is >= 255. Reduce your \"text-size\".`)),t.addSymbols(t.text,m,x,o,a,s,h,e,u.lineStartIndex,u.lineLength,f,y,l);for(let b of c)p[b]=t.text.placedSymbolArray.length-1;return m.length*4}function fy(t){for(let e in t)return t[e];return null}function zb(t,e,r,i,n,a,s,o,l,u,h,c,p,f,d,y,m,g,x,b,v,w,_,A,S){let F=t.addToLineVertexArray(e,r),L=o.layout.get(\"symbol-height-offset\").evaluate(v,{},A);L>t.maxHeightOffset&&(t.maxHeightOffset=L);let V,P,R,E,$=0,O=0,M=0,j=0,it=-1,pt=-1,st={},ft=(0,ko.default)(\"\");if(t.allowVerticalPlacement&&i.vertical){let Q=o.layout.get(\"text-rotate\").evaluate(v,{},A)+90,Z=i.vertical;R=new ta(l,e,u,h,c,Z,p,f,d,Q),s&&(E=new ta(l,e,u,h,c,s,m,g,d,Q))}if(n){let Q=o.layout.get(\"icon-rotate\").evaluate(v,{}),Z=o.layout.get(\"icon-text-fit\")!==\"none\",C=Nc(n,Q,_,Z),ut=s?Nc(s,Q,_,Z):void 0;P=new ta(l,e,u,h,c,n,m,g,!1,Q),$=C.length*4;let Y=t.iconSizeData,G=null;Y.kind===\"source\"?(G=[128*o.layout.get(\"icon-size\").evaluate(v,{})],G[0]>32640&&Mt(`${t.layerIds[0]}: Value for \"icon-size\" is >= 255. Reduce your \"icon-size\".`)):Y.kind===\"composite\"&&(G=[128*w.compositeIconSizes[0].evaluate(v,{},A),128*w.compositeIconSizes[1].evaluate(v,{},A)],(G[0]>32640||G[1]>32640)&&Mt(`${t.layerIds[0]}: Value for \"icon-size\" is >= 255. Reduce your \"icon-size\".`)),t.addSymbols(t.icon,C,G,b,x,v,0,e,F.lineStartIndex,F.lineLength,-1,A,L),it=t.icon.placedSymbolArray.length-1,ut&&(O=ut.length*4,t.addSymbols(t.icon,ut,G,b,x,v,2,e,F.lineStartIndex,F.lineLength,-1,A,L),pt=t.icon.placedSymbolArray.length-1)}let Gt=Object.keys(i.horizontal);for(let Q of Gt){let Z=i.horizontal[Q];V||(V=(ft=(0,ko.default)(Z.text),new ta(l,e,u,h,c,Z,p,f,d,o.layout.get(\"text-rotate\").evaluate(v,{},A))));let C=Z.positionedLines.length===1;if(M+=jc(t,e,Z,a,o,d,v,y,L,F,i.vertical?1:3,C?Gt:[Q],st,it,w,A),C)break}i.vertical&&(j+=jc(t,e,i.vertical,a,o,d,v,y,L,F,2,[\"vertical\"],st,pt,w,A));let ze=V?V.boxStartIndex:t.collisionBoxArray.length,fe=V?V.boxEndIndex:t.collisionBoxArray.length,Le=R?R.boxStartIndex:t.collisionBoxArray.length,Zt=R?R.boxEndIndex:t.collisionBoxArray.length,Sr=P?P.boxStartIndex:t.collisionBoxArray.length,Er=P?P.boxEndIndex:t.collisionBoxArray.length,er=E?E.boxStartIndex:t.collisionBoxArray.length,ci=E?E.boxEndIndex:t.collisionBoxArray.length,Tt=-1,Ee=(Q,Z)=>Q?.circleDiameter?Math.max(Q.circleDiameter,Z):Z;Tt=Ee(V,Tt),Tt=Ee(R,Tt),Tt=Ee(P,Tt),Tt=Ee(E,Tt);let rr=+(Tt>-1);rr&&(Tt*=S/24),t.glyphOffsetArray.length>=t.maxGlyphs&&Mt(\"Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907\"),v.sortKey!==void 0&&t.addToSortKeyRanges(t.symbolInstances.length,v.sortKey);let Fr=py(o,v,A),[Tr,N]=Pb(t.textAnchorOffsets,Fr);t.symbolInstances.emplaceBack(e.x,e.y,st.right>=0?st.right:-1,st.center>=0?st.center:-1,st.left>=0?st.left:-1,st.vertical||-1,it,pt,ft,ze,fe,Le,Zt,Sr,Er,er,ci,u,M,j,$,O,rr,0,p,Tt,Tr,N,L)}function Lb(t,e,r,i){let n=t.compareText;if(!(e in n))n[e]=[];else{let a=n[e];for(let s=a.length-1;s>=0;s--)if(i.dist(a[s])<r)return!0}return n[e].push(i),!1}function Gc(t,e,r){let i=\"never\",n=t.get(e);return n?i=n:t.get(r)&&(i=\"always\"),i}var Vb=[{name:\"a_fade_opacity\",components:1,type:\"Uint8\",offset:0}];function ea(t,e,r,i,n,a,s,o,l,u,h,c,p,f){let d=o?Math.min(Vc,Math.round(o[0])):0,y=o?Math.min(Vc,Math.round(o[1])):0;t.emplaceBack(e,r,Math.round(i*32),Math.round(n*32),a,s,(d<<1)+ +!!l,y,u*16,h*16,c*256,p*256,f)}function Ob(t,e,r){t.emplaceBack(e.x,e.y,r),t.emplaceBack(e.x,e.y,r),t.emplaceBack(e.x,e.y,r),t.emplaceBack(e.x,e.y,r)}function Rb(t){for(let e of t.sections)if(Wd(e.text))return!0;return!1}var rl=class{constructor(t){this.layoutVertexArray=new sg,this.indexArray=new xn,this.programConfigurations=t,this.segments=new te,this.dynamicLayoutVertexArray=new og,this.opacityVertexArray=new lg,this.hasVisibleVertices=!1,this.placedSymbolArray=new Hf}isEmpty(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0}upload(t,e,r,i){this.isEmpty()||(r&&(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,$2.members),this.indexBuffer=t.createIndexBuffer(this.indexArray,e),this.dynamicLayoutVertexBuffer=t.createVertexBuffer(this.dynamicLayoutVertexArray,N2.members,!0),this.opacityVertexBuffer=t.createVertexBuffer(this.opacityVertexArray,Vb,!0),this.opacityVertexBuffer.itemSize=1),(r||i)&&this.programConfigurations.upload(t))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy())}};I(\"SymbolBuffers\",rl);var il=class{constructor(t,e,r){this.layoutVertexArray=new t,this.layoutAttributes=e,this.indexArray=new r,this.segments=new te,this.collisionVertexArray=new ug}upload(t){this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=t.createVertexBuffer(this.collisionVertexArray,U2.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}};I(\"CollisionBuffers\",il);var dy=class{constructor(t){this.collisionBoxArray=t.collisionBoxArray,this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(s=>s.id),this.index=t.index,this.pixelRatio=t.pixelRatio,this.sourceLayerIndex=t.sourceLayerIndex,this.hasDependencies=!0,this.hasRTLText=!1,this.maxHeightOffset=0,this.sortKeyRanges=[],this.collisionCircleArray=[],this.maxGlyphs=65535;let e=this.layers[0]._unevaluatedLayout._values;this.textSizeData=Oc(this.zoom,e[\"text-size\"]),this.iconSizeData=Oc(this.zoom,e[\"icon-size\"]);let r=this.layers[0].layout,i=r.get(\"symbol-sort-key\"),n=r.get(\"symbol-z-order\");this.canOverlap=Gc(r,\"text-overlap\",\"text-allow-overlap\")!==\"never\"||Gc(r,\"icon-overlap\",\"icon-allow-overlap\")!==\"never\"||r.get(\"text-ignore-placement\")||r.get(\"icon-ignore-placement\"),this.sortFeaturesByKey=n!==\"viewport-y\"&&!i.isConstant();let a=n===\"viewport-y\"||n===\"auto\"&&!this.sortFeaturesByKey;this.sortFeaturesByY=a&&this.canOverlap,r.get(\"symbol-placement\")===\"point\"&&(this.writingModes=r.get(\"text-writing-mode\").map(s=>Jd[s])),this.stateDependentLayerIds=this.layers.filter(s=>s.isStateDependent()).map(s=>s.id),this.sourceID=t.sourceID}createArrays(){this.text=new rl(new gr(this.layers,this.zoom,t=>t.startsWith(\"text\"))),this.icon=new rl(new gr(this.layers,this.zoom,t=>t.startsWith(\"icon\"))),this.glyphOffsetArray=new Qf,this.lineVertexArray=new td,this.symbolInstances=new Jf,this.textAnchorOffsets=new rd}calculateGlyphDependencies(t,e,r,i,n){var l;let a=(i||this.allowVerticalPlacement)&&n,s=tu.fromFeature(t,r),o=s.graphemes();for(let u=0;u<o.length;u++){let h=s.getSection(u);if(\"imageName\"in h)continue;let c=e[l=h.fontStack]||(e[l]={}),p=o[u];Gd(p)&&(c[p]=!0);for(let f of p){if(c[f]=!0,!a)continue;let d=qr[f];d&&(c[d]=!0)}}}populate(t,e,r){let i=this.layers[0],n=i.layout,a=n.get(\"text-font\"),s=n.get(\"text-field\"),o=n.get(\"icon-image\"),l=(s.value.kind!==\"constant\"||s.value.value instanceof Be&&!s.value.value.isEmpty()||s.value.value.toString().length>0)&&(a.value.kind!==\"constant\"||a.value.value.length>0),u=o.value.kind!==\"constant\"||!!o.value.value||Object.keys(o.parameters).length>0,h=n.get(\"symbol-sort-key\");if(this.features=[],!l&&!u)return;let c=e.iconDependencies,p=e.glyphDependencies,f=e.availableImages,d=new at(this.zoom);for(let{feature:y,id:m,index:g,sourceLayerIndex:x}of t){let b=i._featureFilter.needGeometry,v=li(y,b);if(!i._featureFilter.filter(d,v,r))continue;b||(v.geometry=Dr(y));let w;if(l){let F=i.getValueAndResolveTokens(\"text-field\",v,r,f),L=Be.factory(F);this.hasRTLText||(this.hasRTLText=Rb(L)),w=cv(L,i,v)}let _;if(u){let F=i.getValueAndResolveTokens(\"icon-image\",v,r,f);_=F instanceof _e?F:_e.fromString(F)}if(!w&&!_)continue;let A=this.sortFeaturesByKey?h.evaluate(v,{},r):void 0,S={id:m,text:w,icon:_,index:g,sourceLayerIndex:x,geometry:v.geometry,properties:y.properties,type:vn.types[y.type],sortKey:A};if(this.features.push(S),_&&(c[_.name]=!0),w){let F=a.evaluate(v,{},r).join(\",\"),L=n.get(\"text-rotation-alignment\")!==\"viewport\"&&n.get(\"symbol-placement\")!==\"point\";this.allowVerticalPlacement=this.writingModes?.includes(2);let V=Jo(w.toString());this.calculateGlyphDependencies(w,p,F,L,V);for(let P of w.sections)P.image&&(c[P.image.name]=!0)}}n.get(\"symbol-placement\")===\"line\"&&(this.features=pv(this.features)),this.sortFeaturesByKey&&this.features.sort((y,m)=>y.sortKey-m.sortKey)}update(t,e,r){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(t,e,this.layers,{imagePositions:r}),this.icon.programConfigurations.updatePaintArrays(t,e,this.layers,{imagePositions:r}))}addFeatures({options:t,canonical:e,glyphMap:r,glyphPositions:i,iconMap:n,iconPositions:a,showCollisionBoxes:s}){Mb({bucket:this,glyphMap:r,glyphPositions:i,imageMap:n,imagePositions:a,showCollisionBoxes:s,canonical:e,subdivisionGranularity:t.subdivisionGranularity})}isEmpty(){return this.symbolInstances.length===0}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(t){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(t),this.iconCollisionBox.upload(t)),this.text.upload(t,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(t,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(t,e){let r=this.lineVertexArray.length;if(t.segment!==void 0){let i=t.dist(e[t.segment+1]),n=t.dist(e[t.segment]),a={};for(let s=t.segment+1;s<e.length;s++)a[s]={x:e[s].x,y:e[s].y,tileUnitDistanceFromAnchor:i},s<e.length-1&&(i+=e[s+1].dist(e[s]));for(let s=t.segment||0;s>=0;s--)a[s]={x:e[s].x,y:e[s].y,tileUnitDistanceFromAnchor:n},s>0&&(n+=e[s-1].dist(e[s]));for(let s=0;s<e.length;s++){let o=a[s];this.lineVertexArray.emplaceBack(o.x,o.y,o.tileUnitDistanceFromAnchor)}}return{lineStartIndex:r,lineLength:this.lineVertexArray.length-r}}addSymbols(t,e,r,i,n,a,s,o,l,u,h,c,p){let f=t.indexArray,d=t.layoutVertexArray,y=t.segments.prepareSegment(4*e.length,d,f,this.canOverlap?a.sortKey:void 0),m=this.glyphOffsetArray.length,g=y.vertexLength,x=this.allowVerticalPlacement&&s===2?Math.PI/2:0,b=a.text&&a.text.sections;for(let v=0;v<e.length;v++){let{tl:w,tr:_,bl:A,br:S,tex:F,pixelOffsetTL:L,pixelOffsetBR:V,minFontScaleX:P,minFontScaleY:R,glyphOffset:E,isSDF:$,sectionIndex:O}=e[v],M=y.vertexLength,j=E[1];ea(d,o.x,o.y,w.x,j+w.y,F.x,F.y,r,$,L.x,L.y,P,R,p),ea(d,o.x,o.y,_.x,j+_.y,F.x+F.w,F.y,r,$,V.x,L.y,P,R,p),ea(d,o.x,o.y,A.x,j+A.y,F.x,F.y+F.h,r,$,L.x,V.y,P,R,p),ea(d,o.x,o.y,S.x,j+S.y,F.x+F.w,F.y+F.h,r,$,V.x,V.y,P,R,p),Ob(t.dynamicLayoutVertexArray,o,x),f.emplaceBack(M,M+2,M+1),f.emplaceBack(M+1,M+2,M+3),y.vertexLength+=4,y.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(E[0]),(v===e.length-1||O!==e[v+1].sectionIndex)&&t.programConfigurations.populatePaintArrays(d.length,a,a.index,{imagePositions:{},canonical:c,formattedSection:b?.[O]})}t.placedSymbolArray.emplaceBack(o.x,o.y,m,this.glyphOffsetArray.length-m,g,l,u,o.segment,r?r[0]:0,r?r[1]:0,i[0],i[1],s,0,!1,0,h,p)}_addCollisionDebugVertex(t,e,r,i,n,a){return e.emplaceBack(0,0),t.emplaceBack(r.x,r.y,i,n,Math.round(a.x),Math.round(a.y))}addCollisionDebugVertices(t,e,r,i,n,a,s){let o=n.segments.prepareSegment(4,n.layoutVertexArray,n.indexArray),l=o.vertexLength,u=n.layoutVertexArray,h=n.collisionVertexArray,c=s.anchorX,p=s.anchorY;this._addCollisionDebugVertex(u,h,a,c,p,new B(t,e)),this._addCollisionDebugVertex(u,h,a,c,p,new B(r,e)),this._addCollisionDebugVertex(u,h,a,c,p,new B(r,i)),this._addCollisionDebugVertex(u,h,a,c,p,new B(t,i)),o.vertexLength+=4;let f=n.indexArray;f.emplaceBack(l,l+1),f.emplaceBack(l+1,l+2),f.emplaceBack(l+2,l+3),f.emplaceBack(l+3,l),o.primitiveLength+=4}addDebugCollisionBoxes(t,e,r,i){for(let n=t;n<e;n++){let a=this.collisionBoxArray.get(n),s=a.x1,o=a.y1,l=a.x2,u=a.y2;this.addCollisionDebugVertices(s,o,l,u,i?this.textCollisionBox:this.iconCollisionBox,a.anchorPoint,r)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new il(Nh,_c.members,Fo),this.iconCollisionBox=new il(Nh,_c.members,Fo);for(let t=0;t<this.symbolInstances.length;t++){let e=this.symbolInstances.get(t);this.addDebugCollisionBoxes(e.textBoxStartIndex,e.textBoxEndIndex,e,!0),this.addDebugCollisionBoxes(e.verticalTextBoxStartIndex,e.verticalTextBoxEndIndex,e,!0),this.addDebugCollisionBoxes(e.iconBoxStartIndex,e.iconBoxEndIndex,e,!1),this.addDebugCollisionBoxes(e.verticalIconBoxStartIndex,e.verticalIconBoxEndIndex,e,!1)}}_deserializeCollisionBoxesForSymbol(t,e,r,i,n,a,s,o,l){let u={};for(let h=e;h<r;h++){let c=t.get(h);u.textBox={x1:c.x1,y1:c.y1,x2:c.x2,y2:c.y2,anchorPointX:c.anchorPointX,anchorPointY:c.anchorPointY},u.textFeatureIndex=c.featureIndex;break}for(let h=i;h<n;h++){let c=t.get(h);u.verticalTextBox={x1:c.x1,y1:c.y1,x2:c.x2,y2:c.y2,anchorPointX:c.anchorPointX,anchorPointY:c.anchorPointY},u.verticalTextFeatureIndex=c.featureIndex;break}for(let h=a;h<s;h++){let c=t.get(h);u.iconBox={x1:c.x1,y1:c.y1,x2:c.x2,y2:c.y2,anchorPointX:c.anchorPointX,anchorPointY:c.anchorPointY},u.iconFeatureIndex=c.featureIndex;break}for(let h=o;h<l;h++){let c=t.get(h);u.verticalIconBox={x1:c.x1,y1:c.y1,x2:c.x2,y2:c.y2,anchorPointX:c.anchorPointX,anchorPointY:c.anchorPointY},u.verticalIconFeatureIndex=c.featureIndex;break}return u}deserializeCollisionBoxes(t){this.collisionArrays=[];for(let e=0;e<this.symbolInstances.length;e++){let r=this.symbolInstances.get(e);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(t,r.textBoxStartIndex,r.textBoxEndIndex,r.verticalTextBoxStartIndex,r.verticalTextBoxEndIndex,r.iconBoxStartIndex,r.iconBoxEndIndex,r.verticalIconBoxStartIndex,r.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(t,e){let r=t.placedSymbolArray.get(e),i=r.vertexStartIndex+r.numGlyphs*4;for(let n=r.vertexStartIndex;n<i;n+=4)t.indexArray.emplaceBack(n,n+2,n+1),t.indexArray.emplaceBack(n+1,n+2,n+3)}getSortedSymbolIndexes(t){if(this.sortedAngle===t&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;let e=Math.sin(t),r=Math.cos(t),i=[],n=[],a=[];for(let s=0;s<this.symbolInstances.length;++s){a.push(s);let o=this.symbolInstances.get(s);i.push(Math.round(e*o.anchorX+r*o.anchorY)|0),n.push(o.featureIndex)}return a.sort((s,o)=>i[s]-i[o]||n[o]-n[s]),a}addToSortKeyRanges(t,e){let r=this.sortKeyRanges[this.sortKeyRanges.length-1];r?.sortKey===e?r.symbolInstanceEnd=t+1:this.sortKeyRanges.push({sortKey:e,symbolInstanceStart:t,symbolInstanceEnd:t+1})}sortFeatures(t){if(this.sortFeaturesByY&&this.sortedAngle!==t&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(t),this.sortedAngle=t,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(let e of this.symbolInstanceIndexes){let r=this.symbolInstances.get(e);this.featureSortOrder.push(r.featureIndex);let i=[r.rightJustifiedTextSymbolIndex,r.centerJustifiedTextSymbolIndex,r.leftJustifiedTextSymbolIndex];for(let n=0;n<i.length;n++){let a=i[n];a>=0&&i.indexOf(a)===n&&this.addIndicesForPlacedSymbol(this.text,a)}r.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,r.verticalPlacedTextSymbolIndex),r.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,r.placedIconSymbolIndex),r.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,r.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}};I(\"SymbolBucket\",dy,{omit:[\"layers\",\"collisionBoxArray\",\"features\",\"compareText\"]});function $b(t,e){return e.replace(/{([^{}]+)}/g,(r,i)=>t&&i in t?String(t[i]):\"\")}var Yc,Nb=()=>Yc||(Yc=new jt({\"symbol-placement\":new z(D.layout_symbol[\"symbol-placement\"],\"symbol-placement\"),\"symbol-spacing\":new z(D.layout_symbol[\"symbol-spacing\"],\"symbol-spacing\"),\"symbol-avoid-edges\":new z(D.layout_symbol[\"symbol-avoid-edges\"],\"symbol-avoid-edges\"),\"symbol-sort-key\":new U(D.layout_symbol[\"symbol-sort-key\"],\"symbol-sort-key\"),\"symbol-z-order\":new z(D.layout_symbol[\"symbol-z-order\"],\"symbol-z-order\"),\"icon-allow-overlap\":new z(D.layout_symbol[\"icon-allow-overlap\"],\"icon-allow-overlap\"),\"icon-overlap\":new z(D.layout_symbol[\"icon-overlap\"],\"icon-overlap\"),\"icon-ignore-placement\":new z(D.layout_symbol[\"icon-ignore-placement\"],\"icon-ignore-placement\"),\"icon-optional\":new z(D.layout_symbol[\"icon-optional\"],\"icon-optional\"),\"icon-rotation-alignment\":new U(D.layout_symbol[\"icon-rotation-alignment\"],\"icon-rotation-alignment\"),\"icon-size\":new U(D.layout_symbol[\"icon-size\"],\"icon-size\"),\"icon-text-fit\":new z(D.layout_symbol[\"icon-text-fit\"],\"icon-text-fit\"),\"icon-text-fit-padding\":new z(D.layout_symbol[\"icon-text-fit-padding\"],\"icon-text-fit-padding\"),\"icon-image\":new U(D.layout_symbol[\"icon-image\"],\"icon-image\"),\"icon-rotate\":new U(D.layout_symbol[\"icon-rotate\"],\"icon-rotate\"),\"icon-padding\":new U(D.layout_symbol[\"icon-padding\"],\"icon-padding\"),\"icon-keep-upright\":new z(D.layout_symbol[\"icon-keep-upright\"],\"icon-keep-upright\"),\"icon-offset\":new U(D.layout_symbol[\"icon-offset\"],\"icon-offset\"),\"icon-anchor\":new U(D.layout_symbol[\"icon-anchor\"],\"icon-anchor\"),\"icon-pitch-alignment\":new z(D.layout_symbol[\"icon-pitch-alignment\"],\"icon-pitch-alignment\"),\"text-pitch-alignment\":new z(D.layout_symbol[\"text-pitch-alignment\"],\"text-pitch-alignment\"),\"text-rotation-alignment\":new z(D.layout_symbol[\"text-rotation-alignment\"],\"text-rotation-alignment\"),\"text-field\":new U(D.layout_symbol[\"text-field\"],\"text-field\"),\"text-font\":new U(D.layout_symbol[\"text-font\"],\"text-font\"),\"text-size\":new U(D.layout_symbol[\"text-size\"],\"text-size\"),\"text-max-width\":new U(D.layout_symbol[\"text-max-width\"],\"text-max-width\"),\"text-line-height\":new z(D.layout_symbol[\"text-line-height\"],\"text-line-height\"),\"text-letter-spacing\":new U(D.layout_symbol[\"text-letter-spacing\"],\"text-letter-spacing\"),\"text-justify\":new U(D.layout_symbol[\"text-justify\"],\"text-justify\"),\"text-radial-offset\":new U(D.layout_symbol[\"text-radial-offset\"],\"text-radial-offset\"),\"text-variable-anchor\":new z(D.layout_symbol[\"text-variable-anchor\"],\"text-variable-anchor\"),\"text-variable-anchor-offset\":new U(D.layout_symbol[\"text-variable-anchor-offset\"],\"text-variable-anchor-offset\"),\"text-anchor\":new U(D.layout_symbol[\"text-anchor\"],\"text-anchor\"),\"text-max-angle\":new z(D.layout_symbol[\"text-max-angle\"],\"text-max-angle\"),\"text-writing-mode\":new z(D.layout_symbol[\"text-writing-mode\"],\"text-writing-mode\"),\"text-rotate\":new U(D.layout_symbol[\"text-rotate\"],\"text-rotate\"),\"text-padding\":new z(D.layout_symbol[\"text-padding\"],\"text-padding\"),\"text-keep-upright\":new z(D.layout_symbol[\"text-keep-upright\"],\"text-keep-upright\"),\"text-transform\":new U(D.layout_symbol[\"text-transform\"],\"text-transform\"),\"text-offset\":new U(D.layout_symbol[\"text-offset\"],\"text-offset\"),\"text-allow-overlap\":new z(D.layout_symbol[\"text-allow-overlap\"],\"text-allow-overlap\"),\"text-overlap\":new z(D.layout_symbol[\"text-overlap\"],\"text-overlap\"),\"text-ignore-placement\":new z(D.layout_symbol[\"text-ignore-placement\"],\"text-ignore-placement\"),\"text-optional\":new z(D.layout_symbol[\"text-optional\"],\"text-optional\"),\"symbol-height-offset\":new U(D.layout_symbol[\"symbol-height-offset\"],\"symbol-height-offset\"),\"symbol-height-anchor\":new z(D.layout_symbol[\"symbol-height-anchor\"],\"symbol-height-anchor\")})),Xc,Ub=()=>Xc||(Xc=new jt({\"icon-opacity\":new U(D.paint_symbol[\"icon-opacity\"],\"icon-opacity\"),\"icon-color\":new U(D.paint_symbol[\"icon-color\"],\"icon-color\"),\"icon-halo-color\":new U(D.paint_symbol[\"icon-halo-color\"],\"icon-halo-color\"),\"icon-halo-width\":new U(D.paint_symbol[\"icon-halo-width\"],\"icon-halo-width\"),\"icon-halo-blur\":new U(D.paint_symbol[\"icon-halo-blur\"],\"icon-halo-blur\"),\"icon-translate\":new z(D.paint_symbol[\"icon-translate\"],\"icon-translate\"),\"icon-translate-anchor\":new z(D.paint_symbol[\"icon-translate-anchor\"],\"icon-translate-anchor\"),\"text-opacity\":new U(D.paint_symbol[\"text-opacity\"],\"text-opacity\"),\"text-color\":new U(D.paint_symbol[\"text-color\"],\"text-color\",{runtimeType:ue,getOverride:t=>t.textColor,hasOverride:t=>!!t.textColor}),\"text-halo-color\":new U(D.paint_symbol[\"text-halo-color\"],\"text-halo-color\"),\"text-halo-width\":new U(D.paint_symbol[\"text-halo-width\"],\"text-halo-width\"),\"text-halo-blur\":new U(D.paint_symbol[\"text-halo-blur\"],\"text-halo-blur\"),\"text-translate\":new z(D.paint_symbol[\"text-translate\"],\"text-translate\"),\"text-translate-anchor\":new z(D.paint_symbol[\"text-translate-anchor\"],\"text-translate-anchor\")})),js={get paint(){return Ub()},get layout(){return Nb()}},yy=class{constructor(t){if(t.property.overrides===void 0)throw Error(\"overrides must be provided to instantiate FormatSectionOverride class\");this.type=t.property.overrides?t.property.overrides.runtimeType:cn,this.defaultValue=t}evaluate(t){if(t.formattedSection){let e=this.defaultValue.property.overrides;if(e?.hasOverride(t.formattedSection))return e.getOverride(t.formattedSection)}return t.feature&&t.featureState?this.defaultValue.evaluate(t.feature,t.featureState):this.defaultValue.property.specification.default}eachChild(t){if(!this.defaultValue.isConstant()){let e=this.defaultValue.value;t(e._styleExpression.expression)}}outputDefined(){return!1}serialize(){return null}};I(\"FormatSectionOverride\",yy,{omit:[\"defaultValue\"]});var qb=class nl extends pe{constructor(e,r){super(e,js,r)}recalculate(e,r){super.recalculate(e,r);let i=this.layout.get(\"icon-rotation-alignment\");if((i.value.kind!==\"constant\"||i.value.value===\"auto\")&&(this.layout._values[\"icon-rotation-alignment\"]=new ae(i.property,{kind:\"constant\",value:this.layout.get(\"symbol-placement\")===\"point\"?\"viewport\":\"map\"},i.parameters)),this.layout.get(\"text-rotation-alignment\")===\"auto\"&&(this.layout.get(\"symbol-placement\")===\"point\"?this.layout._values[\"text-rotation-alignment\"]=\"viewport\":this.layout._values[\"text-rotation-alignment\"]=\"map\"),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\").constantOr(\"viewport\")),this.layout.get(\"symbol-placement\")===\"point\"){let n=this.layout.get(\"text-writing-mode\");if(n){let a=[];for(let s of n)a.includes(s)||a.push(s);this.layout._values[\"text-writing-mode\"]=a}else this.layout._values[\"text-writing-mode\"]=[\"horizontal\"]}this._setPaintOverrides()}getValueAndResolveTokens(e,r,i,n){let a=this.layout.get(e).evaluate(r,{},i,n),s=this._unevaluatedLayout._values[e];return!s.isDataDriven()&&!Oa(s.value)&&a?$b(r.properties,a):a}createBucket(e){return new dy(e)}queryRadius(){return 0}queryIntersectsFeature(){throw Error(\"Should take a different path in FeatureIndex\")}_setPaintOverrides(){for(let e of js.paint.overridableProperties){if(!nl.hasPaintOverride(this.layout,e))continue;let r=this.paint.get(e),i=new Fl(new yy(r),`layers[${this.id}].paint.${r.property.name}`,r.property.specification),n=null;n=r.value.kind===\"constant\"||r.value.kind===\"source\"?new en(\"source\",i):new ya(\"composite\",i,r.value.zoomStops),this.paint._values[e]=new ae(r.property,n,r.parameters)}}_handleOverridablePaintPropertyUpdate(e,r,i){return!this.layout||r.isDataDriven()||i.isDataDriven()?!1:nl.hasPaintOverride(this.layout,e)}static hasPaintOverride(e,r){let i=e.get(\"text-field\"),n=js.paint.properties[r],a=!1,s=o=>{for(let l of o)if(n.overrides?.hasOverride(l)){a=!0;return}};if(i.value.kind===\"constant\"&&i.value.value instanceof Be)s(i.value.value.sections);else if(i.value.kind===\"source\"||i.value.kind===\"composite\"){let o=u=>{if(!a)if(u instanceof ti&&At(u.value)===pn){let h=u.value;s(h.sections)}else u instanceof Vp?s(u.sections):u.eachChild(o)},l=i.value;l._styleExpression&&o(l._styleExpression.expression)}return a}};function jb(t,e,r,i=1){let n=t.get(\"icon-padding\").evaluate(e,{},r)?.values;return[n[0]*i,n[1]*i,n[2]*i,n[3]*i]}var Wc,Gb=()=>Wc||(Wc=new jt({\"background-color\":new z(D.paint_background[\"background-color\"],\"background-color\"),\"background-pattern\":new Xf(D.paint_background[\"background-pattern\"],\"background-pattern\"),\"background-opacity\":new z(D.paint_background[\"background-opacity\"],\"background-opacity\")})),Yb={get paint(){return Gb()}};var Xb=class extends pe{constructor(t,e){super(t,Yb,e)}};var Wb=class extends pe{constructor(t,e){super(t,{},e),this.onAdd=r=>{this.implementation.onAdd&&this.implementation.onAdd(r,r.painter.context.gl)},this.onRemove=r=>{this.implementation.onRemove&&this.implementation.onRemove(r,r.painter.context.gl)},this.implementation=t}is3D(){return this.implementation.renderingMode===\"3d\"}hasOffscreenPass(){return this.implementation.prerender!==void 0}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){throw Error(\"Custom layers cannot be serialized\")}};function my(t,e){if(t.type===\"custom\")return new Wb(t,e);switch(t.type){case\"background\":return new Xb(t,e);case\"circle\":return new Lg(t,e);case\"color-relief\":return new Xg(t,e);case\"fill\":return new Ax(t,e);case\"fill-extrusion\":return new Yx(t,e);case\"heatmap\":return new Ng(t,e);case\"hillshade\":return new jg(t,e);case\"line\":return new R2(t,e);case\"raster\":return new Km(t,e);case\"symbol\":return new qb(t,e)}}var Zb=class{constructor(t){this._methodToThrottle=t,this._triggered=!1,this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._methodToThrottle()}}trigger(){this._triggered||(this._triggered=!0,this._channel?.port1.postMessage(!0))}remove(){delete this._channel,this._methodToThrottle=()=>{}}},Hb={once:!0},gy=class{constructor(t,e){this.target=t,this.mapId=e,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new Zb(()=>this.process()),this.subscription=ah(this.target,\"message\",r=>this.receive(r),!1),this.globalScope=dr(self)?t:window}registerMessageHandler(t,e){this.messageHandlers[t]=e}unregisterMessageHandler(t){delete this.messageHandlers[t]}sendAsync(t,e){return new Promise((r,i)=>{let n=Math.round(Math.random()*1e18).toString(36).substring(0,10),a=e?ah(e.signal,\"abort\",()=>{a?.unsubscribe(),delete this.resolveRejects[n];let l={id:n,type:\"<cancel>\",origin:location.origin,targetMapId:t.targetMapId,sourceMapId:this.mapId};this.target.postMessage(l),i(new cl(e.signal.reason))},Hb):null;this.resolveRejects[n]={resolve:l=>{a?.unsubscribe(),r(l)},reject:l=>{a?.unsubscribe(),i(l)}};let s=[],o={...t,id:n,sourceMapId:this.mapId,origin:location.origin,data:ji(t.data,s)};this.target.postMessage(o,{transfer:s})})}receive(t){let e=t.data,r=e.id,i=[\"file://\",\"resource://android\",\"null\"],n=[e.origin,location.origin],a=e.origin===location.origin,s=n.some(o=>i.includes(o));if((a||s)&&!(e.targetMapId&&this.mapId!==e.targetMapId)){if(e.type===\"<cancel>\"){delete this.tasks[r];let o=this.abortControllers[r];delete this.abortControllers[r],o&&o.abort();return}if(dr(self)||e.mustQueue){this.tasks[r]=e,this.taskQueue.push(r),this.invoker.trigger();return}this.processTask(r,e)}}process(){if(this.taskQueue.length===0)return;let t=this.taskQueue.shift(),e=this.tasks[t];delete this.tasks[t],this.taskQueue.length>0&&this.invoker.trigger(),e&&this.processTask(t,e)}async processTask(t,e){if(e.type===\"<response>\"){let n=this.resolveRejects[t];if(delete this.resolveRejects[t],!n)return;e.error?n.reject(Wi(Gi(e.error))):n.resolve(Gi(e.data));return}if(!this.messageHandlers[e.type]){this.completeTask(t,null,null);return}let r=Gi(e.data),i=new AbortController;this.abortControllers[t]=i;try{let n=await this.messageHandlers[e.type](e.sourceMapId,r,i);this.completeTask(t,null,n)}catch(n){this.completeTask(t,Wi(n))}}completeTask(t,e,r){let i=[];delete this.abortControllers[t];let n={id:t,type:\"<response>\",sourceMapId:this.mapId,origin:location.origin,error:e?ji(e):null,data:ji(r,i)};this.target.postMessage(n,{transfer:i})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}};function Kb(t,e,r){return!(t<0||t>25||r<0||r>=2**t||e<0||e>=2**t)}var xy=class{constructor(t,e,r){if(!Kb(t,e,r))throw Error(`x=${e}, y=${r}, z=${t} outside of bounds. 0<=x<${2**t}, 0<=y<${2**t} 0<=z<=25 `);this.z=t,this.x=e,this.y=r,this.key=Xi(0,t,t,e,r)}equals(t){return this.z===t.z&&this.x===t.x&&this.y===t.y}url(t,e,r){let i=Qb(this.x,this.y,this.z),n=tw(this.z,this.x,this.y);return t[(this.x+this.y)%t.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(r===\"tms\"?2**this.z-this.y-1:this.y)).replace(/{ratio}/g,e>1?\"@2x\":\"\").replace(/{quadkey}/g,n).replace(/{bbox-epsg-3857}/g,i)}isChildOf(t){let e=this.z-t.z;return e>0&&t.x===this.x>>e&&t.y===this.y>>e}getTilePoint(t){let e=2**this.z;return new B((t.x*e-this.x)*mt,(t.y*e-this.y)*mt)}toString(){return`${this.z}/${this.x}/${this.y}`}},Jb=class{constructor(t,e){this.wrap=t,this.canonical=e,this.key=Xi(t,e.z,e.z,e.x,e.y)}},su=class ie{constructor(e,r,i,n,a){if(this.terrainRttPosMatrix32f=null,e<i)throw Error(`overscaledZ should be >= z; overscaledZ = ${e}; z = ${i}`);this.overscaledZ=e,this.wrap=r,this.canonical=new xy(i,+n,+a),this.key=Xi(r,e,i,n,a)}clone(){return new ie(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(e){return this.overscaledZ===e.overscaledZ&&this.wrap===e.wrap&&this.canonical.equals(e.canonical)}scaledTo(e){if(e>this.overscaledZ)throw Error(`targetZ > this.overscaledZ; targetZ = ${e}; overscaledZ = ${this.overscaledZ}`);let r=this.canonical.z-e;return e>this.canonical.z?new ie(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new ie(e,this.wrap,e,this.canonical.x>>r,this.canonical.y>>r)}isOverscaled(){return this.overscaledZ>this.canonical.z}calculateScaledKey(e,r){if(e>this.overscaledZ)throw Error(`targetZ > this.overscaledZ; targetZ = ${e}; overscaledZ = ${this.overscaledZ}`);let i=this.canonical.z-e;return e>this.canonical.z?Xi(this.wrap*+r,e,this.canonical.z,this.canonical.x,this.canonical.y):Xi(this.wrap*+r,e,e,this.canonical.x>>i,this.canonical.y>>i)}isChildOf(e){if(e.wrap!==this.wrap||this.overscaledZ-e.overscaledZ<=0)return!1;if(e.overscaledZ===0)return this.overscaledZ>0;let r=this.canonical.z-e.canonical.z;return r<0?!1:e.canonical.x===this.canonical.x>>r&&e.canonical.y===this.canonical.y>>r}children(e){if(this.overscaledZ>=e)return[new ie(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];let r=this.canonical.z+1,i=this.canonical.x*2,n=this.canonical.y*2;return[new ie(r,this.wrap,r,i,n),new ie(r,this.wrap,r,i+1,n),new ie(r,this.wrap,r,i,n+1),new ie(r,this.wrap,r,i+1,n+1)]}isLessThan(e){return this.wrap<e.wrap?!0:this.wrap>e.wrap?!1:this.overscaledZ<e.overscaledZ?!0:this.overscaledZ>e.overscaledZ?!1:this.canonical.x<e.canonical.x?!0:this.canonical.x>e.canonical.x?!1:this.canonical.y<e.canonical.y}wrapped(){return new ie(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(e){return new ie(this.overscaledZ,e,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return 2**(this.overscaledZ-this.canonical.z)}toUnwrapped(){return new Jb(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(e){return this.canonical.getTilePoint(new jl(e.x-this.wrap,e.y))}normalizeCoordinates(e,r,i=mt){if(e>=0&&e<i&&r>=0&&r<i)return{tileID:this,x:e,y:r};let n=Math.floor(e/i),a=Math.floor(r/i),s=e-n*i,o=r-a*i,l=this.canonical.z,u=1<<l,h=this.canonical.y+a;if(h<0||h>=u)return null;let c=this.canonical.x+n,p=this.wrap;return c<0?(p-=Math.ceil(-c/u),c=(c%u+u)%u):c>=u&&(p+=Math.floor(c/u),c%=u),{tileID:new ie(this.overscaledZ,p,l,c,h),x:s,y:o}}};function Xi(t,e,r,i,n){t*=2,t<0&&(t=t*-1-1);let a=1<<r;return(a*a*t+a*n+i).toString(36)+r.toString(36)+e.toString(36)}var Gs=Math.PI*6378137;function Qb(t,e,r){e=2**r-e-1;let i=Zc(t*256,e*256,r),n=Zc((t+1)*256,(e+1)*256,r);return`${i[0]},${i[1]},${n[0]},${n[1]}`}function Zc(t,e,r){let i=2*Gs/256/2**r;return[t*i-Gs,e*i-Gs]}function tw(t,e,r){let i=\"\";for(let n=t;n>0;n--){let a=1<<n-1;i+=(e&a?1:0)+(r&a?2:0)}return i}I(\"CanonicalTileID\",xy),I(\"OverscaledTileID\",su,{omit:[\"terrainRttPosMatrix32f\"]});var ew=class{constructor(t,e){this.feature=t,this.type=t.type,this.properties=t.tags?t.tags:{},this.extent=e,\"id\"in t&&(typeof t.id==\"string\"?this.id=parseInt(t.id,10):typeof t.id==\"number\"&&!isNaN(t.id)&&(this.id=t.id))}loadGeometry(){let t=[],e=this.feature.type===1?[this.feature.geometry]:this.feature.geometry;for(let r of e){let i=[];for(let n of r)i.push(new B(n[0],n[1]));t.push(i)}return t}},al=\"_geojsonTileLayer\",vy=class{constructor(t,e){this.layers={[al]:this},this.name=al,this.version=e?e.version:1,this.extent=e?e.extent:4096,this.length=t.length,this.features=t}feature(t){return new ew(this.features[t],this.extent)}};function ou(t,e=\"\"){let r=new Bv;return rw(t,r,e),r.finish()}function rw(t,e,r=\"\"){for(let i in t.layers)e.writeMessage(3,(n,a)=>iw(n,a,r),t.layers[i])}function iw(t,e,r=\"\"){e.writeVarintField(15,t.version||1),e.writeStringField(1,t.name||\"\"),e.writeVarintField(5,t.extent||4096);let i={jsonPrefix:r,keys:[],values:[],keycache:{},valuecache:{}};for(let s=0;s<t.length;s++)i.feature=t.feature(s),e.writeMessage(2,nw,i);let n=i.keys;for(let s of n)e.writeStringField(3,s);let a=i.values;for(let s of a)e.writeMessage(4,ow,s)}function nw(t,e){if(!t.feature)return;let r=t.feature;r.id!==void 0&&e.writeVarintField(1,r.id),e.writeMessage(2,aw,t),e.writeVarintField(3,r.type),e.writeMessage(4,sw,r)}function aw(t,e){for(let r in t.feature?.properties){let i=t.feature.properties[r],n=t.keycache[r];if(i==null)continue;n===void 0&&(t.keys.push(r),n=t.keys.length-1,t.keycache[r]=n),e.writeVarint(n),typeof i!=\"string\"&&typeof i!=\"boolean\"&&typeof i!=\"number\"&&(i=t.jsonPrefix+JSON.stringify(i));let a=typeof i+\":\"+i,s=t.valuecache[a];s===void 0&&(t.values.push(i),s=t.values.length-1,t.valuecache[a]=s),e.writeVarint(s)}}function Ys(t,e){return(e<<3)+(t&7)}function Hc(t){return t<<1^t>>31}function sw(t,e){let r=t.loadGeometry(),i=t.type,n=0,a=0;for(let s of r){let o=1;i===1&&(o=s.length),e.writeVarint(Ys(1,o));let l=i===3?s.length-1:s.length;for(let u=0;u<l;u++){u===1&&i!==1&&e.writeVarint(Ys(2,l-1));let h=s[u].x-n,c=s[u].y-a;e.writeVarint(Hc(h)),e.writeVarint(Hc(c)),n+=h,a+=c}t.type===3&&e.writeVarint(Ys(7,1))}}function ow(t,e){let r=typeof t;r===\"string\"?e.writeStringField(1,t):r===\"boolean\"?e.writeBooleanField(7,t):r===\"number\"&&(t%1==0?t<0?e.writeSVarintField(6,t):e.writeVarintField(5,t):e.writeDoubleField(3,t))}var lu=class{constructor(t){this._stringToNumber={},this._numberToString=[];for(let e=0;e<t.length;e++){let r=t[e];this._stringToNumber[r]=e,this._numberToString[e]=r}}encode(t){return this._stringToNumber[t]}decode(t){if(t>=this._numberToString.length)throw Error(`Out of bounds. Index requested n=${t} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[t]}},lw=class{constructor(t,e,r,i,n){this.type=\"Feature\",this._vectorTileFeature=t,this._x=r,this._y=i,this._z=e;for(let a in t.properties)typeof t.properties[a]==\"string\"&&t.properties[a].startsWith(\"__$json__:\")&&(t.properties[a]=JSON.parse(t.properties[a].slice(10)));this.properties=t.properties,this.id=n}projectPoint(t,e,r,i){return[(t.x+e)*360/i-180,360/Math.PI*Math.atan(Math.exp((1-(t.y+r)*2/i)*Math.PI))-90]}projectLine(t,e,r,i){return t.map(n=>this.projectPoint(n,e,r,i))}get geometry(){if(this._geometry)return this._geometry;let t=this._vectorTileFeature,e=t.extent*2**this._z,r=t.extent*this._x,i=t.extent*this._y,n=t.loadGeometry();switch(t.type){case 1:{let a=[];for(let o of n)a.push(o[0]);let s=this.projectLine(a,r,i,e);this._geometry=a.length===1?{type:\"Point\",coordinates:s[0]}:{type:\"MultiPoint\",coordinates:s};break}case 2:{let a=n.map(s=>this.projectLine(s,r,i,e));this._geometry=a.length===1?{type:\"LineString\",coordinates:a[0]}:{type:\"MultiLineString\",coordinates:a};break}case 3:{let a=Sd(n),s=[];for(let o of a)s.push(o.map(l=>this.projectLine(l,r,i,e)));this._geometry=s.length===1?{type:\"Polygon\",coordinates:s[0]}:{type:\"MultiPolygon\",coordinates:s};break}default:throw Error(`unknown feature type: ${t.type}`)}return this._geometry}set geometry(t){this._geometry=t}toJSON(){let t={geometry:this.geometry};for(let e in this)e!==\"_geometry\"&&e!==\"_vectorTileFeature\"&&e!==\"_x\"&&e!==\"_y\"&&e!==\"_z\"&&(t[e]=this[e]);return t}},_r=class{constructor(t,e,r){this._name=t,this.dataBuffer=e,typeof r==\"number\"?this._size=r:(this.nullabilityBuffer=r,this._size=r.size())}getValue(t){return this.nullabilityBuffer&&!this.nullabilityBuffer.get(t)?null:this.getValueFromBuffer(t)}has(t){return this.nullabilityBuffer?.get(t)||!this.nullabilityBuffer}get name(){return this._name}get size(){return this._size}},Wa=class extends _r{},uu=class extends Wa{getValueFromBuffer(t){return this.dataBuffer[t]}},hu=class extends Wa{getValueFromBuffer(t){return this.dataBuffer[t]}},by=class extends _r{constructor(t,e,r,i){super(t,e,i),this.delta=r}},cu=class extends by{constructor(t,e,r,i,n){super(t,n?Int32Array.of(e):Uint32Array.of(e),r,i)}getValueFromBuffer(t){return this.dataBuffer[0]+t*this.delta}},pu=class extends _r{constructor(t,e,r,i){super(t,i?Int32Array.of(e):Uint32Array.of(e),r)}getValueFromBuffer(t){return this.dataBuffer[0]}},uw=class{constructor(t,e,r,i,n=4096){if(this._name=t,this._geometryVector=e,this._idVector=r,this._propertyVectors=i,this._extent=n,t.length===0)throw Error(\"Missing layer name\")}get name(){return this._name}get idVector(){return this._idVector}get geometryVector(){return this._geometryVector}get propertyVectors(){return this._propertyVectors??[]}getPropertyVector(t){return this.propertyVectorsMap||(this.propertyVectorsMap=new Map(this.propertyVectors.map(e=>[e.name,e]))),this.propertyVectorsMap.get(t)}get numFeatures(){return this.geometryVector.numGeometries}get extent(){return this._extent}getFeatures(){let t=[],e=this.geometryVector.getGeometries();for(let r=0;r<this.numFeatures;r++){let i;if(this.idVector){let s=this.idVector.getValue(r);s!==null&&(i=this.containsMaxSafeIntegerValues(this.idVector)?Number(s):s)}let n={coordinates:e[r],type:this.geometryVector.geometryType(r)},a={};for(let s of this.propertyVectors){if(!s)continue;let o=s.name,l=s.getValue(r);l!==null&&(a[o]=l)}t.push({id:i,geometry:n,properties:a})}return t}containsMaxSafeIntegerValues(t){return t instanceof uu||t instanceof pu||t instanceof cu||t instanceof hu}},$i={FEATURE:0,VERTEX:1},rt={BOOLEAN:0,INT_8:1,UINT_8:2,INT_32:3,UINT_32:4,INT_64:5,UINT_64:6,FLOAT:7,DOUBLE:8,STRING:9},Ke={GEOMETRY:0,STRUCT:1,MAP:2},wy={ID:0},Dy=class{constructor(t){this.value=t}get(){return this.value}set(t){this.value=t}increment(){return this.value++}add(t){this.value+=t}},W;(function(t){t.NONE=\"NONE\",t.DELTA=\"DELTA\",t.COMPONENTWISE_DELTA=\"COMPONENTWISE_DELTA\",t.RLE=\"RLE\",t.MORTON=\"MORTON\"})(W||(W={}));var Qt;(function(t){t.NONE=\"NONE\",t.FAST_PFOR=\"FAST_PFOR\",t.VARINT=\"VARINT\"})(Qt||(Qt={}));var fu=new Uint32Array(33);fu[0]=0;for(let t=1;t<=32;t++)fu[t]=t===32?4294967295:4294967295>>>32-t;var sl=fu,_y=65536;function du(t,e){return t-t%e}function hw(t){return du(t+31,32)}function cw(t){if(!Number.isFinite(t)||t<=0)return _y;let e=du(Math.floor(t),256);return e===0?256:e}function pw(t){let e=t>>>0;return((e&255)<<24|(e&65280)<<8|e>>>8&65280|e>>>24&255)>>>0}function fw(t,e,r,i){let n=i,a=t[e]>>>0,s=t[e+1]>>>0;r[n++]=a>>>0&3,r[n++]=a>>>2&3,r[n++]=a>>>4&3,r[n++]=a>>>6&3,r[n++]=a>>>8&3,r[n++]=a>>>10&3,r[n++]=a>>>12&3,r[n++]=a>>>14&3,r[n++]=a>>>16&3,r[n++]=a>>>18&3,r[n++]=a>>>20&3,r[n++]=a>>>22&3,r[n++]=a>>>24&3,r[n++]=a>>>26&3,r[n++]=a>>>28&3,r[n++]=a>>>30&3,r[n++]=s>>>0&3,r[n++]=s>>>2&3,r[n++]=s>>>4&3,r[n++]=s>>>6&3,r[n++]=s>>>8&3,r[n++]=s>>>10&3,r[n++]=s>>>12&3,r[n++]=s>>>14&3,r[n++]=s>>>16&3,r[n++]=s>>>18&3,r[n++]=s>>>20&3,r[n++]=s>>>22&3,r[n++]=s>>>24&3,r[n++]=s>>>26&3,r[n++]=s>>>28&3,r[n]=s>>>30&3}function dw(t,e,r,i){let n=i,a=t[e]>>>0,s=t[e+1]>>>0,o=t[e+2]>>>0;r[n++]=a>>>0&7,r[n++]=a>>>3&7,r[n++]=a>>>6&7,r[n++]=a>>>9&7,r[n++]=a>>>12&7,r[n++]=a>>>15&7,r[n++]=a>>>18&7,r[n++]=a>>>21&7,r[n++]=a>>>24&7,r[n++]=a>>>27&7,r[n++]=(a>>>30|(s&1)<<2)&7,r[n++]=s>>>1&7,r[n++]=s>>>4&7,r[n++]=s>>>7&7,r[n++]=s>>>10&7,r[n++]=s>>>13&7,r[n++]=s>>>16&7,r[n++]=s>>>19&7,r[n++]=s>>>22&7,r[n++]=s>>>25&7,r[n++]=s>>>28&7,r[n++]=(s>>>31|(o&3)<<1)&7,r[n++]=o>>>2&7,r[n++]=o>>>5&7,r[n++]=o>>>8&7,r[n++]=o>>>11&7,r[n++]=o>>>14&7,r[n++]=o>>>17&7,r[n++]=o>>>20&7,r[n++]=o>>>23&7,r[n++]=o>>>26&7,r[n]=o>>>29&7}function yw(t,e,r,i){let n=i,a=t[e]>>>0,s=t[e+1]>>>0,o=t[e+2]>>>0,l=t[e+3]>>>0;r[n++]=a>>>0&15,r[n++]=a>>>4&15,r[n++]=a>>>8&15,r[n++]=a>>>12&15,r[n++]=a>>>16&15,r[n++]=a>>>20&15,r[n++]=a>>>24&15,r[n++]=a>>>28&15,r[n++]=s>>>0&15,r[n++]=s>>>4&15,r[n++]=s>>>8&15,r[n++]=s>>>12&15,r[n++]=s>>>16&15,r[n++]=s>>>20&15,r[n++]=s>>>24&15,r[n++]=s>>>28&15,r[n++]=o>>>0&15,r[n++]=o>>>4&15,r[n++]=o>>>8&15,r[n++]=o>>>12&15,r[n++]=o>>>16&15,r[n++]=o>>>20&15,r[n++]=o>>>24&15,r[n++]=o>>>28&15,r[n++]=l>>>0&15,r[n++]=l>>>4&15,r[n++]=l>>>8&15,r[n++]=l>>>12&15,r[n++]=l>>>16&15,r[n++]=l>>>20&15,r[n++]=l>>>24&15,r[n]=l>>>28&15}function mw(t,e,r,i){let n=i,a=t[e]>>>0,s=t[e+1]>>>0,o=t[e+2]>>>0,l=t[e+3]>>>0,u=t[e+4]>>>0;r[n++]=a>>>0&31,r[n++]=a>>>5&31,r[n++]=a>>>10&31,r[n++]=a>>>15&31,r[n++]=a>>>20&31,r[n++]=a>>>25&31,r[n++]=(a>>>30|(s&7)<<2)&31,r[n++]=s>>>3&31,r[n++]=s>>>8&31,r[n++]=s>>>13&31,r[n++]=s>>>18&31,r[n++]=s>>>23&31,r[n++]=(s>>>28|(o&1)<<4)&31,r[n++]=o>>>1&31,r[n++]=o>>>6&31,r[n++]=o>>>11&31,r[n++]=o>>>16&31,r[n++]=o>>>21&31,r[n++]=o>>>26&31,r[n++]=(o>>>31|(l&15)<<1)&31,r[n++]=l>>>4&31,r[n++]=l>>>9&31,r[n++]=l>>>14&31,r[n++]=l>>>19&31,r[n++]=l>>>24&31,r[n++]=(l>>>29|(u&3)<<3)&31,r[n++]=u>>>2&31,r[n++]=u>>>7&31,r[n++]=u>>>12&31,r[n++]=u>>>17&31,r[n++]=u>>>22&31,r[n]=u>>>27&31}function gw(t,e,r,i){let n=i,a=t[e]>>>0,s=t[e+1]>>>0,o=t[e+2]>>>0,l=t[e+3]>>>0,u=t[e+4]>>>0,h=t[e+5]>>>0;r[n++]=a>>>0&63,r[n++]=a>>>6&63,r[n++]=a>>>12&63,r[n++]=a>>>18&63,r[n++]=a>>>24&63,r[n++]=(a>>>30|(s&15)<<2)&63,r[n++]=s>>>4&63,r[n++]=s>>>10&63,r[n++]=s>>>16&63,r[n++]=s>>>22&63,r[n++]=(s>>>28|(o&3)<<4)&63,r[n++]=o>>>2&63,r[n++]=o>>>8&63,r[n++]=o>>>14&63,r[n++]=o>>>20&63,r[n++]=o>>>26&63,r[n++]=l>>>0&63,r[n++]=l>>>6&63,r[n++]=l>>>12&63,r[n++]=l>>>18&63,r[n++]=l>>>24&63,r[n++]=(l>>>30|(u&15)<<2)&63,r[n++]=u>>>4&63,r[n++]=u>>>10&63,r[n++]=u>>>16&63,r[n++]=u>>>22&63,r[n++]=(u>>>28|(h&3)<<4)&63,r[n++]=h>>>2&63,r[n++]=h>>>8&63,r[n++]=h>>>14&63,r[n++]=h>>>20&63,r[n]=h>>>26&63}function xw(t,e,r,i){let n=i,a=t[e]>>>0,s=t[e+1]>>>0,o=t[e+2]>>>0,l=t[e+3]>>>0,u=t[e+4]>>>0,h=t[e+5]>>>0,c=t[e+6]>>>0;r[n++]=a>>>0&127,r[n++]=a>>>7&127,r[n++]=a>>>14&127,r[n++]=a>>>21&127,r[n++]=(a>>>28|(s&7)<<4)&127,r[n++]=s>>>3&127,r[n++]=s>>>10&127,r[n++]=s>>>17&127,r[n++]=s>>>24&127,r[n++]=(s>>>31|(o&63)<<1)&127,r[n++]=o>>>6&127,r[n++]=o>>>13&127,r[n++]=o>>>20&127,r[n++]=(o>>>27|(l&3)<<5)&127,r[n++]=l>>>2&127,r[n++]=l>>>9&127,r[n++]=l>>>16&127,r[n++]=l>>>23&127,r[n++]=(l>>>30|(u&31)<<2)&127,r[n++]=u>>>5&127,r[n++]=u>>>12&127,r[n++]=u>>>19&127,r[n++]=(u>>>26|(h&1)<<6)&127,r[n++]=h>>>1&127,r[n++]=h>>>8&127,r[n++]=h>>>15&127,r[n++]=h>>>22&127,r[n++]=(h>>>29|(c&15)<<3)&127,r[n++]=c>>>4&127,r[n++]=c>>>11&127,r[n++]=c>>>18&127,r[n]=c>>>25&127}function vw(t,e,r,i){let n=i,a=t[e]>>>0,s=t[e+1]>>>0,o=t[e+2]>>>0,l=t[e+3]>>>0,u=t[e+4]>>>0,h=t[e+5]>>>0,c=t[e+6]>>>0,p=t[e+7]>>>0;r[n++]=a>>>0&255,r[n++]=a>>>8&255,r[n++]=a>>>16&255,r[n++]=a>>>24&255,r[n++]=s>>>0&255,r[n++]=s>>>8&255,r[n++]=s>>>16&255,r[n++]=s>>>24&255,r[n++]=o>>>0&255,r[n++]=o>>>8&255,r[n++]=o>>>16&255,r[n++]=o>>>24&255,r[n++]=l>>>0&255,r[n++]=l>>>8&255,r[n++]=l>>>16&255,r[n++]=l>>>24&255,r[n++]=u>>>0&255,r[n++]=u>>>8&255,r[n++]=u>>>16&255,r[n++]=u>>>24&255,r[n++]=h>>>0&255,r[n++]=h>>>8&255,r[n++]=h>>>16&255,r[n++]=h>>>24&255,r[n++]=c>>>0&255,r[n++]=c>>>8&255,r[n++]=c>>>16&255,r[n++]=c>>>24&255,r[n++]=p>>>0&255,r[n++]=p>>>8&255,r[n++]=p>>>16&255,r[n]=p>>>24&255}function bw(t,e,r,i){let n=i,a=t[e]>>>0,s=t[e+1]>>>0,o=t[e+2]>>>0,l=t[e+3]>>>0,u=t[e+4]>>>0,h=t[e+5]>>>0,c=t[e+6]>>>0,p=t[e+7]>>>0,f=t[e+8]>>>0;r[n++]=a>>>0&511,r[n++]=a>>>9&511,r[n++]=a>>>18&511,r[n++]=(a>>>27|(s&15)<<5)&511,r[n++]=s>>>4&511,r[n++]=s>>>13&511,r[n++]=s>>>22&511,r[n++]=(s>>>31|(o&255)<<1)&511,r[n++]=o>>>8&511,r[n++]=o>>>17&511,r[n++]=(o>>>26|(l&7)<<6)&511,r[n++]=l>>>3&511,r[n++]=l>>>12&511,r[n++]=l>>>21&511,r[n++]=(l>>>30|(u&127)<<2)&511,r[n++]=u>>>7&511,r[n++]=u>>>16&511,r[n++]=(u>>>25|(h&3)<<7)&511,r[n++]=h>>>2&511,r[n++]=h>>>11&511,r[n++]=h>>>20&511,r[n++]=(h>>>29|(c&63)<<3)&511,r[n++]=c>>>6&511,r[n++]=c>>>15&511,r[n++]=(c>>>24|(p&1)<<8)&511,r[n++]=p>>>1&511,r[n++]=p>>>10&511,r[n++]=p>>>19&511,r[n++]=(p>>>28|(f&31)<<4)&511,r[n++]=f>>>5&511,r[n++]=f>>>14&511,r[n]=f>>>23&511}function ww(t,e,r,i){let n=i,a=t[e]>>>0,s=t[e+1]>>>0,o=t[e+2]>>>0,l=t[e+3]>>>0,u=t[e+4]>>>0,h=t[e+5]>>>0,c=t[e+6]>>>0,p=t[e+7]>>>0,f=t[e+8]>>>0,d=t[e+9]>>>0;r[n++]=a>>>0&1023,r[n++]=a>>>10&1023,r[n++]=a>>>20&1023,r[n++]=(a>>>30|(s&255)<<2)&1023,r[n++]=s>>>8&1023,r[n++]=s>>>18&1023,r[n++]=(s>>>28|(o&63)<<4)&1023,r[n++]=o>>>6&1023,r[n++]=o>>>16&1023,r[n++]=(o>>>26|(l&15)<<6)&1023,r[n++]=l>>>4&1023,r[n++]=l>>>14&1023,r[n++]=(l>>>24|(u&3)<<8)&1023,r[n++]=u>>>2&1023,r[n++]=u>>>12&1023,r[n++]=u>>>22&1023,r[n++]=h>>>0&1023,r[n++]=h>>>10&1023,r[n++]=h>>>20&1023,r[n++]=(h>>>30|(c&255)<<2)&1023,r[n++]=c>>>8&1023,r[n++]=c>>>18&1023,r[n++]=(c>>>28|(p&63)<<4)&1023,r[n++]=p>>>6&1023,r[n++]=p>>>16&1023,r[n++]=(p>>>26|(f&15)<<6)&1023,r[n++]=f>>>4&1023,r[n++]=f>>>14&1023,r[n++]=(f>>>24|(d&3)<<8)&1023,r[n++]=d>>>2&1023,r[n++]=d>>>12&1023,r[n]=d>>>22&1023}function Dw(t,e,r,i){let n=i,a=t[e]>>>0,s=t[e+1]>>>0,o=t[e+2]>>>0,l=t[e+3]>>>0,u=t[e+4]>>>0,h=t[e+5]>>>0,c=t[e+6]>>>0,p=t[e+7]>>>0,f=t[e+8]>>>0,d=t[e+9]>>>0,y=t[e+10]>>>0;r[n++]=a>>>0&2047,r[n++]=a>>>11&2047,r[n++]=(a>>>22|(s&1)<<10)&2047,r[n++]=s>>>1&2047,r[n++]=s>>>12&2047,r[n++]=(s>>>23|(o&3)<<9)&2047,r[n++]=o>>>2&2047,r[n++]=o>>>13&2047,r[n++]=(o>>>24|(l&7)<<8)&2047,r[n++]=l>>>3&2047,r[n++]=l>>>14&2047,r[n++]=(l>>>25|(u&15)<<7)&2047,r[n++]=u>>>4&2047,r[n++]=u>>>15&2047,r[n++]=(u>>>26|(h&31)<<6)&2047,r[n++]=h>>>5&2047,r[n++]=h>>>16&2047,r[n++]=(h>>>27|(c&63)<<5)&2047,r[n++]=c>>>6&2047,r[n++]=c>>>17&2047,r[n++]=(c>>>28|(p&127)<<4)&2047,r[n++]=p>>>7&2047,r[n++]=p>>>18&2047,r[n++]=(p>>>29|(f&255)<<3)&2047,r[n++]=f>>>8&2047,r[n++]=f>>>19&2047,r[n++]=(f>>>30|(d&511)<<2)&2047,r[n++]=d>>>9&2047,r[n++]=d>>>20&2047,r[n++]=(d>>>31|(y&1023)<<1)&2047,r[n++]=y>>>10&2047,r[n]=y>>>21&2047}function _w(t,e,r,i){let n=i,a=t[e]>>>0,s=t[e+1]>>>0,o=t[e+2]>>>0,l=t[e+3]>>>0,u=t[e+4]>>>0,h=t[e+5]>>>0,c=t[e+6]>>>0,p=t[e+7]>>>0,f=t[e+8]>>>0,d=t[e+9]>>>0,y=t[e+10]>>>0,m=t[e+11]>>>0;r[n++]=a>>>0&4095,r[n++]=a>>>12&4095,r[n++]=(a>>>24|(s&15)<<8)&4095,r[n++]=s>>>4&4095,r[n++]=s>>>16&4095,r[n++]=(s>>>28|(o&255)<<4)&4095,r[n++]=o>>>8&4095,r[n++]=o>>>20&4095,r[n++]=l>>>0&4095,r[n++]=l>>>12&4095,r[n++]=(l>>>24|(u&15)<<8)&4095,r[n++]=u>>>4&4095,r[n++]=u>>>16&4095,r[n++]=(u>>>28|(h&255)<<4)&4095,r[n++]=h>>>8&4095,r[n++]=h>>>20&4095,r[n++]=c>>>0&4095,r[n++]=c>>>12&4095,r[n++]=(c>>>24|(p&15)<<8)&4095,r[n++]=p>>>4&4095,r[n++]=p>>>16&4095,r[n++]=(p>>>28|(f&255)<<4)&4095,r[n++]=f>>>8&4095,r[n++]=f>>>20&4095,r[n++]=d>>>0&4095,r[n++]=d>>>12&4095,r[n++]=(d>>>24|(y&15)<<8)&4095,r[n++]=y>>>4&4095,r[n++]=y>>>16&4095,r[n++]=(y>>>28|(m&255)<<4)&4095,r[n++]=m>>>8&4095,r[n]=m>>>20&4095}function Aw(t,e,r,i){let n=i,a=t[e]>>>0,s=t[e+1]>>>0,o=t[e+2]>>>0,l=t[e+3]>>>0,u=t[e+4]>>>0,h=t[e+5]>>>0,c=t[e+6]>>>0,p=t[e+7]>>>0,f=t[e+8]>>>0,d=t[e+9]>>>0,y=t[e+10]>>>0,m=t[e+11]>>>0,g=t[e+12]>>>0,x=t[e+13]>>>0,b=t[e+14]>>>0,v=t[e+15]>>>0;r[n++]=a>>>0&65535,r[n++]=a>>>16&65535,r[n++]=s>>>0&65535,r[n++]=s>>>16&65535,r[n++]=o>>>0&65535,r[n++]=o>>>16&65535,r[n++]=l>>>0&65535,r[n++]=l>>>16&65535,r[n++]=u>>>0&65535,r[n++]=u>>>16&65535,r[n++]=h>>>0&65535,r[n++]=h>>>16&65535,r[n++]=c>>>0&65535,r[n++]=c>>>16&65535,r[n++]=p>>>0&65535,r[n++]=p>>>16&65535,r[n++]=f>>>0&65535,r[n++]=f>>>16&65535,r[n++]=d>>>0&65535,r[n++]=d>>>16&65535,r[n++]=y>>>0&65535,r[n++]=y>>>16&65535,r[n++]=m>>>0&65535,r[n++]=m>>>16&65535,r[n++]=g>>>0&65535,r[n++]=g>>>16&65535,r[n++]=x>>>0&65535,r[n++]=x>>>16&65535,r[n++]=b>>>0&65535,r[n++]=b>>>16&65535,r[n++]=v>>>0&65535,r[n]=v>>>16&65535}function Sw(t,e,r,i){let n=i,a=e;for(let s=0;s<8;s++){let o=t[a++]>>>0;r[n++]=o>>>0&1,r[n++]=o>>>1&1,r[n++]=o>>>2&1,r[n++]=o>>>3&1,r[n++]=o>>>4&1,r[n++]=o>>>5&1,r[n++]=o>>>6&1,r[n++]=o>>>7&1,r[n++]=o>>>8&1,r[n++]=o>>>9&1,r[n++]=o>>>10&1,r[n++]=o>>>11&1,r[n++]=o>>>12&1,r[n++]=o>>>13&1,r[n++]=o>>>14&1,r[n++]=o>>>15&1,r[n++]=o>>>16&1,r[n++]=o>>>17&1,r[n++]=o>>>18&1,r[n++]=o>>>19&1,r[n++]=o>>>20&1,r[n++]=o>>>21&1,r[n++]=o>>>22&1,r[n++]=o>>>23&1,r[n++]=o>>>24&1,r[n++]=o>>>25&1,r[n++]=o>>>26&1,r[n++]=o>>>27&1,r[n++]=o>>>28&1,r[n++]=o>>>29&1,r[n++]=o>>>30&1,r[n++]=o>>>31&1}}function Ew(t,e,r,i){let n=i,a=e;for(let s=0;s<8;s++){let o=t[a++]>>>0,l=t[a++]>>>0;r[n++]=o>>>0&3,r[n++]=o>>>2&3,r[n++]=o>>>4&3,r[n++]=o>>>6&3,r[n++]=o>>>8&3,r[n++]=o>>>10&3,r[n++]=o>>>12&3,r[n++]=o>>>14&3,r[n++]=o>>>16&3,r[n++]=o>>>18&3,r[n++]=o>>>20&3,r[n++]=o>>>22&3,r[n++]=o>>>24&3,r[n++]=o>>>26&3,r[n++]=o>>>28&3,r[n++]=o>>>30&3,r[n++]=l>>>0&3,r[n++]=l>>>2&3,r[n++]=l>>>4&3,r[n++]=l>>>6&3,r[n++]=l>>>8&3,r[n++]=l>>>10&3,r[n++]=l>>>12&3,r[n++]=l>>>14&3,r[n++]=l>>>16&3,r[n++]=l>>>18&3,r[n++]=l>>>20&3,r[n++]=l>>>22&3,r[n++]=l>>>24&3,r[n++]=l>>>26&3,r[n++]=l>>>28&3,r[n++]=l>>>30&3}}function Fw(t,e,r,i){let n=i,a=e;for(let s=0;s<8;s++){let o=t[a++]>>>0,l=t[a++]>>>0,u=t[a++]>>>0;r[n++]=o>>>0&7,r[n++]=o>>>3&7,r[n++]=o>>>6&7,r[n++]=o>>>9&7,r[n++]=o>>>12&7,r[n++]=o>>>15&7,r[n++]=o>>>18&7,r[n++]=o>>>21&7,r[n++]=o>>>24&7,r[n++]=o>>>27&7,r[n++]=(o>>>30|(l&1)<<2)&7,r[n++]=l>>>1&7,r[n++]=l>>>4&7,r[n++]=l>>>7&7,r[n++]=l>>>10&7,r[n++]=l>>>13&7,r[n++]=l>>>16&7,r[n++]=l>>>19&7,r[n++]=l>>>22&7,r[n++]=l>>>25&7,r[n++]=l>>>28&7,r[n++]=(l>>>31|(u&3)<<1)&7,r[n++]=u>>>2&7,r[n++]=u>>>5&7,r[n++]=u>>>8&7,r[n++]=u>>>11&7,r[n++]=u>>>14&7,r[n++]=u>>>17&7,r[n++]=u>>>20&7,r[n++]=u>>>23&7,r[n++]=u>>>26&7,r[n++]=u>>>29&7}}function Tw(t,e,r,i){let n=i,a=e;for(let s=0;s<8;s++){let o=t[a++]>>>0,l=t[a++]>>>0,u=t[a++]>>>0,h=t[a++]>>>0;r[n++]=o>>>0&15,r[n++]=o>>>4&15,r[n++]=o>>>8&15,r[n++]=o>>>12&15,r[n++]=o>>>16&15,r[n++]=o>>>20&15,r[n++]=o>>>24&15,r[n++]=o>>>28&15,r[n++]=l>>>0&15,r[n++]=l>>>4&15,r[n++]=l>>>8&15,r[n++]=l>>>12&15,r[n++]=l>>>16&15,r[n++]=l>>>20&15,r[n++]=l>>>24&15,r[n++]=l>>>28&15,r[n++]=u>>>0&15,r[n++]=u>>>4&15,r[n++]=u>>>8&15,r[n++]=u>>>12&15,r[n++]=u>>>16&15,r[n++]=u>>>20&15,r[n++]=u>>>24&15,r[n++]=u>>>28&15,r[n++]=h>>>0&15,r[n++]=h>>>4&15,r[n++]=h>>>8&15,r[n++]=h>>>12&15,r[n++]=h>>>16&15,r[n++]=h>>>20&15,r[n++]=h>>>24&15,r[n++]=h>>>28&15}}function kw(t,e,r,i){let n=i,a=e;for(let s=0;s<8;s++){let o=t[a++]>>>0,l=t[a++]>>>0,u=t[a++]>>>0,h=t[a++]>>>0,c=t[a++]>>>0;r[n++]=o>>>0&31,r[n++]=o>>>5&31,r[n++]=o>>>10&31,r[n++]=o>>>15&31,r[n++]=o>>>20&31,r[n++]=o>>>25&31,r[n++]=(o>>>30|(l&7)<<2)&31,r[n++]=l>>>3&31,r[n++]=l>>>8&31,r[n++]=l>>>13&31,r[n++]=l>>>18&31,r[n++]=l>>>23&31,r[n++]=(l>>>28|(u&1)<<4)&31,r[n++]=u>>>1&31,r[n++]=u>>>6&31,r[n++]=u>>>11&31,r[n++]=u>>>16&31,r[n++]=u>>>21&31,r[n++]=u>>>26&31,r[n++]=(u>>>31|(h&15)<<1)&31,r[n++]=h>>>4&31,r[n++]=h>>>9&31,r[n++]=h>>>14&31,r[n++]=h>>>19&31,r[n++]=h>>>24&31,r[n++]=(h>>>29|(c&3)<<3)&31,r[n++]=c>>>2&31,r[n++]=c>>>7&31,r[n++]=c>>>12&31,r[n++]=c>>>17&31,r[n++]=c>>>22&31,r[n++]=c>>>27&31}}function Iw(t,e,r,i){let n=i,a=e;for(let s=0;s<8;s++){let o=t[a++]>>>0,l=t[a++]>>>0,u=t[a++]>>>0,h=t[a++]>>>0,c=t[a++]>>>0,p=t[a++]>>>0;r[n++]=o>>>0&63,r[n++]=o>>>6&63,r[n++]=o>>>12&63,r[n++]=o>>>18&63,r[n++]=o>>>24&63,r[n++]=(o>>>30|(l&15)<<2)&63,r[n++]=l>>>4&63,r[n++]=l>>>10&63,r[n++]=l>>>16&63,r[n++]=l>>>22&63,r[n++]=(l>>>28|(u&3)<<4)&63,r[n++]=u>>>2&63,r[n++]=u>>>8&63,r[n++]=u>>>14&63,r[n++]=u>>>20&63,r[n++]=u>>>26&63,r[n++]=h>>>0&63,r[n++]=h>>>6&63,r[n++]=h>>>12&63,r[n++]=h>>>18&63,r[n++]=h>>>24&63,r[n++]=(h>>>30|(c&15)<<2)&63,r[n++]=c>>>4&63,r[n++]=c>>>10&63,r[n++]=c>>>16&63,r[n++]=c>>>22&63,r[n++]=(c>>>28|(p&3)<<4)&63,r[n++]=p>>>2&63,r[n++]=p>>>8&63,r[n++]=p>>>14&63,r[n++]=p>>>20&63,r[n++]=p>>>26&63}}function Cw(t,e,r,i){let n=i,a=e;for(let s=0;s<8;s++){let o=t[a++]>>>0,l=t[a++]>>>0,u=t[a++]>>>0,h=t[a++]>>>0,c=t[a++]>>>0,p=t[a++]>>>0,f=t[a++]>>>0;r[n++]=o>>>0&127,r[n++]=o>>>7&127,r[n++]=o>>>14&127,r[n++]=o>>>21&127,r[n++]=(o>>>28|(l&7)<<4)&127,r[n++]=l>>>3&127,r[n++]=l>>>10&127,r[n++]=l>>>17&127,r[n++]=l>>>24&127,r[n++]=(l>>>31|(u&63)<<1)&127,r[n++]=u>>>6&127,r[n++]=u>>>13&127,r[n++]=u>>>20&127,r[n++]=(u>>>27|(h&3)<<5)&127,r[n++]=h>>>2&127,r[n++]=h>>>9&127,r[n++]=h>>>16&127,r[n++]=h>>>23&127,r[n++]=(h>>>30|(c&31)<<2)&127,r[n++]=c>>>5&127,r[n++]=c>>>12&127,r[n++]=c>>>19&127,r[n++]=(c>>>26|(p&1)<<6)&127,r[n++]=p>>>1&127,r[n++]=p>>>8&127,r[n++]=p>>>15&127,r[n++]=p>>>22&127,r[n++]=(p>>>29|(f&15)<<3)&127,r[n++]=f>>>4&127,r[n++]=f>>>11&127,r[n++]=f>>>18&127,r[n++]=f>>>25&127}}function Mw(t,e,r,i){let n=i,a=e;for(let s=0;s<8;s++){let o=t[a++]>>>0,l=t[a++]>>>0,u=t[a++]>>>0,h=t[a++]>>>0,c=t[a++]>>>0,p=t[a++]>>>0,f=t[a++]>>>0,d=t[a++]>>>0;r[n++]=o>>>0&255,r[n++]=o>>>8&255,r[n++]=o>>>16&255,r[n++]=o>>>24&255,r[n++]=l>>>0&255,r[n++]=l>>>8&255,r[n++]=l>>>16&255,r[n++]=l>>>24&255,r[n++]=u>>>0&255,r[n++]=u>>>8&255,r[n++]=u>>>16&255,r[n++]=u>>>24&255,r[n++]=h>>>0&255,r[n++]=h>>>8&255,r[n++]=h>>>16&255,r[n++]=h>>>24&255,r[n++]=c>>>0&255,r[n++]=c>>>8&255,r[n++]=c>>>16&255,r[n++]=c>>>24&255,r[n++]=p>>>0&255,r[n++]=p>>>8&255,r[n++]=p>>>16&255,r[n++]=p>>>24&255,r[n++]=f>>>0&255,r[n++]=f>>>8&255,r[n++]=f>>>16&255,r[n++]=f>>>24&255,r[n++]=d>>>0&255,r[n++]=d>>>8&255,r[n++]=d>>>16&255,r[n++]=d>>>24&255}}function Bw(t,e,r,i){let n=i,a=e;for(let s=0;s<128;s++){let o=t[a++]>>>0;r[n++]=o&65535,r[n++]=o>>>16&65535}}function Pw(t,e,r,i,n){let a=sl[n]>>>0,s=e,o=0,l=t[s]>>>0,u=i;for(let h=0;h<8;h++){for(let c=0;c<32;c++)if(o+n<=32){let p=l>>>o&a;r[u+c]=p|0,o+=n,o===32&&(o=0,s++,c!==31&&(l=t[s]>>>0))}else{let p=32-o,f=l>>>o;s++,l=t[s]>>>0;let d=n-p,y=-1>>>32-d>>>0,m=(f|(l&y)<<p)&a;r[u+c]=m|0,o=d}u+=32,o=0,h<7&&(l=t[s]>>>0)}}var ol=cw(_y),zw=3*ol/256+ol|0;function Ay(){let t=new Uint8Array(zw);return{dataToBePacked:Array(33),dataPointers:new Int32Array(33),byteContainer:t,byteContainerI32:new Int32Array(t.buffer,t.byteOffset,t.byteLength>>>2),exceptionSizes:new Int32Array(33)}}function Lw(t=16){if(t<0)throw RangeError(`initialEncodedWordCapacity must be >= 0, got ${t}`);let e=Math.max(16,t|0);return{encodedWords:new Uint32Array(e),decoderWorkspace:Ay()}}function Vw(t,e){if(e<=t.encodedWords.length)return t.encodedWords;let r=new Uint32Array(Math.max(16,e*2));return t.encodedWords=r,r}function Ow(t,e,r,i){i.byteContainer.length<r&&(i.byteContainer=new Uint8Array(r*2),i.byteContainerI32=void 0);let n=i.byteContainer,a=r>>>2;if(n.byteOffset&3)for(let o=0;o<a;o=o+1|0){let l=t[e+o|0]|0,u=o<<2;n[u]=l&255,n[u+1|0]=l>>>8&255,n[u+2|0]=l>>>16&255,n[u+3|0]=l>>>24&255}else{let o=i.byteContainerI32;(!o||o.buffer!==n.buffer||o.byteOffset!==n.byteOffset||o.length<a)&&(o=i.byteContainerI32=new Int32Array(n.buffer,n.byteOffset,n.byteLength>>>2)),o.set(t.subarray(e,e+a))}let s=r&3;if(s>0){let o=t[e+a|0]|0,l=a<<2;for(let u=0;u<s;u=u+1|0)n[l+u|0]=o>>>(u<<3)&255}return n}function Rw(t,e,r){let i=t[e++]|0,n=r.dataToBePacked;for(let a=2;a<=32;a=a+1|0){if(!(i>>>a-1&1))continue;if(e>=t.length)throw Error(`FastPFOR decode: truncated exception stream header (bitWidth=${a}, streamWordIndex=${e}, needWords=1, availableWords=${t.length-e}, encodedWords=${t.length})`);let s=t[e++]>>>0,o=hw(s),l=s*a+31>>>5;if(e+l>t.length)throw Error(`FastPFOR decode: truncated exception stream (bitWidth=${a}, size=${s}, streamWordIndex=${e}, needWords=${l}, availableWords=${t.length-e}, encodedWords=${t.length})`);let u=n[a];(!u||u.length<o)&&(u=n[a]=new Uint32Array(o));let h=0;for(;h<s;h=h+32|0)Zw(t,e,u,h,a),e=e+a|0;let c=h-s|0;e=e-(c*a>>>5)|0,r.exceptionSizes[a]=s}return e}function $w(t,e,r,i,n){switch(n){case 1:Sw(t,e,r,i);break;case 2:Ew(t,e,r,i);break;case 3:Fw(t,e,r,i);break;case 4:Tw(t,e,r,i);break;case 5:kw(t,e,r,i);break;case 6:Iw(t,e,r,i);break;case 7:Cw(t,e,r,i);break;case 8:Mw(t,e,r,i);break;case 16:Bw(t,e,r,i);break;default:Pw(t,e,r,i,n)}return e+(n<<3)|0}function Nw(t,e,r,i){if(r+2>e)throw Error(`FastPFOR decode: byteContainer underflow at block=${i} (need 2 bytes for [bitWidth, exceptionCount], bytePos=${r}, byteSize=${e})`);let n=t[r++],a=t[r++];if(n>32)throw Error(`FastPFOR decode: invalid bitWidth=${n} at block=${i} (expected 0..32). This likely indicates corrupted or truncated input.`);return{bitWidth:n,exceptionCount:a,bytePosIn:r}}function Uw(t,e,r,i,n,a){if(r+1>e)throw Error(`FastPFOR decode: exception header underflow at block=${a} (need 1 byte for maxBits, bytePos=${r}, byteSize=${e})`);let s=t[r++];if(s<i||s>32)throw Error(`FastPFOR decode: invalid maxBits=${s} at block=${a} (bitWidth=${i}, expected ${i}..32)`);let o=s-i|0;if(o<1||o>32)throw Error(`FastPFOR decode: invalid exceptionBitWidth=${o} at block=${a} (bitWidth=${i}, maxBits=${s})`);if(r+n>e)throw Error(`FastPFOR decode: exception positions underflow at block=${a} (need=${n}, have=${e-r})`);return{maxBits:s,exceptionBitWidth:o,bytePosIn:r}}function qw(t,e,r,i,n,a,s,o,l){let{maxBits:u,exceptionBitWidth:h,bytePosIn:c}=Uw(n,a,s,r,i,l);if(s=c,h===1){let m=1<<r;for(let g=0;g<i;g=g+1|0){let x=n[s++];t[x+e|0]|=m}return s}let p=o.dataToBePacked[h];if(!p)throw Error(`FastPFOR decode: missing exception stream for exceptionBitWidth=${h} (bitWidth=${r}, maxBits=${u}) at block ${l}`);let f=o.dataPointers,d=f[h]|0,y=o.exceptionSizes[h]|0;if(d+i>y)throw Error(`FastPFOR decode: exception stream overflow for exceptionBitWidth=${h} (ptr=${d}, need ${i}, size=${y}) at block ${l}`);for(let m=0;m<i;m=m+1|0){let g=n[s++],x=p[d++]|0;t[g+e|0]|=x<<r}return f[h]=d,s}function jw(t,e,r,i,n,a,s,o,l,u){let h=r|0,c=0;for(let p=0;p<s;p=p+1|0){let f=Nw(o,l,c,p);c=f.bytePosIn;let d=f.bitWidth,y=f.exceptionCount,m=a+p*256|0;switch(d){case 0:n.fill(0,m,m+256);break;case 32:for(let g=0;g<256;g=g+1|0)n[m+g|0]=t[h+g|0]|0;h=h+256|0;break;default:h=$w(t,h,n,m,d)}y>0&&(c=qw(n,m,d,y,o,l,c,u,p))}if(h!==i)throw Error(`FastPFOR decode: packed region mismatch (pageStart=${e}, packedStart=${r}, consumedPackedEnd=${h}, expectedPackedEnd=${i}, packedWords=${i-r}, encoded.length=${t.length})`)}function Gw(t,e,r,i,n,a){let s=r|0,o=t[s]|0;if(o<=0||s+o>t.length-1)throw Error(`FastPFOR decode: invalid whereMeta=${o} at pageStart=${s} (expected > 0 and pageStart+whereMeta < encoded.length=${t.length})`);let l=s+1|0,u=s+o|0,h=t[u]>>>0,c=h+3>>>2,p=u+1,f=p+c;if(f>=t.length)throw Error(`FastPFOR decode: invalid byteSize=${h} (metaInts=${c}, pageStart=${s}, packedEnd=${u}, byteContainerStart=${p}) causes bitmapPos=${f} out of bounds (encoded.length=${t.length})`);let d=Ow(t,p,h,a),y=h,m=Rw(t,f,a);return a.dataPointers.fill(0),jw(t,s,l,u,e,i|0,n/256|0,d,y,a),m}function Yw(t,e,r,i,n,a){let s=i+du(n,256),o=i,l=r;for(;o!==s;){let u=Math.min(ol,s-o);l=Gw(t,e,l,o,u,a),o=o+u|0}return l}function Xw(t,e,r,i,n,a){if(a===0)return e;let s=0,o=e,l=e+r,u=n,h=n,c=n+a,p=0,f=0;for(;o<l&&h<c;){let d=t[o]>>>s&255;if(s+=8,o+=s>>>5,s&=31,p|=(d&127)<<f,d&128)i[h++]=p|0,p=0,f=0;else if(f+=7,f>28)throw Error(`FastPFOR VByte: unterminated value (expected MSB=1 terminator within 5 bytes; shift=${f}, partial=${p}, decoded=${h-u}/${a}, inPos=${o}, inEnd=${l})`)}if(h!==c)throw Error(`FastPFOR VByte: truncated stream (decoded=${h-u}, expected=${a}, consumedWords=${o-e}/${r}, vbyteStart=${e}, vbyteEnd=${l})`);return o}function Ww(t,e,r){let i=0,n=0,a=new Uint32Array(e),s=r??Ay();if(t.length>0){let u=t[i]|0;if(i=i+1|0,u&255)throw Error(`FastPFOR decode: invalid alignedLength=${u} (expected multiple of 256)`);if(n+u>a.length)throw Error(`FastPFOR decode: output buffer too small (outPos=${n}, alignedLength=${u}, out.length=${a.length})`);i=Yw(t,a,i,n,u,s),n=n+u|0}let o=t.length-i|0,l=e-n|0;return Xw(t,i,o,a,n,l),a}function Zw(t,e,r,i,n){switch(n){case 2:fw(t,e,r,i);return;case 3:dw(t,e,r,i);return;case 4:yw(t,e,r,i);return;case 5:mw(t,e,r,i);return;case 6:gw(t,e,r,i);return;case 7:xw(t,e,r,i);return;case 8:vw(t,e,r,i);return;case 9:bw(t,e,r,i);return;case 10:ww(t,e,r,i);return;case 11:Dw(t,e,r,i);return;case 12:_w(t,e,r,i);return;case 16:Aw(t,e,r,i);return;case 32:for(let u=0;u<32;u=u+1|0)r[i+u|0]=t[e+u|0]|0;return}let a=sl[n]>>>0,s=e,o=0,l=t[s]>>>0;for(let u=0;u<32;u++)if(o+n<=32){let h=l>>>o&a;r[i+u]=h|0,o+=n,o===32&&(o=0,s++,u!==31&&(l=t[s]>>>0))}else{let h=32-o,c=l>>>o;s++,l=t[s]>>>0;let p=sl[n-h]>>>0,f=(c|(l&p)<<h)&a;r[i+u]=f|0,o=n-h}}function Hw(t,e,r,i){if(e<0||r<0||e+r>t.length)throw RangeError(`decodeBigEndianInt32sInto: out of bounds (offset=${e}, byteLength=${r}, bytes.length=${t.length})`);let n=Math.floor(r/4),a=r%4!=0,s=a?n+1:n;if(i.length<s)throw RangeError(`decodeBigEndianInt32sInto: out.length=${i.length} < ${s}`);if(n>0){let o=t.byteOffset+e;if(o&3)for(let l=0;l<n;l++){let u=e+l*4;i[l]=t[u]<<24|t[u+1]<<16|t[u+2]<<8|t[u+3]|0}else{let l=new Uint32Array(t.buffer,o,n);for(let u=0;u<n;u++)i[u]=pw(l[u])|0}}if(a){let o=e+n*4,l=r-n*4,u=0;for(let h=0;h<l;h++)u|=t[o+h]<<24-h*8;i[n]=u|0}return s}function Rt(t,e,r){let i=new Uint32Array(r),n=0,a=e.get();for(let s=0;s<i.length;s++){let o=t[a++],l=o&127;if(o<128){i[n++]=l;continue}if(o=t[a++],l|=(o&127)<<7,o<128){i[n++]=l;continue}if(o=t[a++],l|=(o&127)<<14,o<128){i[n++]=l;continue}if(o=t[a++],l|=(o&127)<<21,o<128){i[n++]=l;continue}o=t[a++],l|=(o&15)<<28,i[n++]=l}return e.set(a),i}function yu(t,e,r){let i=new BigUint64Array(r);for(let n=0;n<i.length;n++)i[n]=Kw(t,e);return i}function Kw(t,e){let r=0n,i=0,n=e.get();for(;n<t.length;){let a=t[n++];if(r|=BigInt(a&127)<<BigInt(i),!(a&128))break;if(i+=7,i>=64)throw Error(\"Varint too long\")}return e.set(n),r}function Jw(t,e,r){let i=new Float64Array(r);for(let n=0;n<r;n++)i[n]=Qw(t,e);return i}function Qw(t,e){let r,i;return i=t[e.get()],e.increment(),r=i&127,i<128||(i=t[e.get()],e.increment(),r|=(i&127)<<7,i<128)||(i=t[e.get()],e.increment(),r|=(i&127)<<14,i<128)||(i=t[e.get()],e.increment(),r|=(i&127)<<21,i<128)?r:(i=t[e.get()],r|=(i&15)<<28,t3(r,t,e))}function t3(t,e,r){let i,n;if(n=e[r.get()],r.increment(),i=(n&112)>>4,n<128||(n=e[r.get()],r.increment(),i|=(n&127)<<3,n<128)||(n=e[r.get()],r.increment(),i|=(n&127)<<10,n<128)||(n=e[r.get()],r.increment(),i|=(n&127)<<17,n<128)||(n=e[r.get()],r.increment(),i|=(n&127)<<24,n<128)||(n=e[r.get()],r.increment(),i|=(n&1)<<31,n<128))return i*4294967296+(t>>>0);throw Error(\"Expected varint not more than 10 bytes\")}function e3(t,e,r,i){return r3(t,e,r,i,Lw(r>>>2))}function r3(t,e,r,i,n){let a=i.get();if(r&3)throw Error(`FastPFOR: invalid encodedByteLength=${r} at offset=${a} (encodedBytes.length=${t.length}; expected a multiple of 4 bytes for an int32 big-endian word stream)`);let s=r>>>2,o=Vw(n,s);Hw(t,a,r,o);let l=Ww(o.subarray(0,s),e,n.decoderWorkspace);return i.add(r),l}function et(t){return t>>>1^-(t&1)}function Ot(t){return t>>1n^-(t&1n)}function Ge(t){return t%2==1?(t+1)/-2:t/2}function i3(t){let e=new Int32Array(t.length);for(let r=0;r<t.length;r++)e[r]=et(t[r]);return e}function n3(t){let e=new BigInt64Array(t.length);for(let r=0;r<t.length;r++)e[r]=Ot(t[r]);return e}function a3(t){for(let e=0;e<t.length;e++)t[e]=Ge(t[e])}function ll(t,e,r){if(r===void 0){r=0;for(let a=0;a<e;a++)r+=t[a]}let i=new Uint32Array(r),n=0;for(let a=0;a<e;a++){let s=t[a],o=t[a+e];i.fill(o,n,n+s),n+=s}return i}function ul(t,e,r){if(r===void 0){r=0;for(let a=0;a<e;a++)r+=Number(t[a])}let i=new BigUint64Array(r),n=0;for(let a=0;a<e;a++){let s=Number(t[a]),o=t[a+e];i.fill(o,n,n+s),n+=s}return i}function Sy(t,e,r){let i=new Float64Array(r),n=0;for(let a=0;a<e;a++){let s=t[a],o=t[a+e];i.fill(o,n,n+s),n+=s}return i}function Kc(t){let e=new Int32Array(t.length);e[0]=et(t[0]);let r=t.length/4*4,i=1;if(r>=4)for(;i<r-4;i+=4){let n=t[i],a=t[i+1],s=t[i+2],o=t[i+3];e[i]=et(n)+e[i-1],e[i+1]=et(a)+e[i],e[i+2]=et(s)+e[i+1],e[i+3]=et(o)+e[i+2]}for(;i!==t.length;++i)e[i]=et(t[i])+e[i-1];return e}function Jc(t){let e=new BigInt64Array(t.length);e[0]=Ot(t[0]);let r=t.length/4*4,i=1;if(r>=4)for(;i<r-4;i+=4){let n=t[i],a=t[i+1],s=t[i+2],o=t[i+3];e[i]=Ot(n)+e[i-1],e[i+1]=Ot(a)+e[i],e[i+2]=Ot(s)+e[i+1],e[i+3]=Ot(o)+e[i+2]}for(;i!==e.length;++i)e[i]=Ot(t[i])+e[i-1];return e}function s3(t){t[0]=Ge(t[0]);let e=t.length/4*4,r=1;if(e>=4)for(;r<e-4;r+=4){let i=t[r],n=t[r+1],a=t[r+2],s=t[r+3];t[r]=Ge(i)+t[r-1],t[r+1]=Ge(n)+t[r],t[r+2]=Ge(a)+t[r+1],t[r+3]=Ge(s)+t[r+2]}for(;r!==t.length;++r)t[r]=Ge(t[r])+t[r-1]}function o3(t,e,r){if(r===void 0){r=0;for(let a=0;a<e;a++)r+=t[a]}let i=new Int32Array(r),n=0;for(let a=0;a<e;a++){let s=t[a],o=t[a+e];o=et(o),i.fill(o,n,n+s),n+=s}return i}function l3(t,e,r){if(r===void 0){r=0;for(let a=0;a<e;a++)r+=Number(t[a])}let i=new BigInt64Array(r),n=0;for(let a=0;a<e;a++){let s=Number(t[a]),o=t[a+e];o=Ot(o),i.fill(o,n,n+s),n+=s}return i}function u3(t,e,r){let i=new Float64Array(r),n=0;for(let a=0;a<e;a++){let s=t[a],o=t[a+e];o=Ge(o),i.fill(o,n,n+s),n+=s}return i}function mu(t){let e=t.length/4*4,r=1;if(e>=4)for(let i=t[0];r<e-4;r+=4)i=t[r]+=i,i=t[r+1]+=i,i=t[r+2]+=i,i=t[r+3]+=i;for(;r!==t.length;)t[r]+=t[r-1],++r}function h3(t){let e=0;for(let r=0;r<t.length;r++)t[r]+=e,e=t[r]}function c3(t){if(t.length<2)return new Int32Array(t);let e=new Int32Array(t.length);e[0]=et(t[0]),e[1]=et(t[1]);let r=t.length/4*4,i=2;if(r>=4)for(;i<r-4;i+=4){let n=t[i],a=t[i+1],s=t[i+2],o=t[i+3];e[i]=et(n)+e[i-2],e[i+1]=et(a)+e[i-1],e[i+2]=et(s)+e[i],e[i+3]=et(o)+e[i+1]}for(;i!==t.length;i+=2)e[i]=et(t[i])+e[i-2],e[i+1]=et(t[i+1])+e[i-1];return e}function Ey(t,e,r,i){if(t.length<2)return new Int32Array(t);let n=new Int32Array(t.length),a=et(t[0]),s=et(t[1]);n[0]=qe(Math.round(a*e),r,i),n[1]=qe(Math.round(s*e),r,i);let o=t.length/16,l=2;if(o>=4)for(;l<o-4;l+=4){let u=t[l],h=t[l+1],c=et(u)+a,p=et(h)+s;n[l]=qe(Math.round(c*e),r,i),n[l+1]=qe(Math.round(p*e),r,i);let f=t[l+2],d=t[l+3];a=et(f)+c,s=et(d)+p,n[l+2]=qe(Math.round(a*e),r,i),n[l+3]=qe(Math.round(s*e),r,i)}for(;l!==t.length;l+=2)a+=et(t[l]),s+=et(t[l+1]),n[l]=qe(Math.round(a*e),r,i),n[l+1]=qe(Math.round(s*e),r,i);return n}function qe(t,e,r){return Math.min(r,Math.max(e,t))}function p3(t){let e=new Int32Array(t.length+1);e[0]=0,e[1]=et(t[0]);let r=e[1];for(let i=2;i!==e.length;++i){let n=t[i-1],a=et(n);r+=a,e[i]=e[i-1]+r}return new Uint32Array(e)}function f3(t,e,r){let i=new Int32Array(r+1);i[0]=0;let n=1,a=i[0];for(let s=0;s<e;s++){let o=t[s],l=t[s+e];l=et(l);for(let u=n;u<n+o;u++)i[u]=l+a,a=i[u];n+=o}return i}function d3(t,e,r){let i=new Uint32Array(r+1);i[0]=0;let n=1,a=i[0];for(let s=0;s<e;s++){let o=t[s],l=t[s+e];for(let u=n;u<n+o;u++)i[u]=l+a,a=i[u];n+=o}return i}function y3(t,e,r){let i=new Int32Array(r),n=0,a=0;for(let s=0;s<e;s++){let o=t[s],l=t[s+e],u=et(l);for(let h=0;h<o;h++)a+=u,i[n++]=a}return i}function m3(t,e,r){let i=new BigInt64Array(r),n=0,a=0n;for(let s=0;s<e;s++){let o=Number(t[s]),l=t[s+e],u=Ot(l);for(let h=0;h<o;h++)a+=u,i[n++]=a}return i}function Qc(t){let e=new Uint32Array(t.length);e[0]=et(t[0])>>>0;for(let r=1;r<t.length;r++)e[r]=e[r-1]+et(t[r])>>>0;return e}function tp(t){let e=new BigUint64Array(t.length);e[0]=BigInt.asUintN(64,Ot(t[0]));for(let r=1;r<t.length;r++)e[r]=BigInt.asUintN(64,e[r-1]+Ot(t[r]));return e}function g3(t){if(t.length<2)return new Uint32Array(t);let e=new Uint32Array(t.length);e[0]=et(t[0])>>>0,e[1]=et(t[1])>>>0;for(let r=2;r<t.length;r+=2)e[r]=e[r-2]+et(t[r])>>>0,e[r+1]=e[r-1]+et(t[r+1])>>>0;return e}function x3(t,e,r,i){let n=Ey(t,e,r,i);return new Uint32Array(n)}function v3(t){return t[1]}function b3(t){return et(t[1])}function w3(t){if(t.length===2){let e=et(t[1]);return[e,e]}return[et(t[2]),et(t[3])]}function D3(t){return t[1]}function _3(t){return Ot(t[1])}function A3(t){if(t.length===2){let e=Ot(t[1]);return[e,e]}return[Ot(t[2]),Ot(t[3])]}var _t;(function(t){t.PRESENT=\"PRESENT\",t.DATA=\"DATA\",t.OFFSET=\"OFFSET\",t.LENGTH=\"LENGTH\"})(_t||(_t={}));var Ut;(function(t){t.NONE=\"NONE\",t.SINGLE=\"SINGLE\",t.SHARED=\"SHARED\",t.VERTEX=\"VERTEX\",t.MORTON=\"MORTON\",t.FSST=\"FSST\"})(Ut||(Ut={}));var xe;(function(t){t.VERTEX=\"VERTEX\",t.INDEX=\"INDEX\",t.STRING=\"STRING\",t.KEY=\"KEY\"})(xe||(xe={}));var Et;(function(t){t.VAR_BINARY=\"VAR_BINARY\",t.GEOMETRIES=\"GEOMETRIES\",t.PARTS=\"PARTS\",t.RINGS=\"RINGS\",t.TRIANGLES=\"TRIANGLES\",t.SYMBOL=\"SYMBOL\",t.DICTIONARY=\"DICTIONARY\"})(Et||(Et={}));var S3=[_t.PRESENT,_t.DATA,_t.OFFSET,_t.LENGTH],ep=[W.NONE,W.DELTA,W.COMPONENTWISE_DELTA,W.RLE,W.MORTON],E3=[Qt.NONE,Qt.FAST_PFOR,Qt.VARINT],F3=[Ut.NONE,Ut.SINGLE,Ut.SHARED,Ut.VERTEX,Ut.MORTON,Ut.FSST],T3=[xe.VERTEX,xe.INDEX,xe.STRING,xe.KEY],k3=[Et.VAR_BINARY,Et.GEOMETRIES,Et.PARTS,Et.RINGS,Et.TRIANGLES,Et.SYMBOL,Et.DICTIONARY];function ht(t,e){let r=M3(t,e);return r.logicalLevelTechnique1===W.MORTON?I3(r,t,e):(W.RLE===r.logicalLevelTechnique1||W.RLE===r.logicalLevelTechnique2)&&Qt.NONE!==r.physicalLevelTechnique?C3(r,t,e):r}function I3(t,e,r){let i=Rt(e,r,2);return{physicalStreamType:t.physicalStreamType,logicalStreamType:t.logicalStreamType,logicalLevelTechnique1:t.logicalLevelTechnique1,logicalLevelTechnique2:t.logicalLevelTechnique2,physicalLevelTechnique:t.physicalLevelTechnique,numValues:t.numValues,byteLength:t.byteLength,decompressedCount:t.decompressedCount,numBits:i[0],coordinateShift:i[1]}}function C3(t,e,r){let i=Rt(e,r,2);return{physicalStreamType:t.physicalStreamType,logicalStreamType:t.logicalStreamType,logicalLevelTechnique1:t.logicalLevelTechnique1,logicalLevelTechnique2:t.logicalLevelTechnique2,physicalLevelTechnique:t.physicalLevelTechnique,numValues:t.numValues,byteLength:t.byteLength,decompressedCount:i[1],runs:i[0],numRleValues:i[1]}}function M3(t,e){let r=t[e.get()],i=S3[r>>4],n={};switch(i){case _t.DATA:n={dictionaryType:F3[r&15]};break;case _t.OFFSET:n={offsetType:T3[r&15]};break;case _t.LENGTH:n={lengthType:k3[r&15]}}e.increment();let a=t[e.get()],s=ep[a>>5],o=ep[a>>2&7],l=E3[a&3];e.increment();let u=Rt(t,e,2),h=u[0],c=u[1];return{physicalStreamType:i,logicalStreamType:n,logicalLevelTechnique1:s,logicalLevelTechnique2:o,physicalLevelTechnique:l,numValues:h,byteLength:c,decompressedCount:h}}var lt;(function(t){t[t.FLAT=0]=\"FLAT\",t[t.CONST=1]=\"CONST\",t[t.SEQUENCE=2]=\"SEQUENCE\",t[t.DICTIONARY=3]=\"DICTIONARY\",t[t.FSST_DICTIONARY=4]=\"FSST_DICTIONARY\"})(lt||(lt={}));var ce=class{constructor(t,e){this.values=t,this._size=e}get(t){let e=Math.floor(t/8),r=t%8;return(this.values[e]>>r&1)==1}set(t,e){let r=Math.floor(t/8),i=t%8;this.values[r]=this.values[r]|+!!e<<i}getInt(t){let e=Math.floor(t/8),r=t%8;return this.values[e]>>r&1}size(){return this._size}getBuffer(){return this.values}};function Ar(t,e,r){if(!e)return t;let i=e.size(),n=t.constructor,a=new n(i),s=0;for(let o=0;o<i;o++)a[o]=e.get(o)?t[s++]:r;return a}function B3(t,e,r){if(!r)return t;let i=r.size(),n=new ce(t,e),a=new ce(new Uint8Array(Math.ceil(i/8)),i),s=0;for(let o=0;o<i;o++){let l=r.get(o)?n.get(s++):!1;a.set(o,l)}return a.getBuffer()}function Fy(t,e,r){for(let i=0;i<t;i++){let n=ht(e,r);r.add(n.byteLength)}}function ui(t,e,r,i,n){let a=P3(t,Math.ceil(e/8),r,i);return n?B3(a,e,n):a}function P3(t,e,r,i){let n=new Uint8Array(e),a=0,s=i.get()+r;for(;a<e&&!(i.get()>=s);){let o=t[i.increment()];if(o<=127){let l=o+3,u=t[i.increment()],h=Math.min(a+l,e);n.fill(u,a,h),a=h}else{let l=256-o;for(let u=0;u<l&&a<e;u++)n[a++]=t[i.increment()]}}return i.set(s),n}function Ty(t,e,r,i){let n=e.get(),a=n+r*Float32Array.BYTES_PER_ELEMENT,s=new Uint8Array(t.subarray(n,a)).buffer,o=new Float32Array(s);return e.set(a),i?Ar(o,i,0):o}function ky(t,e,r,i){let n=e.get(),a=n+r*Float64Array.BYTES_PER_ELEMENT,s=new Uint8Array(t.subarray(n,a)).buffer,o=new Float64Array(s);return e.set(a),i?Ar(o,i,0):o}function z3(t,e,r){let i=e.get(),n=r*Uint32Array.BYTES_PER_ELEMENT,a=new DataView(t.buffer,t.byteOffset,t.byteLength),s=new Uint32Array(r);for(let o=0;o<r;o++)s[o]=a.getUint32(i+o*Uint32Array.BYTES_PER_ELEMENT,!0);return e.add(n),s}function L3(t,e,r){let i=e.get(),n=r*BigUint64Array.BYTES_PER_ELEMENT,a=new DataView(t.buffer,t.byteOffset,t.byteLength),s=new BigUint64Array(r);for(let o=0;o<r;o++)s[o]=a.getBigUint64(i+o*BigUint64Array.BYTES_PER_ELEMENT,!0);return e.add(n),s}var V3=new TextDecoder;function gu(t,e,r){return r-e>=12?V3.decode(t.subarray(e,r)):O3(t,e,r)}function O3(t,e,r){let i=\"\",n=e;for(;n<r;){let a=t[n],s=null,o=a>239?4:a>223?3:a>191?2:1;if(n+o>r)break;let l,u,h;o===1?a<128&&(s=a):o===2?(l=t[n+1],(l&192)==128&&(s=(a&31)<<6|l&63,s<=127&&(s=null))):o===3?(l=t[n+1],u=t[n+2],(l&192)==128&&(u&192)==128&&(s=(a&15)<<12|(l&63)<<6|u&63,(s<=2047||s>=55296&&s<=57343)&&(s=null))):o===4&&(l=t[n+1],u=t[n+2],h=t[n+3],(l&192)==128&&(u&192)==128&&(h&192)==128&&(s=(a&15)<<18|(l&63)<<12|(u&63)<<6|h&63,(s<=65535||s>=1114112)&&(s=null))),s===null?(s=65533,o=1):s>65535&&(s-=65536,i+=String.fromCharCode(s>>>10&1023|55296),s=56320|s&1023),i+=String.fromCharCode(s),n+=o}return i}function _a(t,e,r,i,n){return q3(hi(t,e,r),r,i,n)}function Vt(t,e,r,i,n){return j3(hi(t,e,r),r,i,n)}function Ye(t,e,r){return Y3(hi(t,e,r),r)}function hi(t,e,r){let i=r.physicalLevelTechnique;switch(i){case Qt.FAST_PFOR:return e3(t,r.numValues,r.byteLength,e);case Qt.VARINT:return Rt(t,e,r.numValues);case Qt.NONE:return z3(t,e,r.numValues);default:throw Error(`Specified physicalLevelTechnique ${i} is not supported (yet).`)}}function bn(t,e,r){let i=r.physicalLevelTechnique;switch(i){case Qt.VARINT:return yu(t,e,r.numValues);case Qt.NONE:return L3(t,e,r.numValues);default:throw Error(`Specified physicalLevelTechnique ${i} is not supported (yet).`)}}function R3(t,e,r){let i=hi(t,e,r);return i.length===1?et(i[0]):b3(i)}function xu(t,e,r){let i=hi(t,e,r);return i.length===1?r.logicalLevelTechnique1===W.DELTA?et(i[0]):i[0]:v3(i)}function Iy(t,e,r){return w3(hi(t,e,r))}function Cy(t,e,r){return A3(yu(t,e,r.numValues))}function My(t,e,r,i){return Py(bn(t,e,r),r,i)}function vu(t,e,r,i){return zy(bn(t,e,r),r,i)}function $3(t,e,r,i){let n=N3(t,e,r,!1);return i?Ar(n,i,0):n}function N3(t,e,r,i){if(r.physicalLevelTechnique===Qt.VARINT)return G3(Jw(t,e,r.numValues),r,i);let n=bn(t,e,r),a=i?Py(n,r):zy(n,r);return Float64Array.from(a,Number)}function U3(t,e,r){let i=bn(t,e,r);return i.length===1?Ot(i[0]):_3(i)}function By(t,e,r){let i=bn(t,e,r);return i.length===1?r.logicalLevelTechnique1===W.DELTA?Ot(i[0]):i[0]:D3(i)}function q3(t,e,r,i){let n;switch(e.logicalLevelTechnique1){case W.DELTA:if(e.logicalLevelTechnique2===W.RLE){let a=e;if(!i)return y3(t,a.runs,a.numRleValues);t=ll(t,a.runs,a.numRleValues),n=Kc(t)}else n=Kc(t);break;case W.RLE:n=o3(t,e.runs,e.numRleValues);break;case W.MORTON:mu(t),n=new Int32Array(t);break;case W.COMPONENTWISE_DELTA:if(r&&!i)return Ey(t,r.scale,r.min,r.max);n=c3(t);break;case W.NONE:n=i3(t);break;default:throw Error(`The specified Logical level technique is not supported: ${e.logicalLevelTechnique1}`)}return i?Ar(n,i,0):n}function j3(t,e,r,i){let n;switch(e.logicalLevelTechnique1){case W.DELTA:if(e.logicalLevelTechnique2===W.RLE){let a=e;n=Qc(ll(t,a.runs,a.numRleValues))}else n=Qc(t);break;case W.RLE:n=ll(t,e.runs,e.numRleValues);break;case W.MORTON:mu(t),n=t;break;case W.COMPONENTWISE_DELTA:n=r&&!i?x3(t,r.scale,r.min,r.max):g3(t);break;case W.NONE:n=t;break;default:throw Error(`The specified Logical level technique is not supported: ${e.logicalLevelTechnique1}`)}return i?Ar(n,i,0):n}function Py(t,e,r){let i;switch(e.logicalLevelTechnique1){case W.DELTA:if(e.logicalLevelTechnique2===W.RLE){let n=e;if(!r)return m3(t,n.runs,n.numRleValues);t=ul(t,n.runs,n.numRleValues),i=Jc(t)}else i=Jc(t);break;case W.RLE:i=l3(t,e.runs,e.numRleValues);break;case W.NONE:i=n3(t);break;default:throw Error(`The specified Logical level technique is not supported: ${e.logicalLevelTechnique1}`)}return r?Ar(i,r,0n):i}function zy(t,e,r){let i;switch(e.logicalLevelTechnique1){case W.DELTA:if(e.logicalLevelTechnique2===W.RLE){let n=e;i=tp(ul(t,n.runs,n.numRleValues))}else i=tp(t);break;case W.RLE:i=ul(t,e.runs,e.numRleValues);break;case W.NONE:i=t;break;default:throw Error(`The specified Logical level technique is not supported: ${e.logicalLevelTechnique1}`)}return r?Ar(i,r,0n):i}function G3(t,e,r){switch(e.logicalLevelTechnique1){case W.DELTA:if(e.logicalLevelTechnique2===W.RLE){let i=e;t=Sy(t,i.runs,i.numRleValues)}return s3(t),t;case W.RLE:return W3(t,e,r);case W.NONE:return r&&a3(t),t;default:throw Error(`The specified Logical level technique is not supported: ${e.logicalLevelTechnique1}`)}}function Y3(t,e){if(e.logicalLevelTechnique1===W.DELTA&&e.logicalLevelTechnique2===W.NONE)return p3(t);if(e.logicalLevelTechnique1===W.RLE&&e.logicalLevelTechnique2===W.NONE){let r=e;return d3(t,r.runs,r.numRleValues)}if(e.logicalLevelTechnique1===W.NONE&&e.logicalLevelTechnique2===W.NONE){h3(t);let r=new Uint32Array(e.numValues+1);return r[0]=0,r.set(t,1),r}if(e.logicalLevelTechnique1===W.DELTA&&e.logicalLevelTechnique2===W.RLE){let r=e,i=f3(t,r.runs,r.numRleValues);return mu(i),new Uint32Array(i)}throw Error(\"Only delta encoding is supported for transforming length to offset streams yet.\")}function Za(t,e,r,i,n=\"int32\"){let a=t.logicalLevelTechnique1;if(a===W.RLE)return t.runs===1?lt.CONST:lt.FLAT;if(a!==W.DELTA||t.logicalLevelTechnique2!==W.RLE)return t.numValues===1?lt.CONST:lt.FLAT;let s=e instanceof ce?e.size():e,o=t;if(o.numRleValues!==s)return lt.FLAT;if(o.runs===1)return lt.SEQUENCE;if(o.runs!==2)return t.numValues===1?lt.CONST:lt.FLAT;let l=i.get();if(t.physicalLevelTechnique===Qt.VARINT)return X3(r,i,n)?lt.SEQUENCE:t.numValues===1?lt.CONST:lt.FLAT;let u=i.get(),h=new Int32Array(r.buffer,r.byteOffset+u,4);return i.set(l),h[2]===2&&h[3]===2?lt.SEQUENCE:t.numValues===1?lt.CONST:lt.FLAT}function X3(t,e,r){let i=new Dy(e.get());if(r===\"int64\"){let a=yu(t,i,4);return a[2]===2n&&a[3]===2n}let n=Rt(t,i,4);return n[2]===2&&n[3]===2}function W3(t,e,r){return r?u3(t,e.runs,e.numRleValues):Sy(t,e.runs,e.numRleValues)}var Ly=class extends Wa{getValueFromBuffer(t){return this.dataBuffer[t]}},Vy=class extends by{constructor(t,e,r,i,n){super(t,n?BigInt64Array.of(e):BigUint64Array.of(e),r,i)}getValueFromBuffer(t){return this.dataBuffer[0]+BigInt(t)*this.delta}};function bu(t,e,r){return{x:rp(t,e)-r,y:rp(t>>1,e)-r}}function rp(t,e){let r=0;for(let i=0;i<e;i++)r|=(t&1<<2*i)>>i;return r}var Pt;(function(t){t[t.POINT=0]=\"POINT\",t[t.LINESTRING=1]=\"LINESTRING\",t[t.POLYGON=2]=\"POLYGON\",t[t.MULTIPOINT=3]=\"MULTIPOINT\",t[t.MULTILINESTRING=4]=\"MULTILINESTRING\",t[t.MULTIPOLYGON=5]=\"MULTIPOLYGON\"})(Pt||(Pt={}));var ip;(function(t){t[t.POINT=0]=\"POINT\",t[t.LINESTRING=1]=\"LINESTRING\",t[t.POLYGON=2]=\"POLYGON\"})(ip||(ip={}));var Qe;(function(t){t[t.MORTON=0]=\"MORTON\",t[t.VEC_2=1]=\"VEC_2\",t[t.VEC_3=2]=\"VEC_3\"})(Qe||(Qe={}));function Z3(t){let e=Array(t.numGeometries),r=1,i=1,n=1,a=0,s=0,o=0,l=t.mortonSettings,u=t.topologyVector,h=u.geometryOffsets,c=u.partOffsets,p=u.ringOffsets,f=t.vertexOffsets,d=!f||f.length===0,y=t.containsPolygonGeometry(),m=t.vertexBuffer;for(let g=0;g<t.numGeometries;g++){let x=t.geometryType(g);switch(x){case Pt.POINT:{let b,v;if(d)b=m[s++],v=m[s++];else if(t.vertexBufferType===Qe.MORTON){let w=m[f[o++]],_=bu(w,l.numBits,l.coordinateShift);b=_.x,v=_.y}else{let w=f[o++]*2;b=m[w],v=m[w+1]}e[a++]=[[new B(b,v)]],h&&n++,c&&r++,p&&i++}break;case Pt.MULTIPOINT:{let b=h[n]-h[n-1];n++;let v;if(d){v=Array(b);for(let w=0;w<b;w++){let _=m[s++],A=m[s++];v[w]=new B(_,A)}}else v=or(t.vertexBufferType,m,f,o,b,!1,l),o+=b;e[a++]=v.map(w=>[w]),r+=b,i+=b}break;case Pt.LINESTRING:{let b;y?(b=p[i]-p[i-1],i++):b=c[r]-c[r-1],r++;let v;d?(v=Lr(m,s,b,!1),s+=b*2):(v=or(t.vertexBufferType,m,f,o,b,!1,l),o+=b),e[a++]=[v],h&&n++}break;case Pt.POLYGON:{let b=c[r]-c[r-1];r++;let v=Array(b-1),w,_=p[i]-p[i-1];if(i++,d){w=Lr(m,s,_,!0),s+=_*2;for(let A=0;A<v.length;A++)_=p[i]-p[i-1],i++,v[A]=Lr(m,s,_,!0),s+=_*2}else{w=or(t.vertexBufferType,m,f,o,_,!0,l),o+=_;for(let A=0;A<v.length;A++)_=p[i]-p[i-1],i++,v[A]=or(t.vertexBufferType,m,f,o,_,!0,l),o+=_}e[a++]=[w].concat(v),h&&n++}break;case Pt.MULTILINESTRING:{let b=h[n]-h[n-1];n++;let v=Array(b);for(let w=0;w<b;w++){let _;if(y?(_=p[i]-p[i-1],i++):_=c[r]-c[r-1],r++,d)v[w]=Lr(m,s,_,!1),s+=_*2;else{let A=or(t.vertexBufferType,m,f,o,_,!1,l);v[w]=A,o+=_}}e[a++]=v}break;case Pt.MULTIPOLYGON:{let b=h[n]-h[n-1];n++;let v=Array(b);for(let w=0;w<b;w++){let _=c[r]-c[r-1];r++;let A,S=Array(_-1),F=p[i]-p[i-1];i++,d?(A=Lr(m,s,F,!0),s+=F*2):(A=or(t.vertexBufferType,m,f,o,F,!0,l),o+=F);for(let L=0;L<S.length;L++){let V=p[i]-p[i-1];i++,d?(S[L]=Lr(m,s,V,!0),s+=V*2):(S[L]=or(t.vertexBufferType,m,f,o,V,!0,l),o+=V)}v[w]=[A].concat(S)}e[a++]=v.flat()}break;default:throw Error(`The specified geometry type (${x}) is currently not supported.`)}}return e}function or(t,e,r,i,n,a,s){return t===Qe.MORTON?K3(e,r,i,n,a,s):H3(e,r,i,n,a)}function Lr(t,e,r,i){let n=Array(i?r+1:r);for(let a=0;a<r*2;a+=2){let s=t[e+a],o=t[e+a+1];n[a/2]=new B(s,o)}return i&&(n[n.length-1]=n[0]),n}function H3(t,e,r,i,n){let a=Array(n?i+1:i);for(let s=0;s<i*2;s+=2){let o=e[r+s/2]*2,l=t[o],u=t[o+1];a[s/2]=new B(l,u)}return n&&(a[a.length-1]=a[0]),a}function K3(t,e,r,i,n,a){let s=Array(n?i+1:i);for(let o=0;o<i;o++){let l=t[e[r+o]],u=bu(l,a.numBits,a.coordinateShift);s[o]=new B(u.x,u.y)}return n&&(s[s.length-1]=s[0]),s}var Oy=class{constructor(t,e,r,i,n){this._vertexBufferType=t,this._topologyVector=e,this._vertexOffsets=r,this._vertexBuffer=i,this._mortonSettings=n}get vertexBufferType(){return this._vertexBufferType}get topologyVector(){return this._topologyVector}get vertexOffsets(){return this._vertexOffsets}get vertexBuffer(){return this._vertexBuffer}getSimpleEncodedVertex(t){let e=this.vertexOffsets?this.vertexOffsets[t]*2:t*2;return[this.vertexBuffer[e],this.vertexBuffer[e+1]]}getVertex(t){if(this.vertexOffsets&&this.mortonSettings){let r=this.vertexOffsets[t],i=this.vertexBuffer[r],n=bu(i,this.mortonSettings.numBits,this.mortonSettings.coordinateShift);return[n.x,n.y]}let e=this.vertexOffsets?this.vertexOffsets[t]*2:t*2;return[this.vertexBuffer[e],this.vertexBuffer[e+1]]}getGeometries(){return Z3(this)}get mortonSettings(){return this._mortonSettings}};function J3(t,e,r,i,n){return new Ry(t,e,Qe.VEC_2,r,i,n)}function Q3(t,e,r,i,n,a){return new Ry(t,e,Qe.MORTON,r,i,n,a)}var Ry=class extends Oy{constructor(t,e,r,i,n,a,s){super(r,i,n,a,s),this._numGeometries=t,this._geometryType=e}geometryType(t){return this._geometryType}get numGeometries(){return this._numGeometries}containsPolygonGeometry(){return this._geometryType===Pt.POLYGON||this._geometryType===Pt.MULTIPOLYGON}containsSingleGeometryType(){return!0}};function $y(t,e,r,i){return new Ny(Qe.VEC_2,t,e,r,i)}function t6(t,e,r,i,n){return new Ny(Qe.MORTON,t,e,r,i,n)}var Ny=class extends Oy{constructor(t,e,r,i,n,a){super(t,r,i,n,a),this._geometryTypes=e}geometryType(t){return this._geometryTypes[t]}get numGeometries(){return this._geometryTypes.length}containsPolygonGeometry(){for(let t=0;t<this.numGeometries;t++)if(this.geometryType(t)===Pt.POLYGON||this.geometryType(t)===Pt.MULTIPOLYGON)return!0;return!1}containsSingleGeometryType(){return!1}},Uy=class{constructor(t,e,r,i){this._triangleOffsets=t,this._indexBuffer=e,this._vertexBuffer=r,this._topologyVector=i}get triangleOffsets(){return this._triangleOffsets}get indexBuffer(){return this._indexBuffer}get vertexBuffer(){return this._vertexBuffer}get topologyVector(){return this._topologyVector}getGeometries(){if(!this._topologyVector)throw Error(\"Cannot convert GpuVector to coordinates without topology information\");let t=new Uint32Array(this.numGeometries);for(let e=0;e<this.numGeometries;e++)t[e]=this.geometryType(e);return $y(t,this._topologyVector,void 0,this._vertexBuffer).getGeometries()}[Symbol.iterator](){return null}};function np(t,e,r,i,n,a){return new e6(t,e,r,i,n,a)}var e6=class extends Uy{constructor(t,e,r,i,n,a){super(r,i,n,a),this._numGeometries=t,this._geometryType=e}geometryType(t){return this._geometryType}get numGeometries(){return this._numGeometries}containsSingleGeometryType(){return!0}};function ap(t,e,r,i,n){return new r6(t,e,r,i,n)}var r6=class extends Uy{constructor(t,e,r,i,n){super(e,r,i,n),this._geometryTypes=t}geometryType(t){return this._geometryTypes[t]}get numGeometries(){return this._geometryTypes.length}containsSingleGeometryType(){return!1}};function i6(t,e,r,i,n){let a=ht(t,r),s=Za(a,i,t,r),o,l,u,h;if(s===lt.CONST){let b=xu(t,r,a),v,w,_,A;for(let S=0;S<e-1;S++){let F=ht(t,r);switch(F.physicalStreamType){case _t.LENGTH:switch(F.logicalStreamType.lengthType){case Et.GEOMETRIES:v=Ye(t,r,F);break;case Et.PARTS:w=Ye(t,r,F);break;case Et.RINGS:_=Ye(t,r,F);break;case Et.TRIANGLES:A=Ye(t,r,F)}break;case _t.OFFSET:switch(F.logicalStreamType.offsetType){case xe.VERTEX:o=Vt(t,r,F);break;case xe.INDEX:h=Vt(t,r,F)}break;case _t.DATA:if(Ut.VERTEX===F.logicalStreamType.dictionaryType)l=_a(t,r,F,n);else{let L=F;u={numBits:L.numBits,coordinateShift:L.coordinateShift},l=Vt(t,r,F,n)}}}return h?v!==void 0||w!==void 0?np(i,b,A,h,l,{geometryOffsets:v,partOffsets:w,ringOffsets:_}):np(i,b,A,h,l):u===void 0?J3(i,b,{geometryOffsets:v,partOffsets:w,ringOffsets:_},o,l):Q3(i,b,{geometryOffsets:v,partOffsets:w,ringOffsets:_},o,l,u)}let c=Vt(t,r,a),p,f,d,y;for(let b=0;b<e-1;b++){let v=ht(t,r);switch(v.physicalStreamType){case _t.LENGTH:switch(v.logicalStreamType.lengthType){case Et.GEOMETRIES:p=Vt(t,r,v);break;case Et.PARTS:f=Vt(t,r,v);break;case Et.RINGS:d=Vt(t,r,v);break;case Et.TRIANGLES:y=Ye(t,r,v)}break;case _t.OFFSET:switch(v.logicalStreamType.offsetType){case xe.VERTEX:o=Vt(t,r,v);break;case xe.INDEX:h=Vt(t,r,v)}break;case _t.DATA:if(Ut.VERTEX===v.logicalStreamType.dictionaryType)l=_a(t,r,v,n);else{let w=v;u={numBits:w.numBits,coordinateShift:w.coordinateShift},l=Vt(t,r,v,n)}}}let m,g,x;return p?(m=Xs(c,p,2),f&&d?(g=sp(c,m,f,!1),x=a6(c,m,g,d)):f&&(g=n6(c,m,f))):f&&d?(g=Xs(c,f,1),x=sp(c,g,d,!0)):f&&(g=Xs(c,f,0)),h&&!g?ap(c,y,h,l):h?ap(c,y,h,l,{geometryOffsets:m,partOffsets:g,ringOffsets:x}):u===void 0?$y(c,{geometryOffsets:m,partOffsets:g,ringOffsets:x},o,l):t6(c,{geometryOffsets:m,partOffsets:g,ringOffsets:x},o,l,u)}function Xs(t,e,r){let i=new Uint32Array(t.length+1),n=0;i[0]=n;let a=0;for(let s=0;s<t.length;s++)n=i[s+1]=n+(t[s]>r?e[a++]:1);return i}function sp(t,e,r,i){let n=new Uint32Array(e[e.length-1]+1),a=0;n[0]=a;let s=1,o=0;for(let l=0;l<t.length;l++){let u=t[l],h=e[l+1]-e[l];if(u===5||u===2||i&&(u===4||u===1))for(let c=0;c<h;c++)a=n[s++]=a+r[o++];else for(let c=0;c<h;c++)n[s++]=++a}return n}function n6(t,e,r){let i=new Uint32Array(e[e.length-1]+1),n=0;i[0]=n;let a=1,s=0;for(let o=0;o<t.length;o++){let l=t[o],u=e[o+1]-e[o];if(l===4||l===1)for(let h=0;h<u;h++)n=i[a++]=n+r[s++];else for(let h=0;h<u;h++)i[a++]=++n}return i}function a6(t,e,r,i){let n=new Uint32Array(r[r.length-1]+1),a=0;n[0]=a;let s=1,o=1,l=0;for(let u=0;u<t.length;u++){let h=t[u],c=e[u+1]-e[u];if(h!==0&&h!==3)for(let p=0;p<c;p++){let f=r[s]-r[s-1];s++;for(let d=0;d<f;d++)a=n[o++]=a+i[l++]}else for(let p=0;p<c;p++)n[o++]=++a,s++}return n}var s6=class extends _r{constructor(t,e,r){super(t,e.getBuffer(),r),this.dataVector=e}getValueFromBuffer(t){return this.dataVector.get(t)}},o6=class extends Wa{getValueFromBuffer(t){return this.dataBuffer[t]}},qy=class extends _r{constructor(t,e,r,i){super(t,i?BigInt64Array.of(e):BigUint64Array.of(e),r)}getValueFromBuffer(t){return this.dataBuffer[0]}},wu=class extends _r{constructor(t,e,r,i){super(t,r,i),this.offsetBuffer=e}},op=class extends wu{constructor(t,e,r,i){super(t,e,r,i??e.length-1)}getValueFromBuffer(t){let e=this.offsetBuffer[t],r=this.offsetBuffer[t+1];return gu(this.dataBuffer,e,r)}},Kr=class extends wu{constructor(t,e,r,i,n){super(t,r,i,n??e.length),this.indexBuffer=e,this.indexBuffer=e}getValueFromBuffer(t){let e=this.indexBuffer[t],r=this.offsetBuffer[e],i=this.offsetBuffer[e+1];return gu(this.dataBuffer,r,i)}};function l6(t,e){let r=0;for(let i=0;i<e.length;i++){let n=e[i];n===255?(r++,i++):r+=t[n]}return r}function u6(t,e,r){let i=new Uint32Array(e.length);for(let s=1;s<e.length;s++)i[s]=i[s-1]+e[s-1];let n=new Uint8Array(l6(e,r)),a=0;for(let s=0;s<r.length;s++){let o=r[s];if(o===255)s++,n[a++]=r[s];else{let l=e[o],u=i[o];for(;l-- >0;)n[a++]=t[u++]}}return n}var jy=class extends wu{constructor(t,e,r,i,n,a,s,o){super(t,r,i,s??e.length),this.indexBuffer=e,this.symbolOffsetBuffer=n,this.symbolTableBuffer=a,this.sharedDictionaryCache=o}getValueFromBuffer(t){this.decodedDictionary??(this.decodedDictionary=this.sharedDictionaryCache?.decodedDictionary,this.decodedDictionary??(this.decodedDictionary=this.decodeDictionary(),this.sharedDictionaryCache&&(this.sharedDictionaryCache.decodedDictionary=this.decodedDictionary)));let e=this.indexBuffer[t],r=this.offsetBuffer[e],i=this.offsetBuffer[e+1];return gu(this.decodedDictionary,r,i)}decodeDictionary(){return this.symbolLengthBuffer??(this.symbolLengthBuffer=this.offsetToLengthBuffer(this.symbolOffsetBuffer)),u6(this.symbolTableBuffer,this.symbolLengthBuffer,this.dataBuffer)}offsetToLengthBuffer(t){let e=new Uint32Array(t.length-1),r=t[0];for(let i=1;i<t.length;i++){let n=t[i];e[i-1]=n-r,r=n}return e}};function Gy(t,e,r,i,n){let a,s,o,l,u,h=n,c,p;for(let f=0;f<i;f++){let d=ht(e,r);switch(d.physicalStreamType){case _t.PRESENT:{let y=new ce(ui(e,d.numValues,d.byteLength,r),d.numValues);h=n??y;break}case _t.OFFSET:s=Vt(e,r,d,void 0,h);break;case _t.LENGTH:{let y=Ye(e,r,d);Et.DICTIONARY===d.logicalStreamType.lengthType?a=y:Et.SYMBOL===d.logicalStreamType.lengthType?l=y:c=y;break}case _t.DATA:{let y=e.subarray(r.get(),r.get()+d.byteLength);r.add(d.byteLength);let m=d.logicalStreamType.dictionaryType;Ut.FSST===m?u=y:Ut.SINGLE===m||Ut.SHARED===m?o=y:Ut.NONE===m&&(p=y);break}}}return h6(t,u,s,a,o,l,h)??c6(t,o,s,a,h)??p6(t,c,p,s,h)}function h6(t,e,r,i,n,a,s){if(e){if(!r||!i||!n||!a)throw Error(`Incomplete FSST dictionary string column \"${t}\"`);return new jy(t,r,i,n,a,e,s)}}function c6(t,e,r,i,n){if(e){if(!r||!i)throw Error(`Incomplete dictionary string column \"${t}\"`);return n?new Kr(t,r,i,e,n):new Kr(t,r,i,e)}}function p6(t,e,r,i,n){if(e&&r){if(i)return n?new Kr(t,i,e,r,n):new Kr(t,i,e,r);if(n&&n.size()!==e.length-1){let a=new Uint32Array(n.size()),s=0;for(let o=0;o<n.size();o++)n.get(o)?a[o]=s++:a[o]=0;return new Kr(t,a,e,r,n)}return n?new op(t,e,r,n):new op(t,e,r)}}function f6(t,e,r,i){let n,a,s,o,l=!1;for(;!l;){let f=ht(t,e);switch(f.physicalStreamType){case _t.LENGTH:Et.DICTIONARY===f.logicalStreamType.lengthType?n=Ye(t,e,f):s=Ye(t,e,f);break;case _t.DATA:Ut.SINGLE===f.logicalStreamType.dictionaryType||Ut.SHARED===f.logicalStreamType.dictionaryType?(a=t.subarray(e.get(),e.get()+f.byteLength),l=!0):o=t.subarray(e.get(),e.get()+f.byteLength),e.add(f.byteLength)}}if(r.type!==\"complexType\")throw Error(`Shared dictionary column ${r.name} must be a complex (struct) column.`);if(!n||!a)throw Error(`Incomplete shared dictionary for column \"${r.name}\"`);let u=r.complexType.children,h=[],c=o?{}:void 0,p=0;for(let f of u){let d=Rt(t,e,1)[0];if(d===0)continue;let y=f.name?`${r.name}${f.name}`:r.name;if(i&&!i.has(y)){Fy(d,t,e);continue}if(f.type!==\"scalarField\"||f.scalarField.physicalType!==rt.STRING)throw Error(\"Currently only scalar string fields are implemented for a struct.\");if(d>1&&!f.nullable||d===1&&f.nullable)throw Error(`The number of streams for the child field ${f.name} does not match its nullability. nullibilty: ${f.nullable}, numStreams: ${d}`);let m;if(f.nullable){let x=ht(t,e);m=new ce(ui(t,x.numValues,x.byteLength,e),x.numValues)}let g=Vt(t,e,ht(t,e),void 0,m);if(o){if(!s)throw Error(`Incomplete shared FSST dictionary for column \"${y}\"`);h[p++]=new jy(y,g,n,a,s,o,m,c)}else h[p++]=new Kr(y,g,n,a,m)}return h}var lp=class extends _r{constructor(t,e,r){super(t,new Uint8Array,r??e.length),this.values=e}getValueFromBuffer(t){return this.values[t]}},ve;(function(t){t[t.STRING=1]=\"STRING\",t[t.INT32=2]=\"INT32\",t[t.UINT32=4]=\"UINT32\",t[t.INT64=8]=\"INT64\",t[t.UINT64=16]=\"UINT64\",t[t.FLOAT=32]=\"FLOAT\",t[t.DOUBLE=64]=\"DOUBLE\",t[t.PRESENCE=128]=\"PRESENCE\"})(ve||(ve={}));var Ze;(function(t){t[t.FALSE=0]=\"FALSE\",t[t.TRUE=1]=\"TRUE\",t[t.START_MAP=2]=\"START_MAP\",t[t.START_LIST=3]=\"START_LIST\",t[t.COUNT=4]=\"COUNT\"})(Ze||(Ze={}));function d6(t,e,r,i){let n=y6(r);if(i===0)return n.map(h=>new lp(h,[]));let a=m6(t,e,i),s=(a.presentStream?a.presentCount:a.lengthStream.length)/n.length,o=[],l=0,u=0;for(let h=0;h<n.length;h++){let c=w6(a,h,s,l,u);o.push(new lp(n[h],c.value,c.nullabilityBuffer)),l=c.countsEnd,u=c.valuesEnd}return o}function y6(t){let e=t.type===\"complexType\"?t.complexType.children:void 0;return!e||e.length===0?[t.name]:e.map(r=>t.name+(r.name??\"\"))}function m6(t,e,r){let i=t[e.get()];e.add(1);let n=Vt(t,e,ht(t,e)),a=r-1,s=[];i&ve.STRING&&(a-=g6(t,e,s)),a-=x6(t,e,i,s),a-=v6(t,e,i,s);let o,l=0;if(i&ve.PRESENCE){let h=b6(t,e);o=h.value,l=h.count,a--}let u=new Uint32Array;if(a>0&&(u=Vt(t,e,ht(t,e)),a--),a!==0)throw Error(`Unexpected number of remaining streams while decoding map column: ${a}`);return{lengthStream:n,dictionary:s,presentStream:o,presentCount:l,flattenedValues:u}}function g6(t,e,r){let i=t[e.get()];e.add(1);let n=Gy(\"\",t,e,i);if(n)for(let a=0;a<n.size;a++)r.push(n.getValue(a));return i}function x6(t,e,r,i){let n=0;return r&ve.INT32?(jr(i,_a(t,e,ht(t,e))),n++):r&ve.INT64&&(jr(i,My(t,e,ht(t,e))),n++),r&ve.UINT32?(jr(i,Vt(t,e,ht(t,e))),n++):r&ve.UINT64&&(jr(i,vu(t,e,ht(t,e))),n++),n}function v6(t,e,r,i){let n=0;return r&ve.FLOAT&&(jr(i,Ty(t,e,ht(t,e).numValues)),n++),r&ve.DOUBLE&&(jr(i,ky(t,e,ht(t,e).numValues)),n++),n}function b6(t,e){let r=ht(t,e);if(r.physicalStreamType!==_t.PRESENT)throw Error(`Expected PRESENT stream for map column but found: ${r.physicalStreamType}`);let i=r.numValues,n=e.get(),a=new ce(ui(t,i,r.byteLength,e),i);return e.set(n+r.byteLength),{value:a,count:i}}function w6(t,e,r,i,n){let{lengthStream:a,flattenedValues:s,presentStream:o,dictionary:l}=t,u=e*r,h=r,c;if(o){c=new ce(new Uint8Array(Math.ceil(r/8)),r),h=0;for(let x=0;x<r;x++)o.get(u+x)&&(c.set(x,!0),h++)}let p=i+h;if(p>a.length)throw Error(\"Merged map counts underflow while decoding child streams\");let f=Array(r),d=i,y=n;for(let x=0;x<r;x++){if(o&&!o.get(u+x)){f[x]=null;continue}let b=y+a[d++];if(b>s.length)throw Error(\"Map value stream underflow while decoding feature payload\");let v=D6(s,y,b,l);f[x]=v.value,y=v.nextIndex}let m=0;for(let x=i;x<p;x++)m+=a[x];let g=n+m;if(y!==g)throw Error(\"Unused flattened map values remain after decode\");return{value:f,nullabilityBuffer:c,countsEnd:p,valuesEnd:g}}function D6(t,e,r,i){return r-e===1||t[e]===Ze.START_LIST?Du(t,e,r,i):Yy(t,e,r,i)}function Yy(t,e,r,i){let n=Object.create(null),a=e;for(;a<r;){let s=Xy(t[a++],i);if(typeof s!=\"string\")throw Error(`Map key dictionary index does not resolve to a string: ${s}`);let o=Du(t,a,r,i);n[s]=o.value,a=o.nextIndex}return{value:n,nextIndex:a}}function Du(t,e,r,i){if(e>=r)throw Error(\"Unexpected end of map value stream\");let n=t[e];if(n===Ze.FALSE)return{value:!1,nextIndex:e+1};if(n===Ze.TRUE)return{value:!0,nextIndex:e+1};if(n===Ze.START_MAP){let a=up(t,e,r);return{value:Yy(t,e+2,a,i).value,nextIndex:a}}if(n===Ze.START_LIST){let a=up(t,e,r),s=[],o=e+2;for(;o<a;){let l=Du(t,o,a,i);s.push(l.value),o=l.nextIndex}return{value:s,nextIndex:a}}return{value:Xy(n,i),nextIndex:e+1}}function up(t,e,r){if(e+1>=r)throw Error(\"Missing length for nested map/list payload\");let i=t[e+1];if(i<2)throw Error(`Invalid nested payload length: ${i}`);let n=e+i;if(n>r)throw Error(\"Nested payload exceeds containing payload bounds\");return n}function Xy(t,e){let r=t-Ze.COUNT;if(r<0||r>=e.length)throw Error(`Scalar dictionary index out of range: ${t}`);return e[r]}function jr(t,e){for(let r of e)t.push(r)}function _6(t,e,r,i,n,a){return r.type===\"scalarType\"?a&&!a.has(r.name)?(Fy(i,t,e),null):A6(i,t,e,n,r.scalarType,r):r.complexType?.physicalType===Ke.MAP?d6(t,e,r,i):i===0?null:f6(t,e,r,a)}function A6(t,e,r,i,n,a){let s;if(t===0)return null;if(a.nullable){let l=ht(e,r),u=l.numValues,h=r.get(),c=ui(e,u,l.byteLength,r);r.set(h+l.byteLength),s=new ce(c,l.numValues)}let o=s??i;switch(n.physicalType){case rt.UINT_32:case rt.INT_32:return k6(e,r,a,n,o);case rt.STRING:{let l=a.nullable?t-1:t;return Gy(a.name,e,r,l,s)??null}case rt.BOOLEAN:return S6(e,r,a,i,o);case rt.UINT_64:case rt.INT_64:return T6(e,r,a,o,n);case rt.FLOAT:return E6(e,r,a,o);case rt.DOUBLE:return F6(e,r,a,o);default:throw Error(`The specified data type for the field is currently not supported: ${n}`)}}function S6(t,e,r,i,n){let a=ht(t,e),s=a.numValues,o=e.get(),l=wn(n)?n:void 0,u=ui(t,s,a.byteLength,e,l);e.set(o+a.byteLength);let h=new ce(u,s);return new s6(r.name,h,n)}function E6(t,e,r,i){let n=ht(t,e),a=wn(i)?i:void 0,s=Ty(t,e,n.numValues,a);return new o6(r.name,s,i)}function F6(t,e,r,i){let n=ht(t,e),a=wn(i)?i:void 0,s=ky(t,e,n.numValues,a);return new hu(r.name,s,i)}function T6(t,e,r,i,n){let a=ht(t,e),s=Za(a,i,t,e,\"int64\"),o=n.physicalType===rt.INT_64;if(s===lt.FLAT){let u=wn(i)?i:void 0,h=o?My(t,e,a,u):vu(t,e,a,u);return new Ly(r.name,h,i)}if(s===lt.SEQUENCE){let u=Cy(t,e,a);return new Vy(r.name,u[0],u[1],a.numRleValues,o)}let l=o?U3(t,e,a):By(t,e,a);return new qy(r.name,l,i,o)}function k6(t,e,r,i,n){let a=ht(t,e),s=Za(a,n,t,e),o=i.physicalType===rt.INT_32;if(s===lt.FLAT){let u=wn(n)?n:void 0,h=o?_a(t,e,a,void 0,u):Vt(t,e,a,void 0,u);return new uu(r.name,h,n)}if(s===lt.SEQUENCE){let u=Iy(t,e,a);return new cu(r.name,u[0],u[1],a.numRleValues,o)}let l=o?R3(t,e,a):xu(t,e,a);return new pu(r.name,l,n,o)}function wn(t){return t instanceof ce}var It={ID:0,ID_NULLABLE:1,ID_LONG:2,GEOMETRY:4,SCALAR_BASE:10,STRUCT:30,MAP:31};function Wy(t){switch(t){case It.ID:case It.ID|It.ID_NULLABLE:case It.ID|It.ID_LONG:case It.ID|It.ID_LONG|It.ID_NULLABLE:return{nullable:(t&It.ID_NULLABLE)!==0,columnScope:$i.FEATURE,type:\"scalarType\",scalarType:{longID:(t&It.ID_LONG)!==0,type:\"logicalType\",logicalType:wy.ID}};case It.GEOMETRY:return{nullable:!1,columnScope:$i.FEATURE,type:\"complexType\",complexType:{type:\"physicalType\",physicalType:Ke.GEOMETRY,children:[]}};case It.STRUCT:return{nullable:!1,columnScope:$i.FEATURE,type:\"complexType\",complexType:{type:\"physicalType\",physicalType:Ke.STRUCT,children:[]}};case It.MAP:return{nullable:!0,columnScope:$i.FEATURE,type:\"complexType\",complexType:{type:\"physicalType\",physicalType:Ke.MAP,children:[]}};default:return P6(t)}}function I6(t){return t>=It.SCALAR_BASE}function Zy(t){return t===It.STRUCT||t===It.MAP}function C6(t){if(t.type===\"scalarType\"){let e=t.scalarType;if(e.type===\"physicalType\")switch(e.physicalType){case rt.BOOLEAN:case rt.INT_8:case rt.UINT_8:case rt.INT_32:case rt.UINT_32:case rt.INT_64:case rt.UINT_64:case rt.FLOAT:case rt.DOUBLE:return!1;case rt.STRING:return!0;default:return!1}if(e.type===\"logicalType\")return!1}else if(t.type===\"complexType\"){let e=t.complexType;if(e.type===\"physicalType\")switch(e.physicalType){case Ke.GEOMETRY:case Ke.STRUCT:case Ke.MAP:return!0;default:return!1}}return console.warn(\"Unexpected column type in hasStreamCount\",t),!1}function M6(t){return t.type===\"scalarType\"&&t.scalarType?.type===\"logicalType\"&&t.scalarType.logicalType===wy.ID}function B6(t){return t.type===\"complexType\"&&t.complexType?.type===\"physicalType\"&&t.complexType.physicalType===Ke.GEOMETRY}function P6(t){let e;switch(t){case 10:case 11:e=rt.BOOLEAN;break;case 12:case 13:e=rt.INT_8;break;case 14:case 15:e=rt.UINT_8;break;case 16:case 17:e=rt.INT_32;break;case 18:case 19:e=rt.UINT_32;break;case 20:case 21:e=rt.INT_64;break;case 22:case 23:e=rt.UINT_64;break;case 24:case 25:e=rt.FLOAT;break;case 26:case 27:e=rt.DOUBLE;break;case 28:case 29:e=rt.STRING;break;default:return null}return{nullable:!!(t&1),columnScope:$i.FEATURE,type:\"scalarType\",scalarType:{longID:!1,type:\"physicalType\",physicalType:e}}}var z6=new TextDecoder,hp=\"0-3(ID), 4(GEOMETRY), 10-29(scalars), 30(STRUCT), 31(MAP)\";function _u(t,e){let r=Rt(t,e,1)[0];if(r===0)return\"\";let i=e.get(),n=i+r,a=t.subarray(i,n);return e.add(r),z6.decode(a)}function L6(t){let e=t.name,r=t.nullable;return t.type===\"scalarType\"?{type:\"scalarField\",scalarField:t.scalarType,name:e,nullable:r}:{type:\"complexField\",complexField:t.complexType,name:e,nullable:r}}function Hy(t,e){let r=Rt(t,e,1)[0]>>>0,i=r>=It.SCALAR_BASE?Wy(r):null;if(!i)throw Error(`Unsupported field type code ${r}. Supported: 10-29(scalars), 30(STRUCT), 31(MAP)`);let n={...i,name:_u(t,e)};if(n.type===\"complexType\"&&Zy(r)){let a=n.complexType,s=Rt(t,e,1)[0]>>>0;a.children=Array(s);for(let o=0;o<s;o++)a.children[o]=Hy(t,e)}return L6(n)}function V6(t,e){let r=Rt(t,e,1)[0]>>>0,i=Wy(r);if(!i)throw Error(`Unsupported column type code ${r}. Supported: ${hp}`);let n;if(I6(r))n=_u(t,e);else if(r<It.GEOMETRY)n=\"id\";else if(r===It.GEOMETRY)n=\"geometry\";else throw Error(`Unsupported column type code ${r}. Supported: ${hp}`);let a={...i,name:n};if(a.type===\"complexType\"&&Zy(r)){let s=Rt(t,e,1)[0]>>>0,o=a.complexType;o.children=Array(s);for(let l=0;l<s;l++)o.children[l]=Hy(t,e)}return a}function O6(t,e){let r={};r.featureTables=[];let i={};if(i.name=_u(t,e),i.name.length===0)throw Error(\"Missing layer name\");let n=Rt(t,e,1)[0]>>>0,a=Rt(t,e,1)[0]>>>0;i.columns=Array(a);for(let s=0;s<a;s++)i.columns[s]=V6(t,e);return r.featureTables.push(i),[r,n]}function R6(t,e,r=!0){let i=new Dy(0),n=[];for(;i.get()<t.length;){let a=Rt(t,i,1)[0]>>>0,s=i.get()+a;if(s>t.length)throw Error(`Block overruns tile: ${s} > ${t.length}`);let o=Rt(t,i,1)[0]>>>0;if(o!==1&&o!==2){i.set(s);continue}let[l,u]=O6(t,i),h=l.featureTables[0],c=null,p=null,f=[],d=0;for(let m of h.columns){let g=m.name;if(M6(m)){let x=null;if(m.nullable){let v=ht(t,i),w=i.get(),_=ui(t,v.numValues,v.byteLength,i);i.set(w+v.byteLength),x=new ce(_,v.numValues)}let b=ht(t,i);d=x?x.size():b.decompressedCount,c=$6(t,m,i,g,b,x??d,r)}else if(B6(m)){let x=Rt(t,i,1)[0];if(d===0){let b=i.get();d=ht(t,i).decompressedCount,i.set(b)}e&&(e.scale=e.extent/u),p=i6(t,x,i,d,e)}else{let x=C6(m)?Rt(t,i,1)[0]:1;if(x===0)continue;let b=_6(t,i,m,x,d,void 0);if(b)if(Array.isArray(b))for(let v of b)f.push(v);else f.push(b)}}let y=new uw(h.name,p,c,f,u);n.push(y),i.set(s)}return n}function $6(t,e,r,i,n,a,s=!1){let o=e.scalarType?.longID?rt.UINT_64:rt.UINT_32,l=typeof a==\"number\"?void 0:a,u=Za(n,a,t,r,o===rt.UINT_64?\"int64\":\"int32\");if(o===rt.UINT_32)switch(u){case lt.FLAT:return new uu(i,Vt(t,r,n,void 0,l),a);case lt.SEQUENCE:{let h=Iy(t,r,n);return new cu(i,h[0],h[1],n.numRleValues,!1)}case lt.CONST:return new pu(i,xu(t,r,n),a,!1)}switch(u){case lt.FLAT:return s?new hu(i,$3(t,r,n,l),a):new Ly(i,vu(t,r,n,l),a);case lt.SEQUENCE:{let h=Cy(t,r,n);return new Vy(i,h[0],h[1],n.numRleValues,!1)}case lt.CONST:return new qy(i,By(t,r,n),a,!1)}throw Error(\"Vector type not supported for id column.\")}var N6=class{constructor(t,e){switch(this._featureData=t,this.properties=this._featureData.properties||{},this._featureData.geometry?.type){case Pt.POINT:case Pt.MULTIPOINT:this.type=1;break;case Pt.LINESTRING:case Pt.MULTILINESTRING:this.type=2;break;case Pt.POLYGON:case Pt.MULTIPOLYGON:this.type=3;break;default:this.type=0}this.extent=e,this.id=Number(this._featureData.id)}loadGeometry(){let t=[];for(let e of this._featureData.geometry.coordinates){let r=[];for(let i of e)r.push(new B(i.x,i.y));t.push(r)}return t}},U6=class{constructor(t){this.features=[],this.featureTable=t,this.name=t.name,this.extent=t.extent,this.version=2,this.features=t.getFeatures(),this.length=this.features.length}feature(t){return new N6(this.features[t],this.extent)}},Au=class{constructor(t){this.layers={};let e=R6(new Uint8Array(t));this.layers=e.reduce((r,i)=>({...r,[i.name]:new U6(i)}),{})}},Su=class{constructor(t,e){this.tileID=t,this.x=t.canonical.x,this.y=t.canonical.y,this.z=t.canonical.z,this.grid=new so(mt,16,0),this.grid3D=new so(mt,16,0),this.featureIndexArray=new nd,this.promoteId=e}insert(t,e,r,i,n,a){let s=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(r,i,n);let o=a?this.grid3D:this.grid;for(let l of e){let u=[1/0,1/0,-1/0,-1/0];for(let h of l)u[0]=Math.min(u[0],h.x),u[1]=Math.min(u[1],h.y),u[2]=Math.max(u[2],h.x),u[3]=Math.max(u[3],h.y);u[0]<8192&&u[1]<8192&&u[2]>=0&&u[3]>=0&&o.insert(s,u[0],u[1],u[2],u[3])}}loadVTLayers(){return this.vtLayers||(this.encoding===\"mlt\"?this.vtLayers=new Au(this.rawTileData).layers:this.vtLayers=new ql(new ru(this.rawTileData)).layers,this.sourceLayerCoder=new lu(this.vtLayers?Object.keys(this.vtLayers).sort():[al])),this.vtLayers}query(t,e,r,i){this.loadVTLayers();let n=t.params,a=mt/t.tileSize/t.scale,s=ii(n.filter,\"queryRenderedFeatures filter\",n.globalState),o=t.queryGeometry,l=t.queryPadding*a,u=wa.fromPoints(o),h=this.grid.query(u.minX-l,u.minY-l,u.maxX+l,u.maxY+l),c=wa.fromPoints(t.cameraQueryGeometry).expandBy(l),p=this.grid3D.query(c.minX,c.minY,c.maxX,c.maxY,(y,m,g,x)=>Ag(t.cameraQueryGeometry,y-l,m-l,g+l,x+l));for(let y of p)h.push(y);h.sort(j6);let f={},d;for(let y of h){if(y===d)continue;d=y;let m=this.featureIndexArray.get(y),g=null;this.loadMatchingFeature(f,m.bucketIndex,m.sourceLayerIndex,m.featureIndex,s,n.layers,n.availableImages,e,r,i,(x,b,v)=>(g||(g=Dr(x)),b.queryIntersectsFeature({queryGeometry:o,feature:x,featureState:v,geometry:g,zoom:this.z,transform:t.transform,pixelsToTileUnits:a,pixelPosMatrix:t.pixelPosMatrix,unwrappedTileID:this.tileID.toUnwrapped(),getElevation:t.getElevation})))}return f}loadMatchingFeature(t,e,r,i,n,a,s,o,l,u,h){let c=this.bucketLayerIDs[e];if(a&&!c.some(y=>a.has(y)))return;let p=this.sourceLayerCoder.decode(r),f=this.vtLayers[p].feature(i);if(n.needGeometry){let y=li(f,!0);if(!n.filter(new at(this.tileID.overscaledZ),y,this.tileID.canonical))return}else if(!n.filter(new at(this.tileID.overscaledZ),f))return;let d=this.getId(f,p);for(let y of c){if(a&&!a.has(y))continue;let m=o[y];if(!m)continue;let g={};d&&u&&(g=u.getState(m.sourceLayer||\"_geojsonTileLayer\",d));let x=qt({},l[y]);x.paint=cp(x.paint,m.paint,f,g,s),x.layout=cp(x.layout,m.layout,f,g,s);let b=!h||h(f,m,g);if(!b)continue;let v=new lw(f,this.z,this.x,this.y,d);v.layer=x;let w=t[y];w===void 0&&(w=t[y]=[]),w.push({featureIndex:i,feature:v,intersectionZ:b})}}lookupSymbolFeatures(t,e,r,i,n,a,s,o){let l={};this.loadVTLayers();let u=ii(n.filterSpec,\"queryRenderedFeatures symbol filter\",n.globalState);for(let h of t)this.loadMatchingFeature(l,r,i,h,u,a,s,o,e);return l}hasLayer(t){for(let e of this.bucketLayerIDs)for(let r of e)if(t===r)return!0;return!1}getId(t,e){let r=t.id;if(this.promoteId){let i=typeof this.promoteId==\"string\"?this.promoteId:this.promoteId[e];r=t.properties[i],typeof r==\"boolean\"&&(r=Number(r)),r===void 0&&t.properties?.cluster&&this.promoteId&&(r=Number(t.properties.cluster_id))}return r}};I(\"FeatureIndex\",Su,{omit:[\"rawTileData\",\"sourceLayerCoder\"]});function q6(t){return typeof t==\"object\"&&!!t&&\"evaluate\"in t}function cp(t,e,r,i,n){return Aa(t,(a,s)=>{let o=e instanceof Na?e.get(s):null;return q6(o)?o.evaluate(r,i,void 0,n):o})}function j6(t,e){return e-t}var Ky=class{constructor(t){this.maxEntries=t,this.map=new Map}get(t){let e=this.map.get(t);return e!==void 0&&(this.map.delete(t),this.map.set(t,e)),e}set(t,e){if(this.map.has(t))this.map.delete(t);else if(this.map.size>=this.maxEntries){let r=this.map.keys().next().value;this.map.delete(r)}this.map.set(t,e)}clear(){this.map.clear()}};/**\n* MapLibre GL JS\n* @license 3-Clause BSD. Full text of license: https://github.com/maplibre/maplibre-gl-js/blob/v6.9.0/LICENSE.txt\n*/function Eu(t){let e=typeof t;if(e===\"number\"||e===\"boolean\"||e===\"string\"||t==null)return JSON.stringify(t);if(Array.isArray(t)){let n=\"[\";for(let a of t)n+=`${Eu(a)},`;return`${n}]`}let r=Object.keys(t).sort(),i=\"{\";for(let n=0;n<r.length;n++)i+=`${JSON.stringify(r[n])}:${Eu(t[r[n]])},`;return`${i}}`}function G6(t){let e=\"\";for(let r of Ap)e+=`/${Eu(t[r])}`;return e}function Y6(t,e){let r={};for(let n=0;n<t.length;n++){let a=e&&e[t[n].id]||G6(t[n]);e&&(e[t[n].id]=a);let s=r[a];s||(s=r[a]=[]),s.push(t[n])}let i=[];for(let n in r)i.push(r[n]);return i}var X6=class{constructor(t,e){this.keyCache={},t&&this.replace(t,e)}replace(t,e){this._layerConfigs={},this._layers={},this.update(t,[],e)}update(t,e,r){for(let n of t){this._layerConfigs[n.id]=n;let a=this._layers[n.id]=my(n,r);a._featureFilter=ii(a.filter,`layers[${n.id}].filter`,r),this.keyCache[n.id]&&delete this.keyCache[n.id]}for(let n of e)delete this.keyCache[n],delete this._layerConfigs[n],delete this._layers[n];this.familiesBySource={};let i=Y6(Object.values(this._layerConfigs),this.keyCache);for(let n of i){let a=n.map(c=>this._layers[c.id]),s=a[0];if(s.isHidden())continue;let o=s.source||\"\",l=this.familiesBySource[o];l||(l=this.familiesBySource[o]={});let u=s.sourceLayer||\"_geojsonTileLayer\",h=l[u];h||(h=l[u]=[]),h.push(a)}}},t1=class{constructor(t){let e={},r=[];for(let s in t){let o=t[s],l=e[s]={};for(let u in o){let h=o[u];if(!h||h.bitmap.width===0||h.bitmap.height===0)continue;let c={x:0,y:0,w:h.bitmap.width+2,h:h.bitmap.height+2};r.push(c),l[u]={rect:c,metrics:h.metrics}}}let{w:i,h:n}=iu(r),a=new Ya({width:i||1,height:n||1});for(let s in t){let o=t[s];for(let l in o){let u=o[l];if(!u||u.bitmap.width===0||u.bitmap.height===0)continue;let h=e[s][l].rect;Ya.copy(u.bitmap,a,{x:0,y:0},{x:h.x+1,y:h.y+1},u.bitmap)}}this.image=a,this.positions=e}};I(\"GlyphAtlas\",t1);var e1=class{constructor(t){this.tileID=new su(t.tileID.overscaledZ,t.tileID.wrap,t.tileID.canonical.z,t.tileID.canonical.x,t.tileID.canonical.y),this.uid=t.uid,this.zoom=t.zoom,this.pixelRatio=t.pixelRatio,this.tileSize=t.tileSize,this.source=t.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=t.showCollisionBoxes,this.collectResourceTiming=!!t.collectResourceTiming,this.returnDependencies=!!t.returnDependencies,this.promoteId=t.promoteId,this.inFlightDependencies=[]}async parse(t,e,r,i,n){this.data=t,this.collisionBoxArray=new Bl;let a=new lu(Object.keys(t.layers).sort()),s=new Su(this.tileID,this.promoteId);s.bucketLayerIDs=[];let o={},l={featureIndex:s,iconDependencies:{},patternDependencies:{},glyphDependencies:{},dashDependencies:{},availableImages:r,subdivisionGranularity:n},u=e.familiesBySource[this.source];for(let S in u){let F=t.layers[S];if(!F)continue;F.version===1&&Mt(`Vector tile source \"${this.source}\" layer \"${S}\" does not use vector tile spec v2 and therefore may have some rendering errors.`);let L=a.encode(S),V=[];for(let P=0;P<F.length;P++){let R=F.feature(P),E=s.getId(R,S);V.push({feature:R,id:E,index:P,sourceLayerIndex:L})}for(let P of u[S]){let R=P[0];R.source!==this.source&&Mt(`layer.source = ${R.source} does not equal this.source = ${this.source}`),!R.isHidden(this.zoom,!0)&&(Jy(P,this.zoom,r),(o[R.id]=R.createBucket({index:s.bucketLayerIDs.length,layers:P,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:L,sourceID:this.source})).populate(V,l,this.tileID.canonical),s.bucketLayerIDs.push(P.map(E=>E.id)))}}let h=Aa(l.glyphDependencies,S=>Object.keys(S));for(let S of this.inFlightDependencies)S?.abort();this.inFlightDependencies=[];let c=Promise.resolve({});if(Object.keys(h).length){let S=new AbortController;this.inFlightDependencies.push(S),c=i.sendAsync({type:\"GG\",data:{stacks:h,source:this.source,tileID:this.tileID,type:\"glyphs\"}},S)}let p=Object.keys(l.iconDependencies),f=Promise.resolve({});if(p.length){let S=new AbortController;this.inFlightDependencies.push(S),f=i.sendAsync({type:\"GI\",data:{icons:p,source:this.source,tileID:this.tileID,type:\"icons\"}},S)}let d=Object.keys(l.patternDependencies),y=Promise.resolve({});if(d.length){let S=new AbortController;this.inFlightDependencies.push(S),y=i.sendAsync({type:\"GI\",data:{icons:d,source:this.source,tileID:this.tileID,type:\"patterns\"}},S)}let m=l.dashDependencies,g=Promise.resolve({});if(Object.keys(m).length){let S=new AbortController;this.inFlightDependencies.push(S),g=i.sendAsync({type:\"GDA\",data:{dashes:m}},S)}let[x,b,v,w]=await Promise.all([c,f,y,g]),_=new t1(x),A=new nu(b,v);for(let S in o){let F=o[S];F.hasDependencies&&(Jy(F.layers,this.zoom,r),F.addFeatures({options:l,canonical:this.tileID.canonical,glyphMap:x,glyphPositions:_.positions,iconMap:b,iconPositions:A.iconPositions,patternMap:v,patternPositions:A.patternPositions,dashPositions:w,showCollisionBoxes:this.showCollisionBoxes}))}return{buckets:Object.values(o).filter(S=>!S.isEmpty()),featureIndex:s,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:_.image,imageAtlas:A,dashPositions:w,glyphMap:this.returnDependencies?x:null,iconMap:this.returnDependencies?b:null,glyphPositions:this.returnDependencies?_.positions:null}}};function Jy(t,e,r){let i=new at(e);for(let n of t)n.recalculate(i,r)}var r1=class{constructor(){this.loading={},this.loaded={},this.parsing={}}startLoading(t,e){this.loading[t]=e}finishLoading(t){delete this.loading[t]}abort(t){let e=this.loading[t];e?.abort&&(e.abort.abort(),delete this.loading[t])}getParsing(t){return this.parsing[t]}setParsing(t,e){this.parsing[t]=e}removeParsing(t){delete this.parsing[t]}markLoaded(t,e){this.loaded[t]=e}getLoaded(t){let e=this.loaded[t];if(e)return e}removeLoaded(t){delete this.loaded[t]}clearLoaded(){this.loaded={}}},i1=class{constructor(t){this.start=`${t}#start`,this.end=`${t}#end`,this.measure=t,performance.mark(this.start)}finish(){performance.mark(this.end);let t=performance.getEntriesByName(this.measure);return t.length===0&&(performance.measure(this.measure,this.start,this.end),t=performance.getEntriesByName(this.measure),performance.clearMarks(this.start),performance.clearMarks(this.end),performance.clearMeasures(this.measure)),t}},W6=class{constructor(t,e,r,i,n){this.type=t,this.properties=r||{},this.extent=n,this.pointsArray=e,this.id=i}loadGeometry(){return this.pointsArray.map(t=>t.map(e=>new B(e.x,e.y)))}},Z6=class{constructor(t,e,r){this.version=2,this._myFeatures=t,this.name=e,this.length=t.length,this.extent=r}feature(t){return this._myFeatures[t]}},H6=class{constructor(){this.layers={}}addLayer(t){this.layers[t.name]=t}};function K6(t,e,r){let{extent:i}=t,n=2**(r.z-e.z),a=(r.x-e.x*n)*i,s=(r.y-e.y*n)*i,o=[];for(let l=0;l<t.length;l++){let u=t.feature(l),h=u.loadGeometry();for(let c of h)for(let p of c)p.x=p.x*n-a,p.y=p.y*n-s;h=hy(h,u.type,-128,-128,i+128,i+128),h.length!==0&&o.push(new W6(u.type,h,u.properties,u.id,i))}return new Z6(o,t.name,i)}var J6=class{constructor(t,e,r){this.actor=t,this.layerIndex=e,this.availableImages=r,this.tileState=new r1,this.overzoomedTileResultCache=new Ky(1e3)}loadVectorTile(t,e){try{return{vectorTile:t.encoding===\"mlt\"?new Au(e):new ql(new ru(e)),rawData:e}}catch(r){let i=new Uint8Array(e),n=i[0]===31&&i[1]===139,a=`Unable to parse the tile at ${t.request.url}, `;throw a+=n?\"please make sure the data is not gzipped and that you have configured the relevant header in the server\":`got error: ${Wi(r).message}`,Error(a)}}async loadTile(t){let{uid:e,overzoomParameters:r}=t;r&&(t.request=r.overzoomRequest);let i=this._startRequestTiming(t),n=new e1(t);this.tileState.startLoading(e,n);let a=new AbortController;n.abort=a;try{let s=await wp(t.request,a);if(t.etag&&t.etag===s.etag)return this.tileState.finishLoading(e),this._getEtagUnmodifiedResult(s,i);let o=this.loadVectorTile(t,s.data);if(this.tileState.finishLoading(e),!o)return null;let{vectorTile:l,rawData:u}=o;r&&({vectorTile:l,rawData:u}=this._getOverzoomTile(t,l));let h=this._getExpiryData(s),c=this._finishRequestTiming(i);n.vectorTile=l,n.etag=s.etag,this.tileState.markLoaded(e,n);let p={rawData:u,cacheControl:h,resourceTiming:c};return this.tileState.setParsing(e,p),await this._parseWorkerTile(n,t)}catch(s){throw this.tileState.finishLoading(e),this.tileState.markLoaded(e,n),s}}_getEtagUnmodifiedResult(t,e){let r=this._getExpiryData(t),i=this._finishRequestTiming(e);return qt({etagUnmodified:!0},r,i)}async _parseWorkerTile(t,e){let r=this.tileState.getParsing(t.uid),i=await t.parse(t.vectorTile,this.layerIndex,this.availableImages,this.actor,e.subdivisionGranularity);if(r){let{rawData:n,cacheControl:a,resourceTiming:s}=r,o=e.overzoomParameters?\"mvt\":e.encoding;i=qt({rawTileData:n.slice(0),encoding:o},i,a,s),this.tileState.removeParsing(t.uid)}else t.etag&&(i=qt(i,{etag:t.etag}));return i}_getExpiryData({expires:t,cacheControl:e,etag:r}){let i={};return t&&(i.expires=t),e&&(i.cacheControl=e),r&&(i.etag=r),i}_startRequestTiming(t){if(t.request?.collectResourceTiming)return new i1(t.request.url)}_finishRequestTiming(t){let e=t?.finish();return e?{resourceTiming:JSON.parse(JSON.stringify(e))}:{}}_getOverzoomTile(t,e){let{tileID:r,source:i,overzoomParameters:n}=t,{maxZoomTileID:a}=n,s=`${a.key}_${r.key}_${t.request?.url}`,o=this.overzoomedTileResultCache.get(s);if(o)return o;let l=new H6,u=this.layerIndex.familiesBySource[i];for(let c in u){let p=e.layers[c];if(!p)continue;let f=K6(p,a,r.canonical);f.length>0&&l.addLayer(f)}let h={vectorTile:l,rawData:ou(l).buffer};return this.overzoomedTileResultCache.set(s,h),h}async reloadTile(t){let e=t.uid,r=this.tileState.getLoaded(e);if(!r)throw Error(\"Should not be trying to reload a tile that was never loaded or has been removed\");if(r.vectorTile)return r.showCollisionBoxes=t.showCollisionBoxes,await this._parseWorkerTile(r,t)}async abortTile(t){this.tileState.abort(t.uid)}async removeTile(t){this.tileState.removeLoaded(t.uid)}},Q6=class{constructor(){this.loaded={}}async loadTile(t){let{uid:e,encoding:r,rawImageData:i,redFactor:n,greenFactor:a,blueFactor:s,baseShift:o}=t,l=i.width+4,u=i.height+4,h=Sa(i)?new Wt({width:l,height:u},await mp(i,-2,-2,l,u)):i,c=new Nl(e,h,r,n,a,s,o);return this.loaded||(this.loaded={}),this.loaded[e]=c,c}removeTile(t){let e=this.loaded,r=t.uid;e?.[r]&&delete e[r]}},t5=class{constructor(t,e,r,i=e5){this.actor=t,this.layerIndex=e,this.availableImages=r,this.tileState=new r1,this._createGeoJSONIndex=i}loadVectorTile(t){if(!this._geoJSONIndex)throw Error(\"Unable to parse the data into a cluster or geojson\");let{z:e,x:r,y:i}=t.tileID.canonical,n=this._geoJSONIndex.getTile(e,r,i);if(!n)return null;let a=new vy(n.features,{version:2,extent:mt});return{vectorTile:a,rawData:ou(a,yp).buffer}}async loadTile(t){let{uid:e}=t,r=new e1(t);r.abort=new AbortController;try{let i=this.loadVectorTile(t);if(!i)return null;let{vectorTile:n,rawData:a}=i;r.vectorTile=n,this.tileState.markLoaded(e,r);let s={rawData:a};return this.tileState.setParsing(e,s),await this._parseWorkerTile(r,t)}catch(i){throw this.tileState.markLoaded(e,r),i}}async _parseWorkerTile(t,e){let r=this.tileState.getParsing(t.uid),i=await t.parse(t.vectorTile,this.layerIndex,this.availableImages,this.actor,e.subdivisionGranularity);if(r){let{rawData:n}=r;i=qt({rawTileData:n.slice(0),encoding:\"mvt\"},i),this.tileState.removeParsing(t.uid)}return i}async abortTile(t){this.tileState.abort(t.uid)}async removeTile(t){this.tileState.removeLoaded(t.uid)}async loadData(t){this._pendingRequest?.abort();let e=this._startRequestTiming(t);this._pendingRequest=new AbortController;try{await this.loadAndProcessGeoJSON(t,this._pendingRequest),delete this._pendingRequest,this.tileState.clearLoaded();let r={};return t.request&&(r.data=t.data),this._finishRequestTiming(e,t,r),r}catch(r){if(delete this._pendingRequest,!pl(r))throw r;return{abandoned:!0}}}_startRequestTiming(t){if(t.request?.collectResourceTiming)return new i1(t.request.url)}_finishRequestTiming(t,e,r){let i=t?.finish();i&&(r.resourceTiming={[e.source]:JSON.parse(JSON.stringify(i))})}async reloadTile(t){let e=t.uid,r=this.tileState.getLoaded(e);if(!r)return await this.loadTile(t);if(r.vectorTile)return r.showCollisionBoxes=t.showCollisionBoxes,await this._parseWorkerTile(r,t)}async loadAndProcessGeoJSON(t,e){if(t.request&&(t.data=(await bp(t.request,e)).data),t.data){t.data=this._filterGeoJSON(t.data,t.filter,t.source),this._geoJSONIndex=this._createGeoJSONIndex(t.data,t);return}if(t.dataDiff){this._geoJSONIndex??(this._geoJSONIndex=this._createGeoJSONIndex({type:\"FeatureCollection\",features:[]},t)),this._geoJSONIndex.updateData(t.dataDiff,this._getFilterPredicate(t.filter,t.source));return}if(t.updateCluster&&this._geoJSONIndex.updateClusterOptions(t.geojsonVtOptions.cluster,n1(t)),this._geoJSONIndex==null)throw Error(`Input data given to '${t.source}' is not a valid GeoJSON object.`)}_filterGeoJSON(t,e,r){if(t.type!==\"FeatureCollection\")return t;let i=this._getFilterPredicate(e,r);return i?{type:\"FeatureCollection\",features:t.features.filter(n=>i(n))}:t}_getFilterPredicate(t,e){if(typeof t!=\"boolean\"&&!t?.length)return;let r=tr(t,`sources.${e}.filter`,{type:\"boolean\",\"property-type\":\"data-driven\",overridable:!1,transition:!1});if(r.result===\"error\")throw Error(r.value.map(i=>`${i.key}: ${i.message}`).join(\", \"));return i=>r.value.evaluate({zoom:0},i)}async removeSource(t){this._pendingRequest?.abort()}getClusterExpansionZoom(t){return this._geoJSONIndex.getClusterExpansionZoom(t.clusterId)}getClusterChildren(t){return this._geoJSONIndex.getClusterChildren(t.clusterId)}getClusterLeaves(t){return this._geoJSONIndex.getClusterLeaves(t.clusterId,t.limit,t.offset)}};function e5(t,e){let r=qt(e.geojsonVtOptions||{},{updateable:!0,clusterOptions:n1(e)});return new $d(t,r)}function n1({geojsonVtOptions:t,clusterProperties:e,source:r}){if(!e||!t.clusterOptions)return t.clusterOptions;let i={},n={},a={accumulated:null,zoom:0},s={properties:null},o=Object.keys(e);for(let l of o){let[u,h]=e[l],c=tr(h,`sources.${r}.clusterProperties.${l}[1]`),p=tr(typeof u==\"string\"?[u,[\"accumulated\"],[\"get\",l]]:u,`sources.${r}.clusterProperties.${l}[0]`);i[l]=c.value,n[l]=p.value}return t.clusterOptions.map=l=>{s.properties=l;let u={};for(let h of o)u[h]=i[h].evaluate(a,s);return u},t.clusterOptions.reduce=(l,u)=>{s.properties=u;for(let h of o)a.accumulated=l[h],l[h]=n[h].evaluate(a,s)},t.clusterOptions}async function Qy(t){if(t.endsWith(\".mjs\")){await import(t);return}let e=await fetch(t,{credentials:\"same-origin\"});if(!e.ok)throw Error(`Failed to load ${t}: ${e.status}`);let r=await e.text();if(/^[ \\t]*(import|export)\\s/m.test(r)){let i=URL.createObjectURL(new Blob([r],{type:\"text/javascript\"}));try{await import(i)}finally{URL.revokeObjectURL(i)}return}globalThis.eval(r)}var r5=class{constructor(t){this.self=t,this.actor=new gy(t),this.layerIndexes={},this.availableImages={},this.workerSources={},this.demWorkerSources={},this.externalWorkerSourceTypes={},this.globalStates=new Map,this.self.registerWorkerSource=(e,r)=>{if(this.externalWorkerSourceTypes[e])throw Error(`Worker source with name \"${e}\" already registered.`);this.externalWorkerSourceTypes[e]=r},this.self.addProtocol=gp,this.self.removeProtocol=xp,this.self.registerRTLTextPlugin=e=>{vr.setMethods(e)},this.self.makeRequest=Ea,this.actor.registerMessageHandler(\"LDT\",(e,r)=>this._getDEMWorkerSource(e,r.source).loadTile(r)),this.actor.registerMessageHandler(\"RDT\",async(e,r)=>{this._getDEMWorkerSource(e,r.source).removeTile(r)}),this.actor.registerMessageHandler(\"GCEZ\",async(e,r)=>this._getWorkerSource(e,r.type,r.source).getClusterExpansionZoom(r)),this.actor.registerMessageHandler(\"GCC\",async(e,r)=>this._getWorkerSource(e,r.type,r.source).getClusterChildren(r)),this.actor.registerMessageHandler(\"GCL\",async(e,r)=>this._getWorkerSource(e,r.type,r.source).getClusterLeaves(r)),this.actor.registerMessageHandler(\"LD\",(e,r)=>this._getWorkerSource(e,r.type,r.source).loadData(r)),this.actor.registerMessageHandler(\"LT\",(e,r)=>this._getWorkerSource(e,r.type,r.source).loadTile(r)),this.actor.registerMessageHandler(\"RT\",(e,r)=>this._getWorkerSource(e,r.type,r.source).reloadTile(r)),this.actor.registerMessageHandler(\"AT\",(e,r)=>this._getWorkerSource(e,r.type,r.source).abortTile(r)),this.actor.registerMessageHandler(\"RMT\",(e,r)=>this._getWorkerSource(e,r.type,r.source).removeTile(r)),this.actor.registerMessageHandler(\"RS\",async(e,r)=>{if(!this.workerSources[e]?.[r.type]?.[r.source])return;let i=this.workerSources[e][r.type][r.source];delete this.workerSources[e][r.type][r.source],i.removeSource!==void 0&&i.removeSource(r)}),this.actor.registerMessageHandler(\"RM\",async e=>{delete this.layerIndexes[e],delete this.availableImages[e],delete this.workerSources[e],delete this.demWorkerSources[e],this.globalStates.delete(e)}),this.actor.registerMessageHandler(\"SR\",async(e,r)=>{this.referrer=r}),this.actor.registerMessageHandler(\"SRPS\",(e,r)=>this._syncRTLPluginState(e,r)),this.actor.registerMessageHandler(\"IS\",async(e,r)=>{await Qy(r)}),this.actor.registerMessageHandler(\"SI\",(e,r)=>this._setImages(e,r)),this.actor.registerMessageHandler(\"UL\",async(e,r)=>{this._getLayerIndex(e).update(r.layers,r.removedIds,this._getGlobalState(e))}),this.actor.registerMessageHandler(\"UGS\",async(e,r)=>{let i=this._getGlobalState(e);for(let n in r)i[n]=r[n]}),this.actor.registerMessageHandler(\"SL\",async(e,r)=>{this._getLayerIndex(e).replace(r,this._getGlobalState(e))})}_getGlobalState(t){let e=this.globalStates.get(t);return e||(e={},this.globalStates.set(t,e)),e}async _setImages(t,e){this.availableImages[t]=e;for(let r in this.workerSources[t]){let i=this.workerSources[t][r];for(let n in i)i[n].availableImages=e}}async _syncRTLPluginState(t,e){return await vr.syncState(e,Qy)}_getAvailableImages(t){let e=this.availableImages[t];return e||(e=[]),e}_getLayerIndex(t){let e=this.layerIndexes[t];return e||(e=this.layerIndexes[t]=new X6),e}_getWorkerSource(t,e,r){var i,n;if((i=this.workerSources)[t]||(i[t]={}),(n=this.workerSources[t])[e]||(n[e]={}),!this.workerSources[t][e][r]){let a={sendAsync:(s,o)=>(s.targetMapId=t,this.actor.sendAsync(s,o))};switch(e){case\"vector\":this.workerSources[t][e][r]=new J6(a,this._getLayerIndex(t),this._getAvailableImages(t));break;case\"geojson\":this.workerSources[t][e][r]=new t5(a,this._getLayerIndex(t),this._getAvailableImages(t));break;default:this.workerSources[t][e][r]=new this.externalWorkerSourceTypes[e](a,this._getLayerIndex(t),this._getAvailableImages(t))}}return this.workerSources[t][e][r]}_getDEMWorkerSource(t,e){var r,i;return(r=this.demWorkerSources)[t]||(r[t]={}),(i=this.demWorkerSources[t])[e]||(i[e]=new Q6),this.demWorkerSources[t][e]}};dr(self)&&(self.worker=new r5(self));export{r5 as default};\n";
12396
+ ;// ./src/map/installMapLibreWorker.ts
12397
+
12398
+
12399
+
12400
+ /**
12401
+ * The blob URL this SDK created, or `null` while nothing has been installed yet. Kept so the
12402
+ * install is idempotent and so we can tell our own URL from one a consumer supplied.
12403
+ */
12404
+ var installedWorkerUrl = null;
12405
+
12406
+ /**
12407
+ * Registers a self-contained MapLibre worker carried inside this bundle.
12408
+ *
12409
+ * MapLibre 6 no longer inlines its worker. It resolves it at runtime with
12410
+ * `new URL('./maplibre-gl-worker.mjs', import.meta.url)`, building the filename by concatenation
12411
+ * so no bundler can see it statically and none emit the file. Once a consumer bundles this SDK,
12412
+ * `import.meta.url` is the consumer's own chunk, the worker is requested from a path where nothing
12413
+ * exists — in a single-page app the request falls through to the app shell and the worker dies on
12414
+ * a `text/html` MIME error — and the map renders nothing at all. Handing MapLibre a `blob:` URL
12415
+ * removes that resolution from the picture entirely, so this holds regardless of the consumer's
12416
+ * bundler, base href, or whether the app is served from a subpath.
12417
+ *
12418
+ * Must run before anything touches MapLibre's global worker pool, which is earlier than it looks.
12419
+ * The pool is created by the first `Dispatcher` and the URL is read then, once, and not again
12420
+ * while a map is alive — so any MapLibre call that builds a Dispatcher ahead of this one wins
12421
+ * permanently. `new Map(...)` is the obvious one, but `prewarm()`, `importScriptInWorkers()` and
12422
+ * the now-removed `setRTLTextPlugin()` all do it too. Hence the very top of the map constructor,
12423
+ * rather than next to the map.
12424
+ *
12425
+ * Never called at module load: that would run `new Blob` and `URL.createObjectURL` during import,
12426
+ * which fails under SSR and in jsdom, and would hand MapLibre a worker URL for applications that
12427
+ * import this package without ever creating a map. It does not save memory — the worker string is
12428
+ * resident from the moment this module is imported either way.
12429
+ *
12430
+ * A consumer that installed its own worker URL is self-hosting on purpose — a strict
12431
+ * Content-Security-Policy without `worker-src blob:`, typically — and is left alone.
12432
+ *
12433
+ * Under such a policy with no URL set, the failure is silent from the application's side, and
12434
+ * measured rather than assumed: `createObjectURL` does not throw, `new Worker` does not throw
12435
+ * synchronously, and MapLibre fires no `error` event. The only signal is the browser's own
12436
+ * console message, *"Creating a worker from 'blob:…' violates the following Content Security
12437
+ * Policy directive"*, next to a map that never loads. That string is repeated here so searching
12438
+ * for it lands on this explanation and on `setMapLibreWorkerUrl`.
12439
+ *
12440
+ * @see setMapLibreWorkerUrl for the supported way to opt out.
12441
+ * @group Configuration
12442
+ */
12443
+ function installMapLibreWorker() {
12444
+ if (installedWorkerUrl !== null) return;
12445
+ // `WORKER_URL` defaults to "", so a truthy value can only mean a consumer set one.
12446
+ if (maplibre_gl_xh()) return;
12447
+ var runtimeVersion = maplibre_gl_gh();
12448
+ if (runtimeVersion !== MAPLIBRE_WORKER_VERSION) {
12449
+ // The bundled worker and the running MapLibre talk an internal, unversioned protocol. A skew
12450
+ // is only possible if the consumer forced a different maplibre-gl than this SDK pinned; it is
12451
+ // still better to install a slightly mismatched worker than to leave the map with none, so
12452
+ // this warns rather than bails.
12453
+ console.warn("[MapVX] MapLibre version mismatch: the bundled worker is ".concat(MAPLIBRE_WORKER_VERSION, " but ") + "maplibre-gl ".concat(runtimeVersion, " is running. Install maplibre-gl@").concat(MAPLIBRE_WORKER_VERSION, " ") + "or call setMapLibreWorkerUrl() with a self-hosted worker of the matching version.");
12454
+ }
12455
+ try {
12456
+ var blob = new Blob([MAPLIBRE_WORKER_SOURCE], {
12457
+ type: "text/javascript"
12458
+ });
12459
+ // Deliberately never revoked. MapLibre terminates its worker pool when the last map is
12460
+ // removed and reads this URL again when the next map is created, so revoking would break
12461
+ // every map after the first.
12462
+ installedWorkerUrl = URL.createObjectURL(blob);
12463
+ maplibre_gl_Sh(installedWorkerUrl);
12464
+ } catch (error) {
12465
+ // Blob/createObjectURL are absent under SSR and in some test environments. Leaving MapLibre's
12466
+ // own resolution in place is the best remaining option: it works when the SDK is served
12467
+ // unbundled, which is exactly the situation where this path is reachable.
12468
+ installedWorkerUrl = null;
12469
+ console.warn("[MapVX] Could not install the bundled MapLibre worker:", error);
12470
+ }
12471
+ }
12472
+
12473
+ /**
12474
+ * Points MapLibre at a worker script you host yourself, instead of the one bundled into this SDK.
12475
+ *
12476
+ * The bundled worker is delivered as a `blob:` URL, which a Content-Security-Policy without
12477
+ * `worker-src blob:` (or `child-src blob:`) will block. Self-hosting is the way out: copy
12478
+ * `maplibre-gl-worker.mjs` **and** `maplibre-gl-shared.mjs` from `maplibre-gl/dist` — the worker
12479
+ * imports the shared file at runtime, so both must be served from the same directory — and point
12480
+ * this at the first one. Use `npm ls maplibre-gl` to see which version this SDK resolved; the
12481
+ * files must come from that one.
12482
+ *
12483
+ * **The URL has to be same-origin.** A cross-origin one does not escape `blob:`: MapLibre wraps
12484
+ * any worker URL it considers cross-origin in a generated `blob:` worker that imports it, so a
12485
+ * CDN-hosted worker hits exactly the same Content-Security-Policy wall as the bundled one.
12486
+ *
12487
+ * Call it before creating any map. Once MapLibre's worker pool has spun up it does not re-read the
12488
+ * URL until every map has been removed.
12489
+ *
12490
+ * Exists so opting out does not force a direct `maplibre-gl` dependency on consumers that only
12491
+ * use this SDK.
12492
+ *
12493
+ * @param url - URL of the MapLibre worker script to load.
12494
+ * @example
12495
+ * ```ts
12496
+ * import { setMapLibreWorkerUrl, initializeSDK } from "@mapvx/web-js"
12497
+ *
12498
+ * setMapLibreWorkerUrl("/assets/maplibre-gl-worker.mjs")
12499
+ * const sdk = initializeSDK(token)
12500
+ * ```
12501
+ * @group Configuration
12502
+ */
12503
+ function setMapLibreWorkerUrl(url) {
12504
+ maplibre_gl_Sh(url);
12505
+ // Stop claiming ownership: the URL in play is now the consumer's, and ours (if any) must not be
12506
+ // revoked while a worker pool may still be using it.
12507
+ installedWorkerUrl = null;
12508
+ }
12509
+
12510
+ /**
12511
+ * The worker URL MapLibre will use, or `""` when none has been set yet.
12512
+ *
12513
+ * Returns a `blob:` URL once the bundled worker has been installed, which happens when the first
12514
+ * map is created. Useful to assert in tests that the bundled worker is in play.
12515
+ *
12516
+ * @returns The current MapLibre worker URL.
12517
+ * @group Configuration
12518
+ */
12519
+ function getMapLibreWorkerUrl() {
12520
+ return maplibre_gl_xh();
12521
+ }
12522
+
12523
+ /**
12524
+ * Resets the module-level install state. Test seam only — the blob URL is intentionally never
12525
+ * revoked in production, so there is nothing to clean up outside tests.
12526
+ *
12527
+ * @internal
12528
+ */
12529
+ function resetMapLibreWorkerInstallForTests() {
12530
+ installedWorkerUrl = null;
12531
+ }
12382
12532
  ;// ./src/assets/icons.ts
12383
12533
  var userLocationDataUrl = "data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%20aria-hidden%3D%22false%22%20role%3D%22img%22%3E%3Ccircle%20cx%3D%2212%22%20cy%3D%2212%22%20r%3D%226%22%20fill%3D%22var(--icon-fill%2C%20%23007aff)%22%20stroke%3D%22var(--icon-stroke%2C%20%23ffffff)%22%20stroke-width%3D%222%22/%3E%3C/svg%3E";
12384
12534
 
@@ -15906,13 +16056,6 @@ var RouteController = /*#__PURE__*/function () {
15906
16056
  }
15907
16057
  }]);
15908
16058
  }();
15909
- ;// ./src/domain/models/_rtl.ts
15910
- /**
15911
- * Array of language codes that use right-to-left (RTL) text direction
15912
- * These languages require special handling for text layout and UI direction
15913
- * @group Utils
15914
- */
15915
- var rtlLanguages = ["ar"];
15916
16059
  ;// ./src/domain/models/routeConfiguration.ts
15917
16060
  function routeConfiguration_typeof(o) { "@babel/helpers - typeof"; return routeConfiguration_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, routeConfiguration_typeof(o); }
15918
16061
  function routeConfiguration_defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, routeConfiguration_toPropertyKey(o.key), o); } }
@@ -21345,7 +21488,7 @@ function scene3DController_toPrimitive(t, r) { if ("object" != scene3DController
21345
21488
  */
21346
21489
  var Scene3DController = /*#__PURE__*/function () {
21347
21490
  function Scene3DController(map, scene3DConfig, initialCenter, onModelsProgress) {
21348
- var _scene3DConfig$custom;
21491
+ var _scene3DConfig$custom, _scene3DConfig$custom2, _scene3DConfig$custom3;
21349
21492
  scene3DController_classCallCheck(this, Scene3DController);
21350
21493
  /** Latest known floor key; updated by the floor-change hooks and read when (re)building layers. */
21351
21494
  scene3DController_defineProperty(this, "currentFloor", "");
@@ -21387,6 +21530,7 @@ var Scene3DController = /*#__PURE__*/function () {
21387
21530
  this.initialCenter = initialCenter;
21388
21531
  this.onModelsProgress = onModelsProgress;
21389
21532
  this.deckTileCache = resolveDeckTileCache((_scene3DConfig$custom = scene3DConfig.customLayers) === null || _scene3DConfig$custom === void 0 ? void 0 : _scene3DConfig$custom.tileCache);
21533
+ this.useTileWorker = (_scene3DConfig$custom2 = (_scene3DConfig$custom3 = scene3DConfig.customLayers) === null || _scene3DConfig$custom3 === void 0 ? void 0 : _scene3DConfig$custom3.useTileWorker) !== null && _scene3DConfig$custom2 !== void 0 ? _scene3DConfig$custom2 : false;
21390
21534
  this.lodThresholds = resolveModels3DLodThresholds(scene3DConfig.models);
21391
21535
  }
21392
21536
 
@@ -22382,12 +22526,18 @@ var Scene3DController = /*#__PURE__*/function () {
22382
22526
  return loadSpriteAtlas;
22383
22527
  }()
22384
22528
  /**
22385
- * Cache-bounding props spread onto every deck.gl `MVTLayer` so the overlays never keep an
22386
- * unbounded set of parsed tiles in memory. `maxCacheByteSize` is only included when configured
22387
- * (deck.gl enforces it only when a tile's byte size is known).
22529
+ * Props spread onto every deck.gl `MVTLayer`.
22530
+ *
22531
+ * The cache bounds stop the overlays from keeping an unbounded set of parsed tiles in memory;
22532
+ * `maxCacheByteSize` is only included when configured, since deck.gl enforces it only when a
22533
+ * tile's byte size is known.
22534
+ *
22535
+ * `loadOptions.worker` is what keeps the scene off `unpkg.com`: loaders.gl would otherwise fetch
22536
+ * its MVT worker from there the first time a tile is parsed, and that request is not something a
22537
+ * kiosk can rely on. See {@link CustomLayerConfig.useTileWorker}.
22388
22538
  */
22389
22539
  }, {
22390
- key: "deckTileCacheProps",
22540
+ key: "deckTileLayerProps",
22391
22541
  get: function get() {
22392
22542
  var _this$deckTileCache = this.deckTileCache,
22393
22543
  maxCacheSize = _this$deckTileCache.maxCacheSize,
@@ -22397,7 +22547,10 @@ var Scene3DController = /*#__PURE__*/function () {
22397
22547
  var props = {
22398
22548
  maxCacheSize: maxCacheSize,
22399
22549
  maxRequests: maxRequests,
22400
- refinementStrategy: refinementStrategy
22550
+ refinementStrategy: refinementStrategy,
22551
+ loadOptions: {
22552
+ worker: this.useTileWorker
22553
+ }
22401
22554
  };
22402
22555
  if (maxCacheByteSize !== undefined) {
22403
22556
  props.maxCacheByteSize = maxCacheByteSize;
@@ -22410,7 +22563,7 @@ var Scene3DController = /*#__PURE__*/function () {
22410
22563
  var _layerConfig$binaryDa;
22411
22564
  var deck = this.deckMod;
22412
22565
  if (!deck) return null;
22413
- return new deck.MVTLayer(scene3DController_objectSpread(scene3DController_objectSpread({}, this.deckTileCacheProps), {}, {
22566
+ return new deck.MVTLayer(scene3DController_objectSpread(scene3DController_objectSpread({}, this.deckTileLayerProps), {}, {
22414
22567
  id: "indoor-lines-elevated",
22415
22568
  data: layerConfig.dataUrl,
22416
22569
  binary: (_layerConfig$binaryDa = layerConfig.binaryData) !== null && _layerConfig$binaryDa !== void 0 ? _layerConfig$binaryDa : false,
@@ -22447,7 +22600,7 @@ var Scene3DController = /*#__PURE__*/function () {
22447
22600
  var useSdf = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
22448
22601
  var deck = this.deckMod;
22449
22602
  if (!deck) return null;
22450
- return new deck.MVTLayer(scene3DController_objectSpread(scene3DController_objectSpread({}, this.deckTileCacheProps), {}, {
22603
+ return new deck.MVTLayer(scene3DController_objectSpread(scene3DController_objectSpread({}, this.deckTileLayerProps), {}, {
22451
22604
  id: "indoor-labels",
22452
22605
  data: layerConfig.dataUrl,
22453
22606
  binary: (_layerConfig$binaryDa2 = layerConfig.binaryData) !== null && _layerConfig$binaryDa2 !== void 0 ? _layerConfig$binaryDa2 : false,
@@ -22500,7 +22653,7 @@ var Scene3DController = /*#__PURE__*/function () {
22500
22653
  _this7 = this;
22501
22654
  var deck = this.deckMod;
22502
22655
  if (!deck || !this.spriteIconMapping || !this.spriteAtlasImage) return null;
22503
- return new deck.MVTLayer(scene3DController_objectSpread(scene3DController_objectSpread({}, this.deckTileCacheProps), {}, {
22656
+ return new deck.MVTLayer(scene3DController_objectSpread(scene3DController_objectSpread({}, this.deckTileLayerProps), {}, {
22504
22657
  id: "indoor-poi-icons",
22505
22658
  data: layerConfig.dataUrl,
22506
22659
  binary: (_layerConfig$binaryDa3 = layerConfig.binaryData) !== null && _layerConfig$binaryDa3 !== void 0 ? _layerConfig$binaryDa3 : false,
@@ -22542,7 +22695,7 @@ var Scene3DController = /*#__PURE__*/function () {
22542
22695
  _this8 = this;
22543
22696
  var deck = this.deckMod;
22544
22697
  if (!deck || !this.spriteIconMapping || !this.spriteAtlasImage) return null;
22545
- return new deck.MVTLayer(scene3DController_objectSpread(scene3DController_objectSpread({}, this.deckTileCacheProps), {}, {
22698
+ return new deck.MVTLayer(scene3DController_objectSpread(scene3DController_objectSpread({}, this.deckTileLayerProps), {}, {
22546
22699
  id: "indoor-store-logos",
22547
22700
  data: layerConfig.dataUrl,
22548
22701
  binary: (_layerConfig$binaryDa4 = layerConfig.binaryData) !== null && _layerConfig$binaryDa4 !== void 0 ? _layerConfig$binaryDa4 : false,
@@ -23148,6 +23301,7 @@ function map_toPrimitive(t, r) { if ("object" != map_typeof(t) || !t) return t;
23148
23301
  ;
23149
23302
 
23150
23303
 
23304
+
23151
23305
  /** Shared GeoJSON source holding every circle drawn through the circle API. */
23152
23306
  var CIRCLE_SOURCE_ID = "mapvx-circles";
23153
23307
  /** Fill layer rendering the translucent interior of the circles. */
@@ -23356,7 +23510,6 @@ function convertPaddingToPixels(padding, containerWidth, containerHeight) {
23356
23510
 
23357
23511
 
23358
23512
 
23359
-
23360
23513
  /**
23361
23514
  * @group Map
23362
23515
  */
@@ -23376,10 +23529,18 @@ var InternalMapVXMap = /*#__PURE__*/function (_Loggeable) {
23376
23529
  * @returns A new instance of MapVXMap.
23377
23530
  */
23378
23531
  function InternalMapVXMap(mapConfig, container, token) {
23379
- var _mapConfig$lang, _mapConfig$lang2, _mapConfig$lang3, _mapConfig$mode;
23532
+ var _mapConfig$lang, _mapConfig$lang2, _mapConfig$mode;
23380
23533
  var _this;
23381
23534
  map_classCallCheck(this, InternalMapVXMap);
23382
23535
  _this = map_callSuper(this, InternalMapVXMap);
23536
+ // First statement on purpose, and further forward than it looks necessary. MapLibre reads
23537
+ // WORKER_URL once, when its first Dispatcher is built, and never again while any map is alive
23538
+ // — so the worker has to be installed before *anything* touches MapLibre, not merely before
23539
+ // `new Map(...)`. Today the constructor reaches MapLibre only through the map itself, but
23540
+ // until recently it also called `setRTLTextPlugin()` here, which builds a Dispatcher of its
23541
+ // own 200 lines ahead of the map; `prewarm()` and `importScriptInWorkers()` do the same.
23542
+ // Keeping this first means no later edit can slip such a call in front of it.
23543
+ // See installMapLibreWorker and DEVELOPER_DOCS/MAPLIBRE_V6_MIGRATION.md.
23383
23544
  /**
23384
23545
  * Logged-in user's bearer token, if the map was created with one.
23385
23546
  * When present, `setStyle` resolves styles through the bearer-authenticated
@@ -23459,10 +23620,8 @@ var InternalMapVXMap = /*#__PURE__*/function (_Loggeable) {
23459
23620
  map_defineProperty(_this, "floorSettleDeadline", null);
23460
23621
  /** Owns the deck.gl overlay + GLB scene; created on style load only when 3D is active. */
23461
23622
  map_defineProperty(_this, "scene3D", undefined);
23462
- if (rtlLanguages.includes((_mapConfig$lang = mapConfig.lang) !== null && _mapConfig$lang !== void 0 ? _mapConfig$lang : "")) {
23463
- _this.setRTLSupport();
23464
- }
23465
- _this.repository = new Repository(token, (_mapConfig$lang2 = mapConfig.lang) !== null && _mapConfig$lang2 !== void 0 ? _mapConfig$lang2 : "en", mapConfig.apiUrl, undefined, mapConfig.mapvxRequestContext, {
23623
+ installMapLibreWorker();
23624
+ _this.repository = new Repository(token, (_mapConfig$lang = mapConfig.lang) !== null && _mapConfig$lang !== void 0 ? _mapConfig$lang : "en", mapConfig.apiUrl, undefined, mapConfig.mapvxRequestContext, {
23466
23625
  routeApiUrl: mapConfig.routeApiUrl,
23467
23626
  healthApiUrl: mapConfig.healthApiUrl,
23468
23627
  legacyApiUrl: mapConfig.legacyApiUrl,
@@ -23470,7 +23629,7 @@ var InternalMapVXMap = /*#__PURE__*/function (_Loggeable) {
23470
23629
  });
23471
23630
  _this.token = token;
23472
23631
  _this.authToken = mapConfig.authToken;
23473
- _this.currentLang = (_mapConfig$lang3 = mapConfig.lang) !== null && _mapConfig$lang3 !== void 0 ? _mapConfig$lang3 : "en";
23632
+ _this.currentLang = (_mapConfig$lang2 = mapConfig.lang) !== null && _mapConfig$lang2 !== void 0 ? _mapConfig$lang2 : "en";
23474
23633
  _this.parentPlaceId = mapConfig.parentPlaceId;
23475
23634
  _this.routeController = new RouteController(_this);
23476
23635
  _this.userLocationMarker = undefined;
@@ -23503,6 +23662,13 @@ var InternalMapVXMap = /*#__PURE__*/function (_Loggeable) {
23503
23662
  _this.initialMapStyleSetUp(mapConfig, container);
23504
23663
  return _this;
23505
23664
  }
23665
+
23666
+ /**
23667
+ * Transform style sources to use cached-tile:// protocol for tile URLs.
23668
+ * This enables the service worker to intercept and cache tile requests.
23669
+ * @param style The original style specification
23670
+ * @returns A new style with transformed tile URLs
23671
+ */
23506
23672
  map_inherits(InternalMapVXMap, _Loggeable);
23507
23673
  return map_createClass(InternalMapVXMap, [{
23508
23674
  key: "floorSettlePending",
@@ -23518,20 +23684,6 @@ var InternalMapVXMap = /*#__PURE__*/function (_Loggeable) {
23518
23684
  return typeof performance !== "undefined" ? performance.now() : Date.now();
23519
23685
  }
23520
23686
  /** Style variant/theme requested on every mapStyleJson fetch for this map. */
23521
- }, {
23522
- key: "setRTLSupport",
23523
- value: function setRTLSupport() {
23524
- maplibre_gl_mh("https://unpkg.com/@mapbox/mapbox-gl-rtl-text@0.3.0/dist/mapbox-gl-rtl-text.js", false)["catch"](function () {
23525
- // RTL support may fail in some browsers - this is expected
23526
- });
23527
- }
23528
-
23529
- /**
23530
- * Transform style sources to use cached-tile:// protocol for tile URLs.
23531
- * This enables the service worker to intercept and cache tile requests.
23532
- * @param style The original style specification
23533
- * @returns A new style with transformed tile URLs
23534
- */
23535
23687
  }, {
23536
23688
  key: "transformStyleForCaching",
23537
23689
  value: function transformStyleForCaching(style) {
@@ -24017,9 +24169,6 @@ var InternalMapVXMap = /*#__PURE__*/function (_Loggeable) {
24017
24169
  var _this0 = this;
24018
24170
  this.repository.setLang(lang);
24019
24171
  this.currentLang = lang;
24020
- if (rtlLanguages.includes(lang)) {
24021
- this.setRTLSupport();
24022
- }
24023
24172
  // setLayersForLanguage reads this.map.getStyle()?.layers, which is empty
24024
24173
  // until the style finishes loading. If setLang is called right after
24025
24174
  // createMap (before the "load" event), apply it once the style is ready
@@ -29008,6 +29157,12 @@ function normalizeOrigin(raw) {
29008
29157
 
29009
29158
 
29010
29159
 
29160
+ // ─── MapLibre worker ─────────────────────────────────────────────────────────
29161
+ // The SDK carries MapLibre's worker internally and installs it when the first map is created;
29162
+ // these exist for consumers whose Content-Security-Policy forbids blob: workers and who therefore
29163
+ // need to self-host it. See src/map/installMapLibreWorker.ts.
29164
+
29165
+
29011
29166
  /**
29012
29167
  * Function to load default styles
29013
29168
  * @group Utils