PageSourceSearch

https://www.onepassselect.com/_next/static/chunks/02e20e0b-31828d30d1ac25a0.js

js onepassselect.com collected 2026-10-04 05:12:54 UTC 541,963 bytes, 804 lines download raw bytes

1"use strict";(self.__LOADABLE_LOADED_CHUNKS__=self.__LOADABLE_LOADED_CHUNKS__||[]).push([[9411],{77612:(t,i,r)=>{let a,o,s,n,l,h,c,u,d,_;r.d(i,{QE:()=>a7,T5:()=>a0,ov:()=>a2,pH:()=>a9});var p=r(41148);function m(){var t=new p.Ri(4);return p.Ri!=Float32Array&&(t[1]=0,t[2]=0),t[0]=1,t[3]=1,t}let f={frame(t,i,r,a){let o=a||window,s=o.requestAnimationFrame(t=>{n(),i(t)}),{unsubscribe:n}=(0,p.Fr)(t.signal,"abort",()=>{n(),o.cancelAnimationFrame(s),r(new p.Ln(t.signal.reason))},!1)},frameAsync(t,i){return new Promise((r,a)=>{this.frame(t,r,a,i)})},getImageData(t,i=0){return this.getImageCanvasContext(t).getImageData(-i,-i,t.width+2*i,t.height+2*i)},getImageCanvasContext(t){let i=window.document.createElement("canvas"),r=i.getContext("2d",{willReadFrequently:!0});if(!r)throw Error("failed to create canvas 2d context");return i.width=t.width,i.height=t.height,r.drawImage(t,0,0,t.width,t.height),r},resolveURL:t=>((a||=document.createElement("a")).href=t,a.href),get hardwareConcurrency(){return"u">typeof navigator&&navigator.hardwareConcurrency||4},get prefersReducedMotion(){return void 0===s?!!matchMedia&&(o??=matchMedia("(prefers-reduced-motion: reduce)")).matches:s},set prefersReducedMotion(e){s=e}},g=new class{constructor(){this._frozenAt=null}getCurrentTime(){return null===this._frozenAt?performance.now():this._frozenAt}setNow(t){this._frozenAt=t}restoreNow(){this._frozenAt=null}isFrozen(){return null!==this._frozenAt}};function v(){return g.getCurrentTime()}var y=class t{static{this.docStyle="u">typeof window&&window.document?.documentElement.style}static{this.selectProp=!t.docStyle||"userSelect"in t.docStyle?"userSelect":"webkitUserSelect"}static create(t,i,r){let a=window.document.createElement(t);return void 0!==i&&(a.className=i),r&&r.appendChild(a),a}static createNS(t,i){return window.document.createElementNS(t,i)}static disableDrag(){t.docStyle&&t.selectProp&&(t.userSelect=t.docStyle[t.selectProp],t.docStyle[t.selectProp]="none")}static enableDrag(){t.docStyle&&t.selectProp&&(t.docStyle[t.selectProp]=t.userSelect)}static suppressClickInternal(i){i.preventDefault(),i.stopPropagation(),window.removeEventListener("click",t.suppressClickInternal,!0)}static suppressClick(){window.addEventListener("click",t.suppressClickInternal,!0),window.setTimeout(()=>{window.removeEventListener("click",t.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 p.Vi((r.clientX-a.left)/i.x-t.clientLeft,(r.clientY-a.top)/i.y-t.clientTop)}static mousePos(i,r){let a=t.getScale(i);return t.getPoint(i,a,r)}static touchPos(i,r){let a=[],o=t.getScale(i);for(let s of r)a.push(t.getPoint(i,o,s));return a}static sanitize(i){let r=new DOMParser().parseFromString(i,"text/html").body||document.createElement("body");for(let t of r.querySelectorAll("script"))t.remove();return t.clean(r),r.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.startsWith("on"))return!0}static clean(i){for(let r of i.children)t.removeAttributes(r),t.clean(r)}static removeAttributes(i){for(let{name:r,value:a}of Array.from(i.attributes))t.isPossiblyDangerous(r,a)&&i.removeAttribute(r)}};(function(t){let i,r,a,o;t.resetRequestQueue=()=>{i=[],r=0,a=0,o={}},t.addThrottleControl=t=>{let i=a++;return o[i]=t,i},t.removeThrottleControl=t=>{delete o[t],l()},t.transformAndGetImage=async function(t,i,r,a,o=!0,s){let l=await t.transformRequest(i,r);return(0,p.zn)(a.signal),n.getImage(l,a,o,s)},t.getImage=(t,r,a=!0,o)=>new Promise((s,n)=>{t.headers||={},t.headers.accept="image/webp,*/*",(0,p.or)(t,{type:"image"}),i.push({abortController:r,requestParameters:t,supportImageRefresh:a,imageBitmapOptions:o,state:"queued",onError:t=>{n(t)},onSuccess:t=>{s(t)}}),l()});let s=async t=>{t.state="running";let{requestParameters:i,supportImageRefresh:a,imageBitmapOptions:o,onError:s,onSuccess:n,abortController:c}=t,u=!1===a&&!o&&!(0,p.yr)(self)&&!(0,p.Pn)(i.url)&&(!i.headers||Object.keys(i.headers).reduce((t,i)=>t&&"accept"===i,!0));r++;let d=u?h(i,c):(0,p.jn)(i,c);try{let i,r=await d;delete t.abortController,t.state="completed",r.data instanceof HTMLImageElement||(0,p.mr)(r.data)?n(r):r.data&&n({data:await (i=r.data,"function"==typeof createImageBitmap?(0,p.Wn)(i,o):(0,p.Un)(i)),cacheControl:r.cacheControl,expires:r.expires})}catch(i){delete t.abortController,s((0,p.ir)(i))}finally{r--,l()}},l=()=>{let t=(()=>{for(let t of Object.keys(o))if(o[t]())return!0;return!1})()?p.In.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:p.In.MAX_PARALLEL_IMAGE_REQUESTS;for(let a=r;a<t&&i.length>0;a++){let t=i.shift();if(t.abortController.signal.aborted){a--;continue}s(t)}},h=(t,i)=>new Promise((r,a)=>{let o=new Image,s=t.url,n=t.credentials;n&&"include"===n?o.crossOrigin="use-credentials":(n&&"same-origin"===n||!(0,p.Mn)(s))&&(o.crossOrigin="anonymous"),i.signal.addEventListener("abort",()=>{o.src="",a(new p.Ln(i.signal.reason))}),o.fetchPriority="high",o.onload=()=>{o.onerror=o.onload=null,r({data:o})},o.onerror=()=>{o.onerror=o.onload=null,i.signal.aborted||a(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."))},o.src=s})})(n||={}),n.resetRequestQueue();var x=class{constructor(t){this._transformRequestFn=t??null}transformRequest(t,i){return this._transformRequestFn&&this._transformRequestFn(t,i)||{url:t}}setTransformRequest(t){this._transformRequestFn=t}},b=class extends p.Cn{},w=class extends b{},T=class extends b{constructor(t={}){super("style.load",t)}},P=class extends b{constructor(t,i={}){super(t,i),this.dataType="style"}}
1,M=class extends b{constructor(t,i={}){super(t,i),this.dataType="source"}},I=class extends b{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,i,r,a={}){r=r instanceof MouseEvent?r:new MouseEvent(t,r);let o=y.mousePos(i.getCanvas(),r);super(t,(0,p.or)({point:o,lngLat:i.unproject(o),originalEvent:r},a)),this._defaultPrevented=!1,this.target=i}},S=class extends b{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,i,r){let a="touchend"===t?r.changedTouches:r.touches,o=y.touchPos(i.getCanvasContainer(),a),s=o.map(t=>i.unproject(t)),n=o.reduce((t,i,r,a)=>t.add(i.div(a.length)),new p.Vi(0,0));super(t,{points:o,point:n,lngLats:s,lngLat:i.unproject(n),originalEvent:r}),this._defaultPrevented=!1}},C=class extends b{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,i){super("wheel",{originalEvent:i}),this._defaultPrevented=!1}},E=class extends b{},z=class extends b{constructor(t={}){super("terrain",t)}},R=class extends b{constructor(t={}){super("projectiontransition",t)}},D=class extends b{},A=class extends b{constructor(t={}){super("styleimagemissing",t)}};function L(t){let i=[];if("string"==typeof t)i.push({id:"default",url:t});else if(t&&t.length>0){let r=[];for(let{id:a,url:o}of t){let t=`${a}${o}`;r.includes(t)||(r.push(t),i.push({id:a,url:o}))}}return i}function F(t,i,r){try{let a=new URL(t);return a.pathname+=`${i}${r}`,a.toString()}catch{throw Error(`Invalid sprite URL "${t}", must be absolute. Modify style specification directly or use TransformStyleFunction to correct the issue dynamically`)}}async function k(t,i,r,a){let o=L(t),s=r>1?"@2x":"",l={},h={};for(let{id:t,url:r}of o){let o=await i.transformRequest(F(r,s,".json"),"SpriteJSON");l[t]=(0,p.On)(o,a);let c=await i.transformRequest(F(r,s,".png"),"SpriteImage");h[t]=n.getImage(c,a)}return await Promise.all([...Object.values(l),...Object.values(h)]),B(l,h)}async function B(t,i){let r={};for(let a in t){r[a]={};let o=f.getImageCanvasContext((await i[a]).data),s=(await t[a]).data;for(let t in s){let{width:i,height:n,x:l,y:h,sdf:c,pixelRatio:u,stretchX:d,stretchY:_,content:p,textFitWidth:m,textFitHeight:f}=s[t],g={width:i,height:n,x:l,y:h,context:o};r[a][t]={data:null,pixelRatio:u,sdf:c,stretchX:d,stretchY:_,content:p,textFitWidth:m,textFitHeight:f,spriteData:g}}}return r}var j=class extends p.wn{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 t of Object.keys(this.images))this.removeImage(t);this._spriteImagesIds={}}isLoaded(){return this.loaded}setLoaded(t){if(this.loaded!==t&&(this.loaded=t,t)){for(let{ids:t,promiseResolve:i}of this.requestors)i(this._getImagesForIds(t));this.requestors=[]}}getImage(t){let i=this.images[t];if(i&&!i.data&&i.spriteData){let t=i.spriteData;i.data=new p.Dt({width:t.width,height:t.height},t.context.getImageData(t.x,t.y,t.width,t.height).data),i.spriteData=null}return i}addImage(t,i){if(this.images[t])throw Error(`Image id ${t} already exist, use updateImage instead`);this._validate(t,i)&&(this.images[t]=i,this._imagesIds=null,i.isWebGLImage&&this.updateImage(t,i,!1))}_validate(t,i){let r=!0,a=i.data||i.spriteData;return this._validateStretch(i.stretchX,a?.width)||(this.fire(new p.Sn(Error(`Image "${t}" has invalid "stretchX" value`))),r=!1),this._validateStretch(i.stretchY,a?.height)||(this.fire(new p.Sn(Error(`Image "${t}" has invalid "stretchY" value`))),r=!1),this._validateContent(i.content,i)||(this.fire(new p.Sn(Error(`Image "${t}" has invalid "content" value`))),r=!1),r}_validateStretch(t,i){if(!t)return!0;let r=0;for(let a of t){if(a[0]<r||a[1]<a[0]||i<a[1])return!1;r=a[1]}return!0}_validateContent(t,i){if(!t)return!0;if(4!==t.length)return!1;let r=i.spriteData,a=r?.width||i.data.width,o=r?.height||i.data.height;return!(t[0]<0)&&!(a<t[0])&&!(t[1]<0)&&!(o<t[1])&&!(t[2]<0)&&!(a<t[2])&&!(t[3]<0)&&!(o<t[3])&&!(t[2]<t[0])&&t[3]>=t[1]}updateImage(t,i,r=!0){let a=this.images[t];if(r){let t=a.data||a.spriteData;if(t.width!==i.data.width||t.height!==i.data.height)throw Error(`size mismatch between old image (${t.width}x${t.height}) and new image (${i.data.width}x${i.data.height}).`)}i.version=(a.version??0)+1,this.images[t]=i,this.updateVersion++}removeImage(t){let i=this.images[t];i&&(delete this.images[t],this._imagesIds=null,i.userImage?.onRemove&&i.userImage.onRemove())}listImages(){return this._imagesIds??=Object.keys(this.images),this._imagesIds}_getSpriteImageId(t,i){return"default"===t?i:`${t}:${i}`}setSpriteImages(t,i){let r=this._spriteImagesIds[t]??[],a=[];for(let r in i){let o=this._getSpriteImageId(t,r);a.push(o),o in this.images?this.updateImage(o,i[r],!1):this.addImage(o,i[r])}
1let o=new Set(a),s=r.filter(t=>!o.has(t));for(let t of s)this.removeImage(t);return this._spriteImagesIds[t]=a,{loaded:a,removed:s}}removeSpriteImages(t){let i=this._spriteImagesIds[t]??[];for(let t of i)this.removeImage(t);return delete this._spriteImagesIds[t],i}removeAllSpriteImages(){let t=Object.values(this._spriteImagesIds).flat();for(let i of t)this.removeImage(i);return this._spriteImagesIds={},t}setMissingImageResolver(t){this.missingImageResolver=t}getImages(t){return new Promise((i,r)=>{let a=!0;if(!this.isLoaded())for(let i of t)this.images[i]||(a=!1);this.isLoaded()||a?i(this._getImagesForIds(t)):this.requestors.push({ids:t,promiseResolve:i})})}async _getImagesForIds(t){let i=new Set(t.filter(t=>!this.getImage(t))),r=this.missingImageResolver;r&&await Promise.allSettled(Array.from(i,t=>r(t)));let a={};for(let r of t){let t=this.getImage(r);t&&(i.delete(r),a[r]={data:t.data.clone(),pixelRatio:t.pixelRatio,sdf:t.sdf,version:t.version,stretchX:t.stretchX,stretchY:t.stretchY,content:t.content,textFitWidth:t.textFitWidth,textFitHeight:t.textFitHeight,hasRenderCallback:!!t.userImage?.render,isWebGLImage:t.isWebGLImage})}for(let t of i)this.fire(new A({id:t})),(0,p.zr)(`Image "${t}" 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 a}beginFrame(){this._renderCallbacksDispatchedThisFrame={}}dispatchRenderCallbacks(t){for(let i of t){if(this._renderCallbacksDispatchedThisFrame[i])continue;this._renderCallbacksDispatchedThisFrame[i]=!0;let t=this.getImage(i);t||(0,p.zr)(`Image with ID: "${i}" was not found`),(0,p.R)(t)&&this.updateImage(i,t)}}cloneImages(){let t={};for(let i in this.images){let r=this.images[i];t[i]={...r,data:r.data?r.data.clone():null}}return t}},O=class{constructor(t){this._imageManager=t,this._entries={},this._image=new p.Dt({width:1,height:1}),this._dirty=!0}destroy(){this._texture&&=(this._texture.destroy(),null),this._entries={},this._image=new p.Dt({width:1,height:1}),this._dirty=!0}getPixelSize(){let{width:t,height:i}=this._image;return{width:t,height:i}}getPattern(t){let i=this._imageManager.getImage(t);if(!i)return null;let r=this._entries[t];
1if(r?.image!==i){let r={w:i.data.width+2,h:i.data.height+2,x:0,y:0};this._entries[t]={bin:r,position:new p.F(r,i),image:i}}else{if(r.position.version===i.version)return r.position;r.position.version=i.version}return this._update(),this._entries[t].position}bind(t){let i=t.gl;this._texture?this._dirty&&=(this._texture.update(this._image),!1):(this._texture=new p.xt(t,this._image,i.RGBA),this._dirty=!1),this._texture.bind(i.LINEAR,i.CLAMP_TO_EDGE)}_update(){for(let t in this._entries)this._imageManager.getImage(t)||delete this._entries[t];let t=[];for(let i in this._entries)t.push(this._entries[i].bin);let{w:i,h:r}=(0,p.I)(t),a=this._image;for(let t in a.resize({width:i||1,height:r||1}),this._entries){let{bin:i}=this._entries[t],r=i.x+1,o=i.y+1,s=this._entries[t].image.data,n=s.width,l=s.height;p.Dt.copy(s,a,{x:0,y:0},{x:r,y:o},{width:n,height:l}),p.Dt.copy(s,a,{x:0,y:l-1},{x:r,y:o-1},{width:n,height:1}),p.Dt.copy(s,a,{x:0,y:0},{x:r,y:o+l},{width:n,height:1}),p.Dt.copy(s,a,{x:n-1,y:0},{x:r-1,y:o},{width:1,height:l}),p.Dt.copy(s,a,{x:0,y:0},{x:r+n,y:o},{width:1,height:l})}this._dirty=!0}};async function N(t,i,r,a){let o=256*i,s=o+255,n=await a.transformRequest(r.replace("{fontstack}",t).replace("{range}",`${o}-${s}`),"Glyphs"),l=await (0,p.Dn)(n,new AbortController);if(!l?.data)throw Error(`Could not load glyph range. range: ${i}, ${o}-${s}`);let h={};for(let t of(0,p.z)(l.data))h[t.id]=t;return h}let Z=new Float64Array(256);for(let t=0;t<256;t++){let i=.5-(t/255)**(1/2.2);Z[t]=i*Math.abs(i)}Z[255]=-1e20;var U=class{constructor({fontSize:t=24,buffer:i=3,radius:r=8,cutoff:a=.25,fontFamily:o="sans-serif",fontWeight:s="normal",fontStyle:n="normal",lang:l=null}={}){this.buffer=i,this.radius=r,this.cutoff=a,this.lang=l;let h=this.size=t+4*i,c=this._createCanvas(h),u=this.ctx=c.getContext("2d",{willReadFrequently:!0});u.font=`${n} ${s} ${t}px ${o}`,u.textBaseline="alphabetic",u.textAlign="left",u.fillStyle="black",this.gridOuter=new Float64Array(h*h),this.gridInner=new Float64Array(h*h),this.f=new Float64Array(h),this.z=new Float64Array(h+1),this.v=new Uint16Array(h)}_createCanvas(t){if("u">typeof OffscreenCanvas)return new OffscreenCanvas(t,t);let i=document.createElement("canvas");return i.width=i.height=t,i}draw(t){let{width:i,actualBoundingBoxAscent:r,actualBoundingBoxDescent:a,actualBoundingBoxLeft:o,actualBoundingBoxRight:s}=this.ctx.measureText(t),n=Math.ceil(r),l=Math.floor(-o),h=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(s)-l)),c=Math.max(0,Math.min(this.size-this.buffer,n+Math.ceil(a))),u=h+2*this.buffer,d=c+2*this.buffer,_=Math.max(u*d,0),p=new Uint8ClampedArray(_),m={data:p,width:u,height:d,glyphWidth:h,glyphHeight:c,glyphTop:n,glyphLeft:l,glyphAdvance:i};if(0===h||0===c)return m;let{ctx:f,buffer:g,gridInner:v,gridOuter:y}=this;this.lang&&(f.lang=this.lang),f.clearRect(g,g,h,c),f.fillText(t,g-l,g+n);let x=f.getImageData(g,g,h,c);y.fill(1e20,0,_),v.fill(0,0,_);let b=3;for(let t=0;t<c;t++){let i=(t+g)*u+g;for(let t=0;t<h;t++,b+=4,i++){let t=x.data[b];if(0===t)continue;let r=Z[t];y[i]=Math.max(0,r),v[i]=Math.max(0,-r)}}V(y,0,0,u,d,u,this.f,this.v,this.z);let w=Math.min(g,1);V(v,g-w,g-w,h+2*w,c+2*w,u,this.f,this.v,this.z);let T=255/this.radius,P=255*(1-this.cutoff);for(let t=0;t<_;t++){let i=Math.sqrt(y[t])-Math.sqrt(v[t]);p[t]=Math.round(P-T*i)}return m}};function V(t,i,r,a,o,s,n,l,h){for(let c=i;c<i+a;c++)G(t,r*s+c,s,o,n,l,h);for(let c=r;c<r+o;c++)G(t,c*s+i,1,a,n,l,h)}function G(t,i,r,a,o,s,n){s[0]=0,n[0]=-1e20,n[1]=1e20,o[0]=t[i];for(let l=1,h=0,c=0;l<a;l++){o[l]=t[i+l*r];let a=l*l;do{let t=s[h];c=(o[l]-o[t]+a-t*t)/(l-t)/2}while(c<=n[h]&&--h>-1);s[++h]=l,n[h]=c,n[h+1]=1e20}for(let l=0,h=0;l<a;l++){for(;n[h+1]<l;)h++;let a=s[h],c=l-a;t[i+l*r]=o[a]+c*c}}let q=p.xn.layout_symbol["text-font"].default.join(",");var W=class t{static{this.loadGlyphRange=N}static{this.TinySDF=U}constructor(t,i,r){this.requestManager=t,this.localIdeographFontFamily=i,this.entries={},this.lang=r}setURL(t){this.url=t}async getGlyphs(t){let i=[];for(let r in t)for(let a of t[r])i.push(this._getAndCacheGlyphsPromise(r,a));let r=await Promise.all(i),a={};for(let{stack:t,id:i,glyph:o}of r)a[t]||={},a[t][i]=o&&{id:o.id,bitmap:o.bitmap.clone(),metrics:o.metrics};return a}
1async _getAndCacheGlyphsPromise(t,i){this.entries[t]??={glyphs:{},requests:{},ranges:{}};let r=this.entries[t],a=r.glyphs[i];return void 0===a?!this.url||this._charUsesLocalIdeographFontFamily(i)?(a=r.glyphs[i]=await this._drawGlyph(r,t,i),{stack:t,id:i,glyph:a}):await this._downloadAndCacheRangePromise(t,i):{stack:t,id:i,glyph:a}}async _downloadAndCacheRangePromise(i,r){let a=this.entries[i],o=Math.floor(r/256);if(a.ranges[o])return{stack:i,id:r,glyph:null};a.requests[o]||=t.loadGlyphRange(i,o,this.url,this.requestManager);try{let t=await a.requests[o];for(let i in t)a.glyphs[+i]=t[+i];return a.ranges[o]=!0,{stack:i,id:r,glyph:t[r]||null}}catch(s){let t=a.glyphs[r]=await this._drawGlyph(a,i,r);return this._warnOnMissingGlyphRange(t,o,r,(0,p.ir)(s)),{stack:i,id:r,glyph:t}}}_warnOnMissingGlyphRange(t,i,r,a){let o=256*i,s=r.toString(16).padStart(4,"0").toUpperCase();(0,p.zr)(`Unable to load glyph range ${i}, ${o}-${o+255}. Rendering codepoint U+${s} locally instead. ${a}`)}_charUsesLocalIdeographFontFamily(t){return!!this.localIdeographFontFamily&&(0,p.rn)(t)}async _drawGlyph(t,i,r){let a=i===q&&""!==this.localIdeographFontFamily&&this._charUsesLocalIdeographFontFamily(r),o=a?"ideographTinySDF":"tinySDF";t[o]||=this._createTinySDF(a?this.localIdeographFontFamily:i);let s=(await t[o]).draw(String.fromCodePoint(r)),n=/^\p{gc=Cf}+$/u.test(String.fromCodePoint(r));return{id:r,bitmap:new p.Et({width:s.width||60,height:s.height||60},s.data),metrics:{width:n?0:s.glyphWidth/2||24,height:s.glyphHeight/2||24,left:s.glyphLeft/2+.5||0,top:s.glyphTop/2-27.5||-8,advance:n?0:s.glyphAdvance/2||24,isDoubleResolution:!0}}}async _createTinySDF(i){let r=i?i.split(","):[];r.push("sans-serif");let a=r.map(t=>/[-\w]+/.test(t)?t:`'${CSS.escape(t)}'`).join(","),o=this._fontWeight(r[0]),s=this._fontStyle(r[0]);if("u">typeof document&&document.fonts?.load)try{await document.fonts.load(`${s} ${o||"normal"} 48px ${a}`)}catch(t){(0,p.zr)(`Failed to load font "${a}": ${(0,p.ir)(t).message}`)}return new t.TinySDF({fontSize:48,buffer:6,radius:16,cutoff:.25,fontFamily:a,fontWeight:o,fontStyle:s,lang:this.lang})}_fontStyle(t){return/italic/i.test(t)?"italic":/oblique/i.test(t)?"oblique":"normal"}_fontWeight(t){let i;for(let[r,a]of Object.entries({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}))RegExp(`\\b${r}\\b`,"i").test(t)&&(i=`${a}`);return i}destroy(){for(let t in this.entries){let i=this.entries[t];
1i.tinySDF=null,i.ideographTinySDF=null,i.glyphs={},i.requests={},i.ranges={}}this.entries={}}},$=class extends p.wn{constructor(t,i){super(),this._transitionable=new p.en(l||=new p.Qt({anchor:new p.Zt(p.xn.light.anchor,"anchor"),position:new p.Zt(p.xn.light.position,"position"),color:new p.Zt(p.xn.light.color,"color"),intensity:new p.Zt(p.xn.light.intensity,"intensity")}),"light",i),this.setLight(t),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}getCartesianPosition(){return(0,p.Pr)(this.properties.get("position"))}setLight(t,i={}){if(!this._validate(p.ln.light,t,i))for(let i in t){let r=t[i];i.endsWith("-transition")?this._transitionable.setTransition(i.slice(0,-p.$t.length),r):this._transitionable.setValue(i,r)}}updateTransitions(t){this._transitioning=this._transitionable.transitioned(t,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(t){this.properties=this._transitioning.possiblyEvaluate(t)}_validate(t,i,r){return(0,p.cn)(this,t,{value:i},r)}},H=class extends p.wn{constructor(t,i){super(),this._transitionable=new p.en(h||=new p.Qt({"sky-color":new p.Zt(p.xn.sky["sky-color"],"sky-color"),"horizon-color":new p.Zt(p.xn.sky["horizon-color"],"horizon-color"),"fog-color":new p.Zt(p.xn.sky["fog-color"],"fog-color"),"fog-ground-blend":new p.Zt(p.xn.sky["fog-ground-blend"],"fog-ground-blend"),"horizon-fog-blend":new p.Zt(p.xn.sky["horizon-fog-blend"],"horizon-fog-blend"),"sky-horizon-blend":new p.Zt(p.xn.sky["sky-horizon-blend"],"sky-horizon-blend"),"atmosphere-blend":new p.Zt(p.xn.sky["atmosphere-blend"],"atmosphere-blend")}),"sky",i),this.setSky(t),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new p.tn(0))}setSky(t,i={}){if(!this._validate(p.ln.sky,t,i))for(let i in t||={"sky-color":"transparent","horizon-color":"transparent","fog-color":"transparent","fog-ground-blend":1,"atmosphere-blend":0}){let r=t[i];i.endsWith("-transition")?this._transitionable.setTransition(i.slice(0,-p.$t.length),r):this._transitionable.setValue(i,r)}}getSky(){return this._transitionable.serialize()}updateTransitions(t){this._transitioning=this._transitionable.transitioned(t,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(t){this.properties=this._transitioning.possiblyEvaluate(t)}_validate(t,i,r={}){return(0,p.cn)(this,t,{value:i},r)}calculateFogBlendOpacity(t){return t<60?0:t<70?(t-60)/10:1}},X=class{constructor(t,i){this.width=t,this.height=i,this.nextRow=0,this.data=new Uint8Array(this.width*this.height),this.dashEntry={}}getDash(t,i){let r=t.join(",")+String(i);return this.dashEntry[r]||=this.addDash(t,i),this.dashEntry[r]}getDashRanges(t,i,r){let a=t.length%2==1,o=[],s=a?-t[t.length-1]*r:0,n=t[0]*r,l=!0;o.push({left:s,right:n,isDash:l,zeroLength:0===t[0]});let h=t[0];for(let i=1;i<t.length;i++){l=!l;let a=t[i];s=h*r,h+=a,n=h*r,o.push({left:s,right:n,isDash:l,zeroLength:0===a})}return o}addRoundDash(t,i,r){let a=i/2;for(let i=-r;i<=r;i++){let o=this.nextRow+r+i,s=this.width*o,n=0,l=t[0];for(let o=0;o<this.width;o++){o/l.right>1&&(l=t[++n]);let h=Math.min(Math.abs(o-l.left),Math.abs(o-l.right)),c,u=i/r*(a+1);if(l.isDash){let t=a-Math.abs(u);c=Math.sqrt(h*h+t*t)}else c=a-Math.sqrt(h*h+u*u);this.data[s+o]=Math.max(0,Math.min(255,c+128))}}}addRegularDash(t){for(let i=t.length-1;i>=0;--i){let r=t[i],a=t[i+1];r.zeroLength?t.splice(i,1):a?.isDash===r.isDash&&(a.left=r.left,t.splice(i,1))}let i=t[0],r=t[t.length-1];i.isDash===r.isDash&&(i.left=r.left-this.width,r.right=i.right+this.width);let a=this.width*this.nextRow,o=0,s=t[0];for(let i=0;i<this.width;i++){i/s.right>1&&(s=t[++o]);let r=Math.min(Math.abs(i-s.left),Math.abs(i-s.right)),n=s.isDash?r:-r;this.data[a+i]=Math.max(0,Math.min(255,n+128))}}addDash(t,i){let r=7*!!i,a=2*r+1;if(this.nextRow+a>this.height)return(0,p.zr)("LineAtlas out of space"),null;let o=0;for(let i of t)o+=i;if(0!==o){let a=this.width/o,s=this.getDashRanges(t,this.width,a);i?this.addRoundDash(s,a,r):this.addRegularDash(s)}let s={y:this.nextRow+r,height:2*r,width:o};return this.nextRow+=a,this.dirty=!0,s}bind(t){let i=t.gl;this.texture?(i.bindTexture(i.TEXTURE_2D,this.texture),this.dirty&&(this.dirty=!1,i.texSubImage2D(i.TEXTURE_2D,0,0,0,this.width,this.height,i.ALPHA,i.UNSIGNED_BYTE,this.data))):(this.texture=i.createTexture(),i.bindTexture(i.TEXTURE_2D,this.texture),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,i.REPEAT),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,i.REPEAT),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,i.LINEAR),i.texImage2D(i.TEXTURE_2D,0,i.ALPHA,this.width,this.height,0,i.ALPHA,i.UNSIGNED_BYTE,this.data))}};function K(t,i){if(i)try{return new Worker(t,{type:"module"})}catch(t){console.warn("Module worker not supported, falling back to classic worker",t)}return new Worker(t)}async function Y(t){let i=await fetch(t);if(!i.ok)throw Error(`Failed to fetch worker script (${i.status}): ${t}`);
1let r=new Blob([await i.text()],{type:"text/javascript"});return URL.createObjectURL(r)}async function J(){let t=p.In.WORKER_URL||function(){let t="file:///home/runner/_work/pass-frontend/pass-frontend/node_modules/maplibre-gl/dist/maplibre-gl.mjs";if(!/^https?:/.test(t))return"";let i=t.endsWith("-dev.mjs")?"maplibre-gl-worker-dev.mjs":"maplibre-gl-worker.mjs";return new URL(`./${i}`,t).href}(),i=!t?.endsWith(".cjs");if(!function(t){if(!t)return!1;let i=globalThis.location;if(!i)return!1;try{return new URL(t,i.href).origin!==i.origin}catch{return!1}}(t))return K(t,i);if(i){let r,a=(r=new Blob([`import ${JSON.stringify(new URL(t,"file:///home/runner/_work/pass-frontend/pass-frontend/node_modules/maplibre-gl/dist/maplibre-gl.mjs").href)}`],{type:"text/javascript"}),URL.createObjectURL(r));try{return K(a,i)}finally{URL.revokeObjectURL(a)}}let r=await Y(t);try{return K(r,i)}finally{URL.revokeObjectURL(r)}}var Q=class t{constructor(){this.active={},this.workersPromise=null}async acquire(i){if(this.active[i]=!0,!this.workersPromise){let i=[];for(;i.length<t.workerCount;)i.push(J());this.workersPromise=Promise.all(i)}return(await this.workersPromise).slice()}release(t){if(delete this.active[t],0===this.numActive()&&this.workersPromise){let t=this.workersPromise;this.workersPromise=null,t.then(t=>{for(let i of t)i.terminate()})}}isPreloaded(){return!!this.active.maplibre_preloaded_worker_pool}numActive(){return Object.keys(this.active).length}};let ee=Math.floor(f.hardwareConcurrency/2);Q.workerCount=(0,p.gr)(globalThis)?Math.max(Math.min(ee,3),1):1;var et=class{constructor(t,i){this.workerPool=t,this.actors=[],this.currentActor=0,this.id=i,this.removed=!1,this.actorsPromise=this.initActors(i)}async initActors(t){let i=await this.workerPool.acquire(t);if(this.removed)return[];if(this.actors=i.map((i,r)=>{let a=new p.x(i,t);return a.name=`Worker ${r}`,a}),!this.actors.length)throw Error("No actors found");return this.actors}async broadcast(t,i){return Promise.all((await this.actorsPromise).map(r=>r.sendAsync({type:t,data:i})))}async getActor(){let t=await this.actorsPromise;return this.currentActor=(this.currentActor+1)%t.length,t[this.currentActor]}async waitForInitComplete(){0===this.actors.length&&await this.actorsPromise}getReadyActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(t=!0){for(let t of(this.removed=!0,this.actors))t.remove();this.actors=[],t&&this.workerPool.release(this.id)}async registerMessageHandler(t,i){for(let r of(await this.actorsPromise))r.registerMessageHandler(t,i)}async unregisterMessageHandler(t){for(let i of(await this.actorsPromise))i.unregisterMessageHandler(t)}};function ei(t,i){let r=t.tileID,a=i.tileID;return r.overscaledZ-a.overscaledZ||r.canonical.y-a.canonical.y||r.wrap-a.wrap||r.canonical.x-a.canonical.x}function er(t,i){let r=t.feature,a=i.getFeatureState(r.layer["source-layer"],r.id);r.source=r.layer.source,r.layer["source-layer"]&&(r.sourceLayer=r.layer["source-layer"]),r.state=a}async function ea(t,i,r,a){let o=t;if(t.url?o=(await (0,p.On)(await i.transformRequest(t.url,"Source"),r)).data:await f.frameAsync(r,a),!o)return null;let s=(0,p.Tr)((0,p.or)(o,t),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);return"vector_layers"in o&&o.vector_layers&&(s.vectorLayerIds=o.vector_layers.map(t=>t.id)),s}var eo=class t{constructor(t,i){t&&(i?this.setSouthWest(t).setNorthEast(i):Array.isArray(t)&&(4===t.length?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 p.ct?new p.ct(t.lng,t.lat):p.ct.convert(t),this}setSouthWest(t){return this._sw=t instanceof p.ct?new p.ct(t.lng,t.lat):p.ct.convert(t),this}extend(i){let r=this._sw,a=this._ne,o,s;if(i instanceof p.ct)o=i,s=i;else if(i instanceof t){if(o=i._sw,s=i._ne,!o||!s)return this}else return Array.isArray(i)?4===i.length||i.every(Array.isArray)?this.extend(t.convert(i)):this.extend(p.ct.convert(i)):i&&("lng"in i||"lon"in i)&&"lat"in i?this.extend(p.ct.convert(i)):this;return r||a?(r.lng=Math.min(o.lng,r.lng),r.lat=Math.min(o.lat,r.lat),a.lng=Math.max(s.lng,a.lng),a.lat=Math.max(s.lat,a.lat)):(this._sw=new p.ct(o.lng,o.lat),this._ne=new p.ct(s.lng,s.lat)),this}getCenter(){return new p.ct((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)}
1getSouthWest(){return this._sw}getNorthEast(){return this._ne}getNorthWest(){return new p.ct(this.getWest(),this.getNorth())}getSouthEast(){return new p.ct(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}=p.ct.convert(t),a=this._sw.lat<=r&&r<=this._ne.lat,o=this._sw.lng<=i&&i<=this._ne.lng;return this._sw.lng>this._ne.lng&&(o=this._sw.lng>=i&&i>=this._ne.lng),a&&o}intersects(i){if(!((i=t.convert(i)).getNorth()>=this.getSouth()&&i.getSouth()<=this.getNorth()))return!1;let r=Math.abs(this.getEast()-this.getWest()),a=Math.abs(i.getEast()-i.getWest());if(r>=360||a>=360)return!0;let o=(0,p.Br)(this.getWest(),-180,180),s=(0,p.Br)(this.getEast(),-180,180),n=(0,p.Br)(i.getWest(),-180,180),l=(0,p.Br)(i.getEast(),-180,180),h=o>s,c=n>l;return!!h&&!!c||(h?l>=o||n<=s:c?s>=n||o<=l:n<=s&&l>=o)}static convert(i){return i instanceof t||!i?i:new t(i)}static fromLngLat(i,r=0){let a=360*r/0x2637f09,o=a/Math.cos(Math.PI/180*i.lat);return new t(new p.ct(i.lng-o,i.lat-a),new p.ct(i.lng+o,i.lat+a))}adjustAntiMeridian(){let i=new p.ct(this._sw.lng,this._sw.lat),r=new p.ct(this._ne.lng,this._ne.lat);return i.lng>r.lng?new t(i,new p.ct(r.lng+360,r.lat)):new t(i,r)}},es=class{constructor(t,i,r){this.bounds=eo.convert(this.validateBounds(t)),this.minzoom=i||0,this.maxzoom=r||24}validateBounds(t){return Array.isArray(t)&&4===t.length?[Math.max(-180,t[0]),Math.max(-90,t[1]),Math.min(180,t[2]),Math.min(90,t[3])]:[-180,-90,180,90]}contains(t){let i=2**t.z,r={minX:Math.floor((0,p.at)(this.bounds.getWest())*i),minY:Math.floor((0,p.ot)(this.bounds.getNorth())*i),maxX:Math.ceil((0,p.at)(this.bounds.getEast())*i),maxY:Math.ceil((0,p.ot)(this.bounds.getSouth())*i)};return t.x>=r.minX&&t.x<r.maxX&&t.y>=r.minY&&t.y<r.maxY}},en=class extends p.wn{constructor(t,i,r,a){if(super(),this.id=t,this.dispatcher=r,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,(0,p.or)(this,(0,p.Tr)(i,["url","scheme","tileSize","promoteId","encoding"])),this._options=(0,p.or)({type:"vector"},i),this._collectResourceTiming=i.collectResourceTiming,512!==this.tileSize)throw Error("vector tile sources must have a tileSize of 512");this.setEventedParent(a)}async load(t=!1){this._loaded=!1,this.fire(new M("dataloading")),this._tileJSONRequest=new AbortController;try{let i=await ea(this._options,this.map._requestManager,this._tileJSONRequest,this.map._ownerWindow);this._tileJSONRequest=null,this._loaded=!0,i&&((0,p.or)(this,i),i.bounds&&(this.tileBounds=new es(i.bounds,this.minzoom,this.maxzoom)),this.fire(new M("data",{sourceDataType:"metadata"})),this.fire(new M("data",{sourceDataType:"content",sourceDataChanged:t})))}catch(t){this._tileJSONRequest=null,this._loaded=!0,(0,p.Rn)(t)||this.fire(new p.Sn((0,p.ir)(t)))}}loaded(){return this._loaded}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}onAdd(t){this.map=t,this.load()}setSourceProperty(t){this._tileJSONRequest&&this._tileJSONRequest.abort(),t(),this.load(!0)}setTiles(t){return this.setSourceProperty(()=>{this._options.tiles=t}),this}setUrl(t){return this.setSourceProperty(()=>{this.url=t,this._options.url=t}),this}onRemove(){this._tileJSONRequest&&=(this._tileJSONRequest.abort(),null)}serialize(){return(0,p.or)({},this._options)}async loadTile(t){let i=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),r={request:await this.map._requestManager.transformRequest(i,"Tile"),uid:t.uid,tileID:t.tileID,zoom:t.tileID.overscaledZ,tileSize:this.tileSize*t.tileID.overscaleFactor(),type:this.t
vendor: 1,756 bytes, line 1
1ype,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(t),etag:t.etag};r.request.collectResourceTiming=this._collectResourceTiming,await this.dispatcher.waitForInitComplete();let a="RT";if(t.actor&&"expired"!==t.state){if("loading"===t.state)return new Promise((i,r)=>{t.reloadPromise={resolve:i,reject:r}})}else t.actor=this.dispatcher.getReadyActor(),a="LT";t.abortController=new AbortController;try{let i=await t.actor.sendAsync({type:a,data:r},t.abortController);if(delete t.abortController,t.aborted)return;this._afterTileLoadWorkerResponse(t,i);let o={};return i?.etagUnmodified&&(o.unmodified=!0),o}catch(i){if(delete t.abortController,t.aborted||(0,p.Rn)(i))return;if(i&&404!==i.status)throw i;this._afterTileLoadWorkerResponse(t,null)}}async _getOverzoomParameters(t){if(t.tileID.canonical.z<=this.maxzoom||void 0===this.map._zoomLevelsToOverscale)return;let i=t.tileID.scaledTo(this.maxzoom).canonical,r=i.url(this.tiles,this.map.getPixelRatio(),this.scheme);return{maxZoomTileID:i,overzoomRequest:await this.map._requestManager.transformRequest(r,"Tile")}}_afterTileLoadWorkerResponse(t,i){if(i?.resourceTiming&&(t.resourceTiming=i.resourceTiming),i&&this.map._refreshExpiredTiles&&t.setExpiryData(i),t.etag=i?.etag,t.loadVectorData(i,this.map.painter),t.reloadPromise){let i=t.reloadPromise;t.reloadPromise=null,this.loadTile(t).then(i.resolve).catch(i.reject)}}async abortTile(t){t.abortController&&(t.abortController.abort(),delete t.abortController),t.actor&&await t.actor.sendAsync({type:"AT",data:{uid:t.uid,type:this.t
1ype,source:this.id}})}async unloadTile(t){t.unloadVectorData(),t.actor&&await t.actor.sendAsync({type:"RMT",data:{uid:t.uid,type:this.type,source:this.id}})}hasTransition(){return!1}},el=class extends p.wn{constructor(t,i,r,a){super(),this.id=t,this.dispatcher=r,this.setEventedParent(a),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=(0,p.or)({type:"raster"},i),(0,p.or)(this,(0,p.Tr)(i,["url","scheme","tileSize"]))}async load(t=!1){this._loaded=!1,this.fire(new M("dataloading")),this._tileJSONRequest=new AbortController;try{let i=await ea(this._options,this.map._requestManager,this._tileJSONRequest,this.map._ownerWindow);this._tileJSONRequest=null,this._loaded=!0,i&&((0,p.or)(this,i),i.bounds&&(this.tileBounds=new es(i.bounds,this.minzoom,this.maxzoom)),this.fire(new M("data",{sourceDataType:"metadata"})),this.fire(new M("data",{sourceDataType:"content",sourceDataChanged:t})))}catch(t){this._tileJSONRequest=null,this._loaded=!0,(0,p.Rn)(t)||this.fire(new p.Sn((0,p.ir)(t)))}}loaded(){return this._loaded}onAdd(t){this.map=t,this.load()}onRemove(){this._tileJSONRequest&&=(this._tileJSONRequest.abort(),null)}setSourceProperty(t){this._tileJSONRequest&&=(this._tileJSONRequest.abort(),null),t(),this.load(!0)}setTiles(t){return this.setSourceProperty(()=>{this._options.tiles=t}),this}setUrl(t){return this.setSourceProperty(()=>{this.url=t,this._options.url=t}),this}serialize(){return(0,p.or)({},this._options)}setPremultiplyAlpha(t){return this._premultiplyAlpha===t||this.setSourceProperty(()=>{this._premultiplyAlpha=t}),this}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}async loadTile(t){let i=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),r=this._premultiplyAlpha,a=r?void 0:{premultiplyAlpha:"none"};t.abortController=new AbortController;try{let o=await n.transformAndGetImage(this.map._requestManager,i,"Tile",t.abortController,this.map._refreshExpiredTiles,a);if(delete t.abortController,t.aborted){t.state="unloaded";return}if(o?.data){this.map._refreshExpiredTiles&&(o.cacheControl||o.expires)&&t.setExpiryData({cacheControl:o.cacheControl,expires:o.expires});let i=this.map.painter.context,a=i.gl,s=o.data;t.texture=this.map.painter.getTileTexture(s.width),t.texture?t.texture.update(s,{useMipmap:!0,premultiply:r}):(t.texture=new p.xt(i,s,a.RGBA,{useMipmap:!0,premultiply:r}),t.texture.bind(a.LINEAR,a.CLAMP_TO_EDGE,a.LINEAR_MIPMAP_NEAREST)),t.state="loaded"}}catch(i){if(delete t.abortController,t.aborted)t.state="unloaded";else if(i)throw t.state="errored",i}}async abortTile(t){t.abortController&&(t.abortController.abort(),delete t.abortController)}async unloadTile(t){t.texture&&this.map.painter.saveTileTexture(t.texture)}hasTransition(){return!1}},eh=class extends el{constructor(t,i,r,a){super(t,i,r,a),this.type="raster-dem",this.maxzoom=22,this._options=(0,p.or)({type:"raster-dem"},i),this.encoding=i.encoding||"mapbox",this.redFactor=i.redFactor,this.greenFactor=i.greenFactor,this.blueFactor=i.blueFactor,this.baseShift=i.baseShift}async loadTile(t){let i=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);t.neighboringTiles=this._getNeighboringTiles(t.tileID),t.abortController=new AbortController;try{let r=await n.transformAndGetImage(this.map._requestManager,i,"Tile",t.abortController,this.map._refreshExpiredTiles,{colorSpaceConversion:"none"});if(delete t.abortController,t.aborted){t.state="unloaded";return}if(r?.data){let i=r.data;this.map._refreshExpiredTiles&&(r.cacheControl||r.expires)&&t.setExpiryData({cacheControl:r.cacheControl,expires:r.expires});let a=(0,p.mr)(i)&&(0,p.Bi)()?i:await this.readImageNow(i),o={type:this.type,uid:t.uid,source:this.id,rawImageData:a,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};if(t.actor&&"expired"!==t.state&&"reloading"!==t.state)return;await this.dispatcher.waitForInitComplete(),t.actor&&"expired"!==t.state||(t.actor=this.dispatcher.getReadyActor()),t.dem=await t.actor.sendAsync({type:"LDT",data:o}
1),t.needsHillshadePrepare=!0,t.needsTerrainPrepare=!0,t.state="loaded"}}catch(i){if(delete t.abortController,t.aborted)t.state="unloaded";else if(i)throw t.state="errored",i}}async readImageNow(t){if("u">typeof VideoFrame&&(0,p.zi)()){let i=t.width+2,r=t.height+2;try{return new p.Dt({width:i,height:r},await (0,p.kr)(t,-1,-1,i,r))}catch{}}return f.getImageData(t,1)}_getNeighboringTiles(t){let i=t.canonical,r=2**i.z,a=(i.x-1+r)%r,o=0===i.x?t.wrap-1:t.wrap,s=(i.x+1+r)%r,n=i.x+1===r?t.wrap+1:t.wrap,l={};return l[new p.g(t.overscaledZ,o,i.z,a,i.y).key]={backfilled:!1},l[new p.g(t.overscaledZ,n,i.z,s,i.y).key]={backfilled:!1},i.y>0&&(l[new p.g(t.overscaledZ,o,i.z,a,i.y-1).key]={backfilled:!1},l[new p.g(t.overscaledZ,t.wrap,i.z,i.x,i.y-1).key]={backfilled:!1},l[new p.g(t.overscaledZ,n,i.z,s,i.y-1).key]={backfilled:!1}),i.y+1<r&&(l[new p.g(t.overscaledZ,o,i.z,a,i.y+1).key]={backfilled:!1},l[new p.g(t.overscaledZ,t.wrap,i.z,i.x,i.y+1).key]={backfilled:!1},l[new p.g(t.overscaledZ,n,i.z,s,i.y+1).key]={backfilled:!1}),l}async unloadTile(t){t.demTexture&&this.map.painter.saveTileTexture(t.demTexture),t.fbo&&(t.fbo.destroy(),delete t.fbo),t.dem&&delete t.dem,delete t.neighboringTiles,t.state="unloaded",t.actor&&await t.actor.sendAsync({type:"RDT",data:{type:this.type,uid:t.uid,source:this.id}})}};function ec(t,i){return i?t.properties[i]:t.id}function eu(t){if(!t)return{};let i={};
1return i.removeAll=t.removeAll,i.remove=new Set(t.remove||[]),i.add=new Map(t.add?.map(t=>[t.id,t])),i.update=new Map(t.update?.map(t=>[t.id,t])),i}function ed(t){return"GeometryCollection"===t.type?t.geometries.flatMap(t=>ed(t)):function t(i){return i&&0!==i.length?"number"==typeof i[0]?[i]:i.flatMap(i=>t(i)):[]}(t.coordinates)}function e_(t){let i=new eo,r;switch(t.type){case"FeatureCollection":r=t.features.flatMap(t=>ed(t.geometry));break;case"Feature":r=ed(t.geometry);break;default:r=ed(t)}if(0===r.length)return i;for(let t of r){let[r,a]=t;i.extend([r,a])}return i}var ep=class extends p.wn{constructor(t,i,r,a){super(),this.id=t,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:i.data},this.actorPromise=r.getActor(),this.setEventedParent(a),this._data="string"==typeof i.data?{url:i.data}:{geojson:i.data},this._options=(0,p.or)({},i),this._collectResourceTiming=i.collectResourceTiming,void 0!==i.maxzoom&&(this.maxzoom=i.maxzoom),i.type&&(this.type=i.type),i.attribution&&(this.attribution=i.attribution),this.promoteId=i.promoteId,void 0!==i.clusterMaxZoom&&this.maxzoom<=i.clusterMaxZoom&&(0,p.zr)(`The maxzoom value "${this.maxzoom}" is expected to be greater than the clusterMaxZoom value "${i.clusterMaxZoom}".`),this.workerOptions=(0,p.or)({source:this.id,geojsonVtOptions:{buffer:this._pixelsToTileUnits(void 0===i.buffer?128:i.buffer),tolerance:this._pixelsToTileUnits(void 0===i.tolerance?.375:i.tolerance),extent:p.Ur,maxZoom:this.maxzoom,lineMetrics:i.lineMetrics||!1,generateId:i.generateId||!1,promoteId:"string"==typeof i.promoteId?i.promoteId:void 0,cluster:i.cluster||!1,clusterOptions:{maxZoom:this._getClusterMaxZoom(i.clusterMaxZoom),minPoints:Math.max(2,i.clusterMinPoints||2),extent:p.Ur,radius:this._pixelsToTileUnits(i.clusterRadius||50),log:!1,generateId:i.generateId||!1}},clusterProperties:i.clusterProperties,filter:i.filter},i.workerOptions)}_hasPendingWorkerUpdate(){return void 0!==this._pendingWorkerUpdate.data||void 0!==this._pendingWorkerUpdate.diff||this._pendingWorkerUpdate.updateCluster}_pixelsToTileUnits(t){return t*(p.Ur/this.tileSize)}_tileUnitsToPixels(t){return t/(p.Ur/this.tileSize)}_getClusterMaxZoom(t){let i=t?Math.round(t):this.maxzoom-1;return Number.isInteger(t)||void 0===t||(0,p.zr)(`Integer expected for option 'clusterMaxZoom': provided value "${t}" rounded to "${i}"`),i}async load(){await this._updateWorkerData()}onAdd(t){this.map=t,this.load()}setData(t){return this._data="string"==typeof t?{url:t}:{geojson:t},this._pendingWorkerUpdate={data:t},this._updateWorkerData()}updateData(t){return this._pendingWorkerUpdate.diff=function(t,i,r){let a;if(!t)return i||{};if(!i)return t||{};let o=eu(t),s=eu(i);var n,l=o,h=s;for(let t of(h.removeAll&&(l.add.clear(),l.update.clear(),l.remove.clear(),h.remove.clear()),h.remove))l.add.delete(t),l.update.delete(t);for(let[t,i]of h.update){let r=l.update.get(t);r&&(h.update.set(t,function(t,i){let r={id:t.id};if(i.removeAllProperties&&(delete t.removeProperties,delete t.addOrUpdateProperties,delete i.removeProperties),i.removeProperties)for(let r of i.removeProperties){let i=t.addOrUpdateProperties.findIndex(t=>t.key===r);i>-1&&t.addOrUpdateProperties.splice(i,1)}return(t.removeAllProperties||i.removeAllProperties)&&(r.removeAllProperties=!0),(t.removeProperties||i.removeProperties)&&(r.removeProperties=[...t.removeProperties||[],...i.removeProperties||[]]),(t.addOrUpdateProperties||i.addOrUpdateProperties)&&(r.addOrUpdateProperties=[...t.addOrUpdateProperties||[],...i.addOrUpdateProperties||[]]),(t.newGeometry||i.newGeometry)&&(r.newGeometry=i.newGeometry||t.newGeometry),r}(r,i)),l.update.delete(t))}let c={};
vendor: 4,862 bytes, line 1
1if((o.removeAll||s.removeAll)&&(c.removeAll=!0),c.remove=new Set([...o.remove,...s.remove]),c.add=new Map([...o.add,...s.add]),c.update=new Map([...o.update,...s.update]),c.remove.size&&c.add.size)for(let t of c.add.keys())c.remove.delete(t);let u=(a={},(n=c).removeAll&&(a.removeAll=n.removeAll),n.remove&&(a.remove=Array.from(n.remove)),n.add&&(a.add=Array.from(n.add.values())),n.update&&(a.update=Array.from(n.update.values())),a);return u}(this._pendingWorkerUpdate.diff,t),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 e_(await this.getData())}setClusterOptions(t){return this.workerOptions.geojsonVtOptions.cluster=t.cluster,void 0!==t.clusterRadius&&(this.workerOptions.geojsonVtOptions.clusterOptions.radius=this._pixelsToTileUnits(t.clusterRadius)),void 0!==t.clusterMaxZoom&&(this.workerOptions.geojsonVtOptions.clusterOptions.maxZoom=this._getClusterMaxZoom(t.clusterMaxZoom)),this._pendingWorkerUpdate.updateCluster=!0,this._updateWorkerData()}getClusterOptions(){let{cluster:t,clusterOptions:i}=this.workerOptions.geojsonVtOptions;return{cluster:t,clusterMaxZoom:i.maxZoom,clusterRadius:this._tileUnitsToPixels(i.radius)}}async getClusterExpansionZoom(t){return(await this.actorPromise).sendAsync({type:"GCEZ",data:{type:this.type,clusterId:t,source:this.id}})}async getClusterChildren(t){return(await this.actorPromise).sendAsync({type:"GCC",data:{type:this.type,clusterId:t,source:this.id}})}async getClusterLeaves(t,i,r){return(await this.actorPromise).sendAsync({type:"GCL",data:{type:this.type,source:this.id,clusterId:t,limit:i,offset:r}})}async _updateWorkerData(){if(this._isUpdatingWorker)return this._updatePromise;if(!this._hasPendingWorkerUpdate())return void(0,p.zr)(`No pending worker updates for GeoJSONSource ${this.id}.`);let{data:t,diff:i,updateCluster:r}=this._pendingWorkerUpdate,a=this._getLoadGeoJSONParameters(t,i,r);void 0===t?i?this._pendingWorkerUpdate.diff=void 0:r&&(this._pendingWorkerUpdate.updateCluster=void 0):this._pendingWorkerUpdate.data=void 0,this._updatePromise=this._dispatchWorkerUpdate(a),await this._updatePromise}async _getLoadGeoJSONParameters(t,i,r){let a=(0,p.or)({type:this.type,source:this.id},this.workerOptions);return"string"==typeof t?(a.request=await this.map._requestManager.transformRequest(f.resolveURL(t),"Source"),a.request.collectResourceTiming=this._collectResourceTiming,a):void 0!==t?(a.data=t,a):i?(a.dataDiff=i,a):r?(a.updateCluster=!0,a):void 0}async _dispatchWorkerUpdate(t){this._isUpdatingWorker=!0,this.fire(new M("dataloading"));try{let i=await t,r=await (await this.actorPromise).sendAsync({type:"LD",data:i});if(this._isUpdatingWorker=!1,this._removed||r.abandoned)return void this.fire(new M("dataabort"));r.data&&(this._data={geojson:r.data});let a=this._applyDiffToSource(i.dataDiff),o=this._getShouldReloadTileOptions(a),s={};this._applyResourceTiming(s,r),this.fire(new M("data",{...s,sourceDataType:"metadata"})),this.fire(new M("data",{...s,sourceDataType:"content",shouldReloadTileOptions:o}))}catch(t){if(this._isUpdatingWorker=!1,this._removed)return void this.fire(new M("dataabort"));this.fire(new p.Sn((0,p.ir)(t)))}finally{this._hasPendingWorkerUpdate()&&await this._updateWorkerData()}}_applyResourceTiming(t,i){if(!this._collectResourceTiming)return;let r=i.resourceTiming?.[this.id];if(!r)return;let a=r.slice(0);a?.length&&(0,p.or)(t,{resourceTiming:a})}_applyDiffToSource(t){if(!t)return;let i="string"==typeof this.promoteId?this.promoteId:void 0;if(!this._data.url&&!this._data.updateable){let t=function(t,i){let r=new Map;if(null==t||null==t.type)return r;if("Feature"===t.type){let a=ec(t,i);return null==a?void 0:(r.set(a,t),r)}if("FeatureCollection"===t.type){let a=new Set;for(let o of t.features){let t=ec(o,i);if(null==t||a.has(t))return;a.add(t),r.set(t,o)}return r}}(this._data.geojson,i);if(!t)throw Error(`GeoJSONSource "${this.id}": GeoJSON data is not compatible with updateData`);this._data={updateable:t}}if(!this._data.updateable)return;let r=function(t,i,r){let a=[];if(i.removeAll)t.clear();else if(i.remove)for(let r of i.remove){let i=t.get(r);i&&(a.push(i.geometry),t.delete(r))}if(i.add)for(let o of i.add){let i=ec(o,r);if(null==i)continue;let s=t.get(i);s&&a.push(s.geometry),a.push(o.geometry),t.set(i,o)}if(i.update)for(let r of i.update){let i=t.get(r.id);if(!i)continue;let o=!!r.newGeometry,s=r.removeAllProperties||r.removeProperties?.length>0||r.addOrUpdateProperties?.length>0;if(!o&&!s)continue;a.push(i.geometry);let n={...i};if(t.set(r.id,n),o&&(a.push(r.newGeometry),n.geometry=r.newGeometry),s){if(n.properties=r.removeAllProperties?{}:{...n.properties||{}},r.removeProperties)for(let t of r.removeProperties)delete n.properties[t];
1if(r.addOrUpdateProperties)for(let{key:t,value:i}of r.addOrUpdateProperties)n.properties[t]=i}}return a}(this._data.updateable,t,i);if(!(t.removeAll||this._options.cluster))return r}_getShouldReloadTileOptions(t){if(t)return{affectedBounds:t.filter(Boolean).map(t=>e_(t))}}shouldReloadTile(t,{affectedBounds:i}){if("loading"===t.state)return!0;if("unloaded"===t.state)return!1;let{buffer:r,extent:a}=this.workerOptions.geojsonVtOptions,o=function({x:t,y:i,z:r},a=0){return new eo([(0,p.it)((t-a)/2**r),(0,p.rt)((i+1+a)/2**r)],[(0,p.it)((t+1+a)/2**r),(0,p.rt)((i-a)/2**r)])}(t.tileID.canonical,r/a);for(let t of i)if(o.intersects(t))return!0;return!1}loaded(){return!this._isUpdatingWorker&&!this._hasPendingWorkerUpdate()}async loadTile(t){let i=t.actor?"RT":"LT";t.actor=await this.actorPromise;let r={type:this.type,uid:t.uid,tileID:t.tileID,zoom:t.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};t.abortController=new AbortController;try{let a=await (await this.actorPromise).sendAsync({type:i,data:r},t.abortController);delete t.abortController,t.unloadVectorData(),t.aborted||t.loadVectorData(a,this.map.painter,"RT"===i)}catch(i){if(delete t.abortController,t.aborted||(0,p.Rn)(i))return;throw i}}async abortTile(t){t.abortController&&(t.abortController.abort(),delete t.abortController),t.aborted=!0}async unloadTile(t){t.unloadVectorData(),await (await this.actorPromise).sendAsync({type:"RMT",data:{uid:t.uid,type:this.t
1ype,source:this.id}})}onRemove(){this._removed=!0,this.actorPromise.then(t=>t.sendAsync({type:"RS",data:{type:this.type,source:this.id}}))}serialize(){return(0,p.or)({},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}};let em=[0,0,1],ef=(t,i,r,a,o,s)=>{var n;return{u_tl_parent:t,u_scale_parent:i,u_buffer_scale:1,u_perspective_transform:s,u_fade_t:r.mix,u_opacity:r.opacity*a.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:a.paint.get("raster-brightness-min"),u_brightness_high:a.paint.get("raster-brightness-max"),u_saturation_factor:function(t){return t>0?1-1/(1.001-t):-t}(a.paint.get("raster-saturation")),u_contrast_factor:(n=a.paint.get("raster-contrast"))>0?1/(1-n):1+n,u_spin_weights:function(t){let i=Math.sin(t*=Math.PI/180),r=Math.cos(t);return[(2*r+1)/3,(-Math.sqrt(3)*i-r+1)/3,(Math.sqrt(3)*i-r+1)/3]}(a.paint.get("raster-hue-rotate")),u_coords_top:[o[0].x,o[0].y,o[1].x,o[1].y],u_coords_bottom:[o[3].x,o[3].y,o[2].x,o[2].y]}};var eg=class extends p.wn{constructor(t,i,r,a){super(),this.perspectiveTransform=em,this.flippedWindingOrder=!1,this._imageDirty=!1,this.id=t,this.dispatcher=r,this.coordinates=i.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(a),this.options=i}async load(t){this._loaded=!1,this.fire(new M("dataloading")),this.url=this.options.url,this._abortController=new AbortController;try{let i=await n.transformAndGetImage(this.map._requestManager,this.url,"Image",this._abortController);this._abortController=null,this._loaded=!0,i?.data&&(this._setImage(i.data),t&&(this.coordinates=t),this._finishLoading())}catch(t){if((0,p.Rn)(t))return;this._abortController=null,this._loaded=!0,this.fire(new p.Sn((0,p.ir)(t)))}}loaded(){return this._loaded}updateImage(t){return this._abortController&&=(this._abortController.abort(),null),"image"in t?(this._loaded=!0,this._setImage(t.image),t.coordinates&&(this.coordinates=t.coordinates),this._finishLoading()):t.url&&(this.options.url=t.url,this.load(t.coordinates)),this}_setImage(t){this.image=t,this._imageDirty=!0}_disposeTexture(){this.texture?.destroy(),this.texture=null}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new M("data",{sourceDataType:"metadata"})))}onAdd(t){this.map=t,this.load()}onRemove(){this._abortController&&=(this._abortController.abort(),null),this._disposeTexture(),this.image=null,this.tiles={}}setCoordinates(t){var i,r;let a,o,s,n,l,h;this.coordinates=t;let c=t.map(p.tt.fromLngLat);return this.tileID=(i=c,o=Math.max(0,Math.floor(-Math.log(Math.max((a=p.ft.fromPoints(i)).width(),a.height()))/Math.LN2)),s=2**o,new p.h(o,Math.floor((a.minX+a.maxX)/2*s),Math.floor((a.minY+a.maxY)/2*s))),this.terrainTileRanges=this._getOverlappingTileRanges(c),this.minzoom=this.maxzoom=this.tileID.z,this.tileCoords=c.map(t=>this.tileID.getTilePoint(t)._round()),this.perspectiveTransform=function(t){var i;if(function(t){let[i,r,a,o]=t;return 2220446049250313e-31>Math.abs(i.x+a.x-r.x-o.x)&&2220446049250313e-31>Math.abs(i.y+a.y-r.y-o.y)}(t))return em;let[r,a,o,s]=t,n=r.x-a.x+o.x-s.x,l=r.y-a.y+o.y-s.y,h=a.x-o.x,c=a.y-o.y,u=s.x-o.x,d=s.y-o.y,_=(i=[h,c,u,d])[0]*i[3]-i[2]*i[1];if(2220446049250313e-31>Math.abs(_))return em;let m=(n*d-u*l)/_,f=(h*l-n*c)/_,g=[1,1+m,1+m+f,1+f],v=Math.max(...g.map(t=>Math.abs(t))),y=g.some(t=>!Number.isFinite(t)||t<=17763568394002505e-31*v);if(!Number.isFinite(v)||0===v||y)return em;let x=a.x-r.x+m*a.x,b=s.x-r.x+f*s.x,w=a.y-r.y+m*a.y,T=s.y-r.y+f*s.y,P=[0,0,0];(0,p.ii)(P,[x,w,m],[b,T,f]);let M=Math.max(...P.map(t=>Math.abs(t))),I=t.map(({x:t,y:i})=>(0,p.ai)(P,[t,i,1])),S=t.map(({x:t,y:i})=>17763568394002505e-31*(Math.abs(P[0]*t)+Math.abs(P[1]*i)+Math.abs(P[2]))),C=Math.max(...I.map(t=>Math.abs(t))),E=Math.sign(I[0]),z=I.some((t,i)=>!Number.isFinite(t)||Math.abs(t)<=Math.max(2220446049250313e-31*C,S[i])||Math.sign(t)!==E);if(!Number.isFinite(M)||0===M||!Number.isFinite(C)||0===C||z)return em;let R=P.map(t=>t/M);return R.every(Number.isFinite)?R:em}(this.tileCoords),this.flippedWindingOrder=(n=(r=this.tileCoords)[1].x-r[0].x,l=r[1].y-r[0].y,h=r[2].x-r[0].x,n
1*(r[2].y-r[0].y)-l*h<0),this.fire(new M("data",{sourceDataType:"content"})),this}prepare(){if(0===Object.keys(this.tiles).length||!this.image)return;let t=this.map.painter.context,i=t.gl;this.texture?this._imageDirty&&(this.texture.update(this.image),this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE)):(this.texture=new p.xt(t,this.image,i.RGBA),this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE)),this._imageDirty=!1;let r=!1;for(let t in this.tiles){let i=this.tiles[t];"loaded"!==i.state&&(i.state="loaded",i.texture=this.texture,r=!0)}r&&this.fire(new M("data",{sourceDataType:"idle",sourceId:this.id}))}async loadTile(t){this.tileID?.equals(t.tileID.canonical)?(this.tiles[String(t.tileID.wrap)]=t,t.buckets={}):t.state="errored"}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}_getOverlappingTileRanges(t){let{minX:i,minY:r,maxX:a,maxY:o}=p.ft.fromPoints(t),s={};for(let t=0;t<=25;t++){let n=2**t,l=Math.floor(i*n),h=Math.floor(r*n),c=Math.floor(a*n),u=Math.floor(o*n),d=(l%n+n)%n,_=c%n,p=Math.floor(l/n),m=Math.floor(c/n);s[t]={minWrap:p,maxWrap:m,minTileXWrapped:d,maxTileXWrapped:_,minTileY:h,maxTileY:u}}return s}},ev=class extends eg{constructor(t,i,r,a){super(t,i,r,a),this._onPlayingHandler=()=>{this.map?.triggerRepaint()},this.roundZoom=!0,this.type="video",this.options=i}async load(){this._loaded=!1;let t=this.options;for(let i of(this.urls=[],t.urls))this.urls.push((await this.map._requestManager.transformRequest(i,"Source")).url);try{let t=await (0,p.An)(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 p.Sn((0,p.ir)(t)))}}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(t){if(this.video){let i=this.video.seekable;t<i.start(0)||t>i.end(0)?this.fire(new p.Sn(new p.pn(`sources.${this.id}`,null,`Playback for this video can be set only between the ${i.start(0)} and ${i.end(0)}-second mark.`))):this.video.currentTime=t}}getVideo(){return this.video}onAdd(t){this.map||(this.map=t,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(0===Object.keys(this.tiles).length||this.video.readyState<2)return;let t=this.map.painter.context,i=t.gl;this.texture?this.video.paused||(this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE),i.texSubImage2D(i.TEXTURE_2D,0,0,0,i.RGBA,i.UNSIGNED_BYTE,this.video)):(this.texture=new p.xt(t,this.video,i.RGBA),this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE));let r=!1;for(let t in this.tiles){let i=this.tiles[t];"loaded"!==i.state&&(i.state="loaded",i.texture=this.texture,r=!0)}r&&this.fire(new M("data",{sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}},ey=class extends eg{constructor(t,i,r,a){super(t,i,r,a),i.coordinates?(!Array.isArray(i.coordinates)||4!==i.coordinates.length||i.coordinates.some(t=>!Array.isArray(t)||2!==t.length||t.some(t=>"number"!=typeof t)))&&this.fire(new p.Sn(new p.pn(`sources.${t}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new p.Sn(new p.pn(`sources.${t}`,null,'missing required property "coordinates"'))),i.animate&&"boolean"!=typeof i.animate&&this.fire(new p.Sn(new p.pn(`sources.${t}`,null,'optional "animate" property must be a boolean value'))),i.canvas?"string"==typeof i.canvas||i.canvas instanceof HTMLCanvasElement||this.fire(new p.Sn(new p.pn(`sources.${t}`,null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new p.Sn(new p.pn(`sources.${t}`,null,'missing required property "canvas"'))),this.options=i,this.animate=void 0===i.animate||i.animate}async load(){if(this._loaded=!0,this.canvas||=this.options.canvas instanceof HTMLCanvasElement?this.options.canvas:document.getElementById(this.options.canvas),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions())return void this.fire(new p.Sn(Error("Canvas dimensions cannot be less than or equal to zero.")));this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&=(this.prepare(),!1)},this._finishLoading()}getCanvas(){return this.canvas}onAdd(t){this.map=t,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this._playing=!1,super.onRemove()}prepare(){let t=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,t=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,t=!0),this._hasInvalidDimensions()||0===Object.keys(this.tiles).length)return;let i=this.map.painter.context,r=i.gl;this.texture?(t||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):(this.texture=new p.xt(i,this.canvas,r.RGBA,{premultiply:!0}),this.texture.bind(r.LINEAR,r.CLAMP_TO_EDGE));let a=!1;for(let t in this.tiles){let i=this.tiles[t];"loaded"!==i.state&&(i.state="loaded",i.texture=this.texture,a=!0)}a&&this.fire(new M("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 t of[this.canvas.width,this.canvas.height])if(isNaN(t)||t<=0)return!0;return!1}};let ex={},eb="RTLPluginLoaded";var ew=class extends p.wn{constructor(...t){super(...t),this.status="unavailable",this.url=null,this.dispatcher=(u||(u=new et(c||=new Q,p.En)).registerMessageHandler("GR",(t,i,r)=>(0,p.jn)(i,r)),u)}_syncState(t){return this.status=t,this.dispatcher.broadcast("SRPS",{pluginStatus:t,pluginURL:this.url}).catch(t=>{throw this.status="error",t})}getRTLTextPluginStatus(){return this.status}clearRTLTextPlugin(){this.status="unavailable",this.url=null}async setRTLTextPlugin(t,i=!1){if(this.url)throw Error("setRTLTextPlugin cannot be called multiple times.");if(this.url=f.resolveURL(t),!this.url)throw Error(`requested url ${t}
1 is invalid`);if("unavailable"===this.status)if(!i)return this._requestImport();else this.status="deferred",this._syncState(this.status);else if("requested"===this.status)return this._requestImport()}async _requestImport(){await this._syncState("loading"),this.status="loaded",this.fire(new p.Cn(eb))}lazyLoad(){"unavailable"===this.status?this.status="requested":"deferred"===this.status&&this._requestImport()}};let eT=null;function eP(){return eT||=new ew}var eM=class{constructor(t,i){this.timeAdded=0,this.fadeEndTime=0,this.fadeOpacity=1,this.tileID=t,this.uid=(0,p.Rr)(),this.uses=0,this.tileSize=i,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(t){return this.hasData()&&(!this.fadeEndTime||this.fadeOpacity>0)&&(t||!this.holdingForSymbolFade())}setCrossFadeLogic({fadingRole:t,fadingDirection:i,fadingParentID:r,fadeEndTime:a}){this.resetFadeLogic(),this.fadingRole=t,this.fadingDirection=i,this.fadingParentID=r,this.fadeEndTime=a}setSelfFadeLogic(t){this.resetFadeLogic(),this.selfFading=!0,this.fadeEndTime=t}resetFadeLogic(){this.fadingRole=null,this.fadingDirection=null,this.fadingParentID=null,this.selfFading=!1,this.timeAdded=v(),this.fadeEndTime=0,this.fadeOpacity=1}wasRequested(){return"errored"===this.state||"loaded"===this.state||"reloading"===this.state}clearTextures(t){this.demTexture&&t.saveTileTexture(this.demTexture),this.demTexture=null}getRTT(t){return this.rttObjects[t]}acquireRTT(t,i,r){return this.rttObjects[i]=t.acquireRTT(r)}releaseRTT(t){if(0!==this.rttObjects.length){for(let i of this.rttObjects)i&&t.releaseRTT(i);this.rttObjects.length=0}}loadVectorData(t,i,r){if(t?.etagUnmodified===!0){this.state="loaded";return}if(this.hasData()&&this.unloadVectorData(),this.state="loaded",!t){this.collisionBoxArray=new p.Vt;return}for(let a in t.featureIndex&&(this.latestFeatureIndex=t.featureIndex,t.rawTileData?(this.latestRawTileData=t.rawTileData,this.latestEncoding=t.encoding,this.latestFeatureIndex.rawTileData=t.rawTileData,this.latestFeatureIndex.encoding=t.encoding):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData,this.latestFeatureIndex.encoding=this.latestEncoding)),this.collisionBoxArray=t.collisionBoxArray,this.buckets=function(t,i){let r={};if(!i)return r;for(let a of t){let t=a.layerIds.map(t=>i.getLayer(t)).filter(Boolean);if(0!==t.length)for(let i of(a.layers=t,a.stateDependentLayerIds&&(a.stateDependentLayers=a.stateDependentLayerIds.map(i=>t.filter(t=>t.id===i)[0])),t))r[i.id]=a}return r}(t.buckets,i?.style),this.hasSymbolBuckets=!1,this.buckets){let t=this.buckets[a];if(t instanceof p.D)if(this.hasSymbolBuckets=!0,r)t.justReloaded=!0;else break}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(let t in this.buckets){let i=this.buckets[t];if(i instanceof p.D&&i.hasRTLText){this.hasRTLText=!0,eP().lazyLoad();break}}for(let t in this.queryPadding=0,this.buckets){let r=this.buckets[t];this.queryPadding=Math.max(this.queryPadding,i.style.getLayer(t).queryRadius(r))}t.imageAtlas&&(this.imageAtlas=t.imageAtlas),t.glyphAtlasImage&&(this.glyphAtlasImage=t.glyphAtlasImage),this.dashPositions=t.dashPositions}unloadVectorData(){for(let t in this.buckets)this.buckets[t].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(t){return this.buckets[t.id]}upload(t){for(let i in this.buckets){let r=this.buckets[i];r.uploadPending()&&r.upload(t)}let i=t.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new p.xt(t,this.imageAtlas.image,i.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&=(this.glyphAtlasTexture=new p.xt(t,this.glyphAtlasImage,i.ALPHA),null)}prepare(t){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(t,this.imageAtlasTexture)}queryRenderedFeatures(t,i,r,a,o,s,n,l,h,c,u){return this.latestFeatureIndex?.rawTileData?this.latestFeatureIndex.query({queryGeometry:a,cameraQueryGeometry:o,scale:s,tileSize:this.tileSize,pixelPosMatrix:c,transform:l,params:n,queryPadding:this.queryPadding*h,getElevation:u},t,i,r):{}}querySourceFeatures(t,i){let r=this.latestFeatureIndex;if(!r?.rawTileData)return;let a=r.loadVTLayers(),o=i?.sourceLayer?i.sourceLayer:"",s=a._geojsonTileLayer||a[o];if(!s)return;let n=(0,p.vn)(i?.filter,`querySourceFeatures[${o}].filter`,i?.globalState),{z:l,x:h,y:c}=this.tileID.canonical,u={z:l,x:h,y:c};for(let i=0;i<s.length;i++){let a=s.feature(i);if(n.needGeometry){let t=(0,p.At)(a,!0);
1if(!n.filter(new p.tn(this.tileID.overscaledZ),t,this.tileID.canonical))continue}else if(!n.filter(new p.tn(this.tileID.overscaledZ),a))continue;let d=r.getId(a,o),_=new p.u(a,l,h,c,d);_.tile=u,t.push(_)}}hasData(){return"loaded"===this.state||"reloading"===this.state||"expired"===this.state}patternsLoaded(){return this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length}setExpiryData(t){let i=this.expirationTime;if(t.cacheControl){let i=(0,p.wr)(t.cacheControl);i["max-age"]&&(this.expirationTime=Date.now()+1e3*i["max-age"])}else t.expires&&(this.expirationTime=new Date(t.expires).getTime());if(this.expirationTime){let t=Date.now(),r=!1;if(this.expirationTime>t)r=!1;else if(i)if(this.expirationTime<i)r=!0;else{let a=this.expirationTime-i;a?this.expirationTime=t+Math.max(a,3e4):r=!0}else 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(),0x80000000-1)}setFeatureState(t,i,r){if(!this.latestFeatureIndex?.rawTileData||0===Object.keys(t).length||this.featureStateRevision===r)return;this.featureStateRevision=r;let a=this.latestFeatureIndex.loadVTLayers();for(let r in this.buckets){if(!i.style.hasLayer(r))continue;let o=this.buckets[r],s=o.layers[0].sourceLayer||"_geojsonTileLayer",n=a[s],l=t[s];if(!n||!l||0===l.length)continue;o.update(l,n,this.imageAtlas?.patternPositions||{},this.dashPositions||{});let h=i?.style?.getLayer(r);h&&(this.queryPadding=Math.max(this.queryPadding,h.queryRadius(o)))}}holdingForSymbolFade(){return void 0!==this.symbolFadeHoldUntil}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<v()}clearSymbolFadeHold(){this.symbolFadeHoldUntil=void 0}setSymbolHoldDuration(t){this.symbolFadeHoldUntil=v()+t}setDependencies(t,i){let r={};for(let t of i)r[t]=!0;this.dependencies[t]=r}hasDependency(t,i){for(let r of t){let t=this.dependencies[r];if(t){for(let r of i)if(t[r])return!0}}return!1}};function eI(t){let i=[];for(let r in t)i.push({id:r,state:t[r]});return i}var eS=class{constructor(){this.state={},this.stateChanges={},this.deletedStates={},this.revision=0}updateState(t,i,r){let a=String(i);if(this.stateChanges[t]||={},this.stateChanges[t][a]||={},(0,p.or)(this.stateChanges[t][a],r),null===this.deletedStates[t])for(let i in this.deletedStates[t]={},this.state[t])if(i===a)for(let o in this.deletedStates[t][a]={},this.state[t][i])void 0===r[o]&&(this.deletedStates[t][a][o]=null);else this.deletedStates[t][i]=null;else if(this.deletedStates[t]?.[a]===null)for(let i in this.deletedStates[t][a]={},this.state[t][a])void 0===r[i]&&(this.deletedStates[t][a][i]=null);else for(let i in r)this.deletedStates[t]?.[a]?.[i]===null&&delete this.deletedStates[t][a][i]}removeFeatureState(t,i,r){if(null===this.deletedStates[t])return;let a=String(i);if(this.deletedStates[t]||={},r&&void 0!==i)null!==this.deletedStates[t][a]&&(this.deletedStates[t][a]||={},this.deletedStates[t][a][r]=null);else if(void 0!==i)if(this.stateChanges[t]?.[a])for(r in this.deletedStates[t][a]={},this.stateChanges[t][a])this.deletedStates[t][a][r]=null;else this.deletedStates[t][a]=null;else this.deletedStates[t]=null}getState(t,i){let r=String(i),a=this.state[t]||{},o=this.stateChanges[t]||{},s=(0,p.or)({},a[r],o[r]);if(null===this.deletedStates[t])return{};if(this.deletedStates[t]){let r=this.deletedStates[t][i];if(null===r)return{};for(let t in r)delete s[t]}return s}initializeTileState(t,i){let r={};for(let t in this.state)r[t]=eI(this.state[t]);t.setFeatureState(r,i,this.revision)}coalesceChanges(t,i){let r={};for(let t in this.stateChanges)for(let i in this.state[t]||={},r[t]||={},this.stateChanges[t])this.state[t][i]||={},(0,p.or)(this.state[t][i],this.stateChanges[t][i]),r[t][i]=this.state[t][i];for(let t in this.deletedStates)if(this.state[t]||={},r[t]||={},null===this.deletedStates[t])for(let i in this.state[t])this.state[t][i]={},r[t][i]={};else for(let i in this.deletedStates[t]){if(null===this.deletedStates[t][i])this.state[t][i]={};else for(let r of Object.keys(this.deletedStates[t][i]))delete this.state[t][i][r];r[t][i]=this.state[t][i]}if(this.stateChanges={},this.deletedStates={},0===Object.keys(r).length)return;this.revision++;let a={};for(let t in r)a[t]=eI(r[t]);t.setFeatureState(a,i,this.revision)}};function eC(t,i,r){let a=0,o=(r-i)/10;for(let s=0;s<10;s++){let n=i+(s+.5)/10*(r-i);a+=o*Math.cos(n)**t}return a}function eE(t,i){return function(r,a,o,s,n){let l=2*((t-1)/(0,p.Nr)(Math.cos((0,p.tr)(p.Z-n))/Math.cos((0,p.tr)(p.Z)))-1),h=Math.acos(o/s),c=2*eC(l-1,0,(0,p.tr)(n/2)),u=Math.min((0,p.tr)(p.Z),h+(0,p.tr)(n/2)),d=eC(l-1,Math.min(u,h-(0,p.tr)(n/2)),u),_=Math.atan(a/o),m=Math.hypot(a,o),f=r;return f+=(0,p.Nr)(s/m/Math.max(.5,Math.cos((0,p.tr)(n/2)))),f+=l*(0,p.Nr)(Math.cos(_))/2,f-=(0,p.Nr)(Math.max(1,d/c/i))/2}}let ez=eE(9.314,3);function eR(t,i){return Math.max(0,(i.roundZoom?Math.round:Math.floor)(t.zoom+(0,p.Nr)(t.tileSize/i.tileSize)))}function eD(t,i){let r,a,o=t.getCameraFrustum(),s=t.getClippingPlane(),n=t.screenPointToMercatorCoordinate(t.getCameraPoint()),l=p.tt.fromLngLat(t.center,t.elevation);n.z=l.z+Math.cos(t.pitchInRadians)*t.cameraToCenterDistance/t.worldSize;let h=(r=p.Z-t.pitch-t.fov/2,a=(0,p.Kn)((15-r)/15,0,1),t.elevation+500*a),c=t.getCoveringTilesDetailsProvider(),u=c.allowVariableZoom(t,i),d=eR(t,i),_=i.minzoom||0,m=void 0===i.maxzoom?t.maxZoom:i.maxzoom,f=Math.min(Math.max(0,d),m),g=2**f,v=[g*n.x,g*n.y,0],y=[g*l.x,g*l.y,0],x=Math.hypot(l.x-n.x,l.y-n.y),b=Math.abs(l.z-n.z),w=Math.hypot(x,b),T=t=>({zoom:0,x:0,y:0,wrap:t,fullyVisible:!1}),P=[],M=[];if(t.renderWorldCopies&&c.allowWorldCopies())for(let t=1;t<=3;t++)P.push(T(-t)),P.push(T(t));for(P.push(T(0));P.length>0;){let r=P.pop(),a=r.x,g=r.y,x=r.fullyVisible,T={x:a,y:g,z:r.zoom},I=c.getTileBoundingVolume(T,r.wrap,h,i);if(!x){let t=function(t,i,r){let a=i.intersectsFrustum(t);if(!r||0===a)return a;let o=i.intersectsPlane(r);return 0===o?0:2===a&&2===o?2:1}(o,I,s);if(0===t)continue;x=2===t}let S=c.distanceToTile2d(n.x,n.y,T,I),C=d;u&&(C=(i.calculateTileZoom||ez)(t.zoom+(0,p.Nr)(t.tileSize/i.tileSize),S,b,w,t.fov));let E=Math.min(C=Math.max(0,C=(i.roundZoom?Math.round:Math.floor)(C)),m);if(r.wrap=c.getWrap(l,T,r.wrap),r.zoom>=E){if(r.zoom<_)continue;let t=f-r.zoom,o=v[0]-.5-(a<<t),s=v[1]-.5-(g<<t),n=i.reparseOverscaled?Math.max(r.zoom,C):r.zoom;M.push({tileID:new p.g(r.zoom===m?n:r.zoom,r.wrap,r.zoom,a,g),distanceSq:(0,p.qr)([y[0]-.5-a,y[1]-.5-g]),tileDistanceToCamera:Math.sqrt(o*o+s*s)});continue}for(let t=0;t<4;t++){let i=(a<<1)+t%2,o=(g<<1)+(t>>1),s=r.zoom+1;P.push({zoom:s,x:i,y:o,wrap:r.wrap,fullyVisible:x})}}return M.sort((t,i)=>t.distanceSq-i.distanceSq).map(t=>t.tileID)}function eA(t){return"raster"===t||"image"===t||"video"===t}function eL(t,i,r,a,o,s,n){if(r[0].overscaledZ>=s)return!1;let l=!1;for(let s of r){let r=t.getLoadedTile(s);if(!r)continue;let{fadingRole:h,fadingDirection:c,fadingParentID:u}=r;0===h&&0===c&&u||(r.setCrossFadeLogic({fadingRole:0,fadingDirection:0,fadingParentID:i.tileID,fadeEndTime:o+n}),i.setCrossFadeLogic({fadingRole:1,fadingDirection:1,fadeEndTime:o+n})),a[s.key]=s,l=!0}return l}function eF(t,i){t.needsHillshadePrepare=!0,t.needsTerrainPrepare=!0;let r=i.tileID.canonical.x-t.tileID.canonical.x,a=i.tileID.canonical.y-t.tileID.canonical.y,o=2**t.tileID.canonical.z,s=i.tileID.key;(0!==r||0!==a)&&(Math.abs(a)>1||(Math.abs(r)>1&&(1===Math.abs(r+o)?r+=o:1===Math.abs(r-o)&&(r-=o)),!(!i.dem||!t.dem)&&(t.dem.backfillBorder(i.dem,r,a),t.neighboringTiles?.[s]&&(t.neighboringTiles[s].backfilled=!0))))}var ek=class{constructor(){this._tiles={}}handleWrapJump(t){let i={};for(let r in this._tiles){let a=this._tiles[r];a.tileID=a.tileID.unwrapTo(a.tileID.wrap+t),i[a.tileID.key]=a}this._tiles=i}setFeatureState(t,i,r){for(let a in this._tiles)this._tiles[a].setFeatureState(t,i,r)}getAllTiles(){return Object.values(this._tiles)}getAllIds(t=!1){return t?Object.values(this._tiles).map(t=>t.tileID).sort(p.y).map(t=>t.key):Object.keys(this._tiles)}getTileById(t){return this._tiles[t]}setTile(t,i){this._tiles[t]=i}deleteTileById(t){delete this._tiles[t]}getLoadedTile(t){let i=this.getTileById(t.key);return i?.hasData()?i:null}isIdRenderable(t,i=!1){return this.getTileById(t)?.isRenderable(i)}getRenderableIds(t=0,i){let r=[];for(let t of this.getAllIds())this.isIdRenderable(t,i)&&r.push(this.getTileById(t));return i?r.sort((i,r)=>{let a=i.tileID,o=r.tileID,s=new p.Vi(a.canonical.x,a.canonical.y)._rotate(-t),n=new p.Vi(o.canonical.x,o.canonical.y)._rotate(-t);return a.overscaledZ-o.overscaledZ||n.y-s.y||n.x-s.x}).map(t=>t.tileID.key):r.map(t=>t.tileID).sort(p.y).map(t=>t.key)}},eB=class t extends p.wn{static{this.maxUnderzooming=10}static{this.maxOverzooming=3}constructor(t,i,r){super(),this.id=t,this.dispatcher=r,this.on("data",t=>{this._dataHandler(t)}),this.on("dataloading",()=>{this._sourceErrored=!1}),this.on("error",()=>{this._sourceErrored=this._source.loaded()}),this._source=((t,i,r,a)=>{let o=new((t=>{switch(t){case"geojson":return ep;case"image":return eg;case"raster":return el;case"raster-dem":return eh;case"vector":return en;case"video":return ev;case"canvas":return ey}return ex[t]})(i.type))(t,i,r,a);if(o.id!==t)throw Error(`Expected Source id to be ${t} instead of ${o.id}`);return o}
1)(t,i,r,this),this._inViewTiles=new ek,this._outOfViewCache=new p.s(0,t=>this._unloadTile(t)),this._timers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._rasterFadeDuration=0,this._maxFadingAncestorLevels=5,this._state=new eS,this._didEmitContent=!1,this._updated=!1}onAdd(t){this.map=t,this._maxTileCacheSize=t?t._maxTileCacheSize:null,this._maxTileCacheZoomLevels=t?t._maxTileCacheZoomLevels:null,this._source?.onAdd&&this._source.onAdd(t)}onRemove(t){for(let t of this._inViewTiles.getAllTiles())t.unloadVectorData();this.clearTiles(),this._source?.onRemove&&this._source.onRemove(t),this._inViewTiles=new ek}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;if((void 0!==this.used||void 0!==this.usedForTerrain)&&!this.used&&!this.usedForTerrain)return!0;if(!this._updated)return!1;for(let t of this._inViewTiles.getAllTiles())if("loaded"!==t.state&&"errored"!==t.state)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 o=await this._source.loadTile(t);this._tileLoaded(t,i,r,a,o)}catch(i){t.state="errored",404===i.status?this.update(this.transform,this.terrain):this._source.fire(new p.Sn((0,p.ir)(i),{tile:t}))}}_unloadTile(t){this._source.unloadTile&&this._source.unloadTile(t)}_abortTile(t){this._source.abortTile&&this._source.abortTile(t),this._source.fire(new M("dataabort",{tile:t,coord:t.tileID}))}serialize(){return this._source.serialize()}prepare(t){for(let i of(this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._inViewTiles,this.map?this.map.painter:null),this._inViewTiles.getAllTiles()))i.upload(t),i.prepare(this.map.style.imageManager)}getIds(){return this._inViewTiles.getAllIds(!0)}getRenderableIds(t){return this._inViewTiles.getRenderableIds(this.transform?.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){if(this._paused){this._shouldReloadOnResume=!0;return}for(let r of(this._outOfViewCache.reset(),this._inViewTiles.getAllIds())){let a=this._inViewTiles.getTileById(r);i&&!this._source.shouldReloadTile(a,i)||(t?this._reloadTile(r,"errored"===a.state?"loading":"expired"):"errored"!==a.state&&this._reloadTile(r,"reloading"))}}async _reloadTile(t,i){let r=this._inViewTiles.getTileById(t);if(!r)return;let a=r.hasData();"loading"!==r.state&&(r.state=i),await this._loadTile(r,t,i,a)}_tileLoaded(t,i,r,a,o){a||(t.timeAdded=v(),t.selfFading&&(t.fadeEndTime=t.timeAdded+this._rasterFadeDuration)),"expired"===r&&(t.refreshedUponExpiration=!0),this._setTileReloadTimer(i,t),!o?.unmodified&&("raster-dem"===this.getSource().type&&t.dem&&function(t,i){for(let r of i.getRenderableIds()){if(!t.neighboringTiles?.[r])continue;let a=i.getTileById(r);t.neighboringTiles[r].backfilled||eF(t,a),a.neighboringTiles?.[t.tileID.key]?.backfilled||eF(a,t)}}(t,this._inViewTiles),t.featureStateRevision=-1,this._state.initializeTileState(t,this.map?this.map.painter:null),t.aborted||this._source.fire(new M("data",{tile:t,coord:t.tileID})))}getTile(t){return this.getTileByID(t.key)}getTileByID(t){return this._inViewTiles.getTileById(t)}_retainLoadedChildren(i,r){let a=this._getLoadedDescendents(r),o=new Set;for(let s of r){let r=a[s.key];if(!r?.length){o.add(s);continue}let n=s.overscaledZ+t.maxOverzooming,l=r.filter(t=>t.tileID.overscaledZ<=n);if(!l.length){o.add(s);continue}let h=Math.min(...l.map(t=>t.tileID.overscaledZ)),c=l.filter(t=>t.tileID.overscaledZ===h).map(t=>t.tileID);for(let t of c)i[t.key]=t;this._areDescendentsComplete(c,h,s.overscaledZ)||o.add(s)}return o}_getLoadedDescendents(t){let i={};for(let r of this._inViewTiles.getAllTiles().filter(t=>t.hasData()))for(let a of t)r.tileID.isChildOf(a)&&(i[a.key]||=[],i[a.key].push(r));return i}_areDescendentsComplete(t,i,r){return 1===t.length&&t[0].isOverscaled()?t[0].overscaledZ===i:4**(i-r)===t.length}getLoadedTile(t){return this._inViewTiles.getLoadedTile(t)}updateCacheSize(t){let i=Math.floor((Math.ceil(t.width/this._source.tileSize)+1)*(Math.ceil(t.height/this._source.tileSize)+1)*(null===this._maxTileC
1acheZoomLevels?p.In.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),r="number"==typeof this._maxTileCacheSize?Math.min(this._maxTileCacheSize,i):i;this._outOfViewCache.setMaxSize(r)}handleWrapJump(t){let i=Math.round((t-(void 0===this._prevLng?t:this._prevLng))/360);this._prevLng=t,i&&(this._inViewTiles.handleWrapJump(i),this._resetTileReloadTimers())}update(t,i){let r;if(!this._sourceLoaded||this._paused)return;this.transform=t,this.terrain=i,this.updateCacheSize(t),this.handleWrapJump(this.transform.center.lng),this.used||this.usedForTerrain?this._source.tileID?r=t.getVisibleUnwrappedCoordinates(this._source.tileID).map(t=>new p.g(t.canonical.z,t.wrap,t.canonical.z,t.canonical.x,t.canonical.y)):(r=eD(t,{tileSize:this.usedForTerrain?this.tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:"vector"===this._source.type&&void 0!==this.map._zoomLevelsToOverscale?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}),this._source.hasTile&&(r=r.filter(t=>this._source.hasTile(t)))):r=[],this.usedForTerrain&&(r=this._addTerrainIdealTiles(r));let a=0===r.length&&!this._updated&&this._didEmitContent;this._updated=!0,a&&this.fire(new M("data",{sourceDataType:"idle",sourceId:this.id}));let o=eR(t,this._source),s=this._updateRetainedTiles(r,o),n=eA(this._source.type);n&&this._rasterFadeDuration>0&&!i&&function(t,i,r,a,o,s,n){let l=v(),h=(0,p.dr)(i);for(let c of i){let i=t.getTileById(c.key);(0===i.fadingDirection||0===i.fadeOpacity)&&i.resetFadeLogic(),!function(t,i,r,a,o,s,n){if(!i.hasData())return!1;let{tileID:l,fadingRole:h,fadingDirection:c,fadingParentID:u}=i;if(0===h&&1===c&&u)return r[u.key]=u,!0;let d=Math.max(l.overscaledZ-o,s);for(let o=l.overscaledZ-1;o>=d;o--){let s=l.scaledTo(o),h=t.getLoadedTile(s);if(h)return i.setCrossFadeLogic({fadingRole:0,fadingDirection:1,fadingParentID:h.tileID,fadeEndTime:a+n}),h.setCrossFadeLogic({fadingRole:1,fadingDirection:0,fadeEndTime:a+n}),r[s.key]=s,!0}return!1}(t,i,r,l,a,o,n)&&(function(t,i,r,a,o,s){if(!i.hasData())return!1;let n=i.tileID.children(o),l=eL(t,i,n,r,a,o,s);if(l)return!0;for(let h of n)eL(t,i,h.children(o),r,a,o,s)&&(l=!0);return l}(t,i,r,l,s,n)||function(t,i,r,a){let o=t.tileID;return!!t.selfFading||!t.hasData()&&!!i.has(o)&&(t.setSelfFadeLogic(r+a),!0)}(i,h,l,n)||i.resetFadeLogic())}}(this._inViewTiles,r,s,this._maxFadingAncestorLevels,this._source.minzoom,this._source.maxzoom,this._rasterFadeDuration),n?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 t=r.scaledTo(r.canonical.z-1);i.push(t);let a=r.scaledTo(Math.max(this._source.minzoom,Math.min(r.canonical.z,5)));i.push(a)}return t.concat(i)}releaseSymbolFadeTiles(){for(let t of this._inViewTiles.getAllIds())this._inViewTiles.getTileById(t).holdingForSymbolFade()&&this._removeTile(t)}_updateRetainedTiles(i,r){let a=new Set;for(let t of i)this._addTile(t).hasData()||a.add(t);let o=i.reduce((t,i)=>(t[i.key]=i,t),{}),s=this._retainLoadedChildren(o,a),n={},l=Math.max(r-t.maxUnderzooming,this._source.minzoom);for(let t of s){let i=this._inViewTiles.getTileById(t.key),r=i?.wasRequested();for(let a=t.overscaledZ-1;a>=l;--a){let s=t.scaledTo(a);if(n[s.key])break;if(n[s.key]=!0,(i=this.getTile(s))||!r||(i=this._addTile(s)),i){let t=i.hasData();if((t||!this.map?.cancelPendingTileRequestsWhileZooming||r)&&(o[s.key]=s),r=i.wasRequested(),t)break}}}return o}_addTile(t){let i=this._inViewTiles.getTileById(t.key);if(i)return i;(i=this._outOfViewCache.getAndRemove(t))&&(i.resetFadeLogic(),this._setTileReloadTimer(t.key,i),i.tileID=t,this._state.initializeTileState(i,this.map?this.map.painter:null));let r=i;
1return i||(i=new eM(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 M("dataloading",{tile:i,coord:i.tileID})),i}_setTileReloadTimer(t,i){this._clearTileReloadTimer(t);let r=i.getExpiryTimeout();if(r){let i=()=>{this._reloadTile(t,"expired"),delete this._timers[t]};this._timers[t]=setTimeout(i,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)&&"errored"!=r.state||t.some(t=>t.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()&&"reloading"!==i.state?this._outOfViewCache.add(i.tileID,i,i.getExpiryTimeout()):(i.aborted=!0,this._abortTile(i),this._unloadTile(i))))}_dataHandler(t){if("source"===t.dataType){if("metadata"===t.sourceDataType){this._sourceLoaded=!0;return}"content"!==t.sourceDataType||!this._sourceLoaded||this._paused||(this.reload(t.sourceDataChanged,t.shouldReloadTileOptions),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0)}}clearTiles(){for(let t of(this._shouldReloadOnResume=!1,this._paused=!1,this._inViewTiles.getAllIds()))this._removeTile(t);this._outOfViewCache.reset()}tilesIn(t,i,r){let a=[],o=this.transform;if(!o)return a;let s=o.getCoveringTilesDetailsProvider().allowWorldCopies(),n=r?o.getCameraQueryGeometry(t):t,l=t=>o.screenPointToMercatorCoordinate(t,this.terrain),h=this.transformBbox(t,l,!s),c=this.transformBbox(n,l,!s),u=this.getIds(),d=p.ft.fromPoints(c);for(let t of u){let r=this._inViewTiles.getTileById(t);if(r.holdingForSymbolFade())continue;let n=s?[r.tileID]:[r.tileID.unwrapTo(-1),r.tileID.unwrapTo(0)],l=2**(o.zoom-r.tileID.overscaledZ),u=i*r.queryPadding*p.Ur/r.tileSize/l;for(let t of n){let i=d.map(i=>t.getTilePoint(new p.tt(i.x,i.y)));if(i.expandBy(u),i.intersects(p.dt)){let i=h.map(i=>t.getTilePoint(i)),o=c.map(i=>t.getTilePoint(i));a.push({tile:r,tileID:s?t:t.unwrapTo(0),queryGeometry:i,cameraQueryGeometry:o,scale:l})}}}return a}transformBbox(t,i,r){let a=t.map(i);if(r){let r=p.ft.fromPoints(t);r.shrinkBy(.001*Math.min(r.width(),r.height()));let o=r.map(i);p.ft.fromPoints(a).covers(o)||(a=a.map(t=>t.x>.5?new p.tt(t.x-1,t.y,t.z):t))}return a}getVisibleCoordinates(t){let i=this.getRenderableIds(t).map(t=>this._inViewTiles.getTileById(t).tileID);return this.transform&&this.transform.populateCache(i),i}hasTransition(){return!!this._source.hasTransition()||eA(this._source.type)&&function(t,i){if(i<=0)return!1;let r=v();for(let i of t.getAllTiles())if(i.fadeEndTime>=r)return!0;return!1}(this._inViewTiles,this._rasterFadeDuration)}setRasterFadeDuration(t){this._rasterFadeDuration=t}setFeatureState(t,i,r){t||=p.f,this._state.updateState(t,i,r)}removeFeatureState(t,i,r){t||=p.f,this._state.removeFeatureState(t,i,r)}getFeatureState(t,i){return t||=p.f,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("loaded"!==t.state&&"errored"!==t.state)return!1;return!0}},ej=class{constructor(t,i){this.reset(t,i)}reset(t,i){this.points=t||[],this._distances=[0];for(let t=1;t<this.points.length;t++)this._distances[t]=this._distances[t-1]+this.points[t].dist(this.points[t-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(i||0,.5*this.length),this.paddedLength=this.length-2*this.padding}lerp(t){if(1===this.points.length)return this.points[0];t=(0,p.Kn)(t,0,1);let i=1,r=this._distances[i],a=t*this.paddedLength+this.padding;
1for(;r<a&&i<this._distances.length;)r=this._distances[++i];let o=i-1,s=this._distances[o],n=r-s,l=n>0?(a-s)/n:0;return this.points[o].mult(1-l).add(this.points[i].mult(l))}};function eO(t,i){let r=!0;return"always"===t||("never"===t||"never"===i)&&(r=!1),r}var eN=class{constructor(t,i,r){let a=this.boxCells=[],o=this.circleCells=[];this.xCellCount=Math.ceil(t/r),this.yCellCount=Math.ceil(i/r);for(let t=0;t<this.xCellCount*this.yCellCount;t++)a.push([]),o.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=t,this.height=i,this.xScale=this.xCellCount/t,this.yScale=this.yCellCount/i,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(t,i,r,a,o){this._forEachCell(i,r,a,o,this._insertBoxCell,this.boxUid++),this.boxKeys.push(t),this.bboxes.push(i),this.bboxes.push(r),this.bboxes.push(a),this.bboxes.push(o)}insertCircle(t,i,r,a){this._forEachCell(i-a,r-a,i+a,r+a,this._insertCircleCell,this.circleUid++),this.circleKeys.push(t),this.circles.push(i),this.circles.push(r),this.circles.push(a)}_insertBoxCell(t,i,r,a,o,s){this.boxCells[o].push(s)}_insertCircleCell(t,i,r,a,o,s){this.circleCells[o].push(s)}_query(t,i,r,a,o,s,n){if(r<0||t>this.width||a<0||i>this.height)return[];let l=[];if(t<=0&&i<=0&&this.width<=r&&this.height<=a){if(o)return[{key:null,x1:t,y1:i,x2:r,y2:a}];for(let t=0;t<this.boxKeys.length;t++)l.push({key:this.boxKeys[t],x1:this.bboxes[4*t],y1:this.bboxes[4*t+1],x2:this.bboxes[4*t+2],y2:this.bboxes[4*t+3]});for(let t=0;t<this.circleKeys.length;t++){let i=this.circles[3*t],r=this.circles[3*t+1],a=this.circles[3*t+2];l.push({key:this.circleKeys[t],x1:i-a,y1:r-a,x2:i+a,y2:r+a})}}else this._forEachCell(t,i,r,a,this._queryCell,l,{hitTest:o,overlapMode:s,seenUids:{box:{},circle:{}}},n);return l}query(t,i,r,a){return this._query(t,i,r,a,!1,null)}hitTest(t,i,r,a,o,s){return this._query(t,i,r,a,!0,o,s).length>0}hitTestCircle(t,i,r,a,o){let s=t-r,n=t+r,l=i-r,h=i+r;if(n<0||s>this.width||h<0||l>this.height)return!1;let c=[];return this._forEachCell(s,l,n,h,this._queryCellCircle,c,{hitTest:!0,overlapMode:a,circle:{x:t,y:i,radius:r},seenUids:{box:{},circle:{}}},o),c.length>0}_queryCell(t,i,r,a,o,s,n,l){let{seenUids:h,hitTest:c,overlapMode:u}=n,d=this.boxCells[o];if(null!==d){let o=this.bboxes;for(let n of d)if(!h.box[n]){h.box[n]=!0;let d=4*n,_=this.boxKeys[n];if(t<=o[d+2]+1e-6&&i<=o[d+3]+1e-6&&r>=o[d+0]-1e-6&&a>=o[d+1]-1e-6&&(!l||l(_))&&(!c||!eO(u,_.overlapMode))&&(s.push({key:_,x1:o[d],y1:o[d+1],x2:o[d+2],y2:o[d+3]}),c))return!0}}let _=this.circleCells[o];if(null!==_){let o=this.circles;for(let n of _)if(!h.circle[n]){h.circle[n]=!0;let d=3*n,_=this.circleKeys[n];if(this._circleAndRectCollide(o[d],o[d+1],o[d+2],t,i,r,a)&&(!l||l(_))&&(!c||!eO(u,_.overlapMode))){let t=o[d],i=o[d+1],r=o[d+2];if(s.push({key:_,x1:t-r,y1:i-r,x2:t+r,y2:i+r}),c)return!0}}}return!1}_queryCellCircle(t,i,r,a,o,s,n,l){let{circle:h,seenUids:c,overlapMode:u}=n,d=this.boxCells[o];if(null!==d){let t=this.bboxes;for(let i of d)if(!c.box[i]){c.box[i]=!0;let r=4*i,a=this.boxKeys[i];if(this._circleAndRectCollide(h.x,h.y,h.radius,t[r+0],t[r+1],t[r+2],t[r+3])&&(!l||l(a))&&!eO(u,a.overlapMode))return s.push(!0),!0}}let _=this.circleCells[o];if(null!==_){let t=this.circles;for(let i of _)if(!c.circle[i]){c.circle[i]=!0;let r=3*i,a=this.circleKeys[i];if(this._circlesCollide(t[r],t[r+1],t[r+2],h.x,h.y,h.radius)&&(!l||l(a))&&!eO(u,a.overlapMode))return s.push(!0),!0}}}_forEachCell(t,i,r,a,o,s,n,l){let h=this._convertToXCellCoord(t),c=this._convertToYCellCoord(i),u=this._convertToXCellCoord(r),d=this._convertToYCellCoord(a);for(let _=h;_<=u;_++)for(let h=c;h<=d;h++){let c=this.xCellCount*h+_;if(o.call(this,t,i,r,a,c,s,n,l))return}}_convertToXCellCoord(t){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(t*this.xScale)))}_convertToYCellCoord(t){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(t*this.yScale)))}_circlesCollide(t,i,r,a,o,s){let n=a-t,l=o-i,h=r+s;return h*h>n*n+l*l}_circleAndRectCollide(t,i,r,a,o,s,n){let l=(s-a)/2,h=Math.abs(t-(a+l));if(h>l+r)return!1;let c=(n-o)/2,u=Math.abs(i-(o+c));if(u>c+r)return!1;if(h<=l||u<=c)return!0;let d=h-l,_=u-c;return d*d+_*_<=r*r}};let eZ=(0,p.Si)();function eU(t,i,r){let a=(0,p.Si)();if(!t){var o,s,n,l,h;let{vecSouth:t,vecEast:r}=eV(i),c=m();c[0]=r[0],c[1]=r[1],c[2]=t[0],c[3]=t[1],o=c[0],s=c[1],n=c[2],(h=o*(l=c[3])-n*s)&&(h=1/h,c[0]=l*h,c[1]=-s*h,c[2]=-n*h,c[3]=o*h),a[0]=c[0],a[1]=c[1],a[4]=c[2],a[5]=c[3]}
1return(0,p.Pi)(a,a,[1/r,1/r,1]),a}function eV(t){let i=Math.cos(t.rollInRadians),r=Math.sin(t.rollInRadians),a=Math.cos(t.pitchInRadians),o=Math.cos(t.bearingInRadians),s=Math.sin(t.bearingInRadians),n=(0,p.Wr)();n[0]=-o*a*r-s*i,n[1]=-s*a*r+o*i;let l=(0,p.Gr)(n);l<1e-9?(0,p.Jr)(n):(0,p.Kr)(n,n,1/l);let h=(0,p.Wr)();h[0]=o*a*i-s*r,h[1]=s*a*i+o*r;let c=(0,p.Gr)(h);return c<1e-9?(0,p.Jr)(h):(0,p.Kr)(h,h,1/c),{vecEast:h,vecSouth:n}}function eG(t,i,r,a){let o;a?(o=[t,i,a(t,i),1],(0,p.ti)(o,o,r)):e3(o=[t,i,0,1],o,r);let s=o[3];return{point:new p.Vi(o[0]/s,o[1]/s),signedDistanceFromCamera:s,isOccluded:!1}}function eq(t,i,r,a,o,s,n,l){let h=s.glyphStartIndex+s.numGlyphs,c=s.lineStartIndex,u=s.lineStartIndex+s.lineLength,d=i.getoffsetX(s.glyphStartIndex),_=i.getoffsetX(h-1),p=e0(t*d,r,a,o,s.segment,c,u,l,n);if(!p)return null;let m=e0(t*_,r,a,o,s.segment,c,u,l,n);return!m||l.projectionCache.anyProjectionOccluded?null:{first:p,last:m}}function eW(t,i,r,a){return 1===t&&Math.abs(r.y-i.y)>Math.abs(r.x-i.x)*a?{useVertical:!0}:(2===t?i.y<r.y:i.x>r.x)?{needsFlipping:!0}:null}function e$(t){let{projectionContext:i,pitchedLabelPlaneMatrixInverse:r,symbol:a,fontSize:o,flip:s,keepUpright:n,glyphOffsetArray:l,dynamicLayoutVertexArray:h,aspectRatio:c,rotateToLine:u}=t,d=o/24,_=a.lineOffsetX*d,m=a.lineOffsetY*d,f;if(a.numGlyphs>1){let t=a.glyphStartIndex+a.numGlyphs,o=a.lineStartIndex,h=a.lineStartIndex+a.lineLength,p=eq(d,l,_,m,s,a,u,i);if(!p)return{notEnoughRoom:!0};let g=eY(p.first.point.x,p.first.point.y,i,r),v=eY(p.last.point.x,p.last.point.y,i,r);if(n&&!s){let t=eW(a.writingMode,g,v,c);if(t)return t}f=[p.first];for(let r=a.glyphStartIndex+1;r<t-1;r++){let t=e0(d*l.getoffsetX(r),_,m,s,a.segment,o,h,i,u);if(!t)return{notEnoughRoom:!0};f.push(t)}f.push(p.last)}else{if(n&&!s){let t=eK(i.tileAnchorPoint.x,i.tileAnchorPoint.y,i).point,o=a.lineStartIndex+a.segment+1,s=new p.Vi(i.lineVertexArray.getx(o),i.lineVertexArray.gety(o)),n=eK(s.x,s.y,i),l=n.signedDistanceFromCamera>0?n.point:eH(i.tileAnchorPoint,s,t,1,i),h=eY(t.x,t.y,i,r),u=eY(l.x,l.y,i,r),d=eW(a.writingMode,h,u,c);if(d)return d}let t=e0(d*l.getoffsetX(a.glyphStartIndex),_,m,s,a.segment,a.lineStartIndex,a.lineStartIndex+a.lineLength,i,u);if(!t||i.projectionCache.anyProjectionOccluded)return{notEnoughRoom:!0};f=[t]}for(let t of f)(0,p.O)(h,t.point,t.angle);return{}}function eH(t,i,r,a,o){let s=t.add(t.sub(i)._unit()),n=eK(s.x,s.y,o).point,l=r.sub(n);return r.add(l._mult(a/l.mag()))}function eX(t,i,r){let a=i.projectionCache;if(a.projections[t])return a.projections[t];let o=new p.Vi(i.lineVertexArray.getx(t),i.lineVertexArray.gety(t)),s=eK(o.x,o.y,i);if(s.signedDistanceFromCamera>0)return a.projections[t]=s.point,a.anyProjectionOccluded||=s.isOccluded,s.point;let n=t-r.direction,l=0===r.distanceFromAnchor?i.tileAnchorPoint:new p.Vi(i.lineVertexArray.getx(n),i.lineVertexArray.gety(n)),h=r.absOffsetX-r.distanceFromAnchor+1;return eH(l,o,r.previousVertex,h,i)}function eK(t,i,r){let a=t+r.translation[0],o=i+r.translation[1],s;return r.pitchWithMap?(s=eG(a,o,r.pitchedLabelPlaneMatrix,r.getElevation)).isOccluded=!1:((s=r.transform.projectTileCoordinates(a,o,r.unwrappedTileID,r.getElevation)).point.x=(.5*s.point.x+.5)*r.width,s.point.y=(-(.5*s.point.y)+.5)*r.height),s}function eY(t,i,r,a){if(r.pitchWithMap){let o=[t,i,0,1];return(0,p.ti)(o,o,a),r.transform.projectTileCoordinates(o[0]/o[3],o[1]/o[3],r.unwrappedTileID,r.getElevation).point}return{x:t/r.width*2-1,y:1-i/r.height*2}}function eJ(t,i,r){return r.transform.projectTileCoordinates(t,i,r.unwrappedTileID,r.getElevation)}function eQ(t,i,r){return t._unit()._perp()._mult(i*r)}function e0(t,i,r,a,o,s,n,l,h){let c=a?t-i:t+i,u=c>0?1:-1,d=0;a&&(u*=-1,d=Math.PI),u<0&&(d+=Math.PI);let _=u>0?s+o:s+o+1,m;l.projectionCache.cachedAnchorPoint?m=l.projectionCache.cachedAnchorPoint:(m=eK(l.tileAnchorPoint.x,l.tileAnchorPoint.y,l).point,l.projectionCache.cachedAnchorPoint=m);let f=m,g=m,v,y,x=0,b=0,w=Math.abs(c),T=[],P;for(;x+b<=w;){if((_+=u)<s||_>=n)return null;x+=b,g=f,y=v;let t={absOffsetX:w,direction:u,distanceFromAnchor:x,previousVertex:g};if(f=eX(_,l,t),0===r)T.push(g),P=f.sub(g);else{let i,a=f.sub(g);
1i=0===a.mag()?eQ(eX(_+u,l,t).sub(f),r,u):eQ(a,r,u),y||=g.add(i),v=function(t,i,r,a,o,s,n,l,h){if(l.projectionCache.offsets[t])return l.projectionCache.offsets[t];let c=r.add(i);if(t+h.direction<a||t+h.direction>=o)return l.projectionCache.offsets[t]=c,c;let u=eX(t+h.direction,l,h),d=eQ(u.sub(r),n,h.direction),_=r.add(d),m=u.add(d);return l.projectionCache.offsets[t]=(0,p.cr)(s,c,_,m)||c,l.projectionCache.offsets[t]}(_,i,f,s,n,y,r,l,t),T.push(y),P=v.sub(y)}b=P.mag()}let M=(w-x)/b,I=P._mult(M)._add(y||g),S=d+Math.atan2(f.y-g.y,f.x-g.x);return T.push(I),{point:I,angle:h?S:0,path:T}}let e1=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function e2(t,i){for(let r=0;r<t;r++){let t=i.length;i.resize(t+4),i.float32.set(e1,3*t)}}function e3(t,i,r){let a=i[0],o=i[1];return t[0]=r[0]*a+r[4]*o+r[12],t[1]=r[1]*a+r[5]*o+r[13],t[3]=r[3]*a+r[7]*o+r[15],t}var e4=class{constructor(t,i=new eN(t.width+200,t.height+200,25),r=new eN(t.width+200,t.height+200,25)){this.transform=t,this.grid=i,this.ignoredGrid=r,this.pitchFactor=Math.cos(t.pitch*Math.PI/180)*t.cameraToCenterDistance,this.screenRightBoundary=t.width+100,this.screenBottomBoundary=t.height+100,this.gridRightBoundary=t.width+200,this.gridBottomBoundary=t.height+200,this.perspectiveRatioCutoff=.6}placeCollisionBox(t,i,r,a,o,s,n,l,h,c,u,d){let _=t.anchorPointX+l[0],p=t.anchorPointY+l[1],m=this.projectAndGetPerspectiveRatio(_,p,o,c,d),f=r*m.perspectiveRatio,g;if(s||n)g=this._projectCollisionBox(t,f,a,o,s,n,l,m,c,u,d);else{let i=m.x+(u?u.x*f:0),r=m.y+(u?u.y*f:0);g={allPointsOccluded:!1,box:[i+t.x1*f,r+t.y1*f,i+t.x2*f,r+t.y2*f]}}let[v,y,x,b]=g.box,w=s?g.allPointsOccluded:m.isOccluded,T=w;return T||=m.perspectiveRatio<this.perspectiveRatioCutoff,(T||=!this.isInsideGrid(v,y,x,b))||"always"!==i&&this.grid.hitTest(v,y,x,b,i,h)?{box:[v,y,x,b],placeable:!1,offscreen:!1,occluded:w}:{box:[v,y,x,b],placeable:!0,offscreen:this.isOffscreen(v,y,x,b),occluded:w}}placeCollisionCircles(t,i,r,a,o,s,n,l,h,c,u,d,_,m){let f=[],g=new p.Vi(i.anchorX,i.anchorY),v=this.getPerspectiveRatio(g.x,g.y,s,m),y=(h?o*this.transform.getPitchedTextCorrection(i.anchorX,i.anchorY,s)/v:o*v)/24,x=i.lineOffsetX*y,b=i.lineOffsetY*y,w={getElevation:m,pitchedLabelPlaneMatrix:n,lineVertexArray:r,pitchWithMap:h,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},transform:this.transform,tileAnchorPoint:g,unwrappedTileID:s,width:this.transform.width,height:this.transform.height,translation:_},T=eq(y,a,x,b,!1,i,!1,w),P=!1,M=!1,I=!0;if(T){let i=.5*u*v+d,r=new p.Vi(-100,-100),a=new p.Vi(this.screenRightBoundary,this.screenBottomBoundary),o=new ej,s=T.first,n=T.last,_=[];for(let t=s.path.length-1;t>=1;t--)_.push(s.path[t]);for(let t=1;t<n.path.length;t++)_.push(n.path[t]);let m=2.5*i;if(h){let t=this.projectPathToScreenSpace(_,w);_=t.some(t=>t.signedDistanceFromCamera<=0)?[]:t.map(t=>t.point)}let g=[];if(_.length>0){let t=_[0].clone(),i=_[0].clone();for(let r=1;r<_.length;r++)t.x=Math.min(t.x,_[r].x),t.y=Math.min(t.y,_[r].y),i.x=Math.max(i.x,_[r].x),i.y=Math.max(i.y,_[r].y);g=t.x>=r.x&&i.x<=a.x&&t.y>=r.y&&i.y<=a.y?[_]:i.x<r.x||t.x>a.x||i.y<r.y||t.y>a.y?[]:(0,p.a)([_],r.x,r.y,a.x,a.y)}for(let r of g){o.reset(r,.25*i);let a=0;a=o.length<=.5*i?1:Math.ceil(o.paddedLength/m)+1;for(let r=0;r<a;r++){let s=r/Math.max(a-1,1),n=o.lerp(s),h=n.x+100,u=n.y+100;f.push(h,u,i,0);let d=h-i,_=u-i,p=h+i,m=u+i;if(I&&=this.isOffscreen(d,_,p,m),M||=this.isInsideGrid(d,_,p,m),"always"!==t&&this.grid.hitTestCircle(h,u,i,t,c)&&(P=!0,!l))return{circles:[],offscreen:!1,collisionDetected:P}}}}return{circles:!l&&P||!M||v<this.perspectiveRatioCutoff?[]:f,offscreen:I,collisionDetected:P}}projectPathToScreenSpace(t,i){var r;let a;return function(t){let i=0,r=0,a=0,o=0;for(let s=0;s<t.length;s++)t[s].isOccluded?(a=s+1,o=0):++o>r&&(r=o,i=a);return t.slice(i,i+r)}((a=1/((r=i.pitchedLabelPlaneMatrix)[0]*r[5]-r[1]*r[4]),eZ[0]=r[5]*a,eZ[1]=-r[1]*a,eZ[2]=0,eZ[3]=0,eZ[4]=-r[4]*a,eZ[5]=r[0]*a,eZ[6]=0,eZ[7]=0,eZ[8]=0,eZ[9]=0,eZ[10]=1/r[10],eZ[11]=0,eZ[12]=0,eZ[13]=0,eZ[14]=0,eZ[15]=1/r[15],t.map(t=>{let r=eG(t.x,t.y,eZ,i.getElevation),a=i.transform.projectTileCoordinates(r.point.x,r.point.y,i.unwrappedTileID,i.getElevation);return a.point.x=(.5*a.point.x+.5)*i.width,a.point.y=(-(.5*a.point.y)+.5)*i.height,a})))}queryRenderedSymbols(t){if(0===t.length||0===this.grid.keysLength()&&0===this.ignoredGrid.keysLength())return{};let i=[],r=new p.ft;for(let a of t){let t=new p.Vi(a.x+100,a.y+100);r.extend(t),i.push(t)}let{minX:a,minY:o,maxX:s,maxY:n}=r,l=this.grid.query(a,o,s,n).concat(this.ignoredGrid.query(a,o,s,n)),h={},c={};for(let t of l){let r=t.key;if(void 0===h[r.bucketInstanceId]&&(h[r.bucketInstanceId]={}),h[r.bucketInstanceId][r.featureIndex])continue;let a=[new p.Vi(t.x1,t.y1),new p.Vi(t.x2,t.y1),new p.Vi(t.x2,t.y2),new p.Vi(t.x1,t.y2)];(0,p.kt)(i,a)&&(h[r.bucketInstanceId][r.featureIndex]=!0,void 0===c[r.bucketInstanceId]&&(c[r.bucketInstanceId]=[]),c[r.bucketInstanceId].push(r.featureIndex))}return c}insertCollisionBox(t,i,r,a,o,s){(r?this.ignoredGrid:this.grid).insert({bucketInstanceId:a,featureIndex:o,collisionGroupID:s,overlapMode:i}
1,t[0],t[1],t[2],t[3])}insertCollisionCircles(t,i,r,a,o,s){let n=r?this.ignoredGrid:this.grid,l={bucketInstanceId:a,featureIndex:o,collisionGroupID:s,overlapMode:i};for(let i=0;i<t.length;i+=4)n.insertCircle(l,t[i],t[i+1],t[i+2])}projectAndGetPerspectiveRatio(t,i,r,a,o){if(o){let r;a?(r=[t,i,a(t,i),1],(0,p.ti)(r,r,o)):e3(r=[t,i,0,1],r,o);let s=r[3];return{x:(r[0]/s+1)/2*this.transform.width+100,y:(-r[1]/s+1)/2*this.transform.height+100,perspectiveRatio:.5+.5*(this.transform.cameraToCenterDistance/s),isOccluded:!1,signedDistanceFromCamera:s}}{let o=this.transform.projectTileCoordinates(t,i,r,a);return{x:(o.point.x+1)/2*this.transform.width+100,y:(-o.point.y+1)/2*this.transform.height+100,perspectiveRatio:.5+.5*(this.transform.cameraToCenterDistance/o.signedDistanceFromCamera),isOccluded:o.isOccluded,signedDistanceFromCamera:o.signedDistanceFromCamera}}}getPerspectiveRatio(t,i,r,a){let o=this.transform.projectTileCoordinates(t,i,r,a);return .5+.5*(this.transform.cameraToCenterDistance/o.signedDistanceFromCamera)}isOffscreen(t,i,r,a){return r<100||t>=this.screenRightBoundary||a<100||i>this.screenBottomBoundary}isInsideGrid(t,i,r,a){return r>=0&&t<this.gridRightBoundary&&a>=0&&i<this.gridBottomBoundary}getViewportMatrix(){let t=(0,p.Ei)([]);return(0,p.Fi)(t,t,[-100,-100,0]),t}_projectCollisionBox(t,i,r,a,o,s,n,l,h,c,u){let d=1,_=0,m=0,f=1,g=t.anchorPointX+n[0],v=t.anchorPointY+n[1];if(s&&!o){let t=this.projectAndGetPerspectiveRatio(g+1,v,a,h,u),i=t.x-l.x,r=Math.atan((t.y-l.y)/i)+(i<0?Math.PI:0),o=Math.sin(r),s=Math.cos(r);d=s,_=o,m=-o,f=s}else if(!s&&o){let t=eV(this.transform);d=t.vecEast[0],_=t.vecEast[1],m=t.vecSouth[0],f=t.vecSouth[1]}let y=l.x,x=l.y,b=i;if(o&&(y=g,x=v,b=2**-(this.transform.zoom-r.overscaledZ)*this.transform.getPitchedTextCorrection(g,v,a),!c)){let t=l.signedDistanceFromCamera/this.transform.cameraToCenterDistance;b*=(0,p.Kn)(.5+.5*t,0,4)}c&&(y+=d*c.x*b+m*c.y*b,x+=_*c.x*b+f*c.y*b);let w=t.x1*b,T=t.x2*b,P=(w+T)/2,M=t.y1*b,I=t.y2*b,S=(M+I)/2,C=[];for(let{offsetX:t,offsetY:i}of[{offsetX:w,offsetY:M},{offsetX:P,offsetY:M},{offsetX:T,offsetY:M},{offsetX:T,offsetY:S},{offsetX:T,offsetY:I},{offsetX:P,offsetY:I},{offsetX:w,offsetY:I},{offsetX:w,offsetY:S}])C.push(new p.Vi(y+d*t+m*i,x+_*t+f*i));let E=!1;if(o){let t=C.map(t=>this.projectAndGetPerspectiveRatio(t.x,t.y,a,h,u));E=t.some(t=>!t.isOccluded),C=t.map(t=>new p.Vi(t.x,t.y))}else E=!0;return{box:(0,p.lr)(C),allPointsOccluded:!E}}},e5=class{constructor(t,i,r,a){this.opacity=t?Math.max(0,Math.min(1,t.opacity+(t.placed?i:-i))):a&&r?1:0,this.placed=r}isHidden(){return 0===this.opacity&&!this.placed}},e6=class{constructor(t,i,r,a,o){this.text=new e5(t?t.text:null,i,r,o),this.icon=new e5(t?t.icon:null,i,a,o)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}},e8=class{constructor(t,i,r){this.text=t,this.icon=i,this.skipFade=r}},e9=class{constructor(t,i,r,a,o){this.bucketInstanceId=t,this.featureIndex=i,this.sourceLayerIndex=r,this.bucketIndex=a,this.tileID=o}},e7=class{constructor(t){this.crossSourceCollisions=t,this.maxGroupID=0,this.collisionGroups={}}get(t){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[t]){let i=++this.maxGroupID;this.collisionGroups[t]={ID:i,predicate:t=>t.collisionGroupID===i}}return this.collisionGroups[t]}};function te(t,i,r,a,o){let{horizontalAlign:s,verticalAlign:n}=(0,p.N)(t);return new p.Vi(-(s-.5)*i+a[0]*o,-(n-.5)*r+a[1]*o)}var tt=class{constructor(t,i,r,a,o){this.transform=t.clone(),this.terrain=i,this.collisionIndex=new e4(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=r,this.retainedQueryData={},this.collisionGroups=new e7(a),this.collisionCircleArrays={},this.collisionBoxArrays=new Map,this.prevPlacement=o,o&&(o.prevPlacement=void 0),this.placedOrientations={}}_getTerrainElevationFunc(t){let i=this.terrain;return i?(r,a)=>i.getElevation(t,r,a):null}getBucketParts(t,i,r,a){let o=r.getBucket(i),s=r.latestFeatureIndex;if(!o||!s||i.id!==o.layerIds[0])return;let n=r.collisionBoxArray,l=o.layers[0].layout,h=o.layers[0].paint,c=2**(this.transform.zoom-r.tileID.overscaledZ
1),u=r.tileSize/p.Ur,d=r.tileID.toUnwrapped(),_="map"===l.get("text-rotation-alignment"),m=(0,p.Hr)(r,1,this.transform.zoom),f=(0,p.Lr)(this.collisionIndex.transform,r,h.get("text-translate"),h.get("text-translate-anchor")),g=(0,p.Lr)(this.collisionIndex.transform,r,h.get("icon-translate"),h.get("icon-translate-anchor")),v=eU(_,this.transform,m);this.retainedQueryData[o.bucketInstanceId]=new e9(o.bucketInstanceId,s,o.sourceLayerIndex,o.index,r.tileID);let y={bucket:o,layout:l,translationText:f,translationIcon:g,unwrappedTileID:d,pitchedLabelPlaneMatrix:v,scale:c,textPixelRatio:u,holdingForFade:r.holdingForSymbolFade(),collisionBoxArray:n,partiallyEvaluatedTextSize:(0,p.j)(o.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(o.sourceID)};if(a)for(let i of o.sortKeyRanges){let{sortKey:r,symbolInstanceStart:a,symbolInstanceEnd:o}=i;t.push({sortKey:r,symbolInstanceStart:a,symbolInstanceEnd:o,parameters:y})}else t.push({symbolInstanceStart:0,symbolInstanceEnd:o.symbolInstances.length,parameters:y})}attemptAnchorPlacement(t,i,r,a,o,s,n,l,h,c,u,d,_,m,f,g,v,y,x,b){let w=p.r[t.textAnchor],T=[t.textOffset0,t.textOffset1],P=te(w,r,a,T,o),M=this.collisionIndex.placeCollisionBox(i,d,l,h,c,n,s,g,u.predicate,x,P,b);if(!(y&&!this.collisionIndex.placeCollisionBox(y,d,l,h,c,n,s,v,u.predicate,x,P,b).placeable)&&M.placeable){let t;if(this.prevPlacement?.variableOffsets[_.crossTileID]&&this.prevPlacement?.placements[_.crossTileID]?.text&&(t=this.prevPlacement.variableOffsets[_.crossTileID].anchor),0===_.crossTileID)throw Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[_.crossTileID]={textOffset:T,width:r,height:a,anchor:w,textBoxScale:o,prevAnchor:t},this.markUsedJustification(m,w,_,f),m.allowVerticalPlacement&&(this.markUsedOrientation(m,f,_),this.placedOrientations[_.crossTileID]=f),{shift:P,placedGlyphBoxes:M}}}placeLayerBucketPart(t,i,r){let{bucket:a,layout:o,translationText:s,translationIcon:n,unwrappedTileID:l,pitchedLabelPlaneMatrix:h,textPixelRatio:c,holdingForFade:u,collisionBoxArray:d,partiallyEvaluatedTextSize:_,collisionGroup:m}=t.parameters,f=o.get("text-optional"),g=o.get("icon-optional"),v=(0,p.k)(o,"text-overlap","text-allow-overlap"),y="always"===v,x=(0,p.k)(o,"icon-overlap","icon-allow-overlap"),b="always"===x,w="map"===o.get("text-rotation-alignment"),T="map"===o.get("text-pitch-alignment"),P="none"!==o.get("icon-text-fit"),M="viewport-y"===o.get("symbol-z-order"),I=y&&(b||!a.hasIconData()||g),S=b&&(y||!a.hasTextData()||f);!a.collisionArrays&&d&&a.deserializeCollisionBoxes(d);let C=this.retainedQueryData[a.bucketInstanceId].tileID,E=this._getTerrainElevationFunc(C),z=this.transform.getFastPathSimpleProjectionMatrix(C),R=(t,d,b)=>{if(i[t.crossTileID])return;if(u){this.placements[t.crossTileID]=new e8(!1,!1,!1);return}let M=!1,R=!1,D=!0,A=null,L={box:null,placeable:!1,offscreen:null,occluded:!1},F={box:null,placeable:!1,offscreen:null},k=null,B=null,j=null,O=0,N=0,Z=0;d.textFeatureIndex?O=d.textFeatureIndex:t.useRuntimeCollisionCircles&&(O=t.featureIndex),d.verticalTextFeatureIndex&&(N=d.verticalTextFeatureIndex);let U=d.textBox;if(U){let i=i=>{let r=1;if(a.allowVerticalPlacement&&!i&&this.prevPlacement){let i=this.prevPlacement.placedOrientations[t.crossTileID];i&&(this.placedOrientations[t.crossTileID]=i,r=i,this.markUsedOrientation(a,r,t))}return r},o=(i,r)=>{if(a.allowVerticalPlacement&&t.numVerticalGlyphVertices>0&&d.verticalTextBox){for(let t of a.writingModes)if(2===t?F=L=r():L=i(),L?.placeable)break}else L=i()},h=t.textAnchorOffsetStartIndex,u=t.textAnchorOffsetEndIndex;if(u===h){let r=(i,r)=>{let o=this.collisionIndex.placeCollisionBox(i,v,c,C,l,T,w,s,m.predicate,E,void 0,z);return o?.placeable&&(this.markUsedOrientation(a,r,t),this.placedOrientations[t.crossTileID]=r),o};o(()=>r(U,1),()=>{let i=d.verticalTextBox;return a.allowVerticalPlacement&&t.numVerticalGlyphVertices>0&&i?r(i,2):{box:null,offscreen:null}}),i(L?.placeable)}else{let _=p.r[this.prevPlacement?.variableOffsets[t.crossTileID]?.anchor],f=(i,o,d)=>{let p=i.x2-i.x1,f=i.y2-i.y1,g=t.textBoxScale,y=P&&"never"===x?o:null,b=null,I="never"===v?1:2,S="never";_&&I++;for(let r=0;r<I;r++){for(let r=h;r<u;r++){let o=a.textAnchorOffsets.get(r);if(_&&o.textAnchor!==_)continue;let h=this.attemptAnchorPlacement(o,i,p,f,g,w,T,c,C,l,m,S,t,a,d,s,n,y,E);if(h&&(b=h.placedGlyphBoxes,b?.placeable))return M=!0,A=h.shift,b}_?_=null:S=v}return r&&!b&&(b={box:this.collisionIndex.placeCollisionBox(U,"always",c,C,l,T,w,s,m.predicate,E,void 0,z).box,offscreen:!1,placeable:!1,occluded:!1}),b};o(()=>f(U,d.iconBox,1),()=>{let i=d.verticalTextBox,r=L?.placeable;return a.allowVerticalPlacement&&!r&&t.numVerticalGlyphVertices>0&&i?f(i,d.verticalIconBox,2):{box:null,occluded:!0,offscreen:null}}),L&&(M=L.placeable,D=L.offscreen);let g=i(L?.placeable);if(!M&&this.prevPlacement){let i=this.prevPlacement.variableOffsets[t.crossTileID];i&&(this.variableOffsets[t.crossTileID]=i,this.markUsedJustification(a,i.anchor,t,g))}}}if(k=L,M=k?.placeable,D=k?.offscreen,t.useRuntimeCollisionCircles&&t.centerJustifiedTextSymbolIndex>=0){let i=a.text.placedSymbolArray.get(t.centerJustifiedTextSymbolIndex),n=(0,p.A)(a.textSizeData,_,i),c=o.get("text-padding"),u=t.collisionCircleDiameter;(B=this.collisionIndex.placeCollisionCircles(v,i,a.lineVertexArray,a.glyphOffsetArray,n,l,h,r,T,m.predicate,u,c,s,E)).circles.length&&B.collisionDetected&&!r&&(0,p.zr)("Collisions detected, but collision boxes are not shown"),M=y||B.circles.length>0&&!B.collisionDetected,D&&=B.offscreen}if(d.iconFeatureIndex&&(Z=d.iconFeatureIndex),d.iconBox){let t=t=>this.collisionIndex.placeCollisionBox(t,x,c,C,l,T,w,n,m.predicate,E,P&&A?A:void 0,z);R=F&&F.placeable&&d.verticalIconBox?(j=t(d.verticalIconBox)).placeable:(j=t(d.iconBox)).placeable,D&&=j.offscreen}let V=f||0===t.numHorizontalGlyphVertices&&0===t.numVerticalGlyphVertices,G=g||0===t.numIconVertices;V||G?G?V||(R&&=M):M=R&&M:R=M=R&&M;let q=M&&k.placeable,W=R&&j.placeable;if(q&&(F&&F.placeable&&N?this.collisionIndex.insertCollisionBox(k.box,v,o.get("text-ignore-placement"),a.bucketInstanceId,N,m.ID):this.collisionIndex.insertCollisionBox(k.box,v,o.get("text-ignore-placement"),a.bucketInstanceId,O,m.ID)),W&&this.collisionIndex.insertCollisionBox(j.box,x,o.get("icon-ignore-placement"),a.bucketInstanceId,Z,m.ID),B&&M&&this.collisionIndex.insertCollisionCircles(B.circles,v,o.get("text-ignore-placement"),a.bucketInstanceId,O,m.ID),r&&this.storeCollisionData(a.bucketInstanceId,b,d,k,j,B),0===t.crossTileID)throw Error("symbolInstance.crossTileID can't be 0");if(0===a.bucketInstanceId)throw Error("bucket.bucketInstanceId can't be 0");let $=(M||I)&&!k?.occluded,H=(R||S)&&!j?.occluded;this.placements[t.crossTileID]=new e8($,H,D||a.justReloaded),i[t.crossTileID]=!0};if(M){if(0!==t.symbolInstanceStart)throw Error("bucket.bucketInstanceId should be 0");
1let i=a.getSortedSymbolIndexes(-this.transform.bearingInRadians);for(let t=i.length-1;t>=0;--t){let r=i[t];R(a.symbolInstances.get(r),a.collisionArrays[r],r)}}else for(let i=t.symbolInstanceStart;i<t.symbolInstanceEnd;i++)R(a.symbolInstances.get(i),a.collisionArrays[i],i);a.justReloaded=!1}storeCollisionData(t,i,r,a,o,s){if(r.textBox||r.iconBox){let s,n;this.collisionBoxArrays.has(t)?s=this.collisionBoxArrays.get(t):(s=new Map,this.collisionBoxArrays.set(t,s)),s.has(i)?n=s.get(i):(n={text:null,icon:null},s.set(i,n)),r.textBox&&(n.text=a.box),r.iconBox&&(n.icon=o.box)}if(s){let i=this.collisionCircleArrays[t];void 0===i&&(i=this.collisionCircleArrays[t]=[]);for(let t=0;t<s.circles.length;t+=4)i.push(s.circles[t+0]-100),i.push(s.circles[t+1]-100),i.push(s.circles[t+2]),i.push(+!!s.collisionDetected)}}markUsedJustification(t,i,r,a){let o={left:r.leftJustifiedTextSymbolIndex,center:r.centerJustifiedTextSymbolIndex,right:r.rightJustifiedTextSymbolIndex},s;for(let n of(s=2===a?r.verticalPlacedTextSymbolIndex:o[(0,p.t)(i)],[r.leftJustifiedTextSymbolIndex,r.centerJustifiedTextSymbolIndex,r.rightJustifiedTextSymbolIndex,r.verticalPlacedTextSymbolIndex]))n>=0&&(s>=0&&n!==s?t.text.placedSymbolArray.get(n).crossTileID=0:t.text.placedSymbolArray.get(n).crossTileID=r.crossTileID)}markUsedOrientation(t,i,r){let a=1===i||3===i?i:0;for(let i of[r.leftJustifiedTextSymbolIndex,r.centerJustifiedTextSymbolIndex,r.rightJustifiedTextSymbolIndex])t.text.placedSymbolArray.get(i).placedOrientation=a;r.verticalPlacedTextSymbolIndex&&(t.text.placedSymbolArray.get(r.verticalPlacedTextSymbolIndex).placedOrientation=2===i?i:0)}commit(t){this.commitTime=t,this.zoomAtLastRecencyCheck=this.transform.zoom;let i=this.prevPlacement,r=!1;this.prevZoomAdjustment=i?i.zoomAdjustment(this.transform.zoom):0;let a=i?i.symbolFadeChange(t):1,o=i?i.opacities:{},s=i?i.variableOffsets:{},n=i?i.placedOrientations:{};for(let t in this.placements){let i=this.placements[t],s=o[t];s?(this.opacities[t]=new e6(s,a,i.text,i.icon),r||=i.text!==s.text.placed,r||=i.icon!==s.icon.placed):(this.opacities[t]=new e6(null,a,i.text,i.icon,i.skipFade),r||=i.text||i.icon)}for(let t in o){let i=o[t];if(!this.opacities[t]){let o=new e6(i,a,!1,!1);o.isHidden()||(this.opacities[t]=o,r||=i.text.placed,r||=i.icon.placed)}}for(let t in s)this.variableOffsets[t]||!this.opacities[t]||this.opacities[t].isHidden()||(this.variableOffsets[t]=s[t]);for(let t in n)this.placedOrientations[t]||!this.opacities[t]||this.opacities[t].isHidden()||(this.placedOrientations[t]=n[t]);if(i&&void 0===i.lastPlacementChangeTime)throw Error("Last placement time for previous placement is not defined");r?this.lastPlacementChangeTime=t:"number"!=typeof this.lastPlacementChangeTime&&(this.lastPlacementChangeTime=i?i.lastPlacementChangeTime:t)}updateLayerOpacities(t,i){let r={};for(let a of i){let i=a.getBucket(t);i&&a.latestFeatureIndex&&t.id===i.layerIds[0]&&this.updateBucketOpacities(i,a.tileID,r,a.collisionBoxArray)}}updateBucketOpacities(t,i,r,a){t.hasTextData()&&(t.text.opacityVertexArray.clear(),t.text.hasVisibleVertices=!1),t.hasIconData()&&(t.icon.opacityVertexArray.clear(),t.icon.hasVisibleVertices=!1),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexArray.clear(),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexArray.clear();let o=t.layers[0],s=o.layout,n=new e6(null,0,!1,!1,!0),l=s.get("text-allow-overlap"),h=s.get("icon-allow-overlap"),c=o._unevaluatedLayout.hasValue("text-variable-anchor")||o._unevaluatedLayout.hasValue("text-variable-anchor-offset"),u="map"===s.get("text-rotation-alignment"),d="map"===s.get("text-pitch-alignment"),_="none"!==s.get("icon-text-fit"),m=new e6(null,0,l&&(h||!t.hasIconData()||s.get("icon-optional")),h&&(l||!t.hasTextData()||s.get("text-optional")),!0);!t.collisionArrays&&a&&(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData())&&t.deserializeCollisionBoxes(a);let f=(t,i,r)=>{for(let a=0;a<i/4;a++)t.opacityVertexArray.emplaceBack(r);t.hasVisibleVertices||=r!==ta},g=this.collisionBoxArrays.get(t.bucketInstanceId);for(let i=0;i<t.symbolInstances.length;i++){let a=t.symbolInstances.get(i),{numHorizontalGlyphVertices:o,numVerticalGlyphVertices:s,crossTileID:l}=a,h=r[l],v=this.opacities[l];h?v=n:v||(v=m,this.opacities[l]=v),r[l]=!0;let y=o>0||s>0,x=a.numIconVertices>0,b=this.placedOrientations[a.crossTileID],w=2===b,T=1===b||3===b;if(y){let i=tr(v.text),r=w?ta:i;f(t.text,o,r);let n=T?ta:i;f(t.text,s,n);let l=v.text.isHidden();for(let i of[a.rightJustifiedTextSymbolIndex,a.centerJustifiedTextSymbolIndex,a.leftJustifiedTextSymbolIndex])i>=0&&(t.text.placedSymbolArray.get(i).hidden=l||w?1:0);a.verticalPlacedTextSymbolIndex>=0&&(t.text.placedSymbolArray.get(a.verticalPlacedTextSymbolIndex).hidden=l||T?1:0);let h=this.variableOffsets[a.crossTileID];h&&this.markUsedJustification(t,h.anchor,a,b);let c=this.placedOrientations[a.crossTileID];c&&(this.markUsedJustification(t,"left",a,c),this.markUsedOrientation(t,c,a))}if(x){let i=tr(v.icon),r=!(_&&a.verticalPlacedIconSymbolIndex&&w);if(a.placedIconSymbolIndex>=0){let o=r?i:ta;f(t.icon,a.numIconVertices,o),t.icon.placedSymbolArray.get(a.placedIconSymbolIndex).hidden=v.icon.isHidden()}
vendor: 13,852 bytes, lines 1-25
1if(a.verticalPlacedIconSymbolIndex>=0){let o=r?ta:i;f(t.icon,a.numVerticalIconVertices,o),t.icon.placedSymbolArray.get(a.verticalPlacedIconSymbolIndex).hidden=v.icon.isHidden()}}let P=g?.has(i)?g.get(i):{text:null,icon:null};if(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData()){let r=t.collisionArrays[i];if(r){let i=new p.Vi(0,0);if(r.textBox||r.verticalTextBox){let a=!0;if(c){let t=this.variableOffsets[l];t?(i=te(t.anchor,t.width,t.height,t.textOffset,t.textBoxScale),u&&i._rotate(d?-this.transform.bearingInRadians:this.transform.bearingInRadians)):a=!1}if(r.textBox||r.verticalTextBox){let o;r.textBox&&(o=w),r.verticalTextBox&&(o=T),ti(t.textCollisionBox.collisionVertexArray,v.text.placed,!a||o,P.text,i.x,i.y)}}if(r.iconBox||r.verticalIconBox){let a=!!(!T&&r.verticalIconBox),o;r.iconBox&&(o=a),r.verticalIconBox&&(o=!a),ti(t.iconCollisionBox.collisionVertexArray,v.icon.placed,o,P.icon,_?i.x:0,_?i.y:0)}}}}if(t.sortFeatures(-this.transform.bearingInRadians),this.retainedQueryData[t.bucketInstanceId]&&(this.retainedQueryData[t.bucketInstanceId].featureSortOrder=t.featureSortOrder),t.hasTextData()&&t.text.opacityVertexBuffer&&t.text.opacityVertexBuffer.updateData(t.text.opacityVertexArray),t.hasIconData()&&t.icon.opacityVertexBuffer&&t.icon.opacityVertexBuffer.updateData(t.icon.opacityVertexArray),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexBuffer&&t.iconCollisionBox.collisionVertexBuffer.updateData(t.iconCollisionBox.collisionVertexArray),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexBuffer&&t.textCollisionBox.collisionVertexBuffer.updateData(t.textCollisionBox.collisionVertexArray),t.text.opacityVertexArray.length!==t.text.layoutVertexArray.length/4)throw Error(`bucket.text.opacityVertexArray.length (= ${t.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${t.text.layoutVertexArray.length}) / 4`);if(t.icon.opacityVertexArray.length!==t.icon.layoutVertexArray.length/4)throw Error(`bucket.icon.opacityVertexArray.length (= ${t.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${t.icon.layoutVertexArray.length}) / 4`);t.bucketInstanceId in this.collisionCircleArrays&&(t.collisionCircleArray=this.collisionCircleArrays[t.bucketInstanceId],delete this.collisionCircleArrays[t.bucketInstanceId])}symbolFadeChange(t){return 0===this.fadeDuration?1:(t-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(t){return Math.max(0,(this.transform.zoom-t)/1.5)}hasTransitions(t){return this.stale||t-this.lastPlacementChangeTime<this.fadeDuration}stillRecent(t,i){let r=this.zoomAtLastRecencyCheck===i?1-this.zoomAdjustment(i):1;return this.zoomAtLastRecencyCheck=i,this.commitTime+this.fadeDuration*r>t}setStale(){this.stale=!0}};function ti(t,i,r,a,o,s){a&&0!==a.length||(a=[0,0,0,0]);let n=a[0]-100,l=a[1]-100,h=a[2]-100,c=a[3]-100;t.emplaceBack(+!!i,+!!r,o||0,s||0,n,l),t.emplaceBack(+!!i,+!!r,o||0,s||0,h,l),t.emplaceBack(+!!i,+!!r,o||0,s||0,h,c),t.emplaceBack(+!!i,+!!r,o||0,s||0,n,c)}function tr(t){if(0===t.opacity&&!t.placed)return 0;if(1===t.opacity&&t.placed)return 0xffffffff;let i=+!!t.placed,r=Math.floor(127*t.opacity);return 0x2000000*r+0x1000000*i+131072*r+65536*i+512*r+256*i+2*r+i}let ta=0;var to=class{constructor(t){this._sortAcrossTiles="viewport-y"!==t.layout.get("symbol-z-order")&&!t.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(t,i,r,a,o){let s=this._bucketParts;for(;this._currentTileIndex<t.length;){let r=t[this._currentTileIndex];if(i.getBucketParts(s,a,r,this._sortAcrossTiles),this._currentTileIndex++,o())return!0}for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,s.sort((t,i)=>t.sortKey-i.sortKey));this._currentPartIndex<s.length;){let t=s[this._currentPartIndex];if(i.placeLayerBucketPart(t,this._seenCrossTileIDs,r),this._currentPartIndex++,o())return!0}return!1}},ts=class{constructor(t,i,r,a,o,s,n,l){this.placement=new tt(t,i,s,n,l),this._currentPlacementIndex=r.length-1,this._forceFullPlacement=a,this._showCollisionBoxes=o,this._done=!1}isDone(){return this._done}continuePlacement(t,i,r){let a=v(),o=()=>!this._forceFullPlacement&&v()-a>2;for(;this._currentPlacementIndex>=0;){let a=i[t[this._currentPlacementIndex]],s=this.placement.collisionIndex.transform.zoom;if((0,p.E)(a)&&a.layout&&(!a.minzoom||a.minzoom<=s)&&(!a.maxzoom||a.maxzoom>s)){if(this._inProgressLayer||=new to(a),this._inProgressLayer.continuePlacement(r[a.source],this.placement,this._showCollisionBoxes,a,o))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(t){return this.placement.commit(t),this.placement}};let tn=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],tl=new Uint32Array(96);var th=class t{static from(i){if(!i||void 0===i.byteLength||i.buffer)throw Error("Data must be an instance of ArrayBuffer or SharedArrayBuffer.");let[r,a]=new Uint8Array(i,0,2);if(219!==r)throw Error("Data does not appear to be in a KDBush format.");let o=a>>4;if(1!==o)throw Error(`Got v${o} data when expected v1.`);let s=tn[15&a];if(!s)throw Error("Unrecognized array type.");let[n]=new Uint16Array(i,2,1),[l]=new Uint32Array(i,4,1);return new t(l,n,s,void 0,i)}constructor(t,i=64,r=Float64Array,a=ArrayBuffer,o){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=tn.indexOf(this.ArrayType),n=2*t*this.ArrayType.BYTES_PER_ELEMENT,l=t*this.IndexArrayType.BYTES_PER_ELEMENT,h=(8-l%8)%8;if(s<0)throw Error(`Unexpected typed array class: ${r}.`);if(o)this.data=o,this.ids=new this.IndexArrayType(o,8,t),this.coords=new r(o,8+l+h,2*t),this._pos=2*t,this._finished=!0;else{let o=this.data=new a(8+n+l+h);this.ids=new this.IndexArrayType(o,8,t),this.coords=new r(o,8+l+h,2*t),this._pos=0,this._finished=!1,new Uint8Array(o,0,2).set([219,16+s]),new Uint16Array(o,2,1)[0]=i,new Uint32Array(o,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 function t(i,r,a,o,s,n){if(s-o<=a)return;let l=o+s>>1;(function t(i,r,a,o,s,n){for(;s>o;){if(s-o>600){let l=s-o+1,h=a-o+1,c=Math.log(l),u=.5*Math.exp(2*c/3),d=.5*Math.sqrt(c*u*(l-u)/l)*(h-l/2<0?-1:1);t(i,r,a,Math.max(o,Math.floor(a-h*u/l+d)),Math.min(s,Math.floor(a+(l-h)*u/l+d)),n)}let l=r[2*a+n],h=o,c=s;for(tc(i,r,o,a),r[2*s+n]>l&&tc(i,r,o,s);h<c;){for(tc(i,r,h,c),h++,c--;r[2*h+n]<l;)h++;for(;r[2*c+n]>l;)c--}r[2*o+n]===l?tc(i,r,o,c):tc(i,r,++c,s),c<=a&&(o=c+1),a<=c&&(s=c-1)}})(i,r,l,o,s,n),t(i,r,a,o,l-1,1-n),t(i,r,a,l+1,s,1-n)}(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:o,coords:s,nodeSize:n}=this;tl[0]=0,tl[1]=o.length-1,tl[2]=0;let l=3,h=[];for(;l>0;){let c=tl[--l],u=tl[--l],d=tl[--l];if(u-d<=n){for(let n=d;n<=u;n++){let l=s[2*n],c=s[2*n+1];l>=t&&l<=r&&c>=i&&c<=a&&h.push(o[n])}continue}let _=d+u>>1,p=s[2*_],m=s[2*_+1];p>=t&&p<=r&&m>=i&&m<=a&&h.push(o[_]),(0===c?t<=p:i<=m)&&(tl[l++]=d,tl[l++]=_-1,tl[l++]=1-c),(0===c?r>=p:a>=m)&&(tl[l++]=_+1,tl[l++]=u,tl[l++]=1-c)}return h}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:o,coords:s,nodeSize:n}=this;tl[0]=0,tl[1]=o.length-1,tl[2]=0;let l=3,h=0,c=r*r;for(;l>0;){let u=tl[--l],d=tl[--l],_=tl[--l];if(d-_<=n){for(let r=_;r<=d;r++)td(s[2*r],s[2*r+1],t,i)<=c&&(a[h++]=o[r]);continue}let p=_+d>>1,m=s[2*p],f=s[2*p+1];td(m,f,t,i)<=c&&(a[h++]=o[p]),(0===u?t-r<=m:i-r<=f)&&(tl[l++]=_,tl[l++]=p-1,tl[l++]=1-u),(0===u?t+r>=m:i+r>=f)&&(tl[l++]=p+1,tl[l++]=d,tl[l++]=1-u)}return h}};function tc(t,i,r,a){tu(t,r,a),tu(i,2*r,2*a),tu(i,2*r+1,2*a+1)}function tu(t,i,r){let a=t[i];t[i]=t[r],t[r]=a}function td(t,i,r,a){let o=t-r,s=i-a;return o*o+s*s}let t_=512/p.Ur/2;var tp=class{constructor(t,i,r){this.tileID=t,this.bucketInstanceId=r,this._symbolsByKey={};let a=new Map;for(let t=0;t<i.length;t++){let r=i.get(t),o=r.key,s=a.get(o);s?s.push(r):a.set(o,[r])}for(let[t,i]of a){let r={positions:i.map(t=>({x:Math.floor(t.anchorX*t_),y:Math.floor(t.anchorY*t_)})),crossTileIDs:i.map(t=>t.crossTileID)};if(r.positions.length>128){let t=new th(r.positions.length,16,Uint16Array);for(let{x:i,y:a}of r.positions)t.add(i,a);t.finish(),delete r.positions,r.index=t}this._symbolsByKey[t]=r}}getScaledCoordinates(t,i){let{x:r,y:a,z:o}=this.tileID.canonical,{x:s,y:n,z:l}=i.canonical,h=t_/2**(l-o),c=(s*p.Ur+t.anchorX)*h,u=(n*p.Ur+t.anchorY)*h;return{x:Math.floor(c-r*p.Ur*t_),y:Math.floor(u-a*p.Ur*t_)}}findMatches(t,i,r){let a=this.tileID.canonical.z<i.canonical.z?1:2**(this.tileID.canonical.z-i.canonical.z);for(let o=0;o<t.length;o++){let s=t.get(o);if(s.crossTileID)continue;let n=this._symbolsByKey[s.key];if(!n)continue;let l=this.getScaledCoordinates(s,i);n.index?this.findMatchesForIndexedEntry(n,s,l,a,r):n.positions&&this.findMatchesForNonIndexedEntry(n,s,l,a,r)}}findMatchesForIndexedEntry(t,i,r,a,o){let s=t.index.range(r.x-a,r.y-a,r.x+a,r.y+a),n=1/0;for(let i of s)i<n&&!o[t.crossTileIDs[i]]&&(n=i);if(n!==1/0){let r=t.crossTileIDs[n];o[r]=!0,i.crossTileID=r}}findMatchesForNonIndexedEntry(t,i,r,a,o){for(let s=0;s<t.positions.length;s++){let n=t.positions[s],l=t.crossTileIDs[s];if(Math.abs(n.x-r.x)<=a&&Math.abs(n.y-r.y)<=a&&!o[l]){o[l]=!0,i.crossTileID=l;break}}}getCrossTileIDsLists(){return Object.values(this._symbolsByKey).map(({crossTileIDs:t})=>t)}},tm=class{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}},tf=class{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(t){let i=Math.round((t-this.lng)/360);if(0!==i)for(let t in this.indexes){let r=this.indexes[t],a={};for(let t in r){let o=r[t];o.tileID=o.tileID.unwrapTo(o.tileID.wrap+i),a[o.tileID.key]=o}this.indexes[t]=a}this.lng=t}addBucket(t,i,r){if(this.indexes[t.overscaledZ]?.[t.key]){if(this.indexes[t.overscaledZ][t.key].bucketInstanceId===i.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(t.overscaledZ,this.indexes[t.overscaledZ][t.key])}for(let t=0;t<i.symbolInstances.length;t++)i.symbolInstances.get(t).crossTileID=0;this.usedCrossTileIDs[t.overscaledZ]||={};let a=this.usedCrossTileIDs[t.overscaledZ];for(let r in this.indexes){let o=this.indexes[r];if(Number(r)>t.overscaledZ)for(let r in o){let s=o[r];s.tileID.isChildOf(t)&&s.findMatches(i.symbolInstances,t,a)}else{let s=o[t.scaledTo(Number(r)).key];s&&s.findMatches(i.symbolInstances,t,a)}}for(let t=0;t<i.symbolInstances.length;t++){let o=i.symbolInstances.get(t);o.crossTileID||(o.crossTileID=r.generate(),a[o.crossTileID]=!0)}return void 0===this.indexes[t.overscaledZ]&&(this.indexes[t.overscaledZ]={}),this.indexes[t.overscaledZ][t.key]=new tp(t,i.symbolInstances,i.bucketInstanceId),!0}removeBucketCrossTileIDs(t,i){for(let r of i.getCrossTileIDsLists())for(let i of r)delete this.usedCrossTileIDs[t][i]}removeStaleBuckets(t){let i=!1;for(let r in this.indexes){let a=this.indexes[r];for(let o in a)t[a[o].bucketInstanceId]||(this.removeBucketCrossTileIDs(r,a[o]),delete a[o],i=!0)}return i}},tg=class{constructor(){this.layerIndexes={},this.crossTileIDs=new tm,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(t,i,r){let a=this.layerIndexes[t.id];void 0===a&&(a=this.layerIndexes[t.id]=new tf);let o=!1,s={};for(let n of(a.handleWrapJump(r),i)){let i=n.getBucket(t);t.id===i?.layerIds[0]&&(i.bucketInstanceId||=(this.maxBucketInstanceId+=1,this.maxBucketInstanceId),a.addBucket(n.tileID,i,this.crossTileIDs)&&(o=!0),s[i.bucketInstanceId]=!0)}return a.removeStaleBuckets(s)&&(o=!0),o}pruneUnusedLayers(t){let i={};for(let r of t)i[r]=!0;for(let t in this.layerIndexes)i[t]||delete this.layerIndexes[t]}},tv=`uniform vec4 u_color;uniform float u_opacity;void main() {fragColor=u_color*u_opacity;
2#ifdef OVERDRAW_INSPECTOR
3fragColor=vec4(1.0);
4#endif
5}`,ty=`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;
6#ifdef OVERDRAW_INSPECTOR
7fragColor=vec4(1.0);
8#endif
9}`,tx=`in vec3 v_data;flat in float v_visibility;
10#pragma maplibre: define highp vec4 color
11#pragma maplibre: define mediump float radius
12#pragma maplibre: define lowp float blur
13#pragma maplibre: define lowp float opacity
14#pragma maplibre: define highp vec4 stroke_color
15#pragma maplibre: define mediump float stroke_width
16#pragma maplibre: define lowp float stroke_opacity
17void main() {
18#pragma maplibre: initialize highp vec4 color
19#pragma maplibre: initialize mediump float radius
20#pragma maplibre: initialize lowp float blur
21#pragma maplibre: initialize lowp float opacity
22#pragma maplibre: initialize highp vec4 stroke_color
23#pragma maplibre: initialize mediump float stroke_width
24#pragma maplibre: initialize lowp float stroke_opacity
25vec2 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
25/(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;}
26#ifdef OVERDRAW_INSPECTOR
27fragColor=vec4(1.0);
28#endif
29}`,tb=`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 lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;uniform vec2 u_translate;layout(location=0) in ivec2 a_pos;out vec3 v_data;flat out float v_visibility;
30#pragma maplibre: define highp vec4 color
31#pragma maplibre: define mediump float radius
32#pragma maplibre: define lowp float blur
33#pragma maplibre: define lowp float opacity
34#pragma maplibre: define highp vec4 stroke_color
35#pragma maplibre: define mediump float stroke_width
36#pragma maplibre: define lowp float stroke_opacity
37void main(void) {
38#pragma maplibre: initialize highp vec4 color
39#pragma maplibre: initialize mediump float radius
40#pragma maplibre: initialize lowp float blur
41#pragma maplibre: initialize lowp float opacity
42#pragma maplibre: initialize highp vec4 stroke_color
43#pragma maplibre: initialize mediump float stroke_width
44#pragma maplibre: initialize lowp float stroke_opacity
45ivec2 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) {
46#ifdef GLOBE
47vec3 center_vector=projectToSphere(circle_center);
48#endif
49float 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 {
50#ifdef GLOBE
51vec4 projected_center=interpolateProjection(circle_center,center_vector,ele);
52#else
53vec4 projected_center=projectTileWithElevation(circle_center,ele);
54#endif
55corner_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);}
56#ifdef GLOBE
57vec2 angles=extrude*angle_scale;vec3 corner_vector=globeRotateVector(center_vector,angles);gl_Position=interpolateProjection(corner_position,corner_vector,ele);
58#else
59gl_Position=projectTileWithElevation(corner_position,ele);
60#endif
61} 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);}`,tw="void main() {fragColor=vec4(1.0);}";let tT={prelude:tP(`#ifdef GL_ES
62precision mediump float;
63#else
64#if !defined(lowp)
65#define lowp
66#endif
67#if !defined(mediump)
68#define mediump
69#endif
70#if !defined(highp)
71#define highp
72#endif
73#endif
74out highp vec4 fragColor;`,`#ifdef GL_ES
75precision highp float;
76#else
77#if !defined(lowp)
78#define lowp
79#endif
80#if !defined(mediump)
81#define mediump
82#endif
83#if !defined(highp)
84#define highp
85#endif
86#endif
87vec2 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
88);}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);
88return (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
89);}
90#ifdef TERRAIN3D
91uniform sampler2D u_terrain;uniform float u_terrain_dim;uniform mat4 u_terrain_matrix;uniform vec4 u_terrain_unpack;uniform float u_terrain_exaggeration;uniform highp sampler2D u_depth;
92#endif
93const 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) {
94#ifdef TERRAIN3D
95highp 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));
96#else
97return 1.0;
98#endif
99}float calculate_visibility(vec4 pos) {
100#ifdef TERRAIN3D
101vec3 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;
102#else
103return 1.0;
104#endif
105}float ele(ivec2 pos) {
106#ifdef TERRAIN3D
107vec4 rgb=(texelFetch(u_terrain,pos,0)*255.0)*u_terrain_unpack;return rgb.r+rgb.g+rgb.b-u_terrain_unpack.a;
108#else
109return 0.0;
110#endif
111}float get_elevation(vec2 pos) {
112#ifdef TERRAIN3D
113#ifdef GLOBE
114if ((pos.y <-32767.5) || (pos.y > 32766.5)) {return 0.0;}
115#endif
116vec2 coord=(u_terrain_matrix*vec4(pos,0.0,1.0)).xy*u_terrain_dim+1.0;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;
117#else
118return 0.0;
119#endif
120}const float PI=3.141592653589793;uniform mat4 u_projection_matrix;`),projectionMercator:tP(`
121void 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:tP("uniform bool u_projection_clip_antimeridian;in highp float v_projection_tile_x;void clipAntimeridian() {if (u_projection_clip_antimeridian && (v_projection_tile_x < 0.0 || v_projection_tile_x >=8192.0)) {discard;}}",`#define GLOBE_RADIUS 6371008.8
122uniform 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;out 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
123);}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));
123float 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
124);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:tP(tv,"layout(location=0) in vec2 a_pos;void main() {gl_Position=projectTile(a_pos);}"),backgroundPattern:tP(ty,"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);}"),circle:tP(tx,tb),clippingMask:tP(tw,"layout(location=0) in vec2 a_pos;void main() {gl_Position=projectTile(a_pos);}"),heatmap:tP(`uniform highp float u_intensity;in vec2 v_extrude;
125#pragma maplibre: define highp float weight
126#define GAUSS_COEF 0.3989422804014327
127void main() {
128#pragma maplibre: initialize highp float weight
129float 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);
130#ifdef OVERDRAW_INSPECTOR
131fragColor=vec4(1.0);
132#endif
133}`,`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;
134#pragma maplibre: define highp float weight
135#pragma maplibre: define mediump float radius
136const highp float ZERO=1.0/255.0/16.0;
137#define GAUSS_COEF 0.3989422804014327
138void main(void) {
139#pragma maplibre: initialize highp float weight
140#pragma maplibre: initialize mediump float radius
141ivec2 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);
142#ifdef GLOBE
143vec2 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);
144#else
145gl_Position=projectTileFor3D(circle_center+extrude,get_elevation(circle_center));
146#endif
147}`),heatmapTexture:tP(`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;
148#ifdef OVERDRAW_INSPECTOR
149fragColor=vec4(0.0);
150#endif
151}`,"uniform mat4 u_matrix;uniform vec2 u_world;layout(location=0) in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos*u_world,0,1);v_pos.x=a_pos.x;v_pos.y=1.0-a_pos.y;}"),collisionBox:tP("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;uniform vec2 u_pixel_extrude_scale;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:tP("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;uniform vec2 u_viewport_size;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:tP(`#ifdef GL_ES
152precision highp float;
153#endif
154uniform 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
155{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));
156#ifdef OVERDRAW_INSPECTOR
157fragColor=vec4(1.0);
158#endif
159}`,"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=1.0/u_dimension;float scale=(u_dimension.x-2.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:tP("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:tP(tw,`layout(location=0) in vec2 a_pos;void main() {
160#ifdef GLOBE
161gl_Position=projectTileFor3D(a_pos,0.0);
162#else
163gl_Position=u_projection_matrix*vec4(a_pos,0.0,1.0);
164#endif
165}`),fill:tP(`#pragma maplibre: define highp vec4 color
166#pragma maplibre: define lowp float opacity
167void main() {
168#pragma maplibre: initialize highp vec4 color
169#pragma maplibre: initialize lowp float opacity
170fragColor=color*opacity;
171#ifdef OVERDRAW_INSPECTOR
172fragColor=vec4(1.0);
173#endif
174}`,`uniform vec2 u_fill_translate;layout(location=0) in vec2 a_pos;
175#pragma maplibre: define highp vec4 color
176#pragma maplibre: define lowp float opacity
177void main() {
178#pragma maplibre: initialize highp vec4 color
179#pragma maplibre: initialize lowp float opacity
180if (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:tP(`in vec2 v_pos;
181#ifdef GLOBE
182in float v_depth;
183#endif
184#pragma maplibre: define highp vec4 outline_color
185#pragma maplibre: define lowp float opacity
186void main() {
187#pragma maplibre: initialize highp vec4 outline_color
188#pragma maplibre: initialize lowp float opacity
189float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);fragColor=outline_color*(alpha*opacity);
190#ifdef GLOBE
191if (v_depth > 1.0) {discard;}
192#endif
193#ifdef OVERDRAW_INSPECTOR
194fragColor=vec4(1.0);
195#endif
196}`,`uniform vec2 u_world;uniform vec2 u_fill_translate;layout(location=0) in vec2 a_pos;out vec2 v_pos;
197#ifdef GLOBE
198out float v_depth;
199#endif
200#pragma maplibre: define highp vec4 outline_color
201#pragma maplibre: define lowp float opacity
202void main() {
203#pragma maplibre: initialize highp vec4 outline_color
204#pragma maplibre: initialize lowp float opacity
205if (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;
206#ifdef GLOBE
207v_depth=gl_Position.z/gl_Position.w;
208#endif
209}`),fillOutlinePattern:tP(`uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_fade;in vec2 v_pos_a;in vec2 v_pos_b;in vec2 v_pos;
210#ifdef GLOBE
211in float v_depth;
212#endif
213#pragma maplibre: define lowp float opacity
214#pragma maplibre: define lowp vec4 pattern_from
215#pragma maplibre: define lowp vec4 pattern_to
216void main() {
217#pragma maplibre: initialize lowp float opacity
218#pragma maplibre: initialize mediump vec4 pattern_from
219#pragma maplibre: initialize mediump vec4 pattern_to
220vec2 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);fragColor=mix(color1,color2,u_fade)*alpha*opacity;
221#ifdef GLOBE
222if (v_depth > 1.0) {discard;}
223#endif
224#ifdef OVERDRAW_INSPECTOR
225fragColor=vec4(1.0);
226#endif
227}`,`uniform vec2 u_world;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;
228#ifdef GLOBE
229out float v_depth;
230#endif
231#pragma maplibre: define lowp float opacity
232#pragma maplibre: define lowp vec4 pattern_from
233#pragma maplibre: define lowp vec4 pattern_to
234#pragma maplibre: define lowp float pixel_ratio_from
235#pragma maplibre: define lowp float pixel_ratio_to
236void main() {
237#pragma maplibre: initialize lowp float opacity
238#pragma maplibre: initialize mediump vec4 pattern_from
239#pragma maplibre: initialize mediump vec4 pattern_to
240#pragma maplibre: initialize lowp float pixel_ratio_from
241#pragma maplibre: initialize lowp float pixel_ratio_to
242if (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;
243#ifdef GLOBE
244v_depth=gl_Position.z/gl_Position.w;
245#endif
246}`),fillPattern:tP(`#ifdef GL_ES
247precision highp float;
248#endif
249uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b;
250#pragma maplibre: define lowp float opacity
251#pragma maplibre: define lowp vec4 pattern_from
252#pragma maplibre: define lowp vec4 pattern_to
253void main() {
254#pragma maplibre: initialize lowp float opacity
255#pragma maplibre: initialize mediump vec4 pattern_from
256#pragma maplibre: initialize mediump vec4 pattern_to
257vec2 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);fragColor=mix(color1,color2,u_fade)*opacity;
258#ifdef OVERDRAW_INSPECTOR
259fragColor=vec4(1.0);
260#endif
261}`,`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;
262#pragma maplibre: define lowp float opacity
263#pragma maplibre: define lowp vec4 pattern_from
264#pragma maplibre: define lowp vec4 pattern_to
265#pragma maplibre: define lowp float pixel_ratio_from
266#pragma maplibre: define lowp float pixel_ratio_to
267void main() {
268#pragma maplibre: initialize lowp float opacity
269#pragma maplibre: initialize mediump vec4 pattern_from
270#pragma maplibre: initialize mediump vec4 pattern_to
271#pragma maplibre: initialize lowp float pixel_ratio_from
272#pragma maplibre: initialize lowp float pixel_ratio_to
273if (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:tP(`in vec4 v_color;void main() {fragColor=v_color;
274#ifdef OVERDRAW_INSPECTOR
275fragColor=vec4(1.0);
276#endif
277}`,`uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp vec3 u_lightpos_globe;uniform lowp 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;
278#ifdef TERRAIN3D
279layout(location=2) in vec2 a_centroid;
280#endif
281out vec4 v_color;
282#pragma maplibre: define highp float base
283#pragma maplibre: define highp float height
284#pragma maplibre: define highp vec4 color
285void main() {
286#pragma maplibre: initialize highp float base
287#pragma maplibre: initialize highp float height
288#pragma maplibre: initialize highp vec4 color
289vec3 normal=vec3(a_normal_ed.xyz);
290#ifdef TERRAIN3D
291float height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);
292#else
293float height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;
294#endif
295base=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;
296#ifdef GLOBE
297vec3 spherePos=projectToSphere(posInTile,a_pos);gl_Position=interpolateProjectionFor3D(posInTile,spherePos,elevation);
298#else
299gl_Position=u_projection_matrix*vec4(posInTile,elevation,1.0);
300#endif
301float 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);
302#ifdef GLOBE
303mat3 rotMatrix=globeGetRotationMatrix(spherePos);normalForLighting=rotMatrix*normalForLighting;directional=mix(directional,clamp(dot(normalForLighting,u_lightpos_globe),0.0,1.0),u_projection_transition);
304#endif
305directional=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+base)*pow(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:tP(`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;
306#pragma maplibre: define lowp float base
307#pragma maplibre: define lowp float height
308#pragma maplibre: define lowp vec4 pattern_from
309#pragma maplibre: define lowp vec4 pattern_to
310#pragma maplibre: define lowp float pixel_ratio_from
311#pragma maplibre: define lowp float pixel_ratio_to
312void main() {
313#pragma maplibre: initialize lowp float base
314#pragma maplibre: initialize lowp float height
315#pragma maplibre: initialize mediump vec4 pattern_from
316#pragma maplibre: initialize mediump vec4 pattern_to
317#pragma maplibre: initialize lowp float pixel_ratio_from
318#pragma maplibre: initialize lowp float pixel_ratio_to
319vec2 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;
320#ifdef OVERDRAW_INSPECTOR
321fragColor=vec4(1.0);
322#endif
323}`,`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;
324#ifdef TERRAIN3D
325layout(location=2) in vec2 a_centroid;
326#endif
327#ifdef GLOBE
328out vec3 v_sphere_pos;
329#endif
330out vec2 v_pos_a;out vec2 v_pos_b;out vec4 v_lighting;
331#pragma maplibre: define lowp float base
332#pragma maplibre: define lowp float height
333#pragma maplibre: define lowp vec4 pattern_from
334#pragma maplibre: define lowp vec4 pattern_to
335#pragma maplibre: define lowp float pixel_ratio_from
336#pragma maplibre: define lowp float pixel_ratio_to
337void main() {
338#pragma maplibre: initialize lowp float base
339#pragma maplibre: initialize lowp float height
340#pragma maplibre: initialize mediump vec4 pattern_from
341#pragma maplibre: initialize mediump vec4 pattern_to
342#pragma maplibre: initialize lowp float pixel_ratio_from
343#pragma maplibre: initialize lowp float pixel_ratio_to
344vec2 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;
345#ifdef TERRAIN3D
346float height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);
347#else
348float height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;
349#endif
350base=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;
351#ifdef GLOBE
352vec3 spherePos=projectToSphere(posInTile,a_pos);vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);v_sphere_pos=elevatedPos;gl_Position=interpolateProjectionFor3D(posInTile,spherePos,elevation);
353#else
354gl_Position=u_projection_matrix*vec4(posInTile,elevation,1.0);
355#endif
356vec2 pos=a_normal_ed.x==1 && a_normal_ed.y==0 && a_normal_ed.z==16384
357? a_pos
358: 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+base)*pow(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:tP(`#ifdef GL_ES
359precision highp float;
360#endif
361uniform 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-2.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
361ow(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);
362#ifdef OVERDRAW_INSPECTOR
363fragColor=vec4(1.0);
364#endif
365}`,"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:tP(`uniform sampler2D u_image;in 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];
366#define PI 3.141592653589793
367#define STANDARD 0
368#define COMBINED 1
369#define IGOR 2
370#define MULTIDIRECTIONAL 3
371#define BASIC 4
372float 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
373{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
374{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() {vec4 pixel=texture(u_image,v_pos);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);}
375#ifdef OVERDRAW_INSPECTOR
376fragColor=vec4(1.0);
377#endif
378}`,"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:tP(`uniform lowp float u_device_pixel_ratio;flat in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale;
379#ifdef GLOBE
380in float v_depth;
381#endif
382#pragma maplibre: define highp vec4 color
383#pragma maplibre: define lowp float blur
384#pragma maplibre: define lowp float opacity
385void main() {
386#pragma maplibre: initialize highp vec4 color
387#pragma maplibre: initialize lowp float blur
388#pragma maplibre: initialize lowp float opacity
389clipAntimeridian();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);
390#ifdef GLOBE
391if (v_depth > 1.0) {discard;}
392#endif
393#ifdef OVERDRAW_INSPECTOR
394fragColor=vec4(1.0);
395#endif
396}`,`
397#define scale 0.015873016
398layout(location=0) in ivec2 a_pos_normal;layout(location=1) in uvec4 a_data;uniform vec2 u_translation;uniform mediump float u_ratio;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;out vec2 v_normal;flat out vec2 v_width2;out float v_gamma_scale;out highp float v_linesofar;
399#ifdef GLOBE
400out 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
405#pragma maplibre: define mediump float gapwidth
406#pragma maplibre: define lowp float offset
407#pragma maplibre: define mediump float width
408void main() {
409#pragma maplibre: initialize highp vec4 color
410#pragma maplibre: initialize lowp float blur
411#pragma maplibre: initialize lowp float opacity
412#pragma maplibre: initialize mediump float gapwidth
413#pragma maplibre: initialize lowp float offset
414#pragma maplibre: initialize mediump float width
415if (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);
415float 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;
416#ifdef GLOBE
417v_depth=gl_Position.z/gl_Position.w;
418#endif
419#ifdef TERRAIN3D
420v_gamma_scale=1.0;
421#else
422float 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;
423#endif
424v_width2=vec2(outset,inset);}`),lineGradient:tP(`uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;flat in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale;in highp vec2 v_uv;
425#ifdef GLOBE
426in float v_depth;
427#endif
428#pragma maplibre: define lowp float blur
429#pragma maplibre: define lowp float opacity
430void main() {
431#pragma maplibre: initialize lowp float blur
432#pragma maplibre: initialize lowp float opacity
433clipAntimeridian();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);
434#ifdef GLOBE
435if (v_depth > 1.0) {discard;}
436#endif
437#ifdef OVERDRAW_INSPECTOR
438fragColor=vec4(1.0);
439#endif
440}`,`
441#define scale 0.015873016
442layout(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 lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_image_height;out vec2 v_normal;flat out vec2 v_width2;out float v_gamma_scale;out highp vec2 v_uv;
443#ifdef GLOBE
444out float v_depth;
445#endif
446#pragma maplibre: define lowp float blur
447#pragma maplibre: define lowp float opacity
448#pragma maplibre: define mediump float gapwidth
449#pragma maplibre: define lowp float offset
450#pragma maplibre: define mediump float width
451void main() {
452#pragma maplibre: initialize lowp float blur
453#pragma maplibre: initialize lowp float opacity
454#pragma maplibre: initialize mediump float gapwidth
455#pragma maplibre: initialize lowp float offset
456#pragma maplibre: initialize mediump float width
457if (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;
458#ifdef GLOBE
459v_depth=gl_Position.z/gl_Position.w;
460#endif
461#ifdef TERRAIN3D
462v_gamma_scale=1.0;
463#else
464float 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;
465#endif
466v_width2=vec2(outset,inset);}`),linePattern:tP(`#ifdef GL_ES
467precision highp float;
468#endif
469uniform lowp float u_device_pixel_ratio;uniform 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;
470#ifdef GLOBE
471in float v_depth;
472#endif
473#pragma maplibre: define lowp vec4 pattern_from
474#pragma maplibre: define lowp vec4 pattern_to
475#pragma maplibre: define lowp float pixel_ratio_from
476#pragma maplibre: define lowp float pixel_ratio_to
477#pragma maplibre: define lowp float blur
478#pragma maplibre: define lowp float opacity
479void main() {
480#pragma maplibre: initialize mediump vec4 pattern_from
481#pragma maplibre: initialize mediump vec4 pattern_to
482#pragma maplibre: initialize lowp float pixel_ratio_from
483#pragma maplibre: initialize lowp float pixel_ratio_to
484#pragma maplibre: initialize lowp float blur
485#pragma maplibre: initialize lowp float opacity
486clipAntimeridian();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;
487#ifdef GLOBE
488if (v_depth > 1.0) {discard;}
489#endif
490#ifdef OVERDRAW_INSPECTOR
491fragColor=vec4(1.0);
492#endif
493}`,`
494#define scale 0.015873016
495#define LINE_DISTANCE_SCALE 2.0
496layout(location=0) in ivec2 a_pos_normal;layout(location=1) in uvec4 a_data;uniform vec2 u_translation;uniform vec2 u_units_to_pixels;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;out vec2 v_normal;flat out vec2 v_width2;out float v_linesofar;out float v_gamma_scale;flat out float v_width;
497#ifdef GLOBE
498out float v_depth;
499#endif
500#pragma maplibre: define lowp float blur
501#pragma maplibre: define lowp float opacity
502#pragma maplibre: define lowp float offset
503#pragma maplibre: define mediump float gapwidth
504#pragma maplibre: define mediump float width
505#pragma maplibre: define lowp float floorwidth
506#pragma maplibre: define lowp vec4 pattern_from
507#pragma maplibre: define lowp vec4 pattern_to
508#pragma maplibre: define lowp float pixel_ratio_from
509#pragma maplibre: define lowp float pixel_ratio_to
510void main() {
511#pragma maplibre: initialize lowp float blur
512#pragma maplibre: initialize lowp float opacity
513#pragma maplibre: initialize lowp float offset
514#pragma maplibre: initialize mediump float gapwidth
515#pragma maplibre: initialize mediump float width
516#pragma maplibre: initialize lowp float floorwidth
517#pragma maplibre: initialize mediump vec4 pattern_from
518#pragma maplibre: initialize mediump vec4 pattern_to
519#pragma maplibre: initialize lowp float pixel_ratio_from
520#pragma maplibre: initialize lowp float pixel_ratio_to
521if (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);
521float 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;
522#ifdef GLOBE
523v_depth=gl_Position.z/gl_Position.w;
524#endif
525#ifdef TERRAIN3D
526v_gamma_scale=1.0;
527#else
528float 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;
529#endif
530v_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}`),lineSDF:tP(`uniform lowp float u_device_pixel_ratio;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;
531#ifdef GLOBE
532in float v_depth;
533#endif
534#pragma maplibre: define highp vec4 color
535#pragma maplibre: define lowp float blur
536#pragma maplibre: define lowp float opacity
537#pragma maplibre: define mediump float width
538#pragma maplibre: define lowp float floorwidth
539#pragma maplibre: define mediump vec4 dasharray_from
540#pragma maplibre: define mediump vec4 dasharray_to
541void main() {
542#pragma maplibre: initialize highp vec4 color
543#pragma maplibre: initialize lowp float blur
544#pragma maplibre: initialize lowp float opacity
545#pragma maplibre: initialize mediump float width
546#pragma maplibre: initialize lowp float floorwidth
547#pragma maplibre: initialize mediump vec4 dasharray_from
548#pragma maplibre: initialize mediump vec4 dasharray_to
549clipAntimeridian();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);
549float 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);
550#ifdef GLOBE
551if (v_depth > 1.0) {discard;}
552#endif
553#ifdef OVERDRAW_INSPECTOR
554fragColor=vec4(1.0);
555#endif
556}`,`
557#define scale 0.015873016
558#define LINE_DISTANCE_SCALE 2.0
559layout(location=0) in ivec2 a_pos_normal;layout(location=1) in uvec4 a_data;uniform vec2 u_translation;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;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;
560#ifdef GLOBE
561out float v_depth;
562#endif
563#pragma maplibre: define highp vec4 color
564#pragma maplibre: define lowp float blur
565#pragma maplibre: define lowp float opacity
566#pragma maplibre: define mediump float gapwidth
567#pragma maplibre: define lowp float offset
568#pragma maplibre: define mediump float width
569#pragma maplibre: define lowp float floorwidth
570#pragma maplibre: define mediump vec4 dasharray_from
571#pragma maplibre: define mediump vec4 dasharray_to
572void main() {
573#pragma maplibre: initialize highp vec4 color
574#pragma maplibre: initialize lowp float blur
575#pragma maplibre: initialize lowp float opacity
576#pragma maplibre: initialize mediump float gapwidth
577#pragma maplibre: initialize lowp float offset
578#pragma maplibre: initialize mediump float width
579#pragma maplibre: initialize lowp float floorwidth
580#pragma maplibre: initialize mediump vec4 dasharray_from
581#pragma maplibre: initialize mediump vec4 dasharray_to
582if (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;
583#ifdef GLOBE
584v_depth=gl_Position.z/gl_Position.w;
585#endif
586#ifdef TERRAIN3D
587v_gamma_scale=1.0;
588#else
589float 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;
590#endif
591float 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:tP(`uniform lowp float u_device_pixel_ratio;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;
592#ifdef GLOBE
593in float v_depth;
594#endif
595#pragma maplibre: define lowp float blur
596#pragma maplibre: define lowp float opacity
597#pragma maplibre: define mediump float width
598#pragma maplibre: define lowp float floorwidth
599#pragma maplibre: define mediump vec4 dasharray_from
600#pragma maplibre: define mediump vec4 dasharray_to
601void main() {
602#pragma maplibre: initialize lowp float blur
603#pragma maplibre: initialize lowp float opacity
604#pragma maplibre: initialize mediump float width
605#pragma maplibre: initialize lowp float floorwidth
606#pragma maplibre: initialize mediump vec4 dasharray_from
607#pragma maplibre: initialize mediump vec4 dasharray_to
608clipAntimeridian();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);
608float 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);
609#ifdef GLOBE
610if (v_depth > 1.0) {discard;}
611#endif
612#ifdef OVERDRAW_INSPECTOR
613fragColor=vec4(1.0);
614#endif
615}`,`
616#define scale 0.015873016
617#define LINE_DISTANCE_SCALE 2.0
618layout(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 lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;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;
619#ifdef GLOBE
620out float v_depth;
621#endif
622#pragma maplibre: define lowp float blur
623#pragma maplibre: define lowp float opacity
624#pragma maplibre: define mediump float gapwidth
625#pragma maplibre: define lowp float offset
626#pragma maplibre: define mediump float width
627#pragma maplibre: define lowp float floorwidth
628#pragma maplibre: define mediump vec4 dasharray_from
629#pragma maplibre: define mediump vec4 dasharray_to
630void main() {
631#pragma maplibre: initialize lowp float blur
632#pragma maplibre: initialize lowp float opacity
633#pragma maplibre: initialize mediump float gapwidth
634#pragma maplibre: initialize lowp float offset
635#pragma maplibre: initialize mediump float width
636#pragma maplibre: initialize lowp float floorwidth
637#pragma maplibre: initialize mediump vec4 dasharray_from
638#pragma maplibre: initialize mediump vec4 dasharray_to
639if (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;
640#ifdef GLOBE
641v_depth=gl_Position.z/gl_Position.w;
642#endif
643#ifdef TERRAIN3D
644v_gamma_scale=1.0;
645#else
646float 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;
647#endif
648float 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:tP(`uniform sampler2D u_image;uniform float u_opacity;in vec2 v_pos;void main() {fragColor=texture(u_image,v_pos)*u_opacity;
649#ifdef OVERDRAW_INSPECTOR
650fragColor=vec4(0.0);
651#endif
652}`,"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:tP(`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);
653#ifdef OVERDRAW_INSPECTOR
654fragColor=vec4(1.0);
655#endif
656}`,`uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_buffer_scale;uniform vec3 u_perspective_transform;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 position=mix(mix(u_coords_top.xy,u_coords_top.zw,fractionalPos.x),mix(u_coords_bottom.xy,u_coords_bottom.zw,fractionalPos.x),fractionalPos.y);gl_Position=projectTile(position,position);vec2 texturePos=((fractionalPos-0.5)/u_buffer_scale)+0.5;
657#ifdef GLOBE
658if (a_pos.y <-32767.5) {texturePos.y=0.0;}if (a_pos.y > 32766.5) {texturePos.y=1.0;}
659#endif
660float perspectiveRatio=dot(u_perspective_transform,vec3(position,1.0));v_pos0=vec3(texturePos*perspectiveRatio,perspectiveRatio);vec2 parentPos=(texturePos*u_scale_parent)+u_tl_parent;v_pos1=vec3(parentPos*perspectiveRatio,perspectiveRatio);}`),symbolIcon:tP(`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;
661#ifdef OVERDRAW_INSPECTOR
662fragColor=vec4(1.0);
663#endif
664}`,`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;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 highp float u_camera_to_center_distance;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform float u_fade_change;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;out vec2 v_tex;flat out float v_total_opacity;
665#pragma maplibre: define lowp float opacity
666void main() {
667#pragma maplibre: initialize lowp float opacity
668vec2 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=get_elevation(a_pos);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_fade_change :-u_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 ?
669camera_to_anchor_distance/u_camera_to_center_distance :
670u_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;
671#ifdef GLOBE
672if(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);}
673#endif
674vec4 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:tP(`#define SDF_PX 8.0
675uniform bool u_is_halo;uniform bool u_is_plain;uniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;in vec2 v_data0;in vec3 v_data1;
676#pragma maplibre: define highp vec4 fill_color
677#pragma maplibre: define highp vec4 halo_color
678#pragma maplibre: define lowp float halo_width
679#pragma maplibre: define lowp float halo_blur
680void main() {
681#pragma maplibre: initialize highp vec4 fill_color
682#pragma maplibre: initialize highp vec4 halo_color
683#pragma maplibre: initialize lowp float halo_width
684#pragma maplibre: initialize lowp float halo_blur
685float 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;}
686#ifdef OVERDRAW_INSPECTOR
687fragColor=vec4(1.0);
688#endif
689}`,`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;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 highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_translation;uniform float u_pitched_scale;uniform bool u_is_offset;out vec2 v_data0;out vec3 v_data1;
690#pragma maplibre: define highp vec4 fill_color
691#pragma maplibre: define highp vec4 halo_color
692#pragma maplibre: define lowp float opacity
693#pragma maplibre: define lowp float halo_width
694#pragma maplibre: define lowp float halo_blur
695void main() {
696#pragma maplibre: initialize highp vec4 fill_color
697#pragma maplibre: initialize highp vec4 halo_color
698#pragma maplibre: initialize lowp float opacity
699#pragma maplibre: initialize lowp float halo_width
700#pragma maplibre: initialize lowp float halo_blur
701vec2 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=get_elevation(a_pos);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_fade_change :-u_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 ?
702camera_to_anchor_distance/u_camera_to_center_distance :
703u_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;
704#ifdef GLOBE
705if(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);}
706#endif
707vec4 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
707_data1=vec3(gamma_scale,size,total_opacity);}`),symbolTextAndIcon:tP(`#define SDF_PX 8.0
708#define SDF 1.0
709#define ICON 0.0
710uniform bool u_is_halo;uniform bool u_is_text;uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;in vec4 v_data0;in vec3 v_data1;flat in float v_is_sdf;
711#pragma maplibre: define highp vec4 fill_color
712#pragma maplibre: define highp vec4 halo_color
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 halo_width
719#pragma maplibre: initialize lowp float halo_blur
720float total_opacity=v_data1[2];if (v_is_sdf==ICON) {vec2 tex_icon=v_data0.zw;fragColor=texture(u_texture_icon,tex_icon)*total_opacity;
721#ifdef OVERDRAW_INSPECTOR
722fragColor=vec4(1.0);
723#endif
724return;}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;}
725#ifdef OVERDRAW_INSPECTOR
726fragColor=vec4(1.0);
727#endif
728}`,`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;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 highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform 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;out vec4 v_data0;out vec3 v_data1;flat out float v_is_sdf;
729#pragma maplibre: define highp vec4 fill_color
730#pragma maplibre: define highp vec4 halo_color
731#pragma maplibre: define lowp float opacity
732#pragma maplibre: define lowp float halo_width
733#pragma maplibre: define lowp float halo_blur
734void main() {
735#pragma maplibre: initialize highp vec4 fill_color
736#pragma maplibre: initialize highp vec4 halo_color
737#pragma maplibre: initialize lowp float opacity
738#pragma maplibre: initialize lowp float halo_width
739#pragma maplibre: initialize lowp float halo_blur
740vec2 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=get_elevation(a_pos);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_fade_change :-u_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 ?
741camera_to_anchor_distance/u_camera_to_center_distance :
742u_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;
743#ifdef GLOBE
744if(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);}
745#endif
746vec4 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:tP("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);
746float 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:tP("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;}"),terrainCoords:tP("precision mediump float;uniform sampler2D u_texture;uniform float u_terrain_coords_id;in vec2 v_texture_pos;void main() {vec4 rgba=texture(u_texture,v_texture_pos);fragColor=vec4(rgba.r,rgba.g,rgba.b,u_terrain_coords_id);}","layout(location=0) in vec3 a_pos3d;uniform float u_ele_delta;out vec2 v_texture_pos;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);}"),atmosphere:tP(`#ifdef GL_ES
747precision highp float;
748#endif
749in 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
750);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:tP("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;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;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(fragColor,vec4(vec3(0.0),0.0),u_sky_blend);}","layout(location=0) in vec2 a_pos;void main() {gl_Position=vec4(a_pos,1.0,1.0);}")};
750function tP(t,i){let r=/#pragma maplibre: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,a=i.match(/in ([\w]+) ([\w]+)/g),o=t.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),s=i.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),n=s?s.concat(o):o,l=a?a.length:0,h={};return{fragmentSource:t=t.replace(r,(t,i,r,a,o)=>(h[o]=!0,"define"===i?`
751#ifndef HAS_UNIFORM_u_${o}
752in ${r} ${a} ${o};
753#else
754uniform ${r} ${a} u_${o};
755#endif
756`:`
757#ifdef HAS_UNIFORM_u_${o}
758    ${r} ${a} ${o} = u_${o};
759#endif
760`)),vertexSource:i=i.replace(r,(t,i,r,a,o)=>{let s="float"===a?"vec2":"vec4",n=o.match(/color/)?"color":s;return h[o]?"define"===i?`
761#ifndef HAS_UNIFORM_u_${o}
762uniform lowp float u_${o}_t;
763layout(location = ${l++}) in ${r} ${s} a_${o};
764out ${r} ${a} ${o};
765#else
766uniform ${r} ${a} u_${o};
767#endif
768`:"vec4"===n?`
769#ifndef HAS_UNIFORM_u_${o}
770    ${o} = a_${o};
771#else
772    ${r} ${a} ${o} = u_${o};
773#endif
774`:`
775#ifndef HAS_UNIFORM_u_${o}
776    ${o} = unpack_mix_${n}(a_${o}, u_${o}_t);
777#else
778    ${r} ${a} ${o} = u_${o};
779#endif
780`:"define"===i?`
781#ifndef HAS_UNIFORM_u_${o}
782uniform lowp float u_${o}_t;
783layout(location = ${l++}) in ${r} ${s} a_${o};
784#else
785uniform ${r} ${a} u_${o};
786#endif
787`:"vec4"===n?`
788#ifndef HAS_UNIFORM_u_${o}
789    ${r} ${a} ${o} = a_${o};
790#else
791    ${r} ${a} ${o} = u_${o};
792#endif
793`:`
794#ifndef HAS_UNIFORM_u_${o}
795    ${r} ${a} ${o} = unpack_mix_${n}(a_${o}, u_${o}_t);
796#else
797    ${r} ${a} ${o} = u_${o};
798#endif
799`}),staticAttributes:a,staticUniforms:n}}var tM=class{constructor(t,i,r){this.vertexBuffer=t,this.indexBuffer=i,this.segments=r}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.vertexBuffer=null,this.indexBuffer=null,this.segments=null}};let tI=(0,p.Yt)([{name:"a_pos",type:"Int16",components:2}]),tS="#define PROJECTION_MERCATOR",tC="mercator";var tE=class{constructor(){this._cachedMesh=null}get name(){return"mercator"}get useSubdivision(){return!1}get shaderVariantName(){return tC}get shaderDefine(){return tS}get shaderPreludeCode(){return tT.projectionMercator}get vertexShaderPreludeCode(){return tT.projectionMercator.vertexSource}get subdivisionGranularity(){return p.vt.noSubdivision}get useGlobeControls(){return!1}get transitionState(){return 0}destroy(){}getMeshFromTileID(t,i,r,a,o){if(this._cachedMesh)return this._cachedMesh;let s=new p.Gt;s.emplaceBack(0,0),s.emplaceBack(p.Ur,0),s.emplaceBack(0,p.Ur),s.emplaceBack(p.Ur,p.Ur);let n=t.createVertexBuffer(s,tI.members),l=p.Bt.simpleSegment(0,0,4,2),h=new p.Jt;h.emplaceBack(1,0,2),h.emplaceBack(1,2,3);let c=t.createIndexBuffer(h);return this._cachedMesh=new tM(n,c,l),this._cachedMesh}recalculate(){}hasTransition(){return!1}},tz=class t{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 null!=i.top&&null!=t.top&&(this.top=p.bn.number(t.top,i.top,r)),null!=i.bottom&&null!=t.bottom&&(this.bottom=p.bn.number(t.bottom,i.bottom,r)),null!=i.left&&null!=t.left&&(this.left=p.bn.number(t.left,i.left,r)),null!=i.right&&null!=t.right&&(this.right=p.bn.number(t.right,i.right,r)),this}getCenter(t,i){let r=(0,p.Kn)((this.left+t-this.right)/2,0,t),a=(0,p.Kn)((this.top+i-this.bottom)/2,0,i);return new p.Vi(r,a)}equals(t){return this.top===t.top&&this.bottom===t.bottom&&this.left===t.left&&this.right===t.right}clone(){return new t(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}};function tR(t,i){if(!t.renderWorldCopies||t.lngRange)return;let r=i.lng-t.center.lng;i.lng+=r>180?-360:360*(r<-180)}function tD(t){return Math.max(0,Math.floor(t))}var tA=class{constructor(t,i){this.applyConstrain=(t,i)=>null===this._constrainOverride?this._callbacks.defaultConstrain(t,i):this._constrainOverride(t,i),this._callbacks=t,this._tileSize=512,this._renderWorldCopies=i?.renderWorldCopies===void 0||!!i?.renderWorldCopies,this._minZoom=i?.minZoom||0,this._maxZoom=i?.maxZoom||22,this._minPitch=i?.minPitch===void 0||i?.minPitch===null?0:i?.minPitch,this._maxPitch=i?.maxPitch===void 0||i?.maxPitch===null?60:i?.maxPitch,this._constrainOverride=i?.constrainOverride??null,this.setMaxBounds(),this._width=0,this._height=0,this._center=new p.ct(0,0),this._elevation=0,this._zoom=0,this._tileZoom=tD(this._zoom),this._scale=(0,p.Vr)(this._zoom),this._bearingInRadians=0,this._fovInRadians=.6435011087932844,this._pitchInRadians=0,this._rollInRadians=0,this._unmodified=!0,this._edgeInsets=new tz,this._minElevationForCurrentTile=0,this._autoCalculateNearFarZ=!0}apply(t,i,r){this._constrainOverride=t.constrainOverride,this._latRange=t.latRange,this._lngRange=t.lngRange,this._width=t.width,this._height=t.height,this._center=t.center,this._elevation=t.elevation,this._minElevationForCurrentTile=t.minElevationForCurrentTile,this._zoom=t.zoom,this._tileZoom=tD(this._zoom),this._scale=(0,p.Vr)(this._zoom),this._bearingInRadians=t.bearingInRadians,this._fovInRadians=t.fovInRadians,this._pitchInRadians=t.pitchInRadians,this._rollInRadians=t.rollInRadians,this._unmodified=t.unmodified,this._edgeInsets=new tz(t.padding.top,t.padding.bottom,t.padding.left,t.padding.right),this._minZoom=t.minZoom,this._maxZoom=t.maxZoom,this._minPitch=t.minPitch,this._maxPitch=t.maxPitch,this._renderWorldCopies=t.renderWorldCopies,this._cameraToCenterDistance=t.cameraToCenterDistance,this._nearZ=t.nearZ,this._farZ=t.farZ,this._autoCalculateNearFarZ=!r&&t.autoCalculateNearFarZ,i&&this.constrainInternal(),this._calcMatrices()}
799get pixelsToClipSpaceMatrix(){return this._pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._clipSpaceToPixelsMatrix}get minElevationForCurrentTile(){return this._minElevationForCurrentTile}setMinElevationForCurrentTile(t){this._minElevationForCurrentTile=t}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(t){this._minZoom!==t&&(this._minZoom=t,this.setZoom(this.applyConstrain(this._center,this.zoom).zoom))}get maxZoom(){return this._maxZoom}setMaxZoom(t){this._maxZoom!==t&&(this._maxZoom=t,this.setZoom(this.applyConstrain(this._center,this.zoom).zoom))}get minPitch(){return this._minPitch}setMinPitch(t){this._minPitch!==t&&(this._minPitch=t,this.setPitch(Math.max(this.pitch,t)))}get maxPitch(){return this._maxPitch}setMaxPitch(t){this._maxPitch!==t&&(this._maxPitch=t,this.setPitch(Math.min(this.pitch,t)))}get renderWorldCopies(){return this._renderWorldCopies}setRenderWorldCopies(t){void 0===t?t=!0:null===t&&(t=!1),this._renderWorldCopies=t}get constrainOverride(){return this._constrainOverride}setConstrainOverride(t){void 0===t&&(t=null),this._constrainOverride!==t&&(this._constrainOverride=t,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 p.Vi(this._width,this._height)}get bearing(){return this._bearingInRadians/Math.PI*180}setBearing(t){var i,r,a,o,s,n,l,h,c;let u=(0,p.Br)(t,-180,180)*Math.PI/180;this._bearingInRadians!==u&&(this._unmodified=!1,this._bearingInRadians=u,this._calcMatrices(),this._rotationMatrix=m(),i=this._rotationMatrix,r=this._rotationMatrix,a=-this._bearingInRadians,o=r[0],s=r[1],n=r[2],l=r[3],h=Math.sin(a),c=Math.cos(a),i[0]=o*c+n*h,i[1]=s*c+l*h,i[2]=-(o*h)+n*c,i[3]=-(s*h)+l*c)}get rotationMatrix(){return this._rotationMatrix}get pitchInRadians(){return this._pitchInRadians}get pitch(){return this._pitchInRadians/Math.PI*180}setPitch(t){let i=(0,p.Kn)(t,this.minPitch,this.maxPitch)/180*Math.PI;this._pitchInRadians!==i&&(this._unmodified=!1,this._pitchInRadians=i,this._calcMatrices())}get rollInRadians(){return this._rollInRadians}get roll(){return this._rollInRadians/Math.PI*180}setRoll(t){let i=t/180*Math.PI;this._rollInRadians!==i&&(this._unmodified=!1,this._rollInRadians=i,this._calcMatrices())}get fovInRadians(){return this._fovInRadians}get fov(){return(0,p.Dr)(this._fovInRadians)}setFov(t){t=(0,p.Kn)(t,.1,150),this.fov!==t&&(this._unmodified=!1,this._fovInRadians=(0,p.tr)(t),this._calcMatrices())}get zoom(){return this._zoom}setZoom(t){let i=this.applyConstrain(this._center,t).zoom;this._zoom!==i&&(this._unmodified=!1,this._zoom=i,this._tileZoom=Math.max(0,Math.floor(i)),this._scale=(0,p.Vr)(i),this.constrainInternal(),this._calcMatrices())}get center(){return this._center}setCenter(t){(t.lat!==this._center.lat||t.lng!==this._center.lng)&&(this._unmodified=!1,this._center=t,this.constrainInternal(),this._calcMatrices())}get elevation(){return this._elevation}setElevation(t){t!==this._elevation&&(this._elevation=t,this.constrainInternal(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}setPadding(t){this._edgeInsets.equals(t)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,t,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(t,i){this._autoCalculateNearFarZ=!1,this._nearZ=t,this._farZ=i,this._calcMatrices()}clearNearFarZOverride(){this._autoCalculateNearFarZ=!0,this._calcMatrices()}isPaddingEqual(t){return this._edgeInsets.equals(t)}interpolatePadding(t,i,r){this._unmodified=!1,this._edgeInsets.interpolate(t,i,r),this.constrainInternal(),this._calcMatrices()}resize(t,i,r=!0){this._width=t,this._height=i,r&&this.constrainInternal(),this._calcMatrices()}getMaxBounds(){return this._latRange?.length!==2||this._lngRange?.length!==2?null:new eo([this._lngRange[0],this._latRange[0]],[this._lngRange[1],this._latRange[1]])}setMaxBounds(t){t?(this._lngRange=[t.getWest(),t.getEast()],this._latRange=[t.getSouth(),t.getNorth()],this.constrainInternal()):(this._lngRange=null,this._latRange=[-p.Vn,p.Vn])}getCameraQueryGeometry(t,i){if(1===i.length)return[i[0],t];{let{minX:r,minY:a,maxX:o,maxY:s}=p.ft.fromPoints(i).extend(t);return[new p.Vi(r,a),new p.Vi(o,a),new p.Vi(o,s),new p.Vi(r,s),new p.Vi(r,a)]}}constrainInternal(){if(!this.center||!this._width||!this._height||this._constraining)return;this._constraining=!0;let t=this._unmodified,{center:i,zoom:r}=this.applyConstrain(this.center,this.zoom);this.setCenter(i),this.setZoom(r),this._unmodified=t,this._constraining=!1}
799_calcMatrices(){if(this._width&&this._height){this._pixelsToGLUnits=[2/this._width,-2/this._height];let t=(0,p.Ei)(new Float64Array(16));(0,p.Pi)(t,t,[this._width/2,-this._height/2,1]),(0,p.Fi)(t,t,[1,-1,0]),this._clipSpaceToPixelsMatrix=t,t=(0,p.Ei)(new Float64Array(16)),(0,p.Pi)(t,t,[1,-1,1]),(0,p.Fi)(t,t,[-1,-1,0]),(0,p.Pi)(t,t,[2/this._width,2/this._height,1]),this._pixelsToClipSpaceMatrix=t;let i=this.fovInRadians/2;this._cameraToCenterDistance=.5/Math.tan(i)*this._height}this._callbacks.calcMatrices()}calculateCenterFromCameraLngLatAlt(t,i,r,a){let o=void 0===r?this.bearing:r,s=a=void 0===a?this.pitch:a,{distanceToCenter:n,clampedElevation:l}=this._distanceToCenterFromAltElevationPitch(i,this.elevation,s),{x:h,y:c}=(0,p.J)(s,o),u=p.tt.fromLngLat(t,i),d=(0,p.nt)(1,u.y),_,m,f=0;do{if((f+=1)>10)break;let t=h*(m=n/d),i=c*m;d=1/(_=new p.tt(u.x+t,u.y+i)).meterInMercatorCoordinateUnits()}while(Math.abs(n-m*d)>1e-12);return{center:_.toLngLat(),elevation:l,zoom:(0,p.Nr)(this.height/2/Math.tan(this.fovInRadians/2)/m/this.tileSize)}}recalculateZoomAndCenter(t){if(this.elevation-t==0)return;let i=1/this.worldSize,r=(0,p.st)(1,this.center.lat)*this.worldSize,a=p.tt.fromLngLat(this.center,this.elevation),o=a.x/i,s=a.y/i,n=a.z/i,l=this.pitch,h=this.bearing,{x:c,y:u,z:d}=(0,p.J)(l,h),_=this.cameraToCenterDistance,{distanceToCenter:m,clampedElevation:f}=this._distanceToCenterFromAltElevationPitch((n+_*d)/r,t,l),g=m*r,v=new p.tt((o+-(_*c)+c*g)*i,(s+-(_*u)+u*g)*i,0).toLngLat(),y=(0,p.st)(1,v.lat),x=(0,p.Nr)(this.height/2/Math.tan(this.fovInRadians/2)/m/y/this.tileSize);this._elevation=f,this._center=v,this.setZoom(x)}_distanceToCenterFromAltElevationPitch(t,i,r){let a=-Math.cos((0,p.tr)(r)),o=t-i,s,n=i;return a*o>=0||.1>Math.abs(a)?n=t+(s=1e4)*a:s=-o/a,{distanceToCenter:s,clampedElevation:n}}getCameraPoint(){let t=Math.tan(this.pitchInRadians)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new p.Vi(t*Math.sin(this.rollInRadians),t*Math.cos(this.rollInRadians)))}getCameraAltitude(){return Math.cos(this.pitchInRadians)*this._cameraToCenterDistance/this._pixelPerMeter+this.elevation}getCameraLngLat(){let t=(0,p.st)(1,this.center.lat)*this.worldSize,i=this.cameraToCenterDistance/t;return(0,p.Y)(this.center,this.elevation,this.pitch,this.bearing,i).toLngLat()}getMercatorTileCoordinates(t){if(!t)return[0,0,1,1];let i=t.canonical.z>=0?1<<t.canonical.z:2**t.canonical.z;return[t.canonical.x/i,t.canonical.y/i,1/i/p.Ur,1/i/p.Ur]}},tL=class t{constructor(t,i){this.min=t,this.max=i,this.center=(0,p.pi)([],(0,p.ni)([],this.min,this.max),.5)}quadrant(i){let r=[i%2==0,i<2],a=(0,p.ri)(this.min),o=(0,p.ri)(this.max);for(let t=0;t<r.length;t++)a[t]=r[t]?this.min[t]:this.center[t],o[t]=r[t]?this.center[t]:this.max[t];return o[2]=this.max[2],new t(a,o)}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 t=this.intersectsPlane(r);if(0===t)return 0;1===t&&(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}},tF=class{distanceToTile2d(t,i,r,a){return Math.hypot(a.distanceX([t,i]),a.distanceY([t,i]))}getWrap(t,i,r){return r}getTileBoundingVolume(t,i,r,a){let o=Math.min(0,r),s=Math.max(0,r);if(a?.terrain){let r=new p.g(t.z,i,t.z,t.x,t.y),n=a.terrain.getMinMaxElevation(r);o=n.minElevation??o,s=n.maxElevation??s}let n=1<<t.z;return new tL([i+t.x/n,t.y/n,o],[i+(t.x+1)/n,(t.y+1)/n,s])}allowVariableZoom(t,i){let r=t.fov*(Math.abs(Math.cos(t.rollInRadians))*t.height+Math.abs(Math.sin(t.rollInRadians))*t.width)/t.height,a=(0,p.Kn)(78.5-r/2,0,60);return!!i.terrain||t.pitch>a}allowWorldCopies(){return!0}prepareNextFrame(){}},tk=class t{constructor(t,i,r){this.points=t,this.planes=i,this.aabb=r}static fromInvProjectionMatrix(i,r=1,a=0,o,s){let n=s?[[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**a,h=[[-1,1,-1,1],[1,1,-1,1],[1,-1,-1,1],[-1,-1,-1,1],[-1,1,1,1],[1,1,1,1],[1,-1,1,1],[-1,-1,1,1]].map(t=>{var a,o,s,n;let h,c;return a=t,o=i,s=r,n=l,c=1/(h=(0,p.ti)([],a,o))[3]/s*n,(0,p.$r)(h,h,[c,c,1/h[3],c])});o&&function(t,i,r,a){var o,s;let n,l,h,c=4*!!a,u=4*!a,d=0,_=[],m=[];for(let i=0;i<4;i++){let r=(0,p.hi)([],t[i+u],t[i+c]),a=(0,p.si)(r);(0,p.pi)(r,r,1/a),_.push(a),m.push(r)}for(let i=0;i<4;i++){let a=(0,p.Or)(t[i+c],m[i],r);d=null!==a&&a>=0?Math.max(d,a):Math.max(d,_[i])}let f=(o=t,s=i,n=(0,p.hi)([],o[s[0]],o[s[1]]),l=(0,p.hi)([],o[s[2]],o[s[1]]),h=[0,0,0,0],(0,p.li)(h,(0,p.ii)([],n,l)),h[3]=-(0,p.ai)(h,o[s[0]]),h),g=function(t,i){let r=(0,p.oi)(t),a=(0,p.ei)([],t,1/r),o=(0,p.hi)([],i,(0,p.pi)([],a,(0,p.ai)(i,a))),s=(0,p.oi)(o);if(s>0){let t=Math.sqrt(1-a[3]*a[3]),r=(0,p.pi)([],a,-a[3]),n=(0,p.ni)([],r,(0,p.pi)([],o,t/s));return(0,p.Er)(i,n)}return null}(r,f);null!==g&&(d=Math.min(d,g/(0,p.ai)(m[0],f)));for(let i=0;i<4;i++){let r=Math.min(d,_[i]);
799t[i+u]=[t[i+c][0]+m[i][0]*r,t[i+c][1]+m[i][1]*r,t[i+c][2]+m[i][2]*r,1]}}(h,n[0],o,s);let c=n.map(t=>{let i=(0,p.hi)([],h[t[0]],h[t[1]]),r=(0,p.hi)([],h[t[2]],h[t[1]]),a=(0,p.li)([],(0,p.ii)([],i,r)),o=-(0,p.ai)(a,h[t[1]]);return a.concat(o)}),u=[1/0,1/0,1/0],d=[-1/0,-1/0,-1/0];for(let t of h)for(let i=0;i<3;i++)u[i]=Math.min(u[i],t[i]),d[i]=Math.max(d[i],t[i]);return new t(h,c,new tL(u,d))}},tB=class t{get pixelsToClipSpaceMatrix(){return this._helper.pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._helper.clipSpaceToPixelsMatrix}get pixelsToGLUnits(){return this._helper.pixelsToGLUnits}get centerOffset(){return this._helper.centerOffset}get size(){return this._helper.size}get rotationMatrix(){return this._helper.rotationMatrix}get centerPoint(){return this._helper.centerPoint}get pixelsPerMeter(){return this._helper.pixelsPerMeter}setMinZoom(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){this._posMatrixCache=new Map,this._alignedPosMatrixCache=new Map,this._fogMatrixCacheF32=new Map,this.defaultConstrain=(t,i)=>{i=(0,p.Kn)(+i,this.minZoom,this.maxZoom);let r={center:new p.ct(t.lng,t.lat),zoom:i},a=this._helper._lngRange;this._helper._renderWorldCopies||null!==a||(a=[-179.9999999999,180-1e-10]);let o=this.tileSize*(0,p.Vr)(r.zoom),s=0,n=o,l=0,h=o,c=0,u=0,{x:d,y:_}=this.size;if(this._helper._latRange){let t=this._helper._latRange;s=(0,p.ot)(t[1])*o,(n=(0,p.ot)(t[0])*o)-s<_&&(c=_/(n-s))}a&&(l=(0,p.Br)((0,p.at)(a[0])*o,0,o),(h=(0,p.Br)((0,p.at)(a[1])*o,0,o))<l&&(h+=o),h-l<d&&(u=d/(h-l)));let{x:m,y:f}=(0,p.Q)(o,t),g,v,y=Math.max(u||0,c||0);if(y){let t=new p.Vi(u?(h+l)/2:m,c?(n+s)/2:f);return r.center=(0,p.et)(o,t).wrap(),r.zoom+=(0,p.Nr)(y),r}if(this._helper._latRange){let t=_/2;f-t<s&&(v=s+t),f+t>n&&(v=n-t)}if(a){let t=(l+h)/2,i=m;
799this._helper._renderWorldCopies&&(i=(0,p.Br)(m,t-o/2,t+o/2));let r=d/2;i-r<l&&(g=l+r),i+r>h&&(g=h-r)}if(void 0!==g||void 0!==v){let t=new p.Vi(g??m,v??f);r.center=(0,p.et)(o,t).wrap()}return r},this.applyConstrain=(t,i)=>this._helper.applyConstrain(t,i),this._helper=new tA({calcMatrices:()=>this._calcMatrices(),defaultConstrain:(t,i)=>this.defaultConstrain(t,i)},t),this._coveringTilesDetailsProvider=new tF}clone(){let i=new t;return i.apply(this,!1),i}apply(t,i,r){this._helper.apply(t,i,r)}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 p._(0,t)];if(this._helper._renderWorldCopies){let r=this.screenPointToMercatorCoordinate(new p.Vi(0,0)),a=this.screenPointToMercatorCoordinate(new p.Vi(this._helper._width,0)),o=this.screenPointToMercatorCoordinate(new p.Vi(this._helper._width,this._helper._height)),s=this.screenPointToMercatorCoordinate(new p.Vi(0,this._helper._height)),n=Math.floor(Math.min(r.x,a.x,o.x,s.x)),l=Math.floor(Math.max(r.x,a.x,o.x,s.x));for(let r=n-1;r<=l+1;r++)0!==r&&i.push(new p._(r,t))}return i}getCameraFrustum(){return tk.fromInvProjectionMatrix(this._invViewProjMatrix,this.worldSize)}getClippingPlane(){return null}getCoveringTilesDetailsProvider(){return this._coveringTilesDetailsProvider}recalculateZoomAndCenter(t){let i=this.screenPointToLocation(this.centerPoint,t),r=t?t.getElevationForLngLatZoom(i,this._helper._tileZoom):0;this._helper.recalculateZoomAndCenter(r)}setLocationAtPoint(t,i,r=this.elevation){let a=r-this.elevation,o=this.screenPointToMercatorCoordinateAtZ(i,a),s=this.screenPointToMercatorCoordinateAtZ(this.centerPoint,0),n=p.tt.fromLngLat(t),l=new p.tt(n.x-(o.x-s.x),n.y-(o.y-s.y));this.setCenter(l?.toLngLat()),this._helper._renderWorldCopies&&this.setCenter(this.center.wrap())}locationToScreenPoint(t,i){return i?this.coordinatePoint(p.tt.fromLngLat(t),i.getElevationForLngLat(t,this),this._pixelMatrix3D):this.coordinatePoint(p.tt.fromLngLat(t))}screenPointToLocation(t,i){return this.screenPointToMercatorCoordinate(t,i)?.toLngLat()}screenPointToLocationAtElevation(t,i){return this.screenPointToMercatorCoordinateAtZ(t,i-this.elevation)?.toLngLat()}screenPointToMercatorCoordinate(t,i){if(i){let r=i.pointCoordinate(t);if(null!=r)return r}return this.screenPointToMercatorCoordinateAtZ(t)}screenPointToMercatorCoordinateAtZ(t,i){let r=i||0,a=[t.x,t.y,0,1],o=[t.x,t.y,1,1];(0,p.ti)(a,a,this._pixelMatrixInverse),(0,p.ti)(o,o,this._pixelMatrixInverse);let s=a[3],n=o[3],l=a[0]/s,h=o[0]/n,c=a[1]/s,u=o[1]/n,d=a[2]/s,_=o[2]/n,m=d===_?0:(r-d)/(_-d);return new p.tt(p.bn.number(l,h,m)/this.worldSize,p.bn.number(c,u,m)/this.worldSize,r)}coordinatePoint(t,i=0,r=this._pixelMatrix){let a=[t.x*this.worldSize,t.y*this.worldSize,i,1];return(0,p.ti)(a,a,r),new p.Vi(a[0]/a[3],a[1]/a[3])}getBounds(){let t=Math.max(0,this._helper._height/2-(0,p.X)(this));return new eo().extend(this.screenPointToLocation(new p.Vi(0,t))).extend(this.screenPointToLocation(new p.Vi(this._helper._width,t))).extend(this.screenPointToLocation(new p.Vi(this._helper._width,this._helper._height))).extend(this.screenPointToLocation(new p.Vi(0,this._helper._height)))}isPointOnMapSurface(t,i){return i?null!=i.pointCoordinate(t):t.y>this.height/2-(0,p.X)(this)}calculatePosMatrix(t,i=!1,r=!1){let a=t.key??(0,p.v)(t.wrap,t.canonical.z,t.canonical.z,t.canonical.x,t.canonical.y),o=i?this._alignedPosMatrixCache:this._posMatrixCache;if(o.has(a)){let t=o.get(a);return r?t.f32:t.f64}let s=(0,p.q)(t,this.worldSize);(0,p.Oi)(s,i?this._alignedProjMatrix:this._viewProjMatrix,s);let n={f64:s,f32:new Float32Array(s)};return o.set(a,n),r?n.f32:n.f64}calculateFogMatrix(t){let i=t.key,r=this._fogMatrixCacheF32;if(r.has(i))return r.get(i);let a=(0,p.q)(t,this.worldSize);return(0,p.Oi)(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)}_calculateNearFarZIfNeeded(t,i,r){if(!this._helper.autoCalculateNearFarZ)return;let a=Math.min(this.elevation,this.minElevationForCurrentTile,this.getCameraAltitude()-100),o=t-a*this._helper._pixelPerMeter/Math.cos(i),s=a<0?o:t,n=Math.PI/2+this.pitchInRadians,l=(0,p.tr)(this.fov)*(Math.abs(Math.cos((0,p.tr)(this.roll)))*this.height+Math.abs(Math.sin((0,p.tr)(this.roll)))*this.width)/this.height*(.5+r.y/this.height),h=Math.sin(l)*s/Math.sin((0,p.Kn)(Math.PI-n-l,.01,Math.PI-.01)),c=(0,p.X)(this),u=Math.atan(c/this._helper.cameraToCenterDistance),d=(0,p.tr)(90-p.Z),_=u>d?2*u*(.5+r.y/(2*c)):d,m=Math.min(h,Math.sin(_)*s/Math.sin((0,p.Kn)(Math.PI-n-_,.01,Math.PI-.01)));this._helper._farZ=(Math.cos(Math.PI/2-i)*m+s)*1.01,this._helper._nearZ=this._helper._height/50}_calcMatrices(){var t,i;let r;if(!this._helper._height)return;let a=this.centerOffset,o=(0,p.Q)(this.worldSize,this.center),s=o.x,n=o.y;this._helper._pixelPerMeter=(0,p.st)(1,this.center.lat)*this.worldSize;let l=(0,p.tr)(Math.min(this.pitch,p.Z)),h=Math.max(this._helper.cameraToCenterDistance/2,this._helper.cameraToCenterDistance+this._helper._elevation*this._helper._pixelPerMeter/Math.cos(l));this._calculateNearFarZIfNeeded(h,l,a),r=new Float64Array(16),(0,p.Ai)(r,this.fovInRadians,this._helper._width/this._helper._height,this._helper._nearZ,this._helper._farZ),this._invProjMatrix=new Float64Array(16),t=this._invProjMatrix,i=r,t[0]=1/i[0],t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1/i[5],t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=0,t[11]=1/i[14],t[12]=0,t[13]=0,t[14]=-1,t[15]=i[10]/i[14],r[8]=-(2*a.x)/this._helper._width,r[9]=2*a.y/this._helper._height,this._projectionMatrix=(0,p.bi)(r),(0,p.Pi)(r,r,[1,-1,1]),(0,p.Fi)(r,r,[0,0,-this._helper.cameraToCenterDistance]),(0,p.Ni)(r,r,-this.rollInRadians),(0,p.ji)(r,r,this.pitchInRadians),(0,p.Ni)(r,r,-this.bearingInRadians),(0,p.Fi)(r,r,[-s,-n,0]),this._mercatorMatrix=(0,p.Pi)([],r,[this.worldSize,this.worldSize,this.worldSize]),(0,p.Pi)(r,r,[1,1,this._helper._pixelPerMeter]),this._pixelMatrix=(0,p.Oi)(new Float64Array(16),this.clipSpaceToPixelsMatrix,r),(0,p.Fi)(r,r,[0,0,-this.elevation]),this._viewProjMatrix=r,this._invViewProjMatrix=(0,p.Di)([],r);let c=[0,0,-1,1];(0,p.ti)(c,c,this._invViewProjMatrix),this._cameraPosition=[c[0]/c[3],c[1]/c[3],c[2]/c[3]],this._fogMatrix=new Float64Array(16),(0,p.Ai)(this._fogMatrix,this.fovInRadians,this.width/this.height,h,this._helper._farZ),this._fogMatrix[8]=-(2*a.x)/this.width,this._fogMatrix[9]=2*a.y/this.height,(0,p.Pi)(this._fogMatrix,this._fogMatrix,[1,-1,1]),(0,p.Fi)(this._fogMatrix,this._fogMatrix,[0,0,-this.cameraToCenterDistance]),(0,p.Ni)(this._fogMatrix,this._fogMatrix,-this.rollInRadians),(0,p.ji)(this._fogMatrix,this._fogMatrix,this.pitchInRadians),(0,p.Ni)(this._fogMatrix,this._fogMatrix,-this.bearingInRadians),(0,p.Fi)(this._fogMatrix,this._fogMatrix,[-s,-n,0]),(0,p.Pi)(this._fogMatrix,this._fogMatrix,[1,1,this._helper._pixelPerMeter]),(0,p.Fi)(this._fogMatrix,this._fogMatrix,[0,0,-this.elevation]),this._pixelMatrix3D=(0,p.Oi)(new Float64Array(16),this.clipSpaceToPixelsMatrix,r);let u=this._helper._width%2/2,d=this._helper._height%2/2,_=Math.cos(this.bearingInRadians),m=Math.sin(-this.bearingInRadians),f=s-Math.round(s)+_*u+m*d,g=n-Math.round(n)+_*d+m*u,v=new Float64Array(r);if((0,p.Fi)(v,v,[f>.5?f-1:f,g>.5?g-1:g,0]),this._alignedProjMatrix=v,!(r=(0,p.Di)(new Float64Array(16),this._pixelMatrix)))throw Error("failed to invert matrix");this._pixelMatrixInverse=r,this._clearMatrixCaches()}_clearMatrixCaches(){this._posMatrixCache.clear(),this._alignedPosMatrixCache.clear(),this._fogMatrixCacheF32.clear()}maxPitchScaleFactor(){if(!this._pixelMatrixInverse)return 1;let t=this.screenPointToMercatorCoordinate(new p.Vi(0,0)),i=[t.x*this.worldSize,t.y*this.worldSize,0,1];return(0,p.ti)(i,i,this._pixelMatrix)[3]/this._helper.cameraToCenterDistance}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return this._helper.getCameraAltitude()}getCameraLngLat(){let t=(0,p.st)(1,this.center.lat)*this.worldSize,i=this._helper.cameraToCenterDistance/t;return(0,p.Y)(this.center,this.elevation,this.pitch,this.bearing,i).toLngLat()}lngLatToCameraDepth(t,i){let r=p.tt.fromLngLat(t),a=[r.x*this.worldSize,r.y*this.worldSize,i,1];return(0,p.ti)(a,a,this._viewProjMatrix),a[2]/a[3]}getProjectionData(t){let{overscaledTileID:i,aligned:r,applyTerrainMatrix:a}=t,o=this._helper.getMercatorTileCoordinates(i),s=i?this.calculatePosMatrix(i,r,!0):null,n;return{mainMatrix:n=i?.terrainRttPosMatrix32f&&a?i.terrainRttPosMatrix32f:s||(0,p.Jn)(),tileMercatorCoords:o,clippingPlane:[0,0,0,0],projectionTransition:0,fallbackMatrix:n,clipAntimeridian:!1}}isLocationOccluded(t){return!1}getPixelScale(){return 1}getCircleRadiusCorrection(){return 1}getPitchedTextCorrection(t,i,r){return 1}transformLightDirection(t){return(0,p.ri)(t)}getRayDirectionFromPixel(t){throw Error("Not implemented.")}projectTileCoordinates(t,i,r,a){let o=this.calculatePosMatrix(r),s;a?(s=[t,i,a(t,i),1],(0,p.ti)(s,s,o)):e3(s=[t,i,0,1],s,o);let n=s[3];return{point:new p.Vi(s[0]/n,s[1]/n),signedDistanceFromCamera:n,isOccluded:!1}}populateCache(t){for(let i of t)this.calculatePosMatrix(i)}getProjectionDataForCustomLayer(t=!0){let i=new p.g(0,0,0,0,0),r=this.getProjectionData({overscaledTileID:i,applyGlobeMatrix:t}),a=(0,p.q)(i,this.worldSize);(0,p.Oi)(a,this._viewProjMatrix,a);let o=[p.Ur,p.Ur,this.worldSize/this._helper.pixelsPerMeter],s=(0,p.Xn)();
799return(0,p.Pi)(s,a,o),{...r,tileMercatorCoords:[0,0,1,1],fallbackMatrix:s,mainMatrix:s}}getFastPathSimpleProjectionMatrix(t){return this.calculatePosMatrix(t)}};function tj(){(0,p.zr)("Map cannot fit within canvas with the given bounds, padding, and/or offset.")}function tO(t){if(t.useSlerp)if(t.k<1){let i=(0,p.Mr)(t.startEulerAngles.roll,t.startEulerAngles.pitch,t.startEulerAngles.bearing),r=(0,p.Mr)(t.endEulerAngles.roll,t.endEulerAngles.pitch,t.endEulerAngles.bearing),a=new Float64Array(4);(0,p.Qr)(a,i,r,t.k);let o=(0,p.pr)(a);t.tr.setRoll(o.roll),t.tr.setPitch(o.pitch),t.tr.setBearing(o.bearing)}else t.tr.setRoll(t.endEulerAngles.roll),t.tr.setPitch(t.endEulerAngles.pitch),t.tr.setBearing(t.endEulerAngles.bearing);else t.tr.setRoll(p.bn.number(t.startEulerAngles.roll,t.endEulerAngles.roll,t.k)),t.tr.setPitch(p.bn.number(t.startEulerAngles.pitch,t.endEulerAngles.pitch,t.k)),t.tr.setBearing(p.bn.number(t.startEulerAngles.bearing,t.endEulerAngles.bearing,t.k))}function tN(t,i,r,a,o){let s=o.padding,n=(0,p.Q)(o.worldSize,r.getNorthWest()),l=(0,p.Q)(o.worldSize,r.getNorthEast()),h=(0,p.Q)(o.worldSize,r.getSouthEast()),c=(0,p.Q)(o.worldSize,r.getSouthWest
799()),u=(0,p.tr)(-a),d=n.rotate(u),_=l.rotate(u),m=h.rotate(u),f=c.rotate(u),g=new p.Vi(Math.max(d.x,_.x,f.x,m.x),Math.max(d.y,_.y,f.y,m.y)),v=new p.Vi(Math.min(d.x,_.x,f.x,m.x),Math.min(d.y,_.y,f.y,m.y)),y=g.sub(v),x=o.width-(s.left+s.right+i.left+i.right),b=o.height-(s.top+s.bottom+i.top+i.bottom),w=x/y.x,T=b/y.y;if(T<0||w<0)return void tj();let P=Math.min((0,p.Nr)(o.scale*Math.min(w,T)),t.maxZoom),M=p.Vi.convert(t.offset),I=(i.left-i.right)/2,S=(i.top-i.bottom)/2,C=new p.Vi(I,S).rotate((0,p.tr)(a)),E=M.add(C).mult(o.scale/(0,p.Vr)(P));return{center:(0,p.et)(o.worldSize,n.add(h).div(2).sub(E)),zoom:P,bearing:a}}var tZ=class{get useGlobeControls(){return!1}handlePanInertia(t,i){let r=t.mag(),a=Math.abs((0,p.X)(i));return{easingOffset:t.mult(Math.min(.75*a/r,1)),easingCenter:i.center}}handleMapControlsRollPitchBearingZoom(t,i){t.bearingDelta&&i.setBearing(i.bearing+t.bearingDelta),t.pitchDelta&&i.setPitch(i.pitch+t.pitchDelta),t.rollDelta&&i.setRoll(i.roll+t.rollDelta),t.zoomDelta&&i.setZoom(i.zoom+t.zoomDelta)}handleMapControlsPan(t,i,r){.01>t.around.distSqr(i.centerPoint)||i.setLocationAtPoint(r,t.around,t.aroundElevation)}cameraForBoxAndBearing(t,i,r,a,o){return tN(t,i,r,a,o)}handleJumpToCenterZoom(t,i){let r=void 0===i.zoom?t.zoom:+i.zoom;t.zoom!==r&&t.setZoom(+i.zoom),void 0!==i.center&&t.setCenter(p.ct.convert(i.center))}handleEaseTo(t,i){let r=t.zoom,a=t.padding,o={roll:t.roll,pitch:t.pitch,bearing:t.bearing},s={roll:void 0===i.roll?t.roll:i.roll,pitch:void 0===i.pitch?t.pitch:i.pitch,bearing:void 0===i.bearing?t.bearing:i.bearing},n=void 0!==i.zoom,l=!t.isPaddingEqual(i.padding),h=!1,c=n?+i.zoom:t.zoom,u=t.centerPoint.add(i.offsetAsPoint),d=t.screenPointToLocation(u),{center:_,zoom:m}=t.applyConstrain(p.ct.convert(i.center||d),c??r);tR(t,_);let f=(0,p.Q)(t.worldSize,d),g=(0,p.Q)(t.worldSize,_).sub(f),v=(0,p.Vr)(m-r);return{easeFunc:n=>{if(h&&t.setZoom(p.bn.number(r,m,n)),(0,p.jr)(o,s)||tO({startEulerAngles:o,endEulerAngles:s,tr:t,k:n,useSlerp:o.roll!=s.roll}),l&&(t.interpolatePadding(a,i.padding,n),u=t.centerPoint.add(i.offsetAsPoint)),i.around)t.setLocationAtPoint(i.around,i.aroundPoint);else{let i=(0,p.Vr)(t.zoom-r),a=(m>r?Math.min(2,v):Math.max(.5,v))**(1-n),o=(0,p.et)(t.worldSize,f.add(g.mult(n*a)).mult(i));t.setLocationAtPoint(t.renderWorldCopies?o.wrap():o,u)}},isZooming:h=m!==r,elevationCenter:_}}handleFlyTo(t,i){let r=void 0!==i.zoom,a=t.zoom,o=t.applyConstrain(p.ct.convert(i.center||i.locationAtOffset),r?+i.zoom:a),s=o.center,n=o.zoom;tR(t,s);let l=t.worldSize,h=(0,p.Q)(l,i.locationAtOffset),c=(0,p.Q)(l,s).sub(h),u=c.mag(),d=(0,p.Vr)(n-a),_=Math.min(Math.max(void 0===i.minZoom?t.minZoom:+i.minZoom,t.minZoom),a,n),m=t.applyConstrain(s,_).zoom;return{easeFunc:(i,r,o,u)=>{t.setZoom(1===i?n:a+(0,p.Nr)(r));let d=1===i?s:(0,p.et)(l,h.add(c.mult(o)));t.setLocationAtPoint(t.renderWorldCopies?d.wrap():d,u)},scaleOfZoom:d,targetCenter:s,scaleOfMinZoom:(0,p.Vr)(m-a),pixelPathLength:u}}};let tU=p.Ur/128,tV=new p.vt({fill:new p._t(128,2),line:new p._t(512,0),tile:new p._t(128,32),stencil:new p._t(128,1),circle:3});var tG=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 tT.projectionGlobe}get vertexShaderPreludeCode(){return tT.projectionMercator.vertexSource}get subdivisionGranularity(){return tV}get useGlobeControls(){return!0}destroy(){}_getMeshKey(t){return`${t.granularity.toString(36)}_${t.generateBorders?"b":""}${t.extendToNorthPole?"n":""}${t.extendToSouthPole?"s":""}`}getMeshFromTileID(t,i,r,a,o){let s=("stencil"===o?tV.stencil:tV.tile).getGranularityForZoomLevel(i.z),n=0===i.y&&a,l=i.y===(1<<i.z)-1&&a;return this._getMesh(t,{granularity:s,generateBorders:r,extendToNorthPole:n,extendToSouthPole:l})}_getMesh(t,i){let r,a,o,s=this._getMeshKey(i);if(s in this._tileMeshCache)return this._tileMeshCache[s];let n=(r=function(t,i){let r=void 0===t.granularity?1:Math.max(t.granularity,1),a=r+2*!!t.generateBorders,o=r+(t.extendToNorthPole||t.generateBorders?1:0)+(t.extendToSouthPole||t.generateBorders?1:0),s=a+1,n=o+1,l=t.generateBorders?-1:0,h=t.generateBorders||t.extendToNorthPole?-1:0,c=r+ +!!t.generateBorders,u=r+(t.generateBorders||t.extendToSouthPole?1:0),d=a*o*6,_=s*n>65536;if(_&&"16bit"===i)throw Error("Granularity is too large and meshes would not fit inside 16 bit vertex indices.");let m=_||"32bit"===i,f=new Int16Array(s*n*2),g=0;for(let i=h;i<=u;i++)for(let a=l;a<=c;a++){let o=a/r*p.Ur;
799-1===a&&(o=-tU),a===r+1&&(o=p.Ur+tU);let s=i/r*p.Ur;-1===i&&(s=t.extendToNorthPole?p.ht:-tU),i===r+1&&(s=t.extendToSouthPole?p.gt:p.Ur+tU),f[g++]=o,f[g++]=s}let v=m?new Uint32Array(d):new Uint16Array(d),y=0;for(let t=0;t<o;t++)for(let i=0;i<a;i++){let r=i+t*s,a=i+1+t*s,o=i+(t+1)*s,n=i+1+(t+1)*s;v[y++]=r,v[y++]=o,v[y++]=a,v[y++]=a,v[y++]=o,v[y++]=n}return{vertices:f.buffer.slice(0),indices:v.buffer.slice(0),uses32bitIndices:m}}(i,"16bit"),a=p.Gt.deserialize({arrayBuffer:r.vertices,length:r.vertices.byteLength/2/2}),o=p.Jt.deserialize({arrayBuffer:r.indices,length:r.indices.byteLength/2/3}),new tM(t.createVertexBuffer(a,tI.members),t.createIndexBuffer(o),p.Bt.simpleSegment(0,0,a.length,o.length)));return this._tileMeshCache[s]=n,n}recalculate(t){}hasTransition(){return!1}},tq=class extends p.wn{constructor(t,i){super(),this._transitionable=new p.en(d||=new p.Qt({type:new p.Zt(p.xn.projection.type,"type")}),"projection",i),this.setProjection(t),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new p.tn(0)),this._mercatorProjection=new tE,this._verticalPerspectiveProjection=new tG}get transitionState(){let t=this.properties.get("type");if("string"==typeof t&&"mercator"===t)return 0;if("string"==typeof t&&"vertical-perspective"===t)return 1;if(t instanceof p.fn){if(t.from===t.to)return+("mercator"!==t.from);if("vertical-perspective"===t.from&&"mercator"===t.to)return 1-t.transition;if("mercator"===t.from&&"vertical-perspective"===t.to)return t.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(t,i,r,a,o){return this.currentProjection.getMeshFromTileID(t,i,r,a,o)}setProjection(t){this._transitionable.setValue("type",t?.type||"mercator")}updateTransitions(t){this._transitioning=this._transitionable.transitioned(t,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()||this.currentProjection.hasTransition()}recalculate(t){this.properties=this._transitioning.possiblyEvaluate(t)}};function tW(t){return 2*Math.PI*tX(t.worldSize,t.center.lat)}function t$(t,i,r,a,o){let s=1/(1<<o),n=t/p.Ur*s+r*s,l=i/p.Ur*s+a*s,h=(0,p.Sr)(n*Math.PI*2+Math.PI,2*Math.PI),c=2*Math.atan(Math.exp(Math.PI-l*Math.PI*2))-.5*Math.PI,u=Math.cos(c),d=new Float64Array(3);return d[0]=Math.sin(h)*u,d[1]=Math.sin(c),d[2]=Math.cos(h)*u,d}function tH(t){var i,r;let a,o;return i=t.lng*Math.PI/180,a=Math.cos(r=t.lat*Math.PI/180),(o=new Float64Array(3))[0]=Math.sin(i)*a,o[1]=Math.sin(r),o[2]=Math.cos(i)*a,o}function tX(t,i){return t/(2*Math.PI)/Math.cos(i*Math.PI/180)}function tK(t){let i=Math.asin(t[1])/Math.PI*180,r=Math.sqrt(t[0]*t[0]+t[2]*t[2]);if(r>1e-6){let a=t[0]/r,o=Math.acos(t[2]/r),s=(a>0?o:-o)/Math.PI*180;return new p.ct((0,p.Br)(s,-180,180),i)}return new p.ct(0,i)}let tY=.98*Math.PI;function tJ(t,i){let r=t.cameraPosition,a=(0,p.si)(r);if(a<=1)return t.screenPointToLocation(i);let o=(0,p.Zn)();(0,p.li)(o,r);let s=t.getRayDirectionFromPixel(i),n=-(0,p.ai)(s,o),l=(0,p.Zn)();(0,p.mi)(l,s,o,n);let h=(0,p.si)(l);if(h<1e-9)return t.screenPointToLocation(i);let c=Math.atan2(h,n),u=.9*Math.asin(1/a);if(c<u)return t.screenPointToLocation(i);let d=a*Math.sin(u),_=Math.asin((0,p.Kn)(d,-1,1))-u,m=a*Math.cos(u)/Math.sqrt(Math.max(1-d*d,1e-12))-1,f=tY-_,g=c-u,v=_+m*g*f/(f+m*g),y=(0,p.Zn)();(0,p.pi)(y,l,1/h);let x=(0,p.Zn)();return(0,p.pi)(x,o,Math.cos((0,p.Kn)(v,0,tY))),(0,p.mi)(x,x,y,Math.sin((0,p.Kn)(v,0,tY))),(0,p.li)(x,x),tK(x)}function tQ(t){return Math.cos(t*Math.PI/180)}function t0(t,i){let r=tQ(t),a=tQ(i);return(0,p.Nr)(a/r)}function t1(t){let i=.5*t,r=Math.sin(i),a=Math.cos(i);return Math.log(r+a)-Math.log(a-r)}
799function t2(t,i,r,a){let o=t.lat+r*a;if(Math.abs(r)>1){let s=(Math.sign(t.lat+r)===Math.sign(t.lat)?Math.abs(t.lat):-Math.abs(t.lat))*Math.PI/180,n=Math.abs(t.lat+r)*Math.PI/180,l=t1(s+a*(n-s)),h=t1(s),c=t1(n),u=t.lng+(l-h)/(c-h)*i;return new p.ct(u,o)}{let r=t.lng+i*a;return new p.ct(r,o)}}var t3=class{constructor(t){this._cachePrevious=new Map,this._cache=new Map,this._hadAnyChanges=!1,this._boundingVolumeFactory=t}swapBuffers(){if(!this._hadAnyChanges)return;let t=this._cachePrevious;this._cachePrevious=this._cache,this._cache=t,this._cache.clear(),this._hadAnyChanges=!1}getTileBoundingVolume(t,i,r,a){let o=`${t.z}_${t.x}_${t.y}_${a?.terrain?"t":""}_${Math.round(r)}`,s=this._cache.get(o);if(s)return s;let n=this._cachePrevious.get(o);if(n)return this._cache.set(o,n),n;let l=this._boundingVolumeFactory(t,i,r,a);return this._cache.set(o,l),this._hadAnyChanges=!0,l}},t4=class t{constructor(t,i,r,a){this.min=r,this.max=a,this.points=t,this.planes=i}static fromAabb(i,r){let a=[];for(let t=0;t<8;t++)a.push([((0|t)&1)==1?r[0]:i[0],(t>>1&1)==1?r[1]:i[1],(t>>2&1)==1?r[2]:i[2]]);return new t(a,[[-1,0,0,r[0]],[1,0,0,-i[0]],[0,-1,0,r[1]],[0,1,0,-i[1]],[0,0,-1,r[2]],[0,0,1,-i[2]]],i,r)}static fromCenterSizeAngles(i,r,a){let o=(0,p.Yr)([],a[0],a[1],a[2]),s=(0,p.vi)([],[r[0],0,0],o),n=(0,p.vi)([],[0,r[1],0],o),l=(0,p.vi)([],[0,0,r[2]],o),h=[...i],c=[...i];for(let t=0;t<8;t++)for(let r=0;r<3;r++){let a=i[r]+s[r]*(((0|t)&1)==1?1:-1)+n[r]*((t>>1&1)==1?1:-1)+l[r]*((t>>2&1)==1?1:-1);h[r]=Math.min(h[r],a),c[r]=Math.max(c[r],a)}let u=[];for(let t=0;t<8;t++){let r=[...i];(0,p.ni)(r,r,(0,p.pi)([],s,((0|t)&1)==1?1:-1)),(0,p.ni)(r,r,(0,p.pi)([],n,(t>>1&1)==1?1:-1)),(0,p.ni)(r,r,(0,p.pi)([],l,(t>>2&1)==1?1:-1)),u.push(r)}return new t(u,[[...s,-(0,p.ai)(s,u[0])],[...n,-(0,p.ai)(n,u[0])],[...l,-(0,p.ai)(l,u[0])],[-s[0],-s[1],-s[2],-(0,p.ai)(s,u[7])],[-n[0],-n[1],-n[2],-(0,p.ai)(n,u[7])],[-l[0],-l[1],-l[2],-(0,p.ai)(l,u[7])]],h,c)}intersectsFrustum(t){let i=!0,r=this.points.length,a=this.planes.length,o=t.planes.length,s=t.points.length;for(let a=0;a<o;a++){let o=t.planes[a],s=0;for(let t=0;t<r;t++){let i=this.points[t];o[0]*i[0]+o[1]*i[1]+o[2]*i[2]+o[3]>=0&&s++}if(0===s)return 0;s<r&&(i=!1)}if(i)return 2;for(let i=0;i<a;i++){let r=this.planes[i],a=0;for(let i=0;i<s;i++){let o=t.points[i];r[0]*o[0]+r[1]*o[1]+r[2]*o[2]+r[3]>=0&&a++}if(0===a)return 0}return 1}intersectsPlane(t){let i=this.points.length,r=0;for(let a=0;a<i;a++){let i=this.points[a];t[0]*i[0]+t[1]*i[1]+t[2]*i[2]+t[3]>=0&&r++}return r===i?2:+(0!==r)}};function t5(t,i,r){let a=t-i;return a<0?-a:Math.max(0,a-r)}function t6(t,i,r,a,o){let s=t-r;return Math.max(s<0?Math.min(-s,1+s-o):s>o?Math.min(Math.max(s-o,0),1-s):0,t5(i,a,o))}var t8=class{constructor(){this._boundingVolumeCache=new t3(this._computeTileBoundingVolume)}prepareNextFrame(){this._boundingVolumeCache.swapBuffers()}distanceToTile2d(t,i,r,a){let o=1<<r.z,s=1/o,n=r.x/o,l=r.y/o;return Math.min(Math.min(Math.min(2,t6(t,i,n,l,s)),t6(t,i,n+.5,-l-s,s)),t6(t,i,n+.5,2-l-s,s))}getWrap(t,i,r){let a=1<<i.z,o=1/a,s=i.x/a,n=t5(t.x,s,o),l=t5(t.x,s-1,o),h=t5(t.x,s+1,o),c=Math.min(n,l,h);return c===h?1:c===l?-1:0}allowVariableZoom(t,i){return eR(t,i)>4}allowWorldCopies(){return!1}getTileBoundingVolume(t,i,r,a){return this._boundingVolumeCache.getTileBoundingVolume(t,i,r,a)}_computeTileBoundingVolume(t,i,r,a){let o=Math.min(0,r),s=Math.max(0,r);if(a?.terrain){let r=new p.g(t.z,i,t.z,t.x,t.y),n=a.terrain.getMinMaxElevation(r);o=n.minElevation??o,s=n.maxElevation??s}if(o/=p.lt,s/=p.lt,o+=1,s+=1,t.z<=0)return t4.fromAabb([-s,-s,-s],[s,s,s]);if(1===t.z)return t4.fromAabb([0===t.x?-s:0,0===t.y?0:-s,-s],[0===t.x?0:s,0===t.y?s:0,s]);{let i=[t$(0,0,t.x,t.y,t.z),t$(p.Ur,0,t.x,t.y,t.z),t$(p.Ur,p.Ur,t.x,t.y,t.z),t$(0,p.Ur,t.x,t.y,t.z)],r=[];for(let t of i)r.push((0,p.pi)([],t,s));if(s!==o)for(let t of i)r.push((0,p.pi)([],t,o));0===t.y&&r.push([0,1,0]),t.y===(1<<t.z)-1&&r.push([0,-1,0]);let a=[1,1,1],n=[-1,-1,-1];for(let t of r)for(let i=0;i<3;i++)a[i]=Math.min(a[i],t[i]),n[i]=Math.max(n[i],t[i]);let l=t$(p.Ur/2,p.Ur/2,t.x,t.y,t.z),h=(0,p.ii)([],[0,1,0],l);(0,p.li)(h,h);let c=(0,p.ii)([],l,h);(0,p.li)(c,c);let u=(0,p.ii)([],i[2],i[1]);(0,p.li)(u,u);let d=(0,p.ii)([],i[0],i[3]);(0,p.li)(d,d),r.push((0,p.pi)([],l,s)),t.y>=(1<<t.z)/2&&r.push((0,p.pi)([],t$(p.Ur/2,0,t.x,t.y,t.z),s)),t.y<(1<<t.z)/2&&r.push((0,p.pi)([],t$(p.Ur/2,p.Ur,t.x,t.y,t.z),s));let _=t9(l,r),m=t9(c,r),f=[-l[0],-l[1],-l[2],_.max],g=[l[0],l[1],l[2],-_.min],v=[-c[0],-c[1],-c[2],m.max],y=[c[0],c[
7991],c[2],-m.min],x=[...u,0],b=[...d,0],w=[];return 0===t.y?w.push((0,p.Ir)(b,x,f),(0,p.Ir)(b,x,g)):w.push((0,p.Ir)(v,x,f),(0,p.Ir)(v,x,g),(0,p.Ir)(v,b,f),(0,p.Ir)(v,b,g)),t.y===(1<<t.z)-1?w.push((0,p.Ir)(b,x,f),(0,p.Ir)(b,x,g)):w.push((0,p.Ir)(y,x,f),(0,p.Ir)(y,x,g),(0,p.Ir)(y,b,f),(0,p.Ir)(y,b,g)),new t4(w,[f,g,v,y,x,b],a,n)}}};function t9(t,i){let r=1/0,a=-1/0;for(let o of i){let i=(0,p.ai)(t,o);r=Math.min(r,i),a=Math.max(a,i)}return{min:r,max:a}}var t7=class t{get pixelsToClipSpaceMatrix(){return this._helper.pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._helper.clipSpaceToPixelsMatrix}get pixelsToGLUnits(){return this._helper.pixelsToGLUnits}get centerOffset(){return this._helper.centerOffset}get size(){return this._helper.size}get rotationMatrix(){return this._helper.rotationMatrix}get centerPoint(){return this._helper.centerPoint}get pixelsPerMeter(){return this._helper.pixelsPerMeter}setMinZoom(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){this._cachedClippingPlane=(0,p.Qn)(),this._projectionMatrix=(0,p.Yn)(),this._globeViewProjMatrix32f=(0,p.Jn)(),this._globeViewProjMatrixF64=(0,p.Yn)(),this._globeViewProjMatrixF64Inverted=(0,p.Yn)(),this._globeProjMatrixInverted=(0,p.Yn)(),this._cameraPosition=(0,p.Zn)(),this.defaultConstrain=(t,i)=>{let r=(0,p.Kn)(t.lat,-p.Vn,p.Vn),a=(0,p.Kn)(+i,this.minZoom+t0(0,r),this.maxZoom);return{center:new p.ct(t.lng,r),zoom:a}},this.applyConstrain=(t,i)=>this._helper.applyConstrain(t,i),this._helper=new tA({calcMatrices:()=>this._calcMatrices(),defaultConstrain:(t,i)=>this.defaultConstrain(t,i)},t),this._coveringTilesDetailsProvider=new t8}clone(){let i=new t;return i.apply(this,!1),i}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=(0,p.Zn)();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?.canonical.z===0}}_computeClippingPlane(t){let i=this.pitchInRadians,r=this.cameraToCenterDistance/t,a=Math.sin(i)*r,o=Math.cos(i)*r+1,s=1/Math.sqrt(a*a+o*o)*1,n=-a,l=o,h=Math.sqrt(n*n+l*l),c=[0,n/=h,l/=h];(0,p.fi)(c,c,[0,0,0],-this.bearingInRadians),(0,p.ui)(c,c,[0,0,0],-1*this.center.lat*Math.PI/180),(0,p.di)(c,c,[0,0,0],this.center.lng*Math.PI/180);let u=1/(0,p.si)(c);return(0,p.pi)(c,c,u),[...c,-s*u]}isLocationOccluded(t){return!this.isSurfacePointVisible(tH(t))}transformLightDirection(t){let i=this._helper._center.lng*Math.PI/180,r=this._helper._center.lat*Math.PI/180,a=Math.cos(r),o=[Math.sin(i)*a,Math.sin(r),Math.cos(i)*a],s=[o[2],0,-o[0]],n=[0,0,0];(0,p.ii)(n,s,o),(0,p.li)(s,s),(0,p.li)(n,n);let l=[s[0]*t[0]+n[0]*t[1]+o[0]*t[2],s[1]*t[0]+n[1]*t[1]+o[1]*t[2],s[2]*t[0]+n[2]*t[1]+o[2]*t[2]],h=[0,0,0];return(0,p.li)(h,l),h}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){var a,o;let s=(0,p.$)(t,i,r.canonical),n=(a=s.x,o=s.y,[(0,p.Sr)(a*Math.PI*2+Math.PI,2*Math.PI),2*Math.atan(Math.exp(Math.PI-o*Math.PI*2))-.5*Math.PI]);return this.getCircleRadiusCorrection()/Math.cos(n[1])}projectTileCoordinates(t,i,r,a){let o=r.canonical,s=t$(t,i,o.x,o.y,o.z),n=1+(a?a(t,i):0)/p.lt,l=[s[0]*n,s[1]*n,s[2]*n,1];(0,p.ti)(l,l,this._globeViewProjMatrixF64);let h=this._cachedClippingPlane,c=h[0]*s[0]+h[1]*s[1]+h[2]*s[2]+h[3]<0;return{point:new p.Vi(l[0]/l[3],l[1]/l[3]),signedDistanceFromCamera:l[3],isOccluded:c}}
799_calcMatrices(){if(!this._helper._width||!this._helper._height)return;let t=tX(this.worldSize,this.center.lat),i=(0,p.Xn)();this._helper.autoCalculateNearFarZ&&(this._helper._nearZ=.5,this._helper._farZ=this.cameraToCenterDistance+2*t),(0,p.Ai)(i,this.fovInRadians,this.width/this.height,this._helper._nearZ,this._helper._farZ);let r=this.centerOffset;i[8]=-(2*r.x)/this._helper._width,i[9]=2*r.y/this._helper._height,this._projectionMatrix=(0,p.bi)(i),this._globeProjMatrixInverted=(0,p.Xn)(),(0,p.Di)(this._globeProjMatrixInverted,i),(0,p.Fi)(i,i,[0,0,-this.cameraToCenterDistance]),(0,p.Ni)(i,i,this.rollInRadians),(0,p.ji)(i,i,-this.pitchInRadians),(0,p.Ni)(i,i,this.bearingInRadians),(0,p.Fi)(i,i,[0,0,-t]);let a=(0,p.Zn)();a[0]=t,a[1]=t,a[2]=t,(0,p.ji)(i,i,this.center.lat*Math.PI/180),(0,p.Mi)(i,i,-this.center.lng*Math.PI/180),(0,p.Pi)(i,i,a),this._globeViewProjMatrixF64=i,this._globeViewProjMatrix32f=new Float32Array(i),this._globeViewProjMatrixF64Inverted=(0,p.Xn)(),(0,p.Di)(this._globeViewProjMatrixF64Inverted,i);let o=(0,p.Zn)();this._cameraPosition=(0,p.Zn)(),this._cameraPosition[2]=this.cameraToCenterDistance/t,(0,p.fi)(this._cameraPosition,this._cameraPosition,o,-this.rollInRadians),(0,p.ui)(this._cameraPosition,this._cameraPosition,o,this.pitchInRadians),(0,p.fi)(this._cameraPosition,this._cameraPosition,o,-this.bearingInRadians),(0,p.ni)(this._cameraPosition,this._cameraPosition,[0,0,1]),(0,p.ui)(this._cameraPosition,this._cameraPosition,o,-this.center.lat*Math.PI/180),(0,p.di)(this._cameraPosition,this._cameraPosition,o,this.center.lng*Math.PI/180),this._cachedClippingPlane=this._computeClippingPlane(t);let s=(0,p.bi)(this._globeViewProjMatrixF64Inverted);(0,p.Pi)(s,s,[1,1,-1]),this._cachedFrustum=tk.fromInvProjectionMatrix(s,1,0,this._cachedClippingPlane,!0)}calculateFogMatrix(t){(0,p.zr)("calculateFogMatrix is not supported on globe projection.");let i=(0,p.Xn)();return(0,p.Ei)(i),i}getVisibleUnwrappedCoordinates(t){return[new p._(0,t)]}getCameraFrustum(){return this._cachedFrustum}getClippingPlane(){return this._cachedClippingPlane}getCoveringTilesDetailsProvider(){return this._coveringTilesDetailsProvider}recalculateZoomAndCenter(t){if(t)return void(0,p.zr)("terrain is not fully supported on vertical perspective projection.");this._helper.recalculateZoomAndCenter(0)}maxPitchScaleFactor(){return 1}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return this._helper.getCameraAltitude()}getCameraLngLat(){return this._helper.getCameraLngLat()}lngLatToCameraDepth(t,i){if(!this._globeViewProjMatrixF64)return 1;let r=tH(t);(0,p.pi)(r,r,1+i/p.lt);let a=(0,p.Qn)();return(0,p.ti)(a,[r[0],r[1],r[2],1],this._globeViewProjMatrixF64),a[2]/a[3]}populateCache(t){}getBounds(){let t=.5*this.width,i=.5*this.height,r=[new p.Vi(0,0),new p.Vi(t,0),new p.Vi(this.width,0),new p.Vi(this.width,i),new p.Vi(this.width,this.height),new p.Vi(t,this.height),new p.Vi(0,this.height),new p.Vi(0,i)],a=[];for(let t of r)a.push(this.unprojectScreenPoint(t));let o=0,s=0,n=0,l=0,h=this.center;for(let t of a){let i=(0,p.nr)(h.lng,t.lng),r=(0,p.nr)(h.lat,t.lat);i<s&&(s=i),i>o&&(o=i),r<l&&(l=r),r>n&&(n=r)}let c=[h.lng+s,h.lat+l,h.lng+o,h.lat+n];return this.isSurfacePointOnScreen([0,1,0])&&(c[3]=90,c[0]=-180,c[2]=180),this.isSurfacePointOnScreen([0,-1,0])&&(c[1]=-90,c[0]=-180,c[2]=180),new eo(c)}calculateCenterFromCameraLngLatAlt(t,i,r,a){return this._helper.calculateCenterFromCameraLngLatAlt(t,i,r,a)}setLocationAtPoint(t,i,r){let a=tH(this.unprojectScreenPoint(i)),o=tH(t),s=(0,p.Zn)();(0,p.yi)(s);let n=(0,p.Zn)();(0,p.di)(n,a,s,-this.center.lng*Math.PI/180),(0,p.ui)(n,n,s,this.center.lat*Math.PI/180);let l=o[0]*o[0]+o[2]*o[2],h=n[0]*n[0];if(l<h)return;let c=Math.sqrt(l-h),u=(0,p.Hn)(o[0],o[2],n[0],c),d=(0,p.Hn)(o[0],o[2],n[0],-c),_=(0,p.Zn)();(0,p.di)(_,o,s,-u);let m=(0,p.Hn)(_[1],_[2],n[1],n[2]),f=(0,p.Zn)();(0,p.di)(f,o,s,-d);let g=(0,p.Hn)(f[1],f[2],n[1],n[2]),v=.5*Math.PI,y=m>=-v&&m<=v,x=g>=-v&&g<=v,b,w;if(y&&x){let t=this.center.lng*Math.PI/180,i=this.center.lat*Math.PI/180;(0,p.rr)(u,t)+(0,p.rr)(m,i)<(0,p.rr)(d,t)+(0,p.rr)(g,i)?(b=u,w=m):(b=d,w=g)}else if(y)b=u,w=m;else{if(!x)return;b=d,w=g}let T=b/Math.PI*180,P=w/Math.PI*180,M=this.center.lat;this.setCenter(new p.ct(T,(0,p.Kn)(P,-90,90))),this.setZoom(this.zoom+t0(M,this.center.lat))}locationToScreenPoint(t,i){let r=tH(t);if(i){let a=i.getElevationForLngLatZoom(t,this._helper._tileZoom);(0,p.pi)(r,r,1+a/p.lt)}return this._projectSurfacePointToScreen(r)}_projectSurfacePointToScreen(t){let i=(0,p.Qn)();return(0,p.ti)(i,[...t,1],this._globeViewProjMatrixF64),i[0]/=i[3],i[1]/=i[3],new p.Vi((.5*i[0]+.5)*this.width,(-(.5*i[1])+.5)*this.height)}screenPointToMercatorCoordinate(t,i){if(i){let r=i.pointCoordinate(t);if(r)return r}return p.tt.fromLngLat(this.unprojectScreenPoint(t))}screenPointToLocation(t,i){return this.screenPointToMercatorCoordinate(t,i)?.toLngLat()}screenPointToLocationAtElevation(t,i){return this.screenPointToLocation(t)}
799isPointOnMapSurface(t,i){let r=this._cameraPosition,a=this.getRayDirectionFromPixel(t);return!!this.rayPlanetIntersection(r,a)}getRayDirectionFromPixel(t){let i=(0,p.Qn)();i[0]=t.x/this.width*2-1,i[1]=-((t.y/this.height*2-1)*1),i[2]=1,i[3]=1,(0,p.ti)(i,i,this._globeViewProjMatrixF64Inverted),i[0]/=i[3],i[1]/=i[3],i[2]/=i[3];let r=(0,p.Zn)();r[0]=i[0]-this._cameraPosition[0],r[1]=i[1]-this._cameraPosition[1],r[2]=i[2]-this._cameraPosition[2];let a=(0,p.Zn)();return(0,p.li)(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=(0,p.Qn)();return(0,p.ti)(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}rayPlanetIntersection(t,i){let r=(0,p.ai)(t,i),a=(0,p.Zn)(),o=(0,p.Zn)();(0,p.pi)(o,i,r),(0,p.hi)(a,t,o);let s=1-(0,p.ai)(a,a);if(s<0)return null;let n=(0,p.ai)(t,t)-1,l=-r+(r<0?1:-1)*Math.sqrt(s),h=n/l;return{tMin:Math.min(h,l),tMax:Math.max(h,l)}}unprojectScreenPoint(t){var i,r;let a,o,s,n=this._cameraPosition,l=this.getRayDirectionFromPixel(t),h=this.rayPlanetIntersection(n,l);if(h){let t=(0,p.Zn)();(0,p.ni)(t,n,[l[0]*h.tMin,l[1]*h.tMin,l[2]*h.tMin]);let i=(0,p.Zn)();return(0,p.li)(i,t),tK(i)}let c=this._cachedClippingPlane,u=c[0]*l[0]+c[1]*l[1]+c[2]*l[2],d=-(0,p.Er)(c,n)/u,_=(0,p.Zn)();if(d>0)(0,p.ni)(_,n,[l[0]*d,l[1]*d,l[2]*d]);else{let t=(0,p.Zn)();(0,p.ni)(t,n,[2*l[0],2*l[1],2*l[2]]);let i=(0,p.Er)(this._cachedClippingPlane,t);(0,p.hi)(_,t,[this._cachedClippingPlane[0]*i,this._cachedClippingPlane[1]*i,this._cachedClippingPlane[2]*i])}let m=((a=(0,p.Zn)())[0]=-(c[0]*c[3]),a[1]=-(c[1]*c[3]),a[2]=-(c[2]*c[3]),{center:a,radius:Math.sqrt(1-c[3]*c[3])});return tK((i=m.center,r=m.radius,o=(0,p.Zn)(),(0,p.hi)(o,_,i),s=(0,p.Zn)(),(0,p.mi)(s,i,o,r/(0,p.oi)(o)),s))}getProjectionDataForCustomLayer(t=!0){let i=this.getProjectionData({overscaledTileID:new p.g(0,0,0,0,0),applyGlobeMatrix:t});return i.tileMercatorCoords=[0,0,1,1],i}getFastPathSimpleProjectionMatrix(t){}},ie=class t{get pixelsToClipSpaceMatrix(){return this._helper.pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._helper.clipSpaceToPixelsMatrix}get pixelsToGLUnits(){return this._helper.pixelsToGLUnits}get centerOffset(){return this._helper.centerOffset}get size(){return this._helper.size}get rotationMatrix(){return this._helper.rotationMatrix}get centerPoint(){return this._helper.centerPoint}get pixelsPerMeter(){return this._helper.pixelsPerMeter}setMinZoom(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=(t,i)=>this.currentTransform.defaultConstrain(t,i),this.applyConstrain=(t,i)=>this._helper.applyConstrain(t,i),this._helper=new tA({calcMatrices:()=>this._calcMatrices(),defaultConstrain:(t,i)=>this.defaultConstrain(t,i)},t),this._globeness=1,this._mercatorTransform=new tB,this._verticalPerspectiveTransform=new t7}clone(){let i=new t;return i._globeness=this._globeness,i.apply(this,!1),i}apply(t,i){this._helper.apply(t,i),this._mercatorTransform.apply(this,!1),this._verticalPerspectiveTransform.apply(this,!1)}get projectionMatrix(){return this.currentTransform.projectionMatrix}get modelViewProjectionMatrix(){return this.currentTransform.modelViewProjectionMatrix}get inverseProjectionMatrix(){return this.currentTransform.inverseProjectionMatrix}get cameraPosition(){return this.currentTransform.cameraPosition}getProjectionData(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){return this.currentTransform.isLocationOccluded(t)}transformLightDirection(t){return this.currentTransform.transformLightDirection(t)}getPixelScale(){return(0,p.br)(this._mercatorTransform.getPixelScale(),this._verticalPerspectiveTransform.getPixelScale(),this._globeness)}getCircleRadiusCorrection(){return(0,p.br)(this._mercatorTransform.getCircleRadiusCorrection(),this._verticalPerspectiveTransform.getCircleRadiusCorrection(),this._globeness)}getPitchedTextCorrection(t,i,r){let a=this._mercatorTransform.getPitchedTextCorrection(t,i,r),o=this._verticalPerspectiveTransform.getPitchedTextCorrection(t,i,r);return(0,p.br)(a,o,this._globeness)}projectTileCoordinates(t,i,r,a){return this.currentTransform.projectTileCoordinates(t,i,r,a)}_calcMatrices(){this._helper._width&&this._helper._height&&(this._verticalPerspectiveTransform.apply(this,!1),this._helper._nearZ=this._verticalPerspectiveTransform.nearZ,this._helper._farZ=this._verticalPerspectiveTransform.farZ,this._mercatorTransform.apply(this,!0,this.isGlobeRendering),this._helper._nearZ=this._mercatorTransform.nearZ,this._helper._farZ=this._mercatorTransform.farZ)}calculateFogMatrix(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._helper.getCameraAltitude()}getCameraLngLat(){return this._helper.getCameraLngLat()}lngLatToCameraDepth(t,i){return this.currentTransform.lngLatToCameraDepth(t,i)}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)}setLocationAtPoint(t,i,r){if(!this.isGlobeRendering){this._mercatorTransform.setLocationAtPoint(t,i,r),this.apply(this._mercatorTransform,!1);return}this._verticalPerspectiveTransform.setLocationAtPoint(t,i,r),this.apply(this._verticalPerspectiveTransform,!1)}locationToScreenPoint(t,i){return this.currentTransform.locationToScreenPoint(t,i)}screenPointToMercatorCoordinate(t,i){return this.currentTransform.screenPointToMercatorCoordinate(t,i)}screenPointToLocation(t,i){return this.currentTransform.screenPointToLocation(t,i)}screenPointToLocationAtElevation(t,i){return this.currentTransform.screenPointToLocationAtElevation(t,i)}
799isPointOnMapSurface(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)}},it=class t{get useGlobeControls(){return!0}handlePanInertia(t,i){let r,a,o,s,n=(r=t.rotate(i.bearingInRadians),a=i.zoom+t0(i.center.lat,0),o=(0,p.br)(1/tQ(i.center.lat),1/tQ(Math.min(Math.abs(i.center.lat),60)),(0,p.Ar)(a,7,3,0,1)),s=360/tW({worldSize:i.worldSize,center:{lat:i.center.lat}}),new p.ct(i.center.lng-r.x*s*o,(0,p.Kn)(i.center.lat+r.y*s,-p.Vn,p.Vn)));return Math.abs(n.lng-i.center.lng)>180&&(n.lng=i.center.lng+179.5*Math.sign(n.lng-i.center.lng)),{easingCenter:n,easingOffset:new p.Vi(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 o=i.zoom;t.zoomDelta&&i.setZoom(i.zoom+t.zoomDelta);let s=i.zoom-o;if(0===s)return;let n=(0,p.nr)(i.center.lng,a.lng),l=n/(Math.abs(n/180)+1),h=(0,p.nr)(i.center.lat,a.lat),c=i.getRayDirectionFromPixel(r),u=i.cameraPosition,d=-1*(0,p.ai)(u,c),_=(0,p.Zn)();
799(0,p.ni)(_,u,[c[0]*d,c[1]*d,c[2]*d]);let m=(0,p.si)(_),f=Math.exp(-(.5*Math.max(m-1-.3,0))),g=(0,p.Ar)(m,.95,.999,0,1),v=tX(i.worldSize,i.center.lat)/Math.min(i.width,i.height),y=(0,p.Ar)(v,.9,.5,1,.25),x=Math.min(f,(0,p.br)(1,y,g)),b=(1-(0,p.Vr)(-s))*x,w=i.center.lat,T=i.zoom,P=new p.ct(i.center.lng+l*b,(0,p.Kn)(i.center.lat+h*b,-p.Vn,p.Vn));i.setLocationAtPoint(a,r);let M=i.center,I=Math.max((0,p.Ar)(Math.abs(n),45,85,0,1),g)**.25,S=(0,p.nr)(M.lng,P.lng),C=(0,p.nr)(M.lat,P.lat);i.setCenter(new p.ct(M.lng+S*I,M.lat+C*I).wrap()),i.setZoom(T+t0(w,i.center.lat))}handleMapControlsPan(t,i,r){t.panDelta&&function(t,i,r,a,o=!0){var s,n,l,h,c,u,d;let _,m,f,g,v,y,x,b,w,T,P,M,I,S,C=tJ(t,r),E=i;if(a)E=tJ(t,r.sub(a));else if(!t.isPointOnMapSurface(r))return;let z=tH(C),R=tH(E),D=(s=t.center,n=t.bearing,(0,p.Yr)((0,p.Qn)(),-s.lng,-s.lat,n)),A=(0,p.ii)((0,p.Zn)(),R,z),L=Math.sqrt((0,p.ai)(A,A)),F=Math.acos((0,p.Kn)((0,p.ai)(R,z),-1,1))/2,k=Math.sin(F),B=L?(0,p.Xr)(A[1]/L*k,-A[0]/L*k,A[2]/L*k,Math.cos(F)):(0,p.Xr)(0,0,0,1),{lng:j,lat:O,bearing:N}=(P=(l=(0,p.Zr)((0,p.Qn)(),D,B))[0],M=l[1],I=l[2],{lng:-(180*Math.atan2(2*((S=l[3])*P+M*I),1-2*(P*P+M*M)))/Math.PI,lat:-(180*Math.asin((0,p.Kn)(2*(S*M-I*P),-1,1)))/Math.PI,bearing:180*Math.atan2(2*(S*I+P*M),1-2*(M*M+I*I))/Math.PI}),Z=t.center.lat,U=(0,p.Kn)(O,-90,90),V=o?(h=t,c=r,u=a,d=j,_=h.center.lng,f=(m=h.center.lat)>=0?90:-90,g=h.locationToScreenPoint(new p.ct(0,f)),v=c.x-g.x,y=c.y-g.y,b=(x=(0,p.Kn)(1-(p.Vn-Math.abs(m))/12,0,1))*x*(3-2*x),w=(0,p.Sr)(d-_+180,360)-180,T=0,b>0&&u&&(T=(f>0?1:-1)*((v*u.y-y*u.x)/Math.max(v*v+y*y,400))*180/Math.PI),_+(1-b)*w+b*T):j;t.setCenter(new p.ct((0,p.Br)(V,-180,180),U)),o||t.setBearing(N),t.setZoom(t.zoom+t0(Z,t.center.lat))}(i,r,t.around,t.panDelta)}cameraForBoxAndBearing(i,r,a,o,s){let n=tN(i,r,a,o,s),l=r.left/s.width*2-1,h=(s.width-r.right)/s.width*2-1,c=-(r.top/s.height*2)+1,u=-((s.height-r.bottom)/s.height*2)+1,d=0>(0,p.nr)(a.getWest(),a.getEast()),_=d?a.getEast():a.getWest(),m=d?a.getWest():a.getEast(),f=Math.max(a.getNorth(),a.getSouth()),g=Math.min(a.getNorth(),a.getSouth()),v=_+.5*(0,p.nr)(_,m),y=f+.5*(0,p.nr)(f,g),x=s.clone();x.setCenter(n.center),x.setBearing(n.bearing),x.setPitch(0),x.setRoll(0),x.setZoom(n.zoom);let b=x.modelViewProjectionMatrix,w=[tH(a.getNorthWest()),tH(a.getNorthEast()),tH(a.getSouthWest
799()),tH(a.getSouthEast()),tH(new p.ct(m,y)),tH(new p.ct(_,y)),tH(new p.ct(v,f)),tH(new p.ct(v,g))],T=tH(n.center),P=1/0;for(let i of w)l<0&&(P=t.getLesserNonNegativeNonNull(P,t.solveVectorScale(i,T,b,"x",l))),h>0&&(P=t.getLesserNonNegativeNonNull(P,t.solveVectorScale(i,T,b,"x",h))),c>0&&(P=t.getLesserNonNegativeNonNull(P,t.solveVectorScale(i,T,b,"y",c))),u<0&&(P=t.getLesserNonNegativeNonNull(P,t.solveVectorScale(i,T,b,"y",u)));return Number.isFinite(P)&&0!==P?(n.zoom=Math.min(x.zoom+(0,p.Nr)(P),i.maxZoom),n):void tj()}handleJumpToCenterZoom(t,i){let r=t.center.lat,a=t.applyConstrain(i.center?p.ct.convert(i.center):t.center,t.zoom).center;t.setCenter(a.wrap());let o=void 0===i.zoom?t.zoom+t0(r,a.lat):+i.zoom;t.zoom!==o&&t.setZoom(o)}handleEaseTo(t,i){let r=t.zoom,a=t.center,o=t.padding,s={roll:t.roll,pitch:t.pitch,bearing:t.bearing},n={roll:void 0===i.roll?t.roll:i.roll,pitch:void 0===i.pitch?t.pitch:i.pitch,bearing:void 0===i.bearing?t.bearing:i.bearing},l=void 0!==i.zoom,h=!t.isPaddingEqual(i.padding),c=!1,u=i.center?p.ct.convert(i.center):a,d=t.applyConstrain(u,r).center;tR(t,d);let _=t.clone();_.setCenter(d),_.setZoom(l?+i.zoom:r+t0(a.lat,u.lat)),_.setBearing(i.bearing);let m=new p.Vi((0,p.Kn)(t.centerPoint.x+i.offsetAsPoint.x,0,t.width),(0,p.Kn)(t.centerPoint.y+i.offsetAsPoint.y,0,t.height));_.setLocationAtPoint(d,m);let f=(i.offset&&i.offsetAsPoint.mag())>0?_.center:d,g=l?+i.zoom:r+t0(a.lat,f.lat),v=r+t0(a.lat,0),y=g+t0(f.lat,0),x=(0,p.nr)(a.lng,f.lng),b=(0,p.nr)(a.lat,f.lat),w=(0,p.Vr)(y-v);return{easeFunc:r=>{if((0,p.jr)(s,n)||tO({startEulerAngles:s,endEulerAngles:n,tr:t,k:r,useSlerp:s.roll!=n.roll}),h&&t.interpolatePadding(o,i.padding,r),i.around)(0,p.zr)("Easing around a point is not supported under globe projection."),t.setLocationAtPoint(i.around,i.aroundPoint);else{let i=t2(a,x,b,r*(y>v?Math.min(2,w):Math.max(.5,w))**(1-r));t.setCenter(i.wrap())}if(c){let i=p.bn.number(v,y,r)+t0(0,t.center.lat);t.setZoom(i)}},isZooming:c=g!==r,elevationCenter:f}}handleFlyTo(t,i){let r,a,o=void 0!==i.zoom,s=t.center,n=t.zoom,l=t.padding,h=!t.isPaddingEqual(i.padding),c=t.applyConstrain(p.ct.convert(i.center||i.locationAtOffset),n).center,u=o?+i.zoom:t.zoom+t0(t.center.lat,c.lat),d=t.clone();d.setCenter(c),d.setZoom(u),d.setBearing(i.bearing);let _=new p.Vi((0,p.Kn)(t.centerPoint.x+i.offsetAsPoint.x,0,t.width),(0,p.Kn)(t.centerPoint.y+i.offsetAsPoint.y,0,t.height));d.setLocationAtPoint(c,_);let m=d.center;tR(t,m);let f=(r=tH(s),a=tH(m),Math.acos((0,p.ai)(r,a))/(2*Math.PI)*tW(t)),g=n+t0(s.lat,0),v=u+t0(m.lat,0),y=(0,p.Vr)(v-g),x=Math.min(Math.max("number"==typeof i.minZoom?+i.minZoom:t.minZoom,t.minZoom)+t0(m.lat,0),g,v)+t0(0,m.lat),b=t.applyConstrain(m,x).zoom+t0(m.lat,0),w=(0,p.Vr)(b-g),T=(0,p.nr)(s.lng,m.lng),P=(0,p.nr)(s.lat,m.lat);return{easeFunc:(r,a,o,n)=>{let c=t2(s,T,P,o);h&&t.interpolatePadding(l,i.padding,r);let d=1===r?m:c;t.setCenter(d.wrap());let _=g+(0,p.Nr)(a);t.setZoom(1===r?u:_+t0(0,d.lat))},scaleOfZoom:y,targetCenter:m,scaleOfMinZoom:w,pixelPathLength:f}}static solveVectorScale(t,i,r,a,o){let s="x"===a?[r[0],r[4],r[8],r[12]]:[r[1],r[5],r[9],r[13]],n=[r[3],r[7],r[11],r[15]],l=t[0]*s[0]+t[1]*s[1]+t[2]*s[2],h=t[0]*n[0]+t[1]*n[1]+t[2]*n[2],c=i[0]*s[0]+i[1]*s[1]+i[2]*s[2],u=i[0]*n[0]+i[1]*n[1]+i[2]*n[2],d=(c+s[3]-o*u-o*n[3])/(c-l-o*u+o*h);return c+o*h===l+o*u||n[3]*(l-c)+s[3]*(u-h)+l*u==c*h?null:d}static getLesserNonNegativeNonNull(t,i){return null!==i&&i>=0&&i<t?i:t}},ii=class{constructor(t){this._globe=t,this._mercatorCameraHelper=new tZ,this._verticalPerspectiveCameraHelper=new it}get useGlobeControls(){return this._globe.useGlobeRendering}get currentHelper(){return this.useGlobeControls?this._verticalPerspectiveCameraHelper:this._mercatorCameraHelper}handlePanInertia(t,i){return this.currentHelper.handlePanInertia(t,i)}handleMapControlsRollPitchBearingZoom(t,i){this.currentHelper.handleMapControlsRollPitchBearingZoom(t,i)}handleMapControlsPan(t,i,r){this.currentHelper.handleMapControlsPan(t,i,r)}cameraForBoxAndBearing(t,i,r,a,o){return this.currentHelper.cameraForBoxAndBearing(t,i,r,a,o)}handleJumpToCenterZoom(t,i){this.currentHelper.handleJumpToCenterZoom(t,i)}handleEaseTo(t,i){return this.currentHelper.handleEaseTo(t,i)}handleFlyTo(t,i){return this.currentHelper.handleFlyTo(t,i)}};let ir=(0,p._n)();var ia=class extends p.wn{constructor(t,i={}){super(),this._rtlPluginLoaded=()=>{for(let t in this.tileManagers){let i=this.tileManagers[t].getSource().type;("vector"===i||"geojson"===i)&&this.tileManagers[t].reload()}},this.map=t,this.dispatcher=new et(c||=new Q,t._getMapId()),this.dispatcher.registerMessageHandler("GG",(t,i)=>this.getGlyphs(t,i)),this.dispatcher.registerMessageHandler("GI",(t,i)=>this.getImages(t,i)),this.dispatcher.registerMessageHandler("GDA",(t,i)=>this.getDashes(t,i)),this.imageManager=new j,this.imageManager.setEventedParent(this),this.imageManager.setMissingImageResolver(t._missingStyleImageResolver),this.patternAtlas=new O(this.imageManager);let r=t._container?.lang||"u">typeof document&&document.documentElement?.lang||void 0;this.glyphManager=new W(t._requestManager,i.localIdeographFontFamily,r),this.lineAtlas=new X(256,512),this.crossTileSymbolIndex=new tg,this._setInitialValues(),this._resetUpdates(),this.dispatcher.broadcast("SR",(0,p.kn)()),eP().on(eb,this._rtlPluginLoaded),this.on("data",t=>{if("source"!==t.dataType||"metadata"!==t.sourceDataType)return;let i=this.tileManagers[t.sourceId];if(!i)return;let r=i.getSource();if(r?.vectorLayerIds)for(let t in this._layers){let i=this._layers[t];
799i.source===r.id&&this._validateLayer(i)}})}_setInitialValues(){this._layers={},this._order=[],this.tileManagers={},this.zoomHistory=new p.in,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.crossTileSymbolIndex=new(this.crossTileSymbolIndex?.constructor||Object),this.pauseablePlacement=void 0,this.placement=void 0,this.z=0}setGlobalStateProperty(t,i){this._checkLoaded();let r=null===i?this.stylesheet.state?.[t]?.default??null:i;if((0,p.$n)(r,this._globalState[t]))return this;this._globalState[t]=r,this._applyGlobalStateChanges([t])}getGlobalState(){return this._globalState}setGlobalState(t){this._checkLoaded();let i=[];for(let r in t)(0,p.$n)(this._globalState[r],t[r].default)||(i.push(r),this._globalState[r]=t[r].default);this._applyGlobalStateChanges(i)}_applyGlobalStateChanges(t){if(0===t.length)return;let i=new Set,r={};for(let a of t)for(let t in r[a]=this._globalState[a],this._layers){let r=this._layers[t],o=r.getLayoutAffectingGlobalStateRefs(),s=r.getPaintAffectingGlobalStateRefs(),n=r.getVisibilityAffectingGlobalStateRefs();if(o.has(a)&&i.add(r.source),s.has(a))for(let{name:t,value:i}of s.get(a))this._updatePaintProperty(r,t,i);n?.has(a)&&(r.recalculateVisibility(),this._updateLayer(r))}for(let t in this.dispatcher.broadcast("UGS",r),this.tileManagers)i.has(t)&&(this._reloadSource(t),this._changed=!0)}async loadURL(t,i={},r){this.fire(new P("dataloading")),i.validate="boolean"!=typeof i.validate||i.validate,this._loadStyleRequest=new AbortController;let a=this._loadStyleRequest;try{let o=await this.map._requestManager.transformRequest(t,"Style");(0,p.zn)(a.signal);let s=await (0,p.On)(o,a);this._loadStyleRequest===a&&(this._loadStyleRequest=null),this._load(s.data,i,r)}catch(t){this._loadStyleRequest===a&&(this._loadStyleRequest=null),t&&!a.signal.aborted&&this.fire(new p.Sn((0,p.ir)(t)))}}loadJSON(t,i={},r){this.fire(new P("dataloading")),this._frameRequest=new AbortController,f.frameAsync(this._frameRequest,this.map._ownerWindow).then(()=>{this._frameRequest=null,i.validate=!1!==i.validate,this._load(t,i,r)}).catch(()=>{})}loadEmpty(){this.fire(new P("dataloading")),this._load(ir,{validate:!1})}_load(t,i,r){let a=i.transformStyle?i.transformStyle(r,t):t;if(!(i.validate&&(0,p.un)(this,a))){for(let t in a={...a},this._loaded=!0,this.stylesheet=a,a.sources)this.addSource(t,a.sources[t],{validate:!1});a.sprite?this._loadSprite(a.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(a.glyphs),this._createLayers(),this.light=new $(this.stylesheet.light??{},this._globalState),this._setProjectionInternal(this.stylesheet.projection?.type||"mercator"),this.sky=new H(this.stylesheet.sky,this._globalState),this.map.setTerrain(this.stylesheet.terrain??null,{validate:!1}),this.fire(new P("data")),this.fire(new T)}}_createLayers(){let t=(0,p.hn)(this.stylesheet.layers);for(let i of(this.setGlobalState(this.stylesheet.state??null),this.dispatcher.broadcast("SL",t),this._order=t.map(t=>t.id),this._layers={},this._serializedLayers=null,t)){let t=(0,p.S)(i,this._globalState);if(t.setEventedParent(this,{layer:{id:i.id}}),this._layers[i.id]=t,(0,p.Xt)(t)&&this.tileManagers[t.source]){let r=i.paint?.["raster-fade-duration"]??t.paint.get("raster-fade-duration");this.tileManagers[t.source].setRasterFadeDuration(r)}}}async _loadSprite(t,i=!1,r){let a;this.imageManager.setLoaded(!1);let o=new AbortController;this._spriteRequest=o;try{let r=await k(t,this.map._requestManager,this.map.getPixelRatio(),o);if(!r)return;for(let t in r){let{loaded:a,removed:o}=this.imageManager.setSpriteImages(t,r[t]);this._markImagesChanged(o),i&&this._markImagesChanged(a)}}catch(t){a=t,o.signal.aborted||this.fire(new p.Sn(a))}finally{this._spriteRequest=null,this.imageManager.setLoaded(!0),i&&(this._changed=!0),this.dispatcher.broadcast("SI",this.imageManager.listImages()),this.fire(new P("data")),r?.(a)}}_unloadSprite(){this._markImagesChanged(this.imageManager.removeAllSpriteImages()),this._imagesListDirty=!0,this._changed=!0,this.fire(new P("data"))}_validateLayer(t){let i=this.tileManagers[t.source];if(!i)return;let r=t.sourceLayer;if(!r)return;let a=i.getSource();("geojson"===a.type||a.vectorLayerIds&&!a.vectorLayerIds.includes(r))&&this.fire(new p.Sn(Error(`Source layer "${r}" does not exist on source "${a.id}" as specified by style layer "${t.id}".`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(let t in this.tileManagers)if(!this.tileManagers[t].loaded())return!1;return this.imageManager.isLoaded()}_serializeByIds(t,i=!1){let r=this._serializedAllLayers();if(!t||0===t.length)return Object.values(i?(0,p.qn)(r):r);let a=[];for(let o of t)if(r[o]){let t=i?(0,p.qn)(r[o]):r[o];a.push(t)}return a}_serializedAllLayers(){let t=this._serializedLayers;if(t)return t;for(let i of(t=this._serializedLayers={},Object.keys(this._layers))){let r=this._layers[i];"custom"!==r.type&&(t[i]=r.serialize())}return t}hasTransitions(){if(this.light?.hasTransition()||this.sky?.hasTransition()||this.projection?.hasTransition())return!0;for(let t in this.tileManagers)if(this.tileManagers[t].hasTransition())return!0;for(let t in this._layers)if(this._layers[t].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw Error("Style is not done loading.")}update(t){if(!this._loaded)return;let i=this._changed;if(i){this._imagesListDirty&&=(this.dispatcher.broadcast("SI",this.imageManager.listImages()),!1);let i=Object.keys(this._updatedLayers),r=Object.keys(this._removedLayers);for(let t in(i.length||r.length)&&this._updateWorkerLayers(i,r),this._updatedSources){let i=this._updatedSources[t];if("reload"===i)this._reloadSource(t);else if("clear"===i)this._clearSource(t);else throw Error(`Invalid action ${i}`)}for(let i in this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs(),this._updatedPaintProps)this._layers[i].updateTransitions(t);this.light.updateTransitions(t),this.sky.updateTransitions(t),this._resetUpdates()}let r={};for(let t in this.tileManagers){let i=this.tileManagers[t];r[t]=i.used,i.used=!1}let a=this.imageManager.listImages();for(let i of this._order){let r=this._layers[i];r.recalculate(t,a),!r.isHidden(t.zoom)&&r.source&&(this.tileManagers[r.source].used=!0)}for(let t in r){let i=this.tileManagers[t];!!r[t]!=!!i.used&&i.fire(new M("data",{sourceDataType:"visibility",sourceId:t}))}this.light.recalculate(t),this.sky.recalculate(t),this.projection.recalculate(t),this.z=t.zoom,i&&this.fire(new P("data"))}_updateTilesForChangedImages(){let t=Object.keys(this._changedImages);if(t.length){for(let i in this.tileManagers)this.tileManagers[i].reloadTilesForDependencies(["icons","patterns"],t);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(let t in this.tileManagers)this.tileManagers[t].reloadTilesForDependencies(["glyphs"],[""]);this._glyphsDidChange=!1}}_updateWorkerLayers(t,i){this.dispatcher.broadcast("UL",{layers:this._serializeByIds(t,!1),removedIds:i})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(t,i={}){this._checkLoaded();let r=this.serialize();if(t=i.transformStyle?i.transformStyle(r,t):t,(i.validate??!0)&&(0,p.un)(this,t))return!1;(t=(0,p.qn)(t)).layers=(0,p.hn)(t.layers);
vendor: 1,044 bytes, line 799
799let a=(0,p.gn)(r,t),o=this._getOperationsToPerform(a);if(o.unimplemented.length>0)throw Error(`Unimplemented: ${o.unimplemented.join(", ")}.`);if(0===o.operations.length)return!1;for(let t of o.operations)t();return this.stylesheet=t,this._serializedLayers=null,this.fire(new T({style:this})),!0}_getOperationsToPerform(t){let i=[],r=[];for(let a of t)switch(a.command){case"setCenter":case"setZoom":case"setBearing":case"setPitch":case"setRoll":continue;case"addLayer":i.push(()=>this.addLayer.apply(this,a.args));break;case"removeLayer":i.push(()=>this.removeLayer.apply(this,a.args));break;case"setPaintProperty":i.push(()=>this.setPaintProperty.apply(this,a.args));break;case"setLayoutProperty":i.push(()=>this.setLayoutProperty.apply(this,a.args));break;case"setFilter":i.push(()=>this.setFilter.apply(this,a.args));break;case"addSource":i.push(()=>this.addSource.apply(this,a.args));break;case"removeSource":i.push(()=>this.removeSource.apply(this,a.args));break;case"setLayerZoomRange":i.push(()=>this.setLayerZoomRange.apply(this,a.args
799));break;case"setLight":i.push(()=>this.setLight.apply(this,a.args));break;case"setGeoJSONSourceData":i.push(()=>this.setGeoJSONSourceData.apply(this,a.args));break;case"setGlyphs":i.push(()=>this.setGlyphs.apply(this,a.args));break;case"setSprite":i.push(()=>this.setSprite.apply(this,a.args));break;case"setTerrain":i.push(()=>this.map.setTerrain.apply(this,a.args));break;case"setSky":i.push(()=>this.setSky.apply(this,a.args));break;case"setProjection":this.setProjection.apply(this,a.args);break;case"setGlobalState":i.push(()=>this.setGlobalState.apply(this,a.args));break;case"setTransition":i.push(()=>{});break;default:r.push(a.command)}return{operations:i,unimplemented:r}}addImage(t,i){if(this.getImage(t))return void this.fire(new p.Sn(Error(`An image named "${t}" already exists.`)));this.imageManager.addImage(t,i),this._afterImageUpdated(t)}updateImage(t,i){this.imageManager.updateImage(t,i)}getImage(t){return this.imageManager.getImage(t)}setMissingImageResolver(t){this.imageManager.setMissingImageResolver(t)}removeImage(t){if(!this.getImage(t))return void this.fire(new p.Sn(Error(`An image named "${t}" does not exist.`)));this.imageManager.removeImage(t),this._afterImageUpdated(t)}_markImagesChanged(t){for(let i of t)this._changedImages[i]=!0}_afterImageUpdated(t){this._changedImages[t]=!0,this._imagesListDirty=!0,this._changed=!0,this.fire(new P("data"))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(t,i,r={}){if(this._checkLoaded(),void 0!==this.tileManagers[t])throw Error(`Source "${t}" already exists.`);if(!i.type)throw Error(`The type property must be defined, but only the following properties were given: ${Object.keys(i).join(", ")}.`);if(p.on.has(i.type)&&this._validate(p.ln.source,`sources.${t}`,i,null,r))return;this.map?._collectResourceTiming&&(i.collectResourceTiming=!0);let a=this.tileManagers[t]=new eB(t,i,this.dispatcher);a.style=this,a.setEventedParent(this,()=>({isSourceLoaded:a.loaded(),source:a.serialize(),sourceId:t})),a.onAdd(this.map),this._changed=!0}removeSource(t){if(this._checkLoaded(),void 0===this.tileManagers[t])throw Error(`There is no source with this ID=${t}`);for(let i in this._layers)if(this._layers[i].source===t)return this.fire(new p.Sn(Error(`Source "${t}" cannot be removed while layer "${i}" is using it.`)));let i=this.tileManagers[t];delete this.tileManagers[t],delete this._updatedSources[t],i.fire(new M("data",{sourceDataType:"metadata",sourceId:t})),i.setEventedParent(null),i.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(t,i){if(this._checkLoaded(),void 0===this.tileManagers[t])throw Error(`There is no source with this ID=${t}`);let r=this.tileManagers[t].getSource();if("geojson"!==r.type)throw Error(`geojsonSource.type is ${r.type}, which is !== 'geojson`);r.setData(i),this._changed=!0}getSource(t){return this.tileManagers[t]?.getSource()}addLayer(t,i,r={}){let a;this._checkLoaded();let o=t.id;if(this.getLayer(o))return void this.fire(new p.Sn(Error(`Layer "${o}" already exists on this map.`)));if("custom"===t.type){if((0,p.sn)(this,(0,p.w)(t)))return;a=(0,p.S)(t,this._globalState)}else{if("source"in t&&"object"==typeof t.source&&(this.addSource(o,t.source),t=(0,p.qn)(t),t=(0,p.or)(t,{source:o})),this._validate(p.ln.layer,`layers.${o}`,t,{arrayIndex:-1},r))return;a=(0,p.S)(t,this._globalState),this._validateLayer(a),a.setEventedParent(this,{layer:{id:o}})}let s=i?this._order.indexOf(i):this._order.length;if(i&&-1===s)return void this.fire(new p.Sn(Error(`Cannot add layer "${o}" before non-existing layer "${i}".`)));if(this._order.splice(s,0,o),this._layerOrderChanged=!0,this._layers[o]=a,this._removedLayers[o]&&a.source&&"custom"!==a.type){let t=this._removedLayers[o];delete this._removedLayers[o],t.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(t,i){if(this._checkLoaded(),this._changed=!0,!this._layers[t])return void this.fire(new p.Sn(Error(`The layer '${t}' does not exist in the map's style and cannot be moved.`)));if(t===i)return;let r=this._order.indexOf(t);this._order.splice(r,1);let a=i?this._order.indexOf(i):this._order.length;if(i&&-1===a)return void this.fire(new p.Sn(Error(`Cannot move layer "${t}" before non-existing layer "${i}".`)));this._order.splice(a,0,t),this._layerOrderChanged=!0}removeLayer(t){this._checkLoaded();let i=this._layers[t];
799if(!i)return void this.fire(new p.Sn(Error(`Cannot remove non-existing layer "${t}".`)));i.setEventedParent(null);let r=this._order.indexOf(t);this._order.splice(r,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[t]=i,delete this._layers[t],this._serializedLayers&&delete this._serializedLayers[t],delete this._updatedLayers[t],delete this._updatedPaintProps[t],i.onRemove&&i.onRemove(this.map)}getLayer(t){return this._layers[t]}getLayersOrder(){return[...this._order]}hasLayer(t){return t in this._layers}setLayerZoomRange(t,i,r){this._checkLoaded();let a=this.getLayer(t);if(!a)return void this.fire(new p.Sn(Error(`Cannot set the zoom range of non-existing layer "${t}".`)));(a.minzoom!==i||a.maxzoom!==r)&&(null!=i&&(a.minzoom=i),null!=r&&(a.maxzoom=r),this._updateLayer(a))}setFilter(t,i,r={}){this._checkLoaded();let a=this.getLayer(t);if(!a)return void this.fire(new p.Sn(Error(`Cannot filter non-existing layer "${t}".`)));if(!(0,p.$n)(a.filter,i)){if(null==i){a.setFilter(void 0),this._updateLayer(a);return}
799this._validate(p.ln.filter,`layers.${a.id}.filter`,i,null,r)||(a.setFilter((0,p.qn)(i)),this._updateLayer(a))}}getFilter(t){return(0,p.qn)(this.getLayer(t).filter)}setLayoutProperty(t,i,r,a={}){this._checkLoaded();let o=this.getLayer(t);if(!o)return void this.fire(new p.Sn(Error(`Cannot style non-existing layer "${t}".`)));(0,p.$n)(o.getLayoutProperty(i),r)||(o.setLayoutProperty(i,r,a),this._updateLayer(o))}getLayoutProperty(t,i){let r=this.getLayer(t);return r?r.getLayoutProperty(i):void this.fire(new p.Sn(Error(`Cannot get style of non-existing layer "${t}".`)))}setPaintProperty(t,i,r,a={}){this._checkLoaded();let o=this.getLayer(t);if(!o)return void this.fire(new p.Sn(Error(`Cannot style non-existing layer "${t}".`)));(0,p.$n)(o.getPaintProperty(i),r)||this._updatePaintProperty(o,i,r,a)}_updatePaintProperty(t,i,r,a={}){t.setPaintProperty(i,r,a)&&this._updateLayer(t),(0,p.Xt)(t)&&"raster-fade-duration"===i&&this.tileManagers[t.source].setRasterFadeDuration(r),this._changed=!0,this._updatedPaintProps[t.id]=!0,this._serializedLayers=null}getPaintProperty(t,i){return this.getLayer(t).getPaintProperty(i)}setFeatureState(t,i){this._checkLoaded();let r=t.source,a=t.sourceLayer,o=this.tileManagers[r];if(void 0===o)return void this.fire(new p.Sn(Error(`The source '${r}' does not exist in the map's style.`)));let s=o.getSource().type;if("geojson"===s&&a)return void this.fire(new p.Sn(Error("GeoJSON sources cannot have a sourceLayer parameter.")));if("vector"===s&&!a)return void this.fire(new p.Sn(Error("The sourceLayer parameter must be provided for vector source types.")));if(void 0===t.id)return void this.fire(new p.Sn(Error("The feature id parameter must be provided.")));let n=["__proto__","constructor","prototype"];if(i&&Object.keys(i).some(t=>n.includes(t)))return void this.fire(new p.Sn(Error(`The feature state should not include one of the following keys: ${n}`)));o.setFeatureState(a,t.id,i)}removeFeatureState(t,i){this._checkLoaded();let r=t.source,a=this.tileManagers[r];if(void 0===a)return void this.fire(new p.Sn(Error(`The source '${r}' does not exist in the map's style.`)));let o=a.getSource().type,s="vector"===o?t.sourceLayer:void 0;return"vector"!==o||s?i&&"string"!=typeof t.id&&"number"!=typeof t.id?void this.fire(new p.Sn(Error("A feature id is required to remove its specific state property."))):void a.removeFeatureState(s,t.id,i):void this.fire(new p.Sn(Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(t){this._checkLoaded();let i=t.source,r=t.sourceLayer,a=this.tileManagers[i];return void 0===a?void this.fire(new p.Sn(Error(`The source '${i}' does not exist in the map's style.`))):"vector"!==a.getSource().type||r?(void 0===t.id&&this.fire(new p.Sn(Error("The feature id parameter must be provided."))),a.getFeatureState(r,t.id)):void this.fire(new p.Sn(Error("The sourceLayer parameter must be provided for vector source types.")))}getTransition(){return(0,p.or)({duration:300,delay:0},this.stylesheet?.transition)}serialize(){if(!this._loaded)return;let t=(0,p.xr)(this.tileManagers,t=>t.serialize()),i=this._serializeByIds(this._order,!0),r=this.map.getTerrain()||void 0,a=this.stylesheet;return(0,p.sr)({version:a.version,name:a.name,metadata:a.metadata,light:a.light,sky:a.sky,center:a.center,zoom:a.zoom,bearing:a.bearing,pitch:a.pitch,sprite:a.sprite,glyphs:a.glyphs,transition:a.transition,projection:a.projection,sources:t,layers:i,terrain:r},t=>void 0!==t)}_updateLayer(t){this._updatedLayers[t.id]=!0,t.source&&!this._updatedSources[t.source]&&"raster"!==this.tileManagers[t.source].getSource().type&&(this._updatedSources[t.source]="reload",this.tileManagers[t.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(t){let i=t=>"fill-extrusion"===this._layers[t].type,r={},a=[];for(let o=this._order.length-1;o>=0;o--){let s=this._order[o];if(i(s))for(let i of(r[s]=o,t)){let t=i[s];if(t)for(let i of t)a.push(i)}}a.sort((t,i)=>i.intersectionZ-t.intersectionZ);let o=[];for(let s=this._order.length-1;s>=0;s--){let n=this._order[s];if(i(n))for(let t=a.length-1;t>=0;t--){let i=a[t].feature;if(r[i.layer.id]<s)break;o.push(i),a.pop()}else for(let i of t){let t=i[n];if(t)for(let i of t)o.push(i.feature)}}return o}
799queryRenderedFeatures(t,i,r){i?.filter&&this._validate(p.ln.filter,"queryRenderedFeatures.filter",i.filter,null,i);let a={};if(i?.layers){if(!(Array.isArray(i.layers)||i.layers instanceof Set))return this.fire(new p.Sn(Error("parameters.layers must be an Array or a Set of strings"))),[];for(let t of i.layers){let i=this._layers[t];if(!i)return this.fire(new p.Sn(Error(`The layer '${t}' does not exist in the map's style and cannot be queried for features.`))),[];a[i.source]=!0}}let o=[];i.availableImages=this.imageManager.listImages();let s=this._serializedAllLayers(),n=i.layers instanceof Set?i.layers:Array.isArray(i.layers)?new Set(i.layers):null,l={...i,layers:n,globalState:this._globalState};for(let n in this.tileManagers)i.layers&&!a[n]||o.push(function(t,i,r,a,o,s,n){let l=function(t,i,r){if(t)for(let a of t){let t=i[a];if(t?.source===r&&"fill-extrusion"===t.type)return!0}else for(let t in i){let a=i[t];if(a.source===r&&"fill-extrusion"===a.type)return!0}return!1}(o?.layers??null,i,t.id),h=s.maxPitchScaleFactor(),c=t.tilesIn(a,h,l);c.sort(ei);let u=[];for(let a of c)u.push({wrappedTileID:a.tileID.wrapped().key,queryResults:a.tile.queryRenderedFeatures(i,r,t.getState(),a.queryGeometry,a.cameraQueryGeometry,a.scale,o,s,h,function(t,i){let r=(0,p.Si)();return(0,p.Fi)(r,r,[1,1,0]),(0,p.Pi)(r,r,[.5*t.width,.5*t.height,1]),t.calculatePosMatrix?(0,p.Oi)(r,r,t.calculatePosMatrix(i.toUnwrapped())):r}(s,a.tileID),n?(t,i)=>n(a.tileID,t,i):void 0)});var d=function(t){let i={},r={};for(let{queryResults:a,wrappedTileID:o}of t){r[o]||={};let t=r[o];for(let r in a){let o=a[r];t[r]||={};let s=t[r];for(let t of(i[r]||=[],o))s[t.featureIndex]||(s[t.featureIndex]=!0,i[r].push(t))}}return i}(u),_=t;for(let t in d)for(let i of d[t])er(i,_);return d}(this.tileManagers[n],this._layers,s,t,l,r,this.map.terrain?(t,i,r)=>this.map.terrain.getElevation(t,i,r):void 0));return this.placement&&o.push(function(t,i,r,a,o,s,n){let l={},h=s.queryRenderedSymbols(a),c=[];for(let t of Object.keys(h).map(Number))c.push(n[t]);for(let r of(c.sort(ei),c)){let a=r.featureIndex.lookupSymbolFeatures(h[r.bucketInstanceId],i,r.bucketIndex,r.sourceLayerIndex,{filterSpec:o.filter,globalState:o.globalState},o.layers,o.availableImages,t);for(let t in a){l[t]||=[];let i=a[t];for(let a of(i.sort((t,i)=>{let a=r.featureSortOrder;if(a){let r=a.indexOf(t.featureIndex);return a.indexOf(i.featureIndex)-r}return i.featureIndex-t.featureIndex}),i))l[t].push(a)}}var u=l,d=t,_=r;for(let t in u)for(let i of u[t])er(i,_[d[t].source]);return u}(this._layers,s,this.tileManagers,t,l,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(o)}querySourceFeatures(t,i){i?.filter&&this._validate(p.ln.filter,"querySourceFeatures.filter",i.filter,null,i);let r=this.tileManagers[t];return r?function(t,i){let r=t.getRenderableIds().map(i=>t.getTileByID(i)),a=[],o={};for(let t of r){let r=t.tileID.canonical.key;o[r]||(o[r]=!0,t.querySourceFeatures(a,i))}return a}(r,i?{...i,globalState:this._globalState}:{globalState:this._globalState}):[]}getLight(){return this.light.getLight()}setLight(t,i={}){this._checkLoaded();let r=this.light.getLight(),a=!1;for(let i in t)if(!(0,p.$n)(t[i],r[i])){a=!0;break}if(!a)return;let o={now:v(),transition:(0,p.or)({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(t,i),this.light.updateTransitions(o)}getProjection(){return this.stylesheet?.projection}setProjection(t){this._checkLoaded();let i=t??{type:"mercator"};if(this.stylesheet.projection=t,this.projection){if(this.projection.name===i.type)return;this.projection.destroy(),delete this.projection}this._setProjectionInternal(i.type)}getSky(){return this.stylesheet?.sky}setSky(t,i={}){this._checkLoaded();let r=this.getSky(),a=!1;if(!t&&!r)return;if(t&&!r)a=!0;else if(!t&&r)a=!0;else for(let i in t)if(!(0,p.$n)(t[i],r[i])){a=!0;break}if(!a)return;let o={now:v(),transition:(0,p.or)({duration:300,delay:0},this.stylesheet.transition)};this.stylesheet.sky=t,this.sky.setSky(t,i),this.sky.updateTransitions(o)}_setProjectionInternal(t){let i=function(t,i,r){let a={constrainOverride:i};if(Array.isArray(t)){let i=new tq({type:t},r);return{projection:i,transform:new ie(a),cameraHelper:new ii(i)}}switch(t){case"mercator":return{projection:new tE,transform:new tB(a),cameraHelper:new tZ};case"globe":{let t=new tq({type:["interpolate",["linear"],["zoom"],11,"vertical-perspective",12,"mercator"]},{});return{projection:t,transform:new ie(a),cameraHelper:new ii(t)}}case"vertical-perspective":return{projection:new tG,transform:new t7(a),cameraHelper:new it};default:return(0,p.zr)(`Unknown projection name: ${t}. Falling back to mercator projection.`),{projection:new tE,transform:new tB(a),cameraHelper:new tZ}}}(t,this.map._camera?.transform.constrainOverride,this._globalState);for(let t in this.projection=i.projection,this.map.migrateProjection(i.transform,i.cameraHelper),this.tileManagers)this.tileManagers[t].reload()}_validate(t,i,r,a,o={}){return(0,p.cn)(this,t,{key:i,style:this.serialize(),value:r,...a},o)}_remove(t=!0){for(let t in this._frameRequest&&=(this._frameRequest.abort(),null),this._loadStyleRequest&&=(this._loadStyleRequest.abort(),null),this._spriteRequest&&=(this._spriteRequest.abort(),null),eP().off(eb,this._rtlPluginLoaded),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),t&&this.dispatcher.broadcast("RM",void 0),this.dispatcher.remove(t)}_clearSource(t){this.tileManagers[t].clearTiles()}_reloadSource(t){this.tileManagers[t].resume(),this.tileManagers[t].reload()}_updateSources(t){for(let i in this.tileManagers)this.tileManagers[i].update(t,this.map.terrain)}_generateCollisionBoxes(){for(let t in this.tileManagers)this._reloadSource(t)}_updatePlacement(t,i,r,a,o=!1){let s=!1,n=!1,l={};for(let i of this._order){let r=this._layers[i];if("symbol"!==r.type)continue;if(!l[r.source]){let t=this.tileManagers[r.source];l[r.source]=t.getRenderableIds(!0).map(i=>t.getTileByID(i)).sort((t,i)=>i.tileID.overscaledZ-t.tileID.overscaledZ||(t.tileID.isLessThan(i.tileID)?-1:1))}let a=this.crossTileSymbolIndex.addLayer(r,l[r.source],t.center.lng);s||=a}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((o||=this._layerOrderChanged||0===r)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(v(),t.zoom))&&(this.pauseablePlacement=new ts(t,this.map.terrain,this._order,o,i,r,a,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,l),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(v()),n=!0),s&&this.pauseablePlacement.placement.setStale()),n||s)for(let t of this._order){let i=this._layers[t];"symbol"===i.type&&this.placement.updateLayerOpacities(i,l[i.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(v())}_releaseSymbolFadeTiles(){for(let t in this.tileManagers)this.tileManagers[t].releaseSymbolFadeTiles()}async getImages(t,i){let r=await this.imageManager.getImages(i.icons);this._updateTilesForChangedImages();let a=this.tileManagers[i.source];return a&&a.setDependencies(i.tileID.key,i.type,i.icons),r}async getGlyphs(t,i){let r=await this.glyphManager.getGlyphs(i.stacks),a=this.tileManagers[i.source];return a&&a.setDependencies(i.tileID.key,i.type,[""]),r}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(t,i={}
799){this._checkLoaded(),t&&this._validate(p.ln.glyphs,"glyphs",t,null,i)||(this._glyphsDidChange=!0,this.stylesheet.glyphs=t,this.glyphManager.entries={},this.glyphManager.setURL(t))}async getDashes(t,i){let r={};for(let[t,a]of Object.entries(i.dashes))r[t]=this.lineAtlas.getDash(a.dasharray,a.round);return r}addSprite(t,i,r={},a){this._checkLoaded();let o=[{id:t,url:i}],s=[...L(this.stylesheet.sprite),...o];this._validate(p.ln.sprite,"sprite",s,null,r)||(this.stylesheet.sprite=s,this._loadSprite(o,!0,a))}removeSprite(t){this._checkLoaded();let i=L(this.stylesheet.sprite);if(!i.find(i=>i.id===t))return void this.fire(new p.Sn(Error(`Sprite "${t}" doesn't exists on this map.`)));let r=this.imageManager.removeSpriteImages(t);this._markImagesChanged(r),i.splice(i.findIndex(i=>i.id===t),1),this.stylesheet.sprite=i.length>0?i:void 0,this._imagesListDirty=!0,this._changed=!0,this.fire(new P("data"))}getSprite(){return L(this.stylesheet.sprite)}setSprite(t,i={},r){this._checkLoaded(),!(t&&this._validate(p.ln.sprite,"sprite",t,null,i))&&(this.stylesheet.sprite=t,t?this._loadSprite(t,!0,r):(this._unloadSprite(),r&&r(null)))}destroy(){for(let t in this._frameRequest&&=(this._frameRequest.abort(),null),this._loadStyleRequest&&=(this._loadStyleRequest.abort(),null),this._spriteRequest&&=(this._spriteRequest.abort(),null),this.tileManagers){let i=this.tileManagers[t];i.setEventedParent(null),i.onRemove(this.map)}for(let t in this.tileManagers={},this.imageManager&&(this.imageManager.setEventedParent(null),this.imageManager.destroy(),this.patternAtlas.destroy()),this.glyphManager&&this.glyphManager.destroy(),this._layers){let i=this._layers[t];i.setEventedParent(null),i.onRemove&&i.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={}}};let io=(0,p.Yt)([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);var is=class{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(t,i,r,a,o,s,n,l,h){this.context=t;let c=this.boundPaintVertexBuffers.length!==a.length;for(let t=0;!c&&t<a.length;t++)this.boundPaintVertexBuffers[t]!==a[t]&&(c=!0);!this.vao||this.boundProgram!==i||this.boundLayoutVertexBuffer!==r||c||this.boundIndexBuffer!==o||this.boundVertexOffset!==s||this.boundDynamicVertexBuffer!==n||this.boundDynamicVertexBuffer2!==l||this.boundDynamicVertexBuffer3!==h?this.freshBind(i,r,a,o,s,n,l,h):(t.bindVertexArray.set(this.vao),n&&n.bind(),o?.dynamicDraw&&o.bind(),l&&l.bind(),h&&h.bind())}freshBind(t,i,r,a,o,s,n,l){let h=t.numAttributes,c=this.context,u=c.gl;for(let h of(this.vao&&this.destroy(),this.vao=c.createVertexArray(),c.bindVertexArray.set(this.vao),this.boundProgram=t,this.boundLayoutVertexBuffer=i,this.boundPaintVertexBuffers=r,this.boundIndexBuffer=a,this.boundVertexOffset=o,this.boundDynamicVertexBuffer=s,this.boundDynamicVertexBuffer2=n,this.boundDynamicVertexBuffer3=l,i.enableAttributes(u,t),r))h.enableAttributes(u,t);for(let a of(s&&s.enableAttributes(u,t),n&&n.enableAttributes(u,t),l&&l.enableAttributes(u,t),i.bind(),i.setVertexAttribPointers(u,t,o),r))a.bind(),a.setVertexAttribPointers(u,t,o);s&&(s.bind(),s.setVertexAttribPointers(u,t,o)),a&&a.bind(),n&&(n.bind(),n.setVertexAttribPointers(u,t,o)),l&&(l.bind(),l.setVertexAttribPointers(u,t,o)),c.currentNumAttributes=h}destroy(){this.vao&&=(this.context.deleteVertexArray(this.vao),null)}};let il=(t,i,r,a,o)=>({u_texture:0,u_ele_delta:t,u_fog_matrix:i,u_fog_color:r?r.properties.get("fog-color"):p.dn.white,u_fog_ground_blend:r?r.properties.get("fog-ground-blend"):1,u_fog_ground_blend_opacity:o?0:r?r.calculateFogBlendOpacity(a):0,u_horizon_color:r?r.properties.get("horizon-color"):p.dn.white,u_horizon_fog_blend:r?r.properties.get("horizon-fog-blend"):1,u_is_globe_mode:+!!o}),ih=t=>({u_ele_delta:t}),ic=(t,i)=>({u_terrain_coords_id:t/255,u_texture:0,u_ele_delta:i});function iu(t){let i=[];for(let r of t){if(null===r)continue;let t=r.split(" ");i.push(t.pop())}return i}var id=class{constructor(t,i,r,a,o,s,n,l,h=[]){let c=t.gl;this.program=c.createProgram();let u=iu(i.staticAttributes),d=r?r.getBinderAttributes():[],_=u.concat(d),m=tT.prelude.staticUniforms?iu(tT.prelude.staticUniforms):[],f=n.staticUniforms?iu(n.staticUniforms):[],g=i.staticUniforms?iu(i.staticUniforms):[],v=r?r.getBinderUniforms():[],y=m.concat(f).concat(g).concat(v),x=[];for(let t of y)x.includes(t)||x.push(t);let b=r?r.defines():[];b.unshift("#version 300 es"),o&&b.push("#define OVERDRAW_INSPECTOR;"),s&&b.push("#define TERRAIN3D;
799"),l&&b.push(l),h&&b.push(...h);let w=b.concat(tT.prelude.fragmentSource,n.fragmentSource,i.fragmentSource).join(`
800`),T=b.concat(tT.prelude.vertexSource,n.vertexSource,i.vertexSource).join(`
801`),P=c.createShader(c.FRAGMENT_SHADER);if(c.isContextLost()){this.failedToCreate=!0;return}if(c.shaderSource(P,w),c.compileShader(P),!c.getShaderParameter(P,c.COMPILE_STATUS))throw Error(`Could not compile fragment shader: ${c.getShaderInfoLog(P)}`);c.attachShader(this.program,P);let M=c.createShader(c.VERTEX_SHADER);if(c.isContextLost()){this.failedToCreate=!0;return}if(c.shaderSource(M,T),c.compileShader(M),!c.getShaderParameter(M,c.COMPILE_STATUS))throw Error(`Could not compile vertex shader: ${c.getShaderInfoLog(M)}`);c.attachShader(this.program,M),this.attributes={};let I={};if(this.numAttributes=_.length,c.linkProgram(this.program),!c.getProgramParameter(this.program,c.LINK_STATUS))throw Error(`Program failed to link: ${c.getProgramInfoLog(this.program)}`);let S=function(t,i){let r=new Set([t.INT,t.INT_VEC2,t.INT_VEC3,t.INT_VEC4,t.UNSIGNED_INT,t.UNSIGNED_INT_VEC2,t.UNSIGNED_INT_VEC3,t.UNSIGNED_INT_VEC4]),a=new Set,o=t.getProgramParameter(i,t.ACTIVE_ATTRIBUTES);for(let s=0;s<o;s++){let o=t.getActiveAttrib(i,s);o&&r.has(o.type)&&a.add(o.name)}return a}(c,this.program);for(let t of _){if(!t)continue;let i=c.getAttribLocation(this.program,t);i>=0&&(this.attributes[t]={location:i,isInteger:S.has(t)})}for(let t of(c.deleteShader(M),c.deleteShader(P),x))if(t&&!I[t]){let i=c.getUniformLocation(this.program,t);i&&(I[t]=i)}this.fixedUniforms=a(t,I),this.terrainUniforms=((t,i)=>({u_depth:new p.Mt(t,i.u_depth),u_terrain:new p.Mt(t,i.u_terrain),u_terrain_dim:new p.jt(t,i.u_terrain_dim),u_terrain_matrix:new p.zt(t,i.u_terrain_matrix),u_terrain_unpack:new p.Ft(t,i.u_terrain_unpack),u_terrain_exaggeration:new p.jt(t,i.u_terrain_exaggeration)}))(t,I),this.projectionUniforms=((t,i)=>({u_projection_matrix:new p.zt(t,i.u_projection_matrix),u_projection_tile_mercator_coords:new p.Ft(t,i.u_projection_tile_mercator_coords),u_projection_clipping_plane:new p.Ft(t,i.u_projection_clipping_plane),u_projection_transition:new p.jt(t,i.u_projection_transition),u_projection_fallback_matrix:new p.zt(t,i.u_projection_fallback_matrix),u_projection_clip_antimeridian:new p.Mt(t,i.u_projection_clip_antimeridian)}))(t,I),this.binderUniforms=r?r.getUniforms(t,I):[]}draw(t,i,r,a,o,s,n,l,h,c,u,d,_,p,m,f,g,v,y){let x=t.gl;if(this.failedToCreate)return;if(t.program.set(this.program),t.setDepthMode(r),t.setStencilMode(a),t.setColorMode(o),t.setCullFace(s),l)for(let i in t.activeTexture.set(x.TEXTURE2),x.bindTexture(x.TEXTURE_2D,l.depthTexture),t.activeTexture.set(x.TEXTURE3),x.bindTexture(x.TEXTURE_2D,l.texture),this.terrainUniforms)this.terrainUniforms[i].set(l[i]);if(h){let t={u_projection_matrix:h.mainMatrix,u_projection_tile_mercator_coords:h.tileMercatorCoords,u_projection_clipping_plane:h.clippingPlane,u_projection_transition:h.projectionTransition,u_projection_fallback_matrix:h.fallbackMatrix,u_projection_clip_antimeridian:+!!h.clipAntimeridian};for(let i in this.projectionUniforms)this.projectionUniforms[i].set(t[i])}if(n)for(let t in this.fixedUniforms)this.fixedUniforms[t].set(n[t]);f&&f.setUniforms(t,this.binderUniforms,p,{zoom:m});let b=0;switch(i){case x.LINES:b=2;break;case x.TRIANGLES:b=3;break;case x.LINE_STRIP:b=1}for(let r of _.get())r.vaos||={},r.vaos[c]||=new is,r.vaos[c].bind(t,this,u,f?f.getPaintVertexBuffers():[],d,r.vertexOffset,g,v,y),x.drawElements(i,r.primitiveLength*b,x.UNSIGNED_SHORT,r.primitiveOffset*b*2)}};function i_(t,i,r){let a=1/(0,p.Hr)(r,1,i.transform.tileZoom),o=2**r.tileID.overscaledZ,s=r.tileSize*2**i.transform.tileZoom/o,n=s*(r.tileID.canonical.x+r.tileID.wrap*o),l=s*r.tileID.canonical.y;return{u_image:0,u_texsize:r.imageAtlasTexture.size,u_scale:[a,t.fromScale,t.toScale],u_fade:t.t,u_pixel_coord_upper:[n>>16,l>>16],u_pixel_coord_lower:[65535&n,65535&l]}}let ip=(t,i,r,a)=>{let o=t.style.light,s=o.getCartesianPosition(),n=(0,p.Ii)();"viewport"===o.properties.get("anchor")&&(0,p.Li)(n,t.transform.bearingInRadians),(0,p.gi)(s,s,n);let l=t.transform.transformLightDirection(s),h=o.properties.get("color");return{u_lightpos:s,u_lightpos_globe:l,u_lightintensity:o.properties.get("intensity"),u_lightcolor:[h.r,h.g,h.b],u_vertical_gradient:+i,u_opacity:r,u_fill_translate:a}},im=(t,i,r,a,o,s,n)=>(0,p.or)(ip(t,i,r,a),i_(s,t,n),{u_height_factor:-(2**o.overscaledZ
801)/n.tileSize/8}),ig=(t,i,r,a)=>(0,p.or)(i_(i,t,r),{u_fill_translate:a}),iv=t=>({u_fill_translate:t}),iy=(t,i)=>({u_world:t,u_fill_translate:i}),ix=(t,i,r,a,o)=>(0,p.or)(ig(t,i,r,o),{u_world:a}),ib=(t,i,r,a,o)=>{let s=t.transform,n,l,h=0;if("map"===r.paint.get("circle-pitch-alignment")){let t=(0,p.Hr)(i,1,s.zoom);n=!0,l=[t,t],h=t/(p.Ur*2**i.tileID.overscaledZ)*2*Math.PI*o}else n=!1,l=s.pixelsToGLUnits;return{u_camera_to_center_distance:s.cameraToCenterDistance,u_scale_with_map:+("map"===r.paint.get("circle-pitch-scale")),u_pitch_with_map:+n,u_device_pixel_ratio:t.pixelRatio,u_extrude_scale:l,u_globe_extrude_scale:h,u_translate:a}},iw=t=>({u_pixel_extrude_scale:[1/t.width,1/t.height]}),iT=t=>({u_viewport_size:[t.width,t.height]}),iP=(t,i=1)=>({u_color:t,u_overlay:0,u_overlay_scale:i}),iM=(t,i,r,a)=>{let o=(0,p.Hr)(t,1,i)/(p.Ur*2**t.tileID.overscaledZ)*2*Math.PI*a;return{u_extrude_scale:(0,p.Hr)(t,1,i),u_intensity:r,u_globe_extrude_scale:o}},iI=(t,i,r,a)=>{let o=(0,p.Si)();(0,p.ki)(o,0,t.width,t.height,0,0,1);let s=t.context.gl;return{u_matrix:o,u_world:[s.drawingBufferWidth,s.drawingBufferHeight],u_image:r,u_color_ramp:a,u_opacity:i.paint.get("heatmap-opacity")}},iS=(t,i,r)=>{let a=r.paint.get("hillshade-accent-color"),o;switch(r.paint.get("hillshade-method")){case"basic":o=4;break;case"combined":o=1;break;case"igor":o=2;break;case"multidirectional":o=3;break;default:o=0}let s=r.getIlluminationProperties();for(let i=0;i<s.directionRadians.length;i++)"viewport"===r.paint.get("hillshade-illumination-anchor")&&(s.directionRadians[i]+=t.transform.bearingInRadians);return{u_image:0,u_latrange:function(t,i){let r=2**i.canonical.z,a=i.canonical.y;return[new p.tt(0,a/r).toLngLat().lat,new p.tt(0,(a+1)/r).toLngLat().lat]}(0,i.tileID),u_exaggeration:r.paint.get("hillshade-exaggeration"),u_altitudes:s.altitudeRadians,u_azimuths:s.directionRadians,u_accent:a,u_method:o,u_highlights:s.highlightColor,u_shadows:s.shadowColor}},iC=(t,i)=>{let r=i.stride,a=(0,p.Si)();return(0,p.ki)(a,0,p.Ur,-p.Ur,0,0,1),(0,p.Fi)(a,a,[0,-p.Ur,0]),{u_matrix:a,u_image:1,u_dimension:[r,r],u_zoom:t.overscaledZ,u_unpack:i.getUnpackVector()}},iE=(t,i,r=0)=>({u_image:0,u_unpack:i.getUnpackVector(),u_dimension:[i.stride,i.stride],u_elevation_stops:1,u_color_stops:4,u_color_ramp_size:r,u_opacity:t.paint.get("color-relief-opacity")}),iz=(t,i,r,a)=>{let o=t.transform;return{u_translation:ik(t,i,r),u_ratio:a/(0,p.Hr)(i,1,o.zoom),u_device_pixel_ratio:t.pixelRatio,u_units_to_pixels:[1/o.pixelsToGLUnits[0],1/o.pixelsToGLUnits[1]]}},iR=(t,i,r,a,o)=>(0,p.or)(iz(t,i,r,a),{u_image:0,u_image_height:o}),iD=(t,i,r,a,o)=>{let s=t.transform,n=iF(i,s);return{u_translation:ik(t,i,r),u_texsize:i.imageAtlasTexture.size,u_ratio:a/(0,p.Hr)(i,1,s.zoom),u_device_pixel_ratio:t.pixelRatio,u_image:0,u_scale:[n,o.fromScale,o.toScale],u_fade:o.t,u_units_to_pixels:[1/s.pixelsToGLUnits[0],1/s.pixelsToGLUnits[1]]}},iA=(t,i,r,a,o)=>{let s=iF(i,t.transform);return(0,p.or)(iz(t,i,r,a),{u_tileratio:s,u_crossfade_from:o.fromScale,u_crossfade_to:o.toScale,u_image:0,u_mix:o.t,u_lineatlas_width:t.lineAtlas.width,u_lineatlas_height:t.lineAtlas.height})},iL=(t,i,r,a,o,s)=>{let n=iF(i,t.transform);return(0,p.or)(iz(t,i,r,a),{u_image:0,u_image_height:s,u_tileratio:n,u_crossfade_from:o.fromScale,u_crossfade_to:o.toScale,u_image_dash:1,u_mix:o.t,u_lineatlas_width:t.lineAtlas.width,u_lineatlas_height:t.lineAtlas.height})};function iF(t,i){return 1/(0,p.Hr)(t,1,i.tileZoom)}function ik(t,i,r){return(0,p.Lr)(t.transform,i,r.paint.get("line-translate"),r.paint.get("line-translate-anchor"))}let iB=(t,i,r,a,o,s,n,l,h,c,u,d,_,p)=>{let m=n.transform;return{u_is_size_zoom_constant:+("constant"===t||"source"===t),u_is_size_feature_constant:+("constant"===t||"camera"===t),u_size_t:i?i.uSizeT:0,u_size:i?i.uSize:0,u_camera_to_center_distance:m.cameraToCenterDistance,u_pitch:m.pitch/360*2*Math.PI,u_rotate_symbol:+r,u_aspect_ratio:m.width/m.height,u_fade_change:n.options.fadeDuration?n.symbolFadeChange:1,u_label_plane_matrix:l,u_coord_matrix:h,u_is_text:+u,u_pitch_with_map:+a,u_is_along_line:o,u_is_variable_anchor:s,u_texsize:d,u_texture:0,u_translation:c,u_pitched_scale:_,u_is_offset:p}},ij=(t,i,r,a,o,s,n,l,h,c,u,d,_,m,f)=>
801{let g=n.transform;return(0,p.or)(iB(t,i,r,a,o,s,n,l,h,c,u,d,m,f),{u_gamma_scale:a?Math.cos(g.pitch*Math.PI/180)*g.cameraToCenterDistance:1,u_device_pixel_ratio:n.pixelRatio,u_is_halo:+!!_,u_is_plain:1})},iO=(t,i,r,a,o,s,n,l,h,c,u,d,_,m)=>(0,p.or)(ij(t,i,r,a,o,s,n,l,h,c,!0,u,!0,_,m),{u_texsize_icon:d,u_texture_icon:1}),iN=(t,i)=>({u_opacity:t,u_color:i}),iZ=(t,i,r,a,o)=>(0,p.or)(function(t,i,r,a){let o=r.patternAtlas.getPattern(t.from.toString()),s=r.patternAtlas.getPattern(t.to.toString()),{width:n,height:l}=r.patternAtlas.getPixelSize(),h=2**a.tileID.overscaledZ,c=a.tileSize*2**r.transform.tileZoom/h,u=c*(a.tileID.canonical.x+a.tileID.wrap*h),d=c*a.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:o.tl,u_pattern_br_a:o.br,u_pattern_tl_b:s.tl,u_pattern_br_b:s.br,u_texsize:[n,l],u_mix:i.t,u_pattern_size_a:o.displaySize,u_pattern_size_b:s.displaySize,u_scale_a:i.fromScale,u_scale_b:i.toScale,u_tile_units_to_pixels:1/(0,p.Hr)(a,1,r.transform.tileZoom),u_pixel_coord_upper:[u>>16,d>>16],u_pixel_coord_lower:[65535&u,65535&d]}}(r,o,i,a),{u_opacity:t}),iU=(t,i)=>{},iV={fillExtrusion:(t,i)=>({u_lightpos:new p.Pt(t,i.u_lightpos),u_lightpos_globe:new p.Pt(t,i.u_lightpos_globe),u_lightintensity:new p.jt(t,i.u_lightintensity),u_lightcolor:new p.Pt(t,i.u_lightcolor),u_vertical_gradient:new p.jt(t,i.u_vertical_gradient),u_opacity:new p.jt(t,i.u_opacity),u_fill_translate:new p.Nt(t,i.u_fill_translate)}),fillExtrusionPattern:(t,i)=>({u_lightpos:new p.Pt(t,i.u_lightpos),u_lightpos_globe:new p.Pt(t,i.u_lightpos_globe),u_lightintensity:new p.jt(t,i.u_lightintensity),u_lightcolor:new p.Pt(t,i.u_lightcolor),u_vertical_gradient:new p.jt(t,i.u_vertical_gradient),u_height_factor:new p.jt(t,i.u_height_factor),u_opacity:new p.jt(t,i.u_opacity),u_fill_translate:new p.Nt(t,i.u_fill_translate),u_image:new p.Mt(t,i.u_image),u_texsize:new p.Nt(t,i.u_texsize),u_pixel_coord_upper:new p.Nt(t,i.u_pixel_coord_upper),u_pixel_coord_lower:new p.Nt(t,i.u_pixel_coord_lower),u_scale:new p.Pt(t,i.u_scale),u_fade:new p.jt(t,i.u_fade)}),fill:(t,i)=>({u_fill_translate:new p.Nt(t,i.u_fill_translate)}),fillPattern:(t,i)=>({u_image:new p.Mt(t,i.u_image),u_texsize:new p.Nt(t,i.u_texsize),u_pixel_coord_upper:new p.Nt(t,i.u_pixel_coord_upper),u_pixel_coord_lower:new p.Nt(t,i.u_pixel_coord_lower),u_scale:new p.Pt(t,i.u_scale),u_fade:new p.jt(t,i.u_fade),u_fill_translate:new p.Nt(t,i.u_fill_translate)}),fillOutline:(t,i)=>({u_world:new p.Nt(t,i.u_world),u_fill_translate:new p.Nt(t,i.u_fill_translate)}),fillOutlinePattern:(t,i)=>({u_world:new p.Nt(t,i.u_world),u_image:new p.Mt(t,i.u_image),u_texsize:new p.Nt(t,i.u_texsize),u_pixel_coord_upper:new p.Nt(t,i.u_pixel_coord_upper),u_pixel_coord_lower:new p.Nt(t,i.u_pixel_coord_lower),u_scale:new p.Pt(t,i.u_scale),u_fade:new p.jt(t,i.u_fade),u_fill_translate:new p.Nt(t,i.u_fill_translate)}),circle:(t,i)=>({u_camera_to_center_distance:new p.jt(t,i.u_camera_to_center_distance),u_scale_with_map:new p.Mt(t,i.u_scale_with_map),u_pitch_with_map:new p.Mt(t,i.u_pitch_with_map),u_extrude_scale:new p.Nt(t,i.u_extrude_scale),u_device_pixel_ratio:new p.jt(t,i.u_device_pixel_ratio),u_globe_extrude_scale:new p.jt(t,i.u_globe_extrude_scale),u_translate:new p.Nt(t,i.u_translate)}),collisionBox:(t,i)=>({u_pixel_extrude_scale:new p.Nt(t,i.u_pixel_extrude_scale)}),collisionCircle:(t,i)=>({u_viewport_size:new p.Nt(t,i.u_viewport_size)}),debug:(t,i)=>({u_color:new p.It(t,i.u_color),u_overlay:new p.Mt(t,i.u_overlay),u_overlay_scale:new p.jt(t,i.u_overlay_scale)}),depth:iU,clippingMask:iU,heatmap:(t,i)=>({u_extrude_scale:new p.jt(t,i.u_extrude_scale),u_intensity:new p.jt(t,i.u_intensity),u_globe_extrude_scale:new p.jt(t,i.u_globe_extrude_scale)}),heatmapTexture:(t,i)=>({u_matrix:new p.zt(t,i.u_matrix),u_world:new p.Nt(t,i.u_world),u_image:new p.Mt(t,i.u_image),u_color_ramp:new p.Mt(t,i.u_color_ramp),u_opacity:new p.jt(t,i.u_opacity)}),hillshade:(t,i)=>({u_image:new p.Mt(t,i.u_image),u_latrange:new p.Nt(t,i.u_latrange),u_exaggeration:new p.jt(t,i.u_exaggeration),u_altitudes:new p.Rt(t,i.u_altitudes),u_azimuths:new p.Rt(t,i.u_azimuths),u_accent:new p.It(t,i.u_accent),u_method:new p.Mt(t,i.u_method),u_shadows:new p.Lt(t,i.u_shadows),u_highlights:new p.Lt(t,i.u_highlights)}),hillshadePrepare:(t,i)=>({u_matrix:new p.zt(t,i.u_matrix),u_image:new p.Mt(t,i.u_image),u_dimension:new p.Nt(t,i.u_dimension),u_zoom:new p.jt(t,i.u_zoom),u_unpack:new p.Ft(t,i.u_unpack)}),colorRelief:(t,i)=>({u_image:new p.Mt(t,i.u_image),u_unpack:new p.Ft(t,i.u_unpack),u_dimension:new p.Nt(t,i.u_dimension),u_elevation_stops:new p.Mt(t,i.u_elevation_stops),u_color_stops:new p.Mt(t,i.u_color_stops),u_color_ramp_size:new p.Mt(t,i.u_color_ramp_size),u_opacity:new p.jt(t,i.u_opacity)}),line:(t,i)=>({u_translation:new p.Nt(t,i.u_translation),u_ratio:new p.jt(t,i.u_ratio),u_device_pixel_ratio:new p.jt(t,i.u_device_pixel_ratio),u_units_to_pixels:new p.Nt(t,i.u_units_to_pixels)}),lineGradient:(t,i)=>({u_translation:new p.Nt(t,i.u_translation),u_ratio:new p.jt(t,i.u_ratio),u_device_pixel_ratio:new p.jt(t,i.u_device_pixel_ratio),u_units_to_pixels:new p.Nt(t,i.u_units_to_pixels),u_image:new p.Mt(t,i.u_image),u_image_height:new p.jt(t,i.u_image_height)}),linePattern:(t,i)=>({u_translation:new p.Nt(t,i.u_translation),u_texsize:new p.Nt(t,i.u_texsize),u_ratio:new p.jt(t,i.u_ratio),u_device_pixel_ratio:new p.jt(t,i.u_device_pixel_ratio),u_image:new p.Mt(t,i.u_image),u_units_to_pixels:new p.Nt(t,i.u_units_to_pixels),u_scale:new p.Pt(t,i.u_scale),u_fade:new p.jt(t,i.u_fade)}),lineSDF:(t,i)=>({u_translation:new p.Nt(t,i.u_translation),u_ratio:new p.jt(t,i.u_ratio),u_device_pixel_ratio:new p.jt(t,i.u_device_pixel_ratio),u_units_to_pixels:new p.Nt(t,i.u_units_to_pixels),u_image:new p.Mt(t,i.u_image),u_mix:new p.jt(t,i.u_mix),u_tileratio:new p.jt(t,i.u_tileratio),u_crossfade_from:new p.jt(t,i.u_crossfade_from),u_crossfade_to:new p.jt(t,i.u_crossfade_to),u_lineatlas_width:new p.jt(t,i.u_lineatlas_width),u_lineatlas_height:new p.jt(t,i.u_lineatlas_height)}),lineGradientSDF:(t,i)=>({u_translation:new p.Nt(t,i.u_translation),u_ratio:new p.jt(t,i.u_ratio),u_device_pixel_ratio:new p.jt(t,i.u_device_pixel_ratio),u_units_to_pixels:new p.Nt(t,i.u_units_to_pixels),u_image:new p.Mt(t,i.u_image),u_image_height:new p.jt(t,i.u_image_height),u_tileratio:new p.jt(t,i.u_tileratio),u_crossfade_from:new p.jt(t,i.u_crossfade_from),u_crossfade_to:new p.jt(t,i.u_crossfade_to),u_image_dash:new p.Mt(t,i.u_image_dash),u_mix:new p.jt(t,i.u_mix),u_lineatlas_width:new p.jt(t,i.u_lineatlas_width),u_lineatlas_height:new p.jt(t,i.u_lineatlas_height)}),layerOpacity:(t,i)=>({u_image:new p.Mt(t,i.u_image),u_opacity:new p.jt(t,i.u_opacity)}),raster:(t,i)=>({u_tl_parent:new p.Nt(t,i.u_tl_parent),u_scale_parent:new p.jt(t,i.u_scale_parent),u_buffer_scale:new p.jt(t,i.u_buffer_scale),u_perspective_transform:new p.Pt(t,i.u_perspective_transform),u_fade_t:new p.jt(t,i.u_fade_t),u_opacity:new p.jt(t,i.u_opacity),u_image0:new p.Mt(t,i.u_image0),u_image1:new p.Mt(t,i.u_image1),u_brightness_low:new p.jt(t,i.u_brightness_low),u_brightness_high:new p.jt(t,i.u_brightness_high),u_saturation_factor:new p.jt(t,i.u_saturation_factor),u_contrast_factor:new p.jt(t,i.u_contrast_factor),u_spin_weights:new p.Pt(t,i.u_spin_weights),u_coords_top:new p.Ft(t,i.u_coords_top),u_coords_bottom:new p.Ft(t,i.u_coords_bottom)}),symbolIcon:(t,i)=>({u_is_size_zoom_constant:new p.Mt(t,i.u_is_size_zoom_constant),u_is_size_feature_constant:new p.Mt(t,i.u_is_size_feature_constant),u_size_t:new p.jt(t,i.u_size_t),u_size:new p.jt(t,i.u_size),u_camera_to_center_distance:new p.jt(t,i.u_camera_to_center_distance),u_pitch:new p.jt(t,i.u_pitch),u_rotate_symbol:new p.Mt(t,i.u_rotate_symbol),u_aspect_ratio:new p.jt(t,i.u_aspect_ratio),u_fade_change:new p.jt(t,i.u_fade_change),u_label_plane_matrix:new p.zt(t,i.u_label_plane_matrix
801),u_coord_matrix:new p.zt(t,i.u_coord_matrix),u_is_text:new p.Mt(t,i.u_is_text),u_pitch_with_map:new p.Mt(t,i.u_pitch_with_map),u_is_along_line:new p.Mt(t,i.u_is_along_line),u_is_variable_anchor:new p.Mt(t,i.u_is_variable_anchor),u_texsize:new p.Nt(t,i.u_texsize),u_texture:new p.Mt(t,i.u_texture),u_translation:new p.Nt(t,i.u_translation),u_pitched_scale:new p.jt(t,i.u_pitched_scale),u_is_offset:new p.Mt(t,i.u_is_offset)}),symbolSDF:(t,i)=>({u_is_size_zoom_constant:new p.Mt(t,i.u_is_size_zoom_constant),u_is_size_feature_constant:new p.Mt(t,i.u_is_size_feature_constant),u_size_t:new p.jt(t,i.u_size_t),u_size:new p.jt(t,i.u_size),u_camera_to_center_distance:new p.jt(t,i.u_camera_to_center_distance),u_pitch:new p.jt(t,i.u_pitch),u_rotate_symbol:new p.Mt(t,i.u_rotate_symbol),u_aspect_ratio:new p.jt(t,i.u_aspect_ratio),u_fade_change:new p.jt(t,i.u_fade_change),u_label_plane_matrix:new p.zt(t,i.u_label_plane_matrix),u_coord_matrix:new p.zt(t,i.u_coord_matrix),u_is_text:new p.Mt(t,i.u_is_text),u_pitch_with_map:new p.Mt(t,i.u_pitch_with_map),u_is_along_line:new p.Mt(t,i.u_is_along_line),u_is_variable_anchor:new p.Mt(t,i.u_is_variable_anchor),u_texsize:new p.Nt(t,i.u_texsize),u_texture:new p.Mt(t,i.u_texture),u_gamma_scale:new p.jt(t,i.u_gamma_scale),u_device_pixel_ratio:new p.jt(t,i.u_device_pixel_ratio),u_is_halo:new p.Mt(t,i.u_is_halo),u_is_plain:new p.Mt(t,i.u_is_plain),u_translation:new p.Nt(t,i.u_translation),u_pitched_scale:new p.jt(t,i.u_pitched_scale),u_is_offset:new p.Mt(t,i.u_is_offset)}),symbolTextAndIcon:(t,i)=>({u_is_size_zoom_constant:new p.Mt(t,i.u_is_size_zoom_constant),u_is_size_feature_constant:new p.Mt(t,i.u_is_size_feature_constant),u_size_t:new p.jt(t,i.u_size_t),u_size:new p.jt(t,i.u_size),u_camera_to_center_distance:new p.jt(t,i.u_camera_to_center_distance),u_pitch:new p.jt(t,i.u_pitch),u_rotate_symbol:new p.Mt(t,i.u_rotate_symbol),u_aspect_ratio:new p.jt(t,i.u_aspect_ratio),u_fade_change:new p.jt(t,i.u_fade_change),u_label_plane_matrix:new p.zt(t,i.u_label_plane_matrix),u_coord_matrix:new p.zt(t,i.u_coord_matrix),u_is_text:new p.Mt(t,i.u_is_text),u_pitch_with_map:new p.Mt(t,i.u_pitch_with_map),u_is_along_line:new p.Mt(t,i.u_is_along_line),u_is_variable_anchor:new p.Mt(t,i.u_is_variable_anchor),u_texsize:new p.Nt(t,i.u_texsize),u_texsize_icon:new p.Nt(t,i.u_texsize_icon),u_texture:new p.Mt(t,i.u_texture),u_texture_icon:new p.Mt(t,i.u_texture_icon),u_gamma_scale:new p.jt(t,i.u_gamma_scale),u_device_pixel_ratio:new p.jt(t,i.u_device_pixel_ratio),u_is_halo:new p.Mt(t,i.u_is_halo),u_translation:new p.Nt(t,i.u_translation),u_pitched_scale:new p.jt(t,i.u_pitched_scale),u_is_offset:new p.Mt(t,i.u_is_offset)}),background:(t,i)=>({u_opacity:new p.jt(t,i.u_opacity),u_color:new p.It(t,i.u_color)}),backgroundPattern:(t,i)=>({u_opacity:new p.jt(t,i.u_opacity),u_image:new p.Mt(t,i.u_image),u_pattern_tl_a:new p.Nt(t,i.u_pattern_tl_a),u_pattern_br_a:new p.Nt(t,i.u_pattern_br_a),u_pattern_tl_b:new p.Nt(t,i.u_pattern_tl_b),u_pattern_br_b:new p.Nt(t,i.u_pattern_br_b),u_texsize:new p.Nt(t,i.u_texsize),u_mix:new p.jt(t,i.u_mix),u_pattern_size_a:new p.Nt(t,i.u_pattern_size_a),u_pattern_size_b:new p.Nt(t,i.u_pattern_size_b),u_scale_a:new p.jt(t,i.u_scale_a),u_scale_b:new p.jt(t,i.u_scale_b),u_pixel_coord_upper:new p.Nt(t,i.u_pixel_coord_upper),u_pixel_coord_lower:new p.Nt(t,i.u_pixel_coord_lower),u_tile_units_to_pixels:new p.jt(t,i.u_tile_units_to_pixels)}),terrain:(t,i)=>({u_texture:new p.Mt(t,i.u_texture),u_ele_delta:new p.jt(t,i.u_ele_delta),u_fog_matrix:new p.zt(t,i.u_fog_matrix),u_fog_color:new p.It(t,i.u_fog_color),u_fog_ground_blend:new p.jt(t,i.u_fog_ground_blend),u_fog_ground_blend_opacity:new p.jt(t,i.u_fog_ground_blend_opacity),u_horizon_color:new p.It(t,i.u_horizon_color),u_horizon_fog_blend:new p.jt(t,i.u_horizon_fog_blend),u_is_globe_mode:new p.jt(t,i.u_is_globe_mode)}),terrainDepth:(t,i)=>({u_ele_delta:new p.jt(t,i.u_ele_delta)}),terrainCoords:(t,i)=>({u_texture:new p.Mt(t,i.u_texture),u_terrain_coords_id:new p.jt(t,i.u_terrain_coords_id),u_ele_delta:new p.jt(t,i.u_ele_delta)}),atmosphere:(t,i)=>({u_sun_pos:new p.Pt(t,i.u_sun_pos),u_atmosphere_blend:new p.jt(t,i.u_atmosphere_blend),u_globe_position:new p.Pt(t,i.u_globe_position),u_globe_radius:new p.jt(t,i.u_globe_radius),u_inv_proj_matrix:new p.zt(t,i.u_inv_proj_matrix)}),sky:(t,i)=>({u_sky_color:new p.It(t,i.u_sky_color),u_horizon_color:new p.It(t,i.u_horizon_color),u_horizon:new p.Nt(t,i.u_horizon),u_horizon_normal:new p.Nt(t,i.u_horizon_normal),u_sky_horizon_blend:new p.jt(t,i.u_sky_horizon_blend),u_sky_blend:new p.jt(t,i.u_sky_blend)})};var iG=class{constructor(t,i,r){this.context=t;let a=t.gl;this.buffer=a.createBuffer(),this.dynamicDraw=!!r,this.context.unbindVAO(),t.bindElementBuffer.set(this.buffer),a.bufferData(a.ELEMENT_ARRAY_BUFFER,i.arrayBuffer,this.dynamicDraw?a.DYNAMIC_DRAW:a.STATIC_DRAW),this.dynamicDraw||i.freeBufferAfterUpload()}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(t){let i=this.context.gl;if(!this.dynamicDraw)throw Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),i.bufferSubData(i.ELEMENT_ARRAY_BUFFER,0,t.arrayBuffer)}destroy(){let t=this.context.gl;this.buffer&&(t.deleteBuffer(this.buffer),delete this.buffer)}};let iq={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};var iW=class{constructor(t,i,r,a){this.length=i.length,this.attributes=r,this.itemSize=i.bytesPerElement,this.dynamicDraw=a,this.context=t;let o=t.gl;this.buffer=o.createBuffer(),t.bindVertexBuffer.set(this.buffer),o.bufferData(o.ARRAY_BUFFER,i.arrayBuffer,this.dynamicDraw?o.DYNAMIC_DRAW:o.STATIC_DRAW),this.dynamicDraw||i.freeBufferAfterUpload()}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(t){if(t.length!==this.length)throw Error(`Length of new data is ${t.length}, which doesn't match current length of ${this.length}`);let i=this.context.gl;this.bind(),i.bufferSubData(i.ARRAY_BUFFER,0,t.arrayBuffer)}
vendor: 7,090 bytes, line 801
801enableAttributes(t,i){for(let r of this.attributes){let a=i.attributes[r.name];void 0!==a&&t.enableVertexAttribArray(a.location)}}setVertexAttribPointers(t,i,r){for(let a of this.attributes){let o=i.attributes[a.name];if(void 0!==o){let i=a.offset+this.itemSize*(r||0);o.isInteger?t.vertexAttribIPointer(o.location,a.components,t[iq[a.type]],this.itemSize,i):t.vertexAttribPointer(o.location,a.components,t[iq[a.type]],!1,this.itemSize,i)}}}destroy(){let t=this.context.gl;this.buffer&&(t.deleteBuffer(this.buffer),delete this.buffer)}},i$=class{constructor(t){this.gl=t.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(t){}getDefault(){return this.default}setDefault(){this.set(this.default)}},iH=class extends i${getDefault(){return p.dn.transparent}set(t){let i=this.current;(t.r!==i.r||t.g!==i.g||t.b!==i.b||t.a!==i.a||this.dirty)&&(this.gl.clearColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)}},iX=class extends i${getDefault(){return 1}set(t){(t!==this.current||this.dirty)&&(this.gl.clearDepth(t),this.current=t,this.dirty=!1)}},iK=class extends i${getDefault(){return 0}set(t){(t!==this.current||this.dirty)&&(this.gl.clearStencil(t),this.current=t,this.dirty=!1)}},iY=class extends i${getDefault(){return[!0,!0,!0,!0]}set(t){let i=this.current;(t[0]!==i[0]||t[1]!==i[1]||t[2]!==i[2]||t[3]!==i[3]||this.dirty)&&(this.gl.colorMask(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}},iJ=class extends i${getDefault(){return!0}set(t){(t!==this.current||this.dirty)&&(this.gl.depthMask(t),this.current=t,this.dirty=!1)}},iQ=class extends i${getDefault(){return 255}set(t){(t!==this.current||this.dirty)&&(this.gl.stencilMask(t),this.current=t,this.dirty=!1)}},i0=class extends i${getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(t){let i=this.current;(t.func!==i.func||t.ref!==i.ref||t.mask!==i.mask||this.dirty)&&(this.gl.stencilFunc(t.func,t.ref,t.mask),this.current=t,this.dirty=!1)}},i1=class extends i${getDefault(){let t=this.gl;return[t.KEEP,t.KEEP,t.KEEP]}set(t){let i=this.current;(t[0]!==i[0]||t[1]!==i[1]||t[2]!==i[2]||this.dirty)&&(this.gl.stencilOp(t[0],t[1],t[2]),this.current=t,this.dirty=!1)}},i2=class extends i${getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;let i=this.gl;t?i.enable(i.STENCIL_TEST):i.disable(i.STENCIL_TEST),this.current=t,this.dirty=!1}},i3=class extends i${getDefault(){return[0,1]}set(t){let i=this.current;(t[0]!==i[0]||t[1]!==i[1]||this.dirty)&&(this.gl.depthRange(t[0],t[1]),this.current=t,this.dirty=!1)}},i4=class extends i${getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;let i=this.gl;t?i.enable(i.DEPTH_TEST):i.disable(i.DEPTH_TEST),this.current=t,this.dirty=!1}},i5=class extends i${getDefault(){return this.gl.LESS}set(t){(t!==this.current||this.dirty)&&(this.gl.depthFunc(t),this.current=t,this.dirty=!1)}},i6=class extends i${getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;let i=this.gl;t?i.enable(i.BLEND):i.disable(i.BLEND),this.current=t,this.dirty=!1}},i8=class extends i${getDefault(){let t=this.gl;return[t.ONE,t.ZERO]}set(t){let i=this.current;(t[0]!==i[0]||t[1]!==i[1]||this.dirty)&&(this.gl.blendFunc(t[0],t[1]),this.current=t,this.dirty=!1)}},i9=class extends i${getDefault(){return p.dn.transparent}set(t){let i=this.current;(t.r!==i.r||t.g!==i.g||t.b!==i.b||t.a!==i.a||this.dirty)&&(this.gl.blendColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)}},i7=class extends i${getDefault(){return this.gl.FUNC_ADD}set(t){(t!==this.current||this.dirty)&&(this.gl.blendEquation(t),this.current=t,this.dirty=!1)}},re=class extends i${getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;let i=this.gl;t?i.enable(i.CULL_FACE):i.disable(i.CULL_FACE),this.current=t,this.dirty=!1}},rt=class extends i${getDefault(){return this.gl.BACK}set(t){(t!==this.current||this.dirty)&&(this.gl.cullFace(t),this.current=t,this.dirty=!1)}},ri=class extends i${getDefault(){return this.gl.CCW}set(t){(t!==this.current||this.dirty)&&(this.gl.frontFace(t),this.current=t,this.dirty=!1)}},rr=class extends i${getDefault(){return null}set(t){(t!==this.current||this.dirty)&&(this.gl.useProgram(t),this.current=t,this.dirty=!1)}},ra=class extends i${getDefault(){return this.gl.TEXTURE0}set(t){(t!==this.current||this.dirty)&&(this.gl.activeTexture(t),this.current=t,this.dirty=!1)}},ro=class extends i${getDefault(){let t=this.gl;return[0,0,t.drawingBufferWidth,t.drawingBufferHeight]}set(t){let i=this.current;(t[0]!==i[0]||t[1]!==i[1]||t[2]!==i[2]||t[3]!==i[3]||this.dirty)&&(this.gl.viewport(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}},rs=class extends i${getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;let i=this.gl;i.bindFramebuffer(i.FRAMEBUFFER,t),this.current=t,this.dirty=!1}},rn=class extends i${getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;let i=this.gl;i.bindRenderbuffer(i.RENDERBUFFER,t),this.current=t,this.dirty=!1}},rl=class extends i${getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;let i=this.gl;i.bindTexture(i.TEXTURE_2D,t),this.current=t,this.dirty=!1}},rh=class extends i${getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;let i=this.gl;i.bindBuffer(i.ARRAY_BUFFER,t),this.current=t,this.dirty=!1}},rc=class extends i${getDefault(){return null}set(t){let i=this.gl;i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,t),this.current=t,this.dirty=!1}},ru=class extends i${getDefault(){return null}set(t){(t!==this.current||this.dirty)&&(this.gl.bindVertexArray(t),this.current=t,this.dirty=!1)}},rd=class extends i${getDefault(){return 4}set(t){if(t===this.current&&!this.dirty)return;let i=this.gl;i.pixelStorei(i.UNPACK_ALIGNMENT,t),this.current=t,this.dirty=!1}},r_=class extends i${getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;let i=this.gl;i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t),this.current=t,this.dirty=!1}},rp=class extends i${getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;let i=this.gl;i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,t),this.current=t,this.dirty=!1}},rm=class extends i${constructor(t,i){super(t),this.context=t,this.parent=i}getDefault(){return null}},rf=class extends rm{setDirty(){this.dirty=!0}set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let i=this.gl;i.framebufferTexture2D(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,t,0),this.current=t,this.dirty=!1}},rg=class extends rm{set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let i=this.gl;i.framebufferRenderbuffer(i.FRAMEBUFFER,i.DEPTH_ATTACHMENT,i.RENDERBUFFER,t),this.current=t,this.dirty=!1}},rv=class extends rm{set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let i=this.gl;i.framebufferRenderbuffer(i.FRAMEBUFFER,i.DEPTH_STENCIL_ATTACHMENT,i.RENDERBUFFER,t),this.current=t,this.dirty=!1}},ry=class{constructor(t,i,r,a,o){this.context=t,this.width=i,this.height=r;let s=t.gl,n=this.framebuffer=s.createFramebuffer();
vendor: 6,016 bytes, line 801
801if(this.colorAttachment=new rf(t,n),a)this.depthAttachment=o?new rv(t,n):new rg(t,n);else if(o)throw Error("Stencil cannot be set without depth")}destroy(){let t=this.context.gl,i=this.colorAttachment.get();if(i&&t.deleteTexture(i),this.depthAttachment){let i=this.depthAttachment.get();i&&t.deleteRenderbuffer(i)}t.deleteFramebuffer(this.framebuffer)}},rx=class{constructor(t,i,r){this.blendFunction=t,this.blendColor=i,this.mask=r}};rx.Replace=[1,0],rx.disabled=new rx(rx.Replace,p.dn.transparent,[!1,!1,!1,!1]),rx.unblended=new rx(rx.Replace,p.dn.transparent,[!0,!0,!0,!0]),rx.alphaBlended=new rx([1,771],p.dn.transparent,[!0,!0,!0,!0]);var rb=class{constructor(t){this.gl=t,this.clearColor=new iH(this),this.clearDepth=new iX(this),this.clearStencil=new iK(this),this.colorMask=new iY(this),this.depthMask=new iJ(this),this.stencilMask=new iQ(this),this.stencilFunc=new i0(this),this.stencilOp=new i1(this),this.stencilTest=new i2(this),this.depthRange=new i3(this),this.depthTest=new i4(this),this.depthFunc=new i5(this),this.blend=new i6(this),this.blendFunc=new i8(this),this.blendColor=new i9(this),this.blendEquation=new i7(this),this.cullFace=new re(this),this.cullFaceSide=new rt(this),this.frontFace=new ri(this),this.program=new rr(this),this.activeTexture=new ra(this),this.viewport=new ro(this),this.bindFramebuffer=new rs(this),this.bindRenderbuffer=new rn(this),this.bindTexture=new rl(this),this.bindVertexBuffer=new rh(this),this.bindElementBuffer=new rc(this),this.bindVertexArray=new ru(this),this.pixelStoreUnpack=new rd(this),this.pixelStoreUnpackPremultiplyAlpha=new r_(this),this.pixelStoreUnpackFlipY=new rp(this),this.extTextureFilterAnisotropic=t.getExtension("EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=t.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),this.maxTextureSize=t.getParameter(t.MAX_TEXTURE_SIZE),t.getExtension("EXT_color_buffer_half_float"),t.getExtension("EXT_color_buffer_float")}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}setCustomLayerDefaults(){this.unbindVAO(),this.cullFace.setDefault(),this.activeTexture.setDefault(),this.pixelStoreUnpack.setDefault(),this.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.pixelStoreUnpackFlipY.setDefault()}createIndexBuffer(t,i){return new iG(this,t,i)}createVertexBuffer(t,i,r){return new iW(this,t,i,r)}createRenderbuffer(t,i,r){let a=this.gl,o=a.createRenderbuffer();return this.bindRenderbuffer.set(o),a.renderbufferStorage(a.RENDERBUFFER,t,i,r),this.bindRenderbuffer.set(null),o}createFramebuffer(t,i,r,a){return new ry(this,t,i,r,a)}clear({color:t,depth:i,stencil:r}){let a=this.gl,o=0;t&&(o|=a.COLOR_BUFFER_BIT,this.clearColor.set(t),this.colorMask.set([!0,!0,!0,!0])),void 0!==i&&(o|=a.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(i),this.depthMask.set(!0)),void 0!==r&&(o|=a.STENCIL_BUFFER_BIT,this.clearStencil.set(r),this.stencilMask.set(255)),a.clear(o)}setCullFace(t){!1===t.enable?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(t.mode),this.frontFace.set(t.frontFace))}setDepthMode(t){t.func!==this.gl.ALWAYS||t.mask?(this.depthTest.set(!0),this.depthFunc.set(t.func),this.depthMask.set(t.mask),this.depthRange.set(t.range)):this.depthTest.set(!1)}setStencilMode(t){t.test.func!==this.gl.ALWAYS||t.mask?(this.stencilTest.set(!0),this.stencilMask.set(t.mask),this.stencilOp.set([t.fail,t.depthFail,t.pass]),this.stencilFunc.set({func:t.test.func,ref:t.ref,mask:t.test.mask})):this.stencilTest.set(!1)}setColorMode(t){(0,p.$n)(t.blendFunction,rx.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(t.blendFunction),this.blendColor.set(t.blendColor)),this.colorMask.set(t.mask)}createVertexArray(){return this.gl.createVertexArray()}deleteVertexArray(t){this.gl.deleteVertexArray(t)}unbindVAO(){this.bindVertexArray.set(null)}},rw=class{constructor(t,i,r){this.func=t,this.mask=i,this.range=r}};rw.ReadOnly=!1,rw.ReadWrite=!0,rw.disabled=new rw(519,rw.ReadOnly,[0,1]);var rT=class{constructor(t,i,r,a,o,s){this.test=t,this.ref=i,this.mask=r,this.fail=a,this.depthFail=o,this.pass=s}};rT.disabled=new rT({func:519,mask:0},0,0,7680,7680,7680);var rP=class{constructor(t,i,r){this.enable=t,this.mode=i,this.frontFace=r}};function rM(t,i,r,a,o){let s=t.context,n=t.transform,l=s.gl,h=t.useProgram("collisionBox"),c=[],u=0,d=0;for(let _ of a){let a=i.getTile(_).getBucket(r);
801if(!a)continue;let p=o?a.textCollisionBox:a.iconCollisionBox,m=a.collisionCircleArray;m.length>0&&(c.push({circleArray:m,circleOffset:d,coord:_}),u+=m.length/4,d=u),p&&h.draw(s,l.LINES,rw.disabled,rT.disabled,t.colorModeForRenderPass(),rP.disabled,iw(t.transform),t.style.map.terrain?.getTerrainData(_),n.getProjectionData({overscaledTileID:_,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),r.id,p.layoutVertexBuffer,p.indexBuffer,p.segments,null,t.transform.zoom,null,null,p.collisionVertexBuffer)}if(!o||!c.length)return;let m=t.useProgram("collisionCircle"),f=new p.Ht;f.resize(4*u),f._trim();let g=0;for(let t of c)for(let i=0;i<t.circleArray.length/4;i++){let r=4*i,a=t.circleArray[r+0],o=t.circleArray[r+1],s=t.circleArray[r+2],n=t.circleArray[r+3];f.emplace(g++,a,o,s,n,0),f.emplace(g++,a,o,s,n,1),f.emplace(g++,a,o,s,n,2),f.emplace(g++,a,o,s,n,3)}(!_||_.length<2*u)&&(_=function(t){let i=2*t,r=new p.Kt;r.resize(i),r._trim();for(let t=0;t<i;t++){let i=6*t;r.uint16[i+0]=4*t+0,r.uint16[i+1]=4*t+1,r.uint16[i+2]=4*t+2,r.uint16[i+3]=4*t+2,r.uint16[i+4]=4*t+3,r.uint16[i+5]=4*t+0}return r}(u));let v=s.createIndexBuffer(_,!0),y=s.createVertexBuffer(f,p.V.members,!0);for(let i of c){let a=iT(t.transform);m.draw(s,l.TRIANGLES,rw.disabled,rT.disabled,t.colorModeForRenderPass(),rP.disabled,a,t.style.map.terrain?.getTerrainData(i.coord),null,r.id,y,v,p.Bt.simpleSegment(0,2*i.circleOffset,i.circleArray.length,i.circleArray.length/2),null,t.transform.zoom,null,null,null)}y.destroy(),v.destroy()}rP.disabled=new rP(!1,1029,2305),rP.backCCW=new rP(!0,1029,2305),rP.frontCCW=new rP(!0,1028,2305);let rI=(0,p.Ei)(new Float32Array(16));function rS(t,i,r,a,o,s,n,l,h,c,u,d,_){let m=t.context,f=m.gl,g=t.transform,v="map"===l,y="map"===h,x="viewport"!==l&&"point"!==r.layout.get("symbol-placement"),b=v&&!y&&!x,w=!r.layout.get("symbol-sort-key").isConstant(),T=!1,P=t.getDepthModeForSublayer(0,rw.ReadOnly),M=r._unevaluatedLayout.hasValue("text-variable-anchor")||r._unevaluatedLayout.hasValue("text-variable-anchor-offset"),I=[],S=g.getCircleRadiusCorrection();for(let l of a){let a=i.getTile(l),h=a.getBucket(r);if(!h)continue;let u=o?h.text:h.icon;if(!u?.segments.get().length||!u.hasVisibleVertices)continue;let d=u.programConfigurations.get(r.id),m=o||h.sdfIcons,P=o?h.textSizeData:h.iconSizeData,C=y||0!==g.pitch,E=t.useProgram(h.iconsInText&&o?"symbolTextAndIcon":m?"symbolSDF":"symbolIcon",d),z=(0,p.j)(P,g.zoom),R=t.style.map.terrain?.getTerrainData(l),D,A=[0,0],L,F,k=null,B;if(o){if(L=a.glyphAtlasTexture,F=f.LINEAR,D=a.glyphAtlasTexture.size,h.iconsInText){A=a.imageAtlasTexture.size,k=a.imageAtlasTexture;let i="composite"===P.kind||"camera"===P.kind;B=C||t.options.rotating||t.options.zooming||i?f.LINEAR:f.NEAREST}}else{let i=1!==r.layout.get("icon-size").constantOr(0)||h.iconsNeedLinear;L=a.imageAtlasTexture,F=m||t.options.rotating||t.options.zooming||i||C?f.LINEAR:f.NEAREST,D=a.imageAtlasTexture.size}let j=(0,p.Hr)(a,1,t.transform.zoom),O=eU(v,t.transform,j),N=function(t,i,r,a){if(t){let t=(0,p.Si)();if(!i){let{vecSouth:i,vecEast:a}=eV(r);t[0]=a[0],t[1]=a[1],t[4]=i[0],t[5]=i[1]}return(0,p.Pi)(t,t,[a,a,1]),t}return r.pixelsToClipSpaceMatrix}(y,v,t.transform,j),Z=(0,p.Lr)(g,a,s,n),U=g.getProjectionData({overscaledTileID:l,applyGlobeMatrix:!_,applyTerrainMatrix:!0}),V=M&&h.hasTextData(),G="none"!==r.layout.get("icon-text-fit")&&V&&h.hasIconData(),q=r._unevaluatedLayout.hasValue("icon-offset");if(x){let i=(0,p.Si)();!function(t,i){let r=1/(i[0]*i[0]+i[1]*i[1]+i[2]*i[2]),a=1/(i[8]*i[8]+i[9]*i[9]+i[10]*i[10]),o=i[0]*r,s=i[4]*r,n=i[8]*a,l=i[1]*r,h=i[5]*r,c=i[9]*a,u=i[2]*r,d=i[6]*r,_=i[10]*a;t[0]=o,t[1]=s,t[2]=n,t[4]=l,t[5]=h,t[6]=c,t[8]=u,t[9]=d,t[10]=_;let p=i[12],m=i[13],f=i[14];t[12]=-o*p-l*m-u*f,t[13]=-s*p-h*m-d*f,t[14]=-n*p-c*m-_*f,t[3]=0,t[7]=0,t[11]=0,t[15]=1}(i,O);let a=t.style.map.terrain?(i,r)=>t.style.map.terrain.getElevation(l,i,r):null;!function(t,i,r,a,o,s,n,l,h,c,u,d,_){let m=r?t.textSizeData:t.iconSizeData,f=(0,p.j)(m,i.transform.zoom),g=[256/i.width*2+1,256/i.height*2+1],v=r?t.text.dynamicLayoutVertexArray:t.icon.dynamicLayoutVertexArray;v.clear();let y=t.lineVertexArray,x=r?t.text.placedSymbolArray:t.icon.placedSymbolArray,b=i.transform.width/i.transform.height,w=!1;for(let r=0;r<x.length;r++){var T;let P=x.get(r);if(P.hidden||2===P.writingMode&&!w){e2(P.numGlyphs,v);continue}w=!1;let M=new p.Vi(P.anchorX,P.anchorY),I={getElevation:_,pitchedLabelPlaneMatr
801ix:a,lineVertexArray:y,pitchWithMap:s,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},transform:i.transform,tileAnchorPoint:M,unwrappedTileID:h,width:c,height:u,translation:d},S=eJ(P.anchorX,P.anchorY,I);if(T=S.point,!(T.x>=-g[0]&&T.x<=g[0]&&T.y>=-g[1])||!(T.y<=g[1])){e2(P.numGlyphs,v);continue}let C=S.signedDistanceFromCamera,E=.5+i.transform.cameraToCenterDistance/C*.5,z=(0,p.A)(m,f,P),R=s?z*i.transform.getPitchedTextCorrection(P.anchorX,P.anchorY,h)/E:z*E,D=e$({projectionContext:I,pitchedLabelPlaneMatrixInverse:o,symbol:P,fontSize:R,flip:!1,keepUpright:n,glyphOffsetArray:t.glyphOffsetArray,dynamicLayoutVertexArray:v,aspectRatio:b,rotateToLine:l});w=D.useVertical,(D.notEnoughRoom||w||D.needsFlipping&&e$({projectionContext:I,pitchedLabelPlaneMatrixInverse:o,symbol:P,fontSize:R,flip:!0,keepUpright:n,glyphOffsetArray:t.glyphOffsetArray,dynamicLayoutVertexArray:v,aspectRatio:b,rotateToLine:l}).notEnoughRoom)&&e2(P.numGlyphs,v)}r?t.text.dynamicLayoutVertexBuffer.updateData(v):t.icon.dynamicLayoutVertexBuffer.updateData(v)}(h,t,o,O,i,y,c,"map"===r.layout.get("text-rotation-alignment"),l.toUnwrapped(),g.width,g.height,Z,a)}let W=o&&M||G,$=y?O:t.transform.clipSpaceToPixelsMatrix,H=x||W?rI:$,X=m&&0!==r.paint.get(o?"text-halo-width":"icon-halo-width").constantOr(1),K={program:E,buffers:u,uniformValues:m?h.iconsInText?iO(P.kind,z,b,y,x,W,t,H,N,Z,D,A,S,q):ij(P.kind,z,b,y,x,W,t,H,N,Z,o,D,X,S,q):iB(P.kind,z,b,y,x,W,t,H,N,Z,o,D,S,q),projectionData:U,atlasTexture:L,atlasTextureIcon:k,atlasInterpolation:F,atlasInterpolationIcon:B,isSDF:m,hasHalo:X};if(w&&h.canOverlap)for(let t of(T=!0,u.segments.get()))I.push({segments:new p.Bt([t]),sortKey:t.sortKey,state:K,terrainData:R});else I.push({segments:u.segments,sortKey:0,state:K,terrainData:R})}T&&I.sort((t,i)=>t.sortKey-i.sortKey);let C=r.paint.get(o?"text-halo-width":"icon-halo-width").constantOr(null)??1/0,E=24*r.layout.get("text-letter-spacing").constantOr(0)<0||C>1;for(let i of I){let a=i.state;m.activeTexture.set(f.TEXTURE0),a.atlasTexture.bind(a.atlasInterpolation,f.CLAMP_TO_EDGE),a.atlasTextureIcon&&(m.activeTexture.set(f.TEXTURE1),a.atlasTextureIcon&&a.atlasTextureIcon.bind(a.atlasInterpolationIcon,f.CLAMP_TO_EDGE));let o=a.isSDF&&a.hasHalo;if(o){let o=a.uniformValues;o.u_is_halo=1,E&&(o.u_is_plain=0,rC(a.buffers,i.segments,r,t,a.program,P,u,d,o,a.projectionData,i.terrainData),o.u_is_halo=0,o.u_is_plain=1)}rC(a.buffers,i.segments,r,t,a.program,P,u,d,a.uniformValues,a.projectionData,i.terrainData),o&&!E&&(a.uniformValues.u_is_halo=0)}}function rC(t,i,r,a,o,s,n,l,h,c,u){let d=a.context,_=d.gl;o.draw(d,_.TRIANGLES,s,n,l,rP.backCCW,h,u,c,r.id,t.layoutVertexBuffer,t.indexBuffer,i,r.paint,a.transform.zoom,t.programConfigurations.get(r.id),t.dynamicLayoutVertexBuffer,t.opacityVertexBuffer)}function rE(t,i,r){let a=t.gl,o=a.createTexture();a.bindTexture(a.TEXTURE_2D,o),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_S,a.CLAMP_TO_EDGE),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_T,a.CLAMP_TO_EDGE),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,a.LINEAR),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MAG_FILTER,a.LINEAR),a.texStorage2D(a.TEXTURE_2D,1,a.RGBA16F,i,r);let s=t.createFramebuffer(i,r,!1,!1);return s.colorAttachment.set(o),s}function rz(t,i){return i.colorRampTexture||=new p.xt(t,i.colorRamp,t.gl.RGBA),i.colorRampTexture}function rR(t,i,r,a){let o=t.context,s=o.bindFramebuffer.get(),n=o.viewport.get(),[,,l,h]=n;return function(t,i,r){let a=t.context.gl;if(!t.layerOpacityFbo){let o=t.context.createFramebuffer(i,r,!0,!0),s=a.createTexture();a.bindTexture(a.TEXTURE_2D,s),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_S,a.CLAMP_TO_EDGE),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_T,a.CLAMP_TO_EDGE),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,a.LINEAR),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MAG_FILTER,a.LINEAR),a.texImage2D(a.TEXTURE_2D,0,a.RGBA,i,r,0,a.RGBA,a.UNSIGNED_BYTE,null),o.colorAttachment.set(s),o.depthAttachment.set(t.context.createRenderbuffer(a.DEPTH_STENCIL,i,r)),t.layerOpacityFbo=o,t.context.bindFramebuffer.set(t.layerOpacityFbo.framebuffer);return}if(t.layerOpacityFbo.width===i&&t.layerOpacityFbo.height===r)return t.context.bindFramebuffer.set(t.layerOpacityFbo.framebuffer);let o=t.layerOpacityFbo;a.bindTexture(a.TEXTURE_2D,o.colorAttachment.get()),a.texImage2D(a.TEXTURE_2D,0,a.RGBA,i,r,0,a.RGBA,a.UNSIGNED_BYTE,null),t.context.bindRenderbuffer.set(o.depthAttachment.get()),a.renderbufferStorage(a.RENDERBUFFER,a.DEPTH_STENCIL,i,r),t.context.bindRenderbuffer.set(null),o.width=i,o.height=r,t.context.bindFramebuffer.set(o.framebuffer)}(t,l,h),o.viewport.set([0,0,l,h]),o.clear({color:p.dn.transparent,depth:1,stencil:0}),t.currentStencilSource=void 0,t.renderTileClippingMasks(i,r,a),{compositeTarget:s,compositeViewport:n}}function rD(t,i,r,a){let o=t.context,s=o.gl;o.bindFramebuffer.set(r.compositeTarget),o.viewport.set(r.compositeViewport),o.activeTexture.set(s.TEXTURE0),s.bindTexture(s.TEXTURE_2D,t.layerOpacityFbo.colorAttachment.get()),t.useProgram("layerOpacity").draw(o,s.TRIANGLES,rw.disabled,rT.disabled,t.colorModeForRenderPass(),rP.disabled,{u_image:0,u_opacity:i},null,null,a.id,t.viewportBuffer,t.quadTriangleIndexBuffer,t.viewportSegments,a.paint,t.transform.zoom),t.currentStencilSource=void 0}function rA(t,i,r,a,o,s,n,l){let h=256;if(o.stepInterpolant){let a=i.getSource().maxzoom,o=n.canonical.z===a?Math.
801ceil(1<<t.transform.maxZoom-n.canonical.z):1,l=s.maxLineLength/p.Ur*1024*o;h=(0,p.Kn)((0,p.Cr)(l),256,r.maxTextureSize)}return l.gradient=(0,p.Tt)({expression:o.gradientExpression(),evaluationKey:"lineProgress",resolution:h,image:l.gradient||void 0,clips:s.lineClipsArray}),l.texture?l.texture.update(l.gradient):l.texture=new p.xt(r,l.gradient,a.RGBA),l.version=o.gradientVersion,l.texture}function rL(t,i,r,a,o,s){let{isRenderingToTexture:n}=o,l=t.getDepthModeForSublayer(0,rw.ReadOnly),h=t.colorModeForRenderPass(),c=r.paint.get("line-dasharray"),u=c.constantOr(1),d=r.paint.get("line-pattern"),_=d.constantOr(1),p=r.paint.get("line-gradient"),m=r.getCrossfadeParameters(),f;f=_?"linePattern":u&&p?"lineGradientSDF":u?"lineSDF":p?"lineGradient":"line";let g=t.context,v=g.gl,y=t.transform,x=!0;for(let o of a){let a=i.getTile(o);if(_&&!a.patternsLoaded())continue;let b=a.getBucket(r);if(!b)continue;let w=b.programConfigurations.get(r.id),T=t.context.program.get(),P=t.useProgram(f,w),M=x||P.program!==T,I=s?t.getTerrainDataForTile(o,n):null,S=d.constantOr(null),C=c?.constantOr(null);if(S&&a.imageAtlas){let t=a.imageAtlas,i=t.patternPositions[S.to.toString()],r=t.patternPositions[S.from.toString()];i&&r&&w.setConstantPatternPositions(i,r)}else if(C){let i="round"===r.layout.get("line-cap").constantOr(null),a=t.lineAtlas.getDash(C.to,i),o=t.lineAtlas.getDash(C.from,i);w.setConstantDashPositions(a,o)}let E=y.getProjectionData({overscaledTileID:o,applyGlobeMatrix:!n,applyTerrainMatrix:!0}),z=y.getPixelScale(),R;_?(R=iD(t,a,r,z,m),g.activeTexture.set(v.TEXTURE0),a.imageAtlasTexture.bind(v.LINEAR,v.CLAMP_TO_EDGE),w.updatePaintBuffers(m)):u&&p?(R=iL(t,a,r,z,m,b.lineClipsArray.length),function(t,i,r,a,o,s,n,l,h){let c=s.gradients[o.id],u=c.texture;o.gradientVersion!==c.version&&(u=rA(t,i,r,a,o,s,n,c)),r.activeTexture.set(a.TEXTURE0),u.bind(o.stepInterpolant?a.NEAREST:a.LINEAR,a.CLAMP_TO_EDGE),r.activeTexture.set(a.TEXTURE1),t.lineAtlas.bind(r),l.updatePaintBuffers(h)}(t,i,g,v,r,b,o,w,m)):u?(R=iA(t,a,r,z,m),(M||t.lineAtlas.dirty)&&(g.activeTexture.set(v.TEXTURE0),t.lineAtlas.bind(g)),w.updatePaintBuffers(m)):p?(R=iR(t,a,r,z,b.lineClipsArray.length),function(t,i,r,a,o,s,n){let l=s.gradients[o.id],h=l.texture;o.gradientVersion!==l.version&&(h=rA(t,i,r,a,o,s,n,l)),r.activeTexture.set(a.TEXTURE0),h.bind(o.stepInterpolant?a.NEAREST:a.LINEAR,a.CLAMP_TO_EDGE)}(t,i,g,v,r,b,o)):R=iz(t,a,r,z);let D=t.stencilModeForClipping(o);P.draw(g,v.TRIANGLES,l,D,h,rP.disabled,R,I,E,r.id,b.layoutVertexBuffer,b.indexBuffer,b.segments,r.paint,t.transform.zoom,w,b.layoutVertexBuffer2),x=!1}}function rF(t,i,r,a,o){if(!r||!a?.imageAtlas)return;let s=a.imageAtlas.patternPositions,n=s[r.to.toString()],l=s[r.from.toString()];if(!n&&l&&(n=l),!l&&n&&(l=n),!n||!l){let t=o.getPaintProperty(i);n=s[t],l=s[t]}n&&l&&t.setConstantPatternPositions(n,l)}function rk(t,i,r,a,o){let{isRenderingToTexture:s}=o,n=t.colorModeForRenderPass();rj(t,i,r,a,t.getDepthModeForSublayer(1,rw.ReadOnly),n,!1,s),rB(t,i,r,a,o)}function rB(t,i,r,a,o){if(!r.paint.get("fill-antialias"))return;let{isRenderingToTexture:s}=o,n=t.colorModeForRenderPass();rj(t,i,r,a,t.getDepthModeForSublayer(2*!!r.getPaintProperty("fill-outline-color"),rw.ReadOnly),n,!0,s)}function rj(t,i,r,a,o,s,n,l){let h=t.context.gl,c="fill-pattern",u=r.paint.get(c),d=u?.constantOr(1),_=r.getCrossfadeParameters(),m,f,g,v,y,x=t.transform,b=r.paint.get("fill-translate"),w=r.paint.get("fill-translate-anchor");n?(f=d&&!r.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",m=h.LINES):(f=d?"fillPattern":"fill",m=h.TRIANGLES);let T=u.constantOr(null);for(let u of a){let a=i.getTile(u);if(d&&!a.patternsLoaded())continue;let P=a.getBucket(r);if(!P)continue;let M=P.programConfigurations.get(r.id),I=t.useProgram(f,M),S=t.getTerrainDataForTile(u,l);d&&(t.context.activeTexture.set(h.TEXTURE0),a.imageAtlasTexture.bind(h.LINEAR,h.CLAMP_TO_EDGE),M.updatePaintBuffers(_)),rF(M,c,T,a,r);let C=x.getProjectionData({overscaledTileID:u,applyGlobeMatrix:!l,applyTerrainMatrix:!0}),E=(0,p.Lr)(x,a,b,w);if(n){v=P.indexBuffer2,y=P.segments2;let i=[h.drawingBufferWidth,h.drawingBufferHeight];g="fillOutlinePattern"===f&&d?ix(t,_,a,i,E):iy(i,E)}else v=P.indexBuffer,y=P.segments,g=d?ig(t,_,a,E):iv(E);let z=t.stencilModeForClipping(u);I.draw(t.context,m,o,z,s,rP.backCCW,g,S,C,r.id,P.layoutVertexBuffer,v,y,r.paint,t.transform.zoom,M)}}function rO(t,i,r,a,o,s,n,l){let h=t.context,c=h.gl,u="fill-extrusion-pattern",d=r.paint.get(u),_=d.constantOr(1),m=r.getCrossfadeParameters(),f=r.paint.get("fill-extrusion-opacity"),g=d.constantOr(null),v=t.transform;
801for(let d of a){let a=i.getTile(d),y=a.getBucket(r);if(!y)continue;let x=t.style.map.terrain?.getTerrainData(d),b=y.programConfigurations.get(r.id),w=t.useProgram(_?"fillExtrusionPattern":"fillExtrusion",b);_&&(t.context.activeTexture.set(c.TEXTURE0),a.imageAtlasTexture.bind(c.LINEAR,c.CLAMP_TO_EDGE),b.updatePaintBuffers(m));let T=v.getProjectionData({overscaledTileID:d,applyGlobeMatrix:!l,applyTerrainMatrix:!0});rF(b,u,g,a,r);let P=(0,p.Lr)(v,a,r.paint.get("fill-extrusion-translate"),r.paint.get("fill-extrusion-translate-anchor")),M=r.paint.get("fill-extrusion-vertical-gradient"),I=_?im(t,M,f,P,d,m,a):ip(t,M,f,P);w.draw(h,h.gl.TRIANGLES,o,s,n,rP.backCCW,I,x,T,r.id,y.layoutVertexBuffer,y.indexBuffer,y.segments,r.paint,t.transform.zoom,b,t.style.map.terrain&&y.centroidVertexBuffer)}}function rN(t,i,r,a,o,s,n,l,h){let c=t.style.projection,u=t.context,d=t.transform,_=u.gl,p=[`#define NUM_ILLUMINATION_SOURCES ${r.paint.get("hillshade-highlight-color").values.length}`],m=t.useProgram("hillshade",null,!1,p),f=!t.options.moving;for(let p of a){let a=i.getTile(p),g=a.fbo;if(!g)continue;let v=c.getMeshFromTileID(u,p.canonical,l,!0,"raster"),y=t.getTerrainDataForTile(p,h);u.activeTexture.set(_.TEXTURE0),_.bindTexture(_.TEXTURE_2D,g.colorAttachment.get());let x=d.getProjectionData({overscaledTileID:p,aligned:f,applyGlobeMatrix:!h,applyTerrainMatrix:!0});m.draw(u,_.TRIANGLES,s,o[p.overscaledZ],n,rP.backCCW,iS(t,a,r),y,x,r.id,v.vertexBuffer,v.indexBuffer,v.segments)}}let rZ=0;function rU(t,i,r,a,o,s,n,l,h){let c=t.style.projection,u=t.context,d=t.transform,_=u.gl,m=t.useProgram("colorRelief"),f=!t.options.moving,g="nearest"===r.paint.get("resampling")?_.NEAREST:_.LINEAR,v=!0,y=0;for(let x of a){let a=i.getTile(x),b=a.dem;if(v){let t=rZ||=_.getParameter(_.MAX_TEXTURE_SIZE),{elevationTexture:i,colorTexture:a}=r.getColorRampTextures(u,t,b.getUnpackVector());u.activeTexture.set(_.TEXTURE1),i.bind(_.NEAREST,_.CLAMP_TO_EDGE),u.activeTexture.set(_.TEXTURE4),a.bind(_.LINEAR,_.CLAMP_TO_EDGE),v=!1,y=i.size[0]}if(!b?.data)continue;let w=b.stride,T=b.getPixels();if(u.activeTexture.set(_.TEXTURE0),u.pixelStoreUnpackPremultiplyAlpha.set(!1),a.demTexture||=t.getTileTexture(w),a.demTexture){let t=a.demTexture;t.update(T,{premultiply:!1}),t.bind(g,_.CLAMP_TO_EDGE)}else a.demTexture=new p.xt(u,T,_.RGBA,{premultiply:!1}),a.demTexture.bind(g,_.CLAMP_TO_EDGE);let P=c.getMeshFromTileID(u,x.canonical,l,!0,"raster"),M=t.getTerrainDataForTile(x,h),I=d.getProjectionData({overscaledTileID:x,aligned:f,applyGlobeMatrix:!h,applyTerrainMatrix:!0});m.draw(u,_.TRIANGLES,s,o[x.overscaledZ],n,rP.backCCW,iE(r,a.dem,y),M,I,r.id,P.vertexBuffer,P.indexBuffer,P.segments)}}let rV=[new p.Vi(0,0),new p.Vi(p.Ur,0),new p.Vi(p.Ur,p.Ur),new p.Vi(0,p.Ur)];function rG(t,i,r,a,o,s,n,l,h,c=!1,u=!1){let d=a[a.length-1].overscaledZ,_=t.context,m=_.gl,f=t.useProgram("raster"),g=t.transform,y=t.style.projection,x=t.colorModeForRenderPass(),b=!t.options.moving,w=r.paint.get("raster-opacity"),T="nearest"===r.paint.get("resampling")||"nearest"===r.paint.get("raster-resampling")?m.NEAREST:m.LINEAR,P=r.paint.get("raster-fade-duration"),M=!!t.style.map.terrain;for(let I of a){let a=t.getDepthModeForSublayer(I.overscaledZ-d,1===w?rw.ReadWrite:rw.ReadOnly,m.LESS),S=i.getTile(I);_.activeTexture.set(m.TEXTURE0),S.texture.bind(T,m.CLAMP_TO_EDGE,m.LINEAR_MIPMAP_NEAREST),_.activeTexture.set(m.TEXTURE1);let{parentTile:C,parentScaleBy:E,parentTopLeft:z,fadeValues:R}=function(t,i,r,a){let o={parentTile:null,parentScaleBy:1,parentTopLeft:[0,0],fadeValues:{tileOpacity:1,parentTileOpacity:1,fadeMix:{opacity:1,mix:0}}};if(0===r||a)return o;if(t.fadingParentID){let a=i.getLoadedTile(t.fadingParentID);if(!a)return o;let s=2**(a.tileID.overscaledZ-t.tileID.overscaledZ);return{parentTile:a,parentScaleBy:s,parentTopLeft:[t.tileID.canonical.x*s%1,t.tileID.canonical.y*s%1],fadeValues:function(t,i,r){let a=v(),o=(a-t.timeAdded)/r,s=(a-i.timeAdded)/r,n=1===t.fadingDirection,l=(0,p.Kn)(o,0,1),h=(0,p.Kn)(1-s,0,1),c=n?l:h;return{tileOpacity:c,parentTileOpacity:n?h:l,fadeMix:{opacity:1,mix:1-c}}}(t,a,r)}}return t.selfFading?{parentTile:null,parentScaleBy:1,parentTopLeft:[0,0],fadeValues:function(t,i){let r=(v()-t.timeAdded)/i,a=(0,p.Kn)(r,0,1);return{tileOpacity:a,fadeMix:{opacity:a,mix:0}}}(t,r)}:o}(S,i,P,M);S.fadeOpacity=R.tileOpacity,C?(C.fadeOpacity=R.parentTileOpacity,C.texture.bind(T,m.CLAMP_TO_EDGE,m.LINEAR_MIPMAP_NEAREST)):S.texture.bind(T,m.CLAMP_TO_EDGE,m.LINEAR_MIPMAP_NEAREST),S.texture.useMipmap&&_.extTextureFilterAnisotropic&&t.transform.pitch>t.options.anisotropicFilterPitch&&m.texParameterf(m.TEXTURE_2D,_.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,_.extTextureFilterAnisotropicMax);let D=t.getTerrainDataForTile(I,u),A=g.getProjectionData({overscaledTileID:I,aligned:b,applyGlobeMatrix:!u,applyTerrainMatrix:!0}),L=ef(z,E,R.fadeMix,r,l,h),F=y.getMeshFromTileID(_,I.canonical,s,n,"raster"),k=o?o[I.overscaledZ]:rT.disabled;f.draw(_,m.TRIANGLES,a,k,x,c?rP.frontCCW:rP.backCCW,L,D,A,r.id,F.vertexBuffer,F.indexBuffer,F.segments)}}let rq=new p.dn(1,0,0,1),rW=new p.dn(0,1,0,1),r$=new p.dn(0,0,1,1),rH=new p.dn(1,0,1,1),rX=new p.dn(0,1,1,1);function rK(t,i,r,a){rJ(t,0,i+r/2,t.transform.width,r,a)}function rY(t,i,r,a){rJ(t,i-r/2,0,r,t.transform.height,a)}function rJ(t,i,r,a,o,s){let n=t.context,l=n.gl;l.enable(l.SCISSOR_TEST),l.scissor(i*t.pixelRatio,r*t.pixelRatio,a*t.pixelRatio,o*t.pixelRatio),n.clear({color:s}),l.disable(l.SCISSOR_TEST)}function rQ(t,i){if(!i.mesh){let r=new p.Gt;r.emplaceBack(-1,-1),r.emplaceBack(1,-1),r.emplaceBack(1,1),r.emplaceBack(-1,1);let a=new p.Jt;a.emplaceBack(0,1,2),a.emplaceBack(0,2,3),i.mesh=new tM(t.createVertexBuffer(r,tI.members),t.createIndexBuffer(a),p.Bt.simpleSegment(0,0,r.length,a.length))}return i.mesh}
801let r0={symbol:function(t,i,r,a,o,s){if("translucent"!==t.renderPass)return;let{isRenderingToTexture:n}=s,l=rT.disabled,h=t.colorModeForRenderPass();(r._unevaluatedLayout.hasValue("text-variable-anchor")||r._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&function(t,i,r,a,o,s,n,l,h){let c=i.transform,u=i.style.map.terrain,d="map"===o,_="map"===s;for(let o of t){let t=a.getTile(o),s=t.getBucket(r);if(!s?.text?.segments.get().length)continue;let m=s.textSizeData,f=(0,p.j)(m,c.zoom),g=(0,p.Hr)(t,1,i.transform.zoom),v=eU(d,i.transform,g),y="none"!==r.layout.get("icon-text-fit")&&s.hasIconData();if(f){let i=2**(c.zoom-t.tileID.overscaledZ),r=u?(t,i)=>u.getElevation(o,t,i):null;!function(t,i,r,a,o,s,n,l,h,c,u,d){let _=t.text.placedSymbolArray,m=t.text.dynamicLayoutVertexArray,f=t.icon.dynamicLayoutVertexArray,g={};m.clear();for(let f=0;f<_.length;f++){let v=_.get(f),y=t.allowVerticalPlacement&&!v.placedOrientation,x=v.hidden||!v.crossTileID||y?null:a[v.crossTileID];if(x){let a=new p.Vi(v.anchorX,v.anchorY),_={getElevation:d,width:o.width,height:o.height,pitchedLabelPlaneMatrix:s,lineVertexArray:null,pitchWithMap:r,transform:o,projectionCache:null,tileAnchorPoint:a,translation:c,unwrappedTileID:u},f=r?eJ(a.x,a.y,_):eK(a.x,a.y,_),y=.5+o.cameraToCenterDistance/f.signedDistanceFromCamera*.5,b=(0,p.A)(t.textSizeData,l,v)*y/24;r&&(b*=t.tilePixelRatio/n);let{width:w,height:T,anchor:P,textOffset:M,textBoxScale:I}=x,S=function(t,i,r,a,o,s){let{horizontalAlign:n,verticalAlign:l}=(0,p.N)(t);return new p.Vi((-(n-.5)*i/o+a[0])*s,(-(l-.5)*r/o+a[1])*s)}(P,w,T,M,I,b),C=o.getPitchedTextCorrection(a.x+c[0],a.y+c[1],u),E=function(t,i,r,a,o,s){let n=i.tileAnchorPoint.add(new p.Vi(i.translation[0],i.translation[1]));if(i.pitchWithMap){let t=a.mult(s);r||(t=t.rotate(-o));let l=n.add(t);return eG(l.x,l.y,i.pitchedLabelPlaneMatrix,i.getElevation).point}if(r){let r=eK(i.tileAnchorPoint.x+1,i.tileAnchorPoint.y,i).point.sub(t),o=Math.atan(r.y/r.x)+(r.x<0?Math.PI:0);return t.add(a.rotate(o))}return t.add(a)}(f.point,_,i,S,-o.bearingInRadians,C),z=t.allowVerticalPlacement&&2===v.placedOrientation?Math.PI/2:0;for(let t=0;t<v.numGlyphs;t++)(0,p.O)(m,E,z);h&&v.associatedIconIndex>=0&&(g[v.associatedIconIndex]={shiftedAnchor:E,angle:z})}else e2(v.numGlyphs,m)}if(h){f.clear();let i=t.icon.placedSymbolArray;for(let t=0;t<i.length;t++){let r=i.get(t);if(r.hidden)e2(r.numGlyphs,f);else{let i=g[t];if(i)for(let t=0;t<r.numGlyphs;t++)(0,p.O)(f,i.shiftedAnchor,i.angle);else e2(r.numGlyphs,f)}}t.icon.dynamicLayoutVertexBuffer.updateData(f)}t.text.dynamicLayoutVertexBuffer.updateData(m)}(s,d,_,h,c,v,i,f,y,(0,p.Lr)(c,t,n,l),o.toUnwrapped(),r)}}}(a,t,r,i,r.layout.get("text-rotation-alignment"),r.layout.get("text-pitch-alignment"),r.paint.get("text-translate"),r.paint.get("text-translate-anchor"),o),0!==r.paint.get("icon-opacity").constantOr(1)&&rS(t,i,r,a,!1,r.paint.get("icon-translate"),r.paint.get("icon-translate-anchor"),r.layout.get("icon-rotation-alignment"),r.layout.get("icon-pitch-alignment"),r.layout.get("icon-keep-upright"),l,h,n),0!==r.paint.get("text-opacity").constantOr(1)&&rS(t,i,r,a,!0,r.paint.get("text-translate"),r.paint.get("text-translate-anchor"),r.layout.get("text-rotation-alignment"),r.layout.get("text-pitch-alignment"),r.layout.get("text-keep-upright"),l,h,n),i.map.showCollisionBoxes&&(rM(t,i,r,a,!0),rM(t,i,r,a,!1))},circle:function(t,i,r,a,o){if("translucent"!==t.renderPass)return;let{isRenderingToTexture:s}=o,n=r.paint.get("circle-opacity"),l=r.paint.get("circle-stroke-width"),h=r.paint.get("circle-stroke-opacity"),c=!r.layout.get("circle-sort-key").isConstant();if(0===n.constantOr(1)&&(0===l.constantOr(1)||0===h.constantOr(1)))return;let u=t.context,d=u.gl,_=t.transform,m=t.getDepthModeForSublayer(0,rw.ReadOnly),f=rT.disabled,g=t.colorModeForRenderPass(),v=[],y=_.getCircleRadiusCorrection();for(let o of a){let a=i.getTile(o),n=a.getBucket(r);if(!n)continue;let l=r.paint.get("circle-translate"),h=r.paint.get("circle-translate-anchor"),u=(0,p.Lr)(_,a,l,h),d=n.programConfigurations.get(r.id),m=t.useProgram("circle",d),f=n.layoutVertexBuffer,g=n.indexBuffer,x=t.style.map.terrain?.getTerrainData(o),b={programConfiguration:d,program:m,layoutVertexBuffer:f,indexBuffer:g,uniformValues:ib(t,a,r,u,y),terrainData:x,projectionData:_.getProjectionData({overscaledTileID:o,applyGlobeMatrix:!s,applyTerrainMatrix:!0})};if(c)for(let t of n.segments.get())v.push({segments:new p.Bt([t]),sortKey:t.sortKey,state:b});else v.push({segments:n.segments,sortKey:0,state:b})}for(let i of(c&&v.sort((t,i)=>t.sortKey-i.sortKey),v)){let{programConfiguration:a,program:o,layoutVertexBuffer:s,indexBuffer:n,uniformValues:l,terrainData:h,projectionData:c}=i.state,_=i.segments;o.draw(u,d.TRIANGLES,m,f,g,rP.backCCW,l,h,c,r.id,s,n,_,r.paint,t.transform.zoom,a)}},heatmap:function(t,i,r,a,o){if(0===r.paint.get("heatmap-opacity"))return;let s=t.context,{isRenderingToTexture:n,isRenderingGlobe:l}=o;if(t.style.map.terrain){for(let o of a){let a=i.getTile(o);i.hasRenderableParent(o)||("offscreen"===t.renderPass?function(t,i,r,a,o){let s=t.context,n=s.gl,l=rT.disabled,h=new rx([n.ONE,n.ONE],p.dn.transparent,[!0,!0,!0,!0]),c=i.getBucket(r);
801if(!c)return;let u=a.key,d=r.heatmapFbos.get(u);d||(d=rE(s,i.tileSize,i.tileSize),r.heatmapFbos.set(u,d)),s.bindFramebuffer.set(d.framebuffer),s.viewport.set([0,0,i.tileSize,i.tileSize]),s.clear({color:p.dn.transparent});let _=c.programConfigurations.get(r.id),m=t.useProgram("heatmap",_,!o),f=t.transform.getProjectionData({overscaledTileID:i.tileID,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),g=t.style.map.terrain.getTerrainData(a);m.draw(s,n.TRIANGLES,rw.disabled,l,h,rP.disabled,iM(i,t.transform.zoom,r.paint.get("heatmap-intensity"),1),g,f,r.id,c.layoutVertexBuffer,c.indexBuffer,c.segments,r.paint,t.transform.zoom,_)}(t,a,r,o,l):"translucent"===t.renderPass&&function(t,i,r,a,o){let s=t.context,n=s.gl,l=t.transform;s.setColorMode(t.colorModeForRenderPass());let h=rz(s,i),c=r.key,u=i.heatmapFbos.get(c);if(!u)return;s.activeTexture.set(n.TEXTURE0),n.bindTexture(n.TEXTURE_2D,u.colorAttachment.get()),s.activeTexture.set(n.TEXTURE1),h.bind(n.LINEAR,n.CLAMP_TO_EDGE);let d=l.getProjectionData({overscaledTileID:r,applyTerrainMatrix:o,applyGlobeMatrix:!a});t.useProgram("heatmapTexture").draw(s,n.TRIANGLES,rw.disabled,rT.disabled,t.colorModeForRenderPass(),rP.disabled,iI(t,i,0,1),null,d,i.id,t.rasterBoundsBuffer,t.quadTriangleIndexBuffer,t.rasterBoundsSegments,i.paint,l.zoom),u.destroy(),i.heatmapFbos.delete(c)}(t,r,o,n,l))}s.viewport.set([0,0,t.width,t.height])}else{var h,c;let o,s,n;"offscreen"===t.renderPass?function(t,i,r,a){var o,s,n;let l,h,c=t.context,u=c.gl,d=t.transform,_=rT.disabled,m=new rx([u.ONE,u.ONE],p.dn.transparent,[!0,!0,!0,!0]);for(let f of(o=c,s=t,n=r,l=o.gl,o.activeTexture.set(l.TEXTURE1),o.viewport.set([0,0,s.width/4,s.height/4]),(h=n.heatmapFbos.get(p.Ct))?(l.bindTexture(l.TEXTURE_2D,h.colorAttachment.get()),o.bindFramebuffer.set(h.framebuffer)):(h=rE(o,s.width/4,s.height/4),n.heatmapFbos.set(p.Ct,h)),c.clear({color:p.dn.transparent}),a)){if(i.hasRenderableParent(f))continue;let a=i.getTile(f),o=a.getBucket(r);if(!o)continue;let s=o.programConfigurations.get(r.id),n=t.useProgram("heatmap",s),l=d.getProjectionData({overscaledTileID:f,applyGlobeMatrix:!0,applyTerrainMatrix:!1}),h=d.getCircleRadiusCorrection();n.draw(c,u.TRIANGLES,rw.disabled,_,m,rP.backCCW,iM(a,d.zoom,r.paint.get("heatmap-intensity"),h),null,l,r.id,o.layoutVertexBuffer,o.indexBuffer,o.segments,r.paint,d.zoom,s)}c.viewport.set([0,0,t.width,t.height])}(t,i,r,a):"translucent"===t.renderPass&&(h=t,c=r,s=(o=h.context).gl,o.setColorMode(h.colorModeForRenderPass()),(n=c.heatmapFbos.get(p.Ct))&&(o.activeTexture.set(s.TEXTURE0),s.bindTexture(s.TEXTURE_2D,n.colorAttachment.get()),o.activeTexture.set(s.TEXTURE1),rz(o,c).bind(s.LINEAR,s.CLAMP_TO_EDGE),h.useProgram("heatmapTexture").draw(o,s.TRIANGLES,rw.disabled,rT.disabled,h.colorModeForRenderPass(),rP.disabled,iI(h,c,0,1),null,null,c.id,h.viewportBuffer,h.quadTriangleIndexBuffer,h.viewportSegments,c.paint,h.transform.zoom)))}},line:function(t,i,r,a,o){if("translucent"!==t.renderPass)return;let s=r.paint.get("line-opacity"),n=r.paint.get("line-width"),l=r.paint.get("line-layer-opacity");if(0===s.constantOr(1)||0===n.constantOr(1)||0===l)return;let h=!!t.style.map.terrain;if(l<1){let s=rR(t,r,a,h);rL(t,i,r,a,o,h),rD(t,l,s,r);return}rL(t,i,r,a,o,h)},fill:function(t,i,r,a,o){let s=r.paint.get("fill-color"),n=r.paint.get("fill-opacity"),l=r.paint.get("fill-layer-opacity");if(0===n.constantOr(1)||0===l)return;if(l<1){if("translucent"!==t.renderPass)return;let s=rR(t,r,a,!!t.style.map.terrain);rk(t,i,r,a,o),rD(t,l,s,r);return}let h=r.paint.get("fill-pattern"),c=t.opaquePassEnabledForLayer()&&!h.constantOr(1)&&1===s.constantOr(p.dn.transparent).a&&1===n.constantOr(0);if(c&&"opaque"===t.renderPass){let{isRenderingToTexture:s}=o,n=t.colorModeForRenderPass();rj(t,i,r,a,t.getDepthModeForSublayer(1,rw.ReadWrite),n,!1,s);return}if(c&&"translucent"===t.renderPass)return void rB(t,i,r,a,o);"translucent"===t.renderPass&&rk(t,i,r,a,o)},fillExtrusion:function(t,i,r,a,o){let s=r.paint.get("fill-extrusion-opacity");if(0===s)return;let{isRenderingToTexture:n}=o;if("translucent"===t.renderPass){let o=new rw(t.context.gl.LEQUAL,rw.ReadWrite,t.depthRangeFor3D);if(1!==s||r.paint.get("fill-extrusion-pattern").constantOr(1))rO(t,i,r,a,o,rT.disabled,rx.disabled,n),rO(t,i,r,a,o,t.stencilModeFor3D(),t.colorModeForRenderPass(),n);else{let s=t.colorModeForRenderPass();rO(t,i,r,a,o,rT.disabled,s,n)}}},hillshade:function(t,i,r,a,o){if("offscreen"!==t.renderPass&&"translucent"!==t.renderPass)return;let{isRenderingToTexture:s}=o,n=t.context,l=t.style.projection.useSubdivision,h=t.getDepthModeForSublayer(0,rw.ReadOnly),c=t.colorModeForRenderPass();if("offscreen"===t.renderPass)(function(t,i,r,a,o,s,n){let l=t.context,h=l.gl,c="nearest"===a.paint.get("resampling")?h.NEAREST:h.LINEAR;for(let u of r){let r=i.getTile(u),d=r.dem;if(!d?.data||!r.needsHillshadePrepare)continue;let _=d.dim,m=d.stride,f=d.getPixels();if(l.activeTexture.set(h.TEXTURE1),l.pixelStoreUnpackPremultiplyAlpha.set(!1),r.demTexture||=t.getTileTexture(m),r.demTexture){let t=r.demTexture;t.update(f,{premultiply:!1}),t.bind(h.NEAREST,h.CLAMP_TO_EDGE)}else r.demTexture=new p.xt(l,f,h.RGBA,{premultiply:!1}),r.demTexture.bind(h.NEAREST,h.CLAMP_TO_EDGE);l.activeTexture.set(h.TEXTURE0);let g=r.fbo;if(!g){let t=new p.xt(l,{width:_,height:_,data:null},h.RGBA);t.bind(c,h.CLAMP_TO_EDGE),(g=r.fbo=l.createFramebuffer(_,_,!0,!1)).colorAttachment.set(t.texture)}l.bindFramebuffer.set(g.framebuffer),l.viewport.set([0,0,_,_]),t.useProgram("hillshadePrepare").draw(l,h.TRIANGLES,o,s,n,rP.disabled,iC(r.tileID,d),null,null,a.id,t.rasterBoundsBuffer,t.quadTriangleIndexBuffer,t.rasterBoundsSegments),r.needsHillshadePrepare=!1}})(t,i,a,r,h,rT.disabled,c),n.viewport.set([0,0,t.width,t.height]);else if("translucent"===t.renderPass)if(l){let[o,n,l]=t.stencilConfigForOverlapTwoPass(a);rN(t,i,r,l,o,h,c,!1,s),rN(t,i,r,l,n,h,c,!0,s)}else{let[o,n]=t.getStencilConfigForOverlapAndUpdateStencilID(a);rN(t,i,r,n,o,h,c,!1,s)}},colorRelief:function(t,i,r,a,o){if("translucent"!==t.renderPass||!a.length)return;let{isRenderingToTexture:s}=o,n=t.style.projection.useSubdivision,l=t.getDepthModeForSublayer(0,rw.ReadOnly),h=t.colorModeForRenderPass();if(n){let[o,n,c]=t.stencilConfigForOverlapTwoPass(a);rU(t,i,r,c,o,l,h,!1,s),rU(t,i,r,c,n,l,h,!0,s)}else{let[o,n]=t.getStencilConfigForOverlapAndUpdateStencilID(a);rU(t,i,r,n,o,l,h,!1,s)}},raster:function(t,i,r,a,o){if("translucent"!==t.renderPass||0===r.paint.get("raster-opacity")||!a.length)return;let{isRenderingToTexture:s}=o,n=i.getSource(),l=t.style.projection.useSubdivision;if(n instanceof eg)rG(t,i,r,a,null,!1,!1,n.tileCoords,n.perspectiveTransform,n.flippedWindingOrder,s);else if(l){let[o,n,l]=t.stencilConfigForOverlapTwoPass(a);
801rG(t,i,r,l,o,!1,!0,rV,em,!1,s),rG(t,i,r,l,n,!0,!0,rV,em,!1,s)}else{let[o,n]=t.getStencilConfigForOverlapAndUpdateStencilID(a);rG(t,i,r,n,o,!1,!0,rV,em,!1,s)}},background:function(t,i,r,a,o){let s=r.paint.get("background-color"),n=r.paint.get("background-opacity");if(0===n)return;let{isRenderingToTexture:l}=o,h=t.context,c=h.gl,u=t.style.projection,d=t.transform,_=d.tileSize,p=r.paint.get("background-pattern");if(t.isPatternMissing(p))return;let m=!p&&1===s.a&&1===n&&t.opaquePassEnabledForLayer()?"opaque":"translucent";if(t.renderPass!==m)return;let f=rT.disabled,g=t.getDepthModeForSublayer(0,"opaque"===m?rw.ReadWrite:rw.ReadOnly),v=t.colorModeForRenderPass(),y=t.useProgram(p?"backgroundPattern":"background"),x=a||eD(d,{tileSize:_,terrain:t.style.map.terrain});p&&(h.activeTexture.set(c.TEXTURE0),t.patternAtlas.bind(t.context));let b=r.getCrossfadeParameters();for(let i of x){let a=d.getProjectionData({overscaledTileID:i,applyGlobeMatrix:!l,applyTerrainMatrix:!0}),o=p?iZ(n,t,p,{tileID:i,tileSize:_},b):iN(n,s),m=t.getTerrainDataForTile(i,l),x=u.getMeshFromTileID(h,i.canonical,!1,!0,"raster");y.draw(h,c.TRIANGLES,g,f,v,rP.backCCW,o,m,a,r.id,x.vertexBuffer,x.indexBuffer,x.segments)}},sky:function(t,i){var r,a;let o,s,n,l,h=t.context,c=h.gl,u=(r=t.transform,a=t.pixelRatio,o=Math.cos(r.rollInRadians),s=Math.sin(r.rollInRadians),n=(0,p.X)(r),l=r.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}).projectionTransition,{u_sky_color:i.properties.get("sky-color"),u_horizon_color:i.properties.get("horizon-color"),u_horizon:[(r.width/2-n*s)*a,(r.height/2+n*o)*a],u_horizon_normal:[-s,o],u_sky_horizon_blend:i.properties.get("sky-horizon-blend")*r.height/2*a,u_sky_blend:l}),d=new rw(c.LEQUAL,rw.ReadWrite,[0,1]),_=rT.disabled,m=t.colorModeForRenderPass(),f=t.useProgram("sky"),g=rQ(h,i);f.draw(h,c.TRIANGLES,d,_,m,rP.disabled,u,null,void 0,"sky",g.vertexBuffer,g.indexBuffer,g.segments)},atmosphere:function(t,i,r){var a;let o,s,n=t.context,l=n.gl,h=t.useProgram("atmosphere"),c=new rw(l.LEQUAL,rw.ReadOnly,[0,1]),u=t.transform,d=(a=t.transform,o=r.getCartesianPosition(),(0,p.ci)(o,o),s=(0,p.Ei)(new Float64Array(16)),"map"===r.properties.get("anchor")&&((0,p.Ni)(s,s,a.rollInRadians),(0,p.ji)(s,s,-a.pitchInRadians),(0,p.Ni)(s,s,a.bearingInRadians),(0,p.ji)(s,s,a.center.lat*Math.PI/180),(0,p.Mi)(s,s,-a.center.lng*Math.PI/180)),(0,p._i)(o,o,s),o),_=u.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),m=i.properties.get("atmosphere-blend")*_.projectionTransition;if(0===m)return;let f=tX(u.worldSize,u.center.lat),g=u.inverseProjectionMatrix,v=new Float64Array(4);v[3]=1,(0,p.ti)(v,v,u.modelViewProjectionMatrix),v[0]/=v[3],v[1]/=v[3],v[2]/=v[3],v[3]=1,(0,p.ti)(v,v,g),v[0]/=v[3],v[1]/=v[3],v[2]/=v[3],v[3]=1;let y={u_sun_pos:d,u_atmosphere_blend:m,u_globe_position:[v[0],v[1],v[2]],u_globe_radius:f,u_inv_proj_matrix:g},x=rQ(n,i);h.draw(n,l.TRIANGLES,c,rT.disabled,rx.alphaBlended,rP.disabled,y,null,null,"atmosphere",x.vertexBuffer,x.indexBuffer,x.segments)},custom:function(t,i,r,a){let{isRenderingGlobe:o}=a,s=t.context,n=r.implementation,l=t.style.projection,h=t.transform,c=h.getProjectionDataForCustomLayer(o),u={farZ:h.farZ,nearZ:h.nearZ,fov:h.fov*Math.PI/180,modelViewProjectionMatrix:h.modelViewProjectionMatrix,projectionMatrix:h.projectionMatrix,shaderData:{variantName:l.shaderVariantName,vertexShaderPrelude:`const float PI = 3.141592653589793;
802uniform mat4 u_projection_matrix;
803${l.shaderPreludeCode.vertexSource}`,define:l.shaderDefine},defaultProjectionData:c,getProjectionData:t=>h.getProjectionData({overscaledTileID:new p.g(t.tileID.canonical.z,t.tileID.wrap??0,t.tileID.canonical.z,t.tileID.canonical.x,t.tileID.canonical.y),aligned:t.aligned,applyGlobeMatrix:t.applyGlobeMatrix,applyTerrainMatrix:t.applyTerrainMatrix})},d=n.renderingMode?n.renderingMode:"2d";if("offscreen"===t.renderPass){let i=n.prerender;i&&(t.setCustomLayerDefaults(),s.setColorMode(t.colorModeForRenderPass()),i.call(n,s.gl,u),s.setDirty(),t.setBaseState())}else if("translucent"===t.renderPass){t.setCustomLayerDefaults(),s.setColorMode(t.colorModeForRenderPass()),s.setStencilMode(rT.disabled);let i="3d"===d?t.getDepthModeFor3D():t.getDepthModeForSublayer(0,rw.ReadOnly);s.setDepthMode(i),n.render(s.gl,u),s.setDirty(),t.setBaseState(),s.bindFramebuffer.set(null)}},debug:function(t,i,r){for(let a of r)!function(t,i,r){let a=t.context,o=a.gl,s=t.useProgram("debug"),n=rw.disabled,l=rT.disabled,h=t.colorModeForRenderPass(),c="$debug",u=t.style.map.terrain?.getTerrainData(r);a.activeTexture.set(o.TEXTURE0);let d=Math.floor((i.getTileByID(r.key).latestRawTileData?.byteLength||0)/1024),_=512/Math.min(i.getTile(r).tileSize,512)*(r.overscaledZ/t.transform.zoom)*.5,m=r.canonical.toString();r.overscaledZ!==r.canonical.z&&(m+=` => ${r.overscaledZ}`),function(t,i){t.initDebugOverlayCanvas();let r=t.debugOverlayCanvas,a=t.context.gl,o=t.debugOverlayCanvas.getContext("2d");o.clearRect(0,0,r.width,r.height),o.shadowColor="white",o.shadowBlur=2,o.lineWidth=1.5,o.strokeStyle="white",o.textBaseline="top",o.font="bold 36px Open Sans, sans-serif",o.fillText(i,5,5),o.strokeText(i,5,5),t.debugOverlayTexture.update(r),t.debugOverlayTexture.bind(a.LINEAR,a.CLAMP_TO_EDGE)}(t,`${m} ${d}kB`);let f=t.transform.getProjectionData({overscaledTileID:r,applyGlobeMatrix:!0,applyTerrainMatrix:!0});s.draw(a,o.TRIANGLES,n,l,rx.alphaBlended,rP.disabled,iP(p.dn.transparent,_),null,f,c,t.debugBuffer,t.quadTriangleIndexBuffer,t.debugSegments),s.draw(a,o.LINE_STRIP,n,l,h,rP.disabled,iP(p.dn.red),u,f,c,t.debugBuffer,t.tileBorderIndexBuffer,t.debugSegments)}(t,i,a)},debugPadding:function(t){var i,r,a,o;let s=t.transform.padding;rK(t,t.transform.height-(s.top||0),3,rq),rK(t,s.bottom||0,3,rW),rY(t,s.left||0,3,r$),rY(t,t.transform.width-(s.right||0),3,rH);let n=t.transform.centerPoint;i=t,r=n.x,a=t.transform.height-n.y,rJ(i,r-1,a-10,2,20,o=rX),rJ(i,r-10,a-1,20,2,o)},terrainDepth:function(t,i){let r=t.context,a=r.gl,o=t.transform,s=rx.unblended,n=new rw(a.LEQUAL,rw.ReadWrite,[0,1]),l=i.tileManager.getRenderableTiles(),h=t.useProgram("terrainDepth");for(let c of(r.bindFramebuffer.set(i.getFramebuffer("depth").framebuffer),r.viewport.set([0,0,t.width/devicePixelRatio,t.height/devicePixelRatio]),r.clear({color:p.dn.transparent,depth:1}),l)){let t=i.getTerrainMesh(c.tileID),l=i.getTerrainData(c.tileID),u=o.getProjectionData({overscaledTileID:c.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0}
803),d=ih(i.getSkirtLength(o.zoom));h.draw(r,a.TRIANGLES,n,rT.disabled,s,rP.backCCW,d,l,u,"terrain",t.vertexBuffer,t.indexBuffer,t.segments)}r.bindFramebuffer.set(null),r.viewport.set([0,0,t.width,t.height])},terrainCoords:function(t,i){let r=t.context,a=r.gl,o=t.transform,s=rx.unblended,n=new rw(a.LEQUAL,rw.ReadWrite,[0,1]),l=i.getCoordsTexture(),h=i.tileManager.getRenderableTiles(),c=t.useProgram("terrainCoords");for(let u of(r.bindFramebuffer.set(i.getFramebuffer("coords").framebuffer),r.viewport.set([0,0,t.width/devicePixelRatio,t.height/devicePixelRatio]),r.clear({color:p.dn.transparent,depth:1}),i.coordsIndex=[],h)){let t=i.getTerrainMesh(u.tileID),h=i.getTerrainData(u.tileID);r.activeTexture.set(a.TEXTURE0),a.bindTexture(a.TEXTURE_2D,l.texture);let d=ic(255-i.coordsIndex.length,i.getSkirtLength(o.zoom)),_=o.getProjectionData({overscaledTileID:u.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0});c.draw(r,a.TRIANGLES,n,rT.disabled,s,rP.backCCW,d,h,_,"terrain",t.vertexBuffer,t.indexBuffer,t.segments),i.coordsIndex.push(u.tileID.key)}r.bindFramebuffer.set(null),r.viewport.set([0,0,t.width,t.height])}};var r1=class t{constructor(t,i){this.drawFunctions=r0,this.context=new rb(t),this.transform=i,this.layerOpacityFbo=null,this._tileTextures={},this._rttObjectRecyclePool=[],this._rttSharedFbo=null,this.terrainFacilitator={depthDirty:!0,coordsDirty:!1,matrix:(0,p.Ei)(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=eB.maxOverzooming+eB.maxUnderzooming+1,this.depthEpsilon=1/65536,this.crossTileSymbolIndex=new tg}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 t of this.style._order)this.style._layers[t].resize()}setup(){let t=this.context,i=new p.Gt;i.emplaceBack(0,0),i.emplaceBack(p.Ur,0),i.emplaceBack(0,p.Ur),i.emplaceBack(p.Ur,p.Ur),this.tileExtentBuffer=t.createVertexBuffer(i,tI.members),this.tileExtentSegments=p.Bt.simpleSegment(0,0,4,2);let r=new p.Gt;r.emplaceBack(0,0),r.emplaceBack(p.Ur,0),r.emplaceBack(0,p.Ur),r.emplaceBack(p.Ur,p.Ur),this.debugBuffer=t.createVertexBuffer(r,tI.members),this.debugSegments=p.Bt.simpleSegment(0,0,4,5);let a=new p.qt;a.emplaceBack(0,0,0,0),a.emplaceBack(p.Ur,0,p.Ur,0),a.emplaceBack(0,p.Ur,0,p.Ur),a.emplaceBack(p.Ur,p.Ur,p.Ur,p.Ur),this.rasterBoundsBuffer=t.createVertexBuffer(a,io.members),this.rasterBoundsSegments=p.Bt.simpleSegment(0,0,4,2);let o=new p.Gt;o.emplaceBack(0,0),o.emplaceBack(p.Ur,0),o.emplaceBack(0,p.Ur),o.emplaceBack(p.Ur,p.Ur),this.rasterBoundsBufferPosOnly=t.createVertexBuffer(o,tI.members),this.rasterBoundsSegmentsPosOnly=p.Bt.simpleSegment(0,0,4,5);let s=new p.Gt;s.emplaceBack(0,0),s.emplaceBack(1,0),s.emplaceBack(0,1),s.emplaceBack(1,1),this.viewportBuffer=t.createVertexBuffer(s,tI.members),this.viewportSegments=p.Bt.simpleSegment(0,0,4,2);let n=new p.Ut;n.emplaceBack(0),n.emplaceBack(1),n.emplaceBack(3),n.emplaceBack(2),n.emplaceBack(0),this.tileBorderIndexBuffer=t.createIndexBuffer(n);let l=new p.Jt;l.emplaceBack(1,0,2),l.emplaceBack(1,2,3),this.quadTriangleIndexBuffer=t.createIndexBuffer(l);let h=this.context.gl;this.stencilClearMode=new rT({func:h.ALWAYS,mask:0},0,255,h.ZERO,h.ZERO,h.ZERO),this.tileExtentMesh=new tM(this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}clearStencil(){let t=this.context,i=t.gl;this.nextStencilID=1,this.currentStencilSource=void 0;let r=(0,p.Si)();(0,p.ki)(r,0,this.width,this.height,0,0,1),(0,p.Pi)(r,r,[i.drawingBufferWidth,i.drawingBufferHeight,0]),this.useProgram("clippingMask",null,!0).draw(t,i.TRIANGLES,rw.disabled,this.stencilClearMode,rx.disabled,rP.disabled,null,null,{mainMatrix:r,tileMercatorCoords:[0,0,1,1],clippingPlane:[0,0,0,0],projectionTransition:0,fallbackMatrix:r,clipAntimeridian:!1},"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}renderTileClippingMasks(t,i,r){if(this.currentStencilSource===t.source||!t.isTileClipped()||!i?.length)return;this.currentStencilSource=t.source,this.nextStencilID+i.length>256&&this.clearStencil();let a=this.context;a.setColorMode(rx.disabled),a.setDepthMode(rw.disabled);let o={};for(let t of i)o[t.key]=this.nextStencilID++;this.style.projection.useSubdivision&&this._renderTileMasks(o,i,r,!0),this._renderTileMasks(o,i,r,!1),this._tileClippingMaskIDs=o}_renderTileMasks(t,i,r,a){let o=this.context,s=o.gl,n=this.style.projection,l=this.transform,h=this.useProgram("clippingMask");for(let c of i){let i=t[c.key],u=this.getTerrainDataForTile(c,r),d=n.getMeshFromTileID(this.context,c.canonical,a,!0,"stencil"),_=l.getProjectionData({overscaledTileID:c,applyGlobeMatrix:!r,applyTerrainMatrix:!0});h.draw(o,s.TRIANGLES,rw.disabled,new rT({func:s.ALWAYS,mask:0},i,255,s.KEEP,s.KEEP,s.REPLACE),rx.disabled,r?rP.disabled:rP.backCCW,null,u,_,"$clipping",d.vertexBuffer,d.indexBuffer,d.segments)}}getTerrainDataForTile(t,i){return i&&this.style.projection?.name==="mercator"?null:this.style.map.terrain?.getTerrainData(t)||null}_renderTilesDepthBuffer(){let t=this.context,i=t.gl,r=this.style.projection,a=this.transform,o=this.useProgram("depth"),s=this.getDepthModeFor3D();for(let n of eD(a,{tileSize:a.tileSize})){let l=this.style.map.terrain?.getTerrainData(n),h=r.getMeshFromTileID(this.context,n.canonical,!0,!0,"raster"),c=a.getProjectionData({overscaledTileID:n,applyGlobeMatrix:!0,applyTerrainMatrix:!0});o.draw(t,i.TRIANGLES,s,rT.disabled,rx.disabled,rP.backCCW,null,l,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 rT({func:i.NOTEQUAL,mask:255},t,255,i.KEEP,i.KEEP,i.REPLACE)}stencilModeForClipping(t){let i=this.context.gl;return new rT({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((t,i)=>
vendor: 1,835 bytes, line 803
803i.overscaledZ-t.overscaledZ),a=r[r.length-1].overscaledZ,o=r[0].overscaledZ-a+1;if(o>1){this.currentStencilSource=void 0,this.nextStencilID+o>256&&this.clearStencil();let t={};for(let r=0;r<o;r++)t[r+a]=new rT({func:i.GEQUAL,mask:255},r+this.nextStencilID,255,i.KEEP,i.KEEP,i.REPLACE);return this.nextStencilID+=o,[t,r]}return[{[a]:rT.disabled},r]}stencilConfigForOverlapTwoPass(t){let i=this.context.gl,r=t.sort((t,i)=>i.overscaledZ-t.overscaledZ),a=r[r.length-1].overscaledZ,o=r[0].overscaledZ-a+1;if(this.clearStencil(),o>1){let t={},s={};for(let r=0;r<o;r++)t[r+a]=new rT({func:i.GREATER,mask:255},o+1+r,255,i.KEEP,i.KEEP,i.REPLACE),s[r+a]=new rT({func:i.GREATER,mask:255},1+r,255,i.KEEP,i.KEEP,i.REPLACE);return this.nextStencilID=2*o+1,[t,s,r]}return this.nextStencilID=3,[{[a]:new rT({func:i.GREATER,mask:255},2,255,i.KEEP,i.KEEP,i.REPLACE)},{[a]:new rT({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=1/8;return new rx([t.CONSTANT_COLOR,t.ONE],new p.dn(i,i,i,0),[!0,!0,!0,!0])}return"opaque"===this.renderPass?rx.unblended:rx.alphaBlended}getDepthModeForSublayer(t,i,r){if(!this.opaquePassEnabledForLayer())return rw.disabled;let a=1-((1+this.currentLayer)*this.numSublayers+t)*this.depthEpsilon;return new rw(r||this.context.gl.LEQUAL,i,[a,a])}getDepthModeFor3D(){return new rw(this.context.gl.LEQUAL,rw.ReadWrite,this.depthRangeFor3D)}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}render(t,i){this.style=t,this.options=i,this.lineAtlas=t.lineAtlas,this.imageManager=t.imageManager,this.patternAtlas=t.patternAtlas,this.glyphManager=t.glyphManager,this.symbolFadeChange=t.placement.symbolFadeChange(v()),this.imageManager.beginFrame();let r=this.style._order,a=this.style.tileManagers,o={},s={},n={}
803,l={isRenderingToTexture:!1,isRenderingGlobe:t.projection?.transitionState>0};for(let t in a){let i=a[t];i.used&&i.prepare(this.context),o[t]=i.getVisibleCoordinates(!1),s[t]=o[t].slice().reverse(),n[t]=i.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let t=0;t<r.length;t++){let i=r[t];if(this.style._layers[i].is3D()){this.opaquePassCutoff=t;break}}for(let t of(this.maybeDrawDepth(!1),this.renderToTexture&&(this.renderToTexture.prepareForRender(this.style,this.transform.zoom),this.opaquePassCutoff=0),this.renderPass="offscreen",r)){let i=this.style._layers[t];if(!i.hasOffscreenPass()||i.isHidden(this.transform.zoom))continue;let r=s[i.source];("custom"===i.type||r.length)&&this.renderLayer(this,a[i.source],i,r,l)}if(this.context.viewport.set([0,0,this.width,this.height]),this.context.bindFramebuffer.set(null),this.context.clear({color:i.showOverdrawInspector?p.dn.black:p.dn.transparent,depth:1}),this.clearStencil(),this.style.sky&&this.drawFunctions.sky(this,this.style.sky),this._showOverdrawInspector=i.showOverdrawInspector,this.depthRangeFor3D=[0,1-(t._order.length+2)*this.numSublayers*this.depthEpsilon],!this.renderToTexture)for(this.renderPass="opaque",this.currentLayer=r.length-1;this.currentLayer>=0;this.currentLayer--){let t=this.style._layers[r[this.currentLayer]],i=a[t.source],s=o[t.source];this.renderTileClippingMasks(t,s,!1),this.renderLayer(this,i,t,s,l)}this.renderPass="translucent";let h=!1;for(this.currentLayer=0;this.currentLayer<r.length;this.currentLayer++){let t=this.style._layers[r[this.currentLayer]],i=a[t.source];if(this.renderToTexture?.renderLayer(t,l))continue;this.opaquePassEnabledForLayer()||h||(h=!0,l.isRenderingGlobe&&!this.style.map.terrain&&this._renderTilesDepthBuffer());let c=("symbol"===t.type?n:s)[t.source];this.renderTileClippingMasks(t,o[t.source],!!this.renderToTexture),this.renderLayer(this,i,t,c,l)}if(l.isRenderingGlobe&&this.drawFunctions.atmosphere(this,this.style.sky,this.style.light),this.options.showTileBoundaries){let t=function(t,i){let r=null,a=Object.values(t._layers).flatMap(r=>r.source&&!r.isHidden(i)?[t.tileManagers[r.source]]:[]),o=a.filter(t=>"vector"===t.getSource().type),s=a.filter(t=>"vector"!==t.getSource().type),n=t=>{(!r||r.getSource().maxzoom<t.getSource().maxzoom)&&(r=t)};for(let t of o)n(t);if(!r)for(let t of s)n(t);return r}(this.style,this.transform.zoom);t&&this.drawFunctions.debug(this,t,t.getVisibleCoordinates())}this.options.showPadding&&this.drawFunctions.debugPadding(this),this.context.setDefault()}maybeDrawDepth(t){if(!this.style?.map?.terrain)return;let i=this.terrainFacilitator.matrix,r=this.transform.modelViewProjectionMatrix,a=this.terrainFacilitator.depthDirty;a||=t?!(0,p.wi)(i,r):!(0,p.Ci)(i,r),(a||=this.style.map.terrain.tileManager.anyTilesAfterTime(this.terrainFacilitator.renderTime))&&((0,p.xi)(i,r),this.terrainFacilitator.renderTime=v(),this.terrainFacilitator.depthDirty=!1,this.terrainFacilitator.coordsDirty=!0,this.drawFunctions.terrainDepth(this,this.style.map.terrain))}maybeDrawCoords(){this.style?.map?.terrain&&this.terrainFacilitator.coordsDirty&&(this.terrainFacilitator.coordsDirty=!1,this.drawFunctions.terrainCoords(this,this.style.map.terrain))}renderLayer(t,i,r,a,o){if(r.isHidden(this.transform.zoom)||"background"!==r.type&&"custom"!==r.type&&!(a||[]).length)return;this.id=r.id;let s=this.drawFunctions;(0,p.E)(r)?s.symbol(t,i,r,a,this.style.placement.variableOffsets,o):(0,p.Ot)(r)?s.circle(t,i,r,a,o):(0,p.wt)(r)?s.heatmap(t,i,r,a,o):(0,p.H)(r)?s.line(t,i,r,a,o):(0,p.pt)(r)?s.fill(t,i,r,a,o):(0,p.G)(r)?s.fillExtrusion(t,i,r,a,o):(0,p.St)(r)?s.hillshade(t,i,r,a,o):(0,p.yt)(r)?s.colorRelief(t,i,r,a,o):(0,p.Xt)(r)?s.raster(t,i,r,a,o):(0,p.T)(r)?s.background(t,i,r,a,o):(0,p.C)(r)&&s.custom(t,i,r,o)}static{this.MAX_TEXTURE_POOL_SIZE_PER_BUCKET=50}saveTileTexture(i){let r=this._tileTextures[i.size[0]];r?r.length<t.MAX_TEXTURE_POOL_SIZE_PER_BUCKET?r.push(i):i.destroy():this._tileTextures[i.size[0]]=[i]}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&&(i.bindTexture(i.TEXTURE_2D,r.texture.texture),i.texImage2D(i.TEXTURE_2D,0,i.RGBA,t,t,0,i.RGBA,i.UNSIGNED_BYTE,null),r.texture.size=[t,t],r.size=t),r;let a=new p.xt(this.context,{width:t,height:t,data:null},i.RGBA);return a.bind(i.LINEAR,i.CLAMP_TO_EDGE),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 t=this.context.createFramebuffer(r,r,!0,!0),a=this.context.createRenderbuffer(i.DEPTH_STENCIL,r,r);t.depthAttachment.set(a),this._rttSharedFbo={fbo:t,depthRenderbuffer:a,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)}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=[]){this.cache||={};let o=!!this.style.map.terrain,s=this.style.projection,n=r?tT.projectionMercator:s.shaderPreludeCode,l=r?tS:s.shaderDefine,h=`/${r?tC:s.shaderVariantName}`,c=t+(i?i.cacheKey:"")+h+(this._showOverdrawInspector?"/overdraw":"")+(o?"/terrain":"")+(a?`/${a.join("/")}`:"");return this.cache[c]||=new id(this.context,tT[t],i,iV[t],this._showOverdrawInspector,o,n,l,a),this.cache[c]}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(null==this.debugOverlayCanvas){this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512;let t=this.context.gl;this.debugOverlayTexture=new p.xt(this.context,this.debugOverlayCanvas,t.RGBA)}}destroy(){if(this._tileTextures){for(let t in this._tileTextures){let i=this._tileTextures[t];
vendor: 5,321 bytes, line 803
803if(i)for(let t of i)t.destroy()}this._tileTextures={}}for(let t of this._rttObjectRecyclePool)t.texture.destroy();if(this._rttObjectRecyclePool=[],this._rttSharedFbo){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}if(this.layerOpacityFbo?.destroy(),this.layerOpacityFbo=null,this.tileExtentBuffer&&this.tileExtentBuffer.destroy(),this.debugBuffer&&this.debugBuffer.destroy(),this.rasterBoundsBuffer&&this.rasterBoundsBuffer.destroy(),this.rasterBoundsBufferPosOnly&&this.rasterBoundsBufferPosOnly.destroy(),this.viewportBuffer&&this.viewportBuffer.destroy(),this.tileBorderIndexBuffer&&this.tileBorderIndexBuffer.destroy(),this.quadTriangleIndexBuffer&&this.quadTriangleIndexBuffer.destroy(),this.tileExtentMesh&&this.tileExtentMesh.vertexBuffer?.destroy(),this.tileExtentMesh&&this.tileExtentMesh.indexBuffer?.destroy(),this.debugOverlayTexture&&this.debugOverlayTexture.destroy(),this.cache){for(let t in this.cache){let i=this.cache[t];i?.program&&this.context.gl.deleteProgram(i.program)}this.cache={}}this.context&&this.context.setDefault()}overLimit(){let{drawingBufferWidth:t,drawingBufferHeight:i}=this.context.gl;return this.width!==t||this.height!==i}},r2=class extends Error{constructor(t,i){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=t,this.statusMessage=i?.statusMessage??null}};function r3(t,i){let r=!1,a=null,o,s=()=>{a=null,r&&=(t(...o),a=setTimeout(s,i),!1)};return(...t)=>(r=!0,o=t,a||s(),a)}var r4=class{constructor(t){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 i=Array.from(t.keys());i.length>0&&t.delete(i[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=r3(this._updateHashUnthrottled,300),this._hashName=t&&encodeURIComponent(t)}addTo(t){return this._map=t,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(t){let i=this._map.getCenter(),r=Math.round(100*this._map.getZoom())/100,a=10**Math.ceil((r*Math.LN2+Math.log(512/360/.5))/Math.LN10),o=Math.round(i.lng*a)/a,s=Math.round(i.lat*a)/a,n=this._map.getBearing(),l=this._map.getPitch(),h="";if(h+=t?`/${o}/${s}/${r}`:`${r}/${s}/${o}`,(n||l)&&(h+=`/${Math.round(10*n)/10}`),l&&(h+=`/${Math.round(l)}`),this._hashName){let t=this._getHashParams();return t.set(this._hashName,h),`#${decodeURIComponent(t.toString()).replace(/=&/g,"&").replace(/=$/g,"")}`}return`#${h}`}_isValidHash(t){if(t.length<3||t.some(t=>isNaN(+t)))return!1;try{new p.ct(+t[2],+t[1])}catch{return!1}let i=+t[0],r=+(t[3]||0),a=+(t[4]||0);return i>=this._map.getMinZoom()&&i<=this._map.getMaxZoom()&&r>=-180&&r<=180&&a>=this._map.getMinPitch()&&a<=this._map.getMaxPitch()}};let r5={linearity:.3,easing:(0,p.Gn)(0,0,.3,1)},r6=(0,p.or)({deceleration:2500,maxSpeed:1400},r5),r8=(0,p.or)({deceleration:20,maxSpeed:1400},r5),r9=(0,p.or)({deceleration:1e3,maxSpeed:360},r5),r7=(0,p.or)({deceleration:1e3,maxSpeed:90},r5),ae=(0,p.or)({deceleration:1e3,maxSpeed:360},r5);var at=class{constructor(t){this._map=t,this.clear()}clear(){this._inertiaBuffer=[]}record(t){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:v(),settings:t})}_drainInertiaBuffer(){let t=this._inertiaBuffer,i=v();for(;t.length>0&&i-t[0].time>160;)t.shift()}_getVelocityEntries(){let t=this._inertiaBuffer,i=v()-60,r=Math.max(0,t.length-2);for(;r>0&&t[r-1].time>=i;)r--;return t.slice(r)}_onMoveEnd(t){this._drainInertiaBuffer();let i=this._getVelocityEntries();if(i.length<2)return void this.clear();let r={zoom:0,bearing:0,pitch:0,roll:0,pan:new p.Vi(0,0),pinchAround:void 0,around:void 0};for(let{settings:t}of i)t.around&&(r.around=t.around),t.pinchAround&&(r.pinchAround=t.pinchAround);for(let{settings:t}of i.slice(1))r.zoom+=t.zoomDelta||0,r.bearing+=t.bearingDelta||0,r.pitch+=t.pitchDelta||0,r.roll+=t.rollDelta||0,t.panDelta&&r.pan._add(t.panDelta);
803if(!r.pan.mag()&&!r.zoom&&!r.bearing&&!r.pitch&&!r.roll)return void this.clear();let a=v()-i[0].time,o={};if(r.pan.mag()){let i=ar(r.pan.mag(),a,(0,p.or)({},r6,t||{})),s=r.pan.mult(i.amount/r.pan.mag()),n=this._map._camera.cameraHelper.handlePanInertia(s,this._map._camera.transform);o.center=n.easingCenter,o.offset=n.easingOffset,ai(o,i)}if(r.zoom){let t=ar(r.zoom,a,r8);o.zoom=(0,p.ar)(this._map.getZoom()+t.amount,this._map.getZoomSnap(),t.amount),ai(o,t)}if(r.bearing){let t=ar(r.bearing,a,r9);o.bearing=this._map.getBearing()+(0,p.Kn)(t.amount,-179,179),ai(o,t)}if(r.pitch){let t=ar(r.pitch,a,r7);o.pitch=this._map.getPitch()+t.amount,ai(o,t)}if(r.roll){let t=ar(r.roll,a,ae);o.roll=this._map.getRoll()+(0,p.Kn)(t.amount,-179,179),ai(o,t)}if(o.zoom||o.bearing){let t=void 0===r.pinchAround?r.around:r.pinchAround;o.around=t?this._map.unproject(t):this._map.getCenter()}return this.clear(),(0,p.or)(o,{noMoveStart:!0})}};function ai(t,i){(!t.duration||t.duration<i.duration)&&(t.duration=i.duration,t.easing=i.easing)}function ar(t,i,r){let{maxSpeed:a,linearity:o,deceleration:s}=r,n=(0,p.Kn)(t*o/(i/1e3),-a,a),l=Math.abs(n)/(s*o);return{easing:r.easing,duration:1e3*l,amount:l/2*n}}var aa=class{constructor(t,i){this._map=t,this._clickTolerance=i.clickTolerance}reset(){delete this._mousedownPos}wheel(t){return this._firePreventable(new C(this._map,t))}mousedown(t,i){return this._mousedownPos=i,this._firePreventable(new I(t.type,this._map,t))}mouseup(t){this._map.fire(new I(t.type,this._map,t))}click(t,i){this._mousedownPos&&this._mousedownPos.dist(i)>=this._clickTolerance||this._map.fire(new I(t.type,this._map,t))}dblclick(t){return this._firePreventable(new I(t.type,this._map,t))}mouseover(t){this._map.fire(new I(t.type,this._map,t))}mouseout(t){this._map.fire(new I(t.type,this._map,t))}touchstart(t){return this._firePreventable(new S(t.type,this._map,t))}touchmove(t){this._map.fire(new S(t.type,this._map,t))}touchend(t){this._map.fire(new S(t.type,this._map,t))}touchcancel(t){this._map.fire(new S(t.type,this._map,t))}_firePreventable(t){if(this._map.fire(t),t.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}},ao=class{constructor(t){this._map=t}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(t){this._map.fire(new I(t.type,this._map,t))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new I("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(t){this._delayContextMenu?this._contextMenuEvent=t:this._ignoreContextMenu||this._map.fire(new I(t.type,this._map,t)),this._map.listens("contextmenu")&&t.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}},as=class{constructor(t,i,r){this._map=t,this._tr=r,this._el=t.getCanvasContainer(),this._container=t.getContainer(),this._clickTolerance=i.clickTolerance||1,i.boxZoom&&"object"==typeof i.boxZoom&&(this._boxZoomEnd=i.boxZoom.boxZoomEnd)}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(t,i){this.isEnabled()&&t.shiftKey&&0===t.button&&(y.disableDrag(),this._startPos=this._lastPos=i,this._active=!0)}mousemoveWindow(t,i){if(!this._active||this._lastPos.equals(i)||!this._box&&i.dist(this._startPos)<this._clickTolerance)return;let r=this._startPos;this._lastPos=i,this._box||(this._box=y.create("div","maplibregl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair"),this._fireEvent("boxzoomstart",t));let a=Math.min(r.x,i.x),o=Math.max(r.x,i.x),s=Math.min(r.y,i.y),n=Math.max(r.y,i.y);this._box.style.transform=`translate(${a}px,${s}px)`,this._box.style.width=`${o-a}px`,this._box.style.height=`${n-s}px`}mouseupWindow(t,i){if(!this._active||0!==t.button)return;let r=this._startPos;if(this.reset(),y.suppressClick(),r.x!==i.x||r.y!==i.y)return(this._map.fire(new E("boxzoomend",{originalEvent:t})),this._boxZoomEnd)?void this._boxZoomEnd(this._map,r,i,t):{cameraAnimation:t=>t.fitScreenCoordinates(r,i,this._tr.bearing,{linear:!0})};this._fireEvent("boxzoomcancel",t)}keydown(t){this._active&&27===t.keyCode&&(this.reset(),this._fireEvent("boxzoomcancel",t))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&=(this._box.remove(),null),y.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(t,i){return this._map.fire(new E(t,{originalEvent:i}))}};function an(t,i){if(t.length!==i.length)throw Error(`The number of touches and points are not equal - touches ${t.length}, points ${i.length}`);let r={};for(let a=0;a<t.length;a++)r[t[a].identifier]=i[a];return r}var al=class{constructor(t){this.reset(),this.numTouches=t.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(t,i,r){(this.centroid||r.length>this.numTouches)&&(this.aborted=!0),this.aborted||(void 0===this.startTime&&(this.startTime=t.timeStamp),r.length===this.numTouches&&(this.centroid=function(t){let i=new p.Vi(0,0);for(let r of t)i._add(r);return i.div(t.length)}(i),this.touches=an(r,i)))}touchmove(t,i,r){if(this.aborted||!this.centroid)return;let a=an(r,i);for(let t in this.touches){let i=this.touches[t],r=a[t];(!r||r.dist(i)>30)&&(this.aborted=!0)}}touchend(t,i,r){if((!this.centroid||t.timeStamp-this.startTime>500)&&(this.aborted=!0),0===r.length){let t=!this.aborted&&this.centroid;if(this.reset(),t)return t}}},ah=class{constructor(t){this.singleTap=new al(t),this.numTaps=t.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(t,i,r){this.singleTap.touchstart(t,i,r)}touchmove(t,i,r){this.singleTap.touchmove(t,i,r)}touchend(t,i,r){let a=this.singleTap.touchend(t,i,r);
803if(a){let i=t.timeStamp-this.lastTime<500,r=!this.lastTap||30>this.lastTap.dist(a);if(i&&r||this.reset(),this.count++,this.lastTime=t.timeStamp,this.lastTap=a,this.count===this.numTaps)return this.reset(),a}}},ac=class{constructor(t,i){this._tr=i,this._zoomIn=new ah({numTouches:1,numTaps:2}),this._zoomOut=new ah({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(t,i,r){this._zoomIn.touchstart(t,i,r),this._zoomOut.touchstart(t,i,r)}touchmove(t,i,r){this._zoomIn.touchmove(t,i,r),this._zoomOut.touchmove(t,i,r)}touchend(t,i,r){let a=this._zoomIn.touchend(t,i,r),o=this._zoomOut.touchend(t,i,r),s=this._tr;return a?(this._active=!0,t.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:i=>i.easeTo({duration:300,zoom:(0,p.ar)(s.zoom+1,i.getZoomSnap()),around:s.unproject(a)},{originalEvent:t})}):o?(this._active=!0,t.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:i=>i.easeTo({duration:300,zoom:(0,p.ar)(s.zoom-1,i.getZoomSnap()),around:s.unproject(o)},{originalEvent:t})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}},au=class{constructor(t){this._enabled=!!t.enable,this._moveStateManager=t.moveStateManager,this._clickTolerance=t.clickTolerance||1,this._moveFunction=t.move,this._activateOnStart=!!t.activateOnStart,t.assignEvents(this),this.reset()}reset(t){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(t)}_move(...t){let i=this._moveFunction(...t);if(i.bearingDelta||i.pitchDelta||i.rollDelta||i.around||i.panDelta)return this._active=!0,i}dragStart(t,i){!this.isEnabled()||this._lastPoint||this._moveStateManager.isValidStartEvent(t)&&(this._moveStateManager.startMove(t),this._lastPoint=Array.isArray(i)?i[0]:i,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(t,i){if(!this.isEnabled())return;let r=this._lastPoint;if(!r)return;if(t.preventDefault(),!this._moveStateManager.isValidMoveEvent(t))return void this.reset(t);let a=Array.isArray(i)?i[0]:i;if(!(!this._moved&&a.dist(r)<this._clickTolerance))return this._moved=!0,this._lastPoint=a,this._move(r,a)}dragEnd(t){this.isEnabled()&&this._lastPoint&&this._moveStateManager.isValidEndEvent(t)&&(this._moved&&y.suppressClick(),this.reset(t))}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}getClickTolerance(){return this._clickTolerance}};let ad={0:1,2:2};var a_=class{constructor(t){this._correctEvent=t.checkCorrectEvent}startMove(t){this._eventButton=t.button}endMove(t){delete this._eventButton}isValidStartEvent(t){return this._correctEvent(t)}isValidMoveEvent(t){let i;return i=ad[this._eventButton],void 0!==t.buttons&&(t.buttons&i)===i}isValidEndEvent(t){return t.button===this._eventButton}},ap=class{constructor(){this._firstTouch=void 0}_isOneFingerTouch(t){return 1===t.targetTouches.length}_isSameTouchEvent(t){return t.targetTouches[0].identifier===this._firstTouch}startMove(t){this._firstTouch=t.targetTouches[0].identifier}endMove(t){delete this._firstTouch}isValidStartEvent(t){return this._isOneFingerTouch(t)}isValidMoveEvent(t){return this._isOneFingerTouch(t)&&this._isSameTouchEvent(t)}isValidEndEvent(t){return this._isOneFingerTouch(t)&&this._isSameTouchEvent(t)}},am=class{constructor(t=new a_({checkCorrectEvent:()=>!0}),i=new ap){this.mouseMoveStateManager=t,this.oneFingerTouchMoveStateManager=i}_executeRelevantHandler(t,i,r){return t instanceof MouseEvent?i(t):"u">typeof TouchEvent&&t instanceof TouchEvent?r(t):void 0}startMove(t){this._executeRelevantHandler(t,t=>{this.mouseMoveStateManager.startMove(t)},t=>{this.oneFingerTouchMoveStateManager.startMove(t)})}endMove(t){this._executeRelevantHandler(t,t=>{this.mouseMoveStateManager.endMove(t)},t=>{this.oneFingerTouchMoveStateManager.endMove(t)})}isValidStartEvent(t){return!!this._executeRelevantHandler(t,t=>this.mouseMoveStateManager.isValidStartEvent(t),t=>this.oneFingerTouchMoveStateManager.isValidStartEvent(t))}isValidMoveEvent(t){return!!this._executeRelevantHandler(t,t=>this.mouseMoveStateManager.isValidMoveEvent(t),t=>this.oneFingerTouchMoveStateManager.isValidMoveEvent(t))}isValidEndEvent(t){return!!this._executeRelevantHandler(t,t=>this.mouseMoveStateManager.isValidEndEvent(t),t=>this.oneFingerTouchMoveStateManager.isValidEndEvent(t))}};let af=t=>{t.mousedown=t.dragStart,t.mousemoveWindow=t.dragMove,t.mouseup=t.dragEnd,t.contextmenu=t=>{t.preventDefault()}};var ag=class{constructor(t,i){this._clickTolerance=t.clickTolerance||1,this._map=i,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new p.Vi(0,0)}_shouldBePrevented(t){return t<(this._map.cooperativeGestures.isEnabled()?2:1)}touchstart(t,i,r){return this._calculateTransform(t,i,r)}touchmove(t,i,r){if(this._active)return this._shouldBePrevented(r.length)?void this._map.cooperativeGestures.notifyGestureBlocked("touch_pan",t):(t.preventDefault(),this._calculateTransform(t,i,r))}touchend(t,i,r){this._calculateTransform(t,i,r),this._active&&this._shouldBePrevented(r.length)&&this.reset()}touchcancel(){this.reset()}_calculateTransform(t,i,r){r.length>0&&(this._active=!0);let a=an(r,i),o=new p.Vi(0,0),s=new p.Vi(0,0),n=0;for(let t in a){let i=a[t],r=this._touches[t];r&&(o._add(i),s._add(i.sub(r)),n++,a[t]=i)}if(this._touches=a,this._shouldBePrevented(n)||!s.mag())return;let l=s.div(n);if(this._sum._add(l),!(this._sum.mag()<this._clickTolerance))return{around:o.div(n),panDelta:l}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}},av=class{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}touchstart(t,i,r){this._firstTwoTouches||r.length<2||(this._firstTwoTouches=[r[0].identifier,r[1].identifier],this._start([i[0],i[1]]))}touchmove(t,i,r){if(!this._firstTwoTouches)return;t.preventDefault();let[a,o]=this._firstTwoTouches,s=ay(r,i,a),n=ay(r,i,o);if(!s||!n)return;let l=this._aroundCenter?null:s.add(n).div(2);return this._move([s,n],l,t)}touchend(t,i,r){if(!this._firstTwoTouches)return;let[a,o]=this._firstTwoTouches,s=ay(r,i,a),n=ay(r,i,o);s&&n||(this._active&&y.suppressClick(),this.reset())}touchcancel(){this.reset()}enable(t){this._enabled=!0,this._aroundCenter=!!t&&"center"===t.around}disable(){this._enabled=!1,this.reset()}isEnabled(){return!!this._enabled}isActive(){return!!this._active}};function ay(t,i,r){for(let a=0;a<t.length;a++)if(t[a].identifier===r)return i[a]}function ax(t,i){return Math.log(t/i)/Math.LN2}var ab=class extends av{constructor(){super(),this._zoomRate=1,this._zoomThreshold=.1}setZoomRate(t){this._zoomRate=t??1}setZoomThreshold(t){this._zoomThreshold=t??.1}reset(){super.reset(),delete this._distance,delete this._startDistance}_start(t){this._startDistance=this._distance=t[0].dist(t[1])}_move(t,i){let r=this._distance;if(this._distance=t[0].dist(t[1]),!(!this._active&&Math.abs(ax(this._distance,this._startDistance))<this._zoomThreshold))return this._active=!0,{zoomDelta:ax(this._distance,r)*this._zoomRate,pinchAround:i}}};function aw(t,i){return 180*t.angleWith(i)/Math.PI}var aT=class extends av{reset(){super.reset(),delete this._minDiameter,delete this._startVector,delete this._vector}_start(t){this._startVector=this._vector=t[0].sub(t[1]),this._minDiameter=t[0].dist(t[1])}_move(t,i,r){let a=this._vector;if(this._vector=t[0].sub(t[1]),!(!this._active&&this._isBelowThreshold(this._vector)))return this._active=!0,{bearingDelta:aw(this._vector,a),pinchAround:i}}_isBelowThreshold(t){this._minDiameter=Math.min(this._minDiameter,t.mag());let i=25/(Math.PI*this._minDiameter)*360;return Math.abs(aw(t,this._startVector))<i}};function aP(t){return Math.abs(t.y)>Math.abs(t.x)}var aM=class extends av{constructor(t){super(),this._currentTouchCount=0,this._map=t}
803reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(t,i,r){super.touchstart(t,i,r),this._currentTouchCount=r.length}_start(t){this._lastPoints=t,aP(t[0].sub(t[1]))&&(this._valid=!1)}_move(t,i,r){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;let a=t[0].sub(this._lastPoints[0]),o=t[1].sub(this._lastPoints[1]);if(this._valid=this.gestureBeginsVertically(a,o,r.timeStamp),this._valid)return this._lastPoints=t,this._active=!0,{pitchDelta:-((a.y+o.y)/2*.5)}}gestureBeginsVertically(t,i,r){if(void 0!==this._valid)return this._valid;let a=t.mag()>=2,o=i.mag()>=2;if(!a&&!o)return;if(!a||!o)return void 0===this._firstMove&&(this._firstMove=r),r-this._firstMove<100&&void 0;let s=t.y>0==i.y>0;return aP(t)&&aP(i)&&s}};let aI={panStep:100,bearingStep:15,pitchStep:10};var aS=class{constructor(t,i){this._tr=i,this._panStep=aI.panStep,this._bearingStep=aI.bearingStep,this._pitchStep=aI.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(t){if(t.altKey||t.ctrlKey||t.metaKey)return;let i=0,r=0,a=0,o=0,s=0;switch(t.keyCode){case 61:case 107:case 171:case 187:i=1;break;case 189:case 109:case 173:i=-1;break;case 37:t.shiftKey?r=-1:(t.preventDefault(),o=-1);break;case 39:t.shiftKey?r=1:(t.preventDefault(),o=1);break;case 38:t.shiftKey?a=1:(t.preventDefault(),s=-1);break;case 40:t.shiftKey?a=-1:(t.preventDefault(),s=1);break;default:return}return this._rotationDisabled&&(r=0,a=0),{cameraAnimation:n=>{let l=this._tr;n.easeTo({duration:300,easeId:"keyboardHandler",easing:aC,zoom:i?(0,p.ar)(l.zoom+i*(t.shiftKey?2:1),n.getZoomSnap()):l.zoom,bearing:l.bearing+r*this._bearingStep,pitch:l.pitch+a*this._pitchStep,offset:[-o*this._panStep,-s*this._panStep],center:l.center},{originalEvent:t})}}}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 aC(t){return t*(2-t)}var aE=class{constructor(t,i,r){this._onTimeout=t=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(t)},this._map=t,this._tr=r,this._triggerRenderFrame=i,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222}setZoomRate(t){this._defaultZoomRate=t}setWheelZoomRate(t){this._wheelZoomRate=t}isEnabled(){return!!this._enabled}isActive(){return!!this._active||void 0!==this._finishTimeout}isZooming(){return!!this._zooming}enable(t){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!t&&"center"===t.around)}disable(){this.isEnabled()&&(this._enabled=!1)}_shouldBePrevented(t){return!!this._map.cooperativeGestures.isEnabled()&&!(t.ctrlKey||this._map.cooperativeGestures.isBypassed(t))}wheel(t){if(!this.isEnabled())return;if(this._shouldBePrevented(t))return void this._map.cooperativeGestures.notifyGestureBlocked("wheel_zoom",t);let i=t.deltaMode===WheelEvent.DOM_DELTA_LINE?40*t.deltaY:t.deltaY,r=v(),a=r-(this._lastWheelEventTime||0);this._lastWheelEventTime=r,0!==i&&i%4.000244140625==0?this._type="wheel":0!==i&&4>Math.abs(i)?this._type="trackpad":a>400?(this._type=null,this._lastValue=i,this._timeout=setTimeout(this._onTimeout,40,t)):this._type||(this._type=200>Math.abs(a*i)?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,i+=this._lastValue)),t.shiftKey&&i&&(i/=4),this._type&&(this._lastWheelEvent=t,this._delta-=i,this._active||this._start(t)),t.preventDefault()}_start(t){if(!this._delta)return;this._needsRerender=!1,this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);let i=y.mousePos(this._map.getCanvas(),t),r=this._tr;this._aroundPoint=this._aroundCenter?r.transform.locationToScreenPoint(p.ct.convert(r.center)):i,this._needsRerender||(this._needsRerender=!0,this._triggerRenderFrame())}renderFrame(){if(!this._needsRerender||(this._needsRerender=!1,!this.isActive()))return;let t=this._tr.transform;if("number"==typeof this._lastExpectedZoom){let i=t.zoom-this._lastExpectedZoom;"number"==typeof this._startZoom&&(this._startZoom+=i),"number"==typeof this._targetZoom&&(this._targetZoom+=i)}if(0!==this._delta){let i="wheel"===this._type&&Math.abs(this._delta)>4.000244140625?this._wheelZoomRate:this._defaultZoomRate,r=2/(1+Math.exp(-Math.abs(this._delta*i)));this._delta<0&&0!==r&&(r=1/r);let a="number"==typeof this._targetZoom?(0,p.Vr)(this._targetZoom):t.scale,o=t.applyConstrain(t.getCameraLngLat(),(0,p.Nr)(a*r)).zoom,s=this._map.getZoomSnap();if("wheel"===this._type&&s>0){let i=(0,p.ar)(t.zoom,s);this._targetZoom=(0,p.ar)(o,s,o-i)}else this._targetZoom=o;"wheel"===this._type&&(this._startZoom=t.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}let i="number"==typeof this._targetZoom?this._targetZoom:t.zoom,r=this._startZoom,a=this._easing,o=!1,s;if("wheel"===this._type&&r&&a){let t=Math.min((v()-this._lastWheelEventTime+5)/200,1),n=a(t);s=p.bn.number(r,i,n),t<1?this._needsRerender=!0:o=!0}else s=i,o=!0;return this._active=!0,o&&(this._active=!1,this._finishTimeout=setTimeout(()=>
vendor: 11,804 bytes, line 803
803{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._lastExpectedZoom,delete this._finishTimeout},200)),this._lastExpectedZoom=s,{noInertia:!0,needsRenderFrame:!o,zoomDelta:s-t.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(t){let i=p.er;if(this._prevEase){let t=this._prevEase,r=(v()-t.start)/t.duration,a=t.easing(r+.01)-t.easing(r),o=.27/Math.sqrt(a*a+1e-4)*.01,s=Math.sqrt(.0729-o*o);i=(0,p.Gn)(o,s,.25,1)}return this._prevEase={start:v(),duration:t,easing:i},i}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,delete this._lastExpectedZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}},az=class{constructor(t,i){this._clickZoom=t,this._tapZoom=i}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()}},aR=class{constructor(t,i){this._tr=i,this.reset()}reset(){this._active=!1}dblclick(t,i){return t.preventDefault(),{cameraAnimation:r=>{r.easeTo({duration:300,zoom:(0,p.ar)(this._tr.zoom+(t.shiftKey?-1:1),r.getZoomSnap()),around:this._tr.unproject(i)},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}},aD=class{constructor(){this._tap=new ah({numTouches:1,numTaps:1}),this._zoomRate=1,this.reset()}setZoomRate(t){this._zoomRate=t??1}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,delete this._tapPoint,this._tap.reset()}touchstart(t,i,r){if(!this._swipePoint)if(this._tapTime){let a=i[0],o=t.timeStamp-this._tapTime<500,s=30>this._tapPoint.dist(a);o&&s?r.length>0&&(this._swipePoint=a,this._swipeTouch=r[0].identifier):this.reset()}else this._tap.touchstart(t,i,r)}touchmove(t,i,r){if(this._tapTime){if(this._swipePoint){if(r[0].identifier!==this._swipeTouch)return;let a=i[0],o=a.y-this._swipePoint.y;return this._swipePoint=a,t.preventDefault(),this._active=!0,{zoomDelta:o/128*this._zoomRate}}}else this._tap.touchmove(t,i,r)}touchend(t,i,r){if(this._tapTime)this._swipePoint&&0===r.length&&this.reset();else{let a=this._tap.touchend(t,i,r);a&&(this._tapTime=t.timeStamp,this._tapPoint=a)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}},aA=class{constructor(t,i,r){this._el=t,this._mousePan=i,this._touchPan=r}enable(t){this._inertiaOptions=t||{},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()}},aL=class{constructor(t,i,r,a){this._pitchWithRotate=t.pitchWithRotate,this._rollEnabled=t.rollEnabled,this._mouseRotate=i,this._mousePitch=r,this._mouseRoll=a}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()}},aF=class{constructor(t,i,r,a){this._el=t,this._touchZoom=i,this._touchRotate=r,this._tapDragZoom=a,this._rotationDisabled=!1,this._enabled=!0}enable(t){this._touchZoom.enable(t),this._rotationDisabled||this._touchRotate.enable(t),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(t){this._touchZoom.setZoomRate(t),this._tapDragZoom.setZoomRate(t)}setZoomThreshold(t){this._touchZoom.setZoomThreshold(t)}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}},ak=class{constructor(t,i){this._bypassKey=navigator.userAgent.includes("Mac")?"metaKey":"ctrlKey",this._map=t,this._options=i,this._enabled=!1}isActive(){return!1}reset(){}_setupUI(){if(this._container)return;let t=this._map.getCanvasContainer();t.classList.add("maplibregl-cooperative-gestures"),this._container=y.create("div","maplibregl-cooperative-gesture-screen",t);let i=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");"metaKey"===this._bypassKey&&(i=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));let r=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),a=document.createElement("div");a.className="maplibregl-desktop-message",a.textContent=i,this._container.appendChild(a);let o=document.createElement("div");o.className="maplibregl-mobile-message",o.textContent=r,this._container.appendChild(o),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(t){return t[this._bypassKey]}notifyGestureBlocked(t,i){this._enabled&&(this._map.fire(new b("cooperativegestureprevented",{gestureType:t,originalEvent:i})),this._container.classList.add("maplibregl-show"),setTimeout(()=>{this._container.classList.remove("maplibregl-show")},100))}},aB=class{constructor(t){this._camera=t}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(t){return this.transform.screenPointToLocation(p.Vi.convert(t),this._camera.terrain)}};let aj=t=>t.zoom||t.drag||t.roll||t.pitch||t.rotate;var aO=class extends p.Cn{};function aN(t){return t.panDelta?.mag()||t.zoomDelta||t.bearingDelta||t.pitchDelta||t.rollDelta}var aZ=class{get _ownerDocument(){return this._el?.ownerDocument||document}get _ownerWindow(){return this._el?.ownerDocument?.defaultView||window}constructor(t,i,r){this._terrainGestureAnchorElevation=null,this.handleWindowEvent=t=>{this.handleEvent(t,`${t.type}Window`)},this.handleEvent=(t,i)=>{if("blur"===t.type)return void this.stop(!0);this._updatingCamera=!0;let r="renderFrame"===t.type?void 0:t,a={needsRenderFrame:!1},o={},s={};for(let{handlerName:n,handler:l,allowed:h}of this._handlers){let c;if(l.isEnabled()){if(this._blockedByActive(s,h,n))l.reset();else if(l[i||t.type]){if((0,p.hr)(t,i||t.type)){let r=y.mousePos(this._map.getCanvas(),t);c=l[i||t.type](t,r)}else if((0,p._r)(t,i||t.type)){let r=t.touches,a=this._getMapTouches(r),o=y.touchPos(this._map.getCanvas(),a);c=l[i||t.type](t,o,a)}else(0,p.vr)(i||t.type)||(c=l[i||t.type](t));this.mergeHandlerResult(a,o,c,n,r),c?.needsRenderFrame&&this._triggerRenderFrame()}(c||l.isActive())&&(s[n]=l)}}let n={};for(let t in this._previousActiveHandlers)s[t]||(n[t]=r);this._previousActiveHandlers=s,(Object.keys(n).length||aN(a))&&(this._changes.push([a,o,n]),this._triggerRenderFrame()),(Object.keys(s).length||aN(a))&&this._camera.stop(!0),this._updatingCamera=!1;let{cameraAnimation:l}=a;l&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],l(this._map))},this._map=t,this._camera=i,this._transformProvider=new aB(this._camera),this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new at(t),this._bearingSnap=r.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(r);let a=this._el;for(let[t,i,r]of(this._listeners=[[a,"touchstart",{passive:!0}],[a,"touchmove",{passive:!1}],[a,"touchend",void 0],[a,"touchcancel",void 0],[a,"mousedown",void 0],[a,"mousemove",void 0],[a,"mouseup",void 0],[this._ownerDocument,"mousemove",{capture:!0}],[this._ownerDocument,"mouseup",void 0],[a,"mouseover",void 0],[a,"mouseout",void 0],[a,"dblclick",void 0],[a,"click",void 0],[a,"keydown",{capture:!1}],[a,"keyup",void 0],[a,"wheel",{passive:!1}],[a,"contextmenu",void 0],[this._ownerWindow,"blur",void 0]],this._listeners))t.addEventListener(i,t===this._ownerDocument?this.handleWindowEvent:this.handleEvent,r)}destroy(){for(let[t,i,r]of this._listeners)t.removeEventListener(i,t===this._ownerDocument?this.handleWindowEvent:this.handleEvent,r)}_addDefaultHandlers(t){let i=this._map,r=i.getCanvasContainer();this._add("mapEvent",new aa(i,t));let a=i.boxZoom=new as(i,t,this._transformProvider);this._add("boxZoom",a),t.interactive&&t.boxZoom&&a.enable();let o=i.cooperativeGestures=new ak(i,t.cooperativeGestures);this._add("cooperativeGestures",o),t.cooperativeGestures&&o.enable();let s=new ac(i,this._transformProvider),n=new aR(i,this._transformProvider);i.doubleClickZoom=new az(n,s),this._add("tapZoom",s),this._add("clickZoom",n),t.interactive&&t.doubleClickZoom&&i.doubleClickZoom.enable();let l=new aD;this._add("tapDragZoom",l);let h=i.touchPitch=new aM(i);this._add("touchPitch",h),t.interactive&&t.touchPitch&&i.touchPitch.enable(t.touchPitch);let c=()=>i.project(i.getCenter()),u=function({enable:t,clickTolerance:i,aroundCenter:r=!0,minPixelCenterThreshold:a=100,rotateSpeed:o=.8},s){return new au({clickTolerance:i,move:(t,i)=>{let n=s();if(r&&Math.abs(n.y-t.y)>a)return{bearingDelta:(0,p.ur)(new p.Vi(t.x,i.y),i,n)};let l=(i.x-t.x)*o;return r&&i.y<n.y&&(l=-l),{bearingDelta:l}},moveStateManager:new a_({checkCorrectEvent:t=>0===t.button&&t.ctrlKey||2===t.button&&!t.ctrlKey}),enable:t,assignEvents:af})}(t,c),d=function({enable:t,clickTolerance:i,pitchSpeed:r=-.5}){return new au({clickTolerance:i,move:(t,i)=>({pitchDelta:(i.y-t.y)*r}),moveStateManager:new a_({checkCorrectEvent:t=>0===t.button&&t.ctrlKey||2===t.button}),enable:t,assignEvents:af})}(t),_=function({enable:t,clickTolerance:i,rollDegreesPerPixelMoved:r=.3},a){return new au({clickTolerance:i,move:(t,i)=>{let o=a(),s=(i.x-t.x)*r;return i.y<o.y&&(s=-s),{rollDelta:s}},moveStateManager:new a_({checkCorrectEvent:t=>2===t.button&&t.ctrlKey}),enable:t,assignEvents:af})}(t,c);i.dragRotate=new aL(t,u,d,_),this._add("mouseRotate",u,["mousePitch"]),this._add("mousePitch",d,["mouseRotate","mouseRoll"]),this._add("mouseRoll",_,["mousePitch"]),t.interactive&&t.dragRotate&&i.dragRotate.enable();let m=function({enable:t,clickTolerance:i}){return new au({clickTolerance:i,move:(t,i)=>({around:i,panDelta:i.sub(t)}),activateOnStart:!0,moveStateManager:new a_({checkCorrectEvent:t=>0===t.button&&!t.ctrlKey}),enable:t,assignEvents:af})}(t),f=new ag(t,i);i.dragPan=new aA(r,m,f),this._add("mousePan",m),this._add("touchPan",f,["touchZoom","touchRotate"]),t.interactive&&t.dragPan&&i.dragPan.enable(t.dragPan);let g=new aT,v=new ab;i.touchZoomRotate=new aF(r,v,g,l),this._add("touchRotate",g,["touchPan","touchZoom"]),this._add("touchZoom",v,["touchPan","touchRotate"]),t.interactive&&t.touchZoomRotate&&i.touchZoomRotate.enable(t.touchZoomRotate),this._add("blockableMapEvent",new ao(i));let y=i.scrollZoom=new aE(i,()=>
803this._triggerRenderFrame(),this._transformProvider);this._add("scrollZoom",y,["mousePan"]),t.interactive&&t.scrollZoom&&i.scrollZoom.enable(t.scrollZoom);let x=i.keyboard=new aS(i,this._transformProvider);this._add("keyboard",x),t.interactive&&t.keyboard&&i.keyboard.enable()}_add(t,i,r){this._handlers.push({handlerName:t,handler:i,allowed:r}),this._handlersById[t]=i}stop(t){if(!this._updatingCamera){for(let{handler:t}of this._handlers)t.reset();this._inertia.clear(),this._fireEvents({},{},t),this._changes=[]}}isActive(){for(let{handler:t}of this._handlers)if(t.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!aj(this._eventsInProgress)||this.isZooming()}_blockedByActive(t,i,r){for(let a in t)if(a!==r&&!i?.includes(a))return!0;return!1}_getMapTouches(t){let i=[];for(let r of t){let t=r.target;this._el.contains(t)&&i.push(r)}return i}mergeHandlerResult(t,i,r,a,o){if(!r)return;(0,p.or)(t,r);let s={handlerName:a,originalEvent:r.originalEvent||o};void 0!==r.zoomDelta&&(i.zoom=s),void 0!==r.panDelta&&(i.drag=s),void 0!==r.rollDelta&&(i.roll=s),void 0!==r.pitchDelta&&(i.pitch=s),void 0!==r.bearingDelta&&(i.rotate=s)}_applyChanges(){let t={},i={},r={};for(let[a,o,s]of this._changes)a.panDelta&&(t.panDelta=(t.panDelta||new p.Vi(0,0))._add(a.panDelta)),a.zoomDelta&&(t.zoomDelta=(t.zoomDelta||0)+a.zoomDelta),a.bearingDelta&&(t.bearingDelta=(t.bearingDelta||0)+a.bearingDelta),a.pitchDelta&&(t.pitchDelta=(t.pitchDelta||0)+a.pitchDelta),a.rollDelta&&(t.rollDelta=(t.rollDelta||0)+a.rollDelta),void 0!==a.around&&(t.around=a.around),void 0!==a.pinchAround&&(t.pinchAround=a.pinchAround),a.noInertia&&(t.noInertia=a.noInertia),(0,p.or)(i,o),(0,p.or)(r,s);this._updateMapTransform(t,i,r),this._changes=[]}_updateMapTransform(t,i,r){let a=this._map,o=this._camera.getTransformForUpdate(),s=a.terrain;if(!aN(t)&&!(s&&this._terrainMovement))return void this._fireEvents(i,r,!0);this._camera.stop(!0);let{panDelta:n,zoomDelta:l,bearingDelta:h,pitchDelta:c,rollDelta:u}=t,{around:d,aroundOnSurface:_}=this._resolveAround(t,s,o),p=s?this._terrainGestureElevation(s,d,_,o,i):void 0,m={panDelta:n,zoomDelta:l,rollDelta:u,pitchDelta:c,bearingDelta:h,around:d,aroundElevation:p};this._camera.cameraHelper.useGlobeControls&&!o.isPointOnMapSurface(d)&&(d=o.centerPoint);let f=this._computePreZoomAroundLoc(o,d,n,p);this._handleMapControls({terrain:s,tr:o,deltasForHelper:m,preZoomAroundLoc:f,combinedEventsInProgress:i,panDelta:n}),this._camera.applyUpdatedTransform(o),this._map._update(),t.noInertia||this._inertia.record(t),this._fireEvents(i,r,!0)}_resolveAround(t,i,r){let a=void 0===t.pinchAround?t.around:t.pinchAround;return a||=this._camera.transform.centerPoint,i&&!r.isPointOnMapSurface(a)?{around:r.centerPoint,aroundOnSurface:!1}:{around:a,aroundOnSurface:!0}}_terrainGestureElevation(t,i,r,a,o){if(!r)return;if(!this._terrainMovement&&(o.drag||o.zoom)){let r=t.pointCoordinate(i);this._terrainGestureAnchorElevation=r?r.z:null}if(null===this._terrainGestureAnchorElevation)return;let s=this._terrainGestureAnchorElevation;if(!(.01>i.distSqr(a.centerPoint))&&!(s-a.elevation>=.9*(a.getCameraAltitude()-a.elevation)))return s}_computePreZoomAroundLoc(t,i,r,a){if(.01>i.distSqr(t.centerPoint))return t.center;let o=r?i.sub(r):i;return void 0===a?t.screenPointToLocation(o):t.screenPointToLocationAtElevation(o,a)}_handleMapControls({terrain:t,tr:i,deltasForHelper:r,preZoomAroundLoc:a,combinedEventsInProgress:o,panDelta:s}){let n=this._camera.cameraHelper;if(n.handleMapControlsRollPitchBearingZoom(r,i),!t)return void n.handleMapControlsPan(r,i,a);if(n.useGlobeControls){!this._terrainMovement&&(o.drag||o.zoom)&&(this._terrainMovement=!0,this._camera.elevationFreeze=!0),n.handleMapControlsPan(r,i,a);return}if(!this._terrainMovement&&(o.drag||o.zoom)){this._terrainMovement=!0,this._camera.elevationFreeze=!0,n.handleMapControlsPan(r,i,a);return}if(void 0===r.aroundElevation&&o.drag&&this._terrainMovement&&s)return void i.setCenter(i.screenPointToLocation(i.centerPoint.sub(s)));
803n.handleMapControlsPan(r,i,a)}_fireEvents(t,i,r){let a=aj(this._eventsInProgress),o=aj(t),s={};for(let i in t){let{originalEvent:r}=t[i];this._eventsInProgress[i]||(s[`${i}start`]=r),this._eventsInProgress[i]=t[i]}for(let t in!a&&o&&this._fireEvent("movestart",o.originalEvent),s)this._fireEvent(t,s[t]);for(let i in o&&this._fireEvent("move",o.originalEvent),t){let{originalEvent:r}=t[i];this._fireEvent(i,r)}let n={},l;for(let t in this._eventsInProgress){let{handlerName:r,originalEvent:a}=this._eventsInProgress[t];this._handlersById[r].isActive()||(delete this._eventsInProgress[t],l=i[r]||a,n[`${t}end`]=l)}for(let t in n)this._fireEvent(t,n[t]);let h=aj(this._eventsInProgress),c=(a||o)&&!h;if(c&&this._terrainMovement){this._camera.elevationFreeze=!1,this._terrainMovement=!1,this._terrainGestureAnchorElevation=null;let t=this._camera.getTransformForUpdate();this._map.getCenterClampedToGround()&&t.recalculateZoomAndCenter(this._map.terrain),this._camera.applyUpdatedTransform(t)}if(r&&c){this._updatingCamera=!0;let t=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),i=t=>0!==t&&-this._bearingSnap<t&&t<this._bearingSnap;t&&(t.essential||!f.prefersReducedMotion)?(i(t.bearing||this._map.getBearing())&&(t.bearing=0),t.freezeElevation=!0,this._map.easeTo(t,{originalEvent:l})):(this._map.fire(new w("moveend",{originalEvent:l})),i(this._map.getBearing())&&this._map.resetNorth()),this._updatingCamera=!1}}_fireEvent(t,i){this._map.fire(new w(t,i?{originalEvent:i}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(t=>{delete this._frameId,this.handleEvent(new aO("renderFrame",{timeStamp:t})),this._applyChanges()})}
803_triggerRenderFrame(){void 0===this._frameId&&(this._frameId=this._requestFrame())}},aU=class extends p.wn{constructor(t){super(),this._renderFrameCallback=()=>{let t=Math.min((v()-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 tB,this.cameraHelper=new tZ,void 0!==t.minZoom&&this.transform.setMinZoom(t.minZoom),void 0!==t.maxZoom&&this.transform.setMaxZoom(t.maxZoom),void 0!==t.minPitch&&this.transform.setMinPitch(t.minPitch),void 0!==t.maxPitch&&this.transform.setMaxPitch(t.maxPitch),void 0!==t.renderWorldCopies&&this.transform.setRenderWorldCopies(t.renderWorldCopies),null!==t.transformConstrain&&this.transform.setConstrainOverride(t.transformConstrain),this._moving=!1,this._zooming=!1,this._bearingSnap=t.bearingSnap,this._zoomSnap=t.zoomSnap,this._requestRenderFrame=t.requestRenderFrame,this._cancelRenderFrame=t.cancelRenderFrame,this.terrain=t.terrain,this._centerClampedToGround=t.centerClampedToGround??!0,this.transformCameraUpdate=t.transformCameraUpdate??null,this._stopHandlers=t.stopHandlers??(()=>{}),this.on("moveend",()=>{delete this._requestedCameraState})}migrateProjection(t,i){t.apply(this.transform,!0),this.transform=t,this.cameraHelper=i}getCenter(){return new p.ct(this.transform.center.lng,this.transform.center.lat)}setCenter(t,i){return this.jumpTo({center:t},i)}getCenterElevation(){return this.transform.elevation}setCenterElevation(t,i){return this.jumpTo({elevation:t},i),this}getCenterClampedToGround(){return this._centerClampedToGround}setCenterClampedToGround(t){this._centerClampedToGround=t}panBy(t,i,r){return t=p.Vi.convert(t).mult(-1),this.panTo(this.transform.center,(0,p.or)({offset:t},i),r)}panTo(t,i,r){return this.easeTo((0,p.or)({center:t},i),r)}getZoom(){return this.transform.zoom}setZoom(t,i){return this.jumpTo({zoom:t},i),this}zoomTo(t,i,r){return this.easeTo((0,p.or)({zoom:t},i),r)}zoomIn(t,i){return this.zoomTo((0,p.ar)(this.getZoom()+1,this._zoomSnap),t,i),this}zoomOut(t,i){return this.zoomTo((0,p.ar)(this.getZoom()-1,this._zoomSnap),t,i),this}getVerticalFieldOfView(){return this.transform.fov}setVerticalFieldOfView(t,i){return t!=this.transform.fov&&(this.transform.setFov(t),this.fire(new w("movestart",i)).fire(new w("move",i)).fire(new w("moveend",i))),this}getBearing(){return this.transform.bearing}setZoomSnap(t){return this._zoomSnap=t,this}getZoomSnap(){return this._zoomSnap}setBearing(t,i){return this.jumpTo({bearing:t},i),this}getPadding(){return this.transform.padding}setPadding(t,i){return this.jumpTo({padding:t},i),this}rotateTo(t,i,r){return this.easeTo((0,p.or)({bearing:t},i),r)}resetNorth(t,i){return this.rotateTo(0,(0,p.or)({duration:1e3},t),i),this}resetNorthPitch(t,i){return this.easeTo((0,p.or)({bearing:0,pitch:0,roll:0,duration:1e3},t),i),this}snapToNorth(t,i){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(t,i):this}getPitch(){return this.transform.pitch}setPitch(t,i){return this.jumpTo({pitch:t},i),this}getRoll(){return this.transform.roll}setRoll(t,i){return this.jumpTo({roll:t},i),this}cameraForBounds(t,i){t=eo.convert(t).adjustAntiMeridian();let r=i?.bearing||0;return this._cameraForBoxAndBearing(t.getNorthWest(),t.getSouthEast(),r,i)}_cameraForBoxAndBearing(t,i,r,a){let o={top:0,bottom:0,right:0,left:0};if("number"==typeof(a=(0,p.or)({padding:o,offset:[0,0],maxZoom:this.transform.maxZoom},a)).padding){let t=a.padding;a.padding={top:t,bottom:t,right:t,left:t}}let s=(0,p.or)(o,a.padding);a.padding=s;let n=this.transform,l=new eo(t,i),h=this.cameraHelper.cameraForBoxAndBearing(a,s,l,r,n);return h&&this._zoomSnap&&(h.zoom=(0,p.ar)(h.zoom,this._zoomSnap,-1)),h}fitBounds(t,i,r){return this._fitInternal(this.cameraForBounds(t,i),i,r)}fitScreenCoordinates(t,i,r,a,o){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.screenPointToLocation(p.Vi.convert(t)),this.transform.screenPointToLocation(p.Vi.convert(i)),r,a),a,o)}_fitInternal(t,i,r){return t?(i=(0,p.or)(t,i),delete i.padding,i.linear?this.easeTo(i,r):this.flyTo(i,r)):this}jumpTo(t,i){this.stop(),"zoom"in t&&this._zoomSnap&&(t.zoom=(0,p.ar)(t.zoom,this._zoomSnap));let r=this.getTransformForUpdate(),a=!1,o=!1,s=!1,n=r.zoom;this.terrain&&r.setElevation(this.terrain.getElevationForLngLatZoom(t.center?p.ct.convert(t.center):r.center,t.zoom||r.tileZoom)),this.cameraHelper.handleJumpToCenterZoom(r,t);let l=r.zoom!==n;return"elevation"in t&&r.elevation!==+t.elevation&&r.setElevation(+t.elevation),"bearing"in t&&r.bearing!==+t.bearing&&(a=!0,r.setBearing(+t.bearing)),"pitch"in t&&r.pitch!==+t.pitch&&(o=!0,r.setPitch(+t.pitch)),"roll"in t&&r.roll!==+t.roll&&(s=!0,r.setRoll(+t.roll)),null==t.padding||r.isPaddingEqual(t.padding)||r.setPadding(t.padding),this.applyUpdatedTransform(r),this.fire(new w("movestart",i)).fire(new w("move",i)),l&&this.fire(new w("zoomstart",i)).fire(new w("zoom",i)).fire(new w("zoomend",i)),a&&this.fire(new w("rotatestart",i)).fire(new w("rotate",i)).fire(new w("rotateend",i)),o&&this.fire(new w("pitchstart",i)).fire(new w("pitch",i)).fire(new w("pitchend",
803i)),s&&this.fire(new w("rollstart",i)).fire(new w("roll",i)).fire(new w("rollend",i)),this.fire(new w("moveend",i))}calculateCameraOptionsFromTo(t,i,r,a=0){let o=p.tt.fromLngLat(t,i),s=p.tt.fromLngLat(r,a),n=s.x-o.x,l=s.y-o.y,h=s.z-o.z,c=Math.hypot(n,l,h);if(0===c)throw Error("Can't calculate camera options with same From and To");let u=Math.hypot(n,l),d=(0,p.Nr)(this.transform.cameraToCenterDistance/c/this.transform.tileSize),_=180*Math.atan2(n,-l)/Math.PI,m=180*Math.acos(u/c)/Math.PI;return m=h<0?90-m:90+m,{center:s.toLngLat(),elevation:a,zoom:d,pitch:m,bearing:_}}calculateCameraOptionsFromCameraLngLatAltRotation(t,i,r,a,o){let s=this.transform.calculateCenterFromCameraLngLatAlt(t,i,r,a);return{center:s.center,elevation:s.elevation,zoom:s.zoom,bearing:r,pitch:a,roll:o}}easeTo(t,i){this._stop(!1,t.easeId),"zoom"in(t=(0,p.or)({offset:[0,0],duration:500,easing:p.er},t))&&this._zoomSnap&&(t.zoom=(0,p.ar)(t.zoom,this._zoomSnap)),(!1===t.animate||!t.essential&&f.prefersReducedMotion)&&(t.duration=0);let r=this.getTransformForUpdate(),a=this.getBearing(),o=r.pitch,s=r.roll,n="bearing"in t?this._normalizeBearing(t.bearing,a):a,l="pitch"in t?+t.pitch:o,h="roll"in t?this._normalizeBearing(t.roll,s):s,c="padding"in t?t.padding:r.padding,u=p.Vi.convert(t.offset),d,_;t.around&&(d=p.ct.convert(t.around),_=r.locationToScreenPoint(d));let m={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching,rolling:this._rolling},g=this.cameraHelper.handleEaseTo(r,{bearing:n,pitch:l,roll:h,padding:c,around:d,aroundPoint:_,offsetAsPoint:u,offset:t.offset,zoom:t.zoom,center:t.center});return this._rotating||=a!==n,this._pitching||=l!==o,this._rolling||=h!==s,this._padding=!r.isPaddingEqual(c),this._zooming||=g.isZooming,this._easeId=t.easeId,this._prepareEase(i,t.noMoveStart,m),this.terrain&&this._prepareElevation(g.elevationCenter),this._ease(a=>{g.easeFunc(a),this.terrain&&!t.freezeElevation&&this._updateElevation(a),this.applyUpdatedTransform(r),this._fireMoveEvents(i)},r=>{this.terrain&&t.freezeElevation&&this._finalizeElevation(),this._afterEase(i,r)},t),this}_prepareEase(t,i,r={}){this._moving=!0,i||r.moving||this.fire(new w("movestart",t)),this._zooming&&!r.zooming&&this.fire(new w("zoomstart",t)),this._rotating&&!r.rotating&&this.fire(new w("rotatestart",t)),this._pitching&&!r.pitching&&this.fire(new w("pitchstart",t)),this._rolling&&!r.rolling&&this.fire(new w("rollstart",t))}_prepareElevation(t){this._elevationCenter=t,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(t,this.transform.tileZoom),this.elevationFreeze=!0}_updateElevation(t){(void 0===this._elevationStart||void 0===this._elevationCenter)&&this._prepareElevation(this.transform.center),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom));let i=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(t<1&&i!==this._elevationTarget){let r=this._elevationTarget-this._elevationStart,a=(i-(r*t+this._elevationStart))/(1-t);this._elevationStart+=t*(r-a),this._elevationTarget=i}this.transform.setElevation(p.bn.number(this._elevationStart,this._elevationTarget,t))}_finalizeElevation(){this.elevationFreeze=!1,this.getCenterClampedToGround()&&this.transform.recalculateZoomAndCenter(this.terrain)}getTransformForUpdate(){return this.transformCameraUpdate||this.terrain?(this._requestedCameraState||=this.transform.clone(),this._requestedCameraState):this.transform}_elevateCameraIfInsideTerrain(t){if(!this.terrain&&t.elevation>=0&&t.pitch<=90)return{};let i=t.getCameraLngLat(),r=t.getCameraAltitude(),a=this.terrain?this.terrain.getElevationForLngLatZoom(i,t.zoom):0;if(r<a){let r=this.calculateCameraOptionsFromTo(i,a,t.center,t.elevation);return{pitch:r.pitch,zoom:r.zoom}}return{}}applyUpdatedTransform(t){let i=[];if(i.push(t=>this._elevateCameraIfInsideTerrain(t)),this.transformCameraUpdate&&i.push(t=>this.transformCameraUpdate(t)),!i.length)return;let r=t.clone();for(let t of i){let i=r.clone(),{center:a,zoom:o,roll:s,pitch:n,bearing:l,elevation:h}=t(i);a&&i.setCenter(a),void 0!==h&&i.setElevation(h),void 0!==o&&i.setZoom(o),void 0!==s&&i.setRoll(s),void 0!==n&&i.setPitch(n),void 0!==l&&i.setBearing(l),r.apply(i,!1)}this.transform.apply(r,!1)}_fireMoveEvents(t){this.fire(new w("move",t)),this._zooming&&this.fire(new w("zoom",t)),this._rotating&&this.fire(new w("rotate",t)),this._pitching&&this.fire(new w("pitch",t)),this._rolling&&this.fire(new w("roll",t))}
803_afterEase(t,i){if(this._easeId&&i&&this._easeId===i)return;delete this._easeId;let r=this._zooming,a=this._rotating,o=this._pitching,s=this._rolling;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._rolling=!1,this._padding=!1,r&&this.fire(new w("zoomend",t)),a&&this.fire(new w("rotateend",t)),o&&this.fire(new w("pitchend",t)),s&&this.fire(new w("rollend",t)),this.fire(new w("moveend",t))}flyTo(t,i){if(!t.essential&&f.prefersReducedMotion){let r=(0,p.Tr)(t,["center","zoom","bearing","pitch","roll","elevation","padding"]);return this.jumpTo(r,i)}this.stop(),"zoom"in(t=(0,p.or)({offset:[0,0],speed:1.2,curve:1.42,easing:p.er},t))&&this._zoomSnap&&(t.zoom=(0,p.ar)(t.zoom,this._zoomSnap));let r=this.getTransformForUpdate(),a=r.bearing,o=r.pitch,s=r.roll,n=r.padding,l="bearing"in t?this._normalizeBearing(t.bearing,a):a,h="pitch"in t?+t.pitch:o,c="roll"in t?this._normalizeBearing(t.roll,s):s,u="padding"in t?t.padding:r.padding,d=p.Vi.convert(t.offset),_=r.centerPoint.add(d),m=r.screenPointToLocation(_),g=this.cameraHelper.handleFlyTo(r,{bearing:l,pitch:h,roll:c,padding:u,locationAtOffset:m,offsetAsPoint:d,center:t.center,minZoom:t.minZoom,zoom:t.zoom}),v=t.curve,y=Math.max(r.width,r.height),x=y/g.scaleOfZoom,b=g.pixelPathLength,w=y/g.scaleOfMinZoom,T=(v=M
803ath.min(v,Math.sqrt(w/b*2)))*v;function P(t){let i=(x*x-y*y+(t?-1:1)*T*T*b*b)/(2*(t?x:y)*T*b);return Math.log(Math.sqrt(i*i+1)-i)}function M(t){return(Math.exp(t)-Math.exp(-t))/2}function I(t){return(Math.exp(t)+Math.exp(-t))/2}let S=P(!1),C=function(t){return I(S)/I(S+v*t)},E=function(t){var i;return y*((I(S)*(M(i=S+v*t)/I(i))-M(S))/T)/b},z=(P(!0)-S)/v;if(2e-6>Math.abs(b)||!isFinite(z)){if(1e-6>Math.abs(y-x))return this.easeTo(t,i);let r=x<y?-1:1;z=Math.abs(Math.log(x/y))/v,E=()=>0,C=t=>Math.exp(r*v*t)}if("duration"in t)t.duration=+t.duration;else{let i="screenSpeed"in t?t.screenSpeed/v:+t.speed;t.duration=1e3*z/i}return t.maxDuration&&t.duration>t.maxDuration&&(t.duration=0),this._zooming=!0,this._rotating=a!==l,this._pitching=h!==o,this._rolling=c!==s,this._padding=!r.isPaddingEqual(u),this._prepareEase(i,!1),this.terrain&&this._prepareElevation(g.targetCenter),this._ease(m=>{let f=m*z,v=1/C(f),y=E(f);this._rotating&&r.setBearing(p.bn.number(a,l,m)),this._pitching&&r.setPitch(p.bn.number(o,h,m)),this._rolling&&r.setRoll(p.bn.number(s,c,m)),this._padding&&(r.interpolatePadding(n,u,m),_=r.centerPoint.add(d)),g.easeFunc(m,v,y,_),this.terrain&&!t.freezeElevation&&this._updateElevation(m),this.applyUpdatedTransform(r),this._fireMoveEvents(i)},()=>{this.terrain&&t.freezeElevation&&this._finalizeElevation(),this._afterEase(i)},t),this}isEasing(){return!!this._easeFrameId}stop(t){return this._stop(t)}_stop(t,i){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){let t=this._onEaseEnd;delete this._onEaseEnd,t.call(this,i)}return t||this._stopHandlers(),this}_ease(t,i,r){!1===r.animate||0===r.duration?(t(1),i()):(this._easeStart=v(),this._easeOptions=r,this._onEaseFrame=t,this._onEaseEnd=i,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(t,i){let r=Math.abs((t=(0,p.Br)(t,-180,180))-i);return Math.abs(t-360-i)<r&&(t-=360),Math.abs(t+360-i)<r&&(t+=360),t}isMoving(){return this._moving}isZooming(){return this._zooming}isRotating(){return this._rotating}};let aV={compact:!0,customAttribution:'<a href="https://maplibre.org/" target="_blank">MapLibre</a>'};var aG=class{constructor(t=aV){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&&("terrain"===t.type||"style"===t.dataType||"source"===t.dataType&&("metadata"===t.sourceDataType||"visibility"===t.sourceDataType))&&this._updateAttributions()},this._updateCompact=()=>{this._map.getCanvasContainer().offsetWidth<=640||this._compact?!1===this._compact?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=t}getDefaultPosition(){return"bottom-right"}onAdd(t){return this._map=t,this._compact=this.options.compact,this._container=y.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=y.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=y.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(t,i){let r=this._map._getUIString(`AttributionControl.${i}`);t.title=r,t.setAttribute("aria-label",r)}_updateAttributions(){if(!this._map.style)return;let t=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?t=t.concat(this.options.customAttribution.map(t=>"string"==typeof t?t:"")):"string"==typeof this.options.customAttribution&&t.push(this.options.customAttribution)),this._map.style.stylesheet){let t=this._map.style.stylesheet;this.styleOwner=t.owner,this.styleId=t.id}let i=this._map.style.tileManagers;for(let r in i){let a=i[r];if(a.used||a.usedForTerrain){let i=a.getSource();i.attribution&&!t.includes(i.attribution)&&t.push(i.attribution)}}(t=t.filter(t=>String(t).trim())).sort((t,i)=>t.length-i.length);let r=(t=t.filter((i,r)=>{for(let a=r+1;a<t.length;a++)if(t[a].includes(i))return!1;return!0})).join(" | ");r!==this._attribHTML&&(this._attribHTML=r,t.length?(this._innerContainer.innerHTML=y.sanitize(r),this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}},aq=class{constructor(t={}){this._updateCompact=()=>{let t=this._container.children;if(t.length){let i=t[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?!1!==this._compact&&i.classList.add("maplibregl-compact"):i.classList.remove("maplibregl-compact")}},this.options=t}getDefaultPosition(){return"bottom-left"}onAdd(t){this._map=t,this._compact=this.options?.compact,this._container=y.create("div","maplibregl-ctrl");let i=y.create("a","maplibregl-ctrl-logo");return i.target="_blank",i.rel="noopener nofollow",i.href="https://maplibre.org/",i.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),i.setAttribute("rel","noopener nofollow"),this._container.appendChild(i),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}},aW=class{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(t){let i=++this._id;return this._queue.push({callback:t,id:i,cancelled:!1}),i}remove(t){let i=this._currentlyRunning;for(let r of i?this._queue.concat(i):this._queue)if(r.id===t){r.cancelled=!0;return}}run(t=0){if(this._currentlyRunning)throw Error("Attempting to run(), but is already running.");let i=this._currentlyRunning=this._queue;
803for(let r of(this._queue=[],i))if(!r.cancelled&&(r.callback(t),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}};let a$=(0,p.Yt)([{name:"a_pos3d",type:"Int16",components:3}]);var aH=class extends p.wn{constructor(t){super(),this._lastTilesetChange=v(),this.tileManager=t,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.deltaZoom=1,this.tileSize=t._source.tileSize*2**this.deltaZoom,t.usedForTerrain=!0,t.tileSize=this.tileSize}destruct(){this.tileManager.usedForTerrain=!1,this.tileManager.tileSize=null,this.releaseAllRTT()}getSource(){return this.tileManager._source}update(t,i){this.tileManager.update(t,i),this._renderableTilesKeys=[];let r={};for(let a of eD(t,{tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:i,calculateTileZoom:this.tileManager._source.calculateTileZoom}))r[a.key]=!0,this._renderableTilesKeys.push(a.key),this._tiles[a.key]||(a.terrainRttPosMatrix32f=new Float32Array(16),(0,p.ki)(a.terrainRttPosMatrix32f,0,p.Ur,p.Ur,0,0,1),this._tiles[a.key]=new eM(a,this.tileSize),this._lastTilesetChange=v());for(let t in this._tiles)r[t]||(this._tiles[t].releaseRTT(this.tileManager.map.painter),delete this._tiles[t])}releaseRTT(t){for(let i in this._tiles){let r=this._tiles[i];(r.tileID.equals(t)||r.tileID.isChildOf(t)||t.isChildOf(r.tileID))&&r.releaseRTT(this.tileManager.map.painter)}}releaseAllRTT(){for(let t in this._tiles)this._tiles[t].releaseRTT(this.tileManager.map.painter)}getRenderableTiles(){return this._renderableTilesKeys.map(t=>this.getTileByID(t))}getTileByID(t){return this._tiles[t]}getTerrainCoords(t,i){return i?this._getTerrainCoordsForTileRanges(t,i):this._getTerrainCoordsForRegularTile(t)}_getTerrainCoordsForRegularTile(t){let i={};for(let r of this._renderableTilesKeys){let a=this._tiles[r].tileID,o=t.clone(),s=(0,p.Xn)();if(a.canonical.equals(t.canonical))(0,p.ki)(s,0,p.Ur,p.Ur,0,0,1);else if(a.canonical.isChildOf(t.canonical)){let i=a.canonical.z-t.canonical.z,r=a.canonical.x-(a.canonical.x>>i<<i),o=a.canonical.y-(a.canonical.y>>i<<i),n=p.Ur>>i;(0,p.ki)(s,0,n,n,0,0,1),(0,p.Fi)(s,s,[-r*n,-o*n,0])}else{if(!t.canonical.isChildOf(a.canonical))continue;let i=t.canonical.z-a.canonical.z,r=t.canonical.x-(t.canonical.x>>i<<i),o=t.canonical.y-(t.canonical.y>>i<<i),n=p.Ur>>i;(0,p.ki)(s,0,p.Ur,p.Ur,0,0,1),(0,p.Fi)(s,s,[r*n,o*n,0]),(0,p.Pi)(s,s,[1/2**i,1/2**i,0])}o.terrainRttPosMatrix32f=new Float32Array(s),i[r]=o}return i}_getTerrainCoordsForTileRanges(t,i){let r={};for(let a of this._renderableTilesKeys){let o=this._tiles[a].tileID;if(!this._isWithinTileRanges(o,i))continue;let s=t.clone(),n=(0,p.Xn)();if(o.canonical.z===t.canonical.z){let i=t.canonical.x-o.canonical.x+t.wrap*(1<<t.canonical.z),r=t.canonical.y-o.canonical.y;(0,p.ki)(n,0,p.Ur,p.Ur,0,0,1),(0,p.Fi)(n,n,[i*p.Ur,r*p.Ur,0])}else if(o.canonical.z>t.canonical.z){let i=o.canonical.z-t.canonical.z,r=o.canonical.x-(o.canonical.x>>i<<i)+t.wrap*(1<<o.canonical.z),a=o.canonical.y-(o.canonical.y>>i<<i),s=t.canonical.x-(o.canonical.x>>i),l=t.canonical.y-(o.canonical.y>>i),h=p.Ur>>i;(0,p.ki)(n,0,h,h,0,0,1),(0,p.Fi)(n,n,[-r*h+s*p.Ur,-a*h+l*p.Ur,0])}else{let i=t.canonical.z-o.canonical.z,r=t.canonical.x-(t.canonical.x>>i<<i)+t.wrap*(1<<t.canonical.z),a=t.canonical.y-(t.canonical.y>>i<<i),s=(t.canonical.x>>i)-o.canonical.x,l=(t.canonical.y>>i)-o.canonical.y,h=p.Ur<<i;(0,p.ki)(n,0,h,h,0,0,1),(0,p.Fi)(n,n,[r*p.Ur+s*h,a*p.Ur+l*h,0])}s.terrainRttPosMatrix32f=new Float32Array(n),r[a]=s}return r}getSourceTile(t,i){let r=this.tileManager._source,a=t.overscaledZ-this.deltaZoom;if(a>r.maxzoom&&(a=r.maxzoom),a<r.minzoom)return;this._sourceTileCache[t.key]||=t.scaledTo(a).key;let o=this.findTileInCaches(this._sourceTileCache[t.key]);if(!o?.dem&&i)for(;a>=r.minzoom&&!o?.dem;)o=this.findTileInCaches(t.scaledTo(a--).key);return o}findTileInCaches(t){let i=this.tileManager.getTileByID(t);return i||(i=this.tileManager._outOfViewCache.getByKey(t))}anyTilesAfterTime(t=v()){return this._lastTilesetChange>=t}_isWithinTileRanges(t,i){let r=i[t.canonical.z];return!!r&&(t.wrap>r.minWrap||t.wrap<r.maxWrap||t.canonical.x>=r.minTileXWrapped&&t.canonical.x<=r.maxTileXWrapped&&t.canonical.y>=r.minTileY&&t.canonical.y<=r.maxTileY)}},aX=class{constructor(t,i,r,a="auto"){this._meshCache={},this.painter=t,this.tileManager=new aH(i),this.options=r,this.exaggeration="number"==typeof r.exaggeration?r.exaggeration:1,this._terrainSkirtLength=a,this.qual
803ityFactor=2,this.meshSize=128,this._demMatrixCache=new Map,this._elevationSamplerCache=new Map,this.coordsIndex=[],this._coordsTextureSize=1024}destroy(){for(let t in this._fbo&&=(this._fbo.destroy(),null),this._fboCoordsTexture&&=(this._fboCoordsTexture.destroy(),null),this._fboDepthTexture&&=(this._fboDepthTexture.destroy(),null),this._emptyDemTexture&&=(this._emptyDemTexture.destroy(),null),this._emptyDepthTexture&&=(this._emptyDepthTexture.destroy(),null),this._coordsTexture&&=(this._coordsTexture.destroy(),null),this._meshCache)this._meshCache[t].destroy();this._meshCache={},this.tileManager.destruct()}getDEMElevation(t,i,r,a=p.Ur){let o=t.normalizeCoordinates(i,r,a);if(!o)return 0;let s=this._getElevationSampler(o.tileID);return s?s(o.x,o.y,a):0}getElevationForLngLatZoom(t,i){if(!(0,p.b)(i,t.wrap()))return 0;let{tileID:r,mercatorX:a,mercatorY:o}=this._getOverscaledTileIDFromLngLatZoom(t,i);return this.getElevation(r,a%p.Ur,o%p.Ur,p.Ur)}getElevationForLngLat(t,i){let r=eD(i,{maxzoom:this.tileManager.maxzoom,minzoom:this.tileManager.minzoom,tileSize:512,terrain:this}),a=0;for(let t of r)t.canonical.z>a&&(a=Math.min(t.canonical.z,this.tileManager.maxzoom));return this.getElevationForLngLatZoom(t,a)}getElevation(t,i,r,a=p.Ur){return this.getDEMElevation(t,i,r,a)*this.exaggeration}resetElevationCache(){this._elevationSamplerCache.clear()}_getElevationSampler(t){let i=t.key,r=this._elevationSamplerCache.get(i);if(r)return r;let a=this.tileManager.getSourceTile(t,!0),o=a?.dem;if(!a||!o)return null;let s=this._getDEMTileMatrix(t,a),n=s[0]*o.dim,l=s[5]*o.dim,h=s[12]*o.dim,c=s[13]*o.dim,u=(t,i,r)=>{let a=8192===r?1:p.Ur/r;return o.sampleBilinear(t*a*n+h,i*a*l+c)};return this._elevationSamplerCache.set(i,u),u}_getDEMTileMatrix(t,i){let r=`${i.tileID.key}/${t.key}`,a=this._demMatrixCache.get(r);if(a)return a;let o=this.tileManager.getSource().maxzoom,s=t.canonical.z-i.tileID.canonical.z;t.overscaledZ>t.canonical.z&&(t.canonical.z>=o?s=t.canonical.z-o:(0,p.zr)("cannot calculate elevation if elevation maxzoom > source.maxzoom"));let n=t.canonical.x-(t.canonical.x>>s<<s),l=t.canonical.y-(t.canonical.y>>s<<s),h=(0,p.Ti)(new Float64Array(16),[1/(p.Ur<<s),1/(p.Ur<<s),0]);return(0,p.Fi)(h,h,[n*p.Ur,l*p.Ur,0]),this._demMatrixCache.set(r,h),h}getTerrainData(t){if(!this._emptyDemTexture){let t=this.painter.context,i=new p.Dt({width:1,height:1},new Uint8Array(4));this._emptyDepthTexture=new p.xt(t,i,t.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new p.xt(t,new p.Dt({width:1,height:1}),t.gl.RGBA,{premultiply:!1}),this._emptyDemTexture.bind(t.gl.NEAREST,t.gl.CLAMP_TO_EDGE),this._emptyDemMatrix=(0,p.Ei)([])}let i=this.tileManager.getSourceTile(t,!0);if(i?.dem&&(!i.demTexture||i.needsTerrainPrepare)){let t=this.painter.context;i.demTexture||=this.painter.getTileTexture(i.dem.stride),i.demTexture?i.demTexture.update(i.dem.getPixels(),{premultiply:!1}):i.demTexture=new p.xt(t,i.dem.getPixels(),t.gl.RGBA,{premultiply:!1}),i.demTexture.bind(t.gl.NEAREST,t.gl.CLAMP_TO_EDGE),i.needsTerrainPrepare=!1}let r=i?this._getDEMTileMatrix(t,i):this._emptyDemMatrix;return{u_depth:2,u_terrain:3,u_terrain_dim:i?.dem?.dim||1,u_terrain_matrix:r,u_terrain_unpack:i?.dem?.getUnpackVector()||this._emptyDemUnpack,u_terrain_exaggeration:this.exaggeration,texture:(i?.demTexture||this._emptyDemTexture).texture,depthTexture:(this._fboDepthTexture||this._emptyDepthTexture).texture,tile:i}}getFramebuffer(t){let i=this.painter,r=i.width/devicePixelRatio,a=i.height/devicePixelRatio;return this._fbo&&(this._fbo.width!==r||this._fbo.height!==a)&&(this._fbo.destroy(),this._fboCoordsTexture.destroy(),this._fboDepthTexture.destroy(),delete this._fbo,delete this._fboDepthTexture,delete this._fboCoordsTexture),this._fboCoordsTexture||(this._fboCoordsTexture=new p.xt(i.context,{width:r,height:a,data:null},i.context.gl.RGBA,{premultiply:!1}),this._fboCoordsTexture.bind(i.context.gl.NEAREST,i.context.gl.CLAMP_TO_EDGE)),this._fboDepthTexture||(this._fboDepthTexture=new p.xt(i.context,{width:r,height:a,data:null},i.context.gl.RGBA,{premultiply:!1}),this._fboDepthTexture.bind(i.context.gl.NEAREST,i.context.gl.CLAMP_TO_EDGE)),this._fbo||(this._fbo=i.context.createFramebuffer(r,a,!0,!1),this._fbo.depthAttachment.set(i.context.createRenderbuffer(i.context.gl.DEPTH_COMPONENT16,r,a))),this._fbo.colorAttachment.set("coords"===t?this._fboCoordsTexture.texture:this._fboDepthTexture.texture),this._fbo}getCoordsTexture(){let t=this.painter.context;if(this._coordsTexture)return this._coordsTexture;let i=new Uint8Array(this._coordsTextureSize*this._coordsTextureSize*4);for(let t=0,r=0;t<this._coordsTextureSize;t++)for(let a=0;a<this._coordsTextureSize;a++,r+=4)i[r+0]=255&a,i[r+1]=255&t,i[r+2]=a>>8<<4|t>>8,i[r+3]=0;let r=new p.Dt({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(i.buffer)),a=new p.xt(t,r,t.gl.RGBA,{premultiply:!1});return a.bind(t.gl.NEAREST,t.gl.CLAMP_TO_EDGE),this._coordsTexture=a,a}
803pointCoordinate(t){this.painter.maybeDrawDepth(!0),this.painter.maybeDrawCoords();let i=new Uint8Array(4),r=this.painter.context,a=r.gl,o=Math.round(t.x*this.painter.pixelRatio/devicePixelRatio),s=Math.round(t.y*this.painter.pixelRatio/devicePixelRatio),n=Math.round(this.painter.height/devicePixelRatio);r.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),a.readPixels(o,n-s-1,1,1,a.RGBA,a.UNSIGNED_BYTE,i),r.bindFramebuffer.set(null);let l=i[0]+(i[2]>>4<<8),h=i[1]+((15&i[2])<<8),c=this.coordsIndex[255-i[3]],u=c&&this.tileManager.getTileByID(c);if(!u)return null;let d=this._coordsTextureSize,_=(1<<u.tileID.canonical.z)*d;return new p.tt((u.tileID.canonical.x*d+l)/_+u.tileID.wrap,(u.tileID.canonical.y*d+h)/_,this.getElevation(u.tileID,l,h,d))}depthAtPoint(t){let i=new Uint8Array(4),r=this.painter.context,a=r.gl;return r.bindFramebuffer.set(this.getFramebuffer("depth").framebuffer),a.readPixels(t.x,this.painter.height/devicePixelRatio-t.y-1,1,1,a.RGBA,a.UNSIGNED_BYTE,i),r.bindFramebuffer.set(null),(i[0]/0x1000000+i[1]/65536+i[2]/256+i[3])/256}getTerrainMesh(t){let i=this.painter.style.projection?.transitionState>0,r=i&&0===t.canonical.y,a=i&&t.canonical.y===(1<<t.canonical.z)-1,o=`m_${r?"n":""}_${a?"s":""}`;if(this._meshCache[o])return this._meshCache[o];let s=this.painter.context,n=new p.Wt,l=new p.Jt,h=this.meshSize,c=p.Ur/h,u=h*h;for(let t=0;t<=h;t++)for(let i=0;i<=h;i++)n.emplaceBack(i*c,t*c,0);for(let t=0;t<u;t+=h+1)for(let i=0;i<h;i++)l.emplaceBack(i+t,h+i+t+1,h+i+t+2),l.emplaceBack(i+t,h+i+t+2,i+t+1);"none"!==this._terrainSkirtLength&&this._buildSkirts(n,l,h,c,r,a);let d=new tM(s.createVertexBuffer(n,a$.members),s.createIndexBuffer(l),p.Bt.simpleSegment(0,0,n.length,l.length));return this._meshCache[o]=d,d}getSkirtLength(t){return 2*Math.PI*p.lt/2**Math.max(t,0)/5}getMinTileElevationForLngLatZoom(t,i){if(!(0,p.b)(i,t.wrap()))return 0;let{tileID:r}=this._getOverscaledTileIDFromLngLatZoom(t,i);return this.getMinMaxElevation(r).minElevation??0}getMinMaxElevation(t){let i=this.tileManager.getSourceTile(t,!0),r={minElevation:null,maxElevation:null};return i?.dem&&(r.minElevation=i.dem.min*this.exaggeration,r.maxElevation=i.dem.max*this.exaggeration),r}_getOverscaledTileIDFromLngLatZoom(t,i){let r=p.tt.fromLngLat(t.wrap()),a=(1<<i)*p.Ur,o=r.x*a,s=r.y*a,n=Math.floor(o/p.Ur),l=Math.floor(s/p.Ur);return{tileID:new p.g(i,0,i,n,l),mercatorX:o,mercatorY:s}}_buildSkirts(t,i,r,a,o,s){let n=t.length,l=n+(r+1),h=(r+1)*r,c=o?p.ht:0,u=+!o,d=s?p.gt:p.Ur,_=+!s;for(let i=0;i<=r;i++)t.emplaceBack(i*a,c,u);for(let i=0;i<=r;i++)t.emplaceBack(i*a,d,_);for(let t=0;t<r;t++)i.emplaceBack(h+t,l+t,l+t+1),i.emplaceBack(h+t,l+t+1,h+t+1),i.emplaceBack(0+t,n+t+1,n+t),i.emplaceBack(0+t,0+t+1,n+t+1);let m=t.length,f=m+(r+1)*2;for(let i of[0,1])for(let o=0;o<=r;o++)for(let r of[0,1])t.emplaceBack(i*p.Ur,o*a,r);for(let t=0;t<2*r;t+=2)i.emplaceBack(m+t,m+t+1,m+t+3),i.emplaceBack(m+t,m+t+3,m+t+2),i.emplaceBack(f+t,f+t+3,f+t+1),i.emplaceBack(f+t,f+t+2,f+t+3)}};let aK={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0,"color-relief":!0};var aY=class{constructor(t,i){this.painter=t,this.terrain=i,this.rttSize=i.tileManager.tileSize*i.qualityFactor}getTexture(t){return t.getRTT(this._stacks.length-1).texture}
803prepareForRender(t,i){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.tileManager.getRenderableTiles(),this._renderableLayerIds=t._order.filter(r=>!t._layers[r].isHidden(i));let r=new Set;for(let i of this._renderableLayerIds){let a=t._layers[i],o=a.source;o&&aK[a.type]&&r.add(o)}for(let i of(this._coordsAscending={},this._rttFingerprints={},r)){let r=t.tileManagers[i];if(!r)continue;this._coordsAscending[i]={};let a=this._coordsAscending[i],o=r.getSource(),s=o instanceof eg?o.terrainTileRanges:null;for(let t of r.getVisibleCoordinates()){let i=this.terrain.tileManager.getTerrainCoords(t,s);for(let t in i)a[t]||=[],a[t].push(i[t])}this._rttFingerprints[i]={};let n=this._rttFingerprints[i],l=r.getState().revision;for(let t in a)n[t]=`${a[t].map(t=>t.key).sort().join()}#${l}`}for(let t of this._renderableTiles)for(let i in this._rttFingerprints){let r=this._rttFingerprints[i][t.tileID.key];r&&r!==t.rttFingerprint[i]&&t.releaseRTT(this.painter)}}renderLayer(t,i){if(t.isHidden(this.painter.transform.zoom))return!1;let r={...i,isRenderingToTexture:!0},a=t.type,o=this.painter,s=this._renderableLayerIds[this._renderableLayerIds.length-1]===t.id;if(aK[a]&&(this._prevType&&aK[this._prevType]||this._stacks.push([]),this._prevType=a,this._stacks[this._stacks.length-1].push(t.id),!s))return!0;if(aK[this._prevType]||aK[a]&&s){this._prevType=a;let t=this._stacks.length-1,i=this._stacks[t]||[];for(let a of this._renderableTiles){if(this._rttTiles.push(a),a.getRTT(t))continue;let s=a.acquireRTT(o,t,this.rttSize);for(let t of(o.bindRTT(s),o.context.clear({color:p.dn.transparent,stencil:0}),o.currentStencilSource=void 0,i)){let i=o.style._layers[t],s=i.source?this._coordsAscending[i.source][a.tileID.key]:[a.tileID];o.context.viewport.set([0,0,this.rttSize,this.rttSize]),o.renderTileClippingMasks(i,s,!0),o.renderLayer(o,o.style.tileManagers[i.source],i,s,r),i.source&&(a.rttFingerprint[i.source]=this._rttFingerprints[i.source][a.tileID.key])}}return function(t,i,r,a){let{isRenderingGlobe:o}=a,s=t.context,n=s.gl,l=t.transform,h=t.colorModeForRenderPass(),c=t.getDepthModeFor3D(),u=t.useProgram("terrain");for(let a of(s.bindFramebuffer.set(null),s.viewport.set([0,0,t.width,t.height]),r)){let r=i.getTerrainMesh(a.tileID),d=t.renderToTexture.getTexture(a),_=i.getTerrainData(a.tileID);s.activeTexture.set(n.TEXTURE0),n.bindTexture(n.TEXTURE_2D,d.texture);let p=il(i.getSkirtLength(l.zoom),l.calculateFogMatrix(a.tileID.toUnwrapped()),t.style.sky,l.pitch,o),m=l.getProjectionData({overscaledTileID:a.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0});u.draw(s,n.TRIANGLES,c,rT.disabled,h,rP.backCCW,p,_,m,"terrain",r.vertexBuffer,r.indexBuffer,r.segments)}}(this.painter,this.terrain,this._rttTiles,r),this._rttTiles=[],aK[a]}return!1}};let aJ={"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"},aQ={hash:!1,interactive:!0,bearingSnap:7,zoomSnap:0,attributionControl:aV,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
803acheSize:null,maxTileCacheZoomLevels:p.In.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 a0=class extends p.wn{get _ownerWindow(){return this._container?.ownerDocument?.defaultView||window}constructor(t){super(),this._idleTriggered=!1,this._crossFadingFactor=1,this._renderTaskQueue=new aW,this._controls=[],this._mapId=(0,p.Rr)(),this._missingStyleImageResolver=null,this._lostContextStyle={style:null,images:null},this._contextLost=t=>{if(t.preventDefault(),this._frameRequest&&=(this._frameRequest.abort(),null),this.painter.destroy(),this._lostContextStyle=this._getStyleAndImages(),!this.style)return void this.fire(new D("webglcontextlost",{originalEvent:t}));for(let t of Object.values(this.style._layers))if("custom"===t.type&&console.warn(`Custom layer with id '${t.id}' cannot be restored after WebGL context loss. You will need to re-add it manually after context restoration.`),t._listeners)for(let[i]of Object.entries(t._listeners))console.warn(`Custom layer with id '${t.id}' had event listeners for event '${i}' 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 D("webglcontextlost",{originalEvent:t}))},this._contextRestored=t=>{if(this._lostContextStyle.style&&this.setStyle(this._lostContextStyle.style,{diff:!1}),this._lostContextStyle.images&&this.style)for(let t in this.style.imageManager.images=this._lostContextStyle.images,this._lostContextStyle.images){let i=this._lostContextStyle.images[t];i.isWebGLImage&&this.style.imageManager.updateImage(t,i,!1)}this._lostContextStyle={style:null,images:null},this._setupPainter(),this.painter&&(this.resize(),this._update(),this._resizeInternal(),this.fire(new D("webglcontextrestored",{originalEvent:t})))},this._onMapScroll=t=>{if(t.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()};let i={...aQ,...t,canvasContextAttributes:{...aQ.canvasContextAttributes,...t.canvasContextAttributes}};if(null!=i.minZoom&&null!=i.maxZoom&&i.minZoom>i.maxZoom)throw Error("maxZoom must be greater than or equal to minZoom");if(null!=i.minPitch&&null!=i.maxPitch&&i.minPitch>i.maxPitch)throw Error("maxPitch must be greater than or equal to minPitch");if(null!=i.minPitch&&i.minPitch<0)throw Error("minPitch must be greater than or equal to 0");if(null!=i.maxPitch&&i.maxPitch>180)throw Error("maxPitch must be less than or equal to 180");if(this._camera=new aU({minZoom:i.minZoom,maxZoom:i.maxZoom,minPitch:i.minPitch,maxPitch:i.maxPitch,bearingSnap:i.bearingSnap,zoomSnap:i.zoomSnap,renderWorldCopies:i.renderWorldCopies,centerClampedToGround:i.centerClampedToGround,terrain:this.terrain,transformConstrain:i.transformConstrain,requestRenderFrame:t=>this._requestRenderFrame(t),cancelRenderFrame:t=>this._cancelRenderFrame(t),transformCameraUpdate:i.transformCameraUpdate,stopHandlers:()=>this._handlers?.stop(!1)}),this._camera.setEventedParent(this),this._interactive=i.interactive,this._maxTileCacheSize=i.maxTileCacheSize,this._maxTileCacheZoomLevels=i.maxTileCacheZoomLevels,this._canvasContextAttributes={...i.canvasContextAttributes},this._trackResize=!0===i.trackResize,this._terrainSkirtLength=i.terrainSkirtLength,this._refreshExpiredTiles=!0===i.refreshExpiredTiles,this._fadeDuration=i.fadeDuration,this._crossSourceCollisions=!0===i.crossSourceCollisions,this._collectResourceTiming=!0===i.collectResourceTiming,this._locale={...aJ,...i.locale},this._clickTolerance=i.clickTolerance,this._overridePixelRatio=i.pixelRatio,this._maxCanvasSize=i.maxCanvasSize,this._zoomLevelsToOverscale=i.zoomLevelsToOverscale,this.cancelPendingTileRequestsWhileZooming=!0===i.cancelPendingTileRequestsWhileZooming,this.setAnisotropicFilterPitch(i.anisotropicFilterPitch),void 0!==i.reduceMotion&&(f.prefersReducedMotion=i.reduceMotion),this._imageQueueHandle=n.addThrottleControl(()=>this.isMoving()),this._requestManager=new x(i.transformRequest),this._container=this._resolveContainer(i.container),i.maxBounds&&this.setMaxBounds(i.maxBounds),this._setupContainer(),this._setupPainter(),!this.painter)return;this.on("move",()=>this._update(!1)),this.on("moveend",()=>this._update(!1)),this.on("zoom",()=>this._update(!0)),this.on("terrain",()=>{this.painter.terrainFacilitator.depthDirty=!0,this._update(!0)}),this.once("idle",()=>this._idleTriggered=!0),this._handlers=new aZ(this,this._camera,i),"u">typeof window&&(this._ownerWindow.addEventListener("online",this._onWindowOnline,!1),this._setupResizeObserver());let r="string"==typeof i.hash&&i.hash||void 0;this._hash=i.hash?new r4(r).addTo(this):void 0,this._hash?._onHashChange()||(this.jumpTo({center:i.center,elevation:i.elevation,zoom:i.zoom,bearing:i.bearing,pitch:i.pitch,roll:i.roll}),i.bounds&&(this.resize(),this.fitBounds(i.bounds,(0,p.or)({},i.fitBoundsOptions,{duration:0}))));let a="string"==typeof i.style||i.style?.projection?.type!=="globe";this.resize(null,a),this._localIdeographFontFamily=i.localIdeographFontFamily,this._val
vendor: 4,113 bytes, line 803
803idateStyle=i.validateStyle,i.style&&this.setStyle(i.style,{localIdeographFontFamily:i.localIdeographFontFamily}),i.attributionControl&&this.addControl(new aG("boolean"==typeof i.attributionControl?void 0:i.attributionControl)),i.maplibreLogo&&this.addControl(new aq,i.logoPosition),this.on("style.load",()=>{if(a||this._resizeTransform(),this._camera.transform.unmodified){let t=(0,p.Tr)(this.style.stylesheet,["center","zoom","bearing","pitch","roll"]);this.jumpTo(t)}}),this.on("data",t=>{this._update("style"===t.dataType),this.fire("style"===t.dataType?new P("styledata",t):new M("sourcedata",t))}),this.on("dataloading",t=>{this.fire("style"===t.dataType?new P("styledataloading",t):new M("sourcedataloading",t))}),this.on("dataabort",t=>{this.fire(new M("sourcedataabort",t))})}_getMapId(){return this._mapId}setGlobalStateProperty(t,i){return this.style.setGlobalStateProperty(t,i),this._update(!0)}getGlobalState(){return this.style.getGlobalState()}addControl(t,i){if(void 0===i&&(i=t.getDefaultPosition?t.getDefaultPosition():"top-right"),!t?.onAdd)return this.fire(new p.Sn(Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));let r=t.onAdd(this);this._controls.push(t);let a=this._controlPositions[i];return i.includes("bottom")?a.insertBefore(r,a.firstChild):a.appendChild(r),this}removeControl(t){if(!t?.onRemove)return this.fire(new p.Sn(Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));let i=this._controls.indexOf(t);return i>-1&&this._controls.splice(i,1),t.onRemove(this),this}hasControl(t){return this._controls.includes(t)}coveringTiles(t){return eD(this._camera.transform,t)}setTransformCameraUpdate(t){this._camera.transformCameraUpdate=t}getCenter(){return new p.ct(this._camera.transform.center.lng,this._camera.transform.center.lat)}setCenter(t,i){return this._camera.setCenter(t,i),this}getCenterElevation(){return this._camera.transform.elevation}setCenterElevation(t,i){return this._camera.setCenterElevation(t,i),this}setCenterClampedToGround(t){this._camera.setCenterClampedToGround(t)}panBy(t,i,r){return this._camera.panBy(t,i,r),this}panTo(t,i,r){return this._camera.panTo(t,i,r),this}getZoom(){return this._camera.transform.zoom}setZoom(t,i){return this._camera.setZoom(t,i),this}zoomTo(t,i,r){return this._camera.zoomTo(t,i,r),this}zoomIn(t,i){return this._camera.zoomIn(t,i),this}zoomOut(t,i){return this._camera.zoomOut(t,i),this}getVerticalFieldOfView(){return this._camera.transform.fov}setVerticalFieldOfView(t,i){return this._camera.setVerticalFieldOfView(t,i),this}getBearing(){return this._camera.transform.bearing}setBearing(t,i){return this._camera.setBearing(t,i),this}getZoomSnap(){return this._camera.getZoomSnap()}setZoomSnap(t){return this._camera.setZoomSnap(t),this}getPadding(){return this._camera.transform.padding}setPadding(t,i){return this._camera.setPadding(t,i),this}rotateTo(t,i,r){return this._camera.rotateTo(t,i,r),this}resetNorth(t,i){return this._camera.resetNorth(t,i),this}resetNorthPitch(t,i){return this._camera.resetNorthPitch(t,i),this}snapToNorth(t,i){return this._camera.snapToNorth(t,i),this}getPitch(){return this._camera.transform.pitch}setPitch(t,i){return this._camera.setPitch(t,i),this}getRoll(){return this._camera.transform.roll}setRoll(t,i){return this._camera.setRoll(t,i),this}cameraForBounds(t,i){return this._camera.cameraForBounds(t,i)}fitBounds(t,i,r){return this._camera.fitBounds(t,i,r),this}fitScreenCoordinates(t,i,r,a,o){return this._camera.fitScreenCoordinates(t,i,r,a,o),this}jumpTo(t,i){return this._camera.jumpTo(t,i),this}calculateCameraOptionsFromCameraLngLatAltRotation(t,i,r,a,o){return this._camera.calculateCameraOptionsFromCameraLngLatAltRotation(t,i,r,a,o)}easeTo(t,i){return this._camera.easeTo(t,i),this}flyTo(t,i){return this._camera.flyTo(t,i),this}stop(){return this._camera.stop(),this}queryTerrainElevation(t){return this.terrain?this.terrain.getElevationForLngLat(p.ct.convert(t),this._camera.transform):null}getCenterClampedToGround(){return this._camera.getCenterClampedToGroun
803d()}calculateCameraOptionsFromTo(t,i,r,a){return null==a&&this.terrain&&(a=this.terrain.getElevationForLngLat(r,this._camera.transform)),this._camera.calculateCameraOptionsFromTo(t,i,r,a)}resize(t,i=!0){if(null!==this._lostContextStyle.style)return this;this._resizeInternal(i);let r=!this._camera._moving;return r&&(this.stop(),this.fire(new w("movestart",t)).fire(new w("move",t))),this.fire(new b("resize",t)),r&&this.fire(new w("moveend",t)),this}_resizeInternal(t=!0){let[i,r]=this._containerDimensions(),a=this._getClampedPixelRatio(i,r);if(this._resizeCanvas(i,r,a),this.painter.resize(i,r,a),this.painter.overLimit()){let t=this.painter.context.gl;this._maxCanvasSize=[t.drawingBufferWidth,t.drawingBufferHeight];let a=this._getClampedPixelRatio(i,r);this._resizeCanvas(i,r,a),this.painter.resize(i,r,a)}this._resizeTransform(t)}_resizeTransform(t=!0){let[i,r]=this._containerDimensions();this._camera.transform.resize(i,r,t),this._camera._requestedCameraState?.resize(i,r,t)}_getClampedPixelRatio(t,i){let{0:r,1:a}=this._maxCanvasSize,o=this.getPixelRatio(),s=t*o,n=i*o;return Math.min(s>r?r/s:1,n>a?a/n:1)*o}getPixelRatio(){return this._overridePixelRatio??devicePixelRatio}setPixelRatio(t){this._overridePixelRatio=t,this.resize()}getBounds(){return this._camera.transform.getBounds()}getMaxBounds(){return this._camera.transform.getMaxBounds()}setMaxBounds(t){return this._camera.transform.setMaxBounds(eo.convert(t)),this._update()}setMinZoom(t){if((t??=-2)>=-2&&t<=this._camera.transform.maxZoom){let i=this._camera.transform.zoom,r=this._camera.getTransformForUpdate();return r.setMinZoom(t),this._camera.applyUpdatedTransform(r),this._update(),i!==this._camera.transform.zoom&&this.fire(new w("zoomstart")).fire(new w("zoom")).fire(new w("zoomend")).fire(new w("movestart")).fire(new w("move")).fire(new w("moveend")),this}throw Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this._camera.transform.minZoom}setMaxZoom(t){if((t??=22)>=this._camera.transform.minZoom){let i=this._camera.transform.zoom,r=this._camera.getTransformForUpdate();return r.setMaxZoom(t),this._camera.applyUpdatedTransform(r),this._update(),i!==this._camera.transform.zoom&&this.fire(new w("zoomstart")).fire(new w("zoom")).fire(new w("zoomend")).fire(new w("movestart")).fire(new w("move")).fire(new w("moveend")),this}throw Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this._camera.transform.maxZoom}setMinPitch(t){if((t??=0)<0)throw Error("minPitch must be greater than or equal to 0");if(t>=0&&t<=this._camera.transform.maxPitch){let i=this._camera.transform.pitch,r=this._camera.getTransformForUpdate();return r.setMinPitch(t),this._camera.applyUpdatedTransform(r),this._update(),i!==this._camera.transform.pitch&&this.fire(new w("pitchstart")).fire(new w("pitch")).fire(new w("pitchend")).fire(new w("movestart")).fire(new w("move")).fire(new w("moveend")),this}throw Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this._camera.transform.minPitch}setMaxPitch(t){if((t??=60)>180)throw Error("maxPitch must be less than or equal to 180");if(t>=this._camera.transform.minPitch){let i=this._camera.transform.pitch,r=this._camera.getTransformForUpdate();return r.setMaxPitch(t),this._camera.applyUpdatedTransform(r),this._update(),i!==this._camera.transform.pitch&&this.fire(new w("pitchstart")).fire(new w("pitch")).fire(new w("pitchend")).fire(new w("movestart")).fire(new w("move")).fire(new w("moveend")),this}throw Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this._camera.transform.maxPitch}getAnisotropicFilterPitch(){return this._anisotropicFilterPitch}setAnisotropicFilterPitch(t){if((t??=20)>180)throw Error("anisotropicFilterPitch must be less than or equal to 180");if(t<0)throw Error("anisotropicFilterPitch must be greater than or equal to 0");return this._anisotropicFilterPitch=t,this._update()}getRenderWorldCopies(){return this._camera.transform.renderWorldCopies}setRenderWorldCopies(t){return this._camera.transform.setRenderWorldCopies(t),this._update()}setTransformConstrain(t){return this._camera.transform.setConstrainOverride(t),this._update()}project(t){return this._camera.transform.locationToScreenPoint(p.ct.convert(t),this.style&&this.terrain)}unproject(t){return this._camera.transform.screenPointToLocation(p.Vi.convert(t),this.terrain)}isMoving(){return this._camera.isMoving()||this._handlers?.isMoving()||!1}isZooming(){return this._camera.isZooming()||this._handlers?.isZooming()||!1}isRotating(){return this._camera.isRotating()||this._handlers?.isRotating()||!1}
803_createDelegatedListener(t,i,r){if("mouseenter"===t||"mouseover"===t){let a=!1;return{layers:i,listener:r,delegates:{mousemove:o=>{let s=i.filter(t=>this.getLayer(t)),n=0===s.length?[]:this.queryRenderedFeatures(o.point,{layers:s});n.length?a||(a=!0,r.call(this,new I(t,this,o.originalEvent,{features:n}))):a=!1},mouseout:()=>{a=!1}}}}if("mouseleave"===t||"mouseout"===t){let a=!1;return{layers:i,listener:r,delegates:{mousemove:o=>{let s=i.filter(t=>this.getLayer(t));(0===s.length?[]:this.queryRenderedFeatures(o.point,{layers:s})).length?a=!0:a&&(a=!1,r.call(this,new I(t,this,o.originalEvent)))},mouseout:i=>{a&&(a=!1,r.call(this,new I(t,this,i.originalEvent)))}}}}{let a=t=>{let a=i.filter(t=>this.getLayer(t)),o=0===a.length?[]:this.queryRenderedFeatures(t.point,{layers:a});o.length&&(t.features=o,r.call(this,t),delete t.features)};return{layers:i,listener:r,delegates:{[t]:a}}}}_saveDelegatedListener(t,i){this._delegatedListeners||={},this._delegatedListeners[t]||=[],this._delegatedListeners[t].push(i)}_removeDelegatedListener(t,i,r){if(!this._delegatedListeners?.[t])return;let a=this._delegatedListeners[t];for(let t=0;t<a.length;t++){let o=a[t];if(o.listener===r&&o.layers.length===i.length&&o.layers.every(t=>i.includes(t))){for(let t in o.delegates)this.off(t,o.delegates[t]);a.splice(t,1);return}}}on(t,i,r){if(void 0===r)return super.on(t,i);let a="string"==typeof i?[i]:i,o=this._createDelegatedListener(t,a,r);for(let i in this._saveDelegatedListener(t,o),o.delegates)this.on(i,o.delegates[i]);return{unsubscribe:()=>{this._removeDelegatedListener(t,a,r)}}}once(t,i,r){if(void 0===r)return super.once(t,i);let a="string"==typeof i?[i]:i,o=this._createDelegatedListener(t,a,r);for(let i in o.delegates){let s=o.delegates[i];o.delegates[i]=(...i)=>{this._removeDelegatedListener(t,a,r),s(...i)}}for(let i in this._saveDelegatedListener(t,o),o.delegates)this.once(i,o.delegates[i]);return this}off(t,i,r){if(void 0===r)return super.off(t,i);let a="string"==typeof i?[i]:i;return this._removeDelegatedListener(t,a,r),this}queryRenderedFeatures(t,i){if(!this.style)return[];let r,a=t instanceof p.Vi||Array.isArray(t),o=a?t:[[0,0],[this._camera.transform.width,this._camera.transform.height]];if(i||=(a?{}:t)||{},o instanceof p.Vi||"number"==typeof o[0])r=[p.Vi.convert(o)];else{let t=p.Vi.convert(o[0]),i=p.Vi.convert(o[1]);r=[t,new p.Vi(i.x,t.y),i,new p.Vi(t.x,i.y),t]}return this.style.queryRenderedFeatures(r,i,this._camera.transform)}querySourceFeatures(t,i){return this.style.querySourceFeatures(t,i)}setStyle(t,i){return!1!==(i=(0,p.or)({},{localIdeographFontFamily:this._localIdeographFontFamily,validate:this._val
803idateStyle},i)).diff&&i.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&t?(this._diffStyle(t,i),this):(this._localIdeographFontFamily=i.localIdeographFontFamily,this._updateStyle(t,i))}setTransformRequest(t){return this._requestManager.setTransformRequest(t),this}_getUIString(t){let i=this._locale[t];if(null==i)throw Error(`Missing UI string '${t}'`);return i}_updateStyle(t,i){if(this._diffStyleRequest?.abort(),this._diffStyleRequest=null,i.transformStyle&&this.style&&!this.style._loaded)return void this.style.once("style.load",()=>this._updateStyle(t,i));let r=this.style&&i.transformStyle?this.style.serialize():void 0;return(this.style&&(this.style.setEventedParent(null),this.style._remove(!t)),t)?(this.style=new ia(this,i||{}),this.style.setEventedParent(this,{style:this.style}),"string"==typeof t?this.style.loadURL(t,i,r):this.style.loadJSON(t,i,r)):(this._frameRequest&&=(this._frameRequest.abort(),null),this.style?.projection?.destroy(),delete this.style),this}_lazyInitEmptyStyle(){this.style||(this.style=new ia(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}async _diffStyle(t,i){if(this._diffStyleRequest?.abort(),"string"==typeof t){this._diffStyleRequest=new AbortController;let r=this._diffStyleRequest;try{let a=await this._requestManager.transformRequest(t,"Style");if(r.signal.aborted){this._diffStyleRequest=null;return}let o=await (0,p.On)(a,r);this._diffStyleRequest=null,this._updateDiff(o.data,i)}catch(t){this._diffStyleRequest=null,(0,p.Rn)(t)||this.fire(new p.Sn((0,p.ir)(t)))}}else"object"==typeof t&&(this._diffStyleRequest=null,this._updateDiff(t,i))}_updateDiff(t,i){try{this.style.setState(t,i)&&this._update(!0)}catch(r){(0,p.zr)(`Unable to perform style diff: ${(0,p.ir)(r).message}.  Rebuilding the style from scratch.`),this._updateStyle(t,i)}}getStyle(){if(this.style)return this.style.serialize()}_getStyleAndImages(){return this.style?{style:this.style.serialize(),images:this.style.imageManager.cloneImages()}:{style:null,images:{}}}isStyleLoaded(){return this.style?this.style.loaded():void(0,p.zr)("There is no style added to the map.")}addSource(t,i){return this._lazyInitEmptyStyle(),this.style.addSource(t,i),this._update(!0)}isSourceLoaded(t){let i=this.style?.tileManagers[t];return void 0===i?void this.fire(new p.Sn(Error(`There is no tile manager with ID '${t}'`))):i.loaded()}setTerrain(t,i={}){if(this.style._checkLoaded(),t&&(0,p.cn)(this,p.ln.terrain,{value:t},i))return this;if(this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),t){let i=this.style.tileManagers[t.source];if(!i)throw Error(`cannot load terrain, because there exists no source with ID: ${t.source}`);for(let r in null===this.terrain&&i.reload(),this.style._layers){let i=this.style._layers[r];"hillshade"===i.type&&i.source===t.source&&(0,p.zr)("You are using the same source for a hillshade layer and for 3D terrain. Please consider using two separate sources to improve rendering quality."),"color-relief"===i.type&&i.source===t.source&&(0,p.zr)("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 aX(this.painter,i,t,this._terrainSkirtLength),this.painter.renderToTexture=new aY(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.getElevationForLngLatZoom(this._camera.transform.center,this._camera.transform.tileZoom)),this._terrainDataCallback=i=>this._handleTerrainDataEvent(i,t.source),this.style.on("data",this._terrainDataCallback)}else this.terrain&&this.terrain.destroy(),this.terrain=null,this.painter.renderToTexture=null,this._camera.terrain=null,this._camera.transform.setMinElevationForCurrentTile(0),this.getCenterClampedToGround()&&this._camera.transform.setElevation(0);return this.fire(new z({terrain:t})),this}_handleTerrainDataEvent(t,i){if("style"===t.dataType)return void this.terrain.tileManager.releaseAllRTT();let r=t.sourceId===i;if(r&&this.terrain.resetElevationCache(),r&&t.tile&&!this._camera.elevationFreeze&&(this._camera.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this._camera.transform.center,this._camera.transform.tileZoom)),this.getCenterClampedToGroun
803d()&&this._camera.transform.setElevation(this.terrain.getElevationForLngLatZoom(this._camera.transform.center,this._camera.transform.tileZoom))),t.tile){if(t.source?.type==="image")return void this.terrain.tileManager.releaseAllRTT();this.terrain.tileManager.releaseRTT(t.tile.tileID)}}getTerrain(){return this.terrain?.options??null}areTilesLoaded(){for(let t of Object.values(this.style?.tileManagers))if(!t.areTilesLoaded())return!1;return!0}removeSource(t){return this.style.removeSource(t),this._update(!0)}getSource(t){return this.style?.getSource(t)}setSourceTileLodParams(t,i,r){if(r){let a=this.getSource(r);if(!a)throw Error(`There is no source with ID "${r}", cannot set LOD parameters`);a.calculateTileZoom=eE(Math.max(1,t),Math.max(1,i))}else for(let r in this.style.tileManagers)this.style.tileManagers[r].getSource().calculateTileZoom=eE(Math.max(1,t),Math.max(1,i));return this._update(!0),this}refreshTiles(t,i){let r=this.style.tileManagers[t];if(!r)throw Error(`There is no tile manager with ID "${t}", cannot refresh tile`);void 0===i?r.reload(!0):r.refreshTiles(i.map(t=>new p.h(t.z,t.x,t.y)))}addImage(t,i,r={}){this._lazyInitEmptyStyle();let a=this._createStyleImage(i,r);return a&&(this.style.addImage(t,a),a.userImage?.onAdd&&a.userImage.onAdd(this,t)),this}setMissingStyleImageResolver(t){return this._missingStyleImageResolver=t,this.style?.setMissingImageResolver(t),this}_createStyleImage(t,i={}){let{pixelRatio:r=1,sdf:a=!1,stretchX:o,stretchY:s,content:n,textFitWidth:l,textFitHeight:h}=i;if(t instanceof HTMLImageElement||(0,p.mr)(t)){let{width:i,height:c,data:u}=f.getImageData(t);return{data:new p.Dt({width:i,height:c},u),pixelRatio:r,stretchX:o,stretchY:s,content:n,textFitWidth:l,textFitHeight:h,sdf:a,version:0}}if(void 0===t.width||void 0===t.height)return this.fire(new p.Sn(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:i,height:c,data:u}=t,d=(0,p.L)(t.data);return{data:d?new p.Dt({width:i,height:c}):new p.Dt({width:i,height:c},new Uint8Array(u)),pixelRatio:r,stretchX:o,stretchY:s,content:n,textFitWidth:l,textFitHeight:h,sdf:a,version:0,isWebGLImage:d,userImage:t}}}updateImage(t,i){let r=this.style.getImage(t);if(!r)return this.fire(new p.Sn(Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));let{width:a,height:o,data:s}=i instanceof HTMLImageElement||(0,p.mr)(i)?f.getImageData(i):i;if(void 0===a||void 0===o)return this.fire(new p.Sn(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(a!==r.data.width||o!==r.data.height)return this.fire(new p.Sn(Error("The width and height of the updated image must be that same as the previous version of the image")));if(r.isWebGLImage=(0,p.L)(s),r.isWebGLImage)r.userImage=i;else{let t=!(i instanceof HTMLImageElement||(0,p.mr)(i));r.data.replace(s,t)}return this.style.updateImage(t,r),this}getImage(t){return this.style.getImage(t)}hasImage(t){return t?!!this.style.getImage(t):(this.fire(new p.Sn(Error("Missing required image id"))),!1)}removeImage(t){this.style.removeImage(t)}async loadImage(t){return n.getImage(await this._requestManager.transformRequest(t,"Image"),new AbortController)}listImages(){return this.style?.listImages()??[]}addLayer(t,i){return this._lazyInitEmptyStyle(),this.style.addLayer(t,i),this._update(!0)}moveLayer(t,i){return this.style.moveLayer(t,i),this._update(!0)}removeLayer(t){return this.style.removeLayer(t),this._update(!0)}getLayer(t){return this.style?.getLayer(t)}getLayersOrder(){return this.style?.getLayersOrder()??[]}setLayerZoomRange(t,i,r){return this.style.setLayerZoomRange(t,i,r),this._update(!0)}setFilter(t,i,r={}){return this.style?.setFilter(t,i,r),this._update(!0)}getFilter(t){return this.style.getFilter(t)}setPaintProperty(t,i,r,a={}){return this.style?.setPaintProperty(t,i,r,a),this._update(!0)}getPaintProperty(t,i){return this.style.getPaintProperty(t,i)}setLayoutProperty(t,i,r,a={}){return this.style.setLayoutProperty(t,i,r,a),this._update(!0)}getLayoutProperty(t,i){return this.style.getLayoutProperty(t,i)}setGlyphs(t,i={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(t,i),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(t,i,r={}){return this._lazyInitEmptyStyle(),this.style.addSprite(t,i,r,t=>{t||this._update(!0)}),this}removeSprite(t){return this._lazyInitEmptyStyle(),this.style.removeSprite(t),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(t,i={}){return this._lazyInitEmptyStyle(),this.style.setSprite(t,i,t=>{t||this._update(!0)}),this}setLight(t,i={}){return this._lazyInitEmptyStyle(),this.style.setLight(t,i),this._update(!0)}getLight(){return this.style.getLight()}setSky(t,i={}){return this._lazyInitEmptyStyle(),this.style.setSky(t,i),this._update(!0)}getSky(){return this.style.getSky()}setFeatureState(t,i){return this.style.setFeatureState(t,i),this._update()}removeFeatureState(t,i){return this.style.removeFeatureState(t,i),this._update()}getFeatureState(t){return this.style.getFeatureState(t)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let t=0,i=0;return this._container&&(t=this._container.clientWidth||400,i=this._container.clientHeight||300),[t,i]}_setupResizeObserver(){let t=!1,i=r3(t=>{this._trackResize&&!this._removed&&(this.resize(t),this.redraw())},50),r=this._ownerWindow.ResizeObserver??ResizeObserver;this._resizeObserver=new r(r=>{if(!t){t=!0;return}i(r)}),this._resizeObserver.observe(this._container)}
vendor: 12,466 bytes, line 803
803_resolveContainer(t){if("string"==typeof t){let i=document.getElementById(t);if(!i)throw Error(`Container '${t}' not found.`);return i}if(t instanceof HTMLElement||t&&"object"==typeof t&&1===t.nodeType)return t;throw Error("Invalid type: 'container' must be a String or HTMLElement.")}_setupContainer(){let t=this._container;t.classList.add("maplibregl-map");let i=this._canvasContainer=y.create("div","maplibregl-canvas-container",t);this._interactive&&i.classList.add("maplibregl-interactive"),this._canvas=y.create("canvas","maplibregl-canvas",i),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex",this._interactive?"0":"-1"),this._canvas.setAttribute("aria-label",this._getUIString("Map.Title")),this._canvas.setAttribute("role","region");let r=this._containerDimensions(),a=this._getClampedPixelRatio(r[0],r[1]);this._resizeCanvas(r[0],r[1],a);let o=this._controlContainer=y.create("div","maplibregl-control-container",t),s=this._controlPositions={};for(let t of["top-left","top-right","bottom-left","bottom-right"])s[t]=y.create("div",`maplibregl-ctrl-${t} `,o);this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(t,i,r){this._canvas.width=Math.floor(r*t),this._canvas.height=Math.floor(r*i),this._canvas.style.width=`${t}px`,this._canvas.style.height=`${i}px`}_setupPainter(){let t={...this._canvasContextAttributes,alpha:!0,depth:!0,stencil:!0,premultipliedAlpha:!0},i=null;this._canvas.addEventListener("webglcontextcreationerror",t=>{i=t},{once:!0});let r=this._canvas.getContext("webgl2",t);if(!r)return void this.fire(new p.Sn(new r2(t,i)));this.painter=new r1(r,this._camera.transform)}migrateProjection(t,i){this._camera.migrateProjection(t,i),this.painter.transform=t,this.fire(new R({newProjection:this.style.projection.name}))}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(t){return this.style?._loaded&&(this._styleDirty||=t,this._sourcesDirty=!0,this.triggerRepaint()),this}_requestRenderFrame(t){return this._update(),this._renderTaskQueue.add(t)}_cancelRenderFrame(t){this._renderTaskQueue.remove(t)}_render(t){let i=this._idleTriggered?this._fadeDuration:0,r=this.style.projection?.transitionState>0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(t),this._removed)return;let a=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;let t=this._camera.transform.zoom,r=v();this.style.zoomHistory.update(t,r);let o=new p.tn(t,{now:r,fadeDuration:i,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),s=o.crossFadingFactor();(1!==s||s!==this._crossFadingFactor)&&(a=!0,this._crossFadingFactor=s),this.style.update(o)}let o=this.style.projection?.transitionState>0!==r;this._camera.transform.setTransitionState(this.style.projection?.transitionState),this.style&&(this._sourcesDirty||o)&&(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.getElevationForLngLatZoom(this._camera.transform.center,this._camera.transform.tileZoom))):(this._camera.transform.setMinElevationForCurrentTile(0),this.getCenterClampedToGround()&&this._camera.transform.setElevation(0)),this._placementDirty=this.style?._updatePlacement(this._camera.transform,this.showCollisionBoxes,i,this._crossSourceCollisions,o),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:i,showPadding:this.showPadding,anisotropicFilterPitch:this.getAnisotropicFilterPitch()}),this.fire(new b("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,this.fire(new b("load"))),this.style&&(this.style.hasTransitions()||a)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();let s=this._sourcesDirty||this._styleDirty||this._placementDirty;return s||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new b("idle")),!this._loaded||this._fullyLoaded||s||(this._fullyLoaded=!0),this}redraw(){return this.style&&(this._frameRequest&&=(this._frameRequest.abort(),null),this._render(0)),this}remove(){for(let t of(this._hash&&this._hash.remove(),this._controls))t.onRemove(this);this._controls=[],this._frameRequest&&=(this._frameRequest.abort(),null),this._renderTaskQueue.clear(),this._diffStyleRequest?.abort(),this.painter.destroy(),this._handlers.destroy(),this.setStyle(null),"u">typeof window&&this._ownerWindow.removeEventListener("online",this._onWindowOnline,!1),n.removeThrottleControl(this._imageQueueHandle),this._resizeObserver?.disconnect();let t=this.painter.context.gl.getExtension("WEBGL_lose_context");t?.loseContext&&t.loseContext(),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"),this._removed=!0,this.fire(new b("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,f.frame(this._frameRequest,t=>{this._frameRequest=null;try{this._render(t)}catch(t){if(!(0,p.Rn)(t))throw t}},()=>{},this._ownerWindow))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(t){this._showTileBoundaries!==t&&(this._showTileBoundaries=t,this._update())}get showPadding(){return!!this._showPadding}set showPadding(t){this._showPadding!==t&&(this._showPadding=t,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(t){this._showCollisionBoxes!==t&&(this._showCollisionBoxes=t,t?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(t){this._showOverdrawInspector!==t&&(this._showOverdrawInspector=t,this._update())}get repaint(){return!!this._repaint}set repaint(t){this._repaint!==t&&(this._repaint=t,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(t){this._vertices=t,this._update()}get version(){return"6.4.1"}getCameraTargetElevation(){return this._camera.transform.elevation}getProjection(){return this.style.getProjection()}setProjection(t){return this._lazyInitEmptyStyle(),this.style.setProjection(t),this._update(!0)}};let a1={showCompass:!0,showZoom:!0,visualizePitch:!1,visualizeRoll:!0};var a2=class{constructor(t){this._updateZoomButtons=()=>{let t=this._map.getZoom(),i=t===this._map.getMaxZoom(),r=t===this._map.getMinZoom();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((0,p.tr)(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=(0,p.or)({},a1,t),this._container=y.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})),y.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})),y.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=y.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}onAdd(t){return this._map=t,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),this._map.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&this._map.on("pitch",this._rotateCompassArrow),this.options.visualizeRoll&&this._map.on("roll",this._rotateCompassArrow),this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new a3(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){this._container.remove(),this.options.showZoom&&this._map.off("zoom",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(t,i){let r=y.create("button",t,this._container);return r.type="button",r.addEventListener("click",i),r}},a3=class{constructor(t,i,r=!1){this.mousedown=t=>{this.startMove(t,y.mousePos(this.element,t)),window.addEventListener("mousemove",this.mousemove),window.addEventListener("mouseup",this.mouseup)},this.mousemove=t=>{this.move(t,y.mousePos(this.element,t))},this.mouseup=t=>{this._rotatePitchHandler.dragEnd(t),this.offTemp()},this.touchstart=t=>{1===t.targetTouches.length?(this._startPos=this._lastPos=y.touchPos(this.element,t.targetTouches)[0],this.startMove(t,this._startPos),window.addEventListener("touchmove",this.touchmove,{passive:!1}),window.addEventListener("touchend",this.touchend)):this.reset()},this.touchmove=t=>{1===t.targetTouches.length?(this._lastPos=y.touchPos(this.element,t.targetTouches)[0],this.move(t,this._lastPos)):this.reset()},this.touchend=t=>{0===t.targetTouches.length&&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=i;let a=new am;this._rotatePitchHandler=new au({clickTolerance:3,move:(t,a)=>{let o=i.getBoundingClientRect(),s=new p.Vi((o.bottom-o.top)/2,(o.right-o.left)/2);return{bearingDelta:(0,p.ur)(new p.Vi(t.x,a.y),a,s),pitchDelta:r?-((a.y-t.y)*.5):void 0}},moveStateManager:a,enable:!0,assignEvents:()=>{}}),this.map=t,i.addEventListener("mousedown",this.mousedown),i.addEventListener("touchstart",this.touchstart,{passive:!1}),i.addEventListener("touchcancel",this.reset)}startMove(t,i){this._rotatePitchHandler.dragStart(t,i),y.disableDrag()}move(t,i){let r=this.map,{bearingDelta:a,pitchDelta:o}=this._rotatePitchHandler.dragMove(t,i)||{};a&&r.setBearing(r.getBearing()+a),o&&r.setPitch(r.getPitch()+o)}off(){let t=this.element;t.removeEventListener("mousedown",this.mousedown),t.removeEventListener("touchstart",this.touchstart),window.removeEventListener("touchmove",this.touchmove),window.removeEventListener("touchend",this.touchend),t.removeEventListener("touchcancel",this.reset),this.offTemp()}offTemp(){y.enableDrag(),window.removeEventListener("mousemove",this.mousemove),window.removeEventListener("mouseup",this.mouseup),window.removeEventListener("touchmove",this.touchmove),window.removeEventListener("touchend",this.touchend)}};
803let a4={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%)"},a5={ArrowLeft:[-1,0],ArrowRight:[1,0],ArrowUp:[0,-1],ArrowDown:[0,1]};var a6=class extends p.Cn{},a8=class extends p.Cn{},a9=class extends p.wn{constructor(t){if(super(),this._onClick=t=>{this.fire(new a8("click",{originalEvent:t}))},this._onKeyPress=t=>{("Space"===t.code||"Enter"===t.code)&&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=a5[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 p.Vi(a.x+i[0]*r,a.y+i[1]*r))),this._keyboardDragActive||(this._keyboardDragActive=!0,this.fire(new a6("dragstart"))),this.fire(new a6("drag"))},this._onKeyUp=t=>{a5[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._update=t=>{if(!this._map)return;let i=this._map.loaded()&&!this._map.isMoving();t?.type!=="terrain"&&(t?.type!=="render"||i)||this._map.once("render",this._update),this._lngLat=function(t,i,r,a=!1){if(a||!r.getCoveringTilesDetailsProvider().allowWorldCopies())return t?.wrap();let o=new p.ct(t.lng,t.lat);if(t=new p.ct(t.lng,t.lat),i){let a=new p.ct(t.lng-360,t.lat),o=new p.ct(t.lng+360,t.lat),s=r.locationToScreenPoint(t).distSqr(i);r.locationToScreenPoint(a).distSqr(i)<s?t=a:r.locationToScreenPoint(o).distSqr(i)<s&&(t=o)}for(;Math.abs(t.lng-r.center.lng)>180;){let i=r.locationToScreenPoint(t);if(i.x>=0&&i.y>=0&&i.x<=r.width&&i.y<=r.height)break;t.lng>r.center.lng?t.lng-=360:t.lng+=360}return t.lng!==o.lng&&r.isPointOnMapSurface(r.locationToScreenPoint(t))?t:o}(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="";"viewport"===this._rotationAlignment||"auto"===this._rotationAlignment?r=`rotateZ(${this._rotation}deg)`:"map"===this._rotationAlignment&&(r=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let a="";"viewport"===this._pitchAlignment||"auto"===this._pitchAlignment?a="rotateX(0deg)":"map"===this._pitchAlignment&&(a=`rotateX(${this._map.getPitch()}deg)`),this._subpixelPositioning||t&&"moveend"!==t.type||(this._pos=this._pos.round()),this._element.style.transform=`${a4[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${a} ${r}`,f.frameAsync(new AbortController,this._map._ownerWindow).then(()=>{this._updateOpacity(t?.type==="moveend")}).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","pending"===this._state&&(this._state="active",this.fire(new a6("dragstart"))),this.fire(new a6("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),"active"===this._state&&this.fire(new a6("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=t?.anchor||"center",this._color=t?.color||"#3FB1CE",this._scale=t?.scale||1,this._draggable=t?.draggable||!1,this._clickTolerance=t?.clickTolerance||0,this._subpixelPositioning=t?.subpixelPositioning||!1,this._isDragging=!1,this._roleManaged=!1,this._tabIndexManaged=!1,this._keyboardDragActive=!1,this._state="inactive",this._rotation=t?.rotation||0,this._rotationAlignment=t?.rotationAlignment||"auto",this._pitchAlignment=t?.pitchAlignment&&"auto"!==t.pitchAlignment?t.pitchAlignment:this._rotationAlignment,this.setOpacity(t?.opacity,t?.opacityWhenCovered),t?.element)this._element=t.element,this._offset=p.Vi.convert(t?.offset||[0,0]);else{this._defaultMarker=!0,this._element=y.create("div");let i=y.createNS("http://www.w3.org/2000/svg","svg");i.setAttributeNS(null,"display","block"),i.setAttributeNS(null,"height","41px"),i.setAttributeNS(null,"width","27px"),i.setAttributeNS(null,"viewBox","0 0 27 41");let r=y.createNS("http://www.w3.org/2000/svg","g");
803r.setAttributeNS(null,"stroke","none"),r.setAttributeNS(null,"stroke-width","1"),r.setAttributeNS(null,"fill","none"),r.setAttributeNS(null,"fill-rule","evenodd");let a=y.createNS("http://www.w3.org/2000/svg","g");a.setAttributeNS(null,"fill-rule","nonzero");let o=y.createNS("http://www.w3.org/2000/svg","g");for(let t of(o.setAttributeNS(null,"transform","translate(3.0, 29.0)"),o.setAttributeNS(null,"fill","#000000"),[{rx:"10.5",ry:"5.25002273"},{rx:"10.5",ry:"5.25002273"},{rx:"9.5",ry:"4.77275007"},{rx:"8.5",ry:"4.29549936"},{rx:"7.5",ry:"3.81822308"},{rx:"6.5",ry:"3.34094679"},{rx:"5.5",ry:"2.86367051"},{rx:"4.5",ry:"2.38636864"}])){let i=y.createNS("http://www.w3.org/2000/svg","ellipse");i.setAttributeNS(null,"opacity","0.04"),i.setAttributeNS(null,"cx","10.5"),i.setAttributeNS(null,"cy","5.80029008"),i.setAttributeNS(null,"rx",t.rx),i.setAttributeNS(null,"ry",t.ry),o.appendChild(i)}let s=y.createNS("http://www.w3.org/2000/svg","g");s.setAttributeNS(null,"fill",this._color);let n=y.createNS("http://www.w3.org/2000/svg","path");n.setAttributeNS(null,"d","M27,13.5 C27,19.074644 20.250001,27.000002 14.75,34.500002 C14.016665,35.500004 12.983335,35.500004 12.25,34.500002 C6.7499993,27.000002 0,19.222562 0,13.5 C0,6.0441559 6.0441559,0 13.5,0 C20.955844,0 27,6.0441559 27,13.5 Z"),s.appendChild(n);let l=y.createNS("http://www.w3.org/2000/svg","g");l.setAttributeNS(null,"opacity","0.25"),l.setAttributeNS(null,"fill","#000000");let h=y.createNS("http://www.w3.org/2000/svg","path");h.setAttributeNS(null,"d","M13.5,0 C6.0441559,0 0,6.0441559 0,13.5 C0,19.222562 6.7499993,27 12.25,34.5 C13,35.522727 14.016664,35.500004 14.75,34.5 C20.250001,27 27,19.074644 27,13.5 C27,6.0441559 20.955844,0 13.5,0 Z M13.5,1 C20.415404,1 26,6.584596 26,13.5 C26,15.898657 24.495584,19.181431 22.220703,22.738281 C19.945823,26.295132 16.705119,30.142167 13.943359,33.908203 C13.743445,34.180814 13.612715,34.322738 13.5,34.441406 C13.387285,34.322738 13.256555,34.180814 13.056641,33.908203 C10.284481,30.127985 7.4148684,26.314159 5.015625,22.773438 C2.6163816,19.232715 1,15.953538 1,13.5 C1,6.584596 6.584596,1 13.5,1 Z"),l.appendChild(h);let c=y.createNS("http://www.w3.org/2000/svg","g");c.setAttributeNS(null,"transform","translate(6.0, 7.0)"),c.setAttributeNS(null,"fill","#FFFFFF");let u=y.createNS("http://www.w3.org/2000/svg","g");u.setAttributeNS(null,"transform","translate(8.0, 8.0)");let d=y.createNS("http://www.w3.org/2000/svg","circle");d.setAttributeNS(null,"fill","#000000"),d.setAttributeNS(null,"opacity","0.25"),d.setAttributeNS(null,"cx","5.5"),d.setAttributeNS(null,"cy","5.5"),d.setAttributeNS(null,"r","5.4999962");let _=y.createNS("http://www.w3.org/2000/svg","circle");_.setAttributeNS(null,"fill","#FFFFFF"),_.setAttributeNS(null,"cx","5.5"),_.setAttributeNS(null,"cy","5.5"),_.setAttributeNS(null,"r","5.4999962"),u.appendChild(d),u.appendChild(_),a.appendChild(o),a.appendChild(s),a.appendChild(l),a.appendChild(c),a.appendChild(u),i.appendChild(a),i.setAttributeNS(null,"height",`${41*this._scale}px`),i.setAttributeNS(null,"width",`${27*this._scale}px`),this._element.appendChild(i),this._offset=p.Vi.convert(t?.offset||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",t=>{t.preventDefault()}),this._element.addEventListener("mousedown",t=>{t.preventDefault()}),function(t,i,r){let a=t.classList;for(let t in a4)a.remove(`maplibregl-${r}-anchor-${t}`);a.add(`maplibregl-${r}-anchor-${i}`)}(this._element,this._anchor,"marker"),t?.className)for(let i of t.className.split(" "))this._element.classList.add(i);this._popup=null}addTo(t){return this.remove(),this._map=t,this._defaultMarker&&!this._element.hasAttribute("aria-label")&&this._element.setAttribute("aria-label",t._getUIString("Marker.Title")),this._updateAccessibilityRole(),t.getCanvasContainer().appendChild(this._element),t.on("move",this._update),t.on("moveend",this._update),t.on("terrain",this._update),t.on("projectiontransition",this._update),this._element.addEventListener("click",this._onClick),this.setDraggable(this._draggable),this._update(),this._map.on("click",this._onMapClick),this}remove(){return this._opacityTimeout&&(clearTimeout(this._opacityTimeout),delete this._opacityTimeout),this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._update),this._map.off("moveend",this._update),this._map.off("terrain",this._update),this._map.off("projectiontransition",this._update),this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler),this._map.off("mouseup",this._onUp),this._map.off("touchend",this._onUp),this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),delete this._map),this._element.removeEventListener("click",this._onClick),this._element.removeEventListener("keydown",this._onKeyDown),this._element.removeEventListener("keyup",this._onKeyUp),this._element.removeEventListener("blur",this._onBlur),this._element.removeEventListener("keypress",this._onKeyPress),this._keyboardDragActive=!1,this._element.remove(),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(t){return this._lngLat=p.ct.convert(t),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(t){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress)),t){if(!("offset"in t.options)){let i=13.5/Math.SQRT2;t.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[
8030,-38.1],"bottom-left":[i,-((24.6+i)*1)],"bottom-right":[-i,-((24.6+i)*1)],left:[13.5,-24.6],right:[-13.5,-24.6]}:this._offset}this._popup=t,this._element.addEventListener("keypress",this._onKeyPress)}return this._updateTabIndex(),this._updateAccessibilityRole(),this}setSubpixelPositioning(t){return this._subpixelPositioning=t,this}_endKeyboardDrag(){this._keyboardDragActive&&(this._keyboardDragActive=!1,this.fire(new a6("dragend")))}getPopup(){return this._popup}togglePopup(){let t=this._popup;return this._element.style.opacity===this._opacityWhenCovered||t&&(t.isOpen()?t.remove():(t.setLngLat(this._lngLat),t.addTo(this._map))),this}_updateOpacity(t=!1){let i=this._map?.terrain,r=this._map._camera.transform.isLocationOccluded(this._lngLat);if(!i||r){let t=r?this._opacityWhenCovered:this._opacity;this._element.style.opacity!==t&&(this._element.style.opacity=t,this._element.classList.toggle("maplibregl-marker-covered",r));return}if(t)this._opacityTimeout=null;else{if(this._opacityTimeout)return;this._opacityTimeout=setTimeout(()=>{this._opacityTimeout=null},100)}let a=this._map,o=a.terrain.depthAtPoint(this._pos),s=a.terrain.getElevationForLngLat(this._lngLat,a._camera.transform);
803if(a._camera.transform.lngLatToCameraDepth(this._lngLat,s)-o<.006){this._element.style.opacity=this._opacity,this._element.classList.remove("maplibregl-marker-covered");return}let n=-this._offset.y/a._camera.transform.pixelsPerMeter,l=Math.sin(a.getPitch()*Math.PI/180)*n,h=a.terrain.depthAtPoint(new p.Vi(this._pos.x,this._pos.y-this._offset.y)),c=a._camera.transform.lngLatToCameraDepth(this._lngLat,s+l)-h>.006;this._popup?.isOpen()&&c&&this._popup.remove(),this._element.style.opacity=c?this._opacityWhenCovered:this._opacity,this._element.classList.toggle("maplibregl-marker-covered",c)}getOffset(){return this._offset}setOffset(t){return this._offset=p.Vi.convert(t),this._update(),this}addClassName(t){this._element.classList.add(t)}removeClassName(t){this._element.classList.remove(t)}toggleClassName(t){return this._element.classList.toggle(t)}setDraggable(t){return this._draggable=!!t,this._element.classList.toggle("maplibregl-marker-draggable",this._draggable),this._map&&(t?(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&&=("0"===this._element.getAttribute("tabindex")&&this._element.removeAttribute("tabindex"),!1)}_updateAccessibilityRole(){if(!this._defaultMarker||this._element.hasAttribute("role")&&!this._roleManaged)return;let t=this._draggable||this._popup?"button":"img";this._element.setAttribute("role",t),this._roleManaged=!0}setRotation(t){return this._rotation=t||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(t){return this._rotationAlignment=t||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(t){return this._pitchAlignment=t&&"auto"!==t?t:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}setOpacity(t,i){return(void 0===this._opacity||void 0===t&&void 0===i)&&(this._opacity="1",this._opacityWhenCovered="0.2"),void 0!==t&&(this._opacity=String(t)),void 0!==i&&(this._opacityWhenCovered=String(i)),this._map&&this._updateOpacity(!0),this}};p.Cn,p.Cn,p.Cn,p.wn,p.Cn,p.wn;function a7(t){p.In.WORKER_URL=t}p.Cn,p.wn}}]);
804//# sourceMappingURL=02e20e0b-31828d30d1ac25a0.js.map

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.