PageSourceSearch

https://havocrewards.com/assets/Venues-BQxKwEgm.js

js havocrewards.com collected 2026-09-24 14:44:30 UTC 1,089,451 bytes, 823 lines download raw bytes

1import{b as le,i as Ux,j as ue,e as __,s as Gx,d as Zx}from"./vendor-B71EOk4P.js";import{_ as qx,u as od,F as zu,a as y_,g as lf,S as Wx}from"./index-DdejeiNO.js";import{V as Hx,u as uf,c as Xx}from"./venueMapStore-CRzCLfnC.js";const Yx=le.createContext(null);function Kx(e,t){const i=Array.isArray(e)?e[0]:e?e.x:0,r=Array.isArray(e)?e[1]:e?e.y:0,a=Array.isArray(t)?t[0]:t?t.x:0,n=Array.isArray(t)?t[1]:t?t.y:0;return i===a&&r===n}function or(e,t){if(e===t)return!0;if(!e||!t)return!1;if(Array.isArray(e)){if(!Array.isArray(t)||e.length!==t.length)return!1;for(let i=0;i<e.length;i++)if(!or(e[i],t[i]))return!1;return!0}else if(Array.isArray(t))return!1;if(typeof e=="object"&&typeof t=="object"){const i=Object.keys(e),r=Object.keys(t);if(i.length!==r.length)return!1;for(const a of i)if(!t.hasOwnProperty(a)||!or(e[a],t[a]))return!1;return!0}return!1}function hf(e){var t;return{center:e.getCenter(),zoom:e.getZoom(),bearing:e.getBearing(),pitch:e.getPitch(),elevation:((t=e.getCenterElevation)==null?void 0:t.call(e))??0,padding:e.getPadding()}}function cf(e){return{longitude:e.center.lng,latitude:e.center.lat,zoom:e.zoom,pitch:e.pitch,bearing:e.bearing,padding:e.padding}}function df(e,t){const i=t.viewState||t,r={};if("longitude"in i&&"latitude"in i&&(i.longitude!==e.center.lng||i.latitude!==e.center.lat)){const a=e.center.constructor;r.center=new a(i.longitude,i.latitude)}return"zoom"in i&&i.zoom!==e.zoom&&(r.zoom=i.zoom),"bearing"in i&&i.bearing!==e.bearing&&(r.bearing=i.bearing),"pitch"in i&&i.pitch!==e.pitch&&(r.pitch=i.pitch),i.padding&&e.padding&&!or(i.padding,e.padding)&&(r.padding=i.padding),r}function v_(e,t,i,r){return e.min===t.min&&e.max===t.max?!1:(e.min>=t.min?(e.max!==t.max&&r(e.max),e.min!==t.min&&i(e.min)):(e.min!==t.min&&i(e.min),e.max!==t.max&&r(e.max)),!0)}function Jx(e,t,i){return v_(t,i,r=>e.setMinZoom(r),r=>e.setMaxZoom(r))}function Qx(e,t,i){return v_(t,i,r=>e.setMinPitch(r),r=>e.setMaxPitch(r))}const eb=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function pf(e){if(!e)return null;if(typeof e=="string"||("toJS"in e&&(e=e.toJS()),!e.layers))return e;const t={};for(const r of e.layers)t[r.id]=r;const i=e.layers.map(r=>{let a=null;"interactive"in r&&(a=Object.assign({},r),delete a.interactive);const n=t[r.ref];if(n){a=a||Object.assign({},r),delete a.ref;for(const s of eb)s in n&&(a[s]=n[s])}return a||r});return{...e,layers:i}}const ff={version:8,sources:{},layers:[]},ir={minZoom:0,maxZoom:22,minPitch:0,maxPitch:85,maxBounds:[-180,-85.051129,180,85.051129],projection:"mercator",renderWorldCopies:!0},mf={mousedown:"onMouseDown",mouseup:"onMouseUp",mouseover:"onMouseOver",mousemove:"onMouseMove",click:"onClick",dblclick:"onDblClick",mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",mouseout:"onMouseOut",contextmenu:"onContextMenu",touchstart:"onTouchStart",touchend:"onTouchEnd",touchmove:"onTouchMove",touchcancel:"onTouchCancel"},gf={movestart:"onMoveStart",move:"onMove",moveend:"onMoveEnd",dragstart:"onDragStart",drag:"onDrag",dragend:"onDragEnd",zoomstart:"onZoomStart",zoom:"onZoom",zoomend:"onZoomEnd",rotatestart:"onRotateStart",rotate:"onRotate",rotateend:"onRotateEnd",pitchstart:"onPitchStart",pitch:"onPitch",pitchend:"onPitchEnd"},_f={wheel:"onWheel",boxzoomstart:"onBoxZoomStart",boxzoomend:"onBoxZoomEnd",boxzoomcancel:"onBoxZoomCancel",resize:"onResize",load:"onLoad",render:"onRender",idle:"onIdle",remove:"onRemove",data:"onData",styledata:"onStyleData",sourcedata:"onSourceData",error:"onError"},tb=["maxBounds","projection","renderWorldCopies"],ib=["scrollZoom","boxZoom","dragRotate","dragPan","keyboard","doubleClickZoom","touchZoomRotate","touchPitch"];class Ha{constructor(t,i,r){this._map=null,this._internalUpdate=!1,this._hoveredFeatures=null,this._propsedCameraUpdate=null,this._styleComponents={},this._onEvent=a=>{const n=this.props[_f[a.type]];n?n(a):a.type==="error"&&console.error(a.error)},this._onCameraEvent=a=>{if(this._internalUpdate)return;a.viewState=this._propsedCameraUpdate||cf(hf(this._map));const n=this.props[gf[a.type]];n&&n(a)},this._onCameraUpdate=a=>this._internalUpdate?a:(this._propsedCameraUpdate=cf(a),df(a,this.props)),this._onPointerEvent=a=>{(a.type==="mousemove"||a.type==="mouseout")&&this._updateHover(a);const n=this.props[mf[a.type]];n&&(this.props.interactiveLayerIds&&a.type!=="mouseover"&&a.type!=="mouseout"&&(a.features=this._hoveredFeatures||this._queryRenderedFeatures(a.point)),n(a),delete a.features)},this._MapClass=t,this.props=i,this._initialize(r)}get map(){return this._map}setProps(t){const i=this.props;this.props=t;const r=this._updateSettings(t,i),a=this._updateSize(t),n=this._updateViewState(t);this._updateStyle(t,i),this._updateStyleComponents(t),this._updateHandlers(t,i),(r||a||n&&!this._map.isMoving())&&this.redraw()}static reuse(t,i){const r=Ha.savedMaps.pop();if(!r)return null;const a=r.map,n=a.getContainer();for(i.className=n.className;n.childNodes.length>0;)i.appendChild(n.childNodes[0]);a._container=i;const s=a._resizeObserver;s&&(s.disconnect(),s.observe(i)),r.setProps({...t,styleDiffing:!1}),a.resize();const{initialViewState:o}=t;return o&&(o.bounds?a.fitBounds(o.bounds,{...o.fitBoundsOptions,duration:0}):r._updateViewState(o)),a.isStyleLoaded()?a.fire("load"):a.once("style.load",()=>a.fire("load")),a._update(),r}_initialize(t){const{props:i}=this,{mapStyle:r=ff}=i,a={...i,...i.initialViewState,container:t,style:pf(r)},n=a.initialViewState||a.viewState||a;if(Object.assign(a,{center:[n.longitude||0,n.latitude||0],zoom:n.zoom||0,pitch:n.pitch||0,bearing:n.bearing||0}),i.gl){const l=HTMLCanvasElement.prototype.getContext;HTMLCanvasElement.prototype.getContext=()=>(HTMLCanvasElement.prototype.getContext=l,i.gl)}const s=new this._MapClass(a);n.padding&&s.setPadding(n.padding),i.cursor&&(s.getCanvas().style.cursor=i.cursor);const o=s;typeof o.setTransformCameraUpdate=="function"?o.setTransformCameraUpdate(this._onCameraUpdate):o.transformCameraUpdate=this._onCameraUpdate,s.on("style.load",()=>{var l;this._styleComponents={light:s.getLight(),sky:s.getSky(),projection:(l=s.getProjection)==null?void 0:l.call(s),terrain:s.getTerrain()},this._updateStyleComponents(this.props)}),s.on("sourcedata",()=>{this._updateStyleComponents(this.props)});for(const l in mf)s.on(l,this._onPointerEvent);for(const l in gf)s.on(l,this._onCameraEvent);for(const l in _f)s.on(l,this._onEvent);this._map=s}recycle(){const i=this.map.getContainer().querySelector("[mapboxgl-children]");i==null||i.remove(),Ha.savedMaps.push(this)}destroy(){this._map.remove()}redraw(){const t=this._map;t.style&&(t._frame&&(t._frame.cancel(),t._frame=null),t._render())}_updateSize(t){const{viewState:i}=t;if(i){const r=this._map,a=r.getCanvas();if(i.width!==a.clientWidth||i.height!==a.clientHeight)return r.resize(),!0}return!1}_updateViewState(t){const i=this._map,r=hf(i);if(!i.isMoving()){const n=df(r,t);if(Object.keys(n).length>0)return this._internalUpdate=!0,i.jumpTo(n),this._internalUpdate=!1,!0}return!1}_updateConstraints(t,i){const r=Jx(this._map,{min:t.minZoom??ir.minZoom,max:t.maxZoom??ir.maxZoom},{min:i.minZoom??ir.minZoom,max:i.maxZoom??ir.maxZoom}),a=Qx(this._map,{min:t.minPitch??ir.minPitch,max:t.maxPitch??ir.maxPitch},{min:i.minPitch??ir.minPitch,max:i.maxPitch??ir.maxPitch});return r||a}_updateSettings(t,i){const r=this._map;let a=!1;
1for(const s of tb)if((s in t||s in i)&&!or(t[s],i[s])){a=!0;const l=s in t?t[s]:ir[s],u=r[`set${s[0].toUpperCase()}${s.slice(1)}`];u==null||u.call(r,l)}const n=this._updateConstraints(t,i);return a||n}_updateStyle(t,i){if(t.cursor!==i.cursor&&(this._map.getCanvas().style.cursor=t.cursor||""),t.mapStyle!==i.mapStyle){const{mapStyle:r=ff,styleDiffing:a=!0}=t,n={diff:a};"localIdeographFontFamily"in t&&(n.localIdeographFontFamily=t.localIdeographFontFamily),this._map.setStyle(pf(r),n)}}_updateStyleComponents({light:t,projection:i,sky:r,terrain:a}){var o,l,u;const n=this._map,s=this._styleComponents;(o=n.style)!=null&&o._loaded&&(t&&!or(t,s.light)&&(s.light=t,n.setLight(t)),i&&!or(i,s.projection)&&i!==((l=s.projection)==null?void 0:l.type)&&(s.projection=typeof i=="string"?{type:i}:i,(u=n.setProjection)==null||u.call(n,s.projection)),r&&!or(r,s.sky)&&(s.sky=r,n.setSky(r)),a!==void 0&&!or(a,s.terrain)&&(!a||n.getSource(a.source))&&(s.terrain=a,n.setTerrain(a)))}_updateHandlers(t,i){const r=this._map;for(const a of ib){const n=t[a]??!0,s=i[a]??!0;or(n,s)||(n?r[a].enable(n):r[a].disable())}}_queryRenderedFeatures(t){const i=this._map,{interactiveLayerIds:r=[]}=this.props;try{return i.queryRenderedFeatures(t,{layers:r.filter(i.getLayer.bind(i))})}catch{return[]}}_updateHover(t){var a;const{props:i}=this;if(i.interactiveLayerIds&&(i.onMouseMove||i.onMouseEnter||i.onMouseLeave)){const n=t.type,s=((a=this._hoveredFeatures)==null?void 0:a.length)>0,o=this._queryRenderedFeatures(t.point),l=o.length>0;!l&&s&&(t.type="mouseleave",this._onPointerEvent(t)),this._hoveredFeatures=o,l&&!s&&(t.type="mouseenter",this._onPointerEvent(t)),t.type=n}else this._hoveredFeatures=null}}Ha.savedMaps=[];const rb=["setMaxBounds","setMinZoom","setMaxZoom","setMinPitch","setMaxPitch","setRenderWorldCopies","setProjection","setStyle","addSource","removeSource","addLayer","removeLayer","setLayerZoomRange","setFilter","setPaintProperty","setLayoutProperty","setLight","setTerrain","setFog","remove"];function ab(e){if(!e)return null;const t=e.map,i={getMap:()=>t};for(const r of nb(t))!(r in i)&&!rb.includes(r)&&(i[r]=t[r].bind(t));return i}function nb(e){const t=new Set;let i=e;for(;i;){for(const r of Object.getOwnPropertyNames(i))r[0]!=="_"&&typeof e[r]=="function"&&r!=="fire"&&r!=="setEventedParent"&&t.add(r);i=Object.getPrototypeOf(i)}return Array.from(t)}const sb=typeof document<"u"?le.useLayoutEffect:le.useEffect;function ob(e,t){const{RTLTextPlugin:i,maxParallelImageRequests:r,workerCount:a,workerUrl:n}=t;if(i&&e.getRTLTextPluginStatus&&e.getRTLTextPluginStatus()==="unavailable"){const{pluginUrl:s,lazy:o=!0}=typeof i=="string"?{pluginUrl:i}:i;e.setRTLTextPlugin(s,l=>{l&&console.error(l)},o)}r!==void 0&&e.setMaxParallelImageRequests(r),a!==void 0&&e.setWorkerCount(a),n!==void 0&&e.setWorkerUrl(n)}const ld=le.createContext(null);function lb(e,t){const i=le.useContext(Yx),[r,a]=le.useState(null),n=le.useRef(),{current:s}=le.useRef({mapLib:null,map:null});le.useEffect(()=>{const u=e.mapLib;let h=!0,c;return Promise.resolve(u||qx(()=>Promise.resolve().then(()=>Mk),void 0)).then(d=>{if(!h)return;if(!d)throw new Error("Invalid mapLib");const p="Map"in d?d:d.default;if(!p.Map)throw new Error("Invalid mapLib");ob(p,e),e.reuseMaps&&(c=Ha.reuse(e,n.current)),c||(c=new Ha(p.Map,e,n.current)),s.map=ab(c),s.mapLib=p,a(c),i==null||i.onMapMount(s.map,e.id)}).catch(d=>{const{onError:p}=e;p?p({type:"error",target:null,originalEvent:null,error:d}):console.error(d)}),()=>{h=!1,c&&(i==null||i.onMapUnmount(e.id),e.reuseMaps?c.recycle():c.destroy())}},[]),sb(()=>{r&&r.setProps(e)}),le.useImperativeHandle(t,()=>s.map,[r]);const o=le.useMemo(()=>({position:"relative",width:"100%",height:"100%",...e.style}),[e.style]),l={height:"100%"};return le.createElement("div",{id:e.id,ref:n,style:o},r&&le.createElement(ld.Provider,{value:s},le.createElement("div",{"mapboxgl-children":"",style:l},e.children)))}const ub=le.forwardRef(lb),hb=/box|flex|grid|column|lineHeight|fontWeight|opacity|order|tabSize|zIndex/;function x_(e,t){if(!e||!t)return;const i=e.style;for(const r in t){const a=t[r];Number.isFinite(a)&&!hb.test(r)?i[r]=`${a}px`:i[r]=a}}function cb(e,t){if(e===t)return null;const i=yf(e),r=yf(t),a=[];for(const n of r)i.has(n)||a.push(n);for(const n of i)r.has(n)||a.push(n);return a.length===0?null:a}function yf(e){return new Set(e?e.trim().split(/\s+/):[])}const vf=le.memo(le.forwardRef((e,t)=>
1{const{map:i,mapLib:r}=le.useContext(ld),a=le.useRef({props:e}),n=le.useMemo(()=>{let _=!1;le.Children.forEach(e.children,v=>{v&&(_=!0)});const y={...e,element:_?document.createElement("div"):void 0},x=new r.Marker(y);return x.setLngLat([e.longitude,e.latitude]),x.getElement().addEventListener("click",v=>{var w,b;(b=(w=a.current.props).onClick)==null||b.call(w,{type:"click",target:x,originalEvent:v})}),x.on("dragstart",v=>{var b,T;const w=v;w.lngLat=n.getLngLat(),(T=(b=a.current.props).onDragStart)==null||T.call(b,w)}),x.on("drag",v=>{var b,T;const w=v;w.lngLat=n.getLngLat(),(T=(b=a.current.props).onDrag)==null||T.call(b,w)}),x.on("dragend",v=>{var b,T;const w=v;w.lngLat=n.getLngLat(),(T=(b=a.current.props).onDragEnd)==null||T.call(b,w)}),x},[]);le.useEffect(()=>(n.addTo(i.getMap()),()=>{n.remove()}),[]);const{longitude:s,latitude:o,offset:l,style:u,draggable:h=!1,popup:c=null,rotation:d=0,rotationAlignment:p="auto",pitchAlignment:f="auto"}=e;le.useEffect(()=>{x_(n.getElement(),u)},[u]),le.useImperativeHandle(t,()=>n,[]);const m=a.current.props;(n.getLngLat().lng!==s||n.getLngLat().lat!==o)&&n.setLngLat([s,o]),l&&!Kx(n.getOffset(),l)&&n.setOffset(l),n.isDraggable()!==h&&n.setDraggable(h),n.getRotation()!==d&&n.setRotation(d),n.getRotationAlignment()!==p&&n.setRotationAlignment(p),n.getPitchAlignment()!==f&&n.setPitchAlignment(f),n.getPopup()!==c&&n.setPopup(c);const g=cb(m.className,e.className);if(g)for(const _ of g)n.toggleClassName(_);return a.current.props=e,Ux.createPortal(e.children,n.getElement())}));function db(e,t,i,r){const a=le.useContext(ld),n=le.useMemo(()=>e(a),[]);return le.useEffect(()=>{const s=t,o=typeof t=="function"?t:null,{map:l}=a;return l.hasControl(n)||l.addControl(n,s==null?void 0:s.position),()=>{o&&o(a),l.hasControl(n)&&l.removeControl(n)}},[]),n}function pb(e){const t=db(({mapLib:i})=>new i.NavigationControl(e),{position:e.position});return le.useEffect(()=>{x_(t._container,e.style)},[e.style]),null}const fb=le.memo(pb),mb="/assets/maplibre-gl-worker-h4-_G1GT.js";/**
2* MapLibre GL JS
3* @license 3-Clause BSD. Full text of license: https://github.com/maplibre/maplibre-gl-js/blob/v6.10.0/LICENSE.txt
4*/var gb=Object.create,b_=Object.defineProperty,_b=Object.getOwnPropertyDescriptor,yb=Object.getOwnPropertyNames,vb=Object.getPrototypeOf,xb=Object.prototype.hasOwnProperty,ud=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),bb=(e,t,i,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(var a=yb(t),n=0,s=a.length,o;n<s;n++)o=a[n],!xb.call(e,o)&&o!==i&&b_(e,o,{get:(l=>t[l]).bind(null,o),enumerable:!(r=_b(t,o))||r.enumerable});return e},wb=(e,t,i)=>(i=e==null?{}:gb(vb(e)),bb(b_(i,"default",{value:e,enumerable:!0}),e));function A(e,t){this.x=e,this.y=t}A.prototype={clone(){return new A(this.x,this.y)},add(e){return this.clone()._add(e)},sub(e){return this.clone()._sub(e)},multByPoint(e){return this.clone()._multByPoint(e)},divByPoint(e){return this.clone()._divByPoint(e)},mult(e){return this.clone()._mult(e)},div(e){return this.clone()._div(e)},rotate(e){return this.clone()._rotate(e)},rotateAround(e,t){return this.clone()._rotateAround(e,t)},matMult(e){return this.clone()._matMult(e)},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(e){return this.x===e.x&&this.y===e.y},dist(e){return Math.sqrt(this.distSqr(e))},distSqr(e){let t=e.x-this.x,i=e.y-this.y;return t*t+i*i},angle(){return Math.atan2(this.y,this.x)},angleTo(e){return Math.atan2(this.y-e.y,this.x-e.x)},angleWith(e){return this.angleWithSep(e.x,e.y)},angleWithSep(e,t){return Math.atan2(this.x*t-this.y*e,this.x*e+this.y*t)},_matMult(e){let t=e[0]*this.x+e[1]*this.y,i=e[2]*this.x+e[3]*this.y;return this.x=t,this.y=i,this},_add(e){return this.x+=e.x,this.y+=e.y,this},_sub(e){return this.x-=e.x,this.y-=e.y,this},_mult(e){return this.x*=e,this.y*=e,this},_div(e){return this.x/=e,this.y/=e,this},_multByPoint(e){return this.x*=e.x,this.y*=e.y,this},_divByPoint(e){return this.x/=e.x,this.y/=e.y,this},_unit(){return this._div(this.mag()),this},_perp(){let e=this.y;return this.y=this.x,this.x=-e,this},_rotate(e){let t=Math.cos(e),i=Math.sin(e),r=t*this.x-i*this.y,a=i*this.x+t*this.y;return this.x=r,this.y=a,this}
vendor: 21,015 bytes, line 4
4,_rotateAround(e,t){let i=Math.cos(e),r=Math.sin(e),a=t.x+i*(this.x-t.x)-r*(this.y-t.y),n=t.y+r*(this.x-t.x)+i*(this.y-t.y);return this.x=a,this.y=n,this},_round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},constructor:A},A.convert=function(e){if(e instanceof A)return e;if(Array.isArray(e))return new A(+e[0],+e[1]);if(e.x!==void 0&&e.y!==void 0)return new A(+e.x,+e.y);throw Error("Expected [x, y] or {x, y} point format")};function Tb(e,t,i,r){let a=3*e,n=3*(i-e)-a,s=1-a-n,o=3*t,l=3*(r-t)-o,u=1-o-l;return function(h,c=1e-6){if(h<=0)return 0;if(h>=1)return 1;let d=h;for(let m=0;m<8;m++){let g=((s*d+n)*d+a)*d-h;if(Math.abs(g)<c)return((u*d+l)*d+o)*d;let _=(3*s*d+2*n)*d+a;if(Math.abs(_)<1e-6)break;d-=g/_}let p=0,f=1;d=h;for(let m=0;m<20;m++){let g=((s*d+n)*d+a)*d;if(Math.abs(g-h)<c)break;h>g?p=d:f=d,d=(p+f)*.5}return((u*d+l)*d+o)*d}}let xf;function hd(){return xf??(xf=typeof OffscreenCanvas<"u"&&!!new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),xf}let to;function w_(){if(to==null&&(to=!1,hd())){let e=new OffscreenCanvas(5,5).getContext("2d",{willReadFrequently:!0});if(e){for(let i=0;i<25;i++){let r=i*4;e.fillStyle=`rgb(${r},${r+1},${r+2})`,e.fillRect(i%5,Math.floor(i/5),1,1)}let t=e.getImageData(0,0,5,5).data;for(let i=0;i<100;i++)if(i%4!=3&&t[i]!==i){to=!0;break}}}return to||!1}var wt=typeof Float32Array<"u"?Float32Array:Array;function T_(){var e=new wt(9);return wt!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[5]=0,e[6]=0,e[7]=0),e[0]=1,e[4]=1,e[8]=1,e}function Eb(e){var t=e[0],i=e[1],r=e[2],a=e[3],n=e[4],s=e[5],o=e[6],l=e[7],u=e[8];return t*(u*n-s*l)+i*(-u*a+s*o)+r*(l*a-n*o)}function Sb(e,t){var i=Math.sin(t),r=Math.cos(t);return e[0]=r,e[1]=i,e[2]=0,e[3]=-i,e[4]=r,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e}function Db(e,t){var i=t[0],r=t[1],a=t[2],n=t[3],s=i+i,o=r+r,l=a+a,u=i*s,h=r*s,c=r*o,d=a*s,p=a*o,f=a*l,m=n*s,g=n*o,_=n*l;return e[0]=1-c-f,e[3]=h-_,e[6]=d+g,e[1]=h+_,e[4]=1-u-f,e[7]=p-m,e[2]=d-g,e[5]=p+m,e[8]=1-u-c,e}function kr(){var e=new wt(16);return wt!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0),e[0]=1,e[5]=1,e[10]=1,e[15]=1,e}function bh(e){var t=new wt(16);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}function Cb(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function Fi(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function Yo(e,t){var i=t[0],r=t[1],a=t[2],n=t[3],s=t[4],o=t[5],l=t[6],u=t[7],h=t[8],c=t[9],d=t[10],p=t[11],f=t[12],m=t[13],g=t[14],_=t[15],y=i*o-r*s,x=i*l-a*s,v=i*u-n*s,w=r*l-a*o,b=r*u-n*o,T=a*u-n*l,P=h*m-c*f,S=h*g-d*f,M=h*_-p*f,k=c*g-d*m,R=c*_-p*m,D=d*_-p*g,I=y*D-x*R+v*k+w*M-b*S+T*P;return I?(I=1/I,e[0]=(o*D-l*R+u*k)*I,e[1]=(a*R-r*D-n*k)*I,e[2]=(m*T-g*b+_*w)*I,e[3]=(d*b-c*T-p*w)*I,e[4]=(l*M-s*D-u*S)*I,e[5]=(i*D-a*M+n*S)*I,e[6]=(g*v-f*T-_*x)*I,e[7]=(h*T-d*v+p*x)*I,e[8]=(s*R-o*M+u*P)*I,e[9]=(r*M-i*R-n*P)*I,e[10]=(f*b-m*v+_*y)*I,e[11]=(c*v-h*b-p*y)*I,e[12]=(o*S-s*k-l*P)*I,e[13]=(i*k-r*S+a*P)*I,e[14]=(m*x-f*w-g*y)*I,e[15]=(h*w-c*x+d*y)*I,e):null}function Ma(e,t,i){var r=t[0],a=t[1],n=t[2],s=t[3],o=t[4],l=t[5],u=t[6],h=t[7],c=t[8],d=t[9],p=t[10],f=t[11],m=t[12],g=t[13],_=t[14],y=t[15],x=i[0],v=i[1],w=i[2],b=i[3];return e[0]=x*r+v*o+w*c+b*m,e[1]=x*a+v*l+w*d+b*g,e[2]=x*n+v*u+w*p+b*_,e[3]=x*s+v*h+w*f+b*y,x=i[4],v=i[5],w=i[6],b=i[7],e[4]=x*r+v*o+w*c+b*m,e[5]=x*a+v*l+w*d+b*g,e[6]=x*n+v*u+w*p+b*_,e[7]=x*s+v*h+w*f+b*y,x=i[8],v=i[9],w=i[10],b=i[11],e[8]=x*r+v*o+w*c+b*m,e[9]=x*a+v*l+w*d+b*g,e[10]=x*n+v*u+w*p+b*_,e[11]=x*s+v*h+w*f+b*y,x=i[12],v=i[13],w=i[14],b=i[15],e[12]=x*r+v*o+w*c+b*m,e[13]=x*a+v*l+w*d+b*g,e[14]=x*n+v*u+w*p+b*_,e[15]=x*s+v*h+w*f+b*y,e}function ct(e,t,i){var r=i[0],a=i[1],n=i[2],s,o,l,u,h,c,d,p,f,m,g,_;return t===e?(e[12]=t[0]*r+t[4]*a+t[8]*n+t[12],e[13]=t[1]*r+t[5]*a+t[9]*n+t[13],e[14]=t[2]*r+t[6]*a+t[10]*n+t[14],e[15]=t[3]*r+t[7]*a+t[11]*n+t[15]):(s=t[0],o=t[1],l=t[2],u=t[3],h=t[4],c=t[5],d=t[6],p=t[7],f=t[8],m=t[9],g=t[10],_=t[11],e[0]=s,e[1]=o,e[2]=l,e[3]=u,e[4]=h,e[5]=c,e[6]=d,e[7]=p,e[8]=f,e[9]=m,e[10]=g,e[11]=_,e[12]=s*r+h*a+f*n+t[12],e[13]=o*r+c*a+m*n+t[13],e[14]=l*r+d*a+g*n+t[14],e[15]=u*r+p*a+_*n+t[15]),e}function At(e,t,i){var r=i[0],a=i[1],n=i[2];return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e[4]=t[4]*a,e[5]=t[5]*a,e[6]=t[6]*a,e[7]=t[7]*a,e[8]=t[8]*n,e[9]=t[9]*n,e[10]=t[10]*n,e[11]=t[11]*n,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function Xa(e,t,i){var r=Math.sin(i),a=Math.cos(i),n=t[4],s=t[5],o=t[6],l=t[7],u=t[8],h=t[9],c=t[10],d=t[11];return t!==e&&(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[4]=n*a+u*r,e[5]=s*a+h*r,e[6]=o*a+c*r,e[7]=l*a+d*r,e[8]=u*a-n*r,e[9]=h*a-s*r,e[10]=c*a-o*r,e[11]=d*a-l*r,e}function E_(e,t,i){var r=Math.sin(i),a=Math.cos(i),n=t[0],s=t[1],o=t[2],l=t[3],u=t[8],h=t[9],c=t[10],d=t[11];return t!==e&&(e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=n*a-u*r,e[1]=s*a-h*r,e[2]=o*a-c*r,e[3]=l*a-d*r,e[8]=n*r+u*a,e[9]=s*r+h*a,e[10]=o*r+c*a,e[11]=l*r+d*a,e}function Dr(e,t,i){var r=Math.sin(i),a=Math.cos(i),n=t[0],s=t[1],o=t[2],l=t[3],u=t[4],h=t[5],c=t[6],d=t[7];return t!==e&&(e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=n*a+u*r,e[1]=s*a+h*r,e[2]=o*a+c*r,e[3]=l*a+d*r,e[4]=u*a-n*r,e[5]=h*a-s*r,e[6]=c*a-o*r,e[7]=d*a-l*r,e}function Pb(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=t[1],e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=t[2],e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function Ab(e,t,i,r,a){var n=1/Math.tan(t/2);if(e[0]=n/i,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=n,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,a!=null&&a!==1/0){var s=1/(r-a);e[10]=(a+r)*s,e[14]=2*a*r*s}else e[10]=-1,e[14]=-2*r;return e}var wh=Ab;function Ib(e,t,i,r,a,n,s){var o=1/(t-i),l=1/(r-a),u=1/(n-s);return e[0]=-2*o,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*l,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*u,e[11]=0,e[12]=(t+i)*o,e[13]=(a+r)*l,e[14]=(s+n)*u,e[15]=1,e}var Ni=Ib;function Mb(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&e[4]===t[4]&&e[5]===t[5]&&e[6]===t[6]&&e[7]===t[7]&&e[8]===t[8]&&e[9]===t[9]&&e[10]===t[10]&&e[11]===t[11]&&e[12]===t[12]&&e[13]===t[13]&&e[14]===t[14]&&e[15]===t[15]}function Fb(e,t){var i=e[0],r=e[1],a=e[2],n=e[3],s=e[4],o=e[5],l=e[6],u=e[7],h=e[8],c=e[9],d=e[10],p=e[11],f=e[12],m=e[13],g=e[14],_=e[15],y=t[0],x=t[1],v=t[2],w=t[3],b=t[4],T=t[5],P=t[6],S=t[7],M=t[8],k=t[9],R=t[10],D=t[11],I=t[12],C=t[13],E=t[14],F=t[15];return Math.abs(i-y)<=1e-6*Math.max(1,Math.abs(i),Math.abs(y))&&Math.abs(r-x)<=1e-6*Math.max(1,Math.abs(r),Math.abs(x))&&Math.abs(a-v)<=1e-6*Math.max(1,Math.abs(a),Math.abs(v))&&Math.abs(n-w)<=1e-6*Math.max(1,Math.abs(n),Math.abs(w))&&Math.abs(s-b)<=1e-6*Math.max(1,Math.abs(s),Math.abs(b))&&Math.abs(o-T)<=1e-6*Math.max(1,Math.abs(o),Math.abs(T))&&Math.abs(l-P)<=1e-6*Math.max(1,Math.abs(l),Math.abs(P))&&Math.abs(u-S)<=1e-6*Math.max(1,Math.abs(u),Math.abs(S))&&Math.abs(h-M)<=1e-6*Math.max(1,Math.abs(h),Math.abs(M))&&Math.abs(c-k)<=1e-6*Math.max(1,Math.abs(c),Math.abs(k))&&Math.abs(d-R)<=1e-6*Math.max(1,Math.abs(d),Math.abs(R))&&Math.abs(p-D)<=1e-6*Math.max(1,Math.abs(p),Math.abs(D))&&Math.abs(f-I)<=1e-6*Math.max(1,Math.abs(f),Math.abs(I))&&Math.abs(m-C)<=1e-6*Math.max(1,Math.abs(m),Math.abs(C))&&Math.abs(g-E)<=1e-6*Math.max(1,Math.abs(g),Math.abs(E))&&Math.abs(_-F)<=1e-6*Math.max(1,Math.abs(_),Math.abs(F))}function S_(){var e=new wt(3);return wt!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function Th(e){var t=new wt(3);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t}function mr(e){var t=e[0],i=e[1],r=e[2];return Math.sqrt(t*t+i*i+r*r)}function bf(e,t,i){var r=new wt(3);return r[0]=e,r[1]=t,r[2]=i,r}function xi(e,t,i){return e[0]=t[0]+i[0],e[1]=t[1]+i[1],e[2]=t[2]+i[2],e}function cd(e,t,i){return e[0]=t[0]-i[0],e[1]=t[1]-i[1],e[2]=t[2]-i[2],e}function He(e,t,i){return e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e}function Ko(e,t,i,r){return e[0]=t[0]+i[0]*r,e[1]=t[1]+i[1]*r,e[2]=t[2]+i[2]*r,e}function zb(e,t){var i=t[0]-e[0],r=t[1]-e[1],a=t[2]-e[2];return Math.sqrt(i*i+r*r+a*a)}function Rb(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e}function Nt(e,t){var i=t[0],r=t[1],a=t[2],n=i*i+r*r+a*a;return n>0&&(n=1/Math.sqrt(n)),e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e}function dt(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function ei(e,t,i){var r=t[0],a=t[1],n=t[2],s=i[0],o=i[1],l=i[2];return e[0]=a*l-n*o,e[1]=n*s-r*l,e[2]=r*o-a*s,e}function kb(e,t,i){var r=t[0],a=t[1],n=t[2],s=i[3]*r+i[7]*a+i[11]*n+i[15];return s||(s=1),e[0]=(i[0]*r+i[4]*a+i[8]*n+i[12])/s,e[1]=(i[1]*r+i[5]*a+i[9]*n+i[13])/s,e[2]=(i[2]*r+i[6]*a+i[10]*n+i[14])/s,e}function Lb(e,t,i){var r=t[0],a=t[1],n=t[2];return e[0]=r*i[0]+a*i[3]+n*i[6],e[1]=r*i[1]+a*i[4]+n*i[7],e[2]=r*i[2]+a*i[5]+n*i[8],e}function Ru(e,t,i){var r=i[0],a=i[1],n=i[2],s=i[3],o=t[0],l=t[1],u=t[2],h=a*u-n*l,c=n*o-r*u,d=r*l-a*o;return h+=h,c+=c,d+=d,e[0]=o+s*h+a*d-n*c,e[1]=l+s*c+n*h-r*d,e[2]=u+s*d+r*c-a*h,e}function En(e,t,i,r){var a=[],n=[];return a[0]=t[0]-i[0],a[1]=t[1]-i[1],a[2]=t[2]-i[2],n[0]=a[0],n[1]=a[1]*Math.cos(r)-a[2]*Math.sin(r),n[2]=a[1]*Math.sin(r)+a[2]*Math.cos(r),e[0]=n[0]+i[0],e[1]=n[1]+i[1],e[2]=n[2]+i[2],e}function Da(e,t,i,r){var a=[],n=[];return a[0]=t[0]-i[0],a[1]=t[1]-i[1],a[2]=t[2]-i[2],n[0]=a[2]*Math.sin(r)+a[0]*Math.cos(r),n[1]=a[1],n[2]=a[2]*Math.cos(r)-a[0]*Math.sin(r),e[0]=n[0]+i[0],e[1]=n[1]+i[1],e[2]=n[2]+i[2],e}function ku(e,t,i,r){var a=[],n=[];return a[0]=t[0]-i[0],a[1]=t[1]-i[1],a[2]=t[2]-i[2],n[0]=a[0]*Math.cos(r)-a[1]*Math.sin(r),n[1]=a[0]*Math.sin(r)+a[1]*Math.cos(r),n[2]=a[2],e[0]=n[0]+i[0],e[1]=n[1]+i[1],e[2]=n[2]+i[2],e}function Bb(e){return e[0]=0,e[1]=0,e[2]=0,e}var gr=cd,Jo=mr;(function(){var e=S_();return function(t,i,r,a,n,s){var o,l;for(i||(i=3),r||(r=0),l=a?Math.min(a*i+r,t.length):t.length,o=r;o<l;o+=i)e[0]=t[o],e[1]=t[o+1],e[2]=t[o+2],n(e,e,s),t[o]=e[0],t[o+1]=e[1],t[o+2]=e[2];return t}})();function Ob(){var e=new wt(4);return wt!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0,e[3]=0),e}function $b(e,t,i,r){var a=new wt(4);return a[0]=e,a[1]=t,a[2]=i,a[3]=r,a}function jb(e,t,i){return e[0]=t[0]*i[0],e[1]=t[1]*i[1],e[2]=t[2]*i[2],e[3]=t[3]*i[3],e}function Vb(e,t,i){return e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e[3]=t[3]*i,e}function Nb(e,t){var i=t[0],r=t[1],a=t[2],n=t[3],s=i*i+r*r+a*a+n*n;return s>0&&(s=1/Math.sqrt(s)),e[0]=i*s,e[1]=r*s,e[2]=a*s,e[3]=n*s,e}function It(e,t,i){var r=t[0],a=t[1],n=t[2],s=t[3];return e[0]=i[0]*r+i[4]*a+i[8]*n+i[12]*s,e[1]=i[1]*r+i[5]*a+i[9]*n+i[13]*s,e[2]=i[2]*r+i[6]*a+i[10]*n+i[14]*s,e[3]=i[3]*r+i[7]*a+i[11]*n+i[15]*s,e}var Ub=jb;(function(){var e=Ob();return function(t,i,r,a,n,s){var o,l;for(i||(i=4),r||(r=0),l=a?Math.min(a*i+r,t.length):t.length,o=r;o<l;o+=i)e[0]=t[o],e[1]=t[o+1],e[2]=t[o+2],e[3]=t[o+3],n(e,e,s),t[o]=e[0],t[o+1]=e[1],t[o+2]=e[2],t[o+3]=e[3];return t}})();function wf(){var e=new wt(4);return wt!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}function Gb(e,t,i){i*=.5;var r=Math.sin(i);return e[0]=r*t[0],e[1]=r*t[1],e[2]=r*t[2],e[3]=Math.cos(i),e}function Zb(e,t,i){var r=t[0],a=t[1],n=t[2],s=t[3],o=i[0],l=i[1],u=i[2],h=i[3];return e[0]=r*h+s*o+a*u-n*l,e[1]=a*h+s*l+n*o-r*u,e[2]=n*h+s*u+r*l-a*o,e[3]=s*h-r*o-a*l-n*u,e}function ko(e,t,i,r){var a=t[0],n=t[1],s=t[2],o=t[3],l=i[0],u=i[1],h=i[2],c=i[3],d,p=a*l+n*u+s*h+o*c,f,m,g;return p<0&&(p=-p,l=-l,u=-u,h=-h,c=-c),1-p>1e-6?(d=Math.acos(p),f=Math.sin(d),m=Math.sin((1-r)*d)/f,g=Math.sin(r*d)/f):(m=1-r,g=r),e[0]=m*a+g*l,e[1]=m*n+g*u,e[2]=m*s+g*h,e[3]=m*o+g*c,e}function qb(e,t){var i=t[0]+t[4]+t[8],r;if(i>0)r=Math.sqrt(i+1),e[3]=.5*r,r=.5/r,e[0]=(t[5]-t[7])*r,e[1]=(t[6]-t[2])*r,e[2]=(t[1]-t[3])*r;else{var a=0;t[4]>t[0]&&(a=1),t[8]>t[a*3+a]&&(a=2);var n=(a+1)%3,s=(a+2)%3;r=Math.sqrt(t[a*3+a]-t[n*3+n]-t[s*3+s]+1),e[a]=.5*r,r=.5/r,e[3]=(t[n*3+s]-t[s*3+n])*r,e[n]=(t[n*3+a]+t[a*3+n])*r,e[s]=(t[s*3+a]+t[a*3+s])*r}return e}function dd(e,t,i,r){var a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:"zyx",n=Math.PI/360;t*=n,r*=n,i*=n;var s=Math.sin(t),o=Math.cos(t),l=Math.sin(i),u=Math.cos(i),h=Math.sin(r),c=Math.cos(r);switch(a){case"xyz":e[0]=s*u*c+o*l*h,e[1]=o*l*c-s*u*h,e[2]=o*u*h+s*l*c,e[3]=o*u*c-s*l*h;break;case"xzy":e[0]=s*u*c-o*l*h,e[1]=o*l*c-s*u*h,e[2]=o*u*h+s*l*c,e[3]=o*u*c+s*l*h;break;case"yxz":e[0]=s*u*c+o*l*h,e[1]=o*l*c-s*u*h,e[2]=o*u*h-s*l*c,e[3]=o*u*c+s*l*h;break;case"yzx":e[0]=s*u*c+o*l*h,e[1]=o*l*c+s*u*h,e[2]=o*u*h-s*l*c,e[3]=o*u*c-s*l*h;break;case"zxy":e[0]=s*u*c-o*l*h,e[1]=o*l*c+s*u*h,e[2]=o*u*h+s*l*c,e[3]=o*u*c-s*l*h;break;case"zyx":e[0]=s*u*c-o*l*h,e[1]=o*l*c+s*u*h,e[2]=o*u*h-s*l*c,e[3]=o*u*c+s*l*h;break;default:throw Error("Unknown angle order "+a)}return e}var Tf=$b,Ef=Nb;(function(){var e=S_(),t=bf(1,0,0),i=bf(0,1,0);return function(r,a,n){var s=dt(a,n);return s<-.999999?(ei(e,t,a),Jo(e)<1e-6&&ei(e,i,a),Nt(e,e),Gb(r,e,Math.PI),r):s>.999999?(r[0]=0,r[1]=0,r[2]=0,r[3]=1,r):(ei(e,a,n),r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=1+s,Ef(r,r))}})(),function(){var e=wf(),t=wf();return function(i,r,a,n,s,o){return ko(e,r,s,o),ko(t,a,n,o),ko(i,e,t,2*o*(1-o)),i}}(),function(){var e=T_();return function(t,i,r,a){return e[0]=r[0],e[3]=r[1],e[6]=r[2],e[1]=a[0],e[4]=a[1],e[7]=a[2],e[2]=-i[0],e[5]=-i[1],e[8]=-i[2],Ef(t,qb(t,e))}}();function Eh(){var e=new wt(2);return wt!=Float32Array&&(e[0]=0,e[1]=0),e}function Sf(e,t){var i=new wt(2);return i[0]=e,i[1]=t,i}function Df(e,t,i){return e[0]=t[0]*i,e[1]=t[1]*i,e}function Cf(e){var t=e[0],i=e[1];return Math.sqrt(t*t+i*i)}function Wb(e){var t=e[0],i=e[1];return t*t+i*i}function Hb(e,t){return e[0]*t[0]+e[1]*t[1]}function Pf(e){return e[0]=0,e[1]=0,e}var Xb=Wb;(function(){var e=Eh();return function(t,i,r,a,n,s){var o,l;for(i||(i=2),r||(r=0),l=a?Math.min(a*i+r,t.length):t.length,o=r;o<l;o+=i)e[0]=t[o],e[1]=t[o+1],n(e,e,s),t[o]=e[0],t[o+1]=e[1];return t}})();const L=8192;function hi(e,t,i){return t*(L/(e.tileSize*2**(i-e.tileID.overscaledZ)))}function kt(e){return e instanceof Error?e:Error(typeof e=="string"?e:String(e))}function Wr(){return new Float64Array(4)}function Ae(){return new Float64Array(3)}function Hr(){return new Float64Array(16)}function io(){let e=new Float64Array(16);return Fi(e),e}function D_(){let e=new Float32Array(16);return Fi(e),e}function Mr(e,t,i,r,a=!1){if(!i[0]&&!i[1])return[0,0];let n=a?r==="map"?-e.bearingInRadians:0:r==="viewport"?e.bearingInRadians:0;if(n){let s=Math.sin(n),o=Math.cos(n);i=[i[0]*o-i[1]*s,i[0]*s+i[1]*o]}return[a?i[0]:hi(t,i[0],e.zoom),a?i[1]:hi(t,i[1],e.zoom)]}function Sh(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]}function pi(e,t,i){let r=Eb([e[0],e[1],e[2],t[0],t[1],t[2],i[0],i[1],i[2]]);if(r===0)return null;let a=ei([],[t[0],t[1],t[2]],[i[0],i[1],i[2]]),n=ei([],[i[0],i[1],i[2]],[e[0],e[1],e[2]]),s=ei([],[e[0],e[1],e[2]],[t[0],t[1],t[2]]),o=He([],a,-e[3]);return xi(o,o,He([],n,-t[3])),xi(o,o,He([],s,-i[3])),He(o,o,1/r),o}function Yb(e,t,i){let r=e[0]*i[0]+e[1]*i[1]+e[2]*i[2],a=t[0]*i[0]+t[1]*i[1]+t[2]*i[2];return a===0?null:(-r-i[3])/a}function ro(e,t,i,r){let a=Math.sqrt(e*e+t*t),n=Math.sqrt(i*i+r*r);e/=a,t/=a,i/=n,r/=n;let s=e*i+t*r,o=Math.acos(s);return-t*i+e*r>0?o:-o}function ni(e,t){let i=sa(e,360),r=sa(t,360),a=r-i,n=r>i?a-360:a+360;return Math.abs(a)<Math.abs(n)?a:n}function ao(e,t){let i=sa(e,Math.PI*2),r=sa(t,Math.PI*2);return Math.min(Math.abs(i-r),Math.abs(i-r+Math.PI*2),Math.abs(i-r-Math.PI*2))}function sa(e,t){return(e%t+t)%t}function Lo(e,t,i,r,a){return ja(r,a,he((e-t)/(i-t),0,1))}function ja(e,t,i){return e*(1-i)+t*i}function Kb(e){let t=1/0,i=1/0,r=-1/0,a=-1/0;for(let n of e)t=Math.min(t,n.x),i=Math.min(i,n.y),r=Math.max(r,n.x),a=Math.max(a,n.y);return[t,i,r,a]}function Jb(e){if(!e.length)return new Set;let t=Math.max(...e.map(l=>l.canonical.z)),i=1/0,r=-1/0,a=1/0,n=-1/0,s=[];for(let l of e){let{x:u,y:h,z:c}=l.canonical,d=2**(t-c),p=u*d,f=h*d;s.push({id:l,x:p,y:f}),p<i&&(i=p),p>r&&(r=p),f<a&&(a=f),f>n&&(n=f)}let o=new Set;for(let l of s)(l.x===i||l.x===r||l.y===a||l.y===n)&&o.add(l.id);return o}function Qb(e){if(e<=0)return 0;if(e>=1)return 1;let t=e*e,i=t*e;return 4*(e<.5?i:3*(e-t)+i-.75)}function pd(e,t,i,r){return Tb(e,t,i,r)}const Dh=pd(.25,.1,.25,1);function he(e,t,i){return Math.min(i,Math.max(t,e))}function bi(e,t,i){let r=i-t,a=((e-t)%r+r)%r+t;return a===t?i:a}function W(e,...t){for(let i of t)for(let r in i)e[r]=i[r];return e}function ws(e,t){let i={};for(let r of t)r in e&&(i[r]=e[r]);return i}let ew=1;function C_(){return ew++}function tw(e){return Math.log(e)/Math.LN2%1==0}function iw(e){return e<=1?1:2**Math.ceil(Math.log(e)/Math.LN2)}function Gt(e){return 2**e}function zt(e){return Math.log(e)/Math.LN2}function oi(e,t,i){if(t<=0)return e;let r=1/t;return i===void 0||Math.abs(i)<1e-10?Math.round(e*r)/r:(i>0?Math.ceil(e*r-1e-9):Math.floor(e*r+1e-10))/r}function fd(e,t,i){let r={};for(let a in e)r[a]=t.call(this,e[a],a,e);return r}function P_(e,t,i){let r={};for(let a in e)t.call(this,e[a],a,e)&&(r[a]=e[a]);return r}function Ai(e,t){if(Array.isArray(e)){if(!Array.isArray(t)||e.length!==t.length)return!1;for(let i=0;i<e.length;i++)if(!Ai(e[i],t[i]))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 i in e)if(!Ai(e[i],t[i]))return!1;return!0}return e===t}function Qt(e){return Array.isArray(e)?e.map(Qt):typeof e=="object"&&e?fd(e,Qt):e}const Af={};function xe(e){Af[e]||(typeof console<"u"&&console.warn(e),Af[e]=!0)}function Cr(e,t,i){return(i.y-e.y)*(t.x-e.x)>(t.y-e.y)*(i.x-e.x)}function rw(e,t,i,r){let a=t.y-e.y,n=t.x-e.x,s=r.y-i.y,o=r.x-i.x,l=s*n-o*a;if(l===0)return null;let u=e.y-i.y,h=e.x-i.x,c=(o*u-s*h)/l;return new A(e.x+c*n,e.y+c*a)}function aw([e,t,i]){return t+=90,t*=Math.PI/180,i*=Math.PI/180,[e*Math.cos(t)*Math.sin(i),e*Math.sin(t)*Math.sin(i),e*Math.cos(i)]}function Ya(e){return typeof WorkerGlobalScope<"u"&&e!==void 0&&e instanceof WorkerGlobalScope}function nw(e){let t=/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,i={};if(e.replace(t,(r,a,n,s)=>{let o=n||s;return i[a]=!o||o.toLowerCase(),""}),i["max-age"]){let r=parseInt(i["max-age"],10);isNaN(r)?delete i["max-age"]:i["max-age"]=r}return i}let Lu=null;function sw(e){if(Lu==null){let t=e.navigator?e.navigator.userAgent:null;Lu=!!e.safari||!!(t&&(/\b(iPad|iPhone|iPod)\b/.test(t)||t.match("Safari")&&!t.match("Chrome")))}return Lu}function Qr(e){return typeof ImageBitmap<"u"&&e instanceof ImageBitmap}const ow=async(e,t)=>{let i=new Blob([new Uint8Array(e)],{type:"image/png"});try{return createImageBitmap(i,t)}catch(r){throw Error(`Could not load image because of ${kt(r).message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`)}},lw=e=>new Promise((t,i)=>{let r=new Image;r.onload=()=>{t(r),URL.revokeObjectURL(r.src),r.onload=null,window.requestAnimationFrame(()=>r.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=")},r.onerror=()=>i(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."));let a=new Blob([new Uint8Array(e)],{type:"image/png"});r.src=URL.createObjectURL(a)});function uw(e,t,i,r,a){let n=Math.max(-t,0)*4,s=(Math.max(0,i)-i)*r*4+n,o=r*4,l=Math.max(0,t),u=Math.max(0,i),h=Math.min(e.width,t+r),c=Math.min(e.height,i+a);return{rect:{x:l,y:u,width:h-l,height:c-u},layout:[{offset:s,stride:o}]}}async function hw(e,t,i,r,a){if(typeof VideoFrame>"u")throw Error("VideoFrame not supported");let n=new VideoFrame(e,{timestamp:0});try{let s=n==null?void 0:n.format;if(!s||!(s.startsWith("BGR")||s.startsWith("RGB")))throw Error(`Unrecognized format ${s}`);let o=s.startsWith("BGR"),l=new Uint8ClampedArray(r*a*4);if(await n.copyTo(l,uw(e,t,i,r,a)),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{n.close()}}function Ch(e,t,i,r){return e.addEventListener(t,i,r),{unsubscribe:()=>{e.removeEventListener(t,i,r)}}}function Xe(e){return e*Math.PI/180}function Gi(e){return e/Math.PI*180}function A_(e,t){return e.roll==t.roll&&e.pitch==t.pitch&&e.bearing==t.bearing}function cw(e){let t=new Float64Array(9);Db(t,e);let i=Gi(-Math.asin(he(t[2],-1,1))),r,a;return Math.hypot(t[5],t[8])<.001?(r=0,a=-Gi(Math.atan2(t[3],t[4]))):(r=Gi(t[5]===0&&t[8]===0?0:Math.atan2(t[5],t[8])),a=Gi(t[1]===0&&t[0]===0?0:Math.atan2(t[1],t[0]))),{roll:r,pitch:i+90,bearing:a}}function I_(e,t,i){let r=Sf(t.x-i.x,t.y-i.y),a=Sf(e.x-i.x,e.y-i.y),n=r[0]*a[1]-r[1]*a[0];return Gi(Math.atan2(n,Hb(r,a)))}function If(e,t,i){let r=new Float64Array(4);return dd(r,e,t-90,i),r}const Xi=85.051129,M_={touchstart:!0,touchmove:!0,touchmoveWindow:!0,touchend:!0,touchcancel:!0}
4,F_={dblclick:!0,click:!0,mouseover:!0,mouseout:!0,mousedown:!0,mousemove:!0,mousemoveWindow:!0,mouseup:!0,mouseupWindow:!0,contextmenu:!0,wheel:!0};function dw(e,t){return M_[t]&&"touches"in e}function pw(e,t){var a,n;if(!F_[t])return!1;let i=e,r=((n=(a=i==null?void 0:i.target)==null?void 0:a.ownerDocument)==null?void 0:n.defaultView)||window;return i instanceof r.MouseEvent||i instanceof r.WheelEvent}function fw(e){return M_[e]||F_[e]}const Mf="AbortError";var Ts=class extends Error{constructor(e=Mf){super(e instanceof Error?e.message:e),this.name=Mf,e instanceof Error&&e.stack&&(this.stack=e.stack)}};function Fr(e){return e instanceof Error&&e.name==="AbortError"}function md(e){if(e.aborted)throw new Ts(e.reason)}const ti={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};function z_(e){return ti.REGISTERED_PROTOCOLS[e.substring(0,e.indexOf("://"))]}function mw(e,t){ti.REGISTERED_PROTOCOLS[e]=t}function gw(e){delete ti.REGISTERED_PROTOCOLS[e]}const Ph="global-dispatcher";var is=class extends Error{constructor(e,t,i,r){super(`AJAXError: ${t} (${e}): ${i}`),this.status=e,this.statusText=t,this.url=i,this.body=r}};function gd(){var e;if(Ya(self))return(e=self.worker)==null?void 0:e.referrer;if(window.location.protocol==="blob:")try{return window.parent.location.href}catch{}return window.location.href}const _w=e=>{var t;return e.startsWith("file:")||((t=gd())==null?void 0:t.startsWith("file:"))&&!/^\w+:/.test(e)};async function yw(e,t){let i=new Request(e.url,{method:e.method||"GET",body:e.body,credentials:e.credentials,headers:e.headers,cache:e.cache,referrer:gd(),referrerPolicy:e.referrerPolicy,signal:t.signal});e.type==="json"&&!i.headers.has("Accept")&&i.headers.set("Accept","application/json");let r;try{r=await fetch(i)}catch(s){throw Fr(s)?s:new is(0,kt(s).message,e.url,new Blob)}if(!r.ok){let s=await r.blob();throw new is(r.status,r.statusText,e.url,s)}let a;a=e.type==="arrayBuffer"||e.type==="image"?r.arrayBuffer():e.type==="json"?r.json():r.text();let n=await a;return md(t.signal),{data:n,cacheControl:r.headers.get("Cache-Control"),expires:r.headers.get("Expires"),etag:r.headers.get("ETag")}}function vw(e,t){return new Promise((i,r)=>{var n;let a=new XMLHttpRequest;a.open(e.method||"GET",e.url,!0),(e.type==="arrayBuffer"||e.type==="image")&&(a.responseType="arraybuffer");for(let s in e.headers)a.setRequestHeader(s,e.headers[s]);e.type==="json"&&(a.responseType="text",(n=e.headers)!=null&&n.Accept||a.setRequestHeader("Accept","application/json")),a.withCredentials=e.credentials==="include",a.onerror=()=>{r(Error(a.statusText))},a.onload=()=>{if(!t.signal.aborted)if((a.status>=200&&a.status<300||a.status===0)&&a.response!==null){let s=a.response;if(e.type==="json")try{s=JSON.parse(a.response)}catch(o){r(o);return}i({data:s,cacheControl:a.getResponseHeader("Cache-Control"),expires:a.getResponseHeader("Expires"),etag:a.getResponseHeader("ETag")})}else{let s=new Blob([a.response],{type:a.getResponseHeader("Content-Type")});r(new is(a.status,a.statusText,e.url,s))}},t.signal.addEventListener("abort",()=>{a.abort(),r(new Ts(t.signal.reason))}),a.send(e.body)})}const Pl=async function(e,t){var i,r;if(e.url.includes("://")&&!/^https?:|^file:/.test(e.url)){let a=z_(e.url);if(a){let n=await a(e,t);return!n.data&&e.type==="arrayBuffer"?W(n,{data:new ArrayBuffer(0)}):n}if(Ya(self)&&((i=self.worker)!=null&&i.actor))return self.worker.actor.sendAsync({type:"GR",data:e,targetMapId:Ph},t)}if(!_w(e.url)){if(fetch&&Request&&AbortController&&Object.hasOwn(Request.prototype,"signal"))return yw(e,t);if(Ya(self)&&((r=self.worker)!=null&&r.actor))return self.worker.actor.sendAsync({type:"GR",data:e,mustQueue:!0,targetMapId:Ph},t)}return vw(e,t)},Al=(e,t)=>
4Pl(W(e,{type:"json"}),t),R_=(e,t)=>Pl(W(e,{type:"arrayBuffer"}),t);function k_(e){if(!e||e.startsWith("data:image/"))return!0;if(e.startsWith("blob:")&&(e=e.slice(5),e.startsWith("null")))return!1;if(e.indexOf("://")<=0)return!0;let t=new URL(e),i=window.location;return t.protocol===i.protocol&&t.host===i.host}const xw=e=>{let t=window.document.createElement("video");return t.muted=!0,new Promise(i=>{t.onloadstart=()=>{i(t)};for(let r of e){let a=window.document.createElement("source");k_(r)||(t.crossOrigin="Anonymous"),a.src=r,t.appendChild(a)}})};function Ff(e,t,i){var r;(r=i[e])!=null&&r.includes(t)||(i[e]||(i[e]=[]),i[e].push(t))}function Bu(e,t,i){if(i!=null&&i[e]){let r=i[e].indexOf(t);r!==-1&&i[e].splice(r,1)}}var ci=class{constructor(e,t={}){W(this,t),this.type=e}},Q=class extends ci{constructor(e,t={}){super("error",W({error:e},t))}},_t=class{on(e,t){return this._listeners||(this._listeners={}),Ff(e,t,this._listeners),{unsubscribe:()=>{this.off(e,t)}}}off(e,t){return Bu(e,t,this._listeners),Bu(e,t,this._oneTimeListeners),this}once(e,t){return t?(this._oneTimeListeners||(this._oneTimeListeners={}),Ff(e,t,this._oneTimeListeners),this):new Promise(i=>this.once(e,i))}fire(e,t){var a,n,s,o;let i=typeof e=="string"?new ci(e,t||{}):e,r=i.type;if(this.listens(r)){i.target=this;let l=((n=(a=this._listeners)==null?void 0:a[r])==null?void 0:n.slice())??[];for(let c of l)c.call(this,i);let u=((o=(s=this._oneTimeListeners)==null?void 0:s[r])==null?void 0:o.slice())??[];for(let c of u)Bu(r,c,this._oneTimeListeners),c.call(this,i);let h=this._eventedParent;h&&(W(i,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),h.fire(i))}else i instanceof Q&&console.error(i.error);return this}listens(e){var t,i,r,a,n;return!!((i=(t=this._listeners)==null?void 0:t[e])!=null&&i.length||(a=(r=this._oneTimeListeners)==null?void 0:r[e])!=null&&a.length||(n=this._eventedParent)!=null&&n.listens(e))}setEventedParent(e,t){return this._eventedParent=e,this._eventedParentData=t,this}},L_={$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}
vendor: 113,113 bytes, line 4
4,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"}]}}}}};const z=L_,bw=["type","source","source-layer","minzoom","maxzoom","filter","layout"];var O=class{constructor(e,t,i,r,a="error"){this.message=(e?`${e}: `:"")+i,r&&(this.identifier=r),this.severity=a,t!=null&&t.__line__&&(this.line=t.__line__)}};const Es={kind:"null"},V={kind:"number"},fe={kind:"string"},ve={kind:"boolean"},Ii={kind:"color"},Il={kind:"projectionDefinition"},ea={kind:"object"},me={kind:"value"},ww={kind:"error"},Ml={kind:"collator"},Ss={kind:"formatted"},Fl={kind:"padding"},rs={kind:"colorArray"},zl={kind:"numberArray"},Ds={kind:"resolvedImage"},Rl={kind:"variableAnchorOffsetCollection"};function $t(e,t){return{kind:"array",itemType:e,N:t}}function it(e){if(e.kind==="array"){let t=it(e.itemType);return typeof e.N=="number"?`array<${t}, ${e.N}>`:e.itemType.kind==="value"?"array":`array<${t}>`}return e.kind}const Tw=[Es,V,fe,ve,Ii,Il,Ss,ea,$t(me),Fl,zl,rs,Ds,Rl];function as(e,t){if(t.kind==="error")return null;if(e.kind==="array"){if(t.kind==="array"&&(t.N===0&&t.itemType.kind==="value"||!as(e.itemType,t.itemType))&&(typeof e.N!="number"||e.N===t.N))return null}else{if(e.kind===t.kind)return null;if(e.kind==="value"){for(let i of Tw)if(!as(i,t))return null}}return`Expected ${it(e)} but found ${it(t)} instead.`}function _d(e,t){return t.some(i=>i.kind===e.kind)}function ta(e,t){return t.some(i=>i==="null"?e===null:i==="array"?Array.isArray(e):i==="object"?e&&!Array.isArray(e)&&typeof e=="object":i===typeof e)}function wr(e,t){return e.kind==="array"&&t.kind==="array"?e.itemType.kind===t.itemType.kind&&typeof e.N=="number":e.kind===t.kind}const B_=.96422,O_=.82521,$_=4/29,Ah=6/29,j_=3*Ah*Ah,Ew=Math.PI/180,Sw=180/Math.PI;function V_(e){return e%=360,e<0&&(e+=360),e}function N_([e,t,i,r]){e=Ou(e),t=Ou(t),i=Ou(i);let a,n,s=$u((.2225045*e+.7168786*t+.0606169*i)/1);e===t&&t===i?a=n=s:(a=$u((.4360747*e+.3850649*t+.1430804*i)/B_),n=$u((.0139322*e+.0971045*t+.7141733*i)/O_));let o=116*s-16;return[o<0?0:o,500*(a-s),200*(s-n),r]}function Ou(e){return e<=.04045?e/12.92:((e+.055)/1.055)**2.4}function $u(e){return e>.008856451679035631?e**(1/3):e/j_+$_}function U_([e,t,i,r]){let a=(e+16)/116,n=isNaN(t)?a:a+t/500,s=isNaN(i)?a:a-i/200;return a=1*Vu(a),n=B_*Vu(n),s=O_*Vu(s),[ju(3.1338561*n-1.6168667*a-.4906146*s),ju(-.9787684*n+1.9161415*a+.033454*s),ju(.0719453*n-.2289914*a+1.4052427*s),r]}function ju(e){return e=e<=.00304?12.92*e:1.055*e**(1/2.4)-.055,e<0?0:e>1?1:e}function Vu(e){return e>Ah?e*e*e:j_*(e-$_)}function Dw(e){let[t,i,r,a]=N_(e),n=Math.sqrt(i*i+r*r);return[Math.round(n*1e4)?V_(Math.atan2(r,i)*Sw):NaN,n,t,a]}function Cw([e,t,i,r]){return e=isNaN(e)?0:e*Ew,U_([i,Math.cos(e)*t,Math.sin(e)*t,r])}function Pw([e,t,i,r]){e=V_(e),t/=100,i/=100;function a(n){let s=(n+e/30)%12,o=t*Math.min(i,1-i);return i-o*Math.max(-1,Math.min(s-3,9-s,1))}return[a(0),a(8),a(4),r]}const Aw=Object.hasOwn||function(e,t){return Object.prototype.hasOwnProperty.call(e,t)};function Wn(e,t){return Aw(e,t)?e[t]:void 0}function Iw(e){if(e=e.toLowerCase().trim(),e==="transparent")return[0,0,0,0];let t=Wn(Mw,e);if(t){let[r,a,n]=t;return[r/255,a/255,n/255,1]}if(e.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(e)){let r=e.length<6?1:2,a=1;return[no(e.slice(a,a+=r)),no(e.slice(a,a+=r)),no(e.slice(a,a+=r)),no(e.slice(a,a+r)||"ff")]}if(e.startsWith("rgb")){let r=e.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(r){let[a,n,s,o,l,u,h,c,d,p,f,m]=r,g=[o||" ",h||" ",p].join("");if(g==="  "||g==="  /"||g===",,"||g===",,,"){let _=[s,u,d].join(""),y=_==="%%%"?100:_===""?255:0;if(y){let x=[Fa(+n/y,0,1),Fa(+l/y,0,1),Fa(+c/y,0,1),f?zf(+f,m):1];if(Rf(x))return x}}return}}let i=e.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(i){let[r,a,n,s,o,l,u,h,c]=i,d=[n||" ",o||" ",u].join("");if(d==="  "||d==="  /"||d===",,"||d===",,,"){let p=[+a,Fa(+s,0,100),Fa(+l,0,100),h?zf(+h,c):1];if(Rf(p))return Pw(p)}}}function no(e){return parseInt(e.padEnd(2,e),16)/255}function zf(e,t){return Fa(t?e/100:e,0,1)}function Fa(e,t,i){return Math.min(Math.max(t,e),i)}function Rf(e){return!e.some(Number.isNaN)}const Mw={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 Ar(e,t,i){return e+i*(t-e)}function Ka(e,t,i){return e.map((r,a)=>Ar(r,t[a],i))}function Fw(e){return e==="rgb"||e==="hcl"||e==="lab"}var St,de=(St=class{constructor(t,i,r,a=1,n=!0){this.r=t,this.g=i,this.b=r,this.a=a,n||(this.r*=a,this.g*=a,this.b*=a,a||this.overwriteGetter("rgb",[t,i,r,a]))}static parse(t){if(t instanceof St)return t;if(typeof t!="string")return;let i=Iw(t);if(i)return new St(...i,!1)}get rgb(){let{r:t,g:i,b:r,a}=this,n=a||1/0;return this.overwriteGetter("rgb",[t/n,i/n,r/n,a])}get hcl(){return this.overwriteGetter("hcl",Dw(this.rgb))}get lab(){return this.overwriteGetter("lab",N_(this.rgb))}overwriteGetter(t,i){return Object.defineProperty(this,t,{value:i}),i}toString(){let[t,i,r,a]=this.rgb;return`rgba(${[t,i,r].map(n=>Math.round(n*255)).join(",")},${a})`}static interpolate(t,i,r,a="rgb"){switch(a){case"rgb":{let[n,s,o,l]=Ka(t.rgb,i.rgb,r);return new St(n,s,o,l,!1)}case"hcl":{let[n,s,o,l]=t.hcl,[u,h,c,d]=i.hcl,p,f;if(!isNaN(n)&&!isNaN(u)){let x=u-n;u>n&&x>180?x-=360:u<n&&n-u>180&&(x+=360),p=n+r*x}else isNaN(n)?isNaN(u)?p=NaN:(p=u,(o===1||o===0)&&(f=h)):(p=n,(c===1||c===0)&&(f=s));let[m,g,_,y]=Cw([p,f??Ar(s,h,r),Ar(o,c,r),Ar(l,d,r)]);return new St(m,g,_,y,!1)}case"lab":{let[n,s,o,l]=U_(Ka(t.lab,i.lab,r));return new St(n,s,o,l,!1)}}}},St.black=new St(0,0,0,1),St.white=new St(1,1,1,1),St.transparent=new St(0,0,0,0),St.red=new St(1,0,0,1),St);const zw=["bottom","center","top"];var Ih=class{constructor(t,i,r,a,n,s){this.text=t,this.image=i,this.scale=r,this.fontStack=a,this.textColor=n,this.verticalAlign=s}},_r=class Bo{constructor(t){this.sections=t}static fromString(t){return new Bo([new Ih(t,null,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some(t=>t.text.length!==0||t.image&&t.image.name.length!==0)}static factory(t){return t instanceof Bo?t:Bo.fromString(t)}toString(){return this.sections.length===0?"":this.sections.map(t=>t.text).join("")}},Ji=class $n{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof $n)return t;if(typeof t=="number")return new $n([t,t,t,t]);if(Array.isArray(t)&&!(t.length<1||t.length>4)){for(let i of t)if(typeof i!="number")return;switch(t.length){case 1:t=[t[0],t[0],t[0],t[0]];break;case 2:t=[t[0],t[1],t[0],t[1]];break;case 3:t=[t[0],t[1],t[2],t[1]]}return new $n(t)}}toString(){return JSON.stringify(this.values)}static interpolate(t,i,r){return new $n(Ka(t.values,i.values,r))}},Qi=class jn{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof jn)return t;if(typeof t=="number")return new jn([t]);if(Array.isArray(t)){for(let i of t)if(typeof i!="number")return;return new jn(t)}}toString(){return JSON.stringify(this.values)}static interpolate(t,i,r){return new jn(Ka(t.values,i.values,r))}},Ti=class Vn{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof Vn)return t;if(typeof t=="string"){let r=de.parse(t);return r?new Vn([r]):void 0}if(!Array.isArray(t))return;let i=[];for(let r of t){if(typeof r!="string")return;let a=de.parse(r);if(!a)return;i.push(a)}return new Vn(i)}toString(){return JSON.stringify(this.values)}static interpolate(t,i,r,a="rgb"){let n=[];if(t.values.length!=i.values.length)throw Error(`colorArray: Arrays have mismatched length (${t.values.length} vs. ${i.values.length}), cannot interpolate.`);for(let s=0;s<t.values.length;s++)n.push(de.interpolate(t.values[s],i.values[s],r,a));return new Vn(n)}},Ye=class extends Error{constructor(e,t){super(e),this.name="RuntimeError",this.path=t}toJSON(){return this.message}};const Rw=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);var Yi=class Oo{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof Oo)return t;if(!(!Array.isArray(t)||t.length<1||t.length%2!=0)){for(let i=0;i<t.length;i+=2){let r=t[i],a=t[i+1];if(typeof r!="string"||!Rw.has(r)||!Array.isArray(a)||a.length!==2||typeof a[0]!="number"||typeof a[1]!="number")return}return new Oo(t)}}toString(){return JSON.stringify(this.values)}static interpolate(t,i,r,a){let n=t.values,s=i.values;if(n.length!==s.length)throw new Ye(`Cannot interpolate values of different length. from: ${t.toString()}, to: ${i.toString()}`,a);let o=[];for(let l=0;l<n.length;l+=2){if(n[l]!==s[l])throw new Ye(`Cannot interpolate values containing mismatched anchors. from[${l}]: ${n[l]}, to[${l}]: ${s[l]}`,a);o.push(n[l]);let[u,h]=n[l+1],[c,d]=s[l+1];o.push([Ar(u,c,r),Ar(h,d,r)])}return new Oo(o)}},Ki=class G_{constructor(t){this.name=t.name,this.available=t.available}toString(){return this.name}static fromString(t){return t?new G_({name:t,available:!1}):null}},Lr=class za{constructor(t,i,r){this.from=t,this.to=i,this.transition=r}toString(){return this.from===this.to&&this.transition===1?this.from:JSON.stringify([this.from,this.to,this.transition])}static interpolate(t,i,r){return new za(t,i,r)}static parse(t){if(t instanceof za)return t;if(Array.isArray(t)&&t.length===3&&typeof t[0]=="string"&&typeof t[1]=="string"&&typeof t[2]=="number")return new za(t[0],t[1],t[2]);if(typeof t=="object"&&typeof t.from=="string"&&typeof t.to=="string"&&typeof t.transition=="number")return new za(t.from,t.to,t.transition);if(typeof t=="string")return new za(t,t,1)}},yd=class{constructor(t,i,r){this.sensitivity=t?i?"variant":"case":i?"accent":"base",this.locale=r,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(t,i){return this.collator.compare(t,i)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}};function Z_(e,t,i,r){return typeof e=="number"&&e>=0&&e<=255&&typeof t=="number"&&t>=0&&t<=255&&typeof i=="number"&&i>=0&&i<=255?r===void 0||typeof r=="number"&&r>=0&&r<=1?null:`Invalid rgba value [${[e,t,i,r].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof r=="number"?[e,t,i,r]:[e,t,i]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function Ja(e){if(e===null||typeof e=="string"||typeof e=="boolean"||typeof e=="number"||e instanceof Lr||e instanceof de||e instanceof yd||e instanceof _r||e instanceof Ji||e instanceof Qi||e instanceof Ti||e instanceof Yi||e instanceof Ki)return!0;if(Array.isArray(e)){for(let t of e)if(!Ja(t))return!1;return!0}if(typeof e=="object"){for(let t in e)if(!Ja(e[t]))return!1;return!0}return!1}function ut(e){if(e===null)return Es;if(typeof e=="string")return fe;if(typeof e=="boolean")return ve;if(typeof e=="number")return V;if(e instanceof de)return Ii;if(e instanceof Lr)return Il;if(e instanceof yd)return Ml;if(e instanceof _r)return Ss;if(e instanceof Ji)return Fl;if(e instanceof Qi)return zl;if(e instanceof Ti)return rs;if(e instanceof Yi)return Rl;if(e instanceof Ki)return Ds;if(Array.isArray(e)){let t=e.length,i;for(let r of e){let a=ut(r);if(!i)i=a;else{if(i===a)continue;i=me;break}}return $t(i||me,t)}return ea}function Hn(e){let t=typeof e;return e===null?"":t==="string"||t==="number"||t==="boolean"?String(e):e instanceof de||e instanceof Lr||e instanceof _r||e instanceof Ji||e instanceof Qi||e instanceof Ti||e instanceof Yi||e instanceof Ki?e.toString():JSON.stringify(e)}var Qa=class q_{constructor(t,i){this.type=t,this.value=i}static parse(t,i){if(t.length!==2)return i.error(`'literal' expression requires exactly one argument, but found ${t.length-1} instead.`);if(!Ja(t[1]))return i.error(`invalid value of type "${typeof t[1]}"`);let r=t[1],a=ut(r),n=i.expectedType;return a.kind==="array"&&a.N===0&&n&&n.kind==="array"&&(typeof n.N!="number"||n.N===0)&&(a=n),new q_(a,r)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}};const kw=["Unknown","Point","LineString","Polygon"];var W_=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"?kw[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 i=this._parseColorCache.get(t);return i||(i=de.parse(t),this._parseColorCache.set(t,i)),i}};function kl(e,t,i){let r=e.length-1,a=0,n=r,s=0,o,l;for(;a<=n;)if(s=Math.floor((a+n)/2),o=e[s],l=e[s+1],o<=t){if(s===r||t<l)return s;a=s+1}else if(o>t)n=s-1;else throw new Ye("Input is not a number.",i);return 0}var vd=class H_{constructor(t,i,r,a){this.type=t,this.input=i,this.key=a,this.labels=[],this.outputs=[];for(let[n,s]of r)this.labels.push(n),this.outputs.push(s)}static parse(t,i){if(t.length-1<4)return i.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return i.error("Expected an even number of arguments.");let r=i.parse(t[1],1,V);if(!r)return null;let a=[],n=null;i.expectedType&&i.expectedType.kind!=="value"&&(n=i.expectedType);for(let s=1;s<t.length;s+=2){let o=s===1?-1/0:t[s],l=t[s+1],u=s,h=s+1;if(typeof o!="number")return i.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',u);if(a.length&&a[a.length-1][0]>=o)return i.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',u);let c=i.parse(l,h,n);if(!c)return null;n||(n=c.type),a.push([o,c])}return new H_(n,r,a,i.key)}evaluate(t){let i=this.labels,r=this.outputs;if(i.length===1)return r[0].evaluate(t);let a=this.input.evaluate(t);if(a<=i[0])return r[0].evaluate(t);let n=i.length;return a>=i[n-1]?r[n-1].evaluate(t):r[kl(i,a,this.key)].evaluate(t)}eachChild(t){t(this.input);for(let i of this.outputs)t(i)}outputDefined(){return this.outputs.every(t=>t.outputDefined())}};function Lw(e,t,i,r){let a=3*e,n=3*(i-e)-a,s=1-a-n,o=3*t,l=3*(r-t)-o,u=1-o-l;return function(h,c=1e-6){if(h<=0)return 0;if(h>=1)return 1;let d=h;for(let m=0;m<8;m++){let g=((s*d+n)*d+a)*d-h;if(Math.abs(g)<c)return((u*d+l)*d+o)*d;let _=(3*s*d+2*n)*d+a;if(Math.abs(_)<1e-6)break;d-=g/_}let p=0,f=1;d=h;for(let m=0;m<20;m++){let g=((s*d+n)*d+a)*d;if(Math.abs(g-h)<c)break;h>g?p=d:f=d,d=(p+f)*.5}return((u*d+l)*d+o)*d}}var Ei=class Mh{constructor(t,i,r,a,n,s){this.type=t,this.operator=i,this.interpolation=r,this.input=a,this.key=s,this.labels=[],this.outputs=[];for(let[o,l]of n)this.labels.push(o),this.outputs.push(l)}static interpolationFactor(t,i,r,a){let n=0;if(t.name==="exponential")n=Nu(i,t.base,r,a);else if(t.name==="linear")n=Nu(i,1,r,a);else if(t.name==="cubic-bezier"){let s=t.controlPoints;n=Lw(s[0],s[1],s[2],s[3])(Nu(i,1,r,a))}return n}static parse(t,i){let[r,a,n,...s]=t;if(!Array.isArray(a)||a.length===0)return i.error("Expected an interpolation type expression.",1);if(a[0]==="linear")a={name:"linear"};else if(a[0]==="exponential"){let u=a[1];if(typeof u!="number")return i.error("Exponential interpolation requires a numeric base.",1,1);a={name:"exponential",base:u}}else if(a[0]==="cubic-bezier"){let u=a.slice(1);if(u.length!==4||u.some(h=>typeof h!="number"||h<0||h>1))return i.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);a={name:"cubic-bezier",controlPoints:u}}else return i.error(`Unknown interpolation type ${String(a[0])}`,1,0);if(t.length-1<4)return i.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return i.error("Expected an even number of arguments.");if(n=i.parse(n,2,V),!n)return null;let o=[],l=null;(r==="interpolate-hcl"||r==="interpolate-lab")&&i.expectedType!=rs?l=Ii:i.expectedType&&i.expectedType.kind!=="value"&&(l=i.expectedType);for(let u=0;u<s.length;u+=2){let h=s[u],c=s[u+1],d=u+3,p=u+4;if(typeof h!="number")return i.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',d);if(o.length&&o[o.length-1][0]>=h)return i.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',d);let f=i.parse(c,p,l);if(!f)return null;l||(l=f.type),o.push([h,f])}return!wr(l,V)&&!wr(l,Il)&&!wr(l,Ii)&&!wr(l,Fl)&&!wr(l,zl)&&!wr(l,rs)&&!wr(l,Rl)&&!wr(l,$t(V))?i.error(`Type ${it(l)} is not interpolatable.`):new Mh(l,r,a,n,o,i.key)}evaluate(t){let i=this.labels,r=this.outputs;if(i.length===1)return r[0].evaluate(t);let a=this.input.evaluate(t);if(a<=i[0])return r[0].evaluate(t);let n=i.length;if(a>=i[n-1])return r[n-1].evaluate(t);let s=kl(i,a,this.key),o=i[s],l=i[s+1],u=Mh.interpolationFactor(this.interpolation,a,o,l),h=r[s].evaluate(t),c=r[s+1].evaluate(t);switch(this.operator){case"interpolate":switch(this.type.kind){case"number":return Ar(h,c,u);case"color":return de.interpolate(h,c,u);case"padding":return Ji.interpolate(h,c,u);case"colorArray":return Ti.interpolate(h,c,u);case"numberArray":return Qi.interpolate(h,c,u);case"variableAnchorOffsetCollection":return Yi.interpolate(h,c,u,this.key);case"array":return Ka(h,c,u);case"projectionDefinition":return Lr.interpolate(h,c,u)}case"interpolate-hcl":switch(this.type.kind){case"color":return de.interpolate(h,c,u,"hcl");case"colorArray":return Ti.interpolate(h,c,u,"hcl")}case"interpolate-lab":switch(this.type.kind){case"color":return de.interpolate(h,c,u,"lab");case"colorArray":return Ti.interpolate(h,c,u,"lab")}}}eachChild(t){t(this.input);for(let i of this.outputs)t(i)}outputDefined(){return this.outputs.every(t=>t.outputDefined())}};function Nu(e,t,i,r){let a=r-i,n=e-i;return a===0?0:t===1?n/a:(t**+n-1)/(t**+a-1)}const Je={color:de.interpolate,number:Ar,padding:Ji.interpolate,numberArray:Qi.interpolate,colorArray:Ti.interpolate,variableAnchorOffsetCollection:Yi.interpolate,array:Ka};var X_=class Y_{constructor(t){this.type=Ss,this.sections=t}static parse(t,i){if(t.length<2)return i.error("Expected at least one argument.");let r=t[1];if(!Array.isArray(r)&&typeof r=="object")return i.error("First argument must be an image or text section.");let a=[],n=!1;for(let s=1;s<=t.length-1;++s){let o=t[s];if(n&&typeof o=="object"&&!Array.isArray(o)){n=!1;let l=null;if(o["font-scale"]&&(l=i.parse(o["font-scale"],1,V),!l))return null;let u=null;if(o["text-font"]&&(u=i.parse(o["text-font"],1,$t(fe)),!u))return null;let h=null;if(o["text-color"]&&(h=i.parse(o["text-color"],1,Ii),!h))return null;let c=null;if(o["vertical-align"]){if(typeof o["vertical-align"]=="string"&&!zw.includes(o["vertical-align"]))return i.error(`'vertical-align' must be one of: 'bottom', 'center', 'top' but found '${o["vertical-align"]}' instead.`);if(c=i.parse(o["vertical-align"],1,fe),!c)return null}let d=a[a.length-1];d.scale=l,d.font=u,d.textColor=h,d.verticalAlign=c}else{let l=i.parse(t[s],1,me);if(!l)return null;let u=l.type.kind;if(u!=="string"&&u!=="value"&&u!=="null"&&u!=="resolvedImage")return i.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");n=!0,a.push({content:l,scale:null,font:null,textColor:null,verticalAlign:null})}}return new Y_(a)}evaluate(t){return new _r(this.sections.map(i=>{let r=i.content.evaluate(t);return ut(r)===Ds?new Ih("",r,null,null,null,i.verticalAlign?i.verticalAlign.evaluate(t):null):new Ih(Hn(r),null,i.scale?i.scale.evaluate(t):null,i.font?i.font.evaluate(t).join(","):null,i.textColor?i.textColor.evaluate(t):null,i.verticalAlign?i.verticalAlign.evaluate(t):null)}))}eachChild(t){for(let i of this.sections)t(i.content),i.scale&&t(i.scale),i.font&&t(i.font),i.textColor&&t(i.textColor),i.verticalAlign&&t(i.verticalAlign)}outputDefined(){return!1}};function K_(e,t,i=0,r=e.length-1,a=Bw){for(;r>i;){if(r-i>600){let l=r-i+1,u=t-i+1,h=Math.log(l),c=.5*Math.exp(2*h/3),d=.5*Math.sqrt(h*c*(l-c)/l)*(u-l/2<0?-1:1);K_(e,t,Math.max(i,Math.floor(t-u*c/l+d)),Math.min(r,Math.floor(t+(l-u)*c/l+d)),a)}let n=e[t],s=i,o=r;for(Sn(e,i,t),a(e[r],n)>0&&Sn(e,i,r);s<o;){for(Sn(e,s,o),s++,o--;a(e[s],n)<0;)s++;for(;a(e[o],n)>0;)o--}a(e[i],n)===0?Sn(e,i,o):(o++,Sn(e,o,r)),o<=t&&(i=o+1),t<=o&&(r=o-1)}}function Sn(e,t,i){let r=e[t];e[t]=e[i],e[i]=r}function Bw(e,t){return e<t?-1:+(e>t)}function Ll(e,t){if(e.length<=1)return[e];let i=[],r,a;for(let n of e){let s=$w(n);s!==0&&(n.area=Math.abs(s),a===void 0&&(a=s<0),a===s<0?(r&&i.push(r),r=[n]):r.push(n))}if(r&&i.push(r),t>1)for(let n=0;n<i.length;n++)i[n].length<=t||(K_(i[n],t,1,i[n].length-1,Ow),i[n]=i[n].slice(0,t));return i}function Ow(e,t){return t.area-e.area}function $w(e){let t=0;for(let i=0,r=e.length,a=r-1,n,s;i<r;a=i++)n=e[i],s=e[a],t+=(s.x-n.x)*(n.y+s.y);return t}const so={string:fe,number:V,boolean:ve,object:ea};var lr=class J_{constructor(t,i,r){this.type=t,this.args=i,this.key=r}static parse(t,i){if(t.length<2)return i.error("Expected at least one argument.");let r=1,a,n=t[0];if(n==="array"){let o;if(t.length>2){let u=t[1];if(typeof u!="string"||!(u in so)||u==="object")return i.error('The item type argument of "array" must be one of string, number, boolean',1);o=so[u],r++}else o=me;let l;if(t.length>3){if(t[2]!==null&&(typeof t[2]!="number"||t[2]<0||t[2]!==Math.floor(t[2])))return i.error('The length argument to "array" must be a positive integer literal',2);l=t[2],r++}a=$t(o,l)}else{if(!so[n])throw Error(`Types doesn't contain name = ${n}`);a=so[n]}let s=[];for(;r<t.length;r++){let o=i.parse(t[r],r,me);if(!o)return null;s.push(o)}return new J_(a,s,i.key)}evaluate(t){for(let i=0;i<this.args.length;i++){let r=this.args[i].evaluate(t);if(!as(this.type,ut(r)))return r;if(i===this.args.length-1)throw new Ye(`Expected value to be of type ${it(this.type)}, but found ${it(ut(r))} instead.`,this.key)}throw Error()}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}};const kf={"to-boolean":ve,"to-color":Ii,"to-number":V,"to-string":fe};var Ba=class Q_{constructor(t,i,r){this.type=t,this.args=i,this.key=r}static parse(t,i){if(t.length<2)return i.error("Expected at least one argument.");let r=t[0];if(!kf[r])throw Error(`Can't parse ${r} as it is not part of the known types`);if((r==="to-boolean"||r==="to-string")&&t.length!==2)return i.error("Expected one argument.");let a=kf[r],n=[];for(let s=1;s<t.length;s++){let o=i.parse(t[s],s,me);if(!o)return null;n.push(o)}return new Q_(a,n,i.key)}evaluate(t){switch(this.type.kind){case"boolean":return!!this.args[0].evaluate(t);case"color":{let i,r;for(let a of this.args){if(i=a.evaluate(t),r=null,i instanceof de)return i;if(typeof i=="string"){let n=t.parseColor(i);if(n)return n}else if(Array.isArray(i)&&(r=i.length<3||i.length>4?`Invalid rgba value ${JSON.stringify(i)}: expected an array containing either three or four numeric values.`:Z_(i[0],i[1],i[2],i[3]),!r))return new de(i[0]/255,i[1]/255,i[2]/255,i[3])}throw new Ye(r||`Could not parse color from value '${typeof i=="string"?i:JSON.stringify(i)}'`,this.key)}case"padding":{let i;for(let r of this.args){i=r.evaluate(t);let a=Ji.parse(i);if(a)return a}throw new Ye(`Could not parse padding from value '${typeof i=="string"?i:JSON.stringify(i)}'`,this.key)}case"numberArray":{let i;for(let r of this.args){i=r.evaluate(t);let a=Qi.parse(i);if(a)return a}throw new Ye(`Could not parse numberArray from value '${typeof i=="string"?i:JSON.stringify(i)}'`,this.key)}case"colorArray":{let i;for(let r of this.args){i=r.evaluate(t);let a=Ti.parse(i);if(a)return a}throw new Ye(`Could not parse colorArray from value '${typeof i=="string"?i:JSON.stringify(i)}'`,this.key)}case"variableAnchorOffsetCollection":{let i;for(let r of this.args){i=r.evaluate(t);let a=Yi.parse(i);if(a)return a}throw new Ye(`Could not parse variableAnchorOffsetCollection from value '${typeof i=="string"?i:JSON.stringify(i)}'`,this.key)}case"number":{let i=null;for(let r of this.args){if(i=r.evaluate(t),i===null)return 0;let a=Number(i);if(!isNaN(a))return a}throw new Ye(`Could not convert ${JSON.stringify(i)} to number.`,this.key)}case"formatted":return _r.fromString(Hn(this.args[0].evaluate(t)));case"resolvedImage":return Ki.fromString(Hn(this.args[0].evaluate(t)));case"projectionDefinition":{let i=this.args[0].evaluate(t);if(Lr.parse(i))return i;throw new Ye(`Could not parse projectionDefinition from value '${typeof i=="string"?i:JSON.stringify(i)}'`,this.key)}default:return Hn(this.args[0].evaluate(t))}}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}},ey=class ty{constructor(t,i){this.type=i.type,this.bindings=[].concat(t),this.result=i}evaluate(t){return this.result.evaluate(t)}eachChild(t){for(let i of this.bindings)t(i[1]);t(this.result)}static parse(t,i){if(t.length<4)return i.error(`Expected at least 3 arguments, but found ${t.length-1} instead.`);let r=[];for(let n=1;n<t.length-1;n+=2){let s=t[n];if(typeof s!="string")return i.error(`Expected string, but found ${typeof s} instead.`,n);if(/[^a-zA-Z0-9_]/.test(s))return i.error("Variable names must contain only alphanumeric characters or '_'.",n);let o=i.parse(t[n+1],n+1);if(!o)return null;r.push([s,o])}let a=i.parse(t[t.length-1],t.length-1,i.expectedType,r);return a?new ty(r,a):null}outputDefined(){return this.result.outputDefined()}},iy=class ry{constructor(t,i){this.type=i.type,this.name=t,this.boundExpression=i}static parse(t,i){if(t.length!==2||typeof t[1]!="string")return i.error("'var' expression requires exactly one string literal argument.");let r=t[1];return i.scope.has(r)?new ry(r,i.scope.get(r)):i.error(`Unknown variable "${r}". Make sure "${r}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(t){return this.boundExpression.evaluate(t)}eachChild(){}outputDefined(){return!1}},jw=class ay{constructor(t,i,r,a){this.type=t,this.index=i,this.input=r,this.key=a}static parse(t,i){if(t.length!==3)return i.error(`Expected 2 arguments, but found ${t.length-1} instead.`);let r=i.parse(t[1],1,V),a=i.parse(t[2],2,$t(i.expectedType||me));if(!r||!a)return null;let n=a.type;return new ay(n.itemType,r,a,i.key)}evaluate(t){let i=this.index.evaluate(t),r=this.input.evaluate(t);if(i<0)throw new Ye(`Array index out of bounds: ${i} < 0.`,this.key);if(i>=r.length)throw new Ye(`Array index out of bounds: ${i} > ${r.length-1}.`,this.key);if(i!==Math.floor(i))throw new Ye(`Array index must be an integer, but found ${i} instead.`,this.key);return r[i]}eachChild(t){t(this.index),t(this.input)}outputDefined(){return!1}},Vw=class ny{constructor(t,i,r){this.needle=t,this.haystack=i,this.key=r,this.type=ve}static parse(t,i){if(t.length!==3)return i.error(`Expected 2 arguments, but found ${t.length-1} instead.`);let r=i.parse(t[1],1,me),a=i.parse(t[2],2,me);return!r||!a?null:_d(r.type,[ve,fe,V,Es,me])?new ny(r,a,i.key):i.error(`Expected first argument to be of type boolean, string, number or null, but found ${it(r.type)} instead`)}evaluate(t){let i=this.needle.evaluate(t),r=this.haystack.evaluate(t);if(!r)return!1;if(!ta(i,["boolean","string","number","null"]))throw new Ye(`Expected first argument to be of type boolean, string, number or null, but found ${it(ut(i))} instead.`,this.key);if(!ta(r,["string","array"]))throw new Ye(`Expected second argument to be of type array or string, but found ${it(ut(r))} instead.`,this.key);return r.indexOf(i)>=0}eachChild(t){t(this.needle),t(this.haystack)}outputDefined(){return!0}},Nw=class Fh{constructor(t,i,r,a){this.needle=t,this.haystack=i,this.key=r,this.fromIndex=a,this.type=V}static parse(t,i){if(t.length<=2||t.length>=5)return i.error(`Expected 2 or 3 arguments, but found ${t.length-1} instead.`);let r=i.parse(t[1],1,me),a=i.parse(t[2],2,me);if(!r||!a)return null;if(!_d(r.type,[ve,fe,V,Es,me]))return i.error(`Expected first argument to be of type boolean, string, number or null, but found ${it(r.type)} instead`);if(t.length===4){let n=i.parse(t[3],3,V);return n?new Fh(r,a,i.key,n):null}return new Fh(r,a,i.key)}evaluate(t){let i=this.needle.evaluate(t),r=this.haystack.evaluate(t);if(!ta(i,["boolean","string","number","null"]))throw new Ye(`Expected first argument to be of type boolean, string, number or null, but found ${it(ut(i))} instead.`,this.key);let a;if(this.fromIndex&&(a=this.fromIndex.evaluate(t)),ta(r,["string"])){let n=r.indexOf(i,a);return n===-1?-1:[...r.slice(0,n)].length}if(ta(r,["array"]))return r.indexOf(i,a);throw new Ye(`Expected second argument to be of type array or string, but found ${it(ut(r))} instead.`,this.key)}eachChild(t){t(this.needle),t(this.haystack),this.fromIndex&&t(this.fromIndex)}outputDefined(){return!1}},Uw=class sy{constructor(t,i,r,a,n,s){this.inputType=t,this.type=i,this.input=r,this.cases=a,this.outputs=n,this.otherwise=s}static parse(t,i){if(t.length<5)return i.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if(t.length%2!=1)return i.error("Expected an even number of arguments.");let r,a;i.expectedType&&i.expectedType.kind!=="value"&&(a=i.expectedType);let n={},s=[];for(let u=2;u<t.length-1;u+=2){let h=t[u],c=t[u+1];Array.isArray(h)||(h=[h]);let d=i.concat(u);if(h.length===0)return d.error("Expected at least one branch label.");for(let f of h){if(typeof f!="number"&&typeof f!="string")return d.error("Branch labels must be numbers or strings.");if(typeof f=="number"&&Math.abs(f)>2**53-1)return d.error(`Branch labels must be integers no larger than ${2**53-1}.`);if(typeof f=="number"&&Math.floor(f)!==f)return d.error("Numeric branch labels must be integer values.");if(!r)r=ut(f);else if(d.checkSubtype(r,ut(f)))return null;if(n[String(f)]!==void 0)return d.error("Branch labels must be unique.");n[String(f)]=s.length}let p=i.parse(c,u,a);if(!p)return null;a||(a=p.type),s.push(p)}let o=i.parse(t[1],1,me);if(!o)return null;let l=i.parse(t[t.length-1],t.length-1,a);return!l||o.type.kind!=="value"&&i.concat(1).checkSubtype(r,o.type)?null:new sy(r,a,o,n,s,l)}evaluate(t){let i=this.input.evaluate(t);return(ut(i)===this.inputType&&this.outputs[this.cases[i]]||this.otherwise).evaluate(t)}eachChild(t){t(this.input),this.outputs.forEach(t),t(this.otherwise)}outputDefined(){return this.outputs.every(t=>t.outputDefined())&&this.otherwise.outputDefined()}},Gw=class oy{constructor(t,i,r){this.type=t,this.branches=i,this.otherwise=r}static parse(t,i){if(t.length<4)return i.error(`Expected at least 3 arguments, but found only ${t.length-1}.`);if(t.length%2!=0)return i.error("Expected an odd number of arguments.");let r;i.expectedType&&i.expectedType.kind!=="value"&&(r=i.expectedType);let a=[];for(let s=1;s<t.length-1;s+=2){let o=i.parse(t[s],s,ve);if(!o)return null;let l=i.parse(t[s+1],s+1,r);if(!l)return null;a.push([o,l]),r||(r=l.type)}let n=i.parse(t[t.length-1],t.length-1,r);if(!n)return null;if(!r)throw Error("Can't infer output type");return new oy(r,a,n)}evaluate(t){for(let[i,r]of this.branches)if(i.evaluate(t))return r.evaluate(t);return this.otherwise.evaluate(t)}eachChild(t){for(let[i,r]of this.branches)t(i),t(r);t(this.otherwise)}outputDefined(){return this.branches.every(([t,i])=>i.outputDefined())&&this.otherwise.outputDefined()}},Zw=class zh{constructor(t,i,r,a,n){this.type=t,this.input=i,this.beginIndex=r,this.key=a,this.endIndex=n}static parse(t,i){if(t.length<=2||t.length>=5)return i.error(`Expected 2 or 3 arguments, but found ${t.length-1} instead.`);let r=i.parse(t[1],1,me),a=i.parse(t[2],2,V);if(!r||!a)return null;if(!_d(r.type,[$t(me),fe,me]))return i.error(`Expected first argument to be of type array or string, but found ${it(r.type)} instead`);if(t.length===4){let n=i.parse(t[3],3,V);return n?new zh(r.type,r,a,i.key,n):null}return new zh(r.type,r,a,i.key)}evaluate(t){let i=this.input.evaluate(t),r=this.beginIndex.evaluate(t),a;if(this.endIndex&&(a=this.endIndex.evaluate(t)),ta(i,["string"]))return[...i].slice(r,a).join("");if(ta(i,["array"]))return i.slice(r,a);throw new Ye(`Expected first argument to be of type array or string, but found ${it(ut(i))} instead.`,this.key)}eachChild(t){t(this.input),t(this.beginIndex),this.endIndex&&t(this.endIndex)}outputDefined(){return!1}},ly=class Rh{constructor(t,i){this.type=t,this.args=i}static parse(t,i){if(t.length<2)return i.error("Expected at least one argument.");let r=null,a=i.expectedType;a&&a.kind!=="value"&&(r=a);let n=[];for(let s of t.slice(1)){let o=i.parse(s,1+n.length,r,void 0,{typeAnnotation:"omit"});if(!o)return null;r||(r=o.type),n.push(o)}if(!r)throw Error("No output type");return a&&n.some(s=>as(a,s.type))?new Rh(me,n):new Rh(r,n)}evaluate(t){let i=null,r=0,a;for(let n of this.args)if(r++,i=n.evaluate(t),i&&i instanceof Ki&&!i.available&&(a||(a=i.name),i=null,r===this.args.length&&(i=a)),i!==null)break;return i}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}};function Lf(e,t){return e==="=="||e==="!="?t.kind==="boolean"||t.kind==="string"||t.kind==="number"||t.kind==="null"||t.kind==="value":t.kind==="string"||t.kind==="number"||t.kind==="value"}function qw(e,t,i){return t===i}function Ww(e,t,i){return t!==i}function Hw(e,t,i){return t<i}function Xw(e,t,i){return t>i}function Yw(e,t,i){return t<=i}function Kw(e,t,i){return t>=i}function uy(e,t,i,r){return r.compare(t,i)===0}function Jw(e,t,i,r){return!uy(e,t,i,r)}function Qw(e,t,i,r){return r.compare(t,i)<0}function e2(e,t,i,r){return r.compare(t,i)>0}function t2(e,t,i,r){return r.compare(t,i)<=0}function i2(e,t,i,r){return r.compare(t,i)>=0}function ln(e,t,i){let r=e!=="=="&&e!=="!=";return class hy{constructor(n,s,o,l){this.lhs=n,this.rhs=s,this.key=o,this.collator=l,this.type=ve,this.hasUntypedArgument=n.type.kind==="value"||s.type.kind==="value"}static parse(n,s){if(n.length!==3&&n.length!==4)return s.error("Expected two or three arguments.");let o=n[0],l=s.parse(n[1],1,me);if(!l)return null;if(!Lf(o,l.type))return s.concat(1).error(`"${o}" comparisons are not supported for type '${it(l.type)}'.`);let u=s.parse(n[2],2,me);if(!u)return null;if(!Lf(o,u.type))return s.concat(2).error(`"${o}" comparisons are not supported for type '${it(u.type)}'.`);if(l.type.kind!==u.type.kind&&l.type.kind!=="value"&&u.type.kind!=="value")return s.error(`Cannot compare types '${it(l.type)}' and '${it(u.type)}'.`);r&&(l.type.kind==="value"&&u.type.kind!=="value"?l=new lr(u.type,[l],s.key):l.type.kind!=="value"&&u.type.kind==="value"&&(u=new lr(l.type,[u],s.key)));let h=null;if(n.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(n[3],3,Ml),!h)return null}return new hy(l,u,s.key,h)}evaluate(n){let s=this.lhs.evaluate(n),o=this.rhs.evaluate(n);if(r&&this.hasUntypedArgument){let l=ut(s),u=ut(o);if(l.kind!==u.kind||l.kind!=="string"&&l.kind!=="number")throw new Ye(`Expected arguments for "${e}" to be (string, string) or (number, number), but found (${l.kind}, ${u.kind}) instead.`,this.key)}if(this.collator&&!r&&this.hasUntypedArgument){let l=ut(s),u=ut(o);if(l.kind!=="string"||u.kind!=="string")return t(n,s,o)}return this.collator?i(n,s,o,this.collator.evaluate(n)):t(n,s,o)}eachChild(n){n(this.lhs),n(this.rhs),this.collator&&n(this.collator)}outputDefined(){return!0}}}const r2=ln("==",qw,uy),a2=ln("!=",Ww,Jw),n2=ln("<",Hw,Qw),s2=ln(">",Xw,e2),o2=ln("<=",Yw,t2),l2=ln(">=",Kw,i2);var cy=class dy{constructor(t,i,r){this.type=Ml,this.locale=r,this.caseSensitive=t,this.diacriticSensitive=i}static parse(t,i){if(t.length!==2)return i.error("Expected one argument.");let r=t[1];if(typeof r!="object"||Array.isArray(r))return i.error("Collator options argument must be an object.");let a=i.parse(r["case-sensitive"]!==void 0&&r["case-sensitive"],1,ve);if(!a)return null;let n=i.parse(r["diacritic-sensitive"]!==void 0&&r["diacritic-sensitive"],1,ve);if(!n)return null;let s=null;return r.locale&&(s=i.parse(r.locale,1,fe),!s)?null:new dy(a,n,s)}evaluate(t){return new yd(this.caseSensitive.evaluate(t),this.diacriticSensitive.evaluate(t),this.locale?this.locale.evaluate(t):null)}eachChild(t){t(this.caseSensitive),t(this.diacriticSensitive),this.locale&&t(this.locale)}outputDefined(){return!1}},u2=class py{constructor(t,i,r,a,n,s){this.type=fe,this.number=t,this.locale=i,this.currency=r,this.unit=a,this.minFractionDigits=n,this.maxFractionDigits=s}static parse(t,i){if(t.length!==3)return i.error("Expected two arguments.");let r=i.parse(t[1],1,V);if(!r)return null;let a=t[2];if(typeof a!="object"||Array.isArray(a))return i.error("NumberFormat options argument must be an object.");let n=null;if(a.locale&&(n=i.parse(a.locale,1,fe),!n))return null;let s=null;if(a.currency&&(s=i.parse(a.currency,1,fe),!s))return null;let o=null;if(a.unit&&(o=i.parse(a.unit,1,fe),!o))return null;if(s&&o)return i.error("NumberFormat options `currency` and `unit` are mutually exclusive");let l=null;if(a["min-fraction-digits"]&&(l=i.parse(a["min-fraction-digits"],1,V),!l))return null;let u=null;return a["max-fraction-digits"]&&(u=i.parse(a["max-fraction-digits"],1,V),!u)?null:new py(r,n,s,o,l,u)}evaluate(t){return new Intl.NumberFormat(this.locale?this.locale.evaluate(t):[],{style:this.currency?"currency":this.unit?"unit":"decimal",currency:this.currency?this.currency.evaluate(t):void 0,unit:this.unit?this.unit.evaluate(t):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(t):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(t):void 0}).format(this.number.evaluate(t))}eachChild(t){t(this.number),this.locale&&t(this.locale),this.currency&&t(this.currency),this.unit&&t(this.unit),this.minFractionDigits&&t(this.minFractionDigits),this.maxFractionDigits&&t(this.maxFractionDigits)}outputDefined(){return!1}},h2=class fy{constructor(t){this.type=Ds,this.input=t}static parse(t,i){if(t.length!==2)return i.error("Expected two arguments.");let r=i.parse(t[1],1,fe);return r?new fy(r):i.error("No image name provided.")}evaluate(t){let i=this.input.evaluate(t),r=Ki.fromString(i);return r&&t.availableImages&&(r.available=t.availableImages.indexOf(i)>-1),r}eachChild(t){t(this.input)}outputDefined(){return!1}},c2=class my{constructor(t,i){this.input=t,this.key=i,this.type=V}static parse(t,i){if(t.length!==2)return i.error(`Expected 1 argument, but found ${t.length-1} instead.`);let r=i.parse(t[1],1);return r?r.type.kind!=="array"&&r.type.kind!=="string"&&r.type.kind!=="value"?i.error(`Expected argument of type string or array, but found ${it(r.type)} instead.`):new my(r,i.key):null}evaluate(t){let i=this.input.evaluate(t);if(typeof i=="string")return[...i].length;if(Array.isArray(i))return i.length;throw new Ye(`Expected value to be of type string or array, but found ${it(ut(i))} instead.`,this.key)}eachChild(t){t(this.input)}outputDefined(){return!1}};const Wi=8192;function d2(e,t){let i=p2(e[0]),r=m2(e[1]),a=2**t.z;return[Math.round(i*a*Wi),Math.round(r*a*Wi)]}function xd(e,t){let i=2**t.z,r=(e[0]/Wi+t.x)/i,a=(e[1]/Wi+t.y)/i;return[f2(r),g2(a)]}function p2(e){return(180+e)/360}function f2(e){return e*360-180}function m2(e){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+e*Math.PI/360)))/360}function g2(e){return 360/Math.PI*Math.atan(Math.exp((180-e*360)*Math.PI/180))-90}function Cs(e,t){e[0]=Math.min(e[0],t[0]),e[1]=Math.min(e[1],t[1]),e[2]=Math.max(e[2],t[0]),e[3]=Math.max(e[3],t[1])}function ns(e,t){return!(e[0]<=t[0]||e[2]>=t[2]||e[1]<=t[1]||e[3]>=t[3])}function _2(e,t,i){return t[1]>e[1]!=i[1]>e[1]&&e[0]<(i[0]-t[0])*(e[1]-t[1])/(i[1]-t[1])+t[0]}function y2(e,t,i){let r=e[0]-t[0],a=e[1]-t[1],n=e[0]-i[0],s=e[1]-i[1];return r*s-n*a===0&&r*n<=0&&a*s<=0}function Bl(e,t,i,r){let a=[t[0]-e[0],t[1]-e[1]];return w2([r[0]-i[0],r[1]-i[1]],a)!==0&&!!(Bf(e,t,i,r)&&Bf(i,r,e,t))}function v2(e,t,i){for(let r of i)for(let a=0;a<r.length-1;++a)if(Bl(e,t,r[a],r[a+1]))return!0;return!1}function un(e,t,i=!1){let r=!1;for(let a of t)for(let n=0;n<a.length-1;n++){if(y2(e,a[n],a[n+1]))return i;_2(e,a[n],a[n+1])&&(r=!r)}return r}function x2(e,t){for(let i of t)if(un(e,i))return!0;return!1}function gy(e,t){for(let i of e)if(!un(i,t))return!1;for(let i=0;i<e.length-1;++i)if(v2(e[i],e[i+1],t))return!1;return!0}function b2(e,t){for(let i of t)if(gy(e,i))return!0;return!1}function w2(e,t){return e[0]*t[1]-e[1]*t[0]}function Bf(e,t,i,r){let a=e[0]-i[0],n=e[1]-i[1],s=t[0]-i[0],o=t[1]-i[1],l=r[0]-i[0],u=r[1]-i[1],h=a*u-l*n,c=s*u-l*o;return h>0&&c<0||h<0&&c>0}function bd(e,t,i){let r=[];for(let a=0;a<e.length;a++){let n=[];for(let s=0;s<e[a].length;s++){let o=d2(e[a][s],i);Cs(t,o),n.push(o)}r.push(n)}return r}function _y(e,t,i){let r=[];for(let a=0;a<e.length;a++){let n=bd(e[a],t,i);r.push(n)}return r}function yy(e,t,i,r){if(e[0]<i[0]||e[0]>i[2]){let a=r*.5,n=e[0]-i[0]>a?-r:i[0]-e[0]>a?r:0;n===0&&(n=e[0]-i[2]>a?-r:i[2]-e[0]>a?r:0),e[0]+=n}Cs(t,e)}function T2(e){e[0]=e[1]=1/0,e[2]=e[3]=-1/0}function Of(e,t,i,r){let a=2**r.z*Wi,n=[r.x*Wi,r.y*Wi],s=[];for(let o of e)for(let l of o){let u=[l.x+n[0],l.y+n[1]];yy(u,t,i,a),s.push(u)}return s}function $f(e,t,i,r){let a=2**r.z*Wi,n=[r.x*Wi,r.y*Wi],s=[];for(let o of e){let l=[];for(let u of o){let h=[u.x+n[0],u.y+n[1]];Cs(t,h),l.push(h)}s.push(l)}if(t[2]-t[0]<=a/2){T2(t);for(let o of s)for(let l of o)yy(l,t,i,a)}return s}function E2(e,t){let i=[1/0,1/0,-1/0,-1/0],r=[1/0,1/0,-1/0,-1/0],a=e.canonicalID();if(t.type==="Polygon"){let n=bd(t.coordinates,r,a),s=Of(e.geometry(),i,r,a);if(!ns(i,r))return!1;for(let o of s)if(!un(o,n))return!1}if(t.type==="MultiPolygon"){let n=_y(t.coordinates,r,a),s=Of(e.geometry(),i,r,a);if(!ns(i,r))return!1;for(let o of s)if(!x2(o,n))return!1}return!0}function S2(e,t){let i=[1/0,1/0,-1/0,-1/0],r=[1/0,1/0,-1/0,-1/0],a=e.canonicalID();if(t.type==="Polygon"){let n=bd(t.coordinates,r,a),s=$f(e.geometry(),i,r,a);if(!ns(i,r))return!1;for(let o of s)if(!gy(o,n))return!1}if(t.type==="MultiPolygon"){let n=_y(t.coordinates,r,a),s=$f(e.geometry(),i,r,a);if(!ns(i,r))return!1;for(let o of s)if(!b2(o,n))return!1}return!0}var wd=class $o{constructor(t,i){this.type=ve,this.geojson=t,this.geometries=i}static parse(t,i){if(t.length!==2)return i.error(`'within' expression requires exactly one argument, but found ${t.length-1} instead.`);if(Ja(t[1])){let r=t[1];if(r.type==="FeatureCollection"){let a=[];for(let n of r.features){let{type:s,coordinates:o}=n.geometry;s==="Polygon"&&a.push(o),s==="MultiPolygon"&&a.push(...o)}if(a.length)return new $o(r,{type:"MultiPolygon",coordinates:a})}else if(r.type==="Feature"){let a=r.geometry.type;if(a==="Polygon"||a==="MultiPolygon")return new $o(r,r.geometry)}else if(r.type==="Polygon"||r.type==="MultiPolygon")return new $o(r,r)}return i.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(t){if(t.geometry()!=null&&t.canonicalID()!=null){if(t.geometryType()==="Point")return E2(t,this.geometries);if(t.geometryType()==="LineString")return S2(t,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}},vy=class{constructor(t=[],i=(r,a)=>r<a?-1:+(r>a)){if(this.data=t,this.length=this.data.length,this.compare=i,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],i=this.data.pop();return--this.length>0&&(this.data[0]=i,this._down(0)),t}peek(){return this.data[0]}_up(t){let{data:i,compare:r}=this,a=i[t];for(;t>0;){let n=t-1>>1,s=i[n];if(r(a,s)>=0)break;i[t]=s,t=n}i[t]=a}_down(t){let{data:i,compare:r}=this,a=this.length>>1,n=i[t];for(;t<a;){let s=(t<<1)+1,o=s+1;if(o<this.length&&r(i[o],i[s])<0&&(s=o),r(i[s],n)>=0)break;i[t]=i[s],t=s}i[t]=n}};const jf=Math.PI/180;var Td=class{constructor(t){let i=jf*6378.137*1e3,r=Math.cos(t*jf),a=1/(1-.0066943799901413165*(1-r*r)),n=Math.sqrt(a);this.kx=i*n*r,this.ky=i*n*a*.9933056200098587}distance(t,i){let r=this.wrap(t[0]-i[0])*this.kx,a=(t[1]-i[1])*this.ky;return Math.sqrt(r*r+a*a)}pointOnLine(t,i){let r=1/0,a,n,s,o;for(let l=0;l<t.length-1;l++){let u=t[l][0],h=t[l][1],c=this.wrap(t[l+1][0]-u)*this.kx,d=(t[l+1][1]-h)*this.ky,p=0;(c!==0||d!==0)&&(p=(this.wrap(i[0]-u)*this.kx*c+(i[1]-h)*this.ky*d)/(c*c+d*d),p>1?(u=t[l+1][0],h=t[l+1][1]):p>0&&(u+=c/this.kx*p,h+=d/this.ky*p)),c=this.wrap(i[0]-u)*this.kx,d=(i[1]-h)*this.ky;let f=c*c+d*d;f<r&&(r=f,a=u,n=h,s=l,o=p)}return{point:[a,n],index:s,t:Math.max(0,Math.min(1,o))}}wrap(t){for(;t<-180;)t+=360;for(;t>180;)t-=360;return t}};function xy(e,t){return t[0]-e[0]}function Qo(e){return e[1]-e[0]+1}function yr(e,t){return e[1]>=e[0]&&e[1]<t}function kh(e,t){if(e[0]>e[1])return[null,null];let i=Qo(e);if(t){if(i===2)return[e,null];let a=Math.floor(i/2);return[[e[0],e[0]+a],[e[0]+a,e[1]]]}if(i===1)return[e,null];let r=Math.floor(i/2)-1;return[[e[0],e[0]+r],[e[0]+r+1,e[1]]]}function Lh(e,t){if(!yr(t,e.length))return[1/0,1/0,-1/0,-1/0];let i=[1/0,1/0,-1/0,-1/0];for(let r=t[0];r<=t[1];++r)Cs(i,e[r]);return i}function Bh(e){let t=[1/0,1/0,-1/0,-1/0];for(let i of e)for(let r of i)Cs(t,r);return t}function Vf(e){return e[0]!==-1/0&&e[1]!==-1/0&&e[2]!==1/0&&e[3]!==1/0}function Ed(e,t,i){if(!Vf(e)||!Vf(t))return NaN;let r=0,a=0;return e[2]<t[0]&&(r=t[0]-e[2]),e[0]>t[2]&&(r=e[0]-t[2]),e[1]>t[3]&&(a=e[1]-t[3]),e[3]<t[1]&&(a=t[1]-e[3]),i.distance([0,0],[r,a])}function Xr(e,t,i){let r=i.pointOnLine(t,e);return i.distance(e,r.point)}function Sd(e,t,i,r,a){let n=Math.min(Xr(e,[i,r],a),Xr(t,[i,r],a)),s=Math.min(Xr(i,[e,t],a),Xr(r,[e,t],a));return Math.min(n,s)}function D2(e,t,i,r,a){if(!(yr(t,e.length)&&yr(r,i.length)))return 1/0;let n=1/0;for(let s=t[0];s<t[1];++s){let o=e[s],l=e[s+1];for(let u=r[0];u<r[1];++u){let h=i[u],c=i[u+1];if(Bl(o,l,h,c))return 0;n=Math.min(n,Sd(o,l,h,c,a))}}return n}function C2(e,t,i,r,a){if(!(yr(t,e.length)&&yr(r,i.length)))return NaN;let n=1/0;for(let s=t[0];s<=t[1];++s)for(let o=r[0];o<=r[1];++o)if(n=Math.min(n,a.distance(e[s],i[o])),n===0)return n;return n}function P2(e,t,i){if(un(e,t,!0))return 0;let r=1/0;for(let a of t){let n=a[0],s=a[a.length-1];if(n!==s&&(r=Math.min(r,Xr(e,[s,n],i)),r===0))return r;let o=i.pointOnLine(a,e);if(r=Math.min(r,i.distance(e,o.point)),r===0)return r}return r}function A2(e,t,i,r){if(!yr(t,e.length))return NaN;for(let n=t[0];n<=t[1];++n)if(un(e[n],i,!0))return 0;let a=1/0;for(let n=t[0];n<t[1];++n){let s=e[n],o=e[n+1];for(let l of i)for(let u=0,h=l.length,c=h-1;u<h;c=u++){let d=l[c],p=l[u];if(Bl(s,o,d,p))return 0;a=Math.min(a,Sd(s,o,d,p,r))}}return a}function Nf(e,t){for(let i of e)for(let r of i)if(un(r,t,!0))return!0;return!1}function I2(e,t,i,r=1/0){let a=Bh(e),n=Bh(t);if(r!==1/0&&Ed(a,n,i)>=r)return r;if(ns(a,n)){if(Nf(e,t))return 0}else if(Nf(t,e))return 0;let s=1/0;for(let o of e)for(let l=0,u=o.length,h=u-1;l<u;h=l++){let c=o[h],d=o[l];for(let p of t)for(let f=0,m=p.length,g=m-1;f<m;g=f++){let _=p[g],y=p[f];if(Bl(c,d,_,y))return 0;s=Math.min(s,Sd(c,d,_,y,i))}}return s}function Uf(e,t,i,r,a,n){if(!n)return;let s=Ed(Lh(r,n),a,i);s<t&&e.push([s,n,[0,0]])}function oo(e,t,i,r,a,n,s){if(!n||!s)return;let o=Ed(Lh(r,n),Lh(a,s),i);o<t&&e.push([o,n,s])}function el(e,t,i,r,a=1/0){let n=Math.min(r.distance(e[0],i[0][0]),a);if(n===0)return n;let s=new vy([[0,[0,e.length-1],[0,0]]],xy),o=Bh(i);for(;s.length>0;){let l=s.pop();if(l[0]>=n)continue;let u=l[1],h=t?50:100;if(Qo(u)<=h){if(!yr(u,e.length))return NaN;if(t){let c=A2(e,u,i,r);if(isNaN(c)||c===0)return c;n=Math.min(n,c)}else for(let c=u[0];c<=u[1];++c){let d=P2(e[c],i,r);if(n=Math.min(n,d),n===0)return 0}}else{let c=kh(u,t);Uf(s,n,r,e,o,c[0]),Uf(s,n,r,e,o,c[1])}}return n}function tl(e,t,i,r,a,n=1/0){let s=Math.min(n,a.distance(e[0],i[0]));if(s===0)return s;let o=new vy([[0,[0,e.length-1],[0,i.length-1]]],xy);for(;o.length>0;){let l=o.pop();if(l[0]>=s)continue;let u=l[1],h=l[2],c=t?50:100,d=r?50:100;if(Qo(u)<=c&&Qo(h)<=d){if(!yr(u,e.length)&&yr(h,i.length))return NaN;let p;if(t&&r)p=D2(e,u,i,h,a),s=Math.min(s,p);else if(t&&!r){let f=e.slice(u[0],u[1]+1);for(let m=h[0];m<=h[1];++m)if(p=Xr(i[m],f,a),s=Math.min(s,p),s===0)return s}else if(!t&&r){let f=i.slice(h[0],h[1]+1);for(let m=u[0];m<=u[1];++m)if(p=Xr(e[m],f,a),s=Math.min(s,p),s===0)return s}else p=C2(e,u,i,h,a),s=Math.min(s,p)}else{let p=kh(u,t),f=kh(h,r);oo(o,s,a,e,i,p[0],f[0]),oo(o,s,a,e,i,p[0],f[1]),oo(o,s,a,e,i,p[1],f[0]),oo(o,s,a,e,i,p[1],f[1])}}return s}function M2(e,t){let i=e.geometry(),r=i.flat().map(s=>xd([s.x,s.y],e.canonical));if(i.length===0)return NaN;let a=new Td(r[0][1]),n=1/0;for(let s of t){switch(s.type){case"Point":n=Math.min(n,tl(r,!1,[s.coordinates],!1,a,n));break;case"LineString":n=Math.min(n,tl(r,!1,s.coordinates,!0,a,n));break;case"Polygon":n=Math.min(n,el(r,!1,s.coordinates,a,n))}if(n===0)return n}return n}function F2(e,t){let i=e.geometry(),r=i.flat().map(s=>xd([s.x,s.y],e.canonical));if(i.length===0)return NaN;let a=new Td(r[0][1]),n=1/0;for(let s of t){switch(s.type){case"Point":n=Math.min(n,tl(r,!0,[s.coordinates],!1,a,n));break;case"LineString":n=Math.min(n,tl(r,!0,s.coordinates,!0,a,n));break;case"Polygon":n=Math.min(n,el(r,!0,s.coordinates,a,n))}if(n===0)return n}return n}function z2(e,t){let i=e.geometry();if(i.length===0||i[0].length===0)return NaN;let r=Ll(i,0).map(s=>s.map(o=>o.map(l=>xd([l.x,l.y],e.canonical)))),a=new Td(r[0][0][0][1]),n=1/0;for(let s of t)for(let o of r){switch(s.type){case"Point":n=Math.min(n,el([s.coordinates],!1,o,a,n));break;case"LineString":n=Math.min(n,el(s.coordinates,!0,o,a,n));break;case"Polygon":n=Math.min(n,I2(o,s.coordinates,a,n))}if(n===0)return n}return n}function Uu(e){return e.type==="MultiPolygon"?e.coordinates.map(t=>({type:"Polygon",coordinates:t})):e.type==="MultiLineString"?e.coordinates.map(t=>({type:"LineString",coordinates:t})):e.type==="MultiPoint"?e.coordinates.map(t=>({type:"Point",coordinates:t})):[e]}var Dd=class jo{constructor(t,i){this.type=V,this.geojson=t,this.geometries=i}static parse(t,i){if(t.length!==2)return i.error(`'distance' expression requires exactly one argument, but found ${t.length-1} instead.`);if(Ja(t[1])){let r=t[1];if(r.type==="FeatureCollection")return new jo(r,r.features.map(a=>Uu(a.geometry)).flat());if(r.type==="Feature")return new jo(r,Uu(r.geometry));if("type"in r&&"coordinates"in r)return new jo(r,Uu(r))}return i.error("'distance' expression requires valid geojson object that contains polygon geometry type.")}evaluate(t){if(t.geometry()!=null&&t.canonicalID()!=null){if(t.geometryType()==="Point")return M2(t,this.geometries);if(t.geometryType()==="LineString")return F2(t,this.geometries);if(t.geometryType()==="Polygon")return z2(t,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}},R2=class by{constructor(t){let i=null;for(let r of t)if(!i)i=r.type;else{if(i===r.type)continue;i=me;break}this.type=$t(i??me,t.length),this.arr=t}static parse(t,i){if(t.length!==2)return i.error(`'semiliteral' expression requires exactly one argument, but found ${t.length-1} instead.`);if(!Ja(t[1]))return i.error(`invalid value of type "${typeof t[1]}"`);let r=t[1],a=ut(r);if(a.kind==="array"){let n=r,s=i.concat(1),o=[];for(let l=0;l<n.length;l++){let u=s.parse(n[l],l,me);if(!u)return null;o.push(u)}return new by(o)}return new Qa(a,r)}evaluate(t){return this.arr.map(i=>i.evaluate(t))}eachChild(t){this.arr.forEach(t)}outputDefined(){return this.arr.every(t=>t.outputDefined())}},Cd=class wy{constructor(t){this.key=t,this.type=me}static parse(t,i){if(t.length!==2)return i.error(`Expected 1 argument, but found ${t.length-1} instead.`);let r=t[1];return r==null?i.error("Global state property must be defined."):typeof r=="string"?new wy(r):i.error(`Global state property must be string, but found ${typeof t[1]} instead.`)}evaluate(t){var r;let i=(r=t.globals)==null?void 0:r.globalState;return!i||Object.keys(i).length===0?null:Wn(i,this.key)??null}eachChild(){}outputDefined(){return!1}};const Va={"==":r2,"!=":a2,">":s2,"<":n2,">=":l2,"<=":o2,array:lr,at:jw,boolean:lr,case:Gw,coalesce:ly,collator:cy,format:X_,image:h2,in:Vw,"index-of":Nw,interpolate:Ei,"interpolate-hcl":Ei,"interpolate-lab":Ei,length:c2,let:ey,literal:Qa,match:Uw,number:lr,"number-format":u2,object:lr,semiliteral:R2,slice:Zw,step:vd,string:lr,"to-boolean":Ba,"to-color":Ba,"to-number":Ba,"to-string":Ba,var:iy,within:wd,distance:Dd,"global-state":Cd};var Ui=class extends Error{constructor(t,i){super(i),this.message=i,this.key=t}},k2=class Ty{constructor(t,i=[]){this.parent=t,this.bindings={};for(let[r,a]of i)this.bindings[r]=a}concat(t){return new Ty(this,t)}get(t){if(this.bindings[t])return this.bindings[t];if(this.parent)return this.parent.get(t);throw Error(`${t} not found in scope.`)}has(t){return this.bindings[t]?!0:this.parent?this.parent.has(t):!1}},Ey=class Sy{constructor(t,i,r=[],a,n=new k2,s=[]){this.registry=t,this.path=r,this.key=r.map(o=>`[${o}]`).join(""),this.scope=n,this.errors=s,this.expectedType=a,this._isConstant=i}parse(t,i,r,a,n={}){return i==null?this._parse(t,n):this.concat(i,r,a)._parse(t,n)}_parse(t,i){(t===null||typeof t=="string"||typeof t=="boolean"||typeof t=="number")&&(t=["literal",t]);let r=this.key;function a(n,s,o){return o==="assert"?new lr(s,[n],r):o==="coerce"?new Ba(s,[n],r):n}if(Array.isArray(t)){if(t.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');let n=t[0];if(typeof n!="string")return this.error(`Expression name must be a string, but found ${typeof n} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;let s=this.registry[n];if(s){let o=s.parse(t,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=a(o,l,i.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=a(o,l,i.typeAnnotation||"coerce");else if(this.checkSubtype(l,u))return null}if(!(o instanceof Qa)&&o.type.kind!=="resolvedImage"&&this._isConstant(o)){let l=new W_;try{o=new Qa(o.type,o.evaluate(l))}catch(u){return this.error(u.message),null}}return o}return this.error(`Unknown expression "${n}". If you wanted a literal array, use ["literal", [...]].`,0)}return t===void 0?this.error("'undefined' value invalid. Use null instead."):typeof t=="object"?this.error('Bare objects invalid. Use ["literal", {...}] instead.'):this.error(`Expected an array, but found ${typeof t} instead.`)}concat(t,i,r){let a=typeof t=="number"?this.path.concat(t):this.path,n=r?this.scope.concat(r):this.scope;return new Sy(this.registry,this._isConstant,a,i||null,n,this.errors)}error(t,...i){let r=`${this.key}${i.map(a=>`[${a}]`).join("")}`;this.errors.push(new Ui(r,t))}checkSubtype(t,i){let r=as(t,i);return r&&this.error(r),r}},da=class Nn{constructor(t,i,r,a,n){this.name=t,this.type=i,this._evaluate=r,this.args=a,this.key=n}evaluate(t){return this._evaluate(t,this.args,this.key)}eachChild(t){this.args.forEach(t)}outputDefined(){return!1}static parse(t,i){let r=t[0],a=Nn.definitions[r];if(!a)return i.error(`Unknown expression "${r}". If you wanted a literal array, use ["literal", [...]].`,0);let n=Array.isArray(a)?a[0]:a.type,s=Array.isArray(a)?[[a[1],a[2]]]:a.overloads,o=s.filter(([u])=>!Array.isArray(u)||u.length===t.length-1),l=null;for(let[u,h]of o){l=new Ey(i.registry,il,i.path,null,i.scope);let c=[],d=!1;for(let p=1;p<t.length;p++){let f=t[p],m=Array.isArray(u)?u[p-1]:u.type,g=l.parse(f,1+c.length,m);if(!g){d=!0;break}c.push(g)}if(!d){if(Array.isArray(u)&&u.length!==c.length){l.error(`Expected ${u.length} arguments, but found ${c.length} instead.`);continue}for(let p=0;p<c.length;p++){let f=Array.isArray(u)?u[p]:u.type,m=c[p];l.concat(p+1).checkSubtype(f,m.type)}if(l.errors.length===0)return new Nn(r,n,h,c,i.key)}}if(o.length===1)i.errors.push(...l.errors);else{let u=(o.length?o:s).map(([c])=>B2(c)).join(" | "),h=[];for(let c=1;c<t.length;c++){let d=i.parse(t[c],1+h.length);if(!d)return null;h.push(it(d.type))}i.error(`Expected arguments of type ${u}, but found (${h.join(", ")}) instead.`)}return null}static register(t,i){Nn.definitions=i;for(let r in i)t[r]=Nn}};function Gf(e,[t,i,r,a],n){t=t.evaluate(e),i=i.evaluate(e),r=r.evaluate(e);let s=a?a.evaluate(e):1,o=Z_(t,i,r,s);if(o)throw new Ye(o,n);return new de(t/255,i/255,r/255,s,!1)}function Zf(e,t){return e in t&&t[e]!==void 0}function Gu(e,t){let i=t[e];return i===void 0?null:i}function L2(e,t,i,r){for(;i<=r;){let a=i+r>>1;if(t[a]===e)return!0;t[a]>e?r=a-1:i=a+1}return!1}function $r(e){return{type:e}}da.register(Va,{error:[ww,[fe],(e,[t],i)=>{throw new Ye(t.evaluate(e),i)}],typeof:[fe,[me],(e,[t])=>it(ut(t.evaluate(e)))],"to-rgba":[$t(V,4),[Ii],(e,[t])=>{let[i,r,a,n]=t.evaluate(e).rgb;return[i*255,r*255,a*255,n]}],rgb:[Ii,[V,V,V],Gf],rgba:[Ii,[V,V,V,V],Gf],has:{type:ve,overloads:[[[fe],(e,[t])=>Zf(t.evaluate(e),e.properties())],[[fe,ea],(e,[t,i])=>Zf(t.evaluate(e),i.evaluate(e))]]},get:{type:me,overloads:[[[fe],(e,[t])=>Gu(t.evaluate(e),e.properties())],[[fe,ea],(e,[t,i])=>Gu(t.evaluate(e),i.evaluate(e))]]},"feature-state":[me,[fe],(e,[t])=>Gu(t.evaluate(e),e.featureState||{})],properties:[ea,[],e=>e.properties()],"geometry-type":[fe,[],e=>e.geometryType()],id:[me,[],e=>e.id()],zoom:[V,[],e=>e.globals.zoom],"heatmap-density":[V,[],e=>e.globals.heatmapDensity||0],elevation:[V,[],e=>e.globals.elevation||0],"line-progress":[V,[],e=>e.globals.lineProgress||0],accumulated:[me,[],e=>e.globals.accumulated===void 0?null:e.globals.accumulated],"+":[V,$r(V),(e,t)=>{let i=0;for(let r of t)i+=r.evaluate(e);return i}],"*":[V,$r(V),(e,t)=>{let i=1;for(let r of t)i*=r.evaluate(e);return i}],"-":{type:V,overloads:[[[V,V],(e,[t,i])=>t.evaluate(e)-i.evaluate(e)],[[V],(e,[t])=>-t.evaluate(e)]]},"/":[V,[V,V],(e,[t,i])=>t.evaluate(e)/i.evaluate(e)],"%":[V,[V,V],(e,[t,i])=>t.evaluate(e)%i.evaluate(e)],ln2:[V,[],()=>Math.LN2],pi:[V,[],()=>Math.PI],e:[V,[],()=>Math.E],"^":[V,[V,V],(e,[t,i])=>t.evaluate(e)**+i.evaluate(e)],sqrt:[V,[V],(e,[t])=>Math.sqrt(t.evaluate(e))],log10:[V,[V],(e,[t])=>Math.log(t.evaluate(e))/Math.LN10],ln:[V,[V],(e,[t])=>Math.log(t.evaluate(e))],log2:[V,[V],(e,[t])=>Math.log(t.evaluate(e))/Math.LN2],sin:[V,[V],(e,[t])=>Math.sin(t.evaluate(e))],cos:[V,[V],(e,[t])=>Math.cos(t.evaluate(e))],tan:[V,[V],(e,[t])=>Math.tan(t.evaluate(e))],asin:[V,[V],(e,[t])=>Math.asin(t.evaluate(e))],acos:[V,[V],(e,[t])=>Math.acos(t.evaluate(e))],atan:[V,[V],(e,[t])=>Math.atan(t.evaluate(e))],min:[V,$r(V),(e,t)=>Math.min(...t.map(i=>i.evaluate(e)))],max:[V,$r(V),(e,t)=>Math.max(...t.map(i=>i.evaluate(e)))],abs:[V,[V],(e,[t])=>Math.abs(t.evaluate(e))],round:[V,[V],(e,[t])=>{let i=t.evaluate(e);return i<0?-Math.round(-i):Math.round(i)}],floor:[V,[V],(e,[t])=>Math.floor(t.evaluate(e))],ceil:[V,[V],(e,[t])=>Math.ceil(t.evaluate(e))],"filter-==":[ve,[fe,me],(e,[t,i])=>e.properties()[t.value]===i.value],"filter-id-==":[ve,[me],(e,[t])=>e.id()===t.value],"filter-type-==":[ve,[fe],(e,[t])=>e.geometryType()===t.value],"filter-<":[ve,[fe,me],(e,[t,i])=>{let r=e.properties()[t.value],a=i.value;return typeof r==typeof a&&r<a}],"filter-id-<":[ve,[me],(e,[t])=>{let i=e.id(),r=t.value;return typeof i==typeof r&&i<r}],"filter->":[ve,[fe,me],(e,[t,i])=>{let r=e.properties()[t.value],a=i.value;return typeof r==typeof a&&r>a}],"filter-id->":[ve,[me],(e,[t])=>{let i=e.id(),r=t.value;return typeof i==typeof r&&i>r}],"filter-<=":[ve,[fe,me],(e,[t,i])=>{let r=e.properties()[t.value],a=i.value;return typeof r==typeof a&&r<=a}],"filter-id-<=":[ve,[me],(e,[t])=>{let i=e.id(),r=t.value;return typeof i==typeof r&&i<=r}],"filter->=":[ve,[fe,me],(e,[t,i])=>{let r=e.properties()[t.value],a=i.value;return typeof r==typeof a&&r>=a}],"filter-id->=":[ve,[me],(e,[t])=>{let i=e.id(),r=t.value;return typeof i==typeof r&&i>=r}],"filter-has":[ve,[me],(e,[t])=>{let i=t.value,r=e.properties();return i in r&&r[i]!==void 0}],"filter-has-id":[ve,[],e=>e.id()!==null&&e.id()!==void 0],"filter-type-in":[ve,[$t(fe)],(e,[t])=>t.value.indexOf(e.geometryType())>=0],"filter-id-in":[ve,[$t(me)],(e,[t])=>t.value.indexOf(e.id())>=0],"filter-in-small":[ve,[fe,$t(me)],(e,[t,i])=>i.value.indexOf(e.properties()[t.value])>=0],"filter-in-large":[ve,[fe,$t(me)],(e,[t,i])=>L2(e.properties()[t.value],i.value,0,i.value.length-1)],all:{type:ve,overloads:[[[ve,ve],(e,[t,i])=>t.evaluate(e)&&i.evaluate(e)],[$r(ve),(e,t)=>{for(let i of t)if(!i.evaluate(e))return!1;return!0}]]},any:{type:ve,overloads:[[[ve,ve],(e,[t,i])=>t.evaluate(e)||i.evaluate(e)],[$r(ve),(e,t)=>{for(let i of t)if(i.evaluate(e))return!0;return!1}]]},"!":[ve,[ve],(e,[t])=>!t.evaluate(e)],"is-supported-script":[ve,[fe],(e,[t])=>{let i=e.globals&&e.globals.isSupportedScript;return!i||i(t.evaluate(e))}],upcase:[fe,[fe],(e,[t])=>t.evaluate(e).toUpperCase()],downcase:[fe,[fe],(e,[t])=>t.evaluate(e).toLowerCase()],concat:[fe,$r(me),(e,t)=>t.map(i=>Hn(i.evaluate(e))).join("")],split:[$t(fe),[fe,fe],(e,[t,i])=>t.evaluate(e).split(i.evaluate(e))],join:[fe,[$t(fe),fe],(e,[t,i])=>t.evaluate(e).join(i.evaluate(e))],"resolved-locale":[fe,[Ml],(e,[t])=>t.evaluate(e).resolvedLocale()]});function B2(e){return Array.isArray(e)?`(${e.map(it).join(", ")})`:`(${it(e.type)}...)`}function il(e){if(e instanceof iy)return il(e.boundExpression);if(e instanceof da&&e.name==="error"||e instanceof cy||e instanceof wd||e instanceof Dd||e instanceof Cd)return!1;let t=e instanceof Ba||e instanceof lr,i=!0;return e.eachChild(r=>{i&&(i=t?il(r):r instanceof Qa)}),i?Ol(e)&&$l(e,["zoom","heatmap-density","elevation","line-progress","accumulated","is-supported-script"]):!1}function Ol(e){if(e instanceof da&&(e.name==="get"&&e.args.length===1||e.name==="feature-state"||e.name==="has"&&e.args.length===1||e.name==="properties"||e.name==="geometry-type"||e.name==="id"||/^filter-/.test(e.name))||e instanceof wd||e instanceof Dd)return!1;let t=!0;return e.eachChild(i=>{t&&!Ol(i)&&(t=!1)}),t}function ss(e){if(e instanceof da&&e.name==="feature-state")return!1;let t=!0;return e.eachChild(i=>{t&&!ss(i)&&(t=!1)}),t}function $l(e,t){if(e instanceof da&&t.indexOf(e.name)>=0)return!1;let i=!0;return e.eachChild(r=>{i&&!$l(r,t)&&(i=!1)}),i}function en(e){return e["property-type"]==="data-driven"||e["property-type"]==="cross-faded-data-driven"}function Dy(e){return!!e.expression&&e.expression.parameters.indexOf("zoom")>-1}function Pd(e){return!!e.expression&&e.expression.interpolated}const Ad=/^(.*)-transition$/;function os(e,...t){for(let i of t)for(let r in i)e[r]=i[r];return e}function ye(e){return e instanceof Number?"number":e instanceof String?"string":e instanceof Boolean?"boolean":Array.isArray(e)?"array":e===null?"null":typeof e}function jl(e){return typeof e=="object"&&!!e&&!Array.isArray(e)&&ut(e)===ea}function O2(e){return e}function $2(e){switch(e.type){case"color":return de.parse;case"padding":return Ji.parse;case"numberArray":return Qi.parse;case"colorArray":return Ti.parse;default:return null}}function j2(e){switch(e){case"exponential":return Py;case"interval":return N2;case"categorical":return V2;case"identity":return U2;default:throw Error(`Unknown function type "${e}"`)}}function Cy(e,t){let i=e.stops&&typeof e.stops[0][0]=="object",r=i||e.property!==void 0,a=i||!r,n=e.type||(Pd(t)?"exponential":"interval"),s=$2(t);if(s&&(e=os({},e),e.stops&&(e.stops=e.stops.map(h=>[h[0],s(h[1])])),e.default?e.default=s(e.default):e.default=s(t.default)),e.colorSpace&&!Fw(e.colorSpace))throw Error(`Unknown color space: "${e.colorSpace}"`);let o=j2(n),l,u;if(n==="categorical"){l=Object.create(null);for(let h of e.stops)l[h[0]]=h[1];u=typeof e.stops[0][0]}if(i){let h={},c=[];for(let f=0;f<e.stops.length;f++){let m=e.stops[f],g=m[0].zoom;h[g]===void 0&&(h[g]={zoom:g,type:e.type,property:e.property,default:e.default,stops:[]},c.push(g)),h[g].stops.push([m[0].value,m[1]])}let d=[];for(let f of c)d.push([h[f].zoom,Cy(h[f],t)]);let p={name:"linear"};return{kind:"composite",interpolationType:p,interpolationFactor:Ei.interpolationFactor.bind(void 0,p),zoomStops:d.map(f=>f[0]),evaluate({zoom:f},m){return Py({stops:d,base:e.base},t,f).evaluate(f,m)}}}if(a){let h=n==="exponential"?{name:"exponential",base:e.base===void 0?1:e.base}:null;return{kind:"camera",interpolationType:h,interpolationFactor:Ei.interpolationFactor.bind(void 0,h),zoomStops:e.stops.map(c=>c[0]),evaluate:({zoom:c})=>o(e,t,c,l,u)}}return{kind:"source",evaluate(h,c){let d=c&&c.properties?c.properties[e.property]:void 0;return d===void 0?Ps(e.default,t.default):o(e,t,d,l,u)}}}function Ps(e,t,i){if(e!==void 0)return e;if(t!==void 0)return t;if(i!==void 0)return i}function V2(e,t,i,r,a){return Ps(typeof i===a?r[i]:void 0,e.default,t.default)}function N2(e,t,i){if(ye(i)!=="number")return Ps(e.default,t.default);let r=e.stops.length;if(r===1||i<=e.stops[0][0])return e.stops[0][1];if(i>=e.stops[r-1][0])return e.stops[r-1][1];let a=kl(e.stops.map(n=>n[0]),i,"");return e.stops[a][1]}function Py(e,t,i){let r=e.base===void 0?1:e.base;if(ye(i)!=="number")return Ps(e.default,t.default);let a=e.stops.length;if(a===1||i<=e.stops[0][0])return e.stops[0][1];if(i>=e.stops[a-1][0])return e.stops[a-1][1];let n=kl(e.stops.map(h=>h[0]),i,""),s=G2(i,r,e.stops[n][0],e.stops[n+1][0]),o=e.stops[n][1],l=e.stops[n+1][1],u=Je[t.type]||O2;return typeof o.evaluate=="function"?{evaluate(...h){let c=o.evaluate.apply(void 0,h),d=l.evaluate.apply(void 0,h);if(c!==void 0&&d!==void 0)return u(c,d,s,e.colorSpace)}}:u(o,l,s,e.colorSpace)}function U2(e,t,i){switch(t.type){case"color":i=de.parse(i);break;case"formatted":i=_r.fromString(i.toString());break;case"resolvedImage":i=Ki.fromString(i.toString());break;case"padding":i=Ji.parse(i);break;case"colorArray":i=Ti.parse(i);break;case"numberArray":i=Qi.parse(i);break;default:ye(i)!==t.type&&(t.type!=="enum"||!t.values[i])&&(i=void 0)}return Ps(i,e.default,t.default)}function G2(e,t,i,r){let a=r-i,n=e-i;return a===0?0:t===1?n/a:(t**+n-1)/(t**+a-1)}function Oh(e){return{result:"success",value:e}}function Ra(e){return{result:"error",value:e}}var Id=class{constructor(t,i,r,a){this.expression=t,this._warningHistory={},this._evaluator=new W_,this._defaultValue=r?Ry(r):null,this._enumValues=r&&r.type==="enum"?r.values:null,this._globalState=a,this._rootKey=i}evaluateWithoutErrorHandling(t,i,r,a,n,s){return this._globalState&&(t=tn(t,this._globalState)),this._evaluator.globals=t,this._evaluator.feature=i,this._evaluator.featureState=r,this._evaluator.canonical=a,this._evaluator.availableImages=n||null,this._evaluator.formattedSection=s,this.expression.evaluate(this._evaluator)}evaluate(t,i,r,a,n,s){this._globalState&&(t=tn(t,this._globalState)),this._evaluator.globals=t,this._evaluator.feature=i||null,this._evaluator.featureState=r||null,this._evaluator.canonical=a,this._evaluator.availableImages=n||null,this._evaluator.formattedSection=s||null;try{let o=this.expression.evaluate(this._evaluator);if(o==null||typeof o=="number"&&o!==o)return this._defaultValue;if(this._enumValues&&!(o in this._enumValues))throw new Ye(`Expected value to be one of ${Object.keys(this._enumValues).map(l=>JSON.stringify(l)).join(", ")}, but found ${JSON.stringify(o)} instead.`,"");return o}catch(o){let l=o instanceof Ye?o.path:"",u=`${l}|${o.message}`;return this._warningHistory[u]||(this._warningHistory[u]=!0,typeof console<"u"&&console.warn(Ay(this._rootKey,l,o.message,this._defaultValue))),this._defaultValue}}};function Ay(e,t,i,r){return`${e}${t}: ${i}${r==null?"":` Falling back to ${String(r)}.`}`}function Iy(e){if(!e)throw Error('rootKey must identify the location of the expression in the style JSON, e.g. "layers[3].paint.line-width".')}function Vl(e){return Array.isArray(e)&&e.length>0&&typeof e[0]=="string"&&e[0]in Va}function Nl(e,t,i,r){Iy(t);let a=new Ey(Va,il,[],i?W2(i):void 0),n=a.parse(e,void 0,void 0,void 0,i&&i.type==="string"?{typeAnnotation:"coerce"}:void 0);return n?Oh(new Id(n,t,i,r)):Ra(a.errors)}var ls=class{constructor(t,i,r){this.kind=t,this._styleExpression=i,this.isStateDependent=t!=="constant"&&!ss(i.expression),this.globalStateRefs=As(i.expression),this._globalState=r}evaluateWithoutErrorHandling(t,i,r,a,n,s){return this._globalState&&(t=tn(t,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(t,i,r,a,n,s)}evaluate(t,i,r,a,n,s){return this._globalState&&(t=tn(t,this._globalState)),this._styleExpression.evaluate(t,i,r,a,n,s)}},rl=class{constructor(t,i,r,a,n){this.kind=t,this.zoomStops=r,this._styleExpression=i,this.isStateDependent=t!=="camera"&&!ss(i.expression),this.globalStateRefs=As(i.expression),this.interpolationType=a,this._globalState=n}evaluateWithoutErrorHandling(t,i,r,a,n,s){return this._globalState&&(t=tn(t,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(t,i,r,a,n,s)}evaluate(t,i,r,a,n,s){return this._globalState&&(t=tn(t,this._globalState)),this._styleExpression.evaluate(t,i,r,a,n,s)}interpolationFactor(t,i,r){return this.interpolationType?Ei.interpolationFactor(this.interpolationType,t,i,r):0}};function Z2(e){return e._styleExpression!==void 0}function My(e,t,i,r){let a=Nl(e,t,i,r);if(a.result==="error")return a;let n=a.value.expression,s=Ol(n);if(!s&&!en(i))return Ra([new Ui("","data expressions not supported")]);let o=$l(n,["zoom"]);if(!o&&!Dy(i))return Ra([new Ui("","zoom expressions not supported")]);let l=Vo(n);if(!l&&!o)return Ra([new Ui("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')]);if(l instanceof Ui)return Ra([l]);if(l instanceof Ei&&!Pd(i))return Ra([new Ui("",'"interpolate" expressions cannot be used with this property')]);if(!l)return Oh(s?new ls("constant",a.value,r):new ls("source",a.value,r));let u=l instanceof Ei?l.interpolation:void 0;return Oh(s?new rl("camera",a.value,l.labels,u,r):new rl("composite",a.value,l.labels,u,r))}var Fy=class zy{constructor(t,i,r){this.isStateDependent=!1,this.globalStateRefs=new Set,this._globalState=null,Iy(i),this._parameters=t,this._specification=r,this._rootKey=i,this._defaultValue=Ry(r),this._warningHistory={};let a=Cy(this._parameters,this._specification);this.kind=a.kind,this.interpolationFactor=a.interpolationFactor,this.zoomStops=a.zoomStops,this.interpolationType=a.interpolationType,this._innerEvaluate=a.evaluate}evaluate(t,i){try{return this._innerEvaluate(t,i)}catch(r){let a=r instanceof Error?r.message:String(r),n=`|${a}`;return this._warningHistory[n]||(this._warningHistory[n]=!0,typeof console<"u"&&console.warn(Ay(this._rootKey,"",a,this._defaultValue))),this._defaultValue}}static deserialize(t){return new zy(t._parameters,t._rootKey,t._specification)}static serialize(t){return{_parameters:t._parameters,_specification:t._specification,_rootKey:t._rootKey}}};function q2(e,t,i,r){if(jl(e))return new Fy(e,t,i);if(Vl(e)){let a=My(e,t,i,r);if(a.result==="error")throw Error(a.value.map(n=>`${n.key}: ${n.message}`).join(", "));return a.value}{let a=e;return i.type==="color"&&typeof e=="string"?a=de.parse(e):i.type==="padding"&&(typeof e=="number"||Array.isArray(e))?a=Ji.parse(e):i.type==="numberArray"&&(typeof e=="number"||Array.isArray(e))?a=Qi.parse(e):i.type==="colorArray"&&(typeof e=="string"||Array.isArray(e))?a=Ti.parse(e):i.type==="variableAnchorOffsetCollection"&&Array.isArray(e)?a=Yi.parse(e):i.type==="projectionDefinition"&&typeof e=="string"&&(a=Lr.parse(e)),{globalStateRefs:new Set,_globalState:null,kind:"constant",evaluate:()=>a}}}function Vo(e){let t=null;if(e instanceof ey)t=Vo(e.result);else if(e instanceof ly){for(let i of e.args)if(t=Vo(i),t)break}else(e instanceof vd||e instanceof Ei)&&e.input instanceof da&&e.input.name==="zoom"&&(t=e);return t instanceof Ui||e.eachChild(i=>{let r=Vo(i);r instanceof Ui?t=r:!t&&r?t=new Ui("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):t&&r&&t!==r&&(t=new Ui("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),t}function As(e,t=new Set){return e instanceof Cd&&t.add(e.key),e.eachChild(i=>{As(i,t)}),t}function W2(e){let t={color:Ii,string:fe,number:V,enum:fe,boolean:ve,formatted:Ss,padding:Fl,numberArray:zl,colorArray:rs,projectionDefinition:Il,resolvedImage:Ds,variableAnchorOffsetCollection:Rl};return e.type==="array"?$t(t[e.value]||me,e.length):t[e.type]}function Ry(e){if(e.type==="color"&&jl(e.default))return new de(0,0,0,0);switch(e.type){case"color":return de.parse(e.default)||null;case"padding":return Ji.parse(e.default)||null;case"numberArray":return Qi.parse(e.default)||null;case"colorArray":return Ti.parse(e.default)||null;case"variableAnchorOffsetCollection":return Yi.parse(e.default)||null;case"projectionDefinition":return Lr.parse(e.default)||null;default:return e.default===void 0?null:e.default}}function tn(e,t){let{zoom:i,heatmapDensity:r,elevation:a,lineProgress:n,isSupportedScript:s,accumulated:o}=e??{};return{zoom:i,heatmapDensity:r,elevation:a,lineProgress:n,isSupportedScript:s,accumulated:o,globalState:t}}function H2(e){let t=!1;for(let i of e){let r=ky(i);if(r==="expression")return"expression";r==="legacy"&&(t=!0)}return t?"legacy":"neutral"}function ky(e){if(typeof e=="boolean")return"neutral";if(!Array.isArray(e)||e.length===0)return"legacy";switch(e[0]){case"has":return e.length<2||e[1]==="$id"||e[1]==="$type"?"legacy":e.length===2?"neutral":"expression";case"in":return e.length>=3&&(typeof e[1]!="string"||Array.isArray(e[2]))?"expression":"legacy";case"!in":case"!has":return"legacy";case"==":case"!=":case">":case">=":case"<":case"<=":return e.length!==3||Array.isArray(e[1])||Array.isArray(e[2])?"expression":"legacy";case"none":return"legacy";case"any":case"all":return H2(e.slice(1));default:return"expression"}}function Md(e){return ky(e)!=="legacy"}function qf(e){return e==="$type"?["geometry-type"]:e==="$id"?["id"]:["get",e]}function X2(e){switch(e[0]){case"==":case"!=":case"<":case"<=":case">":case">=":return e.length!==3||typeof e[1]!="string"?null:[e[0],qf(e[1]),e[2]];case"in":case"!in":{if(e.length<2||typeof e[1]!="string")return null;let t=["in",qf(e[1]),["literal",e.slice(2)]];return e[0]==="!in"?["!",t]:t}case"has":case"!has":{if(e.length!==2||typeof e[1]!="string"||e[1]==="$type"||e[1]==="$id")return null;let t=["has",e[1]];return e[0]==="!has"?["!",t]:t}default:return null}}function Ly(e){if((e[0]==="<"||e[0]==="<="||e[0]===">"||e[0]===">=")&&e[1]==="$type")return`"$type" cannot be use with operator "${e[0]}"`;let t=X2(e);return t?`Mixing deprecated filter syntax with expression syntax is not supported. Replace ${JSON.stringify(e)} with ${JSON.stringify(t)}.`:`Mixing deprecated filter syntax with expression syntax is not supported. Convert ${JSON.stringify(e)} to expression syntax.`}function Zu(e,t,i){let r=i[e];return Array.isArray(r)?Md(r)?Fd(r,t.concat(e)):{path:t.concat(e),legacyFilter:r}:null}function Fd(e,t=[]){if(!Array.isArray(e)||e.length<1)return null;switch(e[0]){case"all":case"any":case"none":for(let i=1;i<e.length;i++){let r=Zu(i,t,e);if(r)return r}break;case"!":{let i=Zu(1,t,e);if(i)return i;break}case"case":for(let i=1;i<e.length-1;i+=2){let r=Zu(i,t,e);if(r)return r}}return null}function Y2(e,t){let i=Fd(e);if(!i||typeof console>"u")return;let r=i.path.map(a=>`[${a}]`).join("");console.warn(`${t}${r}: ${Ly(i.legacyFilter)}`)}const K2={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function us(e,t,i){if(e==null)return{filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set};Md(e)?Y2(e,t):e=al(e);let r=Nl(e,t,K2,i);if(r.result==="error")throw Error(r.value.map(a=>`${a.key}: ${a.message}`).join(", "));return{filter:(a,n,s)=>r.value.evaluate(a,n,{},s),needGeometry:By(e),getGlobalStateRefs:()=>As(r.value.expression)}}function J2(e,t){return e<t?-1:+(e>t)}function By(e){if(!Array.isArray(e))return!1;if(e[0]==="within"||e[0]==="distance")return!0;for(let t=1;t<e.length;t++)if(By(e[t]))return!0;return!1}function al(e){if(!e)return!0;let t=e[0];return e.length<=1?t!=="any":t==="=="?qu(e[1],e[2],"=="):t==="!="?lo(qu(e[1],e[2],"==")):t==="<"||t===">"||t==="<="||t===">="?qu(e[1],e[2],t):t==="any"?Q2(e.slice(1)):t==="all"?["all"].concat(e.slice(1).map(al)):t==="none"?["all"].concat(e.slice(1).map(al).map(lo)):t==="in"?Wf(e[1],e.slice(2)):t==="!in"?lo(Wf(e[1],e.slice(2))):t==="has"?Hf(e[1]):t!=="!has"||lo(Hf(e[1]))}function qu(e,t,i){switch(e){case"$type":return[`filter-type-${i}`,t];case"$id":return[`filter-id-${i}`,t];default:return[`filter-${i}`,e,t]}}function Q2(e){return["any"].concat(e.map(al))}function Wf(e,t){if(t.length===0)return!1;switch(e){case"$type":return["filter-type-in",["literal",t]];case"$id":return["filter-id-in",["literal",t]];default:return t.length>200&&!t.some(i=>typeof i!=typeof t[0])?["filter-in-large",e,["literal",t.sort(J2)]]:["filter-in-small",e,["literal",t]]}}function Hf(e){switch(e){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",e]}}function lo(e){return["!",e]}function Oy(e){let t=e.key,i=e.value;return i?[new O(t,i,"constants have been deprecated as of v8")]:[]}function lt(e){return e instanceof Number||e instanceof String||e instanceof Boolean?e.valueOf():e}function oa(e){if(Array.isArray(e))return e.map(oa);if(e instanceof Object&&!(e instanceof Number||e instanceof String||e instanceof Boolean)){let t={};for(let i in e)t[i]=oa(e[i]);return t}return lt(e)}function ui(e){let t=e.key,i=e.value,r=e.valueSpec||{},a=e.objectElementValidators||{},n=e.style,s=e.styleSpec,o=e.validateSpec,l=[],u=ye(i);if(u!=="object")return[new O(t,i,`object expected, ${u}
4 found`)];for(let h in i){let c=h.split(".")[0],d=Wn(r,c)||r["*"],p;if(Wn(a,c))p=a[c];else if(Wn(r,c)){if(i[h]===void 0)continue;p=o}else if(a["*"])p=a["*"];else if(r["*"])p=o;else{l.push(new O(t,i[h],`unknown property "${h}"`));continue}l=l.concat(p({key:(t&&`${t}.`)+h,value:i[h],valueSpec:d,style:n,styleSpec:s,object:i,objectKey:h,validateSpec:o},i))}for(let h in r)a[h]||r[h].required&&r[h].default===void 0&&i[h]===void 0&&l.push(new O(t,i,`missing required property "${h}"`));return l}function zd(e){let t=e.value,i=e.valueSpec,r=e.validateSpec,a=e.style,n=e.styleSpec,s=e.key,o=e.arrayElementValidator||r;if(ye(t)!=="array")return[new O(s,t,`array expected, ${ye(t)} found`)];if(i.length&&t.length!==i.length)return[new O(s,t,`array length ${i.length} expected, length ${t.length} found`)];let l={type:i.value,values:i.values};n.$version<7&&(l.function=i.function),ye(i.value)==="object"&&(l=i.value);let u=[];for(let h=0;h<t.length;h++)u=u.concat(o({array:t,arrayIndex:h,value:t[h],valueSpec:l,validateSpec:e.validateSpec,style:a,styleSpec:n,key:`${s}[${h}]`}));return u}function Ul(e){let t=e.key,i=e.value,r=e.valueSpec,a=ye(i);return a==="number"&&i!==i&&(a="NaN"),a==="number"?"minimum"in r&&i<r.minimum?[new O(t,i,`${i} is less than the minimum value ${r.minimum}`)]:"maximum"in r&&i>r.maximum?[new O(t,i,`${i} is greater than the maximum value ${r.maximum}`)]:[]:[new O(t,i,`number expected, ${a} found`)]}function $y(e){let t=e.valueSpec,i=lt(e.value.type),r,a={},n,s,o=i!=="categorical"&&e.value.property===void 0,l=!o,u=ye(e.value.stops)==="array"&&ye(e.value.stops[0])==="array"&&ye(e.value.stops[0][0])==="object",h=ui({key:e.key,value:e.value,valueSpec:e.styleSpec.function,validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec,objectElementValidators:{stops:c,default:f}});return i==="identity"&&o&&h.push(new O(e.key,e.value,'missing required property "property"')),i!=="identity"&&!e.value.stops&&h.push(new O(e.key,e.value,'missing required property "stops"')),i==="exponential"&&e.valueSpec.expression&&!Pd(e.valueSpec)&&h.push(new O(e.key,e.value,"exponential functions not supported")),e.styleSpec.$version>=8&&(l&&!en(e.valueSpec)?h.push(new O(e.key,e.value,"property functions not supported")):o&&!Dy(e.valueSpec)&&h.push(new O(e.key,e.value,"zoom functions not supported"))),(i==="categorical"||u)&&e.value.property===void 0&&h.push(new O(e.key,e.value,'"property" property is required')),h;function c(m){if(i==="identity")return[new O(m.key,m.value,'identity function may not have a "stops" property')];let g=[],_=m.value;return g=g.concat(zd({key:m.key,value:_,valueSpec:m.valueSpec,validateSpec:m.validateSpec,style:m.style,styleSpec:m.styleSpec,arrayElementValidator:d})),ye(_)==="array"&&_.length===0&&g.push(new O(m.key,_,"array must have at least one stop")),g}function d(m){let g=[],_=m.value,y=m.key;if(ye(_)!=="array")return[new O(y,_,`array expected, ${ye(_)} found`)];if(_.length!==2)return[new O(y,_,`array length 2 expected, length ${_.length} found`)];if(u){if(ye(_[0])!=="object")return[new O(y,_,`object expected, ${ye(_[0])} found`)];if(_[0].zoom===void 0)return[new O(y,_,"object stop key must have zoom")];if(_[0].value===void 0)return[new O(y,_,"object stop key must have value")];if(s&&s>lt(_[0].zoom))return[new O(y,_[0].zoom,"stop zoom values must appear in ascending order")];lt(_[0].zoom)!==s&&(s=lt(_[0].zoom),n=void 0,a={}),g=g.concat(ui({key:`${y}[0]`,value:_[0],valueSpec:{zoom:{}},validateSpec:m.validateSpec,style:m.style,styleSpec:m.styleSpec,objectElementValidators:{zoom:Ul,value:p}}))}else g=g.concat(p({key:`${y}[0]`,value:_[0],validateSpec:m.validateSpec,style:m.style,styleSpec:m.styleSpec},_));return Vl(oa(_[1]))?g.concat([new O(`${y}[1]`,_[1],"expressions are not allowed in function stops.")]):g.concat(m.validateSpec({key:`${y}[1]`,value:_[1],valueSpec:t,validateSpec:m.validateSpec,style:m.style,styleSpec:m.styleSpec}))}function p(m,g){let _=ye(m.value),y=lt(m.value),x=m.value===null?g:m.value;if(!r)r=_;else if(_!==r)return[new O(m.key,x,`${_} stop domain type must match previous stop domain type ${r}`)];if(_!=="number"&&_!=="string"&&_!=="boolean")return[new O(m.key,x,"stop domain value must be a number, string, or boolean")];
vendor: 9,888 bytes, lines 4-5
4if(_!=="number"&&i!=="categorical"){let v=`number expected, ${_} found`;return en(t)&&i===void 0&&(v+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new O(m.key,x,v)]}return i==="categorical"&&_==="number"&&(!isFinite(y)||Math.floor(y)!==y)?[new O(m.key,x,`integer expected, found ${y}`)]:i!=="categorical"&&_==="number"&&n!==void 0&&y<n?[new O(m.key,x,"stop domain values must appear in ascending order")]:(n=y,i==="categorical"&&y in a?[new O(m.key,x,"stop domain values must be unique")]:(a[y]=!0,[]))}function f(m){return m.validateSpec({key:m.key,value:m.value,valueSpec:t,validateSpec:m.validateSpec,style:m.style,styleSpec:m.styleSpec})}}function rn(e){let t=(e.expressionContext==="property"?My:Nl)(oa(e.value),e.key,e.valueSpec);if(t.result==="error")return t.value.map(r=>new O(`${e.key}${r.key}`,e.value,r.message));let i=t.value.expression||t.value._styleExpression.expression;if(e.expressionContext==="property"&&e.propertyKey==="text-font"&&!i.outputDefined())return[new O(e.key,e.value,`Invalid data expression for "${e.propertyKey}". Output values must be contained as literals within the expression.`)];if(e.expressionContext==="property"&&e.propertyType==="layout"&&!ss(i))return[new O(e.key,e.value,'"feature-state" data expressions are not supported with layout properties.')];if(e.expressionContext==="filter"&&!ss(i))return[new O(e.key,e.value,'"feature-state" data expressions are not supported with filters.')];if(e.expressionContext&&e.expressionContext.indexOf("cluster")===0){if(!$l(i,["zoom","feature-state"]))return[new O(e.key,e.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(e.expressionContext==="cluster-initial"&&!Ol(i))return[new O(e.key,e.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function eT(e){let t=e.value,i=e.key,r=ye(t);return r==="boolean"?[]:[new O(i,t,`boolean expected, ${r} found`)]}function $h(e){let t=e.key,i=e.value,r=ye(i);return r==="string"?de.parse(String(i))?[]:[new O(t,i,`color expected, "${i}" found`)]:[new O(t,i,`color expected, ${r} found`)]}function hs(e){let t=e.key,i=e.value,r=e.valueSpec,a=[];return Array.isArray(r.values)?r.values.indexOf(lt(i))===-1&&a.push(new O(t,i,`expected one of [${r.values.join(", ")}], ${JSON.stringify(i)} found`)):Object.keys(r.values).indexOf(lt(i))===-1&&a.push(new O(t,i,`expected one of [${Object.keys(r.values).join(", ")}], ${JSON.stringify(i)} found`)),a}function tT(e,t){let i=e;for(let r of t)i=i[r];return i}function iT(e,t){let i=Fd(t);return i?[new O(`${e.key}${i.path.map(r=>`[${r}]`).join("")}`,tT(e.value,i.path),Ly(i.legacyFilter),null,"warning")]:[]}function Rd(e){let t=oa(e.value);return Md(t)?[...iT(e,t),...rn(os({},e,{expressionContext:"filter",valueSpec:{value:"boolean"}}))]:jy(e)}function jy(e){let t=e.value,i=e.key;if(ye(t)!=="array")return[new O(i,t,`array expected, ${ye(t)} found`)];let r=e.styleSpec,a,n=[];if(t.length<1)return[new O(i,t,"filter array must have at least 1 element")];switch(n=n.concat(hs({key:`${i}[0]`,value:t[0],valueSpec:r.filter_operator,style:e.style,styleSpec:e.styleSpec})),lt(t[0])){case"<":case"<=":case">":case">=":t.length>=2&&lt(t[1])==="$type"&&n.push(new O(i,t,`"$type" cannot be use with operator "${t[0]}"`));case"==":case"!=":t.length!==3&&n.push(new O(i,t,`filter array for operator "${t[0]}" must have 3 elements`));case"in":case"!in":t.length>=2&&(a=ye(t[1]),a!=="string"&&n.push(new O(`${i}[1]`,t[1],`string expected, ${a} found`)));for(let s=2;s<t.length;s++)a=ye(t[s]),lt(t[1])==="$type"?n=n.concat(hs({key:`${i}[${s}]`,value:t[s],valueSpec:r.geometry_type,style:e.style,styleSpec:e.styleSpec})):a!=="string"&&a!=="number"&&a!=="boolean"&&n.push(new O(`${i}[${s}]`,t[s],`string, number, or boolean expected, ${a} found`));break;case"any":case"all":case"none":for(let s=1;s<t.length;s++)n=n.concat(jy({key:`${i}[${s}]`,value:t[s],style:e.style,styleSpec:e.styleSpec}));break;case"has":case"!has":a=ye(t[1]),t.length===2?a!=="string"&&n.push(new O(`${i}[1]`,t[1],`string expected, ${a} found`)):n.push(new O(i,t,`filter array for "${t[0]}" operator must have 2 elements`))}return n}function Vy(e,t){let i=e.key,r=e.validateSpec,a=e.style,n=e.styleSpec,s=e.value,o=e.objectKey,l=n[`${t}_${e.layerType}`];if(!l)return[];let u=o.match(Ad);if(t==="paint"&&u&&l[u[1]]&&l[u[1]].transition)return r({key:i,value:s,valueSpec:n.transition,style:a,styleSpec:n});let h=e.valueSpec||l[o];if(!h)return[new O(i,s,`unknown property "${o}"`)];let c;if(ye(s)==="string"&&en(h)&&!h.tokens&&(c=/^{([^}]+)}$/.exec(s)))return[new O(i,s,`"${o}" does not support interpolation syntax
5Use an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(c[1])} }\`.`)];let d=[];return e.layerType==="symbol"&&o==="text-font"&&jl(oa(s))&&lt(s.type)==="identity"&&d.push(new O(i,s,'"text-font" does not support identity functions')),d.concat(r({key:e.key,value:s,valueSpec:h,style:a,styleSpec:n,expressionContext:"property",propertyType:t,propertyKey:o}))}function Ny(e){return Vy(e,"paint")}function Uy(e){return Vy(e,"layout")}function Gy(e){var l,u;let t=[],i=e.value,r=e.key,a=e.style,n=e.styleSpec;if(ye(i)!=="object")return[new O(r,i,`object expected, ${ye(i)} found`)];!i.type&&!i.ref&&t.push(new O(r,i,'either "type" or "ref" is required'));let s=lt(i.type),o=lt(i.ref);if(i.id){let h=lt(i.id);for(let c=0;c<e.arrayIndex;c++){let d=a.layers[c];lt(d.id)===h&&t.push(new O(r,i.id,`duplicate layer id "${i.id}", previously used at line ${d.id.__line__}`))}}if("ref"in i){["type","source","source-layer","filter","layout"].forEach(c=>{c in i&&t.push(new O(r,i[c],`"${c}" is prohibited for ref layers`))});let h;a.layers.forEach(c=>{lt(c.id)===o&&(h=c)}),h?h.ref?t.push(new O(r,i.ref,"ref cannot reference another ref layer")):s=lt(h.type):t.push(new O(r,i.ref,`ref layer "${o}" not found`))}else if(s!=="background")if(!i.source)t.push(new O(r,i,'missing required property "source"'));else{let h=a.sources&&a.sources[i.source],c=h&&lt(h.type);h?c==="vector"&&s==="raster"?t.push(new O(r,i.source,`layer "${i.id}" requires a raster source`)):c!=="raster-dem"&&s==="hillshade"||c!=="raster-dem"&&s==="color-relief"?t.push(new O(r,i.source,`layer "${i.id}" requires a raster-dem source`)):c==="raster"&&s!=="raster"?t.push(new O(r,i.source,`layer "${i.id}" requires a vector source`)):c==="vector"&&!i["source-layer"]?t.push(new O(r,i,`layer "${i.id}" must specify a "source-layer"`)):c==="raster-dem"&&s!=="hillshade"&&s!=="color-relief"?t.push(new O(r,i.source,"raster-dem source can only be used with layer type 'hillshade' or 'color-relief'.")):s==="line"&&i.paint&&i.paint["line-gradient"]&&(c!=="geojson"||!h.lineMetrics)&&t.push(new O(r,i,`layer "${i.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):t.push(new O(r,i.source,`source "${i.source}" not found`))}return s==="raster"&&((l=i.paint)!=null&&l.resampling)&&((u=i.paint)!=null&&u["raster-resampling"])&&t.push(new O(r,i.paint,`layer "${i.id}" redundantly specifies "resampling" and "raster-resampling" paint properties, but only one is allowed. It is advised to use "resampling".`)),t=t.concat(ui({key:r,value:i,valueSpec:n.layer,style:e.style,styleSpec:e.styleSpec,validateSpec:e.validateSpec,objectElementValidators:{"*"(){return[]},type(){return e.validateSpec({key:`${r}.type`,value:i.type,valueSpec:n.layer.type,style:e.style,styleSpec:e.styleSpec,validateSpec:e.validateSpec,object:i,objectKey:"type"})},filter:Rd,layout(h){return ui({layer:i,key:h.key,value:h.value,style:h.style,styleSpec:h.styleSpec,validateSpec:h.validateSpec,objectElementValidators:{"*"(c){return Uy(os({layerType:s},c))}}})},paint(h){return ui({layer:i,key:h.key,value:h.value,style:h.style,styleSpec:h.styleSpec,validateSpec:h.validateSpec,objectElementValidators:{"*"(c){return Ny(os({layerType:s},c))}}})}}})),t}function zr(e){let t=e.value,i=e.key,r=ye(t);return r==="string"?[]:[new O(i,t,`string expected, ${r} found`)]}function rT(e){let t=e.sourceName??"",i=e.value,r=e.styleSpec,a=r.source_raster_dem,n=e.style,s=[],o=ye(i);if(i===void 0)return s;if(o!=="object")return s.push(new O("source_raster_dem",i,`object expected, ${o} found`)),s;let l=lt(i.encoding)==="custom",u=["redFactor","greenFactor","blueFactor","baseShift"],h=e.value.encoding?`"${e.value.encoding}"`:"Default";for(let c in i)!l&&u.includes(c)?s.push(new O(c,i[c],`In "${t}": "${c}" is only valid when "encoding" is set to "custom". ${h} encoding found`)):a[c]?s=s.concat(e.validateSpec({key:c,value:i[c],valueSpec:a[c],validateSpec:e.validateSpec,style:n,styleSpec:r})):s.push(new O(c,i[c],`unknown property "${c}"`));return s}const Xf={promoteId:aT};function Zy(e){let t=e.value,i=e.key,r=e.styleSpec,a=e.style,n=e.validateSpec;if(!t.type)return[new O(i,t,'"type" is required')];let s=lt(t.type),o;switch(s){case"vector":case"raster":return o=ui({key:i,value:t,valueSpec:r[`source_${s.replace("-","_")}`],style:e.style,styleSpec:r,objectElementValidators:Xf,validateSpec:n}),o;case"raster-dem":return o=rT({sourceName:i,value:t,style:e.style,styleSpec:r,validateSpec:n}),o;case"geojson":if(o=ui({key:i,value:t,valueSpec:r.source_geojson,style:a,styleSpec:r,validateSpec:n,objectElementValidators:Xf}),t.cluster)for(let l in t.clusterProperties){let[u,h]=t.clusterProperties[l],c=typeof u=="string"?[u,["accumulated"],["get",l]]:u;o.push(...rn({key:`${i}.${l}.map`,value:h,expressionContext:"cluster-map"})),o.push(...rn({key:`${i}.${l}.reduce`,value:c,expressionContext:"cluster-reduce"}))}return o;case"video":return ui({key:i,value:t,valueSpec:r.source_video,style:a,validateSpec:n,styleSpec:r});case"image":return ui({key:i,value:t,valueSpec:r.source_image,style:a,validateSpec:n,styleSpec:r});case"canvas":return[new O(i,null,"Please use runtime APIs to add canvas sources, rather than 
5including them in stylesheets.","source.canvas")];default:return hs({key:`${i}.type`,value:t.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]}})}}function aT({key:e,value:t}){if(ye(t)==="string")return zr({key:e,value:t});{let i=[];for(let r in t)i.push(...zr({key:`${e}.${r}`,value:t[r]}));return i}}function qy(e){let t=e.value,i=e.styleSpec,r=i.light,a=e.style,n=[],s=ye(t);if(t===void 0)return n;if(s!=="object")return n=n.concat([new O("light",t,`object expected, ${s} found`)]),n;for(let o in t){let l=o.match(Ad);n=l&&r[l[1]]&&r[l[1]].transition?n.concat(e.validateSpec({key:o,value:t[o],valueSpec:i.transition,validateSpec:e.validateSpec,style:a,styleSpec:i})):r[o]?n.concat(e.validateSpec({key:o,value:t[o],valueSpec:r[o],validateSpec:e.validateSpec,style:a,styleSpec:i})):n.concat([new O(o,t[o],`unknown property "${o}"`)])}return n}function Wy(e){let t=e.value,i=e.styleSpec,r=i.sky,a=e.style,n=ye(t);if(t===void 0)return[];if(n!=="object")return[new O("sky",t,`object expected, ${n} found`)];let s=[];for(let o in t){let l=o.match(Ad);s=l&&r[l[1]]&&r[l[1]].transition?s.concat(e.validateSpec({key:o,value:t[o],valueSpec:i.transition,style:a,styleSpec:i})):r[o]?s.concat(e.validateSpec({key:o,value:t[o],valueSpec:r[o],style:a,styleSpec:i})):s.concat([new O(o,t[o],`unknown property "${o}"`)])}return s}function Hy(e){let t=e.value,i=e.styleSpec,r=i.terrain,a=e.style,n=[],s=ye(t);if(t===void 0)return n;if(s!=="object")return n=n.concat([new O("terrain",t,`object expected, ${s} found`)]),n;for(let o in t)n=r[o]?n.concat(e.validateSpec({key:o,value:t[o],valueSpec:r[o],validateSpec:e.validateSpec,style:a,styleSpec:i})):n.concat([new O(o,t[o],`unknown property "${o}"`)]);return n}function nT(e){return zr(e).length===0?[]:rn(e)}function sT(e){return zr(e).length===0?[]:rn(e)}function oT(e){let t=e.key,i=e.value;if(ye(i)==="array"){if(i.length<1||i.length>4)return[new O(t,i,`padding requires 1 to 4 values; ${i.length} values found`)];let r={type:"number"},a=[];for(let n=0;n<i.length;n++)a=a.concat(e.validateSpec({key:`${t}[${n}]`,value:i[n],validateSpec:e.validateSpec,valueSpec:r}));return a}return Ul({key:t,value:i,valueSpec:{}})}function lT(e){let t=e.key,i=e.value;if(ye(i)==="array"){let r={type:"number"};if(i.length<1)return[new O(t,i,"array length at least 1 expected, length 0 found")];let a=[];for(let n=0;n<i.length;n++)a=a.concat(e.validateSpec({key:`${t}[${n}]`,value:i[n],validateSpec:e.validateSpec,valueSpec:r}));return a}return Ul({key:t,value:i,valueSpec:{}})}function uT(e){let t=e.key,i=e.value;if(ye(i)==="array"){if(i.length<1)return[new O(t,i,"array length at least 1 expected, length 0 found")];let r=[];for(let a=0;a<i.length;a++)r=r.concat($h({key:`${t}[${a}]`,value:i[a]}));return r}return $h({key:t,value:i})}function hT(e){let t=e.key,i=e.value,r=ye(i),a=e.styleSpec;if(r!=="array"||i.length<1||i.length%2!=0)return[new O(t,i,"variableAnchorOffsetCollection requires a non-empty array of even length")];let n=[];for(let s=0;s<i.length;s+=2)n=n.concat(hs({key:`${t}[${s}]`,value:i[s],valueSpec:a.layout_symbol["text-anchor"]})),n=n.concat(zd({key:`${t}[${s+1}]`,value:i[s+1],valueSpec:{length:2,value:"number"},validateSpec:e.validateSpec,style:e.style,styleSpec:a}));return n}function Xy(e){let t=[],i=e.value,r=e.key;if(Array.isArray(i)){let a=[],n=[];for(let s in i)i[s].id&&a.includes(i[s].id)&&t.push(new O(r,i,`all the sprites' ids must be unique, but ${i[s].id} is duplicated`)),a.push(i[s].id),i[s].url&&n.includes(i[s].url)&&t.push(new O(r,i,`all the sprites' URLs must be unique, but ${i[s].url} is duplicated`)),n.push(i[s].url),t=t.concat(ui({key:`${r}[${s}]`,value:i[s],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:e.validateSpec}));return t}return zr({key:r,value:i})}function cT(e){let t=e.value,i=e.styleSpec,r=i.projection,a=e.style,n=ye(t);if(t===void 0)return[];if(n!=="object")return[new O("projection",t,`object expected, ${n} found`)];let s=[];for(let o in t)s=r[o]?s.concat(e.validateSpec({key:o,value:t[o],valueSpec:r[o],style:a,styleSpec:i})):s.concat([new O(o,t[o],`unknown property "${o}"`)]);return s}function dT(e){let t=e.key,i=e.value;i=i instanceof String?i.valueOf():i;let r=ye(i);return r==="array"&&!fT(i)&&!pT(i)?[new O(t,i,`projection expected, invalid array ${JSON.stringify(i)} found`)]:["array","string"].includes(r)?[]:[new O(t,i,`projection expected, invalid type "${r}" found`)]}function pT(e){return!!["interpolate","step","literal"].includes(e[0])}function fT(e){return Array.isArray(e)&&e.length===3&&typeof e[0]=="string"&&typeof e[1]=="string"&&typeof e[2]=="number"}function jh(e){return!!e&&e.constructor===Object}function Yy(e){return jh(e.value)?[]:[new O(e.key,e.value,`object expected, ${ye(e.value)} found`)]}const Yf=1114111,mT=/^u\+(?:([0-9a-f]{1,6})(?:-([0-9a-f]{1,6}))?|([0-9a-f]{0,5}\?{1,6}))$/i;
vendor: 16,145 bytes, line 5
5function gT(e,t){if(ye(t)!=="string")return[];let i=`${t}`,r=()=>[new O(e,t,'invalid unicode range, expected a value such as "U+26", "U+0-10FFFF" or "U+4??"')],a=i.match(mT);if(!a)return r();let[,n,s,o]=a;if(o!==void 0)return o.length>6?r():[];let l=parseInt(n,16),u=s===void 0?l:parseInt(s,16);return l>Yf||u>Yf?[new O(e,t,"unicode range is out of bounds, the maximum code point is U+10FFFF")]:l>u?[new O(e,t,`unicode range start must not be greater than its end, but ${i} is`)]:[]}function Ky(e){let t=e.key??"font-faces",i=e.value,r=e.validateSpec,a=e.styleSpec??L_,n=e.style;if(!jh(i))return[new O(t,i,`object expected, ${ye(i)} found`)];let s=[];for(let o in i){let l=i[o],u=ye(l);if(u==="string")s.push(...zr({key:`${t}.${o}`,value:l}));else if(u==="array"){let h={url:{type:"string",required:!0},"unicode-range":{type:"array",value:"string"}};for(let[c,d]of l.entries()){let p=`${t}.${o}[${c}]`;s.push(...ui({key:p,value:d,valueSpec:h,styleSpec:a,style:n,validateSpec:r}));let f=jh(d)?d["unicode-range"]:void 0;if(ye(f)==="array")for(let[m,g]of f.entries())s.push(...gT(`${p}.unicode-range[${m}]`,g))}}else s.push(new O(`${t}.${o}`,l,`string or array expected, ${u} found`))}return s}const Kf={"*"(){return[]},array:zd,boolean:eT,number:Ul,color:$h,constants:Oy,enum:hs,filter:Rd,function:$y,layer:Gy,object:ui,source:Zy,light:qy,sky:Wy,terrain:Hy,projection:cT,projectionDefinition:dT,string:zr,formatted:nT,resolvedImage:sT,padding:oT,numberArray:lT,colorArray:uT,variableAnchorOffsetCollection:hT,sprite:Xy,state:Yy,fontFaces:Ky};function nl(e){let t=e.value,i=e.valueSpec,r=e.styleSpec;return e.validateSpec=nl,i.expression&&jl(lt(t))?$y(e):i.expression&&Vl(oa(t))?rn(e):i.type&&Kf[i.type]?Kf[i.type](e):ui(os({},e,{valueSpec:i.type?r[i.type]:i}))}function Jy(e){let t=e.value,i=e.key,r=zr(e);return r.length||(t.indexOf("{fontstack}")===-1&&r.push(new O(i,t,'"glyphs" url must include a "{fontstack}" token')),t.indexOf("{range}")===-1&&r.push(new O(i,t,'"glyphs" url must include a "{range}" token'))),r}function ai(e,t=z){let i=[];return i=i.concat(nl({key:"",value:e,valueSpec:t.$root,styleSpec:t,style:e,validateSpec:nl,objectElementValidators:{glyphs:Jy,"*"(){return[]}}})),e.constants&&(i=i.concat(Oy({key:"constants",value:e.constants}))),Qy(i)}ai.source=mi(fi(Zy)),ai.sprite=mi(fi(Xy)),ai.glyphs=mi(fi(Jy)),ai.fontFaces=mi(fi(Ky)),ai.light=mi(fi(qy)),ai.sky=mi(fi(Wy)),ai.terrain=mi(fi(Hy)),ai.state=mi(fi(Yy)),ai.layer=mi(fi(Gy)),ai.filter=mi(fi(Rd)),ai.paintProperty=mi(fi(Ny)),ai.layoutProperty=mi(fi(Uy));function fi(e){return function(t){return e(Object.assign({},t,{validateSpec:nl}))}}function Qy(e){return[].concat(e).sort((t,i)=>t.line-i.line)}function mi(e){return function(...t){return Qy(e.apply(this,t))}}const _T={type:"enum","property-type":"data-constant",expression:{interpolated:!1,parameters:["global-state"]},values:{visible:{},none:{}},transition:!1,default:"visible"};var yT=class{constructor(t,i,r){this._rootKey=i,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 i=Nl(t,this._rootKey,_T,this._globalState);if(i.result==="error")throw this._literalValue="visible",this._compiledValue=void 0,Error(i.value.map(r=>`${r.key}: ${r.message}`).join(", "));this._literalValue=void 0,this._compiledValue=i.value,this._globalStateRefs=As(i.value.expression)}getGlobalStateRefs(){return this._globalStateRefs}};function vT(e,t,i){return new yT(e,t,i)}const Jt=ai,e0=new Set(Object.keys(z).filter(e=>e.startsWith("source_")).map(e=>e.slice(7).replaceAll("_","-")));function xT(e){return Object.entries(e.sources??{}).filter(([,t])=>!e0.has(t.type)).map(([t])=>`sources.${t}`)}function Jf(e,t){let i=xT(t);return kd(e,Jt(t).filter(({message:r})=>!i.some(a=>r.startsWith(`${a}:`)||r.startsWith(`${a}.`))))}function kd(e,t){let i=!1;for(let r of t){if(r.severity==="warning"){xe(r.message);continue}e.fire(new Q(Error(r.message))),i=!0}return i}function Is(e,t,i,r){return(r==null?void 0:r.validate)!==!1&&kd(e,t({styleSpec:z,...i}))}var Vh=class t0{constructor(t,i,r){let a=this.cells=[];if(t instanceof ArrayBuffer){this.arrayBuffer=t;let s=new Int32Array(this.arrayBuffer);t=s[0],i=s[1],r=s[2],this.d=i+2*r;for(let u=0;u<this.d*this.d;u++){let h=s[3+u],c=s[3+u+1];a.push(h===c?null:s.subarray(h,c))}let o=s[3+a.length],l=s[3+a.length+1];this.keys=s.subarray(o,l),this.bboxes=s.subarray(l),this.insert=this._insertReadonly}else{this.d=i+2*r;for(let s=0;s<this.d*this.d;s++)a.push([]);this.keys=[],this.bboxes=[]}this.n=i,this.extent=t,this.padding=r,this.scale=i/t,this.uid=0;let n=r/i*t;this.min=-n,this.max=t+n}insert(t,i,r,a,n){this._forEachCell(i,r,a,n,this._insertCell,this.uid++,void 0,void 0),this.keys.push(t),this.bboxes.push(i),this.bboxes.push(r),this.bboxes.push(a),this.bboxes.push(n)}_insertReadonly(){throw Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(t,i,r,a,n,s){this.cells[n].push(s)}query(t,i,r,a,n){let s=this.min,o=this.max;if(t<=s&&i<=s&&o<=r&&o<=a&&!n)return[...this.keys];{let l=[];return this._forEachCell(t,i,r,a,this._queryCell,l,{},n),l}}_queryCell(t,i,r,a,n,s,o,l){let u=this.cells[n];if(u!==null){let h=this.keys,c=this.bboxes;for(let d of u)if(o[d]===void 0){let p=d*4;(l?l(c[p+0],c[p+1],c[p+2],c[p+3]):t<=c[p+2]&&i<=c[p+3]&&r>=c[p+0]&&a>=c[p+1])?(o[d]=!0,s.push(h[d])):o[d]=!1}}}_forEachCell(t,i,r,a,n,s,o,l){let u=this._convertToCellCoord(t),h=this._convertToCellCoord(i),c=this._convertToCellCoord(r),d=this._convertToCellCoord(a);for(let p=u;p<=c;p++)for(let f=h;f<=d;f++){let m=this.d*f+p;if((!l||l(this._convertFromCellCoord(p),this._convertFromCellCoord(f),this._convertFromCellCoord(p+1),this._convertFromCellCoord(f+1)))&&n.call(this,t,i,r,a,m,s,o,l))return}}_convertFromCellCoord(t){return(t-this.padding)/this.scale}_convertToCellCoord(t){return Math.max(0,Math.min(this.d-1,Math.floor(t*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;let t=this.cells,i=3+this.cells.length+1+1,r=0;for(let s of this.cells)r+=s.length;let a=new Int32Array(i+r+this.keys.length+this.bboxes.length);a[0]=this.extent,a[1]=this.n,a[2]=this.padding;let n=i;for(let s=0;s<t.length;s++){let o=t[s];a[3+s]=n,a.set(o,n),n+=o.length}return a[3+t.length]=n,a.set(this.keys,n),n+=this.keys.length,a[3+t.length+1]=n,a.set(this.bboxes,n),n+=this.bboxes.length,a.buffer}static serialize(t,i){let r=t.toArrayBuffer();return i&&i.push(r),{buffer:r}}static deserialize(t){return new t0(t.buffer)}};const ur={};function G(e,t,i={}){if(ur[e])throw Error(`${e} is already registered.`);Object.defineProperty(t,"_classRegistryKey",{value:e,writeable:!1}),ur[e]={klass:t,omit:i.omit||[],shallow:i.shallow||[]}}G("Object",Object),G("Set",Set),G("TransferableGridIndex",Vh),G("Color",de),G("Error",Error),G("AJAXError",is),G("ResolvedImage",Ki),G("StylePropertyFunction",Fy),G("StyleExpression",Id,{omit:["_evaluator"]}),G("ZoomDependentExpression",rl),G("ZoomConstantExpression",ls),G("CompoundExpression",da,{omit:["_evaluate"]});for(let e in Va)Va[e]._classRegistryKey||G(`Expression_${e}`,Va[e]);function i0(e){var t;return e&&typeof ArrayBuffer<"u"&&(e instanceof ArrayBuffer||((t=e.constructor)==null?void 0:t.name)==="ArrayBuffer")}function Ld(e){let t=e.constructor;return e.$name||t._classRegistryKey}function bT(e){if(typeof e!="object"||!e)return!1;let t=Ld(e);return t&&t!=="Object"}function r0(e){return!bT(e)&&(e==null||typeof e=="boolean"||typeof e=="number"||typeof e=="string"||e instanceof Boolean||e instanceof Number||e instanceof String||e instanceof Date||e instanceof RegExp||e instanceof Blob||e instanceof Error||i0(e)||Qr(e)||ArrayBuffer.isView(e)||e instanceof ImageData)}function Xn(e,t){if(r0(e))return(i0(e)||Qr(e))&&t&&t.push(e),ArrayBuffer.isView(e)&&t&&t.push(e.buffer),e instanceof ImageData&&t&&t.push(e.data.buffer),e;if(Array.isArray(e)){let n=[];for(let s of e)n.push(Xn(s,t));return n}if(typeof e!="object")throw Error(`can't serialize object of type ${typeof e}`);let i=Ld(e);if(!i)throw Error(`can't serialize object of unregistered class ${e.constructor.name}`);if(!ur[i])throw Error(`${i} is not registered.`);let{klass:r}=ur[i],a=r.serialize?r.serialize(e,t):{};if(r.serialize){if(a===(t==null?void 0:t[t.length-1]))throw Error("statically serialized object won't survive transfer of $name property")}else{for(let n in e){if(!e.hasOwnProperty(n)||ur[i].omit.includes(n))continue;let s=e[n];s!==void 0&&(a[n]=ur[i].shallow.includes(n)?s:Xn(s,t))}e instanceof Error&&(a.message=e.message)}if(a.$name)throw Error("$name property is reserved for worker serialization logic.");return i!=="Object"&&(a.$name=i),a}function Yn(e){if(r0(e))return e;if(Array.isArray(e))return e.map(Yn);if(typeof e!="object")throw Error(`can't deserialize object of type ${typeof e}`);let t=Ld(e)||"Object";if(!ur[t])throw Error(`can't deserialize unregistered class ${t}`);let{klass:i}=ur[t];if(!i)throw Error(`can't deserialize unregistered class ${t}`);if(i.deserialize)return i.deserialize(e);let r=Object.create(i.prototype);for(let a of Object.keys(e)){if(a==="$name")continue;let n=e[a];r[a]=ur[t].shallow.includes(a)?n:Yn(n)}return r}var Nh=class{constructor(){this.first=!0}update(t,i){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=i):this.lastFloorZoom<r&&(this.lastIntegerZoom=r,this.lastIntegerZoomTime=i),t!==this.lastZoom&&(this.lastZoom=t,this.lastFloorZoom=r,!0))}},Be=class{constructor(t,i){this.zoom=t,i?(this.now=i.now||0,this.fadeDuration=i.fadeDuration||0,this.zoomHistory=i.zoomHistory||new Nh,this.transition=i.transition||{}):(this.now=0,this.fadeDuration=0,this.zoomHistory=new Nh,this.transition={})}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){let t=this.zoom,i=t-Math.floor(t),r=this.crossFadingFactor();return t>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:i+(1-i)*r}:{fromScale:.5,toScale:1,t:1-(1-r)*i}}},Gl=class{constructor(t,i,r,a){this.property=t,this.value=i,this.expression=q2(i===void 0?t.specification.default:i,r,t.specification,a)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}getGlobalStateRefs(){return this.expression.globalStateRefs||new Set}possiblyEvaluate(t,i,r){return this.property.possiblyEvaluate(this,t,i,r)}},Uh=class{constructor(t,i,r){this.property=t,this.value=new Gl(t,void 0,i,r)}transitioned(t,i){return i.value===this.value?i:new Qf(this.property,this.value,i,W({},t.transition,this.transition),t.now)}untransitioned(){return new Qf(this.property,this.value,null,{},0)}},Zl=class{constructor(t,i,r){this._properties=t,this._values=Object.create(t.defaultTransitionablePropertyValues),this._globalState=r,this._rootKey=i}_propertyRootKey(t){return`${this._rootKey}.${String(t)}`}hasProperty(t){return t in this._properties.defaultTransitionablePropertyValues}getValue(t){return Qt(this._values[t].value.value)}setValue(t,i){Object.hasOwn(this._values,t)||(this._values[t]=new Uh(this._values[t].property,this._propertyRootKey(t),this._globalState)),this._values[t].value=new Gl(this._values[t].property,i===null?void 0:Qt(i),this._propertyRootKey(t),this._globalState)}setValues(t){for(let i in t){let r=t[i];i.endsWith("-transition")?this.setTransition(i.slice(0,-11),r):Ai(this._values[i].value.value,r)||this.setValue(i,r)}}getTransition(t){return Qt(this._values[t].transition)}setTransition(t,i){Object.hasOwn(this._values,t)||(this._values[t]=new Uh(this._values[t].property,this._propertyRootKey(t),this._globalState)),this._values[t].transition=Qt(i)||void 0}serialize(){let t={};for(let i of Object.keys(this._values)){let r=this.getValue(i);r!==void 0&&(t[i]=r);let a=this.getTransition(i);a!==void 0&&(t[`${i}-transition`]=a)}return t}transitioned(t,i){let r=new em(this._properties);for(let a of Object.keys(this._values))r._values[a]=this._values[a].transitioned(t,i._values[a]);return r}untransitioned(){let t=new em(this._properties);for(let i of Object.keys(this._values))t._values[i]=this._values[i].untransitioned();return t}},Qf=class{constructor(t,i,r,a,n){this.property=t,this.value=i,this.begin=n+a.delay||0,this.end=this.begin+a.duration||0,t.specification.transition&&(a.delay||a.duration)&&(this.prior=r)}possiblyEvaluate(t,i,r){let a=t.now||0,n=this.value.possiblyEvaluate(t,i,r),s=this.prior;if(!s)return n;if(a>this.end||this.value.isDataDriven())return this.prior=null,n;if(a<this.begin)return s.possiblyEvaluate(t,i,r);{let o=(a-this.begin)/(this.end-this.begin);return this.property.interpolate(s.possiblyEvaluate(t,i,r),n,Qb(o))}}},em=class{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitioningPropertyValues)}possiblyEvaluate(t,i,r){let a=new ql(this._properties);for(let n of Object.keys(this._values))a._values[n]=this._values[n].possiblyEvaluate(t,i,r);return a}hasTransition(){for(let t of Object.keys(this._values))if(this._values[t].prior)return!0;return!1}},wT=class{constructor(t,i,r){this._properties=t,this._values=Object.create(t.defaultPropertyValues),this._globalState=r,this._rootKey=i}_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 Qt(this._values[t].value)}setValue(t,i){this._values[t]=new Gl(this._values[t].property,i===null?void 0:Qt(i),this._propertyRootKey(t),this._globalState)}serialize(){let t={};for(let i of Object.keys(this._values)){let r=this.getValue(i);r!==void 0&&(t[i]=r)}return t}possiblyEvaluate(t,i,r){let a=new ql(this._properties);for(let n of Object.keys(this._values))a._values[n]=this._values[n].possiblyEvaluate(t,i,r);return a}},wi=class{constructor(t,i,r){this.property=t,this.value=i,this.parameters=r}isConstant(){return this.value.kind==="constant"}constantOr(t){return this.value.kind==="constant"?this.value.value:t}evaluate(t,i,r,a){return this.property.evaluate(this.value,this.parameters,t,i,r,a)}},ql=class{constructor(t){this._properties=t,this._values=Object.create(t.defaultPossiblyEvaluatedValues)}get(t){return this._values[t]}};function tm(e){if(Array.isArray(e))return e.length;let t=e==null?void 0:e.values;return Array.isArray(t)?t.length:void 0}function a0(e,t){let i=tm(e),r=tm(t);return i!==void 0&&r!==void 0&&i!==r}var N=class{constructor(t,i){this.specification=t,this.name=i}possiblyEvaluate(t,i){if(t.isDataDriven())throw Error("Value should not be data driven");return t.expression.evaluate(i)}interpolate(t,i,r){if(a0(t,i))return xe(`Property "${this.name}" is trying to interpolate arrays of different lengths. Rendering may 'jump'.`),i;let a=this.specification.type,n=Je[a];return n?n(t,i,r):t}},ee=class{constructor(t,i,r){this.specification=t,this.name=i,this.overrides=r}possiblyEvaluate(t,i,r,a){return t.expression.kind==="constant"||t.expression.kind==="camera"?new wi(this,{kind:"constant",value:t.expression.evaluate(i,null,{},r,a)},i):new wi(this,t.expression,i)}interpolate(t,i,r){if(t.value.kind!=="constant"||i.value.kind!=="constant")return t;if(t.value.value===void 0||i.value.value===void 0)return new wi(this,{kind:"constant",value:void 0},t.parameters);if(a0(t.value.value,i.value.value))return xe(`Property "${this.name}" is trying to interpolate arrays of different lengths. Rendering may 'jump'.`),i;let a=this.specification.type,n=Je[a];if(n){let s=n(t.value.value,i.value.value,r);return new wi(this,{kind:"constant",value:s},t.parameters)}return t}evaluate(t,i,r,a,n,s){return t.kind==="constant"?t.value:t.evaluate(i,r,a,n,s)}},cs=class extends ee{possiblyEvaluate(t,i,r,a){if(t.value===void 0)return new wi(this,{kind:"constant",value:void 0},i);if(t.expression.kind==="constant"){let n=t.expression.evaluate(i,null,{},r,a),s=t.property.specification.type==="resolvedImage"&&typeof n!="str
5ing"?n.name:n,o=this._calculate(s,s,s,i);return new wi(this,{kind:"constant",value:o},i)}if(t.expression.kind==="camera"){let n=this._calculate(t.expression.evaluate({zoom:i.zoom-1}),t.expression.evaluate({zoom:i.zoom}),t.expression.evaluate({zoom:i.zoom+1}),i);return new wi(this,{kind:"constant",value:n},i)}return new wi(this,t.expression,i)}evaluate(t,i,r,a,n,s){if(t.kind==="source"){let o=t.evaluate(i,r,a,n,s);return this._calculate(o,o,o,i)}return t.kind==="composite"?this._calculate(t.evaluate({zoom:Math.floor(i.zoom)-1},r,a),t.evaluate({zoom:Math.floor(i.zoom)},r,a),t.evaluate({zoom:Math.floor(i.zoom)+1},r,a),i):t.value}_calculate(t,i,r,a){return a.zoom>a.zoomHistory.lastIntegerZoom?{from:t,to:i}:{from:r,to:i}}interpolate(t){return t}},n0=class{constructor(t,i){this.specification=t,this.name=i}possiblyEvaluate(t,i,r,a){if(t.value!==void 0){if(t.expression.kind==="constant"){let n=t.expression.evaluate(i,null,{},r,a);return this._calculate(n,n,n,i)}return this._calculate(t.expression.evaluate(new Be(Math.floor(i.zoom-1),i)),t.expression.evaluate(new Be(Math.floor(i.zoom),i)),t.expression.evaluate(new Be(Math.floor(i.zoom+1),i)),i)}}_calculate(t,i,r,a){return a.zoom>a.zoomHistory.lastIntegerZoom?{from:t,to:i}:{from:r,to:i}}interpolate(t){return t}},Wl=class{constructor(t,i){this.specification=t,this.name=i}possiblyEvaluate(t,i,r,a){return!!t.expression.evaluate(i,null,{},r,a)}interpolate(){return!1}},Dt=class{constructor(t){this.properties=t,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(let i in t){let r=t[i];r.specification.overridable&&this.overridableProperties.push(i);let a=this.defaultPropertyValues[i]=new Gl(r,void 0,r.name,void 0),n=this.defaultTransitionablePropertyValues[i]=new Uh(r,r.name,void 0);this.defaultTransitioningPropertyValues[i]=n.untransitioned(),this.defaultPossiblyEvaluatedValues[i]=a.possiblyEvaluate({})}}};G("DataDrivenProperty",ee),G("DataConstantProperty",N),G("CrossFadedDataDrivenProperty",cs),G("CrossFadedProperty",n0),G("ColorRampProperty",Wl);const im=" is a PAINT property not a LAYOUT property. Use get/setPaintProperty instead?",Wu=" is a LAYOUT property not a PAINT property. Use get/setLayoutProperty instead?";var Li=class extends _t{constructor(t,i,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=vT(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=us(t.filter,`layers[${this.id}].filter`,r)),i.layout&&(this._unevaluatedLayout=new wT(i.layout,`layers[${this.id}].layout`,r)),i.paint)){this._transitionablePaint=new Zl(i.paint,`layers[${this.id}].paint`,r);for(let a in t.paint)this.setPaintProperty(a,t.paint[a],{validate:!1});for(let a in t.layout)this.setLayoutProperty(a,t.layout[a],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new ql(i.paint)}}setFilter(t){this.filter=t,this._featureFilter=us(t,`layers[${this.id}].filter`,this._globalState)}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(t){var i;if(t==="visibility")return this.visibility;if((i=this._transitionablePaint)!=null&&i.hasProperty(t))throw Error(t+im);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 i of this._visibilityExpression.getGlobalStateRefs())t.add(i);if(this._unevaluatedLayout)for(let i in this._unevaluatedLayout._values){let r=this._unevaluatedLayout._values[i];for(let a of r.getGlobalStateRefs())t.add(a)}for(let i of this._featureFilter.getGlobalStateRefs())t.add(i);return t}getPaintAffectingGlobalStateRefs(){let t=new globalThis.Map;if(this._transitionablePaint)for(let i in this._transitionablePaint._values){let r=this._transitionablePaint._values[i].value;for(let a of r.getGlobalStateRefs()){let n=t.get(a)??[];n.push({name:i,value:r.value}),t.set(a,n)}}return t}getVisibilityAffectingGlobalStateRefs(){return this._visibilityExpression.getGlobalStateRefs()}setLayoutProperty(t,i,r={}){var a;if(t==="visibility"){this.visibility=i,this._visibilityExpression.setValue(i),this.recalculateVisibility();return}if((a=this._transitionablePaint)!=null&&a.hasProperty(t)){this.fire(new Q(Error(t+im)));return}
5i!=null&&this._validate(Jt.layoutProperty,`layers.${this.id}.layout.${t}`,t,i,r)||this._unevaluatedLayout.setValue(t,i)}getPaintProperty(t){var i,r;if(t.endsWith("-transition")){let a=t.slice(0,-11);if(a==="visibility"||(i=this._unevaluatedLayout)!=null&&i.hasProperty(a))throw Error(t+Wu);return this._transitionablePaint.getTransition(a)}if(t==="visibility"||(r=this._unevaluatedLayout)!=null&&r.hasProperty(t))throw Error(t+Wu);return this._transitionablePaint.getValue(t)}setPaintProperty(t,i,r={}){var a;if(t==="visibility"||(a=this._unevaluatedLayout)!=null&&a.hasProperty(t))return this.fire(new Q(Error(t+Wu))),!1;if(i!=null&&this._validate(Jt.paintProperty,`layers.${this.id}.paint.${t}`,t,i,r))return!1;if(t.endsWith("-transition"))return this._transitionablePaint.setTransition(t.slice(0,-11),i||void 0),!1;{let n=this._transitionablePaint._values[t],s=n.property.specification["property-type"]==="cross-faded-data-driven",o=n.value.isDataDriven(),l=n.value;this._transitionablePaint.setValue(t,i),this._handleSpecialPaintPropertyUpdate(t);let u=this._transitionablePaint._values[t].value;return u.isDataDriven()||o||s||this._handleOverridablePaintPropertyUpdate(t,l,u)}}_handleSpecialPaintPropertyUpdate(t){}_handleOverridablePaintPropertyUpdate(t,i,r){return!1}isHidden(t=this.minzoom,i=!1){return this.minzoom&&t<(i?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,i){t.getCrossfadeParameters&&(this._crossfadeParameters=t.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(t,void 0,i)),this.paint=this._transitioningPaint.possiblyEvaluate(t,void 0,i)}serialize(){var i,r;
vendor: 38,159 bytes, line 5
5let 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:(i=this._unevaluatedLayout)==null?void 0:i.serialize(),paint:(r=this._transitionablePaint)==null?void 0:r.serialize()};return this.visibility&&(t.layout||(t.layout={}),t.layout.visibility=this.visibility),P_(t,(a,n)=>a!==void 0&&!(n==="layout"&&!Object.keys(a).length)&&!(n==="paint"&&!Object.keys(a).length))}_validate(t,i,r,a,n={}){return Is(this,t,{key:i,layerType:this.type,objectKey:r,value:a},n)}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(let t in this.paint._values){let i=this.paint.get(t);if(i instanceof wi&&en(i.property.specification)&&(i.value.kind==="source"||i.value.kind==="composite")&&i.value.isStateDependent)return!0}return!1}};let TT;const ET=()=>TT||(TT=new Dt({"raster-opacity":new N(z.paint_raster["raster-opacity"],"raster-opacity"),"raster-hue-rotate":new N(z.paint_raster["raster-hue-rotate"],"raster-hue-rotate"),"raster-brightness-min":new N(z.paint_raster["raster-brightness-min"],"raster-brightness-min"),"raster-brightness-max":new N(z.paint_raster["raster-brightness-max"],"raster-brightness-max"),"raster-saturation":new N(z.paint_raster["raster-saturation"],"raster-saturation"),"raster-contrast":new N(z.paint_raster["raster-contrast"],"raster-contrast"),resampling:new N(z.paint_raster.resampling,"resampling"),"raster-resampling":new N(z.paint_raster["raster-resampling"],"raster-resampling"),"raster-fade-duration":new N(z.paint_raster["raster-fade-duration"],"raster-fade-duration")}));var ST={get paint(){return ET()}};const Gh=e=>e.type==="raster";var DT=class extends Li{constructor(t,i){super(t,ST,i)}};const CT={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};var Ms=class{constructor(t,i){this._structArray=t,this._pos1=i*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}},rt=class{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(t,i){return t._trim(),i&&(t.isTransferred=!0,i.push(t.arrayBuffer)),{length:t.length,arrayBuffer:t.arrayBuffer}}static deserialize(t){let i=Object.create(this.prototype);return i.arrayBuffer=t.arrayBuffer,i.length=t.length,i.capacity=t.arrayBuffer.byteLength/i.bytesPerElement,i._refreshViews(),i}_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 i=this.uint8;this._refreshViews(),i&&this.uint8.set(i)}}_refreshViews(){throw Error("_refreshViews() must be implemented by each concrete StructArray layout")}freeBufferAfterUpload(){this.arrayBuffer=new ArrayBuffer(0),this._refreshViews()}};function tt(e,t=1){let i=0,r=0;return{members:e.map(a=>{let n=PT(a.type),s=i=rm(i,Math.max(t,n)),o=a.components||1;return r=Math.max(r,n),i+=n*o,{name:a.name,type:a.type,components:o,offset:s}}),size:rm(i,Math.max(r,t)),alignment:t}}function PT(e){return CT[e].BYTES_PER_ELEMENT}function rm(e,t){return Math.ceil(e/t)*t}var ds=class extends rt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,i){let r=this.length;return this.resize(r+1),this.emplace(r,t,i)}emplace(t,i,r){let a=t*2;return this.int16[a+0]=i,this.int16[a+1]=r,t}};ds.prototype.bytesPerElement=4,G("StructArrayLayout2i4",ds);var sl=class extends rt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,i,r){let a=this.length;return this.resize(a+1),this.emplace(a,t,i,r)}emplace(t,i,r,a){let n=t*3;return this.int16[n+0]=i,this.int16[n+1]=r,this.int16[n+2]=a,t}};sl.prototype.bytesPerElement=6,G("StructArrayLayout3i6",sl);var Zh=class extends rt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,i,r,a){let n=this.length;return this.resize(n+1),this.emplace(n,t,i,r,a)}emplace(t,i,r,a,n){let s=t*4;return this.int16[s+0]=i,this.int16[s+1]=r,this.int16[s+2]=a,this.int16[s+3]=n,t}};Zh.prototype.bytesPerElement=8,G("StructArrayLayout4i8",Zh);var qh=class extends rt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,i,r,a,n,s){let o=this.length;return this.resize(o+1),this.emplace(o,t,i,r,a,n,s)}emplace(t,i,r,a,n,s,o){let l=t*6;return this.int16[l+0]=i,this.int16[l+1]=r,this.int16[l+2]=a,this.int16[l+3]=n,this.int16[l+4]=s,this.int16[l+5]=o,t}};qh.prototype.bytesPerElement=12,G("StructArrayLayout2i4i12",qh);var Wh=class extends rt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,i,r,a,n,s){let o=this.length;return this.resize(o+1),this.emplace(o,t,i,r,a,n,s)}emplace(t,i,r,a,n,s,o){let l=t*4,u=t*8;return this.int16[l+0]=i,this.int16[l+1]=r,this.uint8[u+4]=a,this.uint8[u+5]=n,this.uint8[u+6]=s,this.uint8[u+7]=o,t}};Wh.prototype.bytesPerElement=8,G("StructArrayLayout2i4ub8",Wh);var ps=class extends rt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,i){let r=this.length;return this.resize(r+1),this.emplace(r,t,i)}emplace(t,i,r){let a=t*2;return this.float32[a+0]=i,this.float32[a+1]=r,t}};ps.prototype.bytesPerElement=8,G("StructArrayLayout2f8",ps);var Hh=class extends rt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,i,r,a,n,s,o,l,u,h){let c=this.length;return this.resize(c+1),this.emplace(c,t,i,r,a,n,s,o,l,u,h)}emplace(t,i,r,a,n,s,o,l,u,h,c){let d=t*10;return this.uint16[d+0]=i,this.uint16[d+1]=r,this.uint16[d+2]=a,this.uint16[d+3]=n,this.uint16[d+4]=s,this.uint16[d+5]=o,this.uint16[d+6]=l,this.uint16[d+7]=u,this.uint16[d+8]=h,this.uint16[d+9]=c,t}};Hh.prototype.bytesPerElement=20,G("StructArrayLayout10ui20",Hh);var Xh=class extends rt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,i,r,a,n,s,o,l){let u=this.length;return this.resize(u+1),this.emplace(u,t,i,r,a,n,s,o,l)}emplace(t,i,r,a,n,s,o,l,u){let h=t*8;return this.uint16[h+0]=i,this.uint16[h+1]=r,this.uint16[h+2]=a,this.uint16[h+3]=n,this.uint16[h+4]=s,this.uint16[h+5]=o,this.uint16[h+6]=l,this.uint16[h+7]=u,t}};Xh.prototype.bytesPerElement=16,G("StructArrayLayout8ui16",Xh);var Yh=class extends rt{_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,i,r,a,n,s,o,l,u,h,c,d,p){let f=this.length;return this.resize(f+1),this.emplace(f,t,i,r,a,n,s,o,l,u,h,c,d,p)}emplace(t,i,r,a,n,s,o,l,u,h,c,d,p,f){let m=t*14,g=t*7;return this.int16[m+0]=i,this.int16[m+1]=r,this.int16[m+2]=a,this.int16[m+3]=n,this.uint16[m+4]=s,this.uint16[m+5]=o,this.uint16[m+6]=l,this.uint16[m+7]=u,this.int16[m+8]=h,this.int16[m+9]=c,this.int16[m+10]=d,this.int16[m+11]=p,this.float32[g+6]=f,t}};Yh.prototype.bytesPerElement=28,G("StructArrayLayout4i4ui4i1f28",Yh);var Kh=class extends rt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,i,r){let a=this.length;return this.resize(a+1),this.emplace(a,t,i,r)}emplace(t,i,r,a){let n=t*3;return this.float32[n+0]=i,this.float32[n+1]=r,this.float32[n+2]=a,t}};Kh.prototype.bytesPerElement=12,G("StructArrayLayout3f12",Kh);var Jh=class extends rt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(t){let i=this.length;return this.resize(i+1),this.emplace(i,t)}emplace(t,i){let r=t*1;return this.uint32[r+0]=i,t}};Jh.prototype.bytesPerElement=4,G("StructArrayLayout1ul4",Jh);var Qh=class extends rt{_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,i,r,a,n,s,o,l,u){let h=this.length;return this.resize(h+1),this.emplace(h,t,i,r,a,n,s,o,l,u)}emplace(t,i,r,a,n,s,o,l,u,h){let c=t*10,d=t*5;return this.int16[c+0]=i,this.int16[c+1]=r,this.int16[c+2]=a,this.int16[c+3]=n,this.int16[c+4]=s,this.int16[c+5]=o,this.uint32[d+3]=l,this.uint16[c+8]=u,this.uint16[c+9]=h,t}};Qh.prototype.bytesPerElement=20,G("StructArrayLayout6i1ul2ui20",Qh);var ec=class extends rt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,i,r,a,n,s){let o=this.length;return this.resize(o+1),this.emplace(o,t,i,r,a,n,s)}emplace(t,i,r,a,n,s,o){let l=t*6;return this.int16[l+0]=i,this.int16[l+1]=r,this.int16[l+2]=a,this.int16[l+3]=n,this.int16[l+4]=s,this.int16[l+5]=o,t}};ec.prototype.bytesPerElement=12,G("StructArrayLayout2i2i2i12",ec);var tc=class extends rt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,i,r,a,n){let s=this.length;return this.resize(s+1),this.emplace(s,t,i,r,a,n)}emplace(t,i,r,a,n,s){let o=t*4,l=t*8;return this.float32[o+0]=i,this.float32[o+1]=r,this.float32[o+2]=a,this.int16[l+6]=n,this.int16[l+7]=s,t}};tc.prototype.bytesPerElement=16,G("StructArrayLayout2f1f2i16",tc);var ic=class extends rt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,i,r,a,n,s){let o=this.length;return this.resize(o+1),this.emplace(o,t,i,r,a,n,s)}emplace(t,i,r,a,n,s,o){let l=t*16,u=t*4,h=t*8;return this.uint8[l+0]=i,this.uint8[l+1]=r,this.float32[u+1]=a,this.float32[u+2]=n,this.int16[h+6]=s,this.int16[h+7]=o,t}};ic.prototype.bytesPerElement=16,G("StructArrayLayout2ub2f2i16",ic);var ol=class extends rt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,i,r){let a=this.length;return this.resize(a+1),this.emplace(a,t,i,r)}emplace(t,i,r,a){let n=t*3;return this.uint16[n+0]=i,this.uint16[n+1]=r,this.uint16[n+2]=a,t}};ol.prototype.bytesPerElement=6,G("StructArrayLayout3ui6",ol);var rc=class extends rt{_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,i,r,a,n,s,o,l,u,h,c,d,p,f,m,g,_,y){let x=this.length;return this.resize(x+1),this.emplace(x,t,i,r,a,n,s,o,l,u,h,c,d,p,f,m,g,_,y)}emplace(t,i,r,a,n,s,o,l,u,h,c,d,p,f,m,g,_,y,x){let v=t*26,w=t*13,b=t*52;return this.int16[v+0]=i,this.int16[v+1]=r,this.uint16[v+2]=a,this.uint16[v+3]=n,this.uint32[w+2]=s,this.uint32[w+3]=o,this.uint32[w+4]=l,this.uint16[v+10]=u,this.uint16[v+11]=h,this.uint16[v+12]=c,this.float32[w+7]=d,this.float32[w+8]=p,this.uint8[b+36]=f,this.uint8[b+37]=m,this.uint8[b+38]=g,this.uint32[w+10]=_,this.int16[v+22]=y,this.float32[w+12]=x,t}};rc.prototype.bytesPerElement=52,G("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i1f52",rc);var ac=class extends rt{_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,i,r,a,n,s,o,l,u,h,c,d,p,f,m,g,_,y,x,v,w,b,T,P,S,M,k,R,D){let I=this.length;return this.resize(I+1),this.emplace(I,t,i,r,a,n,s,o,l,u,h,c,d,p,f,m,g,_,y,x,v,w,b,T,P,S,M,k,R,D)}emplace(t,i,r,a,n,s,o,l,u,h,c,d,p,f,m,g,_,y,x,v,w,b,T,P,S,M,k,R,D,I){let C=t*34,E=t*17;return this.int16[C+0]=i,this.int16[C+1]=r,this.int16[C+2]=a,this.int16[C+3]=n,this.int16[C+4]=s,this.int16[C+5]=o,this.int16[C+6]=l,this.int16[C+7]=u,this.uint16[C+8]=h,this.uint16[C+9]=c,this.uint16[C+10]=d,this.uint16[C+11]=p,this.uint16[C+12]=f,this.uint16[C+13]=m,this.uint16[C+14]=g,this.uint16[C+15]=_,this.uint16[C+16]=y,this.uint16[C+17]=x,this.uint16[C+18]=v,this.uint16[C+19]=w,this.uint16[C+20]=b,this.uint16[C+21]=T,this.uint16[C+22]=P,this.uint32[E+12]=S,this.float32[E+13]=M,this.float32[E+14]=k,this.uint16[C+30]=R,this.uint16[C+31]=D,this.float32[E+16]=I,t}};ac.prototype.bytesPerElement=68,G("StructArrayLayout8i15ui1ul2f2ui1f68",ac);var ll=class extends rt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t){let i=this.length;return this.resize(i+1),this.emplace(i,t)}emplace(t,i){let r=t*1;return this.float32[r+0]=i,t}};ll.prototype.bytesPerElement=4,G("StructArrayLayout1f4",ll);var nc=class extends rt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,i,r){let a=this.length;return this.resize(a+1),this.emplace(a,t,i,r)}emplace(t,i,r,a){let n=t*6,s=t*3;return this.uint16[n+0]=i,this.float32[s+1]=r,this.float32[s+2]=a,t}};nc.prototype.bytesPerElement=12,G("StructArrayLayout1ui2f12",nc);var sc=class extends rt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,i,r){let a=this.length;return this.resize(a+1),this.emplace(a,t,i,r)}emplace(t,i,r,a){let n=t*2,s=t*4;return this.uint32[n+0]=i,this.uint16[s+2]=r,this.uint16[s+3]=a,t}};sc.prototype.bytesPerElement=8,G("StructArrayLayout1ul2ui8",sc);var oc=class extends rt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,i){let r=this.length;return this.resize(r+1),this.emplace(r,t,i)}emplace(t,i,r){let a=t*2;return this.uint16[a+0]=i,this.uint16[a+1]=r,t}};oc.prototype.bytesPerElement=4,G("StructArrayLayout2ui4",oc);var lc=class extends rt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t){let i=this.length;return this.resize(i+1),this.emplace(i,t)}emplace(t,i){let r=t*1;return this.uint16[r+0]=i,t}};lc.prototype.bytesPerElement=2,G("StructArrayLayout1ui2",lc);var uc=class extends rt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,i,r,a){let n=this.length;return this.resize(n+1),this.emplace(n,t,i,r,a)}emplace(t,i,r,a,n){let s=t*4;return this.float32[s+0]=i,this.float32[s+1]=r,this.float32[s+2]=a,this.float32[s+3]=n,t}};uc.prototype.bytesPerElement=16,G("StructArrayLayout4f16",uc);var s0=class extends Ms{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 A(this.anchorPointX,this.anchorPointY)}};s0.prototype.size=20;var o0=class extends Qh{get(t){return new s0(this,t)}};G("CollisionBoxArray",o0);var l0=class extends Ms{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]}};l0.prototype.size=52;var u0=class extends rc{get(t){return new l0(this,t)}};G("PlacedSymbolArray",u0);var h0=class extends Ms{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]}};h0.prototype.size=68;var c0=class extends ac{get(t){return new h0(this,t)}};G("SymbolInstanceArray",c0);var d0=class extends ll{getoffsetX(t){return this.float32[t*1+0]}};G("GlyphOffsetArray",d0);var p0=class extends sl{getx(t){return this.int16[t*3+0]}gety(t){return this.int16[t*3+1]}gettileUnitDistanceFromAnchor(t){return this.int16[t*3+2]}};G("SymbolLineVertexArray",p0);var f0=class extends Ms{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]}};f0.prototype.size=12;var m0=class extends nc{get(t){return new f0(this,t)}};G("TextAnchorOffsetArray",m0);var g0=class extends Ms{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]}};g0.prototype.size=8;var _0=class extends sc{get(t){return new g0(this,t)}};G("FeatureIndexArray",_0);var Pr=class extends ds{},AT=class extends sl{},IT=class extends Zh{},MT=class extends ds{},FT=class extends ds{},zT=class extends qh{},RT=class extends Wh{},kT=class extends ps{},Ca=class extends Hh{},am=class extends Xh{},LT=class extends Yh{},BT=class extends Kh{},OT=class extends Jh{},nm=class extends ec{},$T=class extends tc{},jT=class extends ic{},VT=class extends ol{},er=class extends ol{},hc=class extends oc{},NT=class extends lc{};const UT=tt([{name:"a_pos",components:2,type:"Int16"}],4),GT=UT.members;var Ke=class ka{constructor(t=[]){this._forceNewSegmentOnNextPrepare=!1,this.segments=t}prepareSegment(t,i,r,a){let n=this.segments[this.segments.length-1];return t>ka.MAX_VERTEX_ARRAY_LENGTH&&xe(`Max vertices per segment is ${ka.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${t}. Consider using the \`fillLargeMeshArrays\` function if you require meshes with more than ${ka.MAX_VERTEX_ARRAY_LENGTH} vertices.`),this._forceNewSegmentOnNextPrepare||!n||n.vertexLength+t>ka.MAX_VERTEX_ARRAY_LENGTH||n.sortKey!==a?this.createNewSegment(i,r,a):n}createNewSegment(t,i,r){let a={vertexOffset:t.length,primitiveOffset:i.length,vertexLength:0,primitiveLength:0,vaos:{}};return r!==void 0&&(a.sortKey=r),this._forceNewSegmentOnNextPrepare=!1,this.segments.push(a),a}getOrCreateLatestSegment(t,i,r){return this.prepareSegment(0,t,i,r)}forceNewSegmentOnNextPrepare(){this._forceNewSegmentOnNextPrepare=!0}get(){return this.segments}destroy(){for(let t of this.segments)for(let i in t.vaos)t.vaos[i].destroy()}static simpleSegment(t,i,r,a){return new ka([{vertexOffset:t,primitiveOffset:i,vertexLength:r,primitiveLength:a,vaos:{},sortKey:0}])}};Ke.MAX_VERTEX_ARRAY_LENGTH=2**16-1,G("SegmentVector",Ke);function sm(e,t){return e=he(Math.floor(e),0,255),t=he(Math.floor(t),0,255),256*e+t}const ZT=tt([{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"}]),qT=tt([{name:"a_dasharray_from",components:4,type:"Uint16"},{name:"a_dasharray_to",components:4,type:"Uint16"}]);var WT=ud((e,t)=>{function i(r,a){for(var n=r.length&3,s=r.length-n,o=a,l,u=3432918353,h=461845907,c,d=0;d<s;)c=r.charCodeAt(d)&255|(r.charCodeAt(++d)&255)<<8|(r.charCodeAt(++d)&255)<<16|(r.charCodeAt(++d)&255)<<24,++d,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,n){case 3:c^=(r.charCodeAt(d+2)&255)<<16;case 2:c^=(r.charCodeAt(d+1)&255)<<8;case 1:c^=r.charCodeAt(d)&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^=r.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}t!==void 0&&(t.exports=i)}),HT=ud((e,t)=>{function i(r,a){for(var n=r.length,s=a^n,o=0,l;n>=4;)l=r.charCodeAt(o)&255|(r.charCodeAt(++o)&255)<<8|(r.charCodeAt(++o)&255)<<16|(r.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,n-=4,++o;switch(n){case 3:s^=(r.charCodeAt(o+2)&255)<<16;case 2:s^=(r.charCodeAt(o+1)&255)<<8;case 1:s^=r.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}t.exports=i}),cc=wb(ud((e,t)=>{var i=WT(),r=HT();t.exports=i,t.exports.murmur3=i,t.exports.murmur2=r})()),y0=class v0{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(t,i,r,a){this.ids.push(om(t)),this.positions.push(i,r,a)}getPositions(t){if(!this.indexed)throw Error("Trying to get index, but feature positions are not indexed");let i=om(t),r=0,a=this.ids.length-1;for(;r<a;){let s=r+a>>1;this.ids[s]>=i?a=s:r=s+1}let n=[];for(;this.ids[r]===i;){let s=this.positions[3*r],o=this.positions[3*r+1],l=this.positions[3*r+2];n.push({index:s,start:o,end:l}),r++}return n}static serialize(t,i){let r=new Float64Array(t.ids),a=new Uint32Array(t.positions);return dc(r,a,0,r.length-1),i&&i.push(r.buffer,a.buffer),{ids:r,positions:a}}static deserialize(t){let i=new v0;return i.ids=t.ids,i.positions=t.positions,i.indexed=!0,i}};function om(e){let t=+e;return!isNaN(t)&&t<=2**53-1?t:(0,cc.default)(String(e))}function dc(e,t,i,r){for(;i<r;){let a=e[i+r>>1],n=i-1,s=r+1;for(;;){do n++;while(e[n]<a);do s--;while(e[s]>a);if(n>=s)break;uo(e,n,s),uo(t,3*n,3*s),uo(t,3*n+1,3*s+1),uo(t,3*n+2,3*s+2)}s-i<r-s?(dc(e,t,i,s),i=s+1):(dc(e,t,s+1,r),r=s)}}function uo(e,t,i){let r=e[t];e[t]=e[i],e[i]=r}G("FeaturePositionMap",y0);var vr=class{constructor(t,i){this.gl=t.gl,this.location=i}},K=class extends vr{constructor(t,i){super(t,i),this.current=0}set(t){this.current!==t&&(this.current=t,this.gl.uniform1i(this.location,t))}},U=class extends vr{constructor(t,i){super(t,i),this.current=0}set(t){this.current!==t&&(this.current=t,this.gl.uniform1f(this.location,t))}},_e=class extends vr{constructor(t,i){super(t,i),this.current=[0,0]}set(t){(t[0]!==this.current[0]||t[1]!==this.current[1])&&(this.current=t,this.gl.uniform2f(this.location,t[0],t[1]))}},Zt=class extends vr{constructor(t,i){super(t,i),this.current=[0,0,0]}set(t){(t[0]!==this.current[0]||t[1]!==this.current[1]||t[2]!==this.current[2])&&(this.current=t,this.gl.uniform3f(this.location,t[0],t[1],t[2]))}},fs=class extends vr{constructor(t,i){super(t,i),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]))}},Rr=class extends vr{constructor(t,i){super(t,i),this.current=de.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))}},lm=class extends vr{constructor(t,i){super(t,i),this.current=[]}set(t){if(t!=this.current){this.current=t;let i=new Float32Array(t.length*4);for(let r=0;r<t.length;r++)i[4*r]=t[r].r,i[4*r+1]=t[r].g,i[4*r+2]=t[r].b,i[4*r+3]=t[r].a;this.gl.uniform4fv(this.location,i)}}},um=class extends vr{constructor(t,i){super(t,i),this.current=[]}set(t){if(t!=this.current){this.current=t;let i=new Float32Array(t);this.gl.uniform1fv(this.location,i)}}};const XT=new Float32Array(16);var zi=class extends vr{constructor(t,i){super(t,i),this.current=XT}set(t){if(t[12]!==this.current[12]||t[0]!==this.current[0]){this.current=t,this.gl.uniformMatrix4fv(this.location,!1,t);return}for(let i=1;i<16;i++)if(t[i]!==this.current[i]){this.current=t,this.gl.uniformMatrix4fv(this.location,!1,t);break}}};function pc(e){return[sm(255*e.r,255*e.g),sm(255*e.b,255*e.a)]}var Un=class{constructor(t,i,r){this.value=t,this.uniformNames=i.map(a=>`u_${a}`),this.type=r}setUniform(t,i,r){t.set(r.constantOr(this.value))}getBinding(t,i,r){return this.type==="color"?new Rr(t,i):new U(t,i)}},Ur=class{constructor(t,i){this.uniformNames=i.map(r=>`u_${r}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(t,i){this.pixelRatioFrom=i.pixelRatio,this.pixelRatioTo=t.pixelRatio,this.patternFrom=i.tlbr,this.patternTo=t.tlbr}setConstantDashPositions(t,i){this.dashTo=[0,t.y,t.height,t.width],this.dashFrom=[0,i.y,i.height,i.width]}setUniform(t,i,r,a){let n=null;a==="u_pattern_to"?n=this.patternTo:a==="u_pattern_from"?n=this.patternFrom:a==="u_dasharray_to"?n=this.dashTo:a==="u_dasharray_from"?n=this.dashFrom:a==="u_pixel_ratio_to"?n=this.pixelRatioTo:a==="u_pixel_ratio_from"&&(n=this.pixelRatioFrom),n!==null&&t.set(n)}getBinding(t,i,r){return r.startsWith("u_pattern")||r.startsWith("u_dasharray_")?new fs(t,i):new U(t,i)}},ar=class{constructor(t,i,r,a){this.expression=t,this.type=r,this.maxValue=0,this.paintVertexAttributes=i.map(n=>({name:`a_${n}`,type:"Float32",components:r==="color"?2:1,offset:0})),this.paintVertexArray=new a}populatePaintArray(t,i,r){let a=this.paintVertexArray.length,n=this.expression.evaluate(new Be(0,r),i,{},r.canonical,[],r.formattedSection);this.paintVertexArray.resize(t),this._setPaintValue(a,t,n)}updatePaintArray(t,i,r,a,n){let s=this.expression.evaluate(new Be(0,n),r,a);this._setPaintValue(t,i,s)}_setPaintValue(t,i,r){if(this.type==="color"){let a=pc(r);for(let n=t;n<i;n++)this.paintVertexArray.emplace(n,a[0],a[1])}else{for(let a=t;a<i;a++)this.paintVertexArray.emplace(a,r);this.maxValue=Math.max(this.maxValue,Math.abs(r))}}upload(t){var i,r;(i=this.paintVertexArray)!=null&&i.arrayBuffer.byteLength&&((r=this.paintVertexBuffer)!=null&&r.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=t.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}},Pi=class{constructor(t,i,r,a,n,s){this.expression=t,this.uniformNames=i.map(o=>`u_${o}_t`),this.type=r,this.useIntegerZoom=a,this.zoom=n,this.maxValue=0,this.paintVertexAttributes=i.map(o=>({name:`a_${o}`,type:"Float32",components:r==="color"?4:2,offset:0})),this.paintVertexArray=new s}populatePaintArray(t,i,r){let a=this.expression.evaluate(new Be(this.zoom,r),i,{},r.canonical,[],r.formattedSection),n=this.expression.evaluate(new Be(this.zoom+1,r),i,{},r.canonical,[],r.formattedSection),s=this.paintVertexArray.length;this.paintVertexArray.resize(t),this._setPaintValue(s,t,a,n)}updatePaintArray(t,i,r,a,n){let s=this.expression.evaluate(new Be(this.zoom,n),r,a),o=this.expression.evaluate(new Be(this.zoom+1,n),r,a);this._setPaintValue(t,i,s,o)}_setPaintValue(t,i,r,a){if(this.type==="color"){let n=pc(r),s=pc(a);for(let o=t;o<i;o++)this.paintVertexArray.emplace(o,n[0],n[1],s[0],s[1])}else{for(let n=t;n<i;n++)this.paintVertexArray.emplace(n,r,a);this.maxValue=Math.max(this.maxValue,Math.abs(r),Math.abs(a))}}upload(t){var i,r;(i=this.paintVertexArray)!=null&&i.arrayBuffer.byteLength&&((r=this.paintVertexBuffer)!=null&&r.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,i){let r=this.useIntegerZoom?Math.floor(i.zoom):i.zoom,a=he(this.expression.interpolationFactor(r,this.zoom,this.zoom+1),0,1);t.set(a)}getBinding(t,i,r){return new U(t,i)}},Er=class{constructor(t,i,r,a,n,s){this.expression=t,this.type=i,this.useIntegerZoom=r,this.zoom=a,this.layerId=s,this.zoomInPaintVertexArray=new n,this.zoomOutPaintVertexArray=new n}populatePaintArray(t,i,r){let a=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(t),this.zoomOutPaintVertexArray.resize(t),this._setPaintValues(a,t,this.getPositionIds(i),r)}updatePaintArray(t,i,r,a,n){this._setPaintValues(t,i,this.getPositionIds(r),n)}_setPaintValues(t,i,r,a){let n=this.getPositions(a);if(!n||!r)return;let s=n[r.min],o=n[r.mid],l=n[r.max];if(s&&o&&l)for(let u=t;u<i;u++)this.emplace(this.zoomInPaintVertexArray,u,s,o),this.emplace(this.zoomOutPaintVertexArray,u,l,o)}upload(t){var i,r;if((i=this.zoomInPaintVertexArray)!=null&&i.arrayBuffer.byteLength&&((r=this.zoomOutPaintVertexArray)!=null&&r.arrayBuffer.byteLength)){let a=this.getVertexAttributes();this.zoomInPaintVertexBuffer=t.createVertexBuffer(this.zoomInPaintVertexArray,a,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=t.createVertexBuffer(this.zoomOutPaintVertexArray,a,this.expression.isStateDependent)}}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}},x0=class extends Er{getPositions(t){return t.imagePositions}getPositionIds(t){var i;return(i=t.patterns)==null?void 0:i[this.layerId]}getVertexAttributes(){return ZT.members}emplace(t,i,r,a){t.emplace(i,r.tlbr[0],r.tlbr[1],r.tlbr[2],r.tlbr[3],a.tlbr[0],a.tlbr[1],a.tlbr[2],a.tlbr[3],r.pixelRatio,a.pixelRatio)}},b0=class extends Er{getPositions(t){return t.dashPositions}getPositionIds(t){var i;return(i=t.dashes)==null?void 0:i[this.layerId]}getVertexAttributes(){return qT.members}emplace(t,i,r,a){t.emplace(i,0,r.y,r.height,r.width,0,a.y,a.height,a.width)}},w0=class{constructor(t,i,r){this.binders={},this._buffers=[];let a=[];for(let n in t.paint._values){if(!r(n))continue;let s=t.paint.get(n);if(!(s instanceof wi)||!en(s.property.specification))continue;let o=YT(n,t.type),l=s.value,u=s.property.specification.type,h=s.property.useIntegerZoom,c=s.property.specification["property-type"],d=c==="cross-faded"||c==="cross-faded-data-driven";if(l.kind==="constant")this.binders[n]=d?new Ur(l.value,o):new Un(l.value,o,u),a.push(`/u_${n}`);else if(l.kind==="source"||d){let p=hm(n,u,"source");this.binders[n]=d?n==="line-dasharray"?new b0(l,u,h,i,p,t.id):new x0(l,u,h,i,p,t.id):new ar(l,o,u,p),a.push(`/a_${n}`)}else{let p=hm(n,u,"composite");this.binders[n]=new Pi(l,o,u,h,i,p),a.push(`/z_${n}`)}}this.cacheKey=a.sort().join("")}getMaxValue(t){let i=this.binders[t];return i instanceof ar||i instanceof Pi?i.maxValue:0}populatePaintArrays(t,i,r){for(let a in this.binders){let n=this.binders[a];(n instanceof ar||n instanceof Pi||n instanceof Er)&&n.populatePaintArray(t,i,r)}}setConstantPatternPositions(t,i){for(let r in this.binders){let a=this.binders[r];a instanceof Ur&&a.setConstantPatternPositions(t,i)}}setConstantDashPositions(t,i){for(let r in this.binders){let a=this.binders[r];a instanceof Ur&&a.setConstantDashPositions(t,i)}}updatePaintArrays(t,i,r,a,n){let s=!1;for(let o of t){let l=i.getPositions(o.id);for(let u of l){let h=r.feature(u.index);for(let c in this.binders){let d=this.binders[c];(d instanceof ar||d instanceof Pi||d instanceof Er)&&d.expression.isStateDependent===!0&&(d.expression=a.paint.get(c).value,d.updatePaintArray(u.start,u.end,h,o.state,n),s=!0)}}}return s}defines(){let t=[];for(let i in this.binders){let r=this.binders[i];(r instanceof Un||r instanceof Ur)&&t.push(...r.uniformNames.map(a=>`#define HAS_UNIFORM_${a}`))}return t}getBinderAttributes(){let t=[];for(let i in this.binders){let r=this.binders[i];if(r instanceof ar||r instanceof Pi)for(let a of r.paintVertexAttributes)t.push(a.name);else if(r instanceof Er){let a=r.getVertexAttributes();for(let n of a)t.push(n.name)}}return t}getBinderUniforms(){let t=[];for(let i in this.binders){let r=this.binders[i];if(r instanceof Un||r instanceof Ur||r instanceof Pi)for(let a of r.uniformNames)t.push(a)}return t}getPaintVertexBuffers(){return this._buffers}getUniforms(t,i){let r=[];for(let a in this.binders){let n=this.binders[a];if(n instanceof Un||n instanceof Ur||n instanceof Pi){for(let s of n.uniformNames)if(i[s]){let o=n.getBinding(t,i[s],s);r.push({name:s,property:a,binding:o})}}}return r}setUniforms(t,i,r,a){for(let{name:n,property:s,binding:o}of i)this.binders[s].setUniform(o,a,r.get(s),n)}updatePaintBuffers(t){this._buffers=[];for(let i in this.binders){let r=this.binders[i];if(t&&r instanceof Er){let a=t.fromScale===2?r.zoomInPaintVertexBuffer:r.zoomOutPaintVertexBuffer;a&&this._buffers.push(a)}else(r instanceof ar||r instanceof Pi)&&r.paintVertexBuffer&&this._buffers.push(r.paintVertexBuffer)}}upload(t){for(let i in this.binders){let r=this.binders[i];(r instanceof ar||r instanceof Pi||r instanceof Er)&&r.upload(t)}this.updatePaintBuffers()}destroy(){for(let t in this.binders){let i=this.binders[t];(i instanceof ar||i instanceof Pi||i instanceof Er)&&i.destroy()}}},la=class{constructor(t,i,r=()=>!0){this.programConfigurations={};for(let a of t)this.programConfigurations[a.id]=new w0(a,i,r);this.needsUpload=!1,this._featureMap=new y0,this._bufferOffset=0}populatePaintArrays(t,i,r,a){for(let n in this.programConfigurations)this.programConfigurations[n].populatePaintArrays(t,i,a);i.id!==void 0&&this._featureMap.add(i.id,r,this._bufferOffset,t),this._bufferOffset=t,this.needsUpload=!0}updatePaintArrays(t,i,r,a){for(let n of r)this.needsUpload=this.programConfigurations[n.id].updatePaintArrays(t,this._featureMap,i,n,a)||this.needsUpload}get(t){return this.programConfigurations[t]}upload(t){if(this.needsUpload){for(let i in this.programConfigurations)this.programConfigurations[i].upload(t);this.needsUpload=!1}}destroy(){for(let t in this.programConfigurations)this.programConfigurations[t].destroy()}};function YT(e,t){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"]}[e]||[e.replace(`${t}-`,"").replace(/-/g,"_")]}function KT(e){return{"line-pattern":{source:Ca,composite:Ca},"fill-pattern":{source:Ca,composite:Ca},"fill-extrusion-pattern":{source:Ca,composite:Ca},"line-dasharray":{source:am,composite:am}}[e]}function hm(e,t,i){var a;let r={color:{source:ps,composite:uc},number:{source:ll,composite:ps}};return((a=KT(e))==null?void 0:a[i])||r[t][i]}G("ConstantBinder",Un),G("CrossFadedConstantBinder",Ur),G("SourceExpressionBinder",ar),G("CrossFadedPatternBinder",x0),G("CrossFadedDash
5arrayBinder",b0),G("CompositeExpressionBinder",Pi),G("ProgramConfiguration",w0,{omit:["_buffers"]}),G("ProgramConfigurationSet",la);const fc=2**14-1,cm=-fc-1;function pa(e){let t=L/e.extent,i=e.loadGeometry();for(let r of i)for(let a of r){let n=Math.round(a.x*t),s=Math.round(a.y*t);a.x=he(n,cm,fc),a.y=he(s,cm,fc),(n<a.x||n>a.x+1||s<a.y||s>a.y+1)&&xe("Geometry exceeds allowed extent, reduce your vector tile buffer size")}return i}function fa(e,t){return{type:e.type,id:e.id,properties:e.properties,geometry:t?pa(e):[]}}const dm=-32768;function JT(e,t,i,r,a){e.emplaceBack(dm+t*8+r,dm+i*8+a)}var Bd=class{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(i=>i.id),this.index=t.index,this.hasDependencies=!1,this.layoutVertexArray=new MT,this.indexArray=new er,this.segments=new Ke,this.programConfigurations=new la(t.layers,t.zoom),this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id)}populate(t,i,r){let a=this.layers[0],n=[],s=null,o=!1,l=a.type==="heatmap";if(a.type==="circle"){let d=a;s=d.layout.get("circle-sort-key"),o=!s.isConstant(),l||(l=d.paint.get("circle-pitch-alignment")==="map")}let u=l?i.subdivisionGranularity.circle:1,h=new Be(this.zoom),c=this.layers[0]._featureFilter.needGeometry;for(let{feature:d,id:p,index:f,sourceLayerIndex:m}of t){let g=fa(d,c);if(!this.layers[0]._featureFilter.filter(h,g,r))continue;let _=o?s.evaluate(g,{},r):void 0,y={id:p,properties:d.properties,type:d.type,sourceLayerIndex:m,index:f,geometry:c?g.geometry:pa(d),patterns:{},sortKey:_};n.push(y)}o&&n.sort((d,p)=>d.sortKey-p.sortKey);for(let d of n){let{geometry:p,index:f,sourceLayerIndex:m}=d,g=t[f].feature;this.addFeature(d,p,f,r,u),i.featureIndex.insert(g,p,f,m,this.index)}}update(t,i,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,i,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,GT),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,i,r,a,n=1){let s;switch(n){case 1:s=[0,7];break;case 3:s=[0,2,5,7];break;case 5:s=[0,1,3,4,6,7];break;case 7:s=[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 o=s.length;for(let l of i)for(let u of l){let h=u.x,c=u.y;if(h<0||h>=8192||c<0||c>=8192)continue;let d=this.segments.prepareSegment(o*o,this.layoutVertexArray,this.indexArray,t.sortKey),p=d.vertexLength;for(let f=0;f<o;f++)for(let m=0;m<o;m++)JT(this.layoutVertexArray,h,c,s[m],s[f]);for(let f=0;f<o-1;f++)for(let m=0;m<o-1;m++){let g=p+f*o+m,_=p+(f+1)*o+m;this.indexArray.emplaceBack(g,_+1,g+1),this.indexArray.emplaceBack(g,_,_+1)}d.vertexLength+=o*o,d.primitiveLength+=(o-1)*(o-1)*2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,r,{imagePositions:{},canonical:a})}};G("CircleBucket",Bd,{omit:["layers"]});function T0(e,t){for(let i of e)if(an(t,i))return!0;for(let i of t)if(an(e,i))return!0;return Od(e,t)}function Hl(e,t,i){return an(e,t)?!0:mc(t,e,i)}function E0(e,t){if(e.length===1)return pm(t,e[0]);for(let i of t)for(let r of i)if(an(e,r))return!0;for(let i of e)if(pm(t,i))return!0;for(let i of t)if(Od(e,i))return!0;return!1}function QT(e,t,i){for(let r of t){if(e.length>=3){for(let a of r)if(an(e,a))return!0}if(eE(e,r,i))return!0}return!1}function eE(e,t,i){if(e.length>1){if(Od(e,t))return!0;for(let r of t)if(mc(r,e,i))return!0}for(let r of e)if(mc(r,t,i))return!0;return!1}function Od(e,t){if(e.length===0||t.length===0)return!1;for(let i=0;i<e.length-1;i++){let r=e[i],a=e[i+1];for(let n=0;n<t.length-1;n++){let s=t[n],o=t[n+1];if(tE(r,a,s,o))return!0}}return!1}function tE(e,t,i,r){return Cr(e,i,r)!==Cr(t,i,r)&&Cr(e,t,i)!==Cr(e,t,r)}function mc(e,t,i){let r=i*i;if(t.length===1)return e.distSqr(t[0])<r;for(let a=1;a<t.length;a++){let n=t[a-1],s=t[a];if(S0(e,n,s)<r)return!0}return!1}function S0(e,t,i){let r=t.distSqr(i);if(r===0)return e.distSqr(t);let a=((e.x-t.x)*(i.x-t.x)+(e.y-t.y)*(i.y-t.y))/r;return a<0?e.distSqr(t):a>1?e.distSqr(i):e.distSqr(i.sub(t)._mult(a)._add(t))}function pm(e,t){let i=!1,r,a,n;for(let s of e){r=s;for(let o=0,l=r.length-1;o<r.length;l=o++)a=r[o],n=r[l],a.y>t.y!=n.y>t.y&&t.x<(n.x-a.x)*(t.y-a.y)/(n.y-a.y)+a.x&&(i=!i)}return i}function an(e,t){let i=!1;for(let r=0,a=e.length-1;r<e.length;a=r++){let n=e[r],s=e[a];n.y>t.y!=s.y>t.y&&t.x<(s.x-n.x)*(t.y-n.y)/(s.y-n.y)+n.x&&(i=!i)}return i}function iE(e,t,i,r,a){for(let s of e)if(t<=s.x&&i<=s.y&&r>=s.x&&a>=s.y)return!0;let n=[new A(t,i),new A(t,a),new A(r,a),new A(r,i)];if(e.length>2){for(let s of n)if(an(e,s))return!0}for(let s=0;s<e.length-1;s++){let o=e[s],l=e[s+1];if(rE(o,l,n))return!0}return!1}function rE(e,t,i){let r=i[0],a=i[2];if(e.x<r.x&&t.x<r.x||e.x>a.x&&t.x>a.x||e.y<r.y&&t.y<r.y||e.y>a.y&&t.y>a.y)return!1;let n=Cr(e,t,i[0]);return n!==Cr(e,t,i[1])||n!==Cr(e,t,i[2])||n!==Cr(e,t,i[3])}function Na(e,t,i){let r=t.paint.get(e).value;return r.kind==="constant"?r.value:i.programConfigurations.get(t.id).getMaxValue(e)}function Xl(e){return Math.sqrt(e[0]*e[0]+e[1]*e[1])}function Yl(e,t,i,r,a){if(!t[0]&&!t[1])return e;let n=A.convert(t)._mult(a);i==="viewport"&&n._rotate(-r);let s=[];for(let o of e)s.push(o.sub(n));return s}function aE(e){let t=[];for(let i=0;i<e.length;i++){let r=e[i],a=t.at(-1);
vendor: 63,808 bytes, line 5
5(i===0||a&&!r.equals(a))&&t.push(r)}return t}function nE(e,t){let i=[];for(let r of e){let a=aE(r),n=[];for(let s=0;s<a.length;s++){let o=a[s],l=a[s-1],u=a[s+1],h=s===0?new A(0,0):o.sub(l)._unit()._perp(),c=s===a.length-1?new A(0,0):u.sub(o)._unit()._perp(),d=h._add(c)._unit(),p=d.x*c.x+d.y*c.y;p!==0&&d._mult(1/p),n.push(d._mult(t)._add(o))}i.push(n)}return i}function sE({queryGeometry:e,size:t},i){return Hl(e,i,t)}function oE({queryGeometry:e,size:t,transform:i,unwrappedTileID:r,getElevation:a},n){return Hl(e,n,t*(i.projectTileCoordinates(n.x,n.y,r,a==null?void 0:a(n.x,n.y)).signedDistanceFromCamera/i.cameraToCenterDistance))}function lE({queryGeometry:e,size:t,transform:i,unwrappedTileID:r,getElevation:a},n){let s=i.projectTileCoordinates(n.x,n.y,r,a==null?void 0:a(n.x,n.y)).signedDistanceFromCamera,o=t*(i.cameraToCenterDistance/s);return Hl(e,$d(n,i,r,a),o)}function uE({queryGeometry:e,size:t,transform:i,unwrappedTileID:r,getElevation:a},n){return Hl(e,$d(n,i,r,a),t)}function D0({queryGeometry:e,size:t,transform:i,unwrappedTileID:r,getElevation:a,pitchAlignment:n="map",pitchScale:s="map"},o){let l=n==="map"?s==="map"?sE:oE:s==="map"?lE:uE,u={queryGeometry:e,size:t,transform:i,unwrappedTileID:r,getElevation:a};for(let h of o)for(let c of h)if(l(u,c))return!0;return!1}function $d(e,t,i,r){let a=t.projectTileCoordinates(e.x,e.y,i,r==null?void 0:r(e.x,e.y)).point;return new A((a.x*.5+.5)*t.width,(-a.y*.5+.5)*t.height)}function hE(e,t,i,r){return e.map(a=>$d(a,t,i,r))}let cE;const dE=()=>cE||(cE=new Dt({"circle-sort-key":new ee(z.layout_circle["circle-sort-key"],"circle-sort-key")}));let pE;const fE=()=>pE||(pE=new Dt({"circle-radius":new ee(z.paint_circle["circle-radius"],"circle-radius"),"circle-color":new ee(z.paint_circle["circle-color"],"circle-color"),"circle-blur":new ee(z.paint_circle["circle-blur"],"circle-blur"),"circle-opacity":new ee(z.paint_circle["circle-opacity"],"circle-opacity"),"circle-translate":new N(z.paint_circle["circle-translate"],"circle-translate"),"circle-translate-anchor":new N(z.paint_circle["circle-translate-anchor"],"circle-translate-anchor"),"circle-pitch-scale":new N(z.paint_circle["circle-pitch-scale"],"circle-pitch-scale"),"circle-pitch-alignment":new N(z.paint_circle["circle-pitch-alignment"],"circle-pitch-alignment"),"circle-stroke-width":new ee(z.paint_circle["circle-stroke-width"],"circle-stroke-width"),"circle-stroke-color":new ee(z.paint_circle["circle-stroke-color"],"circle-stroke-color"),"circle-stroke-opacity":new ee(z.paint_circle["circle-stroke-opacity"],"circle-stroke-opacity")}));var mE={get paint(){return fE()},get layout(){return dE()}};const gE=e=>e.type==="circle";var _E=class extends Li{constructor(t,i){super(t,mE,i)}createBucket(t){return new Bd(t)}queryRadius(t){let i=t;return Na("circle-radius",this,i)+Na("circle-stroke-width",this,i)+Xl(this.paint.get("circle-translate"))}queryIntersectsFeature({queryGeometry:t,feature:i,featureState:r,geometry:a,transform:n,pixelsToTileUnits:s,unwrappedTileID:o,getElevation:l}){let u=Yl(t,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),-n.bearingInRadians,s),h=this.paint.get("circle-radius").evaluate(i,r)+this.paint.get("circle-stroke-width").evaluate(i,r),c=this.paint.get("circle-pitch-scale"),d=this.paint.get("circle-pitch-alignment"),p,f;return d==="map"?(p=u,f=h*s):(p=hE(u,n,o,l),f=h),D0({queryGeometry:p,size:f,transform:n,unwrappedTileID:o,getElevation:l,pitchAlignment:d,pitchScale:c},a)}},C0=class extends Bd{};G("HeatmapBucket",C0,{omit:["layers"]});let yE;const vE=()=>yE||(yE=new Dt({"heatmap-radius":new ee(z.paint_heatmap["heatmap-radius"],"heatmap-radius"),"heatmap-weight":new ee(z.paint_heatmap["heatmap-weight"],"heatmap-weight"),"heatmap-intensity":new N(z.paint_heatmap["heatmap-intensity"],"heatmap-intensity"),"heatmap-color":new Wl(z.paint_heatmap["heatmap-color"],"heatmap-color"),"heatmap-opacity":new N(z.paint_heatmap["heatmap-opacity"],"heatmap-opacity")}));var xE={get paint(){return vE()}};function jd(e,{width:t,height:i},r,a){if(!a)a=new Uint8Array(t*i*r);else if(a instanceof Uint8ClampedArray)a=new Uint8Array(a.buffer);else if(a.length!==t*i*r)throw RangeError(`mismatched image size. expected: ${a.length} but got: ${t*i*r}`);return e.width=t,e.height=i,e.data=a,e}function P0(e,{width:t,height:i},r){if(t===e.width&&i===e.height)return;let a=jd({},{width:t,height:i},r);Vd(e,a,{x:0,y:0},{x:0,y:0},{width:Math.min(e.width,t),height:Math.min(e.height,i)},r),e.width=t,e.height=i,e.data=a.data}function Vd(e,t,i,r,a,n){if(a.width===0||a.height===0)return t;if(a.width>e.width||a.height>e.height||i.x>e.width-a.width||i.y>e.height-a.height)throw RangeError("out of range source coordinates for image copy");if(a.width>t.width||a.height>t.height||r.x>t.width-a.width||r.y>t.height-a.height)throw RangeError("out of range destination coordinates for image copy");let s=e.data,o=t.data;if(s===o)throw Error("srcData equals dstData, so image is already copied");for(let l=0;l<a.height;l++){let u=((i.y+l)*e.width+i.x)*n,h=((r.y+l)*t.width+r.x)*n;for(let c=0;c<a.width*n;c++)o[h+c]=s[u+c]}return t}var Nd=class A0{constructor(t,i){jd(this,t,1,i)}resize(t){P0(this,t,1)}clone(){return new A0({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,i,r,a,n){Vd(t,i,r,a,n,1)}},Ze=class I0{constructor(t,i){jd(this,t,4,i)}resize(t){P0(this,t,4)}replace(t,i){i?this.data.set(t):this.data=t instanceof Uint8ClampedArray?new Uint8Array(t.buffer):t}clone(){return new I0({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,i,r,a,n){Vd(t,i,r,a,n,4)}setPixel(t,i,r){let a=(t*this.width+i)*4;this.data[a+0]=Math.round(r.r*255/r.a),this.data[a+1]=Math.round(r.g*255/r.a),this.data[a+2]=Math.round(r.b*255/r.a),this.data[a+3]=Math.round(r.a*255)}};function Hu(e){let t=new Uint8Array(e.length);for(let i=0;i<e.length;i+=4){let r=e[i+3];t[i+0]=Math.round(e[i+0]*r/255),t[i+1]=Math.round(e[i+1]*r/255),t[i+2]=Math.round(e[i+2]*r/255),t[i+3]=r}return t}G("AlphaImage",Nd),G("RGBAImage",Ze);function M0(e){let t={},i=e.resolution||256,r=e.clips?e.clips.length:1,a=e.image||new Ze({width:i,height:r});if(!tw(i))throw Error(`width is not a power of 2 - ${i}`);let n=(s,o,l)=>{t[e.evaluationKey]=l;let u=e.expression.evaluate(t);a.setPixel(s/4/i,o/4,u)};if(e.clips)for(let s=0,o=0;s<r;++s,o+=i*4)for(let l=0,u=0;l<i;l++,u+=4){let h=l/(i-1),{start:c,end:d}=e.clips[s],p=c*(1-h)+d*h;n(o,u,p)}else for(let s=0,o=0;s<i;s++,o+=4){let l=s/(i-1);n(0,o,l)}return a}const ul="big-fb",bE=e=>e.type==="heatmap";var wE=class extends Li{createBucket(t){return new C0(t)}constructor(t,i){super(t,xE,i),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=M0({expression:t,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbos.has("big-fb")&&this.heatmapFbos.delete(ul)}queryRadius(t){return Na("heatmap-radius",this,t)}queryIntersectsFeature({queryGeometry:t,feature:i,featureState:r,geometry:a,transform:n,pixelsToTileUnits:s,unwrappedTileID:o,getElevation:l}){return D0({queryGeometry:t,size:this.paint.get("heatmap-radius").evaluate(i,r)*s,transform:n,unwrappedTileID:o,getElevation:l},a)}hasOffscreenPass(){return this.paint.get("heatmap-opacity")!==0&&!this.isHidden()}};let TE;const EE=()=>TE||(TE=new Dt({"hillshade-illumination-direction":new N(z.paint_hillshade["hillshade-illumination-direction"],"hillshade-illumination-direction"),"hillshade-illumination-altitude":new N(z.paint_hillshade["hillshade-illumination-altitude"],"hillshade-illumination-altitude"),"hillshade-illumination-anchor":new N(z.paint_hillshade["hillshade-illumination-anchor"],"hillshade-illumination-anchor"),"hillshade-exaggeration":new N(z.paint_hillshade["hillshade-exaggeration"],"hillshade-exaggeration"),"hillshade-shadow-color":new N(z.paint_hillshade["hillshade-shadow-color"],"hillshade-shadow-color"),"hillshade-highlight-color":new N(z.paint_hillshade["hillshade-highlight-color"],"hillshade-highlight-color"),"hillshade-accent-color":new N(z.paint_hillshade["hillshade-accent-color"],"hillshade-accent-color"),"hillshade-method":new N(z.paint_hillshade["hillshade-method"],"hillshade-method"),resampling:new N(z.paint_hillshade.resampling,"resampling")}));var SE={get paint(){return EE()}};const DE=e=>e.type==="hillshade";var CE=class extends Li{constructor(t,i){super(t,SE,i),this.recalculate({zoom:0,zoomHistory:{}},void 0)}getIlluminationProperties(){let t=this.paint.get("hillshade-illumination-direction").values,i=this.paint.get("hillshade-illumination-altitude").values,r=this.paint.get("hillshade-highlight-color").values,a=this.paint.get("hillshade-shadow-color").values,n=Math.max(t.length,i.length,r.length,a.length);t=t.concat(Array(n-t.length).fill(t.at(-1))),i=i.concat(Array(n-i.length).fill(i.at(-1))),r=r.concat(Array(n-r.length).fill(r.at(-1))),a=a.concat(Array(n-a.length).fill(a.at(-1)));let s=i.map(Xe);return{directionRadians:t.map(Xe),altitudeRadians:s,shadowColor:a,highlightColor:r}}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&!this.isHidden()}};let PE;const AE=()=>PE||(PE=new Dt({"color-relief-opacity":new N(z["paint_color-relief"]["color-relief-opacity"],"color-relief-opacity"),"color-relief-color":new Wl(z["paint_color-relief"]["color-relief-color"],"color-relief-color"),resampling:new N(z["paint_color-relief"].resampling,"resampling")}));var IE={get paint(){return AE()}};function ho(e){return"data"in e}var gt=class{constructor(t,i,r,a){this.context=t,this.format=r,this.texture=t.gl.createTexture(),this._ownedHandle=this.texture,this.update(i,a)}update(t,i,r){var h;let{width:a,height:n}=t,s=(((h=this.size)==null?void 0:h[0])!==a||this.size[1]!==n)&&!r,{context:o}=this,{gl:l}=o;this.useMipmap=!!(i!=null&&i.useMipmap),s&&this.size&&this.format===l.RGBA&&(l.deleteTexture(this.texture),this.texture=l.createTexture(),this._ownedHandle=this.texture,this.magFilter=void 0,this.minFilter=void 0,this.wrap=void 0),l.bindTexture(l.TEXTURE_2D,this.texture),o.pixelStoreUnpackFlipY.set(!1),o.pixelStoreUnpack.set(1);let u=this.format===l.RGBA&&(i==null?void 0:i.premultiply)!==!1;if(s)if(this.size=[a,n],this.format===l.RGBA&&a>0&&n>0){let c=this.useMipmap?Math.floor(Math.log2(Math.max(a,n)))+1:1;if(l.texStorage2D(l.TEXTURE_2D,c,l.RGBA8,a,n),ho(t)){o.pixelStoreUnpackPremultiplyAlpha.set(!1);let{data:d}=t;u&&d&&(d=Hu(d)),d&&l.texSubImage2D(l.TEXTURE_2D,0,0,0,a,n,l.RGBA,l.UNSIGNED_BYTE,d)}else o.pixelStoreUnpackPremultiplyAlpha.set(u),l.texSubImage2D(l.TEXTURE_2D,0,0,0,l.RGBA,l.UNSIGNED_BYTE,t)}else ho(t)?(o.pixelStoreUnpackPremultiplyAlpha.set(!1),this._uploadRawData(t,u,a,n,l)):(o.pixelStoreUnpackPremultiplyAlpha.set(u),this._uploadDomImage(t,l));else{let{x:c,y:d}=r||{x:0,y:0};ho(t)?(o.pixelStoreUnpackPremultiplyAlpha.set(!1),this._updateRawData(t,u,c,d,a,n,l)):(o.pixelStoreUnpackPremultiplyAlpha.set(u),this._updateDomImage(t,c,d,l))}this.useMipmap&&!(ho(t)&&t.data===null)&&l.generateMipmap(l.TEXTURE_2D),o.pixelStoreUnpackFlipY.setDefault(),o.pixelStoreUnpack.setDefault(),o.pixelStoreUnpackPremultiplyAlpha.setDefault()}_uploadDomImage(t,i){i.texImage2D(i.TEXTURE_2D,0,this.format,this.format,i.UNSIGNED_BYTE,t)}_uploadRawData(t,i,r,a,n){let{data:s}=t;i&&s&&(s=Hu(s)),n.texImage2D(n.TEXTURE_2D,0,this.format,r,a,0,this.format,n.UNSIGNED_BYTE,s)}_updateDomImage(t,i,r,a){a.texSubImage2D(a.TEXTURE_2D,0,i,r,a.RGBA,a.UNSIGNED_BYTE,t)}_updateRawData(t,i,r,a,n,s,o){let{data:l}=t;i&&l&&(l=Hu(l)),o.texSubImage2D(o.TEXTURE_2D,0,r,a,n,s,o.RGBA,o.UNSIGNED_BYTE,l)}bind(t,i,r){let{context:a}=this,{gl:n}=a;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 s=r||t;t!==this.magFilter&&(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,t),this.magFilter=t),s!==this.minFilter&&(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,s),this.minFilter=s),i!==this.wrap&&(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,i),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,i),this.wrap=i)}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}},pr,ME=(pr=class{constructor(t,i,r,a=1,n=1,s=1,o=0){if(this.uid=t,i.height!==i.width)throw RangeError("DEM tiles must be square");if(r&&!["mapbox","terrarium","custom"].includes(r)){xe(`"${r}" is not a valid encoding type. Valid types include "mapbox", "terrarium" and "custom".`);return}this.stride=i.height;let l=this.dim=i.height-4;switch(this.data=new Uint32Array(i.data.buffer),pr.byteViewCache.set(this,new Uint8Array(this.data.buffer)),r){case"terrarium":this.redFactor=256,this.greenFactor=1,this.blueFactor=1/256,this.baseShift=32768;break;case"custom":this.redFactor=a,this.greenFactor=n,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=-9007199254740991;for(let h=0;h<l;h++)for(let c=0;c<l;c++){let d=this._idx(h,c)*4,p=this._unpackAtIndex(u,d);p>this.max&&(this.max=p),p<this.min&&(this.min=p)}}get(t,i){let r=this._getByteView(),a=this._idx(t,i)*4;return this._unpackAtIndex(r,a)}sampleBilinear(t,i){let r=Math.floor(t),a=Math.floor(i);if(r<-1||r>=this.dim||a<-1||a>=this.dim)throw RangeError(`Out of range source coordinates for DEM data. x: ${t}, y: ${i}, dim: ${this.dim}`);let n=this._getByteView(),s=((a+2)*this.stride+r+2)*4,o=this.stride*4,l=t-r,u=i-a,h=this._unpackAtIndex(n,s),c=this._unpackAtIndex(n,s+4),d=this._unpackAtIndex(n,s+o),p=this._unpackAtIndex(n,s+o+4);return h*(1-l)*(1-u)+c*l*(1-u)+d*(1-l)*u+p*l*u}getUnpackVector(){return[this.redFactor,this.greenFactor,this.blueFactor,this.baseShift]}_idx(t,i){if(t<-2||t>=this.dim+2||i<-2||i>=this.dim+2)throw RangeError(`Out of range source coordinates for DEM data. x: ${t}, y: ${i}, dim: ${this.dim}`);return(i+2)*this.stride+(t+2)}unpack(t,i,r){return t*this.redFactor+i*this.greenFactor+r*this.blueFactor-this.baseShift}pack(t){return F0(t,this.getUnpackVector())}getPixels(){return new Ze({width:this.stride,height:this.stride},this._getByteView())}backfillBorder(t,i,r){if(this.dim!==t.dim)throw Error("dem dimension mismatch");let a=i*this.dim,n=i*this.dim+this.dim,s=r*this.dim,o=r*this.dim+this.dim;switch(i){case-1:a=n-2;break;case 1:n=a+2}switch(r){case-1:s=o-2;break;case 1:o=s+2}let l=-i*this.dim,u=-r*this.dim;for(let h=s;h<o;h++)for(let c=a;c<n;c++)this.data[this._idx(c,h)]=t.data[this._idx(c+l,h+u)]}_getByteView(){let t=pr.byteViewCache.get(this);return(t==null?void 0:t.buffer)!==this.data.buffer&&(t=new Uint8Array(this.data.buffer),pr.byteViewCache.set(this,t)),t}_unpackAtIndex(t,i){return this.unpack(t[i],t[i+1],t[i+2])}},pr.byteViewCache=new WeakMap,pr);function F0(e,t){let i=t[0],r=t[1],a=t[2],n=t[3],s=Math.min(i,r,a),o=Math.round((e+n)/s);return{r:Math.floor(o*s/i)%256,g:Math.floor(o*s/r)%256,b:Math.floor(o*s/a)%256}}G("DEMData",ME);const FE=e=>e.type==="color-relief";var zE=class extends Li{constructor(t,i){super(t,IE,i)}_createColorRamp(t){let i={elevationStops:[],colorStops:[]},r=this._transitionablePaint._values["color-relief-color"].value.expression;if(r instanceof ls&&r._styleExpression.expression instanceof Ei){this.colorRampExpression=r;let s=r._styleExpression.expression;i.elevationStops=s.labels,i.colorStops=[];for(let o of i.elevationStops)i.colorStops.push(s.evaluate({globals:{elevation:o}}))}if(i.elevationStops.length<1&&(i.elevationStops=[0],i.colorStops=[de.transparent]),i.elevationStops.length<2&&(i.elevationStops.push(i.elevationStops[0]+1),i.colorStops.push(i.colorStops[0])),i.elevationStops.length<=t)return i;let a={elevationStops:[],colorStops:[]},n=(i.elevationStops.length-1)/(t-1);for(let s=0;s<i.elevationStops.length-.5;s+=n)a.elevationStops.push(i.elevationStops[Math.round(s)]),a.colorStops.push(i.colorStops[Math.round(s)]);return xe(`Too many colors in specification of ${this.id} color-relief layer, may not render properly. Max possible colors: ${t}, provided: ${i.elevationStops.length}`),a}_colorRampChanged(){return this.colorRampExpression!=this._transitionablePaint._values["color-relief-color"].value.expression}getColorRampTextures(t,i,r){if(this.colorRampTextures&&!this._colorRampChanged())return this.colorRampTextures;let a=this._createColorRamp(i),n=new Ze({width:a.colorStops.length,height:1}),s=new Ze({width:a.colorStops.length,height:1});for(let o=0;o<a.elevationStops.length;o++){let l=F0(a.elevationStops[o],r);s.setPixel(0,o,new de(l.r/255,l.g/255,l.b/255,1)),n.setPixel(0,o,a.colorStops[o])}return this.colorRampTextures={elevationTexture:new gt(t,s,t.gl.RGBA),colorTexture:new gt(t,n,t.gl.RGBA)},this.colorRampTextures}hasOffscreenPass(){return!this.isHidden()&&!!this.colorRampTextures}};const RE=tt([{name:"a_pos",components:2,type:"Int16"}],4),kE=RE.members;function hl(e,t,i){let r=i.patternDependencies,a=!1;for(let n of t){let s=n.paint.get(`${e}-pattern`);s.isConstant()||(a=!0);let o=s.constantOr(null);o&&(a=!0,r[o.to]=!0,r[o.from]=!0)}return a}function Ud(e,t,i,r,a){let{zoom:n}=r,s=a.patternDependencies;for(let o of t){let l=o.paint.get(`${e}-pattern`).value;if(l.kind!=="constant"){let u=l.evaluate({zoom:n-1},i,{},a.availableImages),h=l.evaluate({zoom:n},i,{},a.availableImages),c=l.evaluate({zoom:n+1},i,{},a.availableImages);u=u!=null&&u.name?u.name:u,h=h!=null&&h.name?h.name:h,c=c!=null&&c.name?c.name:c,s[u]=!0,s[h]=!0,s[c]=!0,i.patterns[o.id]={min:u,mid:h,max:c}}}return i}const ms=new Set;let gc=!1;function LE(e,t,i=2){let r=t&&t.length,a=r?t[0]*i:e.length;ms.size&&ms.clear();let n=z0(e,0,a,i,!0),s=[];if(!n||n.next===n.prev)return s;let o=0,l=0,u=0;if(r&&(n=VE(e,t,n,i)),e.length>80*i){o=e[0],l=e[1];let h=o,c=l;for(let d=i;d<a;d+=i){let p=e[d],f=e[d+1];p<o&&(o=p),f<l&&(l=f),p>h&&(h=p),f>c&&(c=f)}u=Math.max(h-o,c-l),u=u===0?0:32767/u}return _c(n,s,o,l,u),s}function z0(e,t,i,r,a){let n=null;if(a===eS(e,t,i,r)>0)for(let s=t;s<i;s+=r)n=gm(s/r|0,e[s],e[s+1],n);else for(let s=i-r;s>=t;s-=r)n=gm(s/r|0,e[s],e[s+1],n);return n&&gs(n,n.next)&&(ys(n),n=n.next),n}function ua(e,t=e){let i=t===e,r=e,a;do a=!1,r!==r.next&&(ms.size===0||!ms.has(r))&&(gs(r,r.next)||mt(r.prev,r,r.next)===0)?((i||r===t)&&(t=r.prev),gc=!0,ys(r),r=r.prev,a=!0):(i||r!==t)&&(r=r.next,a=!i);while(a||r!==t);return t}function _c(e,t,i,r,a){a&&HE(e,i,r,a);let n=e,s=!1;for(;e.prev!==e.next;){let o=e.prev,l=e.next;if(mt(o,e,l)<0&&(a?OE(e,i,r,a):BE(e))){t.push(o.i,e.i,l.i),ys(e),e=l,n=l;continue}if(e=l,e===n){if(gc=!1,e=ua(e),gc){n=e;continue}if(!s){e=$E(e,t),n=e,s=!0;continue}jE(e,t,i,r,a);break}}}function BE(e){let t=e.prev,i=e,r=e.next,a=t.x,n=i.x,s=r.x,o=t.y,l=i.y,u=r.y,h=Math.min(a,n,s),c=Math.min(o,l,u),d=Math.max(a,n,s),p=Math.max(o,l,u),f=r.next;for(;f!==t;){if(f.x>=h&&f.x<=d&&f.y>=c&&f.y<=p&&(a!==f.x||o!==f.y)&&dl(a,o,n,l,s,u,f.x,f.y)&&mt(f.prev,f,f.next)>=0)return!1;f=f.next}return!0}function OE(e,t,i,r){let a=e.prev,n=e,s=e.next,o=a.x,l=n.x,u=s.x,h=a.y,c=n.y,d=s.y,p=Math.min(o,l,u),f=Math.min(h,c,d),m=Math.max(o,l,u),g=Math.max(h,c,d),_=bc(p,f,t,i,r),y=bc(m,g,t,i,r),x=e.prevZ;for(;x&&x.z>=_;){if(x.x>=p&&x.x<=m&&x.y>=f&&x.y<=g&&x!==s&&(o!==x.x||h!==x.y)&&dl(o,h,l,c,u,d,x.x,x.y)&&mt(x.prev,x,x.next)>=0)return!1;x=x.prevZ}let v=e.nextZ;for(;v&&v.z<=y;){if(v.x>=p&&v.x<=m&&v.y>=f&&v.y<=g&&v!==s&&(o!==v.x||h!==v.y)&&dl(o,h,l,c,u,d,v.x,v.y)&&mt(v.prev,v,v.next)>=0)return!1;v=v.nextZ}return!0}function $E(e,t){let i=e,r=!1;do{let a=i.prev,n=i.next.next;k0(a,i,i.next,n,!1)&&_s(a,n)&&_s(n,a)&&(t.push(a.i,i.i,n.i),ys(i),ys(i.next),i=e=n,r=!0),i=i.next}while(i!==e);return r?ua(i):i}function jE(e,t,i,r,a){let n=e;do{let s=n.next.next;for(;s!==n.prev;){if(n.i!==s.i&&KE(n,s)){let o=L0(n,s);n=ua(n,n.next),o=ua(o,o.next),_c(n,t,i,r,a),_c(o,t,i,r,a);return}s=s.next}n=n.next}while(n!==e)}let yc=!1;function VE(e,t,i,r){let a=[];for(let n=0,s=t.length;n<s;n++){let o=z0(e,t[n]*r,n<s-1?t[n+1]*r:e.length,r,!1);o===o.next&&ms.add(o),a.push(YE(o))}a.sort(NE),GE(e.length/r,t.length),R0(i,i),yc=!0;for(let n=0;n<a.length;n++)i=UE(a[n],i);return yc=!1,ua(i)}function NE(e,t){return e.x-t.x||e.y-t.y||(e.next.y-e.y)/(e.next.x-e.x)-(t.next.y-t.y)/(t.next.x-t.x)}function UE(e,t){let i=qE(e,t);if(!i)return t;let r=L0(i,e),a=r.next;return R0(i,a.next),ua(r,r.next),ua(i,i.next)}let ot=new Float64Array,cl=0;const vc=[],xc=[];function GE(e,t){let i=Math.ceil((e+2*t)/16)+t+2;ot.length<i*4&&(ot=new Float64Array(i*4)),cl=0}function R0(e,t){let i=e;do{let r=cl++;vc[r]=i;let a=1/0,n=1/0,s=-1/0,o=-1/0,l=0;do{let h=i.next;i.z=r,i.x<a&&(a=i.x),i.x>s&&(s=i.x),i.y<n&&(n=i.y),i.y>o&&(o=i.y),h.x<a&&(a=h.x),h.x>s&&(s=h.x),h.y<n&&(n=h.y),h.y>o&&(o=h.y),i=h}while(++l<16&&i!==t);xc[r]=i;let u=r*4;ot[u]=a,ot[u+1]=n,ot[u+2]=s,ot[u+3]=o}while(i!==t)}function ZE(e,t){let i=e.z*4;t.x<ot[i]&&(ot[i]=t.x),t.y<ot[i+1]&&(ot[i+1]=t.y),t.x>ot[i+2]&&(ot[i+2]=t.x),t.y>ot[i+3]&&(ot[i+3]=t.y)}function fm(e){let t=xc[e];for(;t.prev.next!==t;)t=t.next;return xc[e]=t,t}function mm(e){let t=vc[e];for(;t.prev.next!==t;)t=t.next;return vc[e]=t,t}function qE(e,t){let i=t,r=e.x,a=e.y,n=-1/0,s;if(gs(e,i))return i;for(let d=0,p=0;d<cl;d++,p+=4){if(a<ot[p+1]||a>ot[p+3]||ot[p]>r||ot[p+2]<=n)continue;let f=fm(d);i=mm(d);do{if(i.prev.next===i){if(gs(e,i.next))return i.next;if(a<=i.y&&a>=i.next.y&&i.next.y!==i.y){let m=i.x+(a-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(m<=r&&m>n&&(n=m,s=i.x<i.next.x?i:i.next,m===r))return s}}i=i.next}while(i!==f)}if(!s)return null;let o=s.x,l=s.y,u=Math.min(a,l),h=Math.max(a,l),c=1/0;for(let d=0,p=0;d<cl;d++,p+=4){if(ot[p+2]<o||ot[p]>r||ot[p+3]<u||ot[p+1]>h)continue;let f=fm(d);i=mm(d);do{if(i.prev.next===i&&r>=i.x&&i.x>=o&&r!==i.x&&dl(a<l?r:n,a,o,l,a<l?n:r,a,i.x,i.y)){let m=Math.abs(a-i.y)/(r-i.x);(_s(i,e)||i.y===a&&i.next.y===a&&i.next.x>r)&&(m<c||m===c&&(i.x>s.x||i.x===s.x&&WE(s,i)))&&(s=i,c=m)}i=i.next}while(i!==f)}return s}function WE(e,t){return mt(e.prev,e,t.prev)<0&&mt(t.next,e,e.next)<0}const yi=[];let Dn=[],jr=new Uint32Array,Cn=new Uint32Array;const Pn=new Uint32Array(256);function HE(e,t,i,r){let a=e,n=0;do a.z=bc(a.x,a.y,t,i,r),yi[n++]=a,a=a.next;while(a!==e);XE(n);let s=null;for(let o=0;o<n;o++){let l=yi[o];l.prevZ=s,s&&(s.nextZ=l),s=l}s.nextZ=null}function XE(e){if(e<=32){for(let t=1;t<e;t++){let i=yi[t],r=i.z,a=t-1;for(;a>=0&&yi[a].z>r;)yi[a+1]=yi[a],a--;yi[a+1]=i}return}jr.length<e&&(jr=new Uint32Array(e),Cn=new Uint32Array(e),Dn=Array(e));for(let t=0;t<e;t++)jr[t]=yi[t].z;co(e,yi,jr,Dn,Cn,0),co(e,Dn,Cn,yi,jr,8),co(e,yi,jr,Dn,Cn,16),co(e,Dn,Cn,yi,jr,24)}function co(e,t,i,r,a,n){Pn.fill(0);for(let o=0;o<e;o++)Pn[i[o]>>>n&255]++;let s=0;for(let o=0;o<256;o++){let l=Pn[o];Pn[o]=s,s+=l}for(let o=0;o<e;o++){let l=i[o],u=Pn[l>>>n&255]++;r[u]=t[o],a[u]=l}}function bc(e,t,i,r,a){return e=(e-i)*a|0,t=(t-r)*a|0,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,e|t<<1}function YE(e){let t=e,i=e;do(t.x<i.x||t.x===i.x&&t.y<i.y)&&(i=t),t=t.next;while(t!==e);return i}function dl(e,t,i,r,a,n,s,o){return(a-s)*(t-o)>=(e-s)*(n-o)&&(e-s)*(r-o)>=(i-s)*(t-o)&&(i-s)*(n-o)>=(a-s)*(r-o)}function KE(e,t){let i=gs(e,t)&&mt(e.prev,e,e.next)>0&&mt(t.prev,t,t.next)>0;return e.next.i!==t.i&&(i||_s(e,t)&&_s(t,e)&&(mt(e.prev,e,t.prev)!==0||mt(e,t.prev,t)!==0))&&!JE(e,t)&&(i||QE(e,t))}function mt(e,t,i){return(t.y-e.y)*(i.x-t.x)-(t.x-e.x)*(i.y-t.y)}function gs(e,t){return e.x===t.x&&e.y===t.y}function k0(e,t,i,r,a=!0){let n=mt(e,t,i),s=mt(e,t,r),o=mt(i,r,e),l=mt(i,r,t);return(n>0&&s<0||n<0&&s>0)&&(o>0&&l<0||o<0&&l>0)?!0:a?!!(n===0&&po(e,i,t)||s===0&&po(e,r,t)||o===0&&po(i,e,r)||l===0&&po(i,t,r)):!1}function po(e,t,i){return t.x<=Math.max(e.x,i.x)&&t.x>=Math.min(e.x,i.x)&&t.y<=Math.max(e.y,i.y)&&t.y>=Math.min(e.y,i.y)}function JE(e,t){let i=Math.min(e.x,t.x),r=Math.max(e.x,t.x),a=Math.min(e.y,t.y),n=Math.max(e.y,t.y),s=e;do{let o=s.next;if(s.x>r&&o.x>r||s.x<i&&o.x<i||s.y>n&&o.y>n||s.y<a&&o.y<a){s=o;continue}if(s.i!==e.i&&o.i!==e.i&&s.i!==t.i&&o.i!==t.i&&k0(s,o,e,t))return!0;s=o}while(s!==e);return!1}function _s(e,t){return mt(e.prev,e,e.next)<0?mt(e,t,e.next)>=0&&mt(e,e.prev,t)>=0:mt(e,t,e.prev)<0||mt(e,e.next,t)<0}function QE(e,t){let i=e,r=!1,a=(e.x+t.x)/2,n=(e.y+t.y)/2;do{let s=i.next;i.y>n!=s.y>n&&a<(s.x-i.x)*(n-i.y)/(s.y-i.y)+i.x&&(r=!r),i=s}while(i!==e);return r}function L0(e,t){let i=wc(e.i,e.x,e.y),r=wc(t.i,t.x,t.y),a=e.next,n=t.prev;return e.next=t,t.prev=e,i.next=a,a.prev=i,r.next=i,i.prev=r,n.next=r,r.prev=n,r}function gm(e,t,i,r){let a=wc(e,t,i);return r?(a.next=r.next,a.prev=r,r.next.prev=a,r.next=a):(a.prev=a,a.next=a),a}function ys(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ),yc&&ZE(e.prev,e.next)}function wc(e,t,i){return{i:e,x:t,y:i,prev:null,next:null,z:0,prevZ:null,nextZ:null}}function eS(e,t,i,r){let a=0;for(let n=t,s=i-r;n<i;n+=r)a+=(e[s]-e[n])*(e[n+1]+e[s+1]),s=n;return a}var hr=class{constructor(t,i){if(i>t)throw Error("Min granularity must not be greater than base granularity.");this._baseZoomGranularity=t,this._minGranularity=i}getGranularityForZoomLevel(t){let i=1<<t;return Math.max(Math.floor(this._baseZoomGranularity/i),this._minGranularity,1)}},aa,Gd=(aa=class{constructor(t){this.fill=t.fill,this.line=t.line,this.tile=t.tile,this.stencil=t.stencil,this.circle=t.circle}},aa.noSubdivision=new aa({fill:new hr(0,0),line:new hr(0,0),tile:new hr(0,0),stencil:new hr(0,0),circle:1}),aa);G("SubdivisionGranularityExpression",hr),G("SubdivisionGranularitySetting",Gd);const Kn=-32768,Jn=32767;var tS=class{constructor(t,i){this._vertexBuffer=[],this._vertexDictionary=new Map,this._used=!1,this._granularity=t,this._granularityCellSize=L/t,this._canonical=i}_getKey(t,i){return t+=32768,i+=32768,t<<16|i<<0}_vertexToIndex(t,i){if(t<-32768||i<-32768||t>32767||i>32767)throw Error("Vertex coordinates are out of signed 16 bit integer range.");let r=Math.round(t)|0,a=Math.round(i)|0,n=this._getKey(r,a),s=this._vertexDictionary.get(n);if(s!==void 0)return s;let o=this._vertexBuffer.length/2;return this._vertexDictionary.set(n,o),this._vertexBuffer.push(r,a),o}_subdivideTrianglesScanline(t,i){if(this._granularity<2)return aS(this._vertexBuffer,rS(t,i));let r=[],a=t.length;for(let n=0;n<a;n+=3){let s=[i[t[n+0]],i[t[n+1]],i[t[n+2]]],o=[this._vertexBuffer[s[0]*2+0],this._vertexBuffer[s[0]*2+1],this._vertexBuffer[s[1]*2+0],this._vertexBuffer[s[1]*2+1],this._vertexBuffer[s[2]*2+0],this._vertexBuffer[s[2]*2+1]],l=1/0,u=1/0,h=-1/0,c=-1/0;for(let g=0;g<3;g++){let _=o[g*2],y=o[g*2+1];l=Math.min(l,_),h=Math.max(h,_),u=Math.min(u,y),c=Math.max(c,y)}if(l===h||u===c)continue;let d=Math.floor(l/this._granularityCellSize),p=Math.ceil(h/this._granularityCellSize),f=Math.floor(u/this._granularityCellSize),m=Math.ceil(c/this._granularityCellSize);if(d===p&&f===m){r.push(...s);continue}for(let g=f;g<m;g++){let _=this._scanlineGenerateVertexRingForCellRow(g,o,s);nS(this._vertexBuffer,_,r)}}return r}_scanlineGenerateVertexRingForCellRow(t,i,r){let a=t*this._granularityCellSize,n=a+this._granularityCellSize,s=[];for(let o=0;o<3;o++){let l=i[o*2],u=i[o*2+1],h=i[(o+1)*2%6],c=i[((o+1)*2+1)%6],d=i[(o+2)*2%6],p=i[((o+2)*2+1)%6],f=h-l,m=c-u,g=f===0,_=m===0,y=(a-u)/m,x=(n-u)/m,v=Math.min(y,x),w=Math.max(y,x);if(!_&&(v>=1||w<=0)||_&&(u<a||u>n)){c>=a&&c<=n&&s.push(r[(o+1)%3]);continue}if(!_&&v>0){let P=l+f*v,S=u+m*v;s.push(this._vertexToIndex(P,S))}let b=l+f*Math.max(v,0),T=l+f*Math.min(w,1);if(g||this._generateIntraEdgeVertices(s,l,u,h,c,b,T),!_&&w<1){let P=l+f*w,S=u+m*w;s.push(this._vertexToIndex(P,S))}(_||c>=a&&c<=n)&&s.push(r[(o+1)%3]),!_&&(c<=a||c>=n)&&this._generateInterEdgeVertices(s,l,u,h,c,d,p,T,a,n)}return s}_generateIntraEdgeVertices(t,i,r,a,n,s,o){let l=a-i,u=n-r,h=u===0,c=h?Math.min(i,a):Math.min(s,o),d=h?Math.max(i,a):Math.max(s,o),p=Math.floor(c/this._granularityCellSize)+1,f=Math.ceil(d/this._granularityCellSize)-1;if(h?i<a:s<o)for(let m=p;m<=f;m++){let g=m*this._granularityCellSize,_=r+u*(g-i)/l;t.push(this._vertexToIndex(g,_))}else for(let m=f;m>=p;m--){let g=m*this._granularityCellSize,_=r+u*(g-i)/l;t.push(this._vertexToIndex(g,_))}}_generateInterEdgeVertices(t,i,r,a,n,s,o,l,u,h){let c=n-r,d=s-a,p=o-n,f=(u-n)/p,m=(h-n)/p,g=Math.min(f,m),_=Math.max(f,m),y=a+d*g,x=Math.floor(Math.min(y,l)/this._granularityCellSize)+1,v=Math.ceil(Math.max(y,l)/this._granularityCellSize)-1,w=l<y,b=p===0;if(b&&(o===u||o===h))return;if(b||g>=1||_<=0){let P=i-s,S=r-o,M=(u-o)/S,k=(h-o)/S,R=s+P*Math.min(M,k);x=Math.floor(Math.min(R,l)/this._granularityCellSize)+1,v=Math.ceil(Math.max(R,l)/this._granularityCellSize)-1,w=l<R}let T=c>0?h:u;if(w)for(let P=x;P<=v;P++){let S=P*this._granularityCellSize;t.push(this._vertexToIndex(S,T))}else for(let P=v;P>=x;P--){let S=P*this._granularityCellSize;t.push(this._vertexToIndex(S,T))}}_generateOutline(t,i){let r=[],a=0;for(let n of t){let s=this._granularity<2?this._ringPathIndices(n,a,i):this._pointArrayToIndices(Yr(n,this._granularity,!0));a+=n.length;let o=[];for(let l=1;l<s.length;l++)o.push(s[l-1]),o.push(s[l]);r.push(o)}return r}_ringPathIndices(t,i,r){let a=r.slice(i,i+t.length);return a.length>=2&&O0(t)&&a.push(a[0]),a}_handlePoles(t){let i=!1,r=!1;this._canonical&&(this._canonical.y===0&&(i=!0),this._canonical.y===(1<<this._canonical.z)-1&&(r=!0)),(i||r)&&this._fillPoles(t,i,r)}_ensureNoPoleVertices(){let t=this._vertexBuffer;for(let i=0;i<t.length;i+=2){let r=t[i+1];r===-32768&&(t[i+1]=-32767),r===32767&&(t[i+1]=32766)}}_generatePoleQuad(t,i,r,a,n,s){a>n==(s===-32768)?(t.push(r),t.push(i),t.push(this._vertexToIndex(a,s)),t.push(this._vertexToIndex(n,s)),t.push(r),t.push(this._vertexToIndex(a,s))):(t.push(i),t.push(r),t.push(this._vertexToIndex(a,s)),t.push(r),t.push(this._vertexToIndex(n,s)),t.push(this._vertexToIndex(a,s)))}_fillPoles(t,i,r){let a=this._vertexBuffer,n=L,s=t.length;for(let o=2;o<s;o+=3){let l=t[o-2],u=t[o-1],h=t[o],c=a[l*2],d=a[l*2+1],p=a[u*2],f=a[u*2+1],m=a[h*2],g=a[h*2+1];i&&(d===0&&f===0&&this._generatePoleQuad(t,l,u,c,p,Kn),f===0&&g===0&&this._generatePoleQuad(t,u,h,p,m,Kn),g===0&&d===0&&this._generatePoleQuad(t,h,l,m,c,Kn)),r&&(d===n&&f===n&&this._generatePoleQuad(t,l,u,c,p,Jn),f===n&&g===n&&this._generatePoleQuad(t,u,h,p,m,Jn),g===n&&d===n&&this._generatePoleQuad(t,h,l,m,c,Jn))}}_initializeVertices(t){let i=[];for(let r=0;r<t.length;r+=2)i.push(this._vertexToIndex(t[r],t[r+1]));return i}subdividePolygonInternal(t,i){var l;if(this._used)throw Error("Subdivision: multiple use not allowed.");this._used=!0;let{flattened:r,holeIndices:a}=iS(t),n=this._initializeVertices(r),s;try{let u=LE(r,a);s=this._subdivideTrianglesScanline(u,n)}catch(u){console.error(u)}let o=[];return i&&(o=this._generateOutline(t,n)),this._ensureNoPoleVertices(),this._handlePoles(s),this._granularity>=2&&((l=this._canonical)==null?void 0:l.z)===0&&(s=this._removeTrianglesOutsideTileX(s),o=o.map(u=>this._removeLinesOutsideTileX(u))),{verticesFlattened:this._vertexBuffer,indicesTriangles:s,indicesLineList:o}}_vertexOutsideTileX(t){let i=this._vertexBuffer[t*2];return i<0||i>8192}_removeTrianglesOutsideTileX(t){let i=[];for(let r=0;r<t.length;r+=3)this._vertexOutsideTileX(t[r])||this._vertexOutsideTileX(t[r+1])||this._vertexOutsideTileX(t[r+2])||i.push(t[r],t[r+1],t[r+2]);return i}_removeLinesOutsideTileX(t){let i=[];for(let r=0;r<t.length;r+=2)this._vertexOutsideTileX(t[r])||this._vertexOutsideTileX(t[r+1])||i.push(t[r],t[r+1]);return i}_pointArrayToIndices(t){let i=[];for(let r of t)i.push(this._vertexToIndex(r.x,r.y));return i}};function B0(e,t,i,r=!0){return new tS(i,t).subdividePolygonInternal(e,r)}function Yr(e,t,i=!1){if(!e||e.length<1||e.length<2)return[];let r=i&&O0(e);if(t<2)return r?[...e,e[0]]:[...e];let a=Math.floor(L/t),n=[];n.push(new A(e[0].x,e[0].y));let s=e.length,o=r?s:s-1;for(let l=0;l<o;l++){let u=e[l],h=l<s-1?e[l+1]:e[0],c=u.x,d=u.y,p=h.x,f=h.y,m=c!==p,g=d!==f;if(!m&&!g)continue;let _=p-c,y=f-d,x=Math.abs(_),v=Math.abs(y),w=c,b=d;for(;;){let P=_>0?(Math.floor(w/a)+1)*a:(Math.ceil(w/a)-1)*a,S=y>0?(Math.floor(b/a)+1)*a:(Math.ceil(b/a)-1)*a,M=Math.abs(w-P),k=Math.abs(b-S),R=Math.abs(w-p),D=Math.abs(b-f),I=m?M/x:1/0,C=g?k/v:1/0;if((R<=M||!m)&&(D<=k||!g))break;if(I<C&&m||!g){w=P,b+=y*I;let E=new A(w,Math.round(b));(n[n.length-1].x!==E.x||n[n.length-1].y!==E.y)&&n.push(E)}else{w+=_*C,b=S;let E=new A(Math.round(w),b);(n[n.length-1].x!==E.x||n[n.length-1].y!==E.y)&&n.push(E)}}let T=new A(p,f);(n[n.length-1].x!==T.x||n[n.length-1].y!==T.y)&&n.push(T)}return n}function O0(e){return!e[0].equals(e[e.length-1])}function iS(e){let t=[],i=[];for(let r of e)if(r.length!==0){r!==e[0]&&t.push(i.length/2);for(let a of r)i.push(a.x),i.push(a.y)}return{flattened:i,holeIndices:t}}function rS(e,t){let i=Array(e.length);for(let r=0;r<e.length;r++)i[r]=t[e[r]];return i}function aS(e,t){let i=[];for(let r=0;r<t.length;r+=3){let a=t[r],n=t[r+1],s=t[r+2],o=e[a*2],l=e[a*2+1],u=e[n*2],h=e[n*2+1],c=e[s*2],d=e[s*2+1],p=u-o,f=h-l,m=c-o;p*(d-l)-f*m>0?(i.push(a),i.push(s),i.push(n)):(i.push(a),i.push(n),i.push(s))}return i}function nS(e,t,i){if(t.length===0)throw Error("Subdivision vertex ring is empty.");let r=0,a=e[t[0]*2];for(let l=1;l<t.length;l++){let u=e[t[l]*2];u<a&&(a=u,r=l)}let n=t.length,s=r,o=(s+1)%n;for(;;){let l=s-1>=0?s-1:n-1,u=(o+1)%n,h=e[t[l]*2],c=e[t[l]*2+1],d=e[t[u]*2],p=e[t[u]*2+1],f=e[t[s]*2],m=e[t[s]*2+1],g=e[t[o]*2],_=e[t[o]*2+1],y=!1;if(h<d)y=!0;else if(h>d)y=!1;else{let x=_-m,v=-(g-f),w=m<_?1:-1;((h-f)*x+(c-m)*v)*w>((d-f)*x+(p-m)*v)*w&&(y=!0)}if(y){let x=t[l],v=t[s],w=t[o];x!==v&&x!==w&&v!==w&&i.push(w,v,x),s--,s<0&&(s=n-1)}else{let x=t[u],v=t[s],w=t[o];x!==v&&x!==w&&v!==w&&i.push(w,v,x),o++,o>=n&&(o=0)}if(l===u)break}}function $0(e,t,i,r,a,n,s,o,l){let u=a.length/2,h=s&&o&&l;if(u<Ke.MAX_VERTEX_ARRAY_LENGTH){let c=t.prepareSegment(u,i,r),d=c.vertexLength;for(let m=0;m<n.length;m+=3)r.emplaceBack(d+n[m],d+n[m+1],d+n[m+2]);c.vertexLength+=u,c.primitiveLength+=n.length/3;let p,f;h&&(f=s.prepareSegment(u,i,o),p=f.vertexLength,f.vertexLength+=u);for(let m=0;m<a.length;m+=2)e(a[m],a[m+1]);if(h)for(let m of l){for(let g=1;g<m.length;g+=2)o.emplaceBack(p+m[g-1],p+m[g]);f.primitiveLength+=m.length/2}}else sS(t,i,r,a,n,e),h&&oS(s,i,o,a,l,e),t.forceNewSegmentOnNextPrepare(),s==null||s.forceNewSegmentOnNextPrepare()}function Qn(e,t,i,r,a,n,s){if(n){let o=r.count;return i(t[a*2],t[a*2+1]),e[a]=r.count,r.count++,s.vertexLength++,o}return e[a]}function sS(e,t,i,r,a,n){let s=[];for(let c=0;c<r.length/2;c++)s.push(-1);let o={count:0},l=0,u=e.getOrCreateLatestSegment(t,i),h=u.vertexLength;for(let c=2;c<a.length;c+=3){let d=a[c-2],p=a[c-1],f=a[c],m=s[d]<l,g=s[p]<l,_=s[f]<l,y=+!!m+ +!!g+ +!!_;u.vertexLength+y>Ke.MAX_VERTEX_ARRAY_LENGTH&&(u=e.createNewSegment(t,i),l=o.count,m=!0,g=!0,_=!0,h=0);let x=Qn(s,r,n,o,d,m,u),v=Qn(s,r,n,o,p,g,u),w=Qn(s,r,n,o,f,_,u);i.emplaceBack(h+x-l,h+v-l,h+w-l),u.primitiveLength++}}function oS(e,t,i,r,a,n){let s=[];for(let c=0;c<r.length/2;c++)s.push(-1);let o={count:0},l=0,u=e.getOrCreateLatestSegment(t,i),h=u.vertexLength;for(let c of a)for(let d=1;d<c.length;d+=2){let p=c[d-1],f=c[d],m=s[p]<l,g=s[f]<l,_=+!!m+ +!!g;u.vertexLength+_>Ke.MAX_VERTEX_ARRAY_LENGTH&&(u=e.createNewSegment(t,i),l=o.count,m=!0,g=!0,h=0);let y=Qn(s,r,n,o,p,m,u),x=Qn(s,r,n,o,f,g,u);i.emplaceBack(h+y-l,h+x-l),u.primitiveLength++}}var j0=class{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(i=>i.id),this.index=t.index,this.hasDependencies=!1,this.sdfPatterns={},this.patternFeatures=[],this.layoutVertexArray=new FT,this.indexArray=new er,this.indexArray2=new hc,this.programConfigurations=new la(t.layers,t.zoom),this.segments=new Ke,this.segments2=new Ke,this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id)}populate(t,i,r){this.hasDependencies=hl("fill",this.layers,i);let a=this.layers[0].layout.get("fill-sort-key"),n=!a.isConstant(),s=[],o=new Be(this.zoom),l=this.layers[0]._featureFilter.needGeometry;for(let{feature:u,id:h,index:c,sourceLayerIndex:d}of t){let p=fa(u,l);if(!this.layers[0]._featureFilter.filter(o,p,r))continue;let f=n?a.evaluate(p,{},r,i.availableImages):void 0,m={id:h,properties:u.properties,type:u.type,sourceLayerIndex:d,index:c,geometry:l?p.geometry:pa(u),patterns:{},sortKey:f};s.push(m)}n&&s.sort((u,h)=>u.sortKey-h.sortKey);for(let u of s){let{geometry:h,index:c,sourceLayerIndex:d}=u;if(this.hasDependencies){let f=Ud("fill",this.layers,u,{zoom:this.zoom},i);this.patternFeatures.push(f)}else this.addFeature(u,h,c,r,{},i.subdivisionGranularity);let p=t[c].feature;i.featureIndex.insert(p,h,c,d,this.index)}}update(t,i,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,i,this.stateDependentLayers,{imagePositions:r})}addFeatures({options:t,canonical:i,patternPositions:r,patternMap:a}){this.detectSdfPatterns(a);for(let n of this.patternFeatures)this.addFeature(n,n.geometry,n.index,i,r,t.subdivisionGranularity)}detectSdfPatterns(t){for(let i of this.patternFeatures)for(let r in i.patterns){let a=i.patterns[r];this.recordSdfPattern(r,t[a.min]),this.recordSdfPattern(r,t[a.mid]),this.recordSdfPattern(r,t[a.max])}for(let i of this.layers){let r=i.paint.get("fill-pattern").constantOr(null);r&&(this.recordSdfPattern(i.id,t[r.from.toString()]),this.recordSdfPattern(i.id,t[r.to.toString()]))}}recordSdfPattern(t,i){if(!i)return;let r=i.sdf===!0,a=this.sdfPatterns[t];a===void 0?this.sdfPatterns[t]=r:a!==r&&xe(`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,kE),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,i,r,a,n,s){for(let o of Ll(i,500)){let l=B0(o,a,s.fill.getGranularityForZoomLevel(a.z)),u=this.layoutVertexArray;$0((h,c)=>{u.emplaceBack(h,c)},this.segments,this.layoutVertexArray,this.indexArray,l.verticesFlattened,l.indicesTriangles,this.segments2,this.indexArray2,l.indicesLineList)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,r,{imagePositions:n,canonical:a})}};G("FillBucket",j0,{omit:["layers","patternFeatures"]});let lS;const uS=()=>lS||(lS=new Dt({"fill-sort-key":new ee(z.layout_fill["fill-sort-key"],"fill-sort-key")}));let hS;const cS=()=>hS||(hS=new Dt({"fill-antialias":new N(z.paint_fill["fill-antialias"],"fill-antialias"),"fill-opacity":new ee(z.paint_fill["fill-opacity"],"fill-opacity"),"fill-layer-opacity":new N(z.paint_fill["fill-layer-opacity"],"fill-layer-opacity"),"fill-color":new ee(z.paint_fill["fill-color"],"fill-color"),"fill-outline-color":new ee(z.paint_fill["fill-outline-color"],"fill-outline-color"),"fill-translate":new N(z.paint_fill["fill-translate"],"fill-translate"),"fill-translate-anchor":new N(z.paint_fill["fill-translate-anchor"],"fill-translate-anchor"),"fill-pattern":new cs(z.paint_fill["fill-pattern"],"fill-pattern")}));var dS={get paint(){return cS()},get layout(){return uS()}};const pS=e=>e.type==="fill";var fS=class extends Li{constructor(t,i){super(t,dS,i)}recalculate(t,i){super.recalculate(t,i);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 j0(t)}queryRadius(){return Xl(this.paint.get("fill-translate"))}queryIntersectsFeature({queryGeometry:t,geometry:i,transform:r,pixelsToTileUnits:a}){return E0(Yl(t,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),-r.bearingInRadians,a),i)}isTileClipped(){return!0}};const mS=tt([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),gS=tt([{name:"a_centroid",components:2,type:"Int16"}],4),_S=mS.members;var Mi=class Tc{constructor(){this.minX=1/0,this.maxX=-1/0,this.minY=1/0,this.maxY=-1/0}extend(t){return this.minX=Math.min(this.minX,t.x),this.minY=Math.min(this.minY,t.y),this.maxX=Math.max(this.maxX,t.x),this.maxY=Math.max(this.maxY,t.y),this}expandBy(t){return this.minX-=t,this.minY-=t,this.maxX+=t,this.maxY+=t,(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(t){return this.expandBy(-t)}map(t){let i=new Tc;return i.extend(t(new A(this.minX,this.minY))),i.extend(t(new A(this.maxX,this.minY))),i.extend(t(new A(this.minX,this.maxY))),i.extend(t(new A(this.maxX,this.maxY))),i}static fromPoints(t){let i=new Tc;for(let r of t)i.extend(r);return i}contains(t){return t.x>=this.minX&&t.x<=this.maxX&&t.y>=this.minY&&t.y<=this.maxY}empty(){return this.minX>this.maxX}width(){return this.maxX-this.minX}height(){return this.maxY-this.minY}covers(t){return!this.empty()&&!t.empty()&&t.minX>=this.minX&&t.maxX<=this.maxX&&t.minY>=this.minY&&t.maxY<=this.maxY}intersects(t){return!this.empty()&&!t.empty()&&t.minX<=this.maxX&&t.maxX>=this.minX&&t.minY<=this.maxY&&t.maxY>=this.minY}};const yS=Mi.fromPoints([new A(0,0),new A(L,L)]);function Ec(e,t){return e.x===t.x&&(e.x<0||e.x>8192)||e.y===t.y&&(e.y<0||e.y>8192)}function _m(e){return e.every(t=>t.x<0)||e.every(t=>t.x>8192)||e.every(t=>t.y<0)||e.every(t=>t.y>8192)}var Fs=class{constructor(t,i,r,a,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=a,this._values=n;t.pos<i;){let s=t.readVarint();if(s===8)this.id=t.readVarint();else if(s===18){let o=t.readVarint()+t.pos;for(;t.pos<o;){let l=a[t.readVarint()],u=n[t.readVarint()];this.properties[l]=u}}else s===24?this.type=t.readVarint():(s===34&&(this._geometry=t.pos),t.skip(s))}}loadGeometry(){if(this._geometry<0)throw Error("feature has no geometry");let t=this._pbf;t.pos=this._geometry;let i=t.readVarint()+t.pos,r=[],a,n=1,s=0,o=0,l=0;for(;t.pos<i;){if(s<=0){let u=t.readVarint();if(n=u&7,s=u>>3,s===0)continue}if(s--,n===1)o+=t.readSVarint(),l+=t.readSVarint(),a&&r.push(a),a=[new A(o,l)];else if(n===2)o+=t.readSVarint(),l+=t.readSVarint(),a&&a.push(new A(o,l));else if(n===7)a&&a.push(a[0].clone());else throw Error(`unknown command ${n}`)}return a&&r.push(a),r}bbox(){if(this._geometry<0)throw Error("feature has no geometry");let t=this._pbf;t.pos=this._geometry;let i=t.readVarint()+t.pos,r=1,a=0,n=0,s=0,o=1/0,l=-1/0,u=1/0,h=-1/0;for(;t.pos<i;){if(a<=0){let c=t.readVarint();if(r=c&7,a=c>>3,a===0)continue}if(a--,r===1||r===2)n+=t.readSVarint(),s+=t.readSVarint(),n<o&&(o=n),n>l&&(l=n),s<u&&(u=s),s>h&&(h=s);else if(r!==7)throw Error(`unknown command ${r}`)}return[o,u,l,h]}toGeoJSON(t,i,r){let a=this.extent*2**r,n=this.extent*t,s=this.extent*i,o=this.loadGeometry();function l(d){return[(d.x+n)*360/a-180,360/Math.PI*Math.atan(Math.exp((1-(d.y+s)*2/a)*Math.PI))-90]}function u(d){return d.map(l)}let h;if(this.type===1){let d=[];for(let f of o)d.push(f[0]);let p=u(d);h=d.length===1?{type:"Point",coordinates:p[0]}:{type:"MultiPoint",coordinates:p}}else if(this.type===2){let d=o.map(u);h=d.length===1?{type:"LineString",coordinates:d[0]}:{type:"MultiLineString",coordinates:d}}else if(this.type===3){let d=V0(o),p=[];for(let f of d)p.push(f.map(u));h=p.length===1?{type:"Polygon",coordinates:p[0]}:{type:"MultiPolygon",coordinates:p}}else throw Error("unknown feature type");let c={type:"Feature",geometry:h,properties:this.properties};return this.id!=null&&(c.id=this.id),c}};Fs.types=["Unknown","Point","LineString","Polygon"];function V0(e){let t=e.length;if(t<=1)return[e];let i=[],r,a;for(let n=0;n<t;n++){let s=vS(e[n]);s!==0&&(a===void 0&&(a=s<0),a===s<0?(r&&i.push(r),r=[e[n]]):r&&r.push(e[n]))}return r&&i.push(r),i}function vS(e){let t=0;for(let i=0,r=e.length,a=r-1,n,s;i<r;a=i++)n=e[i],s=e[a],t+=(s.x-n.x)*(n.y+s.y);return t}var xS=class{constructor(t,i){for(this.version=1,this.name="",this.extent=4096,this.length=0,this._pbf=t,this._keys=[],this._values=[],this._features=[],i===void 0&&(i=t.length);t.pos<i;){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(bS(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 i=this._pbf.readVarint()+this._pbf.pos;return new Fs(this._pbf,i,this.extent,this._keys,this._values)}};function bS(e){let t=null,i=e.readVarint()+e.pos;for(;e.pos<i;){let r=e.readVarint();t=r===10?e.readString():r===21?e.readFloat():r===25?e.readDouble():r===32?e.readVarint(!0):r===40?e.readVarint():r===48?e.readSVarint():r===56?e.readBoolean():(e.skip(r),null)}if(t==null)throw Error("unknown feature value");return t}var wS=class{constructor(t,i=t.length){let r=Object.create(null);for(;t.pos<i;){let a=t.readVarint();if(a===26){let n=new xS(t,t.readVarint()+t.pos);n.length&&(r[n.name]=n)}else t.skip(a)}this.layers=r}};const Vt=63710088e-1;var X=class Gn{constructor(t,i){if(isNaN(t)||isNaN(i))throw Error(`Invalid LngLat object: (${t}, ${i})`);if(this.lng=+t,this.lat=+i,this.lat>90||this.lat<-90)throw Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new Gn(bi(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(t){let i=Math.PI/180,r=this.lat*i,a=t.lat*i,n=Math.sin(r)*Math.sin(a)+Math.cos(r)*Math.cos(a)*Math.cos((t.lng-this.lng)*i);return Vt*Math.acos(Math.min(n,1))}static convert(t){if(t instanceof Gn)return t;if(Array.isArray(t)&&(t.length===2||t.length===3))return new Gn(Number(t[0]),Number(t[1]));if(!Array.isArray(t)&&typeof t=="object"&&t)return new Gn(Number("lng"in t?t.lng:t.lon),Number(t.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>]")}};const N0=2*Math.PI*Vt;function U0(e){return N0*Math.cos(e*Math.PI/180)}function nn(e){return(180+e)/360}function sn(e){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+e*Math.PI/360)))/360}function ia(e,t){return e/U0(t)}function Sc(e){return e*360-180}function vs(e){let t=180-e*360;return 360/Math.PI*Math.atan(Math.exp(t*Math.PI/180))-90}function G0(e,t){return e*U0(vs(t))}function TS(e){return 1/Math.cos(e*Math.PI/180)}var Me=class Z0{constructor(t,i,r=0){this.x=+t,this.y=+i,this.z=+r}static fromLngLat(t,i=0){let r=X.convert(t);return new Z0(nn(r.lng),sn(r.lat),ia(i,r.lat))}toLngLat(){return new X(Sc(this.x),vs(this.y))}toAltitude(){return G0(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/N0*TS(vs(this.y))}};const ra=89.25;function q0(e,t,i){let r=1/(1<<i.z);return new Me(e/L*r+i.x*r,t/L*r+i.y*r)}function ES(e,t,i){return q0(e,t,i).toLngLat()}function Zi(e,t){let i=he(t.lat,-85.051129,Xi);return new A(nn(t.lng)*e,sn(i)*e)}function xs(e,t){return new Me(t.x/e,t.y/e).toLngLat()}function es(e){return e.cameraToCenterDistance*Math.min(Math.tan(Xe(90-e.pitch))*.85,Math.tan(Xe(ra-e.pitch)))}function Xu(e,t){let i=e.canonical,r=t/Gt(i.z),a=i.x+2**i.z*e.wrap,n=new Float64Array(16);return Fi(n),ct(n,n,[a*r,i.y*r,0]),At(n,n,[r/L,r/L,1]),n}function W0(e,t,i,r,a){let n=Me.fromLngLat(e,t),s=a*ia(1,e.lat),{x:o,y:l,z:u}=Dc(i,r),h=s*-o,c=s*-l,d=s*u;return new Me(n.x+h,n.y+c,n.z+d)}function SS(e){let t=ia(1,e.center.lat)*e.worldSize;return W0(e.center,e.elevation,e.pitch,e.bearing,e.cameraToCenterDistance/t)}function Dc(e,t){let i=Xe(e),r=Xe(t),a=Math.cos(-i),n=Math.sin(i);return{x:n*Math.sin(r),y:-n*Math.cos(r),z:a}}function DS(e,t){return t<=0||!e||e.length===0?e:e.map(i=>PS(i,t))}function CS(e,t){let i=ES(L/2,L/2,t),r=Me.fromLngLat(i).meterInMercatorCoordinateUnits(),a=(1<<t.z)*L;return e*r*a}function PS(e,t){if(!e||e.length<3)return e;let i=e[0].x===e[e.length-1].x&&e[0].y===e[e.length-1].y,r=i?e.length-1:e.length;if(r<3)return e;let a=[],n=Ec(e[r-1],e[0]);for(let o=0;o<r;o++){let l=e[(o-1+r)%r],u=e[o],h=e[(o+1)%r],c=Ec(u,h);n||c?a.push(u.clone()):IS(a,l,u,h,t),n=c}let s=AS(a);return s.length<3?e:(i&&s.push(s[0].clone()),s)}function AS(e){let t=[];for(let i of e){let r=i.round(),a=t[t.length-1];((a==null?void 0:a.x)!==r.x||(a==null?void 0:a.y)!==r.y)&&t.push(r)}for(;t.length>1&&t[0].x===t[t.length-1].x&&t[0].y===t[t.length-1].y;)t.pop();return t}function IS(e,t,i,r,a){let n=t.sub(i),s=r.sub(i),o=n.mag(),l=s.mag();if(o<1e-6||l<1e-6){e.push(i.clone());return}n._div(o),s._div(l);let u=n.x*s.x+n.y*s.y;if(Math.abs(u)>Math.cos(5*Math.PI/180)){e.push(i.clone());return}let h=.2,c=Math.min(a,o*h,l*h),d=i.add(n.mult(c)),p=i.add(s.mult(c)),f=Math.sqrt((1+u)/2),m=i.add(n.add(s)._unit()._mult(c/f)),g=d.sub(m).angleWith(p.sub(m)),_=Math.max(2,Math.ceil(Math.abs(g)/(Math.PI/6)-1e-6));for(let y=0;y<=_;y++)e.push(d.rotateAround(y/_*g,m))}const Yu=8192;function An(e,t,i,r,a,n,s,o){e.emplaceBack(t,i,Math.floor(r*Yu)*2+s,a*Yu*2,n*Yu*2,Math.round(o))}var H0=class{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(i=>i.id),this.index=t.index,this.hasDependencies=!1,this.layoutVertexArray=new zT,this.centroidVertexArray=new Pr,this.indexArray=new er,this.programConfigurations=new la(t.layers,t.zoom),this.segments=new Ke,this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id)}populate(t,i,r){this.features=[],this.hasDependencies=hl("fill-extrusion",this.layers,i);let a=new Be(this.zoom),n=this.layers[0],s=n.layout.get("fill-extrusion-rounded-corner-distance"),o=s>0?CS(s,r):0,l=n._featureFilter.needGeometry;for(let{feature:u,id:h,index:c,sourceLayerIndex:d}of t){let p=fa(u,l);if(!n._featureFilter.filter(a,p,r))continue;let f={id:h,sourceLayerIndex:d,index:c,geometry:DS(l?p.geometry:pa(u),o),properties:u.properties,type:u.type,patterns:{}};this.hasDependencies?this.features.push(Ud("fill-extrusion",this.layers,f,{zoom:this.zoom},i)):this.addFeature(f,f.geometry,c,r,{},i.subdivisionGranularity),i.featureIndex.insert(u,f.geometry,c,d,this.index,!0)}}addFeatures({options:t,canonical:i,patternPositions:r}){for(let a of this.features){let{geometry:n}=a;this.addFeature(a,n,a.index,i,r,t.subdivisionGranularity)}}update(t,i,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,i,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,_S),this.centroidVertexBuffer=t.createVertexBuffer(this.centroidVertexArray,gS.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,i,r,a,n,s){for(let o of Ll(i,500)){let l={x:0,y:0,sampleCount:0},u=this.layoutVertexArray.length;this.processPolygon(l,a,t,o,s);let h=this.layoutVertexArray.length-u,c=Math.floor(l.x/l.sampleCount),d=Math.floor(l.y/l.sampleCount);for(let p=0;p<h;p++)this.centroidVertexArray.emplaceBack(c,d)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,r,{imagePositions:n,canonical:a})}processPolygon(t,i,r,a,n){if(a.length<1||_m(a[0]))return;for(let c of a)c.length!==0&&MS(t,c);let s={segment:this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray)},o=n.fill.getGranularityForZoomLevel(i.z),l=Fs.types[r.type]==="Polygon";for(let c of a){if(c.length===0||_m(c))continue;let d=Yr(c,o,l);this._generateSideFaces(d,s)}if(!l)return;let u=B0(a,i,o,!1),h=this.layoutVertexArray;$0((c,d)=>{An(h,c,d,0,0,1,1,0)},this.segments,this.layoutVertexArray,this.indexArray,u.verticesFlattened,u.indicesTriangles)}_generateSideFaces(t,i){let r=0;for(let a=1;a<t.length;a++){let n=t[a],s=t[a-1];if(Ec(n,s))continue;i.segment.vertexLength+4>Ke.MAX_VERTEX_ARRAY_LENGTH&&(i.segment=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));let o=n.sub(s)._perp()._unit(),l=s.dist(n);r+l>32768&&(r=0),An(this.layoutVertexArray,n.x,n.y,o.x,o.y,0,0,r),An(this.layoutVertexArray,n.x,n.y,o.x,o.y,0,1,r),r+=l,An(this.layoutVertexArray,s.x,s.y,o.x,o.y,0,0,r),An(this.layoutVertexArray,s.x,s.y,o.x,o.y,0,1,r);let u=i.segment.vertexLength;this.indexArray.emplaceBack(u,u+2,u+1),this.indexArray.emplaceBack(u+1,u+2,u+3),i.segment.vertexLength+=4,i.segment.primitiveLength+=2}}};function MS(e,t){for(let i=0;i<t.length;i++){let r=t[i];(i!==t.length-1||t[0].x!==r.x||t[0].y!==r.y)&&(e.x+=r.x,e.y+=r.y,e.sampleCount++)}}G("FillExtrusionBucket",H0,{omit:["layers","features"]});let FS;const zS=()=>FS||(FS=new Dt({"fill-extrusion-rounded-corner-distance":new N(z["layout_fill-extrusion"]["fill-extrusion-rounded-corner-distance"],"fill-extrusion-rounded-corner-distance")}));let RS;const kS=()=>RS||(RS=new Dt({"fill-extrusion-opacity":new N(z["paint_fill-extrusion"]["fill-extrusion-opacity"],"fill-extrusion-opacity"),"fill-extrusion-color":new ee(z["paint_fill-extrusion"]["fill-extrusion-color"],"fill-extrusion-color"),"fill-extrusion-translate":new N(z["paint_fill-extrusion"]["fill-extrusion-translate"],"fill-extrusion-translate"),"fill-extrusion-translate-anchor":new N(z["paint_fill-extrusion"]["fill-extrusion-translate-anchor"],"fill-extrusion-translate-anchor"),"fill-extrusion-pattern":new cs(z["paint_fill-extrusion"]["fill-extrusion-pattern"],"fill-extrusion-pattern"),"fill-extrusion-height":new ee(z["paint_fill-extrusion"]["fill-extrusion-height"],"fill-extrusion-height"),"fill-extrusion-base":new ee(z["paint_fill-extrusion"]["fill-extrusion-base"],"fill-extrusion-base"),"fill-extrusion-vertical-gradient":new N(z["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"],"fill-extrusion-vertical-gradient")}));var LS={get paint(){return kS()},get layout(){return zS()}};const BS=e=>e.type==="fill-extrusion";var OS=class extends Li{constructor(t,i){super(t,LS,i)}createBucket(t){return new H0(t)}queryRadius(){return Xl(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature({queryGeometry:t,feature:i,featureState:r,geometry:a,transform:n,pixelsToTileUnits:s,pixelPosMatrix:o}){let l=Yl(t,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),-n.bearingInRadians,s),u=this.paint.get("fill-extrusion-height").evaluate(i,r),h=this.paint.get("fill-extrusion-base").evaluate(i,r),c=VS(l,o,0),d=jS(a,h,u,o),p=d[0],f=d[1];return $S(p,f,c)}};function In(e,t){return e.x*t.x+e.y*t.y}function ym(e,t){if(e.length===1){let i=0,r=t[i++],a;for(;!a||r.equals(a);)if(a=t[i++],!a)return 1/0;for(;i<t.length;i++){let n=t[i],s=e[0],o=a.sub(r),l=n.sub(r),u=s.sub(r),h=In(o,o),c=In(o,l),d=In(l,l),p=In(u,o),f=In(u,l),m=h*d-c*c,g=(d*p-c*f)/m,_=(h*f-c*p)/m,y=1-g-_,x=r.z*y+a.z*g+n.z*_;if(isFinite(x))return x}return 1/0}{let i=1/0;for(let r of t)i=Math.min(i,r.z);return i}}function $S(e,t,i){let r=1/0;E0(i,t)&&(r=ym(i,t[0]));for(let a=0;a<t.length;a++){let n=t[a],s=e[a];for(let o=0;o<n.length-1;o++){let l=n[o],u=n[o+1],h=s[o],c=[l,u,s[o+1],h,l];T0(i,c)&&(r=Math.min(r,ym(i,c)))}}return r!==1/0&&r}function jS(e,t,i,r){let a=[],n=[],s=r[8]*t,o=r[9]*t,l=r[10]*t,u=r[11]*t,h=r[8]*i,c=r[9]*i,d=r[10]*i,p=r[11]*i;for(let f of e){let m=[],g=[];for(let _ of f){let y=_.x,x=_.y,v=r[0]*y+r[4]*x+r[12],w=r[1]*y+r[5]*x+r[13],b=r[2]*y+r[6]*x+r[14],T=r[3]*y+r[7]*x+r[15],P=v+s,S=w+o,M=b+l,k=T+u,R=v+h,D=w+c,I=b+d,C=T+p,E=new A(P/k,S/k);E.z=M/k,m.push(E);let F=new A(R/C,D/C);F.z=I/C,g.push(F)}a.push(m),n.push(g)}return[a,n]}function VS(e,t,i){let r=[];for(let a of e){let n=[a.x,a.y,i,1];It(n,n,t),r.push(new A(n[0]/n[3],n[1]/n[3]))}return r}const NS="geojsonvt_clip_start",US="geojsonvt_clip_end",GS=tt([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),ZS=GS.members,qS=tt([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),WS=qS.members,HS=Math.cos(75/2*(Math.PI/180)),X0=1/2,vm=2**14/X0;var Y0=class{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(t=>t.id),this.index=e.index,this.hasDependencies=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={};for(let t of this.layers)this.gradients[t.id]={};this.layoutVertexArray=new RT,this.layoutVertexArray2=new kT,this.indexArray=new er,this.programConfigurations=new la(e.layers,e.zoom),this.segments=new Ke,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(t=>t.isStateDependent()).map(t=>t.id)}populate(e,t,i){this.hasDependencies=hl("line",this.layers,t)||this.hasLineDasharray(this.layers);let r=this.layers[0].layout.get("line-sort-key"),a=!r.isConstant(),n=[],s=new Be(this.zoom),o=this.layers[0]._featureFilter.needGeometry;for(let{feature:l,id:u,index:h,sourceLayerIndex:c}of e){let d=fa(l,o);if(!this.layers[0]._featureFilter.filter(s,d,i))continue;let p=a?r.evaluate(d,{},i):void 0,f={id:u,properties:l.properties,type:l.type,sourceLayerIndex:c,index:h,geometry:o?d.geometry:pa(l),patterns:{},dashes:{},sortKey:p};n.push(f)}a&&n.sort((l,u)=>l.sortKey-u.sortKey);for(let l of n){let{geometry:u,index:h,sourceLayerIndex:c}=l;this.hasDependencies?(hl("line",this.layers,t)?Ud("line",this.layers,l,{zoom:this.zoom},t):this.hasLineDasharray(this.layers)&&this.addLineDashDependencies(this.layers,l,this.zoom,t),this.patternFeatures.push(l)):this.addFeature(l,u,h,i,{},{},t.subdivisionGranularity);let d=e[h].feature;t.featureIndex.insert(d,u,h,c,this.index)}}update(e,t,i,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,{imagePositions:i,dashPositions:r})}addFeatures({options:e,canonical:t,patternPositions:i,dashPositions:r}){for(let a of this.patternFeatures)this.addFeature(a,a.geometry,a.index,t,i,r,e.subdivisionGranularity)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=e.createVertexBuffer(this.layoutVertexArray2,WS)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,ZS),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(e){if(e.properties&&Object.hasOwn(e.properties,"geojsonvt_clip_start")&&Object.hasOwn(e.properties,"geojsonvt_clip_end"))return{start:+e.properties[NS],end:+e.properties[US]}}addFeature(e,t,i,r,a,n,s){let o=this.layers[0].layout,l=o.get("line-join").evaluate(e,{}),u=o.get("line-cap").evaluate(e,{}),h=o.get("line-miter-limit").evaluate(e,{}),c=o.get("line-round-limit").evaluate(e,{});this.lineClips=this.lineFeatureClips(e);for(let d of t)this.addLine(d,e,l,u,h,c,r,s);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,i,{imagePositions:a,dashPositions:n,canonical:r})}addLine(e,t,i,r,a,n,s,o){this.distance=0,this.scaledDistance=0,this.totalDistance=0;let l=s?o.line.getGranularityForZoomLevel(s.z):1;if(e=Yr(e,l),this.lineClips){this.lineClipsArray.push(this.lineClips);for(let x=0;x<e.length-1;x++)this.totalDistance+=e[x].dist(e[x+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}let u=Fs.types[t.type]==="Polygon",h=e.length;for(;h>=2&&e[h-1].equals(e[h-2]);)h--;let c=0;for(;c<h-1&&e[c].equals(e[c+1]);)c++;if(h-c<(u?3:2))return;i==="bevel"&&(a=1.05);let d=this.overscaling<=16?15*L/(512*this.overscaling):0,p=this.segments.prepareSegment(h*10,this.layoutVertexArray,this.indexArray),f,m,g,_,y;this.e1=this.e2=-1,u&&(f=e[h-2],y=e[c].sub(f)._unit()._perp());for(let x=c;x<h;x++){if(g=x===h-1?u?e[c+1]:void 0:e[x+1],g&&e[x].equals(g))continue;y&&(_=y),f&&(m=f),f=e[x],y=g?g.sub(f)._unit()._perp():_,_||(_=y);let v=_.add(y);(v.x!==0||v.y!==0)&&v._unit();let w=_.x*y.x+_.y*y.y,b=v.x*y.x+v.y*y.y,T=b===0?1/0:1/b,P=2*Math.sqrt(2-2*b),S=b<HS&&m&&g,M=_.x*y.y-_.y*y.x>0;if(S&&x>c){let D=f.dist(m);if(D>2*d){let I=f.sub(f.sub(m)._mult(d/D)._round());this.updateDistance(m,I),this.addCurrentVertex(I,_,0,0,p),m=I}}let k=m&&g,R=k?i:u?"butt":r;if(k&&R==="round"&&(T<n?R="miter":T<=2&&(R="fakeround")),R==="miter"&&T>a&&(R="bevel"),R==="bevel"&&(T>2&&(R="flipbevel"),T<a&&(R="miter")),m&&this.updateDistance(m,f),R==="miter")v._mult(T),this.addCurrentVertex(f,v,0,0,p);else if(R==="flipbevel"){if(T>100)v=y.mult(-1);else{let D=T*_.add(y).mag()/_.sub(y).mag();v._perp()._mult(D*(M?-1:1))}this.addCurrentVertex(f,v,0,0,p),this.addCurrentVertex(f,v.mult(-1),0,0,p)}else if(R==="bevel"||R==="fakeround"){let D=-Math.sqrt(T*T-1),I=M?D:0,C=M?0:D;if(m&&this.addCurrentVertex(f,_,I,C,p),R==="fakeround"){let E=Math.round(P*180/Math.PI/20);for(let F=1;F<E;F++){let B=F/E;if(B!==.5){let H=B-.5,ce=1.0904+w*(-3.2452+w*(3.55645-w*1.43519)),Fe=.848013+w*(-1.06021+w*.215638);B+=B*H*(B-1)*(ce*H*H+Fe)}let j=y.sub(_)._mult(B)._add(_)._unit()._mult(M?-1:1);this.addHalfVertex(f,j.x,j.y,!1,M,0,p)}}g&&this.addCurrentVertex(f,y,-I,-C,p)}else if(R==="butt")this.addCurrentVertex(f,v,0,0,p);else if(R==="square"){let D=m?1:-1;this.addCurrentVertex(f,v,D,D,p)}else R==="round"&&(m&&(this.addCurrentVertex(f,_,0,0,p),this.addCurrentVertex(f,_,1,1,p,!0)),g&&(this.addCurrentVertex(f,y,-1,-1,p,!0),this.addCurrentVertex(f,y,0,0,p)));if(S&&x<h-1){let D=f.dist(g);if(D>2*d){let I=f.add(g.sub(f)._mult(d/D)._round());this.updateDistance(f,I),this.addCurrentVertex(I,y,0,0,p),f=I}}}}addCurrentVertex(e,t,i,r,a,n=!1){let s=t.x+t.y*i,o=t.y-t.x*i,l=-t.x+t.y*r,u=-t.y-t.x*r;this.addHalfVertex(e,s,o,n,!1,i,a),this.addHalfVertex(e,l,u,n,!0,-r,a),this.distance>vm/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(e,t,i,r,a,n))}addHalfVertex({x:e,y:t},i,r,a,n,s,o){let l=(this.lineClips?this.scaledDistance*(vm-1):this.scaledDistance)*X0;if(this.layoutVertexArray.emplaceBack((e<<1)+ +!!a,(t<<1)+ +!!n,Math.round(63*i)+128,Math.round(63*r)+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++),n?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(e,t){this.distance+=e.dist(t),this.updateScaledDistance()}hasLineDasharray(e){for(let t of e){let i=t.paint.get("line-dasharray");
5if(i&&!i.isConstant())return!0}return!1}addLineDashDependencies(e,t,i,r){for(let a of e){let n=a.paint.get("line-dasharray");if(!n||n.value.kind==="constant")continue;let s=a.layout.get("line-cap").evaluate(t,{})==="round",o={dasharray:n.value.evaluate({zoom:i-1},t,{}),round:s},l={dasharray:n.value.evaluate({zoom:i},t,{}),round:s},u={dasharray:n.value.evaluate({zoom:i+1},t,{}),round:s},h=`${o.dasharray.join(",")},${o.round}`,c=`${l.dasharray.join(",")},${l.round}`,d=`${u.dasharray.join(",")},${u.round}`;r.dashDependencies[h]=o,r.dashDependencies[c]=l,r.dashDependencies[d]=u,t.dashes[a.id]={min:h,mid:c,max:d}}}};G("LineBucket",Y0,{omit:["layers","patternFeatures"]});let XS;const YS=()=>XS||(XS=new Dt({"line-cap":new ee(z.layout_line["line-cap"],"line-cap"),"line-join":new ee(z.layout_line["line-join"],"line-join"),"line-miter-limit":new ee(z.layout_line["line-miter-limit"],"line-miter-limit"),"line-round-limit":new ee(z.layout_line["line-round-limit"],"line-round-limit"),"line-sort-key":new ee(z.layout_line["line-sort-key"],"line-sort-key")}));let KS;const JS=()=>KS||(KS=new Dt({"line-opacity":new ee(z.paint_line["line-opacity"],"line-opacity"),"line-layer-opacity":new N(z.paint_line["line-layer-opacity"],"line-layer-opacity"),"line-color":new ee(z.paint_line["line-color"],"line-color"),"line-translate":new N(z.paint_line["line-translate"],"line-translate"),"line-translate-anchor":new N(z.paint_line["line-translate-anchor"],"line-translate-anchor"),"line-width":new ee(z.paint_line["line-width"],"line-width"),"line-gap-width":new ee(z.paint_line["line-gap-width"],"line-gap-width"),"line-offset":new ee(z.paint_line["line-offset"],"line-offset"),"line-blur":new ee(z.paint_line["line-blur"],"line-blur"),"line-dasharray":new cs(z.paint_line["line-dasharray"],"line-dasharray"),"line-pattern":new cs(z.paint_line["line-pattern"],"line-pattern"),"line-gradient":new Wl(z.paint_line["line-gradient"],"line-gradient")}));
vendor: 10,521 bytes, line 5
5var xm={get paint(){return JS()},get layout(){return YS()}},QS=class extends ee{possiblyEvaluate(e,t){return t=new Be(Math.floor(t.zoom),{now:t.now,fadeDuration:t.fadeDuration,zoomHistory:t.zoomHistory,transition:t.transition}),super.possiblyEvaluate(e,t)}evaluate(e,t,i,r){return t=W({},t,{zoom:Math.floor(t.zoom)}),super.evaluate(e,t,i,r)}};let fo;const eD=e=>e.type==="line";var tD=class extends Li{constructor(e,t){super(e,xm,t),this.gradientVersion=0,fo||(fo=new QS(xm.paint.properties["line-width"].specification,"line-floorwidth"),fo.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(e){if(e==="line-gradient"){let t=this.gradientExpression();this.stepInterpolant=Z2(t)?t._styleExpression.expression instanceof vd:!1,this.gradientVersion=(this.gradientVersion+1)%(2**53-1)}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(e,t){super.recalculate(e,t),this.paint._values["line-floorwidth"]=fo.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,e)}createBucket(e){return new Y0(e)}queryRadius(e){let t=e,i=bm(Na("line-width",this,t),Na("line-gap-width",this,t)),r=Na("line-offset",this,t);return i/2+Math.abs(r)+Xl(this.paint.get("line-translate"))}queryIntersectsFeature({queryGeometry:e,feature:t,featureState:i,geometry:r,transform:a,pixelsToTileUnits:n}){let s=Yl(e,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),-a.bearingInRadians,n),o=n/2*bm(this.paint.get("line-width").evaluate(t,i),this.paint.get("line-gap-width").evaluate(t,i)),l=this.paint.get("line-offset").evaluate(t,i);return l&&(r=nE(r,l*n)),QT(s,r,o)}isTileClipped(){return!0}};function bm(e,t){return t>0?t+2*e:e}const iD=tt([{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),rD=tt([{name:"a_projected_pos",components:3,type:"Float32"}],4);tt([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const aD=tt([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_box_real",components:2,type:"Int16"}]);tt([{type:"Int16",name:"anchorPointX"},{type:"Int16",name:"anchorPointY"},{type:"Int16",name:"x1"},{type:"Int16",name:"y1"},{type:"Int16",name:"x2"},{type:"Int16",name:"y2"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]);const wm=tt([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),nD=tt([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);tt([{name:"triangle",components:3,type:"Uint16"}]),tt([{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"}]),tt([{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"}]),tt([{type:"Float32",name:"offsetX"}]),tt([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),tt([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);const pl=new class{constructor(){this.TIMEOUT=5e3,this.applyArabicShaping=null,this.processBidirectionalText=null,this.processStyledBidirectionalText=null,this.pluginStatus="unavailable",this.pluginURL=null,this.loadScriptResolve=()=>{}}setState(e){this.pluginStatus=e.pluginStatus,this.pluginURL=e.pluginURL}getState(){return{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}}setMethods(e){if(pl.isParsed())throw Error("RTL text plugin already registered.");this.applyArabicShaping=e.applyArabicShaping,this.processBidirectionalText=e.processBidirectionalText,this.processStyledBidirectionalText=e.processStyledBidirectionalText,this.loadScriptResolve()}isParsed(){return this.applyArabicShaping!=null&&this.processBidirectionalText!=null&&this.processStyledBidirectionalText!=null}getRTLTextPluginStatus(){return this.pluginStatus}async syncState(e,t){if(this.isParsed())return this.getState();if(e.pluginStatus!=="loading")return this.setState(e),e;let i=e.pluginURL,r=new Promise(n=>{this.loadScriptResolve=n}),a=new Promise(n=>setTimeout(()=>n(),this.TIMEOUT));if(await t(i),await Promise.race([r,a]),this.isParsed()){let n={pluginStatus:"loaded",pluginURL:i};return this.setState(n),n}throw this.setState({pluginStatus:"error",pluginURL:""}),Error(`RTL Text Plugin failed to import scripts from ${i}`)}};function sD(e){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(e))}function oD(e){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(e))}function lD(e){return/[\u02EA\u02EB\u1100-\u11FF\u2E80-\u2FDF\u3000-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u4DBF\u4E00-\uA48C\uA490-\uA4C6\uA960-\uA97C\uAC00-\uD7C6\uD7CB-\uD7FB\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(e))}function uD(e){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(e))}function Kl(e){return/[\u02EA\u02EB\u1100-\u11FF\u1401-\u167F\u18B0-\u18FF\u2065\u20
5DD-\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(e))}function hD(e){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(e))}function cD(e){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-\uDE4
50\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(e)}function Tm(e){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(e))}function dD(e,t){return/(?:[\u1039\u17D2\u1A60\u1BAB\u200D\uAAF6]|\uD802\uDE3F|\uD804[\uDD33\uDFD0]|\uD806[\uDD3E\uDE47\uDE99]|\uD807[\uDD45\uDD97\uDF42])$/.test(e)||new RegExp("^\\p{gc=Mc}","u").test(t)}const pD={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"},fD={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,6437
vendor: 11,376 bytes, line 5
57],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]},mD={لآ:[65269,65270],لأ:[65271,65272],لإ:[65273,65274],لا:[65275,65276]},Em=1604,gD=/[\u0600-\u06ff\u0750-\u077f\u0870-\u089f\u08a0-\u08ff\ufb50-\ufdff\ufe70-\ufeff]/;function _D(e,t,i){let r=0;for(let a of e.split(";")){let[n,s]=a.split(",").map(l=>parseInt(l,36)),o=r+n;for(let l=o;l<o+s;l++)i.set(l,t);r=o+s}}const K0=new Map;for(let[e,t]of Object.entries(pD))_D(t,e,K0);function yD(e){return K0.get(e)??"U"}function vD(e){return e==="D"||e==="L"||e==="C"}function xD(e){return e==="D"||e==="R"||e==="C"}function bD(e,t,i){return e==="D"?t&&i?3:t?1:i?2:0:e==="R"?+!!t:e==="L"?i?2:0:null}function wD(e){return[...e].map(t=>{let i=t.codePointAt(0);return{codePoint:i,type:yD(i),form:null}})}function TD(e){let t=e.filter(i=>i.type!=="T");for(let i=0;i<t.length;i++){let r=t[i],a=i>0&&vD(t[i-1].type),n=i+1<t.length&&xD(t[i+1].type);r.form=bD(r.type,a,n)}}function ED(e){let t=!1;for(let i of e)i.type==="T"?i.form=t?3:0:t=i.form===2||i.form===3}function SD(e){let t=[];for(let i=0;i<e.length;i++){let r=e[i];if(r.codePoint!==Em){t.push(r);continue}let a=i+1;for(;a<e.length&&e[a].type==="T";)a++;let n=e[a],s=n&&mD[String.fromCodePoint(Em,n.codePoint)];if(!s){t.push(r);continue}let o=r.form===3||r.form===1;t.push({codePoint:s[+!!o],type:"R",form:0}),t.push(...e.slice(i+1,a)),i=a}return t}function DD(e){if(e.form===null)return e.codePoint;let t=fD[e.codePoint];return t&&(t[e.form]||t[0])||e.codePoint}function CD(e){if(!gD.test(e))return e;let t=wD(e);return TD(t),ED(t),SD(t).map(i=>String.fromCodePoint(DD(i))).join("")}function PD(e,t,i){let r=t.layout.get("text-transform").evaluate(i,{});return r==="uppercase"?e=e.toLocaleUpperCase():r==="lowercase"&&(e=e.toLocaleLowerCase()),(pl.applyArabicShaping??CD)(e)}function AD(e,t,i){for(let r of e.sections)r.text=PD(r.text,t,i);return e}function Ku(e,t,i){let r=i?t.last.points:t.first.points,a=i?r[r.length-1]:r[0];return`${e}:${a.x}:${a.y}`}function ID(e){let t=e.first.points,i=t.length;for(let n=e.first.next;n;n=n.next)i+=n.points.length-1;let r=Array(i);for(let n=0;n<t.length;n++)r[n]=t[n];let a=t.length;for(let n=e.first.next;n;n=n.next){let s=n.points;for(let o=1;o<s.length;o++)r[a++]=s[o]}return r}function Sm(e,t,i,r,a){let n=t[i];delete t[i],t[r]=n;let s=e[n];return s.last.next=a.first,s.last=a.last,n}function Dm(e,t,i,r,a){let n=t[r];delete t[r],t[i]=n;let s=e[n];return a.last.next=s.first,s.first=a.first,n}function MD(e){let t={},i={},r=[];for(let n of e){let s=n.text?n.text.toString():null,o={points:n.geometry[0],next:null},l={feature:n,first:o,last:o};if(!s){r.push(l);continue}let u=Ku(s,l),h=Ku(s,l,!0);if(u in i&&h in t&&i[u]!==t[h]){let c=Dm(r,t,u,h,l),d=Sm(r,i,u,h,r[c]);delete t[u],delete i[h],i[Ku(s,r[d],!0)]=d,r[c].feature.geometry=null}else if(u in i)Sm(r,i,u,h,l);else if(h in t)Dm(r,t,u,h,l);else{let c=r.push(l)-1;t[u]=c,i[h]=c}}let a=[];for(let n of r){let s=n.feature;s.geometry&&(n.first.next&&(s.geometry[0]=ID(n)),a.push(s))}return a}const J0=typeof Intl<"u"&&"Segmenter"in Intl;let Cm,Pm;function Cc(e){if(!J0||!cD(e))return[...e];Cm??(Cm=new Intl.Segmenter(void 0,{granularity:"grapheme"}));let t=[];for(let{segment:i}of Cm.segment(e)){let r=t.length-1;r>=0&&dD(t[r],i)?t[r]+=i:t.push(i)}return t}function FD(e){let t=new Set;if(J0){Pm??(Pm=new Intl.Segmenter(void 0,{granularity:"word"}));for(let{index:r}of Pm.segment(e))t.add(r);return t}let i=0;for(let r of e.split(new RegExp("\\b|(?=\\p{Ideo})","u")))t.add(i),i+=r.length;return t}function fl(e){let t=e.codePointAt(0);return e.length>(t>65535?2:1)}function Zd(e){return/\s/u.test(String.fromCodePoint(e))}function Pc(e){for(let t of e)if(Kl(t.codePointAt(0)))return!0;return!1}function zD(e){for(let t of e)if(!RD(t.codePointAt(0)))return!1;return!0}function RD(e){return!sD(e)}function Am(e){return!(Kl(e)||hD(e))}function Q0(e){return new RegExp("\\p{sc=Arab}","u").test(String.fromCodePoint(e))}function e1(e){return oD(e)}function t1(e){for(let t of e)if(e1(t.codePointAt(0)))return!0;return!1}const Oa={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","⋯":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};function kD(e){let t="",i={premature:!0,value:void 0},r=e[Symbol.iterator](),a=r.next(),n=e[Symbol.iterator]();n.next();let s=n.next();for(;!a.done;)(s.done||!Am(s.value.codePointAt(0))||Oa[s.value])&&(i.premature||!Am(i.value.codePointAt(0))||Oa[i.value])&&Oa[a.value]?t+=Oa[a.value]:t+=a.value,i={value:a.value,premature:!1},a=r.next(),s=n.next();return t}const LD={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},BD={40:!0};function Im(e,t,i,r,a,n){if("fontStack"in t){let s=i[t.fontStack],o=s==null?void 0:s[e];if(o)return o.metrics.advance*t.scale+a;let l=0;for(let u of e){let h=s==null?void 0:s[u];h&&(l+=h.metrics.advance*t.scale+a)}return l}{let s=r[t.imageName];return s?s.displaySize[0]*t.scale*24/n+a:0}}function Mm(e,t,i,r){let a=(e-t)**2;return r?e<t?a/2:a*2:a+Math.abs(i)*i}function Fm(e){return/^\s+$/u.test(e)}function OD(e,t,i){let r=0;return(e===10||e===13)&&(r-=1e4),i&&(r+=150),(e===40||e===65288)&&(r+=50),(t===41||t===65289)&&(r+=50),r}function zm(e,t,i,r,a,n){let s=null,o=Mm(t,i,a,n);for(let l of r){let u=Mm(t-l.x,i,a,n)+l.badness;u<=o&&(s=l,o=u)}return{index:e,x:t,priorBreak:s,badness:o}}function i1(e){return e?i1(e.priorBreak).concat(e.index):[]}var qd=class Ac{constructor(t="",i=[],r=[]){this.text=t,this.sections=i,this.sectionIndex=r,this.imageSectionID=null,this._graphemes=null}graphemes(){return this._graphemes??(this._graphemes=Cc(this.text)),this._graphemes}static fromFeature(t,i){let r=new Ac;for(let a of t.sections)a.image?r.addImageSection(a):r.addTextSection(a,i);return r}length(){return this.graphemes().length}getSection(t){return this.sections[this.sectionIndex[t]]}getSectionIndex(t){return this.sectionIndex[t]}verticalizePunctuation(){this.text=kD(this.text),this._graphemes=null}hasZeroWidthSpaces(){return this.text.includes("​")}trim(){let t=this.graphemes(),i=0;for(;i<t.length&&Fm(t[i]);)i++;let r=t.length;for(;r>i&&Fm(t[r-1]);)r--;this.text=t.slice(i,r).join(""),this.sectionIndex=this.sectionIndex.slice(i,r),this._graphemes=null}substring(t,i){let r=this.graphemes().slice(t,i).join(""),a=this.sectionIndex.slice(t,i);return new Ac(r,this.sections,a)}toCodeUnitIndex(t){return this.graphemes().slice(0,t).join("").length}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((t,i)=>Math.max(t,this.sections[i].scale),0)}getMaxImageSize(t){let i=0,r=0;for(let a=0;a<this.length();a++){let n=this.getSection(a);if("imageName"in n){let s=t[n.imageName];if(!s)continue;let o=s.displaySize;i=Math.max(i,o[0]),r=Math.max(r,o[1])}}return{maxImageWidth:i,maxImageHeight:r}}_appendSection(t,i){let r=this.graphemes(),a=r.length>0?r[r.length-1]:"",n=Cc(a+t);this.text+=t,this._graphemes=r.slice(0,a?-1:void 0).concat(n);let s=n.length-+!!a;for(let o=0;o<s;o++)this.sectionIndex.push(i)}addTextSection(t,i){this.sections.push({scale:t.scale||1,verticalAlign:t.verticalAlign||"bottom",fontStack:t.fontStack||i}),this._appendSection(t.text,this.sections.length-1)}addImageSection(t){let i=t.image?t.image.name:"";if(i.length===0){xe("Can't add FormattedSection with an empty image.");return}let r=this.getNextImageSectionCharCode();if(!r){xe("Reached maximum number of images 6401");return}this.sections.push({scale:1,verticalAlign:t.verticalAlign||"bottom",imageName:i}),this._appendSection(String.fromCharCode(r),this.sections.length-1)}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}determineLineBreaks(t,i,r,a,n){let s=[],o=this.determineAverageLineWidth(t,i,r,a,n),l=this.hasZeroWidthSpaces(),u=this.graphemes(),h=null,c=0,d=0;for(let p=0;p<u.length;p++){let f=u[p];if(p>0){let m=u[p-1].codePointAt(0),g=f.codePointAt(0),_=uD(m),y=Tm(m)&&Tm(g);(LD[m]||_||"imageName"in this.getSection(p-1)||u[p+1]!==void 0&&BD[g]||y&&(h??(h=FD(this.text))).has(d))&&s.push(zm(p,c,o,s,OD(m,g,_&&l),!1))}Zd(f.codePointAt(0))||(c+=Im(f,this.getSection(p),r,a,t,n)),d+=f.length}return i1(zm(this.length(),c,o,s,0,!0))}determineAverageLineWidth(t,i,r,a,n){let s=0,o=0;for(let u of this.graphemes()){let h=this.getSection(o);s+=Im(u,h,r,a,t,n),o++}let l=Math.max(1,Math.ceil(s/i));return s/l}};function $D(){return function(e){var t={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,
5119d+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"},i={},r={};i.L=1,r[1]="L",Object.keys(t).forEach(function(Z,re){i[Z]=1<<re+1,r[i[Z]]=Z}),Object.freeze(i);var a=i.LRI|i.RLI|i.FSI,n=i.L|i.R|i.AL,s=i.B|i.S|i.WS|i.ON|i.FSI|i.LRI|i.RLI|i.PDI,o=i.BN|i.RLE|i.LRE|i.RLO|i.LRO|i.PDF,l=i.S|i.WS|i.B|a|i.PDI|o,u=null;function h(){if(!u){u=new Map;var Z=0;for(var re in t)if(t.hasOwnProperty(re))for(var ne=t[re],$="",se=void 0,J=!1,te=0,q=0;q<=ne.length+1;q+=1){var Ee=ne[q];if(Ee!==","&&q!==ne.length)Ee==="+"?(J=!0,te=Z=te+parseInt($,36),$=""):$+=Ee;else{J?se=Z+parseInt($,36):(te=Z=te+parseInt($,36),se=Z),J=!1,$="",te=se;for(var Se=Z;Se<se+1;Se+=1)u.set(Se,i[re])}}}}function c(Z){return h(),u.get(Z.codePointAt(0))||i.L}function d(Z){return r[c(Z)]}var p={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 f(Z,re){var ne=0,$=new Map,se=re&&new Map,J;return Z.split(",").forEach(function te(q){if(q.indexOf("+")!==-1)for(var Ee=+q;Ee--;)te(J);else{J=q;var Se=q.split(">"),oe=Se[0],at=Se[1];oe=String.fromCodePoint(ne+=parseInt(oe,36)),at=String.fromCodePoint(ne+=parseInt(at,36)),$.set(oe,at),re&&se.set(at,oe)}}),{map:$,reverseMap:se}}var m,g,_;function y(){if(!m){var Z=f(p.pairs,!0),re=Z.map,ne=Z.reverseMap;m=re,g=ne,_=f(p.canonical,!1).map}}function x(Z){return y(),m.get(Z)||null}function v(Z){return y(),g.get(Z)||null}function w(Z){return y(),_.get(Z)||null}var b=i.L,T=i.R,P=i.EN,S=i.ES,M=i.ET,k=i.AN,R=i.CS,D=i.B,I=i.S,C=i.ON,E=i.BN,F=i.NSM,B=i.AL,j=i.LRO,H=i.RLO,ce=i.LRE,Fe=i.RLE,pe=i.PDF,Ve=i.LRI,Te=i.RLI,Ne=i.FSI,Ce=i.PDI;function st(Z,re){for(var ne=125,$=new Uint32Array(Z.length),se=0;se<Z.length;se++)$[se]=c(Z[se]);var J=new Map;function te(Yt,Ci){var Kt=$[Yt];$[Yt]=Ci,J.set(Kt,J.get(Kt)-1),Kt&s&&J.set(s,J.get(s)-1),J.set(Ci,(J.get(Ci)||0)+1),Ci&s&&J.set(s,(J.get(s)||0)+1)}for(var q=new Uint8Array(Z.length),Ee=new Map,Se=[],oe=null,at=0;at<Z.length;at++)oe||Se.push(oe={start:at,end:Z.length-1,level:re==="rtl"?1:re==="ltr"?0:sf(at,!1)}),$[at]&D&&(oe.end=at,oe=null);for(var Br=Fe|ce|H|j|a|Ce|pe|D,tr=function(Yt){return Yt+(Yt&1?1:2)},Bi=function(Yt){return Yt+(Yt&1?2:1)},Oi=0;Oi<Se.length;Oi++){oe=Se[Oi];var Ge=[{_level:oe.level,_override:0,_isolate:0}],je=void 0,di=0,Di=0,ya=0;J.clear();for(var ht=oe.start;ht<=oe.end;ht++){var ft=$[ht];if(je=Ge[Ge.length-1],J.set(ft,(J.get(ft)||0)+1),ft&s&&J.set(s,(J.get(s)||0)+1),ft&Br)if(ft&(Fe|ce)){q[ht]=je._level;var va=(ft===Fe?Bi:tr)(je._level);va<=ne&&!di&&!Di?Ge.push({_level:va,_override:0,_isolate:0}):di||Di++}else if(ft&(H|j)){q[ht]=je._level;var Rp=(ft===H?Bi:tr)(je._level);Rp<=ne&&!di&&!Di?Ge.push({_level:Rp,_override:ft&H?T:b,_isolate:0}):di||Di++}else if(ft&a){ft&Ne&&(ft=sf(ht+1,!0)===1?Te:Ve),q[ht]=je._level,je._override&&te(ht,je._override);var kp=(ft===Te?Bi:tr)(je._level);kp<=ne&&di===0&&Di===0?(ya++,Ge.push({_level:kp,_override:0,_isolate:1,_isolInitIndex:ht})):di++}else if(ft&Ce){if(di>0)di--;else if(ya>0){for(Di=0;!Ge[Ge.length-1]._isolate;)Ge.pop();var lu=Ge[Ge.length-1]._isolInitIndex;lu!=null&&(Ee.set(lu,ht),Ee.set(ht,lu)),Ge.pop(),ya--}je=Ge[Ge.length-1],q[ht]=je._level,je._override&&te(ht,je._override)}else ft&pe?(di===0&&(Di>0?Di--:!je._isolate&&Ge.length>1&&(Ge.pop(),je=Ge[Ge.length-1])),q[ht]=je._level):ft&D&&(q[ht]=oe.level);else q[ht]=je._level,je._override&&ft!==E&&te(ht,je._override)}for(var xa=[],$i=null,Or=oe.start;Or<=oe.end;Or++){var uu=$[Or];if(!(uu&o)){var Lp=q[Or],Bp=uu&a,Bx=uu===Ce;$i&&Lp===$i._level?($i._end=Or,$i._endsWithIsolInit=Bp):xa.push($i={_start:Or,_end:Or,_level:Lp,_startsWithPDI:Bx,_endsWithIsolInit:Bp})}}for(var hu=[],$s=0;$s<xa.length;$s++){var js=xa[$s];if(!js._startsWithPDI||js._startsWithPDI&&!Ee.has(js._start)){for(var cu=[$i=js],Op=void 0;$i&&$i._endsWithIsolInit&&(Op=Ee.get($i._end))!=null;)for(var Vs=$s+1;Vs<xa.length;Vs++)if(xa[Vs]._start===Op){cu.push($i=xa[Vs]);break}for(var ba=[],du=0;du<cu.length;du++)for(var $p=cu[du],pu=$p._start;pu<=$p._end;pu++)ba.push(pu);for(var Ox=q[ba[0]],jp=oe.level,Ns=ba[0]-1;Ns>=0;Ns--)if(!($[Ns]&o)){jp=q[Ns];break}var fu=ba[ba.length-1],$x=q[fu],Vp=oe.level;if(!($[fu]&a)){for(var Us=fu+1;Us<=oe.end;Us++)if(!($[Us]&o)){Vp=q[Us];break}}hu.push({_seqIndices:ba,_sosType:Math.max(jp,Ox)%2?T:b,_eosType:Math.max(Vp,$x)%2?T:b})}}for(var mu=0;mu<hu.length;mu++){var gu=hu[mu],ie=gu._seqIndices,fn=gu._sosType,jx=gu._eosType,wa=q[ie[0]]&1?T:b;if(J.get(F))for(var Gs=0;Gs<ie.length;Gs++){var Np=ie[Gs];if($[Np]&F){for(var _u=fn,Zs=Gs-1;Zs>=0;Zs--)if(!($[ie[Zs]]&o)){_u=$[ie[Zs]];break}te(Np,_u&(a|Ce)?C:_u)}}if(J.get(P))for(var qs=0;qs<ie.length;qs++){var Up=ie[qs];if($[Up]&P)for(var Ws=qs-1;Ws>=-1;Ws--){var Gp=Ws===-1?fn:$[ie[Ws]];if(Gp&n){Gp===B&&te(Up,k);break}}}if(J.get(B))for(var yu=0;yu<ie.length;yu++){var Zp=ie[yu];$[Zp]&B&&te(Zp,T)}if(J.get(S)||J.get(R))for(var mn=1;mn<ie.length-1;mn++){var vu=ie[mn];if($[vu]&(S|R)){for(var Ta=0,xu=0,bu=mn-1;bu>=0&&(Ta=$[ie[bu]],Ta&o);bu--);for(var wu=mn+1;wu<ie.length&&(xu=$[ie[wu]],xu&o);wu++);Ta===xu&&($[vu]===S?Ta===P:Ta&(P|k))&&te(vu,Ta)}}if(J.get(P)){for(var ji=0;ji<ie.length;ji++)if($[ie[ji]]&P){for(var Hs=ji-1;Hs>=0&&$[ie[Hs]]&(M|o);Hs--)te(ie[Hs],P);for(ji++;ji<ie.length&&$[ie[ji]]&(M|o|P);
vendor: 2,222 bytes, line 5
5ji++)$[ie[ji]]!==P&&te(ie[ji],P)}}if(J.get(M)||J.get(S)||J.get(R))for(var gn=0;gn<ie.length;gn++){var qp=ie[gn];if($[qp]&(M|S|R)){te(qp,C);for(var Xs=gn-1;Xs>=0&&$[ie[Xs]]&o;Xs--)te(ie[Xs],C);for(var Ys=gn+1;Ys<ie.length&&$[ie[Ys]]&o;Ys++)te(ie[Ys],C)}}if(J.get(P))for(var Tu=0,Wp=fn;Tu<ie.length;Tu++){var Hp=ie[Tu],Eu=$[Hp];Eu&P?Wp===b&&te(Hp,b):Eu&n&&(Wp=Eu)}if(J.get(s)){for(var _n=T|P|k,Xp=_n|b,Ks=[],Ea=[],Sa=0;Sa<ie.length;Sa++)if($[ie[Sa]]&s){var yn=Z[ie[Sa]],Yp=void 0;if(x(yn)!==null)if(Ea.length<63)Ea.push({char:yn,seqIndex:Sa});else break;else if((Yp=v(yn))!==null)for(var vn=Ea.length-1;vn>=0;vn--){var Su=Ea[vn].char;if(Su===Yp||Su===v(w(yn))||x(w(Su))===yn){Ks.push([Ea[vn].seqIndex,Sa]),Ea.length=vn;break}}}Ks.sort(function(Yt,Ci){return Yt[0]-Ci[0]});for(var Du=0;Du<Ks.length;Du++){for(var Kp=Ks[Du],Js=Kp[0],Cu=Kp[1],Jp=!1,Vi=0,Pu=Js+1;Pu<Cu;Pu++){var Qp=ie[Pu];if($[Qp]&Xp){Jp=!0;var ef=$[Qp]&_n?T:b;if(ef===wa){Vi=ef;break}}}if(Jp&&!Vi){Vi=fn;for(var Au=Js-1;Au>=0;Au--){var tf=ie[Au];if($[tf]&Xp){var rf=$[tf]&_n?T:b;Vi=rf===wa?wa:rf;break}}}if(Vi){if($[ie[Js]]=$[ie[Cu]]=Vi,Vi!==wa){for(var xn=Js+1;xn<ie.length;xn++)if(!($[ie[xn]]&o)){c(Z[ie[xn]])&F&&($[ie[xn]]=Vi);break}}if(Vi!==wa){for(var bn=Cu+1;bn<ie.length;bn++)if(!($[ie[bn]]&o)){c(Z[ie[bn]])&F&&($[ie[bn]]=Vi);break}}}}for(var xr=0;xr<ie.length;xr++)if($[ie[xr]]&s){for(var af=xr,Iu=xr,Mu=fn,wn=xr-1;wn>=0;wn--)if($[ie[wn]]&o)af=wn;else{Mu=$[ie[wn]]&_n?T:b;break}for(var nf=jx,Tn=xr+1;Tn<ie.length;Tn++)if($[ie[Tn]]&(s|o))Iu=Tn;else{nf=$[ie[Tn]]&_n?T:b;break}for(var Fu=af;Fu<=Iu;Fu++)$[ie[Fu]]=Mu===nf?Mu:wa;xr=Iu}}}for(var ii=oe.start;ii<=oe.end;ii++){var Vx=q[ii],Qs=$[ii];if(Vx&1?Qs&(b|P|k)&&q[ii]++:Qs&T?q[ii]++:Qs&(k|P)&&(q[ii]+=2),Qs&o&&(q[ii]=ii===0?oe.level:q[ii-1]),ii===oe.end||c(Z[ii])&(I|D))for(var eo=ii;eo>=0&&c(Z[eo])&l;eo--)q[eo]=oe.level}}return{levels:q,paragraphs:Se};function sf(Yt,Ci){for(var Kt=Yt;Kt<Z.length;Kt++){var br=$[Kt];if(br&(T|B))return 1;if(br&(D|b)||Ci&&br===Ce)return 0;if(br&a){var of=Nx(Kt);Kt=of===-1?Z.length:of}}return 0}function Nx(Yt){for(var Ci=1,Kt=Yt+1;Kt<Z.length;Kt++){var br=$[Kt];if(br&D)break;if(br&Ce){if(--Ci===0)return Kt}else br&a&&Ci++}return-1}}var Tt="14>1,j>2,t>2,u>2,1a>g,2v3>
51,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",Bt;function ze(){if(!Bt){var Z=f(Tt,!0),re=Z.map;Z.reverseMap.forEach(function(ne,$){re.set($,ne)}),Bt=re}}function Ue(Z){return ze(),Bt.get(Z)||null}function Ot(Z,re,ne,$){var se=Z.length;ne=Math.max(0,ne==null?0:+ne),$=Math.min(se-1,$==null?se-1:+$);for(var J=new Map,te=ne;te<=$;te++)if(re[te]&1){var q=Ue(Z[te]);q!==null&&J.set(te,q)}return J}function Ht(Z,re,ne,$){var se=Z.length;ne=Math.max(0,ne==null?0:+ne),$=Math.min(se-1,$==null?se-1:+$);var J=[];return re.paragraphs.forEach(function(te){var q=Math.max(ne,te.start),Ee=Math.min($,te.end);if(q<Ee){for(var Se=re.levels.slice(q,Ee+1),oe=Ee;oe>=q&&c(Z[oe])&l;oe--)Se[oe]=te.level;for(var at=te.level,Br=1/0,tr=0;tr<Se.length;tr++){var Bi=Se[tr];Bi>at&&(at=Bi),Bi<Br&&(Br=Bi|1)}for(var Oi=at;Oi>=Br;Oi--)for(var Ge=0;Ge<Se.length;Ge++)if(Se[Ge]>=Oi){for(var je=Ge;Ge+1<Se.length&&Se[Ge+1]>=Oi;)Ge++;Ge>je&&J.push([je+q,Ge+q])}}}),J}function jt(Z,re,ne,$){var se=Xt(Z,re,ne,$),J=[].concat(Z);return se.forEach(function(te,q){J[q]=(re.levels[te]&1?Ue(Z[te]):null)||Z[te]}),J.join("")}function Xt(Z,re,ne,$){for(var se=Ht(Z,re,ne,$),J=[],te=0;te<Z.length;te++)J[te]=te;return se.forEach(function(q){for(var Ee=q[0],Se=q[1],oe=J.slice(Ee,Se+1),at=oe.length;at--;)J[Se-at]=oe[at]}),J}return e.closingToOpeningBracket=v,e.getBidiCharType=c,e.getBidiCharTypeName=d,e.getCanonicalBracket=w,e.getEmbeddingLevels=st,e.getMirroredCharacter=Ue,e.getMirroredCharactersMap=Ot,e.getReorderSegments=Ht,e.getReorderedIndices=Xt,e.getReorderedString=jt,e.openingToClosingBracket=x,Object.defineProperty(e,"__esModule",{value:!0}),e}({})}const Wd=$D(),jD=/[\u061c\u200e\u200f\u202a-\u202e\u2066-\u2069]/,VD=new Set(["WS","FSI","LRI","RLI","PDI"]),ND=new Set(["S","B"]);function UD(e,t,i,r){let a=[],n=i;for(let s of Cc(e.slice(i,r)))a.push({index:n,text:s,level:t[n]}),n+=s.length;return a}function GD(e,t){let i=!0;for(let r=e.length-1;r>=0;r--){let a=Wd.getBidiCharTypeName(e[r].text[0]);ND.has(a)?(e[r].level=t,i=!0):i&&VD.has(a)?e[r].level=t:i=!1}}function ZD(e,t){let i=t,r=1/0;for(let{level:n}of e)n>i&&(i=n),(n|1)<r&&(r=n|1);let a=e.slice();for(let n=i;n>=r;n--)for(let s=0;s<a.length;s++){if(a[s].level<n)continue;let o=s;for(;o+1<a.length&&a[o+1].level>=n;)o++;for(let l=s,u=o;l<u;l++,u--)[a[l],a[u]]=[a[u],a[l]];s=o}return a}function qD(e){return e.level%2==0?e.text:Wd.getMirroredCharacter(e.text)??e.text}function WD(e,t){var i;return((i=e.find(r=>t>=r.start&&t<=r.end))==null?void 0:i.level)??0}function HD(e,t,i,r,a){let n=UD(e,t,r,a);GD(n,i);let s="",o=[];for(let l of ZD(n,i)){if(jD.test(l.text))continue;let u=qD(l);s+=u,o.push(...Array(u.length).fill(l.index))}return{text:s,sourceIndices:o}}function XD(e,t){let i=t.filter(n=>n>0&&n<e.length),r=[...new Set([0,...i,e.length])].sort((n,s)=>n-s),a=[];for(let n=0;n+1<r.length;n++)a.push([r[n],r[n+1]]);return a}function r1(e,t){let{levels:i,paragraphs:r}=Wd.getEmbeddingLevels(e);
vendor: 90,115 bytes, line 5
5return XD(e,t.concat(r.map(a=>a.start))).map(([a,n])=>HD(e,i,WD(r,a),a,n))}function YD(e,t){return r1(e,t).map(i=>i.text)}function KD(e,t,i){return r1(e,i).map(r=>[r.text,r.sourceIndices.map(a=>t[a]??0)])}const Rm=4294967296,km=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");var a1=class{constructor(e){this.buf=ArrayBuffer.isView(e)?e:new Uint8Array(e),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(e,t,i=this.length){let r;for(;r=this.nextField(i);)e(r,t,this);return t}readMessage(e,t){return this.readFields(e,t,this.readVarint()+this.pos)}readFixed32(){let e=this.dataView.getUint32(this.pos,!0);return this.pos+=4,e}readSFixed32(){let e=this.dataView.getInt32(this.pos,!0);return this.pos+=4,e}readFixed64(){let e=this.dataView.getUint32(this.pos,!0)+this.dataView.getUint32(this.pos+4,!0)*Rm;return this.pos+=8,e}readSFixed64(){let e=this.dataView.getUint32(this.pos,!0)+this.dataView.getInt32(this.pos+4,!0)*Rm;return this.pos+=8,e}readFloat(){let e=this.dataView.getFloat32(this.pos,!0);return this.pos+=4,e}readDouble(){let e=this.dataView.getFloat64(this.pos,!0);return this.pos+=8,e}readVarint(e){let t=this.buf,i=t[this.pos++];if(i<128)return i;let r=i&127,a;return a=t[this.pos++],r|=(a&127)<<7,a<128||(a=t[this.pos++],r|=(a&127)<<14,a<128)||(a=t[this.pos++],r|=(a&127)<<21,a<128)?r:(a=t[this.pos],r|=(a&15)<<28,JD(r,e,this))}readSVarint(){let e=this.readVarint();return e%2==1?(e+1)/-2:e/2}readBoolean(){return!!this.readVarint()}readString(){let e=this.readVarint()+this.pos,t=this.pos;return this.pos=e,e-t>=12&&km?km.decode(this.buf.subarray(t,e)):eC(this.buf,t,e)}readBytes(){let e=this.readVarint()+this.pos,t=this.buf.subarray(this.pos,e);return this.pos=e,t}readPackedVarint(e=[],t){let i=this.readPackedEnd();for(;this.pos<i;)e.push(this.readVarint(t));return e}readPackedSVarint(e=[]){let t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readSVarint());return e}readPackedBoolean(e=[]){let t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readBoolean());return e}readPackedFloat(e=[]){let t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readFloat());return e}readPackedDouble(e=[]){let t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readDouble());return e}readPackedFixed32(e=[]){let t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readFixed32());return e}readPackedSFixed32(e=[]){let t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readSFixed32());return e}readPackedFixed64(e=[]){let t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readFixed64());return e}readPackedSFixed64(e=[]){let t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readSFixed64());return e}readPackedEnd(){return this.type===2?this.readVarint()+this.pos:this.pos+1}nextField(e=this.length){if(this.pos===this._valueStart&&this.skip(this.type),this.pos>=e)return 0;let t=this.readVarint();return this.type=t&7,this._valueStart=this.pos,t>>>3}skip(e){let t=e&7;if(t===0)for(;this.buf[this.pos++]>127;);else if(t===2)this.pos=this.readVarint()+this.pos;else if(t===5)this.pos+=4;else if(t===1)this.pos+=8;else throw Error(`Unimplemented type: ${t}`)}};function JD(e,t,i){let r=i.buf,a,n;if(n=r[i.pos++],a=(n&112)>>4,n<128||(n=r[i.pos++],a|=(n&127)<<3,n<128)||(n=r[i.pos++],a|=(n&127)<<10,n<128)||(n=r[i.pos++],a|=(n&127)<<17,n<128)||(n=r[i.pos++],a|=(n&127)<<24,n<128)||(n=r[i.pos++],a|=(n&1)<<31,n<128))return QD(e,a,t);throw Error("Expected varint not more than 10 bytes")}function QD(e,t,i){return i?t*4294967296+(e>>>0):(t>>>0)*4294967296+(e>>>0)}function eC(e,t,i){let r="",a=t;for(;a<i;){let n=e[a],s=null,o=n>239?4:n>223?3:n>191?2:1;if(a+o>i)break;let l,u,h;o===1?n<128&&(s=n):o===2?(l=e[a+1],(l&192)==128&&(s=(n&31)<<6|l&63,s<=127&&(s=null))):o===3?(l=e[a+1],u=e[a+2],(l&192)==128&&(u&192)==128&&(s=(n&15)<<12|(l&63)<<6|u&63,(s<=2047||s>=55296&&s<=57343)&&(s=null))):o===4&&(l=e[a+1],u=e[a+2],h=e[a+3],(l&192)==128&&(u&192)==128&&(h&192)==128&&(s=(n&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,r+=String.fromCharCode(s>>>10&1023|55296),s=56320|s&1023),r+=String.fromCharCode(s),a+=o}return r}function tC(e,t,i){e===1&&i.readMessage(iC,t)}function iC(e,t,i){if(e===3){let{id:r,bitmap:a,width:n,height:s,left:o,top:l,advance:u}=i.readMessage(rC,{});t.push({id:r,bitmap:new Nd({width:n+6,height:s+6},a),metrics:{width:n,height:s,left:o,top:l,advance:u}})}}function rC(e,t,i){e===1?t.id=i.readVarint():e===2?t.bitmap=i.readBytes():e===3?t.width=i.readVarint():e===4?t.height=i.readVarint():e===5?t.left=i.readSVarint():e===6?t.top=i.readSVarint():e===7&&(t.advance=i.readVarint())}function aC(e){return new a1(e).readFields(tC,[])}function ml(e){return typeof(e==null?void 0:e.renderWithWebGL)=="function"}function nC(e){let{userImage:t}=e;return!(t!=null&&t.render)||!t.render()?!1:(ml(t.data)||e.data.replace(new Uint8Array(t.data.buffer)),!0)}function n1(e){let t=0,i=0;for(let s of e)t+=s.w*s.h,i=Math.max(i,s.w);e.sort((s,o)=>o.h-s.h);let r=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(t/.95)),i),h:1/0}],a=0,n=0;for(let s of e)for(let o=r.length-1;o>=0;o--){let l=r[o];if(!(s.w>l.w||s.h>l.h)){if(s.x=l.x,s.y=l.y,n=Math.max(n,s.y+s.h),a=Math.max(a,s.x+s.w),s.w===l.w&&s.h===l.h){let u=r.pop();u&&o<r.length&&(r[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):(r.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:a,h:n,fill:t/(a*n)||0}}var Hd=class{constructor(e,{pixelRatio:t,version:i,isWebGLImage:r=!1,stretchX:a,stretchY:n,content:s,textFitWidth:o,textFitHeight:l}){this.paddedRect=e,this.pixelRatio=t,this.stretchX=a,this.stretchY=n,this.content=s,this.version=i,this.needsFirstWebGLRender=r,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]}},sC=class{constructor(e,t){let i={},r={};this.haveRenderCallbacks=[],this.patchedUpdateVersion=-1;let a=[];this.addImages(e,i,a),this.addImages(t,r,a);let{w:n,h:s}=n1(a),o=new Ze({width:n||1,height:s||1});for(let l in e){let u=e[l];if(u.isWebGLImage)continue;let h=i[l].paddedRect;Ze.copy(u.data,o,{x:0,y:0},{x:h.x+1,y:h.y+1},u.data)}for(let l in t){let u=t[l],h=r[l].paddedRect,c=h.x+1,d=h.y+1,p=u.data.width,f=u.data.height;Ze.copy(u.data,o,{x:0,y:0},{x:c,y:d},u.data),Ze.copy(u.data,o,{x:0,y:f-1},{x:c,y:d-1},{width:p,height:1}),Ze.copy(u.data,o,{x:0,y:0},{x:c,y:d+f},{width:p,height:1}),Ze.copy(u.data,o,{x:p-1,y:0},{x:c-1,y:d},{width:1,height:f}),Ze.copy(u.data,o,{x:0,y:0},{x:c+p,y:d},{width:1,height:f})}this.image=o,this.iconPositions=i,this.patternPositions=r}addImages(e,t,i){for(let r in e){let a=e[r],n={x:0,y:0,w:a.data.width+2,h:a.data.height+2};i.push(n),t[r]=new Hd(n,a),a.hasRenderCallback&&this.haveRenderCallbacks.push(r)}}patchUpdatedImages(e,t){if(e.dispatchRenderCallbacks(this.haveRenderCallbacks),this.patchedUpdateVersion!==e.updateVersion){this.patchedUpdateVersion=e.updateVersion;for(let i in this.iconPositions)this.patchUpdatedImage(this.iconPositions[i],e.getImage(i),t);for(let i in this.patternPositions)this.patchUpdatedImage(this.patternPositions[i],e.getImage(i),t)}}patchUpdatedImage(e,t,i){var l;if(!e||!t||!e.needsFirstWebGLRender&&e.version===t.version)return;e.needsFirstWebGLRender=!1,e.version=t.version;let[r,a]=e.tl,n=(l=t.userImage)==null?void 0:l.data;if(!ml(n)){i.update(t.data,void 0,{x:r,y:a});return}let{width:s,height:o}=t.data;i.context.setCustomLayerDefaults(),n.renderWithWebGL({gl:i.context.gl,texture:i.texture,x:r,y:a,width:s,height:o}),i.context.setDirty()}};G("ImagePosition",Hd),G("ImageAtlas",sC);var s1=function(e){return e[e.none=0]="none",e[e.horizontal=1]="horizontal",e[e.vertical=2]="vertical",e[e.horizontalOnly=3]="horizontalOnly",e}(s1||{});function oC(e){for(let t of e)if(t.positionedGlyphs.length!==0)return!1;return!0}function lC(e,t){let i=[],r=0;for(let a of t)i.push(e.substring(r,a)),r=a;return r<e.length()&&i.push(e.substring(r,e.length())),i}const Lm=new RegExp("^\\p{gc=M}$","u");function uC(e){let t=[],i=0;for(;i<e.length;){if(!Lm.test(e[i])){t.push(i),i++;continue}let r=i;for(;r<e.length&&Lm.test(e[r]);)r++;let a=e[r];if(a!==void 0&&e1(a.codePointAt(0))){t.push(r);for(let n=r-1;n>=i;n--)t.push(n);i=r+1}else{for(let n=i;n<r;n++)t.push(n);i=r}}return t}function hC(e){let t=[],i=0;for(let r of e.graphemes())t.push(...Array(r.length).fill(e.sectionIndex[i])),i++;return t}function cC(e,t){let i=t.map(n=>e.toCodeUnitIndex(n)),r=pl.isParsed()?pl:null;if(e.sections.length===1)return r?r.processBidirectionalText(e.toString(),i).map(n=>Bm(n,e.sections,[...n].map(()=>0))):YD(e.toString(),i).map(n=>Ic([...n],e.sections,[...n].map(()=>0)));let a=hC(e);return r?r.processStyledBidirectionalText(e.text,a,i).map(([n,s])=>Bm(n,e.sections,s)):KD(e.text,a,i).map(([n,s])=>{let o=[...n];return Ic(o,e.sections,o1(o).map(l=>s[l]??0))})}function Ic(e,t,i){let r=new qd(e.join(""),t,[]),a=0;for(let n of r.graphemes())r.sectionIndex.push(i[a]??0),a+=[...n].length;return r}function o1(e){let t=[],i=0;for(let r of e)t.push(i),i+=r.length;return t}function Bm(e,t,i){let r=[...e],a=o1(r),n=uC(r);return Ic(n.map(s=>r[s]),t,n.map(s=>i[a[s]]??0))}function mo(e,t,i,r,a,n,s,o,l,u,h,c,d,p,f){let m=qd.fromFeature(e,a);c===2&&m.verticalizePunctuation();let g=m.determineLineBreaks(u,n,t,r,p),_=t1(m.text)?cC(m,g):lC(m,g),y=[],x={positionedLines:y,text:m.toString(),top:h[1],bottom:h[1],left:h[0],right:h[0],writingMode:c,iconsInText:!1,verticalizable:!1};return xC(x,t,i,r,_,s,o,l,c,u,d,f),!oC(y)&&x}function Jl(e){let t=.5,i=.5;switch(e){case"right":case"top-right":case"bottom-right":t=1;break;case"left":case"top-left":case"bottom-left":t=0}switch(e){case"bottom":case"bottom-right":case"bottom-left":i=1;break;case"top":case"top-right":case"top-left":i=0}return{horizontalAlign:t,verticalAlign:i}}function dC(e,t,i){let r=t.getMaxScale()*24,{maxImageWidth:a,maxImageHeight:n}=t.getMaxImageSize(e),s=Math.max(r,n*i);return{verticalLineContentWidth:Math.max(r,a*i),horizontalLineContentHeight:s}}function l1(e){switch(e){case"top":return 0;case"center":return .5;default:return 1}}function pC(e,t,i,r){var n;if(e!=null&&e.rect)return e;let a=(n=t[i.fontStack])==null?void 0:n[r];return a?{rect:null,metrics:a.metrics}:null}function fC(e,t,i){return!(e===1||!t&&!Kl(i)||t&&(Zd(i)||Q0(i)))}function No(e){return new RegExp("\\p{Nd}","u").test(String.fromCodePoint(e))}function u1(e){return new RegExp("\\p{Lu}","u").test(String.fromCodePoint(e))}function mC(e){return/[\p{P}\p{S}]/u.test(String.fromCodePoint(e))}function gC(e){let t=e.some(No)&&e.every(r=>No(r)||mC(r)),i=e.length<=3&&e.every(r=>u1(r)||No(r));return t||i}function _C(e){return(No(e)||u1(e))&&!Q0(e)}function yC(e,t){let i=!1;for(let r=0;r<e.length;r++){if(t[r])continue;let a=Oa[e[r]];a&&(r===0||t[r-1])&&(r===e.length-1||t[r+1])&&(e[r]=a,t[r]=!0,i=!0)}return i}function vC(e){let t=e.graphemes().slice(),i=t.map(n=>n.codePointAt(0)),r=i.map(Kl),a=n=>!r[n]&&!Zd(i[n])&&!("imageName"in e.getSection(n));for(let n=0;n<i.length;n++){if(!a(n))continue;let s=n;for(;s+1<i.length&&a(s+1);)s++;if(gC(i.slice(n,s+1)))for(let o=n;o<=s;o++)r[o]=_C(i[o]);n=s}return yC(t,r)&&(e.text=t.join(""),e._graphemes=null),r}function xC(e,t,i,r,a,n,s,o,l,u,h,c){var w;let d=0,p=0,f=0,m=0,g=o==="right"?1:o==="left"?0:.5,_=24/c,y=0;for(let b of a){b.trim();let T=b.getMaxScale(),P={positionedGlyphs:[],lineOffset:0};e.positionedLines[y]=P;let S=P.positionedGlyphs,M=0;if(!b.length()){p+=n,++y;continue}let k=dC(r,b,_),R=l===2&&!h?vC(b):null,D=b.graphemes();for(let E=0;E<D.length;E++){let F=b.getSection(E),B=D[E],j=B.codePointAt(0),H=R?R[E]:fC(l,h,j),ce="fontStack"in F&&fl(B)&&!((w=t[F.fontStack])!=null&&w[B])?[...B]:[B];for(let Fe of ce){let pe={glyph:Fe.codePointAt(0),grapheme:Fe,imageName:null,x:d,y:p+-17,vertical:H,scale:1,fontStack:"",sectionIndex:b.getSectionIndex(E),metrics:null,rect:null},Ve;if("fontStack"in F){if(Ve=bC(F,Fe,H,k,t,i),!Ve)continue;pe.fontStack=F.fontStack}else{if(e.iconsInText=!0,F.scale*=_,Ve=wC(F,H,T,k,r),!Ve)continue;M=Math.max(M,Ve.imageOffset),pe.imageName=F.imageName}let{rect:Te,metrics:Ne,baselineOffset:Ce}=Ve;if(pe.y+=Ce,pe.scale=F.scale,pe.metrics=Ne,pe.rect=Te,S.push(pe),!H)d+=Ne.advance*F.scale+u;else{e.verticalizable=!0;let st="imageName"in F?Ne.advance:24;d+=st*F.scale+u}}}if(S.length!==0){let E=d-u;f=Math.max(E,f),TC(S,0,S.length-1,g)}d=0;let I=(T-1)*24;P.lineOffset=Math.max(M,I);let C=n*T+M;p+=C,m=Math.max(C,m),++y}let{horizontalAlign:x,verticalAlign:v}=Jl(s);EC(e.positionedLines,g,x,v,f,m,n,p,a.length),e.top+=-v*p,e.bottom=e.top+p,e.left+=-x*f,e.right=e.left+f}function bC(e,t,i,r,a,n){var u;let s=(u=n[e.fontStack])==null?void 0:u[t],o=pC(s,a,e,t);if(o===null)return null;let l;if(i)l=r.verticalLineContentWidth-e.scale*24;else{let h=l1(e.verticalAlign);l=(r.horizontalLineContentHeight-e.scale*24)*h}return{rect:o.rect,metrics:o.metrics,baselineOffset:l}}function wC(e,t,i,r,a){let n=a[e.imageName];if(!n)return null;let s=n.paddedRect,o=n.displaySize,l={width:o[0],height:o[1],left:1,top:-3,advance:t?o[1]:o[0]},u;if(t)u=r.verticalLineContentWidth-o[1]*e.scale;else{let c=l1(e.verticalAlign);u=(r.horizontalLineContentHeight-o[1]*e.scale)*c}let h=(t?o[0]:o[1])*e.scale-24*i;return{rect:s,metrics:l,baselineOffset:u,imageOffset:h}}function TC(e,t,i,r){if(r===0)return;let a=e[i],n=a.metrics.advance*a.scale,s=(e[i].x+n)*r;for(let o=t;o<=i;o++)e[o].x-=s}function EC(e,t,i,r,a,n,s,o,l){let u=(t-i)*a,h=0;h=n===s?-r*l*s+.5*s:-o*r- -17;for(let c of e)for(let d of c.positionedGlyphs)d.x+=u,d.y+=h}function SC(e,t,i){let{horizontalAlign:r,verticalAlign:a}=Jl(i),n=t[0],s=t[1],o=n-e.displaySize[0]*r,l=o+e.displaySize[0],u=s-e.displaySize[1]*a;return{image:e,top:u,bottom:u+e.displaySize[1],left:o,right:l}}function h1(e){let t=e.left,i=e.top,r=e.right-t,a=e.bottom-i,n=e.image.content[2]-e.image.content[0],s=e.image.content[3]-e.image.content[1],o=e.image.textFitWidth??"stretchOrShrink",l=e.image.textFitHeight??"stretchOrShrink",u=n/s;if(l==="proportional"){if(o==="stretchOnly"&&r/a<u||o==="proportional"){let h=Math.ceil(a*u);t*=h/r,r=h}}else if(o==="proportional"&&l==="stretchOnly"&&u!==0&&r/a>u){let h=Math.ceil(r/u);i*=h/a,a=h}return{x1:t,y1:i,x2:t+r,y2:i+a}}function Om(e,t,i,r,a,n){let s=e.image,o;if(s.content){let g=s.content,_=s.pixelRatio||1;o=[g[0]/_,g[1]/_,s.displaySize[0]-g[2]/_,s.displaySize[1]-g[3]/_]}let l=t.left*n,u=t.right*n,h,c,d,p;i==="width"||i==="both"?(p=a[0]+l-r[3],c=a[0]+u+r[1]):(p=a[0]+(l+u-s.displaySize[0])/2,c=p+s.displaySize[0]);let f=t.top*n,m=t.bottom*n;return i==="height"||i==="both"?(h=a[1]+f-r[0],d=a[1]+m+r[2]):(h=a[1]+(f+m-s.displaySize[1])/2,d=h+s.displaySize[1]),{image:s,top:h,right:c,bottom:d,left:p,collisionPadding:o}}const $m=32640;function jm(e,t){let{expression:i}=t;if(i.kind==="constant")return{kind:"constant",layoutSize:i.evaluate(new Be(e+1))};if(i.kind==="source")return{kind:"source"};if(i.kind==="composite"){let{minZoom:r,maxZoom:a}=DC(i.zoomStops,e);return{kind:"composite",minZoom:r,maxZoom:a,interpolationType:i.interpolationType}}{let r=CC(i),a=i.evaluate(new Be(e+1));return{kind:"camera",zoomStops:i.zoomStops,sizes:r,layoutSize:a,interpolationType:i.interpolationType}}}function DC(e,t){let i=0;for(;i<e.length&&e[i]<=t;)i++;i=Math.max(0,i-1);let r=i;for(;r<e.length&&e[r]<t+1;)r++;return r=Math.min(e.length-1,r),{minZoom:e[i],maxZoom:e[r]}}function CC(e){return e.zoomStops.map(t=>e.evaluate(new Be(t===-1/0?e.zoomStops[1]-1:t)))}function Xd(e,{uSize:t,uSizeT:i},{lowerSize:r,upperSize:a}){return e.kind==="source"?r/128:e.kind==="composite"?Je.number(r/128,a/128,i):t}function Ql(e,t){let i=0,r=0;return e.kind==="constant"?r=e.layoutSize:e.kind==="camera"?r=PC(e,t):e.kind==="composite"&&(i=AC(e,t)),{uSizeT:i,uSize:r}}function PC({zoomStops:e,sizes:t,layoutSize:i,interpolationType:r},a){let n=e.length-1;for(;n>0&&e[n]>a;)n--;let s=Math.min(n+1,e.length-1),o=r?he(Ei.interpolationFactor(r,a,e[n],e[s]),0,1):0;return Math.min(Je.number(t[n],t[s],o),i)}function AC({interpolationType:e,minZoom:t,maxZoom:i},r){return e?he(Ei.interpolationFactor(e,r,t,i),0,1):0}var Ua=class c1 extends A{constructor(t,i,r,a){super(t,i),this.angle=r,a!==void 0&&(this.segment=a)}clone(){return new c1(this.x,this.y,this.angle,this.segment)}};G("Anchor",Ua);function d1(e,t,i,r,a){if(t.segment===void 0||i===0)return!0;let n=t,s=t.segment+1,o=0;for(;o>-i/2;){if(s--,s<0)return!1;o-=e[s].dist(n),n=e[s]}o+=e[s].dist(e[s+1]),s++;let l=[],u=0;for(;o<i/2;){let h=e[s-1],c=e[s],d=e[s+1];if(!d)return!1;let p=h.angleTo(c)-c.angleTo(d);for(p=Math.abs((p+3*Math.PI)%(Math.PI*2)-Math.PI),l.push({distance:o,angleDelta:p}),u+=p;o-l[0].distance>r;)u-=l.shift().angleDelta;if(u>a)return!1;s++,o+=c.dist(d)}return!0}function p1(e){let t=0;for(let i=0;i<e.length-1;i++)t+=e[i].dist(e[i+1]);return t}function f1(e,t,i){return e?3/5*t*i:0}function m1(e,t){return Math.max(e?e.right-e.left:0,t?t.right-t.left:0)}function IC(e,t,i,r,a,n){let s=f1(i,a,n),o=m1(i,r)*n,l=0,u=p1(e)/2;for(let h=0;h<e.length-1;h++){let c=e[h],d=e[h+1],p=c.dist(d);if(l+p>u){let f=(u-l)/p,m=new Ua(Je.number(c.x,d.x,f),Je.number(c.y,d.y,f),d.angleTo(c),h);return m._round(),!s||d1(e,m,o,s,t)?m:void 0}l+=p}}function MC(e,t,i,r,a,n,s,o,l){let u=f1(r,n,s),h=m1(r,a),c=h*s,d=e[0].x===0||e[0].x===l||e[0].y===0||e[0].y===l;t-c<t/4&&(t=c+t/4);let p=n*2;return g1(e,d?t/2*o%t:(h/2+p)*s*o%t,t,u,i,c,d,!1,l)}function g1(e,t,i,r,a,n,s,o,l){let u=n/2,h=p1(e),c=0,d=t-i,p=[];for(let f=0;f<e.length-1;f++){let m=e[f],g=e[f+1],_=m.dist(g),y=g.angleTo(m);for(;d+i<c+_;){d+=i;let x=(d-c)/_,v=Je.number(m.x,g.x,x),w=Je.number(m.y,g.y,x);if(v>=0&&v<l&&w>=0&&w<l&&d-u>=0&&d+u<=h){let b=new Ua(v,w,y,f);b._round(),(!r||d1(e,b,n,r,a))&&p.push(b)}}c+=_}return!o&&!p.length&&!s&&(p=g1(e,c/2,i,r,a,n,s,!0,l)),p}function _1(e,t,i,r,a){let n=[];for(let s of e){let o;for(let l=0;l<s.length-1;l++){let u=s[l],h=s[l+1];u.x<t&&h.x<t||(u.x<t?u=new A(t,u.y+(h.y-u.y)*((t-u.x)/(h.x-u.x)))._round():h.x<t&&(h=new A(t,u.y+(h.y-u.y)*((t-u.x)/(h.x-u.x)))._round()),!(u.y<i&&h.y<i)&&(u.y<i?u=new A(u.x+(h.x-u.x)*((i-u.y)/(h.y-u.y)),i)._round():h.y<i&&(h=new A(u.x+(h.x-u.x)*((i-u.y)/(h.y-u.y)),i)._round()),!(u.x>=r&&h.x>=r)&&(u.x>=r?u=new A(r,u.y+(h.y-u.y)*((r-u.x)/(h.x-u.x)))._round():h.x>=r&&(h=new A(r,u.y+(h.y-u.y)*((r-u.x)/(h.x-u.x)))._round()),!(u.y>=a&&h.y>=a)&&(u.y>=a?u=new A(u.x+(h.x-u.x)*((a-u.y)/(h.y-u.y)),a)._round():h.y>=a&&(h=new A(u.x+(h.x-u.x)*((a-u.y)/(h.y-u.y)),a)._round()),(!o||!u.equals(o[o.length-1]))&&(o=[u],n.push(o)),o.push(h)))))}}return n}function Vm(e,t,i,r){let a=[],n=e.image,s=n.pixelRatio,o=n.paddedRect.w-2,l=n.paddedRect.h-2,u={x1:e.left,y1:e.top,x2:e.right,y2:e.bottom},h=n.stretchX||[[0,o]],c=n.stretchY||[[0,l]],d=(I,C)=>I+C[1]-C[0],p=h.reduce(d,0),f=c.reduce(d,0),m=o-p,g=l-f,_=0,y=p,x=0,v=f,w=0,b=m,T=0,P=g;if(n.content&&r){let I=n.content,C=I[2]-I[0],E=I[3]-I[1];(n.textFitWidth||n.textFitHeight)&&(u=h1(e)),_=go(h,0,I[0]),x=go(c,0,I[1]),y=go(h,I[0],I[2]),v=go(c,I[1],I[3]),w=I[0]-_,T=I[1]-x,b=C-y,P=E-v}let S=u.x1,M=u.y1,k=u.x2-S,R=u.y2-M,D=(I,C,E,F)=>{let B=_o(I.stretch-_,y,k,S),j=yo(I.fixed-w,b,I.stretch,p),H=_o(C.stretch-x,v,R,M),ce=yo(C.fixed-T,P,C.stretch,f),Fe=_o(E.stretch-_,y,k,S),pe=yo(E.fixed-w,b,E.stretch,p),Ve=_o(F.stretch-x,v,R,M),Te=yo(F.fixed-T,P,F.stretch,f),Ne=new A(B,H),Ce=new A(Fe,H),st=new A(Fe,Ve),Tt=new A(B,Ve),Bt=new A(j/s,ce/s),ze=new A(pe/s,Te/s),Ue=t*Math.PI/180;if(Ue){let Z=Math.sin(Ue),re=Math.cos(Ue),ne=[re,-Z,Z,re];Ne._matMult(ne),Ce._matMult(ne),Tt._matMult(ne),st._matMult(ne)}let Ot=I.stretch+I.fixed,Ht=E.stretch+E.fixed,jt=C.stretch+C.fixed,Xt=F.stretch+F.fixed;return{tl:Ne,tr:Ce,bl:Tt,br:st,tex:{x:n.paddedRect.x+1+Ot,y:n.paddedRect.y+1+jt,w:Ht-Ot,h:Xt-jt},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:Bt,pixelOffsetBR:ze,minFontScaleX:b/s/k,minFontScaleY:P/s/R,isSDF:i}};if(!r||!n.stretchX&&!n.stretchY)a.push(D({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:o+1},{fixed:0,stretch:l+1}));else{let I=Nm(h,m,p),C=Nm(c,g,f);for(let E=0;E<I.length-1;E++){let F=I[E],B=I[E+1];for(let j=0;j<C.length-1;j++){let H=C[j],ce=C[j+1];a.push(D(F,H,B,ce))}}}return a}function go(e,t,i){let r=0;for(let a of e)r+=Math.max(t,Math.min(i,a[1]))-Math.max(t,Math.min(i,a[0]));return r}function Nm(e,t,i){let r=[{fixed:-1,stretch:0}];for(let[a,n]of e){let s=r[r.length-1];r.push({fixed:a-s.stretch,stretch:s.stretch}),r.push({fixed:a-s.stretch,stretch:s.stretch+(n-a)})}return r.push({fixed:t+1,stretch:i}),r}function _o(e,t,i,r){return e/t*i+r}function yo(e,t,i,r){return e-t*i/r}function FC(e,t,i,r,a,n,s,o){let l=r.layout.get("text-rotate").evaluate(n,{})*Math.PI/180,u=[];for(let h of t.positionedLines)for(let c of h.positionedGlyphs){if(!c.rect)continue;let d=c.rect||{},p=4,f=!0,m=1,g=0,_=(a||o)&&c.vertical,y=c.metrics.advance*c.scale/2;if(o&&t.verticalizable){let F=(c.scale-1)*24,B=(24-c.metrics.width*c.scale)/2;g=h.lineOffset/2-(c.imageName?-B:F)}if(c.imageName){let F=s[c.imageName];f=F.sdf,m=F.pixelRatio,p=1/m}let x=a?[c.x+y,c.y]:[0,0],v=a?[0,0]:[c.x+y+i[0],c.y+i[1]-g],w=[0,0];_&&(w=v,v=[0,0]);let b=c.metrics.isDoubleResolution?2:1,T=(c.metrics.left-p)*c.scale-y+v[0],P=(-c.metrics.top-p)*c.scale+v[1],S=T+d.w/b*c.scale/m,M=P+d.h/b*c.scale/m,k=new A(T,P),R=new A(S,P),D=new A(T,M),I=new A(S,M);if(_){let F=new A(-y,y- -17),B=-Math.PI/2,j=12-y,H=c.imageName?j:0,ce=new A(22-j,-H),Fe=new A(...w);k._rotateAround(B,F)._add(ce)._add(Fe),R._rotateAround(B,F)._add(ce)._add(Fe),D._rotateAround(B,F)._add(ce)._add(Fe),I._rotateAround(B,F)._add(ce)._add(Fe)}if(l){let F=Math.sin(l),B=Math.cos(l),j=[B,-F,F,B];k._matMult(j),R._matMult(j),D._matMult(j),I._matMult(j)}let C=new A(0,0),E=new A(0,0);u.push({tl:k,tr:R,bl:D,br:I,tex:d,writingMode:t.writingMode,glyphOffset:x,sectionIndex:c.sectionIndex,isSDF:f,pixelOffsetTL:C,pixelOffsetBR:E,minFontScaleX:0,minFontScaleY:0})}return u}var vo=class{constructor(e,t,i,r,a,n,s,o,l,u){var h;if(this.boxStartIndex=e.length,l){let c=n.top,d=n.bottom,p=n.collisionPadding;p&&(c-=p[1],d+=p[3]);let f=d-c;f>0&&(f=Math.max(10,f),this.circleDiameter=f)}else{let c=(h=n.image)!=null&&h.content&&(n.image.textFitWidth||n.image.textFitHeight)?h1(n):{x1:n.left,y1:n.top,x2:n.right,y2:n.bottom};c.y1=c.y1*s-o[0],c.y2=c.y2*s+o[2],c.x1=c.x1*s-o[3],c.x2=c.x2*s+o[1];let d=n.collisionPadding;if(d&&(c.x1-=d[0]*s,c.y1-=d[1]*s,c.x2+=d[2]*s,c.y2+=d[3]*s),u){let p=new A(c.x1,c.y1),f=new A(c.x2,c.y1),m=new A(c.x1,c.y2),g=new A(c.x2,c.y2),_=u*Math.PI/180;p._rotate(_),f._rotate(_),m._rotate(_),g._rotate(_),c.x1=Math.min(p.x,f.x,m.x,g.x),c.x2=Math.max(p.x,f.x,m.x,g.x),c.y1=Math.min(p.y,f.y,m.y,g.y),c.y2=Math.max(p.y,f.y,m.y,g.y)}e.emplaceBack(t.x,t.y,c.x1,c.y1,c.x2,c.y2,i,r,a)}this.boxEndIndex=e.length}},zC=class{constructor(e=[],t=(i,r)=>i<r?-1:+(i>r)){if(this.data=e,this.length=this.data.length,this.compare=t,this.length>0)for(let i=(this.length>>1)-1;i>=0;i--)this._down(i)}push(e){this.data.push(e),this._up(this.length++)}pop(){if(this.length===0)return;let e=this.data[0],t=this.data.pop();return--this.length>0&&(this.data[0]=t,this._down(0)),e}peek(){return this.data[0]}_up(e){let{data:t,compare:i}=this,r=t[e];for(;e>0;){let a=e-1>>1,n=t[a];if(i(r,n)>=0)break;t[e]=n,e=a}t[e]=r}_down(e){let{data:t,compare:i}=this,r=this.length>>1,a=t[e];for(;e<r;){let n=(e<<1)+1,s=n+1;if(s<this.length&&i(t[s],t[n])<0&&(n=s),i(t[n],a)>=0)break;t[e]=t[n],e=n}t[e]=a}};function RC(e,t=1){let i=Mi.fromPoints(e[0]),r=Math.min(i.width(),i.height()),a=r/2,n=new zC([],kC),{minX:s,minY:o,maxX:l,maxY:u}=i;if(r===0)return new A(s,o);for(let d=s;d<l;d+=r)for(let p=o;p<u;p+=r)n.push(new La(d+a,p+a,a,e));let h=BC(e),c=h;for(;n.length;){let d=n.pop();(d.d>c.d||!c.d)&&(c=d),!(d.max-c.d<=t)&&(a=d.h/2,n.push(new La(d.p.x-a,d.p.y-a,a,e)),n.push(new La(d.p.x+a,d.p.y-a,a,e)),n.push(new La(d.p.x-a,d.p.y+a,a,e)),n.push(new La(d.p.x+a,d.p.y+a,a,e)))}return h.d>0&&c.d-h.d<=t?h.p:c.p}function kC(e,t){return t.max-e.max}var La=class{constructor(e,t,i,r){this.p=new A(e,t),this.h=i,this.d=LC(this.p,r),this.max=this.d+this.h*Math.SQRT2}};function LC(e,t){let i=!1,r=1/0;for(let a of t)for(let n=0,s=a.length,o=s-1;n<s;o=n++){let l=a[n],u=a[o];l.y>e.y!=u.y>e.y&&e.x<(u.x-l.x)*(e.y-l.y)/(u.y-l.y)+l.x&&(i=!i),r=Math.min(r,S0(e,l,u))}return(i?1:-1)*Math.sqrt(r)}function BC(e){let t=0,i=0,r=0,a=e[0];for(let n=0,s=a.length,o=s-1;n<s;o=n++){let l=a[n],u=a[o],h=l.x*u.y-u.x*l.y;i+=(l.x+u.x)*h,r+=(l.y+u.y)*h,t+=h*3}return new La(i/t,r/t,0,e)}let Mc=function(e){return e[e.center=1]="center",e[e.left=2]="left",e[e.right=3]="right",e[e.top=4]="top",e[e.bottom=5]="bottom",e[e["top-left"]=6]="top-left",e[e["top-right"]=7]="top-right",e[e["bottom-left"]=8]="bottom-left",e[e["bottom-right"]=9]="bottom-right",e}({});const Yd=1/0;function y1(e,t){function i(a,n){let s=0,o=0;n<0&&(n=0);let l=n/Math.SQRT2;switch(a){case"top-right":case"top-left":o=l-7;break;case"bottom-right":case"bottom-left":o=-l+7;break;case"bottom":o=-n+7;break;case"top":o=n-7}switch(a){case"top-right":case"bottom-right":s=-l;break;case"top-left":case"bottom-left":s=l;break;case"left":s=n;break;case"right":s=-n}return[s,o]}function r(a,n,s){let o=0,l=0;switch(n=Math.abs(n),s=Math.abs(s),a){case"top-right":case"top-left":case"top":l=s-7;break;case"bottom-right":case"bottom-left":case"bottom":l=-s+7}switch(a){case"top-right":case"bottom-right":case"right":o=-n;break;case"top-left":case"bottom-left":case"left":o=n}return[o,l]}return t[1]===Yd?i(e,t[0]):r(e,t[0],t[1])}function v1(e,t,i){var s;let r=e.layout,a=(s=r.get("text-variable-anchor-offset"))==null?void 0:s.evaluate(t,{},i);if(a){let o=a.values,l=[];for(let u=0;u<o.length;u+=2){let h=l[u]=o[u],c=o[u+1].map(d=>d*24);h.startsWith("top")?c[1]-=7:h.startsWith("bottom")&&(c[1]+=7),l[u+1]=c}return new Yi(l)}let n=r.get("text-variable-anchor");if(n){let o;o=e._unevaluatedLayout.getValue("text-radial-offset")===void 0?r.get("text-offset").evaluate(t,{},i).map(u=>u*24):[r.get("text-radial-offset").evaluate(t,{},i)*24,Yd];let l=[];for(let u of n)l.push(u,y1(u,o));return new Yi(l)}return null}function OC(e){var h,c;e.bucket.createArrays();let t=512*e.bucket.overscaling;e.bucket.tilePixelRatio=L/t,e.bucket.compareText={},e.bucket.iconsNeedLinear=!1;let i=e.bucket.layers[0],r=i.layout,a=i._unevaluatedLayout._values,n={layoutIconSize:a["icon-size"].possiblyEvaluate(new Be(e.bucket.zoom+1),e.canonical),layoutTextSize:a["text-size"].possiblyEvaluate(new Be(e.bucket.zoom+1),e.canonical),textMaxSize:a["text-size"].possiblyEvaluate(new Be(18))};if(e.bucket.textSizeData.kind==="composite"){let{minZoom:d,maxZoom:p}=e.bucket.textSizeData;n.compositeTextSizes=[a["text-size"].possiblyEvaluate(new Be(d),e.canonical),a["text-size"].possiblyEvaluate(new Be(p),e.canonical)]}if(e.bucket.iconSizeData.kind==="composite"){let{minZoom:d,maxZoom:p}=e.bucket.iconSizeData;n.compositeIconSizes=[a["icon-size"].possiblyEvaluate(new Be(d),e.canonical),a["icon-size"].possiblyEvaluate(new Be(p),e.canonical)]}let s=r.get("text-line-height")*24,o=r.get("text-rotation-alignment")!=="viewport"&&r.get("symbol-placement")!=="point",l=r.get("text-keep-upright"),u=r.get("text-size");for(let d of e.bucket.features){let p=r.get("text-font").evaluate(d,{},e.canonical).join(","),f=u.evaluate(d,{},e.canonical),m=n.layoutTextSize.evaluate(d,{},e.canonical),g=n.layoutIconSize.evaluate(d,{},e.canonical),_={horizontal:{},vertical:void 0},y=d.text,x=[0,0];if(y){let T=y.toString(),P=r.get("text-letter-spacing").evaluate(d,{},e.canonical)*24,S=zD(T)?P:0,M=r.get("text-anchor").evaluate(d,{},e.canonical),k=v1(i,d,e.canonical);if(!k){let C=r.get("text-radial-offset").evaluate(d,{},e.canonical);x=C?y1(M,[C*24,Yd]):r.get("text-offset").evaluate(d,{},e.canonical).map(E=>E*24)}let R=o?"center":r.get("text-justify").evaluate(d,{},e.canonical),D=r.get("symbol-placement")==="point"?r.get("text-max-width").evaluate(d,{},e.canonical)*24:1/0,I=()=>{e.bucket.allowVerticalPlacement&&Pc(T)&&(_.vertical=mo(y,e.glyphMap,e.glyphPositions,e.imagePositions,p,D,s,M,"left",S,x,2,!0,m,f))};if(!o&&k){let C=new Set;if(R==="auto")for(let F=0;F<k.values.length;F+=2)C.add(Fc(k.values[F]));else C.add(R);let E=!1;for(let F of C)if(!_.horizontal[F])if(E)_.horizontal[F]=_.horizontal[0];else{let B=mo(y,e.glyphMap,e.glyphPositions,e.imagePositions,p,D,s,"center",F,S,x,1,!1,m,f);B&&(_.horizontal[F]=B,E=B.positionedLines.length===1)}I()}else{R==="auto"&&(R=Fc(M));let C=mo(y,e.glyphMap,e.glyphPositions,e.imagePositions,p,D,s,M,R,S,x,1,!1,m,f);C&&(_.horizontal[R]=C),I(),Pc(T)&&o&&l&&(_.vertical=mo(y,e.glyphMap,e.glyphPositions,e.imagePositions,p,D,s,M,R,S,x,2,!1,m,f))}}let v,w=!1;if((h=d.icon)!=null&&h.name){let T=e.imageMap[d.icon.name];T&&(v=SC(e.imagePositions[d.icon.name],r.get("icon-offset").evaluate(d,{},e.canonical),r.get("icon-anchor").evaluate(d,{},e.canonical)),w=!!T.sdf,e.bucket.sdfIcons===void 0?e.bucket.sdfIcons=w:e.bucket.sdfIcons!==w&&xe("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),T.pixelRatio===e.bucket.pixelRatio?r.get("icon-rotate").constantOr(1)!==0&&(e.bucket.iconsNeedLinear=!0):e.bucket.iconsNeedLinear=!0)}let b=x1(_.horizontal)||_.vertical;(c=e.bucket).iconsInText||(c.iconsInText=b?b.iconsInText:!1),(b||v)&&$C(e.bucket,d,_,v,e.imageMap,n,m,g,x,w,e.canonical,e.subdivisionGranularity)}e.showCollisionBoxes&&e.bucket.generateCollisionDebugBuffers()}function Fc(e){switch(e){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function $C(e,t,i,r,a,n,s,o,l,u,h,c){let d=n.textMaxSize.evaluate(t,{});d===void 0&&(d=s);let p=e.layers[0].layout,f=p.get("icon-offset").evaluate(t,{},h),m=x1(i.horizontal),g=s/24,_=e.tilePixelRatio*g,y=e.tilePixelRatio*d/24,x=e.tilePixelRatio*o,v=e.tilePixelRatio*p.get("symbol-spacing"),w=p.get("text-padding")*e.tilePixelRatio,b=KC(p,t,h,e.tilePixelRatio),T=p.get("text-max-angle")/180*Math.PI,P=p.get("text-rotation-alignment")!=="viewport"&&p.get("symbol-placement")!=="point",S=p.get("icon-rotation-alignment").constantOr("viewport")==="map"&&p.get("symbol-placement")!=="point",M=p.get("symbol-placement"),k=v/2,R=p.get("icon-text-fit"),D;r&&R!=="none"&&(e.allowVerticalPlacement&&i.vertical&&(D=Om(r,i.vertical,R,p.get("icon-text-fit-padding"),f,g)),m&&(r=Om(r,m,R,p.get("icon-text-fit-padding"),f,g)));let I=h?c.line.getGranularityForZoomLevel(h.z):1,C=(E,F)=>{F.x<0||F.x>=8192||F.y<0||F.y>=8192||VC(e,F,E,i,r,a,D,e.layers[0],e.collisionBoxArray,t.index,t.sourceLayerIndex,e.index,_,[w,w,w,w],P,l,x,b,S,f,t,n,u,h,s)};if(M==="line")for(let E of _1(t.geometry,0,0,L,L)){let F=Yr(E,I),B=MC(F,v,T,i.vertical||m,r,24,y,e.overscaling,L);for(let j of B){let H=m;(!H||!NC(e,H.text,k,j))&&C(F,j)}}else if(M==="line-center"){for(let E of t.geometry)if(E.length>1){let F=Yr(E,I),B=IC(F,T,i.vertical||m,r,24,y);B&&C(F,B)}}else if(t.type==="Polygon")for(let E of Ll(t.geometry,0)){let F=RC(E,16);C(Yr(E[0],I,!0),new Ua(F.x,F.y,0))}else if(t.type==="LineString")for(let E of t.geometry){let F=Yr(E,I);C(F,new Ua(F[0].x,F[0].y,0))}else if(t.type==="Point")for(let E of t.geometry)for(let F of E)C([F],new Ua(F.x,F.y,0))}function jC(e,t){let i=e.length,r=t==null?void 0:t.values;if((r==null?void 0:r.length)>0)for(let a=0;a<r.length;a+=2){let n=Mc[r[a]],s=r[a+1];e.emplaceBack(n,s[0],s[1])}return[i,e.length]}function Um(e,t,i,r,a,n,s,o,l,u,h,c,d,p,f,m){let g=FC(t,i,o,a,n,s,r,e.allowVerticalPlacement),_=e.textSizeData,y=null;_.kind==="source"?(y=[128*a.layout.get("text-size").evaluate(s,{})],y[0]>32640&&xe(`${e.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)):_.kind==="composite"&&(y=[128*f.compositeTextSizes[0].evaluate(s,{},m),128*f.compositeTextSizes[1].evaluate(s,{},m)],(y[0]>32640||y[1]>32640)&&xe(`${e.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)),e.addSymbols(e.text,g,y,o,n,s,h,t,u.lineStartIndex,u.lineLength,p,m,l);for(let x of c)d[x]=e.text.placedSymbolArray.length-1;return g.length*4}function x1(e){for(let t in e)return e[t];return null}function VC(e,t,i,r,a,n,s,o,l,u,h,c,d,p,f,m,g,_,y,x,v,w,b,T,P){let S=e.addToLineVertexArray(t,i),M=o.layout.get("symbol-height-offset").evaluate(v,{},T);M>e.maxHeightOffset&&(e.maxHeightOffset=M);let k,R,D,I,C=0,E=0,F=0,B=0,j=-1,H=-1,ce={},Fe=(0,cc.default)("");if(e.allowVerticalPlacement&&r.vertical){let re=o.layout.get("text-rotate").evaluate(v,{},T)+90,ne=r.vertical;D=new vo(l,t,u,h,c,ne,d,p,f,re),s&&(I=new vo(l,t,u,h,c,s,g,_,f,re))}if(a){let re=o.layout.get("icon-rotate").evaluate(v,{}),ne=o.layout.get("icon-text-fit")!=="none",$=Vm(a,re,b,ne),se=s?Vm(s,re,b,ne):void 0;R=new vo(l,t,u,h,c,a,g,_,!1,re),C=$.length*4;let J=e.iconSizeData,te=null;J.kind==="source"?(te=[128*o.layout.get("icon-size").evaluate(v,{})],te[0]>32640&&xe(`${e.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)):J.kind==="composite"&&(te=[128*w.compositeIconSizes[0].evaluate(v,{},T),128*w.compositeIconSizes[1].evaluate(v,{},T)],(te[0]>32640||te[1]>32640)&&xe(`${e.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)),e.addSymbols(e.icon,$,te,x,y,v,0,t,S.lineStartIndex,S.lineLength,-1,T,M),j=e.icon.placedSymbolArray.length-1,se&&(E=se.length*4,e.addSymbols(e.icon,se,te,x,y,v,2,t,S.lineStartIndex,S.lineLength,-1,T,M),H=e.icon.placedSymbolArray.length-1)}let pe=Object.keys(r.horizontal);for(let re of pe){let ne=r.horizontal[re];k||(k=(Fe=(0,cc.default)(ne.text),new vo(l,t,u,h,c,ne,d,p,f,o.layout.get("text-rotate").evaluate(v,{},T))));let $=ne.positionedLines.length===1;if(F+=Um(e,t,ne,n,o,f,v,m,M,S,r.vertical?1:3,$?pe:[re],ce,j,w,T),$)break}r.vertical&&(B+=Um(e,t,r.vertical,n,o,f,v,m,M,S,2,["vertical"],ce,H,w,T));let Ve=k?k.boxStartIndex:e.collisionBoxArray.length,Te=k?k.boxEndIndex:e.collisionBoxArray.length,Ne=D?D.boxStartIndex:e.collisionBoxArray.length,Ce=D?D.boxEndIndex:e.collisionBoxArray.length,st=R?R.boxStartIndex:e.collisionBoxArray.length,Tt=R?R.boxEndIndex:e.collisionBoxArray.length,Bt=I?I.boxStartIndex:e.collisionBoxArray.length,ze=I?I.boxEndIndex:e.collisionBoxArray.length,Ue=-1,Ot=(re,ne)=>re!=null&&re.circleDiameter?Math.max(re.circleDiameter,ne):ne;Ue=Ot(k,Ue),Ue=Ot(D,Ue),Ue=Ot(R,Ue),Ue=Ot(I,Ue);let Ht=+(Ue>-1);Ht&&(Ue*=P/24),e.glyphOffsetArray.length>=e.maxGlyphs&&xe("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),v.sortKey!==void 0&&e.addToSortKeyRanges(e.symbolInstances.length,v.sortKey);let jt=v1(o,v,T),[Xt,Z]=jC(e.textAnchorOffsets,jt);e.symbolInstances.emplaceBack(t.x,t.y,ce.right>=0?ce.right:-1,ce.center>=0?ce.center:-1,ce.left>=0?ce.left:-1,ce.vertical||-1,j,H,Fe,Ve,Te,Ne,Ce,st,Tt,Bt,ze,u,F,B,C,E,Ht,0,d,Ue,Xt,Z,M)}function NC(e,t,i,r){let a=e.compareText;if(!(t in a))a[t]=[];else{let n=a[t];for(let s=n.length-1;s>=0;s--)if(r.dist(n[s])<i)return!0}return a[t].push(r),!1}function gl(e,t,i){let r="never",a=e.get(t);return a?r=a:e.get(i)&&(r="always"),r}const UC=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function xo(e,t,i,r,a,n,s,o,l,u,h,c,d,p){let f=o?Math.min($m,Math.round(o[0])):0,m=o?Math.min($m,Math.round(o[1])):0;e.emplaceBack(t,i,Math.round(r*32),Math.round(a*32),n,s,(f<<1)+ +!!l,m,u*16,h*16,c*256,d*256,p)}function _l(e,t,i){e.emplaceBack(t.x,t.y,i),e.emplaceBack(t.x,t.y,i),e.emplaceBack(t.x,t.y,i),e.emplaceBack(t.x,t.y,i)}function GC(e){for(let t of e.sections)if(t1(t.text))return!0;return!1}var zc=class{constructor(e){this.layoutVertexArray=new LT,this.indexArray=new er,this.programConfigurations=e,this.segments=new Ke,this.dynamicLayoutVertexArray=new BT,this.opacityVertexArray=new OT,this.hasVisibleVertices=!1,this.placedSymbolArray=new u0}isEmpty(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0}upload(e,t,i,r){this.isEmpty()||(i&&(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,iD.members),this.indexBuffer=e.createIndexBuffer(this.indexArray,t),this.dynamicLayoutVertexBuffer=e.createVertexBuffer(this.dynamicLayoutVertexArray,rD.members,!0),this.opacityVertexBuffer=e.createVertexBuffer(this.opacityVertexArray,UC,!0),this.opacityVertexBuffer.itemSize=1),(i||r)&&this.programConfigurations.upload(e))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy())}};G("SymbolBuffers",zc);var Rc=class{constructor(e,t,i){this.layoutVertexArray=new e,this.layoutAttributes=t,this.indexArray=new i,this.segments=new Ke,this.collisionVertexArray=new jT}upload(e){this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=e.createVertexBuffer(this.collisionVertexArray,aD.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}};G("CollisionBuffers",Rc);var yl=class{constructor(e){this.collisionBoxArray=e.collisionBoxArray,this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(s=>s.id),this.index=e.index,this.pixelRatio=e.pixelRatio,this.sourceLayerIndex=e.sourceLayerIndex,this.hasDependencies=!0,this.hasRTLText=!1,this.maxHeightOffset=0,this.sortKeyRanges=[],this.collisionCircleArray=[],this.maxGlyphs=65535;let t=this.layers[0]._unevaluatedLayout._values;this.textSizeData=jm(this.zoom,t["text-size"]),this.iconSizeData=jm(this.zoom,t["icon-size"]);let i=this.layers[0].layout,r=i.get("symbol-sort-key"),a=i.get("symbol-z-order");this.canOverlap=gl(i,"text-overlap","text-allow-overlap")!=="never"||gl(i,"icon-overlap","icon-allow-overlap")!=="never"||i.get("text-ignore-placement")||i.get("icon-ignore-placement"),this.sortFeaturesByKey=a!=="viewport-y"&&!r.isConstant();let n=a==="viewport-y"||a==="auto"&&!this.sortFeaturesByKey;this.sortFeaturesByY=n&&this.canOverlap,i.get("symbol-placement")==="point"&&(this.writingModes=i.get("text-writing-mode").map(s=>s1[s])),this.stateDependentLayerIds=this.layers.filter(s=>s.isStateDependent()).map(s=>s.id),this.sourceID=e.sourceID}createArrays(){this.text=new zc(new la(this.layers,this.zoom,e=>e.startsWith("text"))),this.icon=new zc(new la(this.layers,this.zoom,e=>e.startsWith("icon"))),this.glyphOffsetArray=new d0,this.lineVertexArray=new p0,this.symbolInstances=new c0,this.textAnchorOffsets=new m0}calculateGlyphDependencies(e,t,i,r,a){var l;let n=(r||this.allowVerticalPlacement)&&a,s=qd.fromFeature(e,i),o=s.graphemes();for(let u=0;u<o.length;u++){let h=s.getSection(u);if("imageName"in h)continue;let c=t[l=h.fontStack]||(t[l]={}),d=o[u];fl(d)&&(c[d]=!0);for(let p of d){if(c[p]=!0,!n)continue;let f=Oa[p];f&&(c[f]=!0)}}}populate(e,t,i){var m;let r=this.layers[0],a=r.layout,n=a.get("text-font"),s=a.get("text-field"),o=a.get("icon-image"),l=(s.value.kind!=="constant"||s.value.value instanceof _r&&!s.value.value.isEmpty()||s.value.value.toString().length>0)&&(n.value.kind!=="constant"||n.value.value.length>0),u=o.value.kind!=="constant"||!!o.value.value||Object.keys(o.parameters).length>0,h=a.get("symbol-sort-key");if(this.features=[],!l&&!u)return;let c=t.iconDependencies,d=t.glyphDependencies,p=t.availableImages,f=new Be(this.zoom);for(let{feature:g,id:_,index:y,sourceLayerIndex:x}of e){let v=r._featureFilter.needGeometry,w=fa(g,v);if(!r._featureFilter.filter(f,w,i))continue;v||(w.geometry=pa(g));let b;if(l){let M=r.getValueAndResolveTokens("text-field",w,i,p),k=_r.factory(M);this.hasRTLText||(this.hasRTLText=GC(k)),b=AD(k,r,w)}let T;if(u){let M=r.getValueAndResolveTokens("icon-image",w,i,p);T=M instanceof Ki?M:Ki.fromString(M)}if(!b&&!T)continue;let P=this.sortFeaturesByKey?h.evaluate(w,{},i):void 0,S={id:_,text:b,icon:T,index:y,sourceLayerIndex:x,geometry:w.geometry,properties:g.properties,type:Fs.types[g.type],sortKey:P};if(this.features.push(S),T&&(c[T.name]=!0),b){let M=n.evaluate(w,{},i).join(","),k=a.get("text-rotation-alignment")!=="viewport"&&a.get("symbol-placement")!=="point";this.allowVerticalPlacement=(m=this.writingModes)==null?void 0:m.includes(2);let R=Pc(b.toString());this.calculateGlyphDependencies(b,d,M,k,R);for(let D of b.sections)D.image&&(c[D.image.name]=!0)}}a.get("symbol-placement")==="line"&&(this.features=MD(this.features)),this.sortFeaturesByKey&&this.features.sort((g,_)=>g.sortKey-_.sortKey)}update(e,t,i){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(e,t,this.layers,{imagePositions:i}),this.icon.programConfigurations.updatePaintArrays(e,t,this.layers,{imagePositions:i}))}addFeatures({options:e,canonical:t,glyphMap:i,glyphPositions:r,iconMap:a,iconPositions:n,showCollisionBoxes:s}){OC({bucket:this,glyphMap:i,glyphPositions:r,imageMap:a,imagePositions:n,showCollisionBoxes:s,canonical:t,subdivisionGranularity:e.subdivisionGranularity})}isEmpty(){return this.symbolInstances.length===0}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(e){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(e),this.iconCollisionBox.upload(e)),this.text.upload(e,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(e,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(e,t){let i=this.lineVertexArray.length;if(e.segment!==void 0){let r=e.dist(t[e.segment+1]),a=e.dist(t[e.segment]),n={};for(let s=e.segment+1;s<t.length;s++)n[s]={x:t[s].x,y:t[s].y,tileUnitDistanceFromAnchor:r},s<t.length-1&&(r+=t[s+1].dist(t[s]));for(let s=e.segment||0;s>=0;s--)n[s]={x:t[s].x,y:t[s].y,tileUnitDistanceFromAnchor:a},s>0&&(a+=t[s-1].dist(t[s]));for(let s=0;s<t.length;s++){let o=n[s];this.lineVertexArray.emplaceBack(o.x,o.y,o.tileUnitDistanceFromAnchor)}}return{lineStartIndex:i,lineLength:this.lineVertexArray.length-i}}addSymbols(e,t,i,r,a,n,s,o,l,u,h,c,d){let p=e.indexArray,f=e.layoutVertexArray,m=e.segments.prepareSegment(4*t.length,f,p,this.canOverlap?n.sortKey:void 0),g=this.glyphOffsetArray.length,_=m.vertexLength,y=this.allowVerticalPlacement&&s===2?Math.PI/2:0,x=n.text&&n.text.sections;for(let v=0;v<t.length;v++){let{tl:w,tr:b,bl:T,br:P,tex:S,pixelOffsetTL:M,pixelOffsetBR:k,minFontScaleX:R,minFontScaleY:D,glyphOffset:I,isSDF:C,sectionIndex:E}=t[v],F=m.vertexLength,B=I[1];xo(f,o.x,o.y,w.x,B+w.y,S.x,S.y,i,C,M.x,M.y,R,D,d),xo(f,o.x,o.y,b.x,B+b.y,S.x+S.w,S.y,i,C,k.x,M.y,R,D,d),xo(f,o.x,o.y,T.x,B+T.y,S.x,S.y+S.h,i,C,M.x,k.y,R,D,d),xo(f,o.x,o.y,P.x,B+P.y,S.x+S.w,S.y+S.h,i,C,k.x,k.y,R,D,d),_l(e.dynamicLayoutVertexArray,o,y),p.emplaceBack(F,F+2,F+1),p.emplaceBack(F+1,F+2,F+3),m.vertexLength+=4,m.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(I[0]),(v===t.length-1||E!==t[v+1].sectionIndex)&&e.programConfigurations.populatePaintArrays(f.length,n,n.index,{imagePositions:{},canonical:c,formattedSection:x==null?void 0:x[E]})}e.placedSymbolArray.emplaceBack(o.x,o.y,g,this.glyphOffsetArray.length-g,_,l,u,o.segment,i?i[0]:0,i?i[1]:0,r[0],r[1],s,0,!1,0,h,d)}_addCollisionDebugVertex(e,t,i,r,a,n){return t.emplaceBack(0,0),e.emplaceBack(i.x,i.y,r,a,Math.round(n.x),Math.round(n.y))}addCollisionDebugVertices(e,t,i,r,a,n,s){let o=a.segments.prepareSegment(4,a.layoutVertexArray,a.indexArray),l=o.vertexLength,u=a.layoutVertexArray,h=a.collisionVertexArray,c=s.anchorX,d=s.anchorY;this._addCollisionDebugVertex(u,h,n,c,d,new A(e,t)),this._addCollisionDebugVertex(u,h,n,c,d,new A(i,t)),this._addCollisionDebugVertex(u,h,n,c,d,new A(i,r)),this._addCollisionDebugVertex(u,h,n,c,d,new A(e,r)),o.vertexLength+=4;let p=a.indexArray;p.emplaceBack(l,l+1),p.emplaceBack(l+1,l+2),p.emplaceBack(l+2,l+3),p.emplaceBack(l+3,l),o.primitiveLength+=4}addDebugCollisionBoxes(e,t,i,r){for(let a=e;a<t;a++){let n=this.collisionBoxArray.get(a),s=n.x1,o=n.y1,l=n.x2,u=n.y2;this.addCollisionDebugVertices(s,o,l,u,r?this.textCollisionBox:this.iconCollisionBox,n.anchorPoint,i)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new Rc(nm,wm.members,hc),this.iconCollisionBox=new Rc(nm,wm.members,hc);for(let e=0;e<this.symbolInstances.length;e++){let t=this.symbolInstances.get(e);this.addDebugCollisionBoxes(t.textBoxStartIndex,t.textBoxEndIndex,t,!0),this.addDebugCollisionBoxes(t.verticalTextBoxStartIndex,t.verticalTextBoxEndIndex,t,!0),this.addDebugCollisionBoxes(t.iconBoxStartIndex,t.iconBoxEndIndex,t,!1),this.addDebugCollisionBoxes(t.verticalIconBoxStartIndex,t.verticalIconBoxEndIndex,t,!1)}}_deserializeCollisionBoxesForSymbol(e,t,i,r,a,n,s,o,l){let u={};for(let h=t;h<i;h++){let c=e.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=r;h<a;h++){let c=e.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=n;h<s;h++){let c=e.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=e.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(e){this.collisionArrays=[];for(let t=0;t<this.symbolInstances.length;t++){let i=this.symbolInstances.get(t);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(e,i.textBoxStartIndex,i.textBoxEndIndex,i.verticalTextBoxStartIndex,i.verticalTextBoxEndIndex,i.iconBoxStartIndex,i.iconBoxEndIndex,i.verticalIconBoxStartIndex,i.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(e,t){let i=e.placedSymbolArray.get(t),r=i.vertexStartIndex+i.numGlyphs*4;for(let a=i.vertexStartIndex;a<r;a+=4)e.indexArray.emplaceBack(a,a+2,a+1),e.indexArray.emplaceBack(a+1,a+2,a+3)}getSortedSymbolIndexes(e){if(this.sortedAngle===e&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;let t=Math.sin(e),i=Math.cos(e),r=[],a=[],n=[];for(let s=0;s<this.symbolInstances.length;++s){n.push(s);let o=this.symbolInstances.get(s);r.push(Math.round(t*o.anchorX+i*o.anchorY)|0),a.push(o.featureIndex)}return n.sort((s,o)=>r[s]-r[o]||a[o]-a[s]),n}addToSortKeyRanges(e,t){let i=this.sortKeyRanges[this.sortKeyRanges.length-1];(i==null?void 0:i.sortKey)===t?i.symbolInstanceEnd=e+1:this.sortKeyRanges.push({sortKey:t,symbolInstanceStart:e,symbolInstanceEnd:e+1})}sortFeatures(e){if(this.sortFeaturesByY&&this.sortedAngle!==e&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(e),this.sortedAngle=e,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(let t of this.symbolInstanceIndexes){let i=this.symbolInstances.get(t);this.featureSortOrder.push(i.featureIndex);let r=[i.rightJustifiedTextSymbolIndex,i.centerJustifiedTextSymbolIndex,i.leftJustifiedTextSymbolIndex];for(let a=0;a<r.length;a++){let n=r[a];n>=0&&r.indexOf(n)===a&&this.addIndicesForPlacedSymbol(this.text,n)}i.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,i.verticalPlacedTextSymbolIndex),i.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,i.placedIconSymbolIndex),i.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,i.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}};G("SymbolBucket",yl,{omit:["layers","collisionBoxArray","features","compareText"]});function ZC(e,t){return t.replace(/{([^{}]+)}/g,(i,r)=>e&&r in e?String(e[r]):"")}let qC;const WC=()=>qC||(qC=new Dt({"symbol-placement":new N(z.layout_symbol["symbol-placement"],"symbol-placement"),"symbol-spacing":new N(z.layout_symbol["symbol-spacing"],"symbol-spacing"),"symbol-avoid-edges":new N(z.layout_symbol["symbol-avoid-edges"],"symbol-avoid-edges"),"symbol-sort-key":new ee(z.layout_symbol["symbol-sort-key"],"symbol-sort-key"),"symbol-z-order":new N(z.layout_symbol["symbol-z-order"],"symbol-z-order"),"icon-allow-overlap":new N(z.layout_symbol["icon-allow-overlap"],"icon-allow-overlap"),"icon-overlap":new N(z.layout_symbol["icon-overlap"],"icon-overlap"),"icon-ignore-placement":new N(z.layout_symbol["icon-ignore-placement"],"icon-ignore-placement"),"icon-optional":new N(z.layout_symbol["icon-optional"],"icon-optional"),"icon-rotation-alignment":new ee(z.layout_symbol["icon-rotation-alignment"],"icon-rotation-alignment"),"icon-size":new ee(z.layout_symbol["icon-size"],"icon-size"),"icon-text-fit":new N(z.layout_symbol["icon-text-fit"],"icon-text-fit"),"icon-text-fit-padding":new N(z.layout_symbol["icon-text-fit-padding"],"icon-text-fit-padding"),"icon-image":new ee(z.layout_symbol["icon-image"],"icon-image"),"icon-rotate":new ee(z.layout_symbol["icon-rotate"],"icon-rotate"),"icon-padding":new ee(z.layout_symbol["icon-padding"],"icon-padding"),"icon-keep-upright":new N(z.layout_symbol["icon-keep-upright"],"icon-keep-upright"),"icon-offset":new ee(z.layout_symbol["icon-offset"],"icon-offset"),"icon-anchor":new ee(z.layout_symbol["icon-anchor"],"icon-anchor"),"icon-pitch-alignment":new N(z.layout_symbol["icon-pitch-alignment"],"icon-pitch-alignment"),"text-pitch-alignment":new N(z.layout_symbol["text-pitch-alignment"],"text-pitch-alignment"),"text-rotation-alignment":new N(z.layout_symbol["text-rotation-alignment"],"text-rotation-alignment"),"text-field":new ee(z.layout_symbol["text-field"],"text-field"),"text-font":new ee(z.layout_symbol["text-font"],"text-font"),"text-size":new ee(z.layout_symbol["text-size"],"text-size"),"text-max-width":new ee(z.layout_symbol["text-max-width"],"text-max-width"),"text-line-height":new N(z.layout_symbol["text-line-height"],"text-line-height"),"text-letter-spacing":new ee(z.layout_symbol["text-letter-spacing"],"text-letter-spacing"),"text-justify":new ee(z.layout_symbol["text-justify"],"text-justify"),"text-radial-offset":new ee(z.layout_symbol["text-radial-offset"],"text-radial-offset"),"text-variable-anchor":new N(z.layout_symbol["text-variable-anchor"],"text-variable-anchor"),"text-variable-anchor-offset":new ee(z.layout_symbol["text-variable-anchor-offset"],"text-variable-anchor-offset"),"text-anchor":new ee(z.layout_symbol["text-anchor"],"text-anchor"),"text-max-angle":new N(z.layout_symbol["text-max-angle"],"text-max-angle"),"text-writing-mode":new N(z.layout_symbol["text-writing-mode"],"text-writing-mode"),"text-rotate":new ee(z.layout_symbol["text-rotate"],"text-rotate"),"text-padding":new N(z.layout_symbol["text-padding"],"text-padding"),"text-keep-upright":new N(z.layout_symbol["text-keep-upright"],"text-keep-upright"),"text-transform":new ee(z.layout_symbol["text-transform"],"text-transform"),"text-offset":new ee(z.layout_symbol["text-offset"],"text-offset"),"text-allow-overlap":new N(z.layout_symbol["text-allow-overlap"],"text-allow-overlap"),"text-overlap":new N(z.layout_symbol["text-overlap"],"text-overlap"),"text-ignore-placement":new N(z.layout_symbol["text-ignore-placement"],"text-ignore-placement"),"text-optional":new N(z.layout_symbol["text-optional"],"text-optional"),"symbol-height-offset":new ee(z.layout_symbol["symbol-height-offset"],"symbol-height-offset"),"symbol-height-anchor":new N(z.layout_symbol["symbol-height-anchor"],"symbol-height-anchor")}));let HC;const XC=()=>HC||(HC=new Dt({"icon-opacity":new ee(z.paint_symbol["icon-opacity"],"icon-opacity"),"icon-color":new ee(z.paint_symbol["icon-color"],"icon-color"),"icon-halo-color":new ee(z.paint_symbol["icon-halo-color"],"icon-halo-color"),"icon-halo-width":new ee(z.paint_symbol["icon-halo-width"],"icon-halo-width"),"icon-halo-blur":new ee(z.paint_symbol["icon-halo-blur"],"icon-halo-blur"),"icon-translate":new N(z.paint_symbol["icon-translate"],"icon-translate"),"icon-translate-anchor":new N(z.paint_symbol["icon-translate-anchor"],"icon-translate-anchor"),"text-opacity":new ee(z.paint_symbol["text-opacity"],"text-opacity"),"text-color":new ee(z.paint_symbol["text-color"],"text-color",{runtimeType:Ii,getOverride:e=>e.textColor,hasOverride:e=>!!e.textColor}),"text-halo-color":new ee(z.paint_symbol["text-halo-color"],"text-halo-color"),"text-halo-width":new ee(z.paint_symbol["text-halo-width"],"text-halo-width"),"text-halo-blur":new ee(z.paint_symbol["text-halo-blur"],"text-halo-blur"),"text-translate":new N(z.paint_symbol["text-translate"],"text-translate"),"text-translate-anchor":new N(z.paint_symbol["text-translate-anchor"],"text-translate-anchor")}));var Ju={get paint(){return XC()},get layout(){return WC()}},b1=class{constructor(e){if(e.property.overrides===void 0)throw Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=e.property.overrides?e.property.overrides.runtimeType:Es,this.defaultValue=e}evaluate(e){if(e.formattedSection){let t=this.defaultValue.property.overrides;if(t!=null&&t.hasOverride(e.formattedSection))return t.getOverride(e.formattedSection)}return e.feature&&e.featureState?this.defaultValue.evaluate(e.feature,e.featureState):this.defaultValue.property.specification.default}eachChild(e){if(!this.defaultValue.isConstant()){let t=this.defaultValue.value;e(t._styleExpression.expression)}}outputDefined(){return!1}serialize(){return null}};G("FormatSectionOverride",b1,{omit:["defaultValue"]});const w1=e=>e.type==="symbol";var YC=class kc extends Li{constructor(t,i){super(t,Ju,i)}recalculate(t,i){super.recalculate(t,i);let r=this.layout.get("icon-rotation-alignment");if((r.value.kind!=="constant"||r.value.value==="auto")&&(this.layout._values["icon-rotation-alignment"]=new wi(r.property,{kind:"constant",value:this.layout.get("symbol-placement")==="point"?"viewport":"map"},r.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 a=this.layout.get("text-writing-mode");if(a){let n=[];for(let s of a)n.includes(s)||n.push(s);this.layout._values["text-writing-mode"]=n}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(t,i,r,a){let n=this.layout.get(t).evaluate(i,{},r,a),s=this._unevaluatedLayout._values[t];return!s.isDataDriven()&&!Vl(s.value)&&n?ZC(i.properties,n):n}createBucket(t){return new yl(t)}queryRadius(){return 0}queryIntersectsFeature(){throw Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(let t of Ju.paint.overridableProperties){if(!kc.hasPaintOverride(this.layout,t))continue;let i=this.paint.get(t),r=new Id(new b1(i),`layers[${this.id}].paint.${i.property.name}`,i.property.specification),a=null;a=i.value.kind==="constant"||i.value.kind==="source"?new ls("source",r):new rl("composite",r,i.value.zoomStops),this.paint._values[t]=new wi(i.property,a,i.parameters)}}_handleOverridablePaintPropertyUpdate(t,i,r){return!this.layout||i.isDataDriven()||r.isDataDriven()?!1:kc.hasPaintOverride(this.layout,t)}static hasPaintOverride(t,i){let r=t.get("text-field"),a=Ju.paint.properties[i],n=!1,s=o=>{var l;for(let u of o)if((l=a.overrides)!=null&&l.hasOverride(u)){n=!0;return}};if(r.value.kind==="constant"&&r.value.value instanceof _r)s(r.value.value.sections);else if(r.value.kind==="source"||r.value.kind==="composite"){let o=u=>{if(!n)if(u instanceof Qa&&ut(u.value)===Ss){let h=u.value;s(h.sections)}else u instanceof X_?s(u.sections):u.eachChild(o)},l=r.value;l._styleExpression&&o(l._styleExpression.expression)}return n}};function KC(e,t,i,r=1){var n;let a=(n=e.get("icon-padding").evaluate(t,{},i))==null?void 0:n.values;return[a[0]*r,a[1]*r,a[2]*r,a[3]*r]}let JC;const QC=()=>JC||(JC=new Dt({"background-color":new N(z.paint_background["background-color"],"background-color"),"background-pattern":new n0(z.paint_background["background-pattern"],"background-pattern"),"background-opacity":new N(z.paint_background["background-opacity"],"background-opacity")}));var eP={get paint(){return QC()}};const tP=e=>e.type==="background";var iP=class extends Li{constructor(e,t){super(e,eP,t)}};function rP(e){let t=[],i=e.id;return i===void 0&&t.push(new O(`layers.${i}`,null,'missing required property "id"')),e.render===void 0&&t.push(new O(`layers.${i}`,null,'missing required method "render"')),e.renderingMode&&e.renderingMode!=="2d"&&e.renderingMode!=="3d"&&t.push(new O(`layers.${i}`,null,'property "renderingMode" must be either "2d" or "3d"')),t}const aP=e=>e.type==="custom";var nP=class extends Li{constructor(e,t){super(e,{},t),this.onAdd=i=>{this.implementation.onAdd&&this.implementation.onAdd(i,i.painter.context.gl)},this.onRemove=i=>{this.implementation.onRemove&&this.implementation.onRemove(i,i.painter.context.gl)},this.implementation=e}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 Qu(e,t){if(e.type==="custom")return new nP(e,t);switch(e.type){case"background":return new iP(e,t);case"circle":return new _E(e,t);case"color-relief":return new zE(e,t);case"fill":return new fS(e,t);case"fill-extrusion":return new OS(e,t);case"heatmap":return new wE(e,t);case"hillshade":return new CE(e,t);case"line":return new tD(e,t);case"raster":return new DT(e,t);case"symbol":return new YC(e,t)}}var sP=class{constructor(e){this._methodToThrottle=e,this._triggered=!1,this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._methodToThrottle()}}trigger(){var e;this._triggered||(this._triggered=!0,(e=this._channel)==null||e.port1.postMessage(!0))}remove(){delete this._channel,this._methodToThrottle=()=>{}}};const oP={once:!0};var lP=class{constructor(e,t){this.target=e,this.mapId=t,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new sP(()=>this.process()),this.subscription=Ch(this.target,"message",i=>this.receive(i),!1),this.globalScope=Ya(self)?e:window}registerMessageHandler(e,t){this.messageHandlers[e]=t}unregisterMessageHandler(e){delete this.messageHandlers[e]}sendAsync(e,t){return new Promise((i,r)=>{let a=Math.round(Math.random()*1e18).toString(36).substring(0,10),n=t?Ch(t.signal,"abort",()=>{n==null||n.unsubscribe(),delete this.resolveRejects[a];let l={id:a,type:"<cancel>",origin:location.origin,targetMapId:e.targetMapId,sourceMapId:this.mapId};this.target.postMessage(l),r(new Ts(t.signal.reason))},oP):null;this.resolveRejects[a]={resolve:l=>{n==null||n.unsubscribe(),i(l)},reject:l=>{n==null||n.unsubscribe(),r(l)}};let s=[],o={...e,id:a,sourceMapId:this.mapId,origin:location.origin,data:Xn(e.data,s)};this.target.postMessage(o,{transfer:s})})}receive(e){let t=e.data,i=t.id,r=["file://","resource://android","null"],a=[t.origin,location.origin],n=t.origin===location.origin,s=a.some(o=>r.includes(o));if((n||s)&&!(t.targetMapId&&this.mapId!==t.targetMapId)){if(t.type==="<cancel>"){delete this.tasks[i];let o=this.abortControllers[i];delete this.abortControllers[i],o&&o.abort();return}if(Ya(self)||t.mustQueue){this.tasks[i]=t,this.taskQueue.push(i),this.invoker.trigger();return}this.processTask(i,t)}}process(){if(this.taskQueue.length===0)return;let e=this.taskQueue.shift(),t=this.tasks[e];delete this.tasks[e],this.taskQueue.length>0&&this.invoker.trigger(),t&&this.processTask(e,t)}async processTask(e,t){if(t.type==="<response>"){let a=this.resolveRejects[e];if(delete this.resolveRejects[e],!a)return;t.error?a.reject(kt(Yn(t.error))):a.resolve(Yn(t.data));return}if(!this.messageHandlers[t.type]){this.completeTask(e,null,null);return}let i=Yn(t.data),r=new AbortController;this.abortControllers[e]=r;try{let a=await this.messageHandlers[t.type](t.sourceMapId,i,r);this.completeTask(e,null,a)}catch(a){this.completeTask(e,kt(a))}}completeTask(e,t,i){let r=[];delete this.abortControllers[e];let a={id:e,type:"<response>",sourceMapId:this.mapId,origin:location.origin,error:t?Xn(t):null,data:Xn(i,r)};this.target.postMessage(a,{transfer:r})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}};function uP(e,t,i){return!(e<0||e>25||i<0||i>=2**e||t<0||t>=2**e)}function Gm(e,t){let{x:i,y:r}=Me.fromLngLat(t);return!(e<0||e>25||r<0||r>=1||i<0||i>=1)}var eu=class{constructor(e,t,i){if(!uP(e,t,i))throw Error(`x=${t}, y=${i}, z=${e} outside of bounds. 0<=x<${2**e}, 0<=y<${2**e} 0<=z<=25 `);this.z=e,this.x=t,this.y=i,this.key=Ga(0,e,e,t,i)}equals(e){return this.z===e.z&&this.x===e.x&&this.y===e.y}url(e,t,i){let r=hP(this.x,this.y,this.z),a=cP(this.z,this.x,this.y);return e[(this.x+this.y)%e.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(i==="tms"?2**this.z-this.y-1:this.y)).replace(/{ratio}/g,t>1?"@2x":"").replace(/{quadkey}/g,a).replace(/{bbox-epsg-3857}/g,r)}isChildOf(e){let t=this.z-e.z;return t>0&&e.x===this.x>>t&&e.y===this.y>>t}getTilePoint(e){let t=2**this.z;return new A((e.x*t-this.x)*L,(e.y*t-this.y)*L)}toString(){return`${this.z}/${this.x}/${this.y}`}},vl=class{constructor(e,t){this.wrap=e,this.canonical=t,this.key=Ga(e,t.z,t.z,t.x,t.y)}},Pt=class _i{constructor(t,i,r,a,n){if(this.terrainRttPosMatrix32f=null,t<r)throw Error(`overscaledZ should be >= z; overscaledZ = ${t}; z = ${r}`);this.overscaledZ=t,this.wrap=i,this.canonical=new eu(r,+a,+n),this.key=Ga(i,t,r,a,n)}clone(){return new _i(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(t){return this.overscaledZ===t.overscaledZ&&this.wrap===t.wrap&&this.canonical.equals(t.canonical)}scaledTo(t){if(t>this.overscaledZ)throw Error(`targetZ > this.overscaledZ; targetZ = ${t}; overscaledZ = ${this.overscaledZ}`);let i=this.canonical.z-t;return t>this.canonical.z?new _i(t,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new _i(t,this.wrap,t,this.canonical.x>>i,this.canonical.y>>i)}isOverscaled(){return this.overscaledZ>this.canonical.z}calculateScaledKey(t,i){if(t>this.overscaledZ)throw Error(`targetZ > this.overscaledZ; targetZ = ${t}; overscaledZ = ${this.overscaledZ}`);let r=this.canonical.z-t;return t>this.canonical.z?Ga(this.wrap*+i,t,this.canonical.z,this.canonical.x,this.canonical.y):Ga(this.wrap*+i,t,t,this.canonical.x>>r,this.canonical.y>>r)}isChildOf(t){if(t.wrap!==this.wrap||this.overscaledZ-t.overscaledZ<=0)return!1;if(t.overscaledZ===0)return this.overscaledZ>0;let i=this.canonical.z-t.canonical.z;return i<0?!1:t.canonical.x===this.canonical.x>>i&&t.canonical.y===this.canonical.y>>i}children(t){if(this.overscaledZ>=t)return[new _i(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];let i=this.canonical.z+1,r=this.canonical.x*2,a=this.canonical.y*2;return[new _i(i,this.wrap,i,r,a),new _i(i,this.wrap,i,r+1,a),new _i(i,this.wrap,i,r,a+1),new _i(i,this.wrap,i,r+1,a+1)]}isLessThan(t){return this.wrap<t.wrap?!0:this.wrap>t.wrap?!1:this.overscaledZ<t.overscaledZ?!0:this.overscaledZ>t.overscaledZ?!1:this.canonical.x<t.canonical.x?!0:this.canonical.x>t.canonical.x?!1:this.canonical.y<t.canonical.y}wrapped(){return new _i(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(t){return new _i(this.overscaledZ,t,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return 2**(this.overscaledZ-this.canonical.z)}toUnwrapped(){return new vl(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(t){return this.canonical.getTilePoint(new Me(t.x-this.wrap,t.y))}normalizeCoordinates(t,i,r=L){if(t>=0&&t<r&&i>=0&&i<r)return{tileID:this,x:t,y:i};let a=Math.floor(t/r),n=Math.floor(i/r),s=t-a*r,o=i-n*r,l=this.canonical.z,u=1<<l,h=this.canonical.y+n;if(h<0||h>=u)return null;let c=this.canonical.x+a,d=this.wrap;return c<0?(d-=Math.ceil(-c/u),c=(c%u+u)%u):c>=u&&(d+=Math.floor(c/u),c%=u),{tileID:new _i(this.overscaledZ,d,l,c,h),x:s,y:o}}};function Ga(e,t,i,r,a){e*=2,e<0&&(e=e*-1-1);let n=1<<i;return(n*n*e+n*a+r).toString(36)+i.toString(36)+t.toString(36)}const eh=Math.PI*6378137;function hP(e,t,i){t=2**i-t-1;let r=Zm(e*256,t*256,i),a=Zm((e+1)*256,(t+1)*256,i);return`${r[0]},${r[1]},${a[0]},${a[1]}`}function Zm(e,t,i){let r=2*eh/256/2**i;return[e*r-eh,t*r-eh]}function cP(e,t,i){let r="";for(let a=e;a>0;a--){let n=1<<a-1;r+=(t&n?1:0)+(i&n?2:0)}return r}function qm(e,t){let i=Math.abs(e.wrap*2)-+(e.wrap<0),r=Math.abs(t.wrap*2)-+(t.wrap<0);return e.overscaledZ-t.overscaledZ||r-i||t.canonical.y-e.canonical.y||t.canonical.x-e.canonical.x}G("CanonicalTileID",eu),G("OverscaledTileID",Pt,{omit:["terrainRttPosMatrix32f"]});const Uo="_geojsonTileLayer";var dP=class{constructor(e){this._stringToNumber={},this._numberToString=[];for(let t=0;t<e.length;t++){let i=e[t];this._stringToNumber[i]=t,this._numberToString[t]=i}}encode(e){return this._stringToNumber[e]}decode(e){if(e>=this._numberToString.length)throw Error(`Out of bounds. Index requested n=${e} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[e]}},T1=class{constructor(e,t,i,r,a){this.type="Feature",this._vectorTileFeature=e,this._x=i,this._y=r,this._z=t;for(let n in e.properties)typeof e.properties[n]=="string"&&e.properties[n].startsWith("__$json__:")&&(e.properties[n]=JSON.parse(e.properties[n].slice(10)));this.properties=e.properties,this.id=a}projectPoint(e,t,i,r){return[(e.x+t)*360/r-180,360/Math.PI*Math.atan(Math.exp((1-(e.y+i)*2/r)*Math.PI))-90]}projectLine(e,t,i,r){return e.map(a=>this.projectPoint(a,t,i,r))}get geometry(){if(this._geometry)return this._geometry;let e=this._vectorTileFeature,t=e.extent*2**this._z,i=e.extent*this._x,r=e.extent*this._y,a=e.loadGeometry();switch(e.type){case 1:{let n=[];for(let o of a)n.push(o[0]);let s=this.projectLine(n,i,r,t);this._geometry=n.length===1?{type:"Point",coordinates:s[0]}:{type:"MultiPoint",coordinates:s};break}case 2:{let n=a.map(s=>this.projectLine(s,i,r,t));this._geometry=n.length===1?{type:"LineString",coordinates:n[0]}:{type:"MultiLineString",coordinates:n};break}case 3:{let n=V0(a),s=[];for(let o of n)s.push(o.map(l=>this.projectLine(l,i,r,t)));this._geometry=s.length===1?{type:"Polygon",coordinates:s[0]}:{type:"MultiPolygon",coordinates:s};break}default:throw Error(`unknown feature type: ${e.type}`)}return this._geometry}set geometry(e){this._geometry=e}toJSON(){let e={geometry:this.geometry};for(let t in this)t!=="_geometry"&&t!=="_vectorTileFeature"&&t!=="_x"&&t!=="_y"&&t!=="_z"&&(e[t]=this[t]);return e}},ma=class{constructor(e,t,i){this._name=e,this.dataBuffer=t,typeof i=="number"?this._size=i:(this.nullabilityBuffer=i,this._size=i.size())}getValue(e){return this.nullabilityBuffer&&!this.nullabilityBuffer.get(e)?null:this.getValueFromBuffer(e)}has(e){var t;return((t=this.nullabilityBuffer)==null?void 0:t.get(e))||!this.nullabilityBuffer}get name(){return this._name}get size(){return this._size}},tu=class extends ma{},Kd=class extends tu{getValueFromBuffer(e){return this.dataBuffer[e]}},Jd=class extends tu{getValueFromBuffer(e){return this.dataBuffer[e]}},E1=class extends ma{constructor(e,t,i,r){super(e,t,r),this.delta=i}},Qd=class extends E1{constructor(e,t,i,r,a){super(e,a?Int32Array.of(t):Uint32Array.of(t),i,r)}getValueFromBuffer(e){return this.dataBuffer[0]+e*this.delta}},ep=class extends ma{constructor(e,t,i,r){super(e,r?Int32Array.of(t):Uint32Array.of(t),i)}getValueFromBuffer(e){return this.dataBuffer[0]}},pP=class{constructor(e,t,i,r,a=4096){if(this._name=e,this._geometryVector=t,this._idVector=i,this._propertyVectors=r,this._extent=a,e.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(e){return this.propertyVectorsMap||(this.propertyVectorsMap=new Map(this.propertyVectors.map(t=>[t.name,t]))),this.propertyVectorsMap.get(e)}get numFeatures(){return this.geometryVector.numGeometries}get extent(){return this._extent}getFeatures(){let e=[],t=this.geometryVector.getGeometries();for(let i=0;i<this.numFeatures;i++){let r;if(this.idVector){let s=this.idVector.getValue(i);s!==null&&(r=this.containsMaxSafeIntegerValues(this.idVector)?Number(s):s)}let a={coordinates:t[i],type:this.geometryVector.geometryType(i)},n={};for(let s of this.propertyVectors){if(!s)continue;let o=s.name,l=s.getValue(i);l!==null&&(n[o]=l)}e.push({id:r,geometry:a,properties:n})}return e}containsMaxSafeIntegerValues(e){return e instanceof Kd||e instanceof ep||e instanceof Qd||e instanceof Jd}};const Zn={FEATURE:0},De={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},Ir={GEOMETRY:0,STRUCT:1,MAP:2},S1={ID:0};var D1=class{constructor(e){this.value=e}get(){return this.value}set(e){this.value=e}increment(){return this.value++}add(e){this.value+=e}},ge;(function(e){e.NONE="NONE",e.DELTA="DELTA",e.COMPONENTWISE_DELTA="COMPONENTWISE_DELTA",e.RLE="RLE",e.MORTON="MORTON"})(ge||(ge={}));var Si;(function(e){e.NONE="NONE",e.FAST_PFOR="FAST_PFOR",e.VARINT="VARINT"})(Si||(Si={}));const tp=new Uint32Array(33);tp[0]=0;for(let e=1;e<=32;e++)tp[e]=e===32?4294967295:4294967295>>>32-e;const Lc=tp,C1=65536;function ip(e,t){return e-e%t}function fP(e){return ip(e+31,32)}function mP(e){if(!Number.isFinite(e)||e<=0)return C1;let t=ip(Math.floor(e),256);return t===0?256:t}function gP(e){let t=e>>>0;return((t&255)<<24|(t&65280)<<8|t>>>8&65280|t>>>24&255)>>>0}function _P(e,t,i,r){let a=r,n=e[t]>>>0,s=e[t+1]>>>0;i[a++]=n>>>0&3,i[a++]=n>>>2&3,i[a++]=n>>>4&3,i[a++]=n>>>6&3,i[a++]=n>>>8&3,i[a++]=n>>>10&3,i[a++]=n>>>12&3,i[a++]=n>>>14&3,i[a++]=n>>>16&3,i[a++]=n>>>18&3,i[a++]=n>>>20&3,i[a++]=n>>>22&3,i[a++]=n>>>24&3,i[a++]=n>>>26&3,i[a++]=n>>>28&3,i[a++]=n>>>30&3,i[a++]=s>>>0&3,i[a++]=s>>>2&3,i[a++]=s>>>4&3,i[a++]=s>>>6&3,i[a++]=s>>>8&3,i[a++]=s>>>10&3,i[a++]=s>>>12&3,i[a++]=s>>>14&3,i[a++]=s>>>16&3,i[a++]=s>>>18&3,i[a++]=s>>>20&3,i[a++]=s>>>22&3,i[a++]=s>>>24&3,i[a++]=s>>>26&3,i[a++]=s>>>28&3,i[a]=s>>>30&3}function yP(e,t,i,r){let a=r,n=e[t]>>>0,s=e[t+1]>>>0,o=e[t+2]>>>0;i[a++]=n>>>0&7,i[a++]=n>>>3&7,i[a++]=n>>>6&7,i[a++]=n>>>9&7,i[a++]=n>>>12&7,i[a++]=n>>>15&7,i[a++]=n>>>18&7,i[a++]=n>>>21&7,i[a++]=n>>>24&7,i[a++]=n>>>27&7,i[a++]=(n>>>30|(s&1)<<2)&7,i[a++]=s>>>1&7,i[a++]=s>>>4&7,i[a++]=s>>>7&7,i[a++]=s>>>10&7,i[a++]=s>>>13&7,i[a++]=s>>>16&7,i[a++]=s>>>19&7,i[a++]=s>>>22&7,i[a++]=s>>>25&7,i[a++]=s>>>28&7,i[a++]=(s>>>31|(o&3)<<1)&7,i[a++]=o>>>2&7,i[a++]=o>>>5&7,i[a++]=o>>>8&7,i[a++]=o>>>11&7,i[a++]=o>>>14&7,i[a++]=o>>>17&7,i[a++]=o>>>20&7,i[a++]=o>>>23&7,i[a++]=o>>>26&7,i[a]=o>>>29&7}function vP(e,t,i,r){let a=r,n=e[t]>>>0,s=e[t+1]>>>0,o=e[t+2]>>>0,l=e[t+3]>>>0;i[a++]=n>>>0&15,i[a++]=n>>>4&15,i[a++]=n>>>8&15,i[a++]=n>>>12&15,i[a++]=n>>>16&15,i[a++]=n>>>20&15,i[a++]=n>>>24&15,i[a++]=n>>>28&15,i[a++]=s>>>0&15,i[a++]=s>>>4&15,i[a++]=s>>>8&15,i[a++]=s>>>12&15,i[a++]=s>>>16&15,i[a++]=s>>>20&15,i[a++]=s>>>24&15,i[a++]=s>>>28&15,i[a++]=o>>>0&15,i[a++]=o>>>4&15,i[a++]=o>>>8&15,i[a++]=o>>>12&15,i[a++]=o>>>16&15,i[a++]=o>>>20&15,i[a++]=o>>>24&15,i[a++]=o>>>28&15,i[a++]=l>>>0&15,i[a++]=l>>>4&15,i[a++]=l>>>8&15,i[a++]=l>>>12&15,i[a++]=l>>>16&15,i[a++]=l>>>20&15,i[a++]=l>>>24&15,i[a]=l>>>28&15}function xP(e,t,i,r){let a=r,n=e[t]>>>0,s=e[t+1]>>>0,o=e[t+2]>>>0,l=e[t+3]>>>0,u=e[t+4]>>>0;i[a++]=n>>>0&31,i[a++]=n>>>5&31,i[a++]=n>>>10&31,i[a++]=n>>>15&31,i[a++]=n>>>20&31,i[a++]=n>>>25&31,i[a++]=(n>>>30|(s&7)<<2)&31,i[a++]=s>>>3&31,i[a++]=s>>>8&31,i[a++]=s>>>13&31,i[a++]=s>>>18&31,i[a++]=s>>>23&31,i[a++]=(s>>>28|(o&1)<<4)&31,i[a++]=o>>>1&31,i[a++]=o>>>6&31,i[a++]=o>>>11&31,i[a++]=o>>>16&31,i[a++]=o>>>21&31,i[a++]=o>>>26&31,i[a++]=(o>>>31|(l&15)<<1)&31,i[a++]=l>>>4&31,i[a++]=l>>>9&31,i[a++]=l>>>14&31,i[a++]=l>>>19&31,i[a++]=l>>>24&31,i[a++]=(l>>>29|(u&3)<<3)&31,i[a++]=u>>>2&31,i[a++]=u>>>7&31,i[a++]=u>>>12&31,i[a++]=u>>>17&31,i[a++]=u>>>22&31,i[a]=u>>>27&31}function bP(e,t,i,r){let a=r,n=e[t]>>>0,s=e[t+1]>>>0,o=e[t+2]>>>0,l=e[t+3]>>>0,u=e[t+4]>>>0,h=e[t+5]>>>0;i[a++]=n>>>0&63,i[a++]=n>>>6&63,i[a++]=n>>>12&63,i[a++]=n>>>18&63,i[a++]=n>>>24&63,i[a++]=(n>>>30|(s&15)<<2)&63,i[a++]=s>>>4&63,i[a++]=s>>>10&63,i[a++]=s>>>16&63,i[a++]=s>>>22&63,i[a++]=(s>>>28|(o&3)<<4)&63,i[a++]=o>>>2&63,i[a++]=o>>>8&63,i[a++]=o>>>14&63,i[a++]=o>>>20&63,i[a++]=o>>>26&63,i[a++]=l>>>0&63,i[a++]=l>>>6&63,i[a++]=l>>>12&63,i[a++]=l>>>18&63,i[a++]=l>>>24&63,i[a++]=(l>>>30|(u&15)<<2)&63,i[a++]=u>>>4&63,i[a++]=u>>>10&63,i[a++]=u>>>16&63,i[a++]=u>>>22&63,i[a++]=(u>>>28|(h&3)<<4)&63,i[a++]=h>>>2&63,i[a++]=h>>>8&63,i[a++]=h>>>14&63,i[a++]=h>>>20&63,i[a]=h>>>26&63}function wP(e,t,i,r){let a=r,n=e[t]>>>0,s=e[t+1]>>>0,o=e[t+2]>>>0,l=e[t+3]>>>0,u=e[t+4]>>>0,h=e[t+5]>>>0,c=e[t+6]>>>0;i[a++]=n>>>0&127,i[a++]=n>>>7&127,i[a++]=n>>>14&127,i[a++]=n>>>21&127,i[a++]=(n>>>28|(s&7)<<4)&127,i[a++]=s>>>3&127,i[a++]=s>>>10&127,i[a++]=s>>>17&127,i[a++]=s>>>24&127,i[a++]=(s>>>31|(o&63)<<1)&127,i[a++]=o>>>6&127,i[a++]=o>>>13&127,i[a++]=o>>>20&127,i[a++]=(o>>>27|(l&3)<<5)&127,i[a++]=l>>>2&127,i[a++]=l>>>9&127,i[a++]=l>>>16&127,i[a++]=l>>>23&127,i[a++]=(l>>>30|(u&31)<<2)&127,i[a++]=u>>>5&127,i[a++]=u>>>12&127,i[a++]=u>>>19&127,i[a++]=(u>>>26|(h&1)<<6)&127,i[a++]=h>>>1&127,i[a++]=h>>>8&127,i[a++]=h>>>15&127,i[a++]=h>>>22&127,i[a++]=(h>>>29|(c&15)<<3)&127,i[a++]=c>>>4&127,i[a++]=c>>>11&127,i[a++]=c>>>18&127,i[a]=c>>>25&127}function TP(e,t,i,r){let a=r,n=e[t]>>>0,s=e[t+1]>>>0,o=e[t+2]>>>0,l=e[t+3]>>>0,u=e[t+4]>>>0,h=e[t+5]>>>0,c=e[t+6]>>>0,d=e[t+7]>>>0;i[a++]=n>>>0&255,i[a++]=n>>>8&255,i[a++]=n>>>16&255,i[a++]=n>>>24&255,i[a++]=s>>>0&255,i[a++]=s>>>8&255,i[a++]=s>>>16&255,i[a++]=s>>>24&255,i[a++]=o>>>0&255,i[a++]=o>>>8&255,i[a++]=o>>>16&255,i[a++]=o>>>24&255,i[a++]=l>>>0&255,i[a++]=l>>>8&255,i[a++]=l>>>16&255,i[a++]=l>>>24&255,i[a++]=u>>>0&255,i[a++]=u>>>8&255,i[a++]=u>>>16&255,i[a++]=u>>>24&255,i[a++]=h>>>0&255,i[a++]=h>>>8&255,i[a++]=h>>>16&255,i[a++]=h>>>24&255,i[a++]=c>>>0&255,i[a++]=c>>>8&255,i[a++]=c>>>16&255,i[a++]=c>>>24&255,i[a++]=d>>>0&255,i[a++]=d>>>8&255,i[a++]=d>>>16&255,i[a]=d>>>24&255}function EP(e,t,i,r){let a=r,n=e[t]>>>0,s=e[t+1]>>>0,o=e[t+2]>>>0,l=e[t+3]>>>0,u=e[t+4]>>>0,h=e[t+5]>>>0,c=e[t+6]>>>0,d=e[t+7]>>>0,p=e[t+8]>>>0;i[a++]=n>>>0&511,i[a++]=n>>>9&511,i[a++]=n>>>18&511,i[a++]=(n>>>27|(s&15)<<5)&511,i[a++]=s>>>4&511,i[a++]=s>>>13&511,i[a++]=s>>>22&511,i[a++]=(s>>>31|(o&255)<<1)&511,i[a++]=o>>>8&511,i[a++]=o>>>17&511,i[a++]=(o>>>26|(l&7)<<6)&511,i[a++]=l>>>3&511,i[a++]=l>>>12&511,i[a++]=l>>>21&511,i[a++]=(l>>>30|(u&127)<<2)&511,i[a++]=u>>>7&511,i[a++]=u>>>16&511,i[a++]=(u>>>25|(h&3)<<7)&511,i[a++]=h>>>2&511,i[a++]=h>>>11&511,i[a++]=h>>>20&511,i[a++]=(h>>>29|(c&63)<<3)&511,i[a++]=c>>>6&511,i[a++]=c>>>15&511,i[a++]=(c>>>24|(d&1)<<8)&511,i[a++]=d>>>1&511,i[a++]=d>>>10&511,i[a++]=d>>>19&511,i[a++]=(d>>>28|(p&31)<<4)&511,i[a++]=p>>>5&511,i[a++]=p>>>14&511,i[a]=p>>>23&511}function SP(e,t,i,r){let a=r,n=e[t]>>>0,s=e[t+1]>>>0,o=e[t+2]>>>0,l=e[t+3]>>>0,u=e[t+4]>>>0,h=e[t+5]>>>0,c=e[t+6]>>>0,d=e[t+7]>>>0,p=e[t+8]>>>0,f=e[t+9]>>>0;i[a++]=n>>>0&1023,i[a++]=n>>>10&1023,i[a++]=n>>>20&1023,i[a++]=(n>>>30|(s&255)<<2)&1023,i[a++]=s>>>8&1023,i[a++]=s>>>18&1023,i[a++]=(s>>>28|(o&63)<<4)&1023,i[a++]=o>>>6&1023,i[a++]=o>>>16&1023,i[a++]=(o>>>26|(l&15)<<6)&1023,i[a++]=l>>>4&1023,i[a++]=l>>>14&1023,i[a++]=(l>>>24|(u&3)<<8)&1023,i[a++]=u>>>2&1023,i[a++]=u>>>12&1023,i[a++]=u>>>22&1023,i[a++]=h>>>0&1023,i[a++]=h>>>10&1023,i[a++]=h>>>20&1023,i[a++]=(h>>>30|(c&255)<<2)&1023,i[a++]=c>>>8&1023,i[a++]=c>>>18&1023,i[a++]=(c>>>28|(d&63)<<4)&1023,i[a++]=d>>>6&1023,i[a++]=d>>>16&1023,i[a++]=(d>>>26|(p&15)<<6)&1023,i[a++]=p>>>4&1023,i[a++]=p>>>14&1023,i[a++]=(p>>>24|(f&3)<<8)&1023,i[a++]=f>>>2&1023,i[a++]=f>>>12&1023,i[a]=f>>>22&1023}function DP(e,t,i,r){let a=r,n=e[t]>>>0,s=e[t+1]>>>0,o=e[t+2]>>>0,l=e[t+3]>>>0,u=e[t+4]>>>0,h=e[t+5]>>>0,c=e[t+6]>>>0,d=e[t+7]>>>0,p=e[t+8]>>>0,f=e[t+9]>>>0,m=e[t+10]>>>0;i[a++]=n>>>0&2047,i[a++]=n>>>11&2047,i[a++]=(n>>>22|(s&1)<<10)&2047,i[a++]=s>>>1&2047,i[a++]=s>>>12&2047,i[a++]=(s>>>23|(o&3)<<9)&2047,i[a++]=o>>>2&2047,i[a++]=o>>>13&2047,i[a++]=(o>>>24|(l&7)<<8)&2047,i[a++]=l>>>3&2047,i[a++]=l>>>14&2047,i[a++]=(l>>>25|(u&15)<<7)&2047,i[a++]=u>>>4&2047,i[a++]=u>>>15&2047,i[a++]=(u>>>26|(h&31)<<6)&2047,i[a++]=h>>>5&2047,i[a++]=h>>>16&2047,i[a++]=(h>>>27|(c&63)<<5)&2047,i[a++]=c>>>6&2047,i[a++]=c>>>17&2047,i[a++]=(c>>>28|(d&127)<<4)&2047,i[a++]=d>>>7&2047,i[a++]=d>>>18&2047,i[a++]=(d>>>29|(p&255)<<3)&2047,i[a++]=p>>>8&2047,i[a++]=p>>>19&2047,i[a++]=(p>>>30|(f&511)<<2)&2047,i[a++]=f>>>9&2047,i[a++]=f>>>20&2047,i[a++]=(f>>>31|(m&1023)<<1)&2047,i[a++]=m>>>10&2047,i[a]=m>>>21&2047}function CP(e,t,i,r){let a=r,n=e[t]>>>0,s=e[t+1]>>>0,o=e[t+2]>>>0,l=e[t+3]>>>0,u=e[t+4]>>>0,h=e[t+5]>>>0,c=e[t+6]>>>0,d=e[t+7]>>>0,p=e[t+8]>>>0,f=e[t+9]>>>0,m=e[t+10]>>>0,g=e[t+11]>>>0;i[a++]=n>>>0&4095,i[a++]=n>>>12&4095,i[a++]=(n>>>24|(s&15)<<8)&4095,i[a++]=s>>>4&4095,i[a++]=s>>>16&4095,i[a++]=(s>>>28|(o&255)<<4)&4095,i[a++]=o>>>8&4095,i[a++]=o>>>20&4095,i[a++]=l>>>0&4095,i[a++]=l>>>12&4095,i[a++]=(l>>>24|(u&15)<<8)&4095,i[a++]=u>>>4&4095,i[a++]=u>>>16&4095,i[a++]=(u>>>28|(h&255)<<4)&4095,i[a++]=h>>>8&4095,i[a++]=h>>>20&4095,i[a++]=c>>>0&4095,i[a++]=c>>>12&4095,i[a++]=(c>>>24|(d&15)<<8)&4095,i[a++]=d>>>4&4095,i[a++]=d>>>16&4095,i[a++]=(d>>>28|(p&255)<<4)&4095,i[a++]=p>>>8&4095,i[a++]=p>>>20&4095,i[a++]=f>>>0&4095,i[a++]=f>>>12&4095,i[a++]=(f>>>24|(m&15)<<8)&4095,i[a++]=m>>>4&4095,i[a++]=m>>>16&4095,i[a++]=(m>>>28|(g&255)<<4)&4095,i[a++]=g>>>8&4095,i[a]=g>>>20&4095}function PP(e,t,i,r){let a=r,n=e[t]>>>0,s=e[t+1]>>>0,o=e[t+2]>>>0,l=e[t+3]>>>0,u=e[t+4]>>>0,h=e[t+5]>>>0,c=e[t+6]>>>0,d=e[t+7]>>>0,p=e[t+8]>>>0,f=e[t+9]>>>0,m=e[t+10]>>>0,g=e[t+11]>>>0,_=e[t+12]>>>0,y=e[t+13]>>>0,x=e[t+14]>>>0,v=e[t+15]>>>0;i[a++]=n>>>0&65535,i[a++]=n>>>16&65535,i[a++]=s>>>0&65535,i[a++]=s>>>16&65535,i[a++]=o>>>0&65535,i[a++]=o>>>16&65535,i[a++]=l>>>0&65535,i[a++]=l>>>16&65535,i[a++]=u>>>0&65535,i[a++]=u>>>16&65535,i[a++]=h>>>0&65535,i[a++]=h>>>16&65535,i[a++]=c>>>0&65535,i[a++]=c>>>16&65535,i[a++]=d>>>0&65535,i[a++]=d>>>16&65535,i[a++]=p>>>0&65535,i[a++]=p>>>16&65535,i[a++]=f>>>0&65535,i[a++]=f>>>16&65535,i[a++]=m>>>0&65535,i[a++]=m>>>16&65535,i[a++]=g>>>0&65535,i[a++]=g>>>16&65535,i[a++]=_>>>0&65535,i[a++]=_>>>16&65535,i[a++]=y>>>0&65535,i[a++]=y>>>16&65535,i[a++]=x>>>0&65535,i[a++]=x>>>16&65535,i[a++]=v>>>0&65535,i[a]=v>>>16&65535}function AP(e,t,i,r){let a=r,n=t;for(let s=0;s<8;s++){let o=e[n++]>>>0;i[a++]=o>>>0&1,i[a++]=o>>>1&1,i[a++]=o>>>2&1,i[a++]=o>>>3&1,i[a++]=o>>>4&1,i[a++]=o>>>5&1,i[a++]=o>>>6&1,i[a++]=o>>>7&1,i[a++]=o>>>8&1,i[a++]=o>>>9&1,i[a++]=o>>>10&1,i[a++]=o>>>11&1,i[a++]=o>>>12&1,i[a++]=o>>>13&1,i[a++]=o>>>14&1,i[a++]=o>>>15&1,i[a++]=o>>>16&1,i[a++]=o>>>17&1,i[a++]=o>>>18&1,i[a++]=o>>>19&1,i[a++]=o>>>20&1,i[a++]=o>>>21&1,i[a++]=o>>>22&1,i[a++]=o>>>23&1,i[a++]=o>>>24&1,i[a++]=o>>>25&1,i[a++]=o>>>26&1,i[a++]=o>>>27&1,i[a++]=o>>>28&1,i[a++]=o>>>29&1,i[a++]=o>>>30&1,i[a++]=o>>>31&1}}function IP(e,t,i,r){let a=r,n=t;for(let s=0;s<8;s++){let o=e[n++]>>>0,l=e[n++]>>>0;i[a++]=o>>>0&3,i[a++]=o>>>2&3,i[a++]=o>>>4&3,i[a++]=o>>>6&3,i[a++]=o>>>8&3,i[a++]=o>>>10&3,i[a++]=o>>>12&3,i[a++]=o>>>14&3,i[a++]=o>>>16&3,i[a++]=o>>>18&3,i[a++]=o>>>20&3,i[a++]=o>>>22&3,i[a++]=o>>>24&3,i[a++]=o>>>26&3,i[a++]=o>>>28&3,i[a++]=o>>>30&3,i[a++]=l>>>0&3,i[a++]=l>>>2&3,i[a++]=l>>>4&3,i[a++]=l>>>6&3,i[a++]=l>>>8&3,i[a++]=l>>>10&3,i[a++]=l>>>12&3,i[a++]=l>>>14&3,i[a++]=l>>>16&3,i[a++]=l>>>18&3,i[a++]=l>>>20&3,i[a++]=l>>>22&3,i[a++]=l>>>24&3,i[a++]=l>>>26&3,i[a++]=l>>>28&3,i[a++]=l>>>30&3}}function MP(e,t,i,r){let a=r,n=t;for(let s=0;s<8;s++){let o=e[n++]>>>0,l=e[n++]>>>0,u=e[n++]>>>0;i[a++]=o>>>0&7,i[a++]=o>>>3&7,i[a++]=o>>>6&7,i[a++]=o>>>9&7,i[a++]=o>>>12&7,i[a++]=o>>>15&7,i[a++]=o>>>18&7,i[a++]=o>>>21&7,i[a++]=o>>>24&7,i[a++]=o>>>27&7,i[a++]=(o>>>30|(l&1)<<2)&7,i[a++]=l>>>1&7,i[a++]=l>>>4&7,i[a++]=l>>>7&7,i[a++]=l>>>10&7,i[a++]=l>>>13&7,i[a++]=l>>>16&7,i[a++]=l>>>19&7,i[a++]=l>>>22&7,i[a++]=l>>>25&7,i[a++]=l>>>28&7,i[a++]=(l>>>31|(u&3)<<1)&7,i[a++]=u>>>2&7,i[a++]=u>>>5&7,i[a++]=u>>>8&7,i[a++]=u>>>11&7,i[a++]=u>>>14&7,i[a++]=u>>>17&7,i[a++]=u>>>20&7,i[a++]=u>>>23&7,i[a++]=u>>>26&7,i[a++]=u>>>29&7}}function FP(e,t,i,r){let a=r,n=t;for(let s=0;s<8;s++){let o=e[n++]>>>0,l=e[n++]>>>0,u=e[n++]>>>0,h=e[n++]>>>0;i[a++]=o>>>0&15,i[a++]=o>>>4&15,i[a++]=o>>>8&15,i[a++]=o>>>12&15,i[a++]=o>>>16&15,i[a++]=o>>>20&15,i[a++]=o>>>24&15,i[a++]=o>>>28&15,i[a++]=l>>>0&15,i[a++]=l>>>4&15,i[a++]=l>>>8&15,i[a++]=l>>>12&15,i[a++]=l>>>16&15,i[a++]=l>>>20&15,i[a++]=l>>>24&15,i[a++]=l>>>28&15,i[a++]=u>>>0&15,i[a++]=u>>>4&15,i[a++]=u>>>8&15,i[a++]=u>>>12&15,i[a++]=u>>>16&15,i[a++]=u>>>20&15,i[a++]=u>>>24&15,i[a++]=u>>>28&15,i[a++]=h>>>0&15,i[a++]=h>>>4&15,i[a++]=h>>>8&15,i[a++]=h>>>12&15,i[a++]=h>>>16&15,i[a++]=h>>>20&15,i[a++]=h>>>24&15,i[a++]=h>>>28&15}}function zP(e,t,i,r){let a=r,n=t;for(let s=0;s<8;s++){let o=e[n++]>>>0,l=e[n++]>>>0,u=e[n++]>>>0,h=e[n++]>>>0,c=e[n++]>>>0;i[a++]=o>>>0&31,i[a++]=o>>>5&31,i[a++]=o>>>10&31,i[a++]=o>>>15&31,i[a++]=o>>>20&31,i[a++]=o>>>25&31,i[a++]=(o>>>30|(l&7)<<2)&31,i[a++]=l>>>3&31,i[a++]=l>>>8&31,i[a++]=l>>>13&31,i[a++]=l>>>18&31,i[a++]=l>>>23&31,i[a++]=(l>>>28|(u&1)<<4)&31,i[a++]=u>>>1&31,i[a++]=u>>>6&31,i[a++]=u>>>11&31,i[a++]=u>>>16&31,i[a++]=u>>>21&31,i[a++]=u>>>26&31,i[a++]=(u>>>31|(h&15)<<1)&31,i[a++]=h>>>4&31,i[a++]=h>>>9&31,i[a++]=h>>>14&31,i[a++]=h>>>19&31,i[a++]=h>>>24&31,i[a++]=(h>>>29|(c&3)<<3)&31,i[a++]=c>>>2&31,i[a++]=c>>>7&31,i[a++]=c>>>12&31,i[a++]=c>>>17&31,i[a++]=c>>>22&31,i[a++]=c>>>27&31}}function RP(e,t,i,r){let a=r,n=t;for(let s=0;s<8;s++){let o=e[n++]>>>0,l=e[n++]>>>0,u=e[n++]>>>0,h=e[n++]>>>0,c=e[n++]>>>0,d=e[n++]>>>0;i[a++]=o>>>0&63,i[a++]=o>>>6&63,i[a++]=o>>>12&63,i[a++]=o>>>18&63,i[a++]=o>>>24&63,i[a++]=(o>>>30|(l&15)<<2)&63,i[a++]=l>>>4&63,i[a++]=l>>>10&63,i[a++]=l>>>16&63,i[a++]=l>>>22&63,i[a++]=(l>>>28|(u&3)<<4)&63,i[a++]=u>>>2&63,i[a++]=u>>>8&63,i[a++]=u>>>14&63,i[a++]=u>>>20&63,i[a++]=u>>>26&63,i[a++]=h>>>0&63,i[a++]=h>>>6&63,i[a++]=h>>>12&63,i[a++]=h>>>18&63,i[a++]=h>>>24&63,i[a++]=(h>>>30|(c&15)<<2)&63,i[a++]=c>>>4&63,i[a++]=c>>>10&63,i[a++]=c>>>16&63,i[a++]=c>>>22&63,i[a++]=(c>>>28|(d&3)<<4)&63,i[a++]=d>>>2&63,i[a++]=d>>>8&63,i[a++]=d>>>14&63,i[a++]=d>>>20&63,i[a++]=d>>>26&63}}function kP(e,t,i,r){let a=r,n=t;for(let s=0;s<8;s++){let o=e[n++]>>>0,l=e[n++]>>>0,u=e[n++]>>>0,h=e[n++]>>>0,c=e[n++]>>>0,d=e[n++]>>>0,p=e[n++]>>>0;i[a++]=o>>>0&127,i[a++]=o>>>7&127,i[a++]=o>>>14&127,i[a++]=o>>>21&127,i[a++]=(o>>>28|(l&7)<<4)&127,i[a++]=l>>>3&127,i[a++]=l>>>10&127,i[a++]=l>>>17&127,i[a++]=l>>>24&127,i[a++]=(l>>>31|(u&63)<<1)&127,i[a++]=u>>>6&127,i[a++]=u>>>13&127,i[a++]=u>>>20&127,i[a++]=(u>>>27|(h&3)<<5)&127,i[a++]=h>>>2&127,i[a++]=h>>>9&127,i[a++]=h>>>16&127,i[a++]=h>>>23&127,i[a++]=(h>>>30|(c&31)<<2)&127,i[a++]=c>>>5&127,i[a++]=c>>>12&127,i[a++]=c>>>19&127,i[a++]=(c>>>26|(d&1)<<6)&127,i[a++]=d>>>1&127,i[a++]=d>>>8&127,i[a++]=d>>>15&127,i[a++]=d>>>22&127,i[a++]=(d>>>29|(p&15)<<3)&127,i[a++]=p>>>4&127,i[a++]=p>>>11&127,i[a++]=p>>>18&127,i[a++]=p>>>25&127}}function LP(e,t,i,r){let a=r,n=t;for(let s=0;s<8;s++){let o=e[n++]>>>0,l=e[n++]>>>0,u=e[n++]>>>0,h=e[n++]>>>0,c=e[n++]>>>0,d=e[n++]>>>0,p=e[n++]>>>0,f=e[n++]>>>0;i[a++]=o>>>0&255,i[a++]=o>>>8&255,i[a++]=o>>>16&255,i[a++]=o>>>24&255,i[a++]=l>>>0&255,i[a++]=l>>>8&255,i[a++]=l>>>16&255,i[a++]=l>>>24&255,i[a++]=u>>>0&255,i[a++]=u>>>8&255,i[a++]=u>>>16&255,i[a++]=u>>>24&255,i[a++]=h>>>0&255,i[a++]=h>>>8&255,i[a++]=h>>>16&255,i[a++]=h>>>24&255,i[a++]=c>>>0&255,i[a++]=c>>>8&255,i[a++]=c>>>16&255,i[a++]=c>>>24&255,i[a++]=d>>>0&255,i[a++]=d>>>8&255,i[a++]=d>>>16&255,i[a++]=d>>>24&255,i[a++]=p>>>0&255,i[a++]=p>>>8&255,i[a++]=p>>>16&255,i[a++]=p>>>24&255,i[a++]=f>>>0&255,i[a++]=f>>>8&255,i[a++]=f>>>16&255,i[a++]=f>>>24&255}}function BP(e,t,i,r){let a=r,n=t;for(let s=0;s<128;s++){let o=e[n++]>>>0;i[a++]=o&65535,i[a++]=o>>>16&65535}}function OP(e,t,i,r,a){let n=Lc[a]>>>0,s=t,o=0,l=e[s]>>>0,u=r;for(let h=0;h<8;h++){for(let c=0;c<32;c++)if(o+a<=32){let d=l>>>o&n;i[u+c]=d|0,o+=a,o===32&&(o=0,s++,c!==31&&(l=e[s]>>>0))}else{let d=32-o,p=l>>>o;s++,l=e[s]>>>0;let f=a-d,m=-1>>>32-f>>>0,g=(p|(l&m)<<d)&n;i[u+c]=g|0,o=f}u+=32,o=0,h<7&&(l=e[s]>>>0)}}const Bc=mP(C1),$P=3*Bc/256+Bc|0;function P1(){let e=new Uint8Array($P);return{dataToBePacked:Array(33),dataPointers:new Int32Array(33),byteContainer:e,byteContainerI32:new Int32Array(e.buffer,e.byteOffset,e.byteLength>>>2),exceptionSizes:new Int32Array(33)}}function jP(e=16){if(e<0)throw RangeError(`initialEncodedWordCapacity must be >= 0, got ${e}`);let t=Math.max(16,e|0);return{encodedWords:new Uint32Array(t),decoderWorkspace:P1()}}function VP(e,t){if(t<=e.encodedWords.length)return e.encodedWords;let i=new Uint32Array(Math.max(16,t*2));return e.encodedWords=i,i}function NP(e,t,i,r){r.byteContainer.length<i&&(r.byteContainer=new Uint8Array(i*2),r.byteContainerI32=void 0);let a=r.byteContainer,n=i>>>2;if(a.byteOffset&3)for(let o=0;o<n;o=o+1|0){let l=e[t+o|0]|0,u=o<<2;a[u]=l&255,a[u+1|0]=l>>>8&255,a[u+2|0]=l>>>16&255,a[u+3|0]=l>>>24&255}else{let o=r.byteContainerI32;(!o||o.buffer!==a.buffer||o.byteOffset!==a.byteOffset||o.length<n)&&(o=r.byteContainerI32=new Int32Array(a.buffer,a.byteOffset,a.byteLength>>>2)),o.set(e.subarray(t,t+n))}let s=i&3;if(s>0){let o=e[t+n|0]|0,l=n<<2;for(let u=0;u<s;u=u+1|0)a[l+u|0]=o>>>(u<<3)&255}return a}function UP(e,t,i){let r=e[t++]|0,a=i.dataToBePacked;for(let n=2;n<=32;n=n+1|0){if(!(r>>>n-1&1))continue;if(t>=e.length)throw Error(`FastPFOR decode: truncated exception stream header (bitWidth=${n}, streamWordIndex=${t}, needWords=1, availableWords=${e.length-t}, encodedWords=${e.length})`);let s=e[t++]>>>0,o=fP(s),l=s*n+31>>>5;if(t+l>e.length)throw Error(`FastPFOR decode: truncated exception stream (bitWidth=${n}, size=${s}, streamWordIndex=${t}, needWords=${l}, availableWords=${e.length-t}, encodedWords=${e.length})`);let u=a[n];(!u||u.length<o)&&(u=a[n]=new Uint32Array(o));let h=0;for(;h<s;h=h+32|0)QP(e,t,u,h,n),t=t+n|0;let c=h-s|0;t=t-(c*n>>>5)|0,i.exceptionSizes[n]=s}return t}function GP(e,t,i,r,a){switch(a){case 1:AP(e,t,i,r);break;case 2:IP(e,t,i,r);break;case 3:MP(e,t,i,r);break;case 4:FP(e,t,i,r);break;case 5:zP(e,t,i,r);break;case 6:RP(e,t,i,r);break;case 7:kP(e,t,i,r);break;case 8:LP(e,t,i,r);break;case 16:BP(e,t,i,r);break;default:OP(e,t,i,r,a)}return t+(a<<3)|0}function ZP(e,t,i,r){if(i+2>t)throw Error(`FastPFOR decode: byteContainer underflow at block=${r} (need 2 bytes for [bitWidth, exceptionCount], bytePos=${i}, byteSize=${t})`);let a=e[i++],n=e[i++];if(a>32)throw Error(`FastPFOR decode: invalid bitWidth=${a} at block=${r} (expected 0..32). This likely indicates corrupted or truncated input.`);return{bitWidth:a,exceptionCount:n,bytePosIn:i}}function qP(e,t,i,r,a,n){if(i+1>t)throw Error(`FastPFOR decode: exception header underflow at block=${n} (need 1 byte for maxBits, bytePos=${i}, byteSize=${t})`);let s=e[i++];if(s<r||s>32)throw Error(`FastPFOR decode: invalid maxBits=${s} at block=${n} (bitWidth=${r}, expected ${r}..32)`);let o=s-r|0;if(o<1||o>32)throw Error(`FastPFOR decode: invalid exceptionBitWidth=${o} at block=${n} (bitWidth=${r}, maxBits=${s})`);if(i+a>t)throw Error(`FastPFOR decode: exception positions underflow at block=${n} (need=${a}, have=${t-i})`);return{maxBits:s,exceptionBitWidth:o,bytePosIn:i}}function WP(e,t,i,r,a,n,s,o,l){let{maxBits:u,exceptionBitWidth:h,bytePosIn:c}=qP(a,n,s,i,r,l);if(s=c,h===1){let g=1<<i;for(let _=0;_<r;_=_+1|0){let y=a[s++];e[y+t|0]|=g}return s}let d=o.dataToBePacked[h];if(!d)throw Error(`FastPFOR decode: missing exception stream for exceptionBitWidth=${h} (bitWidth=${i}, maxBits=${u}) at block ${l}`);let p=o.dataPointers,f=p[h]|0,m=o.exceptionSizes[h]|0;if(f+r>m)throw Error(`FastPFOR decode: exception stream overflow for exceptionBitWidth=${h} (ptr=${f}, need ${r}, size=${m}) at block ${l}`);for(let g=0;g<r;g=g+1|0){let _=a[s++],y=d[f++]|0;e[_+t|0]|=y<<i}return p[h]=f,s}function HP(e,t,i,r,a,n,s,o,l,u){let h=i|0,c=0;for(let d=0;d<s;d=d+1|0){let p=ZP(o,l,c,d);c=p.bytePosIn;let f=p.bitWidth,m=p.exceptionCount,g=n+d*256|0;switch(f){case 0:a.fill(0,g,g+256);break;case 32:for(let _=0;_<256;_=_+1|0)a[g+_|0]=e[h+_|0]|0;h=h+256|0;break;default:h=GP(e,h,a,g,f)}m>0&&(c=WP(a,g,f,m,o,l,c,u,d))}if(h!==r)throw Error(`FastPFOR decode: packed region mismatch (pageStart=${t}, packedStart=${i}, consumedPackedEnd=${h}, expectedPackedEnd=${r}, packedWords=${r-i}, encoded.length=${e.length})`)}function XP(e,t,i,r,a,n){let s=i|0,o=e[s]|0;if(o<=0||s+o>e.length-1)throw Error(`FastPFOR decode: invalid whereMeta=${o} at pageStart=${s} (expected > 0 and pageStart+whereMeta < encoded.length=${e.length})`);let l=s+1|0,u=s+o|0,h=e[u]>>>0,c=h+3>>>2,d=u+1,p=d+c;if(p>=e.length)throw Error(`FastPFOR decode: invalid byteSize=${h} (metaInts=${c}, pageStart=${s}, packedEnd=${u}
5, byteContainerStart=${d}) causes bitmapPos=${p} out of bounds (encoded.length=${e.length})`);let f=NP(e,d,h,n),m=h,g=UP(e,p,n);return n.dataPointers.fill(0),HP(e,s,l,u,t,r|0,a/256|0,f,m,n),g}function YP(e,t,i,r,a,n){let s=r+ip(a,256),o=r,l=i;for(;o!==s;){let u=Math.min(Bc,s-o);l=XP(e,t,l,o,u,n),o=o+u|0}return l}function KP(e,t,i,r,a,n){if(n===0)return t;let s=0,o=t,l=t+i,u=a,h=a,c=a+n,d=0,p=0;for(;o<l&&h<c;){let f=e[o]>>>s&255;if(s+=8,o+=s>>>5,s&=31,d|=(f&127)<<p,f&128)r[h++]=d|0,d=0,p=0;else if(p+=7,p>28)throw Error(`FastPFOR VByte: unterminated value (expected MSB=1 terminator within 5 bytes; shift=${p}, partial=${d}, decoded=${h-u}/${n}, inPos=${o}, inEnd=${l})`)}if(h!==c)throw Error(`FastPFOR VByte: truncated stream (decoded=${h-u}, expected=${n}, consumedWords=${o-t}/${i}, vbyteStart=${t}, vbyteEnd=${l})`);return o}function JP(e,t,i){let r=0,a=0,n=new Uint32Array(t),s=i??P1();if(e.length>0){let u=e[r]|0;if(r=r+1|0,u&255)throw Error(`FastPFOR decode: invalid alignedLength=${u} (expected multiple of 256)`);if(a+u>n.length)throw Error(`FastPFOR decode: output buffer too small (outPos=${a}, alignedLength=${u}, out.length=${n.length})`);r=YP(e,n,r,a,u,s),a=a+u|0}let o=e.length-r|0,l=t-a|0;return KP(e,r,o,n,a,l),n}function QP(e,t,i,r,a){switch(a){case 2:_P(e,t,i,r);return;case 3:yP(e,t,i,r);return;case 4:vP(e,t,i,r);return;case 5:xP(e,t,i,r);return;case 6:bP(e,t,i,r);return;case 7:wP(e,t,i,r);return;case 8:TP(e,t,i,r);return;case 9:EP(e,t,i,r);return;case 10:SP(e,t,i,r);return;case 11:DP(e,t,i,r);return;case 12:CP(e,t,i,r);return;case 16:PP(e,t,i,r);return;case 32:for(let u=0;u<32;u=u+1|0)i[r+u|0]=e[t+u|0]|0;return}let n=Lc[a]>>>0,s=t,o=0,l=e[s]>>>0;for(let u=0;u<32;u++)if(o+a<=32){let h=l>>>o&n;i[r+u]=h|0,o+=a,o===32&&(o=0,s++,u!==31&&(l=e[s]>>>0))}else{let h=32-o,c=l>>>o;s++,l=e[s]>>>0;let d=Lc[a-h]>>>0,p=(c|(l&d)<<h)&n;i[r+u]=p|0,o=a-h}}function eA(e,t,i,r){if(t<0||i<0||t+i>e.length)throw RangeError(`decodeBigEndianInt32sInto: out of bounds (offset=${t}, byteLength=${i}, bytes.length=${e.length})`);let a=Math.floor(i/4),n=i%4!=0,s=n?a+1:a;if(r.length<s)throw RangeError(`decodeBigEndianInt32sInto: out.length=${r.length} < ${s}`);if(a>0){let o=e.byteOffset+t;if(o&3)for(let l=0;l<a;l++){let u=t+l*4;r[l]=e[u]<<24|e[u+1]<<16|e[u+2]<<8|e[u+3]|0}else{let l=new Uint32Array(e.buffer,o,a);for(let u=0;u<a;u++)r[u]=gP(l[u])|0}}if(n){let o=t+a*4,l=i-a*4,u=0;for(let h=0;h<l;h++)u|=e[o+h]<<24-h*8;r[a]=u|0}return s}function Rt(e,t,i){let r=new Uint32Array(i),a=0,n=t.get();for(let s=0;s<r.length;s++){let o=e[n++],l=o&127;if(o<128){r[a++]=l;continue}if(o=e[n++],l|=(o&127)<<7,o<128){r[a++]=l;continue}if(o=e[n++],l|=(o&127)<<14,o<128){r[a++]=l;continue}if(o=e[n++],l|=(o&127)<<21,o<128){r[a++]=l;continue}o=e[n++],l|=(o&15)<<28,r[a++]=l}return t.set(n),r}function rp(e,t,i){let r=new BigUint64Array(i);for(let a=0;a<r.length;a++)r[a]=tA(e,t);return r}function tA(e,t){let i=0n,r=0,a=t.get();for(;a<e.length;){let n=e[a++];if(i|=BigInt(n&127)<<BigInt(r),!(n&128))break;if(r+=7,r>=64)throw Error("Varint too long")}return t.set(a),i}function iA(e,t,i){let r=new Float64Array(i);for(let a=0;a<i;a++)r[a]=rA(e,t);return r}function rA(e,t){let i,r;return r=e[t.get()],t.increment(),i=r&127,r<128||(r=e[t.get()],t.increment(),i|=(r&127)<<7,r<128)||(r=e[t.get()],t.increment(),i|=(r&127)<<14,r<128)||(r=e[t.get()],t.increment(),i|=(r&127)<<21,r<128)?i:(r=e[t.get()],i|=(r&15)<<28,aA(i,e,t))}function aA(e,t,i){let r,a;if(a=t[i.get()],i.increment(),r=(a&112)>>4,a<128||(a=t[i.get()],i.increment(),r|=(a&127)<<3,a<128)||(a=t[i.get()],i.increment(),r|=(a&127)<<10,a<128)||(a=t[i.get()],i.increment(),r|=(a&127)<<17,a<128)||(a=t[i.get()],i.increment(),r|=(a&127)<<24,a<128)||(a=t[i.get()],i.increment(),r|=(a&1)<<31,a<128))return r*4294967296+(e>>>0);throw Error("Expected varint not more than 10 bytes")}function nA(e,t,i,r){return sA(e,t,i,r,jP(i>>>2))}function sA(e,t,i,r,a){let n=r.get();if(i&3)throw Error(`FastPFOR: invalid encodedByteLength=${i} at offset=${n} (encodedBytes.length=${e.length}; expected a multiple of 4 bytes for an int32 big-endian word stream)`);let s=i>>>2,o=VP(a,s);eA(e,n,i,o);let l=JP(o.subarray(0,s),t,a.decoderWorkspace);return r.add(i),l}function Le(e){return e>>>1^-(e&1)}function Mt(e){return e>>1n^-(e&1n)}function Gr(e){return e%2==1?(e+1)/-2:e/2}function oA(e){let t=new Int32Array(e.length);for(let i=0;i<e.length;i++)t[i]=Le(e[i]);return t}function lA(e){let t=new BigInt64Array(e.length);for(let i=0;i<e.length;i++)t[i]=Mt(e[i]);return t}function Oc(e,t,i){if(i===void 0){i=0;for(let n=0;n<t;n++)i+=e[n]}let r=new Uint32Array(i),a=0;for(let n=0;n<t;n++){let s=e[n],o=e[n+t];r.fill(o,a,a+s),a+=s}return r}function $c(e,t,i){if(i===void 0){i=0;for(let n=0;n<t;n++)i+=Number(e[n])}let r=new BigUint64Array(i),a=0;for(let n=0;n<t;n++){let s=Number(e[n]),o=e[n+t];r.fill(o,a,a+s),a+=s}return r}function A1(e,t,i){let r=new Float64Array(i),a=0;for(let n=0;n<t;n++){let s=e[n],o=e[n+t];r.fill(o,a,a+s),a+=s}return r}function Wm(e){let t=new Int32Array(e.length);t[0]=Le(e[0]);let i=e.length/4*4,r=1;if(i>=4)for(;r<i-4;r+=4){let a=e[r],n=e[r+1],s=e[r+2],o=e[r+3];t[r]=Le(a)+t[r-1],t[r+1]=Le(n)+t[r],t[r+2]=Le(s)+t[r+1],t[r+3]=Le(o)+t[r+2]}for(;r!==e.length;++r)t[r]=Le(e[r])+t[r-1];return t}function Hm(e){let t=new BigInt64Array(e.length);
vendor: 42,929 bytes, line 5
5t[0]=Mt(e[0]);let i=e.length/4*4,r=1;if(i>=4)for(;r<i-4;r+=4){let a=e[r],n=e[r+1],s=e[r+2],o=e[r+3];t[r]=Mt(a)+t[r-1],t[r+1]=Mt(n)+t[r],t[r+2]=Mt(s)+t[r+1],t[r+3]=Mt(o)+t[r+2]}for(;r!==t.length;++r)t[r]=Mt(e[r])+t[r-1];return t}function uA(e){e[0]=Gr(e[0]);let t=e.length/4*4,i=1;if(t>=4)for(;i<t-4;i+=4){let r=e[i],a=e[i+1],n=e[i+2],s=e[i+3];e[i]=Gr(r)+e[i-1],e[i+1]=Gr(a)+e[i],e[i+2]=Gr(n)+e[i+1],e[i+3]=Gr(s)+e[i+2]}for(;i!==e.length;++i)e[i]=Gr(e[i])+e[i-1]}function hA(e,t,i){if(i===void 0){i=0;for(let n=0;n<t;n++)i+=e[n]}let r=new Int32Array(i),a=0;for(let n=0;n<t;n++){let s=e[n],o=e[n+t];o=Le(o),r.fill(o,a,a+s),a+=s}return r}function cA(e,t,i){if(i===void 0){i=0;for(let n=0;n<t;n++)i+=Number(e[n])}let r=new BigInt64Array(i),a=0;for(let n=0;n<t;n++){let s=Number(e[n]),o=e[n+t];o=Mt(o),r.fill(o,a,a+s),a+=s}return r}function dA(e,t,i){let r=new Float64Array(i),a=0;for(let n=0;n<t;n++){let s=e[n],o=e[n+t];o=Gr(o),r.fill(o,a,a+s),a+=s}return r}function ap(e){let t=e.length/4*4,i=1;if(t>=4)for(let r=e[0];i<t-4;i+=4)r=e[i]+=r,r=e[i+1]+=r,r=e[i+2]+=r,r=e[i+3]+=r;for(;i!==e.length;)e[i]+=e[i-1],++i}function pA(e){let t=0;for(let i=0;i<e.length;i++)e[i]+=t,t=e[i]}function fA(e){if(e.length<2)return new Int32Array(e);let t=new Int32Array(e.length);t[0]=Le(e[0]),t[1]=Le(e[1]);let i=e.length/4*4,r=2;if(i>=4)for(;r<i-4;r+=4){let a=e[r],n=e[r+1],s=e[r+2],o=e[r+3];t[r]=Le(a)+t[r-2],t[r+1]=Le(n)+t[r-1],t[r+2]=Le(s)+t[r],t[r+3]=Le(o)+t[r+1]}for(;r!==e.length;r+=2)t[r]=Le(e[r])+t[r-2],t[r+1]=Le(e[r+1])+t[r-1];return t}function mA(e){let t=new Int32Array(e.length+1);t[0]=0,t[1]=Le(e[0]);let i=t[1];for(let r=2;r!==t.length;++r){let a=e[r-1],n=Le(a);i+=n,t[r]=t[r-1]+i}return new Uint32Array(t)}function gA(e,t,i){let r=new Int32Array(i+1);r[0]=0;let a=1,n=r[0];for(let s=0;s<t;s++){let o=e[s],l=e[s+t];l=Le(l);for(let u=a;u<a+o;u++)r[u]=l+n,n=r[u];a+=o}return r}function _A(e,t,i){let r=new Uint32Array(i+1);r[0]=0;let a=1,n=r[0];for(let s=0;s<t;s++){let o=e[s],l=e[s+t];for(let u=a;u<a+o;u++)r[u]=l+n,n=r[u];a+=o}return r}function yA(e,t,i){let r=new Int32Array(i),a=0,n=0;for(let s=0;s<t;s++){let o=e[s],l=e[s+t],u=Le(l);for(let h=0;h<o;h++)n+=u,r[a++]=n}return r}function vA(e,t,i){let r=new BigInt64Array(i),a=0,n=0n;for(let s=0;s<t;s++){let o=Number(e[s]),l=e[s+t],u=Mt(l);for(let h=0;h<o;h++)n+=u,r[a++]=n}return r}function Xm(e){let t=new Uint32Array(e.length);t[0]=Le(e[0])>>>0;for(let i=1;i<e.length;i++)t[i]=t[i-1]+Le(e[i])>>>0;return t}function Ym(e){let t=new BigUint64Array(e.length);t[0]=BigInt.asUintN(64,Mt(e[0]));for(let i=1;i<e.length;i++)t[i]=BigInt.asUintN(64,t[i-1]+Mt(e[i]));return t}function xA(e){if(e.length<2)return new Uint32Array(e);let t=new Uint32Array(e.length);t[0]=Le(e[0])>>>0,t[1]=Le(e[1])>>>0;for(let i=2;i<e.length;i+=2)t[i]=t[i-2]+Le(e[i])>>>0,t[i+1]=t[i-1]+Le(e[i+1])>>>0;return t}function bA(e){return e[1]}function wA(e){return Le(e[1])}function TA(e){if(e.length===2){let t=Le(e[1]);return[t,t]}return[Le(e[2]),Le(e[3])]}function EA(e){return e[1]}function SA(e){return Mt(e[1])}function DA(e){if(e.length===2){let t=Mt(e[1]);return[t,t]}return[Mt(e[2]),Mt(e[3])]}var pt;(function(e){e.PRESENT="PRESENT",e.DATA="DATA",e.OFFSET="OFFSET",e.LENGTH="LENGTH"})(pt||(pt={}));var Ut;(function(e){e.NONE="NONE",e.SINGLE="SINGLE",e.SHARED="SHARED",e.VERTEX="VERTEX",e.MORTON="MORTON",e.FSST="FSST"})(Ut||(Ut={}));var cr;(function(e){e.VERTEX="VERTEX",e.INDEX="INDEX",e.STRING="STRING",e.KEY="KEY"})(cr||(cr={}));var xt;(function(e){e.VAR_BINARY="VAR_BINARY",e.GEOMETRIES="GEOMETRIES",e.PARTS="PARTS",e.RINGS="RINGS",e.TRIANGLES="TRIANGLES",e.SYMBOL="SYMBOL",e.DICTIONARY="DICTIONARY"})(xt||(xt={}));const CA=[pt.PRESENT,pt.DATA,pt.OFFSET,pt.LENGTH],Km=[ge.NONE,ge.DELTA,ge.COMPONENTWISE_DELTA,ge.RLE,ge.MORTON],PA=[Si.NONE,Si.FAST_PFOR,Si.VARINT],AA=[Ut.NONE,Ut.SINGLE,Ut.SHARED,Ut.VERTEX,Ut.MORTON,Ut.FSST],IA=[cr.VERTEX,cr.INDEX,cr.STRING,cr.KEY],MA=[xt.VAR_BINARY,xt.GEOMETRIES,xt.PARTS,xt.RINGS,xt.TRIANGLES,xt.SYMBOL,xt.DICTIONARY];function Qe(e,t){let i=RA(e,t);return i.logicalLevelTechnique1===ge.MORTON?FA(i,e,t):(ge.RLE===i.logicalLevelTechnique1||ge.RLE===i.logicalLevelTechnique2)&&Si.NONE!==i.physicalLevelTechnique?zA(i,e,t):i}function FA(e,t,i){let r=Rt(t,i,2);return{physicalStreamType:e.physicalStreamType,logicalStreamType:e.logicalStreamType,logicalLevelTechnique1:e.logicalLevelTechnique1,logicalLevelTechnique2:e.logicalLevelTechnique2,physicalLevelTechnique:e.physicalLevelTechnique,numValues:e.numValues,byteLength:e.byteLength,decompressedCount:e.decompressedCount,numBits:r[0],coordinateShift:r[1]}}function zA(e,t,i){let r=Rt(t,i,2);return{physicalStreamType:e.physicalStreamType,logicalStreamType:e.logicalStreamType,logicalLevelTechnique1:e.logicalLevelTechnique1,logicalLevelTechnique2:e.logicalLevelTechnique2,physicalLevelTechnique:e.physicalLevelTechnique,numValues:e.numValues,byteLength:e.byteLength,decompressedCount:r[1],runs:r[0],numRleValues:r[1]}}function RA(e,t){let i=e[t.get()],r=CA[i>>4],a={};switch(r){case pt.DATA:a={dictionaryType:AA[i&15]};break;case pt.OFFSET:a={offsetType:IA[i&15]};break;case pt.LENGTH:a={lengthType:MA[i&15]}}t.increment();let n=e[t.get()],s=Km[n>>5],o=Km[n>>2&7],l=PA[n&3];t.increment();let u=Rt(e,t,2),h=u[0],c=u[1];return{physicalStreamType:r,logicalStreamType:a,logicalLevelTechnique1:s,logicalLevelTechnique2:o,physicalLevelTechnique:l,numValues:h,byteLength:c,decompressedCount:h}}var We;(function(e){e[e.FLAT=0]="FLAT",e[e.CONST=1]="CONST",e[e.SEQUENCE=2]="SEQUENCE",e[e.DICTIONARY=3]="DICTIONARY",e[e.FSST_DICTIONARY=4]="FSST_DICTIONARY"})(We||(We={}));var Ri=class{constructor(e,t){this.values=e,this._size=t}get(e){let t=Math.floor(e/8),i=e%8;return(this.values[t]>>i&1)==1}set(e,t){let i=Math.floor(e/8),r=e%8;this.values[i]=this.values[i]|+!!t<<r}getInt(e){let t=Math.floor(e/8),i=e%8;return this.values[t]>>i&1}size(){return this._size}getBuffer(){return this.values}};function ga(e,t,i){if(!t)return e;let r=t.size(),a=e.constructor,n=new a(r),s=0;for(let o=0;o<r;o++)n[o]=t.get(o)?e[s++]:i;return n}function kA(e,t,i){if(!i)return e;let r=i.size(),a=new Ri(e,t),n=new Ri(new Uint8Array(Math.ceil(r/8)),r),s=0;for(let o=0;o<r;o++){let l=i.get(o)?a.get(s++):!1;n.set(o,l)}return n.getBuffer()}function hn(e,t,i,r,a){let n=LA(e,Math.ceil(t/8),i,r);return a?kA(n,t,a):n}function LA(e,t,i,r){let a=new Uint8Array(t),n=0,s=r.get()+i;for(;n<t&&!(r.get()>=s);){let o=e[r.increment()];if(o<=127){let l=o+3,u=e[r.increment()],h=Math.min(n+l,t);a.fill(u,n,h),n=h}else{let l=256-o;for(let u=0;u<l&&n<t;u++)a[n++]=e[r.increment()]}}return r.set(s),a}function I1(e,t,i,r){let a=t.get(),n=a+i*Float32Array.BYTES_PER_ELEMENT,s=new Uint8Array(e.subarray(a,n)).buffer,o=new Float32Array(s);return t.set(n),r?ga(o,r,0):o}function M1(e,t,i,r){let a=t.get(),n=a+i*Float64Array.BYTES_PER_ELEMENT,s=new Uint8Array(e.subarray(a,n)).buffer,o=new Float64Array(s);return t.set(n),r?ga(o,r,0):o}function BA(e,t,i){let r=t.get(),a=i*Uint32Array.BYTES_PER_ELEMENT,n=new DataView(e.buffer,e.byteOffset,e.byteLength),s=new Uint32Array(i);for(let o=0;o<i;o++)s[o]=n.getUint32(r+o*Uint32Array.BYTES_PER_ELEMENT,!0);return t.add(a),s}function OA(e,t,i){let r=t.get(),a=i*BigUint64Array.BYTES_PER_ELEMENT,n=new DataView(e.buffer,e.byteOffset,e.byteLength),s=new BigUint64Array(i);for(let o=0;o<i;o++)s[o]=n.getBigUint64(r+o*BigUint64Array.BYTES_PER_ELEMENT,!0);return t.add(a),s}const $A=new TextDecoder;function np(e,t,i){return i-t>=12?$A.decode(e.subarray(t,i)):jA(e,t,i)}function jA(e,t,i){let r="",a=t;for(;a<i;){let n=e[a],s=null,o=n>239?4:n>223?3:n>191?2:1;if(a+o>i)break;let l,u,h;o===1?n<128&&(s=n):o===2?(l=e[a+1],(l&192)==128&&(s=(n&31)<<6|l&63,s<=127&&(s=null))):o===3?(l=e[a+1],u=e[a+2],(l&192)==128&&(u&192)==128&&(s=(n&15)<<12|(l&63)<<6|u&63,(s<=2047||s>=55296&&s<=57343)&&(s=null))):o===4&&(l=e[a+1],u=e[a+2],h=e[a+3],(l&192)==128&&(u&192)==128&&(h&192)==128&&(s=(n&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,r+=String.fromCharCode(s>>>10&1023|55296),s=56320|s&1023),r+=String.fromCharCode(s),a+=o}return r}function xl(e,t,i,r,a){return ZA(cn(e,t,i),i,r,a)}function Ct(e,t,i,r,a){return qA(cn(e,t,i),i,r,a)}function Sr(e,t,i){return XA(cn(e,t,i),i)}function cn(e,t,i){let r=i.physicalLevelTechnique;switch(r){case Si.FAST_PFOR:return nA(e,i.numValues,i.byteLength,t);case Si.VARINT:return Rt(e,t,i.numValues);case Si.NONE:return BA(e,t,i.numValues);default:throw Error(`Specified physicalLevelTechnique ${r} is not supported (yet).`)}}function zs(e,t,i){let r=i.physicalLevelTechnique;switch(r){case Si.VARINT:return rp(e,t,i.numValues);case Si.NONE:return OA(e,t,i.numValues);default:throw Error(`Specified physicalLevelTechnique ${r} is not supported (yet).`)}}function VA(e,t,i){let r=cn(e,t,i);return r.length===1?Le(r[0]):wA(r)}function sp(e,t,i){let r=cn(e,t,i);return r.length===1?i.logicalLevelTechnique1===ge.DELTA?Le(r[0]):r[0]:bA(r)}function F1(e,t,i){return TA(cn(e,t,i))}function z1(e,t,i){return DA(rp(e,t,i.numValues))}function R1(e,t,i,r){return WA(zs(e,t,i),i,r)}function op(e,t,i,r){return L1(zs(e,t,i),i,r)}function NA(e,t,i,r){let a=UA(e,t,i,!1);return r?ga(a,r,0):a}function UA(e,t,i,r){if(i.physicalLevelTechnique===Si.VARINT)return HA(iA(e,t,i.numValues),i,r);let a=zs(e,t,i),n=L1(a,i);return Float64Array.from(n,Number)}function GA(e,t,i){let r=zs(e,t,i);return r.length===1?Mt(r[0]):SA(r)}function k1(e,t,i){let r=zs(e,t,i);return r.length===1?i.logicalLevelTechnique1===ge.DELTA?Mt(r[0]):r[0]:EA(r)}function ZA(e,t,i,r){let a;switch(t.logicalLevelTechnique1){case ge.DELTA:if(t.logicalLevelTechnique2===ge.RLE){let n=t;if(!r)return yA(e,n.runs,n.numRleValues);e=Oc(e,n.runs,n.numRleValues),a=Wm(e)}else a=Wm(e);break;case ge.RLE:a=hA(e,t.runs,t.numRleValues);break;case ge.MORTON:ap(e),a=new Int32Array(e);break;case ge.COMPONENTWISE_DELTA:a=fA(e);break;case ge.NONE:a=oA(e);break;default:throw Error(`The specified Logical level technique is not supported: ${t.logicalLevelTechnique1}`)}return r?ga(a,r,0):a}function qA(e,t,i,r){let a;switch(t.logicalLevelTechnique1){case ge.DELTA:if(t.logicalLevelTechnique2===ge.RLE){let n=t;a=Xm(Oc(e,n.runs,n.numRleValues))}else a=Xm(e);break;case ge.RLE:a=Oc(e,t.runs,t.numRleValues);break;case ge.MORTON:ap(e),a=e;break;case ge.COMPONENTWISE_DELTA:a=xA(e);break;case ge.NONE:a=e;break;default:throw Error(`The specified Logical level technique is not supported: ${t.logicalLevelTechnique1}`)}return r?ga(a,r,0):a}function WA(e,t,i){let r;switch(t.logicalLevelTechnique1){case ge.DELTA:if(t.logicalLevelTechnique2===ge.RLE){let a=t;if(!i)return vA(e,a.runs,a.numRleValues);e=$c(e,a.runs,a.numRleValues),r=Hm(e)}else r=Hm(e);break;case ge.RLE:r=cA(e,t.runs,t.numRleValues);break;case ge.NONE:r=lA(e);break;default:throw Error(`The specified Logical level technique is not supported: ${t.logicalLevelTechnique1}`)}return i?ga(r,i,0n):r}function L1(e,t,i){let r;switch(t.logicalLevelTechnique1){case ge.DELTA:if(t.logicalLevelTechnique2===ge.RLE){let a=t;r=Ym($c(e,a.runs,a.numRleValues))}else r=Ym(e);break;case ge.RLE:r=$c(e,t.runs,t.numRleValues);break;case ge.NONE:r=e;break;default:throw Error(`The specified Logical level technique is not supported: ${t.logicalLevelTechnique1}`)}return i?ga(r,i,0n):r}function HA(e,t,i){switch(t.logicalLevelTechnique1){case ge.DELTA:if(t.logicalLevelTechnique2===ge.RLE){let r=t;e=A1(e,r.runs,r.numRleValues)}return uA(e),e;case ge.RLE:return KA(e,t,i);case ge.NONE:return e;default:throw Error(`The specified Logical level technique is not supported: ${t.logicalLevelTechnique1}`)}}function XA(e,t){if(t.logicalLevelTechnique1===ge.DELTA&&t.logicalLevelTechnique2===ge.NONE)return mA(e);if(t.logicalLevelTechnique1===ge.RLE&&t.logicalLevelTechnique2===ge.NONE){let i=t;return _A(e,i.runs,i.numRleValues)}if(t.logicalLevelTechnique1===ge.NONE&&t.logicalLevelTechnique2===ge.NONE){pA(e);let i=new Uint32Array(t.numValues+1);return i[0]=0,i.set(e,1),i}if(t.logicalLevelTechnique1===ge.DELTA&&t.logicalLevelTechnique2===ge.RLE){let i=t,r=gA(e,i.runs,i.numRleValues);return ap(r),new Uint32Array(r)}throw Error("Only delta encoding is supported for transforming length to offset streams yet.")}function iu(e,t,i,r,a="int32"){let n=e.logicalLevelTechnique1;if(n===ge.RLE)return e.runs===1?We.CONST:We.FLAT;if(n!==ge.DELTA||e.logicalLevelTechnique2!==ge.RLE)return e.numValues===1?We.CONST:We.FLAT;let s=t instanceof Ri?t.size():t,o=e;if(o.numRleValues!==s)return We.FLAT;if(o.runs===1)return We.SEQUENCE;if(o.runs!==2)return e.numValues===1?We.CONST:We.FLAT;let l=r.get();if(e.physicalLevelTechnique===Si.VARINT)return YA(i,r,a)?We.SEQUENCE:e.numValues===1?We.CONST:We.FLAT;let u=r.get(),h=new Int32Array(i.buffer,i.byteOffset+u,4);return r.set(l),h[2]===2&&h[3]===2?We.SEQUENCE:e.numValues===1?We.CONST:We.FLAT}function YA(e,t,i){let r=new D1(t.get());if(i==="int64"){let n=rp(e,r,4);return n[2]===2n&&n[3]===2n}let a=Rt(e,r,4);return a[2]===2&&a[3]===2}function KA(e,t,i){return i?dA(e,t.runs,t.numRleValues):A1(e,t.runs,t.numRleValues)}var B1=class extends tu{getValueFromBuffer(e){return this.dataBuffer[e]}},O1=class extends E1{constructor(e,t,i,r,a){super(e,a?BigInt64Array.of(t):BigUint64Array.of(t),i,r)}getValueFromBuffer(e){return this.dataBuffer[0]+BigInt(e)*this.delta}};function lp(e,t,i){return{x:Jm(e,t)-i,y:Jm(e>>1,t)-i}}function Jm(e,t){let i=0;for(let r=0;r<t;r++)i|=(e&1<<2*r)>>r;return i}var Ft;(function(e){e[e.POINT=0]="POINT",e[e.LINESTRING=1]="LINESTRING",e[e.POLYGON=2]="POLYGON",e[e.MULTIPOINT=3]="MULTIPOINT",e[e.MULTILINESTRING=4]="MULTILINESTRING",e[e.MULTIPOLYGON=5]="MULTIPOLYGON"})(Ft||(Ft={}));var JA;(function(e){e[e.POINT=0]="POINT",e[e.LINESTRING=1]="LINESTRING",e[e.POLYGON=2]="POLYGON"})(JA||(JA={}));var _a;(function(e){e[e.MORTON=0]="MORTON",e[e.VEC_2=1]="VEC_2",e[e.VEC_3=2]="VEC_3"})(_a||(_a={}));function QA(e){let t=Array(e.numGeometries),i=1,r=1,a=1,n=0,s=0,o=0,l=e.mortonSettings,u=e.topologyVector,h=u.geometryOffsets,c=u.partOffsets,d=u.ringOffsets,p=e.vertexOffsets,f=!p||p.length===0,m=e.containsPolygonGeometry(),g=e.vertexBuffer;for(let _=0;_<e.numGeometries;_++){let y=e.geometryType(_);switch(y){case Ft.POINT:{let x,v;if(f)x=g[s++],v=g[s++];else if(e.vertexBufferType===_a.MORTON){let w=g[p[o++]],b=lp(w,l.numBits,l.coordinateShift);x=b.x,v=b.y}else{let w=p[o++]*2;x=g[w],v=g[w+1]}t[n++]=[[new A(x,v)]],h&&a++,c&&i++,d&&r++}break;case Ft.MULTIPOINT:{let x=h[a]-h[a-1];a++;let v;if(f){v=Array(x);for(let w=0;w<x;w++){let b=g[s++],T=g[s++];v[w]=new A(b,T)}}else v=Vr(e.vertexBufferType,g,p,o,x,!1,l),o+=x;t[n++]=v.map(w=>[w]),i+=x,r+=x}break;case Ft.LINESTRING:{let x;m?(x=d[r]-d[r-1],r++):x=c[i]-c[i-1],i++;let v;f?(v=Pa(g,s,x,!1),s+=x*2):(v=Vr(e.vertexBufferType,g,p,o,x,!1,l),o+=x),t[n++]=[v],h&&a++}break;case Ft.POLYGON:{let x=c[i]-c[i-1];i++;let v=Array(x-1),w,b=d[r]-d[r-1];if(r++,f){w=Pa(g,s,b,!0),s+=b*2;for(let T=0;T<v.length;T++)b=d[r]-d[r-1],r++,v[T]=Pa(g,s,b,!0),s+=b*2}else{w=Vr(e.vertexBufferType,g,p,o,b,!0,l),o+=b;for(let T=0;T<v.length;T++)b=d[r]-d[r-1],r++,v[T]=Vr(e.vertexBufferType,g,p,o,b,!0,l),o+=b}t[n++]=[w].concat(v),h&&a++}break;case Ft.MULTILINESTRING:{let x=h[a]-h[a-1];a++;let v=Array(x);for(let w=0;w<x;w++){let b;if(m?(b=d[r]-d[r-1],r++):b=c[i]-c[i-1],i++,f)v[w]=Pa(g,s,b,!1),s+=b*2;else{let T=Vr(e.vertexBufferType,g,p,o,b,!1,l);v[w]=T,o+=b}}t[n++]=v}break;case Ft.MULTIPOLYGON:{let x=h[a]-h[a-1];a++;let v=Array(x);for(let w=0;w<x;w++){let b=c[i]-c[i-1];i++;let T,P=Array(b-1),S=d[r]-d[r-1];r++,f?(T=Pa(g,s,S,!0),s+=S*2):(T=Vr(e.vertexBufferType,g,p,o,S,!0,l),o+=S);for(let M=0;M<P.length;M++){let k=d[r]-d[r-1];r++,f?(P[M]=Pa(g,s,k,!0),s+=k*2):(P[M]=Vr(e.vertexBufferType,g,p,o,k,!0,l),o+=k)}v[w]=[T].concat(P)}t[n++]=v.flat()}break;default:throw Error(`The specified geometry type (${y}) is currently not supported.`)}}return t}function Vr(e,t,i,r,a,n,s){return e===_a.MORTON?tI(t,i,r,a,n,s):eI(t,i,r,a,n)}function Pa(e,t,i,r){let a=Array(r?i+1:i);for(let n=0;n<i*2;n+=2){let s=e[t+n],o=e[t+n+1];a[n/2]=new A(s,o)}return r&&(a[a.length-1]=a[0]),a}function eI(e,t,i,r,a){let n=Array(a?r+1:r);for(let s=0;s<r*2;s+=2){let o=t[i+s/2]*2,l=e[o],u=e[o+1];n[s/2]=new A(l,u)}return a&&(n[n.length-1]=n[0]),n}function tI(e,t,i,r,a,n){let s=Array(a?r+1:r);for(let o=0;o<r;o++){let l=e[t[i+o]],u=lp(l,n.numBits,n.coordinateShift);s[o]=new A(u.x,u.y)}return a&&(s[s.length-1]=s[0]),s}var $1=class{constructor(e,t,i,r,a){this._vertexBufferType=e,this._topologyVector=t,this._vertexOffsets=i,this._vertexBuffer=r,this._mortonSettings=a}get vertexBufferType(){return this._vertexBufferType}get topologyVector(){return this._topologyVector}get vertexOffsets(){return this._vertexOffsets}get vertexBuffer(){return this._vertexBuffer}getSimpleEncodedVertex(e){let t=this.vertexOffsets?this.vertexOffsets[e]*2:e*2;return[this.vertexBuffer[t],this.vertexBuffer[t+1]]}getVertex(e){if(this.vertexOffsets&&this.mortonSettings){let i=this.vertexOffsets[e],r=this.vertexBuffer[i],a=lp(r,this.mortonSettings.numBits,this.mortonSettings.coordinateShift);return[a.x,a.y]}let t=this.vertexOffsets?this.vertexOffsets[e]*2:e*2;return[this.vertexBuffer[t],this.vertexBuffer[t+1]]}getGeometries(){return QA(this)}get mortonSettings(){return this._mortonSettings}};function iI(e,t,i,r,a){return new j1(e,t,_a.VEC_2,i,r,a)}function rI(e,t,i,r,a,n){return new j1(e,t,_a.MORTON,i,r,a,n)}var j1=class extends $1{constructor(e,t,i,r,a,n,s){super(i,r,a,n,s),this._numGeometries=e,this._geometryType=t}geometryType(e){return this._geometryType}get numGeometries(){return this._numGeometries}containsPolygonGeometry(){return this._geometryType===Ft.POLYGON||this._geometryType===Ft.MULTIPOLYGON}containsSingleGeometryType(){return!0}};function V1(e,t,i,r){return new N1(_a.VEC_2,e,t,i,r)}function aI(e,t,i,r,a){return new N1(_a.MORTON,e,t,i,r,a)}var N1=class extends $1{constructor(e,t,i,r,a,n){super(e,i,r,a,n),this._geometryTypes=t}geometryType(e){return this._geometryTypes[e]}get numGeometries(){return this._geometryTypes.length}containsPolygonGeometry(){for(let e=0;e<this.numGeometries;e++)if(this.geometryType(e)===Ft.POLYGON||this.geometryType(e)===Ft.MULTIPOLYGON)return!0;return!1}containsSingleGeometryType(){return!1}},U1=class{constructor(e,t,i,r){this._triangleOffsets=e,this._indexBuffer=t,this._vertexBuffer=i,this._topologyVector=r}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 e=new Uint32Array(this.numGeometries);for(let t=0;t<this.numGeometries;t++)e[t]=this.geometryType(t);return V1(e,this._topologyVector,void 0,this._vertexBuffer).getGeometries()}[Symbol.iterator](){return null}};function Qm(e,t,i,r,a,n){return new nI(e,t,i,r,a,n)}var nI=class extends U1{constructor(e,t,i,r,a,n){super(i,r,a,n),this._numGeometries=e,this._geometryType=t}geometryType(e){return this._geometryType}get numGeometries(){return this._numGeometries}containsSingleGeometryType(){return!0}};function eg(e,t,i,r,a){return new sI(e,t,i,r,a)}var sI=class extends U1{constructor(e,t,i,r,a){super(t,i,r,a),this._geometryTypes=e}geometryType(e){return this._geometryTypes[e]}get numGeometries(){return this._geometryTypes.length}containsSingleGeometryType(){return!1}};function oI(e,t,i,r,a){let n=Qe(e,i),s=iu(n,r,e,i),o,l,u,h;if(s===We.CONST){let x=sp(e,i,n),v,w,b,T;for(let P=0;P<t-1;P++){let S=Qe(e,i);switch(S.physicalStreamType){case pt.LENGTH:switch(S.logicalStreamType.lengthType){case xt.GEOMETRIES:v=Sr(e,i,S);break;case xt.PARTS:w=Sr(e,i,S);break;case xt.RINGS:b=Sr(e,i,S);break;case xt.TRIANGLES:T=Sr(e,i,S)}break;case pt.OFFSET:switch(S.logicalStreamType.offsetType){case cr.VERTEX:o=Ct(e,i,S);break;case cr.INDEX:h=Ct(e,i,S)}break;case pt.DATA:if(Ut.VERTEX===S.logicalStreamType.dictionaryType)l=xl(e,i,S,a);else{let M=S;u={numBits:M.numBits,coordinateShift:M.coordinateShift},l=Ct(e,i,S,a)}}}return h?v!==void 0||w!==void 0?Qm(r,x,T,h,l,{geometryOffsets:v,partOffsets:w,ringOffsets:b}):Qm(r,x,T,h,l):u===void 0?iI(r,x,{geometryOffsets:v,partOffsets:w,ringOffsets:b},o,l):rI(r,x,{geometryOffsets:v,partOffsets:w,ringOffsets:b},o,l,u)}let c=Ct(e,i,n),d,p,f,m;for(let x=0;x<t-1;x++){let v=Qe(e,i);switch(v.physicalStreamType){case pt.LENGTH:switch(v.logicalStreamType.lengthType){case xt.GEOMETRIES:d=Ct(e,i,v);break;case xt.PARTS:p=Ct(e,i,v);break;case xt.RINGS:f=Ct(e,i,v);break;case xt.TRIANGLES:m=Sr(e,i,v)}break;case pt.OFFSET:switch(v.logicalStreamType.offsetType){case cr.VERTEX:o=Ct(e,i,v);break;case cr.INDEX:h=Ct(e,i,v)}break;case pt.DATA:if(Ut.VERTEX===v.logicalStreamType.dictionaryType)l=xl(e,i,v,a);else{let w=v;u={numBits:w.numBits,coordinateShift:w.coordinateShift},l=Ct(e,i,v,a)}}}let g,_,y;return d?(g=th(c,d,2),p&&f?(_=tg(c,g,p,!1),y=uI(c,g,_,f)):p&&(_=lI(c,g,p))):p&&f?(_=th(c,p,1),y=tg(c,_,f,!0)):p&&(_=th(c,p,0)),h&&!_?eg(c,m,h,l):h?eg(c,m,h,l,{geometryOffsets:g,partOffsets:_,ringOffsets:y}):u===void 0?V1(c,{geometryOffsets:g,partOffsets:_,ringOffsets:y},o,l):aI(c,{geometryOffsets:g,partOffsets:_,ringOffsets:y},o,l,u)}function th(e,t,i){let r=new Uint32Array(e.length+1),a=0;r[0]=a;let n=0;for(let s=0;s<e.length;s++)a=r[s+1]=a+(e[s]>i?t[n++]:1);return r}function tg(e,t,i,r){let a=new Uint32Array(t[t.length-1]+1),n=0;a[0]=n;let s=1,o=0;for(let l=0;l<e.length;l++){let u=e[l],h=t[l+1]-t[l];if(u===5||u===2||r&&(u===4||u===1))for(let c=0;c<h;c++)n=a[s++]=n+i[o++];else for(let c=0;c<h;c++)a[s++]=++n}return a}function lI(e,t,i){let r=new Uint32Array(t[t.length-1]+1),a=0;r[0]=a;let n=1,s=0;for(let o=0;o<e.length;o++){let l=e[o],u=t[o+1]-t[o];if(l===4||l===1)for(let h=0;h<u;h++)a=r[n++]=a+i[s++];else for(let h=0;h<u;h++)r[n++]=++a}return r}function uI(e,t,i,r){let a=new Uint32Array(i[i.length-1]+1),n=0;a[0]=n;let s=1,o=1,l=0;for(let u=0;u<e.length;u++){let h=e[u],c=t[u+1]-t[u];if(h!==0&&h!==3)for(let d=0;d<c;d++){let p=i[s]-i[s-1];s++;for(let f=0;f<p;f++)n=a[o++]=n+r[l++]}else for(let d=0;d<c;d++)a[o++]=++n,s++}return a}var hI=class extends ma{constructor(e,t,i){super(e,t.getBuffer(),i),this.dataVector=t}getValueFromBuffer(e){return this.dataVector.get(e)}},cI=class extends tu{getValueFromBuffer(e){return this.dataBuffer[e]}},G1=class extends ma{constructor(e,t,i,r){super(e,r?BigInt64Array.of(t):BigUint64Array.of(t),i)}getValueFromBuffer(e){return this.dataBuffer[0]}},up=class extends ma{constructor(e,t,i,r){super(e,i,r),this.offsetBuffer=t}},ig=class extends up{constructor(e,t,i,r){super(e,t,i,r??t.length-1)}getValueFromBuffer(e){let t=this.offsetBuffer[e],i=this.offsetBuffer[e+1];return np(this.dataBuffer,t,i)}},Za=class extends up{constructor(e,t,i,r,a){super(e,i,r,a??t.length),this.indexBuffer=t,this.indexBuffer=t}getValueFromBuffer(e){let t=this.indexBuffer[e],i=this.offsetBuffer[t],r=this.offsetBuffer[t+1];return np(this.dataBuffer,i,r)}};function dI(e,t){let i=0;for(let r=0;r<t.length;r++){let a=t[r];a===255?(i++,r++):i+=e[a]}return i}function pI(e,t,i){let r=new Uint32Array(t.length);for(let s=1;s<t.length;s++)r[s]=r[s-1]+t[s-1];let a=new Uint8Array(dI(t,i)),n=0;for(let s=0;s<i.length;s++){let o=i[s];if(o===255)s++,a[n++]=i[s];else{let l=t[o],u=r[o];for(;l-- >0;)a[n++]=e[u++]}}return a}var Z1=class extends up{constructor(e,t,i,r,a,n,s,o){super(e,i,r,s??t.length),this.indexBuffer=t,this.symbolOffsetBuffer=a,this.symbolTableBuffer=n,this.sharedDictionaryCache=o}getValueFromBuffer(e){var a;this.decodedDictionary??(this.decodedDictionary=(a=this.sharedDictionaryCache)==null?void 0:a.decodedDictionary,this.decodedDictionary??(this.decodedDictionary=this.decodeDictionary(),this.sharedDictionaryCache&&(this.sharedDictionaryCache.decodedDictionary=this.decodedDictionary)));let t=this.indexBuffer[e],i=this.offsetBuffer[t],r=this.offsetBuffer[t+1];return np(this.decodedDictionary,i,r)}decodeDictionary(){return this.symbolLengthBuffer??(this.symbolLengthBuffer=this.offsetToLengthBuffer(this.symbolOffsetBuffer)),pI(this.symbolTableBuffer,this.symbolLengthBuffer,this.dataBuffer)}offsetToLengthBuffer(e){let t=new Uint32Array(e.length-1),i=e[0];for(let r=1;r<e.length;r++){let a=e[r];t[r-1]=a-i,i=a}return t}};function q1(e,t,i,r,a){let n,s,o,l,u,h=a,c,d;for(let p=0;p<r;p++){let f=Qe(t,i);switch(f.physicalStreamType){case pt.PRESENT:{let m=new Ri(hn(t,f.numValues,f.byteLength,i),f.numValues);h=a??m;break}case pt.OFFSET:s=Ct(t,i,f,void 0,h);break;case pt.LENGTH:{let m=Sr(t,i,f);xt.DICTIONARY===f.logicalStreamType.lengthType?n=m:xt.SYMBOL===f.logicalStreamType.lengthType?l=m:c=m;break}case pt.DATA:{let m=t.subarray(i.get(),i.get()+f.byteLength);i.add(f.byteLength);let g=f.logicalStreamType.dictionaryType;Ut.FSST===g?u=m:Ut.SINGLE===g||Ut.SHARED===g?o=m:Ut.NONE===g&&(d=m);break}}}return fI(e,u,s,n,o,l,h)??mI(e,o,s,n,h)??gI(e,c,d,s,h)}function fI(e,t,i,r,a,n,s){if(t){if(!i||!r||!a||!n)throw Error(`Incomplete FSST dictionary string column "${e}"`);return new Z1(e,i,r,a,n,t,s)}}function mI(e,t,i,r,a){if(t){if(!i||!r)throw Error(`Incomplete dictionary string column "${e}"`);return a?new Za(e,i,r,t,a):new Za(e,i,r,t)}}function gI(e,t,i,r,a){if(t&&i){if(r)return a?new Za(e,r,t,i,a):new Za(e,r,t,i);if(a&&a.size()!==t.length-1){let n=new Uint32Array(a.size()),s=0;for(let o=0;o<a.size();o++)a.get(o)?n[o]=s++:n[o]=0;return new Za(e,n,t,i,a)}return a?new ig(e,t,i,a):new ig(e,t,i)}}function _I(e,t,i,r){let a,n,s,o,l=!1;for(;!l;){let p=Qe(e,t);switch(p.physicalStreamType){case pt.LENGTH:xt.DICTIONARY===p.logicalStreamType.lengthType?a=Sr(e,t,p):s=Sr(e,t,p);break;case pt.DATA:Ut.SINGLE===p.logicalStreamType.dictionaryType||Ut.SHARED===p.logicalStreamType.dictionaryType?(n=e.subarray(t.get(),t.get()+p.byteLength),l=!0):o=e.subarray(t.get(),t.get()+p.byteLength),t.add(p.byteLength)}}if(i.type!=="complexType")throw Error(`Shared dictionary column ${i.name} must be a complex (struct) column.`);if(!a||!n)throw Error(`Incomplete shared dictionary for column "${i.name}"`);let u=i.complexType.children,h=[],c=o?{}:void 0,d=0;for(let p of u){let f=Rt(e,t,1)[0];if(f===0)continue;let m=p.name?`${i.name}${p.name}`:i.name;if(p.type!=="scalarField"||p.scalarField.physicalType!==De.STRING)throw Error("Currently only scalar string fields are implemented for a struct.");if(f>1&&!p.nullable||f===1&&p.nullable)throw Error(`The number of streams for the child field ${p.name} does not match its nullability. nullibilty: ${p.nullable}, numStreams: ${f}`);let g;if(p.nullable){let y=Qe(e,t);g=new Ri(hn(e,y.numValues,y.byteLength,t),y.numValues)}let _=Ct(e,t,Qe(e,t),void 0,g);if(o){if(!s)throw Error(`Incomplete shared FSST dictionary for column "${m}"`);h[d++]=new Z1(m,_,a,n,s,o,g,c)}else h[d++]=new Za(m,_,a,n,g)}return h}var rg=class extends ma{constructor(e,t,i){super(e,new Uint8Array,i??t.length),this.values=t}getValueFromBuffer(e){return this.values[e]}},dr;(function(e){e[e.STRING=1]="STRING",e[e.INT32=2]="INT32",e[e.UINT32=4]="UINT32",e[e.INT64=8]="INT64",e[e.UINT64=16]="UINT64",e[e.FLOAT=32]="FLOAT",e[e.DOUBLE=64]="DOUBLE",e[e.PRESENCE=128]="PRESENCE"})(dr||(dr={}));var Kr;(function(e){e[e.FALSE=0]="FALSE",e[e.TRUE=1]="TRUE",e[e.START_MAP=2]="START_MAP",e[e.START_LIST=3]="START_LIST",e[e.COUNT=4]="COUNT"})(Kr||(Kr={}));function yI(e,t,i,r){let a=vI(i);if(r===0)return a.map(h=>new rg(h,[]));let n=xI(e,t,r),s=(n.presentStream?n.presentCount:n.lengthStream.length)/a.length,o=[],l=0,u=0;for(let h=0;h<a.length;h++){let c=SI(n,h,s,l,u);o.push(new rg(a[h],c.value,c.nullabilityBuffer)),l=c.countsEnd,u=c.valuesEnd}return o}function vI(e){let t=e.type==="complexType"?e.complexType.children:void 0;return!t||t.length===0?[e.name]:t.map(i=>e.name+(i.name??""))}function xI(e,t,i){let r=e[t.get()];t.add(1);let a=Ct(e,t,Qe(e,t)),n=i-1,s=[];r&dr.STRING&&(n-=bI(e,t,s)),n-=wI(e,t,r,s),n-=TI(e,t,r,s);let o,l=0;if(r&dr.PRESENCE){let h=EI(e,t);o=h.value,l=h.count,n--}let u=new Uint32Array;if(n>0&&(u=Ct(e,t,Qe(e,t)),n--),n!==0)throw Error(`Unexpected number of remaining streams while decoding map column: ${n}`);return{lengthStream:a,dictionary:s,presentStream:o,presentCount:l,flattenedValues:u}}function bI(e,t,i){let r=e[t.get()];t.add(1);let a=q1("",e,t,r);if(a)for(let n=0;n<a.size;n++)i.push(a.getValue(n));return r}function wI(e,t,i,r){let a=0;return i&dr.INT32?($a(r,xl(e,t,Qe(e,t))),a++):i&dr.INT64&&($a(r,R1(e,t,Qe(e,t))),a++),i&dr.UINT32?($a(r,Ct(e,t,Qe(e,t))),a++):i&dr.UINT64&&($a(r,op(e,t,Qe(e,t))),a++),a}function TI(e,t,i,r){let a=0;return i&dr.FLOAT&&($a(r,I1(e,t,Qe(e,t).numValues)),a++),i&dr.DOUBLE&&($a(r,M1(e,t,Qe(e,t).numValues)),a++),a}function EI(e,t){let i=Qe(e,t);if(i.physicalStreamType!==pt.PRESENT)throw Error(`Expected PRESENT stream for map column but found: ${i.physicalStreamType}`);let r=i.numValues,a=t.get(),n=new Ri(hn(e,r,i.byteLength,t),r);return t.set(a+i.byteLength),{value:n,count:r}}function SI(e,t,i,r,a){let{lengthStream:n,flattenedValues:s,presentStream:o,dictionary:l}=e,u=t*i,h=i,c;if(o){c=new Ri(new Uint8Array(Math.ceil(i/8)),i),h=0;for(let y=0;y<i;y++)o.get(u+y)&&(c.set(y,!0),h++)}let d=r+h;if(d>n.length)throw Error("Merged map counts underflow while decoding child streams");let p=Array(i),f=r,m=a;for(let y=0;y<i;y++){if(o&&!o.get(u+y)){p[y]=null;continue}let x=m+n[f++];if(x>s.length)throw Error("Map value stream underflow while decoding feature payload");let v=DI(s,m,x,l);p[y]=v.value,m=v.nextIndex}let g=0;for(let y=r;y<d;y++)g+=n[y];let _=a+g;if(m!==_)throw Error("Unused flattened map values remain after decode");return{value:p,nullabilityBuffer:c,countsEnd:d,valuesEnd:_}}function DI(e,t,i,r){return i-t===1||e[t]===Kr.START_LIST?hp(e,t,i,r):W1(e,t,i,r)}function W1(e,t,i,r){let a=Object.create(null),n=t;for(;n<i;){let s=H1(e[n++],r);if(typeof s!="string")throw Error(`Map key dictionary index does not resolve to a string: ${s}`);let o=hp(e,n,i,r);a[s]=o.value,n=o.nextIndex}return{value:a,nextIndex:n}}function hp(e,t,i,r){if(t>=i)throw Error("Unexpected end of map value stream");let a=e[t];if(a===Kr.FALSE)return{value:!1,nextIndex:t+1};if(a===Kr.TRUE)return{value:!0,nextIndex:t+1};if(a===Kr.START_MAP){let n=ag(e,t,i);return{value:W1(e,t+2,n,r).value,nextIndex:n}}if(a===Kr.START_LIST){let n=ag(e,t,i),s=[],o=t+2;for(;o<n;){let l=hp(e,o,n,r);s.push(l.value),o=l.nextIndex}return{value:s,nextIndex:n}}return{value:H1(a,r),nextIndex:t+1}}function ag(e,t,i){if(t+1>=i)throw Error("Missing length for nested map/list payload");let r=e[t+1];if(r<2)throw Error(`Invalid nested payload length: ${r}`);let a=t+r;if(a>i)throw Error("Nested payload exceeds containing payload bounds");return a}function H1(e,t){let i=e-Kr.COUNT;if(i<0||i>=t.length)throw Error(`Scalar dictionary index out of range: ${e}`);return t[i]}function $a(e,t){for(let i of t)e.push(i)}function CI(e,t,i,r,a,n){var s;return i.type==="scalarType"?PI(r,e,t,a,i.scalarType,i):((s=i.complexType)==null?void 0:s.physicalType)===Ir.MAP?yI(e,t,i,r):r===0?null:_I(e,t,i)}function PI(e,t,i,r,a,n){let s;if(e===0)return null;if(n.nullable){let l=Qe(t,i),u=l.numValues,h=i.get(),c=hn(t,u,l.byteLength,i);i.set(h+l.byteLength),s=new Ri(c,l.numValues)}let o=s??r;switch(a.physicalType){case De.UINT_32:case De.INT_32:return zI(t,i,n,a,o);case De.STRING:{let l=n.nullable?e-1:e;return q1(n.name,t,i,l,s)??null}case De.BOOLEAN:return AI(t,i,n,r,o);case De.UINT_64:case De.INT_64:return FI(t,i,n,o,a);case De.FLOAT:return II(t,i,n,o);case De.DOUBLE:return MI(t,i,n,o);default:throw Error(`The specified data type for the field is currently not supported: ${a}`)}}function AI(e,t,i,r,a){let n=Qe(e,t),s=n.numValues,o=t.get(),l=Rs(a)?a:void 0,u=hn(e,s,n.byteLength,t,l);t.set(o+n.byteLength);let h=new Ri(u,s);return new hI(i.name,h,a)}function II(e,t,i,r){let a=Qe(e,t),n=Rs(r)?r:void 0,s=I1(e,t,a.numValues,n);return new cI(i.name,s,r)}function MI(e,t,i,r){let a=Qe(e,t),n=Rs(r)?r:void 0,s=M1(e,t,a.numValues,n);return new Jd(i.name,s,r)}function FI(e,t,i,r,a){let n=Qe(e,t),s=iu(n,r,e,t,"int64"),o=a.physicalType===De.INT_64;if(s===We.FLAT){let u=Rs(r)?r:void 0,h=o?R1(e,t,n,u):op(e,t,n,u);return new B1(i.name,h,r)}if(s===We.SEQUENCE){let u=z1(e,t,n);return new O1(i.name,u[0],u[1],n.numRleValues,o)}let l=o?GA(e,t,n):k1(e,t,n);return new G1(i.name,l,r,o)}function zI(e,t,i,r,a){let n=Qe(e,t),s=iu(n,a,e,t),o=r.physicalType===De.INT_32;if(s===We.FLAT){let u=Rs(a)?a:void 0,h=o?xl(e,t,n,void 0,u):Ct(e,t,n,void 0,u);return new Kd(i.name,h,a)}if(s===We.SEQUENCE){let u=F1(e,t,n);return new Qd(i.name,u[0],u[1],n.numRleValues,o)}let l=o?VA(e,t,n):sp(e,t,n);return new ep(i.name,l,a,o)}function Rs(e){return e instanceof Ri}const yt={ID:0,ID_NULLABLE:1,ID_LONG:2,GEOMETRY:4,SCALAR_BASE:10,STRUCT:30,MAP:31};function X1(e){switch(e){case yt.ID:case yt.ID|yt.ID_NULLABLE:case yt.ID|yt.ID_LONG:case yt.ID|yt.ID_LONG|yt.ID_NULLABLE:return{nullable:(e&yt.ID_NULLABLE)!==0,columnScope:Zn.FEATURE,type:"scalarType",scalarType:{longID:(e&yt.ID_LONG)!==0,type:"logicalType",logicalType:S1.ID}};case yt.GEOMETRY:return{nullable:!1,columnScope:Zn.FEATURE,type:"complexType",complexType:{type:"physicalType",physicalType:Ir.GEOMETRY,children:[]}};case yt.STRUCT:return{nullable:!1,columnScope:Zn.FEATURE,type:"complexType",complexType:{type:"physicalType",physicalType:Ir.STRUCT,children:[]}};case yt.MAP:return{nullable:!0,columnScope:Zn.FEATURE,type:"complexType",complexType:{type:"physicalType",physicalType:Ir.MAP,children:[]}};default:return OI(e)}}function RI(e){return e>=yt.SCALAR_BASE}function Y1(e){return e===yt.STRUCT||e===yt.MAP}function kI(e){if(e.type==="scalarType"){let t=e.scalarType;if(t.type==="physicalType")switch(t.physicalType){case De.BOOLEAN:case De.INT_8:case De.UINT_8:case De.INT_32:case De.UINT_32:case De.INT_64:case De.UINT_64:case De.FLOAT:case De.DOUBLE:return!1;case De.STRING:return!0;default:return!1}if(t.type==="logicalType")return!1}else if(e.type==="complexType"){let t=e.complexType;if(t.type==="physicalType")switch(t.physicalType){case Ir.GEOMETRY:case Ir.STRUCT:case Ir.MAP:return!0;default:return!1}}return console.warn("Unexpected column type in hasStreamCount",e),!1}function LI(e){var t;return e.type==="scalarType"&&((t=e.scalarType)==null?void 0:t.type)==="logicalType"&&e.scalarType.logicalType===S1.ID}function BI(e){var t;return e.type==="complexType"&&((t=e.complexType)==null?void 0:t.type)==="physicalType"&&e.complexType.physicalType===Ir.GEOMETRY}function OI(e){let t;switch(e){case 10:case 11:t=De.BOOLEAN;break;case 12:case 13:t=De.INT_8;break;case 14:case 15:t=De.UINT_8;break;case 16:case 17:t=De.INT_32;break;case 18:case 19:t=De.UINT_32;break;case 20:case 21:t=De.INT_64;break;case 22:case 23:t=De.UINT_64;break;case 24:case 25:t=De.FLOAT;break;case 26:case 27:t=De.DOUBLE;break;case 28:case 29:t=De.STRING;break;default:return null}return{nullable:!!(e&1),columnScope:Zn.FEATURE,type:"scalarType",scalarType:{longID:!1,type:"physicalType",physicalType:t}}}const $I=new TextDecoder,ng="0-3(ID), 4(GEOMETRY), 10-29(scalars), 30(STRUCT), 31(MAP)";function cp(e,t){let i=Rt(e,t,1)[0];if(i===0)return"";let r=t.get(),a=r+i,n=e.subarray(r,a);return t.add(i),$I.decode(n)}function jI(e){let t=e.name,i=e.nullable;return e.type==="scalarType"?{type:"scalarField",scalarField:e.scalarType,name:t,nullable:i}:{type:"complexField",complexField:e.complexType,name:t,nullable:i}}function K1(e,t){let i=Rt(e,t,1)[0]>>>0,r=i>=yt.SCALAR_BASE?X1(i):null;if(!r)throw Error(`Unsupported field type code ${i}. Supported: 10-29(scalars), 30(STRUCT), 31(MAP)`);let a={...r,name:cp(e,t)};if(a.type==="complexType"&&Y1(i)){let n=a.complexType,s=Rt(e,t,1)[0]>>>0;n.children=Array(s);for(let o=0;o<s;o++)n.children[o]=K1(e,t)}return jI(a)}function VI(e,t){let i=Rt(e,t,1)[0]>>>0,r=X1(i);if(!r)throw Error(`Unsupported column type code ${i}. Supported: ${ng}`);let a;if(RI(i))a=cp(e,t);else if(i<yt.GEOMETRY)a="id";else if(i===yt.GEOMETRY)a="geometry";else throw Error(`Unsupported column type code ${i}. Supported: ${ng}`);let n={...r,name:a};if(n.type==="complexType"&&Y1(i)){let s=Rt(e,t,1)[0]>>>0,o=n.complexType;o.children=Array(s);for(let l=0;l<s;l++)o.children[l]=K1(e,t)}return n}function NI(e,t){let i={};i.featureTables=[];let r={};if(r.name=cp(e,t),r.name.length===0)throw Error("Missing layer name");let a=Rt(e,t,1)[0]>>>0,n=Rt(e,t,1)[0]>>>0;r.columns=Array(n);for(let s=0;s<n;s++)r.columns[s]=VI(e,t);return i.featureTables.push(r),[i,a]}function UI(e,t,i=!0){let r=new D1(0),a=[];for(;r.get()<e.length;){let n=Rt(e,r,1)[0]>>>0,s=r.get()+n;if(s>e.length)throw Error(`Block overruns tile: ${s} > ${e.length}`);let o=Rt(e,r,1)[0]>>>0;if(o!==1&&o!==2){r.set(s);continue}let[l,u]=NI(e,r),h=l.featureTables[0],c=null,d=null,p=[],f=0;for(let g of h.columns){let _=g.name;if(LI(g)){let y=null;if(g.nullable){let v=Qe(e,r),w=r.get(),b=hn(e,v.numValues,v.byteLength,r);r.set(w+v.byteLength),y=new Ri(b,v.numValues)}let x=Qe(e,r);f=y?y.size():x.decompressedCount,c=GI(e,g,r,_,x,y??f,i)}else if(BI(g)){let y=Rt(e,r,1)[0];if(f===0){let x=r.get();f=Qe(e,r).decompressedCount,r.set(x)}d=oI(e,y,r,f,t)}else{let y=kI(g)?Rt(e,r,1)[0]:1;if(y===0)continue;let x=CI(e,r,g,y,f);if(x)if(Array.isArray(x))for(let v of x)p.push(v);else p.push(x)}}let m=new pP(h.name,d,c,p,u);a.push(m),r.set(s)}return a}function GI(e,t,i,r,a,n,s=!1){var h;let o=(h=t.scalarType)!=null&&h.longID?De.UINT_64:De.UINT_32,l=typeof n=="number"?void 0:n,u=iu(a,n,e,i,o===De.UINT_64?"int64":"int32");if(o===De.UINT_32)switch(u){case We.FLAT:return new Kd(r,Ct(e,i,a,void 0,l),n);case We.SEQUENCE:{let c=F1(e,i,a);return new Qd(r,c[0],c[1],a.numRleValues,!1)}case We.CONST:return new ep(r,sp(e,i,a),n,!1)}switch(u){case We.FLAT:return s?new Jd(r,NA(e,i,a,l),n):new B1(r,op(e,i,a,l),n);case We.SEQUENCE:{let c=z1(e,i,a);return new O1(r,c[0],c[1],a.numRleValues,!1)}case We.CONST:return new G1(r,k1(e,i,a),n,!1)}throw Error("Vector type not supported for id column.")}var ZI=class{constructor(e,t){var i;switch(this._featureData=e,this.properties=this._featureData.properties||{},(i=this._featureData.geometry)==null?void 0:i.type){case Ft.POINT:case Ft.MULTIPOINT:this.type=1;break;case Ft.LINESTRING:case Ft.MULTILINESTRING:this.type=2;break;case Ft.POLYGON:case Ft.MULTIPOLYGON:this.type=3;break;default:this.type=0}this.extent=t,this.id=Number(this._featureData.id)}loadGeometry(){let e=[];for(let t of this._featureData.geometry.coordinates){let i=[];for(let r of t)i.push(new A(r.x,r.y));e.push(i)}return e}},qI=class{constructor(e){this.features=[],this.featureTable=e,this.name=e.name,this.extent=e.extent,this.version=2,this.features=e.getFeatures(),this.length=this.features.length}feature(e){return new ZI(this.features[e],this.extent)}},WI=class{constructor(e){this.layers={};let t=UI(new Uint8Array(e));this.layers=t.reduce((i,r)=>({...i,[r.name]:new qI(r)}),{})}},HI=class{constructor(e,t){this.tileID=e,this.x=e.canonical.x,this.y=e.canonical.y,this.z=e.canonical.z,this.grid=new Vh(L,16,0),this.grid3D=new Vh(L,16,0),this.featureIndexArray=new _0,this.promoteId=t}insert(e,t,i,r,a,n){let s=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(i,r,a);let o=n?this.grid3D:this.grid;for(let l of t){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(){if(!this.vtLayers){switch(this.encoding){case"mlt":this.vtLayers=new WI(this.rawTileData).layers;break;default:this.vtLayers=new wS(new a1(this.rawTileData)).layers}this.sourceLayerCoder=new dP(this.vtLayers?Object.keys(this.vtLayers).sort():[Uo])}return this.vtLayers}query(e,t,i,r){this.loadVTLayers();let a=e.params,n=L/e.tileSize/e.scale,s=us(a.filter,"queryRenderedFeatures filter",a.globalState),o=e.queryGeometry,l=e.queryPadding*n,u=Mi.fromPoints(o),h=this.grid.query(u.minX-l,u.minY-l,u.maxX+l,u.maxY+l),c=Mi.fromPoints(e.cameraQueryGeometry).expandBy(l),d=this.grid3D.query(c.minX,c.minY,c.maxX,c.maxY,(m,g,_,y)=>iE(e.cameraQueryGeometry,m-l,g-l,_+l,y+l));for(let m of d)h.push(m);h.sort(YI);let p={},f;for(let m of h){if(m===f)continue;f=m;let g=this.featureIndexArray.get(m),_=null;this.loadMatchingFeature(p,g.bucketIndex,g.sourceLayerIndex,g.featureIndex,s,a.layers,a.availableImages,t,i,r,(y,x,v)=>(_||(_=pa(y)),x.queryIntersectsFeature({queryGeometry:o,feature:y,featureState:v,geometry:_,zoom:this.z,transform:e.transform,pixelsToTileUnits:n,pixelPosMatrix:e.pixelPosMatrix,unwrappedTileID:this.tileID.toUnwrapped(),getElevation:e.getElevation})))}return p}loadMatchingFeature(e,t,i,r,a,n,s,o,l,u,h){let c=this.bucketLayerIDs[t];if(n&&!c.some(m=>n.has(m)))return;let d=this.sourceLayerCoder.decode(i),p=this.vtLayers[d].feature(r);if(a.needGeometry){let m=fa(p,!0);if(!a.filter(new Be(this.tileID.overscaledZ),m,this.tileID.canonical))return}else if(!a.filter(new Be(this.tileID.overscaledZ),p))return;let f=this.getId(p,d);for(let m of c){if(n&&!n.has(m))continue;let g=o[m];if(!g)continue;let _={};f&&u&&(_=u.getState(g.sourceLayer||"_geojsonTileLayer",f));let y=W({},l[m]);y.paint=sg(y.paint,g.paint,p,_,s),y.layout=sg(y.layout,g.layout,p,_,s);let x=!h||h(p,g,_);if(!x)continue;let v=new T1(p,this.z,this.x,this.y,f);v.layer=y;let w=e[m];w===void 0&&(w=e[m]=[]),w.push({featureIndex:r,feature:v,intersectionZ:x})}}lookupSymbolFeatures(e,t,i,r,a,n,s,o){let l={};this.loadVTLayers();let u=us(a.filterSpec,"queryRenderedFeatures symbol filter",a.globalState);for(let h of e)this.loadMatchingFeature(l,i,r,h,u,n,s,o,t);return l}hasLayer(e){for(let t of this.bucketLayerIDs)for(let i of t)if(e===i)return!0;return!1}getId(e,t){var r;let i=e.id;if(this.promoteId){let a=typeof this.promoteId=="string"?this.promoteId:this.promoteId[t];i=e.properties[a],typeof i=="boolean"&&(i=Number(i)),i===void 0&&((r=e.properties)!=null&&r.cluster)&&this.promoteId&&(i=Number(e.properties.cluster_id))}return i}};G("FeatureIndex",HI,{omit:["rawTileData","sourceLayerCoder"]});function XI(e){return typeof e=="object"&&!!e&&"evaluate"in e}function sg(e,t,i,r,a){return fd(e,(n,s)=>{let o=t instanceof ql?t.get(s):null;return XI(o)?o.evaluate(i,r,void 0,a):o})}function YI(e,t){return t-e}var KI=class{constructor(e,t){this.max=e,this.onRemove=t,this.reset()}reset(){for(let e in this.data)for(let t of this.data[e])t.timeout&&clearTimeout(t.timeout),this.onRemove(t.value);return this.data={},this.order=[],this}add(e,t,i){let r=e.wrapped().key;this.data[r]===void 0&&(this.data[r]=[]);let a={value:t,timeout:void 0};if(i!==void 0&&(a.timeout=setTimeout(()=>{this.remove(e,a)},i)),this.data[r].push(a),this.order.push(r),this.order.length>this.max){let n=this._getAndRemoveByKey(this.order[0]);n&&this.onRemove(n)}return this}has(e){return e.wrapped().key in this.data}getAndRemove(e){return this.has(e)?this._getAndRemoveByKey(e.wrapped().key):null}_getAndRemoveByKey(e){let t=this.data[e].shift();return t.timeout&&clearTimeout(t.timeout),this.data[e].length===0&&delete this.data[e],this.order.splice(this.order.indexOf(e),1),t.value}getByKey(e){let t=this.data[e];return t?t[0].value:null}
5get(e){return this.has(e)?this.data[e.wrapped().key][0].value:null}remove(e,t){if(!this.has(e))return this;let i=e.wrapped().key,r=t===void 0?0:this.data[i].indexOf(t),a=this.data[i][r];return this.data[i].splice(r,1),a.timeout&&clearTimeout(a.timeout),this.data[i].length===0&&delete this.data[i],this.onRemove(a.value),this.order.splice(this.order.indexOf(i),1),this}setMaxSize(e){for(this.max=e;this.order.length>this.max;){let t=this._getAndRemoveByKey(this.order[0]);t&&this.onRemove(t)}return this}filter(e){let t=[];for(let i in this.data)for(let r of this.data[i])e(r.value)||t.push(r);for(let i of t)this.remove(i.value.tileID,i)}};/**
6* MapLibre GL JS
7* @license 3-Clause BSD. Full text of license: https://github.com/maplibre/maplibre-gl-js/blob/v6.10.0/LICENSE.txt
8*/var J1="6.10.0";function Q1(){var e=new wt(4);return wt!=Float32Array&&(e[1]=0,e[2]=0),e[0]=1,e[3]=1,e}function JI(e,t){var i=t[0],r=t[1],a=t[2],n=t[3],s=i*n-a*r;return s?(s=1/s,e[0]=n*s,e[1]=-r*s,e[2]=-a*s,e[3]=i*s,e):null}function QI(e){return e[0]*e[3]-e[2]*e[1]}function eM(e,t,i){var r=t[0],a=t[1],n=t[2],s=t[3],o=Math.sin(i),l=Math.cos(i);return e[0]=r*l+n*o,e[1]=a*l+s*o,e[2]=r*-o+n*l,e[3]=a*-o+s*l,e}let ih,og,rh;const qt={frame(e,t,i,r){let a=r||window,n=a.requestAnimationFrame(o=>{s(),t(o)}),{unsubscribe:s}=Ch(e.signal,"abort",()=>{s(),a.cancelAnimationFrame(n),i(new Ts(e.signal.reason))},!1)},frameAsync(e,t){return new Promise((i,r)=>{this.frame(e,i,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(hd()&&!w_())t=new OffscreenCanvas(e.width,e.height).getContext("2d",{willReadFrequently:!0});else{let i=window.document.createElement("canvas");i.width=e.width,i.height=e.height,t=i.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 ih||(ih=document.createElement("a")),ih.href=e,ih.href},get hardwareConcurrency(){return typeof navigator<"u"&&navigator.hardwareConcurrency||4},get prefersReducedMotion(){return rh===void 0?matchMedia?(og??(og=matchMedia("(prefers-reduced-motion: reduce)")),og.matches):!1:rh},set prefersReducedMotion(e){rh=e}},ru=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 Oe(){return ru.getCurrentTime()}function tM(e){ru.setNow(e)}function iM(){ru.restoreNow()}function rM(){return ru.isFrozen()}var t,Re,ae=(Re=class{static create(t,i,r){let a=window.document.createElement(t);return i!==void 0&&(a.className=i),r&&r.appendChild(a),a}static createNS(t,i){return window.document.createElementNS(t,i)}static disableDrag(){Re.docStyle&&Re.selectProp&&(Re.userSelect=Re.docStyle[Re.selectProp],Re.docStyle[Re.selectProp]="none")}static enableDrag(){Re.docStyle&&Re.selectProp&&(Re.docStyle[Re.selectProp]=Re.userSelect)}static suppressClickInternal(t){t.preventDefault(),t.stopPropagation(),window.removeEventListener("click",Re.suppressClickInternal,!0)}static suppressClick(){window.addEventListener("click",Re.suppressClickInternal,!0),window.setTimeout(()=>{window.removeEventListener("click",Re.suppressClickInternal,!0)},0)}static getScale(t){let i=t.getBoundingClientRect();return{x:i.width/t.offsetWidth||1,y:i.height/t.offsetHeight||1,boundingClientRect:i}}static getPoint(t,i,r){let a=i.boundingClientRect;return new A((r.clientX-a.left)/i.x-t.clientLeft,(r.clientY-a.top)/i.y-t.clientTop)}static mousePos(t,i){let r=Re.getScale(t);return Re.getPoint(t,r,i)}static touchPos(t,i){let r=[],a=Re.getScale(t);for(let n of i)r.push(Re.getPoint(t,a,n));return r}static sanitize(t){let i=new DOMParser().parseFromString(t,"text/html").body||document.createElement("body"),r=i.querySelectorAll("script, iframe");for(let a of r)a.remove();return Re.clean(i),i.innerHTML}static isPossiblyDangerous(t,i){let r=i.replace(/\s+/g,"").toLowerCase();if(["src","href","xlink:href"].includes(t)&&(r.includes("javascript:")||r.includes("data:"))||t==="srcdoc"||t.startsWith("on"))return!0}static clean(t){let i=t.children;for(let r of i)Re.removeAttributes(r),Re.clean(r)}static removeAttributes(t){for(let{name:i,value:r}of Array.from(t.attributes))Re.isPossiblyDangerous(i,r)&&t.removeAttribute(i)}},Re.docStyle=typeof window<"u"&&((t=window.document)==null?void 0:t.documentElement.style),Re.selectProp=!Re.docStyle||"userSelect"in Re.docStyle?"userSelect":"webkitUserSelect",Re);let Hi;(function(e){let t,i,r,a;e.resetRequestQueue=()=>{t=[],i=0,r=0,a={}},e.addThrottleControl=c=>{let d=r++;return a[d]=c,d},e.removeThrottleControl=c=>{delete a[c],u()};let n=()=>{for(let c of Object.keys(a))if(a[c]())return!0;return!1};async function s(c,d,p,f,m=!0,g){let _=await c.transformRequest(d,p);return md(f.signal),Hi.getImage(_,f,m,g)}e.transformAndGetImage=s,e.getImage=(c,d,p=!0,f)=>new Promise((m,g)=>{c.headers||(c.headers={}),c.headers.accept="image/webp,*/*",W(c,{type:"image"});let _={abortController:d,requestParameters:c,supportImageRefresh:p,imageBitmapOptions:f,state:"queued",onError:y=>{g(y)},onSuccess:y=>{m(y)}};t.push(_),u()});let o=(c,d)=>typeof createImageBitmap=="function"?ow(c,d):lw(c),l=async c=>{c.state="running";let{requestParameters:d,supportImageRefresh:p,imageBitmapOptions:f,onError:m,onSuccess:g,abortController:_}=c,y=p===!1&&!f&&!Ya(self)&&!z_(d.url)&&(!d.headers||Object.keys(d.headers).reduce((v,w)=>v&&w==="accept",!0));i++;let x=y?h(d,_):Pl(d,_);try{let v=await x;delete c.abortController,c.state="completed",v.data instanceof HTMLImageElement||Qr(v.data)?g(v):!v.data||v.data.byteLength===0?g({data:null,cacheControl:v.cac
vendor: 12,702 bytes, line 8
8heControl,expires:v.expires}):g({data:await o(v.data,f),cacheControl:v.cacheControl,expires:v.expires})}catch(v){delete c.abortController,m(kt(v))}finally{i--,u()}},u=()=>{let c=n()?ti.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:ti.MAX_PARALLEL_IMAGE_REQUESTS;for(let d=i;d<c&&t.length>0;d++){let p=t.shift();if(p.abortController.signal.aborted){d--;continue}l(p)}},h=(c,d)=>new Promise((p,f)=>{let m=new Image,g=c.url,_=c.credentials;_&&_==="include"?m.crossOrigin="use-credentials":(_&&_==="same-origin"||!k_(g))&&(m.crossOrigin="anonymous"),d.signal.addEventListener("abort",()=>{m.src="",f(new Ts(d.signal.reason))}),m.fetchPriority="high",m.onload=()=>{m.onerror=m.onload=null,p({data:m})},m.onerror=()=>{m.onerror=m.onload=null,!d.signal.aborted&&f(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."))},m.src=g})})(Hi||(Hi={})),Hi.resetRequestQueue();var aM=class{constructor(e){this._transformRequestFn=e??null}transformRequest(e,t){return this._transformRequestFn&&this._transformRequestFn(e,t)||{url:e}}setTransformRequest(e){this._transformRequestFn=e}},bt=class extends ci{},Y=class extends bt{},jc=class extends bt{constructor(e={}){super("style.load",e)}},vi=class extends bt{constructor(e,t={}){super(e,t),this.dataType="style"}},qe=class extends bt{constructor(e,t={}){super(e,t),this.dataType="source"}},li=class extends bt{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,t,i,r={}){i=i instanceof MouseEvent?i:new MouseEvent(e,i);let a=ae.mousePos(t.getCanvas(),i),n=t.unproject(a);super(e,W({point:a,lngLat:n,originalEvent:i},r)),this._defaultPrevented=!1,this.target=t}},qn=class extends bt{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,t,i){let r=e==="touchend"?i.changedTouches:i.touches,a=ae.touchPos(t.getCanvasContainer(),r),n=a.map(l=>t.unproject(l)),s=a.reduce((l,u,h,c)=>l.add(u.div(c.length)),new A(0,0)),o=t.unproject(s);super(e,{points:a,point:s,lngLats:n,lngLat:o,originalEvent:i}),this._defaultPrevented=!1}},ev=class extends bt{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,t){super("wheel",{originalEvent:t}),this._defaultPrevented=!1}},Vc=class extends bt{},tv=class extends bt{constructor(e={}){super("terrain",e)}},iv=class extends bt{constructor(e={}){super("projectiontransition",e)}},Go=class extends bt{},rv=class extends bt{constructor(e={}){super("styleimagemissing",e)}};function nM(e,t){let i={};for(let r in e)r!=="ref"&&(i[r]=e[r]);return bw.forEach(r=>{r in t&&(i[r]=t[r])}),i}function lg(e){e=e.slice();let t=Object.create(null);for(let i=0;i<e.length;i++)t[e[i].id]=e[i];for(let i=0;i<e.length;i++)"ref"in e[i]&&(e[i]=nM(e[i],t[e[i].ref]));return e}function ke(e,t){if(Array.isArray(e)){if(!Array.isArray(t)||e.length!==t.length)return!1;for(let i=0;i<e.length;i++)if(!ke(e[i],t[i]))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 i in e)if(!ke(e[i],t[i]))return!1;return!0}return e===t}function si(e,t){e.push(t)}function av(e,t,i){si(i,{command:"addSource",args:[e,t[e]]})}function nv(e,t,i){si(t,{command:"removeSource",args:[e]}),i[e]=!0}function sM(e,t,i,r){nv(e,i,r),av(e,t,i)}function oM(e,t,i){let r;for(r in e[i])if(Object.prototype.hasOwnProperty.call(e[i],r)&&r!=="data"&&!ke(e[i][r],t[i][r]))return!1;for(r in t[i])if(Object.prototype.hasOwnProperty.call(t[i],r)&&r!=="data"&&!ke(e[i][r],t[i][r]))return!1;return!0}function lM(e,t,i,r){e||(e={}),t||(t={});let a;for(a in e)Object.prototype.hasOwnProperty.call(e,a)&&(Object.prototype.hasOwnProperty.call(t,a)||nv(a,i,r));for(a in t)Object.prototype.hasOwnProperty.call(t,a)&&(Object.prototype.hasOwnProperty.call(e,a)?ke(e[a],t[a])||(e[a].type==="geojson"&&t[a].type==="geojson"&&oM(e,t,a)?si(i,{command:"setGeoJSONSourceData",args:[a,t[a].data]}):sM(a,t,i,r)):av(a,t,i))}function ug(e,t,i,r,a){si(t,{command:a,args:[i,r,e[r]]})}function bo(e,t,i,r,a){e||(e={}),t||(t={});for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&(ke(e[n],t[n])||ug(t,i,r,n,a));for(let n in t)Object.prototype.hasOwnProperty.call(t,n)&&!Object.prototype.hasOwnProperty.call(e,n)&&(ke(e[n],t[n])||ug(t,i,r,n,a))}function hg(e){return e.id}function cg(e,t){return e[t.id]=t,e}function uM(e,t,i){e||(e=[]),t||(t=[]);let r=e.map(hg),a=t.map(hg),n=e.reduce(cg,{}),s=t.reduce(cg,{}),o=r.slice(),l=Object.create(null),u,h,c,d,p;for(let f=0,m=0;f<r.length;f++)u=r[f],Object.prototype.hasOwnProperty.call(s,u)?m++:(si(i,{command:"removeLayer",args:[u]}),o.splice(o.indexOf(u,m),1));for(let f=0,m=0;f<a.length;f++)u=a[a.length-1-f],o[o.length-1-f]!==u&&(Object.prototype.hasOwnProperty.call(n,u)?(si(i,{command:"removeLayer",args:[u]}),o.splice(o.lastIndexOf(u,o.length-m),1)):m++,d=o[o.length-f],si(i,{command:"addLayer",args:[s[u],d]}),o.splice(o.length-f,0,u),l[u]=!0);for(let f=0;f<a.length;f++)if(u=a[f],h=n[u],c=s[u],!(l[u]||ke(h,c))){if(!ke(h.source,c.source)||!ke(h["source-layer"],c["source-layer"])||!ke(h.type,c.type)){si(i,{command:"removeLayer",args:[u]}),d=o[o.lastIndexOf(u)+1],si(i,{command:"addLayer",args:[c,d]});continue}for(p in bo(h.layout,c.layout,i,u,"setLayoutProperty"),bo(h.paint,c.paint,i,u,"setPaintProperty"),ke(h.filter,c.filter)||si(i,{command:"setFilter",args:[u,c.filter]}),(!ke(h.minzoom,c.minzoom)||!ke(h.maxzoom,c.maxzoom))&&si(i,{command:"setLayerZoomRange",args:[u,c.minzoom,c.maxzoom]}),h)Object.prototype.hasOwnProperty.call(h,p)&&p!=="layout"&&p!=="paint"&&p!=="filter"&&p!=="metadata"&&p!=="minzoom"&&p!=="maxzoom"&&(p.indexOf("paint.")===0?bo(h[p],c[p],i,u,"setPaintProperty"):ke(h[p],c[p])||si(i,{command:"setLayerProperty",args:[u,p,c[p]]}));for(p in c)Object.prototype.hasOwnProperty.call(c,p)&&!Object.prototype.hasOwnProperty.call(h,p)&&p!=="layout"&&p!=="paint"&&p!=="filter"&&p!=="metadata"&&p!=="minzoom"&&p!=="maxzoom"&&(p.indexOf("paint.")===0?bo(h[p],c[p],i,u,"setPaintProperty"):ke(h[p],c[p])||si(i,{command:"setLayerProperty",args:[u,p,c[p]]}))}}function hM(e,t){if(!e)return[{command:"setStyle",args:[t]}];let i=[];try{if(!ke(e.version,t.version))return[{command:"setStyle",args:[t]}];ke(e.center,t.center)||i.push({command:"setCenter",args:[t.center]}),ke(e.state,t.state)||i.push({command:"setGlobalState",args:[t.state]}),ke(e.centerAltitude,t.centerAltitude)||i.push({command:"setCenterAltitude",args:[t.centerAltitude]}),ke(e.zoom,t.zoom)||i.push({command:"setZoom",args:[t.zoom]}),ke(e.bearing,t.bearing)||i.push({command:"setBearing",args:[t.bearing]}),ke(e.pitch,t.pitch)||i.push({command:"setPitch",args:[t.pitch]}),ke(e.roll,t.roll)||i.push({command:"setRoll",args:[t.roll]}),ke(e.sprite,t.sprite)||i.push({command:"setSprite",args:[t.sprite]}),ke(e.glyphs,t.glyphs)||i.push({command:"setGlyphs",args:[t.glyphs]}),ke(e["font-faces"],t["font-faces"])||i.push({command:"setFontFaces",args:[t["font-faces"]]}),ke(e.transition,t.transition)||i.push({command:"setTransition",args:[t.transition]}),ke(e.light,t.light)||i.push({command:"setLight",args:[t.light]});let r=!ke(e.terrain,t.terrain);r&&!t.terrain&&i.push({command:"setTerrain",args:[void 0]}),ke(e.sky,t.sky)||i.push({command:"setSky",args:[t.sky]}),ke(e.projection,t.projection)||i.push({command:"setProjection",args:[t.projection]});let a={},n=[];lM(e.sources,t.sources,n,a);let s=[];e.layers&&e.layers.forEach(o=>{"source"in o&&a[o.source]?i.push({command:"removeLayer",args:[o.id]}):s.push(o)}),i=i.concat(n),uM(s,t.layers,i),r&&t.terrain&&i.push({command:"setTerrain",args:[t.terrain]})}catch(r){console.warn("Unable to compute style diff:",r),i=[{command:"setStyle",args:[t]}]}return i}function cM(){let e={},t=z.$version;for(let i in z.$root){let r=z.$root[i];if(r.required){let a=null;a=i==="version"?t:r.type==="array"?[]:{},a!=null&&(e[i]=a)}}return e}function Zo(e){let t=[];if(typeof e=="string")t.push({id:"default",url:e});else if(e&&e.length>0){let i=[];for(let{id:r,url:a}of e){let n=`${r}${a}`;i.includes(n)||(i.push(n),t.push({id:r,url:a}))}}return t}function dg(e,t,i){try{let r=new URL(e);return r.pathname+=`${t}${i}`,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 dM(e,t,i,r){let a=Zo(e),n=i>1?"@2x":"",s={},o={};for(let{id:l,url:u}of a){let h=await t.transformRequest(dg(u,n,".json"),"SpriteJSON");s[l]=Al(h,r);let c=await t.transformRequest(dg(u,n,".png"),"SpriteImage");o[l]=Hi.getImage(c,r)}return await Promise.all([...Object.values(s),...Object.values(o)]),pM(s,o)}async function pM(e,t){let i={};for(let r in e){i[r]={};let a=(await t[r]).data;if(!a)throw Error(`Could not load sprite image for ${r}: the response is empty`);let n=qt.getImageCanvasContext(a),s=(await e[r]).data;for(let o in s){let{width:l,height:u,x:h,y:c,sdf:d,pixelRatio:p,stretchX:f,stretchY:m,content:g,textFitWidth:_,textFitHeight:y}=s[o],x={width:l,height:u,x:h,y:c,context:n};i[r][o]={data:null,pixelRatio:p,sdf:d,stretchX:f,stretchY:m,content:g,textFitWidth:_,textFitHeight:y,spriteData:x}}}return i}var fM=class extends _t{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:t,promiseResolve:i}of this.requestors)i(this._getImagesForIds(t));this.requestors=[]}}getImage(e){let t=this.images[e];if(t&&!t.data&&t.spriteData){let i=t.spriteData;t.data=new Ze({width:i.width,height:i.height},i.context.getImageData(i.x,i.y,i.width,i.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 i=!0,r=t.data||t.spriteData;return this._validateStretch(t.stretchX,r==null?void 0:r.width)||(this.fire(new Q(Error(`Image "${e}" has invalid "stretchX" value`))),i=!1),this._validateStretch(t.stretchY,r==null?void 0:r.height)||(this.fire(new Q(Error(`Image "${e}" has invalid "stretchY" value`))),i=!1),this._validateContent(t.content,t)||(this.fire(new Q(Error(`Image "${e}" has invalid "content" value`))),i=!1),i}_validateStretch(e,t){if(!e)return!0;let i=0;for(let r of e){if(r[0]<i||r[1]<r[0]||t<r[1])return!1;i=r[1]}return!0}_validateContent(e,t){if(!e)return!0;if(e.length!==4)return!1;let i=t.spriteData,r=(i==null?void 0:i.width)||t.data.width,a=(i==null?void 0:i.height)||t.data.height;return e[0]<0||r<e[0]||e[1]<0||a<e[1]||e[2]<0||r<e[2]||e[3]<0||a<e[3]||e[2]<e[0]?!1:e[3]>=e[1]}updateImage(e,t,i=!0){let r=this.images[e];if(i){let a=r.data||r.spriteData;if(a.width!==t.data.width||a.height!==t.data.height)throw Error(`size mismatch between old image (${a.width}x${a.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){var i;let t=this.images[e];t&&(delete this.images[e],this._imagesIds=null,(i=t.userImage)!=null&&i.onRemove&&t.userImage.onRemove())}listImages(){return this._imagesIds??(this._imagesIds=Object.keys(this.images)),this._imagesIds}_getSpriteImageId(e,t){return e==="default"?t:`${e}:${t}`}setSpriteImages(e,t){let i=this._spriteImagesIds[e]??[],r=[];for(let s in t){let o=this._getSpriteImageId(e,s);r.push(o),o in this.images?this.updateImage(o,t[s],!1):this.addImage(o,t[s])}let a=new Set(r),n=i.filter(s=>!a.has(s));for(let s of n)this.removeImage(s);return this._spriteImagesIds[e]=r,{loaded:r,removed:n}}removeSpriteImages(e){let t=this._spriteImagesIds[e]??[];for(let i of t)this.removeImage(i);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,i)=>{let r=!0;if(!this.isLoaded())for(let a of e)this.images[a]||(r=!1);this.isLoaded()||r?t(this._getImagesForIds(e)):this.requestors.push({ids:e,promiseResolve:t})})}async _getImagesForIds(e){var a;let t=new Set(e.filter(n=>!this.getImage(n))),i=this.missingImageResolver;i&&await Promise.allSettled(Array.from(t,n=>i(n)));let r={};for(let n of e){let s=this.getImage(n);s&&(t.delete(n),r[n]={data:s.data.clone(),pixelRatio:s.pixelRatio,sdf:s.sdf,ver
8sion:s.version,stretchX:s.stretchX,stretchY:s.stretchY,content:s.content,textFitWidth:s.textFitWidth,textFitHeight:s.textFitHeight,hasRenderCallback:!!((a=s.userImage)!=null&&a.render),isWebGLImage:s.isWebGLImage})}for(let n of t)this.fire(new rv({id:n})),xe(`Image "${n}" 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 i=this.getImage(t);i||xe(`Image with ID: "${t}" was not found`),nC(i)&&this.updateImage(t,i)}}cloneImages(){let e={};for(let t in this.images){let i=this.images[t];e[t]={...i,data:i.data?i.data.clone():null}}return e}},mM=class{constructor(e){this._imageManager=e,this._entries={},this._image=new Ze({width:1,height:1}),this._dirty=!0}destroy(){this._texture&&(this._texture=(this._texture.destroy(),null)),this._entries={},this._image=new Ze({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 i=this._entries[e];if((i==null?void 0:i.image)!==t){let r={w:t.data.width+2,h:t.data.height+2,x:0,y:0};this._entries[e]={bin:r,position:new Hd(r,t),image:t}}else if(i.position.version!==t.version)i.position.version=t.version;else return i.position;return this._update(),this._entries[e].position}bind(e){let t=e.gl;this._texture?this._dirty&&(this._dirty=(this._texture.update(this._image),!1)):(this._texture=new gt(e,this._image,t.RGBA),this._dirty=!1),this._texture.bind(t.LINEAR,t.CLAMP_TO_EDGE)}_update(){for(let a in this._entries)this._imageManager.getImage(a)||delete this._entries[a];let e=[];for(let a in this._entries)e.push(this._entries[a].bin);let{w:t,h:i}=n1(e),r=this._image;r.resize({width:t||1,height:i||1});for(let a in this._entries){let{bin:n}=this._entries[a],s=n.x+1,o=n.y+1,l=this._entries[a].image.data,u=l.width,h=l.height;Ze.copy(l,r,{x:0,y:0},{x:s,y:o},{width:u,height:h}),Ze.copy(l,r,{x:0,y:h-1},{x:s,y:o-1},{width:u,height:1}),Ze.copy(l,r,{x:0,y:0},{x:s,y:o+h},{width:u,height:1}),Ze.copy(l,r,{x:u-1,y:0},{x:s-1,y:o},{width:1,height:h}),Ze.copy(l,r,{x:0,y:0},{x:s+u,y:o},{width:1,height:h})}this._dirty=!0}};const Nc=1114111,gM={start:0,end:Nc};let _M=0;function yM(e){let t=/^u\+([0-9a-f]*)(\?+)$/i.exec(e);if(t){let[,a,n]=t;return a.length+n.length>6?null:pg(parseInt(`${a}${"0".repeat(n.length)}`,16),parseInt(`${a}${"f".repeat(n.length)}`,16))}let i=/^u\+([0-9a-f]{1,6})(?:-([0-9a-f]{1,6}))?$/i.exec(e);if(!i)return null;let r=parseInt(i[1],16);return pg(r,i[2]===void 0?r:parseInt(i[2],16))}function pg(e,t){return e>t||e>Nc?null:{start:e,end:Math.min(t,Nc)}}function vM(e,t){return e.ranges.some(({start:i,end:r})=>t>=i&&t<=r)}var xM=class{constructor(e){this.requestManager=e,this._faces={},this._registered=new Set}setFontFaces(e){this._unregisterAll(),this._faces={};for(let[t,i]of Object.entries(e??{})){let r=Array.isArray(i)?i:[i];this._faces[t]=r.map(a=>this._declareFontFace(t,a)).filter(a=>a!==null)}}hasFontFaces(){return Object.keys(this._faces).length>0}async getFontFamily(e,t){for(let i of e.split(","))for(let r of this._faces[i.trim()]??[])if(vM(r,t)&&(r.loaded??(r.loaded=this._loadFontFace(r)),await r.loaded))return r.family;return null}_declareFontFace(e,t){let i=typeof t=="string"?{url:t}:t;if(typeof(i==null?void 0:i.url)!="string")return xe(`Ignoring the font face declared for "${e}": it has no URL.`),null;let r=`maplibre-gl-font-face-${_M++}`,a=i["unicode-range"];if(!(a!=null&&a.length))return{url:i.url,ranges:[gM],family:r};let n=[];for(let s of a){let o=yM(s);if(!o){xe(`Ignoring the unicode range "${s}" of the font face at ${i.url}: it is not a valid range.`);continue}n.push(o)}return n.length?{url:i.url,ranges:n,family:r}:null}async _loadFontFace(e){if(typeof FontFace>"u"||typeof document>"u"||!document.fonts)return xe(`Ignoring the font face at ${e.url}: this environment has no CSS Font Loading API.`),!1;let t;
vendor: 4,438 bytes, line 8
8try{return t=new FontFace(e.family,await this._downloadFontFile(e.url)),Object.values(this._faces).some(i=>i.includes(e))?(document.fonts.add(t),this._registered.add(t),await t.load(),!0):!1}catch(i){return t&&this._unregister(t),xe(`Ignoring the font face at ${e.url}: ${kt(i).message}`),!1}}async _downloadFontFile(e){let t=await this.requestManager.transformRequest(e,"Glyphs"),i=await R_(t,new AbortController);if(!(i!=null&&i.data))throw Error(`the response was empty for the font file at ${e}`);return i.data}_unregister(e){var t;(t=document.fonts)==null||t.delete(e),this._registered.delete(e)}_unregisterAll(){var e;for(let t of this._registered)(e=document.fonts)==null||e.delete(t);this._registered.clear()}destroy(){this._unregisterAll(),this._faces={}}};const Uc=1e20,dp=new Float64Array(256);for(let e=0;e<256;e++){let t=.5-(e/255)**.45454545454545453;dp[e]=t*Math.abs(t)}dp[255]=-1e20;var bM=class{constructor({fontSize:e=24,buffer:t=3,radius:i=8,cutoff:r=.25,fontFamily:a="sans-serif",fontWeight:n="normal",fontStyle:s="normal",lang:o=null}={}){this.buffer=t,this.radius=i,this.cutoff=r,this.lang=o;let l=this.size=e+t*4,u=this._createCanvas(l),h=this.ctx=u.getContext("2d",{willReadFrequently:!0});h.font=`${s} ${n} ${e}px ${a}`,h.textBaseline="alphabetic",h.textAlign="left",h.fillStyle="black",this.gridOuter=new Float64Array(l*l),this.gridInner=new Float64Array(l*l),this.f=new Float64Array(l),this.z=new Float64Array(l+1),this.v=new Uint16Array(l)}_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:i,actualBoundingBoxDescent:r,actualBoundingBoxLeft:a,actualBoundingBoxRight:n}=this.ctx.measureText(e),s=Math.ceil(i),o=Math.floor(-a),l=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(n)-o)),u=Math.max(0,Math.min(this.size-this.buffer,s+Math.ceil(r))),h=l+2*this.buffer,c=u+2*this.buffer,d=Math.max(h*c,0),p=new Uint8ClampedArray(d),f={data:p,width:h,height:c,glyphWidth:l,glyphHeight:u,glyphTop:s,glyphLeft:o,glyphAdvance:t};if(l===0||u===0)return f;let{ctx:m,buffer:g,gridInner:_,gridOuter:y}=this;this.lang&&(m.lang=this.lang),m.clearRect(g,g,l,u),m.fillText(e,g-o,g+s);let x=m.getImageData(g,g,l,u);y.fill(Uc,0,d),_.fill(0,0,d);let v=3;for(let P=0;P<u;P++){let S=(P+g)*h+g;for(let M=0;M<l;M++,v+=4,S++){let k=x.data[v];if(k===0)continue;let R=dp[k];y[S]=Math.max(0,R),_[S]=Math.max(0,-R)}}fg(y,0,0,h,c,h,this.f,this.v,this.z);let w=Math.min(g,1);fg(_,g-w,g-w,l+2*w,u+2*w,h,this.f,this.v,this.z);let b=255/this.radius,T=255*(1-this.cutoff);for(let P=0;P<d;P++){let S=Math.sqrt(y[P])-Math.sqrt(_[P]);p[P]=Math.round(T-b*S)}return f}};function fg(e,t,i,r,a,n,s,o,l){for(let u=t;u<t+r;u++)mg(e,i*n+u,n,a,s,o,l);for(let u=i;u<i+a;u++)mg(e,u*n+t,1,r,s,o,l)}function mg(e,t,i,r,a,n,s){n[0]=0,s[0]=-1e20,s[1]=Uc,a[0]=e[t];for(let o=1,l=0,u=0;o<r;o++){a[o]=e[t+o*i];let h=o*o;do{let c=n[l];u=(a[o]-a[c]+h-c*c)/(o-c)/2}while(u<=s[l]&&--l>-1);l++,n[l]=o,s[l]=u,s[l+1]=Uc}for(let o=0,l=0;o<r;o++){for(;s[l+1]<o;)l++;let u=n[l],h=o-u;e[t+o*i]=a[u]+h*h}}const wM=z.layout_symbol["text-font"].default.join(","),TM=(e,t)=>{let i=new bM(e);return i.buffer=t,i};var EM=class{constructor(e,t,i,r=TM){this.requestManager=e,this.localIdeographFontFamily=t,this.entries={},this.lang=i,this.fontFaceManager=new xM(e),this.createRasterizer=r}setURL(e){this.url=e}setFontFaces(e){this.fontFaceManager.setFontFaces(e),this.entries={}}async getGlyphs(e){let t=[];for(let a in e)for(let n of e[a])t.push(this._getAndCacheGlyphsPromise(a,n));let i=await Promise.all(t),r={};for(let{stack:a,id:n,glyph:s}of i)r[a]||(r[a]={}),r[a][n]=s&&{id:s.id,bitmap:s.bitmap.clone(),metrics:s.metrics};return r}async _getAndCacheGlyphsPromise(e,t){var s;(s=this.entries)[e]??(s[e]={glyphs:{},requests:{},ranges:{}});let i=this.entries[e],r=i.glyphs[t];if(r!==void 0)return{stack:e,id:t,glyph:r};let a=t.codePointAt(0),n=this.fontFaceManager.hasFontFaces()?await this.fontFaceManager.getFontFamily(e,a):null;return n?(r=i.glyphs[t]=await this._drawGlyph(i,e,t,n),{stack:e,id:t,glyph:r}):!this.url||fl(t)||this._charUsesLocalIdeographFontFamily(a)?(r=i.glyphs[t]=await this._drawGlyph(i,e,t),{stack:e,id:t,glyph:r}):await this._downloadAndCacheRangePromise(e,t)}async _downloadAndCacheRangePromise(e,t){var n;let i=t.codePointAt(0),r=this.entries[e],a=Math.floor(i/256);if(r.ranges[a])return{stack:e,id:t,glyph:null};
8(n=r.requests)[a]||(n[a]=this._loadGlyphRange(e,a));try{let s=await r.requests[a];for(let o in s)r.glyphs[String.fromCodePoint(+o)]=s[+o];return r.ranges[a]=!0,{stack:e,id:t,glyph:s[i]||null}}catch(s){let o=r.glyphs[t]=await this._drawGlyph(r,e,t);return this._warnOnMissingGlyphRange(o,a,i,kt(s)),{stack:e,id:t,glyph:o}}}async _loadGlyphRange(e,t){let i=t*256,r=i+255,a=await this.requestManager.transformRequest(this.url.replace("{fontstack}",e).replace("{range}",`${i}-${r}`),"Glyphs"),n=await R_(a,new AbortController);if(!(n!=null&&n.data))throw Error(`Could not load glyph range. range: ${t}, ${i}-${r}`);let s={};for(let o of aC(n.data))s[o.id]=o;return s}_warnOnMissingGlyphRange(e,t,i,r){let a=t*256,n=a+255,s=i.toString(16).padStart(4,"0").toUpperCase();xe(`Unable to load glyph range ${t}, ${a}-${n}. Rendering codepoint U+${s} locally instead. ${r}`)}_charUsesLocalIdeographFontFamily(e){return!!this.localIdeographFontFamily&&lD(e)}async _drawGlyph(e,t,i,r){let a=(await this._getTinySDF(e,t,i,r)).draw(i),n=new RegExp("^\\p{gc=Cf}+$","u").test(i);return{id:i.codePointAt(0),bitmap:new Nd({width:a.width||60,height:a.height||60},a.data),metrics:{width:n?0:a.glyphWidth/2||24,height:a.glyphHeight/2||24,left:a.glyphLeft/2+.5||0,top:a.glyphTop/2-27.5||-8,advance:n?0:a.glyphAdvance/2||24,isDoubleResolution:!0}}}_getTinySDF(e,t,i,r){var l,u;let a=fl(i);if(r){let h=a?"clusterTinySDFs":"fontFaceTinySDFs";return e[h]??(e[h]={}),(l=e[h])[r]||(l[r]=this._createTinySDF(r,!1,a?3:1)),e[h][r]}let n=t===wM&&this.localIdeographFontFamily!==""&&this._charUsesLocalIdeographFontFamily(i.codePointAt(0)),s=n?this.localIdeographFontFamily:t;if(a)return e.clusterTinySDFs??(e.clusterTinySDFs={}),(u=e.clusterTinySDFs)[s]||(u[s]=this._createTinySDF(s,!0,3)),e.clusterTinySDFs[s];let o=n?"ideographTinySDF":"tinySDF";return e[o]||(e[o]=this._createTinySDF(s)),e[o]}async _createTinySDF(e,t=!0,i=1){var o;let r=e?e.split(","):[];r.push("sans-serif");let a=r.map(l=>/[-\w]+/.test(l)?l:`'${CSS.escape(l)}'`).join(","),n=t?this._fontWeight(r[0]):void 0,s=t?this._fontStyle(r[0]):"normal";if(typeof document<"u"&&((o=document.fonts)!=null&&o.load))try{await document.fonts.load(`${s} ${n||"normal"} 48px ${a}`)}catch(l){xe(`Failed to load font "${a}": ${kt(l).message}`)}return this.createRasterizer({fontSize:48,buffer:Math.max(6,Math.ceil(48*(i-1)/4)),radius:16,cutoff:.25,fontFamily:a,fontWeight:n,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},i;for(let[r,a]of Object.entries(t))RegExp(`\\b${r}\\b`,"i").test(e)&&(i=`${a}`);return i}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 SM;const DM=()=>SM||(SM=new Dt({anchor:new N(z.light.anchor,"anchor"),position:new N(z.light.position,"position"),color:new N(z.light.color,"color"),intensity:new N(z.light.intensity,"intensity")}));var CM=class extends _t{constructor(e,t){super(),this._transitionable=new Zl(DM(),"light",t),this.setLight(e),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}getCartesianPosition(){return aw(this.properties.get("position"))}setLight(e,t={}){this._validate(Jt.light,e,t)||this._transitionable.setValues(e)}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}_validate(e,t,i){return Is(this,e,{value:t},i)}};let PM;const AM=()=>PM||(PM=new Dt({"sky-color":new N(z.sky["sky-color"],"sky-color"),"horizon-color":new N(z.sky["horizon-color"],"horizon-color"),"fog-color":new N(z.sky["fog-color"],"fog-color"),"fog-ground-blend":ne
vendor: 14,141 bytes, line 8
8w N(z.sky["fog-ground-blend"],"fog-ground-blend"),"horizon-fog-blend":new N(z.sky["horizon-fog-blend"],"horizon-fog-blend"),"sky-horizon-blend":new N(z.sky["sky-horizon-blend"],"sky-horizon-blend"),"atmosphere-blend":new N(z.sky["atmosphere-blend"],"atmosphere-blend")}));var IM=class extends _t{constructor(e,t){super(),this._transitionable=new Zl(AM(),"sky",t),this.setSky(e),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new Be(0))}setSky(e,t={}){this._validate(Jt.sky,e,t)||(e||(e={"sky-color":"transparent","horizon-color":"transparent","fog-color":"transparent","fog-ground-blend":1,"atmosphere-blend":0}),this._transitionable.setValues(e))}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,i={}){return Is(this,e,{value:t},i)}calculateFogBlendOpacity(e){return e<60?0:e<70?(e-60)/10:1}},MM=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){var r;let i=e.join(",")+String(t);return(r=this.dashEntry)[i]||(r[i]=this.addDash(e,t)),this.dashEntry[i]}getDashRanges(e,t,i){let r=e.length%2==1,a=[],n=r?-e[e.length-1]*i:0,s=e[0]*i,o=!0;a.push({left:n,right:s,isDash:o,zeroLength:e[0]===0});let l=e[0];for(let u=1;u<e.length;u++){o=!o;let h=e[u];n=l*i,l+=h,s=l*i,a.push({left:n,right:s,isDash:o,zeroLength:h===0})}return a}addRoundDash(e,t,i){let r=t/2;for(let a=-i;a<=i;a++){let n=this.nextRow+i+a,s=this.width*n,o=0,l=e[o];for(let u=0;u<this.width;u++){u/l.right>1&&(l=e[++o]);let h=Math.abs(u-l.left),c=Math.abs(u-l.right),d=Math.min(h,c),p,f=a/i*(r+1);if(l.isDash){let m=r-Math.abs(f);p=Math.sqrt(d*d+m*m)}else p=r-Math.sqrt(d*d+f*f);this.data[s+u]=Math.max(0,Math.min(255,p+128))}}}addRegularDash(e){for(let s=e.length-1;s>=0;--s){let o=e[s],l=e[s+1];o.zeroLength?e.splice(s,1):(l==null?void 0:l.isDash)===o.isDash&&(l.left=o.left,e.splice(s,1))}let t=e[0],i=e[e.length-1];t.isDash===i.isDash&&(t.left=i.left-this.width,i.right=t.right+this.width);let r=this.width*this.nextRow,a=0,n=e[a];for(let s=0;s<this.width;s++){s/n.right>1&&(n=e[++a]);let o=Math.abs(s-n.left),l=Math.abs(s-n.right),u=Math.min(o,l),h=n.isDash?u:-u;this.data[r+s]=Math.max(0,Math.min(255,h+128))}}addDash(e,t){let i=t?7:0,r=2*i+1;if(this.nextRow+r>this.height)return xe("LineAtlas out of space"),null;let a=0;for(let s of e)a+=s;if(a!==0){let s=this.width/a,o=this.getDashRanges(e,this.width,s);t?this.addRoundDash(o,s,i):this.addRegularDash(o)}let n={y:this.nextRow+i,height:2*i,width:a};return this.nextRow+=r,this.dirty=!0,n}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 FM(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 zM(){let e=import.meta.url;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 ah(e,t){if(t)try{return new Worker(e,{type:"module"})}catch(i){console.warn("Module worker not supported, falling back to classic worker",i)}return new Worker(e)}async function RM(e){let t=await fetch(e);if(!t.ok)throw Error(`Failed to fetch worker script (${t.status}): ${e}`);let i=await t.text(),r=new Blob([i],{type:"text/javascript"});return URL.createObjectURL(r)}function kM(e){let t=new Blob([`import ${JSON.stringify(new URL(e,import.meta.url).href)}`],{type:"text/javascript"});return URL.createObjectURL(t)}async function LM(){let e=ti.WORKER_URL||zM(),t=!(e!=null&&e.endsWith(".cjs"));if(!FM(e))return ah(e,t);if(t){let r=kM(e);try{return ah(r,t)}finally{URL.revokeObjectURL(r)}}let i=await RM(e);try{return ah(i,t)}finally{URL.revokeObjectURL(i)}}const pp="maplibre_preloaded_worker_pool";var au=class sv{constructor(){this.active={},this.workersPromise=null}async acquire(t){if(this.active[t]=!0,!this.workersPromise){let i=[];for(;i.length<sv.workerCount;)i.push(LM());this.workersPromise=Promise.all(i)}return(await this.workersPromise).slice()}release(t){if(delete this.active[t],this.numActive()===0&&this.workersPromise){let i=this.workersPromise;this.workersPromise=null,i.then(r=>{for(let a of r)a.terminate()})}}isPreloaded(){return!!this.active[pp]}numActive(){return Object.keys(this.active).length}};const BM=Math.floor(qt.hardwareConcurrency/2);au.workerCount=sw(globalThis)?Math.max(Math.min(BM,3),1):1;let bl;function fp(){return bl||(bl=new au),bl}function OM(){fp().acquire(pp)}function $M(){let e=bl;e&&(e.isPreloaded()&&e.numActive()===1?(e.release(pp),bl=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 ov=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((i,r)=>{let a=new lP(i,e);return a.name=`Worker ${r}`,a}),!this.actors.length)throw Error("No actors found");return this.actors}async broadcast(e,t){let i=await this.actorsPromise;return Promise.all(i.map(r=>r.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 t of this.actors)t.remove();this.actors=[],e&&this.workerPool.release(this.id)}async registerMessageHandler(e,t){let i=await this.actorsPromise;for(let r of i)r.registerMessageHandler(e,t)}async unregisterMessageHandler(e){let t=await this.actorsPromise;for(let i of t)i.unregisterMessageHandler(e)}};let wo;function mp(){return wo||(wo=new ov(fp(),Ph),wo.registerMessageHandler("GR",(e,t,i)=>Pl(t,i))),wo}function jM(e,t){let i=kr();return ct(i,i,[1,1,0]),At(i,i,[e.width*.5,e.height*.5,1]),e.calculatePosMatrix?Ma(i,i,e.calculatePosMatrix(t.toUnwrapped())):i}function VM(e,t,i){if(e)for(let r of e){let a=t[r];if((a==null?void 0:a.source)===i&&a.type==="fill-extrusion")return!0}else for(let r in t){let a=t[r];if(a.source===i&&a.type==="fill-extrusion")return!0}return!1}function NM(e,t,i,r,a,n,s){let o=VM((a==null?void 0:a.layers)??null,t,e.id),l=n.maxPitchScaleFactor(),u=e.tilesIn(r,l,o);u.sort(lv);let h=[];for(let c of u)h.push({wrappedTileID:c.tileID.wrapped().key,queryResults:c.tile.queryRenderedFeatures(t,i,e.getState(),c.queryGeometry,c.cameraQueryGeometry,c.scale,a,n,l,jM(n,c.tileID),s?(d,p)=>s(c.tileID,d,p):void 0)});return qM(ZM(h),e)}function UM(e,t,i,r,a,n,s){let o={},l=n.queryRenderedSymbols(r),u=[];for(let h of Object.keys(l).map(Number))u.push(s[h]);u.sort(lv);for(let h of u){let c=h.featureIndex.lookupSymbolFeatures(l[h.bucketInstanceId],t,h.bucketIndex,h.sourceLayerIndex,{filterSpec:a.filter,globalState:a.globalState},a.layers,a.availableImages,e);for(let d in c){o[d]||(o[d]=[]);let p=c[d];p.sort((f,m)=>{let g=h.featureSortOrder;if(g){let _=g.indexOf(f.featureIndex);return g.indexOf(m.featureIndex)-_}return m.featureIndex-f.featureIndex});for(let f of p)o[d].push(f)}}return WM(o,e,i)}function GM(e,t){let i=e.getRenderableIds().map(n=>e.getTileByID(n)),r=[],a={};for(let n of i){let s=n.tileID.canonical.key;a[s]||(a[s]=!0,n.querySourceFeatures(r,t))}return r}function lv(e,t){let i=e.tileID,r=t.tileID;return i.overscaledZ-r.overscaledZ||i.canonical.y-r.canonical.y||i.wrap-r.wrap||i.canonical.x-r.canonical.x}function ZM(e){let t={},i={};for(let{queryResults:r,wrappedTileID:a}of e){i[a]||(i[a]={});let n=i[a];for(let s in r){let o=r[s];n[s]||(n[s]={});let l=n[s];t[s]||(t[s]=[]);for(let u of o)l[u.featureIndex]||(l[u.featureIndex]=!0,t[s].push(u))}}return t}function qM(e,t){for(let i in e)for(let r of e[i])uv(r,t);return e}function WM(e,t,i){for(let r in e)for(let a of e[r]){let n=i[t[r].source];uv(a,n)}return e}function uv(e,t){let i=e.feature,r=t.getFeatureState(i.layer["source-layer"],i.id);i.source=i.layer.source,i.layer["source-layer"]&&(i.sourceLayer=i.layer["source-layer"]),i.state=r}async function hv(e,t,i,r){let a=e;if(e.url?a=(await Al(await t.transformRequest(e.url,"Source"),i)).data:await qt.frameAsync(i,r),!a)return null;let n=ws(W(a,e),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);return"vector_layers"in a&&a.vector_layers&&(n.vectorLayerIds=a.vector_layers.map(s=>s.id)),n}var ki=class nr{constructor(t,i){t&&(i?this.setSouthWest(t).setNorthEast(i):Array.isArray(t)&&(t.length===4?this.setSouthWest([t[0],t[1]]).setNorthEast([t[2],t[3]]):this.setSouthWest(t[0]).setNorthEast(t[1])))}setNorthEast(t){return this._ne=t instanceof X?new X(t.lng,t.lat):X.convert(t),this}setSouthWest(t){return this._sw=t instanceof X?new X(t.lng,t.lat):X.convert(t),this}extend(t){let i=this._sw,r=this._ne,a,n;if(t instanceof X)a=t,n=t;else if(t instanceof nr){if(a=t._sw,n=t._ne,!a||!n)return this}else{if(Array.isArray(t)){if(t.length===4||t.every(Array.isArray)){let s=t;return this.extend(nr.convert(s))}{let s=t;return this.extend(X.convert(s))}}return t&&("lng"in t||"lon"in t)&&"lat"in t?this.extend(X.convert(t)):this}return!i&&!r?(this._sw=new X(a.lng,a.lat),this._ne=new X(n.lng,n.lat)):(i.lng=Math.min(a.lng,i.lng),i.lat=Math.min(a.lat,i.lat),r.lng=Math.max(n.lng,r.lng),r.lat=Math.max(n.lat,r.lat)),this}getCenter(){return new X((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 X(this.getWest(),this.getNorth())}getSouthEast(){return new X(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(t){let{lng:i,lat:r}=X.convert(t),a=this._sw.lat<=r&&r<=this._ne.lat,n=this._sw.lng<=i&&i<=this._ne.lng;return this._sw.lng>this._ne.lng&&(n=this._sw.lng>=i&&i>=this._ne.lng),a&&n}intersects(t){if(t=nr.convert(t),!(t.getNorth()>=this.getSouth()&&t.getSouth()<=this.getNorth()))return!1;let i=Math.abs(this.getEast()-this.getWest()),r=Math.abs(t.getEast()-t.getWest());if(i>=360||r>=360)return!0;let a=bi(this.getWest(),-180,180),n=bi(this.getEast(),-180,180),s=bi(t.getWest(),-180,180),o=bi(t.getEast(),-180,180),l=a>n,u=s>o;return l&&u?!0:l?o>=a||s<=n:u?n>=s||a<=o:s<=n&&o>=a}static convert(t){return t instanceof nr||!t?t:new nr(t)}static fromLngLat(t,i=0){let r=360*i/40075017,a=r/Math.cos(Math.PI/180*t.lat);return new nr(new X(t.lng-a,t.lat-r),new X(t.lng+a,t.lat+r))}adjustAntiMeridian(){let t=new X(this._sw.lng,this._sw.lat),i=new X(this._ne.lng,this._ne.lat);return t.lng>i.lng?new nr(t,new X(i.lng+360,i.lat)):new nr(t,i)}},cv=class{constructor(e,t,i){this.bounds=ki.convert(this.validateBounds(e)),this.minzoom=t||0,this.maxzoom=i||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,i={minX:Math.floor(nn(this.bounds.getWest())*t),minY:Math.floor(sn(this.bounds.getNorth())*t),maxX:Math.ceil(nn(this.bounds.getEast())*t),maxY:Math.ceil(sn(this.bounds.getSouth())*t)};return e.x>=i.minX&&e.x<i.maxX&&e.y>=i.minY&&e.y<i.maxY}},dv=class extends _t{constructor(e,t,i,r){if(super(),this.id=e,this.dispatcher=i,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,W(this,ws(t,["url","scheme","tileSize","promoteId","encoding"])),this._options=W({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 qe("dataloading")),this._tileJSONRequest=new AbortController;try{let t=await hv(this._options,this.map._requestManager,this._tileJSONRequest,this.map._ownerWindow);this._tileJSONRequest=null,this._loaded=!0,t&&(W(this,t),t.bounds&&(this.tileBounds=new cv(t.bounds,this.minzoom,this.maxzoom)),this.fire(new qe("data",{sourceDataType:"metadata"})),this.fire(new qe("data",{sourceDataType:"content",sourceDataChanged:e})))}catch(t){this._tileJSONRequest=null,this._loaded=!0,Fr(t)||this.fire(new Q(kt(t)))}}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=(this._tileJSONRequest.abort(),null))}serialize(){return W({},this._options)}async loadTile(e){let t=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),i={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.t
8ype,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};i.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((a,n)=>{e.reloadPromise={resolve:a,reject:n}});e.abortController=new AbortController;try{let a=await e.actor.sendAsync({type:r,data:i},e.abortController);if(delete e.abortController,e.aborted)return;this._afterTileLoadWorkerResponse(e,a);let n={};return a!=null&&a.etagUnmodified&&(n.unmodified=!0),n}catch(a){if(delete e.abortController,e.aborted||Fr(a))return;if(a&&a.status!==404)throw a;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,i=t.url(this.tiles,this.map.getPixelRatio(),this.scheme);return{maxZoomTileID:t,overzoomRequest:await this.map._requestManager.transformRequest(i,"Tile")}}_afterTileLoadWorkerResponse(e,t){if(t!=null&&t.resourceTiming&&(e.resourceTiming=t.resourceTiming),t&&this.map._refreshExpiredTiles&&e.setExpiryData(t),e.etag=t==null?void 0:t.etag,e.loadVectorData(t,this.map.painter),e.reloadPromise){let i=e.reloadPromise;e.reloadPromise=null,this.loadTile(e).then(i.resolve).catch(i.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.t
vendor: 29,523 bytes, line 8
8ype,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}},gp=class extends _t{constructor(e,t,i,r){super(),this.id=e,this.dispatcher=i,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=W({type:"raster"},t),W(this,ws(t,["url","scheme","tileSize"]))}async load(e=!1){this._loaded=!1,this.fire(new qe("dataloading")),this._tileJSONRequest=new AbortController;try{let t=await hv(this._options,this.map._requestManager,this._tileJSONRequest,this.map._ownerWindow);this._tileJSONRequest=null,this._loaded=!0,t&&(W(this,t),t.bounds&&(this.tileBounds=new cv(t.bounds,this.minzoom,this.maxzoom)),this.fire(new qe("data",{sourceDataType:"metadata"})),this.fire(new qe("data",{sourceDataType:"content",sourceDataChanged:e})))}catch(t){this._tileJSONRequest=null,this._loaded=!0,Fr(t)||this.fire(new Q(kt(t)))}}loaded(){return this._loaded}onAdd(e){this.map=e,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest=(this._tileJSONRequest.abort(),null))}setSourceProperty(e){this._tileJSONRequest&&(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 W({},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),i=this._premultiplyAlpha,r=i?void 0:{premultiplyAlpha:"none"};e.abortController=new AbortController;try{let a=await Hi.transformAndGetImage(this.map._requestManager,t,"Tile",e.abortController,this.map._refreshExpiredTiles,r);if(delete e.abortController,e.aborted){e.state="unloaded";return}if(a){this.map._refreshExpiredTiles&&(a.cacheControl||a.expires)&&e.setExpiryData({cacheControl:a.cacheControl,expires:a.expires});let n=this.map.painter.context,s=n.gl,o=a.data??new Ze({width:1,height:1},new Uint8Array(4));e.texture=this.map.painter.getTileTexture(o.width),e.texture?e.texture.update(o,{useMipmap:!0,premultiply:i}):(e.texture=new gt(n,o,s.RGBA,{useMipmap:!0,premultiply:i}),e.texture.bind(s.LINEAR,s.CLAMP_TO_EDGE,s.LINEAR_MIPMAP_NEAREST)),e.state="loaded"}}catch(a){if(delete e.abortController,e.aborted)e.state="unloaded";else if(a)throw e.state="errored",a}}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}},pv=class extends gp{constructor(e,t,i,r){super(e,t,i,r),this.type="raster-dem",this.maxzoom=22,this._options=W({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 i=await Hi.transformAndGetImage(this.map._requestManager,t,"Tile",e.abortController,this.map._refreshExpiredTiles,{colorSpaceConversion:"none"});if(delete e.abortController,e.aborted){e.state="unloaded";return}if(i){if(this.map._refreshExpiredTiles&&(i.cacheControl||i.expires)&&e.setExpiryData({cacheControl:i.cacheControl,expires:i.expires}),!i.data){e.state="loaded";return}let r=i.data,a=Qr(r)&&hd()?r:await this.readImageNow(r),n={type:this.type,uid:e.uid,source:this.id,rawImageData:a,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:n}),e.needsHillshadePrepare=!0,e.needsTerrainPrepare=!0,e.needsColorReliefPrepare=!0,e.state="loaded"}}catch(i){if(delete e.abortController,e.aborted)e.state="unloaded";else if(i)throw e.state="errored",i}}async readImageNow(e){if(typeof VideoFrame<"u"&&w_()){let t=e.width+4,i=e.height+4;try{return new Ze({width:t,height:i},await hw(e,-2,-2,t,i))}catch{}}return qt.getImageData(e,2)}_getNeighboringTiles(e){let t=e.canonical,i=2**t.z,r=(t.x-1+i)%i,a=t.x===0?e.wrap-1:e.wrap,n=(t.x+1+i)%i,s=t.x+1===i?e.wrap+1:e.wrap,o={};return o[new Pt(e.overscaledZ,a,t.z,r,t.y).key]={backfilled:!1},o[new Pt(e.overscaledZ,s,t.z,n,t.y).key]={backfilled:!1},t.y>0&&(o[new Pt(e.overscaledZ,a,t.z,r,t.y-1).key]={backfilled:!1},o[new Pt(e.overscaledZ,e.wrap,t.z,t.x,t.y-1).key]={backfilled:!1},o[new Pt(e.overscaledZ,s,t.z,n,t.y-1).key]={backfilled:!1}),t.y+1<i&&(o[new Pt(e.overscaledZ,a,t.z,r,t.y+1).key]={backfilled:!1},o[new Pt(e.overscaledZ,e.wrap,t.z,t.x,t.y+1).key]={backfilled:!1},o[new Pt(e.overscaledZ,s,t.z,n,t.y+1).key]={backfilled:!1}),o}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 Gc(e,t){return t?e.properties[t]:e.id}function HM(e,t){let i=new Map;if(e==null||e.type==null)return i;if(e.type==="Feature"){let r=Gc(e,t);return r==null?void 0:(i.set(r,e),i)}if(e.type==="FeatureCollection"){let r=new Set;for(let a of e.features){let n=Gc(a,t);if(n==null||r.has(n))return;r.add(n),i.set(n,a)}return i}}function XM(e,t,i){var a,n;let r=[];if(t.removeAll)e.clear();else if(t.remove)for(let s of t.remove){let o=e.get(s);o&&(r.push(o.geometry),e.delete(s))}if(t.add)for(let s of t.add){let o=Gc(s,i);if(o==null)continue;let l=e.get(o);l&&r.push(l.geometry),r.push(s.geometry),e.set(o,s)}if(t.update)for(let s of t.update){let o=e.get(s.id);if(!o)continue;let l=!!s.newGeometry,u=s.removeAllProperties||((a=s.removeProperties)==null?void 0:a.length)>0||((n=s.addOrUpdateProperties)==null?void 0:n.length)>0;if(!l&&!u)continue;r.push(o.geometry);let h={...o};if(e.set(s.id,h),l&&(r.push(s.newGeometry),h.geometry=s.newGeometry),u){if(h.properties=s.removeAllProperties?{}:{...h.properties||{}},s.removeProperties)for(let c of s.removeProperties)delete h.properties[c];if(s.addOrUpdateProperties)for(let{key:c,value:d}of s.addOrUpdateProperties)h.properties[c]=d}}return r}function YM(e,t,i){if(!e)return t||{};if(!t)return e||{};let r=gg(e),a=gg(t);KM(r,a);let n={};if((r.removeAll||a.removeAll)&&(n.removeAll=!0),n.remove=new Set([...r.remove,...a.remove]),n.add=new Map([...r.add,...a.add]),n.update=new Map([...r.update,...a.update]),n.remove.size&&n.add.size)for(let o of n.add.keys())n.remove.delete(o);return QM(n)}function KM(e,t){t.removeAll&&(e.add.clear(),e.update.clear(),e.remove.clear(),t.remove.clear());for(let i of t.remove)e.add.delete(i),e.update.delete(i);for(let[i,r]of t.update){let a=e.update.get(i);a&&(t.update.set(i,JM(a,r)),e.update.delete(i))}}function JM(e,t){let i={id:e.id};if(t.removeAllProperties&&(delete e.removeProperties,delete e.addOrUpdateProperties,delete t.removeProperties),t.removeProperties&&e.addOrUpdateProperties){let r=new Set(t.removeProperties);e.addOrUpdateProperties=e.addOrUpdateProperties.filter(a=>!r.has(a.key))}return(e.removeAllProperties||t.removeAllProperties)&&(i.removeAllProperties=!0),(e.removeProperties||t.removeProperties)&&(i.removeProperties=[...e.removeProperties||[],...t.removeProperties||[]]),(e.addOrUpdateProperties||t.addOrUpdateProperties)&&(i.addOrUpdateProperties=[...e.addOrUpdateProperties||[],...t.addOrUpdateProperties||[]]),(e.newGeometry||t.newGeometry)&&(i.newGeometry=t.newGeometry||e.newGeometry),i}function gg(e){var i,r;if(!e)return{};let t={};return t.removeAll=e.removeAll,t.remove=new Set(e.remove||[]),t.add=new Map((i=e.add)==null?void 0:i.map(a=>[a.id,a])),t.update=new Map((r=e.update)==null?void 0:r.map(a=>[a.id,a])),t}function QM(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 fv(e){return!e||e.length===0?[]:typeof e[0]=="number"?[e]:e.flatMap(t=>fv(t))}function qo(e){return e.type==="GeometryCollection"?e.geometries.flatMap(t=>qo(t)):fv(e.coordinates)}function _g(e){let t=new ki,i;switch(e.type){case"FeatureCollection":i=e.features.flatMap(r=>qo(r.geometry));break;case"Feature":i=qo(e.geometry);break;default:i=qo(e)}if(i.length===0)return t;for(let r of i){let[a,n]=r;t.extend([a,n])}return t}function e3({x:e,y:t,z:i},r=0){let a=Sc((e-r)/2**i),n=vs((t+1+r)/2**i),s=Sc((e+1+r)/2**i),o=vs((t-r)/2**i);return new ki([a,n],[s,o])}var mv=class extends _t{constructor(e,t,i,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=i.getActor(),this.setEventedParent(r),this._data=typeof t.data=="string"?{url:t.data}:{geojson:t.data},this._options=W({},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&&xe(`The maxzoom value "${this.maxzoom}" is expected to be greater than the clusterMaxZoom value "${t.clusterMaxZoom}".`),this.workerOptions=W({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:L,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:L,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*(L/this.tileSize)}_tileUnitsToPixels(e){return e/(L/this.tileSize)}_getClusterMaxZoom(e){let t=e?Math.round(e):this.maxzoom-1;return Number.isInteger(e)||e===void 0||xe(`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=YM(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 _g(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,i){return(await this.actorPromise).sendAsync({type:"GCL",data:{type:this.type,source:this.id,clusterId:e,limit:t,offset:i}})}async _updateWorkerData(){if(this._isUpdatingWorker)return this._updatePromise;if(!this._hasPendingWorkerUpdate()){xe(`No pending worker updates for GeoJSONSource ${this.id}.`);return}let{data:e,diff:t,updateCluster:i}=this._pendingWorkerUpdate,r=this._getLoadGeoJSONParameters(e,t,i);e===void 0?t?this._pendingWorkerUpdate.diff=void 0:i&&(this._pendingWorkerUpdate.updateCluster=void 0):this._pendingWorkerUpdate.data=void 0,this._updatePromise=this._dispatchWorkerUpdate(r),await this._updatePromise}async _getLoadGeoJSONParameters(e,t,i){let r=W({type:this.type,source:this.id},this.workerOptions);if(typeof e=="string")return r.request=await this.map._requestManager.transformRequest(qt.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(i)return r.updateCluster=!0,r}async _dispatchWorkerUpdate(e){this._isUpdatingWorker=!0,this.fire(new qe("dataloading"));try{let t=await e,i=await(await this.actorPromise).sendAsync({type:"LD",data:t});if(this._isUpdatingWorker=!1,this._removed||i.abandoned){this.fire(new qe("dataabort"));return}i.data&&(this._data={geojson:i.data});let r=this._applyDiffToSource(t.dataDiff),a=this._getShouldReloadTileOptions(r),n={};this._applyResourceTiming(n,i),this.fire(new qe("data",{...n,sourceDataType:"metadata"})),this.fire(new qe("data",{...n,sourceDataType:"content",shouldReloadTileOptions:a}))}catch(t){if(this._isUpdatingWorker=!1,this._removed){this.fire(new qe("dataabort"));return}this.fire(new Q(kt(t)))}finally{this._hasPendingWorkerUpdate()&&await this._updateWorkerData()}}_applyResourceTiming(e,t){var a;if(!this._collectResourceTiming)return;let i=(a=t.resourceTiming)==null?void 0:a[this.id];if(!i)return;let r=i.slice(0);r!=null&&r.length&&W(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 r=HM(this._data.geojson,t);if(!r)throw Error(`GeoJSONSource "${this.id}": GeoJSON data is not compatible with updateData`);this._data={updateable:r}}if(!this._data.updateable)return;let i=XM(this._data.updateable,e,t);if(!(e.removeAll||this._options.cluster))return i}_getShouldReloadTileOptions(e){if(e)return{affectedBounds:e.filter(Boolean).map(t=>_g(t))}}shouldReloadTile(e,{affectedBounds:t}){if(e.state==="loading")return!0;if(e.state==="unloaded")return!1;let{buffer:i,extent:r}=this.workerOptions.geojsonVtOptions,a=e3(e.tileID.canonical,i/r);for(let n of t)if(a.intersects(n))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 i={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:i},e.abortController);delete e.abortController,e.unloadVectorData(),e.aborted||e.loadVectorData(r,this.map.painter,t==="RT")}catch(r){if(delete e.abortController,e.aborted||Fr(r))return;throw r}}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 W({},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 qa=[0,0,1],t3=(e,t)=>({u_tl_parent:new _e(e,t.u_tl_parent),u_scale_parent:new U(e,t.u_scale_parent),u_buffer_scale:new U(e,t.u_buffer_scale),u_image_warp:new Zt(e,t.u_image_warp),u_fade_t:new U(e,t.u_fade_t),u_opacity:new U(e,t.u_opacity),u_image0:new K(e,t.u_image0),u_image1:new K(e,t.u_image1),u_brightness_low:new U(e,t.u_brightness_low),u_brightness_high:new U(e,t.u_brightness_high),u_saturation_factor:new U(e,t.u_saturation_factor),u_contrast_factor:new U(e,t.u_contrast_factor),u_spin_weights:new Zt(e,t.u_spin_weights),u_coords_top:new fs(e,t.u_coords_top),u_coords_bottom:new fs(e,t.u_coords_bottom)}),i3=(e,t,i,r,a,n)=>({u_tl_parent:e,u_scale_parent:t,u_buffer_scale:1,u_image_warp:n,u_fade_t:i.mix,u_opacity:i.opacity*r.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:r.paint.get("raster-brightness-min"),u_brightness_high:r.paint.get("raster-brightness-max"),u_saturation_factor:n3(r.paint.get("raster-saturation")),u_contrast_factor:a3(r.paint.get("raster-contrast")),u_spin_weights:r3(r.paint.get("raster-hue-rotate")),u_coords_top:[a[0].x,a[0].y,a[1].x,a[1].y],u_coords_bottom:[a[3].x,a[3].y,a[2].x,a[2].y]});function r3(e){e*=Math.PI/180;let t=Math.sin(e),i=Math.cos(e);return[(2*i+1)/3,(-Math.sqrt(3)*t-i+1)/3,(Math.sqrt(3)*t-i+1)/3]}function a3(e){return e>0?1/(1-e):1+e}function n3(e){return e>0?1-1/(1.001-e):-e}var ks=class{constructor(e,t,i){this.vertexBuffer=e,this.indexBuffer=t,this.segments=i}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.vertexBuffer=null,this.indexBuffer=null,this.segments=null}};const Jr=tt([{name:"a_pos",type:"Int16",components:2}]),To=L/128;function gv(e,t){let i=_v(t,"16bit"),r=Pr.deserialize({arrayBuffer:i.vertices,length:i.vertices.byteLength/2/2}),a=er.deserialize({arrayBuffer:i.indices,length:i.indices.byteLength/2/3});return new ks(e.createVertexBuffer(r,Jr.members),e.createIndexBuffer(a),Ke.simpleSegment(0,0,r.length,a.length))}function _v(e,t){let i=e.granularity===void 0?1:Math.max(e.granularity,1),r=i+(e.generateBorders?2:0),a=i+(e.extendToNorthPole||e.generateBorders?1:0)+(e.extendToSouthPole||e.generateBorders?1:0),n=r+1,s=a+1,o=e.generateBorders?-1:0,l=e.generateBorders||e.extendToNorthPole?-1:0,u=i+ +!!e.generateBorders,h=i+(e.generateBorders||e.extendToSouthPole?1:0),c=n*s,d=r*a*6,p=n*s>65536;if(p&&t==="16bit")throw Error("Granularity is too large and meshes would not fit inside 16 bit vertex indices.");let f=p||t==="32bit",m=new Int16Array(c*2),g=0;for(let x=l;x<=h;x++)for(let v=o;v<=u;v++){let w=v/i*L;v===-1&&(w=-To),v===i+1&&(w=L+To);let b=x/i*L;x===-1&&(b=e.extendToNorthPole?Kn:-To),x===i+1&&(b=e.extendToSouthPole?Jn:L+To),m[g++]=w,m[g++]=b}let _=f?new Uint32Array(d):new Uint16Array(d),y=0;for(let x=0;x<a;x++)for(let v=0;v<r;v++){let w=v+x*n,b=v+1+x*n,T=v+(x+1)*n,P=v+1+(x+1)*n;_[y++]=w,_[y++]=T,_[y++]=b,_[y++]=b,_[y++]=T,_[y++]=P}return{vertices:m.buffer.slice(0),indices:_.buffer.slice(0),uses32bitIndices:f}}var dn=class extends _t{constructor(e,t,i,r){super(),this.imageWarp=qa,this.flippedWindingOrder=!1,this._warp="auto",this._imageDirty=!1,this._subdividedQuad=!1,this._subdividedMesh=null,this.id=e,this.dispatcher=i,this.coordinates=t.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.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 qe("dataloading")),this.url=this.options.url,this._abortController=new AbortController;try{let t=await Hi.transformAndGetImage(this.map._requestManager,this.url,"Image",this._abortController);this._abortController=null,this._loaded=!0,t!=null&&t.data?(this._setImage(t.data),e&&(this.coordinates=e),this._finishLoading()):this.fire(new Q(Error(`Could not load image ${this.url}: the response is empty`)))}catch(t){if(Fr(t))return;this._abortController=null,this._loaded=!0,this.fire(new Q(kt(t)))}}loaded(){return this._loaded}updateImage(e){return this._abortController&&(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??(this._subdividedMesh=gv(e,{granularity:16})),this._subdividedMesh)}_disposeTexture(){var e;(e=this.texture)==null||e.destroy(),this.texture=null}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new qe("data",{sourceDataType:"metadata"})))}onAdd(e){this.map=e,this.load()}onRemove(){var e;this._abortController&&(this._abortController=(this._abortController.abort(),null)),this._disposeTexture(),(e=this._subdividedMesh)==null||e.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(Me.fromLngLat);return this.tileID=s3(t),this.terrainTileRanges=this._getOverlappingTileRanges(t),this.minzoom=this.maxzoom=this.tileID.z,this.tileCoords=t.map(i=>this.tileID.getTilePoint(i)._round()),this.imageWarp=l3(this.tileCoords,this._warp),this._subdividedQuad=this.imageWarp[2]>0&&!yv(this.tileCoords),this.flippedWindingOrder=o3(this.tileCoords),this.fire(new qe("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 gt(e,this.image,t.RGBA),this.texture.bind(t.LINEAR,t.CLAMP_TO_EDGE)),this._imageDirty=!1;let i=!1;for(let r in this.tiles){let a=this.tiles[r];a.state!=="loaded"&&(a.state="loaded",a.texture=this.texture,i=!0)}i&&this.fire(new qe("data",{sourceDataType:"idle",sourceId:this.id}))}async loadTile(e){var t;(t=this.tileID)!=null&&t.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:i,maxX:r,maxY:a}=Mi.fromPoints(e),n={};for(let s=0;s<=25;s++){let o=2**s,l=Math.floor(t*o),u=Math.floor(i*o),h=Math.floor(r*o),c=Math.floor(a*o),d=(l%o+o)%o,p=h%o,f=Math.floor(l/o),m=Math.floor(h/o);n[s]={minWrap:f,maxWrap:m,minTileXWrapped:d,maxTileXWrapped:p,minTileY:u,maxTileY:c}}return n}};function s3(e){let t=Mi.fromPoints(e),i=t.width(),r=t.height(),a=Math.max(0,Math.floor(-Math.log(Math.max(i,r))/Math.LN2)),n=2**a;return new eu(a,Math.floor((t.minX+t.maxX)/2*n),Math.floor((t.minY+t.maxY)/2*n))}function o3(e){let t=e[1].x-e[0].x,i=e[1].y-e[0].y,r=e[2].x-e[0].x;return t*(e[2].y-e[0].y)-i*r<0}function l3(e,t){if(t==="flat"||yv(e))return qa;let[i,r,a,n]=e,s=i.x-r.x+a.x-n.x,o=i.y-r.y+a.y-n.y,l=[r.x-a.x,r.y-a.y,n.x-a.x,n.y-a.y],[u,h,c,d]=l,p=QI(l),f=(s*d-c*o)/p,m=(u*o-s*h)/p,g=[1,1+f,1+f+m,1+m],_=Math.max(...g)/Math.min(...g),y=t==="perspective"?0:u3(_);return!(_>=1&&_<=512)||y>=1?qa:[f,m,y]}function u3(e){let t=(1-4/e)/.9921875;return Math.max(0,t)}function yv(e){let[t,i,r,a]=e;return t.x+r.x===i.x+a.x&&t.y+r.y===i.y+a.y}var vv=class extends dn{constructor(e,t,i,r){super(e,t,i,r),this._onPlayingHandler=()=>{var a;(a=this.map)==null||a.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 t=await xw(this.urls);if(this._loaded=!0,!t)return;this.video=t,this.video.loop=!0,this.video.addEventListener("playing",this._onPlayingHandler),this.map&&this.video.play(),this._finishLoading()}catch(t){this.fire(new Q(kt(t)))}}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 Q(new O(`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 gt(e,this.video,t.RGBA),this.texture.bind(t.LINEAR,t.CLAMP_TO_EDGE));let i=!1;for(let r in this.tiles){let a=this.tiles[r];a.state!=="loaded"&&(a.state="loaded",a.texture=this.texture,i=!0)}i&&this.fire(new qe("data",{sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}},xv=class extends dn{constructor(e,t,i,r){super(e,t,i,r),t.coordinates?(!Array.isArray(t.coordinates)||t.coordinates.length!==4||t.coordinates.some(a=>!Array.isArray(a)||a.length!==2||a.some(n=>typeof n!="number")))&&this.fire(new Q(new O(`sources.${e}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new Q(new O(`sources.${e}`,null,'missing required property "coordinates"'))),t.animate&&typeof t.animate!="boolean"&&this.fire(new Q(new O(`sources.${e}`,null,'optional "animate" property must be a boolean value'))),t.canvas?typeof t.canvas!="string"&&!(t.canvas instanceof HTMLCanvasElement)&&this.fire(new Q(new O(`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 Q(new O(`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.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 Q(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._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,i=t.gl;this.texture?(e||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):(this.texture=new gt(t,this.canvas,i.RGBA,{premultiply:!0}),this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE));let r=!1;for(let a in this.tiles){let n=this.tiles[a];n.state!=="loaded"&&(n.state="loaded",n.texture=this.texture,r=!0)}r&&this.fire(new qe("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 bv={},h3=(e,t,i,r)=>{let a=new(wv(t.type))(e,t,i,r);if(a.id!==e)throw Error(`Expected Source id to be ${e} instead of ${a.id}`);return a},wv=e=>{switch(e){case"geojson":return mv;case"image":return dn;case"raster":return gp;case"raster-dem":return pv;case"vector":return dv;case"video":return vv;case"canvas":return xv}return bv[e]},c3=(e,t)=>{bv[e]=t},d3=async(e,t)=>{if(wv(e))throw Error(`A source type called "${e}" already exists.`);c3(e,t)};function p3(e,t){let i={};if(!t)return i;for(let r of e){let a=r.layerIds.map(n=>t.getLayer(n)).filter(Boolean);if(a.length!==0){r.layers=a,r.stateDependentLayerIds&&(r.stateDependentLayers=r.stateDependentLayerIds.map(n=>a.filter(s=>s.id===n)[0]));for(let n of a)i[n.id]=r}}return i}const Zc="RTLPluginLoaded";var f3=class extends _t{constructor(...e){super(...e),this.status="unavailable",this.url=null,this.dispatcher=mp()}_syncState(e){return this.status=e,this.dispatcher.broadcast("SRPS",{pluginStatus:e,pluginURL:this.url}).catch(t=>{throw this.status="error",t})}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=qt.resolveURL(e),!this.url)throw Error(`requested url ${e}
8 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 ci(Zc))}lazyLoad(){this.status==="unavailable"?this.status="requested":this.status==="deferred"&&this._requestImport()}};let yg=null;function bs(){return yg||(yg=new f3),yg}var Tv=class{constructor(e,t){this.timeAdded=0,this.fadeEndTime=0,this.fadeOpacity=1,this.tileID=e,this.uid=C_(),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.fadingDirection!==0||this.fadeOpacity>0)&&(e||!this.holdingForSymbolFade())}setCrossFadeLogic({fadingRole:e,fadingDirection:t,fadingParentID:i,fadeEndTime:r}){this.resetFadeLogic(),this.fadingRole=e,this.fadingDirection=t,this.fadingParentID=i,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=Oe(),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,i){return this.rttObjects[t]=e.acquireRTT(i)}releaseRTT(e){if(this.rttObjects.length!==0){for(let t of this.rttObjects)t&&e.releaseRTT(t);this.rttObjects.length=0}}loadVectorData(e,t,i){if((e==null?void 0:e.etagUnmodified)===!0){this.state="loaded";return}if(this.hasData()&&this.unloadVectorData(),this.state="loaded",!e){this.collisionBoxArray=new o0;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=p3(e.buckets,t==null?void 0:t.style),this.hasSymbolBuckets=!1;for(let r in this.buckets){let a=this.buckets[r];if(a instanceof yl)if(this.hasSymbolBuckets=!0,i)a.justReloaded=!0;else break}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(let r in this.buckets){let a=this.buckets[r];if(a instanceof yl&&a.hasRTLText){this.hasRTLText=!0,bs().lazyLoad();break}}this.queryPadding=0;for(let r in this.buckets){let a=this.buckets[r];this.queryPadding=Math.max(this.queryPadding,t.style.getLayer(r).queryRadius(a))}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 i in this.buckets){let r=this.buckets[i];r.uploadPending()&&r.upload(e)}let t=e.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new gt(e,this.imageAtlas.image,t.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasImage=(this.glyphAtlasTexture=new gt(e,this.glyphAtlasImage,t.ALPHA),null))}prepare(e){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(e,this.imageAtlasTexture)}queryRenderedFeatures(e,t,i,r,a,n,s,o,l,u,h){var c;return(c=this.latestFeatureIndex)!=null&&c.rawTileData?this.latestFeatureIndex.query({queryGeometry:r,cameraQueryGeometry:a,scale:n,tileSize:this.tileSize,pixelPosMatrix:u,transform:o,params:s,queryPadding:this.queryPadding*l,getElevation:h},e,t,i):{}}querySourceFeatures(e,t){let i=this.latestFeatureIndex;if(!(i!=null&&i.rawTileData))return;let r=i.loadVTLayers(),a=t!=null&&t.sourceLayer?t.sourceLayer:"",n=r._geojsonTileLayer||r[a];if(!n)return;let s=us(t==null?void 0:t.filter,`querySourceFeatures[${a}].filter`,t==null?void 0:t.globalState),{z:o,x:l,y:u}=this.tileID.canonical,h={z:o,x:l,y:u};for(let c=0;c<n.length;c++){let d=n.feature(c);if(s.needGeometry){let m=fa(d,!0);
vendor: 11,046 bytes, line 8
8if(!s.filter(new Be(this.tileID.overscaledZ),m,this.tileID.canonical))continue}else if(!s.filter(new Be(this.tileID.overscaledZ),d))continue;let p=i.getId(d,a),f=new T1(d,o,l,u,p);f.tile=h,e.push(f)}}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 i=nw(e.cacheControl);i["max-age"]&&(this.expirationTime=Date.now()+i["max-age"]*1e3)}else e.expires&&(this.expirationTime=new Date(e.expires).getTime());if(this.expirationTime){let i=Date.now(),r=!1;if(this.expirationTime>i)r=!1;else if(!t)r=!0;else if(this.expirationTime<t)r=!0;else{let a=this.expirationTime-t;a?this.expirationTime=i+Math.max(a,3e4):r=!0}r?(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,i){var a,n,s;if(!((a=this.latestFeatureIndex)!=null&&a.rawTileData)||Object.keys(e).length===0||this.featureStateRevision===i)return;this.featureStateRevision=i;let r=this.latestFeatureIndex.loadVTLayers();for(let o in this.buckets){if(!t.style.hasLayer(o))continue;let l=this.buckets[o],u=l.layers[0].sourceLayer||"_geojsonTileLayer",h=r[u],c=e[u];if(!h||!c||c.length===0)continue;l.update(c,h,((n=this.imageAtlas)==null?void 0:n.patternPositions)||{},this.dashPositions||{});let d=(s=t==null?void 0:t.style)==null?void 0:s.getLayer(o);d&&(this.queryPadding=Math.max(this.queryPadding,d.queryRadius(l)))}}holdingForSymbolFade(){return this.symbolFadeHoldUntil!==void 0}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<Oe()}clearSymbolFadeHold(){this.symbolFadeHoldUntil=void 0}setSymbolHoldDuration(e){this.symbolFadeHoldUntil=Oe()+e}setDependencies(e,t){let i={};for(let r of t)i[r]=!0;this.dependencies[e]=i}hasDependency(e,t){for(let i of e){let r=this.dependencies[i];if(r){for(let a of t)if(r[a])return!0}}return!1}};function vg(e){let t=[];for(let i in e)t.push({id:i,state:e[i]});return t}var m3=class{constructor(){this.state={},this.stateChanges={},this.deletedStates={},this.revision=0}updateState(e,t,i){var a,n,s,o,l;let r=String(t);if((a=this.stateChanges)[e]||(a[e]={}),(n=this.stateChanges[e])[r]||(n[r]={}),W(this.stateChanges[e][r],i),this.deletedStates[e]===null){this.deletedStates[e]={};for(let u in this.state[e])if(u===r){this.deletedStates[e][r]={};for(let h in this.state[e][u])i[h]===void 0&&(this.deletedStates[e][r][h]=null)}else this.deletedStates[e][u]=null}else if(((s=this.deletedStates[e])==null?void 0:s[r])===null){this.deletedStates[e][r]={};for(let u in this.state[e][r])i[u]===void 0&&(this.deletedStates[e][r][u]=null)}else for(let u in i)((l=(o=this.deletedStates[e])==null?void 0:o[r])==null?void 0:l[u])===null&&delete this.deletedStates[e][r][u]}removeFeatureState(e,t,i){var a,n,s;if(this.deletedStates[e]===null)return;let r=String(t);if((a=this.deletedStates)[e]||(a[e]={}),i&&t!==void 0)this.deletedStates[e][r]!==null&&((n=this.deletedStates[e])[r]||(n[r]={}),this.deletedStates[e][r][i]=null);else if(t!==void 0)if((s=this.stateChanges[e])!=null&&s[r])for(i in this.deletedStates[e][r]={},this.stateChanges[e][r])this.deletedStates[e][r][i]=null;else this.deletedStates[e][r]=null;else this.deletedStates[e]=null}getState(e,t){let i=String(t),r=this.state[e]||{},a=this.stateChanges[e]||{},n=W({},r[i],a[i]);if(this.deletedStates[e]===null)return{};if(this.deletedStates[e]){let s=this.deletedStates[e][t];if(s===null)return{};for(let o in s)delete n[o]}return n}initializeTileState(e,t){let i={};for(let r in this.state)i[r]=vg(this.state[r]);e.setFeatureState(i,t,this.revision)}coalesceChanges(e,t){var a,n,s;let i={};for(let o in this.stateChanges){(a=this.state)[o]||(a[o]={}),i[o]||(i[o]={});for(let l in this.stateChanges[o])(n=this.state[o])[l]||(n[l]={}),W(this.state[o][l],this.stateChanges[o][l]),i[o][l]=this.state[o][l]}for(let o in this.deletedStates)if((s=this.state)[o]||(s[o]={}),i[o]||(i[o]={}),this.deletedStates[o]===null)for(let l in this.state[o])this.state[o][l]={},i[o][l]={};else for(let l in this.deletedStates[o]){if(this.deletedStates[o][l]===null)this.state[o][l]={};else for(let u of Object.keys(this.deletedStates[o][l]))delete this.state[o][l][u];i[o][l]=this.state[o][l]}if(this.stateChanges={},this.deletedStates={},Object.keys(i).length===0)return;this.revision++;let r={};for(let o in i)r[o]=vg(i[o]);e.setFeatureState(r,t,this.revision)}},_p=class Ev{constructor(t,i){this.min=t,this.max=i,this.center=He([],xi([],this.min,this.max),.5)}quadrant(t){let i=[t%2==0,t<2],r=Th(this.min),a=Th(this.max);for(let n=0;n<i.length;n++)r[n]=i[n]?this.min[n]:this.center[n],a[n]=i[n]?this.center[n]:this.max[n];return a[2]=this.max[2],new Ev(r,a)}distanceX(t){return Math.max(Math.min(this.max[0],t[0]),this.min[0])-t[0]}distanceY(t){return Math.max(Math.min(this.max[1],t[1]),this.min[1])-t[1]}intersectsFrustum(t){let i=!0;for(let r of t.planes){let a=this.intersectsPlane(r);if(a===0)return 0;a===1&&(i=!1)}return i?2:t.aabb.min[0]>this.max[0]||t.aabb.min[1]>this.max[1]||t.aabb.min[2]>this.max[2]||t.aabb.max[0]<this.min[0]||t.aabb.max[1]<this.min[1]||t.aabb.max[2]<this.min[2]?0:1}intersectsPlane(t){let i=t[3],r=t[3];for(let a=0;a<3;a++)t[a]>0?(i+=t[a]*this.min[a],r+=t[a]*this.max[a]):(r+=t[a]*this.min[a],i+=t[a]*this.max[a]);return i>=0?2:r<0?0:1}},yp=class Sv{constructor(t,i,r){this.points=t,this.planes=i,this.aabb=r}static fromInvProjectionMatrix(t,i=1,r=0,a,n){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]],o=n?[[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**r,u=s.map(p=>g3(p,t,i,l));a&&_3(u,o[0],a,n);let h=o.map(p=>{let f=gr([],u[p[0]],u[p[1]]),m=gr([],u[p[2]],u[p[1]]),g=Nt([],ei([],f,m)),_=-dt(g,u[p[1]]);return g.concat(_)}),c=[1/0,1/0,1/0],d=[-1/0,-1/0,-1/0];for(let p of u)for(let f=0;f<3;f++)c[f]=Math.min(c[f],p[f]),d[f]=Math.max(d[f],p[f]);return new Sv(u,h,new _p(c,d))}};function g3(e,t,i,r){let a=It([],e,t),n=1/a[3]/i*r;return Ub(a,a,[n,n,1/a[3],n])}function _3(e,t,i,r){let a=r?4:0,n=r?0:4,s=0,o=[],l=[];for(let c=0;c<4;c++){let d=gr([],e[c+n],e[c+a]),p=mr(d);He(d,d,1/p),o.push(p),l.push(d)}for(let c=0;c<4;c++){let d=Yb(e[c+a],l[c],i);s=d!==null&&d>=0?Math.max(s,d):Math.max(s,o[c])}let u=y3(e,t),h=v3(i,u);if(h!==null){let c=h/dt(l[0],u);s=Math.min(s,c)}for(let c=0;c<4;c++){let d=Math.min(s,o[c]);e[c+n]=[e[c+a][0]+l[c][0]*d,e[c+a][1]+l[c][1]*d,e[c+a][2]+l[c][2]*d,1]}}function y3(e,t){let i=gr([],e[t[0]],e[t[1]]),r=gr([],e[t[2]],e[t[1]]),a=[0,0,0,0];return Nt(a,ei([],i,r)),a[3]=-dt(a,e[t[0]]),a}function v3(e,t){let i=Jo(e),r=Vb([],e,1/i),a=gr([],t,He([],r,dt(t,r))),n=Jo(a);if(n>0){let s=Math.sqrt(1-r[3]*r[3]),o=He([],r,-r[3]),l=xi([],o,He([],a,s/n));return Sh(t,l)}return null}function x3(e,t,i){let r=t.intersectsFrustum(e);if(!i||r===0)return r;let a=t.intersectsPlane(i);return a===0?0:r===2&&a===2?2:1}function xg(e,t,i){let r=0,a=(i-t)/10;for(let n=0;n<10;n++){let s=t+(n+.5)/10*(i-t);r+=a*Math.cos(s)**+e}return r}function qc(e,t){return function(i,r,a,n,s){let o=2*((e-1)/zt(Math.cos(Xe(ra-s))/Math.cos(Xe(ra)))-1),l=Math.acos(a/n),u=2*xg(o-1,0,Xe(s/2)),h=Math.min(Xe(ra),l+Xe(s/2)),c=Math.min(h,l-Xe(s/2)),d=xg(o-1,c,h),p=Math.atan(r/a),f=Math.hypot(r,a),m=i;return m+=zt(n/f/Math.max(.5,Math.cos(Xe(s/2)))),m+=o*zt(Math.cos(p))/2,m-=zt(Math.max(1,d/u/t))/2,m}}const b3=qc(9.314,3);function vp(e,t){let i=(t.roundZoom?Math.round:Math.floor)(e.zoom+zt(e.tileSize/t.tileSize));return Math.max(0,i)}function w3(e,t){let i=ra-e.pitch-e.fov/2,r=he((15-i)/15,0,1),a=Math.max(500,t??0);return e.elevation+r*a}function T3(e,t,i){let r=e.planes[1],a=e.points.map(l=>{let u=r[0]*l[0]+r[1]*l[1]+r[2]*l[2]+r[3];if(Math.abs(u)>1e-6)return l;let h=[l[0]-i[0],l[1]-i[1],l[2]-i[2]],c=r[0]*h[0]+r[1]*h[1]+r[2]*h[2];if(c>=-1e-9)return l;let d=t/-c;return[l[0]+h[0]*d,l[1]+h[1]*d,l[2]+h[2]*d,l[3]]}),n=e.planes.map((l,u)=>u===1?[l[0],l[1],l[2],l[3]+t]:l),s=[1/0,1/0,1/0],o=[-1/0,-1/0,-1/0];for(let l of a)for(let u=0;u<3;u++)s[u]=Math.min(s[u],l[u]),o[u]=Math.max(o[u],l[u]);return new yp(a,n,new _p(s,o))}function pn(e,t){let i=e.getCameraFrustum(),r=e.getClippingPlane();if(r&&t.maxContentElevation>0){let b=Math.hypot(r[0],r[1],r[2]);if(b>0){let T=1+t.maxContentElevation/Vt,P=he(-r[3]/b,-1,1),S=Math.cos(Math.acos(P)+Math.acos(1/T));r=[r[0],r[1],r[2],-S*b],i=T3(i,Math.sqrt(T*T-1),e.cameraPosition)}}let a=SS(e),n=Me.fromLngLat(e.center,e.elevation),s=w3(e,t.maxContentElevation),o=e.getCoveringTilesDetailsProvider(),l=o.allowVariableZoom(e,t),u=vp(e,t),h=t.minzoom||0,c=t.maxzoom===void 0?e.maxZoom:t.maxzoom,d=Math.min(Math.max(0,u),c),p=2**d,f=[p*a.x,p*a.y,0],m=[p*n.x,p*n.y,0],g=Math.hypot(n.x-a.x,n.y-a.y),_=Math.abs(n.z-a.z),y=Math.hypot(g,_),x=b=>({zoom:0,x:0,y:0,wrap:b,fullyVisible:!1}),v=[],w=[];if(e.renderWorldCopies&&o.allowWorldCopies())for(let b=1;b<=3;b++)v.push(x(-b)),v.push(x(b));for(v.push(x(0));v.length>0;){let b=v.pop(),T=b.x,P=b.y,S=b.fullyVisible,M={x:T,y:P,z:b.zoom},k=o.getTileBoundingVolume(M,b.wrap,s,t);if(!S){let C=x3(i,k,r);if(C===0)continue;S=C===2}let R=o.distanceToTile2d(a.x,a.y,M,k),D=u;l&&(D=(t.calculateTileZoom||b3)(e.zoom+zt(e.tileSize/t.tileSize),R,_,y,e.fov)),D=(t.roundZoom?Math.round:Math.floor)(D),D=Math.max(0,D);let I=Math.min(D,c);if(b.wrap=o.getWrap(n,M,b.wrap),b.zoom>=I){if(b.zoom<h)continue;let C=d-b.zoom,E=f[0]-.5-(T<<C),F=f[1]-.5-(P<<C),B=t.reparseOverscaled?Math.max(b.zoom,D):b.zoom;w.push({tileID:new Pt(b.zoom===c?B:b.zoom,b.wrap,b.zoom,T,P),distanceSq:Xb([m[0]-.5-T,m[1]-.5-P]),tileDistanceToCamera:Math.sqrt(E*E+F*F)});continue}for(let C=0;C<4;C++){let E=(T<<1)+C%2,F=(P<<1)+(C>>1),B=b.zoom+1;v.push({zoom:B,x:E,y:F,wrap:b.wrap,fullyVisible:S})}}return w.sort((b,T)=>b.distanceSq-T.distanceSq).map(b=>b.tileID)}function bg(e){return e==="raster"||e==="image"||e==="video"}function E3(e,t,i,r,a,n,s){let o=Oe(),l=Jb(t);for(let u of t){let h=e.getTileById(u.key);(h.fadingDirection===0||h.fadeOpacity===0)&&h.resetFadeLogic(),!S3(e,h,i,o,r,a,s)&&(D3(e,h,i,o,n,s)||C3(h,l,o,s)||h.resetFadeLogic())}}function S3(e,t,i,r,a,n,s){if(!t.hasData())return!1;let{tileID:o,fadingRole:l,fadingDirection:u,fadingParentID:h}=t;if(l===0&&u===1&&h)return i[h.key]=h,!0;let c=Math.max(o.overscaledZ-a,n);for(let d=o.overscaledZ-1;d>=c;d--){let p=o.scaledTo(d),f=e.getLoadedTile(p);if(f)return t.setCrossFadeLogic({fadingRole:0,fadingDirection:1,fadingParentID:f.tileID,fadeEndTime:r+s}),f.setCrossFadeLogic({fadingRole:1,fadingDirection:0,fadeEndTime:r+s}),i[p.key]=p,!0}return!1}function D3(e,t,i,r,a,n){if(!t.hasData())return!1;let s=t.tileID.children(a),o=wg(e,t,s,i,r,a,n);if(o)return!0;for(let l of s)wg(e,t,l.children(a),i,r,a,n)&&(o=!0);return o}function wg(e,t,i,r,a,n,s){if(i[0].overscaledZ>=n)return!1;let o=!1;for(let l of i){let u=e.getLoadedTile(l);
8if(!u)continue;let{fadingRole:h,fadingDirection:c,fadingParentID:d}=u;(h!==0||c!==0||!d)&&(u.setCrossFadeLogic({fadingRole:0,fadingDirection:0,fadingParentID:t.tileID,fadeEndTime:a+s}),t.setCrossFadeLogic({fadingRole:1,fadingDirection:1,fadeEndTime:a+s})),r[l.key]=l,o=!0}return o}function C3(e,t,i,r){let a=e.tileID;if(e.selfFading)return!0;if(e.hasData())return!1;if(t.has(a)){let n=i+r;return e.setSelfFadeLogic(n),!0}return!1}function P3(e,t){if(t<=0)return!1;let i=Oe();for(let r of e.getAllTiles())if(r.fadeEndTime>=i)return!0;return!1}function A3(e,t){var r,a,n;let i=t.getRenderableIds();for(let s of i){if(!((r=e.neighboringTiles)!=null&&r[s]))continue;let o=t.getTileById(s);e.neighboringTiles[s].backfilled||Tg(e,o),!((n=(a=o.neighboringTiles)==null?void 0:a[e.tileID.key])!=null&&n.backfilled)&&Tg(o,e)}}function Tg(e,t){var s;e.needsHillshadePrepare=!0,e.needsTerrainPrepare=!0,e.needsColorReliefPrepare=!0;let i=t.tileID.canonical.x-e.tileID.canonical.x,r=t.tileID.canonical.y-e.tileID.canonical.y,a=2**e.tileID.canonical.z,n=t.tileID.key;(i!==0||r!==0)&&(Math.abs(r)>1||(Math.abs(i)>1&&(Math.abs(i+a)===1?i+=a:Math.abs(i-a)===1&&(i-=a)),t.dem&&e.dem&&(e.dem.backfillBorder(t.dem,i,r),(s=e.neighboringTiles)!=null&&s[n]&&(e.neighboringTiles[n].backfilled=!0))))}var Eg=class{constructor(){this._tiles={}}handleWrapJump(e){let t={};for(let i in this._tiles){let r=this._tiles[i];r.tileID=r.tileID.unwrapTo(r.tileID.wrap+e),t[r.tileID.key]=r}this._tiles=t}setFeatureState(e,t,i){for(let r in this._tiles)this._tiles[r].setFeatureState(e,t,i)}getAllTiles(){return Object.values(this._tiles)}getAllIds(e=!1){return e?Object.values(this._tiles).map(t=>t.tileID).sort(qm).map(t=>t.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!=null&&t.hasData()?t:null}isIdRenderable(e,t=!1){var i;return(i=this.getTileById(e))==null?void 0:i.isRenderable(t)}getRenderableIds(e=0,t){let i=[];for(let r of this.getAllIds())this.isIdRenderable(r,t)&&i.push(this.getTileById(r));return t?i.sort((r,a)=>{let n=r.tileID,s=a.tileID,o=new A(n.canonical.x,n.canonical.y)._rotate(-e),l=new A(s.canonical.x,s.canonical.y)._rotate(-e);return n.overscaledZ-s.overscaledZ||l.y-o.y||l.x-o.x}).map(r=>r.tileID.key):i.map(r=>r.tileID).sort(qm).map(r=>r.key)}},fr,Wc=(fr=class extends _t{constructor(t,i,r){super(),this._maxContentElevationSeen=0,this.id=t,this.dispatcher=r,this.on("data",a=>{this._dataHandler(a)}),this.on("dataloading",()=>{this._sourceErrored=!1}),this.on("error",()=>{this._sourceErrored=this._source.loaded()}),this._source=h3(t,i,r,this),this._inViewTiles=new Eg,this._outOfViewCache=new KI(0,a=>this._unloadTile(a)),this._timers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._rasterFadeDuration=0,this._maxFadingAncestorLevels=5,this._state=new m3,this._didEmitContent=!1,this._updated=!1}onAdd(t){var i;this.map=t,this._maxTileCacheSize=t?t._maxTileCacheSize:null,this._maxTileCacheZoomLevels=t?t._maxTileCacheZoomLevels:null,(i=this._source)!=null&&i.onAdd&&this._source.onAdd(t)}onRemove(t){var i;for(let r of this._inViewTiles.getAllTiles())r.unloadVectorData();this.clearTiles(),(i=this._source)!=null&&i.onRemove&&this._source.onRemove(t),this._inViewTiles=new Eg}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 t of this._inViewTiles.getAllTiles())if(t.state!=="loaded"&&t.state!=="errored")return!1;return!0}getSource(){return this._source}getState(){return this._state}pause(){this._paused=!0}resume(){if(!this._paused)return;let t=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,t&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}async _loadTile(t,i,r,a){try{let n=await this._source.loadTile(t);this._tileLoaded(t,i,r,a,n)}catch(n){t.state="errored",n.status===404?this.update(this.transform,this.terrain):this._source.fire(new Q(kt(n),{tile:t}))}}_unloadTile(t){this._source.unloadTile&&this._source.unloadTile(t)}_abortTile(t){this._source.abortTile&&this._source.abortTile(t),this._source.fire(new qe("dataabort",{tile:t,coord:t.tileID}))}serialize(){return this._source.serialize()}prepare(t){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._inViewTiles,this.map?this.map.painter:null);for(let i of this._inViewTiles.getAllTiles())i.upload(t),i.prepare(this.map.style.imageManager)}getIds(){return this._inViewTiles.getAllIds(!0)}getRenderableIds(t){var i;return this._inViewTiles.getRenderableIds((i=this.transform)==null?void 0:i.bearingInRadians,t)}hasRenderableParent(t){let i=t.overscaledZ-1;if(i>=this._source.minzoom){let r=this.getLoadedTile(t.scaledTo(i));if(r)return this._inViewTiles.isIdRenderable(r.tileID.key)}return!1}reload(t,i=void 0){if(this._paused){this._shouldReloadOnResume=!0;return}this._outOfViewCache.reset();for(let r of this._inViewTiles.getAllIds()){let a=this._inViewTiles.getTileById(r);(!i||this._source.shouldReloadTile(a,i))&&(t?this._reloadTile(r,a.state==="errored"?"loading":"expired"):a.state!=="errored"&&this._reloadTile(r,"reloading"))}}async _reloadTile(t,i){let r=this._inViewTiles.getTileById(t);if(!r)return;let a=r.hasData();r.state!=="loading"&&(r.state=i),await this._loadTile(r,t,i,a)}_tileLoaded(t,i,r,a,n){a||(t.timeAdded=Oe(),t.selfFading&&(t.fadeEndTime=t.timeAdded+this._rasterFadeDuration)),r
8==="expired"&&(t.refreshedUponExpiration=!0),this._setTileReloadTimer(i,t),!(n!=null&&n.unmodified)&&(this.getSource().type==="raster-dem"&&t.dem&&A3(t,this._inViewTiles),t.featureStateRevision=-1,this._state.initializeTileState(t,this.map?this.map.painter:null),t.aborted||this._source.fire(new qe("data",{tile:t,coord:t.tileID})))}getTile(t){return this.getTileByID(t.key)}getTileByID(t){return this._inViewTiles.getTileById(t)}_retainLoadedChildren(t,i){let r=this._getLoadedDescendents(i),a=new Set;for(let n of i){let s=r[n.key];if(!(s!=null&&s.length)){a.add(n);continue}let o=n.overscaledZ+fr.maxOverzooming,l=s.filter(c=>c.tileID.overscaledZ<=o);if(!l.length){a.add(n);continue}let u=Math.min(...l.map(c=>c.tileID.overscaledZ)),h=l.filter(c=>c.tileID.overscaledZ===u).map(c=>c.tileID);for(let c of h)t[c.key]=c;this._areDescendentsComplete(h,u,n.overscaledZ)||a.add(n)}return a}_getLoadedDescendents(t){var r;let i={};for(let a of this._inViewTiles.getAllTiles().filter(n=>n.hasData()))for(let n of t)a.tileID.isChildOf(n)&&(i[r=n.key]||(i[r]=[]),i[n.key].push(a));return i}_areDescendentsComplete(t,i,r){return t.length===1&&t[0].isOverscaled()?t[0].overscaledZ===i:4**(i-r)===t.length}getLoadedTile(t){return this._inViewTiles.getLoadedTile(t)}updateCacheSize(t){let i=(Math.ceil(t.width/this._source.tileSize)+1)*(Math.ceil(t.height/this._source.tileSize)+1),r=this._maxTileCacheZoomLevels===null?ti.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels,a=Math.floor(i*r),n=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,a):a;this._outOfViewCache.setMaxSize(n)}handleWrapJump(t){let i=(t-(this._prevLng===void 0?t:this._prevLng))/360,r=Math.round(i);this._prevLng=t,r&&(this._inViewTiles.handleWrapJump(r),this._resetTileReloadTimers())}_updateMaxContentElevation(){var a,n;let t=this._maxContentElevationSeen,i=(n=(a=this.map)==null?void 0:a.style)==null?void 0:n._layers;if(!i)return t;let r=this._inViewTiles.getAllTiles();for(let s in i){let o=i[s];if(o.type!=="symbol"||o.source!==this.id||o.isHidden(this.transform.zoom))continue;let l=o;if(l.layout){t=Math.max(t,l.layout.get("symbol-height-offset").constantOr(0));for(let u of r){let h=u.getBucket(o);h&&h.maxHeightOffset>t&&(t=h.maxHeightOffset)}}}return this._maxContentElevationSeen=t,t}update(t,i){if(!this._sourceLoaded||this._paused)return;this.transform=t,this.terrain=i,this.updateCacheSize(t),this.handleWrapJump(this.transform.center.lng);let r;!this.used&&!this.usedForTerrain?r=[]:this._source.tileID?r=t.getVisibleUnwrappedCoordinates(this._source.tileID).map(l=>new Pt(l.canonical.z,l.wrap,l.canonical.z,l.canonical.x,l.canonical.y)):(r=pn(t,{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,t.maxZoom-this.map._zoomLevelsToOverscale):this._source.maxzoom,roundZoom:!this.usedForTerrain&&this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled,terrain:i,calculateTileZoom:this._source.calculateTileZoom,maxContentElevation:this._updateMaxContentElevation()}),this._source.hasTile&&(r=r.filter(l=>this._source.hasTile(l)))),this.usedForTerrain&&(r=this._addTerrainIdealTiles(r));let a=r.length===0&&!this._updated&&this._didEmitContent;this._updated=!0,a&&this.fire(new qe("data",{sourceDataType:"idle",sourceId:this.id}));let n=vp(t,this._source),s=this._updateRetainedTiles(r,n),o=bg(this._source.type);o&&this._rasterFadeDuration>0&&!i&&E3(this._inViewTiles,r,s,this._maxFadingAncestorLevels,this._source.minzoom,this._source.maxzoom,this._rasterFadeDuration),o?this._cleanUpRasterTiles(s):this._cleanUpVectorTiles(s)}_cleanUpRasterTiles(t){for(let i of this._inViewTiles.getAllIds())t[i]||this._removeTile(i)}_cleanUpVectorTiles(t){for(let i of this._inViewTiles.getAllIds()){let r=this._inViewTiles.getTileById(i);if(t[i]){r.clearSymbolFadeHold();continue}if(!r.hasSymbolBuckets){this._removeTile(i);continue}r.holdingForSymbolFade()?r.symbolFadeFinished()&&this._removeTile(i):r.setSymbolHoldDuration(this.map._fadeDuration)}}_addTerrainIdealTiles(t){let i=[];for(let r of t)if(r.canonical.z>this._source.minzoom){let a=r.scaledTo(r.canonical.z-1);i.push(a);let n=r.scaledTo(Math.max(this._source.minzoom,Math.min(r.canonical.z,5)));i.push(n)}return t.concat(i)}releaseSymbolFadeTiles(){for(let t of this._inViewTiles.getAllIds())this._inViewTiles.getTileById(t).holdingForSymbolFade()&&this._removeTile(t)}_updateRetainedTiles(t,i){var l;let r=new Set;for(let u of t)this._addTile(u).hasData()||r.add(u);let a=t.reduce((u,h)=>(u[h.key]=h,u),{}),n=this._retainLoadedChildren(a,r),s={},o=Math.max(i-fr.maxUnderzooming,this._source.minzoom);for(let u of n){let h=this._inViewTiles.getTileById(u.key),c=h==null?void 0:h.wasRequested();for(let d=u.overscaledZ-1;d>=o;--d){let p=u.scaledTo(d);if(s[p.key])break;if(s[p.key]=!0,h=this.getTile(p),!h&&c&&(h=this._addTile(p)),h){let f=h.hasData();if((f||!((l=this.map)!=null&&l.cancelPendingTileRequestsWhileZooming)||c)&&
vendor: 25,029 bytes, line 8
8(a[p.key]=p),c=h.wasRequested(),f)break}}}return a}_addTile(t){let i=this._inViewTiles.getTileById(t.key);if(i)return i;i=this._outOfViewCache.getAndRemove(t),i&&(i.resetFadeLogic(),this._setTileReloadTimer(t.key,i),i.tileID=t,this._state.initializeTileState(i,this.map?this.map.painter:null));let r=i;return i||(i=new Tv(t,this._source.tileSize*t.overscaleFactor()),this._loadTile(i,t.key,i.state,!1)),i.uses++,this._inViewTiles.setTile(t.key,i),r||this._source.fire(new qe("dataloading",{tile:i,coord:i.tileID})),i}_setTileReloadTimer(t,i){this._clearTileReloadTimer(t);let r=i.getExpiryTimeout();if(r){let a=()=>{this._reloadTile(t,"expired"),delete this._timers[t]};this._timers[t]=setTimeout(a,r)}}_clearTileReloadTimer(t){let i=this._timers[t];i&&(clearTimeout(i),delete this._timers[t])}_resetTileReloadTimers(){for(let t in this._timers)clearTimeout(this._timers[t]),delete this._timers[t];for(let t of this._inViewTiles.getAllIds()){let i=this._inViewTiles.getTileById(t);this._setTileReloadTimer(t,i)}}refreshTiles(t){for(let i of this._inViewTiles.getAllIds()){let r=this._inViewTiles.getTileById(i);(this._inViewTiles.isIdRenderable(i)||r.state=="errored")&&t.some(a=>a.equals(r.tileID.canonical))&&this._reloadTile(i,"expired")}}_removeTile(t){let i=this._inViewTiles.getTileById(t);i&&(i.uses--,this._inViewTiles.deleteTileById(t),this._clearTileReloadTimer(t),!(i.uses>0)&&(i.hasData()&&i.state!=="reloading"?this._outOfViewCache.add(i.tileID,i,i.getExpiryTimeout()):(i.aborted=!0,this._abortTile(i),this._unloadTile(i))))}_dataHandler(t){if(t.dataType==="source"){if(t.sourceDataType==="metadata"){this._sourceLoaded=!0;return}t.sourceDataType==="content"&&this._sourceLoaded&&!this._paused&&(this.reload(t.sourceDataChanged,t.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 t of this._inViewTiles.getAllIds())this._removeTile(t);this._outOfViewCache.reset()}tilesIn(t,i,r){let a=[],n=this.transform;if(!n)return a;let s=n.getCoveringTilesDetailsProvider().allowWorldCopies(),o=r?n.getCameraQueryGeometry(t):t,l=p=>n.screenPointToMercatorCoordinate(p,this.terrain),u=this.transformBbox(t,l,!s),h=this.transformBbox(o,l,!s),c=this.getIds(),d=Mi.fromPoints(h);for(let p of c){let f=this._inViewTiles.getTileById(p);if(f.holdingForSymbolFade())continue;let m=s?[f.tileID]:[f.tileID.unwrapTo(-1),f.tileID.unwrapTo(0)],g=2**(n.zoom-f.tileID.overscaledZ),_=i*f.queryPadding*L/f.tileSize/g;for(let y of m){let x=d.map(v=>y.getTilePoint(new Me(v.x,v.y)));if(x.expandBy(_),x.intersects(yS)){let v=u.map(b=>y.getTilePoint(b)),w=h.map(b=>y.getTilePoint(b));a.push({tile:f,tileID:s?y:y.unwrapTo(0),queryGeometry:v,cameraQueryGeometry:w,scale:g})}}}return a}transformBbox(t,i,r){let a=t.map(i);if(r){let n=Mi.fromPoints(t);n.shrinkBy(Math.min(n.width(),n.height())*.001);let s=n.map(i);Mi.fromPoints(a).covers(s)||(a=a.map(o=>o.x>.5?new Me(o.x-1,o.y,o.z):o))}return a}getVisibleCoordinates(t){let i=this.getRenderableIds(t).map(r=>this._inViewTiles.getTileById(r).tileID);return this.transform&&this.transform.populateCache(i),i}hasTransition(){return this._source.hasTransition()?!0:bg(this._source.type)&&P3(this._inViewTiles,this._rasterFadeDuration)}setRasterFadeDuration(t){this._rasterFadeDuration=t}setFeatureState(t,i,r){t||(t=Uo),this._state.updateState(t,i,r)}removeFeatureState(t,i,r){t||(t=Uo),this._state.removeFeatureState(t,i,r)}getFeatureState(t,i){return t||(t=Uo),this._state.getState(t,i)}setDependencies(t,i,r){let a=this._inViewTiles.getTileById(t);a&&a.setDependencies(i,r)}reloadTilesForDependencies(t,i){for(let r of this._inViewTiles.getAllIds())this._inViewTiles.getTileById(r).hasDependency(t,i)&&this._reloadTile(r,"reloading");this._outOfViewCache.filter(r=>!r.hasDependency(t,i))}areTilesLoaded(){for(let t of this._inViewTiles.getAllTiles())if(t.state!=="loaded"&&t.state!=="errored")return!1;return!0}},fr.maxUnderzooming=10,fr.maxOverzooming=3,fr),I3=class{constructor(e,t){this.reset(e,t)}reset(e,t){this.points=e||[],this._distances=[0];for(let i=1;i<this.points.length;i++)this._distances[i]=this._distances[i-1]+this.points[i].dist(this.points[i-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=he(e,0,1);let t=1,i=this._distances[t],r=e*this.paddedLength+this.padding;for(;i<r&&t<this._distances.length;)i=this._distances[++t];let a=t-1,n=this._distances[a],s=i-n,o=s>0?(r-n)/s:0;return this.points[a].mult(1-o).add(this.points[t].mult(o))}};function Wo(e,t,i,r,a){return a?e?e(t,i)+r:r===0?void 0:r:r}function Eo(e,t){let i=!0;return e==="always"||(e==="never"||t==="never")&&(i=!1),i}var Sg=class{constructor(e,t,i){let r=this.boxCells=[],a=this.circleCells=[];this.xCellCount=Math.ceil(e/i),this.yCellCount=Math.ceil(t/i);for(let n=0;n<this.xCellCount*this.yCellCount;n++)r.push([]),a.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,i,r,a){this._forEachCell(t,i,r,a,this._insertBoxCell,this.boxUid++),this.boxKeys.push(e),this.bboxes.push(t),this.bboxes.push(i),this.bboxes.push(r),this.bboxes.push(a)}insertCircle(e,t,i,r){this._forEachCell(t-r,i-r,t+r,i+r,this._insertCircleCell,this.circleUid++),this.circleKeys.push(e),this.circles.push(t),this.circles.push(i),this.circles.push(r)}_insertBoxCell(e,t,i,r,a,n){this.boxCells[a].push(n)}_insertCircleCell(e,t,i,r,a,n){this.circleCells[a].push(n)}_query(e,t,i,r,a,n,s){if(i<0||e>this.width||r<0||t>this.height)return[];let o=[];if(e<=0&&t<=0&&this.width<=i&&this.height<=r){if(a)return[{key:null,x1:e,y1:t,x2:i,y2:r}];for(let l=0;l<this.boxKeys.length;l++)o.push({key:this.boxKeys[l],x1:this.bboxes[l*4],y1:this.bboxes[l*4+1],x2:this.bboxes[l*4+2],y2:this.bboxes[l*4+3]});for(let l=0;l<this.circleKeys.length;l++){let u=this.circles[l*3],h=this.circles[l*3+1],c=this.circles[l*3+2];o.push({key:this.circleKeys[l],x1:u-c,y1:h-c,x2:u+c,y2:h+c})}}else{let l={hitTest:a,overlapMode:n,seenUids:{box:{},circle:{}}};this._forEachCell(e,t,i,r,this._queryCell,o,l,s)}return o}query(e,t,i,r){return this._query(e,t,i,r,!1,null)}hitTest(e,t,i,r,a,n){return this._query(e,t,i,r,!0,a,n).length>0}hitTestCircle(e,t,i,r,a){let n=e-i,s=e+i,o=t-i,l=t+i;if(s<0||n>this.width||l<0||o>this.height)return!1;let u=[],h={hitTest:!0,overlapMode:r,circle:{x:e,y:t,radius:i},seenUids:{box:{},circle:{}}};return this._forEachCell(n,o,s,l,this._queryCellCircle,u,h,a),u.length>0}_queryCell(e,t,i,r,a,n,s,o){let{seenUids:l,hitTest:u,overlapMode:h}=s,c=this.boxCells[a],d=1e-6;if(c!==null){let f=this.bboxes;for(let m of c)if(!l.box[m]){l.box[m]=!0;let g=m*4,_=this.boxKeys[m];if(e<=f[g+2]+d&&t<=f[g+3]+d&&i>=f[g+0]-d&&r>=f[g+1]-d&&(!o||o(_))&&(!u||!Eo(h,_.overlapMode))&&(n.push({key:_,x1:f[g],y1:f[g+1],x2:f[g+2],y2:f[g+3]}),u))return!0}}let p=this.circleCells[a];if(p!==null){let f=this.circles;for(let m of p)if(!l.circle[m]){l.circle[m]=!0;let g=m*3,_=this.circleKeys[m];if(this._circleAndRectCollide(f[g],f[g+1],f[g+2],e,t,i,r)&&(!o||o(_))&&(!u||!Eo(h,_.overlapMode))){let y=f[g],x=f[g+1],v=f[g+2];if(n.push({key:_,x1:y-v,y1:x-v,x2:y+v,y2:x+v}),u)return!0}}}return!1}_queryCellCircle(e,t,i,r,a,n,s,o){let{circle:l,seenUids:u,overlapMode:h}=s,c=this.boxCells[a];if(c!==null){let p=this.bboxes;for(let f of c)if(!u.box[f]){u.box[f]=!0;let m=f*4,g=this.boxKeys[f];if(this._circleAndRectCollide(l.x,l.y,l.radius,p[m+0],p[m+1],p[m+2],p[m+3])&&(!o||o(g))&&!Eo(h,g.overlapMode))return n.push(!0),!0}}let d=this.circleCells[a];if(d!==null){let p=this.circles;for(let f of d)if(!u.circle[f]){u.circle[f]=!0;let m=f*3,g=this.circleKeys[f];if(this._circlesCollide(p[m],p[m+1],p[m+2],l.x,l.y,l.radius)&&(!o||o(g))&&!Eo(h,g.overlapMode))return n.push(!0),!0}}}_forEachCell(e,t,i,r,a,n,s,o){let l=this._convertToXCellCoord(e),u=this._convertToYCellCoord(t),h=this._convertToXCellCoord(i),c=this._convertToYCellCoord(r);for(let d=l;d<=h;d++)for(let p=u;p<=c;p++){let f=this.xCellCount*p+d;if(a.call(this,e,t,i,r,f,n,s,o))return}}_convertToXCellCoord(e){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(e*this.xScale)))}_convertToYCellCoord(e){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(e*this.yScale)))}_circlesCollide(e,t,i,r,a,n){let s=r-e,o=a-t,l=i+n;return l*l>s*s+o*o}_circleAndRectCollide(e,t,i,r,a,n,s){let o=(n-r)/2,l=Math.abs(e-(r+o));if(l>o+i)return!1;let u=(s-a)/2,h=Math.abs(t-(a+u));if(h>u+i)return!1;if(l<=o||h<=u)return!0;let c=l-o,d=h-u;return c*c+d*d<=i*i}};function M3(e,t){let i=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]),a=t[0]*i,n=t[4]*i,s=t[8]*r,o=t[1]*i,l=t[5]*i,u=t[9]*r,h=t[2]*i,c=t[6]*i,d=t[10]*r;e[0]=a,e[1]=n,e[2]=s,e[4]=o,e[5]=l,e[6]=u,e[8]=h,e[9]=c,e[10]=d;let p=t[12],f=t[13],m=t[14];return e[12]=-a*p-o*f-h*m,e[13]=-n*p-l*f-c*m,e[14]=-s*p-u*f-d*m,e[3]=0,e[7]=0,e[11]=0,e[15]=1,e}function F3(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 z3(e,t){let i=1/(t[0]*t[5]-t[1]*t[4]);return e[0]=t[5]*i,e[1]=-t[1]*i,e[2]=0,e[3]=0,e[4]=-t[4]*i,e[5]=t[0]*i,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 R3=kr();function xp(e,t,i){let r=kr();if(!e){let{vecSouth:a,vecEast:n}=bp(t),s=Q1();s[0]=n[0],s[1]=n[1],s[2]=a[0],s[3]=a[1],JI(s,s),r[0]=s[0],r[1]=s[1],r[4]=s[2],r[5]=s[3]}return At(r,r,[1/i,1/i,1]),r}function k3(e,t,i,r){if(e){let a=kr();if(!t){let{vecSouth:n,vecEast:s}=bp(i);a[0]=s[0],a[1]=s[1],a[4]=n[0],a[5]=n[1]}return At(a,a,[r,r,1]),a}return i.pixelsToClipSpaceMatrix}function bp(e){let t=Math.cos(e.rollInRadians),i=Math.sin(e.rollInRadians),r=Math.cos(e.pitchInRadians),a=Math.cos(e.bearingInRadians),n=Math.sin(e.bearingInRadians),s=Eh();s[0]=-a*r*i-n*t,s[1]=-n*r*i+a*t;let o=Cf(s);o<1e-9?Pf(s):Df(s,s,1/o);let l=Eh();l[0]=a*r*t-n*i,l[1]=n*r*t+a*i;let u=Cf(l);return u<1e-9?Pf(l):Df(l,l,1/u),{vecEast:l,vecSouth:s}}function ha(e,t,i){return Wo(e.getElevation,t,i,e.heightOffset??0,e.heightAnchorGround??!0)}function wp(e,t,i,r){let a;r==null?(a=[e,t,0,1],Tp(a,a,i)):(a=[e,t,r,1],It(a,a,i));let n=a[3];return{point:new A(a[0]/n,a[1]/n),signedDistanceFromCamera:n,isOccluded:!1}}function Dv(e,t){return .5+e/t*.5}function L3(e,t){return e.x>=-t[0]&&e.x<=t[0]&&e.y>=-t[1]&&e.y<=t[1]}function B3(e,t,i,r,a,n,s,o,l,u,h,c,d){let p=i?e.textSizeData:e.iconSizeData,f=Ql(p,t.transform.zoom),m=[256/t.width*2+1,256/t.height*2+1],g=i?e.text.dynamicLayoutVertexArray:e.icon.dynamicLayoutVertexArray;g.clear();let _=e.lineVertexArray,y=i?e.text.placedSymbolArray:e.icon.placedSymbolArray,x=t.transform.width/t.transform.height,v=!1;for(let w=0;w<y.length;w++){let b=y.get(w);if(b.hidden||b.writingMode===2&&!v){Wa(b.numGlyphs,g);continue}v=!1;let T=new A(b.anchorX,b.anchorY),P={getElevation:d,pitchedLabelPlaneMatrix:r,lineVertexArray:_,pitchWithMap:n,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},transform:t.transform,tileAnchorPoint:T,unwrappedTileID:l,width:u,height:h,translation:c},S=Av(b.anchorX,b.anchorY,P);if(!L3(S.point,m)){Wa(b.numGlyphs,g);continue}let M=S.signedDistanceFromCamera,k=Dv(t.transform.cameraToCenterDistance,M),R=Xd(p,f,b),D=n?R*t.transform.getPitchedTextCorrection(b.anchorX,b.anchorY,l)/k:R*k,I=Cg({projectionContext:P,pitchedLabelPlaneMatrixInverse:a,symbol:b,fontSize:D,flip:!1,keepUpright:s,glyphOffsetArray:e.glyphOffsetArray,dynamicLayoutVertexArray:g,aspectRatio:x,rotateToLine:o});v=I.useVertical,(I.notEnoughRoom||v||I.needsFlipping&&Cg({projectionContext:P,pitchedLabelPlaneMatrixInverse:a,symbol:b,fontSize:D,flip:!0,keepUpright:s,glyphOffsetArray:e.glyphOffsetArray,dynamicLayoutVertexArray:g,aspectRatio:x,rotateToLine:o}).notEnoughRoom)&&Wa(b.numGlyphs,g)}i?e.text.dynamicLayoutVertexBuffer.updateData(g):e.icon.dynamicLayoutVertexBuffer.updateData(g)}function Cv(e,t,i,r,a,n,s,o){let l=n.glyphStartIndex+n.numGlyphs,u=n.lineStartIndex,h=n.lineStartIndex+n.lineLength,c=t.getoffsetX(n.glyphStartIndex),d=t.getoffsetX(l-1),p=wl(e*c,i,r,a,n.segment,u,h,o,s);if(!p)return null;let f=wl(e*d,i,r,a,n.segment,u,h,o,s);return!f||o.projectionCache.anyProjectionOccluded?null:{first:p,last:f}}function Dg(e,t,i,r){return e===1&&Math.abs(i.y-t.y)>Math.abs(i.x-t.x)*r?{useVertical:!0}:(e===2?t.y<i.y:t.x>i.x)?{needsFlipping:!0}:null}function Cg(e){let{projectionContext:t,pitchedLabelPlaneMatrixInverse:i,symbol:r,fontSize:a,flip:n,keepUpright:s,glyphOffsetArray:o,dynamicLayoutVertexArray:l,aspectRatio:u,rotateToLine:h}=e,c=a/24,d=r.lineOffsetX*c,p=r.lineOffsetY*c,f;if(r.numGlyphs>1){let m=r.glyphStartIndex+r.numGlyphs,g=r.lineStartIndex,_=r.lineStartIndex+r.lineLength,y=Cv(c,o,d,p,n,r,h,t);if(!y)return{notEnoughRoom:!0};let x=So(y.first.point.x,y.first.point.y,t,i),v=So(y.last.point.x,y.last.point.y,t,i);if(s&&!n){let w=Dg(r.writingMode,x,v,u);if(w)return w}f=[y.first];for(let w=r.glyphStartIndex+1;w<m-1;w++){let b=wl(c*o.getoffsetX(w),d,p,n,r.segment,g,_,t,h);if(!b)return{notEnoughRoom:!0};f.push(b)}f.push(y.last)}else{if(s&&!n){let g=ca(t.tileAnchorPoint.x,t.tileAnchorPoint.y,t).point,_=r.lineStartIndex+r.segment+1,y=new A(t.lineVertexArray.getx(_),t.lineVertexArray.gety(_)),x=ca(y.x,y.y,t),v=x.signedDistanceFromCamera>0?x.point:Pv(t.tileAnchorPoint,y,g,1,t),w=So(g.x,g.y,t,i),b=So(v.x,v.y,t,i),T=Dg(r.writingMode,w,b,u);if(T)return T}let m=wl(c*o.getoffsetX(r.glyphStartIndex),d,p,n,r.segment,r.lineStartIndex,r.lineStartIndex+r.lineLength,t,h);if(!m||t.projectionCache.anyProjectionOccluded)return{notEnoughRoom:!0};f=[m]}for(let m of f)_l(l,m.point,m.angle);return{}}function Pv(e,t,i,r,a){let n=e.add(e.sub(t)._unit()),s=ca(n.x,n.y,a).point,o=i.sub(s);return i.add(o._mult(r/o.mag()))}function Hc(e,t,i){let r=t.projectionCache;if(r.projections[e])return r.projections[e];let a=new A(t.lineVertexArray.getx(e),t.lineVertexArray.gety(e)),n=ca(a.x,a.y,t);if(n.signedDistanceFromCamera>0)return r.projections[e]=n.point,r.anyProjectionOccluded||(r.anyProjectionOccluded=n.isOccluded),n.point;let s=e-i.direction,o=i.distanceFromAnchor===0?t.tileAnchorPoint:new A(t.lineVertexArray.getx(s),t.lineVertexArray.gety(s)),l=i.absOffsetX-i.distanceFromAnchor+1;return Pv(o,a,i.previousVertex,l,t)}function ca(e,t,i){let r=e+i.translation[0],a=t+i.translation[1],n;return i.pitchWithMap?(n=wp(r,a,i.pitchedLabelPlaneMatrix,ha(i,r,a)),n.isOccluded=!1):(n=i.transform.projectTileCoordinates(r,a,i.unwrappedTileID,ha(i,r,a)),n.point.x=(n.point.x*.5+.5)*i.width,n.point.y=(-n.point.y*.5+.5)*i.height),n}function So(e,t,i,r){if(i.pitchWithMap){let a=[e,t,0,1];It(a,a,r);let n=a[0]/a[3],s=a[1]/a[3];return i.transform.projectTileCoordinates(n,s,i.unwrappedTileID,ha(i,n,s)).point}return{x:e/i.width*2-1,y:1-t/i.height*2}}function Av(e,t,i){return i.transform.projectTileCoordinates(e,t,i.unwrappedTileID,ha(i,e,t))}function Xc(e,t,i){return e._unit()._perp()._mult(t*i)}function O3(e,t,i,r,a,n,s,o,l){if(o.projectionCache.offsets[e])return o.projectionCache.offsets[e];let u=i.add(t);if(e+l.direction<r||e+l.direction>=a)return o.projectionCache.offsets[e]=u,u;let h=Hc(e+l.direction,o,l),c=Xc(h.sub(i),s,l.direction),d=i.add(c),p=h.add(c);return o.projectionCache.offsets[e]=rw(n,u,d,p)||u,o.projectionCache.offsets[e]}function wl(e,t,i,r,a,n,s,o,l){let u=r?e-t:e+t,h=u>0?1:-1,c=0;r&&(h*=-1,c=Math.PI),h<0&&(c+=Math.PI);let d=h>0?n+a:n+a+1,p;o.projectionCache.cachedAnchorPoint?p=o.projectionCache.cachedAnchorPoint:(p=ca(o.tileAnchorPoint.x,o.tileAnchorPoint.y,o).point,o.projectionCache.cachedAnchorPoint=p);let f=p,m=p,g,_,y=0,x=0,v=Math.abs(u),w=[],b;for(;y+x<=v;){if(d+=h,d<n||d>=s)return null;y+=x,m=f,_=g;let M={absOffsetX:v,direction:h,distanceFromAnchor:y,previousVertex:m};if(f=Hc(d,o,M),i===0)w.push(m),b=f.sub(m);else{let k,R=f.sub(m);k=R.mag()===0?Xc(Hc(d+h,o,M).sub(f),i,h):Xc(R,i,h),_||(_=m.add(k)),g=O3(d,k,f,n,s,_,i,o,M),w.push(_),b=g.sub(_)}x=b.mag()}let T=(v-y)/x,P=b._mult(T)._add(_||m),S=c+Math.atan2(f.y-m.y,f.x-m.x);return w.push(P),{point:P,angle:l?S:0,path:w}}const $3=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function Wa(e,t){for(let i=0;i<e;i++){let r=t.length;t.resize(r+4),t.float32.set($3,r*3)}}function Tp(e,t,i){let r=t[0],a=t[1];return e[0]=i[0]*r+i[4]*a+i[12],e[1]=i[1]*r+i[5]*a+i[13],e[3]=i[3]*r+i[7]*a+i[15],e}function j3(e,t){let i=R3;return z3(i,t.pitchedLabelPlaneMatrix),e.map(r=>{let a=wp(r.x,r.y,i,ha(t,r.x,r.y)),n=t.transform.projectTileCoordinates(a.point.x,a.point.y,t.unwrappedTileID,ha(t,a.point.x,a.point.y));return n.point.x=(n.point.x*.5+.5)*t.width,n.point.y=(-n.point.y*.5+.5)*t.height,n})}function V3(e){let t=0,i=0,r=0,a=0;for(let n=0;n<e.length;n++)e[n].isOccluded?(r=n+1,a=0):(a++,a>i&&(i=a,t=r));return e.slice(t,t+i)}var N3=class{constructor(e,t=new Sg(e.width+200,e.height+200,25),i=new Sg(e.width+200,e.height+200,25)){this.transform=e,this.grid=t,this.ignoredGrid=i,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,i,r,a,n,s,o,l,u,h,c,d=0,p=!0){let f=e.anchorPointX+o[0],m=e.anchorPointY+o[1],g=this.projectAndGetPerspectiveRatio(f,m,a,Wo(u,f,m,d,p),c),_=i*g.perspectiveRatio,y;if(!n&&!s){let S=g.x+(h?h.x*_:0),M=g.y+(h?h.y*_:0);y={allPointsOccluded:!1,box:[S+e.x1*_,M+e.y1*_,S+e.x2*_,M+e.y2*_]}}else y=this._projectCollisionBox(e,_,r,a,n,s,o,g,u,h,c,d,p);let[x,v,w,b]=y.box,T=n?y.allPointsOccluded:g.isOccluded,P=T;return P||(P=g.perspectiveRatio<this.perspectiveRatioCutoff),P||(P=!this.isInsideGrid(x,v,w,b)),P||t!=="always"&&this.grid.hitTest(x,v,w,b,t,l)?{box:[x,v,w,b],placeable:!1,offscreen:!1,occluded:T}:{box:[x,v,w,b],placeable:!0,offscreen:this.isOffscreen(x,v,w,b),occluded:T}}placeCollisionCircles(e,t,i,r,a,n,s,o,l,u,h,c,d,p){let f=[],m=new A(t.anchorX,t.anchorY),g=this.getPerspectiveRatio(m.x,m.y,n,p==null?void 0:p(m.x,m.y)),_=(l?a*this.transform.getPitchedTextCorrection(t.anchorX,t.anchorY,n)/g:a*g)/24,y={projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},x=t.lineOffsetX*_,v=t.lineOffsetY*_,w={getElevation:p,pitchedLabelPlaneMatrix:s,lineVertexArray:i,pitchWithMap:l,projectionCache:y,transform:this.transform,tileAnchorPoint:m,unwrappedTileID:n,width:this.transform.width,height:this.transform.height,translation:d},b=Cv(_,r,x,v,!1,t,!1,w),T=!1,P=!1,S=!0;if(b){let M=h*.5*g+c,k=new A(-100,-100),R=new A(this.screenRightBoundary,this.screenBottomBoundary),D=new I3,I=b.first,C=b.last,E=[];for(let j=I.path.length-1;j>=1;j--)E.push(I.path[j]);for(let j=1;j<C.path.length;j++)E.push(C.path[j]);let F=M*2.5;if(l){let j=this.projectPathToScreenSpace(E,w);E=j.some(H=>H.signedDistanceFromCamera<=0)?[]:j.map(H=>H.point)}let B=[];if(E.length>0){let j=E[0].clone(),H=E[0].clone();for(let ce=1;ce<E.length;ce++)j.x=Math.min(j.x,E[ce].x),j.y=Math.min(j.y,E[ce].y),H.x=Math.max(H.x,E[ce].x),H.y=Math.max(H.y,E[ce].y);B=j.x>=k.x&&H.x<=R.x&&j.y>=k.y&&H.y<=R.y?[E]:H.x<k.x||j.x>R.x||H.y<k.y||j.y>R.y?[]:_1([E],k.x,k.y,R.x,R.y)}for(let j of B){D.reset(j,M*.25);let H=0;H=D.length<=.5*M?1:Math.ceil(D.paddedLength/F)+1;for(let ce=0;ce<H;ce++){let Fe=ce/Math.max(H-1,1),pe=D.lerp(Fe),Ve=pe.x+100,Te=pe.y+100;f.push(Ve,Te,M,0);let Ne=Ve-M,Ce=Te-M,st=Ve+M,Tt=Te+M;if(S&&(S=this.isOffscreen(Ne,Ce,st,Tt)),P||(P=this.isInsideGrid(Ne,Ce,st,Tt)),e!=="always"&&this.grid.hitTestCircle(Ve,Te,M,e,u)&&(T=!0,!o))return{circles:[],offscreen:!1,collisionDetected:T}}}}return{circles:!o&&T||!P||g<this.perspectiveRatioCutoff?[]:f,offscreen:S,collisionDetected:T}}projectPathToScreenSpace(e,t){return V3(j3(e,t))}queryRenderedSymbols(e){if(e.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};let t=[],i=new Mi;for(let h of e){let c=new A(h.x+100,h.y+100);i.extend(c),t.push(c)}let{minX:r,minY:a,maxX:n,maxY:s}=i,o=this.grid.query(r,a,n,s).concat(this.ignoredGrid.query(r,a,n,s)),l={},u={};for(let h of o){let c=h.key;if(l[c.bucketInstanceId]===void 0&&(l[c.bucketInstanceId]={}),l[c.bucketInstanceId][c.featureIndex])continue;let d=[new A(h.x1,h.y1),new A(h.x2,h.y1),new A(h.x2,h.y2),new A(h.x1,h.y2)];T0(t,d)&&(l[c.bucketInstanceId][c.featureIndex]=!0,u[c.bucketInstanceId]===void 0&&(u[c.bucketInstanceId]=[]),u[c.bucketInstanceId].push(c.featureIndex))}return u}insertCollisionBox(e,t,i,r,a,n){let s=i?this.ignoredGrid:this.grid,o={bucketInstanceId:r,featureIndex:a,collisionGroupID:n,overlapMode:t};s.insert(o,e[0],e[1],e[2],e[3])}insertCollisionCircles(e,t,i,r,a,n){let s=i?this.ignoredGrid:this.grid,o={bucketInstanceId:r,featureIndex:a,collisionGroupID:n,overlapMode:t};for(let l=0;l<e.length;l+=4)s.insertCircle(o,e[l],e[l+1],e[l+2])}projectAndGetPerspectiveRatio(e,t,i,r,a){if(a){let n;r==null?(n=[e,t,0,1],Tp(n,n,a)):(n=[e,t,r,1],It(n,n,a));let s=n[3];return{x:(n[0]/s+1)/2*this.transform.width+100,y:(-n[1]/s+1)/2*this.transform.height+100,perspectiveRatio:.5+.5*(this.transform.cameraToCenterDistance/s),isOccluded:!1,signedDistanceFromCamera:s}}{let n=this.transform.projectTileCoordinates(e,t,i,r);return{x:(n.point.x+1)/2*this.transform.width+100,y:(-n.point.y+1)/2*this.transform.height+100,perspectiveRatio:.5+.5*(this.transform.cameraToCenterDistance/n.signedDistanceFromCamera),isOccluded:n.isOccluded,signedDistanceFromCamera:n.signedDistanceFromCamera}}}getPerspectiveRatio(e,t,i,r){let a=this.transform.projectTileCoordinates(e,t,i,r);return .5+.5*(this.transform.cameraToCenterDistance/a.signedDistanceFromCamera)}isOffscreen(e,t,i,r){return i<100||e>=this.screenRightBoundary||r<100||t>this.screenBottomBoundary}isInsideGrid(e,t,i,r){return i>=0&&e<this.gridRightBoundary&&r>=0&&t<this.gridBottomBoundary}getViewportMatrix(){let e=Fi([]);return ct(e,e,[-100,-100,0]),e}_projectCollisionBox(e,t,i,r,a,n,s,o,l,u,h,c=0,d=!0){let p=1,f=0,m=0,g=1,_=e.anchorPointX+s[0],y=e.anchorPointY+s[1];if(n&&!a){let C=this.projectAndGetPerspectiveRatio(_+1,y,r,Wo(l,_+1,y,c,d),h),E=C.x-o.x,F=C.y-o.y,B=Math.atan(F/E)+(E<0?Math.PI:0),j=Math.sin(B),H=Math.cos(B);p=H,f=j,m=-j,g=H}else if(!n&&a){let C=bp(this.transform);p=C.vecEast[0],f=C.vecEast[1],m=C.vecSouth[0],g=C.vecSouth[1]}let x=o.x,v=o.y,w=t;if(a&&(x=_,v=y,w=2**-(this.transform.zoom-i.overscaledZ),w*=this.transform.getPitchedTextCorrection(_,y,r),!u)){let C=o.signedDistanceFromCamera/this.transform.cameraToCenterDistance,E=he(.5+.5*C,0,4);w*=E}u&&(x+=p*u.x*w+m*u.y*w,v+=f*u.x*w+g*u.y*w);let b=e.x1*w,T=e.x2*w,P=(b+T)/2,S=e.y1*w,M=e.y2*w,k=(S+M)/2,R=[{offsetX:b,offsetY:S},{offsetX:P,offsetY:S},{offsetX:T,offsetY:S},{offsetX:T,offsetY:k},{offsetX:T,offsetY:M},{offsetX:P,offsetY:M},{offsetX:b,offsetY:M},{offsetX:b,offsetY:k}],D=[];for(let{offsetX:C,offsetY:E}of R)D.push(new A(x+p*C+m*E,v+f*C+g*E));let I=!1;if(a){let C=D.map(E=>this.projectAndGetPerspectiveRatio(E.x,E.y,r,Wo(l,E.x,E.y,c,d),h));I=C.some(E=>!E.isOccluded),D=C.map(E=>new A(E.x,E.y))}else I=!0;return{box:Kb(D),allPointsOccluded:!I}}},Pg=class{constructor(e,t,i,r){this.opacity=e?Math.max(0,Math.min(1,e.opacity+(e.placed?t:-t))):r&&i?1:0,this.placed=i}isHidden(){return this.opacity===0&&!this.placed}},Mn=class{constructor(e,t,i,r,a){this.text=new Pg(e?e.text:null,t,i,a),this.icon=new Pg(e?e.icon:null,t,r,a)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}},Ag=class{constructor(e,t,i){this.text=e,this.icon=t,this.skipFade=i}},U3=class{constructor(e,t,i,r,a){this.bucketInstanceId=e,this.featureIndex=t,this.sourceLayerIndex=i,this.bucketIndex=r,this.tileID=a}},G3=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:i=>i.collisionGroupID===t}}return this.collisionGroups[e]}};function Ig(e,t,i,r,a){let{horizontalAlign:n,verticalAlign:s}=Jl(e),o=-(n-.5)*t,l=-(s-.5)*i;return new A(o+r[0]*a,l+r[1]*a)}var Z3=class{constructor(e,t,i,r,a){this.transform=e.clone(),this.terrain=t,this.collisionIndex=new N3(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=i,this.retainedQueryData={},this.collisionGroups=new G3(r),this.collisionCircleArrays={},this.collisionBoxArrays=new Map,this.prevPlacement=a,a&&(a.prevPlacement=void 0),this.placedOrientations={}}_getTerrainElevationFunc(e){let t=this.terrain;if(t)return(i,r)=>t.getElevation(e,i,r)}getBucketParts(e,t,i,r){let a=i.getBucket(t),n=i.latestFeatureIndex;if(!a||!n||t.id!==a.layerIds[0])return;let s=i.collisionBoxArray,o=a.layers[0].layout,l=a.layers[0].paint,u=2**(this.transform.zoom-i.tileID.overscaledZ
8),h=i.tileSize/L,c=i.tileID.toUnwrapped(),d=o.get("text-rotation-alignment")==="map",p=hi(i,1,this.transform.zoom),f=Mr(this.collisionIndex.transform,i,l.get("text-translate"),l.get("text-translate-anchor")),m=Mr(this.collisionIndex.transform,i,l.get("icon-translate"),l.get("icon-translate-anchor")),g=xp(d,this.transform,p);this.retainedQueryData[a.bucketInstanceId]=new U3(a.bucketInstanceId,n,a.sourceLayerIndex,a.index,i.tileID);let _={bucket:a,layout:o,translationText:f,translationIcon:m,unwrappedTileID:c,pitchedLabelPlaneMatrix:g,scale:u,textPixelRatio:h,holdingForFade:i.holdingForSymbolFade(),collisionBoxArray:s,partiallyEvaluatedTextSize:Ql(a.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(a.sourceID)};if(r)for(let y of a.sortKeyRanges){let{sortKey:x,symbolInstanceStart:v,symbolInstanceEnd:w}=y;e.push({sortKey:x,symbolInstanceStart:v,symbolInstanceEnd:w,parameters:_})}else e.push({symbolInstanceStart:0,symbolInstanceEnd:a.symbolInstances.length,parameters:_})}attemptAnchorPlacement(e,t,i,r,a,n,s,o,l,u,h,c,d,p,f,m,g,_,y,x,v,w){var M,k,R;let b=Mc[e.textAnchor],T=[e.textOffset0,e.textOffset1],P=Ig(b,i,r,T,a),S=this.collisionIndex.placeCollisionBox(t,c,o,l,u,s,n,m,h.predicate,y,P,x,v,w);if((!_||this.collisionIndex.placeCollisionBox(_,c,o,l,u,s,n,g,h.predicate,y,P,x,v,w).placeable)&&S.placeable){let D;if((M=this.prevPlacement)!=null&&M.variableOffsets[d.crossTileID]&&((R=(k=this.prevPlacement)==null?void 0:k.placements[d.crossTileID])!=null&&R.text)&&(D=this.prevPlacement.variableOffsets[d.crossTileID].anchor),d.crossTileID===0)throw Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[d.crossTileID]={textOffset:T,width:i,height:r,anchor:b,textBoxScale:a,prevAnchor:D},this.markUsedJustification(p,b,d,f),p.allowVerticalPlacement&&(this.markUsedOrientation(p,f,d),this.placedOrientations[d.crossTileID]=f),{shift:P,placedGlyphBoxes:S}}}placeLayerBucketPart(e,t,i){let{bucket:r,layout:a,translationText:n,translationIcon:s,unwrappedTileID:o,pitchedLabelPlaneMatrix:l,textPixelRatio:u,holdingForFade:h,collisionBoxArray:c,partiallyEvaluatedTextSize:d,collisionGroup:p}=e.parameters,f=a.get("text-optional"),m=a.get("icon-optional"),g=gl(a,"text-overlap","text-allow-overlap"),_=g==="always",y=gl(a,"icon-overlap","icon-allow-overlap"),x=y==="always",v=a.get("text-rotation-alignment")==="map",w=a.get("text-pitch-alignment")==="map",b=a.get("icon-text-fit")!=="none",T=a.get("symbol-z-order")==="viewport-y",P=a.get("symbol-height-anchor")==="ground",S=_&&(x||!r.hasIconData()||m),M=x&&(_||!r.hasTextData()||f);!r.collisionArrays&&c&&r.deserializeCollisionBoxes(c);let k=this.retainedQueryData[r.bucketInstanceId].tileID,R=this._getTerrainElevationFunc(k),D=this.transform.getFastPathSimpleProjectionMatrix(k),I=(C,E,F)=>{var re,ne;if(t[C.crossTileID])return;if(h){this.placements[C.crossTileID]=new Ag(!1,!1,!1);return}let B=C.heightOffset,j=!1,H=!1,ce=!0,Fe=null,pe={box:null,placeable:!1,offscreen:null,occluded:!1},Ve={placeable:!1},Te=null,Ne=null,Ce=null,st=0,Tt=0,Bt=0;E.textFeatureIndex?st=E.textFeatureIndex:C.useRuntimeCollisionCircles&&(st=C.featureIndex),E.verticalTextFeatureIndex&&(Tt=E.verticalTextFeatureIndex);let ze=E.textBox;if(ze){let $=q=>{let Ee=1;if(r.allowVerticalPlacement&&!q&&this.prevPlacement){let Se=this.prevPlacement.placedOrientations[C.crossTileID];Se&&(this.placedOrientations[C.crossTileID]=Se,Ee=Se,this.markUsedOrientation(r,Ee,C))}return Ee},se=(q,Ee)=>{if(r.allowVerticalPlacement&&C.numVerticalGlyphVertices>0&&E.verticalTextBox){for(let Se of r.writingModes)if(Se===2?(pe=Ee(),Ve=pe):pe=q(),pe==null?void 0:pe.placeable)break}else pe=q()},J=C.textAnchorOffsetStartIndex,te=C.textAnchorOffsetEndIndex;if(te===J){let q=(Ee,Se)=>{let oe=this.collisionIndex.placeCollisionBox(Ee,g,u,k,o,w,v,n,p.predicate,R,void 0,D,B,P);return oe!=null&&oe.placeable&&(this.markUsedOrientation(r,Se,C),this.placedOrientations[C.crossTileID]=Se),oe};se(()=>q(ze,1),()=>{let Ee=E.verticalTextBox;return r.allowVerticalPlacement&&C.numVerticalGlyphVertices>0&&Ee?q(Ee,2):{box:null,offscreen:null}}),$(pe==null?void 0:pe.placeable)}else{let q=Mc[(ne=(re=this.prevPlacement)==null?void 0:re.variableOffsets[C.crossTileID])==null?void 0:ne.anchor],Ee=(oe,at,Br)=>{let tr=oe.x2-oe.x1,Bi=oe.y2-oe.y1,Oi=C.textBoxScale,Ge=b&&y==="never"?at:null,je=null,di=g==="never"?1:2,Di="never";q&&di++;for(let ya=0;ya<di;ya++){for(let ht=J;ht<te;ht++){let ft=r.textAnchorOffsets.get(ht);if(q&&ft.textAnchor!==q)continue;let va=this.attemptAnchorPlacement(ft,oe,tr,Bi,Oi,v,w,u,k,o,p,Di,C,r,Br,n,s,Ge,R,D,B,P);if(va&&(je=va.placedGlyphBoxes,je==null?void 0:je.placeable))return j=!0,Fe=va.shift,je}q?q=null:Di=g}return i&&!je&&(je={box:this.collisionIndex.placeCollisionBox(ze,"always",u,k,o,w,v,n,p.predicate,R,void 0,D,B,P).box,offscreen:!1,placeable:!1,occluded:!1}),je};se(()=>Ee(ze,E.iconBox,1),()=>{let oe=E.verticalTextBox,at=pe==null?void 0:pe.placeable;return r.allowVerticalPlacement&&!at&&C.numVerticalGlyphVertices>0&&oe?Ee(oe,E.verticalIconBox,2):{box:null,occluded:!0,offscreen:null}}),pe&&(j=pe.placeable,ce=pe.offscreen);let Se=$(pe==null?void 0:pe.placeable);if(!j&&this.prevPlacement){let oe=this.prevPlacement.variableOffsets[C.crossTileID];oe&&(this.variableOffsets[C.crossTileID]=oe,this.markUsedJustification(r,oe.anchor,C,Se))}}}if(Te=pe,j=Te==null?void 0:Te.placeable,ce=Te==null?void 0:Te.offscreen,C.useRuntimeCollisionCircles&&C.centerJustifiedTextSymbolIndex>=0){let $=r.text.placedSymbolArray.get(C.centerJustifiedTextSymbolIndex),se=Xd(r.textSizeData,d,$),J=a.get("text-padding"),te=C.collisionCircleDiameter;Ne=this.collisionIndex.placeCollisionCircles(g,$,r.lineVertexArray,r.glyphOffsetArray,se,o,l,i,w,p.predicate,te,J,n,R),Ne.circles.length&&Ne.collisionDetected&&!i&&xe("Collisions detected, but collision boxes are not shown"),j=_||Ne.circles.length>0&&!Ne.collisionDetected,ce&&(ce=Ne.offscreen)}if(E.iconFeatureIndex&&(Bt=E.iconFeatureIndex),E.iconBox){let $=se=>this.collisionIndex.placeCollisionBox(se,y,u,k,o,w,v,s,p.predicate,R,b&&Fe?Fe:void 0,D,B,P);Ve&&Ve.placeable&&E.verticalIconBox?(Ce=$(E.verticalIconBox),H=Ce.placeable):(Ce=$(E.iconBox),H=Ce.placeable),ce&&(ce=Ce.offscreen)}let Ue=f||C.numHorizontalGlyphVertices===0&&C.numVerticalGlyphVertices===0,Ot=m||C.numIconVertices===0;!Ue&&!Ot?H=j=H&&j:Ot?Ue||H&&(H=j):j=H&&j;let Ht=j&&Te.placeable,jt=H&&Ce.placeable;if(Ht&&(Ve&&Ve.placeable&&Tt?this.collisionIndex.insertCollisionBox(Te.box,g,a.get("text-ignore-placement"),r.bucketInstanceId,Tt,p.ID):this.collisionIndex.insertCollisionBox(Te.box,g,a.get("text-ignore-placement"),r.bucketInstanceId,st,p.ID)),jt&&this.collisionIndex.insertCollisionBox(Ce.box,y,a.get("icon-ignore-placement"),r.bucketInstanceId,Bt,p.ID),Ne&&j&&this.collisionIndex.insertCollisionCircles(Ne.circles,g,a.get("text-ignore-placement"),r.bucketInstanceId,st,p.ID),i&&this.storeCollisionData(r.bu
vendor: 10,553 bytes, line 8
8cketInstanceId,F,E,Te,Ce,Ne),C.crossTileID===0)throw Error("symbolInstance.crossTileID can't be 0");if(r.bucketInstanceId===0)throw Error("bucket.bucketInstanceId can't be 0");let Xt=(j||S)&&!(Te!=null&&Te.occluded),Z=(H||M)&&!(Ce!=null&&Ce.occluded);this.placements[C.crossTileID]=new Ag(Xt,Z,ce||r.justReloaded),t[C.crossTileID]=!0};if(T){if(e.symbolInstanceStart!==0)throw Error("bucket.bucketInstanceId should be 0");let C=r.getSortedSymbolIndexes(-this.transform.bearingInRadians);for(let E=C.length-1;E>=0;--E){let F=C[E];I(r.symbolInstances.get(F),r.collisionArrays[F],F)}}else for(let C=e.symbolInstanceStart;C<e.symbolInstanceEnd;C++)I(r.symbolInstances.get(C),r.collisionArrays[C],C);r.justReloaded=!1}storeCollisionData(e,t,i,r,a,n){if(i.textBox||i.iconBox){let s;this.collisionBoxArrays.has(e)?s=this.collisionBoxArrays.get(e):(s=new Map,this.collisionBoxArrays.set(e,s));let o;s.has(t)?o=s.get(t):(o={text:null,icon:null},s.set(t,o)),i.textBox&&(o.text=r.box),i.iconBox&&(o.icon=a.box)}if(n){let s=this.collisionCircleArrays[e];s===void 0&&(s=this.collisionCircleArrays[e]=[]);for(let o=0;o<n.circles.length;o+=4)s.push(n.circles[o+0]-100),s.push(n.circles[o+1]-100),s.push(n.circles[o+2]),s.push(+!!n.collisionDetected)}}markUsedJustification(e,t,i,r){let a={left:i.leftJustifiedTextSymbolIndex,center:i.centerJustifiedTextSymbolIndex,right:i.rightJustifiedTextSymbolIndex},n;n=r===2?i.verticalPlacedTextSymbolIndex:a[Fc(t)];let s=[i.leftJustifiedTextSymbolIndex,i.centerJustifiedTextSymbolIndex,i.rightJustifiedTextSymbolIndex,i.verticalPlacedTextSymbolIndex];for(let o of s)o>=0&&(n>=0&&o!==n?e.text.placedSymbolArray.get(o).crossTileID=0:e.text.placedSymbolArray.get(o).crossTileID=i.crossTileID)}markUsedOrientation(e,t,i){let r=t===1||t===3?t:0,a=t===2?t:0,n=[i.leftJustifiedTextSymbolIndex,i.centerJustifiedTextSymbolIndex,i.rightJustifiedTextSymbolIndex];for(let s of n)e.text.placedSymbolArray.get(s).placedOrientation=r;i.verticalPlacedTextSymbolIndex&&(e.text.placedSymbolArray.get(i.verticalPlacedTextSymbolIndex).placedOrientation=a)}commit(e){this.commitTime=e,this.zoomAtLastRecencyCheck=this.transform.zoom;let t=this.prevPlacement,i=!1;this.prevZoomAdjustment=t?t.zoomAdjustment(this.transform.zoom):0;let r=t?t.symbolFadeChange(e):1,a=t?t.opacities:{},n=t?t.variableOffsets:{},s=t?t.placedOrientations:{};for(let o in this.placements){let l=this.placements[o],u=a[o];u?(this.opacities[o]=new Mn(u,r,l.text,l.icon),i||(i=l.text!==u.text.placed),i||(i=l.icon!==u.icon.placed)):(this.opacities[o]=new Mn(null,r,l.text,l.icon,l.skipFade),i||(i=l.text||l.icon))}for(let o in a){let l=a[o];if(!this.opacities[o]){let u=new Mn(l,r,!1,!1);u.isHidden()||(this.opacities[o]=u,i||(i=l.text.placed),i||(i=l.icon.placed))}}for(let o in n)!this.variableOffsets[o]&&this.opacities[o]&&!this.opacities[o].isHidden()&&(this.variableOffsets[o]=n[o]);for(let o in s)!this.placedOrientations[o]&&this.opacities[o]&&!this.opacities[o].isHidden()&&(this.placedOrientations[o]=s[o]);if(t&&t.lastPlacementChangeTime===void 0)throw Error("Last placement time for previous placement is not defined");i?this.lastPlacementChangeTime=e:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=t?t.lastPlacementChangeTime:e)}updateLayerOpacities(e,t){let i={};for(let r of t){let a=r.getBucket(e);a&&r.latestFeatureIndex&&e.id===a.layerIds[0]&&this.updateBucketOpacities(a,r.tileID,i,r.collisionBoxArray)}}updateBucketOpacities(e,t,i,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 a=e.layers[0],n=a.layout,s=new Mn(null,0,!1,!1,!0),o=n.get("text-allow-overlap"),l=n.get("icon-allow-overlap"),u=a._unevaluatedLayout.hasValue("text-variable-anchor")||a._unevaluatedLayout.hasValue("text-variable-anchor-offset"),h=n.get("text-rotation-alignment")==="map",c=n.get("text-pitch-alignment")==="map",d=n.get("icon-text-fit")!=="none",p=new Mn(null,0,o&&(l||!e.hasIconData()||n.get("icon-optional")),l&&(o||!e.hasTextData()||n.get("text-optional")),!0);!e.collisionArrays&&r&&(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData())&&e.deserializeCollisionBoxes(r);let f=(g,_,y)=>{for(let x=0;x<_/4;x++)g.opacityVertexArray.emplaceBack(y);g.hasVisibleVertices||(g.hasVisibleVertices=y!==Fn)},m=this.collisionBoxArrays.get(e.bucketInstanceId);for(let g=0;g<e.symbolInstances.length;g++){let _=e.symbolInstances.get(g),{numHorizontalGlyphVertices:y,numVerticalGlyphVertices:x,crossTileID:v}=_,w=i[v],b=this.opacities[v];w?b=s:b||(b=p,this.opacities[v]=b),i[v]=!0;let T=y>0||x>0,P=_.numIconVertices>0,S=this.placedOrientations[_.crossTileID],M=S===2,k=S===1||S===3;if(T){let D=Fg(b.text),I=M?Fn:D;f(e.text,y,I);let C=k?Fn:D;f(e.text,x,C);let E=b.text.isHidden(),F=[_.rightJustifiedTextSymbolIndex,_.centerJustifiedTextSymbolIndex,_.leftJustifiedTextSymbolIndex];for(let H of F)H>=0&&(e.text.placedSymbolArray.get(H).hidden=E||M?1:0);_.verticalPlacedTextSymbolIndex>=0&&(e.text.placedSymbolArray.get(_.verticalPlacedTextSymbolIndex).hidden=E||k?1:0);let B=this.variableOffsets[_.crossTileID];B&&this.markUsedJustification(e,B.anchor,_,S);let j=this.placedOrientations[_.crossTileID];j&&(this.markUsedJustification(e,"left",_,j),this.markUsedOrientation(e,j,_))}if(P){let D=Fg(b.icon),I=!(d&&_.verticalPlacedIconSymbolIndex&&M);if(_.placedIconSymbolIndex>=0){let C=I?D:Fn;f(e.icon,_.numIconVertices,C),e.icon.placedSymbolArray.get(_.placedIconSymbolIndex).hidden=b.icon.isHidden()}if(_.verticalPlacedIconSymbolIndex>=0){let C=I?Fn:D;f(e.icon,_.numVerticalIconVertices,C),e.icon.placedSymbolArray.get(_.verticalPlacedIconSymbolIndex).hidden=b.icon.isHidden()}}let R=m!=null&&m.has(g)?m.get(g):{text:null,icon:null};if(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData()){let D=e.collisionArrays[g];if(D){let I=new A(0,0);if(D.textBox||D.verticalTextBox){let C=!0;if(u){let E=this.variableOffsets[v];E?(I=Ig(E.anchor,E.width,E.height,E.textOffset,E.textBoxScale),h&&I._rotate(c?-this.transform.bearingInRadians:this.transform.bearingInRadians)):C=!1}if(D.textBox||D.verticalTextBox){let E;D.textBox&&(E=M),D.verticalTextBox&&(E=k),Mg(e.textCollisionBox.collisionVertexArray,b.text.placed,!C||E,R.text,I.x,I.y)}}if(D.iconBox||D.verticalIconBox){let C=!(k||!D.verticalIconBox),E;D.iconBox&&(E=C),D.verticalIconBox&&(E=!C),Mg(e.iconCollisionBox.collisionVertexArray,b.icon.placed,E,R.icon,d?I.x:0,d?I.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 i=this.zoomAtLastRecencyCheck===t?1-this.zoomAdjustment(t):1;return this.zoomAtLastRecencyCheck=t,this.commitTime+this.fadeDuration*i>e}setStale(){this.stale=!0}};function Mg(e,t,i,r,a,n){(!r||r.length===0)&&(r=[0,0,0,0]);let s=r[0]-100,o=r[1]-100,l=r[2]-100,u=r[3]-100;e.emplaceBack(+!!t,+!!i,a||0,n||0,s,o),e.emplaceBack(+!!t,+!!i,a||0,n||0,l,o),e.emplaceBack(+!!t,+!!i,a||0,n||0,l,u),e.emplaceBack(+!!t,+!!i,a||0,n||0,s,u)}const q3=2**25,W3=2**24,H3=2**17,X3=2**16;function Fg(e){if(e.opacity===0&&!e.placed)return 0;if(e.opacity===1&&e.placed)return 4294967295;let t=+!!e.placed,i=Math.floor(e.opacity*127);return i*q3+t*W3+i*H3+t*X3+i*512+t*256+i*2+t}const Fn=0;var Y3=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,i,r,a){let n=this._bucketParts;for(;this._currentTileIndex<e.length;){let s=e[this._currentTileIndex];if(t.getBucketParts(n,r,s,this._sortAcrossTiles),this._currentTileIndex++,a())return!0}for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,n.sort((s,o)=>s.sortKey-o.sortKey));this._currentPartIndex<n.length;){let s=n[this._currentPartIndex];if(t.placeLayerBucketPart(s,this._seenCrossTileIDs,i),this._currentPartIndex++,a())return!0}return!1}},K3=class{constructor(e,t,i,r,a,n,s,o){this.placement=new Z3(e,t,n,s,o),this._currentPlacementIndex=i.length-1,this._forceFullPlacement=r,this._showCollisionBoxes=a,this._done=!1}isDone(){return this._done}continuePlacement(e,t,i){let r=Oe(),a=()=>!this._forceFullPlacement&&Oe()-r>2;for(;this._currentPlacementIndex>=0;){let n=t[e[this._currentPlacementIndex]],s=this.placement.collisionIndex.transform.zoom;if(w1(n)&&n.layout&&(!n.minzoom||n.minzoom<=s)&&(!n.maxzoom||n.maxzoom>s)){if(this._inProgressLayer||(this._inProgressLayer=new Y3(n)),this._inProgressLayer.continuePlacement(i[n.source],this.placement,this._showCollisionBoxes,n,a))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(e){return this.placement.commit(e),this.placement}};const zg=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array
vendor: 2,913 bytes, line 8
8],et=new Uint32Array(96);var J3=class Iv{static from(t){if(!t||t.byteLength===void 0||t.buffer)throw Error("Data must be an instance of ArrayBuffer or SharedArrayBuffer.");let[i,r]=new Uint8Array(t,0,2);if(i!==219)throw Error("Data does not appear to be in a KDBush format.");let a=r>>4;if(a!==1)throw Error(`Got v${a} data when expected v1.`);let n=zg[r&15];if(!n)throw Error("Unrecognized array type.");let[s]=new Uint16Array(t,2,1),[o]=new Uint32Array(t,4,1);return new Iv(o,s,n,void 0,t)}constructor(t,i=64,r=Float64Array,a=ArrayBuffer,n){if(isNaN(t)||t<0)throw Error(`Unexpected numItems value: ${t}.`);this.numItems=+t,this.nodeSize=Math.min(Math.max(+i,2),65535),this.ArrayType=r,this.IndexArrayType=t<65536?Uint16Array:Uint32Array;let s=zg.indexOf(this.ArrayType),o=t*2*this.ArrayType.BYTES_PER_ELEMENT,l=t*this.IndexArrayType.BYTES_PER_ELEMENT,u=(8-l%8)%8;if(s<0)throw Error(`Unexpected typed array class: ${r}.`);if(n)this.data=n,this.ids=new this.IndexArrayType(n,8,t),this.coords=new r(n,8+l+u,t*2),this._pos=t*2,this._finished=!0;else{let h=this.data=new a(8+o+l+u);this.ids=new this.IndexArrayType(h,8,t),this.coords=new r(h,8+l+u,t*2),this._pos=0,this._finished=!1,new Uint8Array(h,0,2).set([219,16+s]),new Uint16Array(h,2,1)[0]=i,new Uint32Array(h,4,1)[0]=t}}add(t,i){let r=this._pos>>1;return this.ids[r]=r,this.coords[this._pos++]=t,this.coords[this._pos++]=i,r}finish(){let t=this._pos>>1;if(t!==this.numItems)throw Error(`Added ${t} items when expected ${this.numItems}.`);return Yc(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(t,i,r,a){if(!this._finished)throw Error("Data not yet indexed - call index.finish().");let{ids:n,coords:s,nodeSize:o}=this;et[0]=0,et[1]=n.length-1,et[2]=0;let l=3,u=[];for(;l>0;){let h=et[--l],c=et[--l],d=et[--l];if(c-d<=o){for(let g=d;g<=c;g++){let _=s[2*g],y=s[2*g+1];_>=t&&_<=r&&y>=i&&y<=a&&u.push(n[g])}continue}let p=d+c>>1,f=s[2*p],m=s[2*p+1];f>=t&&f<=r&&m>=i&&m<=a&&u.push(n[p]),(h===0?t<=f:i<=m)&&(et[l++]=d,et[l++]=p-1,et[l++]=1-h),(h===0?r>=f:a>=m)&&(et[l++]=p+1,et[l++]=c,et[l++]=1-h)}return u}within(t,i,r){let a=[];return this.withinInto(t,i,r,a),a}withinInto(t,i,r,a){if(!this._finished)throw Error("Data not yet indexed - call index.finish().");let{ids:n,coords:s,nodeSize:o}=this;et[0]=0,et[1]=n.length-1,et[2]=0;let l=3,u=0,h=r*r;for(;l>0;){let c=et[--l],d=et[--l],p=et[--l];if(d-p<=o){for(let _=p;_<=d;_++)Rg(s[2*_],s[2*_+1],t,i)<=h&&(a[u++]=n[_]);continue}let f=p+d>>1,m=s[2*f],g=s[2*f+1];Rg(m,g,t,i)<=h&&(a[u++]=n[f]),(c===0?t-r<=m:i-r<=g)&&(et[l++]=p,et[l++]=f-1,et[l++]=1-c),(c===0?t+r>=m:i+r>=g)&&(et[l++]=f+1,et[l++]=d,et[l++]=1-c)}return u}};function Yc(e,t,i,r,a,n){if(a-r<=i)return;let s=r+a>>1;Mv(e,t,s,r,a,n),Yc(e,t,i,r,s-1,1-n),Yc(e,t,i,s+1,a,1-n)}function Mv(e,t,i,r,a,n){for(;a>r;){if(a-r>600){let u=a-r+1,h=i-r+1,c=Math.log(u),d=.5*Math.exp(2*c/3),p=.5*Math.sqrt(c*d*(u-d)/u)*(h-u/2<0?-1:1);
vendor: 6,361 bytes, lines 8-35
8Mv(e,t,i,Math.max(r,Math.floor(i-h*d/u+p)),Math.min(a,Math.floor(i+(u-h)*d/u+p)),n)}let s=t[2*i+n],o=r,l=a;for(zn(e,t,r,i),t[2*a+n]>s&&zn(e,t,r,a);o<l;){for(zn(e,t,o,l),o++,l--;t[2*o+n]<s;)o++;for(;t[2*l+n]>s;)l--}t[2*r+n]===s?zn(e,t,r,l):(l++,zn(e,t,l,a)),l<=i&&(r=l+1),i<=l&&(a=l-1)}}function zn(e,t,i,r){nh(e,i,r),nh(t,2*i,2*r),nh(t,2*i+1,2*r+1)}function nh(e,t,i){let r=e[t];e[t]=e[i],e[i]=r}function Rg(e,t,i,r){let a=e-i,n=t-r;return a*a+n*n}const Rn=512/L/2;var Q3=class{constructor(e,t,i){this.tileID=e,this.bucketInstanceId=i,this._symbolsByKey={};let r=new Map;for(let a=0;a<t.length;a++){let n=t.get(a),s=n.key,o=r.get(s);o?o.push(n):r.set(s,[n])}for(let[a,n]of r){let s={positions:n.map(o=>({x:Math.floor(o.anchorX*Rn),y:Math.floor(o.anchorY*Rn)})),crossTileIDs:n.map(o=>o.crossTileID)};if(s.positions.length>128){let o=new J3(s.positions.length,16,Uint16Array);for(let{x:l,y:u}of s.positions)o.add(l,u);o.finish(),delete s.positions,s.index=o}this._symbolsByKey[a]=s}}getScaledCoordinates(e,t){let{x:i,y:r,z:a}=this.tileID.canonical,{x:n,y:s,z:o}=t.canonical,l=o-a,u=Rn/2**l,h=(n*L+e.anchorX)*u,c=(s*L+e.anchorY)*u,d=i*L*Rn,p=r*L*Rn;return{x:Math.floor(h-d),y:Math.floor(c-p)}}findMatches(e,t,i){let r=this.tileID.canonical.z<t.canonical.z?1:2**(this.tileID.canonical.z-t.canonical.z);for(let a=0;a<e.length;a++){let n=e.get(a);if(n.crossTileID)continue;let s=this._symbolsByKey[n.key];if(!s)continue;let o=this.getScaledCoordinates(n,t);s.index?this.findMatchesForIndexedEntry(s,n,o,r,i):s.positions&&this.findMatchesForNonIndexedEntry(s,n,o,r,i)}}findMatchesForIndexedEntry(e,t,i,r,a){let n=e.index.range(i.x-r,i.y-r,i.x+r,i.y+r),s=1/0;for(let o of n)o<s&&!a[e.crossTileIDs[o]]&&(s=o);if(s!==1/0){let o=e.crossTileIDs[s];a[o]=!0,t.crossTileID=o}}findMatchesForNonIndexedEntry(e,t,i,r,a){for(let n=0;n<e.positions.length;n++){let s=e.positions[n],o=e.crossTileIDs[n];if(Math.abs(s.x-i.x)<=r&&Math.abs(s.y-i.y)<=r&&!a[o]){a[o]=!0,t.crossTileID=o;break}}}getCrossTileIDsLists(){return Object.values(this._symbolsByKey).map(({crossTileIDs:e})=>e)}},eF=class{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}},tF=class{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(e){let t=Math.round((e-this.lng)/360);if(t!==0)for(let i in this.indexes){let r=this.indexes[i],a={};for(let n in r){let s=r[n];s.tileID=s.tileID.unwrapTo(s.tileID.wrap+t),a[s.tileID.key]=s}this.indexes[i]=a}this.lng=e}addBucket(e,t,i){var a,n,s;if((a=this.indexes[e.overscaledZ])!=null&&a[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 o=0;o<t.symbolInstances.length;o++){let l=t.symbolInstances.get(o);l.crossTileID=0}(n=this.usedCrossTileIDs)[s=e.overscaledZ]||(n[s]={});let r=this.usedCrossTileIDs[e.overscaledZ];for(let o in this.indexes){let l=this.indexes[o];if(Number(o)>e.overscaledZ)for(let u in l){let h=l[u];h.tileID.isChildOf(e)&&h.findMatches(t.symbolInstances,e,r)}else{let u=l[e.scaledTo(Number(o)).key];u&&u.findMatches(t.symbolInstances,e,r)}}for(let o=0;o<t.symbolInstances.length;o++){let l=t.symbolInstances.get(o);l.crossTileID||(l.crossTileID=i.generate(),r[l.crossTileID]=!0)}return this.indexes[e.overscaledZ]===void 0&&(this.indexes[e.overscaledZ]={}),this.indexes[e.overscaledZ][e.key]=new Q3(e,t.symbolInstances,t.bucketInstanceId),!0}removeBucketCrossTileIDs(e,t){for(let i of t.getCrossTileIDsLists())for(let r of i)delete this.usedCrossTileIDs[e][r]}removeStaleBuckets(e){let t=!1;for(let i in this.indexes){let r=this.indexes[i];for(let a in r)e[r[a].bucketInstanceId]||(this.removeBucketCrossTileIDs(i,r[a]),delete r[a],t=!0)}return t}},Fv=class{constructor(){this.layerIndexes={},this.crossTileIDs=new eF,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(e,t,i){let r=this.layerIndexes[e.id];r===void 0&&(r=this.layerIndexes[e.id]=new tF);let a=!1,n={};r.handleWrapJump(i);for(let s of t){let o=s.getBucket(e);e.id===(o==null?void 0:o.layerIds[0])&&(o.bucketInstanceId||(o.bucketInstanceId=(this.maxBucketInstanceId+=1,this.maxBucketInstanceId)),r.addBucket(s.tileID,o,this.crossTileIDs)&&(a=!0),n[o.bucketInstanceId]=!0)}return r.removeStaleBuckets(n)&&(a=!0),a}pruneUnusedLayers(e){let t={};for(let i of e)t[i]=!0;for(let i in this.layerIndexes)t[i]||delete this.layerIndexes[i]}},iF=`#ifdef GL_ES
9precision mediump float;
10#else
11#if !defined(lowp)
12#define lowp
13#endif
14#if !defined(mediump)
15#define mediump
16#endif
17#if !defined(highp)
18#define highp
19#endif
20#endif
21out highp vec4 fragColor;layout(std140) uniform ProjectionUBO {highp mat4 u_projection_matrix;highp mat4 u_projection_fallback_matrix;highp vec4 u_projection_tile_mercator_coords;highp vec4 u_projection_clipping_plane;highp float u_projection_transition;highp int u_projection_clip_antimeridian;};layout(std140) uniform FrameUBO {highp vec2 u_units_to_pixels;highp vec2 u_world_size;highp float u_camera_to_center_distance;highp float u_symbol_fade_change;highp float u_aspect_ratio;highp float u_device_pixel_ratio;highp vec2 u_viewport_size;highp vec2 u_pixel_extrude_scale;highp float u_pitch;};`,rF=`#ifdef GL_ES
22precision highp float;
23#else
24#if !defined(lowp)
25#define lowp
26#endif
27#if !defined(mediump)
28#define mediump
29#endif
30#if !defined(highp)
31#define highp
32#endif
33#endif
34vec2 unpack_float(const float packedValue) {int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}vec2 unpack_opacity(const uint packedOpacity) {return vec2(float(packedOpacity >> 1u)/127.0,float(packedOpacity & 1u));}vec4 decode_color(const vec2 encodedColor) {return vec4(unpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0
35);}float unpack_mix_vec2(const vec2 packedValue,const float t) {return mix(packedValue[0],packedValue[1],t);}vec4 unpack_mix_color(const vec4 packedColors,const float t) {vec4 minColor=decode_color(vec2(packedColors[0],packedColors[1]));vec4 maxColor=decode_color(vec2(packedColors[2],packedColors[3]));return mix(minColor,maxColor,t);}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const float tile_units_to_pixels,const vec2 pos) {vec2 offset=mod(mod(mod(pixel_coord_upper,pattern_size)*256.0,pattern_size)*256.0+pixel_coord_lower,pattern_size);
35return (tile_units_to_pixels*pos+offset)/pattern_size;}mat3 rotationMatrixFromAxisAngle(vec3 u,float angle) {float c=cos(angle);float s=sin(angle);float c2=1.0-c;return mat3(u.x*u.x*c2+      c,u.x*u.y*c2-u.z*s,u.x*u.z*c2+u.y*s,u.y*u.x*c2+u.z*s,u.y*u.y*c2+    c,u.y*u.z*c2-u.x*s,u.z*u.x*c2-u.y*s,u.z*u.y*c2+u.x*s,u.z*u.z*c2+    c
36);}
37#ifdef TERRAIN3D
38uniform sampler2D u_terrain;uniform highp sampler2D u_depth;layout(std140) uniform TerrainUBO {highp mat4 u_terrain_matrix;highp vec4 u_terrain_unpack;highp float u_terrain_dim;highp float u_terrain_exaggeration;};
39#endif
40const highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitShifts=vec4(1.)/bitSh;highp float unpack(highp vec4 color) {return dot(color,bitShifts);}highp float depthOpacity(vec3 frag) {
41#ifdef TERRAIN3D
42highp float d=unpack(texture(u_depth,frag.xy*0.5+0.5))+0.0001-frag.z;return 1.0-max(0.0,min(1.0,-d*500.0));
43#else
44return 1.0;
45#endif
46}float calculate_visibility(vec4 pos) {
47#ifdef TERRAIN3D
48vec3 frag=pos.xyz/pos.w;highp float d=depthOpacity(frag);if (d > 0.95) return 1.0;return (d+depthOpacity(frag+vec3(0.0,0.01,0.0)))/2.0;
49#else
50return 1.0;
51#endif
52}float ele(ivec2 pos) {
53#ifdef TERRAIN3D
54vec4 rgb=(texelFetch(u_terrain,pos,0)*255.0)*u_terrain_unpack;return rgb.r+rgb.g+rgb.b-u_terrain_unpack.a;
55#else
56return 0.0;
57#endif
58}float get_elevation(vec2 pos) {
59#ifdef TERRAIN3D
60#ifdef GLOBE
61if ((pos.y <-32767.5) || (pos.y > 32766.5)) {return 0.0;}
62#endif
63vec2 coord=(u_terrain_matrix*vec4(pos,0.0,1.0)).xy*u_terrain_dim+1.5;vec2 f=fract(coord);ivec2 c=ivec2(floor(coord));ivec2 hi=textureSize(u_terrain,0)-1;float tl=ele(clamp(c,ivec2(0),hi));float tr=ele(clamp(c+ivec2(1,0),ivec2(0),hi));float bl=ele(clamp(c+ivec2(0,1),ivec2(0),hi));float br=ele(clamp(c+ivec2(1,1),ivec2(0),hi));float elevation=mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);return elevation*u_terrain_exaggeration;
64#else
65return 0.0;
66#endif
67}const float PI=3.141592653589793;
68#define PROJECTION_UBO
69layout(std140) uniform ProjectionUBO {highp mat4 u_projection_matrix;highp mat4 u_projection_fallback_matrix;highp vec4 u_projection_tile_mercator_coords;highp vec4 u_projection_clipping_plane;highp float u_projection_transition;highp int u_projection_clip_antimeridian;};layout(std140) uniform FrameUBO {highp vec2 u_units_to_pixels;highp vec2 u_world_size;highp float u_camera_to_center_distance;highp float u_symbol_fade_change;highp float u_aspect_ratio;highp float u_device_pixel_ratio;highp vec2 u_viewport_size;highp vec2 u_pixel_extrude_scale;highp float u_pitch;};`,aF=`uniform vec4 u_color;uniform float u_opacity;void main() {fragColor=u_color*u_opacity;
70#ifdef OVERDRAW_INSPECTOR
71fragColor=vec4(1.0);
72#endif
73}`,nF="layout(location=0) in vec2 a_pos;void main() {gl_Position=projectTile(a_pos);}",sF=`uniform vec2 u_pattern_tl_a;uniform vec2 u_pattern_br_a;uniform vec2 u_pattern_tl_b;uniform vec2 u_pattern_br_b;uniform vec2 u_texsize;uniform float u_mix;uniform float u_opacity;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b;void main() {vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(u_pattern_tl_a/u_texsize,u_pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(u_pattern_tl_b/u_texsize,u_pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);fragColor=mix(color1,color2,u_mix)*u_opacity;
74#ifdef OVERDRAW_INSPECTOR
75fragColor=vec4(1.0);
76#endif
77}`,oF="uniform vec2 u_pattern_size_a;uniform vec2 u_pattern_size_b;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_scale_a;uniform float u_scale_b;uniform float u_tile_units_to_pixels;layout(location=0) in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b;void main() {gl_Position=projectTile(a_pos);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_a*u_pattern_size_a,u_tile_units_to_pixels,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_b*u_pattern_size_b,u_tile_units_to_pixels,a_pos);}",lF=`in vec3 v_data;flat in float v_visibility;
78#pragma maplibre: define highp vec4 color
79#pragma maplibre: define mediump float radius
80#pragma maplibre: define lowp float blur
81#pragma maplibre: define lowp float opacity
82#pragma maplibre: define highp vec4 stroke_color
83#pragma maplibre: define mediump float stroke_width
84#pragma maplibre: define lowp float stroke_opacity
85void main() {
86#pragma maplibre: initialize highp vec4 color
87#pragma maplibre: initialize mediump float radius
88#pragma maplibre: initialize lowp float blur
89#pragma maplibre: initialize lowp float opacity
90#pragma maplibre: initialize highp vec4 stroke_color
91#pragma maplibre: initialize mediump float stroke_width
92#pragma maplibre: initialize lowp float stroke_opacity
93vec2 extrude=v_data.xy;float extrude_length=length(extrude);float antialiased_blur=v_data.z;float opacity_t=smoothstep(0.0,antialiased_blur,extrude_length-1.0);float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(antialiased_blur,0.0,extrude_length-radius
93/(radius+stroke_width));fragColor=v_visibility*opacity_t*mix(color*opacity,stroke_color*stroke_opacity,color_t);const float epsilon=0.5/255.0;if (fragColor.r < epsilon && fragColor.g < epsilon && fragColor.b < epsilon && fragColor.a < epsilon) {discard;}
94#ifdef OVERDRAW_INSPECTOR
95fragColor=vec4(1.0);
96#endif
97}`,uF=`uniform bool u_scale_with_map;uniform bool u_pitch_with_map;uniform vec2 u_extrude_scale;uniform highp float u_globe_extrude_scale;uniform vec2 u_translate;layout(location=0) in ivec2 a_pos;out vec3 v_data;flat out float v_visibility;
98#pragma maplibre: define highp vec4 color
99#pragma maplibre: define mediump float radius
100#pragma maplibre: define lowp float blur
101#pragma maplibre: define lowp float opacity
102#pragma maplibre: define highp vec4 stroke_color
103#pragma maplibre: define mediump float stroke_width
104#pragma maplibre: define lowp float stroke_opacity
105void main(void) {
106#pragma maplibre: initialize highp vec4 color
107#pragma maplibre: initialize mediump float radius
108#pragma maplibre: initialize lowp float blur
109#pragma maplibre: initialize lowp float opacity
110#pragma maplibre: initialize highp vec4 stroke_color
111#pragma maplibre: initialize mediump float stroke_width
112#pragma maplibre: initialize lowp float stroke_opacity
113ivec2 pos_raw=a_pos+32768;vec2 extrude=vec2(pos_raw & 7)/7.0*2.0-1.0;vec2 circle_center=vec2(pos_raw >> 3)+u_translate;float ele=get_elevation(circle_center);v_visibility=calculate_visibility(projectTileWithElevation(circle_center,ele));if (u_pitch_with_map) {
114#ifdef GLOBE
115vec3 center_vector=projectToSphere(circle_center);
116#endif
117float angle_scale=u_globe_extrude_scale;vec2 corner_position=circle_center;if (u_scale_with_map) {angle_scale*=(radius+stroke_width);corner_position+=extrude*u_extrude_scale*(radius+stroke_width);} else {
118#ifdef GLOBE
119vec4 projected_center=interpolateProjection(circle_center,center_vector,ele);
120#else
121vec4 projected_center=projectTileWithElevation(circle_center,ele);
122#endif
123corner_position+=extrude*u_extrude_scale*(radius+stroke_width)*(projected_center.w/u_camera_to_center_distance);angle_scale*=(radius+stroke_width)*(projected_center.w/u_camera_to_center_distance);}
124#ifdef GLOBE
125vec2 angles=extrude*angle_scale;vec3 corner_vector=globeRotateVector(center_vector,angles);gl_Position=interpolateProjection(corner_position,corner_vector,ele);
126#else
127gl_Position=projectTileWithElevation(corner_position,ele);
128#endif
129} else {gl_Position=projectTileWithElevation(circle_center,ele);if (gl_Position.z/gl_Position.w > 1.0) {gl_Position.xy=vec2(10000.0);}if (u_scale_with_map) {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*u_camera_to_center_distance;} else {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*gl_Position.w;}}float antialiasblur=-max(1.0/u_device_pixel_ratio/(radius+stroke_width),blur);v_data=vec3(extrude.x,extrude.y,antialiasblur);}`,kg="void main() {fragColor=vec4(1.0);}";const qi={prelude:we(iF,rF),projectionMercator:we(`
130void clipAntimeridian() {}`,"float projectLineThickness(float tileY) {return 1.0;}float projectCircleRadius(float tileY) {return 1.0;}vec4 projectTile(vec2 p) {vec4 result=u_projection_matrix*vec4(p,0.0,1.0);return result;}vec4 projectTile(vec2 p,vec2 rawPos) {vec4 result=u_projection_matrix*vec4(p,0.0,1.0);if (rawPos.y <-32767.5 || rawPos.y > 32766.5) {result.z=-10000000.0;}return result;}vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return u_projection_matrix*vec4(posInTile,elevation,1.0);}vec4 projectTileFor3D(vec2 posInTile,float elevation) {return projectTileWithElevation(posInTile,elevation);}"),projectionGlobe:we("in highp float v_projection_tile_x;void clipAntimeridian() {if (u_projection_clip_antimeridian !=0 && (v_projection_tile_x < 0.0 || v_projection_tile_x >=8192.0)) {discard;}}",`#define GLOBE_RADIUS 6371008.8
131#ifndef PROJECTION_UBO
132uniform highp vec4 u_projection_tile_mercator_coords;uniform highp vec4 u_projection_clipping_plane;uniform highp float u_projection_transition;uniform mat4 u_projection_fallback_matrix;
133#endif
134out highp float v_projection_tile_x;vec3 globeRotateVector(vec3 vec,vec2 angles) {vec3 axisRight=vec3(vec.z,0.0,-vec.x);vec3 axisUp=cross(axisRight,vec);axisRight=normalize(axisRight);axisUp=normalize(axisUp);vec2 t=tan(angles);return normalize(vec+axisRight*t.x+axisUp*t.y);}mat3 globeGetRotationMatrix(vec3 spherePos) {vec3 axisRight=vec3(spherePos.z,0.0,-spherePos.x);vec3 axisDown=cross(axisRight,spherePos);axisRight=normalize(axisRight);axisDown=normalize(axisDown);return mat3(axisRight,axisDown,spherePos
135);}float circumferenceRatioAtTileY(float tileY) {float mercator_pos_y=u_projection_tile_mercator_coords.y+u_projection_tile_mercator_coords.w*tileY;float t=exp(PI-(mercator_pos_y*PI*2.0));return (2.0*t)/(t*t+1.0);}float projectLineThickness(float tileY) {float thickness=1.0/circumferenceRatioAtTileY(tileY);if (u_projection_transition < 0.999) {return mix(1.0,thickness,u_projection_transition);} else {return thickness;}}vec3 projectToSphere(vec2 translatedPos,vec2 rawPos) {vec2 mercator_pos=u_projection_tile_mercator_coords.xy+u_projection_tile_mercator_coords.zw*translatedPos;float spherical_x=mercator_pos.x*PI*2.0+PI;float t=exp(PI-(mercator_pos.y*PI*2.0));
135float t2=t*t;float denom=t2+1.0;float sin_sy=(t2-1.0)/denom;float cos_sy=(2.0*t)/denom;vec3 pos=vec3(sin(spherical_x)*cos_sy,sin_sy,cos(spherical_x)*cos_sy
136);if (rawPos.y <-32767.5) {pos=vec3(0.0,1.0,0.0);}if (rawPos.y > 32766.5) {pos=vec3(0.0,-1.0,0.0);}return pos;}vec3 projectToSphere(vec2 posInTile) {return projectToSphere(posInTile,vec2(0.0,0.0));}float globeComputeClippingZ(vec3 spherePos) {return (1.0-(dot(spherePos,u_projection_clipping_plane.xyz)+u_projection_clipping_plane.w));}vec4 interpolateProjection(vec2 posInTile,vec3 spherePos,float elevation) {v_projection_tile_x=posInTile.x;vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);vec4 globePosition=u_projection_matrix*vec4(elevatedPos,1.0);globePosition.z=globeComputeClippingZ(elevatedPos)*globePosition.w;if (u_projection_transition > 0.999) {return globePosition;}vec4 flatPosition=u_projection_fallback_matrix*vec4(posInTile,elevation,1.0);const float z_globeness_threshold=0.2;vec4 result=globePosition;result.z=mix(0.0,globePosition.z,clamp((u_projection_transition-z_globeness_threshold)/(1.0-z_globeness_threshold),0.0,1.0));result.xyw=mix(flatPosition.xyw,globePosition.xyw,u_projection_transition);if ((posInTile.y <-32767.5) || (posInTile.y > 32766.5)) {result=globePosition;const float poles_hidden_anim_percentage=0.02;result.z=mix(globePosition.z,100.0,pow(max((1.0-u_projection_transition)/poles_hidden_anim_percentage,0.0),8.0));}return result;}vec4 interpolateProjectionFor3D(vec2 posInTile,vec3 spherePos,float elevation) {v_projection_tile_x=posInTile.x;vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);vec4 globePosition=u_projection_matrix*vec4(elevatedPos,1.0);if (u_projection_transition > 0.999) {return globePosition;}vec4 fallbackPosition=u_projection_fallback_matrix*vec4(posInTile,elevation,1.0);return mix(fallbackPosition,globePosition,u_projection_transition);}vec4 projectTile(vec2 posInTile) {return interpolateProjection(posInTile,projectToSphere(posInTile),0.0);}vec4 projectTile(vec2 posInTile,vec2 rawPos) {return interpolateProjection(posInTile,projectToSphere(posInTile,rawPos),0.0);}vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return interpolateProjection(posInTile,projectToSphere(posInTile),elevation);}vec4 projectTileFor3D(vec2 posInTile,float elevation) {vec3 spherePos=projectToSphere(posInTile,posInTile);return interpolateProjectionFor3D(posInTile,spherePos,elevation);}`),background:we(aF,nF),backgroundPattern:we(sF,oF),circle:we(lF,uF),clippingMask:we(kg,"layout(location=0) in vec2 a_pos;void main() {gl_Position=projectTile(a_pos);}"),heatmap:we(`uniform highp float u_intensity;in vec2 v_extrude;
137#pragma maplibre: define highp float weight
138#define GAUSS_COEF 0.3989422804014327
139void main() {
140#pragma maplibre: initialize highp float weight
141float d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);fragColor=vec4(val,1.0,1.0,1.0);
142#ifdef OVERDRAW_INSPECTOR
143fragColor=vec4(1.0);
144#endif
145}`,`uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;uniform highp float u_globe_extrude_scale;layout(location=0) in ivec2 a_pos;out vec2 v_extrude;
146#pragma maplibre: define highp float weight
147#pragma maplibre: define mediump float radius
148const highp float ZERO=1.0/255.0/16.0;
149#define GAUSS_COEF 0.3989422804014327
150void main(void) {
151#pragma maplibre: initialize highp float weight
152#pragma maplibre: initialize mediump float radius
153ivec2 pos_raw=a_pos+32768;vec2 unscaled_extrude=vec2(pos_raw & 7)/7.0*2.0-1.0;float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec2 circle_center=vec2(pos_raw >> 3);
154#ifdef GLOBE
155vec2 angles=v_extrude*radius*u_globe_extrude_scale;vec3 center_vector=projectToSphere(circle_center);vec3 corner_vector=globeRotateVector(center_vector,angles);gl_Position=interpolateProjection(circle_center+extrude,corner_vector,0.0);
156#else
157gl_Position=projectTileFor3D(circle_center+extrude,get_elevation(circle_center));
158#endif
159}`),heatmapTexture:we(`uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;in vec2 v_pos;void main() {float t=texture(u_image,v_pos).r;vec4 color=texture(u_color_ramp,vec2(t,0.5));fragColor=color*u_opacity;
160#ifdef OVERDRAW_INSPECTOR
161fragColor=vec4(0.0);
162#endif
163}`,"uniform mat4 u_matrix;layout(location=0) in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos*u_world_size,0,1);v_pos.x=a_pos.x;v_pos.y=1.0-a_pos.y;}"),collisionBox:we("flat in float v_placed;flat in float v_notUsed;void main() {float alpha=0.5;fragColor=vec4(1.0,0.0,0.0,1.0)*alpha;if (v_placed > 0.5) {fragColor=vec4(0.0,0.0,1.0,0.5)*alpha;}if (v_notUsed > 0.5) {fragColor*=.1;}}","layout(location=0) in vec2 a_anchor_pos;layout(location=1) in vec2 a_placed;layout(location=2) in vec2 a_box_real;flat out float v_placed;flat out float v_notUsed;void main() {gl_Position=projectTileWithElevation(a_anchor_pos,get_elevation(a_anchor_pos));gl_Position.xy=((a_box_real+0.5)*u_pixel_extrude_scale*2.0-1.0)*vec2(1.0,-1.0)*gl_Position.w;if (gl_Position.z/gl_Position.w < 1.1) {gl_Position.z=0.5;}v_placed=a_placed.x;v_notUsed=a_placed.y;}"),collisionCircle:we("flat in float v_radius;in vec2 v_extrude;flat in float v_collision;void main() {float alpha=0.5;float stroke_radius=0.9;float distance_to_center=length(v_extrude);float distance_to_edge=abs(distance_to_center-v_radius);float opacity_t=smoothstep(-stroke_radius,0.0,-distance_to_edge);vec4 color=mix(vec4(0.0,0.0,1.0,0.5),vec4(1.0,0.0,0.0,1.0),v_collision);fragColor=color*alpha*opacity_t;}","layout(location=0) in vec2 a_pos;layout(location=1) in float a_radius;layout(location=2) in vec2 a_flags;flat out float v_radius;out vec2 v_extrude;flat out float v_collision;void main() {float radius=a_radius;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2(mix(-1.0,1.0,float(vertexIdx >=2.0)),mix(-1.0,1.0,float(vertexIdx >=1.0 && vertexIdx <=2.0)));vec2 quadVertexExtent=quadVertexOffset*radius;float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_collision=collision;gl_Position=vec4((a_pos/u_viewport_size*2.0-1.0)*vec2(1.0,-1.0),0.0,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}"),colorRelief:we(`#ifdef GL_ES
164precision highp float;
165#endif
166uniform sampler2D u_image;uniform vec4 u_unpack;uniform sampler2D u_elevation_stops;uniform sampler2D u_color_stops;uniform int u_color_ramp_size;uniform float u_opacity;in vec2 v_pos;float getElevation(vec2 coord) {vec4 data=texture(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack);}float getElevationStop(int stop) {vec4 data=texelFetch(u_elevation_stops,ivec2(stop,0),0)*255.0;data.a=-1.0;return dot(data,u_unpack);}void main() {float el=getElevation(v_pos);int r=(u_color_ramp_size-1);int l=0;float el_l=getElevationStop(l);float el_r=getElevationStop(r);while(r-l > 1){int m=(r+l)/2;float el_m=getElevationStop(m);if(el < el_m){r=m;el_r=el_m;}else
167{l=m;el_l=el_m;}}float x=(float(l)+(el-el_l)/(el_r-el_l)+0.5)/float(u_color_ramp_size);fragColor=u_opacity*texture(u_color_stops,vec2(x,0));
168#ifdef OVERDRAW_INSPECTOR
169fragColor=vec4(1.0);
170#endif
171}`,"uniform vec2 u_dimension;layout(location=0) in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=projectTile(a_pos,a_pos);highp vec2 epsilon=2.0/u_dimension;float scale=(u_dimension.x-4.0)/u_dimension.x;v_pos=(a_pos/8192.0)*scale+epsilon;if (a_pos.y <-32767.5) {v_pos.y=0.0;}if (a_pos.y > 32766.5) {v_pos.y=1.0;}}"),debug:we("uniform highp vec4 u_color;uniform sampler2D u_overlay;in vec2 v_uv;void main() {vec4 overlay_color=texture(u_overlay,v_uv);fragColor=mix(u_color,overlay_color,overlay_color.a);}","layout(location=0) in vec2 a_pos;out vec2 v_uv;uniform float u_overlay_scale;void main() {v_uv=a_pos/8192.0;gl_Position=projectTileWithElevation(a_pos*u_overlay_scale,get_elevation(a_pos));}"),depth:we(kg,`layout(location=0) in vec2 a_pos;void main() {
172#ifdef GLOBE
173gl_Position=projectTileFor3D(a_pos,0.0);
174#else
175gl_Position=u_projection_matrix*vec4(a_pos,0.0,1.0);
176#endif
177}`),fill:we(`#pragma maplibre: define highp vec4 color
178#pragma maplibre: define lowp float opacity
179void main() {
180#pragma maplibre: initialize highp vec4 color
181#pragma maplibre: initialize lowp float opacity
182fragColor=color*opacity;
183#ifdef OVERDRAW_INSPECTOR
184fragColor=vec4(1.0);
185#endif
186}`,`uniform vec2 u_fill_translate;layout(location=0) in vec2 a_pos;
187#pragma maplibre: define highp vec4 color
188#pragma maplibre: define lowp float opacity
189void main() {
190#pragma maplibre: initialize highp vec4 color
191#pragma maplibre: initialize lowp float opacity
192if (opacity < 0.01) {gl_Position=vec4(-2.0,-2.0,-2.0,1.0);return;}gl_Position=projectTile(a_pos+u_fill_translate,a_pos);}`),fillOutline:we(`in vec2 v_pos;
193#ifdef GLOBE
194in float v_depth;
195#endif
196#pragma maplibre: define highp vec4 outline_color
197#pragma maplibre: define lowp float opacity
198void main() {
199#pragma maplibre: initialize highp vec4 outline_color
200#pragma maplibre: initialize lowp float opacity
201float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);fragColor=outline_color*(alpha*opacity);
202#ifdef GLOBE
203if (v_depth > 1.0) {discard;}
204#endif
205#ifdef OVERDRAW_INSPECTOR
206fragColor=vec4(1.0);
207#endif
208}`,`uniform vec2 u_fill_translate;layout(location=0) in vec2 a_pos;out vec2 v_pos;
209#ifdef GLOBE
210out float v_depth;
211#endif
212#pragma maplibre: define highp vec4 outline_color
213#pragma maplibre: define lowp float opacity
214void main() {
215#pragma maplibre: initialize highp vec4 outline_color
216#pragma maplibre: initialize lowp float opacity
217if (opacity < 0.01) {gl_Position=vec4(-2.0,-2.0,-2.0,1.0);return;}gl_Position=projectTile(a_pos+u_fill_translate,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world_size;
218#ifdef GLOBE
219v_depth=gl_Position.z/gl_Position.w;
220#endif
221}`),fillOutlinePattern:we(`uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_fade;uniform bool u_sdf_pattern;in vec2 v_pos_a;in vec2 v_pos_b;in vec2 v_pos;
222#ifdef GLOBE
223in float v_depth;
224#endif
225#pragma maplibre: define lowp float opacity
226#pragma maplibre: define highp vec4 color
227#pragma maplibre: define lowp vec4 pattern_from
228#pragma maplibre: define lowp vec4 pattern_to
229void main() {
230#pragma maplibre: initialize lowp float opacity
231#pragma maplibre: initialize highp vec4 color
232#pragma maplibre: initialize mediump vec4 pattern_from
233#pragma maplibre: initialize mediump vec4 pattern_to
234vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);if (u_sdf_pattern) {highp float sdf_edge=(256.0-64.0)/256.0;highp float sdf_gamma_a=max(fwidth(color1.a)*0.5,1.0/255.0/16.0);highp float sdf_gamma_b=max(fwidth(color2.a)*0.5,1.0/255.0/16.0);float sdf_alpha_a=smoothstep(sdf_edge-sdf_gamma_a,sdf_edge+sdf_gamma_a,color1.a);float sdf_alpha_b=smoothstep(sdf_edge-sdf_gamma_b,sdf_edge+sdf_gamma_b,color2.a);fragColor=mix(color*sdf_alpha_a,color*sdf_alpha_b,u_fade)*alpha*opacity;} else {fragColor=mix(color1,color2,u_fade)*alpha*opacity;}
235#ifdef GLOBE
236if (v_depth > 1.0) {discard;}
237#endif
238#ifdef OVERDRAW_INSPECTOR
239fragColor=vec4(1.0);
240#endif
241}`,`uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;uniform vec2 u_fill_translate;layout(location=0) in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b;out vec2 v_pos;
242#ifdef GLOBE
243out float v_depth;
244#endif
245#pragma maplibre: define lowp float opacity
246#pragma maplibre: define highp vec4 color
247#pragma maplibre: define lowp vec4 pattern_from
248#pragma maplibre: define lowp vec4 pattern_to
249#pragma maplibre: define lowp float pixel_ratio_from
250#pragma maplibre: define lowp float pixel_ratio_to
251void main() {
252#pragma maplibre: initialize lowp float opacity
253#pragma maplibre: initialize highp vec4 color
254#pragma maplibre: initialize mediump vec4 pattern_from
255#pragma maplibre: initialize mediump vec4 pattern_to
256#pragma maplibre: initialize lowp float pixel_ratio_from
257#pragma maplibre: initialize lowp float pixel_ratio_to
258if (opacity < 0.01) {gl_Position=vec4(-2.0,-2.0,-2.0,1.0);return;}vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;gl_Position=projectTile(a_pos+u_fill_translate,a_pos);vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world_size;
259#ifdef GLOBE
260v_depth=gl_Position.z/gl_Position.w;
261#endif
262}`),fillPattern:we(`#ifdef GL_ES
263precision highp float;
264#endif
265uniform vec2 u_texsize;uniform float u_fade;uniform bool u_sdf_pattern;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b;
266#pragma maplibre: define lowp float opacity
267#pragma maplibre: define highp vec4 color
268#pragma maplibre: define lowp vec4 pattern_from
269#pragma maplibre: define lowp vec4 pattern_to
270void main() {
271#pragma maplibre: initialize lowp float opacity
272#pragma maplibre: initialize highp vec4 color
273#pragma maplibre: initialize mediump vec4 pattern_from
274#pragma maplibre: initialize mediump vec4 pattern_to
275vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);if (u_sdf_pattern) {highp float sdf_edge=(256.0-64.0)/256.0;highp float sdf_gamma_a=max(fwidth(color1.a)*0.5,1.0/255.0/16.0);highp float sdf_gamma_b=max(fwidth(color2.a)*0.5,1.0/255.0/16.0);float sdf_alpha_a=smoothstep(sdf_edge-sdf_gamma_a,sdf_edge+sdf_gamma_a,color1.a);float sdf_alpha_b=smoothstep(sdf_edge-sdf_gamma_b,sdf_edge+sdf_gamma_b,color2.a);fragColor=mix(color*sdf_alpha_a,color*sdf_alpha_b,u_fade)*opacity;} else {fragColor=mix(color1,color2,u_fade)*opacity;}
276#ifdef OVERDRAW_INSPECTOR
277fragColor=vec4(1.0);
278#endif
279}`,`uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;uniform vec2 u_fill_translate;layout(location=0) in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b;
280#pragma maplibre: define lowp float opacity
281#pragma maplibre: define highp vec4 color
282#pragma maplibre: define lowp vec4 pattern_from
283#pragma maplibre: define lowp vec4 pattern_to
284#pragma maplibre: define lowp float pixel_ratio_from
285#pragma maplibre: define lowp float pixel_ratio_to
286void main() {
287#pragma maplibre: initialize lowp float opacity
288#pragma maplibre: initialize highp vec4 color
289#pragma maplibre: initialize mediump vec4 pattern_from
290#pragma maplibre: initialize mediump vec4 pattern_to
291#pragma maplibre: initialize lowp float pixel_ratio_from
292#pragma maplibre: initialize lowp float pixel_ratio_to
293if (opacity < 0.01) {gl_Position=vec4(-2.0,-2.0,-2.0,1.0);return;}vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;gl_Position=projectTile(a_pos+u_fill_translate,a_pos);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileZoomRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileZoomRatio,a_pos);}`),fillExtrusion:we(`in vec4 v_color;void main() {fragColor=v_color;
294#ifdef OVERDRAW_INSPECTOR
295fragColor=vec4(1.0);
296#endif
297}`,`uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp vec3 u_lightpos_globe;uniform l
297owp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec2 u_fill_translate;layout(location=0) in vec2 a_pos;layout(location=1) in ivec4 a_normal_ed;
298#ifdef TERRAIN3D
299layout(location=2) in vec2 a_centroid;
300#endif
301out vec4 v_color;
302#pragma maplibre: define highp float base
303#pragma maplibre: define highp float height
304#pragma maplibre: define highp vec4 color
305void main() {
306#pragma maplibre: initialize highp float base
307#pragma maplibre: initialize highp float height
308#pragma maplibre: initialize highp vec4 color
309vec3 normal=vec3(a_normal_ed.xyz);float gradient_base=max(0.0,base);float gradient_height=max(0.0,height);
310#ifdef TERRAIN3D
311float height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);
312#else
313float height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;
314#endif
315base=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=float(a_normal_ed.x & 1);float elevation=t > 0.0 ? height : base;vec2 posInTile=a_pos+u_fill_translate;
316#ifdef GLOBE
317vec3 spherePos=projectToSphere(posInTile,a_pos);gl_Position=interpolateProjectionFor3D(posInTile,spherePos,elevation);
318#else
319gl_Position=u_projection_matrix*vec4(posInTile,elevation,1.0);
320#endif
321float colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;v_color=vec4(0.0,0.0,0.0,1.0);vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;vec3 normalForLighting=normal/16384.0;float directional=clamp(dot(normalForLighting,u_lightpos),0.0,1.0);
322#ifdef GLOBE
323mat3 rotMatrix=globeGetRotationMatrix(spherePos);normalForLighting=rotMatrix*normalForLighting;directional=mix(directional,clamp(dot(normalForLighting,u_lightpos_globe),0.0,1.0),u_projection_transition);
324#endif
325directional=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+gradient_base)*pow(gradient_height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_color.r+=clamp(color.r*directional*u_lightcolor.r,mix(0.0,0.3,1.0-u_lightcolor.r),1.0);v_color.g+=clamp(color.g*directional*u_lightcolor.g,mix(0.0,0.3,1.0-u_lightcolor.g),1.0);v_color.b+=clamp(color.b*directional*u_lightcolor.b,mix(0.0,0.3,1.0-u_lightcolor.b),1.0);v_color*=u_opacity;}`),fillExtrusionPattern:we(`uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b;in vec4 v_lighting;
326#pragma maplibre: define lowp float base
327#pragma maplibre: define lowp float height
328#pragma maplibre: define lowp vec4 pattern_from
329#pragma maplibre: define lowp vec4 pattern_to
330#pragma maplibre: define lowp float pixel_ratio_from
331#pragma maplibre: define lowp float pixel_ratio_to
332void main() {
333#pragma maplibre: initialize lowp float base
334#pragma maplibre: initialize lowp float height
335#pragma maplibre: initialize mediump vec4 pattern_from
336#pragma maplibre: initialize mediump vec4 pattern_to
337#pragma maplibre: initialize lowp float pixel_ratio_from
338#pragma maplibre: initialize lowp float pixel_ratio_to
339vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);vec4 mixedColor=mix(color1,color2,u_fade);fragColor=mixedColor*v_lighting;
340#ifdef OVERDRAW_INSPECTOR
341fragColor=vec4(1.0);
342#endif
343}`,`uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform vec3 u_scale;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec2 u_fill_translate;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp vec3 u_lightpos_globe;uniform lowp float u_lightintensity;layout(location=0) in vec2 a_pos;layout(location=1) in ivec4 a_normal_ed;
344#ifdef TERRAIN3D
345layout(location=2) in vec2 a_centroid;
346#endif
347#ifdef GLOBE
348out vec3 v_sphere_pos;
349#endif
350out vec2 v_pos_a;out vec2 v_pos_b;out vec4 v_lighting;
351#pragma maplibre: define lowp float base
352#pragma maplibre: define lowp float height
353#pragma maplibre: define lowp vec4 pattern_from
354#pragma maplibre: define lowp vec4 pattern_to
355#pragma maplibre: define lowp float pixel_ratio_from
356#pragma maplibre: define lowp float pixel_ratio_to
357void main() {
358#pragma maplibre: initialize lowp float base
359#pragma maplibre: initialize lowp float height
360#pragma maplibre: initialize mediump vec4 pattern_from
361#pragma maplibre: initialize mediump vec4 pattern_to
362#pragma maplibre: initialize lowp float pixel_ratio_from
363#pragma maplibre: initialize lowp float pixel_ratio_to
364vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec3 normal=vec3(a_normal_ed.xyz);float edgedistance=float(a_normal_ed.w);vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;float gradient_base=max(0.0,base);float gradient_height=max(0.0,height);
365#ifdef TERRAIN3D
366float height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);
367#else
368float height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;
369#endif
370base=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=float(a_normal_ed.x & 1);float elevation=t > 0.0 ? height : base;vec2 posInTile=a_pos+u_fill_translate;
371#ifdef GLOBE
372vec3 spherePos=projectToSphere(posInTile,a_pos);vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);v_sphere_pos=elevatedPos;gl_Position=interpolateProjectionFor3D(posInTile,spherePos,elevation);
373#else
374gl_Position=u_projection_matrix*vec4(posInTile,elevation,1.0);
375#endif
376vec2 pos=a_normal_ed.x==1 && a_normal_ed.y==0 && a_normal_ed.z==16384
377? a_pos
378: vec2(edgedistance,elevation*u_height_factor);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float directional=clamp(dot(normal/16383.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+gradient_base)*pow(gradient_height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_lighting.rgb+=clamp(directional*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;}`),hillshadePrepare:we(`#ifdef GL_ES
379precision highp float;
380#endif
381uniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform vec4 u_unpack;float getElevation(ivec2 texel) {vec4 data=texelFetch(u_image,texel,0)*255.0;data.a=-1.0;return dot(data,u_unpack);}void main() {ivec2 pos=ivec2(gl_FragCoord.xy)+ivec2(1);float tileSize=u_dimension.x-4.0;float a=getElevation(pos+ivec2(-1,-1));float b=getElevation(pos+ivec2(0,-1));float c=getElevation(pos+ivec2(1,-1));float d=getElevation(pos+ivec2(-1,0));float e=getElevation(pos);float f=getElevation(pos+ivec2(1,0));float g=getElevation(pos+ivec2(-1,1));float h=getElevation(pos+ivec2(0,1));float i=getElevation(pos+ivec2(1,1));float exaggerationFactor=u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;float exaggeration=u_zoom < 15.0 ? (u_zoom-15.0)*exaggerationFactor : 0.0;vec2 deriv=vec2((c+f+f+i)-(a+d+d+g),(g+h+h+i)-(a+b+b+c))*tileSize/p
381ow(2.0,exaggeration+(28.2562-u_zoom));fragColor=clamp(vec4(deriv.x/8.0+0.5,deriv.y/8.0+0.5,1.0,1.0),0.0,1.0);
382#ifdef OVERDRAW_INSPECTOR
383fragColor=vec4(1.0);
384#endif
385}`,"uniform mat4 u_matrix;uniform vec2 u_dimension;layout(location=0) in vec2 a_pos;layout(location=1) in vec2 a_texture_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}"),hillshade:we(`uniform sampler2D u_image;in highp vec2 v_pos;uniform vec2 u_latrange;uniform float u_exaggeration;uniform vec4 u_accent;uniform int u_method;uniform float u_altitudes[NUM_ILLUMINATION_SOURCES];uniform float u_azimuths[NUM_ILLUMINATION_SOURCES];uniform vec4 u_shadows[NUM_ILLUMINATION_SOURCES];uniform vec4 u_highlights[NUM_ILLUMINATION_SOURCES];
386#define PI 3.141592653589793
387#define STANDARD 0
388#define COMBINED 1
389#define IGOR 2
390#define MULTIDIRECTIONAL 3
391#define BASIC 4
392float get_aspect(vec2 deriv){return deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);}void igor_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;float aspect=get_aspect(deriv);float azimuth=u_azimuths[0]+PI;float slope_stength=atan(length(deriv))*2.0/PI;float aspect_strength=1.0-abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);float shadow_strength=slope_stength*aspect_strength;float highlight_strength=slope_stength*(1.0-aspect_strength);fragColor=u_shadows[0]*shadow_strength+u_highlights[0]*highlight_strength;}void standard_hillshade(vec2 deriv){float azimuth=u_azimuths[0]+PI;float slope=atan(0.625*length(deriv));float aspect=get_aspect(deriv);float intensity=u_exaggeration;float base=1.875-intensity*1.75;float maxValue=0.5*PI;float scaledSlope=intensity !=0.5 ? ((pow(base,slope)-1.0)/(pow(base,maxValue)-1.0))*maxValue : slope;float accent=cos(scaledSlope);vec4 accent_color=(1.0-accent)*u_accent*clamp(intensity*2.0,0.0,1.0);float shade=abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);vec4 shade_color=mix(u_shadows[0],u_highlights[0],shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);fragColor=accent_color*(1.0-shade_color.a)+shade_color;}void basic_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;float azimuth=u_azimuths[0]+PI;float cos_az=cos(azimuth);float sin_az=sin(azimuth);float cos_alt=cos(u_altitudes[0]);float sin_alt=sin(u_altitudes[0]);float cang=(sin_alt-(deriv.y*cos_az*cos_alt-deriv.x*sin_az*cos_alt))/sqrt(1.0+dot(deriv,deriv));float shade=clamp(cang,0.0,1.0);if(shade > 0.5){fragColor=u_highlights[0]*(2.0*shade-1.0);}else
393{fragColor=u_shadows[0]*(1.0-2.0*shade);}}void multidirectional_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;fragColor=vec4(0,0,0,0);for(int i=0; i < NUM_ILLUMINATION_SOURCES; i++){float cos_alt=cos(u_altitudes[i]);float sin_alt=sin(u_altitudes[i]);float cos_az=-cos(u_azimuths[i]);float sin_az=-sin(u_azimuths[i]);float cang=(sin_alt-(deriv.y*cos_az*cos_alt-deriv.x*sin_az*cos_alt))/sqrt(1.0+dot(deriv,deriv));float shade=clamp(cang,0.0,1.0);if(shade > 0.5){fragColor+=u_highlights[i]*(2.0*shade-1.0)/float(NUM_ILLUMINATION_SOURCES);}else
394{fragColor+=u_shadows[i]*(1.0-2.0*shade)/float(NUM_ILLUMINATION_SOURCES);}}}void combined_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;float azimuth=u_azimuths[0]+PI;float cos_az=cos(azimuth);float sin_az=sin(azimuth);float cos_alt=cos(u_altitudes[0]);float sin_alt=sin(u_altitudes[0]);float cang=acos((sin_alt-(deriv.y*cos_az*cos_alt-deriv.x*sin_az*cos_alt))/sqrt(1.0+dot(deriv,deriv)));cang=clamp(cang,0.0,PI/2.0);float shade=cang*atan(length(deriv))*4.0/PI/PI;float highlight=(PI/2.0-cang)*atan(length(deriv))*4.0/PI/PI;fragColor=u_shadows[0]*shade+u_highlights[0]*highlight;}void main() {highp vec2 size=vec2(textureSize(u_image,0));highp vec2 texturePos=(v_pos*(size-2.0)+1.0)/size;vec4 pixel=texture(u_image,texturePos);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));vec2 deriv=((pixel.rg*8.0)-4.0)/scaleFactor;if (u_method==BASIC) {basic_hillshade(deriv);} else if (u_method==COMBINED) {combined_hillshade(deriv);} else if (u_method==IGOR) {igor_hillshade(deriv);} else if (u_method==MULTIDIRECTIONAL) {multidirectional_hillshade(deriv);} else if (u_method==STANDARD) {standard_hillshade(deriv);} else {standard_hillshade(deriv);}
395#ifdef OVERDRAW_INSPECTOR
396fragColor=vec4(1.0);
397#endif
398}`,"uniform mat4 u_matrix;layout(location=0) in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=projectTile(a_pos,a_pos);v_pos=a_pos/8192.0;if (a_pos.y <-32767.5) {v_pos.y=0.0;}if (a_pos.y > 32766.5) {v_pos.y=1.0;}}"),line:we(`flat in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale;
399#ifdef GLOBE
400in float v_depth;
401#endif
402#pragma maplibre: define highp vec4 color
403#pragma maplibre: define lowp float blur
404#pragma maplibre: define lowp float opacity
405void main() {
406#pragma maplibre: initialize highp vec4 color
407#pragma maplibre: initialize lowp float blur
408#pragma maplibre: initialize lowp float opacity
409clipAntimeridian();float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);fragColor=color*(alpha*opacity);
410#ifdef GLOBE
411if (v_depth > 1.0) {discard;}
412#endif
413#ifdef OVERDRAW_INSPECTOR
414fragColor=vec4(1.0);
415#endif
416}`,`
417#define scale 0.015873016
418layout(location=0) in ivec2 a_pos_normal;layout(location=1) in uvec4 a_data;uniform vec2 u_translation;uniform mediump float u_ratio;out vec2 v_normal;flat out vec2 v_width2;out float v_gamma_scale;out highp float v_linesofar;
419#ifdef GLOBE
420out float v_depth;
421#endif
422#pragma maplibre: define highp vec4 color
423#pragma maplibre: define lowp float blur
424#pragma maplibre: define lowp float opacity
425#pragma maplibre: define mediump float gapwidth
426#pragma maplibre: define lowp float offset
427#pragma maplibre: define mediump float width
428void main() {
429#pragma maplibre: initialize highp vec4 color
430#pragma maplibre: initialize lowp float blur
431#pragma maplibre: initialize lowp float opacity
432#pragma maplibre: initialize mediump float gapwidth
433#pragma maplibre: initialize lowp float offset
434#pragma maplibre: initialize mediump float width
435if (opacity < 0.01) {gl_Position=vec4(-2.0,-2.0,-2.0,1.0);return;}float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=vec2(ivec2(a_data.xy)-128);float a_direction=float(int(a_data.z & 3u)-1);v_linesofar=float((a_data.z >> 2u)+a_data.w*64u)*2.0;vec2 pos=vec2(a_pos_normal >> 1);mediump vec2 normal=vec2(a_pos_normal & 1);normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);
435float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;
436#ifdef GLOBE
437v_depth=gl_Position.z/gl_Position.w;
438#endif
439#ifdef TERRAIN3D
440v_gamma_scale=1.0;
441#else
442float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
443#endif
444v_width2=vec2(outset,inset);}`),lineGradient:we(`uniform sampler2D u_image;flat in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale;in highp vec2 v_uv;
445#ifdef GLOBE
446in float v_depth;
447#endif
448#pragma maplibre: define lowp float blur
449#pragma maplibre: define lowp float opacity
450void main() {
451#pragma maplibre: initialize lowp float blur
452#pragma maplibre: initialize lowp float opacity
453clipAntimeridian();float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);vec4 color=texture(u_image,v_uv);fragColor=color*(alpha*opacity);
454#ifdef GLOBE
455if (v_depth > 1.0) {discard;}
456#endif
457#ifdef OVERDRAW_INSPECTOR
458fragColor=vec4(1.0);
459#endif
460}`,`
461#define scale 0.015873016
462layout(location=0) in ivec2 a_pos_normal;layout(location=1) in uvec4 a_data;layout(location=2) in float a_uv_x;layout(location=3) in float a_split_index;uniform vec2 u_translation;uniform mediump float u_ratio;uniform float u_image_height;out vec2 v_normal;flat out vec2 v_width2;out float v_gamma_scale;out highp vec2 v_uv;
463#ifdef GLOBE
464out float v_depth;
465#endif
466#pragma maplibre: define lowp float blur
467#pragma maplibre: define lowp float opacity
468#pragma maplibre: define mediump float gapwidth
469#pragma maplibre: define lowp float offset
470#pragma maplibre: define mediump float width
471void main() {
472#pragma maplibre: initialize lowp float blur
473#pragma maplibre: initialize lowp float opacity
474#pragma maplibre: initialize mediump float gapwidth
475#pragma maplibre: initialize lowp float offset
476#pragma maplibre: initialize mediump float width
477if (opacity < 0.01) {gl_Position=vec4(-2.0,-2.0,-2.0,1.0);return;}float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=vec2(ivec2(a_data.xy)-128);float a_direction=float(int(a_data.z & 3u)-1);highp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec2(a_uv_x,a_split_index*texel_height-half_texel_height);vec2 pos=vec2(a_pos_normal >> 1);mediump vec2 normal=vec2(a_pos_normal & 1);normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;
478#ifdef GLOBE
479v_depth=gl_Position.z/gl_Position.w;
480#endif
481#ifdef TERRAIN3D
482v_gamma_scale=1.0;
483#else
484float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
485#endif
486v_width2=vec2(outset,inset);}`),linePattern:we(`#ifdef GL_ES
487precision highp float;
488#endif
489uniform vec2 u_texsize;uniform float u_fade;uniform mediump vec3 u_scale;uniform sampler2D u_image;in vec2 v_normal;flat in vec2 v_width2;in float v_linesofar;in float v_gamma_scale;flat in float v_width;
490#ifdef GLOBE
491in float v_depth;
492#endif
493#pragma maplibre: define lowp vec4 pattern_from
494#pragma maplibre: define lowp vec4 pattern_to
495#pragma maplibre: define lowp float pixel_ratio_from
496#pragma maplibre: define lowp float pixel_ratio_to
497#pragma maplibre: define lowp float blur
498#pragma maplibre: define lowp float opacity
499void main() {
500#pragma maplibre: initialize mediump vec4 pattern_from
501#pragma maplibre: initialize mediump vec4 pattern_to
502#pragma maplibre: initialize lowp float pixel_ratio_from
503#pragma maplibre: initialize lowp float pixel_ratio_to
504#pragma maplibre: initialize lowp float blur
505#pragma maplibre: initialize lowp float opacity
506clipAntimeridian();vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;vec2 pattern_size_a=vec2(display_size_a.x*fromScale/tileZoomRatio,display_size_a.y);vec2 pattern_size_b=vec2(display_size_b.x*toScale/tileZoomRatio,display_size_b.y);float aspect_a=display_size_a.y/v_width;float aspect_b=display_size_b.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float x_a=mod(v_linesofar/pattern_size_a.x*aspect_a,1.0);float x_b=mod(v_linesofar/pattern_size_b.x*aspect_b,1.0);float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;vec2 pos_a=mix(pattern_tl_a*texel_size-texel_size,pattern_br_a*texel_size+texel_size,vec2(x_a,y));vec2 pos_b=mix(pattern_tl_b*texel_size-texel_size,pattern_br_b*texel_size+texel_size,vec2(x_b,y));vec4 color=mix(texture(u_image,pos_a),texture(u_image,pos_b),u_fade);fragColor=color*alpha*opacity;
507#ifdef GLOBE
508if (v_depth > 1.0) {discard;}
509#endif
510#ifdef OVERDRAW_INSPECTOR
511fragColor=vec4(1.0);
512#endif
513}`,`
514#define scale 0.015873016
515#define LINE_DISTANCE_SCALE 2.0
516layout(location=0) in ivec2 a_pos_normal;layout(location=1) in uvec4 a_data;uniform vec2 u_translation;uniform mediump float u_ratio;out vec2 v_normal;flat out vec2 v_width2;out float v_linesofar;out float v_gamma_scale;flat out float v_width;
517#ifdef GLOBE
518out float v_depth;
519#endif
520#pragma maplibre: define lowp float blur
521#pragma maplibre: define lowp float opacity
522#pragma maplibre: define lowp float offset
523#pragma maplibre: define mediump float gapwidth
524#pragma maplibre: define mediump float width
525#pragma maplibre: define lowp float floorwidth
526#pragma maplibre: define lowp vec4 pattern_from
527#pragma maplibre: define lowp vec4 pattern_to
528#pragma maplibre: define lowp float pixel_ratio_from
529#pragma maplibre: define lowp float pixel_ratio_to
530void main() {
531#pragma maplibre: initialize lowp float blur
532#pragma maplibre: initialize lowp float opacity
533#pragma maplibre: initialize lowp float offset
534#pragma maplibre: initialize mediump float gapwidth
535#pragma maplibre: initialize mediump float width
536#pragma maplibre: initialize lowp float floorwidth
537#pragma maplibre: initialize mediump vec4 pattern_from
538#pragma maplibre: initialize mediump vec4 pattern_to
539#pragma maplibre: initialize lowp float pixel_ratio_from
540#pragma maplibre: initialize lowp float pixel_ratio_to
541if (opacity < 0.01) {gl_Position=vec4(-2.0,-2.0,-2.0,1.0);return;}float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=vec2(ivec2(a_data.xy)-128);float a_direction=float(int(a_data.z & 3u)-1);float a_linesofar=float((a_data.z >> 2u)+a_data.w*64u)*LINE_DISTANCE_SCALE;vec2 pos=vec2(a_pos_normal >> 1);mediump vec2 normal=vec2(a_pos_normal & 1);normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);
541float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;
542#ifdef GLOBE
543v_depth=gl_Position.z/gl_Position.w;
544#endif
545#ifdef TERRAIN3D
546v_gamma_scale=1.0;
547#else
548float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
549#endif
550v_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}`),lineSDF:we(`uniform lowp float u_lineatlas_width;uniform sampler2D u_image;uniform float u_mix;in vec2 v_normal;flat in vec2 v_width2;in vec2 v_tex_a;in vec2 v_tex_b;in float v_gamma_scale;
551#ifdef GLOBE
552in float v_depth;
553#endif
554#pragma maplibre: define highp vec4 color
555#pragma maplibre: define lowp float blur
556#pragma maplibre: define lowp float opacity
557#pragma maplibre: define mediump float width
558#pragma maplibre: define lowp float floorwidth
559#pragma maplibre: define mediump vec4 dasharray_from
560#pragma maplibre: define mediump vec4 dasharray_to
561void main() {
562#pragma maplibre: initialize highp vec4 color
563#pragma maplibre: initialize lowp float blur
564#pragma maplibre: initialize lowp float opacity
565#pragma maplibre: initialize mediump float width
566#pragma maplibre: initialize lowp float floorwidth
567#pragma maplibre: initialize mediump vec4 dasharray_from
568#pragma maplibre: initialize mediump vec4 dasharray_to
569clipAntimeridian();float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float sdfdist_a=texture(u_image,v_tex_a).a;float sdfdist_b=texture(u_image,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);
569float sdfgamma=(u_lineatlas_width/256.0/u_device_pixel_ratio)/min(dasharray_from.w,dasharray_to.w);alpha*=smoothstep(0.5-sdfgamma/floorwidth,0.5+sdfgamma/floorwidth,sdfdist);fragColor=color*(alpha*opacity);
570#ifdef GLOBE
571if (v_depth > 1.0) {discard;}
572#endif
573#ifdef OVERDRAW_INSPECTOR
574fragColor=vec4(1.0);
575#endif
576}`,`
577#define scale 0.015873016
578#define LINE_DISTANCE_SCALE 2.0
579layout(location=0) in ivec2 a_pos_normal;layout(location=1) in uvec4 a_data;uniform vec2 u_translation;uniform mediump float u_ratio;uniform float u_tileratio;uniform float u_crossfade_from;uniform float u_crossfade_to;uniform float u_lineatlas_height;out vec2 v_normal;flat out vec2 v_width2;out vec2 v_tex_a;out vec2 v_tex_b;out float v_gamma_scale;
580#ifdef GLOBE
581out float v_depth;
582#endif
583#pragma maplibre: define highp vec4 color
584#pragma maplibre: define lowp float blur
585#pragma maplibre: define lowp float opacity
586#pragma maplibre: define mediump float gapwidth
587#pragma maplibre: define lowp float offset
588#pragma maplibre: define mediump float width
589#pragma maplibre: define lowp float floorwidth
590#pragma maplibre: define mediump vec4 dasharray_from
591#pragma maplibre: define mediump vec4 dasharray_to
592void main() {
593#pragma maplibre: initialize highp vec4 color
594#pragma maplibre: initialize lowp float blur
595#pragma maplibre: initialize lowp float opacity
596#pragma maplibre: initialize mediump float gapwidth
597#pragma maplibre: initialize lowp float offset
598#pragma maplibre: initialize mediump float width
599#pragma maplibre: initialize lowp float floorwidth
600#pragma maplibre: initialize mediump vec4 dasharray_from
601#pragma maplibre: initialize mediump vec4 dasharray_to
602if (opacity < 0.01) {gl_Position=vec4(-2.0,-2.0,-2.0,1.0);return;}float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=vec2(ivec2(a_data.xy)-128);float a_direction=float(int(a_data.z & 3u)-1);float a_linesofar=float((a_data.z >> 2u)+a_data.w*64u)*LINE_DISTANCE_SCALE;vec2 pos=vec2(a_pos_normal >> 1);mediump vec2 normal=vec2(a_pos_normal & 1);normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;
603#ifdef GLOBE
604v_depth=gl_Position.z/gl_Position.w;
605#endif
606#ifdef TERRAIN3D
607v_gamma_scale=1.0;
608#else
609float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
610#endif
611float u_patternscale_a_x=u_tileratio/dasharray_from.w/u_crossfade_from;float u_patternscale_a_y=-dasharray_from.z/2.0/u_lineatlas_height;float u_patternscale_b_x=u_tileratio/dasharray_to.w/u_crossfade_to;float u_patternscale_b_y=-dasharray_to.z/2.0/u_lineatlas_height;v_tex_a=vec2(a_linesofar*u_patternscale_a_x/floorwidth,normal.y*u_patternscale_a_y+(float(dasharray_from.y)+0.5)/u_lineatlas_height);v_tex_b=vec2(a_linesofar*u_patternscale_b_x/floorwidth,normal.y*u_patternscale_b_y+(float(dasharray_to.y)+0.5)/u_lineatlas_height);v_width2=vec2(outset,inset);}`),lineGradientSDF:we(`uniform sampler2D u_image;uniform sampler2D u_image_dash;uniform float u_mix;uniform lowp float u_lineatlas_width;in vec2 v_normal;flat in vec2 v_width2;in vec2 v_tex_a;in vec2 v_tex_b;in float v_gamma_scale;in highp vec2 v_uv;
612#ifdef GLOBE
613in float v_depth;
614#endif
615#pragma maplibre: define lowp float blur
616#pragma maplibre: define lowp float opacity
617#pragma maplibre: define mediump float width
618#pragma maplibre: define lowp float floorwidth
619#pragma maplibre: define mediump vec4 dasharray_from
620#pragma maplibre: define mediump vec4 dasharray_to
621void main() {
622#pragma maplibre: initialize lowp float blur
623#pragma maplibre: initialize lowp float opacity
624#pragma maplibre: initialize mediump float width
625#pragma maplibre: initialize lowp float floorwidth
626#pragma maplibre: initialize mediump vec4 dasharray_from
627#pragma maplibre: initialize mediump vec4 dasharray_to
628clipAntimeridian();float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);vec4 color=texture(u_image,v_uv);float sdfdist_a=texture(u_image_dash,v_tex_a).a;float sdfdist_b=texture(u_image_dash,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);
628float sdfgamma=(u_lineatlas_width/256.0)/min(dasharray_from.w,dasharray_to.w);float dash_alpha=smoothstep(0.5-sdfgamma/floorwidth,0.5+sdfgamma/floorwidth,sdfdist);fragColor=color*(alpha*dash_alpha*opacity);
629#ifdef GLOBE
630if (v_depth > 1.0) {discard;}
631#endif
632#ifdef OVERDRAW_INSPECTOR
633fragColor=vec4(1.0);
634#endif
635}`,`
636#define scale 0.015873016
637#define LINE_DISTANCE_SCALE 2.0
638layout(location=0) in ivec2 a_pos_normal;layout(location=1) in uvec4 a_data;layout(location=2) in float a_uv_x;layout(location=3) in float a_split_index;uniform vec2 u_translation;uniform mediump float u_ratio;uniform float u_image_height;uniform float u_tileratio;uniform float u_crossfade_from;uniform float u_crossfade_to;uniform float u_lineatlas_height;out vec2 v_normal;flat out vec2 v_width2;out float v_gamma_scale;out highp vec2 v_uv;out vec2 v_tex_a;out vec2 v_tex_b;
639#ifdef GLOBE
640out float v_depth;
641#endif
642#pragma maplibre: define lowp float blur
643#pragma maplibre: define lowp float opacity
644#pragma maplibre: define mediump float gapwidth
645#pragma maplibre: define lowp float offset
646#pragma maplibre: define mediump float width
647#pragma maplibre: define lowp float floorwidth
648#pragma maplibre: define mediump vec4 dasharray_from
649#pragma maplibre: define mediump vec4 dasharray_to
650void main() {
651#pragma maplibre: initialize lowp float blur
652#pragma maplibre: initialize lowp float opacity
653#pragma maplibre: initialize mediump float gapwidth
654#pragma maplibre: initialize lowp float offset
655#pragma maplibre: initialize mediump float width
656#pragma maplibre: initialize lowp float floorwidth
657#pragma maplibre: initialize mediump vec4 dasharray_from
658#pragma maplibre: initialize mediump vec4 dasharray_to
659if (opacity < 0.01) {gl_Position=vec4(-2.0,-2.0,-2.0,1.0);return;}float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=vec2(ivec2(a_data.xy)-128);float a_direction=float(int(a_data.z & 3u)-1);float a_linesofar=float((a_data.z >> 2u)+a_data.w*64u)*LINE_DISTANCE_SCALE;float texel_height=1.0/u_image_height;float half_texel_height=0.5*texel_height;v_uv=vec2(a_uv_x,a_split_index*texel_height-half_texel_height);vec2 pos=vec2(a_pos_normal >> 1);mediump vec2 normal=vec2(a_pos_normal & 1);normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;
660#ifdef GLOBE
661v_depth=gl_Position.z/gl_Position.w;
662#endif
663#ifdef TERRAIN3D
664v_gamma_scale=1.0;
665#else
666float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
667#endif
668float u_patternscale_a_x=u_tileratio/dasharray_from.w/u_crossfade_from;float u_patternscale_a_y=-dasharray_from.z/2.0/u_lineatlas_height;float u_patternscale_b_x=u_tileratio/dasharray_to.w/u_crossfade_to;float u_patternscale_b_y=-dasharray_to.z/2.0/u_lineatlas_height;v_tex_a=vec2(a_linesofar*u_patternscale_a_x/floorwidth,normal.y*u_patternscale_a_y+(float(dasharray_from.y)+0.5)/u_lineatlas_height);v_tex_b=vec2(a_linesofar*u_patternscale_b_x/floorwidth,normal.y*u_patternscale_b_y+(float(dasharray_to.y)+0.5)/u_lineatlas_height);v_width2=vec2(outset,inset);}`),layerOpacity:we(`uniform sampler2D u_image;uniform float u_opacity;in vec2 v_pos;void main() {fragColor=texture(u_image,v_pos)*u_opacity;
669#ifdef OVERDRAW_INSPECTOR
670fragColor=vec4(0.0);
671#endif
672}`,"layout(location=0) in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=vec4(a_pos.x*2.0-1.0,1.0-a_pos.y*2.0,0.0,1.0);v_pos.x=a_pos.x;v_pos.y=1.0-a_pos.y;}"),raster:we(`uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;in vec3 v_pos0;in vec3 v_pos1;uniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;void main() {vec4 color0=texture(u_image0,v_pos0.xy/v_pos0.z);vec4 color1=texture(u_image1,v_pos1.xy/v_pos1.z);if (color0.a > 0.0) {color0.rgb=color0.rgb/color0.a;}if (color1.a > 0.0) {color1.rgb=color1.rgb/color1.a;}vec4 color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 rgb=color.rgb;rgb=vec3(dot(rgb,u_spin_weights.xyz),dot(rgb,u_spin_weights.zxy),dot(rgb,u_spin_weights.yzx));float average=(color.r+color.g+color.b)/3.0;rgb+=(average-rgb)*u_saturation_factor;rgb=(rgb-0.5)*u_contrast_factor+0.5;vec3 u_high_vec=vec3(u_brightness_low,u_brightness_low,u_brightness_low);vec3 u_low_vec=vec3(u_brightness_high,u_brightness_high,u_brightness_high);fragColor=vec4(mix(u_high_vec,u_low_vec,rgb)*color.a,color.a);
673#ifdef OVERDRAW_INSPECTOR
674fragColor=vec4(1.0);
675#endif
676}`,`uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_buffer_scale;uniform vec3 u_image_warp;uniform vec4 u_coords_top;uniform vec4 u_coords_bottom;layout(location=0) in vec2 a_pos;out vec3 v_pos0;out vec3 v_pos1;void main() {vec2 fractionalPos=a_pos/8192.0;vec2 topLeft=u_coords_top.xy;vec2 topRight=u_coords_top.zw;vec2 bottomLeft=u_coords_bottom.xy;vec2 bottomRight=u_coords_bottom.zw;
676vec2 bilinearPos=mix(mix(topLeft,topRight,fractionalPos.x),mix(bottomLeft,bottomRight,fractionalPos.x),fractionalPos.y);float denominator=dot(u_image_warp.xy,fractionalPos)+1.0;vec2 acrossTop=topRight-topLeft+u_image_warp.x*topRight;vec2 downLeft=bottomLeft-topLeft+u_image_warp.y*bottomLeft;vec2 projectivePos=(acrossTop*fractionalPos.x+downLeft*fractionalPos.y+topLeft)/denominator;vec2 position=mix(projectivePos,bilinearPos,u_image_warp.z);gl_Position=projectTile(position,position);vec2 texturePos=((fractionalPos-0.5)/u_buffer_scale)+0.5;
677#ifdef GLOBE
678if (a_pos.y <-32767.5) {texturePos.y=0.0;}if (a_pos.y > 32766.5) {texturePos.y=1.0;}
679#endif
680float perspectiveRatio=mix(1.0/denominator,1.0,u_image_warp.z);v_pos0=vec3(texturePos*perspectiveRatio,perspectiveRatio);vec2 parentPos=(texturePos*u_scale_parent)+u_tl_parent;v_pos1=vec3(parentPos*perspectiveRatio,perspectiveRatio);}`),symbolIcon:we(`uniform sampler2D u_texture;in vec2 v_tex;flat in float v_total_opacity;void main() {fragColor=texture(u_texture,v_tex)*v_total_opacity;
681#ifdef OVERDRAW_INSPECTOR
682fragColor=vec4(1.0);
683#endif
684}`,`layout(location=0) in vec4 a_pos_offset;layout(location=1) in uvec4 a_data;layout(location=2) in vec4 a_pixeloffset;layout(location=3) in vec3 a_projected_pos;layout(location=4) in uint a_fade_opacity;layout(location=5) in float a_height_offset;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform bool u_rotate_symbol;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform vec2 u_texsize;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform vec2 u_translation;uniform float u_pitched_scale;uniform bool u_is_offset;uniform bool u_height_anchor_ground;out vec2 v_tex;flat out float v_total_opacity;
685#pragma maplibre: define lowp float opacity
686void main() {
687#pragma maplibre: initialize lowp float opacity
688vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=vec2(a_data.xy);vec2 a_size=vec2(a_data.zw);float a_size_min=float(a_data.z >> 1u);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_minFontScale=a_pixeloffset.zw/256.0;float ele=a_height_offset+(u_height_anchor_ground ? get_elevation(a_pos) : 0.0);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_symbol_fade_change :-u_symbol_fade_change;float visibility=calculate_visibility(projectedPoint);v_total_opacity=opacity*max(0.0,min(visibility,fade_opacity[0]+fade_change));if (v_total_opacity < 0.1){gl_Position=vec4(-2.,-2.,-2.,1.);return;}highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?
689camera_to_anchor_distance/u_camera_to_center_distance :
690u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);if (!u_is_offset) {size*=perspective_ratio;}float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;
691#ifdef GLOBE
692if(u_pitch_with_map) {float anchor_pos_tile_y=(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w,z,1.0)).y;projectionScaling=mix(projectionScaling,1.0/circumferenceRatioAtTileY(anchor_pos_tile_y)*u_pitched_scale,u_projection_transition);}
693#endif
694vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}gl_Position=finalPos;v_tex=a_tex/u_texsize;}`),symbolSDF:we(`#define SDF_PX 8.0
695uniform bool u_is_halo;uniform bool u_is_plain;uniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform bool u_is_text;in vec2 v_data0;in vec3 v_data1;
696#pragma maplibre: define highp vec4 fill_color
697#pragma maplibre: define highp vec4 halo_color
698#pragma maplibre: define lowp float halo_width
699#pragma maplibre: define lowp float halo_blur
700void main() {
701#pragma maplibre: initialize highp vec4 fill_color
702#pragma maplibre: initialize highp vec4 halo_color
703#pragma maplibre: initialize lowp float halo_width
704#pragma maplibre: initialize lowp float halo_blur
705float EDGE_GAMMA=0.105/u_device_pixel_ratio;vec2 tex=v_data0.xy;float gamma_scale=v_data1.x;float size=v_data1.y;float total_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float inner_edge=(256.0-64.0)/256.0;lowp float dist=texture(u_texture,tex).a;lowp vec4 color_alpha_out_text,color_alpha_out_halo;if (u_is_plain){highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(inner_edge-gamma_scaled,inner_edge+gamma_scaled,dist);color_alpha_out_text=total_opacity*alpha*fill_color;}if (u_is_halo) {float gamma_halo=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);float inner_edge_halo=inner_edge+gamma_halo*gamma_scale;highp float gamma_scaled_halo=gamma_halo*gamma_scale;highp float alpha_halo=smoothstep(inner_edge_halo-gamma_scaled_halo,inner_edge_halo+gamma_scaled_halo,dist);highp float halo_edge=(6.0-halo_width/fontScale)/SDF_PX;alpha_halo= min(smoothstep(halo_edge-gamma_scaled_halo,halo_edge+gamma_scaled_halo,dist),1.0-alpha_halo);color_alpha_out_halo=total_opacity*alpha_halo*halo_color;}if (u_is_plain && u_is_halo) {fragColor=color_alpha_out_text+(1.-color_alpha_out_text.a)*color_alpha_out_halo;} else if (u_is_halo){fragColor=color_alpha_out_halo;} else {fragColor=color_alpha_out_text;}
706#ifdef OVERDRAW_INSPECTOR
707fragColor=vec4(1.0);
708#endif
709}`,`layout(location=0) in vec4 a_pos_offset;layout(location=1) in uvec4 a_data;layout(location=2) in vec4 a_pixeloffset;layout(location=3) in vec3 a_projected_pos;layout(location=4) in uint a_fade_opacity;layout(location=5) in float a_height_offset;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform bool u_rotate_symbol;uniform vec2 u_texsize;uniform vec2 u_translation;uniform float u_pitched_scale;uniform bool u_is_offset;uniform bool u_height_anchor_ground;out vec2 v_data0;out vec3 v_data1;
710#pragma maplibre: define highp vec4 fill_color
711#pragma maplibre: define highp vec4 halo_color
712#pragma maplibre: define lowp float opacity
713#pragma maplibre: define lowp float halo_width
714#pragma maplibre: define lowp float halo_blur
715void main() {
716#pragma maplibre: initialize highp vec4 fill_color
717#pragma maplibre: initialize highp vec4 halo_color
718#pragma maplibre: initialize lowp float opacity
719#pragma maplibre: initialize lowp float halo_width
720#pragma maplibre: initialize lowp float halo_blur
721vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=vec2(a_data.xy);vec2 a_size=vec2(a_data.zw);float a_size_min=float(a_data.z >> 1u);vec2 a_pxoffset=a_pixeloffset.xy/16.0;vec2 a_minFontScale=a_pixeloffset.zw/256.0;float ele=a_height_offset+(u_height_anchor_ground ? get_elevation(a_pos) : 0.0);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_symbol_fade_change :-u_symbol_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));float total_opacity=opacity*interpolated_fade_opacity;if (total_opacity < 0.1){gl_Position=vec4(-2.,-2.,-2.,1.);return;}highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?
722camera_to_anchor_distance/u_camera_to_center_distance :
723u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);if (!u_is_offset) {size*=perspective_ratio;}float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;
724#ifdef GLOBE
725if(u_pitch_with_map) {float anchor_pos_tile_y=(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w,z,1.0)).y;projectionScaling=mix(projectionScaling,1.0/circumferenceRatioAtTileY(anchor_pos_tile_y)*u_pitched_scale,u_projection_transition);}
726#endif
727vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}float gamma_scale=finalPos.w;gl_Position=finalPos;v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,total_opacity);}`),symbolTextAndIcon:we(`#define SDF_PX 8.0
728#define SDF 1.0
729#define ICON 0.0
730uniform bool u_is_halo;uniform bool u_is_text;uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;in vec4 v_data0;in vec3 v_data1;flat in float v_is_sdf;
731#pragma maplibre: define highp vec4 fill_color
732#pragma maplibre: define highp vec4 halo_color
733#pragma maplibre: define lowp float halo_width
734#pragma maplibre: define lowp float halo_blur
735void main() {
736#pragma maplibre: initialize highp vec4 fill_color
737#pragma maplibre: initialize highp vec4 halo_color
738#pragma maplibre: initialize lowp float halo_width
739#pragma maplibre: initialize lowp float halo_blur
740float total_opacity=v_data1[2];if (v_is_sdf==ICON) {vec2 tex_icon=v_data0.zw;
740fragColor=texture(u_texture_icon,tex_icon)*total_opacity;
741#ifdef OVERDRAW_INSPECTOR
742fragColor=vec4(1.0);
743#endif
744return;}vec2 tex=v_data0.xy;float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_data1.x;float size=v_data1.y;float fontScale=size/24.0;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;lowp float dist=texture(u_texture,tex).a;lowp vec4 color_alpha_out,color_alpha_out_halo;if (u_is_text) {highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);color_alpha_out=fill_color*(alpha*total_opacity);}if (u_is_halo) {highp float gamma_halo=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);lowp float buff_halo=(6.0-halo_width/fontScale)/SDF_PX;highp float gamma_scaled_halo=gamma_halo*gamma_scale;highp float alpha_halo=smoothstep(buff_halo-gamma_scaled_halo,buff_halo+gamma_scaled_halo,dist);color_alpha_out_halo=halo_color*(alpha_halo*total_opacity);}if (u_is_text && u_is_halo) {fragColor=color_alpha_out+(1.-color_alpha_out.a)*color_alpha_out_halo;} else if (u_is_halo) {fragColor=color_alpha_out_halo;} else {fragColor=color_alpha_out;}
745#ifdef OVERDRAW_INSPECTOR
746fragColor=vec4(1.0);
747#endif
748}`,`layout(location=0) in vec4 a_pos_offset;layout(location=1) in uvec4 a_data;layout(location=2) in vec3 a_projected_pos;layout(location=3) in uint a_fade_opacity;layout(location=4) in float a_height_offset;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform bool u_rotate_symbol;uniform vec2 u_texsize;uniform vec2 u_texsize_icon;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform vec2 u_translation;uniform float u_pitched_scale;uniform bool u_is_offset;uniform bool u_height_anchor_ground;out vec4 v_data0;out vec3 v_data1;flat out float v_is_sdf;
749#pragma maplibre: define highp vec4 fill_color
750#pragma maplibre: define highp vec4 halo_color
751#pragma maplibre: define lowp float opacity
752#pragma maplibre: define lowp float halo_width
753#pragma maplibre: define lowp float halo_blur
754void main() {
755#pragma maplibre: initialize highp vec4 fill_color
756#pragma maplibre: initialize highp vec4 halo_color
757#pragma maplibre: initialize lowp float opacity
758#pragma maplibre: initialize lowp float halo_width
759#pragma maplibre: initialize lowp float halo_blur
760vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=vec2(a_data.xy);vec2 a_size=vec2(a_data.zw);float a_size_min=float(a_data.z >> 1u);float is_sdf=float(a_data.z & 1u);float ele=a_height_offset+(u_height_anchor_ground ? get_elevation(a_pos) : 0.0);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_symbol_fade_change :-u_symbol_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));float total_opacity=opacity*interpolated_fade_opacity;if (total_opacity < 0.1){gl_Position=vec4(-2.,-2.,-2.,1.);return;}highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?
761camera_to_anchor_distance/u_camera_to_center_distance :
762u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);if (!u_is_offset) {size*=perspective_ratio;}float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;
763#ifdef GLOBE
764if(u_pitch_with_map && !u_is_along_line) {float anchor_pos_tile_y=(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w,z,1.0)).y;projectionScaling=mix(projectionScaling,1.0/circumferenceRatioAtTileY(anchor_pos_tile_y)*u_pitched_scale,u_projection_transition);}
765#endif
766vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}float gamma_scale=finalPos.w;gl_Position=finalPos;v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec3(gamma_scale,size,total_opacity);v_is_sdf=is_sdf;}`),terrain:we("uniform sampler2D u_texture;uniform vec4 u_fog_color;uniform vec4 u_horizon_color;uniform float u_fog_ground_blend;uniform float u_fog_ground_blend_opacity;uniform float u_horizon_fog_blend;uniform bool u_is_globe_mode;in vec2 v_texture_pos;in float v_fog_depth;const float gamma=2.2;vec4 gammaToLinear(vec4 color) {return pow(color,vec4(gamma));}vec4 linearToGamma(vec4 color) {return pow(color,vec4(1.0/gamma));}void main() {vec4 surface_color=texture(u_texture,vec2(v_texture_pos.x,1.0-v_texture_pos.y));if (!u_is_globe_mode && u_fog_ground_blend_opacity > 0.0 && v_fog_depth > u_fog_ground_blend) {vec4 surface_color_linear=gammaToLinear(surface_color);float blend_color=smoothstep(0.0,1.0,max((v_fog_depth-u_horizon_fog_blend)/(1.0-u_horizon_fog_blend),0.0));vec4 fog_horizon_color_linear=mix(gammaToLinear(u_fog_color),gammaToLinear(u_horizon_color),blend_color);
766float factor_fog=max(v_fog_depth-u_fog_ground_blend,0.0)/(1.0-u_fog_ground_blend);fragColor=linearToGamma(mix(surface_color_linear,fog_horizon_color_linear,pow(factor_fog,2.0)*u_fog_ground_blend_opacity));} else {fragColor=surface_color;}}","layout(location=0) in vec3 a_pos3d;uniform mat4 u_fog_matrix;uniform float u_ele_delta;out vec2 v_texture_pos;out float v_fog_depth;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/8192.0;gl_Position=projectTileFor3D(a_pos3d.xy,ele-ele_delta);vec4 pos=u_fog_matrix*vec4(a_pos3d.xy,ele,1.0);v_fog_depth=pos.z/pos.w*0.5+0.5;}"),terrainDepth:we("in float v_depth;const highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitMsk=vec4(0.,vec3(1./256.0));highp vec4 pack(highp float value) {highp vec4 comp=fract(value*bitSh);comp-=comp.xxyz*bitMsk;return comp;}void main() {fragColor=pack(v_depth);}","layout(location=0) in vec3 a_pos3d;uniform float u_ele_delta;out float v_depth;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;gl_Position=projectTileFor3D(a_pos3d.xy,ele-ele_delta);v_depth=gl_Position.z/gl_Position.w;}"),atmosphere:we(`#ifdef GL_ES
767precision highp float;
768#endif
769in vec3 view_direction;uniform vec3 u_sun_pos;uniform vec3 u_globe_position;uniform float u_globe_radius;uniform float u_atmosphere_blend;/**Shader use from https:*Made some change to adapt to MapLibre Globe geometry*/const float PI=3.141592653589793;const int iSteps=5;const int jSteps=3;/*radius of the planet*/const float EARTH_RADIUS=6371e3;/*radius of the atmosphere*/const float ATMOS_RADIUS=6471e3;vec2 rsi(vec3 r0,vec3 rd,float sr) {float a=dot(rd,rd);float b=2.0*dot(rd,r0);float c=dot(r0,r0)-(sr*sr);float d=(b*b)-4.0*a*c;if (d < 0.0) return vec2(1e5,-1e5);return vec2((-b-sqrt(d))/(2.0*a),(-b+sqrt(d))/(2.0*a));}vec4 atmosphere(vec3 r,vec3 r0,vec3 pSun,float iSun,float rPlanet,float rAtmos,vec3 kRlh,float kMie,float shRlh,float shMie,float g) {pSun=normalize(pSun);r=normalize(r);vec2 p=rsi(r0,r,rAtmos);if (p.x > p.y) {return vec4(0.0,0.0,0.0,1.0);}if (p.x < 0.0) {p.x=0.0;}vec3 pos=r0+r*p.x;vec2 p2=rsi(r0,r,rPlanet);if (p2.x <=p2.y && p2.x > 0.0) {p.y=min(p.y,p2.x);}float iStepSize=(p.y-p.x)/float(iSteps);float iTime=p.x+iStepSize*0.5;vec3 totalRlh=vec3(0,0,0);vec3 totalMie=vec3(0,0,0);float iOdRlh=0.0;float iOdMie=0.0;float mu=dot(r,pSun);float mumu=mu*mu;float gg=g*g;float pRlh=3.0/(16.0*PI)*(1.0+mumu);float pMie=3.0/(8.0*PI)*((1.0-gg)*(mumu+1.0))/(pow(1.0+gg-2.0*mu*g,1.5)*(2.0+gg));for (int i=0; i < iSteps; i++) {vec3 iPos=r0+r*iTime;float iHeight=length(iPos)-rPlanet;float odStepRlh=exp(-iHeight/shRlh)*iStepSize;float odStepMie=exp(-iHeight/shMie)*iStepSize;iOdRlh+=odStepRlh;iOdMie+=odStepMie;float jStepSize=rsi(iPos,pSun,rAtmos).y/float(jSteps);float jTime=jStepSize*0.5;float jOdRlh=0.0;float jOdMie=0.0;for (int j=0; j < jSteps; j++) {vec3 jPos=iPos+pSun*jTime;float jHeight=length(jPos)-rPlanet;jOdRlh+=exp(-jHeight/shRlh)*jStepSize;jOdMie+=exp(-jHeight/shMie)*jStepSize;jTime+=jStepSize;}vec3 attn=exp(-(kMie*(iOdMie+jOdMie)+kRlh*(iOdRlh+jOdRlh)));totalRlh+=odStepRlh*attn;totalMie+=odStepMie*attn;iTime+=iStepSize;}float opacity=exp(-(length(kRlh)*length(totalRlh)+kMie*length(totalMie)));vec3 color=iSun*(pRlh*kRlh*totalRlh+pMie*kMie*totalMie);return vec4(color,opacity);}void main() {vec3 scale_camera_pos=-u_globe_position*EARTH_RADIUS/u_globe_radius;vec4 color=atmosphere(normalize(view_direction),scale_camera_pos,u_sun_pos,22.0,EARTH_RADIUS,ATMOS_RADIUS,vec3(5.5e-6,13.0e-6,22.4e-6),21e-6,8e3,1.2e3,0.758
770);color.rgb=1.0-exp(-1.0*color.rgb);color=pow(color,vec4(1.0/2.2));fragColor=vec4(color.rgb,1.0-color.a)*u_atmosphere_blend;}`,"layout(location=0) in vec2 a_pos;uniform mat4 u_inv_proj_matrix;out vec3 view_direction;void main() {view_direction=(u_inv_proj_matrix*vec4(a_pos,0.0,1.0)).xyz;gl_Position=vec4(a_pos,0.0,1.0);}"),sky:we("uniform vec4 u_sky_color;uniform vec4 u_horizon_color;uniform vec2 u_horizon;uniform vec2 u_horizon_normal;uniform float u_sky_horizon_blend;uniform float u_sky_blend;uniform vec3 u_globe_position;uniform float u_globe_radius;uniform float u_atmosphere_blend;in vec3 v_view_direction;const float ATMOSPHERE_HEIGHT_TO_GLOBE_RADIUS=100000.0/6371000.0;void main() {float x=gl_FragCoord.x;float y=gl_FragCoord.y;float blend=(y-u_horizon.y)*u_horizon_normal.y+(x-u_horizon.x)*u_horizon_normal.x;float opacity=1.0;if (u_sky_blend > 0.0) {vec3 ray=normalize(v_view_direction);float globe_distance=length(u_globe_position);float angle_to_globe_center=acos(clamp(dot(ray,u_globe_position)/globe_distance,-1.0,1.0));float horizon_angle=asin(min(u_globe_radius/globe_distance,1.0));blend=mix(blend,((angle_to_globe_center-horizon_angle)*u_camera_to_center_distance+1.0)*u_device_pixel_ratio,u_sky_blend);float closest_approach=max(dot(ray,u_globe_position),0.0);
770float lowest_altitude=sqrt(max(globe_distance*globe_distance-closest_approach*closest_approach,0.0))-u_globe_radius;float atmosphere_height=u_globe_radius*ATMOSPHERE_HEIGHT_TO_GLOBE_RADIUS;float inside_atmosphere=1.0-smoothstep(atmosphere_height,10.0*atmosphere_height,globe_distance-u_globe_radius);float through_atmosphere=1.0-smoothstep(0.0,atmosphere_height,lowest_altitude);opacity=inside_atmosphere*through_atmosphere*(1.0-u_atmosphere_blend);}if (blend > 0.0) {if (blend < u_sky_horizon_blend) {fragColor=mix(u_sky_color,u_horizon_color,pow(1.0-blend/u_sky_horizon_blend,2.0));} else {fragColor=u_sky_color;}}fragColor*=mix(1.0,opacity,u_sky_blend);}","layout(location=0) in vec2 a_pos;uniform mat4 u_inv_proj_matrix;out vec3 v_view_direction;void main() {v_view_direction=(u_inv_proj_matrix*vec4(a_pos,0.0,1.0)).xyz;gl_Position=vec4(a_pos,1.0,1.0);}")};function we(e,t){let i=/#pragma maplibre: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,r=t.match(/in ([\w]+) ([\w]+)/g),a=e.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),n=t.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),s=n?n.concat(a):a,o=r?r.length:0,l={};return e=e.replace(i,(u,h,c,d,p)=>(l[p]=!0,h==="define"?`
771#ifndef HAS_UNIFORM_u_${p}
772in ${c} ${d} ${p};
773#else
774uniform ${c} ${d} u_${p};
775#endif
776`:`
777#ifdef HAS_UNIFORM_u_${p}
778    ${c} ${d} ${p} = u_${p};
779#endif
780`)),t=t.replace(i,(u,h,c,d,p)=>{let f=d==="float"?"vec2":"vec4",m=p.match(/color/)?"color":f;return l[p]?h==="define"?`
781#ifndef HAS_UNIFORM_u_${p}
782uniform lowp float u_${p}_t;
783layout(location = ${o++}) in ${c} ${f} a_${p};
784out ${c} ${d} ${p};
785#else
786uniform ${c} ${d} u_${p};
787#endif
788`:m==="vec4"?`
789#ifndef HAS_UNIFORM_u_${p}
790    ${p} = a_${p};
791#else
792    ${c} ${d} ${p} = u_${p};
793#endif
794`:`
795#ifndef HAS_UNIFORM_u_${p}
796    ${p} = unpack_mix_${m}(a_${p}, u_${p}_t);
797#else
798    ${c} ${d} ${p} = u_${p};
799#endif
800`:h==="define"?`
801#ifndef HAS_UNIFORM_u_${p}
802uniform lowp float u_${p}_t;
803layout(location = ${o++}) in ${c} ${f} a_${p};
804#else
805uniform ${c} ${d} u_${p};
806#endif
807`:m==="vec4"?`
808#ifndef HAS_UNIFORM_u_${p}
809    ${c} ${d} ${p} = a_${p};
810#else
811    ${c} ${d} ${p} = u_${p};
812#endif
813`:`
814#ifndef HAS_UNIFORM_u_${p}
815    ${c} ${d} ${p} = unpack_mix_${m}(a_${p}, u_${p}_t);
816#else
817    ${c} ${d} ${p} = u_${p};
818#endif
819`}),{fragmentSource:e,vertexSource:t,staticAttributes:r,staticUniforms:s}}const zv="#define PROJECTION_MERCATOR",Rv="mercator";var Kc=class{constructor(){this._cachedMesh=null}get name(){return"mercator"}get useSubdivision(){return!1}get shaderVariantName(){return Rv}get shaderDefine(){return zv}get shaderPreludeCode(){return qi.projectionMercator}get vertexShaderPreludeCode(){return qi.projectionMercator.vertexSource}get subdivisionGranularity(){return Gd.noSubdivision}get useGlobeControls(){return!1}get transitionState(){return 0}destroy(){}getMeshFromTileID(e,t,i,r,a){if(this._cachedMesh)return this._cachedMesh;let n=new Pr;n.emplaceBack(0,0),n.emplaceBack(L,0),n.emplaceBack(0,L),n.emplaceBack(L,L);let s=e.createVertexBuffer(n,Jr.members),o=Ke.simpleSegment(0,0,4,2),l=new er;l.emplaceBack(1,0,2),l.emplaceBack(1,2,3);let u=e.createIndexBuffer(l);return this._cachedMesh=new ks(s,u,o),this._cachedMesh}recalculate(){}hasTransition(){return!1}},Jc=class kv{constructor(t=0,i=0,r=0,a=0){if(isNaN(t)||t<0||isNaN(i)||i<0||isNaN(r)||r<0||isNaN(a)||a<0)throw Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=t,this.bottom=i,this.left=r,this.right=a}interpolate(t,i,r){return i.top!=null&&t.top!=null&&(this.top=Je.number(t.top,i.top,r)),i.bottom!=null&&t.bottom!=null&&(this.bottom=Je.number(t.bottom,i.bottom,r)),i.left!=null&&t.left!=null&&(this.left=Je.number(t.left,i.left,r)),i.right!=null&&t.right!=null&&(this.right=Je.number(t.right,i.right,r)),this}getCenter(t,i){let r=he((this.left+t-this.right)/2,0,t),a=he((this.top+i-this.bottom)/2,0,i);return new A(r,a)}equals(t){return this.top===t.top&&this.bottom===t.bottom&&this.left===t.left&&this.right===t.right}clone(){return new kv(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}};function Tl(e,t){if(!e.renderWorldCopies||e.lngRange)return;let i=t.lng-e.center.lng;t.lng+=i>180?-360:i<-180?360:0}function Lg(e){return Math.max(0,Math.floor(e))}var Ep=class{constructor(e,t){this.applyConstrain=(i,r)=>this._constrainOverride===null?this._callbacks.defaultConstrain(i,r):this._constrainOverride(i,r),this._callbacks=e,this._tileSize=512,this._renderWorldCopies=(t==null?void 0:t.renderWorldCopies)===void 0||!!(t!=null&&t.renderWorldCopies),this._minZoom=(t==null?void 0:t.minZoom)||0,this._maxZoom=(t==null?void 0:t.maxZoom)||22,this._minPitch=(t==null?void 0:t.minPitch)===void 0||(t==null?void 0:t.minPitch)===null?0:t==null?void 0:t.minPitch,this._maxPitch=(t==null?void 0:t.maxPitch)===void 0||(t==null?void 0:t.maxPitch)===null?60:t==null?void 0:t.maxPitch,this._constrainOverride=(t==null?void 0:t.constrainOverride)??null,this.setMaxBounds(),this._width=0,this._height=0,this._center=new X(0,0),this._elevation=0,this._zoom=0,this._tileZoom=Lg(this._zoom),this._scale=Gt(this._zoom),this._bearingInRadians=0,this._fovInRadians=.6435011087932844,this._pitchInRadians=0,this._rollInRadians=0,this._unmodified=!0,this._edgeInsets=new Jc,this._minElevationForCurrentTile=0,this._autoCalculateNearFarZ=!0}apply(e,t){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=Lg(this._zoom),this._scale=Gt(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 Jc(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=e.autoCalculateNearFarZ,t&&this.constrainInternal(),this._calcMatrices()}
vendor: 80,052 bytes, line 819
819get 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 A(this._width,this._height)}get bearing(){return this._bearingInRadians/Math.PI*180}setBearing(e){let t=bi(e,-180,180)*Math.PI/180;this._bearingInRadians!==t&&(this._unmodified=!1,this._bearingInRadians=t,this._calcMatrices(),this._rotationMatrix=Q1(),eM(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=he(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 Gi(this._fovInRadians)}setFov(e){e=he(e,.1,150),this.fov!==e&&(this._unmodified=!1,this._fovInRadians=Xe(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=Gt(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,i){this._unmodified=!1,this._edgeInsets.interpolate(e,t,i),this.constrainInternal(),this._calcMatrices()}resize(e,t,i=!0){this._width=e,this._height=t,i&&this.constrainInternal(),this._calcMatrices()}getMaxBounds(){var e,t;return((e=this._latRange)==null?void 0:e.length)!==2||((t=this._lngRange)==null?void 0:t.length)!==2?null:new ki([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=[-Xi,Xi])}getCameraQueryGeometry(e,t){if(t.length===1)return[t[0],e];{let{minX:i,minY:r,maxX:a,maxY:n}=Mi.fromPoints(t).extend(e);return[new A(i,r),new A(a,r),new A(a,n),new A(i,n),new A(i,r)]}}constrainInternal(){if(!this.center||!this._width||!this._height||this._constraining)return;this._constraining=!0;let e=this._unmodified,{center:t,zoom:i}=this.applyConstrain(this.center,this.zoom);this.setCenter(t),this.setZoom(i),this._unmodified=e,this._constraining=!1}_calcMatrices(){if(this._pixelPerMeter=ia(1,this.center.lat)*this.worldSize,!this._width||!this._height)return;this._pixelsToGLUnits=[2/this._width,-2/this._height];let e=Fi(new Float64Array(16));At(e,e,[this._width/2,-this._height/2,1]),ct(e,e,[1,-1,0]),this._clipSpaceToPixelsMatrix=e,e=Fi(new Float64Array(16)),At(e,e,[1,-1,1]),ct(e,e,[-1,-1,0]),At(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,i,r){let a=i===void 0?this.bearing:i,n=r=r===void 0?this.pitch:r,{distanceToCenter:s,clampedElevation:o}=this._distanceToCenterFromAltElevationPitch(t,this.elevation,n),{x:l,y:u}=Dc(n,a),h=Me.fromLngLat(e,t),c=G0(1,h.y),d,p,f=0;do{if(f+=1,f>10)break;p=s/c;let m=l*p,g=u*p;d=new Me(h.x+m,h.y+g),c=1/d.meterInMercatorCoordinateUnits()}while(Math.abs(s-p*c)>1e-12);return{center:d.toLngLat(),elevation:o,zoom:zt(this.height/2/Math.tan(this.fovInRadians/2)/p/this.tileSize)}}recalculateZoomAndCenter(e){if(this.elevation-e===0)return;let t=1/this.worldSize,i=ia(1,this.center.lat)*this.worldSize,r=Me.fromLngLat(this.center,this.elevation),a=r.x/t,n=r.y/t,s=r.z/t,o=this.pitch,l=this.bearing,{x:u,y:h,z:c}=Dc(o,l),d=this.cameraToCenterDistance,p=a+d*-u,f=n+d*-h,m=s+d*c,{distanceToCenter:g,clampedElevation:_}=this._distanceToCenterFromAltElevationPitch(m/i,e,o),y=g*i,x=p+u*y,v=f+h*y,w=new Me(x*t,v*t,0).toLngLat(),b=ia(1,w.lat),T=zt(this.height/2/Math.tan(this.fovInRadians/2)/g/b/this.tileSize);this._elevation=_,this._center=w,this.setZoom(T)}_distanceToCenterFromAltElevationPitch(e,t,i){let r=-Math.cos(Xe(i)),a=e-t,n,s=t;return r*a>=0||Math.abs(r)<.1?(n=1e4,s=e+n*r):n=-a/r,{distanceToCenter:n,clampedElevation:s}}getCameraPoint(){let e=this.pitchInRadians,t=Math.tan(e)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new A(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/L,1/t/L]}},hF=class{distanceToTile2d(e,t,i,r){let a=r,n=a.distanceX([e,t]),s=a.distanceY([e,t]);return Math.hypot(n,s)}getWrap(e,t,i){return i}getTileBoundingVolume(e,t,i,r){let a=Math.min(0,i),n=Math.max(0,i);if(r!=null&&r.terrain){let o=new Pt(e.z,t,e.z,e.x,e.y),l=r.terrain.getMinMaxElevation(o);a=l.minElevation??a,n=l.maxElevation??n}let s=1<<e.z;return new _p([t+e.x/s,e.y/s,a],[t+(e.x+1)/s,(e.y+1)/s,n])}allowVariableZoom(e,t){let i=e.fov*(Math.abs(Math.cos(e.rollInRadians))*e.height+Math.abs(Math.sin(e.rollInRadians))*e.width)/e.height,r=he(78.5-i/2,0,60);return!!t.terrain||e.pitch>r}allowWorldCopies(){return!0}prepareNextFrame(){}};const cF=tt([{name:"a_pos3d",type:"Int16",components:3}]);var dF=class extends _t{constructor(e){super(),this._lastTilesetChange=Oe(),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 i={},r=!1;for(let a of pn(e,{tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:t,calculateTileZoom:this.tileManager._source.calculateTileZoom}))i[a.key]=!0,this._renderableTilesKeys.push(a.key),this._tiles[a.key]||(a.terrainRttPosMatrix32f=new Float32Array(16),Ni(a.terrainRttPosMatrix32f,0,L,L,0,0,1),this._tiles[a.key]=new Tv(a,this.tileSize),this._lastTilesetChange=Oe(),r=!0);for(let a in this._tiles)i[a]||(this._tiles[a].releaseRTT(this.tileManager.map.painter),delete this._tiles[a],r=!0);return r}releaseRTT(e){for(let t in this._tiles){let i=this._tiles[t];(i.tileID.equals(e)||i.tileID.isChildOf(e)||e.isChildOf(i.tileID))&&i.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 i of this._renderableTilesKeys){let r=this._tiles[i].tileID,a=e.clone(),n=Hr();if(r.canonical.equals(e.canonical))Ni(n,0,L,L,0,0,1);else if(r.canonical.isChildOf(e.canonical)){let s=r.canonical.z-e.canonical.z,o=r.canonical.x-(r.canonical.x>>s<<s),l=r.canonical.y-(r.canonical.y>>s<<s),u=L>>s;Ni(n,0,u,u,0,0,1),ct(n,n,[-o*u,-l*u,0])}else if(e.canonical.isChildOf(r.canonical)){let s=e.canonical.z-r.canonical.z,o=e.canonical.x-(e.canonical.x>>s<<s),l=e.canonical.y-(e.canonical.y>>s<<s),u=L>>s;Ni(n,0,L,L,0,0,1),ct(n,n,[o*u,l*u,0]),At(n,n,[1/2**s,1/2**s,0])}else continue;a.terrainRttPosMatrix32f=new Float32Array(n),t[i]=a}return t}_getTerrainCoordsForTileRanges(e,t){let i={};for(let r of this._renderableTilesKeys){let a=this._tiles[r].tileID;if(!this._isWithinTileRanges(a,t))continue;let n=e.clone(),s=Hr();if(a.canonical.z===e.canonical.z){let o=e.canonical.x-a.canonical.x+e.wrap*(1<<e.canonical.z),l=e.canonical.y-a.canonical.y;Ni(s,0,L,L,0,0,1),ct(s,s,[o*L,l*L,0])}else if(a.canonical.z>e.canonical.z){let o=a.canonical.z-e.canonical.z,l=a.canonical.x-(a.canonical.x>>o<<o)+e.wrap*(1<<a.canonical.z),u=a.canonical.y-(a.canonical.y>>o<<o),h=e.canonical.x-(a.canonical.x>>o),c=e.canonical.y-(a.canonical.y>>o),d=L>>o;Ni(s,0,d,d,0,0,1),ct(s,s,[-l*d+h*L,-u*d+c*L,0])}else{let o=e.canonical.z-a.canonical.z,l=e.canonical.x-(e.canonical.x>>o<<o)+e.wrap*(1<<e.canonical.z),u=e.canonical.y-(e.canonical.y>>o<<o),h=(e.canonical.x>>o)-a.canonical.x,c=(e.canonical.y>>o)-a.canonical.y,d=L<<o;Ni(s,0,d,d,0,0,1),ct(s,s,[l*L+h*d,u*L+c*d,0])}n.terrainRttPosMatrix32f=new Float32Array(s),i[r]=n}return i}getSourceTile(e,t){var n,s;let i=this.tileManager._source,r=e.overscaledZ-this.deltaZoom;if(r>i.maxzoom&&(r=i.maxzoom),r<i.minzoom)return;(n=this._sourceTileCache)[s=e.key]||(n[s]=e.scaledTo(r).key);let a=this.findTileInCaches(this._sourceTileCache[e.key]);if(!(a!=null&&a.dem)&&t)for(;r>=i.minzoom&&!(a!=null&&a.dem);)a=this.findTileInCaches(e.scaledTo(r--).key);return a}findTileInCaches(e){let t=this.tileManager.getTileByID(e);return t||(t=this.tileManager._outOfViewCache.getByKey(e),t)}anyTilesAfterTime(e=Oe()){return this._lastTilesetChange>=e}_isWithinTileRanges(e,t){let i=t[e.canonical.z];return!!i&&(e.wrap>i.minWrap||e.wrap<i.maxWrap||e.canonical.x>=i.minTileXWrapped&&e.canonical.x<=i.maxTileXWrapped&&e.canonical.y>=i.minTileY&&e.canonical.y<=i.maxTileY)}};const Bg=L*(1-1e-12),Og=-.5;var pF=class{constructor(e,t,i,r="auto"){this._meshCache={},this.painter=e,this.tileManager=new dF(t),this.options=i,this.exaggeration=typeof i.exaggeration=="number"?i.exaggeration:1,this._terrainSkirtLength=r,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache=new Map,this._elevationSamplerCache=new Map}destroy(){this._fbo&&(this._fbo=(this._fbo.destroy(),null)),this._fboDepthTexture&&(this._fboDepthTexture=(this._fboDepthTexture.destroy(),null)),this._emptyDemTexture&&(this._emptyDemTexture=(this._emptyDemTexture.destroy(),null)),this._emptyDepthTexture&&(this._emptyDepthTexture=(this._emptyDepthTexture.destroy(),null));for(let e in this._meshCache)this._meshCache[e].destroy();this._meshCache={},this.tileManager.destruct()}getDEMElevation(e,t,i,r=L){let a=e.normalizeCoordinates(t,i,r);if(!a)return 0;let n=this.getElevationSampler(a.tileID);return n?n(a.x,a.y,r):0}getElevationForLngLatZoom(e,t){if(!Gm(t,e.wrap()))return 0;let{tileID:i,mercatorX:r,mercatorY:a}=this._getOverscaledTileIDFromLngLatZoom(e,t);return this.getElevation(i,r%L,a%L,L)}getElevationForLngLat(e,t){let i=this.getCoverageIndex();if(i){let n=Me.fromLngLat(e),s=Sp(i,this.exaggeration,n.x,n.y);if(s.demLoaded)return s.elevation}let r=pn(t,{maxzoom:this.tileManager.maxzoom,minzoom:this.tileManager.minzoom,tileSize:512,terrain:this}),a=0;for(let n of r)n.canonical.z>a&&(a=Math.min(n.canonical.z,this.tileManager.maxzoom));return this.getElevationForLngLatZoom(e,a)}getElevation(e,t,i,r=L){return this.getDEMElevation(e,t,i,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,i=0,r=0;for(let a of this.tileManager.getRenderableTiles()){if(!a)continue;let{canonical:n,wrap:s}=a.tileID;e.includes(n.z)||e.push(n.z);let o=this.getElevationSampler(a.tileID);t.set(`${s}/${n.z}/${n.x}/${n.y}`,o);let{minElevation:l,maxElevation:u}=this.getMinMaxElevation(a.tileID);i=Math.min(i,l??0),r=Math.max(r,u??0)}return t.size===0?null:(e.sort((a,n)=>n-a),{zooms:e,samplerPerTile:t,minElevation:i-10,maxElevation:r+10})}getElevationSampler(e){let t=e.key,i=this._elevationSamplerCache.get(t);if(i)return i;let r=this.tileManager.getSourceTile(e,!0),a=r==null?void 0:r.dem;if(!r||!a)return null;let n=this._getDEMTileMatrix(e,r),s=n[0]*a.dim,o=n[5]*a.dim,l=n[12]*a.dim+Og,u=n[13]*a.dim+Og,h=(c,d,p)=>{let f=p===8192?1:L/p;return a.sampleBilinear(c*f*s+l,d*f*o+u)};return this._elevationSamplerCache.set(t,h),h}_getDEMTileMatrix(e,t){let i=`${t.tileID.key}/${e.key}`,r=this._demMatrixCache.get(i);if(r)return r;let a=e.canonical.z-t.tileID.canonical.z,n=e.canonical.x-(e.canonical.x>>a<<a),s=e.canonical.y-(e.canonical.y>>a<<a),o=Pb(new Float64Array(16),[1/(L<<a),1/(L<<a),0]);return ct(o,o,[n*L,s*L,0]),this._demMatrixCache.set(i,o),o}getTerrainData(e){var r,a;if(!this._emptyDemTexture){let n=this.painter.context,s=new Ze({width:1,height:1},new Uint8Array(4));this._emptyDepthTexture=new gt(n,s,n.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new gt(n,new Ze({width:1,height:1}),n.gl.RGBA,{premultiply:!1}),this._emptyDemTexture.bind(n.gl.NEAREST,n.gl.CLAMP_TO_EDGE),this._emptyDemMatrix=Fi([])}let t=this.tileManager.getSourceTile(e,!0);if(t!=null&&t.dem&&(!t.demTexture||t.needsTerrainPrepare)){let n=this.painter.context;t.demTexture||(t.demTexture=this.painter.getTileTexture(t.dem.stride)),t.demTexture?t.demTexture.update(t.dem.getPixels(),{premultiply:!1}):t.demTexture=new gt(n,t.dem.getPixels(),n.gl.RGBA,{premultiply:!1}),t.demTexture.bind(n.gl.NEAREST,n.gl.CLAMP_TO_EDGE),t.needsTerrainPrepare=!1}let i=t?this._getDEMTileMatrix(e,t):this._emptyDemMatrix;return{u_depth:2,u_terrain:3,u_terrain_dim:((r=t==null?void 0:t.dem)==null?void 0:r.dim)||1,u_terrain_matrix:i,u_terrain_unpack:((a=t==null?void 0:t.dem)==null?void 0:a.getUnpackVector())||this._emptyDemUnpack,u_terrain_exaggeration:this.exaggeration,texture:((t==null?void 0:t.demTexture)||this._emptyDemTexture).texture,depthTexture:(this._fboDepthTexture||this._emptyDepthTexture).texture,tile:t}}getFramebuffer(){let e=this.painter,t=e.width/devicePixelRatio,i=e.height/devicePixelRatio;return this._fbo&&(this._fbo.width!==t||this._fbo.height!==i)&&(this._fbo.destroy(),this._fboDepthTexture.destroy(),delete this._fbo,delete this._fboDepthTexture),this._fboDepthTexture||(this._fboDepthTexture=new gt(e.context,{width:t,height:i,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,i,!0,!1),this._fbo.depthAttachment.set(e.context.createRenderbuffer(e.context.gl.DEPTH_COMPONENT16,t,i))),this._fbo.colorAttachment.set(this._fboDepthTexture.texture),this._fbo}getTerrainMesh(e){var d;let t=((d=this.painter.style.projection)==null?void 0:d.transitionState)>0,i=t&&e.canonical.y===0,r=t&&e.canonical.y===(1<<e.canonical.z)-1,a=`m_${i?"n":""}_${r?"s":""}`;if(this._meshCache[a])return this._meshCache[a];let n=this.painter.context,s=new AT,o=new er,l=this.meshSize,u=L/l,h=l*l;for(let p=0;p<=l;p++)for(let f=0;f<=l;f++)s.emplaceBack(f*u,p*u,0);for(let p=0;p<h;p+=l+1)for(let f=0;f<l;f++)o.emplaceBack(f+p,l+f+p+1,l+f+p+2),o.emplaceBack(f+p,l+f+p+2,f+p+1);this._terrainSkirtLength!=="none"&&this._buildSkirts(s,o,l,u,i,r);let c=new ks(n.createVertexBuffer(s,cF.members),n.createIndexBuffer(o),Ke.simpleSegment(0,0,s.length,o.length));return this._meshCache[a]=c,c}getSkirtLength(e){return 2*Math.PI*Vt/2**Math.max(e,0)/5}getMinTileElevationForLngLatZoom(e,t){if(!Gm(t,e.wrap()))return 0;let{tileID:i}=this._getOverscaledTileIDFromLngLatZoom(e,t);return this.getMinMaxElevation(i).minElevation??0}getMinMaxElevation(e){let t=this.tileManager.getSourceTile(e,!0),i={minElevation:null,maxElevation:null};return t!=null&&t.dem&&(i.minElevation=t.dem.min*this.exaggeration,i.maxElevation=t.dem.max*this.exaggeration),i}_getOverscaledTileIDFromLngLatZoom(e,t){let i=Me.fromLngLat(e.wrap()),r=(1<<t)*L,a=i.x*r,n=i.y*r,s=Math.floor(a/L),o=Math.floor(n/L);return{tileID:new Pt(t,0,t,s,o),mercatorX:a,mercatorY:n}}_buildSkirts(e,t,i,r,a,n){let s=e.length,o=s+(i+1),l=(i+1)*i,u=a?Kn:0,h=+!a,c=n?Jn:L,d=+!n;for(let m=0;m<=i;m++)e.emplaceBack(m*r,u,h);for(let m=0;m<=i;m++)e.emplaceBack(m*r,c,d);for(let m=0;m<i;m++)t.emplaceBack(l+m,o+m,o+m+1),t.emplaceBack(l+m,o+m+1,l+m+1),t.emplaceBack(0+m,s+m+1,s+m),t.emplaceBack(0+m,0+m+1,s+m+1);let p=e.length,f=p+(i+1)*2;for(let m of[0,1])for(let g=0;g<=i;g++)for(let _ of[0,1])e.emplaceBack(m*L,g*r,_);for(let m=0;m<i*2;m+=2)t.emplaceBack(p+m,p+m+1,p+m+3),t.emplaceBack(p+m,p+m+3,p+m+2),t.emplaceBack(f+m,f+m+3,f+m+1),t.emplaceBack(f+m,f+m+2,f+m+3)}};const $g={covered:!1,demLoaded:!1,elevation:0};function Sp(e,t,i,r){if(r<0||r>=1)return $g;let a=Math.floor(i),n=i-a;for(let s of e.zooms){let o=1<<s,l=n*o,u=r*o,h=Math.floor(l),c=Math.floor(u),d=`${a}/${s}/${h}/${c}`;if(!e.samplerPerTile.has(d))continue;let p=e.samplerPerTile.get(d);return p?{covered:!0,demLoaded:!0,elevation:p(Math.min((l-h)*L,Bg),Math.min((u-c)*L,Bg),L)*t}:{covered:!0,demLoaded:!1,elevation:0}}return $g}function Lv(e,t){return e.covered&&t<=e.elevation+1e-6}function Bv(e,t,i,r,a){for(let n=0;n<40&&r-i>a;n++){let s=(i+r)/2;t(e,s)?r=s:i=s}return{lo:i,hi:r}}var El=class Ov{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(t){this._helper.setMinZoom(t)}setMaxZoom(t){this._helper.setMaxZoom(t)}setMinPitch(t){this._helper.setMinPitch(t)}setMaxPitch(t){this._helper.setMaxPitch(t)}setRenderWorldCopies(t){this._helper.setRenderWorldCopies(t)}setBearing(t){this._helper.setBearing(t)}setPitch(t){this._helper.setPitch(t)}setRoll(t){this._helper.setRoll(t)}setFov(t){this._helper.setFov(t)}setZoom(t){this._helper.setZoom(t)}setCenter(t){this._helper.setCenter(t)}setElevation(t){this._helper.setElevation(t)}setMinElevationForCurrentTile(t){this._helper.setMinElevationForCurrentTile(t)}setPadding(t){this._helper.setPadding(t)}interpolatePadding(t,i,r){this._helper.interpolatePadding(t,i,r)}isPaddingEqual(t){return this._helper.isPaddingEqual(t)}resize(t,i,r=!0){this._helper.resize(t,i,r)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(t){this._helper.setMaxBounds(t)}setConstrainOverride(t){this._helper.setConstrainOverride(t)}overrideNearFarZ(t,i){this._helper.overrideNearFarZ(t,i)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(t){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),t)}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(t){}constructor(t,i){this._posMatrixCache=new Map,this._alignedPosMatrixCache=new Map,this._fogMatrixCacheF32=new Map,this.defaultConstrain=(r,a)=>{a=he(+a,this.minZoom,this.maxZoom);let n={center:new X(r.lng,r.lat),zoom:a},s=this._helper._lngRange;!this._helper._renderWorldCopies&&s===null&&(s=[-179.9999999999,180-1e-10]);let o=this.tileSize*Gt(n.zoom),l=0,u=o,h=0,c=o,d=0,p=0,{x:f,y:m}=this.size;if(this._helper._latRange){let w=this._helper._latRange;l=sn(w[1])*o,u=sn(w[0])*o,u-l<m&&(d=m/(u-l))}s&&(h=bi(nn(s[0])*o,0,o),c=bi(nn(s[1])*o,0,o),c<h&&(c+=o),c-h<f&&(p=f/(c-h)));let{x:g,y:_}=Zi(o,r),y,x,v=Math.max(p||0,d||0);if(v){let w=new A(p?(c+h)/2:g,d?(u+l)/2:_);return n.center=xs(o,w).wrap(),n.zoom+=zt(v),n}if(this._helper._latRange){let w=m/2;_-w<l&&(x=l+w),_+w>u&&(x=u-w)}if(s){let w=(h+c)/2,b=g;this._helper._renderWorldCopies&&(b=bi(g,w-o/2,w+o/2));let T=f/2;b-T<h&&(y=h+T),b+T>c&&(y=c-T)}if(y!==void 0||x!==void 0){let w=new A(y??g,x??_);n.center=xs(o,w).wrap()}return n},this.applyConstrain=(r,a)=>this._helper.applyConstrain(r,a),this._helper=i??new Ep({calcMatrices:()=>this._calcMatrices(),defaultConstrain:(r,a)=>this.defaultConstrain(r,a)},t),this._coveringTilesDetailsProvider=new hF}clone(){let t=new Ov;return t.apply(this,!1),t}apply(t,i){this._helper.apply(t,i)}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(t){let i=[new vl(0,t)];if(this._helper._renderWorldCopies){let r=this.screenPointToMercatorCoordinate(new A(0,0)),a=this.screenPointToMercatorCoordinate(new A(this._helper._width,0)),n=this.screenPointToMercatorCoordinate(new A(this._helper._width,this._helper._height)),s=this.screenPointToMercatorCoordinate(new A(0,this._helper._height)),o=Math.floor(Math.min(r.x,a.x,n.x,s.x)),l=Math.floor(Math.max(r.x,a.x,n.x,s.x));for(let u=o-1;u<=l+1;u++)u!==0&&i.push(new vl(u,t))}return i}getCameraFrustum(){return yp.fromInvProjectionMatrix(this._invViewProjMatrix,this.worldSize)}getClippingPlane(){return null}getCoveringTilesDetailsProvider(){return this._coveringTilesDetailsProvider}recalculateZoomAndCenter(t){let i=this.screenPointToLocation(this.centerPoint,t),r=t?t.getElevationForLngLat(i,this):0;this._helper.recalculateZoomAndCenter(r)}setLocationAtPoint(t,i,r=this.elevation){let a=r-this.elevation,n=this.screenPointToMercatorCoordinateAtZ(i,a),s=this.screenPointToMercatorCoordinateAtZ(this.centerPoint,0),o=Me.fromLngLat(t),l=new Me(o.x-(n.x-s.x),o.y-(n.y-s.y));this.setCenter(l==null?void 0:l.toLngLat()),this._helper._renderWorldCopies&&this.setCenter(this.center.wrap())}locationToScreenPoint(t,i){return i?this.coordinatePoint(Me.fromLngLat(t),i.getElevationForLngLat(t,this),this._pixelMatrix3D):this.coordinatePoint(Me.fromLngLat(t))}screenPointToLocation(t,i){var r;return(r=this.screenPointToMercatorCoordinate(t,i))==null?void 0:r.toLngLat()}screenPointToLocationAtElevation(t,i){var r;return(r=this.screenPointToMercatorCoordinateAtZ(t,i-this.elevation))==null?void 0:r.toLngLat()}screenPointToMercatorCoordinate(t,i){if(i){let r=this.screenTerrainPointToMercatorCoordinate(t,i);if(r!=null)return r}return this.screenPointToMercatorCoordinateAtZ(t)}screenTerrainPointToMercatorCoordinate(t,i){let r=i.getCoverageIndex();if(!r)return null;let{near:a,far:n}=this.getRaySegmentFromPixel(t),s=this.worldSize,o=n[0]-a[0],l=n[1]-a[1],u=n[2]-a[2],h={index:r,exaggeration:i.exaggeration,near:a,dx:o,dy:l,dz:u,worldSize:s},c=0,d=1;if(u===0){if(a[2]>r.maxElevation||a[2]<r.minElevation)return null}else{let _=(r.maxElevation-a[2])/u,y=(r.minElevation-a[2])/u;if(c=Math.max(c,Math.min(_,y)),d=Math.min(d,Math.max(_,y)),c>d)return null}let p=Math.hypot(o,l),f=he(Math.ceil(p*(d-c)/4),1,512),m=0,g=!Do(h,0);for(let _=0;_<=f;_++){let y=c+(d-c)*_/f;if(!g)g=!Do(h,y);else if(Do(h,y)){let{lo:x,hi:v}=Bv(h,Do,m,y,.001/p),w=Ho(h,x),b=Ho(h,v),T=a[2]+x*u-w.elevation,P=a[2]+v*u-b.elevation,S=w.covered&&T>P?he(x+T*(v-x)/(T-P),x,v):v;return new Me((a[0]+S*o)/s,(a[1]+S*l)/s,Ho(h,S).elevation)}m=y}return null}getRaySegmentFromPixel(t){let i=[t.x,t.y,0,1],r=[t.x,t.y,1,1];It(i,i,this._pixelMatrixInverse),It(r,r,this._pixelMatrixInverse);let a=i[3],n=r[3],s=this.elevation;return{near:[i[0]/a,i[1]/a,i[2]/a+s],far:[r[0]/n,r[1]/n,r[2]/n+s]}}screenPointToMercatorCoordinateAtZ(t,i){let r=i||0,{near:a,far:n}=this.getRaySegmentFromPixel(t),s=a[2]===n[2]?0:(r+this.elevation-a[2])/(n[2]-a[2]);return new Me(Je.number(a[0],n[0],s)/this.worldSize,Je.number(a[1],n[1],s)/this.worldSize,r)}coordinatePoint(t,i=0,r=this._pixelMatrix){let a=this._coordinateClipPoint(t,i,r),n=a[3];return n>0?new A(a[0]/n,a[1]/n):this._offScreenPointBehindCamera(a[0],a[1],n)}_coordinateClipPoint(t,i,r){let a=[t.x*this.worldSize,t.y*this.worldSize,i,1];return It(a,a,r)}_offScreenPointBehindCamera(t,i,r){let a=this.width/2,n=this.height/2,s=t-a*r,o=i-n*r;s===0&&o===0&&(o=1);let l=a+this.width,u=n+this.height,h=Math.min(s===0?1/0:l/Math.abs(s),o===0?1/0:u/Math.abs(o));return new A(a+s*h,n+o*h)}getBounds(){let t=Math.max(0,this._helper._height/2-es(this));return new ki().extend(this.screenPointToLocation(new A(0,t))).extend(this.screenPointToLocation(new A(this._helper._width,t))).extend(this.screenPointToLocation(new A(this._helper._width,this._helper._height))).extend(this.screenPointToLocation(new A(0,this._helper._height)))}isPointOnMapSurface(t,i){return i?this.screenTerrainPointToMercatorCoordinate(t,i)!=null:t.y>this.height/2-es(this)}calculatePosMatrix(t,i=!1,r=!1){let a=t.key??Ga(t.wrap,t.canonical.z,t.canonical.z,t.canonical.x,t.canonical.y),n=i?this._alignedPosMatrixCache:this._posMatrixCache;if(n.has(a)){let l=n.get(a);return r?l.f32:l.f64}let s=Xu(t,this.worldSize);Ma(s,i?this._alignedProjMatrix:this._viewProjMatrix,s);let o={f64:s,f32:new Float32Array(s)};return n.set(a,o),r?o.f32:o.f64}calculateFogMatrix(t){let i=t.key,r=this._fogMatrixCacheF32;if(r.has(i))return r.get(i);let a=Xu(t,this.worldSize);return Ma(a,this._fogMatrix,a),r.set(i,new Float32Array(a)),r.get(i)}calculateCenterFromCameraLngLatAlt(t,i,r,a){return this._helper.calculateCenterFromCameraLngLatAlt(t,i,r,a)}calculateCameraOptionsFromTo(t,i,r,a){let n=Me.fromLngLat(t,i),s=Me.fromLngLat(r,a),o=s.x-n.x,l=s.y-n.y,u=s.z-n.z,h=Math.hypot(o,l,u);if(h===0)throw Error("Can't calculate camera options with same From and To");let c=Math.hypot(o,l),d=zt(this.cameraToCenterDistance/h/this.tileSize),p=Gi(Math.atan2(o,-l)),f=Gi(Math.acos(c/h));return f=u<0?90-f:90+f,{center:s.toLngLat(),elevation:a,zoom:d,pitch:f,bearing:p}}_calculateNearFarZ(t,i,r){let a=Math.min(this.elevation,this.minElevationForCurrentTile,this.getCameraAltitude()-100),n=t-a*this._helper._pixelPerMeter/Math.cos(i),s=a<0?n:t,o=Math.PI/2+this.pitchInRadians,l=Xe(this.fov)*(Math.abs(Math.cos(Xe(this.roll)))*this.height+Math.abs(Math.sin(Xe(this.roll)))*this.width)/this.height*(.5+r.y/this.height),u=Math.sin(l)*s/Math.sin(he(Math.PI-o-l,.01,Math.PI-.01)),h=es(this),c=Math.atan(h/this._helper.cameraToCenterDistance),d=Xe(90-ra),p=c>d?2*c*(.5+r.y/(h*2)):d,f=Math.sin(p)*s/Math.sin(he(Math.PI-o-p,.01,Math.PI-.01)),m=Math.min(u,f);this._helper._farZ=(Math.cos(Math.PI/2-i)*m+s)*1.01,this._helper._nearZ=this._helper._height/50}_calcMatrices(t=this._helper.autoCalculateNearFarZ){let i=this.centerOffset,r=Zi(this.worldSize,this.center),a=r.x,n=r.y,s=Xe(Math.min(this.pitch,ra)),o=Math.max(this._helper.cameraToCenterDistance/2,this._helper.cameraToCenterDistance+this._helper._elevation*this._helper._pixelPerMeter/Math.cos(s));t&&this._calculateNearFarZ(o,s,i);let l;l=new Float64Array(16),wh(l,this.fovInRadians,this._helper._width/this._helper._height,this._helper._nearZ,this._helper._farZ),this._invProjMatrix=new Float64Array(16),F3(this._invProjMatrix,l),l[8]=-i.x*2/this._helper._width,l[9]=i.y*2/this._helper._height,this._projectionMatrix=bh(l),At(l,l,[1,-1,1]),ct(l,l,[0,0,-this._helper.cameraToCenterDistance]),Dr(l,l,-this.rollInRadians),Xa(l,l,this.pitchInRadians),Dr(l,l,-this.bearingInRadians),ct(l,l,[-a,-n,0]),this._mercatorMatrix=At([],l,[this.worldSize,this.worldSize,this.worldSize]),At(l,l,[1,1,this._helper._pixelPerMeter]),this._pixelMatrix=Ma(new Float64Array(16),this.clipSpaceToPixelsMatrix,l),ct(l,l,[0,0,-this.elevation]),this._viewProjMatrix=l,this._invViewProjMatrix=Yo([],l);let u=[0,0,-1,1];It(u,u,this._invViewProjMatrix),this._cameraPosition=[u[0]/u[3],u[1]/u[3],u[2]/u[3]],this._fogMatrix=new Float64Array(16),wh(this._fogMatrix,this.fovInRadians,this.width/this.height,o,this._helper._farZ),this._fogMatrix[8]=-i.x*2/this.width,this._fogMatrix[9]=i.y*2/this.height,At(this._fogMatrix,this._fogMatrix,[1,-1,1]),ct(this._fogMatrix,this._fogMatrix,[0,0,-this.cameraToCenterDistance]),Dr(this._fogMatrix,this._fogMatrix,-this.rollInRadians),Xa(this._fogMatrix,this._fogMatrix,this.pitchInRadians),Dr(this._fogMatrix,this._fogMatrix,-this.bearingInRadians),ct(this._fogMatrix,this._fogMatrix,[-a,-n,0]),At(this._fogMatrix,this._fogMatrix,[1,1,this._helper._pixelPerMeter]),ct(this._fogMatrix,this._fogMatrix,[0,0,-this.elevation]),this._pixelMatrix3D=Ma(new Float64Array(16),this.clipSpaceToPixelsMatrix,l);let h=this._helper._width%2/2,c=this._helper._height%2/2,d=Math.cos(this.bearingInRadians),p=Math.sin(-this.bearingInRadians),f=a-Math.round(a)+d*h+p*c,m=n-Math.round(n)+d*c+p*h,g=new Float64Array(l);if(ct(g,g,[f>.5?f-1:f,m>.5?m-1:m,0]),this._alignedProjMatrix=g,l=Yo(new Float64Array(16),this._pixelMatrix),!l)throw Error("failed to invert matrix");this._pixelMatrixInverse=l,this._clearMatrixCaches()}_clearMatrixCaches(){this._posMatrixCache.clear(),this._alignedPosMatrixCache.clear(),this._fogMatrixCacheF32.clear()}maxPitchScaleFactor(){if(!this._pixelMatrixInverse)return 1;let t=this.screenPointToMercatorCoordinate(new A(0,0)),i=[t.x*this.worldSize,t.y*this.worldSize,0,1];return It(i,i,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 t=ia(1,this.center.lat)*this.worldSize,i=this._helper.cameraToCenterDistance/t;return W0(this.center,this.elevation,this.pitch,this.bearing,i).toLngLat()}getProjectionData(t){let{overscaledTileID:i,aligned:r,applyTerrainMatrix:a}=t,n=this._helper.getMercatorTileCoordinates(i),s=i?this.calculatePosMatrix(i,r,!0):null,o;return o=i!=null&&i.terrainRttPosMatrix32f&&a?i.terrainRttPosMatrix32f:s||D_(),{mainMatrix:o,tileMercatorCoords:n,clippingPlane:[0,0,0,0],projectionTransition:0,fallbackMatrix:o,clipAntimeridian:!1}}isLocationOccluded(t,i,r){if(!(i!=null&&i.getCoverageIndex()))return!1;let a=Me.fromLngLat(t);r??(r=i.getElevationForLngLat(t,this));let n=this._coordinateClipPoint(a,r,this._pixelMatrix3D),s=n[3];if(s<=0||n[2]>s)return!0;let o=new A(n[0]/s,n[1]/s),l=this.screenTerrainPointToMercatorCoordinate(o,i);if(l==null)return!1;let u=this.getRaySegmentFromPixel(o),h=jg(u,a.x*this.worldSize,a.y*this.worldSize,r);return jg(u,l.x*this.worldSize,l.y*this.worldSize,l.z)<h*.99}getPixelScale(){return 1}getCircleRadiusCorrection(){return 1}getPitchedTextCorrection(t,i,r){return 1}transformLightDirection(t){return Th(t)}getRayDirectionFromPixel(t){throw Error("Not implemented.")}projectTileCoordinates(t,i,r,a){let n=this.calculatePosMatrix(r),s;a==null?(s=[t,i,0,1],Tp(s,s,n)):(s=[t,i,a,1],It(s,s,n));let o=s[3];return{point:new A(s[0]/o,s[1]/o),signedDistanceFromCamera:o,isOccluded:!1}}populateCache(t){for(let i of t)this.calculatePosMatrix(i)}getProjectionDataForCustomLayer(t=!0){let i=new Pt(0,0,0,0,0),r=this.getProjectionData({overscaledTileID:i,applyGlobeMatrix:t}),a=Xu(i,this.worldSize);Ma(a,this._viewProjMatrix,a);let n=[L,L,this.worldSize/this._helper.pixelsPerMeter],s=Hr();return At(s,a,n),{...r,tileMercatorCoords:[0,0,1,1],fallbackMatrix:s,mainMatrix:s}}getFastPathSimpleProjectionMatrix(t){return this.calculatePosMatrix(t)}};function Ho(e,t){return Sp(e.index,e.exaggeration,(e.near[0]+t*e.dx)/e.worldSize,(e.near[1]+t*e.dy)/e.worldSize)}function Do(e,t){return Lv(Ho(e,t),e.near[2]+t*e.dz)}function jg({near:e,far:t},i,r,a){let n=t[0]-e[0],s=t[1]-e[1],o=t[2]-e[2];return((i-e[0])*n+(r-e[1])*s+(a-e[2])*o)/(n*n+s*s+o*o)}function $v(){xe("Map cannot fit within canvas with the given bounds, padding, and/or offset.")}function jv(e){if(e.useSlerp)if(e.k<1){let t=If(e.startEulerAngles.roll,e.startEulerAngles.pitch,e.startEulerAngles.bearing),i=If(e.endEulerAngles.roll,e.endEulerAngles.pitch,e.endEulerAngles.bearing),r=new Float64Array(4);ko(r,t,i,e.k);let a=cw(r);e.tr.setRoll(a.roll),e.tr.setPitch(a.pitch),e.tr.setBearing(a.bearing)}else e.tr.setRoll(e.endEulerAngles.roll),e.tr.setPitch(e.endEulerAngles.pitch),e.tr.setBearing(e.endEulerAngles.bearing);else e.tr.setRoll(Je.number(e.startEulerAngles.roll,e.endEulerAngles.roll,e.k)),e.tr.setPitch(Je.number(e.startEulerAngles.pitch,e.endEulerAngles.pitch,e.k)),e.tr.setBearing(Je.number(e.startEulerAngles.bearing,e.endEulerAngles.bearing,e.k))}function Vv(e,t,i,r,a){let n=a.padding,s=Zi(a.worldSize,i.getNorthWest()),o=Zi(a.worldSize,i.getNorthEast()),l=Zi(a.worldSize,i.getSouthEast()),u=Zi(a.worldSize,i.getSouthWest()),h=Xe(-r),c=s.rotate(h),d=o.rotate(h),p=l.rotate(h),f=u.rotate(h),m=new A(Math.max(c.x,d.x,f.x,p.x),Math.max(c.y,d.y,f.y,p.y)),g=new A(Math.min(c.x,d.x,f.x,p.x),Math.min(c.y,d.y,f.y,p.y)),_=m.sub(g),y=a.width-(n.left+n.right+t.left+t.right),x=a.height-(n.top+n.bottom+t.top+t.bottom),v=y/_.x,w=x/_.y;if(w<0||v<0){$v();return}let b=Math.min(zt(a.scale*Math.min(v,w)),e.maxZoom),T=A.convert(e.offset),P=(t.left-t.right)/2,S=(t.top-t.bottom)/2,M=new A(P,S).rotate(Xe(r)),k=T.add(M).mult(a.scale/Gt(b));return{center:xs(a.worldSize,s.add(l).div(2).sub(k)),zoom:b,bearing:r}}var Sl=class{get useGlobeControls(){return!1}handlePanInertia(e,t){let i=e.mag(),r=Math.abs(es(t));return{easingOffset:e.mult(Math.min(r*.75/i,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,i){e.around.distSqr(t.centerPoint)<.01||t.setLocationAtPoint(i,e.around,e.aroundElevation)}cameraForBoxAndBearing(e,t,i,r,a){return Vv(e,t,i,r,a)}handleJumpToCenterZoom(e,t){let i=t.zoom===void 0?e.zoom:+t.zoom;e.zoom!==i&&e.setZoom(+t.zoom),t.center!==void 0&&e.setCenter(X.convert(t.center))}handleEaseTo(e,t){let i=e.zoom,r=e.padding,a={roll:e.roll,pitch:e.pitch,bearing:e.bearing},n={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,o=!e.isPaddingEqual(t.padding),l=!1,u=s?+t.zoom:e.zoom,h=e.centerPoint.add(t.offsetAsPoint),c=e.screenPointToLocation(h),{center:d,zoom:p}=e.applyConstrain(X.convert(t.center||c),u??i);Tl(e,d);let f=Zi(e.worldSize,c),m=Zi(e.worldSize,d).sub(f),g=Gt(p-i);return l=p!==i,{easeFunc:_=>{if(l&&e.setZoom(Je.number(i,p,_)),A_(a,n)||jv({startEulerAngles:a,endEulerAngles:n,tr:e,k:_,useSlerp:a.roll!=n.roll}),o&&(e.interpolatePadding(r,t.padding,_),h=e.centerPoint.add(t.offsetAsPoint)),t.around)e.setLocationAtPoint(t.around,t.aroundPoint);else{let y=Gt(e.zoom-i),x=(p>i?Math.min(2,g):Math.max(.5,g))**(1-_),v=xs(e.worldSize,f.add(m.mult(_*x)).mult(y));e.setLocationAtPoint(e.renderWorldCopies?v.wrap():v,h)}},isZooming:l,elevationCenter:d}}handleFlyTo(e,t){let i=t.zoom!==void 0,r=e.zoom,a=e.applyConstrain(X.convert(t.center||t.locationAtOffset),i?+t.zoom:r),n=a.center,s=a.zoom;Tl(e,n);let o=e.worldSize,l=Zi(o,t.locationAtOffset),u=Zi(o,n).sub(l),h=u.mag(),c=Gt(s-r),d=t.minZoom===void 0?e.minZoom:+t.minZoom,p=Math.max(d,e.minZoom),f=Math.min(p,r,s),m=e.applyConstrain(n,f).zoom;return{easeFunc:(g,_,y,x)=>{e.setZoom(g===1?s:r+zt(_));let v=g===1?n:xs(o,l.add(u.mult(y)));e.setLocationAtPoint(e.renderWorldCopies?v.wrap():v,x)},scaleOfZoom:c,targetCenter:n,scaleOfMinZoom:Gt(m-r),pixelPathLength:h}}};let fF;const mF=()=>fF||(fF=new Dt({type:new N(z.projection.type,"type")})),sh=new Gd({fill:new hr(128,2),line:new hr(512,0),tile:new hr(128,32),stencil:new hr(128,1),circle:3});var Nv=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 qi.projectionGlobe}get vertexShaderPreludeCode(){return qi.projectionMercator.vertexSource}get subdivisionGranularity(){return sh}get useGlobeControls(){return!0}destroy(){}_getMeshKey(e){return`${e.granularity.toString(36)}_${e.generateBorders?"b":""}${e.extendToNorthPole?"n":""}${e.extendToSouthPole?"s":""}`}getMeshFromTileID(e,t,i,r,a){let n=(a==="stencil"?sh.stencil:sh.tile).getGranularityForZoomLevel(t.z),s=t.y===0&&r,o=t.y===(1<<t.z)-1&&r;return this._getMesh(e,{granularity:n,generateBorders:i,extendToNorthPole:s,extendToSouthPole:o})}_getMesh(e,t){let i=this._getMeshKey(t);if(i in this._tileMeshCache)return this._tileMeshCache[i];let r=gv(e,t);return this._tileMeshCache[i]=r,r}recalculate(e){}hasTransition(){return!1}},Vg=class extends _t{constructor(e,t){super(),this._transitionable=new Zl(mF(),"projection",t),this.setProjection(e),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new Be(0)),this._mercatorProjection=new Kc,this._verticalPerspectiveProjection=new Nv}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 Lr){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,i,r,a){return this.currentProjection.getMeshFromTileID(e,t,i,r,a)}setProjection(e){this._transitionable.setValue("type",(e==null?void 0: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 Uv(e){let t=on(e.worldSize,e.center.lat);return 2*Math.PI*t}function gF(e,t,i){let r=vt(t),a=vt(i),n=dt(r,a),s=Math.acos(n),o=Uv(e);return s/(2*Math.PI)*o}function _F(e,t){return[sa(e*Math.PI*2+Math.PI,Math.PI*2),2*Math.atan(Math.exp(Math.PI-t*Math.PI*2))-Math.PI*.5]}function yF(e,t){let i=Math.cos(t),r=new Float64Array(3);return r[0]=Math.sin(e)*i,r[1]=Math.sin(t),r[2]=Math.cos(e)*i,r}function Tr(e,t,i,r,a){let n=1/(1<<a),s=e/L*n+i*n,o=t/L*n+r*n,l=sa(s*Math.PI*2+Math.PI,Math.PI*2),u=2*Math.atan(Math.exp(Math.PI-o*Math.PI*2))-Math.PI*.5,h=Math.cos(u),c=new Float64Array(3);return c[0]=Math.sin(l)*h,c[1]=Math.sin(u),c[2]=Math.cos(l)*h,c}function vt(e){return yF(e.lng*Math.PI/180,e.lat*Math.PI/180)}function on(e,t){return e/(2*Math.PI)/Math.cos(t*Math.PI/180)}function Gv(e){let t=It(Wr(),[0,0,0,1],e.modelViewProjectionMatrix);return It(t,t,e.inverseProjectionMatrix),[t[0]/t[3],t[1]/t[3],t[2]/t[3]]}function ts(e){let t=Math.asin(e[1])/Math.PI*180,i=Math.sqrt(e[0]*e[0]+e[2]*e[2]);if(i>1e-6){let r=e[0]/i,a=e[2]/i,n=Math.acos(a),s=(r>0?n:-n)/Math.PI*180;return new X(bi(s,-180,180),t)}return new X(0,t)}function vF(e,t){return dd(Wr(),-e.lng,-e.lat,t)}function xF(e){let t=e[0],i=e[1],r=e[2],a=e[3];return{lng:-Math.atan2(2*(a*t+i*r),1-2*(t*t+i*i))*180/Math.PI,lat:-Math.asin(he(2*(a*i-r*t),-1,1))*180/Math.PI,bearing:Math.atan2(2*(a*r+t*i),1-2*(i*i+r*r))*180/Math.PI}}const oh=Math.PI*.98;function Ng(e,t){let i=e.cameraPosition,r=mr(i);if(r<=1)return e.screenPointToLocation(t);let a=Ae();Nt(a,i);let n=e.getRayDirectionFromPixel(t),s=-dt(n,a),o=Ae();Ko(o,n,a,s);let l=mr(o);if(l<1e-9)return e.screenPointToLocation(t);let u=Math.atan2(l,s),h=Math.asin(1/r)*.9;if(u<h)return e.screenPointToLocation(t);let c=r*Math.sin(h),d=Math.asin(he(c,-1,1))-h,p=r*Math.cos(h)/Math.sqrt(Math.max(1-c*c,1e-12))-1,f=oh-d,m=u-h,g=d+p*m*f/(f+p*m),_=Ae();He(_,o,1/l);let y=Ae();return He(y,a,Math.cos(he(g,0,oh))),Ko(y,y,_,Math.sin(he(g,0,oh))),Nt(y,y),ts(y)}function bF(e,t,i,r,a=!0){let n=Ng(e,i),s=t;if(r)s=Ng(e,i.sub(r));else if(!e.isPointOnMapSurface(i))return;let o=vt(n),l=vt(s),u=vF(e.center,e.bearing),h=ei(Ae(),l,o),c=Math.sqrt(dt(h,h)),d=Math.acos(he(dt(l,o),-1,1))/2,p=Math.sin(d),f=c?Tf(h[1]/c*p,-h[0]/c*p,h[2]/c*p,Math.cos(d)):Tf(0,0,0,1),{lng:m,lat:g,bearing:_}=xF(Zb(Wr(),u,f)),y=e.center.lat,x=e.zoom,v=he(g,-90,90),w=a?wF(e,i,r,m):m;e.setCenter(new X(bi(w,-180,180),v)),a||e.setBearing(_),e.setZoom(x+Et(y,e.center.lat))}function wF(e,t,i,r){let a=e.center.lng,n=e.center.lat,s=n>=0?90:-90,o=e.locationToScreenPoint(new X(0,s)),l=t.x-o.x,u=t.y-o.y,h=l*l+u*u,c=he(1-(Xi-Math.abs(n))/12,0,1),d=c*c*(3-2*c),p=sa(r-a+180,360)-180,f=0;if(d>0&&i){let m=(l*i.y-u*i.x)/Math.max(h,400);f=(s>0?1:-1)*m*180/Math.PI}return a+(1-d)*p+d*f}function TF(e){let t=Ae();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 EF(e,t,i){let r=Ae();gr(r,i,e);let a=Ae();return Ko(a,e,r,t/Jo(r)),a}function Dl(e){return Math.cos(e*Math.PI/180)}function Et(e,t){let i=Dl(e),r=Dl(t);return zt(r/i)}function SF(e,t){return 360/Uv({worldSize:e,center:{lat:t}})}function DF(e,t){let i=e.rotate(t.bearingInRadians),r=t.zoom+Et(t.center.lat,0),a=ja(1/Dl(t.center.lat),1/Dl(Math.min(Math.abs(t.center.lat),60)),Lo(r,7,3,0,1)),n=SF(t.worldSize,t.center.lat);return new X(t.center.lng-i.x*n*a,he(t.center.lat+i.y*n,-Xi,Xi))}function lh(e){let t=.5*e,i=Math.sin(t),r=Math.cos(t);return Math.log(i+r)-Math.log(r-i)}function Ug(e,t,i,r){let a=e.lat+i*r;if(Math.abs(i)>1){let n=e.lat+i,s=(Math.sign(n)===Math.sign(e.lat)?Math.abs(e.lat):-Math.abs(e.lat))*Math.PI/180,o=Math.abs(e.lat+i)*Math.PI/180,l=lh(s+r*(o-s)),u=lh(s),h=lh(o),c=(l-u)/(h-u),d=e.lng+t*c;return new X(d,a)}{let n=e.lng+t*r;return new X(n,a)}}function Co(e,t,i=1){let r=dt(e,t),a=i*i,n=Ae(),s=Ae();He(s,t,r),gr(n,e,s);let o=a-dt(n,n);if(o<0)return null;let l=dt(e,e)-a,u=-r+(r<0?1:-1)*Math.sqrt(o),h=l/u,c=u;return{tMin:Math.min(h,c),tMax:Math.max(h,c)}}var CF=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,i,r){let a=`${e.z}_${e.x}_${e.y}_${r!=null&&r.terrain?"t":""}_${Math.round(i)}`,n=this._cache.get(a);if(n)return n;let s=this._cachePrevious.get(a);if(s)return this._cache.set(a,s),s;let o=this._boundingVolumeFactory(e,t,i,r);return this._cache.set(a,o),this._hadAnyChanges=!0,o}},uh=class Qc{constructor(t,i,r,a){this.min=r,this.max=a,this.points=t,this.planes=i}static fromAabb(t,i){let r=[];for(let a=0;a<8;a++)r.push([(a>>0&1)==1?i[0]:t[0],(a>>1&1)==1?i[1]:t[1],(a>>2&1)==1?i[2]:t[2]]);return new Qc(r,[[-1,0,0,i[0]],[1,0,0,-t[0]],[0,-1,0,i[1]],[0,1,0,-t[1]],[0,0,-1,i[2]],[0,0,1,-t[2]]],t,i)}static fromCenterSizeAngles(t,i,r){let a=dd([],r[0],r[1],r[2]),n=Ru([],[i[0],0,0],a),s=Ru([],[0,i[1],0],a),o=Ru([],[0,0,i[2]],a),l=[...t],u=[...t];for(let c=0;c<8;c++)for(let d=0;d<3;d++){let p=t[d]+n[d]*((c>>0&1)==1?1:-1)+s[d]*((c>>1&1)==1?1:-1)+o[d]*((c>>2&1)==1?1:-1);l[d]=Math.min(l[d],p),u[d]=Math.max(u[d],p)}let h=[];for(let c=0;c<8;c++){let d=[...t];xi(d,d,He([],n,(c>>0&1)==1?1:-1)),xi(d,d,He([],s,(c>>1&1)==1?1:-1)),xi(d,d,He([],o,(c>>2&1)==1?1:-1)),h.push(d)}return new Qc(h,[[...n,-dt(n,h[0])],[...s,-dt(s,h[0])],[...o,-dt(o,h[0])],[-n[0],-n[1],-n[2],-dt(n,h[7])],[-s[0],-s[1],-s[2],-dt(s,h[7])],[-o[0],-o[1],-o[2],-dt(o,h[7])]],l,u)}intersectsFrustum(t){let i=!0,r=this.points.length,a=this.planes.length,n=t.planes.length,s=t.points.length;for(let o=0;o<n;o++){let l=t.planes[o],u=0;for(let h=0;h<r;h++){let c=this.points[h];l[0]*c[0]+l[1]*c[1]+l[2]*c[2]+l[3]>=0&&u++}if(u===0)return 0;u<r&&(i=!1)}if(i)return 2;for(let o=0;o<a;o++){let l=this.planes[o],u=0;for(let h=0;h<s;h++){let c=t.points[h];l[0]*c[0]+l[1]*c[1]+l[2]*c[2]+l[3]>=0&&u++}if(u===0)return 0}return 1}intersectsPlane(t){let i=this.points.length,r=0;for(let a=0;a<i;a++){let n=this.points[a];t[0]*n[0]+t[1]*n[1]+t[2]*n[2]+t[3]>=0&&r++}return r===i?2:r===0?0:1}};function Xo(e,t,i){let r=e-t;return r<0?-r:Math.max(0,r-i)}function hh(e,t,i,r,a){let n=e-i,s;return s=n<0?Math.min(-n,1+n-a):n>a?Math.min(Math.max(n-a,0),1-n):0,Math.max(s,Xo(t,r,a))}var PF=class{constructor(){this._boundingVolumeCache=new CF(this._computeTileBoundingVolume)}prepareNextFrame(){this._boundingVolumeCache.swapBuffers()}distanceToTile2d(e,t,i,r){let a=1<<i.z,n=1/a,s=i.x/a,o=i.y/a,l=.5,u=2;return u=Math.min(u,hh(e,t,s,o,n)),u=Math.min(u,hh(e,t,s+l,-o-n,n)),u=Math.min(u,hh(e,t,s+l,2-o-n,n)),u}getWrap(e,t,i){let r=1<<t.z,a=1/r,n=t.x/r,s=Xo(e.x,n,a),o=Xo(e.x,n-1,a),l=Xo(e.x,n+1,a),u=Math.min(s,o,l);return u===l?1:u===o?-1:0}allowVariableZoom(e,t){return vp(e,t)>4}allowWorldCopies(){return!1}getTileBoundingVolume(e,t,i,r){return this._boundingVolumeCache.getTileBoundingVolume(e,t,i,r)}_computeTileBoundingVolume(e,t,i,r){let a=Math.min(0,i),n=Math.max(0,i);if(r!=null&&r.terrain){let s=new Pt(e.z,t,e.z,e.x,e.y),o=r.terrain.getMinMaxElevation(s);a=o.minElevation??a,n=Math.max(o.maxElevation??n,n)}if(a/=Vt,n/=Vt,a+=1,n+=1,e.z<=0)return uh.fromAabb([-n,-n,-n],[n,n,n]);if(e.z===1)return uh.fromAabb([e.x===0?-n:0,e.y===0?0:-n,-n],[e.x===0?0:n,e.y===0?n:0,n]);{let s=[Tr(0,0,e.x,e.y,e.z),Tr(L,0,e.x,e.y,e.z),Tr(L,L,e.x,e.y,e.z),Tr(0,L,e.x,e.y,e.z)],o=[];for(let P of s)o.push(He([],P,n));if(n!==a)for(let P of s)o.push(He([],P,a));e.y===0&&o.push([0,1,0]),e.y===(1<<e.z)-1&&o.push([0,-1,0]);let l=[1,1,1],u=[-1,-1,-1];for(let P of o)for(let S=0;S<3;S++)l[S]=Math.min(l[S],P[S]),u[S]=Math.max(u[S],P[S]);let h=Tr(L/2,L/2,e.x,e.y,e.z),c=ei([],[0,1,0],h);Nt(c,c);let d=ei([],h,c);Nt(d,d);let p=ei([],s[2],s[1]);Nt(p,p);let f=ei([],s[0],s[3]);Nt(f,f),o.push(He([],h,n)),e.y>=(1<<e.z)/2&&o.push(He([],Tr(L/2,0,e.x,e.y,e.z),n)),e.y<(1<<e.z)/2&&o.push(He([],Tr(L/2,L,e.x,e.y,e.z),n));let m=Gg(h,o),g=Gg(d,o),_=[-h[0],-h[1],-h[2],m.max],y=[h[0],h[1],h[2],-m.min],x=[-d[0],-d[1],-d[2],g.max],v=[d[0],d[1],d[2],-g.min],w=[...p,0],b=[...f,0],T=[];return e.y===0?T.push(pi(b,w,_),pi(b,w,y)):T.push(pi(x,w,_),pi(x,w,y),pi(x,b,_),pi(x,b,y)),e.y===(1<<e.z)-1?T.push(pi(b,w,_),pi(b,w,y)):T.push(pi(v,w,_),pi(v,w,y),pi(v,b,_),pi(v,b,y)),new uh(T,[_,y,x,v,w,b],l,u)}}};function Gg(e,t){let i=1/0,r=-1/0;for(let a of t){let n=dt(e,a);i=Math.min(i,n),r=Math.max(r,n)}return{min:i,max:r}}const Zg=1e-12;var Zv=class qv{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(t){this._helper.setMinZoom(t)}setMaxZoom(t){this._helper.setMaxZoom(t)}setMinPitch(t){this._helper.setMinPitch(t)}setMaxPitch(t){this._helper.setMaxPitch(t)}setRenderWorldCopies(t){this._helper.setRenderWorldCopies(t)}setBearing(t){this._helper.setBearing(t)}setPitch(t){this._helper.setPitch(t)}setRoll(t){this._helper.setRoll(t)}setFov(t){this._helper.setFov(t)}setZoom(t){this._helper.setZoom(t)}setCenter(t){this._helper.setCenter(t)}setElevation(t){this._helper.setElevation(t)}setMinElevationForCurrentTile(t){this._helper.setMinElevationForCurrentTile(t)}setPadding(t){this._helper.setPadding(t)}interpolatePadding(t,i,r){this._helper.interpolatePadding(t,i,r)}isPaddingEqual(t){return this._helper.isPaddingEqual(t)}resize(t,i){this._helper.resize(t,i)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(t){this._helper.setMaxBounds(t)}setConstrainOverride(t){this._helper.setConstrainOverride(t)}overrideNearFarZ(t,i){this._helper.overrideNearFarZ(t,i)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(t){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),t)}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(t){}constructor(t,i){this._cachedClippingPlane=Wr(),this._projectionMatrix=io(),this._globeViewProjMatrix32f=D_(),this._globeViewProjMatrixF64=io(),this._globeViewProjMatrixF64Inverted=io(),this._globeProjMatrixInverted=io(),this._cameraPosition=Ae(),this.defaultConstrain=(r,a)=>{let n=he(r.lat,-Xi,Xi),s=he(+a,this.minZoom+Et(0,n),this.maxZoom);return{center:new X(r.lng,n),zoom:s}},this.applyConstrain=(r,a)=>this._helper.applyConstrain(r,a),this._helper=i??new Ep({calcMatrices:()=>this._calcMatrices(),defaultConstrain:(r,a)=>this.defaultConstrain(r,a)},t),this._coveringTilesDetailsProvider=new PF}clone(){let t=new qv;return t.apply(this,!1),t}apply(t,i){this._helper.apply(t,i)}get projectionMatrix(){return this._projectionMatrix}get modelViewProjectionMatrix(){return this._globeViewProjMatrixF64}get inverseProjectionMatrix(){return this._globeProjMatrixInverted}get cameraPosition(){let t=Ae();return t[0]=this._cameraPosition[0],t[1]=this._cameraPosition[1],t[2]=this._cameraPosition[2],t}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}getProjectionData(t){let{overscaledTileID:i,applyGlobeMatrix:r}=t,a=this._helper.getMercatorTileCoordinates(i);return{mainMatrix:this._globeViewProjMatrix32f,tileMercatorCoords:a,clippingPlane:this._cachedClippingPlane,projectionTransition:+!!r,fallbackMatrix:this._globeViewProjMatrix32f,clipAntimeridian:(i==null?void 0:i.canonical.z)===0}}_computeClippingPlane(t){let i=this.pitchInRadians,r=this.cameraToCenterDistance/t,a=Math.sin(i)*r,n=Math.cos(i)*r+1,s=1/Math.sqrt(a*a+n*n)*1,o=-a,l=n,u=Math.sqrt(o*o+l*l);o/=u,l/=u;let h=[0,o,l];ku(h,h,[0,0,0],-this.bearingInRadians),En(h,h,[0,0,0],-1*this.center.lat*Math.PI/180),Da(h,h,[0,0,0],this.center.lng*Math.PI/180);let c=1/mr(h);return He(h,h,c),[...h,-s*c]}isLocationOccluded(t,i,r){let a=i==null?void 0:i.getCoverageIndex();r??(r=a?i.getElevationForLngLat(t,this):0);let n=Wg(t,r);if(!this.isSurfacePointVisible(n))return!0;if(!a)return!1;let s=this._projectSurfacePointToScreen(n),o=this.cameraPosition,l=this.getRayDirectionFromPixel(s),u=Hg(o,l,n);if(u<=0)return!0;let h=this.screenTerrainPointToMercatorCoordinate(s,i);return h!=null&&Hg(o,l,Wg(h.toLngLat(),h.z))<u*.99}transformLightDirection(t){let i=this._helper._center.lng*Math.PI/180,r=this._helper._center.lat*Math.PI/180,a=Math.cos(r),n=[Math.sin(i)*a,Math.sin(r),Math.cos(i)*a],s=[n[2],0,-n[0]],o=[0,0,0];ei(o,s,n),Nt(s,s),Nt(o,o);let l=[s[0]*t[0]+o[0]*t[1]+n[0]*t[2],s[1]*t[0]+o[1]*t[1]+n[1]*t[2],s[2]*t[0]+o[2]*t[1]+n[2]*t[2]],u=[0,0,0];return Nt(u,l),u}getPixelScale(){return 1/Math.cos(this._helper._center.lat*Math.PI/180)}getCircleRadiusCorrection(){return Math.cos(this._helper._center.lat*Math.PI/180)}getPitchedTextCorrection(t,i,r){let a=q0(t,i,r.canonical),n=_F(a.x,a.y);return this.getCircleRadiusCorrection()/Math.cos(n[1])}projectTileCoordinates(t,i,r,a){let n=r.canonical,s=Tr(t,i,n.x,n.y,n.z),o=1+(a??0)/Vt,l=s[0]*o,u=s[1]*o,h=s[2]*o,c=[l,u,h,1];It(c,c,this._globeViewProjMatrixF64);let d;if(o<=1){let p=this._cachedClippingPlane;d=p[0]*s[0]+p[1]*s[1]+p[2]*s[2]+p[3]<0}else d=this._isLineOfSightBlocked(l,u,h);return{point:new A(c[0]/c[3],c[1]/c[3]),signedDistanceFromCamera:c[3],isOccluded:d}}_isLineOfSightBlocked(t,i,r){let a=this._cameraPosition,n=t-a[0],s=i-a[1],o=r-a[2],l=n*n+s*s+o*o;if(l===0)return!1;let u=he(-(a[0]*n+a[1]*s+a[2]*o)/l,0,1),h=a[0]+u*n,c=a[1]+u*s,d=a[2]+u*o;return h*h+c*c+d*d<1}_calcMatrices(t=this._helper.autoCalculateNearFarZ){let i=on(this.worldSize,this.center.lat),r=Hr();t&&(this._helper._nearZ=.5,this._helper._farZ=this.cameraToCenterDistance+i*2),wh(r,this.fovInRadians,this.width/this.height,this._helper._nearZ,this._helper._farZ);let a=this.centerOffset;r[8]=-a.x*2/this._helper._width,r[9]=a.y*2/this._helper._height,this._projectionMatrix=bh(r),this._globeProjMatrixInverted=Hr(),Yo(this._globeProjMatrixInverted,r),ct(r,r,[0,0,-this.cameraToCenterDistance]),Dr(r,r,this.rollInRadians),Xa(r,r,-this.pitchInRadians),Dr(r,r,this.bearingInRadians),ct(r,r,[0,0,-i]);let n=Ae();n[0]=i,n[1]=i,n[2]=i,Xa(r,r,this.center.lat*Math.PI/180),E_(r,r,-this.center.lng*Math.PI/180),At(r,r,n),this._globeViewProjMatrixF64=r,this._globeViewProjMatrix32f=new Float32Array(r),this._globeViewProjMatrixF64Inverted=Hr(),Yo(this._globeViewProjMatrixF64Inverted,r);let s=Ae();this._cameraPosition=Ae(),this._cameraPosition[2]=this.cameraToCenterDistance/i,ku(this._cameraPosition,this._cameraPosition,s,-this.rollInRadians),En(this._cameraPosition,this._cameraPosition,s,this.pitchInRadians),ku(this._cameraPosition,this._cameraPosition,s,-this.bearingInRadians),xi(this._cameraPosition,this._cameraPosition,[0,0,1]),En(this._cameraPosition,this._cameraPosition,s,-this.center.lat*Math.PI/180),Da(this._cameraPosition,this._cameraPosition,s,this.center.lng*Math.PI/180),this._cachedClippingPlane=this._computeClippingPlane(i);let o=bh(this._globeViewProjMatrixF64Inverted);At(o,o,[1,1,-1]),this._cachedFrustum=yp.fromInvProjectionMatrix(o,1,0,this._cachedClippingPlane,!0)}calculateFogMatrix(t){xe("calculateFogMatrix is not supported on globe projection.");let i=Hr();return Fi(i),i}getVisibleUnwrappedCoordinates(t){return[new vl(0,t)]}getCameraFrustum(){return this._cachedFrustum}getClippingPlane(){return this._cachedClippingPlane}getCoveringTilesDetailsProvider(){return this._coveringTilesDetailsProvider}recalculateZoomAndCenter(t){if(t){xe("terrain is not fully supported on vertical perspective projection.");return}this._helper.recalculateZoomAndCenter(0)}maxPitchScaleFactor(){return 1}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return(mr(this._cameraPosition)-1)*Vt}getCameraLngLat(){let t=Ae();return Nt(t,this._cameraPosition),ts(t)}populateCache(t){}getBounds(){let t=this.width*.5,i=this.height*.5,r=[new A(0,0),new A(t,0),new A(this.width,0),new A(this.width,i),new A(this.width,this.height),new A(t,this.height),new A(0,this.height),new A(0,i)],a=[];for(let c of r)a.push(this.unprojectScreenPoint(c));let n=0,s=0,o=0,l=0,u=this.center;for(let c of a){let d=ni(u.lng,c.lng),p=ni(u.lat,c.lat);d<s&&(s=d),d>n&&(n=d),p<l&&(l=p),p>o&&(o=p)}let h=[u.lng+s,u.lat+l,u.lng+n,u.lat+o];return this.isSurfacePointOnScreen([0,1,0])&&(h[3]=90,h[0]=-180,h[2]=180),this.isSurfacePointOnScreen([0,-1,0])&&(h[1]=-90,h[0]=-180,h[2]=180),new ki(h)}calculateCenterFromCameraLngLatAlt(t,i,r,a){return this._helper.calculateCenterFromCameraLngLatAlt(t,i,r,a)}calculateCameraOptionsFromTo(t,i,r,a){let n=X.convert(r),s=vt(X.convert(t));He(s,s,1+i/Vt);let o=vt(n),l=He(Ae(),o,1+a/Vt),u=cd(Ae(),s,o),h=mr(u);if(h<Zg||zb(s,l)<Zg)throw Error("Can't calculate camera options with same From and To");let c=Ae();Da(u,u,c,-Xe(n.lng)),En(u,u,c,Xe(n.lat));let d=Gi(Math.acos(he(u[2]/h,-1,1))),p=Math.hypot(u[0],u[1])<h*1e-9?this.bearing:Gi(Math.atan2(-u[0],-u[1]));return{center:n,elevation:a,zoom:zt(this.cameraToCenterDistance/h/on(this.tileSize,n.lat)),pitch:d,bearing:p}}setLocationAtPoint(t,i,r){let a=vt(this.unprojectScreenPoint(i)),n=vt(t),s=Ae();Bb(s);let o=Ae();Da(o,a,s,-this.center.lng*Math.PI/180),En(o,o,s,this.center.lat*Math.PI/180);let l=n[0]*n[0]+n[2]*n[2],u=o[0]*o[0];if(l<u)return;let h=Math.sqrt(l-u),c=-h,d=ro(n[0],n[2],o[0],h),p=ro(n[0],n[2],o[0],c),f=Ae();Da(f,n,s,-d);let m=ro(f[1],f[2],o[1],o[2]),g=Ae();Da(g,n,s,-p);let _=ro(g[1],g[2],o[1],o[2]),y=Math.PI*.5,x=m>=-y&&m<=y,v=_>=-y&&_<=y,w,b;if(x&&v){let M=this.center.lng*Math.PI/180,k=this.center.lat*Math.PI/180,R=ao(d,M),D=ao(m,k),I=ao(p,M),C=ao(_,k);R+D<I+C?(w=d,b=m):(w=p,b=_)}else if(x)w=d,b=m;else if(v)w=p,b=_;else return;let T=w/Math.PI*180,P=b/Math.PI*180,S=this.center.lat;this.setCenter(new X(T,he(P,-90,90))),this.setZoom(this.zoom+Et(S,this.center.lat))}locationToScreenPoint(t,i){let r=vt(t);if(i){let a=i.getElevationForLngLatZoom(t,this._helper._tileZoom);He(r,r,1+a/Vt)}return this._projectSurfacePointToScreen(r)}_projectSurfacePointToScreen(t){let i=Wr();return It(i,[...t,1],this._globeViewProjMatrixF64),i[0]/=i[3],i[1]/=i[3],new A((i[0]*.5+.5)*this.width,(-i[1]*.5+.5)*this.height)}screenPointToMercatorCoordinate(t,i){if(i){let r=this.screenTerrainPointToMercatorCoordinate(t,i);if(r)return r}return Me.fromLngLat(this.unprojectScreenPoint(t))}screenTerrainPointToMercatorCoordinate(t,i){let r=i.getCoverageIndex();if(!r)return null;let a=this.cameraPosition,n=this.getRayDirectionFromPixel(t),s=Co(a,n,1+r.maxElevation/Vt);if(!s)return null;let o=Co(a,n,1+r.minElevation/Vt),l=Math.max(s.tMin,0),u=o?o.tMin:s.tMax;if(u<=l)return null;let h={index:r,exaggeration:i.exaggeration,origin:a,direction:n},c=0;for(let d=0;d<=256;d++){let p=l+(u-l)*d/256;if(qg(h,p)){let{hi:f}=Bv(h,qg,c,p,1e-12),{sample:m,mercator:g}=Wv(h,f);return new Me(g.x,g.y,m.elevation)}c=p}return null}screenPointToLocation(t,i){var r;return(r=this.screenPointToMercatorCoordinate(t,i))==null?void 0:r.toLngLat()}screenPointToLocationAtElevation(t,i){return this.screenPointToLocation(t)}isPointOnMapSurface(t,i){let r=this._cameraPosition;return!!Co(r,this.getRayDirectionFromPixel(t))}getRayDirectionFromPixel(t){let i=Wr();i[0]=t.x/this.width*2-1,i[1]=(t.y/this.height*2-1)*-1,i[2]=1,i[3]=1,It(i,i,this._globeViewProjMatrixF64Inverted),i[0]/=i[3],i[1]/=i[3],i[2]/=i[3];let r=Ae();r[0]=i[0]-this._cameraPosition[0],r[1]=i[1]-this._cameraPosition[1],r[2]=i[2]-this._cameraPosition[2];let a=Ae();return Nt(a,r),a}isSurfacePointVisible(t){let i=this._cachedClippingPlane;return i[0]*t[0]+i[1]*t[1]+i[2]*t[2]+i[3]>=0}isSurfacePointOnScreen(t){if(!this.isSurfacePointVisible(t))return!1;let i=Wr();return It(i,[...t,1],this._globeViewProjMatrixF64),i[0]/=i[3],i[1]/=i[3],i[2]/=i[3],i[0]>-1&&i[0]<1&&i[1]>-1&&i[1]<1&&i[2]>-1&&i[2]<1}unprojectScreenPoint(t){let i=this._cameraPosition,r=this.getRayDirectionFromPixel(t),a=Co(i,r);if(a){let h=Ae();xi(h,i,[r[0]*a.tMin,r[1]*a.tMin,r[2]*a.tMin]);let c=Ae();return Nt(c,h),ts(c)}let n=this._cachedClippingPlane,s=n[0]*r[0]+n[1]*r[1]+n[2]*r[2],o=-Sh(n,i)/s,l=Ae();if(o>0)xi(l,i,[r[0]*o,r[1]*o,r[2]*o]);else{let h=Ae();xi(h,i,[r[0]*2,r[1]*2,r[2]*2]);let c=Sh(this._cachedClippingPlane,h);gr(l,h,[this._cachedClippingPlane[0]*c,this._cachedClippingPlane[1]*c,this._cachedClippingPlane[2]*c])}let u=TF(n);return ts(EF(u.center,u.radius,l))}getProjectionDataForCustomLayer(t=!0){let i=this.getProjectionData({overscaledTileID:new Pt(0,0,0,0,0),applyGlobeMatrix:t});return i.tileMercatorCoords=[0,0,1,1],i}getFastPathSimpleProjectionMatrix(t){}};function Wv(e,t){let i=Ae();Ko(i,e.origin,e.direction,t);let r=mr(i),a=Ae();He(a,i,1/r);let n=ts(a),s=Me.fromLngLat(n),o=new Me(s.x,he(s.y,0,.999999999)),l=Sp(e.index,e.exaggeration,o.x,o.y),u=Math.abs(n.lat)>85.051129?0:l.elevation;return{sample:{...l,elevation:u},radius:r,mercator:o}}function qg(e,t){let{sample:i,radius:r}=Wv(e,t);return Lv(i,(r-1)*Vt)}function Wg(e,t){let i=vt(e);return He(i,i,1+t/Vt)}function Hg(e,t,i){let r=cd(Ae(),i,e);return dt(r,t)}var Xg=class Hv{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(t){this._helper.setMinZoom(t)}setMaxZoom(t){this._helper.setMaxZoom(t)}setMinPitch(t){this._helper.setMinPitch(t)}setMaxPitch(t){this._helper.setMaxPitch(t)}setRenderWorldCopies(t){this._helper.setRenderWorldCopies(t)}setBearing(t){this._helper.setBearing(t)}setPitch(t){this._helper.setPitch(t)}setRoll(t){this._helper.setRoll(t)}setFov(t){this._helper.setFov(t)}setZoom(t){this._helper.setZoom(t)}setCenter(t){this._helper.setCenter(t)}setElevation(t){this._helper.setElevation(t)}setMinElevationForCurrentTile(t){this._helper.setMinElevationForCurrentTile(t)}setPadding(t){this._helper.setPadding(t)}interpolatePadding(t,i,r){this._helper.interpolatePadding(t,i,r)}isPaddingEqual(t){return this._helper.isPaddingEqual(t)}resize(t,i,r=!0){this._helper.resize(t,i,r)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(t){this._helper.setMaxBounds(t)}setConstrainOverride(t){this._helper.setConstrainOverride(t)}overrideNearFarZ(t,i){this._helper.overrideNearFarZ(t,i)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(t){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),t)}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(t){this._globeness=t,this._calcMatrices(),this._verticalPerspectiveTransform.getCoveringTilesDetailsProvider().prepareNextFrame(),this._mercatorTransform.getCoveringTilesDetailsProvider().prepareNextFrame()}get currentTransform(){return this.isGlobeRendering?this._verticalPerspectiveTransform:this._mercatorTransform}constructor(t){this._globeness=1,this.defaultConstrain=(i,r)=>this.currentTransform.defaultConstrain(i,r),this.applyConstrain=(i,r)=>this._helper.applyConstrain(i,r),this._helper=new Ep({calcMatrices:()=>this._calcMatrices(),defaultConstrain:(i,r)=>this.defaultConstrain(i,r)},t),this._globeness=1,this._mercatorTransform=new El(void 0,this._helper),this._verticalPerspectiveTransform=new Zv(void 0,this._helper)}clone(){let t=new Hv;return t._globeness=this._globeness,t.apply(this,!1),t}apply(t,i){this._helper.apply(t,i)}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(t){let i=this._mercatorTransform.getProjectionData(t),r=this._verticalPerspectiveTransform.getProjectionData(t);return{mainMatrix:this.isGlobeRendering?r.mainMatrix:i.mainMatrix,clippingPlane:r.clippingPlane,tileMercatorCoords:r.tileMercatorCoords,projectionTransition:t.applyGlobeMatrix?this._globeness:0,fallbackMatrix:i.fallbackMatrix,clipAntimeridian:r.clipAntimeridian}}isLocationOccluded(t,i,r){return this.currentTransform.isLocationOccluded(t,i,r)}transformLightDirection(t){return this.currentTransform.transformLightDirection(t)}getPixelScale(){return ja(this._mercatorTransform.getPixelScale(),this._verticalPerspectiveTransform.getPixelScale(),this._globeness)}getCircleRadiusCorrection(){return ja(this._mercatorTransform.getCircleRadiusCorrection(),this._verticalPerspectiveTransform.getCircleRadiusCorrection(),this._globeness)}getPitchedTextCorrection(t,i,r){let a=this._mercatorTransform.getPitchedTextCorrection(t,i,r),n=this._verticalPerspectiveTransform.getPitchedTextCorrection(t,i,r);return ja(a,n,this._globeness)}projectTileCoordinates(t,i,r,a){return this.currentTransform.projectTileCoordinates(t,i,r,a)}_calcMatrices(){this._helper._width&&this._helper._height&&(this._verticalPerspectiveTransform._calcMatrices(),this._mercatorTransform._calcMatrices(this.autoCalculateNearFarZ&&!this.isGlobeRendering))}calculateFogMatrix(t){return this.currentTransform.calculateFogMatrix(t)}getVisibleUnwrappedCoordinates(t){return this.currentTransform.getVisibleUnwrappedCoordinates(t)}getCameraFrustum(){return this.currentTransform.getCameraFrustum()}getClippingPlane(){return this.currentTransform.getClippingPlane()}getCoveringTilesDetailsProvider(){return this.currentTransform.getCoveringTilesDetailsProvider()}recalculateZoomAndCenter(t){this.currentTransform.recalculateZoomAndCenter(t)}maxPitchScaleFactor(){return this._mercatorTransform.maxPitchScaleFactor()}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return this.currentTransform.getCameraAltitude()}getCameraLngLat(){return this.currentTransform.getCameraLngLat()}populateCache(t){this._mercatorTransform.populateCache(t),this._verticalPerspectiveTransform.populateCache(t)}getBounds(){return this.currentTransform.getBounds()}calculateCenterFromCameraLngLatAlt(t,i,r,a){return this._helper.calculateCenterFromCameraLngLatAlt(t,i,r,a)}calculateCameraOptionsFromTo(t,i,r,a){return this.currentTransform.calculateCameraOptionsFromTo(t,i,r,a)}setLocationAtPoint(t,i,r){this.currentTransform.setLocationAtPoint(t,i,r)}locationToScreenPoint(t,i){return this.currentTransform.locationToScreenPoint(t,i)}screenPointToMercatorCoordinate(t,i){return this.currentTransform.screenPointToMercatorCoordinate(t,i)}screenTerrainPointToMercatorCoordinate(t,i){return this.currentTransform.screenTerrainPointToMercatorCoordinate(t,i)}screenPointToLocation(t,i){return this.currentTransform.screenPointToLocation(t,i)}screenPointToLocationAtElevation(t,i){return this.currentTransform.screenPointToLocationAtElevation(t,i)}isPointOnMapSurface(t,i){return this.currentTransform.isPointOnMapSurface(t,i)}getRayDirectionFromPixel(t){return this._verticalPerspectiveTransform.getRayDirectionFromPixel(t)}getProjectionDataForCustomLayer(t=!0){let i=this._mercatorTransform.getProjectionDataForCustomLayer(t);if(!this.isGlobeRendering)return i;let r=this._verticalPerspectiveTransform.getProjectionDataForCustomLayer(t);return r.fallbackMatrix=i.mainMatrix,r.projectionTransition=this._globeness,r}getFastPathSimpleProjectionMatrix(t){return this.currentTransform.getFastPathSimpleProjectionMatrix(t)}},Xv=class sr{get useGlobeControls(){return!0}handlePanInertia(t,i){let r=DF(t,i);return Math.abs(r.lng-i.center.lng)>180&&(r.lng=i.center.lng+179.5*Math.sign(r.lng-i.center.lng)),{easingCenter:r,easingOffset:new A(0,0)}}handleMapControlsRollPitchBearingZoom(t,i){let r=t.around,a=i.screenPointToLocation(r);t.bearingDelta&&i.setBearing(i.bearing+t.bearingDelta),t.pitchDelta&&i.setPitch(i.pitch+t.pitchDelta),t.rollDelta&&i.setRoll(i.roll+t.rollDelta);let n=i.zoom;t.zoomDelta&&i.setZoom(i.zoom+t.zoomDelta);let s=i.zoom-n;if(s===0)return;let o=ni(i.center.lng,a.lng),l=o/(Math.abs(o/180)+1),u=ni(i.center.lat,a.lat),h=i.getRayDirectionFromPixel(r),c=i.cameraPosition,d=dt(c,h)*-1,p=Ae();xi(p,c,[h[0]*d,h[1]*d,h[2]*d]);let f=mr(p),m=f-1,g=Math.exp(-Math.max(m-.3,0)*.5),_=Lo(f,.95,.999,0,1),y=on(i.worldSize,i.center.lat)/Math.min(i.width,i.height),x=Lo(y,.9,.5,1,.25),v=Math.min(g,ja(1,x,_)),w=(1-Gt(-s))*v,b=i.center.lat,T=i.zoom,P=new X(i.center.lng+l*w,he(i.center.lat+u*w,-Xi,Xi));i.setLocationAtPoint(a,r);let S=i.center,M=Lo(Math.abs(o),45,85,0,1),k=Math.max(M,_)**.25,R=ni(S.lng,P.lng),D=ni(S.lat,P.lat);i.setCenter(new X(S.lng+R*k,S.lat+D*k).wrap()),i.setZoom(T+Et(b,i.center.lat))}handleMapControlsPan(t,i,r){t.panDelta&&bF(i,r,i.isPointOnMapSurface(t.around)?t.around:i.centerPoint,t.panDelta)}cameraForBoxAndBearing(t,i,r,a,n){let s=Vv(t,i,r,a,n),o=i.left/n.width*2-1,l=(n.width-i.right)/n.width*2-1,u=i.top/n.height*-2+1,h=(n.height-i.bottom)/n.height*-2+1,c=ni(r.getWest(),r.getEast())<0,d=c?r.getEast():r.getWest(),p=c?r.getWest():r.getEast(),f=Math.max(r.getNorth(),r.getSouth()),m=Math.min(r.getNorth(),r.getSouth()),g=d+ni(d,p)*.5,_=f+ni(f,m)*.5,y=n.clone();y.setCenter(s.center),y.setBearing(s.bearing),y.setPitch(0),y.setRoll(0),y.setZoom(s.zoom);let x=y.modelViewProjectionMatrix,v=[vt(r.getNorthWest()),vt(r.getNorthEast()),vt(r.getSouthWest()),vt(r.getSouthEast()),vt(new X(p,_)),vt(new X(d,_)),vt(new X(g,f)),vt(new X(g,m))],w=vt(s.center),b=1/0;for(let T of v)o<0&&(b=sr.getLesserNonNegativeNonNull(b,sr.solveVectorScale(T,w,x,"x",o))),l>0&&(b=sr.getLesserNonNegativeNonNull(b,sr.solveVectorScale(T,w,x,"x",l))),u>0&&(b=sr.getLesserNonNegativeNonNull(b,sr.solveVectorScale(T,w,x,"y",u))),h<0&&(b=sr.getLesserNonNegativeNonNull(b,sr.solveVectorScale(T,w,x,"y",h)));if(!Number.isFinite(b)||b===0){$v();return}return s.zoom=Math.min(y.zoom+zt(b),t.maxZoom),s}handleJumpToCenterZoom(t,i){let r=t.center.lat,a=t.applyConstrain(i.center?X.convert(i.center):t.center,t.zoom).center;t.setCenter(a.wrap());let n=i.zoom===void 0?t.zoom+Et(r,a.lat):+i.zoom;t.zoom!==n&&t.setZoom(n)}handleEaseTo(t,i){let r=t.zoom,a=t.center,n=t.padding,s={roll:t.roll,pitch:t.pitch,bearing:t.bearing},o={roll:i.roll===void 0?t.roll:i.roll,pitch:i.pitch===void 0?t.pitch:i.pitch,bearing:i.bearing===void 0?t.bearing:i.bearing},l=i.zoom!==void 0,u=!t.isPaddingEqual(i.padding),h=!1,c=i.center?X.convert(i.center):a,d=t.applyConstrain(c,r).center;Tl(t,d);let p=t.clone();p.setCenter(d),p.setZoom(l?+i.zoom:r+Et(a.lat,c.lat)),p.setBearing(i.bearing);let f=new A(he(t.centerPoint.x+i.offsetAsPoint.x,0,t.width),he(t.centerPoint.y+i.offsetAsPoint.y,0,t.height));p.setLocationAtPoint(d,f);let m=(i.offset&&i.offsetAsPoint.mag())>0?p.center:d,g=l?+i.zoom:r+Et(a.lat,m.lat),_=r+Et(a.lat,0),y=g+Et(m.lat,0),x=ni(a.lng,m.lng),v=ni(a.lat,m.lat),w=Gt(y-_);return h=g!==r,{easeFunc:b=>{if(A_(s,o)||jv({startEulerAngles:s,endEulerAngles:o,tr:t,k:b,useSlerp:s.roll!=o.roll}),u&&t.interpolatePadding(n,i.padding,b),i.around)xe("Easing around a point is not supported under globe projection."),t.setLocationAtPoint(i.around,i.aroundPoint);else{let T=b*(y>_?Math.min(2,w):Math.max(.5,w))**(1-b),P=Ug(a,x,v,T);t.setCenter(P.wrap())}if(h){let T=Je.number(_,y,b)+Et(0,t.center.lat);t.setZoom(T)}},isZooming:h,elevationCenter:m}}handleFlyTo(t,i){let r=i.zoom!==void 0,a=t.center,n=t.zoom,s=t.padding,o=!t.isPaddingEqual(i.padding),l=t.applyConstrain(X.convert(i.center||i.locationAtOffset),n).center,u=r?+i.zoom:t.zoom+Et(t.center.lat,l.lat),h=t.clone();h.setCenter(l),h.setZoom(u),h.setBearing(i.bearing);let c=new A(he(t.centerPoint.x+i.offsetAsPoint.x,0,t.width),he(t.centerPoint.y+i.offsetAsPoint.y,0,t.height));h.setLocationAtPoint(l,c);let d=h.center;Tl(t,d);let p=gF(t,a,d),f=n+Et(a.lat,0),m=u+Et(d.lat,0),g=Gt(m-f),_=typeof i.minZoom=="number"?+i.minZoom:t.minZoom,y=Math.max(_,t.minZoom)+Et(d.lat,0),x=Math.min(y,f,m)+Et(0,d.lat),v=t.applyConstrain(d,x).zoom+Et(d.lat,0),w=Gt(v-f),b=ni(a.lng,d.lng),T=ni(a.lat,d.lat);return{easeFunc:(P,S,M,k)=>{let R=Ug(a,b,T,M);o&&t.interpolatePadding(s,i.padding,P);let D=P===1?d:R;t.setCenter(D.wrap());let I=f+zt(S);t.setZoom(P===1?u:I+Et(0,D.lat))},scaleOfZoom:g,targetCenter:d,scaleOfMinZoom:w,pixelPathLength:p}}static solveVectorScale(t,i,r,a,n){let s=n,o=a==="x"?[r[0],r[4],r[8],r[12]]:[r[1],r[5],r[9],r[13]],l=[r[3],r[7],r[11],r[15]],u=t[0]*o[0]+t[1]*o[1]+t[2]*o[2],h=t[0]*l[0]+t[1]*l[1]+t[2]*l[2],c=i[0]*o[0]+i[1]*o[1]+i[2]*o[2],d=i[0]*l[0]+i[1]*l[1]+i[2]*l[2],p=(c+o[3]-s*d-s*l[3])/(c-u-s*d+s*h);return c+s*h===u+s*d||l[3]*(u-c)+o[3]*(d-h)+u*d===c*h?null:p}static getLesserNonNegativeNonNull(t,i){return i!==null&&i>=0&&i<t?i:t}},Yg=class{constructor(e){this._globe=e,this._mercatorCameraHelper=new Sl,this._verticalPerspectiveCameraHelper=new Xv}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,i){this.currentHelper.handleMapControlsPan(e,t,i)}cameraForBoxAndBearing(e,t,i,r,a){return this.currentHelper.cameraForBoxAndBearing(e,t,i,r,a)}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 AF(e,t,i){let r={constrainOverride:t};if(Array.isArray(e)){let a=new Vg({type:e},i);return{projection:a,transform:new Xg(r),cameraHelper:new Yg(a)}}switch(e){case"mercator":return{projection:new Kc,transform:new El(r),cameraHelper:new Sl};case"globe":{let a=new Vg({type:["interpolate",["linear"],["zoom"],11,"vertical-perspective",12,"mercator"]},{});return{projection:a,transform:new Xg(r),cameraHelper:new Yg(a)}}case"vertical-perspective":return{projection:new Nv,transform:new Zv(r),cameraHelper:new Xv};default:return xe(`Unknown projection name: ${e}. Falling back to mercator projection.`),{projection:new Kc,transform:new El(r),cameraHelper:new Sl}}}const IF=cM();var ed=class extends _t{constructor(e,t={}){var r,a;super(),this._rtlPluginLoaded=()=>{for(let n in this.tileManagers){let s=this.tileManagers[n].getSource().type;(s==="vector"||s==="geojson")&&this.tileManagers[n].reload()}},this.map=e,this.dispatcher=new ov(fp(),e._getMapId()),this.dispatcher.registerMessageHandler("GG",(n,s)=>this.getGlyphs(n,s)),this.dispatcher.registerMessageHandler("GI",(n,s)=>this.getImages(n,s)),this.dispatcher.registerMessageHandler("GDA",(n,s)=>this.getDashes(n,s)),this.imageManager=new fM,this.imageManager.setEventedParent(this),this.imageManager.setMissingImageResolver(e._missingStyleImageResolver),this.patternAtlas=new mM(this.imageManager);let i=((r=e._container)==null?void 0:r.lang)||typeof document<"u"&&((a=document.documentElement)==null?void 0:a.lang)||void 0;this.glyphManager=new EM(e._requestManager,t.localIdeographFontFamily,i),this.lineAtlas=new MM(256,512),this.crossTileSymbolIndex=new Fv,this._setInitialValues(),this._resetUpdates(),this.dispatcher.broadcast("SR",gd()),bs().on(Zc,this._rtlPluginLoaded),this.on("data",n=>{if(n.dataType!=="source"||n.sourceDataType!=="metadata")return;let s=this.tileManagers[n.sourceId];if(!s)return;
819let o=s.getSource();if(o!=null&&o.vectorLayerIds)for(let l in this._layers){let u=this._layers[l];u.source===o.id&&this._validateLayer(u)}})}_setInitialValues(){var e;this._layers={},this._order=[],this.tileManagers={},this.zoomHistory=new Nh,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(((e=this.crossTileSymbolIndex)==null?void 0:e.constructor)||Object),this.pauseablePlacement=void 0,this.placement=void 0,this.z=0}setGlobalStateProperty(e,t){var r,a;this._checkLoaded();let i=t===null?((a=(r=this.stylesheet.state)==null?void 0:r[e])==null?void 0:a.default)??null:t;if(Ai(i,this._globalState[e]))return this;this._globalState[e]=i,this._applyGlobalStateChanges([e])}getGlobalState(){return this._globalState}setGlobalState(e){this._checkLoaded();let t=[];for(let i in e)Ai(this._globalState[i],e[i].default)||(t.push(i),this._globalState[i]=e[i].default);this._applyGlobalStateChanges(t)}_applyGlobalStateChanges(e){if(e.length===0)return;let t=new Set,i={};for(let r of e){i[r]=this._globalState[r];for(let a in this._layers){let n=this._layers[a],s=n.getLayoutAffectingGlobalStateRefs(),o=n.getPaintAffectingGlobalStateRefs(),l=n.getVisibilityAffectingGlobalStateRefs();if(s.has(r)&&t.add(n.source),o.has(r))for(let{name:u,value:h}of o.get(r))this._updatePaintProperty(n,u,h);l!=null&&l.has(r)&&(n.recalculateVisibility(),this._updateLayer(n))}}this.dispatcher.broadcast("UGS",i);for(let r in this.tileManagers)t.has(r)&&(this._reloadSource(r),this._changed=!0)}async loadURL(e,t={},i){this.fire(new vi("dataloading")),t.validate=typeof t.validate!="boolean"||t.validate,this._loadStyleRequest=new AbortController;let r=this._loadStyleRequest;try{let a=await this.map._requestManager.transformRequest(e,"Style");md(r.signal);let n=await Al(a,r);this._loadStyleRequest===r&&(this._loadStyleRequest=null),this._load(n.data,t,i)}catch(a){this._loadStyleRequest===r&&(this._loadStyleRequest=null),a&&!r.signal.aborted&&this.fire(new Q(kt(a)))}}loadJSON(e,t={},i){this.fire(new vi("dataloading")),this._frameRequest=new AbortController,qt.frameAsync(this._frameRequest,this.map._ownerWindow).then(()=>{this._frameRequest=null,t.validate=t.validate!==!1,this._load(e,t,i)}).catch(()=>{})}loadEmpty(){this.fire(new vi("dataloading")),this._load(IF,{validate:!1})}_load(e,t,i){var a;let r=t.transformStyle?t.transformStyle(i,e):e;if(!(t.validate&&Jf(this,r))){r={...r},this._loaded=!0,this.stylesheet=r;for(let n in r.sources)this.addSource(n,r.sources[n],{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 CM(this.stylesheet.light??{},this._globalState),this._setProjectionInternal(((a=this.stylesheet.projection)==null?void 0:a.type)||"mercator"),this.sky=new IM(this.stylesheet.sky,this._globalState),this.map.setTerrain(this.stylesheet.terrain??null,{validate:!1}),this.fire(new vi("data")),this.fire(new jc)}}_createLayers(){var t;let e=lg(this.stylesheet.layers);this.setGlobalState(this.stylesheet.state??null),this.dispatcher.broadcast("SL",e),this._order=e.map(i=>i.id),this._layers={},this._serializedLayers=null;for(let i of e){let r=Qu(i,this._globalState);if(r.setEventedParent(this,{layer:{id:i.id}}),this._layers[i.id]=r,Gh(r)&&this.tileManagers[r.source]){let a=((t=i.paint)==null?void 0:t["raster-fade-duration"])??r.paint.get("raster-fade-duration");this.tileManagers[r.source].setRasterFadeDuration(a)}}}async _loadSprite(e,t=!1,i=void 0){this.imageManager.setLoaded(!1);let r=new AbortController;this._spriteRequest=r;let a;try{let n=await dM(e,this.map._requestManager,this.map.getPixelRatio(),r);if(!n)return;for(let s in n){let{loaded:o,removed:l}=this.imageManager.setSpriteImages(s,n[s]);this._markImagesChanged(l),t&&this._markImagesChanged(o)}}catch(n){a=n,r.signal.aborted||this.fire(new Q(a))}finally{this._spriteRequest=null,this.imageManager.setLoaded(!0),t&&(this._changed=!0),this.dispatcher.broadcast("SI",this.imageManager.listImages()),this.fire(new vi("data")),i==null||i(a)}}_unloadSprite(){this._markImagesChanged(this.imageManager.removeAllSpriteImages()),this._imagesListDirty=!0,this._changed=!0,this.fire(new vi("data"))}_validateLayer(e){let t=this.tileManagers[e.source];if(!t)return;let i=e.sourceLayer;if(!i)return;let r=t.getSource();(r.type==="geojson"||r.vectorLayerIds&&!r.vectorLayerIds.includes(i))&&this.fire(new Q(Error(`Source layer "${i}" 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 i=this._serializedAllLayers();if(!e||e.length===0)return Object.values(t?Qt(i):i);let r=[];
vendor: 5,508 bytes, line 819
819for(let a of e)if(i[a]){let n=t?Qt(i[a]):i[a];r.push(n)}return r}_serializedAllLayers(){let e=this._serializedLayers;if(e)return e;e=this._serializedLayers={};let t=Object.keys(this._layers);for(let i of t){let r=this._layers[i];r.type!=="custom"&&(e[i]=r.serialize())}return e}hasTransitions(){var e,t,i;if((e=this.light)!=null&&e.hasTransition()||(t=this.sky)!=null&&t.hasTransition()||(i=this.projection)!=null&&i.hasTransition())return!0;for(let r in this.tileManagers)if(this.tileManagers[r].hasTransition())return!0;for(let r in this._layers)if(this._layers[r].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._imagesListDirty=(this.dispatcher.broadcast("SI",this.imageManager.listImages()),!1));let a=Object.keys(this._updatedLayers),n=Object.keys(this._removedLayers);(a.length||n.length)&&this._updateWorkerLayers(a,n);for(let s in this._updatedSources){let o=this._updatedSources[s];if(o==="reload")this._reloadSource(s);else if(o==="clear")this._clearSource(s);else throw Error(`Invalid action ${o}`)}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(let s in this._updatedPaintProps)this._layers[s].updateTransitions(e);this._resetUpdates()}let i={};for(let a in this.tileManagers){let n=this.tileManagers[a];i[a]=n.used,n.used=!1}let r=this.imageManager.listImages();for(let a of this._order){let n=this._layers[a];n.recalculate(e,r),!n.isHidden(e.zoom)&&n.source&&(this.tileManagers[n.source].used=!0)}for(let a in i){let n=this.tileManagers[a];!!i[a]!=!!n.used&&n.fire(new qe("data",{sourceDataType:"visibility",sourceId:a}))}this.light.recalculate(e),this.sky.recalculate(e),this.projection.recalculate(e),this.z=e.zoom,t&&this.fire(new vi("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 i=this.serialize();if(e=t.transformStyle?t.transformStyle(i,e):e,(t.validate??!0)&&Jf(this,e))return!1;e=Qt(e),e.layers=lg(e.layers);let r=hM(i,e),a=this._getOperationsToPerform(r);if(a.unimplemented.length>0)throw Error(`Unimplemented: ${a.unimplemented.join(", ")}.`);if(a.operations.length===0)return!1;for(let n of a.operations)n();return this.stylesheet=e,this._serializedLayers=null,this.fire(new jc({style:this})),!0}_getOperationsToPerform(e){let t=[],i=[];for(let r of e)switch(r.command){case"setCenter":case"setZoom":case"setBearing":case"setPitch":case"setRoll":continue;case"addLayer":{let[a,n]=r.args;t.push(()=>this.addLayer(a,n));break}case"removeLayer":{let[a]=r.args;t.push(()=>this.removeLayer(a));break}case"setPaintProperty":{let[a,n,s]=r.args;t.push(()=>this.setPaintProperty(a,n,s));break}case"setLayoutProperty":{let[a,n,s]=r.args;t.push(()=>this.setLayoutProperty(a,n,s));break}case"setFilter":{let[a,n]=r.args;t.push(()=>this.setFilter(a,n));break}case"addSource":{let[a,n]=r.args;t.push(()=>this.addSource(a,n));break}case"removeSource":{let[a]=r.args;t.push(()=>this.removeSource(a));break}case"setLayerZoomRange":{let[a,n,s]=r.args;t.push(()=>this.setLayerZoomRange(a,n,s));break}case"setLight":{let[a]=r.args;t.push(()=>this.setLight(a));break}case"setGeoJSONSourceData":{let[a,n]=r.args;t.push(()=>this.setGeoJSONSourceData(a,n));break}case"setGlyphs":{let[a]=r.args;t.push(()=>this.setGlyphs(a));break}case"setFontFaces":{let[a]=r.args;t.push(()=>this.setFontFaces(a));break}case"setSprite":{let[a]=r.args;t.push(()=>this.setSprite(a));break}case"setTerrain":{let[a]=r.args;t.push(()=>this.map.setTerrain(a));break}case"setSky":{let[a]=r.args;t.push(()=>this.setSky(a));break}case"setProjection":{let[a]=r.args;t.push(()=>this.setProjection(a));break}case"setGlobalState":{let[a]=r.args;t.push(()=>this.setGlobalState(a));break}case"setTransition":t.push(()=>{});break;default:i.push(r.command)}return{operations:t,unimplemented:i}}addImage(e,t){if(this.getImage(e)){this.fire(new Q(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 Q(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 vi("data"))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(e,t,i={}){var a;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: ${Ob
819ject.keys(t).join(", ")}.`);if(e0.has(t.type)&&this._validate(Jt.source,`sources.${e}`,t,null,i))return;(a=this.map)!=null&&a._collectResourceTiming&&(t.collectResourceTiming=!0);let r=this.tileManagers[e]=new Wc(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 i in this._layers)if(this._layers[i].source===e)return this.fire(new Q(Error(`Source "${e}" cannot be removed while layer "${i}" is using it.`)));let t=this.tileManagers[e];delete this.tileManagers[e],delete this._updatedSources[e],t.fire(new qe("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 i=this.tileManagers[e].getSource();if(i.type!=="geojson")throw Error(`geojsonSource.type is ${i.type}, which is !== 'geojson`);i.setData(t),this._changed=!0}getSource(e){var t;return(t=this.tileManagers[e])==null?void 0:t.getSource()}addLayer(e,t,i={}){this._checkLoaded();let r=e.id;if(this.getLayer(r)){this.fire(new Q(Error(`Layer "${r}" already exists on this map.`)));return}let a;if(e.type==="custom"){if(kd(this,rP(e)))return;a=Qu(e,this._globalState)}else{if("source"in e&&typeof e.source=="object"&&(this.addSource(r,e.source),e=Qt(e),e=W(e,{source:r})),this._validate(Jt.layer,`layers.${r}`,e,{arrayIndex:-1},i))return;a=Qu(e,this._globalState),this._validateLayer(a),a.setEventedParent(this,{layer:{id:r}})}let n=t?this._order.indexOf(t):this._order.length;if(t&&n===-1){this.fire(new Q(Error(`Cannot add layer "${r}" before non-existing layer "${t}".`)));return}if(this._order.splice(n,0,r),this._layerOrderChanged=!0,this._layers[r]=a,this._removedLayers[r]&&a.source&&a.type!=="custom"){let s=this._removedLayers[r];delete this._removedLayers[r],s.type===a.type?(this._updatedSources[a.source]="reload",this.tileManagers[a.source].pause()):this._updatedSources[a.source]="clear"}this._updateLayer(a),a.onAdd&&a.onAdd(this.map)}moveLayer(e,t){if(this._checkLoaded(),this._changed=!0,!this._layers[e]){this.fire(new Q(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 Q(Error(`Cannot move layer "${e}" before non-existing layer "${t}".`)));return}let i=this._order.indexOf(e);this._order.splice(i,1);let r=t?this._order.indexOf(t):this._order.length;this._order.splice(r,0,e),this._layerOrderChanged=!0}removeLayer(e){var r;this._checkLoaded();let t=this._layers[e];if(!t){this.fire(new Q(Error(`Cannot remove non-existing layer "${e}".`)));return}t.setEventedParent(null);let i=this._order.indexOf(e);this._order.splice(i,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&&((r=this.tileManagers[t.source])==null||r.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,i){this._checkLoaded();let r=this.getLayer(e);if(!r){this.fire(new Q(Error(`Cannot set the zoom range of non-existing layer "${e}".`)));return}(r.minzoom!==t||r.maxzoom!==i)&&(t!=null&&(r.minzoom=t),i!=null&&(r.maxzoom=i),this._updateLayer(r))}setFilter(e,t,i={}){this._checkLoaded();let r=this.getLayer(e);if(!r){this.fire(new Q(Error(`Cannot filter non-existing layer "${e}".`)));return}if(!Ai(r.filter,t)){if(t==null){r.setFilter(void 0),this._updateLayer(r);return}
vendor: 4,282 bytes, line 819
819this._validate(Jt.filter,`layers.${r.id}.filter`,t,null,i)||(r.setFilter(Qt(t)),this._updateLayer(r))}}getFilter(e){return Qt(this.getLayer(e).filter)}setLayoutProperty(e,t,i,r={}){this._checkLoaded();let a=this.getLayer(e);if(!a){this.fire(new Q(Error(`Cannot style non-existing layer "${e}".`)));return}Ai(a.getLayoutProperty(t),i)||(a.setLayoutProperty(t,i,r),this._updateLayer(a))}getLayoutProperty(e,t){let i=this.getLayer(e);if(!i){this.fire(new Q(Error(`Cannot get style of non-existing layer "${e}".`)));return}return i.getLayoutProperty(t)}setPaintProperty(e,t,i,r={}){this._checkLoaded();let a=this.getLayer(e);if(!a){this.fire(new Q(Error(`Cannot style non-existing layer "${e}".`)));return}Ai(a.getPaintProperty(t),i)||this._updatePaintProperty(a,t,i,r)}_updatePaintProperty(e,t,i,r={}){e.setPaintProperty(t,i,r)&&this._updateLayer(e),Gh(e)&&t==="raster-fade-duration"&&this.tileManagers[e.source].setRasterFadeDuration(i),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 i=e.source,r=e.sourceLayer,a=this.tileManagers[i];if(a===void 0){this.fire(new Q(Error(`The source '${i}' does not exist in the map's style.`)));return}let n=a.getSource().type;if(n==="geojson"&&r){this.fire(new Q(Error("GeoJSON sources cannot have a sourceLayer parameter.")));return}if(n==="vector"&&!r){this.fire(new Q(Error("The sourceLayer parameter must be provided for vector source types.")));return}if(e.id===void 0){this.fire(new Q(Error("The feature id parameter must be provided.")));return}let s=["__proto__","constructor","prototype"];if(t&&Object.keys(t).some(o=>s.includes(o))){this.fire(new Q(Error(`The feature state should not include one of the following keys: ${s}`)));return}a.setFeatureState(r,e.id,t)}removeFeatureState(e,t){this._checkLoaded();let i=e.source,r=this.tileManagers[i];if(r===void 0){this.fire(new Q(Error(`The source '${i}' does not exist in the map's style.`)));return}let a=r.getSource().type,n=a==="vector"?e.sourceLayer:void 0;if(a==="vector"&&!n){this.fire(new Q(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 Q(Error("A feature id is required to remove its specific state property.")));return}r.removeFeatureState(n,e.id,t)}getFeatureState(e){this._checkLoaded();let t=e.source,i=e.sourceLayer,r=this.tileManagers[t];if(r===void 0){this.fire(new Q(Error(`The source '${t}' does not exist in the map's style.`)));return}if(r.getSource().type==="vector"&&!i){this.fire(new Q(Error("The sourceLayer parameter must be provided for vector source types.")));return}return e.id===void 0&&this.fire(new Q(Error("The feature id parameter must be provided."))),r.getFeatureState(i,e.id)}getTransition(){var e;return W({duration:300,delay:0},(e=this.stylesheet)==null?void 0:e.transition)}serialize(){if(!this._loaded)return;let e=fd(this.tileManagers,a=>a.serialize()),t=this._serializeByIds(this._order,!0),i=this.map.getTerrain()||void 0,r=this.stylesheet;return P_({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:i},a=>a!==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=n=>this._layers[n].type==="fill-extrusion",i={},r=[];for(let n=this._order.length-1;n>=0;n--){let s=this._order[n];if(t(s)){i[s]=n;for(let o of e){let l=o[s];if(l)for(let u of l)r.push(u)}}}r.sort((n,s)=>s.intersectionZ-n.intersectionZ);let a=[];for(let n=this._order.length-1;n>=0;n--){let s=this._order[n];if(t(s))for(let o=r.length-1;o>=0;o--){let l=r[o].feature;if(i[l.layer.id]<n)break;a.push(l),r.pop()}else for(let o of e){let l=o[s];if(l)for(let u of l)a.push(u.feature)}}return a}
819queryRenderedFeatures(e,t,i){t!=null&&t.filter&&this._validate(Jt.filter,"queryRenderedFeatures.filter",t.filter,null,t);let r={};if(t!=null&&t.layers){if(!(Array.isArray(t.layers)||t.layers instanceof Set))return this.fire(new Q(Error("parameters.layers must be an Array or a Set of strings"))),[];for(let l of t.layers){let u=this._layers[l];if(!u)return this.fire(new Q(Error(`The layer '${l}' does not exist in the map's style and cannot be queried for features.`))),[];r[u.source]=!0}}let a=[];t.availableImages=this.imageManager.listImages();let n=this._serializedAllLayers(),s=t.layers instanceof Set?t.layers:Array.isArray(t.layers)?new Set(t.layers):null,o={...t,layers:s,globalState:this._globalState};for(let l in this.tileManagers)(!t.layers||r[l])&&a.push(NM(this.tileManagers[l],this._layers,n,e,o,i,this.map.terrain?(u,h,c)=>this.map.terrain.getElevation(u,h,c):void 0));return this.placement&&a.push(UM(this._layers,n,this.tileManagers,e,o,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(a)}querySourceFeatures(e,t){t!=null&&t.filter&&this._validate(Jt.filter,"querySourceFeatures.filter",t.filter,null,t);let i=this.tileManagers[e];return i?GM(i,t?{...t,globalState:this._globalState}:{globalState:this._globalState}):[]}getLight(){return this.light.getLight()}setLight(e,t={}){this._checkLoaded();let i=this.light.getLight(),r=!1;for(let n in e)if(!Ai(e[n],i[n])){r=!0;break}if(!r)return;let a={now:Oe(),transition:W({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(e,t),this.light.updateTransitions(a)}getProjection(){var e;return(e=this.stylesheet)==null?void 0:e.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(){var e;return(e=this.stylesheet)==null?void 0:e.sky}setSky(e,t={}){this._checkLoaded();let i=this.getSky(),r=!1;if(!e&&!i)return;if(e&&!i)r=!0;else if(!e&&i)r=!0;else for(let n in e)if(!Ai(e[n],i[n])){r=!0;break}if(!r)return;let a={now:Oe(),transition:W({duration:300,delay:0},this.stylesheet.transition)};this.stylesheet.sky=e,this.sky.setSky(e,t),this.sky.updateTransitions(a)}_setProjectionInternal(e){var i;let t=AF(e,(i=this.map._camera)==null?void 0:i.transform.constrainOverride,this._globalState);this.projection=t.projection,this.map.migrateProjection(t.transform,t.cameraHelper);for(let r in this.tileManagers)this.tileManagers[r].reload()}_validate(e,t,i,r,a={}){return a.validate!==!1&&Is(this,e,{key:t,style:this.serialize(),value:i,...r},a)}_remove(e=!0){this._frameRequest&&(this._frameRequest=(this._frameRequest.abort(),null)),this._loadStyleRequest&&(this._loadStyleRequest=(this._loadStyleRequest.abort(),null)),this._spriteRequest&&(this._spriteRequest=(this._spriteRequest.abort(),null)),bs().off(Zc,this._rtlPluginLoaded);for(let t in this._layers)this._layers[t].setEventedParent(null);for(let t in this.tileManagers){let i=this.tileManagers[t];i.setEventedParent(null),i.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,i){var a;let r=this.pauseablePlacement;return!r||this._symbolPlacementTriggered||this._placedProjectionTransition!==((a=this.projection)==null?void 0:a.transitionState)||r._showCollisionBoxes!==t||r.placement.collisionGroups.crossSourceCollisions!==i||r.placement.transform.renderWorldCopies!==e.renderWorldCopies||!Mb(r.placement.transform.modelViewProjectionMatrix,e.modelViewProjectionMatrix)}_updatePlacement(e,t,i,r,a=!1){var h,c;let n=!1,s=!1,o={};for(let d of this._order){let p=this._layers[d];if(p.type!=="symbol")continue;if(!o[p.source]){let m=this.tileManagers[p.source];o[p.source]=m.getRenderableIds(!0).map(g=>m.getTileByID(g)).sort((g,_)=>_.tileID.overscaledZ-g.tileID.overscaledZ||(g.tileID.isLessThan(_.tileID)?-1:1))}let f=this.crossTileSymbolIndex.addLayer(p,o[p.source],e.center.lng);n||(n=f)}this.crossTileSymbolIndex.pruneUnusedLayers(this._order),a||(a=this._layerOrderChanged||i===0);let l=n||this._placementInputsChanged(e,t,r),u=((h=this.pauseablePlacement)==null?void 0:h.isDone())&&!this.placement.stillRecent(Oe(),e.zoom);if((a||!this.pauseablePlacement||u&&(l||this.placement.stale))&&(this._symbolPlacementTriggered=!1,this._placedProjectionTransition=(c=this.projection)==null?void 0:c.transitionState,this.pauseablePlacement=new K3(e,this.map.terrain,this._order,a,t,i,r,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?l&&this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,o),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(Oe()),s=!0),n&&this.pauseablePlacement.placement.setStale()),s||n)for(let d of this._order){let p=this._layers[d];p.type==="symbol"&&this.placement.updateLayerOpacities(p,o[p.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(Oe())}_releaseSymbolFadeTiles(){for(let e in this.tileManagers)this.tileManagers[e].releaseSymbolFadeTiles()}async getImages(e,t){let i=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),i}async getGlyphs(e,t){let i=await this.glyphManager.getGlyphs(t.stacks),r=this.tileManagers[t.source];return r&&r.setDependencies(t.tileID.key,t.type,[""]),i}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(e,t={}
vendor: 41,306 bytes, lines 819-821
819){this._checkLoaded(),!(e&&this._validate(Jt.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 i={};for(let[r,a]of Object.entries(t.dashes))i[r]=this.lineAtlas.getDash(a.dasharray,a.round);return i}addSprite(e,t,i={},r){this._checkLoaded();let a=[{id:e,url:t}],n=[...Zo(this.stylesheet.sprite),...a];this._validate(Jt.sprite,"sprite",n,null,i)||(this.stylesheet.sprite=n,this._loadSprite(a,!0,r))}removeSprite(e){this._checkLoaded();let t=Zo(this.stylesheet.sprite);if(!t.find(r=>r.id===e)){this.fire(new Q(Error(`Sprite "${e}" doesn't exists on this map.`)));return}let i=this.imageManager.removeSpriteImages(e);this._markImagesChanged(i),t.splice(t.findIndex(r=>r.id===e),1),this.stylesheet.sprite=t.length>0?t:void 0,this._imagesListDirty=!0,this._changed=!0,this.fire(new vi("data"))}getSprite(){return Zo(this.stylesheet.sprite)}setSprite(e,t={},i){this._checkLoaded(),!(e&&this._validate(Jt.sprite,"sprite",e,null,t))&&(this.stylesheet.sprite=e,e?this._loadSprite(e,!0,i):(this._unloadSprite(),i&&i(null)))}destroy(){this._frameRequest&&(this._frameRequest=(this._frameRequest.abort(),null)),this._loadStyleRequest&&(this._loadStyleRequest=(this._loadStyleRequest.abort(),null)),this._spriteRequest&&(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 MF=tt([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);var FF=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,i,r,a,n,s,o,l){this.context=e;let u=this.boundPaintVertexBuffers.length!==r.length;for(let h=0;!u&&h<r.length;h++)this.boundPaintVertexBuffers[h]!==r[h]&&(u=!0);!this.vao||this.boundProgram!==t||this.boundLayoutVertexBuffer!==i||u||this.boundIndexBuffer!==a||this.boundVertexOffset!==n||this.boundDynamicVertexBuffer!==s||this.boundDynamicVertexBuffer2!==o||this.boundDynamicVertexBuffer3!==l?this.freshBind(t,i,r,a,n,s,o,l):e.bindVertexArray.set(this.vao)}freshBind(e,t,i,r,a,n,s,o){let l=e.numAttributes,u=this.context,h=u.gl;this.vao&&this.destroy(),this.vao=u.createVertexArray(),u.bindVertexArray.set(this.vao),this.boundProgram=e,this.boundLayoutVertexBuffer=t,this.boundPaintVertexBuffers=i,this.boundIndexBuffer=r,this.boundVertexOffset=a,this.boundDynamicVertexBuffer=n,this.boundDynamicVertexBuffer2=s,this.boundDynamicVertexBuffer3=o,t.enableAttributes(h,e);for(let c of i)c.enableAttributes(h,e);n&&n.enableAttributes(h,e),s&&s.enableAttributes(h,e),o&&o.enableAttributes(h,e),t.bind(),t.setVertexAttribPointers(h,e,a);for(let c of i)c.bind(),c.setVertexAttribPointers(h,e,a);n&&(n.bind(),n.setVertexAttribPointers(h,e,a)),r&&r.bind(),s&&(s.bind(),s.setVertexAttribPointers(h,e,a)),o&&(o.bind(),o.setVertexAttribPointers(h,e,a)),u.currentNumAttributes=l}destroy(){this.vao&&(this.vao=(this.context.deleteVertexArray(this.vao),null))}};const zF=(e,t)=>({u_depth:new K(e,t.u_depth),u_terrain:new K(e,t.u_terrain)}),RF=(e,t)=>({u_texture:new K(e,t.u_texture),u_ele_delta:new U(e,t.u_ele_delta),u_fog_matrix:new zi(e,t.u_fog_matrix),u_fog_color:new Rr(e,t.u_fog_color),u_fog_ground_blend:new U(e,t.u_fog_ground_blend),u_fog_ground_blend_opacity:new U(e,t.u_fog_ground_blend_opacity),u_horizon_color:new Rr(e,t.u_horizon_color),u_horizon_fog_blend:new U(e,t.u_horizon_fog_blend),u_is_globe_mode:new U(e,t.u_is_globe_mode)}),kF=(e,t)=>({u_ele_delta:new U(e,t.u_ele_delta)}),LF=(e,t,i,r,a)=>({u_texture:0,u_ele_delta:e,u_fog_matrix:t,u_fog_color:i?i.properties.get("fog-color"):de.white,u_fog_ground_blend:i?i.properties.get("fog-ground-blend"):1,u_fog_ground_blend_opacity:a?0:i?i.calculateFogBlendOpacity(r):0,u_horizon_color:i?i.properties.get("horizon-color"):de.white,u_horizon_fog_blend:i?i.properties.get("horizon-fog-blend"):1,u_is_globe_mode:+!!a}),BF=e=>({u_ele_delta:e}),nu={ProjectionUBO:0,TerrainUBO:1,FrameUBO:2};function OF(e,t){for(let[i,r]of Object.entries(nu)){let a=e.getUniformBlockIndex(t,i);a!==e.INVALID_INDEX&&e.uniformBlockBinding(t,a,r)}}const $F={float:[1,1],int:[1,1],vec2:[2,2],vec4:[4,4],mat4:[16,4]};function Dp(e){let t={},i=0;for(let{name:r,type:a}of e){let[n,s]=$F[a];i=Math.ceil(i/s)*s,t[r]=i,i+=n}return{offsets:t,contentWords:i,sizeWords:Math.ceil(i/4)*4}}var Cp=class{constructor(e,t,i){this.context=e,this.binding=t,this.contentWords=i.contentWords;let r=e.gl;this.buffer=r.createBuffer(),r.bindBuffer(r.UNIFORM_BUFFER,this.buffer),r.bufferData(r.UNIFORM_BUFFER,i.sizeWords*4,r.DYNAMIC_DRAW),r.bindBufferBase(r.UNIFORM_BUFFER,t,this.buffer),this.uploaded=new Float32Array(i.sizeWords),this.pending=new Float32Array(i.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 i=this.pendingWords,r=this.uploadedWords;for(let a=0;a<this.contentWords;a++)if(i[a]!==r[a]){t=!0;break}}this.bind(),t&&(e.bindBufferBase(e.UNIFORM_BUFFER,this.binding,this.buffer),e.bufferSubData(e.UNIFORM_BUFFER,0,this.pending),this.uploaded.set(this.pending),this.hasData=!0)}bind(){if(!this.bindingDirty)return;let e=this.context.gl;e.bindBufferBase(e.UNIFORM_BUFFER,this.binding,this.buffer),this.bindingDirty=!1}destroy(){let e=this.context.gl;this.buffer&&(e.deleteBuffer(this.buffer),delete this.buffer)}};const Yv=Dp([{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"}]),Aa=Yv.offsets;function jF(e){return new Cp(e,nu.ProjectionUBO,Yv)}function VF(e,t){let i=e.pending;i.set(t.mainMatrix,Aa.u_projection_matrix),i.set(t.fallbackMatrix,Aa.u_projection_fallback_matrix),i.set(t.tileMercatorCoords,Aa.u_projection_tile_mercator_coords),i.set(t.clippingPlane,Aa.u_projection_clipping_plane),i[Aa.u_projection_transition]=t.projectionTransition,e.pendingWords[Aa.u_projection_clip_antimeridian]=+!!t.clipAntimeridian,e.upload()}const Kv=Dp([{name:"u_terrain_matrix",type:"mat4"},{name:"u_terrain_unpack",type:"vec4"},{name:"u_terrain_dim",type:"float"},{name:"u_terrain_exaggeration",type:"float"}]),Po=Kv.offsets;function NF(e){return new Cp(e,nu.TerrainUBO,Kv)}function UF(e,t){let i=e.pending;i.set(t.u_terrain_matrix,Po.u_terrain_matrix),i.set(t.u_terrain_unpack,Po.u_terrain_unpack),i[Po.u_terrain_dim]=t.u_terrain_dim,i[Po.u_terrain_exaggeration]=t.u_terrain_exaggeration,e.upload()}function ch(e){let t=[];for(let i of e){if(i===null)continue;let r=i.split(" ");t.push(r.pop())}return t}function GF(e,t){let i=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,a=e.getProgramParameter(t,e.ACTIVE_ATTRIBUTES);for(let n=0;n<a;n++){let s=e.getActiveAttrib(t,n);s&&i.has(s.type)&&r.add(s.name)}return r}var ZF=class{constructor(e,t,i,r,a,n,s,o,l=[]){let u=e.gl;this.program=u.createProgram();let h=ch(t.staticAttributes),c=i?i.getBinderAttributes():[],d=h.concat(c),p=qi.prelude.staticUniforms?ch(qi.prelude.staticUniforms):[],f=t.staticUniforms?ch(t.staticUniforms):[],m=i?i.getBinderUniforms():[],g=p.concat(f).concat(m),_=[];for(let S of g)_.includes(S)||_.push(S);let y=i?i.defines():[];y.unshift("#version 300 es"),a&&y.push("#define OVERDRAW_INSPECTOR;"),n&&y.push("#define TERRAIN3D;"),o&&y.push(o),l&&y.push(...l);let x=y.concat(qi.prelude.fragmentSource,s.fragmentSource,t.fragmentSource).join(`
820`),v=y.concat(qi.prelude.vertexSource,s.vertexSource,t.vertexSource).join(`
821`),w=u.createShader(u.FRAGMENT_SHADER);if(u.isContextLost()){this.failedToCreate=!0;return}u.shaderSource(w,x),u.compileShader(w),u.attachShader(this.program,w);let b=u.createShader(u.VERTEX_SHADER);if(u.isContextLost()){this.failedToCreate=!0;return}u.shaderSource(b,v),u.compileShader(b),u.attachShader(this.program,b),this.attributes={};let T={};if(this.numAttributes=d.length,u.linkProgram(this.program),!u.getProgramParameter(this.program,u.LINK_STATUS)){if(u.isContextLost()){this.failedToCreate=!0;return}throw u.getShaderParameter(w,u.COMPILE_STATUS)?u.getShaderParameter(b,u.COMPILE_STATUS)?Error(`Program failed to link: ${u.getProgramInfoLog(this.program)}`):Error(`Could not compile vertex shader: ${u.getShaderInfoLog(b)}`):Error(`Could not compile fragment shader: ${u.getShaderInfoLog(w)}`)}OF(u,this.program);let P=GF(u,this.program);for(let S of d){if(!S)continue;let M=u.getAttribLocation(this.program,S);M>=0&&(this.attributes[S]={location:M,isInteger:P.has(S)})}u.deleteShader(b),u.deleteShader(w);for(let S of _)if(S&&!T[S]){let M=u.getUniformLocation(this.program,S);M&&(T[S]=M)}this.fixedUniforms=r(e,T),this.terrainUniforms=zF(e,T),this.binderUniforms=i?i.getUniforms(e,T):[]}draw(e,t,i,r,a,n,s,o,l,u,h,c,d,p,f,m,g,_,y){var w;let x=e.gl;if(this.failedToCreate)return;if(e.program.set(this.program),e.projectionUniformBuffer.bind(),e.terrainUniformBuffer.bind(),e.frameUniformBuffer.bind(),e.setDepthMode(i),e.setStencilMode(r),e.setColorMode(a),e.setCullFace(n),o){e.activeTexture.set(x.TEXTURE2),x.bindTexture(x.TEXTURE_2D,o.depthTexture),e.activeTexture.set(x.TEXTURE3),x.bindTexture(x.TEXTURE_2D,o.texture);for(let b in this.terrainUniforms)this.terrainUniforms[b].set(o[b]);UF(e.terrainUniformBuffer,o)}if(l&&VF(e.projectionUniformBuffer,l),s)for(let b in this.fixedUniforms)this.fixedUniforms[b].set(s[b]);m&&m.setUniforms(e,this.binderUniforms,p,{zoom:f});let v=0;switch(t){case x.LINES:v=2;break;case x.TRIANGLES:v=3;break;case x.LINE_STRIP:v=1}for(let b of d.get())b.vaos||(b.vaos={}),(w=b.vaos)[u]||(w[u]=new FF),b.vaos[u].bind(e,this,h,m?m.getPaintVertexBuffers():[],c,b.vertexOffset,g,_,y),x.drawElements(t,b.primitiveLength*v,x.UNSIGNED_SHORT,b.primitiveOffset*v*2)}};function Jv(e,t,i){let r=1/hi(i,1,t.transform.tileZoom),a=2**i.tileID.overscaledZ,n=i.tileSize*2**t.transform.tileZoom/a,s=n*(i.tileID.canonical.x+i.tileID.wrap*a),o=n*i.tileID.canonical.y;return{u_image:0,u_texsize:i.imageAtlasTexture.size,u_scale:[r,e.fromScale,e.toScale],u_fade:e.t,u_pixel_coord_upper:[s>>16,o>>16],u_pixel_coord_lower:[s&65535,o&65535]}}function qF(e,t,i,r){let a=i.patternAtlas.getPattern(e.from.toString()),n=i.patternAtlas.getPattern(e.to.toString()),{width:s,height:o}=i.patternAtlas.getPixelSize(),l=2**r.tileID.overscaledZ,u=r.tileSize*2**i.transform.tileZoom/l,h=u*(r.tileID.canonical.x+r.tileID.wrap*l),c=u*r.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:a.tl,u_pattern_br_a:a.br,u_pattern_tl_b:n.tl,u_pattern_br_b:n.br,u_texsize:[s,o],u_mix:t.t,u_pattern_size_a:a.displaySize,u_pattern_size_b:n.displaySize,u_scale_a:t.fromScale,u_scale_b:t.toScale,u_tile_units_to_pixels:1/hi(r,1,i.transform.tileZoom),u_pixel_coord_upper:[h>>16,c>>16],u_pixel_coord_lower:[h&65535,c&65535]}}const WF=(e,t)=>({u_lightpos:new Zt(e,t.u_lightpos),u_lightpos_globe:new Zt(e,t.u_lightpos_globe),u_lightintensity:new U(e,t.u_lightintensity),u_lightcolor:new Zt(e,t.u_lightcolor),u_vertical_gradient:new U(e,t.u_vertical_gradient),u_opacity:new U(e,t.u_opacity),u_fill_translate:new _e(e,t.u_fill_translate)}),HF=(e,t)=>({u_lightpos:new Zt(e,t.u_lightpos),u_lightpos_globe:new Zt(e,t.u_lightpos_globe),u_lightintensity:new U(e,t.u_lightintensity),u_lightcolor:new Zt(e,t.u_lightcolor),u_vertical_gradient:new U(e,t.u_vertical_gradient),u_height_factor:new U(e,t.u_height_factor),u_opacity:new U(e,t.u_opacity),u_fill_translate:new _e(e,t.u_fill_translate),u_image:new K(e,t.u_image),u_texsize:new _e(e,t.u_texsize),u_pixel_coord_upper:new _e(e,t.u_pixel_coord_upper),u_pixel_coord_lower:new _e(e,t.u_pixel_coord_lower),u_scale:new Zt(e,t.u_scale),u_fade:new U(e,t.u_fade)}),Qv=(e,t,i,r)=>{let a=e.style.light,n=a.getCartesianPosition(),s=T_();a.properties.get("anchor")==="viewport"&&Sb(s,e.transform.bearingInRadians),Lb(n,n,s);let o=e.transform.transformLightDirection(n),l=a.properties.get("color");return{u_lightpos:n,u_lightpos_globe:o,u_lightintensity:a.properties.get("intensity"),u_lightcolor:[l.r,l.g,l.b],u_vertical_gradient:+t,u_opacity:i,u_fill_translate:r}},XF=(e,t,i,r,a,n,s)=>W(Qv(e,t,i,r),Jv(n,e,s),{u_height_factor:-(2**a.overscaledZ)/s.tileSize/8}),YF=(e,t)=>({u_fill_translate:new _e(e,t.u_fill_translate)}),KF=(e,t)=>({u_image:new K(e,t.u_image),u_texsize:new _e(e,t.u_texsize),u_pixel_coord_upper:new _e(e,t.u_pixel_coord_upper),u_pixel_coord_lower:new _e(e,t.u_pixel_coord_lower),u_scale:new Zt(e,t.u_scale),u_fade:new U(e,t.u_fade),u_sdf_pattern:new K(e,t.u_sdf_pattern),u_fill_translate:new _e(e,t.u_fill_translate)}),JF=(e,t)=>({u_fill_translate:new _e(e,t.u_fill_translate)}),QF=(e,t)=>({u_image:new K(e,t.u_image),u_texsize:new _e(e,t.u_texsize),u_pixel_coord_upper:new _e(e,t.u_pixel_coord_upper),u_pixel_coord_lower:new _e(e,t.u_pixel_coord_lower),u_scale:new Zt(e,t.u_scale),u_fade:new U(e,t.u_fade),u_sdf_pattern:new K(e,t.u_sdf_pattern),u_fill_translate:new _e(e,t.u_fill_translate)}),ex=(e,t,i,r,a)=>W(Jv(t,e,i),{u_fill_translate:r,u_sdf_pattern:+!!a}),e5=e=>({u_fill_translate:e}),t5=e=>({u_fill_translate:e}),i5=(e,t,i,r,a)=>ex(e,t,i,r,a),r5=(e,t)=>({u_scale_with_map:new K(e,t.u_scale_with_map),u_pitch_with_map:new K(e,t.u_pitch_with_map),u_extrude_scale:new _e(e,t.u_extrude_scale),u_globe_extrude_scale:new U(e,t.u_globe_extrude_scale),u_translate:new _e(e,t.u_translate)}),a5=(e,t,i,r,a)=>{let n=e.transform,s,o,l=0;if(i.paint.get("circle-pitch-alignment")==="map"){let u=hi(t,1,n.zoom);s=!0,o=[u,u],l=u/(L*2**t.tileID.overscaledZ)*2*Math.PI*a}else s=!1,o=n.pixelsToGLUnits;return{u_scale_with_map:+(i.paint.get("circle-pitch-scale")==="map"),u_pitch_with_map:+s,u_extrude_scale:o,u_globe_extrude_scale:l,u_translate:r}},n5=(e,t)=>({u_color:new Rr(e,t.u_color),u_overlay:new K(e,t.u_overlay),u_overlay_scale:new U(e,t.u_overlay_scale)}),Kg=(e,t=1)=>({u_color:e,u_overlay:0,u_overlay_scale:t}),s5=(e,t)=>({u_extrude_scale:new U(e,t.u_extrude_scale),u_intensity:new U(e,t.u_intensity),u_globe_extrude_scale:new U(e,t.u_globe_extrude_scale)}),o5=(e,t)=>({u_matrix:new zi(e,t.u_matrix),u_image:new K(e,t.u_image),u_color_ramp:new K(e,t.u_color_ramp),u_opacity:new U(e,t.u_opacity)}),tx=(e,t,i,r)=>{let a=hi(e,1,t)/(L*2**e.tileID.overscaledZ)*2*Math.PI*r;return{u_extrude_scale:hi(e,1,t),u_intensity:i,u_globe_extrude_scale:a}},ix=(e,t,i,r)=>{let a=kr();return Ni(a,0,e.width,e.height,0,0,1),{u_matrix:a,u_image:i,u_color_ramp:r,u_opacity:t.paint.get("heatmap-opacity")}},l5=(e,t)=>({u_image:new K(e,t.u_image),u_latrange:new _e(e,t.u_latrange),u_exaggeration:new U(e,t.u_exaggeration),u_altitudes:new um(e,t.u_altitudes),u_azimuths:new um(e,t.u_azimuths),u_accent:new Rr(e,t.u_accent),u_method:new K(e,t.u_method),u_shadows:new lm(e,t.u_shadows),u_highlights:new lm(e,t.u_highlights)}),u5=(e,t)=>({u_matrix:new zi(e,t.u_matrix),u_image:new K(e,t.u_image),u_dimension:new _e(e,t.u_dimension),u_zoom:new U(e,t.u_zoom),u_unpack:new fs(e,t.u_unpack)}),h5=(e,t,i)=>{let r=i.paint.get("hillshade-accent-color"),a;switch(i.paint.get("hillshade-method")){case"basic":a=4;break;case"combined":a=1;break;case"igor":a=2;break;case"multidirectional":a=3;break;default:a=0}let n=i.getIlluminationProperties();for(let s=0;s<n.directionRadians.length;s++)i.paint.get("hillshade-illumination-anchor")==="viewport"&&(n.directionRadians[s]+=e.transform.bearingInRadians);return{u_image:0,u_latrange:d5(e,t.tileID),u_exaggeration:i.paint.get("hillshade-exaggeration"),u_altitudes:n.altitudeRadians,u_azimuths:n.directionRadians,u_accent:r,u_method:a,u_highlights:n.highlightColor,u_shadows:n.shadowColor}},c5=(e,t)=>{let i=t.stride,r=kr();return Ni(r,0,L,-L,0,0,1),ct(r,r,[0,-L,0]),{u_matrix:r,u_image:1,u_dimension:[i,i],u_zoom:e.overscaledZ,u_unpack:t.getUnpackVector()}};function d5(e,t){let i=2**t.canonical.z,r=t.canonical.y;return[new Me(0,r/i).toLngLat().lat,new Me(0,(r+1)/i).toLngLat().lat]}const p5=(e,t)=>({u_image:new K(e,t.u_image),u_unpack:new fs(e,t.u_unpack),u_dimension:new _e(e,t.u_dimension),u_elevation_stops:new K(e,t.u_elevation_stops),u_color_stops:new K(e,t.u_color_stops),u_color_ramp_size:new K(e,t.u_color_ramp_size),u_opacity:new U(e,t.u_opacity)}),f5=(e,t,i=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:i,u_opacity:e.paint.get("color-relief-opacity")}),m5=(e,t)=>({u_translation:new _e(e,t.u_translation),u_ratio:new U(e,t.u_ratio)}),g5=(e,t)=>({u_translation:new _e(e,t.u_translation),u_ratio:new U(e,t.u_ratio),u_image:new K(e,t.u_image),u_image_height:new U(e,t.u_image_height)}),_5=(e,t)=>({u_translation:new _e(e,t.u_translation),u_texsize:new _e(e,t.u_texsize),u_ratio:new U(e,t.u_ratio),u_image:new K(e,t.u_image),u_scale:new Zt(e,t.u_scale),u_fade:new U(e,t.u_fade)}),y5=(e,t)=>({u_translation:new _e(e,t.u_translation),u_ratio:new U(e,t.u_ratio),u_image:new K(e,t.u_image),u_mix:new U(e,t.u_mix),u_tileratio:new U(e,t.u_tileratio),u_crossfade_from:new U(e,t.u_crossfade_from),u_crossfade_to:new U(e,t.u_crossfade_to),u_lineatlas_width:new U(e,t.u_lineatlas_width),u_lineatlas_height:new U(e,t.u_lineatlas_height)}),v5=(e,t)=>({u_translation:new _e(e,t.u_translation),u_ratio:new U(e,t.u_ratio),u_image:new K(e,t.u_image),u_image_height:new U(e,t.u_image_height),u_tileratio:new U(e,t.u_tileratio),u_crossfade_from:new U(e,t.u_crossfade_from),u_crossfade_to:new U(e,t.u_crossfade_to),u_image_dash:new K(e,t.u_image_dash),u_mix:new U(e,t.u_mix),u_lineatlas_width:new U(e,t.u_lineatlas_width),u_lineatlas_height:new U(e,t.u_lineatlas_height)}),su=(e,t,i,r)=>{let a=e.transform;return{u_translation:rx(e,t,i),u_ratio:r/hi(t,1,a.zoom)}},x5=(e,t,i,r,a)=>W(su(e,t,i,r),{u_image:0,u_image_height:a}),b5=(e,t,i,r,a)=>{let n=e.transform,s=Pp(t,n);return{u_translation:rx(e,t,i),u_texsize:t.imageAtlasTexture.size,u_ratio:r/hi(t,1,n.zoom),u_image:0,u_scale:[s,a.fromScale,a.toScale],u_fade:a.t}},w5=(e,t,i,r,a)=>{let n=e.transform,s=Pp(t,n);return W(su(e,t,i,r),{u_tileratio:s,u_crossfade_from:a.fromScale,u_crossfade_to:a.toScale,u_image:0,u_mix:a.t,u_lineatlas_width:e.lineAtlas.width,u_lineatlas_height:e.lineAtlas.height})},T5=(e,t,i,r,a,n)=>{let s=e.transform,o=Pp(t,s);return W(su(e,t,i,r),{u_image:0,u_image_height:n,u_tileratio:o,u_crossfade_from:a.fromScale,u_crossfade_to:a.toScale,u_image_dash:1,u_mix:a.t,u_lineatlas_width:e.lineAtlas.width,u_lineatlas_height:e.lineAtlas.height})};function Pp(e,t){return 1/hi(e,1,t.tileZoom)}function rx(e,t,i){return Mr(e.transform,t,i.paint.get("line-translate"),i.paint.get("line-translate-anchor"))}const E5=(e,t)=>({u_image:new K(e,t.u_image),u_opacity:new U(e,t.u_opacity)}),S5=(e,t)=>({u_image:t,u_opacity:e}),D5=(e,t)=>({u_is_size_zoom_constant:new K(e,t.u_is_size_zoom_constant),u_is_size_feature_constant:new K(e,t.u_is_size_feature_constant),u_size_t:new U(e,t.u_size_t),u_size:new U(e,t.u_size),u_rotate_symbol:new K(e,t.u_rotate_symbol),u_label_plane_matrix:new zi(e,t.u_label_plane_matrix),u_coord_matrix:new zi(e,t.u_coord_matrix),u_is_text:new K(e,t.u_is_text),u_pitch_with_map:new K(e,t.u_pitch_with_map),u_is_along_line:new K(e,t.u_is_along_line),u_is_variable_anchor:new K(e,t.u_is_variable_anchor),u_texsize:new _e(e,t.u_texsize),u_texture:new K(e,t.u_texture),u_translation:new _e(e,t.u_translation),u_pitched_scale:new U(e,t.u_pitched_scale),u_is_offset:new K(e,t.u_is_offset),u_height_anchor_ground:new K(e,t.u_height_anchor_ground)}),C5=(e,t)=>({u_is_size_zoom_constant:new K(e,t.u_is_size_zoom_constant),u_is_size_feature_constant:new K(e,t.u_is_size_feature_constant),u_size_t:new U(e,t.u_size_t),u_size:new U(e,t.u_size),u_rotate_symbol:new K(e,t.u_rotate_symbol),u_label_plane_matrix:new zi(e,t.u_label_plane_matrix),u_coord_matrix:new zi(e,t.u_coord_matrix),u_is_text:new K(e,t.u_is_text),u_pitch_with_map:new K(e,t.u_pitch_with_map),u_is_along_line:new K(e,t.u_is_along_line),u_is_variable_anchor:new K(e,t.u_is_variable_anchor),u_texsize:new _e(e,t.u_texsize),u_texture:new K(e,t.u_texture),u_gamma_scale:new U(e,t.u_gamma_scale),u_is_halo:new K(e,t.u_is_halo),u_is_plain:new K(e,t.u_is_plain),u_translation:new _e(e,t.u_translation),u_pitched_scale:new U(e,t.u_pitched_scale),u_is_offset:new K(e,t.u_is_offset),u_height_anchor_ground:new K(e,t.u_height_anchor_ground)}),P5=(e,t)=>({u_is_size_zoom_constant:new K(e,t.u_is_size_zoom_constant),u_is_size_feature_constant:new K(e,t.u_is_size_feature_constant),u_size_t:new U(e,t.u_size_t),u_size:new U(e,t.u_size),u_rotate_symbol:new K(e,t.u_rotate_symbol),u_label_plane_matrix:new zi(e,t.u_label_plane_matrix),u_coord_matrix:new zi(e,t.u_coord_matrix),u_is_text:new K(e,t.u_is_text),u_pitch_with_map:new K(e,t.u_pitch_with_map),u_is_along_line:new K(e,t.u_is_along_line),u_is_variable_anchor:new K(e,t.u_is_variable_anchor),u_texsize:new _e(e,t.u_texsize),u_texsize_icon:new _e(e,t.u_texsize_icon),u_texture:new K(e,t.u_texture),u_texture_icon:new K(e,t.u_texture_icon),u_gamma_scale:new U(e,t.u_gamma_scale),u_is_halo:new K(e,t.u_is_halo),u_translation:new _e(e,t.u_translation),u_pitched_scale:new U(e,t.u_pitched_scale),u_is_offset:new K(e,t.u_is_offset),u_height_anchor_ground:new K(e,t.u_height_anchor_ground)}),ax=(e,t,i,r,a,n,s,o,l,u,h,c,d,p,f)=>({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:+i,u_label_plane_matrix:o,u_coord_matrix:l,u_is_text:+h,u_pitch_with_map:+r,u_is_along_line:a,u_is_variable_anchor:n,u_texsize:c,u_texture:0,u_translation:u,u_pitched_scale:d,u_is_offset:p,u_height_anchor_ground:+f}),nx=(e,t,i,r,a,n,s,o,l,u,h,c,d,p,f,m)=>{let g=s.transform;return W(ax(e,t,i,r,a,n,s,o,l,u,h,c,p,f,m),{u_gamma_scale:r?Math.cos(g.pitch*Math.PI/180)*g.cameraToCenterDistance:1,u_is_halo:+!!d,u_is_plain:1})},A5=(e,t,i,r,a,n,s,o,l,u,h,c,d,p,f)=>W(nx(e,t,i,r,a,n,s,o,l,u,!0,h,!0,d,p,f),{u_texsize_icon:c,u_texture_icon:1}),I5=(e,t)=>({u_opacity:new U(e,t.u_opacity),u_color:new Rr(e,t.u_color)}),M5=(e,t)=>({u_opacity:new U(e,t.u_opacity),u_image:new K(e,t.u_image),u_pattern_tl_a:new _e(e,t.u_pattern_tl_a),u_pattern_br_a:new _e(e,t.u_pattern_br_a),u_pattern_tl_b:new _e(e,t.u_pattern_tl_b),u_pattern_br_b:new _e(e,t.u_pattern_br_b),u_texsize:new _e(e,t.u_texsize),u_mix:new U(e,t.u_mix),u_pattern_size_a:new _e(e,t.u_pattern_size_a),u_pattern_size_b:new _e(e,t.u_pattern_size_b),u_scale_a:new U(e,t.u_scale_a),u_scale_b:new U(e,t.u_scale_b),u_pixel_coord_upper:new _e(e,t.u_pixel_coord_upper),u_pixel_coord_lower:new _e(e,t.u_pixel_coord_lower),u_tile_units_to_pixels:new U(e,t.u_tile_units_to_pixels)}),F5=(e,t)=>({u_opacity:e,u_color:t}),z5=(e,t,i,r,a)=>W(qF(i,a,t,r),{u_opacity:e}),R5=(e,t)=>({u_sun_pos:new Zt(e,t.u_sun_pos),u_atmosphere_blend:new U(e,t.u_atmosphere_blend),u_globe_position:new Zt(e,t.u_globe_position),u_globe_radius:new U(e,t.u_globe_radius),u_inv_proj_matrix:new zi(e,t.u_inv_proj_matrix)}),k5=(e,t,i,r,a)=>({u_sun_pos:e,u_atmosphere_blend:t,u_globe_position:i,u_globe_radius:r,u_inv_proj_matrix:a}),L5=(e,t)=>({u_sky_color:new Rr(e,t.u_sky_color),u_horizon_color:new Rr(e,t.u_horizon_color),u_horizon:new _e(e,t.u_horizon),u_horizon_normal:new _e(e,t.u_horizon_normal),u_sky_horizon_blend:new U(e,t.u_sky_horizon_blend),u_sky_blend:new U(e,t.u_sky_blend),u_inv_proj_matrix:new zi(e,t.u_inv_proj_matrix),u_globe_position:new Zt(e,t.u_globe_position),u_globe_radius:new U(e,t.u_globe_radius),u_atmosphere_blend:new U(e,t.u_atmosphere_blend)}),B5=(e,t,i)=>{let r=Math.cos(t.rollInRadians),a=Math.sin(t.rollInRadians),n=es(t),s=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-n*a)*i,(t.height/2+n*r)*i],u_horizon_normal:[-a,r],u_sky_horizon_blend:e.properties.get("sky-horizon-blend")*t.height/2*i,u_sky_blend:s,u_inv_proj_matrix:t.inverseProjectionMatrix,u_globe_position:Gv(t),u_globe_radius:on(t.worldSize,t.center.lat),u_atmosphere_blend:e.properties.get("atmosphere-blend")}},Ao=(e,t)=>({}),O5={fillExtrusion:WF,fillExtrusionPattern:HF,fill:YF,fillPattern:KF,fillOutline:JF,fillOutlinePattern:QF,circle:r5,collisionBox:Ao,collisionCircle:Ao,debug:n5,depth:Ao,clippingMask:Ao,heatmap:s5,heatmapTexture:o5,hillshade:l5,hillshadePrepare:u5,colorRelief:p5,line:m5,lineGradient:g5,linePattern:_5,lineSDF:y5,lineGradientSDF:v5,layerOpacity:E5,raster:t3,symbolIcon:D5,symbolSDF:C5,symbolTextAndIcon:P5,background:I5,backgroundPattern:M5,terrain:RF,terrainDepth:kF,atmosphere:R5,sky:L5};var $5=class{constructor(e,t,i){this.context=e;let r=e.gl;this.buffer=r.createBuffer(),this.dynamicDraw=!!i,this.context.unbindVAO(),e.bindElementBuffer.set(this.buffer),r.bufferData(r.ELEMENT_ARRAY_BUFFER,t.arrayBuffer,this.dynamicDraw?r.DYNAMIC_DRAW:r.STATIC_DRAW),this.dynamicDraw||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 Jg={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};var j5=class{constructor(e,t,i,r){this.length=t.length,this.attributes=i,this.itemSize=t.bytesPerElement,this.dynamicDraw=r,this.context=e;let a=e.gl;this.buffer=a.createBuffer(),e.bindVertexBuffer.set(this.buffer),a.bufferData(a.ARRAY_BUFFER,t.arrayBuffer,this.dynamicDraw?a.DYNAMIC_DRAW:a.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 i of this.attributes){let r=t.attributes[i.name];r!==void 0&&e.enableVertexAttribArray(r.location)}}setVertexAttribPointers(e,t,i){for(let r of this.attributes){let a=t.attributes[r.name];if(a!==void 0){let n=r.offset+this.itemSize*(i||0);a.isInteger?e.vertexAttribIPointer(a.location,r.components,e[Jg[r.type]],this.itemSize,n):e.vertexAttribPointer(a.location,r.components,e[Jg[r.type]],!1,this.itemSize,n)}}}destroy(){let e=this.context.gl;this.buffer&&(e.deleteBuffer(this.buffer),delete this.buffer)}},$e=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)}},V5=class extends $e{getDefault(){return de.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)}},N5=class extends $e{getDefault(){return 1}set(e){(e!==this.current||this.dirty)&&(this.gl.clearDepth(e),this.current=e,this.dirty=!1)}},U5=class extends $e{getDefault(){return 0}set(e){(e!==this.current||this.dirty)&&(this.gl.clearStencil(e),this.current=e,this.dirty=!1)}},G5=class extends $e{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)}},Z5=class extends $e{getDefault(){return!0}set(e){(e!==this.current||this.dirty)&&(this.gl.depthMask(e),this.current=e,this.dirty=!1)}},q5=class extends $e{getDefault(){return 255}set(e){(e!==this.current||this.dirty)&&(this.gl.stencilMask(e),this.current=e,this.dirty=!1)}},W5=class extends $e{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)}},H5=class extends $e{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)}},X5=class extends $e{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}},Y5=class extends $e{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)}},K5=class extends $e{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}},J5=class extends $e{getDefault(){return this.gl.LESS}set(e){(e!==this.current||this.dirty)&&(this.gl.depthFunc(e),this.current=e,this.dirty=!1)}},Q5=class extends $e{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}},ez=class extends $e{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)}},tz=class extends $e{getDefault(){return de.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)}},iz=class extends $e{getDefault(){return this.gl.FUNC_ADD}set(e){(e!==this.current||this.dirty)&&(this.gl.blendEquation(e),this.current=e,this.dirty=!1)}},rz=class extends $e{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}},az=class extends $e{getDefault(){return this.gl.BACK}set(e){(e!==this.current||this.dirty)&&(this.gl.cullFace(e),this.current=e,this.dirty=!1)}},nz=class extends $e{getDefault(){return this.gl.CCW}set(e){(e!==this.current||this.dirty)&&(this.gl.frontFace(e),this.current=e,this.dirty=!1)}},sz=class extends $e{getDefault(){return null}set(e){(e!==this.current||this.dirty)&&(this.gl.useProgram(e),this.current=e,this.dirty=!1)}},oz=class extends $e{getDefault(){return this.gl.TEXTURE0}set(e){(e!==this.current||this.dirty)&&(this.gl.activeTexture(e),this.current=e,this.dirty=!1)}},lz=class extends $e{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)}},uz=class extends $e{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}},hz=class extends $e{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}},cz=class extends $e{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}},dz=class extends $e{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}},pz=class extends $e{getDefault(){return null}set(e){let t=this.gl;t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,e),this.current=e,this.dirty=!1}},fz=class extends $e{getDefault(){return null}set(e){(e!==this.current||this.dirty)&&(this.gl.bindVertexArray(e),this.current=e,this.dirty=!1)}},mz=class extends $e{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}},gz=class extends $e{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}},_z=class extends $e{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}},Ap=class extends $e{constructor(e,t){super(e),this.context=e,this.parent=t}getDefault(){return null}},yz=class extends Ap{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}},vz=class extends Ap{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}},xz=class extends Ap{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}},bz=class{constructor(e,t,i,r,a){this.context=e,this.width=t,this.height=i;let n=e.gl,s=this.framebuffer=n.createFramebuffer();if(this.colorAttachment=new yz(e,s),r)this.depthAttachment=a?new xz(e,s):new vz(e,s);else if(a)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 i=this.depthAttachment.get();i&&e.deleteRenderbuffer(i)}e.deleteFramebuffer(this.framebuffer)}};const sx=Dp([{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"}]),ri=sx.offsets;function wz(e){return new Cp(e,nu.FrameUBO,sx)}function Tz(e,t){let i=e.pending,{transform:r}=t,a=t.context.gl;i[ri.u_units_to_pixels]=1/r.pixelsToGLUnits[0],i[ri.u_units_to_pixels+1]=1/r.pixelsToGLUnits[1],i[ri.u_world_size]=a.drawingBufferWidth,i[ri.u_world_size+1]=a.drawingBufferHeight,i[ri.u_camera_to_center_distance]=r.cameraToCenterDistance,i[ri.u_symbol_fade_change]=t.options.fadeDuration?t.symbolFadeChange:1,i[ri.u_aspect_ratio]=r.width/r.height,i[ri.u_device_pixel_ratio]=t.pixelRatio,i[ri.u_viewport_size]=r.width,i[ri.u_viewport_size+1]=r.height,i[ri.u_pixel_extrude_scale]=1/r.width,i[ri.u_pixel_extrude_scale+1]=1/r.height,i[ri.u_pitch]=r.pitch/360*2*Math.PI,e.upload()}var nt=class{constructor(e,t,i){this.blendFunction=e,this.blendColor=t,this.mask=i}};nt.Replace=[1,0],nt.disabled=new nt(nt.Replace,de.transparent,[!1,!1,!1,!1]),nt.unblended=new nt(nt.Replace,de.transparent,[!0,!0,!0,!0]),nt.alphaBlended=new nt([1,771],de.transparent,[!0,!0,!0,!0]);var Ez=class{constructor(e){this.gl=e,this.clearColor=new V5(this),this.clearDepth=new N5(this),this.clearStencil=new U5(this),this.colorMask=new G5(this),this.depthMask=new Z5(this),this.stencilMask=new q5(this),this.stencilFunc=new W5(this),this.stencilOp=new H5(this),this.stencilTest=new X5(this),this.depthRange=new Y5(this),this.depthTest=new K5(this),this.depthFunc=new J5(this),this.blend=new Q5(this),this.blendFunc=new ez(this),this.blendColor=new tz(this),this.blendEquation=new iz(this),this.cullFace=new rz(this),this.cullFaceSide=new az(this),this.frontFace=new nz(this),this.program=new sz(this),this.activeTexture=new oz(this),this.viewport=new lz(this),this.bindFramebuffer=new uz(this),this.bindRenderbuffer=new hz(this),this.bindTexture=new cz(this),this.bindVertexBuffer=new dz(this),this.bindElementBuffer=new pz(this),this.bindVertexArray=new fz(this),this.pixelStoreUnpack=new mz(this),this.pixelStoreUnpackPremultiplyAlpha=new gz(this),this.pixelStoreUnpackFlipY=new _z(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=jF(this),this.terrainUniformBuffer=NF(this),this.frameUniformBuffer=wz(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 $5(this,e,t)}createVertexBuffer(e,t,i){return new j5(this,e,t,i)}createRenderbuffer(e,t,i){let r=this.gl,a=r.createRenderbuffer();return this.bindRenderbuffer.set(a),r.renderbufferStorage(r.RENDERBUFFER,e,t,i),this.bindRenderbuffer.set(null),a}createFramebuffer(e,t,i,r){return new bz(this,e,t,i,r)}clear({color:e,depth:t,stencil:i}){let r=this.gl,a=0;e&&(a|=r.COLOR_BUFFER_BIT,this.clearColor.set(e),this.colorMask.set([!0,!0,!0,!0])),t!==void 0&&(a|=r.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(t),this.depthMask.set(!0)),i!==void 0&&(a|=r.STENCIL_BUFFER_BIT,this.clearStencil.set(i),this.stencilMask.set(255)),r.clear(a)}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){Ai(e.blendFunction,nt.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)}},be=class{constructor(e,t,i){this.func=e,this.mask=t,this.range=i}};be.ReadOnly=!1,be.ReadWrite=!0,be.disabled=new be(519,be.ReadOnly,[0,1]);const dh=7680;var Ie=class{constructor(e,t,i,r,a,n){this.test=e,this.ref=t,this.mask=i,this.fail=r,this.depthFail=a,this.pass=n}};Ie.disabled=new Ie({func:519,mask:0},0,0,dh,dh,dh);const Qg=1029,ph=2305;var Pe=class{constructor(e,t,i){this.enable=e,this.mode=t,this.frontFace=i}};
821Pe.disabled=new Pe(!1,Qg,ph),Pe.backCCW=new Pe(!0,Qg,ph),Pe.frontCCW=new Pe(!0,1028,ph);function Sz(e,t,i){let r=(t==null?void 0:t.transitionState)??0;return{currentPass:"offscreen",currentLayer:0,opaquePassCutoff:1/0,depthRangeFor3D:[0,1],isRenderingToTexture:!1,transform:e,terrain:i,projectionTransition:r,isRenderingGlobe:r>0}}function Lt(e,t,i={}){return e.transform.getProjectionData({overscaledTileID:t,aligned:i.aligned,applyGlobeMatrix:!e.isRenderingToTexture,applyTerrainMatrix:i.applyTerrainMatrix??!0})}function Wt(e,t){var i;return e.isRenderingToTexture?null:((i=e.terrain)==null?void 0:i.getTerrainData(t))??null}let Io;function e_(e,t,i,r,a,n){let s=e.context,o=s.gl,l=e.useProgram("collisionBox"),u=[],h=0,c=0;for(let _ of r){let y=t.getTile(_).getBucket(i);if(!y)continue;let x=a?y.textCollisionBox:y.iconCollisionBox,v=y.collisionCircleArray;v.length>0&&(u.push({circleArray:v,circleOffset:c,coord:_}),h+=v.length/4,c=h),x&&l.draw(s,o.LINES,be.disabled,Ie.disabled,e.colorModeForRenderPass(),Pe.disabled,null,Wt(n,_),Lt(n,_),i.id,x.layoutVertexBuffer,x.indexBuffer,x.segments,null,e.transform.zoom,null,null,x.collisionVertexBuffer)}if(!a||!u.length)return;let d=e.useProgram("collisionCircle"),p=new $T;p.resize(h*4),p._trim();let f=0;for(let _ of u)for(let y=0;y<_.circleArray.length/4;y++){let x=y*4,v=_.circleArray[x+0],w=_.circleArray[x+1],b=_.circleArray[x+2],T=_.circleArray[x+3];p.emplace(f++,v,w,b,T,0),p.emplace(f++,v,w,b,T,1),p.emplace(f++,v,w,b,T,2),p.emplace(f++,v,w,b,T,3)}(!Io||Io.length<h*2)&&(Io=Dz(h));let m=s.createIndexBuffer(Io,!0),g=s.createVertexBuffer(p,nD.members,!0);for(let _ of u)d.draw(s,o.TRIANGLES,be.disabled,Ie.disabled,e.colorModeForRenderPass(),Pe.disabled,null,Wt(n,_.coord),null,i.id,g,m,Ke.simpleSegment(0,_.circleOffset*2,_.circleArray.length,_.circleArray.length/2),null,e.transform.zoom,null,null,null);g.destroy(),m.destroy()}function Dz(e){let t=e*2,i=new VT;i.resize(t),i._trim();for(let r=0;r<t;r++){let a=r*6;i.uint16[a+0]=r*4+0,i.uint16[a+1]=r*4+1,i.uint16[a+2]=r*4+2,i.uint16[a+3]=r*4+2,i.uint16[a+4]=r*4+3,i.uint16[a+5]=r*4+0}return i}const Cz=Fi(new Float32Array(16));function Pz(e,t,i,r,a,n){if(n.currentPass!=="translucent")return;let s=Ie.disabled,o=e.colorModeForRenderPass();(i._unevaluatedLayout.hasValue("text-variable-anchor")||i._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&Iz(r,e,i,t,i.layout.get("text-rotation-alignment"),i.layout.get("text-pitch-alignment"),i.paint.get("text-translate"),i.paint.get("text-translate-anchor"),a),i.paint.get("icon-opacity").constantOr(1)!==0&&t_(e,t,i,r,!1,i.paint.get("icon-translate"),i.paint.get("icon-translate-anchor"),i.layout.get("icon-rotation-alignment").constantOr("viewport"),i.layout.get("icon-pitch-alignment"),i.layout.get("icon-keep-upright"),s,o,n),i.paint.get("text-opacity").constantOr(1)!==0&&t_(e,t,i,r,!0,i.paint.get("text-translate"),i.paint.get("text-translate-anchor"),i.layout.get("text-rotation-alignment"),i.layout.get("text-pitch-alignment"),i.layout.get("text-keep-upright"),s,o,n),t.map.showCollisionBoxes&&(e_(e,t,i,r,!0,n),e_(e,t,i,r,!1,n))}function Az(e,t,i,r,a,n){let{horizontalAlign:s,verticalAlign:o}=Jl(e),l=-(s-.5)*t,u=-(o-.5)*i;return new A((l/a+r[0])*n,(u/a+r[1])*n)}function Iz(e,t,i,r,a,n,s,o,l){var p;let u=t.transform,h=t.style.map.terrain,c=a==="map",d=n==="map";for(let f of e){let m=r.getTile(f),g=m.getBucket(i);if(!((p=g==null?void 0:g.text)!=null&&p.segments.get().length))continue;let _=g.textSizeData,y=Ql(_,u.zoom),x=hi(m,1,t.transform.zoom),v=xp(c,t.transform,x),w=i.layout.get("icon-text-fit")!=="none"&&g.hasIconData();if(y){let b=2**(u.zoom-m.tileID.overscaledZ),T=h?(P,S)=>h.getElevation(f,P,S):void 0;Fz(g,c,d,l,u,v,b,y,w,Mr(u,m,s,o),f.toUnwrapped(),T,i.layout.get("symbol-height-anchor")==="ground")}}}function Mz(e,t,i,r,a,n){let s=t.tileAnchorPoint.add(new A(t.translation[0],t.translation[1]));if(t.pitchWithMap){let o=r.mult(n);i||(o=o.rotate(-a));let l=s.add(o);return wp(l.x,l.y,t.pitchedLabelPlaneMatrix,ha(t,l.x,l.y)).point}if(i){let o=ca(t.tileAnchorPoint.x+1,t.tileAnchorPoint.y,t).point.sub(e),l=
vendor: 5,174 bytes, line 821
821Math.atan(o.y/o.x)+(o.x<0?Math.PI:0);return e.add(r.rotate(l))}return e.add(r)}function Fz(e,t,i,r,a,n,s,o,l,u,h,c,d){let p=e.text.placedSymbolArray,f=e.text.dynamicLayoutVertexArray,m=e.icon.dynamicLayoutVertexArray,g={};f.clear();for(let _=0;_<p.length;_++){let y=p.get(_),x=e.allowVerticalPlacement&&!y.placedOrientation,v=!y.hidden&&y.crossTileID&&!x?r[y.crossTileID]:null;if(!v)Wa(y.numGlyphs,f);else{let w=new A(y.anchorX,y.anchorY),b={getElevation:c,heightOffset:y.heightOffset,heightAnchorGround:d,width:a.width,height:a.height,pitchedLabelPlaneMatrix:n,pitchWithMap:i,transform:a,tileAnchorPoint:w,translation:u,unwrappedTileID:h},T=i?Av(w.x,w.y,b):ca(w.x,w.y,b),P=Dv(a.cameraToCenterDistance,T.signedDistanceFromCamera),S=Xd(e.textSizeData,o,y)*P/24;i&&(S*=e.tilePixelRatio/s);let{width:M,height:k,anchor:R,textOffset:D,textBoxScale:I}=v,C=Az(R,M,k,D,I,S),E=a.getPitchedTextCorrection(w.x+u[0],w.y+u[1],h),F=Mz(T.point,b,t,C,-a.bearingInRadians,E),B=e.allowVerticalPlacement&&y.placedOrientation===2?Math.PI/2:0;for(let j=0;j<y.numGlyphs;j++)_l(f,F,B);l&&y.associatedIconIndex>=0&&(g[y.associatedIconIndex]={shiftedAnchor:F,angle:B})}}if(l){m.clear();let _=e.icon.placedSymbolArray;for(let y=0;y<_.length;y++){let x=_.get(y);if(x.hidden)Wa(x.numGlyphs,m);else{let v=g[y];if(!v)Wa(x.numGlyphs,m);else for(let w=0;w<x.numGlyphs;w++)_l(m,v.shiftedAnchor,v.angle)}}e.icon.dynamicLayoutVertexBuffer.updateData(m)}e.text.dynamicLayoutVertexBuffer.updateData(f)}function zz(e,t,i){return i.iconsInText&&t?"symbolTextAndIcon":e?"symbolSDF":"symbolIcon"}function t_(e,t,i,r,a,n,s,o,l,u,h,c,d){let p=e.context,f=p.gl,m=e.transform,g=o==="map",_=l==="map",y=o!=="viewport"&&i.layout.get("symbol-placement")!=="point",x=g&&!_&&!y,v=!i.layout.get("symbol-sort-key").isConstant(),w=!1,b=e.getDepthModeForSublayer(0,be.ReadOnly),T=i._unevaluatedLayout.hasValue("text-variable-anchor")||i._unevaluatedLayout.hasValue("text-variable-anchor-offset"),P=[],S=m.getCircleRadiusCorrection();for(let R of r){let D=t.getTile(R),I=D.getBucket(i);if(!I)continue;let C=a?I.text:I.icon;if(!(C!=null&&C.segments.get().length)||!C.hasVisibleVertices)continue;let E=C.programConfigurations.get(i.id),F=a||I.sdfIcons,B=a?I.textSizeData:I.iconSizeData,j=_||m.pitch!==0,H=e.useProgram(zz(F,a,I),E),ce=Ql(B,m.zoom),Fe=Wt(d,R),pe,Ve=[0,0],Te,Ne,Ce=null,st;if(a){if(Te=D.glyphAtlasTexture,Ne=f.LINEAR,pe=D.glyphAtlasTexture.size,I.iconsInText){Ve=D.imageAtlasTexture.size,Ce=D.imageAtlasTexture;let q=B.kind==="composite"||B.kind==="camera";st=j||e.options.rotating||e.options.zooming||q?f.LINEAR:f.NEAREST}}else{let q=i.layout.get("icon-size").constantOr(0)!==1||I.iconsNeedLinear;Te=D.imageAtlasTexture,Ne=F||e.options.rotating||e.options.zooming||q||j?f.LINEAR:f.NEAREST,pe=D.imageAtlasTexture.size}let Tt=hi(D,1,e.transform.zoom),Bt=xp(g,e.transform,Tt),ze=k3(_,g,e.transform,Tt),Ue=Mr(m,D,n,s),Ot=Lt(d,R),Ht=T&&I.hasTextData(),jt=i.layout.get("icon-text-fit")!=="none"&&Ht&&I.hasIconData(),Xt=i._unevaluatedLayout.hasValue("icon-offset"),Z=i.layout.get("symbol-height-anchor")==="ground";if(y){let q=kr();M3(q,Bt);let Ee=e.style.map.terrain?(Se,oe)=>e.style.map.terrain.getElevation(R,Se,oe):void 0;B3(I,e,a,Bt,q,_,u,i.layout.get("text-rotation-alignment")==="map",R.toUnwrapped(),m.width,m.height,Ue,Ee)}let re=a&&T||jt,ne=_?Bt:e.transform.clipSpaceToPixelsMatrix,$=y||re?Cz:ne,se=F&&i.paint.get(a?"text-halo-width":"icon-halo-width").constantOr(1)!==0,J;J=F?I.iconsInText?A5(B.kind,ce,x,_,y,re,e,$,ze,Ue,pe,Ve,S,Xt,Z):nx(B.kind,ce,x,_,y,re,e,$,ze,Ue,a,pe,se,S,Xt,Z):ax(B.kind,ce,x,_,y,re,e,$,ze,Ue,a,pe,S,Xt,Z);let te={program:H,buffers:C,uniformValues:J,projectionData:Ot,atlasTexture:Te,atlasTextureIcon:Ce,atlasInterpolation:Ne,atlasInterpolationIcon:st,isSDF:F,hasHalo:se};if(v&&I.canOverlap){w=!0;let q=C.segments.get();for(let Ee of q)P.push({segments:new Ke([Ee]),sortKey:Ee.sortKey,state:te,terrainData:Fe})}else P.push({segments:C.segments,sortKey:0,state:te,terrainData:Fe})}w&&P.sort((R,D)=>R.sortKey-D.sortKey);let M=i.paint.get(a?"text-halo-width":"icon-halo-width").constantOr(null)??1/0,k=i.layout.get("text-letter-spacing").constantOr(0)*24<0||M>1;for(let R of P){let D=R.state;p.activeTexture.set(f.TEXTURE0),D.atlasTexture.bind(D.atlasInterpolation,f.CLAMP_TO_EDGE),D.atlasTextureIcon&&(p.activeTexture.set(f.TEXTURE1),D.atlasTextureIcon&&D.atlasTextureIcon.bind(D.atlasInterpolationIcon,f.CLAMP_TO_EDGE));let I=D.isSDF&&D.hasHalo;if(I){let C=D.uniformValues;C.u_is_halo=1,k&&(C.u_is_plain=0,i_(D.buffers,R.segments,i,e,D.program,b,h,c,C,D.projectionData,R.terrainData),C.u_is_halo=0,C.u_is_plain=1)}i_(D.buffers,R.segments,i,e,D.program,b,h,c,D.uniformValues,D.projectionData,R.terrainData),I&&!k&&(D.uniformValues.u_is_halo=0)}}function i_(e,t,i,r,a,n,s,o,l,u,h){let c=r.context,d=c.gl;a.draw(c,d.TRIANGLES,n,s,o,Pe.backCCW,l,h,u,i.id,e.layoutVertexBuffer,e.indexBuffer,t,i.paint,r.transform.zoom,e.programConfigurations.get(i.id),e.dynamicLayoutVertexBuffer,e.opacityVertexBuffer)}function Rz(e,t,i,r,a){if(a.currentPass!=="translucent")return;let n=i.paint.get("circle-opacity"),s=i.paint.get("circle-stroke-width"),o=i.paint.get("circle-stroke-opacity"),l=!i.layout.get("
821circle-sort-key").isConstant();if(n.constantOr(1)===0&&(s.constantOr(1)===0||o.constantOr(1)===0))return;let u=e.context,h=u.gl,c=e.transform,d=e.getDepthModeForSublayer(0,be.ReadOnly),p=Ie.disabled,f=e.colorModeForRenderPass(),m=[],g=c.getCircleRadiusCorrection();for(let _ of r){let y=t.getTile(_),x=y.getBucket(i);if(!x)continue;let v=i.paint.get("circle-translate"),w=i.paint.get("circle-translate-anchor"),b=Mr(c,y,v,w),T=x.programConfigurations.get(i.id),P=e.useProgram("circle",T),S=x.layoutVertexBuffer,M=x.indexBuffer,k=Wt(a,_),R={programConfiguration:T,program:P,layoutVertexBuffer:S,indexBuffer:M,uniformValues:a5(e,y,i,b,g),terrainData:k,projectionData:Lt(a,_)};if(l){let D=x.segments.get();for(let I of D)m.push({segments:new Ke([I]),sortKey:I.sortKey,state:R})}else m.push({segments:x.segments,sortKey:0,state:R})}l&&m.sort((_,y)=>_.sortKey-y.sortKey);for(let _ of m){let{programConfiguration:y,program:x,layoutVertexBuffer:v,indexBuffer:w,uniformValues:b,terrainData:T,projectionData:P}=_.state,S=_.segments;x.draw(u,h.TRIANGLES,d,p,f,Pe.backCCW,b,T,P,i.id,v,w,S,i.paint,e.transform.zoom,y)}}function kz(e,t,i,r,a){if(i.paint.get("heatmap-opacity")===0)return;let n=e.context;if(e.style.map.terrain){for(let s of r){let o=t.getTile(s);t.hasRenderableParent(s)||(a.currentPass==="offscreen"?Oz(e,o,i,s,a):a.currentPass==="translucent"&&$z(e,i,s,a))}n.viewport.set([0,0,e.width,e.height])}else a.currentPass==="offscreen"?Lz(e,t,i,r,a):a.currentPass==="translucent"&&Bz(e,i)}function Lz(e,t,i,r,a){let n=e.context,s=n.gl,o=e.transform,l=Ie.disabled,u=new nt([s.ONE,s.ONE],de.transparent,[!0,!0,!0,!0]);jz(n,e,i),n.clear({color:de.transparent});for(let h of r){if(t.hasRenderableParent(h))continue;let c=t.getTile(h),d=c.getBucket(i);if(!d)continue;let p=d.programConfigurations.get(i.id),f=e.useProgram("heatmap",p),m=Lt(a,h,{applyTerrainMatrix:!1}),g=o.getCircleRadiusCorrection();f.draw(n,s.TRIANGLES,be.disabled,l,u,Pe.backCCW,tx(c,o.zoom,i.paint.get("heatmap-intensity"),g),null,m,i.id,d.layoutVertexBuffer,d.indexBuffer,d.segments,i.paint,o.zoom,p)}n.viewport.set([0,0,e.width,e.height])}function Bz(e,t){let i=e.context,r=i.gl;i.setColorMode(e.colorModeForRenderPass());let a=t.heatmapFbos.get(ul);a&&(i.activeTexture.set(r.TEXTURE0),r.bindTexture(r.TEXTURE_2D,a.colorAttachment.get()),i.activeTexture.set(r.TEXTURE1),lx(i,t).bind(r.LINEAR,r.CLAMP_TO_EDGE),e.useProgram("heatmapTexture").draw(i,r.TRIANGLES,be.disabled,Ie.disabled,e.colorModeForRenderPass(),Pe.disabled,ix(e,t,0,1),null,null,t.id,e.viewportBuffer,e.quadTriangleIndexBuffer,e.viewportSegments,t.paint,e.transform.zoom))}function Oz(e,t,i,r,a){let n=e.context,s=n.gl,o=Ie.disabled,l=new nt([s.ONE,s.ONE],de.transparent,[!0,!0,!0,!0]),u=t.getBucket(i);if(!u)return;let h=r.key,c=i.heatmapFbos.get(h);c||(c=ox(n,t.tileSize,t.tileSize),i.heatmapFbos.set(h,c)),n.bindFramebuffer.set(c.framebuffer),n.viewport.set([0,0,t.tileSize,t.tileSize]),n.clear({color:de.transparent});let d=u.programConfigurations.get(i.id),p=e.useProgram("heatmap",d,!a.isRenderingGlobe),f=Lt(a,t.tileID),m=Wt(a,r);p.draw(n,s.TRIANGLES,be.disabled,o,l,Pe.disabled,tx(t,e.transform.zoom,i.paint.get("heatmap-intensity"),1),m,f,i.id,u.layoutVertexBuffer,u.indexBuffer,u.segments,i.paint,e.transform.zoom,d)}function $z(e,t,i,r){let a=e.context,n=a.gl,s=e.transform;a.setColorMode(e.colorModeForRenderPass());let o=lx(a,t),l=i.key,u=t.heatmapFbos.get(l);if(!u)return;a.activeTexture.set(n.TEXTURE0),n.bindTexture(n.TEXTURE_2D,u.colorAttachment.get()),a.activeTexture.set(n.TEXTURE1),o.bind(n.LINEAR,n.CLAMP_TO_EDGE);let h=Lt(r,i,{applyTerrainMatrix:r.isRenderingGlobe});e.useProgram("heatmapTexture").draw(a,n.TRIANGLES,be.disabled,Ie.disabled,e.colorModeForRenderPass(),Pe.disabled,ix(e,t,0,1),null,h,t.id,e.rasterBoundsBuffer,e.quadTriangleIndexBuffer,e.rasterBoundsSegments,t.paint,s.zoom),u.destroy(),t.heatmapFbos.delete(l)}function jz(e,t,i){let r=e.gl;e.activeTexture.set(r.TEXTURE1),e.viewport.set([0,0,t.width/4,t.height/4]);let a=i.heatmapFbos.get(ul);a?(r.bindTexture(r.TEXTURE_2D,a.colorAttachment.get()),e.bindFramebuffer.set(a.framebuffer)):(a=ox(e,t.width/4,t.height/4),i.heatmapFbos.set(ul,a))}function ox(e,t,i){let r=e.gl,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.texStorage2D(r.TEXTURE_2D,1,r.RGBA16F,t,i);let n=e.createFramebuffer(t,i,!1,!1);return n.colorAttachment.set(a),n}function lx(e,t){return t.colorRampTexture||(t.colorRampTexture=new gt(e,t.colorRamp,e.gl.RGBA)),t.colorRampTexture}function ux(e,t,i){let r=e.context,a=r.bindFramebuffer.get(),n=r.viewport.get(),[,,s,o]=n;
vendor: 5,128 bytes, line 821
821return Vz(e,s,o),r.viewport.set([0,0,s,o]),r.clear({color:de.transparent,depth:1,stencil:0}),e.currentStencilSource=void 0,e.renderTileClippingMasks(t,i),{compositeTarget:a,compositeViewport:n}}function Vz(e,t,i){let r=e.context.gl;if(!e.layerOpacityFbo){let n=e.context.createFramebuffer(t,i,!0,!0),s=r.createTexture();r.bindTexture(r.TEXTURE_2D,s),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,i,0,r.RGBA,r.UNSIGNED_BYTE,null),n.colorAttachment.set(s),n.depthAttachment.set(e.context.createRenderbuffer(r.DEPTH_STENCIL,t,i)),e.layerOpacityFbo=n,e.context.bindFramebuffer.set(e.layerOpacityFbo.framebuffer);return}if(e.layerOpacityFbo.width===t&&e.layerOpacityFbo.height===i){e.context.bindFramebuffer.set(e.layerOpacityFbo.framebuffer);return}let a=e.layerOpacityFbo;r.bindTexture(r.TEXTURE_2D,a.colorAttachment.get()),r.texImage2D(r.TEXTURE_2D,0,r.RGBA,t,i,0,r.RGBA,r.UNSIGNED_BYTE,null),e.context.bindRenderbuffer.set(a.depthAttachment.get()),r.renderbufferStorage(r.RENDERBUFFER,r.DEPTH_STENCIL,t,i),e.context.bindRenderbuffer.set(null),a.width=t,a.height=i,e.context.bindFramebuffer.set(a.framebuffer)}function hx(e,t,i,r){let a=e.context,n=a.gl;a.bindFramebuffer.set(i.compositeTarget),a.viewport.set(i.compositeViewport),a.activeTexture.set(n.TEXTURE0),n.bindTexture(n.TEXTURE_2D,e.layerOpacityFbo.colorAttachment.get()),e.useProgram("layerOpacity").draw(a,n.TRIANGLES,be.disabled,Ie.disabled,e.colorModeForRenderPass(),Pe.disabled,S5(t,0),null,null,r.id,e.viewportBuffer,e.quadTriangleIndexBuffer,e.viewportSegments,r.paint,e.transform.zoom),e.currentStencilSource=void 0}function cx(e,t,i,r,a,n,s,o){let l=256;if(a.stepInterpolant){let u=t.getSource().maxzoom,h=s.canonical.z===u?Math.ceil(1<<e.transform.maxZoom-s.canonical.z):1,c=n.maxLineLength/L*1024*h;l=he(iw(c),256,i.maxTextureSize)}return o.gradient=M0({expression:a.gradientExpression(),evaluationKey:"lineProgress",resolution:l,image:o.gradient||void 0,clips:n.lineClipsArray}),o.texture?o.texture.update(o.gradient):o.texture=new gt(i,o.gradient,r.RGBA),o.version=a.gradientVersion,o.texture}function Nz(e,t,i,r,a){e.activeTexture.set(t.TEXTURE0),i.imageAtlasTexture.bind(t.LINEAR,t.CLAMP_TO_EDGE),r.updatePaintBuffers(a)}function Uz(e,t,i,r,a,n){(a||e.lineAtlas.dirty)&&(t.activeTexture.set(i.TEXTURE0),e.lineAtlas.bind(t)),r.updatePaintBuffers(n)}function Gz(e,t,i,r,a,n,s){let o=n.gradients[a.id],l=o.texture;a.gradientVersion!==o.version&&(l=cx(e,t,i,r,a,n,s,o)),i.activeTexture.set(r.TEXTURE0),l.bind(a.stepInterpolant?r.NEAREST:r.LINEAR,r.CLAMP_TO_EDGE)}function Zz(e,t,i,r,a,n,s,o,l){let u=n.gradients[a.id],h=u.texture;a.gradientVersion!==u.version&&(h=cx(e,t,i,r,a,n,s,u)),i.activeTexture.set(r.TEXTURE0),h.bind(a.stepInterpolant?r.NEAREST:r.LINEAR,r.CLAMP_TO_EDGE),i.activeTexture.set(r.TEXTURE1),e.lineAtlas.bind(i),o.updatePaintBuffers(l)}function qz(e,t,i,r,a){if(a.currentPass!=="translucent")return;let n=i.paint.get("line-opacity"),s=i.paint.get("line-width"),o=i.paint.get("line-layer-opacity");if(n.constantOr(1)!==0&&s.constantOr(1)!==0&&o!==0){if(o<1){let l=ux(e,i,r);r_(e,t,i,r,a),hx(e,o,l,i);return}r_(e,t,i,r,a)}}function r_(e,t,i,r,a){let n=e.getDepthModeForSublayer(0,be.ReadOnly),s=e.colorModeForRenderPass(),o=i.paint.get("line-dasharray"),l=o.constantOr(1),u=i.paint.get("line-pattern"),h=u.constantOr(1),c=i.paint.get("line-gradient"),d=i.getCrossfadeParameters(),p;p=h?"linePattern":l&&c?"lineGradientSDF":l?"lineSDF":c?"lineGradient":"line";let f=e.context,m=f.gl,g=e.transform,_=!0;for(let y of r){let x=t.getTile(y);if(h&&!x.patternsLoaded())continue;let v=x.getBucket(i);if(!v)continue;let w=v.programConfigurations.get(i.id),b=e.context.program.get(),T=e.useProgram(p,w),P=_||T.program!==b,S=Wt(a,y),M=u.constantOr(null),k=o==null?void 0:o.constantOr(null);if(M&&x.imageAtlas){let E=x.imageAtlas,F=E.patternPositions[M.to.toString()],B=E.patternPositions[M.from.toString()];F&&B&&w.setConstantPatternPositions(F,B)}else if(k){let E=i.layout.get("line-cap").constantOr(null)==="round",F=e.lineAtlas.getDash(k.to,E),B=e.lineAtlas.getDash(k.from,E);w.setConstantDashPositions(F,B)}let R=Lt(a,y),D=g.getPixelScale(),I;h?(I=b5(e,x,i,D,d),Nz(f,m,x,w,d)):l&&c?(I=T5(e,x,i,D,d,v.lineClipsArray.length),Zz(e,t,f,m,i,v,y,w,d)):l?(I=w5(e,x,i,D,d),Uz(e,f,m,w,P,d)):c?(I=x5(e,x,i,D,v.lineClipsArray.length),Gz(e,t,f,m,i,v,y)):I=su(e,x,i,D);let C=e.stencilModeForClipping(y);T.draw(f,m.TRIANGLES,n,C,s,Pe.disabled,I,S,R,i.id,v.layoutVertexBuffer,v.indexBuffer,v.segments,i.paint,e.transform.zoom,w,v.layoutVertexBuffer2),_=!1}}function dx(e,t,i,r,a){if(!i||!(r!=null&&r.imageAtlas))return;let n=r.imageAtlas.patternPositions,s=n[i.to.toString()],o=n[i.from.toString()];if(!s&&o&&(s=o),!o&&s&&(o=s),!s||!o){let l=a.getPaintProperty(t);s=n[l],o=n[l]}s&&o&&e.setConstantPatternPositions(s,o)}function Wz(e,t,i,r,a){let n=i.paint.get("fill-color"),s=i.paint.get("fill-opacity"),o=i.paint.get("fill-layer
821-opacity");if(s.constantOr(1)===0||o===0)return;if(o<1){if(a.currentPass!=="translucent")return;let h=ux(e,i,r);a_(e,t,i,r,a),hx(e,o,h,i);return}let l=i.paint.get("fill-pattern"),u=e.opaquePassEnabledForLayer()&&!l.constantOr(1)&&n.constantOr(de.transparent).a===1&&s.constantOr(0)===1;if(u&&a.currentPass==="opaque"){let h=e.colorModeForRenderPass();Ip(e,t,i,r,e.getDepthModeForSublayer(1,be.ReadWrite),h,!1,a);return}if(u&&a.currentPass==="translucent"){px(e,t,i,r,a);return}a.currentPass==="translucent"&&a_(e,t,i,r,a)}function a_(e,t,i,r,a){let n=e.colorModeForRenderPass();Ip(e,t,i,r,e.getDepthModeForSublayer(1,be.ReadOnly),n,!1,a),px(e,t,i,r,a)}function px(e,t,i,r,a){if(!i.paint.get("fill-antialias"))return;let n=e.colorModeForRenderPass();Ip(e,t,i,r,e.getDepthModeForSublayer(i.getPaintProperty("fill-outline-color")?2:0,be.ReadOnly),n,!0,a)}function Ip(e,t,i,r,a,n,s,o){let l=e.context.gl,u="fill-pattern",h=i.paint.get(u),c=h==null?void 0:h.constantOr(1),d=i.getCrossfadeParameters(),p,f,m,g,_,y=e.transform,x=i.paint.get("fill-translate"),v=i.paint.get("fill-translate-anchor");s?(f=c&&!i.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",p=l.LINES):(f=c?"fillPattern":"fill",p=l.TRIANGLES);let w=h.constantOr(null);for(let b of r){let T=t.getTile(b);if(c&&!T.patternsLoaded())continue;let P=T.getBucket(i);if(!P)continue;let S=P.sdfPatterns[i.id]??!1,M=P.programConfigurations.get(i.id),k=e.useProgram(f,M),R=Wt(o,b);c&&(e.context.activeTexture.set(l.TEXTURE0),T.imageAtlasTexture.bind(l.LINEAR,l.CLAMP_TO_EDGE),M.updatePaintBuffers(d)),dx(M,u,w,T,i);let D=Lt(o,b),I=Mr(y,T,x,v);s?(g=P.indexBuffer2,_=P.segments2,m=f==="fillOutlinePattern"&&c?i5(e,d,T,I,S):t5(I)):(g=P.indexBuffer,_=P.segments,m=c?ex(e,d,T,I,S):e5(I));let C=e.stencilModeForClipping(b);k.draw(e.context,p,a,C,n,Pe.backCCW,m,R,D,i.id,P.layoutVertexBuffer,g,_,i.paint,e.transform.zoom,M)}}function Hz(e,t,i,r,a){let n=i.paint.get("fill-extrusion-opacity");if(n!==0&&a.currentPass==="translucent"){let s=new be(e.context.gl.LEQUAL,be.ReadWrite,a.depthRangeFor3D);if(n===1&&!i.paint.get("fill-extrusion-pattern").constantOr(1)){let o=e.colorModeForRenderPass();fh(e,t,i,r,s,Ie.disabled,o,a)}else fh(e,t,i,r,s,Ie.disabled,nt.disabled,a),fh(e,t,i,r,s,e.stencilModeFor3D(),e.colorModeForRenderPass(),a)}}function fh(e,t,i,r,a,n,s,o){let l=e.context,u=l.gl,h="fill-extrusion-pattern",c=i.paint.get(h),d=c.constantOr(1),p=i.getCrossfadeParameters(),f=i.paint.get("fill-extrusion-opacity"),m=c.constantOr(null),g=e.transform;for(let _ of r){let y=t.getTile(_),x=y.getBucket(i);if(!x)continue;let v=Wt(o,_),w=x.programConfigurations.get(i.id),b=e.useProgram(d?"fillExtrusionPattern":"fillExtrusion",w);d&&(e.context.activeTexture.set(u.TEXTURE0),y.imageAtlasTexture.bind(u.LINEAR,u.CLAMP_TO_EDGE),w.updatePaintBuffers(p));let T=Lt(o,_);dx(w,h,m,y,i);let P=Mr(g,y,i.paint.get("fill-extrusion-translate"),i.paint.get("fill-extrusion-translate-anchor")),S=i.paint.get("fill-extrusion-vertical-gradient"),M=d?XF(e,S,f,P,_,p,y):Qv(e,S,f,P);b.draw(l,l.gl.TRIANGLES,a,n,s,Pe.backCCW,M,v,T,i.id,x.layoutVertexBuffer,x.indexBuffer,x.segments,i.paint,e.transform.zoom,w,e.style.map.terrain&&x.centroidVertexBuffer)}}function Xz(e,t,i,r,a){if(a.currentPass!=="offscreen"&&a.currentPass!=="translucent")return;let n=e.context,s=e.style.projection.useSubdivision,o=e.getDepthModeForSublayer(0,be.ReadOnly),l=e.colorModeForRenderPass();if(a.currentPass==="offscreen")Yz(e,t,r,i,o,Ie.disabled,l),n.viewport.set([0,0,e.width,e.height]);else if(a.currentPass==="translucent")if(s){let[u,h,c]=e.stencilConfigForOverlapTwoPass(r);mh(e,t,i,c,u,o,l,!1,a),mh(e,t,i,c,h,o,l,!0,a)}else{let[u,h]=e.getStencilConfigForOverlapAndUpdateStencilID(r);mh(e,t,i,h,u,o,l,!1,a)}}function mh(e,t,i,r,a,n,s,o,l){let u=e.style.projection,h=e.context,c=h.gl,d=[`#define NUM_ILLUMINATION_SOURCES ${i.paint.get("hillshade-highlight-color").values.length}`],p=e.useProgram("hillshade",null,!1,d),f=!e.options.moving;for(let m of r){let g=t.getTile(m),_=g.fbo;if(!_)continue;let y=u.getMeshFromTileID(h,m.canonical,o,!0,"raster"),x=Wt(l,m);h.activeTexture.set(c.TEXTURE0),c.bindTexture(c.TEXTURE_2D,_.colorAttachment.get());
vendor: 18,078 bytes, lines 821-823
821let v=Lt(l,m,{aligned:f});p.draw(h,c.TRIANGLES,n,a[m.overscaledZ],s,Pe.backCCW,h5(e,g,i),x,v,i.id,y.vertexBuffer,y.indexBuffer,y.segments)}}function Yz(e,t,i,r,a,n,s){let o=e.context,l=o.gl,u=r.paint.get("resampling")==="nearest"?l.NEAREST:l.LINEAR;for(let h of i){let c=t.getTile(h),d=c.dem;if(!(d!=null&&d.data)||!c.needsHillshadePrepare)continue;let p=d.dim+2,f=d.stride,m=d.getPixels();if(o.activeTexture.set(l.TEXTURE1),o.pixelStoreUnpackPremultiplyAlpha.set(!1),c.demTexture||(c.demTexture=e.getTileTexture(f)),c.demTexture){let _=c.demTexture;_.update(m,{premultiply:!1}),_.bind(l.NEAREST,l.CLAMP_TO_EDGE)}else c.demTexture=new gt(o,m,l.RGBA,{premultiply:!1}),c.demTexture.bind(l.NEAREST,l.CLAMP_TO_EDGE);o.activeTexture.set(l.TEXTURE0);let g=c.fbo;if(!g){let _=new gt(o,{width:p,height:p,data:null},l.RGBA);_.bind(u,l.CLAMP_TO_EDGE),g=c.fbo=o.createFramebuffer(p,p,!0,!1),g.colorAttachment.set(_.texture)}o.bindFramebuffer.set(g.framebuffer),o.viewport.set([0,0,p,p]),e.useProgram("hillshadePrepare").draw(o,l.TRIANGLES,a,n,s,Pe.disabled,c5(c.tileID,d),null,null,r.id,e.rasterBoundsBuffer,e.quadTriangleIndexBuffer,e.rasterBoundsSegments),c.needsHillshadePrepare=!1}}function Kz(e,t,i,r,a){if(a.currentPass!=="translucent"||!r.length)return;let n=e.style.projection.useSubdivision,s=e.getDepthModeForSublayer(0,be.ReadOnly),o=e.colorModeForRenderPass();if(n){let[l,u,h]=e.stencilConfigForOverlapTwoPass(r);gh(e,t,i,h,l,s,o,!1,a),gh(e,t,i,h,u,s,o,!0,a)}else{let[l,u]=e.getStencilConfigForOverlapAndUpdateStencilID(r);gh(e,t,i,u,l,s,o,!1,a)}}let n_=0;function gh(e,t,i,r,a,n,s,o,l){let u=e.style.projection,h=e.context,c=h.gl,d=e.useProgram("colorRelief"),p=!e.options.moving,f=i.paint.get("resampling")==="nearest"?c.NEAREST:c.LINEAR,m=!0,g=0;for(let _ of r){let y=t.getTile(_),x=y.dem;if(!(x!=null&&x.data))continue;if(m){n_||(n_=c.getParameter(c.MAX_TEXTURE_SIZE));let P=n_,{elevationTexture:S,colorTexture:M}=i.getColorRampTextures(h,P,x.getUnpackVector());h.activeTexture.set(c.TEXTURE1),S.bind(c.NEAREST,c.CLAMP_TO_EDGE),h.activeTexture.set(c.TEXTURE4),M.bind(c.LINEAR,c.CLAMP_TO_EDGE),m=!1,g=S.size[0]}let v=x.stride;h.activeTexture.set(c.TEXTURE0),(!y.demTexture||y.needsColorReliefPrepare)&&(h.pixelStoreUnpackPremultiplyAlpha.set(!1),y.demTexture||(y.demTexture=e.getTileTexture(v)??new gt(h,{width:v,height:v,data:null},c.RGBA)),y.demTexture.update(x.getPixels(),{premultiply:!1}),y.needsColorReliefPrepare=!1),y.demTexture.bind(f,c.CLAMP_TO_EDGE);let w=u.getMeshFromTileID(h,_.canonical,o,!0,"raster"),b=Wt(l,_),T=Lt(l,_,{aligned:p});d.draw(h,c.TRIANGLES,n,a[_.overscaledZ],s,Pe.backCCW,f5(i,y.dem,g),b,T,i.id,w.vertexBuffer,w.indexBuffer,w.segments)}}const _h=[new A(0,0),new A(L,0),new A(L,L),new A(0,L)];function Jz(e,t,i,r,a){if(a.currentPass!=="translucent"||i.paint.get("raster-opacity")===0||!r.length)return;let n=t.getSource(),s=e.style.projection.useSubdivision;if(n instanceof dn)Mo(e,t,i,r,null,!1,!1,n.tileCoords,n.imageWarp,n.flippedWindingOrder,a,n.getMesh(e.context,s));else if(s){let[o,l,u]=e.stencilConfigForOverlapTwoPass(r);Mo(e,t,i,u,o,!1,!0,_h,qa,!1,a),Mo(e,t,i,u,l,!0,!0,_h,qa,!1,a)}else{let[o,l]=e.getStencilConfigForOverlapAndUpdateStencilID(r);Mo(e,t,i,l,o,!1,!0,_h,qa,!1,a)}}function Mo(e,t,i,r,a,n,s,o,l,u=!1,h,c=null){let d=r[r.length-1].overscaledZ,p=e.context,f=p.gl,m=e.useProgram("raster"),g=e.style.projection,_=e.colorModeForRenderPass(),y=!e.options.moving,x=i.paint.get("raster-opacity"),v=i.paint.get("resampling")==="nearest"||i.paint.get("raster-resampling")==="nearest"?f.NEAREST:f.LINEAR,w=i.paint.get("raster-fade-duration"),b=!!e.style.map.terrain;for(let T of r){let P=e.getDepthModeForSublayer(T.overscaledZ-d,x===1?be.ReadWrite:be.ReadOnly,f.LESS),S=t.getTile(T);p.activeTexture.set(f.TEXTURE0),S.texture.bind(v,f.CLAMP_TO_EDGE,f.LINEAR_MIPMAP_NEAREST),p.activeTexture.set(f.TEXTURE1);let{parentTile:M,parentScaleBy:k,parentTopLeft:R,fadeValues:D}=Qz(S,t,w,b);S.fadeOpacity=D.tileOpacity,M?(M.fadeOpacity=D.parentTileOpacity,M.texture.bind(v,f.CLAMP_TO_EDGE,f.LINEAR_MIPMAP_NEAREST)):S.texture.bind(v,f.CLAMP_TO_EDGE,f.LINEAR_MIPMAP_NEAREST),S.texture.useMipmap&&p.extTextureFilterAnisotropic&&e.transform.pitch>e.options.anisotropicFilterPitch&&f.texParameterf(f.TEXTURE_2D,p.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,p.extTextureFilterAnisotropicMax);let I=Wt(h,T),C=Lt(h,T,{aligned:y}),E=i3(R,k,D.fadeMix,i,o,l),F=c??g.getMeshFromTileID(p,T.canonical,n,s,"raster"),B=a?a[T.overscaledZ]:Ie.disabled;m.draw(p,f.TRIANGLES,P,B,_,u?Pe.frontCCW:Pe.backCCW,E,I,C,i.id,F.vertexBuffer,F.indexBuffer,F.segments)}}function Qz(e,t,i,r){let a={parentTile:null,parentScaleBy:1,parentTopLeft:[0,0],fadeValues:{tileOpacity:1,parentTileOpacity:1,fadeMix:{opacity:1,mix:0}}};if(i===0||r)return a;if(e.fadingParentID){let n=t.getLoadedTile(e.fadingParentID);if(!n)return a;let s=2**(n.tileID.overscaledZ-e.tileID.overscaledZ);return{parentTile:n,parentScaleBy:s,parentTopLeft:[e.tileID.canonical.x*s%1,e.tileID.canonical.y*s%1],fadeValues:eR(e,n,i)}}return e.selfFading?{parentTile:null,parentScaleBy:1,parentTopLeft:[0,0],fadeValues:tR(e,i)}:a}function eR(e,t,i){let r=Oe(),a=(r-e.timeAdded)/i,n=(r-t.timeAdded)/i,s=e.fadingDirection===1,o=he(a,0,1),l=he(1-n,0,1),u=s?o:l;return{tileOpacity:u,parentTileOpacity:s?l:o,fadeMix:{opacity:1,mix:1-u}}}function tR(e,t){let i=(Oe()-e.timeAdded)/t,r=he(i,0,1);return{tileOpacity:r,fadeMix:{opacity:r,mix:0}}}function iR(e,t,i,r,a){let n=i.paint.get("background-color"),s=i.paint.get("background-opacity");if(s===0)return;let o=e.context,l=o.gl,u=e.style.projection,h=e.transform,c=h.tileSize,d=i.paint.get("background-pattern");if(e.isPatternMissing(d))return;let p=!d&&n.a===1&&s===1&&e.opaquePassEnabledForLayer()?"opaque":"translucent";if(a.currentPass!==p)return;let f=Ie.disabled,m=e.getDepthModeForSublayer(0,p==="opaque"?be.ReadWrite:be.ReadOnly),g=e.colorModeForRenderPass(),_=e.useProgram(d?"backgroundPattern":"background"),y=r||pn(h,{tileSize:c,terrain:e.style.map.terrain});d&&(o.activeTexture.set(l.TEXTURE0),e.patternAtlas.bind(e.context));let x=i.getCrossfadeParameters();for(let v of y){let w=Lt(a,v),b=d?z5(s,e,d,{tileID:v,tileSize:c},x):F5(s,n),T=Wt(a,v),P=u.getMeshFromTileID(o,v.canonical,!1,!0,"raster");_.draw(o,l.TRIANGLES,m,f,g,Pe.backCCW,b,T,w,i.id,P.vertexBuffer,P.indexBuffer,P.segments)}}const rR=new de(1,0,0,1),aR=new de(0,1,0,1),nR=new de(0,0,1,1),sR=new de(1,0,1,1),oR=new de(0,1,1,1);function lR(e){let t=e.transform.padding;s_(e,e.transform.height-(t.top||0),3,rR),s_(e,t.bottom||0,3,aR),o_(e,t.left||0,3,nR),o_(e,e.transform.width-(t.right||0),3,sR);let i=e.transform.centerPoint;uR(e,i.x,e.transform.height-i.y,oR)}function uR(e,t,i,r){Cl(e,t-1,i-10,2,20,r),Cl(e,t-10,i-1,20,2,r)}function s_(e,t,i,r){Cl(e,0,t+i/2,e.transform.width,i,r)}function o_(e,t,i,r){Cl(e,t-i/2,0,i,e.transform.height,r)}function Cl(e,t,i,r,a,n){let s=e.context,o=s.gl;o.enable(o.SCISSOR_TEST),o.scissor(t*e.pixelRatio,i*e.pixelRatio,r*e.pixelRatio,a*e.pixelRatio),s.clear({color:n}),o.disable(o.SCISSOR_TEST)}function hR(e,t,i,r){for(let a of i)cR(e,t,a,r)}function cR(e,t,i,r){var y;let a=e.context,n=a.gl,s=e.useProgram("debug"),o=be.disabled,l=Ie.disabled,u=e.colorModeForRenderPass(),h="$debug",c=Wt(r,i);a.activeTexture.set(n.TEXTURE0);let d=((y=t.getTileByID(i.key).latestRawTileData)==null?void 0:y.byteLength)||0,p=Math.floor(d/1024),f=t.getTile(i).tileSize,m=512/Math.min(f,512)*(i.overscaledZ/e.transform.zoom)*.5,g=i.canonical.toString();i.overscaledZ!==i.canonical.z&&(g+=` => ${i.overscaledZ}`),dR(e,`${g} ${p}kB`);let _=Lt(r,i);s.draw(a,n.TRIANGLES,o,l,nt.alphaBlended,Pe.disabled,Kg(de.transparent,m),null,_,h,e.debugBuffer,e.quadTriangleIndexBuffer,e.debugSegments),s.draw(a,n.LINE_STRIP,o,l,u,Pe.disabled,Kg(de.red),c,_,h,e.debugBuffer,e.tileBorderIndexBuffer,e.debugSegments)}function dR(e,t){e.initDebugOverlayCanvas();let i=e.debugOverlayCanvas,r=e.context.gl,a=e.debugOverlayCanvas.getContext("2d");a.clearRect(0,0,i.width,i.height),a.shadowColor="white",a.shadowBlur=2,a.lineWidth=1.5,a.strokeStyle="white",a.textBaseline="top",a.font="bold 36px Open Sans, sans-serif",a.fillText(t,5,5),a.strokeText(t,5,5),e.debugOverlayTexture.update(i),e.debugOverlayTexture.bind(r.LINEAR,r.CLAMP_TO_EDGE)}function pR(e,t){let i=null,r=Object.values(e._layers).flatMap(o=>o.source&&!o.isHidden(t)?[e.tileManagers[o.source]]:[]),a=r.filter(o=>o.getSource().type==="vector"),n=r.filter(o=>o.getSource().type!=="vector"),s=o=>{(!i||i.getSource().maxzoom<o.getSource().maxzoom)&&(i=o)};for(let o of a)s(o);if(!i)for(let o of n)s(o);return i}function fR(e,t,i,r){let{isRenderingGlobe:a}=r,n=e.context,s=i.implementation,o=e.style.projection,l=e.transform,u=l.getProjectionDataForCustomLayer(a),h={farZ:l.farZ,nearZ:l.nearZ,fov:l.fov*Math.PI/180,modelViewProjectionMatrix:l.modelViewProjectionMatrix,projectionMatrix:l.projectionMatrix,shaderData:{variantName:o.shaderVariantName,vertexShaderPrelude:`const float PI = 3.141592653589793;
822uniform mat4 u_projection_matrix;
823${o.shaderPreludeCode.vertexSource}`,define:o.shaderDefine},defaultProjectionData:u,getProjectionData:d=>l.getProjectionData({overscaledTileID:new Pt(d.tileID.canonical.z,d.tileID.wrap??0,d.tileID.canonical.z,d.tileID.canonical.x,d.tileID.canonical.y),aligned:d.aligned,applyGlobeMatrix:d.applyGlobeMatrix,applyTerrainMatrix:d.applyTerrainMatrix})},c=s.renderingMode?s.renderingMode:"2d";if(r.currentPass==="offscreen"){let d=s.prerender;d&&(e.setCustomLayerDefaults(),n.setColorMode(e.colorModeForRenderPass()),d.call(s,n.gl,h),n.setDirty(),e.setBaseState())}else if(r.currentPass==="translucent"){e.setCustomLayerDefaults(),n.setColorMode(e.colorModeForRenderPass()),n.setStencilMode(Ie.disabled);let d=c==="3d"?e.getDepthModeFor3D():e.getDepthModeForSublayer(0,be.ReadOnly);n.setDepthMode(d),s.render(n.gl,h),n.setDirty(),e.setBaseState(),n.bindFramebuffer.set(null)}}function mR(e,t){let i=e.context,r=i.gl,a=e.transform,n=nt.unblended,s=new be(r.LEQUAL,be.ReadWrite,[0,1]),o=t.tileManager.getRenderableTiles(),l=e.useProgram("terrainDepth");i.bindFramebuffer.set(t.getFramebuffer().framebuffer),i.viewport.set([0,0,e.width/devicePixelRatio,e.height/devicePixelRatio]),i.clear({color:de.white,depth:1});for(let u of o){let h=t.getTerrainMesh(u.tileID),c=t.getTerrainData(u.tileID),d=a.getProjectionData({overscaledTileID:u.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0}),p=BF(t.getSkirtLength(a.zoom));l.draw(i,r.TRIANGLES,s,Ie.disabled,n,Pe.backCCW,p,c,d,"terrain",h.vertexBuffer,h.indexBuffer,h.segments)}i.bindFramebuffer.set(null),i.viewport.set([0,0,e.width,e.height])}function gR(e,t,i,r){let{isRenderingGlobe:a}=r,n=e.context,s=n.gl,o=e.transform,l=e.colorModeForRenderPass(),u=e.getDepthModeFor3D(),h=e.useProgram("terrain");n.bindFramebuffer.set(null),n.viewport.set([0,0,e.width,e.height]);for(let c of i){let d=t.getTerrainMesh(c.tileID),p=e.renderToTexture.getTexture(c),f=t.getTerrainData(c.tileID);n.activeTexture.set(s.TEXTURE0),p.bind(s.LINEAR,s.CLAMP_TO_EDGE,s.LINEAR_MIPMAP_LINEAR);let m=t.getSkirtLength(o.zoom),g=o.calculateFogMatrix(c.tileID.toUnwrapped()),_=LF(m,g,e.style.sky,o.pitch,a),y=Lt(r,c.tileID,{applyTerrainMatrix:!1});h.draw(n,s.TRIANGLES,u,Ie.disabled,l,Pe.backCCW,_,f,y,"terrain",d.vertexBuffer,d.indexBuffer,d.segments)}}function fx(e,t){if(!t.mesh){let i=new Pr;i.emplaceBack(-1,-1),i.emplaceBack(1,-1),i.emplaceBack(1,1),i.emplaceBack(-1,1);let r=new er;r.emplaceBack(0,1,2),r.emplaceBack(0,2,3),t.mesh=new ks(e.createVertexBuffer(i,Jr.members),e.createIndexBuffer(r),Ke.simpleSegment(0,0,i.length,r.length))}return t.mesh}function _R(e,t){let i=e.context,r=i.gl,a=B5(t,e.transform,e.pixelRatio),n=new be(r.LEQUAL,be.ReadWrite,[0,1]),s=Ie.disabled,o=e.colorModeForRenderPass(),l=e.useProgram("sky"),u=fx(i,t);l.draw(i,r.TRIANGLES,n,s,o,Pe.disabled,a,null,void 0,"sky",u.vertexBuffer,u.indexBuffer,u.segments)}function yR(e,t){let i=e.getCartesianPosition();Rb(i,i);let r=Fi(new Float64Array(16));return e.properties.get("anchor")==="map"&&(Dr(r,r,t.rollInRadians),Xa(r,r,-t.pitchInRadians),Dr(r,r,t.bearingInRadians),Xa(r,r,t.center.lat*Math.PI/180),E_(r,r,-t.center.lng*Math.PI/180)),kb(i,i,r),i}function vR(e,t,i){let r=e.context,a=r.gl,n=e.useProgram("atmosphere"),s=new be(a.LEQUAL,be.ReadOnly,[0,1]),o=e.transform,l=yR(i,e.transform),u=o.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),h=t.properties.get("atmosphere-blend")*u.projectionTransition;if(h===0)return;let c=on(o.worldSize,o.center.lat),d=Gv(o),p=k5(l,h,d,c,o.inverseProjectionMatrix),f=fx(r,t);n.draw(r,a.TRIANGLES,s,Ie.disabled,nt.alphaBlended,Pe.disabled,p,null,null,"atmosphere",f.vertexBuffer,f.indexBuffer,f.segments)}const xR={symbol:Pz,circle:Rz,heatmap:kz,line:qz,fill:Wz,fillExtrusion:Hz,hillshade:Xz,colorRelief:Kz,raster:Jz,background:iR,sky:_R,atmosphere:vR,custom:fR,debug:hR,debugPadding:lR,terrainDepth:mR};var na,bR=(na=class{constructor(t,i){this.drawFunctions=xR,this.context=new Ez(t),this.transform=i,this.layerOpacityFbo=null,this._tileTextures={},this._rttObjectRecyclePool=[],this._rttSharedFbo=null,this.terrainFacilitator={depthDirty:!0,matrix:Fi(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=Wc.maxOverzooming+Wc.maxUnderzooming+1,this.depthEpsilon=1/2**16,this.crossTileSymbolIndex=new Fv}resize(t,i,r){if(this.width=Math.floor(t*r),this.height=Math.floor(i*r),this.pixelRatio=r,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(let a of this.style._order)this.style._layers[a].resize()}setup(){let t=this.context,i=new Pr;i.emplaceBack(0,0),i.emplaceBack(L,0),i.emplaceBack(0,L),i.emplaceBack(L,L),this.tileExtentBuffer=t.createVertexBuffer(i,Jr.members),this.tileExtentSegments=Ke.simpleSegment(0,0,4,2);let r=new Pr;r.emplaceBack(0,0),r.emplaceBack(L,0),r.emplaceBack(0,L),r.emplaceBack(L,L),this.debugBuffer=t.createVertexBuffer(r,Jr.members),this.debugSegments=Ke.simpleSegment(0,0,4,5);let a=new IT;a.emplaceBack(0,0,0,0),a.emplaceBack(L,0,L,0),a.emplaceBack(0,L,0,L),a.emplaceBack(L,L,L,L),this.rasterBoundsBuffer=t.createVertexBuffer(a,MF.members),this.rasterBoundsSegments=Ke.simpleSegment(0,0,4,2);let n=new Pr;n.emplaceBack(0,0),n.emplaceBack(L,0),n.emplaceBack(0,L),n.emplaceBack(L,L),this.rasterBoundsBufferPosOnly=t.createVertexBuffer(n,Jr.members),this.rasterBoundsSegmentsPosOnly=Ke.simpleSegment(0,0,4,5);let s=new Pr;s.emplaceBack(0,0),s.emplaceBack(1,0),s.emplaceBack(0,1),s.emplaceBack(1,1),this.viewportBuffer=t.createVertexBuffer(s,Jr.members),this.viewportSegments=Ke.simpleSegment(0,0,4,2);let o=new NT;o.emplaceBack(0),o.emplaceBack(1),o.emplaceBack(3),o.emplaceBack(2),o.emplaceBack(0),this.tileBorderIndexBuffer=t.createIndexBuffer(o);let l=new er;l.emplaceBack(1,0,2),l.emplaceBack(1,2,3),this.quadTriangleIndexBuffer=t.createIndexBuffer(l);let u=this.context.gl;this.stencilClearMode=new Ie({func:u.ALWAYS,mask:0},0,255,u.ZERO,u.ZERO,u.ZERO),this.tileExtentMesh=new ks(this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}clearStencil(){let t=this.context,i=t.gl;this.nextStencilID=1,this.currentStencilSource=void 0;let r=kr();Ni(r,0,this.width,this.height,0,0,1),At(r,r,[i.drawingBufferWidth,i.drawingBufferHeight,0]);let a={mainMatrix:r,tileMercatorCoords:[0,0,1,1],clippingPlane:[0,0,0,0],projectionTransition:0,fallbackMatrix:r,clipAntimeridian:!1};this.useProgram("clippingMask",null,!0).draw(t,i.TRIANGLES,be.disabled,this.stencilClearMode,nt.disabled,Pe.disabled,null,null,a,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}renderTileClippingMasks(t,i){if(this.currentStencilSource===t.source||!t.isTileClipped()||!(i!=null&&i.length))return;this.currentStencilSource=t.source,this.nextStencilID+i.length>256&&this.clearStencil();let r=this.context;r.setColorMode(nt.disabled),r.setDepthMode(be.disabled);let a={};for(let n of i)a[n.key]=this.nextStencilID++;this.style.projection.useSubdivision&&this._renderTileMasks(a,i,!0),this._renderTileMasks(a,i,!1),this._tileClippingMaskIDs=a}_renderTileMasks(t,i,r){let a=this.context,n=a.gl,s=this.style.projection,o=this.renderContext,l=this.useProgram("clippingMask");for(let u of i){let h=t[u.key],c=Wt(o,u),d=s.getMeshFromTileID(this.context,u.canonical,r,!0,"stencil"),p=Lt(o,u);l.draw(a,n.TRIANGLES,be.disabled,new Ie({func:n.ALWAYS,mask:0},h,255,n.KEEP,n.KEEP,n.REPLACE),nt.disabled,o.isRenderingToTexture?Pe.disabled:Pe.backCCW,null,c,p,"$clipping",d.vertexBuffer,d.indexBuffer,d.segments)}}_renderTilesDepthBuffer(){let t=this.context,i=t.gl,r=this.style.projection,a=this.transform,n=this.useProgram("depth"),s=this.getDepthModeFor3D(),o=pn(a,{tileSize:a.tileSize});for(let l of o){let u=Wt(this.renderContext,l),h=r.getMeshFromTileID(this.context,l.canonical,!0,!0,"raster"),c=Lt(this.renderContext,l);n.draw(t,i.TRIANGLES,s,Ie.disabled,nt.disabled,Pe.backCCW,null,u,c,"$clipping",h.vertexBuffer,h.indexBuffer,h.segments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();let t=this.nextStencilID++,i=this.context.gl;return new Ie({func:i.NOTEQUAL,mask:255},t,255,i.KEEP,i.KEEP,i.REPLACE)}stencilModeForClipping(t){let i=this.context.gl;return new Ie({func:i.EQUAL,mask:255},this._tileClippingMaskIDs[t.key],0,i.KEEP,i.KEEP,i.REPLACE)}getStencilConfigForOverlapAndUpdateStencilID(t){let i=this.context.gl,r=t.sort((s,o)=>o.overscaledZ-s.overscaledZ),a=r[r.length-1].overscaledZ,n=r[0].overscaledZ-a+1;if(n>1){this.currentStencilSource=void 0,this.nextStencilID+n>256&&this.clearStencil();let s={};for(let o=0;o<n;o++)s[o+a]=new Ie({func:i.GEQUAL,mask:255},o+this.nextStencilID,255,i.KEEP,i.KEEP,i.REPLACE);return this.nextStencilID+=n,[s,r]}return[{[a]:Ie.disabled},r]}stencilConfigForOverlapTwoPass(t){let i=this.context.gl,r=t.sort((s,o)=>o.overscaledZ-s.overscaledZ),a=r[r.length-1].overscaledZ,n=r[0].overscaledZ-a+1;if(this.clearStencil(),n>1){let s={},o={};for(let l=0;l<n;l++)s[l+a]=new Ie({func:i.GREATER,mask:255},n+1+l,255,i.KEEP,i.KEEP,i.REPLACE),o[l+a]=new Ie({func:i.GREATER,mask:255},1+l,255,i.KEEP,i.KEEP,i.REPLACE);return this.nextStencilID=n*2+1,[s,o,r]}
823return this.nextStencilID=3,[{[a]:new Ie({func:i.GREATER,mask:255},2,255,i.KEEP,i.KEEP,i.REPLACE)},{[a]:new Ie({func:i.GREATER,mask:255},1,255,i.KEEP,i.KEEP,i.REPLACE)},r]}colorModeForRenderPass(){let t=this.context.gl;if(this._showOverdrawInspector){let i=.125;return new nt([t.CONSTANT_COLOR,t.ONE],new de(i,i,i,0),[!0,!0,!0,!0])}return this.renderContext.currentPass==="opaque"?nt.unblended:nt.alphaBlended}getDepthModeForSublayer(t,i,r){if(!this.opaquePassEnabledForLayer())return be.disabled;let a=1-((1+this.renderContext.currentLayer)*this.numSublayers+t)*this.depthEpsilon;return new be(r||this.context.gl.LEQUAL,i,[a,a])}getDepthModeFor3D(){return new be(this.context.gl.LEQUAL,be.ReadWrite,this.renderContext.depthRangeFor3D)}opaquePassEnabledForLayer(){return this.renderContext.currentLayer<this.renderContext.opaquePassCutoff}render(t,i){var h;this.style=t,this.options=i;let r=this.renderContext=Sz(this.transform,t.projection,t.map.terrain??null);this.lineAtlas=t.lineAtlas,this.imageManager=t.imageManager,this.patternAtlas=t.patternAtlas,this.glyphManager=t.glyphManager,this.symbolFadeChange=t.placement.symbolFadeChange(Oe()),Tz(this.context.frameUniformBuffer,this),this.imageManager.beginFrame();let a=this.style._order,n=this.style.tileManagers,s={},o={},l={};for(let c in n){let d=n[c];d.used&&d.prepare(this.context),s[c]=d.getVisibleCoordinates(!1),o[c]=s[c].slice().reverse(),l[c]=d.getVisibleCoordinates(!0).reverse()}r.opaquePassCutoff=1/0;for(let c=0;c<a.length;c++){let d=a[c];if(this.style._layers[d].is3D()){r.opaquePassCutoff=c;break}}this.maybeDrawDepth(),this.renderToTexture&&(this.renderToTexture.prepareForRender(this.style,this.transform.zoom),r.opaquePassCutoff=0),r.currentPass="offscreen";for(let c of a){let d=this.style._layers[c];if(!d.hasOffscreenPass()||d.isHidden(this.transform.zoom))continue;let p=o[d.source];(d.type==="custom"||p.length)&&this.renderLayer(this,n[d.source],d,p,r)}if(this.context.viewport.set([0,0,this.width,this.height]),this.context.bindFramebuffer.set(null),this.context.clear({color:i.showOverdrawInspector?de.black:de.transparent,depth:1}),this.clearStencil(),this.style.sky&&this.drawFunctions.sky(this,this.style.sky),this._showOverdrawInspector=i.showOverdrawInspector,r.depthRangeFor3D=[0,1-(t._order.length+2)*this.numSublayers*this.depthEpsilon],!this.renderToTexture)for(r.currentPass="opaque",r.currentLayer=a.length-1;r.currentLayer>=0;r.currentLayer--){let c=this.style._layers[a[r.currentLayer]];if(c.isHidden(this.transform.zoom))continue;let d=n[c.source],p=s[c.source];this.renderTileClippingMasks(c,p),this.renderLayer(this,d,c,p,r)}r.currentPass="translucent";let u=!1;for(r.currentLayer=0;r.currentLayer<a.length;r.currentLayer++){let c=this.style._layers[a[r.currentLayer]];if(c.isHidden(this.transform.zoom))continue;let d=n[c.source];if((h=this.renderToTexture)!=null&&h.renderLayer(c,r))continue;!this.opaquePassEnabledForLayer()&&!u&&(u=!0,r.isRenderingGlobe&&!this.style.map.terrain&&this._renderTilesDepthBuffer());let p=(c.type==="symbol"?l:o)[c.source];this.renderTileClippingMasks(c,s[c.source]),this.renderLayer(this,d,c,p,r)}if(r.isRenderingGlobe&&this.drawFunctions.atmosphere(this,this.style.sky,this.style.light),this.options.showTileBoundaries){let c=pR(this.style,this.transform.zoom);c&&this.drawFunctions.debug(this,c,c.getVisibleCoordinates(),r)}this.options.showPadding&&this.drawFunctions.debugPadding(this),this.renderToTexture&&!this.options.moving&&this.clearRTTPool(),this.context.setDefault()}markTerrainDepthDirty(){this.terrainFacilitator.depthDirty=!0}maybeDrawDepth(){var a,n;if(!((a=this.style)!=null&&a.projection)||!((n=this.style.map)!=null&&n.terrain))return;let t=this.terrainFacilitator.matrix,i=this.transform.modelViewProjectionMatrix,r=this.terrainFacilitator.depthDirty;r||(r=!Fb(t,i)),r||(r=this.style.map.terrain.tileManager.anyTilesAfterTime(this.terrainFacilitator.renderTime)),r&&(Cb(t,i),this.terrainFacilitator.renderTime=Oe(),this.terrainFacilitator.depthDirty=!1,this.drawFunctions.terrainDepth(this,this.style.map.terrain))}renderLayer(t,i,r,a,n){if(r.isHidden(this.transform.zoom)||r.type!=="background"&&r.type!=="custom"&&!(a||[]).length)return;this.id=r.id;let s=this.drawFunctions;w1(r)?s.symbol(t,i,r,a,this.style.placement.variableOffsets,n):gE(r)?s.circle(t,i,r,a,n):bE(r)?s.heatmap(t,i,r,a,n):eD(r)?s.line(t,i,r,a,n):pS(r)?s.fill(t,i,r,a,n):BS(r)?s.fillExtrusion(t,i,r,a,n):DE(r)?s.hillshade(t,i,r,a,n):FE(r)?s.colorRelief(t,i,r,a,n):Gh(r)?s.raster(t,i,r,a,n):tP(r)?s.background(t,i,r,a,n):aP
823(r)&&s.custom(t,i,r,n)}saveTileTexture(t){let i=this._tileTextures[t.size[0]];i?i.length<na.MAX_TEXTURE_POOL_SIZE_PER_BUCKET?i.push(t):t.destroy():this._tileTextures[t.size[0]]=[t]}getTileTexture(t){let i=this._tileTextures[t];return i&&i.length>0?i.pop():null}acquireRTT(t){let i=this.context.gl,r=this._rttObjectRecyclePool.pop();if(r)return r.size!==t&&(r.texture.update({width:t,height:t,data:null},{premultiply:!1,useMipmap:!0}),r.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE,i.LINEAR_MIPMAP_LINEAR),this.context.extTextureFilterAnisotropic&&i.texParameterf(i.TEXTURE_2D,this.context.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,this.context.extTextureFilterAnisotropicMax),r.size=t),r;let a=new gt(this.context,{width:t,height:t,data:null},i.RGBA,{premultiply:!1,useMipmap:!0});return a.bind(i.LINEAR,i.CLAMP_TO_EDGE,i.LINEAR_MIPMAP_LINEAR),this.context.extTextureFilterAnisotropic&&i.texParameterf(i.TEXTURE_2D,this.context.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,this.context.extTextureFilterAnisotropicMax),{texture:a,size:t}}bindRTT(t){let i=this.context.gl,r=t.size;if(!this._rttSharedFbo){let a=this.context.createFramebuffer(r,r,!0,!0),n=this.context.createRenderbuffer(i.DEPTH_STENCIL,r,r);a.depthAttachment.set(n),this._rttSharedFbo={fbo:a,depthRenderbuffer:n,size:r}}this._rttSharedFbo.size!==r&&(this.context.bindRenderbuffer.set(this._rttSharedFbo.depthRenderbuffer),i.renderbufferStorage(i.RENDERBUFFER,i.DEPTH_STENCIL,r,r),this.context.bindRenderbuffer.set(null),this._rttSharedFbo.fbo.width=r,this._rttSharedFbo.fbo.height=r,this._rttSharedFbo.size=r),this._rttSharedFbo.fbo.colorAttachment.set(t.texture.texture),this.context.bindFramebuffer.set(this._rttSharedFbo.fbo.framebuffer)}releaseRTT(t){this._rttObjectRecyclePool.push(t)}clearRTTPool(){for(let t of this._rttObjectRecyclePool)t.texture.destroy();this._rttObjectRecyclePool.length=0}destroyRTTResources(){if(this.clearRTTPool(),!this._rttSharedFbo)return;this._rttSharedFbo.fbo.colorAttachment.set(null),this._rttSharedFbo.fbo.depthAttachment.set(null);let t=this.context.gl;t.deleteRenderbuffer(this._rttSharedFbo.depthRenderbuffer),t.deleteFramebuffer(this._rttSharedFbo.fbo.framebuffer),this._rttSharedFbo=null}isPatternMissing(t){if(!t)return!1;if(!t.from||!t.to)return!0;let i=this.patternAtlas.getPattern(t.from.toString()),r=this.patternAtlas.getPattern(t.to.toString());return!i||!r}useProgram(t,i,r=!1,a=[]){var m;this.cache||(this.cache={});let n=!!this.style.map.terrain,s=this.style.projection,o=r?qi.projectionMercator:s.shaderPreludeCode,l=r?zv:s.shaderDefine,u=`/${r?Rv:s.shaderVariantName}`,h=i?i.cacheKey:"",c=this._showOverdrawInspector?"/overdraw":"",d=n?"/terrain":"",p=a?`/${a.join("/")}`:"",f=t+h+u+c+d+p;return(m=this.cache)[f]||(m[f]=new ZF(this.context,qi[t],i,O5[t],this._showOverdrawInspector,n,o,l,a)),this.cache[f]}setCustomLayerDefaults(){this.context.setCustomLayerDefaults()}setBaseState(){let t=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(t.FUNC_ADD)}initDebugOverlayCanvas(){if(this.debugOverlayCanvas==null){this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512;let t=this.context.gl;this.debugOverlayTexture=new gt(this.context,this.debugOverlayCanvas,t.RGBA)}}destroy(){var t,i,r;if(this._tileTextures){for(let a in this._tileTextures){let n=this._tileTextures[a];if(n)for(let s of n)s.destroy()}this._tileTextures={}}if(this.destroyRTTResources(),(t=this.layerOpacityFbo)==null||t.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&&((i=this.tileExtentMesh.vertexBuffer)==null||i.destroy()),this.tileExtentMesh&&((r=this.tileExtentMesh.indexBuffer)==null||r.destroy()),this.debugOverlayTexture&&this.debugOverlayTexture.destroy(),this.context.projectionUniformBuffer.destroy(),this.context.terrainUniformBuffer.destroy(),this.context.frameUniformBuffer.destroy(),this.cache){for(let a in this.cache){let n=this.cache[a];n!=null&&n.program&&this.context.gl.deleteProgram(n.program)}this.cache={}}this.context&&this.context.setDefault()}overLimit(){let{drawingBufferWidth:t,drawingBufferHeight:i}=this.context.gl;return this.width!==t||this.height!==i}}
vendor: 35,896 bytes, line 823
823,na.MAX_TEXTURE_POOL_SIZE_PER_BUCKET=50,na),mx=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==null?void 0:t.statusMessage)??null}};function Mp(e,t){let i=!1,r=null,a,n=()=>{r=null,i&&(i=(e(...a),r=setTimeout(n,t),!1))};return(...s)=>(i=!0,a=s,r||n(),r)}var gx=class{constructor(e){this._getHashParams=()=>new URLSearchParams(window.location.hash.replace("#","")),this._getCurrentHash=()=>{let t=this._getHashParams();return this._hashName?(t.get(this._hashName)||"").split("/"):([...t.keys()][0]??"").split("/")},this._onHashChange=()=>{let t=this._getCurrentHash();if(!this._isValidHash(t))return!1;let i=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(t[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+t[2],+t[1]],zoom:+t[0],bearing:i,pitch:+(t[4]||0)}),!0},this._updateHashUnthrottled=()=>{let t=window.location.href.replace(/(#.*)?$/,this.getHashString());window.history.replaceState(window.history.state,null,t)},this._removeHash=()=>{let t=this._getHashParams();if(this._hashName)t.delete(this._hashName);else{let n=Array.from(t.keys());n.length>0&&t.delete(n[0])}let i=decodeURIComponent(t.toString()).replace(/=&/g,"&").replace(/=$/g,""),r=i?`#${i}`:"",a=window.location.href.replace(/(#.+)?$/,r);a=a.replace("&&","&"),window.history.replaceState(window.history.state,null,a)},this._updateHash=Mp(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(),i=Math.round(this._map.getZoom()*100)/100,r=10**Math.ceil((i*Math.LN2+Math.log(512/360/.5))/Math.LN10),a=Math.round(t.lng*r)/r,n=Math.round(t.lat*r)/r,s=this._map.getBearing(),o=this._map.getPitch(),l="";if(l+=e?`/${a}/${n}/${i}`:`${i}/${n}/${a}`,(s||o)&&(l+=`/${Math.round(s*10)/10}`),o&&(l+=`/${Math.round(o)}`),this._hashName){let u=this._getHashParams();return u.set(this._hashName,l),`#${decodeURIComponent(u.toString()).replace(/=&/g,"&").replace(/=$/g,"")}`}return`#${l}`}_isValidHash(e){if(e.length<3||e.some(a=>isNaN(+a)))return!1;try{new X(+e[2],+e[1])}catch{return!1}let t=+e[0],i=+(e[3]||0),r=+(e[4]||0);return t>=this._map.getMinZoom()&&t<=this._map.getMaxZoom()&&i>=-180&&i<=180&&r>=this._map.getMinPitch()&&r<=this._map.getMaxPitch()}};const Ls={linearity:.3,easing:pd(0,0,.3,1)},wR=W({deceleration:2500,maxSpeed:1400},Ls),TR=W({deceleration:20,maxSpeed:1400},Ls),ER=W({deceleration:1e3,maxSpeed:360},Ls),SR=W({deceleration:1e3,maxSpeed:90},Ls),DR=W({deceleration:1e3,maxSpeed:360},Ls);var CR=class{constructor(e){this._map=e,this.clear()}clear(){this._inertiaBuffer=[]}record(e){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:Oe(),settings:e})}_drainInertiaBuffer(){let e=this._inertiaBuffer,t=Oe();for(;e.length>0&&t-e[0].time>160;)e.shift()}_getVelocityEntries(){let e=this._inertiaBuffer,t=Oe()-60,i=Math.max(0,e.length-2);for(;i>0&&e[i-1].time>=t;)i--;return e.slice(i)}_onMoveEnd(e){this._drainInertiaBuffer();let t=this._getVelocityEntries();if(t.length<2){this.clear();return}let i={zoom:0,bearing:0,pitch:0,roll:0,pan:new A(0,0),pinchAround:void 0,around:void 0};for(let{settings:n}of t)n.around&&(i.around=n.around),n.pinchAround&&(i.pinchAround=n.pinchAround);for(let{settings:n}of t.slice(1))i.zoom+=n.zoomDelta||0,i.bearing+=n.bearingDelta||0,i.pitch+=n.pitchDelta||0,i.roll+=n.rollDelta||0,n.panDelta&&i.pan._add(n.panDelta);if(!i.pan.mag()&&!i.zoom&&!i.bearing&&!i.pitch&&!i.roll){this.clear();return}let r=Oe()-t[0].time,a={};if(i.pan.mag()){let n=Ln(i.pan.mag(),r,W({},wR,e||{})),s=i.pan.mult(n.amount/i.pan.mag()),o=this._map._camera.cameraHelper.handlePanInertia(s,this._map._camera.transform);a.center=o.easingCenter,a.offset=o.easingOffset,kn(a,n)}if(i.zoom){let n=Ln(i.zoom,r,TR);a.zoom=oi(this._map.getZoom()+n.amount,this._map.getZoomSnap(),n.amount),kn(a,n)}if(i.bearing){let n=Ln(i.bearing,r,ER);a.bearing=this._map.getBearing()+he(n.amount,-179,179),kn(a,n)}if(i.pitch){let n=Ln(i.pitch,r,SR);a.pitch=this._map.getPitch()+n.amount,kn(a,n)}if(i.roll){let n=Ln(i.roll,r,DR);a.roll=this._map.getRoll()+he(n.amount,-179,179),kn(a,n)}if(a.zoom||a.bearing){let n=i.pinchAround===void 0?i.around:i.pinchAround;a.around=n?this._map.unproject(n):this._map.getCenter()}return this.clear(),W(a,{noMoveStart:!0})}};function kn(e,t){(!e.duration||e.duration<t.duration)&&(e.duration=t.duration,e.easing=t.easing)}function Ln(e,t,i){let{maxSpeed:r,linearity:a,deceleration:n}=i,s=he(e*a/(t/1e3),-r,r),o=Math.abs(s)/(n*a);return{easing:i.easing,duration:o*1e3,amount:o/2*s}}var PR=class{constructor(e,t){this._map=e,this._clickTolerance=t.clickTolerance}reset(){delete this._mousedownPos}wheel(e){return this._firePreventable(new ev(this._map,e))}mousedown(e,t){return this._mousedownPos=t,this._firePreventable(new li(e.type,this._map,e))}mouseup(e){this._map.fire(new li(e.type,this._map,e))}click(e,t){this._mousedownPos&&this._mousedownPos.dist(t)>=this._clickTolerance||this._map.fire(new li(e.type,this._map,e))}dblclick(e){return this._firePreventable(new li(e.type,this._map,e))}mouseover(e){this._map.fire(new li(e.type,this._map,e))}mouseout(e){this._map.fire(new li(e.type,this._map,e))}touchstart(e){return this._firePreventable(new qn(e.type,this._map,e))}touchmove(e){this._map.fire(new qn(e.type,this._map,e))}touchend(e){this._map.fire(new qn(e.type,this._map,e))}touchcancel(e){this._map.fire(new qn(e.type,this._map,e))}_firePreventable(e){if(this._map.fire(e),e.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}},AR=class{constructor(e){this._map=e}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(e){this._map.fire(new li(e.type,this._map,e))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new li("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(e){this._delayContextMenu?this._contextMenuEvent=e:this._ignoreContextMenu||this._map.fire(new li(e.type,this._map,e)),this._map.listens("contextmenu")&&e.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}},_x=class{constructor(e,t,i){this._map=e,this._tr=i,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&&(ae.disableDrag(),this._startPos=this._lastPos=t,this._active=!0)}mousemoveWindow(e,t){if(!this._active)return;let i=t;if(this._lastPos.equals(i)||!this._box&&i.dist(this._startPos)<this._clickTolerance)return;let r=this._startPos;this._lastPos=i,this._box||(this._box=ae.create("div","maplibregl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair"),this._fireEvent("boxzoomstart",e));let a=Math.min(r.x,i.x),n=Math.max(r.x,i.x),s=Math.min(r.y,i.y),o=Math.max(r.y,i.y);this._box.style.transform=`translate(${a}px,${s}px)`,this._box.style.width=`${n-a}px`,this._box.style.height=`${o-s}px`}mouseupWindow(e,t){if(!this._active||e.button!==0)return;let i=this._startPos,r=t;if(this.reset(),ae.suppressClick(),i.x===r.x&&i.y===r.y)this._fireEvent("boxzoomcancel",e);else{if(this._map.fire(new Vc("boxzoomend",{originalEvent:e})),this._boxZoomEnd){this._boxZoomEnd(this._map,i,r,e);return}return{cameraAnimation:a=>a.fitScreenCoordinates(i,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=(this._box.remove(),null)),ae.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(e,t){return this._map.fire(new Vc(e,{originalEvent:t}))}};function td(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 i={};for(let r=0;r<e.length;r++)i[e[r].identifier]=t[r];return i}function IR(e){let t=new A(0,0);for(let i of e)t._add(i);return t.div(e.length)}var MR=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,i){(this.centroid||i.length>this.numTouches)&&(this.aborted=!0),!this.aborted&&(this.startTime===void 0&&(this.startTime=e.timeStamp),i.length===this.numTouches&&(this.centroid=IR(t),this.touches=td(i,t)))}touchmove(e,t,i){if(this.aborted||!this.centroid)return;let r=td(i,t);for(let a in this.touches){let n=this.touches[a],s=r[a];(!s||s.dist(n)>30)&&(this.aborted=!0)}}touchend(e,t,i){if((!this.centroid||e.timeStamp-this.startTime>500)&&(this.aborted=!0),i.length===0){let r=!this.aborted&&this.centroid;if(this.reset(),r)return r}}},id=class{constructor(e){this.singleTap=new MR(e),this.numTaps=e.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(e,t,i){this.singleTap.touchstart(e,t,i)}touchmove(e,t,i){this.singleTap.touchmove(e,t,i)}touchend(e,t,i){let r=this.singleTap.touchend(e,t,i);if(r){let a=e.timeStamp-this.lastTime<500,n=!this.lastTap||this.lastTap.dist(r)<30;if((!a||!n)&&this.reset(),this.count++,this.lastTime=e.timeStamp,this.lastTap=r,this.count===this.numTaps)return this.reset(),r}}},FR=class{constructor(e,t){this._tr=t,this._zoomIn=new id({numTouches:1,numTaps:2}),this._zoomOut=new id({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(e,t,i){this._zoomIn.touchstart(e,t,i),this._zoomOut.touchstart(e,t,i)}touchmove(e,t,i){this._zoomIn.touchmove(e,t,i),this._zoomOut.touchmove(e,t,i)}touchend(e,t,i){let r=this._zoomIn.touchend(e,t,i),a=this._zoomOut.touchend(e,t,i),n=this._tr;if(r)return this._active=!0,e.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:s=>s.easeTo({duration:300,zoom:oi(n.zoom+1,s.getZoomSnap()),around:n.unproject(r)},{originalEvent:e})};if(a)return this._active=!0,e.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:s=>s.easeTo({duration:300,zoom:oi(n.zoom-1,s.getZoomSnap()),around:n.unproject(a)},{originalEvent:e})}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}},Bs=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 i=this._lastPoint;if(!i)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(i)<this._clickTolerance))return this._moved=!0,this._lastPoint=r,this._move(i,r)}dragEnd(e){this.isEnabled()&&this._lastPoint&&this._moveStateManager.isValidEndEvent(e)&&(this._moved&&ae.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 zR={0:1,2:2};function RR(e,t){let i=zR[t];return e.buttons===void 0||(e.buttons&i)!==i}var Os=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!RR(e,this._eventButton)}isValidEndEvent(e){return e.button===this._eventButton}},kR=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)}},LR=class{constructor(e=new Os({checkCorrectEvent:()=>!0}),t=new kR){this.mouseMoveStateManager=e,this.oneFingerTouchMoveStateManager=t}_executeRelevantHandler(e,t,i){if(e instanceof MouseEvent)return t(e);if(typeof TouchEvent<"u"&&e instanceof TouchEvent)return i(e)}startMove(e){this._executeRelevantHandler(e,t=>{this.mouseMoveStateManager.startMove(t)},t=>{this.oneFingerTouchMoveStateManager.startMove(t)})}endMove(e){this._executeRelevantHandler(e,t=>{this.mouseMoveStateManager.endMove(t)},t=>{this.oneFingerTouchMoveStateManager.endMove(t)})}isValidStartEvent(e){return!!this._executeRelevantHandler(e,t=>this.mouseMoveStateManager.isValidStartEvent(t),t=>this.oneFingerTouchMoveStateManager.isValidStartEvent(t))}isValidMoveEvent(e){return!!this._executeRelevantHandler(e,t=>this.mouseMoveStateManager.isValidMoveEvent(t),t=>this.oneFingerTouchMoveStateManager.isValidMoveEvent(t))}isValidEndEvent(e){return!!this._executeRelevantHandler(e,t=>this.mouseMoveStateManager.isValidEndEvent(t),t=>this.oneFingerTouchMoveStateManager.isValidEndEvent(t))}};const ou=e=>{e.mousedown=e.dragStart,e.mousemoveWindow=e.dragMove,e.mouseup=e.dragEnd,e.contextmenu=t=>{t.preventDefault()}};function BR({enable:e,clickTolerance:t}){return new Bs({clickTolerance:t,move:(i,r)=>({around:r,panDelta:r.sub(i)}),activateOnStart:!0,moveStateManager:new Os({checkCorrectEvent:i=>i.button===0&&!i.ctrlKey}),enable:e,assignEvents:ou})}function OR({enable:e,clickTolerance:t,aroundCenter:i=!0,minPixelCenterThreshold:r=100,rotateSpeed:a=.8},n){return new Bs({clickTolerance:t,move:(s,o)=>{let l=n();if(i&&Math.abs(l.y-s.y)>r)return{bearingDelta:I_(new A(s.x,o.y),o,l)};let u=(o.x-s.x)*a;return i&&o.y<l.y&&(u=-u),{bearingDelta:u}},moveStateManager:new Os({checkCorrectEvent:s=>s.button===0&&s.ctrlKey||s.button===2&&!s.ctrlKey}),enable:e,assignEvents:ou})}function $R({enable:e,clickTolerance:t,pitchSpeed:i=-.5}){return new Bs({clickTolerance:t,move:(r,a)=>({pitchDelta:(a.y-r.y)*i}),moveStateManager:new Os({checkCorrectEvent:r=>r.button===0&&r.ctrlKey||r.button===2}),enable:e,assignEvents:ou})}function jR({enable:e,clickTolerance:t,rollDegreesPerPixelMoved:i=.3},r){return new Bs({clickTolerance:t,move:(a,n)=>{let s=r(),o=(n.x-a.x)*i;return n.y<s.y&&(o=-o),{rollDelta:o}},moveStateManager:new Os({checkCorrectEvent:a=>a.button===2&&a.ctrlKey}),enable:e,assignEvents:ou})}var VR=class{constructor(e,t){this._clickTolerance=e.clickTolerance||1,this._map=t,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new A(0,0)}_shouldBePrevented(e){return e<(this._map.cooperativeGestures.isEnabled()?2:1)}touchstart(e,t,i){return this._calculateTransform(e,t,i)}touchmove(e,t,i){if(this._active){if(this._shouldBePrevented(i.length)){this._map.cooperativeGestures.notifyGestureBlocked("touch_pan",e);return}return e.preventDefault(),this._calculateTransform(e,t,i)}}touchend(e,t,i){this._calculateTransform(e,t,i),this._active&&this._shouldBePrevented(i.length)&&this.reset()}touchcancel(){this.reset()}_calculateTransform(e,t,i){i.length>0&&(this._active=!0);let r=td(i,t),a=new A(0,0),n=new A(0,0),s=0;for(let l in r){let u=r[l],h=this._touches[l];h&&(a._add(u),n._add(u.sub(h)),s++,r[l]=u)}if(this._touches=r,this._shouldBePrevented(s)||!n.mag())return;let o=n.div(s);if(this._sum._add(o),!(this._sum.mag()<this._clickTolerance))return{around:a.div(s),panDelta:o}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}},Fp=class{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}touchstart(e,t,i){this._firstTwoTouches||i.length<2||(this._firstTwoTouches=[i[0].identifier,i[1].identifier],this._start([t[0],t[1]]))}touchmove(e,t,i){if(!this._firstTwoTouches)return;e.preventDefault();let[r,a]=this._firstTwoTouches,n=Fo(i,t,r),s=Fo(i,t,a);if(!n||!s)return;let o=this._aroundCenter?null:n.add(s).div(2);return this._move([n,s],o,e)}touchend(e,t,i){if(!this._firstTwoTouches)return;let[r,a]=this._firstTwoTouches,n=Fo(i,t,r),s=Fo(i,t,a);n&&s||(this._active&&ae.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 Fo(e,t,i){for(let r=0;r<e.length;r++)if(e[r].identifier===i)return t[r]}const l_=.1;function u_(e,t){return Math.log(e/t)/Math.LN2}var yx=class extends Fp{constructor(){super(),this._zoomRate=1,this._zoomThreshold=l_}setZoomRate(e){this._zoomRate=e??1}setZoomThreshold(e){this._zoomThreshold=e??l_}reset(){super.reset(),delete this._distance,delete this._startDistance}_start(e){this._startDistance=this._distance=e[0].dist(e[1])}_move(e,t){let i=this._distance;if(this._distance=e[0].dist(e[1]),!(!this._active&&Math.abs(u_(this._distance,this._startDistance))<this._zoomThreshold))return this._active=!0,{zoomDelta:u_(this._distance,i)*this._zoomRate,pinchAround:t}}};function h_(e,t){return e.angleWith(t)*180/Math.PI}var vx=class extends Fp{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,i){let r=this._vector;if(this._vector=e[0].sub(e[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:h_(this._vector,r),pinchAround:t}}_isBelowThreshold(e){this._minDiameter=Math.min(this._minDiameter,e.mag());let t=25/(Math.PI*this._minDiameter)*360,i=h_(e,this._startVector);return Math.abs(i)<t}};function yh(e){return Math.abs(e.y)>Math.abs(e.x)}var xx=class extends Fp{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,i){super.touchstart(e,t,i),this._currentTouchCount=i.length}_start(e){this._lastPoints=e,yh(e[0].sub(e[1]))&&(this._valid=!1)}_move(e,t,i){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;let r=e[0].sub(this._lastPoints[0]),a=e[1].sub(this._lastPoints[1]);if(this._valid=this.gestureBeginsVertically(r,a,i.timeStamp),this._valid)return this._lastPoints=e,this._active=!0,{pitchDelta:(r.y+a.y)/2*-.5}}gestureBeginsVertically(e,t,i){if(this._valid!==void 0)return this._valid;let r=e.mag()>=2,a=t.mag()>=2;if(!r&&!a)return;if(!r||!a)return this._firstMove===void 0&&(this._firstMove=i),i-this._firstMove<100&&void 0;let n=e.y>0==t.y>0;return yh(e)&&yh(t)&&n}};const NR={panStep:100,bearingStep:15,pitchStep:10};var bx=class{constructor(e,t){this._tr=t;let i=NR;this._panStep=i.panStep,this._bearingStep=i.bearingStep,this._pitchStep=i.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(e){if(e.altKey||e.ctrlKey||e.metaKey)return;let t=0,i=0,r=0,a=0,n=0;switch(e.keyCode){case 61:case 107:case 171:case 187:t=1;break;case 189:case 109:case 173:t=-1;break;case 37:e.shiftKey?i=-1:(e.preventDefault(),a=-1);break;case 39:e.shiftKey?i=1:(e.preventDefault(),a=1);break;case 38:e.shiftKey?r=1:(e.preventDefault(),n=-1);break;case 40:e.shiftKey?r=-1:(e.preventDefault(),n=1);break;default:return}return this._rotationDisabled&&(i=0,r=0),{cameraAnimation:s=>{let o=this._tr;s.easeTo({duration:300,easeId:"keyboardHandler",easing:UR,zoom:t?oi(o.zoom+t*(e.shiftKey?2:1),s.getZoomSnap()):o.zoom,bearing:o.bearing+i*this._bearingStep,pitch:o.pitch+r*this._pitchStep,offset:[-a*this._panStep,-n*this._panStep],center:o.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 UR(e){return e*(2-e)}const c_=4.000244140625;var wx=class{constructor(e,t,i){this._onTimeout=r=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(r)},this._map=e,this._tr=i,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,i=Oe(),r=i-(this._lastWheelEventTime||0);this._lastWheelEventTime=i,t!==0&&t%c_==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=ae.mousePos(this._map.getCanvas(),e),i=this._tr;this._aroundPoint=this._aroundCenter?i.transform.locationToScreenPoint(X.convert(i.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 s=e.zoom-this._lastExpectedZoom;typeof this._startZoom=="number"&&(this._startZoom+=s),typeof this._targetZoom=="number"&&(this._targetZoom+=s)}if(this._delta!==0){let s=this._type==="wheel"&&Math.abs(this._delta)>c_?this._wheelZoomRate:this._defaultZoomRate,o=2/(1+Math.exp(-Math.abs(this._delta*s)));this._delta<0&&o!==0&&(o=1/o);let l=typeof this._targetZoom=="number"?Gt(this._targetZoom):e.scale,u=e.applyConstrain(e.getCameraLngLat(),zt(l*o)).zoom,h=this._map.getZoomSnap();if(this._type==="wheel"&&h>0){let c=oi(e.zoom,h);this._targetZoom=oi(u,h,u-c)}else this._targetZoom=u;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,i=this._startZoom,r=this._easing,a=!1,n;if(this._type==="wheel"&&i&&r){let s=Oe()-this._lastWheelEventTime,o=Math.min((s+5)/200,1),l=r(o);n=Je.number(i,t,l),o<1?this._needsRerender=!0:a=!0}else n=t,a=!0;return this._active=!0,a&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._lastExpectedZoom,delete this._finishTimeout},200)),this._lastExpectedZoom=n,{noInertia:!0,needsRenderFrame:!a,zoomDelta:n-e.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(e){let t=Dh;if(this._prevEase){let i=this._prevEase,r=(Oe()-i.start)/i.duration,a=i.easing(r+.01)-i.easing(r),n=.27/Math.sqrt(a*a+1e-4)*.01,s=Math.sqrt(.0729-n*n);t=pd(n,s,.25,1)}return this._prevEase={start:Oe(),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)}},Tx=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()}},GR=class{constructor(e,t){this._tr=t,this.reset()}reset(){this._active=!1}dblclick(e,t){return e.preventDefault(),{cameraAnimation:i=>{i.easeTo({duration:300,zoom:oi(this._tr.zoom+(e.shiftKey?-1:1),i.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}},ZR=class{constructor(){this._tap=new id({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,i){if(!this._swipePoint)if(!this._tapTime)this._tap.touchstart(e,t,i);else{let r=t[0],a=e.timeStamp-this._tapTime<500,n=this._tapPoint.dist(r)<30;!a||!n?this.reset():i.length>0&&(this._swipePoint=r,this._swipeTouch=i[0].identifier)}}touchmove(e,t,i){if(!this._tapTime)this._tap.touchmove(e,t,i);else if(this._swipePoint){if(i[0].identifier!==this._swipeTouch)return;let r=t[0],a=r.y-this._swipePoint.y;return this._swipePoint=r,e.preventDefault(),this._active=!0,{zoomDelta:a/128*this._zoomRate}}}touchend(e,t,i){if(this._tapTime)this._swipePoint&&i.length===0&&this.reset();else{let r=this._tap.touchend(e,t,i);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}},Ex=class{constructor(e,t,i){this._el=e,this._mousePan=t,this._touchPan=i}enable(e){this._inertiaOptions=e||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("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()}},Sx=class{constructor(e,t,i,r){this._pitchWithRotate=e.pitchWithRotate,this._rollEnabled=e.rollEnabled,this._mouseRotate=t,this._mousePitch=i,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()}},Dx=class{constructor(e,t,i,r){this._el=e,this._touchZoom=t,this._touchRotate=i,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()}},Cx=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=ae.create("div","maplibregl-cooperative-gesture-screen",e);let t=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");this._bypassKey==="metaKey"&&(t=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));let i=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),r=document.createElement("div");r.className="maplibregl-desktop-message",r.textContent=t,this._container.appendChild(r);let a=document.createElement("div");a.className="maplibregl-mobile-message",a.textContent=i,this._container.appendChild(a),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 bt("cooperativegestureprevented",{gestureType:e,originalEvent:t})),this._container.classList.add("maplibregl-show"),setTimeout(()=>{this._container.classList.remove("maplibregl-show")},100))}},qR=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(A.convert(e),this._camera.terrain)}};const zo=e=>e.zoom||e.drag||e.roll||e.pitch||e.rotate;var WR=class extends ci{};function vh(e){var t;return((t=e.panDelta)==null?void 0:t.mag())||e.zoomDelta||e.bearingDelta||e.pitchDelta||e.rollDelta}var HR=class{get _ownerDocument(){var e;return((e=this._el)==null?void 0:e.ownerDocument)||document}get _ownerWindow(){var e,t;return((t=(e=this._el)==null?void 0:e.ownerDocument)==null?void 0:t.defaultView)||window}constructor(e,t,i){this._terrainGestureAnchorElevation=null,this.handleWindowEvent=a=>{this.handleEvent(a,`${a.type}Window`)},this.handleEvent=(a,n)=>{if(a.type==="blur"){this.stop(!0);return}this._updatingCamera=!0;let s=a.type==="renderFrame"?void 0:a,o={needsRenderFrame:!1},l={},u={};for(let{handlerName:d,handler:p,allowed:f}of this._handlers){if(!p.isEnabled())continue;let m;if(this._blockedByActive(u,f,d))p.reset();else if(p[n||a.type]){if(pw(a,n||a.type)){let g=ae.mousePos(this._map.getCanvas(),a);m=p[n||a.type](a,g)}else if(dw(a,n||a.type)){let g=a.touches,_=this._getMapTouches(g),y=ae.touchPos(this._map.getCanvas(),_);m=p[n||a.type](a,y,_)}else fw(n||a.type)||(m=p[n||a.type](a));this.mergeHandlerResult(o,l,m,d,s),m!=null&&m.needsRenderFrame&&this._triggerRenderFrame()}(m||p.isActive())&&(u[d]=p)}let h={};for(let d in this._previousActiveHandlers)u[d]||(h[d]=s);this._previousActiveHandlers=u,(Object.keys(h).length||vh(o))&&(this._changes.push([o,l,h]),this._triggerRenderFrame()),(Object.keys(u).length||vh(o))&&this._camera.stop(!0),this._updatingCamera=!1;let{cameraAnimation:c}=o;c&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],c(this._map))},this._map=e,this._camera=t,this._transformProvider=new qR(this._camera),this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new CR(e),this._bearingSnap=i.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(i);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[a,n,s]of this._listeners)a.addEventListener(n,a===this._ownerDocument?this.handleWindowEvent:this.handleEvent,s)}destroy(){for(let[e,t,i]of this._listeners)e.removeEventListener(t,e===this._ownerDocument?this.handleWindowEvent:this.handleEvent,i)}_addDefaultHandlers(e){let t=this._map,i=t.getCanvasContainer();this._add("mapEvent",new PR(t,e));let r=t.boxZoom=new _x(t,e,this._transformProvider);this._add("boxZoom",r),e.interactive&&e.boxZoom&&r.enable();let a=t.cooperativeGestures=new Cx(t,e.cooperativeGestures);this._add("cooperativeGestures",a),e.cooperativeGestures&&a.enable();let n=new FR(t,this._transformProvider),s=new GR(t,this._transformProvider);t.doubleClickZoom=new Tx(s,n),this._add("tapZoom",n),this._add("clickZoom",s),e.interactive&&e.doubleClickZoom&&t.doubleClickZoom.enable();let o=new ZR;this._add("tapDragZoom",o);let l=t.touchPitch=new xx(t);this._add("touchPitch",l),e.interactive&&e.touchPitch&&t.touchPitch.enable(e.touchPitch);let u=()=>t.project(t.getCenter()),h=OR(e,u),c=$R(e),d=jR(e,u);t.dragRotate=new Sx(e,h,c,d),this._add("mouseRotate",h,["mousePitch"]),this._add("mousePitch",c,["mouseRotate","mouseRoll"]),this._add("mouseRoll",d,["mousePitch"]),e.interactive&&e.dragRotate&&t.dragRotate.enable();let p=BR(e),f=new VR(e,t);t.dragPan=new Ex(i,p,f),this._add("mousePan",p),this._add("touchPan",f,["touchZoom","touchRotate"]),e.interactive&&e.dragPan&&t.dragPan.enable(e.dragPan);let m=new vx,g=new yx;t.touchZoomRotate=new Dx(i,g,m,o),this._add("touchRotate",m,["touchPan","touchZoom"]),this._add("touchZoom",g,["touchPan","touchRotate"]),e.interactive&&e.touchZoomRotate&&t.touchZoomRotate.enable(e.touchZoomRotate),this._add("blockableMapEvent",new AR(t));let _=t.scrollZoom=new wx(t,()=>this._triggerRenderFrame(),this._transformProvider);this._add("scrollZoom",_,["mousePan"]),e.interactive&&e.scrollZoom&&t.scrollZoom.enable(e.scrollZoom);let y=t.keyboard=new bx(t,this._transformProvider);this._add("keyboard",y),e.interactive&&e.keyboard&&t.keyboard.enable()}_add(e,t,i){this._handlers.push({handlerName:e,handler:t,allowed:i}),this._handlersById[e]=t}stop(e){if(!this._updatingCamera){for(let{handler:t}of this._handlers)t.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!!zo(this._eventsInProgress)||this.isZooming()}_blockedByActive(e,t,i){for(let r in e)if(r!==i&&!(t!=null&&t.includes(r)))return!0;return!1}_getMapTouches(e){let t=[];for(let i of e){let r=i.target;this._el.contains(r)&&t.push(i)}return t}mergeHandlerResult(e,t,i,r,a){if(!i)return;
823W(e,i);let n={handlerName:r,originalEvent:i.originalEvent||a};i.zoomDelta!==void 0&&(t.zoom=n),i.panDelta!==void 0&&(t.drag=n),i.rollDelta!==void 0&&(t.roll=n),i.pitchDelta!==void 0&&(t.pitch=n),i.bearingDelta!==void 0&&(t.rotate=n)}_applyChanges(){let e={},t={},i={};for(let[r,a,n]of this._changes)r.panDelta&&(e.panDelta=(e.panDelta||new A(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),W(t,a),W(i,n);this._updateMapTransform(e,t,i),this._changes=[]}_updateMapTransform(e,t,i){let r=this._map,a=this._camera.getTransformForUpdate(),n=r.terrain;if(!vh(e)&&!(n&&this._terrainMovement)){this._fireEvents(t,i,!0);return}this._camera.stop(!0);let{panDelta:s,zoomDelta:o,bearingDelta:l,pitchDelta:u,rollDelta:h}=e,{around:c,aroundOnSurface:d}=this._resolveAround(e,n,a),p=n?this._terrainGestureElevation(n,c,d,a,t):void 0,f={panDelta:s,zoomDelta:o,rollDelta:h,pitchDelta:u,bearingDelta:l,around:c,aroundElevation:p};this._camera.cameraHelper.useGlobeControls&&!a.isPointOnMapSurface(c)&&(c=a.centerPoint);let m=this._computePreZoomAroundLoc(a,c,s,p);this._handleMapControls({terrain:n,tr:a,deltasForHelper:f,preZoomAroundLoc:m,combinedEventsInProgress:t,panDelta:s}),this._camera.applyUpdatedTransform(a),this._map._update(),e.noInertia||this._inertia.record(e),this._fireEvents(t,i,!0)}_resolveAround(e,t,i){let r=e.pinchAround===void 0?e.around:e.pinchAround;return r||(r=this._camera.transform.centerPoint),t&&!i.isPointOnMapSurface(r)?{around:i.centerPoint,aroundOnSurface:!1}:{around:r,aroundOnSurface:!0}}_terrainGestureElevation(e,t,i,r,a){if(!i)return;if(!this._terrainMovement&&(a.drag||a.zoom)){let s=r.screenTerrainPointToMercatorCoordinate(t,e);this._terrainGestureAnchorElevation=s?s.z:null}if(this._terrainGestureAnchorElevation===null)return;let n=this._terrainGestureAnchorElevation;if(!(t.distSqr(r.centerPoint)<.01)&&!(n-r.elevation>=.9*(r.getCameraAltitude()-r.elevation)))return n}_computePreZoomAroundLoc(e,t,i,r){if(t.distSqr(e.centerPoint)<.01)return e.center;let a=i?t.sub(i):t;return r===void 0?e.screenPointToLocation(a):e.screenPointToLocationAtElevation(a,r)}_handleMapControls({terrain:e,tr:t,deltasForHelper:i,preZoomAroundLoc:r,combinedEventsInProgress:a,panDelta:n}){let s=this._camera.cameraHelper;if(s.handleMapControlsRollPitchBearingZoom(i,t),!e){s.handleMapControlsPan(i,t,r);return}if(s.useGlobeControls){!this._terrainMovement&&(a.drag||a.zoom)&&(this._terrainMovement=!0,this._camera.elevationFreeze=!0),s.handleMapControlsPan(i,t,r);return}if(!this._terrainMovement&&(a.drag||a.zoom)){this._terrainMovement=!0,this._camera.elevationFreeze=!0,s.handleMapControlsPan(i,t,r);return}if(i.aroundElevation===void 0&&a.drag&&this._terrainMovement&&n){t.setCenter(t.screenPointToLocation(t.centerPoint.sub(n)));return}s.handleMapControlsPan(i,t,r)}_fireEvents(e,t,i){let r=zo(this._eventsInProgress),a=zo(e),n={};for(let h in e){let{originalEvent:c}=e[h];this._eventsInProgress[h]||(n[`${h}start`]=c),this._eventsInProgress[h]=e[h]}!r&&a&&this._fireEvent("movestart",a.originalEvent);for(let h in n)this._fireEvent(h,n[h]);a&&this._fireEvent("move",a.originalEvent);for(let h in e){let{originalEvent:c}=e[h];this._fireEvent(h,c)}let s={},o;for(let h in this._eventsInProgress){let{handlerName:c,originalEvent:d}=this._eventsInProgress[h];this._handlersById[c].isActive()||(delete this._eventsInProgress[h],o=t[c]||d,s[`${h}end`]=o)}for(let h in s)this._fireEvent(h,s[h]);let l=zo(this._eventsInProgress),u=(r||a)&&!l;if(u&&this._terrainMovement){this._camera.elevationFreeze=!1,this._terrainMovement=!1,this._terrainGestureAnchorElevation=null;let h=this._camera.getTransformForUpdate();this._map.getCenterClampedToGround()&&h.recalculateZoomAndCenter(this._map.terrain),this._camera.applyUpdatedTransform(h)}if(i&&u){this._updatingCamera=!0;let h=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),c=d=>d!==0&&-this._bearingSnap<d&&d<this._bearingSnap;h&&(h.essential||!qt.prefersReducedMotion)?(c(h.bearing||this._map.getBearing())&&
vendor: 23,605 bytes, line 823
823(h.bearing=0),h.freezeElevation=!0,this._map.easeTo(h,{originalEvent:o})):(this._map.fire(new Y("moveend",{originalEvent:o})),c(this._map.getBearing())&&this._map.resetNorth()),this._updatingCamera=!1}}_fireEvent(e,t){this._map.fire(new Y(e,t?{originalEvent:t}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(e=>{delete this._frameId,this.handleEvent(new WR("renderFrame",{timeStamp:e})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}},XR=class extends _t{constructor(e){super(),this._renderFrameCallback=()=>{let t=Math.min((Oe()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(t)),t<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this.transform=new El,this.cameraHelper=new Sl,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 i=e.clone();i.apply(this._requestedCameraState,!0),this._requestedCameraState=i}}getCenter(){return new X(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,i){return e=A.convert(e).mult(-1),this.panTo(this.transform.center,W({offset:e},t),i)}panTo(e,t,i){return this.easeTo(W({center:e},t),i)}getZoom(){return this.transform.zoom}setZoom(e,t){return this.jumpTo({zoom:e},t),this}zoomTo(e,t,i){return this.easeTo(W({zoom:e},t),i)}zoomIn(e,t){return this.zoomTo(oi(this.getZoom()+1,this._zoomSnap),e,t),this}zoomOut(e,t){return this.zoomTo(oi(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 Y("movestart",t)).fire(new Y("move",t)).fire(new Y("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,i){return this.easeTo(W({bearing:e},t),i)}resetNorth(e,t){return this.rotateTo(0,W({duration:1e3},e),t),this}resetNorthPitch(e,t){return this.easeTo(W({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=ki.convert(e).adjustAntiMeridian();let i=(t==null?void 0:t.bearing)||0;return this._cameraForBoxAndBearing(e.getNorthWest(),e.getSouthEast(),i,t)}_cameraForBoxAndBearing(e,t,i,r){let a={top:0,bottom:0,right:0,left:0};if(r=W({padding:a,offset:[0,0],maxZoom:this.transform.maxZoom},r),typeof r.padding=="number"){let u=r.padding;r.padding={top:u,bottom:u,right:u,left:u}}let n=W(a,r.padding);r.padding=n;let s=this.transform,o=new ki(e,t),l=this.cameraHelper.cameraForBoxAndBearing(r,n,o,i,s);return l&&this._zoomSnap&&(l.zoom=oi(l.zoom,this._zoomSnap,-1)),l}fitBounds(e,t,i){return this._fitInternal(this.cameraForBounds(e,t),t,i)}fitScreenCoordinates(e,t,i,r,a){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.screenPointToLocation(A.convert(e)),this.transform.screenPointToLocation(A.convert(t)),i,r),r,a)}_fitInternal(e,t,i){return e?(t=W(e,t),delete t.padding,t.linear?this.easeTo(t,i):this.flyTo(t,i)):this}jumpTo(e,t){this.stop(),e.zoom!==void 0&&this._zoomSnap&&(e.zoom=oi(e.zoom,this._zoomSnap));let i=this.getTransformForUpdate(),r=!1,a=!1,n=!1,s=i.zoom;this.terrain&&i.setElevation(this.terrain.getElevationForLngLat(e.center?X.convert(e.center):i.center,i)),this.cameraHelper.handleJumpToCenterZoom(i,e);let o=i.zoom!==s;return e.elevation!==void 0&&i.elevation!==+e.elevation&&i.setElevation(+e.elevation),e.bearing!==void 0&&i.bearing!==+e.bearing&&(r=!0,i.setBearing(+e.bearing)),e.pitch!==void 0&&i.pitch!==+e.pitch&&(a=!0,i.setPitch(+e.pitch)),e.roll!==void 0&&i.roll!==+e.roll&&(n=!0,i.setRoll(+e.roll)),e.padding!=null&&!i.isPaddingEqual(e.padding)&&i.setPadding(e.padding),this.applyUpdatedTransform(i),this.fire(new Y("movestart",t)).fire(new Y("move",t)),o&&this.fire(new Y("zoomstart",t)).fire(new Y("zoom",t)).fire(new Y("zoomend",t)),r&&this.fire(new Y("rotatestart",t)).fire(new Y("rotate",t)).fire(new Y("rotateend",t)),a&&this.fire(new Y("pitchstart",t)).fire(new Y("pitch",t)).fire(new Y("pitchend",t)),n&&this.fire(new Y("rollstart",t)).fire(new Y("roll",t)).fire(new Y("rollend",t)),this.fire(new Y("moveend",t))}calculateCameraOptionsFromCameraLngLatAltRotation(e,t,i,r,a){let n=this.transform.calculateCenterFromCameraLngLatAlt(e,t,i,r);return{center:n.center,elevation:n.elevation,zoom:n.zoom,bearing:i,pitch:r,roll:a}}easeTo(e,t){this._stop(!1,e.easeId),e=W({offset:[0,0],duration:500,easing:Dh},e),e.zoom!==void 0&&this._zoomSnap&&(e.zoom=oi(e.zoom,this._zoomSnap)),(e.animate===!1||!e.essential&&qt.prefersReducedMotion)&&(e.duration=0);let i=this.getTransformForUpdate(),r=this.getBearing(),a=i.pitch,n=i.roll,s=e.bearing===void 0?r:this._normalizeBearing(e.bearing,r),o=e.pitch===void 0?a:+e.pitch,l=e.roll===void 0?n:this._normalizeBearing(e.roll,n),u=e.padding===void 0?i.padding:e.padding,h=A.convert(e.offset),c,d;e.around&&(c=X.convert(e.around),d=i.locationToScreenPoint(c));let p={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching,rolling:this._rolling},f=this.cameraHelper.handleEaseTo(i,{bearing:s,pitch:o,roll:l,padding:u,around:c,aroundPoint:d,offsetAsPoint:h,offset:e.offset,zoom:e.zoom,center:e.center});return this._rotating||(this._rotating=r!==s),this._pitching||(this._pitching=o!==a),this._rolling||(this._rolling=l!==n),this._padding=!i.isPaddingEqual(u),this._zooming||(this._zooming=f.isZooming),this._easeId=e.easeId,this._prepareEase(t,e.noMoveStart,p),this.terrain&&this._prepareElevation(f.elevationCenter),this._ease(m=>{f.easeFunc(m),this.terrain&&!e.freezeElevation&&this._updateElevation(m),this.applyUpdatedTransform(i),this._fireMoveEvents(t)},m=>{this.terrain&&e.freezeElevation&&this._finalizeElevation(),this._afterEase(t,m)},e),this}_prepareEase(e,t,i={}){this._moving=!0,!t&&!i.moving&&this.fire(new Y("movestart",e)),this._zooming&&!i.zooming&&this.fire(new Y("zoomstart",e)),this._rotating&&!i.rotating&&this.fire(new Y("rotatestart",e)),this._pitching&&!i.pitching&&this.fire(new Y("pitchstart",e)),this._rolling&&!i.rolling&&this.fire(new Y("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 i=this._elevationTarget-this._elevationStart,r=(t-(i*e+this._elevationStart))/(1-e);this._elevationStart+=e*(i-r),this._elevationTarget=t}this.transform.setElevation(Je.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._requestedCameraState=this.transform.clone()),this._requestedCameraState)}_elevateCameraIfInsideTerrain(e){if(!this.terrain&&e.elevation>=0&&e.pitch<=90)return{};let t=e.getCameraLngLat(),i=e.getCameraAltitude(),r=this.terrain?this.terrain.getElevationForLngLatZoom(t,e.zoom):0;if(i<r){let a=e.calculateCameraOptionsFromTo(t,r,e.center,e.elevation);return{pitch:a.pitch,zoom:a.zoom}}return{}}applyUpdatedTransform(e){let t=[];if(t.push(r=>this._elevateCameraIfInsideTerrain(r)),this.transformCameraUpdate&&t.push(r=>this.transformCameraUpdate(r)),!t.length)return;let i=e.clone();for(let r of t){let a=i.clone(),{center:n,zoom:s,roll:o,pitch:l,bearing:u,elevation:h}=r(a);n&&a.setCenter(n),h!==void 0&&a.setElevation(h),s!==void 0&&a.setZoom(s),o!==void 0&&a.setRoll(o),l!==void 0&&a.setPitch(l),u!==void 0&&a.setBearing(u),i.apply(a,!1)}this.transform.apply(i,!1)}_fireMoveEvents(e){this.fire(new Y("move",e)),this._zooming&&this.fire(new Y("zoom",e)),this._rotating&&this.fire(new Y("rotate",e)),this._pitching&&this.fire(new Y("pitch",e)),this._rolling&&this.fire(new Y("roll",e))}_afterEase(e,t){if(this._easeId&&t&&this._easeId===t)return;delete this._easeId;let i=this._zooming,r=this._rotating,a=this._pitching,n=this._rolling;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._rolling=!1,this._padding=!1,i&&this.fire(new Y("zoomend",e)),r&&this.fire(new Y("rotateend",e)),a&&this.fire(new Y("pitchend",e)),n&&this.fire(new Y("rollend",e)),this.fire(new Y("moveend",e))}flyTo(e,t){if(!e.essential&&qt.prefersReducedMotion){let D=ws(e,["center","zoom","bearing","pitch","roll","elevation","padding"]);return this.jumpTo(D,t)}this.stop(),e=W({offset:[0,0],speed:1.2,curve:1.42,easing:Dh},e),e.zoom!==void 0&&this._zoomSnap&&(e.zoom=oi(e.zoom,this._zoomSnap));let i=this.getTransformForUpdate(),r=i.bearing,a=i.pitch,n=i.roll,s=i.padding,o=e.bearing===void 0?r:this._normalizeBearing(e.bearing,r),l=e.pitch===void 0?a:+e.pitch,u=e.roll===void 0?n:this._normalizeBearing(e.roll,n),h=e.padding===void 0?i.padding:e.padding,c=A.convert(e.offset),d=i.centerPoint.add(c),p=i.screenPointToLocation(d),f=this.cameraHelper.handleFlyTo(i,{bearing:o,pitch:l,roll:u,padding:h,locationAtOffset:p,offsetAsPoint:c,center:e.center,minZoom:e.minZoom,zoom:e.zoom}),m=e.curve,g=Math.max(i.width,i.height),_=g/f.scaleOfZoom,y=f.pixelPathLength,x=g/f.scaleOfMinZoom;m=Math.min(m,Math.sqrt(x/y*2));let v=m*m;function w(D){let I=(_*_-g*g+(D?-1:1)*v*v*y*y)/(2*(D?_:g)*v*y);return Math.log(Math.sqrt(I*I+1)-I)}function b(D){return(Math.exp(D)-Math.exp(-D))/2}function T(D){return(Math.exp(D)+Math.exp(-D))/2}function P(D){return b(D)/T(D)}let S=w(!1),M=function(D){return T(S)/T(S+m*D)},k=function(D){return g*((T(S)*P(S+m*D)-b(S))/v)/y},R=(w(!0)-S)/m;if(Math.abs(y)<2e-6||!isFinite(R)){if(Math.abs(g-_)<1e-6)return this.easeTo(e,t);let D=_<g?-1:1;R=Math.abs(Math.log(_/g))/m,k=()=>0,M=I=>Math.exp(D*m*I)}if(e.duration!==void 0)e.duration=+e.duration;else{let D=e.screenSpeed===void 0?+e.speed:+e.screenSpeed/m;e.duration=1e3*R/D}return e.maxDuration&&e.duration>e.maxDuration&&(e.duration=0),this._zooming=!0,this._rotating=r!==o,this._pitching=l!==a,this._rolling=u!==n,this._padding=!i.isPaddingEqual(h),this._prepareEase(t,!1),this.terrain&&this._prepareElevation(f.targetCenter),this._ease(D=>{let I=D*R,C=1/M(I),E=k(I);this._rotating&&i.setBearing(Je.number(r,o,D)),this._pitching&&i.setPitch(Je.number(a,l,D)),this._rolling&&i.setRoll(Je.number(n,u,D)),this._padding&&(i.interpolatePadding(s,h,D),d=i.centerPoint.add(c)),f.easeFunc(D,C,E,d),this.terrain&&!e.freezeElevation&&this._updateElevation(D),this.applyUpdatedTransform(i),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 i=this._onEaseEnd;delete this._onEaseEnd,i.call(this,t)}return e||this._stopHandlers(),this}_ease(e,t,i){i.animate===!1||i.duration===0?(e(1),t()):(this._easeStart=Oe(),this._easeOptions=i,this._onEaseFrame=e,this._onEaseEnd=t,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(e,t){e=bi(e,-180,180);let i=Math.abs(e-t);return Math.abs(e-360-t)<i&&(e-=360),Math.abs(e+360-t)<i&&(e+=360),e}isMoving(){return this._moving}isZooming(){return this._zooming}isRotating(){return this._rotating}};const Px={compact:!0,customAttribution:'<a href="https://maplibre.org/" target="_blank">MapLibre</a>'};var Ax=class{constructor(e=Px){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=t=>{t&&(t.type==="terrain"||t.dataType==="style"||t.dataType==="source"&&(t.sourceDataType==="metadata"||t.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=ae.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=ae.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=ae.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 i=this._map._getUIString(`AttributionControl.${t}`);e.title=i,e.setAttribute("aria-label",i)}_updateAttributions(){if(!this._map.style)return;let e=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?e=e.concat(this.options.customAttribution.map(r=>typeof r=="string"?r:"")):typeof this.options.customAttribution=="string"&&e.push(this.options.customAttribution)),this._map.style.stylesheet){let r=this._map.style.stylesheet;this.styleOwner=r.owner,this.styleId=r.id}let t=this._map.style.tileManagers;for(let r in t){let a=t[r];if(a.used||a.usedForTerrain){let n=a.getSource();n.attribution&&!e.includes(n.attribution)&&e.push(n.attribution)}}e=e.filter(r=>String(r).trim()),e.sort((r,a)=>r.length-a.length),e=e.filter((r,a)=>{for(let n=a+1;n<e.length;n++)if(e[n].includes(r))return!1;return!0});let i=e.join(" | ");i!==this._attribHTML&&(this._attribHTML=i,e.length?(this._innerContainer.innerHTML=ae.sanitize(i),this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}},Ix=class{constructor(e={}){this._updateCompact=()=>{let t=this._container.children;if(t.length){let i=t[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&i.classList.add("maplibregl-compact"):i.classList.remove("maplibregl-compact")}},this.options=e}getDefaultPosition(){return"bottom-left"}onAdd(e){var i;this._map=e,this._compact=(i=this.options)==null?void 0:i.compact,this._container=ae.create("div","maplibregl-ctrl");let t=ae.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}},YR=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,i=t?this._queue.concat(t):this._queue;for(let r of i)if(r.id===e){r.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 i=!1,r;for(let a of t)if(!a.cancelled){try{a.callback(e)}catch(n){i||(i=!0,r=n)}if(this._cleared)break}if(this._cleared=!1,this._currentlyRunning=!1,i)throw r}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}};const d_=["none","zoom","sourceTiles","visibleLayers","revision"];var KR=class{constructor(e,t,i,r){this._tileKeys=e.map(a=>a.key).sort().join(),this._revision=t,this._zoom=i,this._visibleLayerIds=r}difference(e){return this._revision===(e==null?void 0:e._revision)?this._visibleLayerIds===e._visibleLayerIds?this._tileKeys===e._tileKeys?this._zoom===e._zoom?"none":"zoom":"sourceTiles":"visibleLayers":"revision"}};const Ia={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0,"color-relief":!0};var JR=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 i=t!==this._lastPrepareZoom;this._lastPrepareZoom=t,this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.tileManager.getRenderableTiles(),this._renderableLayerIds=e._order.filter(o=>!e._layers[o].isHidden(t));let r=this._renderableLayerIds.join(),a=new Set;for(let o of this._renderableLayerIds){let l=e._layers[o],u=l.source;u&&Ia[l.type]&&a.add(u)}this._coordsAscending={},this._rttFingerprints={};for(let o of a){let l=e.tileManagers[o];if(!l)continue;this._coordsAscending[o]={};let u=this._coordsAscending[o],h=l.getSource(),c=h instanceof dn?h.terrainTileRanges:null;for(let f of l.getVisibleCoordinates()){let m=this.terrain.tileManager.getTerrainCoords(f,c);for(let g in m)u[g]||(u[g]=[]),u[g].push(m[g])}this._rttFingerprints[o]={};let d=this._rttFingerprints[o],p=l.getState().revision;for(let f in u)d[f]=new KR(u[f],p,t,r)}this.needsFollowUpFrame=!1;let n=i||this.painter.options.moving,s=!1;for(let o of this._renderableTiles){let l=this._textureDifference(o);l!=="none"&&(l==="zoom"&&n||l==="visibleLayers"&&i?this.needsFollowUpFrame=!0:l==="zoom"||l==="sourceTiles"?(s?this.needsFollowUpFrame=!0:o.releaseRTT(this.painter),s=!0):o.releaseRTT(this.painter))}}_textureDifference(e){let t="none";for(let i in this._rttFingerprints){let r=this._rttFingerprints[i][e.tileID.key];if(!r)continue;let a=r.difference(e.rttFingerprint[i]);d_.indexOf(a)>d_.indexOf(t)&&(t=a)}return t}renderLayer(e,t){if(e.isHidden(this.painter.transform.zoom))return!1;let i=e.type,r=this.painter,a=this._renderableLayerIds[this._renderableLayerIds.length-1]===e.id;if(Ia[i]&&((!this._prevType||!Ia[this._prevType])&&this._stacks.push([]),this._prevType=i,this._stacks[this._stacks.length-1].push(e.id),!a))return!0;if(Ia[this._prevType]||Ia[i]&&a){this._prevType=i;let n=this._stacks.length-1,s=this._stacks[n]||[];t.isRenderingToTexture=!0;for(let o of this._renderableTiles){if(this._rttTiles.push(o),o.getRTT(n))continue;let l=o.acquireRTT(r,n,this.rttSize);r.bindRTT(l),r.context.clear({color:de.transparent,stencil:0}),r.currentStencilSource=void 0;for(let u of s){let h=r.style._layers[u],c=h.source?this._coordsAscending[h.source][o.tileID.key]:[o.tileID];r.context.viewport.set([0,0,this.rttSize,this.rttSize]),r.renderTileClippingMasks(h,c),r.renderLayer(r,r.style.tileManagers[h.source],h,c,t),h.source&&(o.rttFingerprint[h.source]=this._rttFingerprints[h.source][o.tileID.key])}l.texture.generateMipmap()}return t.isRenderingToTexture=!1,gR(this.painter,this.terrain,this._rttTiles,t),this._rttTiles=[],Ia[i]}return!1}};const QR={"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"},ek=J1,p_={hash:!1,interactive:!0,bearingSnap:7,zoomSnap:0,attributionControl:Px,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,maxTileC
823acheSize:null,maxTileCacheZoomLevels:ti.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 f_=class extends _t{get _ownerWindow(){var e,t;return((t=(e=this._container)==null?void 0:e.ownerDocument)==null?void 0:t.defaultView)||window}constructor(e){var a,n,s;super(),this._idleTriggered=!1,this._crossFadingFactor=1,this._renderTaskQueue=new YR,this._controls=[],this._mapId=C_(),this._styleUrl=null,this._missingStyleImageResolver=null,this._lostContextStyle={style:null,images:null},this._contextLost=o=>{if(o.preventDefault(),this._frameRequest&&(this._frameRequest=(this._frameRequest.abort(),null)),this.painter.destroy(),this._lostContextStyle=this._getStyleAndImages(),!this.style){this.fire(new Go("webglcontextlost",{originalEvent:o}));return}for(let l of Object.values(this.style._layers))if(l.type==="custom"&&console.warn(`Custom layer with id '${l.id}' cannot be restored after WebGL context loss. You will need to re-add it manually after context restoration.`),l._listeners)for(let[u]of Object.entries(l._listeners))console.warn(`Custom layer with id '${l.id}' had event listeners for event '${u}' 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 Go("webglcontextlost",{originalEvent:o}))},this._contextRestored=o=>{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 l in this._lostContextStyle.images){let u=this._lostContextStyle.images[l];u.isWebGLImage&&this.style.imageManager.updateImage(l,u,!1)}}this._lostContextStyle={style:null,images:null};try{this._setupPainter()}catch(l){this.fire(new Q(l));return}this.resize(),this._update(),this._resizeInternal(),this.fire(new Go("webglcontextrestored",{originalEvent:o}))},this._onMapScroll=o=>{if(o.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()};let t={...p_,...e,canvasContextAttributes:{...p_.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 XR({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:o=>this._requestRenderFrame(o),cancelRenderFrame:o=>this._cancelRenderFrame(o),transformCameraUpdate:t.transformCameraUpdate,stopHandlers:()=>{var o;return(o=this._handlers)==null?void 0:o.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={...QR,...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&&(qt.prefersReducedMotion=t.reduceMotion),this._requestManager=new aM(t.transformRequest),this._container=this._resolveContainer(t.container),t.max
vendor: 5,171 bytes, line 823
823Bounds&&this.setMaxBounds(t.maxBounds),this._setupContainer();try{this._setupPainter()}catch(o){throw this._cleanupContainer(),o}this._imageQueueHandle=Hi.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.markTerrainDepthDirty(),this._update(!0)}),this.once("idle",()=>this._idleTriggered=!0),this._handlers=new HR(this,this._camera,t),typeof window<"u"&&(this._ownerWindow.addEventListener("online",this._onWindowOnline,!1),this._setupResizeObserver());let i=typeof t.hash=="string"&&t.hash||void 0;this._hash=t.hash?new gx(i).addTo(this):void 0,(a=this._hash)!=null&&a._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,W({},t.fitBoundsOptions,{duration:0}))));let r=typeof t.style=="string"||((s=(n=t.style)==null?void 0:n.projection)==null?void 0:s.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 Ax(typeof t.attributionControl=="boolean"?void 0:t.attributionControl)),t.maplibreLogo&&this.addControl(new Ix,t.logoPosition),this.on("style.load",()=>{if(r||this._resizeTransform(),this._camera.transform.unmodified){let o=ws(this.style.stylesheet,["center","zoom","bearing","pitch","roll"]);this.jumpTo(o)}}),this.on("data",o=>{this._update(o.dataType==="style"),this.fire(o.dataType==="style"?new vi("styledata",o):new qe("sourcedata",o))}),this.on("dataloading",o=>{this.fire(o.dataType==="style"?new vi("styledataloading",o):new qe("sourcedataloading",o))}),this.on("dataabort",o=>{this.fire(new qe("sourcedataabort",o))})}_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!=null&&e.onAdd))return this.fire(new Q(Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));let i=e.onAdd(this);this._controls.push(e);let r=this._controlPositions[t];return t.includes("bottom")?r.insertBefore(i,r.firstChild):r.appendChild(i),this}removeControl(e){if(!(e!=null&&e.onRemove))return this.fire(new Q(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 pn(this._camera.transform,e)}setTransformCameraUpdate(e){this._camera.transformCameraUpdate=e}getCenter(){return new X(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,i){return this._camera.panBy(e,t,i),this}panTo(e,t,i){return this._camera.panTo(e,t,i),this}getZoom(){return this._camera.transform.zoom}setZoom(e,t){return this._camera.setZoom(e,t),this}zoomTo(e,t,i){return this._camera.zoomTo(e,t,i),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,i){return this._camera.rotateTo(e,t,i),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,i){return this._camera.fitBounds(e,t,i),this}fitScreenCoordinates(e,t,i,r,a){return this._camera.fitScreenCoordinates(e,t,i,r,a),this}jumpTo(e,t){return this._camera.jumpTo(e,t),this}calculateCameraOptionsFromCameraLngLatAltRotation(e,t,i,r,a){return this._camera.calculateCameraOptionsFromCameraLngLatAltRotation(e,t,i,r,a)}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(X.convert(e),this._camera.transform):null}
823getCenterClampedToGround(){return this._camera.getCenterClampedToGround()}calculateCameraOptionsFromTo(e,t,i,r){return r==null&&this.terrain&&(r=this.terrain.getElevationForLngLat(i,this._camera.transform)),this._camera.transform.calculateCameraOptionsFromTo(e,t,i,r??0)}resize(e,t=!0){if(this._lostContextStyle.style!==null)return this;this._resizeInternal(t);let i=!this._camera._moving;return i&&(this.stop(),this.fire(new Y("movestart",e)).fire(new Y("move",e))),this.fire(new bt("resize",e)),i&&this.fire(new Y("moveend",e)),this}_resizeInternal(e=!0){let[t,i]=this._containerDimensions(),r=this._getClampedPixelRatio(t,i);if(this._resizeCanvas(t,i,r),this.painter.resize(t,i,r),this.painter.overLimit()){let a=this.painter.context.gl;this._maxCanvasSize=[a.drawingBufferWidth,a.drawingBufferHeight];let n=this._getClampedPixelRatio(t,i);this._resizeCanvas(t,i,n),this.painter.resize(t,i,n)}this._resizeTransform(e)}_resizeTransform(e=!0){var r;let[t,i]=this._containerDimensions();this._camera.transform.resize(t,i,e),(r=this._camera._requestedCameraState)==null||r.resize(t,i,e)}_getClampedPixelRatio(e,t){let{0:i,1:r}=this._maxCanvasSize,a=this.getPixelRatio(),n=e*a,s=t*a,o=n>i?i/n:1,l=s>r?r/s:1,u=Math.min(o,l);return u<1&&xe("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."),u*a}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(ki.convert(e)),this._update()}setMinZoom(e){if(e??(e=-2),e>=-2&&e<=this._camera.transform.maxZoom){let t=this._camera.transform.zoom,i=this._camera.getTransformForUpdate();return i.setMinZoom(e),this._camera.applyUpdatedTransform(i),this._update(),t!==this._camera.transform.zoom&&this.fire(new Y("zoomstart")).fire(new Y("zoom")).fire(new Y("zoomend")).fire(new Y("movestart")).fire(new Y("move")).fire(new Y("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??(e=22),e>=this._camera.transform.minZoom){let t=this._camera.transform.zoom,i=this._camera.getTransformForUpdate();return i.setMaxZoom(e),this._camera.applyUpdatedTransform(i),this._update(),t!==this._camera.transform.zoom&&this.fire(new Y("zoomstart")).fire(new Y("zoom")).fire(new Y("zoomend")).fire(new Y("movestart")).fire(new Y("move")).fire(new Y("moveend")),this}throw Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this._camera.transform.maxZoom}setMinPitch(e){if(e??(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,i=this._camera.getTransformForUpdate();return i.setMinPitch(e),this._camera.applyUpdatedTransform(i),this._update(),t!==this._camera.transform.pitch&&this.fire(new Y("pitchstart")).fire(new Y("pitch")).fire(new Y("pitchend")).fire(new Y("movestart")).fire(new Y("move")).fire(new Y("moveend")),this}throw Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this._camera.transform.minPitch}setMaxPitch(e){if(e??(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,i=this._camera.getTransformForUpdate();return i.setMaxPitch(e),this._camera.applyUpdatedTransform(i),this._update(),t!==this._camera.transform.pitch&&this.fire(new Y("pitchstart")).fire(new Y("pitch")).fire(new Y("pitchend")).fire(new Y("movestart")).fire(new Y("move")).fire(new Y("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??(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(X.convert(e),this.style&&this.terrain)}unproject(e){return this._camera.transform.screenPointToLocation(A.convert(e),this.terrain)}isMoving(){var e;return this._camera.isMoving()||((e=this._handlers)==null?void 0:e.isMoving())||!1}isZooming(){var e;return this._camera.isZooming()||((e=this._handlers)==null?void 0:e.isZooming())||!1}isRotating(){var e;return this._camera.isRotating()||((e=this._handlers)==null?void 0:e.isRotating())||!1}_createDelegatedListener(e,t,i){if(e==="mouseenter"||e==="mouseover"){let r=!1;return{layers:t,listener:i,delegates:{mousemove:a=>{let n=t.filter(o=>this.getLayer(o)),s=n.length===0?[]:this.queryRenderedFeatures(a.point,{layers:n});s.length?r||(r=!0,i.call(this,new li(e,this,a.originalEvent,{features:s}))):r=!1},mouseout:()=>{r=!1}}}}if(e==="mouseleave"||e==="mouseout"){let r=!1;return{layers:t,listener:i,delegates:{mousemove:a=>{let n=t.filter(s=>this.getLayer(s));(n.length===0?[]:this.queryRenderedFeatures(a.point,{layers:n})).length?r=!0:r&&(r=!1,i.call(this,new li(e,this,a.originalEvent)))},mouseout:a=>{r&&(r=!1,i.call(this,new li(e,this,a.originalEvent)))}}}}{let r=a=>{let n=t.filter(o=>this.getLayer(o)),s=n.length===0?[]:this.queryRenderedFeatures(a.point,{layers:n});s.length&&(a.features=s,i.call(this,a),delete a.features)};return{layers:t,listener:i,delegates:{[e]:r}}}}_saveDelegatedListener(e,t){var i;this._delegatedListeners||(this._delegatedListeners={}),(i=this._delegatedListeners)[e]||(i[e]=[]),this._delegatedListeners[e].push(t)}_removeDelegatedListener(e,t,i){var a;if(!((a=this._delegatedListeners)!=null&&a[e]))return;let r=this._delegatedListeners[e];for(let n=0;n<r.length;n++){let s=r[n];if(s.listener===i&&s.layers.length===t.length&&s.layers.every(o=>t.includes(o))){for(let o in s.delegates)this.off(o,s.delegates[o]);r.splice(n,1);return}}}on(e,t,i){if(i===void 0)return super.on(e,t);let r=typeof t=="string"?[t]:t,a=this._createDelegatedListener(e,r,i);this._saveDelegatedListener(e,a);for(let n in a.delegates)this.on(n,a.delegates[n]);return{unsubscribe:()=>{this._removeDelegatedListener(e,r,i)}}}once(e,t,i){if(i===void 0)return super.once(e,t);let r=typeof t=="string"?[t]:t,a=this._createDelegatedListener(e,r,i);for(let n in a.delegates){let s=a.delegates[n];a.delegates[n]=(...o)=>{this._removeDelegatedListener(e,r,i),s(...o)}}this._saveDelegatedListener(e,a);for(let n in a.delegates)this.once(n,a.delegates[n]);return this}off(e,t,i){if(i===void 0)return super.off(e,t);let r=typeof t=="string"?[t]:t;return this._removeDelegatedListener(e,r,i),this}queryRenderedFeatures(e,t){if(!this.style)return[];let i,r=e instanceof A||Array.isArray(e),a=r?e:[[0,0],[this._camera.transform.width,this._camera.transform.height]];if(t||(t=(r?{}:e)||{}),a instanceof A||typeof a[0]=="number")i=[A.convert(a)];else{let n=A.convert(a[0]),s=A.convert(a[1]);i=[n,new A(s.x,n.y),s,new A(n.x,s.y),n]}return this.style.queryRenderedFeatures(i,t,this._camera.transform)}querySourceFeatures(e,t){return this.style.querySourceFeatures(e,t)}setStyle(e,t){return t=W({},{localIdeographFontFamily:this._localIdeographFontFamily,validate:this._val
823idateStyle},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){var r,a,n;if((r=this._diffStyleRequest)==null||r.abort(),this._diffStyleRequest=null,t.transformStyle&&this.style&&!this.style._loaded){this.style.once("style.load",()=>this._updateStyle(e,t));return}let i=this.style&&t.transformStyle?this.style.serialize():void 0;if(this.style&&(this.style.setEventedParent(null),this.style._remove(!e)),e)this.style=new ed(this,t||{});else return this._frameRequest&&(this._frameRequest=(this._frameRequest.abort(),null)),(n=(a=this.style)==null?void 0:a.projection)==null||n.destroy(),delete this.style,this;return this.style.setEventedParent(this,{style:this.style}),typeof e=="string"?this.style.loadURL(e,t,i):this.style.loadJSON(e,t,i),this}_lazyInitEmptyStyle(){this.style||(this.style=new ed(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}async _diffStyle(e,t){var i;if((i=this._diffStyleRequest)==null||i.abort(),typeof e=="string"){let r=e;this._diffStyleRequest=new AbortController;let a=this._diffStyleRequest;try{let n=await this._requestManager.transformRequest(r,"Style");if(a.signal.aborted){this._diffStyleRequest=null;return}let s=await Al(n,a);this._diffStyleRequest=null,this._updateDiff(s.data,t)}catch(n){this._diffStyleRequest=null,Fr(n)||this.fire(new Q(kt(n)))}}else typeof e=="object"&&(this._diffStyleRequest=null,this._updateDiff(e,t))}_updateDiff(e,t){try{this.style.setState(e,t)&&this._update(!0)}catch(i){xe(`Unable to perform style diff: ${kt(i).message}.  Rebuilding the style from scratch.`),this._updateStyle(e,t)}}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){xe("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){var i;let t=(i=this.style)==null?void 0:i.tileManagers[e];if(t===void 0){this.fire(new Q(Error(`There is no tile manager with ID '${e}'`)));return}return t.loaded()}setTerrain(e,t={}){if(this.style._checkLoaded(),e&&Is(this,Jt.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.painter.destroyRTTResources(),this._camera.terrain=null,this._camera.transform.setMinElevationForCurrentTile(0),this.getCenterClampedToGround()&&this._camera.transform.setElevation(0);else{let i=this.style.tileManagers[e.source];if(!i)throw Error(`cannot load terrain, because there exists no source with ID: ${e.source}`);this.terrain===null&&i.reload();for(let r in this.style._layers){let a=this.style._layers[r];a.type==="hillshade"&&a.source===e.source&&xe("You are using the same source for a hillshade layer and for 3D terrain. Please consider using two separate sources to improve rendering quality."),a.type==="color-relief"&&a.source===e.source&&xe("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 pF(this.painter,i,e,this._terrainSkirtLength),this.painter.renderToTexture=new JR(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=r=>this._handleTerrainDataEvent(r,e.source),this.style.on("data",this._terrainDataCallback)}return this.style.triggerSymbolPlacement(),this.fire(new tv({terrain:e})),this}_handleTerrainDataEvent(e,t){var r;if(e.dataType==="style"){this.terrain.tileManager.releaseAllRTT();return}let i=e.sourceId===t;if(i&&(this.terrain.resetElevationCache(),this.style.triggerSymbolPlacement()),i&&e.tile&&this.painter.markTerrainDepthDirty(),i&&e.tile&&!this._camera.elevationFreeze&&(this._camera.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this._camera.transform.center,this._camera.transform.tileZoom)),this.getCenterClampedToGroun
823d()&&this._camera.transform.setElevation(this.terrain.getElevationForLngLat(this._camera.transform.center,this._camera.transform))),e.tile){if(((r=e.source)==null?void 0:r.type)==="image"){this.terrain.tileManager.releaseAllRTT();return}this.terrain.tileManager.releaseRTT(e.tile.tileID)}}getTerrain(){var e;return((e=this.terrain)==null?void 0:e.options)??null}areTilesLoaded(){var t;let e=(t=this.style)==null?void 0:t.tileManagers;for(let i of Object.values(e))if(!i.areTilesLoaded())return!1;return!0}removeSource(e){return this.style.removeSource(e),this._update(!0)}getSource(e){var t;return(t=this.style)==null?void 0:t.getSource(e)}setSourceTileLodParams(e,t,i){if(i){let r=this.getSource(i);if(!r)throw Error(`There is no source with ID "${i}", cannot set LOD parameters`);r.calculateTileZoom=qc(Math.max(1,e),Math.max(1,t))}else for(let r in this.style.tileManagers)this.style.tileManagers[r].getSource().calculateTileZoom=qc(Math.max(1,e),Math.max(1,t));return this._update(!0),this}refreshTiles(e,t){let i=this.style.tileManagers[e];if(!i)throw Error(`There is no tile manager with ID "${e}", cannot refresh tile`);t===void 0?i.reload(!0):i.refreshTiles(t.map(r=>new eu(r.z,r.x,r.y)))}addImage(e,t,i={}){var a;this._lazyInitEmptyStyle();let r=this._createStyleImage(t,i);return r?(this.style.addImage(e,r),(a=r.userImage)!=null&&a.onAdd&&r.userImage.onAdd(this,e),this):this}setMissingStyleImageResolver(e){var t;return this._missingStyleImageResolver=e,(t=this.style)==null||t.setMissingImageResolver(e),this}_createStyleImage(e,t={}){let{pixelRatio:i=1,sdf:r=!1,stretchX:a,stretchY:n,content:s,textFitWidth:o,textFitHeight:l}=t;if(e instanceof HTMLImageElement||Qr(e)){let{width:u,height:h,data:c}=qt.getImageData(e);return{data:new Ze({width:u,height:h},c),pixelRatio:i,stretchX:a,stretchY:n,content:s,textFitWidth:o,textFitHeight:l,sdf:r,version:0}}if(e.width===void 0||e.height===void 0)return this.fire(new Q(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:u,height:h,data:c}=e,d=e,p=ml(d.data);return{data:p?new Ze({width:u,height:h}):new Ze({width:u,height:h},new Uint8Array(c)),pixelRatio:i,stretchX:a,stretchY:n,content:s,textFitWidth:o,textFitHeight:l,sdf:r,version:0,isWebGLImage:p,userImage:d}}}updateImage(e,t){let i=this.style.getImage(e);if(!i)return this.fire(new Q(Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));let{width:r,height:a,data:n}=t instanceof HTMLImageElement||Qr(t)?qt.getImageData(t):t;if(r===void 0||a===void 0)return this.fire(new Q(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!==i.data.width||a!==i.data.height)return this.fire(new Q(Error("The width and height of the updated image must be that same as the previous version of the image")));
823if(i.isWebGLImage=ml(n),i.isWebGLImage)i.userImage=t;else{let s=!(t instanceof HTMLImageElement||Qr(t));i.data.replace(n,s)}return this.style.updateImage(e,i),this}getImage(e){return this.style.getImage(e)}hasImage(e){return e?!!this.style.getImage(e):(this.fire(new Q(Error("Missing required image id"))),!1)}removeImage(e){this.style.removeImage(e)}async loadImage(e){let t=await Hi.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(){var e;return((e=this.style)==null?void 0:e.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){var t;return(t=this.style)==null?void 0:t.getLayer(e)}getLayersOrder(){var e;return((e=this.style)==null?void 0:e.getLayersOrder())??[]}setLayerZoomRange(e,t,i){return this.style.setLayerZoomRange(e,t,i),this._update(!0)}setFilter(e,t,i={}){var r;return(r=this.style)==null||r.setFilter(e,t,i),this._update(!0)}getFilter(e){return this.style.getFilter(e)}setPaintProperty(e,t,i,r={}){var a;return(a=this.style)==null||a.setPaintProperty(e,t,i,r),this._update(!0)}getPaintProperty(e,t){return this.style.getPaintProperty(e,t)}setLayoutProperty(e,t,i,r={}){return this.style.setLayoutProperty(e,t,i,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,i={}){return this._lazyInitEmptyStyle(),this.style.addSprite(e,t,i,r=>{r||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,i=>{i||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(){var i;if(!((i=this._container)!=null&&i.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=Mp(r=>{this._trackResize&&!this._removed&&(this.resize(r),this.redraw())},50),i=this._ownerWindow.ResizeObserver??ResizeObserver;this._resizeObserver=new i(r=>{!e&&(e=!0,!this._shouldHandleInitialResize())||t(r)}),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._containerDimensions(),t=this._getClampedPixelRatio(e[0],e[1]),i=this._container;i.classList.add("maplibregl-map");let r=this._canvasContainer=ae.create("div","maplibregl-canvas-container",i);this._interactive&&r.classList.add("maplibregl-interactive"),this._canvas=ae.create("canvas","maplibregl-canvas",r),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","regi
823on"),this._resizeCanvas(e[0],e[1],t);let a=this._controlContainer=ae.create("div","maplibregl-control-container",i),n=this._controlPositions={};for(let s of["top-left","top-right","bottom-left","bottom-right"])n[s]=ae.create("div",`maplibregl-ctrl-${s} `,a);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,i){this._canvas.width=Math.floor(i*e),this._canvas.height=Math.floor(i*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",r=>{t=r},{once:!0});let i=this._canvas.getContext("webgl2",e);if(!i)throw new mx(e,t);this.painter=new bR(i,this._camera.transform)}migrateProjection(e,t){this._camera.migrateProjection(e,t),this.painter.transform=e,this.fire(new iv({newProjection:this.style.projection.name}))}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(e){var t;return(t=this.style)!=null&&t._loaded?(this._styleDirty||(this._styleDirty=e),this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(e){return this._update(),this._renderTaskQueue.add(e)}_cancelRenderFrame(e){this._renderTaskQueue.remove(e)}_render(e){var s,o,l,u,h;let t=this._idleTriggered?this._fadeDuration:0,i=((s=this.style.projection)==null?void 0:s.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 c=this._camera.transform.zoom,d=Oe();this.style.zoomHistory.update(c,d);let p=new Be(c,{now:d,fadeDuration:t,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),f=p.crossFadingFactor();(f!==1||f!==this._crossFadingFactor)&&(r=!0,this._crossFadingFactor=f),this.style.update(p)}let a=((o=this.style.projection)==null?void 0:o.transitionState)>0!==i;this._camera.transform.setTransitionState((l=this.style.projection)==null?void 0:l.transitionState),this.style&&(this._sourcesDirty||a)&&(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=(u=this.style)==null?void 0:u._updatePlacement(this._camera.transform,this.showCollisionBoxes,t,this._crossSourceCollisions,a),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 bt("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,this.fire(new bt("load"))),this.style&&(this.style.hasTransitions()||r)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();let n=this._sourcesDirty||this._styleDirty||this._placementDirty||((h=this.painter.renderToTexture)==null?void 0:h.needsFollowUpFrame);return n||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new bt("idle")),this._loaded&&!this._fullyLoaded&&!n&&(this._fullyLoaded=!0),this}redraw(){return this.style&&(this._frameRequest&&(this._frameRequest=(this._frameRequest.abort(),null)),this._render(0)),this}remove(){var t,i;this._hash&&this._hash.remove();for(let r of this._controls)r.onRemove(this);this._controls=[],this._frameRequest&&(this._frameRequest=(this._frameRequest.abort(),null)),this._renderTaskQueue.clear(),(t=this._diffStyleRequest)==null||t.abort(),this.painter.destroy(),this._handlers.destroy(),this.setStyle(null),typeof window<"u"&&this._ownerWindow.removeEventListener("online",this._onWindowOnline,!1),Hi.removeThrottleControl(this._imageQueueHandle),(i=this._resizeObserver)==null||i.disconnect();let e=this.painter.context.gl.getExtension("WEBGL_lose_context");e!=null&&e.loseContext&&e.loseContext(),this._cleanupContainer(),this._removed=!0,this.fire(new bt("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,qt.frame(this._frameRequest,e=>{this._frameRequest=null;try{this._render(e)}catch(t){if(!Fr(t))throw t}},()=>{},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 ek}getCameraTargetElevation(){return this._camera.transform.elevation}getProjection(){return this.style.getProjection()}setProjection(e){return this._lazyInitEmptyStyle(),this.style.setProjection(e),this._update(!0)}};const tk={showCompass:!0,showZoom:!0,visualizePitch:!1,visualizeRoll:!0};var ik=class{constructor(e){this._updateZoomButtons=()=>{let t=this._map.getZoom(),i=t===this._map.getMaxZoom(),r=t===this._map.getMinZoom(!0);this._zoomInButton.disabled=i,this._zoomOutButton.disabled=r,this._zoomInButton.setAttribute("aria-disabled",i.toString()),this._zoomOutButton.setAttribute("aria-disabled",r.toString())},this._rotateCompassArrow=()=>{let t=this._map.getPitch(),i=this._map.getRoll(),r=this._map.getBearing(),a=1/Math.cos(Xe(t))**.5;if(this.options.visualizePitch&&this.options.visualizeRoll){this._compassIcon.style.transform=`scale(${a}) rotateZ(${-i}deg) rotateX(${t}deg) rotateZ(${-r}deg)`;return}if(this.options.visualizePitch){this._compassIcon.style.transform=`scale(${a}) rotateX(${t}deg) rotateZ(${-r}deg)`;return}if(this.options.visualizeRoll){this._compassIcon.style.transform=`rotate(${-r-i}deg)`;return}this._compassIcon.style.transform=`rotate(${-r}deg)`},this._setButtonTitle=(t,i)=>{let r=this._map._getUIString(`NavigationControl.${i}`);t.title=r,t.setAttribute("aria-label",r)},this.options=W({},tk,e),this._container=ae.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",t=>t.preventDefault()),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",t=>this._map.zoomIn({},{originalEvent:t})),ae.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",t=>this._map.zoomOut({},{originalEvent:t})),ae.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",t=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:t}):this._map.resetNorth({},{originalEvent:t})}),this._compassIcon=ae.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 rk(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 i=ae.create("button",e,this._container);return i.type="button",i.addEventListener("click",t),i}},rk=class{constructor(e,t,i=!1){this.mousedown=a=>{this.startMove(a,ae.mousePos(this.element,a)),window.addEventListener("mousemove",this.mousemove),window.addEventListener("mouseup",this.mouseup)},this.mousemove=a=>{this.move(a,ae.mousePos(this.element,a))},this.mouseup=a=>{this._rotatePitchHandler.dragEnd(a),this.offTemp()},this.touchstart=a=>{a.targetTouches.length===1?(this._startPos=this._lastPos=ae.touchPos(this.element,a.targetTouches)[0],this.startMove(a,this._startPos),window.addEventListener("touchmove",this.touchmove,{passive:!1}),window.addEventListener("touchend",this.touchend)):this.reset()},this.touchmove=a=>{a.targetTouches.length===1?(this._lastPos=ae.touchPos(this.element,a.targetTouches)[0],this.move(a,this._lastPos)):this.reset()},this.touchend=a=>{a.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 LR;this._rotatePitchHandler=new Bs({clickTolerance:3,move:(a,n)=>{let s=t.getBoundingClientRect(),o=new A((s.bottom-s.top)/2,(s.right-s.left)/2);return{bearingDelta:I_(new A(a.x,n.y),n,o),pitchDelta:i?(n.y-a.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),ae.disableDrag()}move(e,t){let i=this.map,{bearingDelta:r,pitchDelta:a}=this._rotatePitchHandler.dragMove(e,t)||{};r&&i.setBearing(i.getBearing()+r),a&&i.setPitch(i.getPitch()+a)}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(){ae.enableDrag(),window.removeEventListener("mousemove",this.mousemove),window.removeEventListener("mouseup",this.mouseup),window.removeEventListener("touchmove",this.touchmove),window.removeEventListener("touchend",this.touchend)}};let Nr;async function ak(e=!1){if(Nr!==void 0&&!e)return Nr;if(window.navigator.permissions===void 0)return Nr=!!window.navigator.geolocation,Nr;try{Nr=(await window.navigator.permissions.query({name:"geolocation"})).state!=="denied"}catch{Nr=!!window.navigator.geolocation}return Nr}function Mx(e,t,i,r=!1){if(r||!i.getCoveringTilesDetailsProvider().allowWorldCopies())return e==null?void 0:e.wrap();let a=new X(e.lng,e.lat);if(e=new X(e.lng,e.lat),t){let n=new X(e.lng-360,e.lat),s=new X(e.lng+360,e.lat),o=i.locationToScreenPoint(e).distSqr(t);i.locationToScreenPoint(n).distSqr(t)<o?e=n:i.locationToScreenPoint(s).distSqr(t)<o&&(e=s)}for(;Math.abs(e.lng-i.center.lng)>180;){let n=i.locationToScreenPoint(e);if(n.x>=0&&n.y>=0&&n.x<=i.width&&n.y<=i.height)break;e.lng>i.center.lng?e.lng-=360:e.lng+=360}
823return e.lng!==a.lng&&i.isPointOnMapSurface(i.locationToScreenPoint(e))?e:a}const zp={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 Fx(e,t,i){let r=e.classList;for(let a in zp)r.remove(`maplibregl-${i}-anchor-${a}`);r.add(`maplibregl-${i}-anchor-${t}`)}const m_={ArrowLeft:[-1,0],ArrowRight:[1,0],ArrowUp:[0,-1],ArrowDown:[0,1]},zx="#3FB1CE";function gi(e,t,i=[]){let r=ae.createNS("http://www.w3.org/2000/svg",e);for(let a in t)r.setAttributeNS(null,a,t[a]);for(let a of i)r.appendChild(a);return r}let xh;function nk(){return xh||(xh=gi("svg",{display:"block",height:"41px",width:"27px",viewBox:"0 0 27 41"},[gi("g",{"fill-rule":"nonzero"},[gi("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])=>gi("ellipse",{opacity:"0.04",cx:"10.5",cy:"5.80029008",rx:e,ry:t}))),gi("g",{fill:zx},[gi("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"})]),gi("g",{opacity:"0.25",fill:"#000000"},[gi("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"})]),gi("g",{transform:"translate(6.0, 7.0)",fill:"#FFFFFF"}),gi("g",{transform:"translate(8.0, 8.0)"},[gi("circle",{fill:"#000000",opacity:"0.25",cx:"5.5",cy:"5.5",r:"5.4999962"}),gi("circle",{fill:"#FFFFFF",cx:"5.5",cy:"5.5",r:"5.4999962"})])])]),xh)}function sk(e){return e.firstElementChild.children[1]}var Zr=class extends ci{},Rx=class extends ci{},rd=class extends _t{constructor(e){if(super(),this._onClick=t=>{this.fire(new Rx("click",{originalEvent:t}))},this._onKeyPress=t=>{(t.code==="Space"||t.code==="Enter")&&this.togglePopup()},this._onKeyDown=t=>{if(!this._defaultMarker||!this._draggable||!this._map||!this._lngLat||t.composedPath()[0]!==this._element||t.altKey||t.ctrlKey||t.metaKey)return;let i=m_[t.key];if(!i)return;t.preventDefault(),t.stopPropagation();let r=t.shiftKey?10:1,a=this._map.project(this._lngLat);this.setLngLat(this._map.unproject(new A(a.x+i[0]*r,a.y+i[1]*r))),this._keyboardDragActive||(this._keyboardDragActive=!0,this.fire(new Zr("dragstart"))),this.fire(new Zr("drag"))},this._onKeyUp=t=>{m_[t.key]&&this._endKeyboardDrag()},this._onBlur=()=>{this._endKeyboardDrag()},this._onMapClick=t=>{let i=t.originalEvent.target,r=this._element;this._popup&&(i===r||r.contains(i))&&this.togglePopup()},this._updateCoveredUnthrottled=()=>{var r,a;let t=(r=this._map)==null?void 0:r.terrain;if(!t||!this._isInViewport())return;let i=this._isCovered(t);i&&((a=this._popup)!=null&&a.isOpen())&&this._popup.remove(),this._element.style.opacity=i?this._opacityWhenCovered:this._opacity,this._element.classList.toggle("maplibregl-marker-covered",i)},this._updateCovered=Mp(this._updateCoveredUnthrottled,100),this._update=t=>{if(!this._map)return;let i=this._map.loaded()&&!this._map.isMoving();((t==null?void 0:t.type)==="terrain"||(t==null?void 0:t.type)==="render"&&!i)&&this._map.once("render",this._update),this._lngLat=Mx(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 r="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?r=`rotateZ(${this._rotation}deg)`:this._rotationAlignment==="map"&&(r=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let a="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?a="rotateX(0deg)":this._pitchAlignment==="map"&&(a=`rotateX(${this._map.getPitch()}deg)`),!this._subpixelPositioning&&(!t||t.type==="moveend")&&(this._pos=this._pos.round()),this._element.style.transform=`${zp[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${a} ${r}`,qt.frameAsync(new AbortController,this._map._ownerWindow).then(()=>{this._updateOpacity()}).catch(()=>{})},this._onMove=t=>{if(!this._isDragging){let i=this._clickTolerance||this._map._clickTolerance;this._isDragging=t.point.dist(this._pointerdownPos)>=i}this._isDragging&&(this._pos=t.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 Zr("dragstart"))),this.fire(new Zr("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 Zr("dragend")),this._state="inactive"},this._addDragHandler=t=>{this._element.contains(t.originalEvent.target)&&(t.preventDefault(),this._positionDelta=t.point.sub(this._pos).add(this._offset),this._pointerdownPos=t.point,this._state="pending",this._map.on("mousemove",this._onMove),this._map.on("touchmove",this._onMove),this._map.once("mouseup",this._onUp),this._map.once("touchend",this._onUp))},this._anchor=(e==null?void 0:e.anchor)||"center",this._color=(e==null?void 0:e.color)||zx,this._scale=(e==null?void 0:e.scale)||1,this._draggable=(e==null?void 0:e.draggable)||!1,this._clickTolerance=(e==null?void 0:e.clickTolerance)||0,this._subpixelPositioning=(e==null?void 0:e.subpixelPositioning)||!1,this._isDragging=!1,this._roleManaged=!1,this._tabIndexManaged=!1,this._keyboardDragActive=!1,this._state="inactive",this._rotation=(e==null?void 0:e.rotation)||0,this._rotationAlignment=(e==null?void 0:e.rotationAlignment)||"auto",this._pitchAlignment=e!=null&&e.pitchAlignment&&e.pitchAlignment!=="auto"?e.pitchAlignment:this._rotationAlignment,this.setOpacity(e==null?void 0:e.opacity,e==null?void 0:e.opacityWhenCovered),e==null?void 0:e.element)this._element=e.element,this._offset=A.convert((e==null?void 0:e.offset)||[0,0]);else{this._defaultMarker=!0,this._element=ae.create("div");let t=nk().cloneNode(!0);t.setAttributeNS(null,"height",`${41*this._scale}px`),t.setAttributeNS(null,"width",`${27*this._scale}px`),sk(t).setAttributeNS(null,"fill",this._color),this._element.appendChild(t),this._offset=A.convert((e==null?void 0:e.offset)||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",t=>{t.preventDefault()}),this._element.addEventListener("mousedown",t=>{t.preventDefault()}),Fx(this._element,this._anchor,"marker"),e==null?void 0: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._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=X.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:[
vendor: 4,302 bytes, line 823
8230,-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 Zr("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(){var i;if(!this._isInViewport())return;let e=(i=this._map)==null?void 0:i.terrain,t=this._map._camera.transform.isLocationOccluded(this._lngLat);if(!e||t){let r=t?this._opacityWhenCovered:this._opacity;this._element.style.opacity!==r&&(this._element.style.opacity=r,this._element.classList.toggle("maplibregl-marker-covered",t));return}this._updateCovered()}_isInViewport(){let{width:e,height:t}=this._map._camera.transform;return!!this._pos&&this._pos.x>=0&&this._pos.y>=0&&this._pos.x<=e&&this._pos.y<=t}_isCovered(e){let t=this._map._camera.transform,i=e.getElevationForLngLat(this._lngLat,t),r=Math.max(0,-this._offset.y)/t.pixelsPerMeter,a=Math.sin(this._map.getPitch()*Math.PI/180)*r;return t.isLocationOccluded(this._lngLat,e,i+a)}getOffset(){return this._offset}setOffset(e){return this._offset=A.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._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(),this}};const ok={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let Ro=0,Bn=!1;var qr=class extends ci{},ad=class extends ci{},kx=class extends ci{},lk=class extends _t{constructor(e){super(),this._onSuccess=t=>{if(this._map){if(this._isOutOfMapMaxBounds(t)){this._setErrorState(),this.fire(new ad("outofmaxbounds",t)),this._updateMarker(),this._finish();return}if(this.options.trackUserLocation)switch(this._lastKnownPosition=t,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_E
823RROR":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(t),(!this.options.trackUserLocation||this._watchState==="ACTIVE_LOCK")&&this._updateCamera(t),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new ad("geolocate",t)),this._finish()}},this._updateCamera=t=>{let i=new X(t.coords.longitude,t.coords.latitude),r=t.coords.accuracy,a=this._map.getBearing(),n=W({bearing:a},this.options.fitBoundsOptions),s=ki.fromLngLat(i,r);this._map.fitBounds(s,n,{geolocateSource:!0})},this._updateMarker=t=>{if(t){let i=new X(t.coords.longitude,t.coords.latitude);this._accuracyCircleMarker.setLngLat(i).addTo(this._map),this._userLocationDotMarker.setLngLat(i).addTo(this._map),this._accuracy=t.coords.accuracy,this._updateCircleRadiusIfNeeded()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()},this._onUpdate=()=>{this._updateCircleRadiusIfNeeded()},this._onError=t=>{if(this._map){if(t.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 i=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=i,this._geolocateButton.setAttribute("aria-label",i),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(t.code===3&&Bn)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new kx("error",t)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._onMoveStart=t=>{if(!this._map)return;let i=(t==null?void 0:t[0])instanceof ResizeObserverEntry;!t.geolocateSource&&this._watchState==="ACTIVE_LOCK"&&!i&&!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 qr("trackuserlocationend")),this.fire(new qr("userlocationlostfocus")))},this._setupUI=()=>{this._map&&(this._container.addEventListener("contextmenu",t=>{t.preventDefault()}),this._geolocateButton=ae.create("button","maplibregl-ctrl-geolocate",this._container),ae.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",this._geolocateButton.disabled=!0)},this._finishSetupUI=t=>{if(this._map){if(t===!1){xe("Geolocation support is not available so the GeolocateControl will be disabled.");let i=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=i,this._geolocateButton.setAttribute("aria-label",i)}else{let i=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.disabled=!1,this._geolocateButton.title=i,this._geolocateButton.setAttribute("aria-label",i)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=ae.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new rd({element:this._dotElement}),this._circleElement=ae.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new rd({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=W({},ok,e)}onAdd(e){return this._map=e,this._container=ae.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),ak().then(t=>this._finishSetupUI(t)),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,Ro=0,Bn=!1}_isOutOfMapMaxBounds(e){let t=this._map.getMaxBounds(),i=e.coords;return t&&(i.longitude<t.getWest()||i.longitude>t.getEast()||i.latitude<t.getSouth()||i.latitude>t.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_E
823RROR",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),i=this._map.unproject([t.x+100,t.y]),r=e.distanceTo(i)/100,a=2*this._accuracy/r;this._circleElement.style.width=`${a.toFixed(2)}px`,this._circleElement.style.height=`${a.toFixed(2)}px`}trigger(){if(!this._setup)return xe("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 qr("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":Ro--,Bn=!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 qr("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 qr("trackuserlocationstart")),this.fire(new qr("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"),Ro++;let e;Ro>1?(e={maximumAge:6e5,timeout:0},Bn=!0):(e=this.options.positionOptions,Bn=!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 uk={maxWidth:100,unit:"metric"};var hk=class{constructor(e){this._onMove=()=>{g_(this._map,this._container,this.options)},this.setUnit=t=>{this.options.unit=t,g_(this._map,this._container,this.options)},this.options={...uk,...e}}getDefaultPosition(){return"bottom-left"}onAdd(e){return this._map=e,this._container=ae.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 g_(e,t,i){let r=(i==null?void 0:i.maxWidth)||100,{width:a,height:n}=e._camera.transform,s=n/2,o=a/2,l=e.unproject([o-r/2,s]),u=e.unproject([o+r/2,s]),h=Math.round(e.project(u).x-e.project(l).x),c=Math.min(r,h,a),d=l.distanceTo(u);if((i==null?void 0:i.unit)==="imperial"){let p=3.2808*d;p>5280?On(t,c,p/5280,e._getUIString("ScaleControl.Miles")):On(t,c,p,e._getUIString("ScaleControl.Feet"))}else(i==null?void 0:i.unit)==="nautical"?On(t,c,d/1852,e._getUIString("ScaleControl.NauticalMiles")):d>=1e3?On(t,c,d/1e3,e._getUIString("ScaleControl.Kilometers")):On(t,c,d,e._getUIString("ScaleControl.Meters"))}function On(e,t,i,r){let a=dk(i),n=a/i;e.style.width=`${t*n}px`;let s=`${a} ${r}`;e.textContent!==s&&(e.textContent=s)}function ck(e){let t=10**Math.ceil(-Math.log(e)/Math.LN10);return Math.round(e*t)/t}function dk(e){let t=10**(`${Math.floor(e)}`.length-1),i=e/t;return i=i>=10?10:i>=5?5:i>=3?3:i>=2?2:i>=1?1:ck(i),t*i}var nd=class extends ci{},pk=class extends _t{constructor(e={}){super(),this._onFullscreenChange=()=>{var i;let t=window.document.fullscreenElement||window.document.webkitFullscreenElement;for(;(i=t==null?void 0:t.shadowRoot)!=null&&i.fullscreenElement;)t=t.shadowRoot.fullscreenElement;t===this._container!==this._fullscreen&&this._handleFullscreenChange()},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},this._fullscreen=!1,this._pseudo=e.pseudo??!1,e!=null&&e.container&&(e.container instanceof HTMLElement?this._container=e.container:xe("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._container=this._map.getContainer()),this._controlContainer=ae.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=ae.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);ae.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 nd("fullscreenstart")),this._prevCooperativeGesturesEnabled=this._map.cooperativeGestures.isEnabled(),this._map.cooperativeGestures.disable()):(this.fire(new nd("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()}},fk=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=ae.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=ae.create("button","maplibregl-ctrl-terrain",this._container),ae.create("span","maplibregl-ctrl-icon",this._terrainButton).setAttribute("aria-hidden","true"),this._terrainButton.t
vendor: 10,694 bytes, line 823
823ype="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}},mk=class{constructor(){this._toggleProjection=()=>{var t;let e=(t=this._map.getProjection())==null?void 0:t.type;e==="mercator"||!e?this._map.setProjection({type:"globe"}):this._map.setProjection({type:"mercator"}),this._updateGlobeIcon()},this._updateGlobeIcon=()=>{var e;this._globeButton.classList.remove("maplibregl-ctrl-globe"),this._globeButton.classList.remove("maplibregl-ctrl-globe-enabled"),((e=this._map.getProjection())==null?void 0:e.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=ae.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._globeButton=ae.create("button","maplibregl-ctrl-globe",this._container),ae.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 gk={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1,locationOccludedOpacity:void 0,padding:void 0},_k=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");var sd=class extends ci{},yk=class extends _t{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 sd("close"))),this),this._update=t=>{let i=this._lngLat||this._trackPointer;if(!this._map||!i||!this._content)return;if(!this._container){if(this._container=ae.create("div","maplibregl-popup",this._map.getContainer()),this._tip=ae.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(let l of this.options.className.split(" "))this._container.classList.add(l);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=Mx(this._lngLat,this._flatPos,this._map._camera.transform,this._trackPointer);let r;if(t&&"point"in t&&t.point&&(r=t.point),this._trackPointer&&!r)return;let a=this._flatPos=this._pos=this._trackPointer&&r?r:this._map.project(this._lngLat);this._map.terrain&&(this._flatPos=this._trackPointer&&r?r:this._map._camera.transform.locationToScreenPoint(this._lngLat));let n=this.options.anchor,s=Lx(this.options.offset);if(!n){let l=this._container.offsetWidth,u=this._container.offsetHeight,h=vk(this.options.padding),c;c=a.y+s.bottom.y<u+h.top?["top"]:a.y>this._map._camera.transform.height-u-h.bottom?["bottom"]:[],a.x<l/2+h.left?c.push("left"):a.x>this._map._camera.transform.width-l/2-h.right&&c.push("right"),n=c.length===0?"bottom":c.join("-")}let o=a.add(s[n]);this.options.subpixelPositioning||(o=o.round()),this._container.style.transform=`${zp[n]} translate(${o.x}px,${o.y}px)`,Fx(this._container,n,"popup"),this._updateOpacity()},this._onClose=()=>{this.remove()},this.options=W(Object.create(gk),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 sd("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(e){return this._lngLat=X.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(),i=document.createElement("body"),r;for(i.innerHTML=e;r=i.firstChild,r;)t.appendChild(r);return this.setDOMContent(t)}getMaxWidth(){var e;return(e=this._container)==null?void 0:e.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=ae.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=ae.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(_k);e&&e.focus()}};function Lx(e){if(!e)return Lx(new A(0,0));if(typeof e=="number"){let t=Math.round(Math.abs(e)/Math.SQRT2);return{center:new A(0,0),top:new A(0,e),"top-left":new A(t,t),"top-right":new A(-t,t),bottom:new A(0,-e),"bottom-left":new A(t,-t),"bottom-right":new A(-t,-t),left:new A(e,0),right:new A(-e,0)}}if(e instanceof A||Array.isArray(e)){let t=A.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:A.convert(e.center||[0,0]),top:A.convert(e.top||[0,0]),"top-left":A.convert(e["top-left"]||[0,0]),"top-right":A.convert(e["top-right"]||[0,0]),bottom:A.convert(e.bottom||[0,0]),"bottom-left":A.convert(e["bottom-left"]||[0,0]),"bottom-right":A.convert(e["bottom-right"]||[0,0]),left:A.convert(e.left||[0,0]),right:A.convert(e.right||[0,0])}}function vk(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 xk=J1;function bk(e,t){return bs().setRTLTextPlugin(e,t)}function wk(){return bs().getRTLTextPluginStatus()}function Tk(){return xk}function Ek(){return au.workerCount}function Sk(e){au.workerCount=e}function Dk(){return ti.MAX_PARALLEL_IMAGE_REQUESTS}function Ck(e){ti.MAX_PARALLEL_IMAGE_REQUESTS=e}function Pk(){return ti.WORKER_URL}function Ak(e){ti.WORKER_URL=e}async function Ik(e){await mp().broadcast("IS",e)}const Mk=Object.freeze(Object.defineProperty({__proto__:null,AJAXError:is,AttributionControl:Ax,BoxZoomHandler:_x,CanvasSource:xv,CooperativeGesturesHandler:Cx,DoubleClickZoomHandler:Tx,DragPanHandler:Ex,DragRotateHandler:Sx,EXTENT:L,EdgeInsets:Jc,ErrorEvent:Q,Event:ci,Evented:_t,FullscreenControl:pk,FullscreenEvent:nd,GPUInitializationError:mx,GeoJSONSource:mv,GeolocateControl:lk,GeolocateErrorEvent:kx,GeolocateEvent:qr,GeolocatePositionEvent:ad,GlobeControl:mk,Hash:gx,ImageSource:dn,KeyboardHandler:bx,LngLat:X,LngLatBounds:ki,LogoControl:Ix,Map:f_,MapBoxZoomEvent:Vc,MapContextEvent:Go,MapLibreEvent:bt,MapLibreMap:f_,MapMouseEvent:li,MapMovementEvent:Y,MapProjectionEvent:iv,MapSourceDataEvent:qe,MapStyleDataEvent:vi,MapStyleImageMissingEvent:rv,MapStyleLoadEvent:jc,MapTerrainEvent:tv,MapTouchEvent:qn,MapWheelEvent:ev,Marker:rd,MarkerClickEvent:Rx,MarkerDragEvent:Zr,MercatorCoordinate:Me,NavigationControl:ik,Point:A,Popup:yk,PopupEvent:sd,RasterDEMTileSource:pv,RasterTileSource:gp,ScaleControl:hk,ScrollZoomHandler:wx,Style:ed,TerrainControl:fk,TwoFingersTouchPitchHandler:xx,TwoFingersTouchRotateHandler:vx,TwoFingersTouchZoomHandler:yx,TwoFingersTouchZoomRotateHandler:Dx,VectorTileSource:dv,VideoSource:vv,addProtocol:mw,addSourceType:d3,clearPrewarmedResources:$M,config:ti,createTileMesh:_v,getGlobalDispatcher:mp,getMaxParallelImageRequests:Dk,getRTLTextPluginStatus:wk,getVersion:Tk,getWorkerCount:Ek,getWorkerUrl:Pk,importScriptInWorkers:Ik,isTimeFrozen:rM,now:Oe,prewarm:OM,removeProtocol:gw,restoreNow:iM,setMa
823xParallelImageRequests:Ck,setNow:tM,setRTLTextPlugin:bk,setWorkerCount:Sk,setWorkerUrl:Ak},Symbol.toStringTag,{value:"Module"}));function Fk({color:e,index:t,onClick:i}){return ue.jsx("div",{onClick:i,className:"venue-pin",style:{...e?{background:e}:null,cursor:i?"pointer":"default"},children:ue.jsx("span",{children:t+1})})}function zk({icon:e,index:t,onClick:i}){const{t:r}=od(),[a,n]=le.useState(!1);return e.image&&!a?ue.jsx("div",{onClick:i,className:"venue-pin venue-pin--image",style:{cursor:i?"pointer":"default"},title:r("venues.map.pinTitle",{number:t+1}),children:ue.jsx("img",{src:e.image,alt:"",onError:()=>n(!0)})}):ue.jsx(Fk,{color:e.color,index:t,onClick:i})}const Rk=3959;function kk(e,t){const i=l=>l*Math.PI/180,r=i(t.lat-e.lat),a=i(t.lng-e.lng),n=i(e.lat),s=i(t.lat),o=Math.sin(r/2)**2+Math.cos(n)*Math.cos(s)*Math.sin(a/2)**2;return 2*Rk*Math.asin(Math.sqrt(o))}function Lk(e){return e<.19?`${Math.round(e*5280)} ft`:e<10?`${e.toFixed(1)} mi`:`${Math.round(e)} mi`}function Bk({origin:e,target:t,color:i}){if(!e)return null;const r=kk(e,t);return Number.isFinite(r)?ue.jsx("span",{className:"distance-pill",style:i?{background:i,borderColor:"transparent"}:void 0,children:Lk(r)}):null}function Ok({venue:e,index:t,userLocation:i,distanceColor:r,onClick:a}){const n=e.images.photo.display,s=e.group_chip;return ue.jsxs("button",{type:"button",className:"venue-card",onClick:a,children:[ue.jsx("div",{className:"venue-card__photo",children:n?ue.jsx("img",{src:n,alt:""}):ue.jsx(Hx,{})}),ue.jsxs("div",{className:"venue-card__body",children:[ue.jsxs("div",{className:"venue-card__title",children:[ue.jsxs("span",{className:"venue-card__index",children:[t+1,"."]})," ",e.name]}),e.subtitle&&ue.jsx("div",{className:"venue-card__subtitle",children:e.subt
823itle}),ue.jsxs("div",{className:"venue-card__pills",children:[s&&ue.jsx("span",{className:"venue-card__chip",style:s.color?{background:s.color}:void 0,children:s.name}),ue.jsx(Bk,{origin:i,target:{lat:e.lat,lng:e.lng},color:r??null})]})]})]})}function $k({initialValue:e="",onSearch:t,onLocateMe:i,locating:r}){const{t:a}=od(),[n,s]=le.useState(e),o=le.useRef(null);return le.useEffect(()=>(o.current&&clearTimeout(o.current),o.current=setTimeout(()=>t(n.trim()),350),()=>{o.current&&clearTimeout(o.current)}),[n]),ue.jsxs("div",{className:"venue-search",children:[i&&ue.jsx("button",{type:"button",className:"venue-search__locate",onClick:i,"aria-label":a("venues.search.locateMe"),disabled:r,children:ue.jsx(zu,{icon:"far fa-location-arrow"})}),ue.jsxs("div",{className:"venue-search__input",children:[ue.jsx(zu,{icon:"far fa-magnifying-glass",className:"venue-search__icon"}),ue.jsx("input",{type:"text",placeholder:a("venues.search.placeholder"),value:n,onChange:l=>s(l.target.value)}),n&&ue.jsx("button",{type:"button",className:"venue-search__clear",onClick:()=>s(""),"aria-label":a("venues.search.clear"),children:ue.jsx(zu,{icon:"far fa-xmark"})})]})]})}function jk(){return __({queryKey:["venues","map_config"],queryFn:async()=>(await y_.get("/api/v3/venues/map_config")).data.data,staleTime:30*6e4,refetchOnMount:!0})}function Vk({region:e,name:t,enabled:i=!0}={}){return __({queryKey:["venues",{region:e,name:t}],queryFn:async()=>{const r={};return e&&(r["region[lat]"]=e.lat,r["region[lng]"]=e.lng,r["region[delta_lat]"]=e.delta_lat,r["region[delta_lng]"]=e.delta_lng),t&&(r.name=t),(await y_.get("/api/v3/venues",{params:r})).data.data},enabled:i,placeholderData:Gx,staleTime:30*6e4,refetchOnMount:!0})}ti.WORKER_URL=mb;const Nk="https://tiles.openfreemap.org/styles/liberty",Uk={latitude:39.5,longitude:-98.35,zoom:4},rr=(e,t)=>typeof e=="number"&&Number.isFinite(e)&&e>=-90&&e<=90&&typeof t=="number"&&Number.isFinite(t)&&t>=-180&&t<=180;function Gk(){return ue.jsx("div",{style:{width:18,height:18,borderRadius:"50%",background:"#1976ff",border:"3px solid white",boxShadow:"0 0 0 4px rgba(25, 118, 255, 0.25), 0 1px 4px rgba(0,0,0,0.4)"}})}function oL(){const{t:e}=od(),t=Zx(),i=le.useRef(null),r=le.useRef(!1),a=uf(),n=le.useMemo(()=>{const E=Xx(),F=E!==null&&Date.now()-E<200,B=uf.getState();return F?{view:B.view,region:B.region,searchQuery:B.searchQuery,scrollPosition:B.scrollPosition}:(B.reset(),{view:null,region:null,searchQuery:"",scrollPosition:0})},[]),{data:s,isLoading:o,error:l}=jk(),[u,h]=le.useState(n.region),[c,d]=le.useState(n.searchQuery),[p,f]=le.useState(null),[m,g]=le.useState(!1),[_,y]=le.useState(!1),[x,v]=le.useState(!1),[w,b]=le.useState(null);le.useEffect(()=>{a.setRegion(u??null)},[u]),le.useEffect(()=>{a.setSearchQuery(c)},[c]);const T=le.useMemo(()=>{const E=s==null?void 0:s.center;return!E||!rr(E.lat,E.lng)?null:{lat:E.lat,lng:E.lng,delta_lat:360,delta_lng:720}},[s]),P=u??T,{data:S,isFetching:M}=Vk({region:P??void 0,name:c||void 0,enabled:!!s}),k=le.useMemo(()=>{if(n.view)return{latitude:n.view.latitude,longitude:n.view.longitude,zoom:n.view.zoom};const E=s==null?void 0:s.center;return E&&rr(E.lat,E.lng)?{latitude:E.lat,longitude:E.lng,zoom:(s==null?void 0:s.zoom)||10}:Uk},[s]);le.useEffect(()=>{n.view&&(r.current=!0)},[]),le.useEffect(()=>{if(r.current||!x||!i.current||!S||S.length===0)return;const E=S.filter(ze=>rr(ze.lat,ze.lng));if(E.length===0)return;const F=i.current.getMap();if(E.length===1){F.flyTo({center:[E[0].lng,E[0].lat],zoom:14,duration:500}),r.current=!0;return}const B=Math.max(...E.map(ze=>ze.lat))-Math.min(...E.map(ze=>ze.lat)),j=Math.max(...E.map(ze=>ze.lng))-Math.min(...E.map(ze=>ze.lng));if(B>10||j>10){r.current=!0;return}let H=E;if((B>3||j>3)&&E.length>=4){const ze=E.reduce((se,J)=>se+J.lat,0)/E.length,Ue=E.reduce((se,J)=>se+J.lng,0)/E.length,Ot=Math.cos(ze*Math.PI/180),Ht=E.map(se=>({v:se,d:Math.hypot(se.lat-ze,(se.lng-Ue)*Ot)})),jt=Ht.map(se=>se.d).sort((se,J)=>se-J),Xt=jt[Math.floor(jt.length*.25)],Z=jt[Math.floor(jt.length*.75)],re=Z-Xt,ne=Z+1.5*re,$=Ht.filter(se=>se.d<=ne).map(se=>se.v);$.length>=2&&$.length<E.length&&(H=$)}const ce=H.map(ze=>ze.lat),Fe=H.map(ze=>ze.lng),pe=Math.min(...ce),Ve=Math.max(...ce),Te=Math.min(...Fe),Ne=Math.max(...Fe),Ce=Math.max(Ve-pe,.005),st=Math.max(Ne-Te,.005),Tt=[Te-st*.25,pe-Ce*.25],Bt=[Ne+st*.25,Ve+Ce*.25];F.fitBounds([Tt,Bt],{padding:64,maxZoom:14,duration:600}),r.current=!0},[S,x]),le.useEffect(()=>{let E=!1;return lf().then(F=>{E||F.success&&F.coords&&rr(F.coords.lat,F.coords.lng)&&f(F.coords)}),()=>{E=!0}},[]),le.useEffect(()=>{n.scrollPosition&&window.scrollTo({top:n.scrollPosition})},[]),le.useEffect(()=>{let E=!1;const F=()=>{E||(E=!0,requestAnimationFrame(()=>{a.setScrollPosition(window.scrollY),E=!1}))};return window.addEventListener("scroll",F,{passive:!0}),()=>window.removeEventListener("scroll",F)},[]);const R=E=>{a.setScrollPosition(window.scrollY),t({to:"/venues/$venueId",params:{venueId:String(E.id)}})},D=async()=>{g(!0);const E=await lf();g(!1),!(!E.success||!E.coords)&&rr(E.coords.lat,E.coords.lng)&&(f(E.coords),i.current&&i.current.getMap().flyTo({center:[E.coords.lng,E.coords.lat],zoom:13,duration:600}))},I=()=>
823{if(!i.current)return;const E=i.current.getMap(),F=E.getCenter(),B=E.getBounds();rr(F.lat,F.lng)&&(h({lat:F.lat,lng:F.lng,delta_lat:Math.abs(B.getNorth()-B.getSouth()),delta_lng:Math.abs(B.getEast()-B.getWest())}),y(!1))};if(l)return ue.jsx("div",{className:"venues-page",children:ue.jsx("div",{className:"venues-page__error",children:ue.jsx("p",{children:e("venues.map.loadError")})})});if(o||!s)return ue.jsx("div",{className:"venues-page",children:ue.jsx("div",{className:"venues-page__loading",children:ue.jsx(Wx,{})})});const C=(S??[]).filter(E=>{if(!rr(E.lat,E.lng))return!1;if(w){const F=(w.n-w.s)*.05,B=(w.e-w.w)*.05;if(E.lat>w.n+F||E.lat<w.s-F||E.lng>w.e+B||E.lng<w.w-B)return!1}return!0});return ue.jsx("div",{className:"venues-page",children:ue.jsxs("div",{className:"venues-page__split",children:[ue.jsxs("div",{className:"venues-page__map",children:[ue.jsxs(ub,{ref:i,initialViewState:k,mapStyle:Nk,style:{width:"100%",height:"100%"},attributionControl:!1,maxPitch:0,pitchWithRotate:!1,dragRotate:!1,touchPitch:!1,onLoad:E=>{const F=E.target,B=F.getCenter(),j=F.getBounds();v(!0),rr(B.lat,B.lng)&&(b({n:j.getNorth(),s:j.getSouth(),e:j.getEast(),w:j.getWest()}),a.setView({latitude:B.lat,longitude:B.lng,zoom:F.getZoom()}))},onMoveEnd:E=>{const F=E.target,B=F.getCenter(),j=F.getBounds();rr(B.lat,B.lng)&&(b({n:j.getNorth(),s:j.getSouth(),e:j.getEast(),w:j.getWest()}),a.setView({latitude:B.lat,longitude:B.lng,zoom:F.getZoom()}),E.originalEvent&&(y(!0),u&&h(null)))},children:[ue.jsx(fb,{position:"top-right",showCompass:!1}),C.map((E,F)=>ue.jsx(vf,{latitude:E.lat,longitude:E.lng,anchor:"bottom",children:ue.jsx(zk,{icon:E.icon,index:F,onClick:()=>R(E)})},E.id)),p&&ue.jsx(vf,{latitude:p.lat,longitude:p.lng,anchor:"center",children:ue.jsx(Gk,{})})]}),_&&ue.jsx("button",{type:"button",className:"venues-page__redo",onClick:I,children:e("venues.map.redoSearch")}),ue.jsxs("details",{className:"venues-page__attribution",children:[ue.jsx("summary",{"aria-label":e("venues.map.credits"),children:"i"}),ue.jsxs("div",{children:["©"," ",ue.jsx("a",{href:"https://www.openstreetmap.org/copyright",target:"_blank",rel:"noreferrer",children:"OpenStreetMap"})," · ",ue.jsx("a",{href:"https://openfreemap.org",target:"_blank",rel:"noreferrer",children:"OpenFreeMap"})]})]})]}),ue.jsx($k,{initialValue:c,onSearch:d,onLocateMe:D,locating:m}),ue.jsx("div",{className:"venues-page__list",children:C.map((E,F)=>ue.jsx(Ok,{venue:E,index:F,userLocation:p,distanceColor:s.default_pin_color,onClick:()=>R(E)},E.id))})]})})}export{oL as Venues};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.