<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./C22pZ_c0.js","./DSqslD0a.js","./entry.BoGgaI8P.css"])))=&gt;i.map(i=&gt;d[i]);
import{_ as fk,r as IE,F as pk,H as mk,I as _k,o as gk,c as yk}from"./DSqslD0a.js";function xk(c,o){for(var u=0;u&lt;o.length;u++){const p=o[u];if(typeof p!="string"&amp;&amp;!Array.isArray(p)){for(const g in p)if(g!=="default"&amp;&amp;!(g in c)){const v=Object.getOwnPropertyDescriptor(p,g);v&amp;&amp;Object.defineProperty(c,g,v.get?v:{enumerable:!0,get:()=&gt;p[g]})}}}return Object.freeze(Object.defineProperty(c,Symbol.toStringTag,{value:"Module"}))}function hf(c,o){if(!c)throw new Error(o||"loader assertion failed.")}const fy=typeof process!="object"||String(process)!=="[object process]"||!0,PE=typeof process&lt;"u"&amp;&amp;process.version&amp;&amp;/v([0-9]*)/.exec(process.version);PE&amp;&amp;parseFloat(PE[1]);const vk="3.4.14";function no(c,o){if(!c)throw new Error(o||"loaders.gl assertion failed.")}const sf=typeof process!="object"||String(process)!=="[object process]"||!0,bk=typeof window&lt;"u"&amp;&amp;typeof window.orientation&lt;"u",CE=typeof process&lt;"u"&amp;&amp;process.version&amp;&amp;/v([0-9]*)/.exec(process.version);CE&amp;&amp;parseFloat(CE[1]);function yu(c){"@babel/helpers - typeof";return yu=typeof Symbol=="function"&amp;&amp;typeof Symbol.iterator=="symbol"?function(o){return typeof o}:function(o){return o&amp;&amp;typeof Symbol=="function"&amp;&amp;o.constructor===Symbol&amp;&amp;o!==Symbol.prototype?"symbol":typeof o},yu(c)}function wk(c,o){if(yu(c)!="object"||!c)return c;var u=c[Symbol.toPrimitive];if(u!==void 0){var p=u.call(c,o||"default");if(yu(p)!="object")return p;throw new TypeError("@@toPrimitive must return a primitive value.")}return(o==="string"?String:Number)(c)}function Tk(c){var o=wk(c,"string");return yu(o)=="symbol"?o:String(o)}function et(c,o,u){return o=Tk(o),o in c?Object.defineProperty(c,o,{value:u,enumerable:!0,configurable:!0,writable:!0}):c[o]=u,c}class Ek{constructor(o,u){et(this,"name",void 0),et(this,"workerThread",void 0),et(this,"isRunning",!0),et(this,"result",void 0),et(this,"_resolve",()=&gt;{}),et(this,"_reject",()=&gt;{}),this.name=o,this.workerThread=u,this.result=new Promise((p,g)=&gt;{this._resolve=p,this._reject=g})}postMessage(o,u){this.workerThread.postMessage({source:"loaders.gl",type:o,payload:u})}done(o){no(this.isRunning),this.isRunning=!1,this._resolve(o)}error(o){no(this.isRunning),this.isRunning=!1,this._reject(o)}}let fg=class{terminate(){}};const pg=new Map;function Sk(c){no(c.source&amp;&amp;!c.url||!c.source&amp;&amp;c.url);let o=pg.get(c.source||c.url);return o||(c.url&amp;&amp;(o=Ak(c.url),pg.set(c.url,o)),c.source&amp;&amp;(o=TA(c.source),pg.set(c.source,o))),no(o),o}function Ak(c){if(!c.startsWith("http"))return c;const o=Mk(c);return TA(o)}function TA(c){const o=new Blob([c],{type:"application/javascript"});return URL.createObjectURL(o)}function Mk(c){return`try {
  importScripts('`.concat(c,`');
} catch (error) {
  console.error(error);
  throw error;
}`)}function EA(c){let o=arguments.length&gt;1&amp;&amp;arguments[1]!==void 0?arguments[1]:!0,u=arguments.length&gt;2?arguments[2]:void 0;const p=u||new Set;if(c){if(LE(c))p.add(c);else if(LE(c.buffer))p.add(c.buffer);else if(!ArrayBuffer.isView(c)){if(o&amp;&amp;typeof c=="object")for(const g in c)EA(c[g],o,p)}}return u===void 0?Array.from(p):[]}function LE(c){return c?c instanceof ArrayBuffer||typeof MessagePort&lt;"u"&amp;&amp;c instanceof MessagePort||typeof ImageBitmap&lt;"u"&amp;&amp;c instanceof ImageBitmap||typeof OffscreenCanvas&lt;"u"&amp;&amp;c instanceof OffscreenCanvas:!1}const mg=()=&gt;{};class Bg{static isSupported(){return typeof Worker&lt;"u"&amp;&amp;sf||typeof fg&lt;"u"&amp;&amp;!sf}constructor(o){et(this,"name",void 0),et(this,"source",void 0),et(this,"url",void 0),et(this,"terminated",!1),et(this,"worker",void 0),et(this,"onMessage",void 0),et(this,"onError",void 0),et(this,"_loadableURL","");const{name:u,source:p,url:g}=o;no(p||g),this.name=u,this.source=p,this.url=g,this.onMessage=mg,this.onError=v=&gt;console.log(v),this.worker=sf?this._createBrowserWorker():this._createNodeWorker()}destroy(){this.onMessage=mg,this.onError=mg,this.worker.terminate(),this.terminated=!0}get isRunning(){return!!this.onMessage}postMessage(o,u){u=u||EA(o),this.worker.postMessage(o,u)}_getErrorFromErrorEvent(o){let u="Failed to load ";return u+="worker ".concat(this.name," from ").concat(this.url,". "),o.message&amp;&amp;(u+="".concat(o.message," in ")),o.lineno&amp;&amp;(u+=":".concat(o.lineno,":").concat(o.colno)),new Error(u)}_createBrowserWorker(){this._loadableURL=Sk({source:this.source,url:this.url});const o=new Worker(this._loadableURL,{name:this.name});return o.onmessage=u=&gt;{u.data?this.onMessage(u.data):this.onError(new Error("No data received"))},o.onerror=u=&gt;{this.onError(this._getErrorFromErrorEvent(u)),this.terminated=!0},o.onmessageerror=u=&gt;console.error(u),o}_createNodeWorker(){let o;if(this.url){const p=this.url.includes(":/")||this.url.startsWith("/")?this.url:"./".concat(this.url);o=new fg(p,{eval:!1})}else if(this.source)o=new fg(this.source,{eval:!0});else throw new Error("no worker");return o.on("message",u=&gt;{this.onMessage(u)}),o.on("error",u=&gt;{this.onError(u)}),o.on("exit",u=&gt;{}),o}}class Ik{static isSupported(){return Bg.isSupported()}constructor(o){et(this,"name","unnamed"),et(this,"source",void 0),et(this,"url",void 0),et(this,"maxConcurrency",1),et(this,"maxMobileConcurrency",1),et(this,"onDebug",()=&gt;{}),et(this,"reuseWorkers",!0),et(this,"props",{}),et(this,"jobQueue",[]),et(this,"idleQueue",[]),et(this,"count",0),et(this,"isDestroyed",!1),this.source=o.source,this.url=o.url,this.setProps(o)}destroy(){this.idleQueue.forEach(o=&gt;o.destroy()),this.isDestroyed=!0}setProps(o){this.props={...this.props,...o},o.name!==void 0&amp;&amp;(this.name=o.name),o.maxConcurrency!==void 0&amp;&amp;(this.maxConcurrency=o.maxConcurrency),o.maxMobileConcurrency!==void 0&amp;&amp;(this.maxMobileConcurrency=o.maxMobileConcurrency),o.reuseWorkers!==void 0&amp;&amp;(this.reuseWorkers=o.reuseWorkers),o.onDebug!==void 0&amp;&amp;(this.onDebug=o.onDebug)}async startJob(o){let u=arguments.length&gt;1&amp;&amp;arguments[1]!==void 0?arguments[1]:(v,E,A)=&gt;v.done(A),p=arguments.length&gt;2&amp;&amp;arguments[2]!==void 0?arguments[2]:(v,E)=&gt;v.error(E);const g=new Promise(v=&gt;(this.jobQueue.push({name:o,onMessage:u,onError:p,onStart:v}),this));return this._startQueuedJob(),await g}async _startQueuedJob(){if(!this.jobQueue.length)return;const o=this._getAvailableWorker();if(!o)return;const u=this.jobQueue.shift();if(u){this.onDebug({message:"Starting job",name:u.name,workerThread:o,backlog:this.jobQueue.length});const p=new Ek(u.name,o);o.onMessage=g=&gt;u.onMessage(p,g.type,g.payload),o.onError=g=&gt;u.onError(p,g),u.onStart(p);try{await p.result}finally{this.returnWorkerToQueue(o)}}}returnWorkerToQueue(o){this.isDestroyed||!this.reuseWorkers||this.count&gt;this._getMaxConcurrency()?(o.destroy(),this.count--):this.idleQueue.push(o),this.isDestroyed||this._startQueuedJob()}_getAvailableWorker(){if(this.idleQueue.length&gt;0)return this.idleQueue.shift()||null;if(this.count&lt;this._getMaxConcurrency()){this.count++;const o="".concat(this.name.toLowerCase()," (#").concat(this.count," of ").concat(this.maxConcurrency,")");return new Bg({name:o,source:this.source,url:this.url})}return null}_getMaxConcurrency(){return bk?this.maxMobileConcurrency:this.maxConcurrency}}const Pk={maxConcurrency:3,maxMobileConcurrency:1,reuseWorkers:!0,onDebug:()=&gt;{}};class io{static isSupported(){return Bg.isSupported()}static getWorkerFarm(){let o=arguments.length&gt;0&amp;&amp;arguments[0]!==void 0?arguments[0]:{};return io._workerFarm=io._workerFarm||new io({}),io._workerFarm.setProps(o),io._workerFarm}constructor(o){et(this,"props",void 0),et(this,"workerPools",new Map),this.props={...Pk},this.setProps(o),this.workerPools=new Map}destroy(){for(const o of this.workerPools.values())o.destroy();this.workerPools=new Map}setProps(o){this.props={...this.props,...o};for(const u of this.workerPools.values())u.setProps(this._getWorkerPoolProps())}getWorkerPool(o){const{name:u,source:p,url:g}=o;let v=this.workerPools.get(u);return v||(v=new Ik({name:u,source:p,url:g}),v.setProps(this._getWorkerPoolProps()),this.workerPools.set(u,v)),v}_getWorkerPoolProps(){return{maxConcurrency:this.props.maxConcurrency,maxMobileConcurrency:this.props.maxMobileConcurrency,reuseWorkers:this.props.reuseWorkers,onDebug:this.props.onDebug}}}et(io,"_workerFarm",void 0);const Ck="latest";function Lk(c){let o=arguments.length&gt;1&amp;&amp;arguments[1]!==void 0?arguments[1]:{};const u=o[c.id]||{},p="".concat(c.id,"-worker.js");let g=u.workerUrl;if(!g&amp;&amp;c.id==="compression"&amp;&amp;(g=o.workerUrl),o._workerType==="test"&amp;&amp;(g="modules/".concat(c.module,"/dist/").concat(p)),!g){let v=c.version;v==="latest"&amp;&amp;(v=Ck);const E=v?"@".concat(v):"";g="https://unpkg.com/@loaders.gl/".concat(c.module).concat(E,"/dist/").concat(p)}return no(g),g}function Rk(c){let o=arguments.length&gt;1&amp;&amp;arguments[1]!==void 0?arguments[1]:vk;no(c,"no worker provided");const u=c.version;return!(!o||!u)}function Dk(c,o){return!io.isSupported()||!sf&amp;&amp;!(o!=null&amp;&amp;o._nodeWorkers)?!1:c.worker&amp;&amp;(o==null?void 0:o.worker)}async function Ok(c,o,u,p,g){const v=c.id,E=Lk(c,u),R=io.getWorkerFarm(u).getWorkerPool({name:v,url:E});u=JSON.parse(JSON.stringify(u)),p=JSON.parse(JSON.stringify(p||{}));const L=await R.startJob("process-on-worker",kk.bind(null,g));return L.postMessage("process",{input:o,options:u,context:p}),await(await L.result).result}async function kk(c,o,u,p){switch(u){case"done":o.done(p);break;case"error":o.error(new Error(p.error));break;case"process":const{id:g,input:v,options:E}=p;try{const A=await c(v,E);o.postMessage("done",{id:g,result:A})}catch(A){const R=A instanceof Error?A.message:"unknown error";o.postMessage("error",{id:g,error:R})}break;default:console.warn("parse-with-worker unknown message ".concat(u))}}function zk(c,o,u){if(u=u||c.byteLength,c.byteLength&lt;u||o.byteLength&lt;u)return!1;const p=new Uint8Array(c),g=new Uint8Array(o);for(let v=0;v&lt;p.length;++v)if(p[v]!==g[v])return!1;return!0}function Fk(){for(var c=arguments.length,o=new Array(c),u=0;u&lt;c;u++)o[u]=arguments[u];const p=o.map(A=&gt;A instanceof ArrayBuffer?new Uint8Array(A):A),g=p.reduce((A,R)=&gt;A+R.byteLength,0),v=new Uint8Array(g);let E=0;for(const A of p)v.set(A,E),E+=A.byteLength;return v.buffer}async function Bk(c){const o=[];for await(const u of c)o.push(u);return Fk(...o)}let Nk="";const RE={};function Uk(c){for(const o in RE)if(c.startsWith(o)){const u=RE[o];c=c.replace(o,u)}return!c.startsWith("http://")&amp;&amp;!c.startsWith("https://")&amp;&amp;(c="".concat(Nk).concat(c)),c}function Vk(c){return c&amp;&amp;typeof c=="object"&amp;&amp;c.isBuffer}function SA(c){if(Vk(c))return c;if(c instanceof ArrayBuffer)return c;if(ArrayBuffer.isView(c))return c.byteOffset===0&amp;&amp;c.byteLength===c.buffer.byteLength?c.buffer:c.buffer.slice(c.byteOffset,c.byteOffset+c.byteLength);if(typeof c=="string"){const o=c;return new TextEncoder().encode(o).buffer}if(c&amp;&amp;typeof c=="object"&amp;&amp;c._toArrayBuffer)return c._toArrayBuffer();throw new Error("toArrayBuffer")}function AA(c){const o=c?c.lastIndexOf("/"):-1;return o&gt;=0?c.substr(o+1):""}function jk(c){const o=c?c.lastIndexOf("/"):-1;return o&gt;=0?c.substr(0,o):""}const Gk=c=&gt;typeof c=="boolean",mu=c=&gt;typeof c=="function",Mu=c=&gt;c!==null&amp;&amp;typeof c=="object",DE=c=&gt;Mu(c)&amp;&amp;c.constructor==={}.constructor,Hk=c=&gt;c&amp;&amp;typeof c[Symbol.iterator]=="function",Wk=c=&gt;c&amp;&amp;typeof c[Symbol.asyncIterator]=="function",Ra=c=&gt;typeof Response&lt;"u"&amp;&amp;c instanceof Response||c&amp;&amp;c.arrayBuffer&amp;&amp;c.text&amp;&amp;c.json,Da=c=&gt;typeof Blob&lt;"u"&amp;&amp;c instanceof Blob,qk=c=&gt;c&amp;&amp;typeof c=="object"&amp;&amp;c.isBuffer,Zk=c=&gt;typeof ReadableStream&lt;"u"&amp;&amp;c instanceof ReadableStream||Mu(c)&amp;&amp;mu(c.tee)&amp;&amp;mu(c.cancel)&amp;&amp;mu(c.getReader),$k=c=&gt;Mu(c)&amp;&amp;mu(c.read)&amp;&amp;mu(c.pipe)&amp;&amp;Gk(c.readable),MA=c=&gt;Zk(c)||$k(c),Xk=/^data:([-\w.]+\/[-\w.+]+)(;|,)/,Yk=/^([-\w.]+\/[-\w.+]+)/;function Kk(c){const o=Yk.exec(c);return o?o[1]:c}function OE(c){const o=Xk.exec(c);return o?o[1]:""}const IA=/\?.*/;function Jk(c){const o=c.match(IA);return o&amp;&amp;o[0]}function py(c){return c.replace(IA,"")}function Cf(c){return Ra(c)?c.url:Da(c)?c.name||"":typeof c=="string"?c:""}function my(c){if(Ra(c)){const o=c,u=o.headers.get("content-type")||"",p=py(o.url);return Kk(u)||OE(p)}return Da(c)?c.type||"":typeof c=="string"?OE(c):""}function Qk(c){return Ra(c)?c.headers["content-length"]||-1:Da(c)?c.size:typeof c=="string"?c.length:c instanceof ArrayBuffer||ArrayBuffer.isView(c)?c.byteLength:-1}async function PA(c){if(Ra(c))return c;const o={},u=Qk(c);u&gt;=0&amp;&amp;(o["content-length"]=String(u));const p=Cf(c),g=my(c);g&amp;&amp;(o["content-type"]=g);const v=await iz(c);v&amp;&amp;(o["x-first-bytes"]=v),typeof c=="string"&amp;&amp;(c=new TextEncoder().encode(c));const E=new Response(c,{headers:o});return Object.defineProperty(E,"url",{value:p}),E}async function tz(c){if(!c.ok){const o=await ez(c);throw new Error(o)}}async function ez(c){let o="Failed to fetch resource ".concat(c.url," (").concat(c.status,"): ");try{const u=c.headers.get("Content-Type");let p=c.statusText;u.includes("application/json")&amp;&amp;(p+=" ".concat(await c.text())),o+=p,o=o.length&gt;60?"".concat(o.slice(0,60),"..."):o}catch{}return o}async function iz(c){if(typeof c=="string")return"data:,".concat(c.slice(0,5));if(c instanceof Blob){const u=c.slice(0,5);return await new Promise(p=&gt;{const g=new FileReader;g.onload=v=&gt;{var E;return p(v==null||(E=v.target)===null||E===void 0?void 0:E.result)},g.readAsDataURL(u)})}if(c instanceof ArrayBuffer){const u=c.slice(0,5),p=rz(u);return"data:base64,".concat(p)}return null}function rz(c){let o="";const u=new Uint8Array(c);for(let p=0;p&lt;u.byteLength;p++)o+=String.fromCharCode(u[p]);return btoa(o)}async function kE(c,o){if(typeof c=="string"){c=Uk(c);let u=o;return o!=null&amp;&amp;o.fetch&amp;&amp;typeof(o==null?void 0:o.fetch)!="function"&amp;&amp;(u=o.fetch),await fetch(c,u)}return await PA(c)}function nz(c){if(typeof window&lt;"u"&amp;&amp;typeof window.process=="object"&amp;&amp;window.process.type==="renderer"||typeof process&lt;"u"&amp;&amp;typeof process.versions=="object"&amp;&amp;process.versions.electron)return!0;const u=typeof navigator=="object"&amp;&amp;typeof navigator.userAgent=="string"&amp;&amp;navigator.userAgent;return!!(u&amp;&amp;u.indexOf("Electron")&gt;=0)}function Iu(){return!(typeof process=="object"&amp;&amp;String(process)==="[object process]"&amp;&amp;!1)||nz()}const Hd=globalThis.window||globalThis.self||globalThis.global,su=globalThis.process||{},CA=typeof __VERSION__&lt;"u"?__VERSION__:"untranspiled source";Iu();function sz(c){try{const o=window[c],u="__storage_test__";return o.setItem(u,u),o.removeItem(u),o}catch{return null}}let oz=class{constructor(o,u){let p=arguments.length&gt;2&amp;&amp;arguments[2]!==void 0?arguments[2]:"sessionStorage";this.storage=void 0,this.id=void 0,this.config=void 0,this.storage=sz(p),this.id=o,this.config=u,this._loadConfiguration()}getConfiguration(){return this.config}setConfiguration(o){if(Object.assign(this.config,o),this.storage){const u=JSON.stringify(this.config);this.storage.setItem(this.id,u)}}_loadConfiguration(){let o={};if(this.storage){const u=this.storage.getItem(this.id);o=u?JSON.parse(u):{}}return Object.assign(this.config,o),this}};function az(c){let o;return c&lt;10?o="".concat(c.toFixed(2),"ms"):c&lt;100?o="".concat(c.toFixed(1),"ms"):c&lt;1e3?o="".concat(c.toFixed(0),"ms"):o="".concat((c/1e3).toFixed(2),"s"),o}function lz(c){let o=arguments.length&gt;1&amp;&amp;arguments[1]!==void 0?arguments[1]:8;const u=Math.max(o-c.length,0);return"".concat(" ".repeat(u)).concat(c)}function _g(c,o,u){let p=arguments.length&gt;3&amp;&amp;arguments[3]!==void 0?arguments[3]:600;const g=c.src.replace(/\(/g,"%28").replace(/\)/g,"%29");c.width&gt;p&amp;&amp;(u=Math.min(u,p/c.width));const v=c.width*u,E=c.height*u,A=["font-size:1px;","padding:".concat(Math.floor(E/2),"px ").concat(Math.floor(v/2),"px;"),"line-height:".concat(E,"px;"),"background:url(".concat(g,");"),"background-size:".concat(v,"px ").concat(E,"px;"),"color:transparent;"].join("");return["".concat(o," %c+"),A]}let df;(function(c){c[c.BLACK=30]="BLACK",c[c.RED=31]="RED",c[c.GREEN=32]="GREEN",c[c.YELLOW=33]="YELLOW",c[c.BLUE=34]="BLUE",c[c.MAGENTA=35]="MAGENTA",c[c.CYAN=36]="CYAN",c[c.WHITE=37]="WHITE",c[c.BRIGHT_BLACK=90]="BRIGHT_BLACK",c[c.BRIGHT_RED=91]="BRIGHT_RED",c[c.BRIGHT_GREEN=92]="BRIGHT_GREEN",c[c.BRIGHT_YELLOW=93]="BRIGHT_YELLOW",c[c.BRIGHT_BLUE=94]="BRIGHT_BLUE",c[c.BRIGHT_MAGENTA=95]="BRIGHT_MAGENTA",c[c.BRIGHT_CYAN=96]="BRIGHT_CYAN",c[c.BRIGHT_WHITE=97]="BRIGHT_WHITE"})(df||(df={}));const cz=10;function zE(c){return typeof c!="string"?c:(c=c.toUpperCase(),df[c]||df.WHITE)}function uz(c,o,u){if(!Iu&amp;&amp;typeof c=="string"){if(o){const p=zE(o);c="\x1B[".concat(p,"m").concat(c,"\x1B[39m")}if(u){const p=zE(u);c="\x1B[".concat(p+cz,"m").concat(c,"\x1B[49m")}}return c}function hz(c){let o=arguments.length&gt;1&amp;&amp;arguments[1]!==void 0?arguments[1]:["constructor"];const u=Object.getPrototypeOf(c),p=Object.getOwnPropertyNames(u),g=c;for(const v of p){const E=g[v];typeof E=="function"&amp;&amp;(o.find(A=&gt;v===A)||(g[v]=E.bind(c)))}}function ff(c,o){if(!c)throw new Error(o||"Assertion failed")}function Il(){let c;if(Iu()&amp;&amp;Hd.performance){var o,u;c=Hd==null||(o=Hd.performance)===null||o===void 0||(u=o.now)===null||u===void 0?void 0:u.call(o)}else if("hrtime"in su){var p;const g=su==null||(p=su.hrtime)===null||p===void 0?void 0:p.call(su);c=g[0]*1e3+g[1]/1e6}else c=Date.now();return c}const Pl={debug:Iu()&amp;&amp;console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},dz={enabled:!0,level:0};function Dn(){}const FE={},BE={once:!0};let _y=class{constructor(){let{id:o}=arguments.length&gt;0&amp;&amp;arguments[0]!==void 0?arguments[0]:{id:""};this.id=void 0,this.VERSION=CA,this._startTs=Il(),this._deltaTs=Il(),this._storage=void 0,this.userData={},this.LOG_THROTTLE_TIMEOUT=0,this.id=o,this.userData={},this._storage=new oz("__probe-".concat(this.id,"__"),dz),this.timeStamp("".concat(this.id," started")),hz(this),Object.seal(this)}set level(o){this.setLevel(o)}get level(){return this.getLevel()}isEnabled(){return this._storage.config.enabled}getLevel(){return this._storage.config.level}getTotal(){return Number((Il()-this._startTs).toPrecision(10))}getDelta(){return Number((Il()-this._deltaTs).toPrecision(10))}set priority(o){this.level=o}get priority(){return this.level}getPriority(){return this.level}enable(){let o=arguments.length&gt;0&amp;&amp;arguments[0]!==void 0?arguments[0]:!0;return this._storage.setConfiguration({enabled:o}),this}setLevel(o){return this._storage.setConfiguration({level:o}),this}get(o){return this._storage.config[o]}set(o,u){this._storage.setConfiguration({[o]:u})}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}assert(o,u){ff(o,u)}warn(o){return this._getLogFunction(0,o,Pl.warn,arguments,BE)}error(o){return this._getLogFunction(0,o,Pl.error,arguments)}deprecated(o,u){return this.warn("`".concat(o,"` is deprecated and will be removed in a later version. Use `").concat(u,"` instead"))}removed(o,u){return this.error("`".concat(o,"` has been removed. Use `").concat(u,"` instead"))}probe(o,u){return this._getLogFunction(o,u,Pl.log,arguments,{time:!0,once:!0})}log(o,u){return this._getLogFunction(o,u,Pl.debug,arguments)}info(o,u){return this._getLogFunction(o,u,console.info,arguments)}once(o,u){return this._getLogFunction(o,u,Pl.debug||Pl.info,arguments,BE)}table(o,u,p){return u?this._getLogFunction(o,u,console.table||Dn,p&amp;&amp;[p],{tag:_z(u)}):Dn}image(o){let{logLevel:u,priority:p,image:g,message:v="",scale:E=1}=o;return this._shouldLog(u||p)?Iu()?mz({image:g,message:v,scale:E}):pz():Dn}time(o,u){return this._getLogFunction(o,u,console.time?console.time:console.info)}timeEnd(o,u){return this._getLogFunction(o,u,console.timeEnd?console.timeEnd:console.info)}timeStamp(o,u){return this._getLogFunction(o,u,console.timeStamp||Dn)}group(o,u){let p=arguments.length&gt;2&amp;&amp;arguments[2]!==void 0?arguments[2]:{collapsed:!1};const g=NE({logLevel:o,message:u,opts:p}),{collapsed:v}=p;return g.method=(v?console.groupCollapsed:console.group)||console.info,this._getLogFunction(g)}groupCollapsed(o,u){let p=arguments.length&gt;2&amp;&amp;arguments[2]!==void 0?arguments[2]:{};return this.group(o,u,Object.assign({},p,{collapsed:!0}))}groupEnd(o){return this._getLogFunction(o,"",console.groupEnd||Dn)}withGroup(o,u,p){this.group(o,u)();try{p()}finally{this.groupEnd(o)()}}trace(){console.trace&amp;&amp;console.trace()}_shouldLog(o){return this.isEnabled()&amp;&amp;this.getLevel()&gt;=LA(o)}_getLogFunction(o,u,p,g,v){if(this._shouldLog(o)){v=NE({logLevel:o,message:u,args:g,opts:v}),p=p||v.method,ff(p),v.total=this.getTotal(),v.delta=this.getDelta(),this._deltaTs=Il();const E=v.tag||v.message;if(v.once&amp;&amp;E)if(!FE[E])FE[E]=Il();else return Dn;return u=fz(this.id,v.message,v),p.bind(console,u,...v.args)}return Dn}};_y.VERSION=CA;function LA(c){if(!c)return 0;let o;switch(typeof c){case"number":o=c;break;case"object":o=c.logLevel||c.priority||0;break;default:return 0}return ff(Number.isFinite(o)&amp;&amp;o&gt;=0),o}function NE(c){const{logLevel:o,message:u}=c;c.logLevel=LA(o);const p=c.args?Array.from(c.args):[];for(;p.length&amp;&amp;p.shift()!==u;);switch(typeof o){case"string":case"function":u!==void 0&amp;&amp;p.unshift(u),c.message=o;break;case"object":Object.assign(c,o);break}typeof c.message=="function"&amp;&amp;(c.message=c.message());const g=typeof c.message;return ff(g==="string"||g==="object"),Object.assign(c,{args:p},c.opts)}function fz(c,o,u){if(typeof o=="string"){const p=u.time?lz(az(u.total)):"";o=u.time?"".concat(c,": ").concat(p,"  ").concat(o):"".concat(c,": ").concat(o),o=uz(o,u.color,u.background)}return o}function pz(c){return console.warn("removed"),Dn}function mz(c){let{image:o,message:u="",scale:p=1}=c;if(typeof o=="string"){const v=new Image;return v.onload=()=&gt;{const E=_g(v,u,p);console.log(...E)},v.src=o,Dn}const g=o.nodeName||"";if(g.toLowerCase()==="img")return console.log(..._g(o,u,p)),Dn;if(g.toLowerCase()==="canvas"){const v=new Image;return v.onload=()=&gt;console.log(..._g(v,u,p)),v.src=o.toDataURL(),Dn}return Dn}function _z(c){for(const o in c)for(const u in c[o])return u||"untitled";return"empty"}const UE=new _y({id:"loaders.gl"});class gz{log(){return()=&gt;{}}info(){return()=&gt;{}}warn(){return()=&gt;{}}error(){return()=&gt;{}}}class yz{constructor(){et(this,"console",void 0),this.console=console}log(){for(var o=arguments.length,u=new Array(o),p=0;p&lt;o;p++)u[p]=arguments[p];return this.console.log.bind(this.console,...u)}info(){for(var o=arguments.length,u=new Array(o),p=0;p&lt;o;p++)u[p]=arguments[p];return this.console.info.bind(this.console,...u)}warn(){for(var o=arguments.length,u=new Array(o),p=0;p&lt;o;p++)u[p]=arguments[p];return this.console.warn.bind(this.console,...u)}error(){for(var o=arguments.length,u=new Array(o),p=0;p&lt;o;p++)u[p]=arguments[p];return this.console.error.bind(this.console,...u)}}const RA={fetch:null,mimeType:void 0,nothrow:!1,log:new yz,CDN:"https://unpkg.com/@loaders.gl",worker:!0,maxConcurrency:3,maxMobileConcurrency:1,reuseWorkers:fy,_nodeWorkers:!1,_workerType:"",limit:0,_limitMB:0,batchSize:"auto",batchDebounceMs:0,metadata:!1,transforms:[]},xz={throws:"nothrow",dataType:"(no longer used)",uri:"baseUri",method:"fetch.method",headers:"fetch.headers",body:"fetch.body",mode:"fetch.mode",credentials:"fetch.credentials",cache:"fetch.cache",redirect:"fetch.redirect",referrer:"fetch.referrer",referrerPolicy:"fetch.referrerPolicy",integrity:"fetch.integrity",keepalive:"fetch.keepalive",signal:"fetch.signal"};function DA(){globalThis.loaders=globalThis.loaders||{};const{loaders:c}=globalThis;return c._state=c._state||{},c._state}const OA=()=&gt;{const c=DA();return c.globalOptions=c.globalOptions||{...RA},c.globalOptions};function vz(c,o,u,p){return u=u||[],u=Array.isArray(u)?u:[u],bz(c,u),Tz(o,c,p)}function bz(c,o){VE(c,null,RA,xz,o);for(const u of o){const p=c&amp;&amp;c[u.id]||{},g=u.options&amp;&amp;u.options[u.id]||{},v=u.deprecatedOptions&amp;&amp;u.deprecatedOptions[u.id]||{};VE(p,u.id,g,v,o)}}function VE(c,o,u,p,g){const v=o||"Top level",E=o?"".concat(o,"."):"";for(const A in c){const R=!o&amp;&amp;Mu(c[A]),L=A==="baseUri"&amp;&amp;!o,G=A==="workerUrl"&amp;&amp;o;if(!(A in u)&amp;&amp;!L&amp;&amp;!G){if(A in p)UE.warn("".concat(v," loader option '").concat(E).concat(A,"' no longer supported, use '").concat(p[A],"'"))();else if(!R){const j=wz(A,g);UE.warn("".concat(v," loader option '").concat(E).concat(A,"' not recognized. ").concat(j))()}}}}function wz(c,o){const u=c.toLowerCase();let p="";for(const g of o)for(const v in g.options){if(c===v)return"Did you mean '".concat(g.id,".").concat(v,"'?");const E=v.toLowerCase();(u.startsWith(E)||E.startsWith(u))&amp;&amp;(p=p||"Did you mean '".concat(g.id,".").concat(v,"'?"))}return p}function Tz(c,o,u){const g={...c.options||{}};return Ez(g,u),g.log===null&amp;&amp;(g.log=new gz),jE(g,OA()),jE(g,o),g}function jE(c,o){for(const u in o)if(u in o){const p=o[u];DE(p)&amp;&amp;DE(c[u])?c[u]={...c[u],...o[u]}:c[u]=o[u]}}function Ez(c,o){o&amp;&amp;!("baseUri"in c)&amp;&amp;(c.baseUri=o)}function gy(c){var o;return c?(Array.isArray(c)&amp;&amp;(c=c[0]),Array.isArray((o=c)===null||o===void 0?void 0:o.extensions)):!1}function yy(c){var o,u;hf(c,"null loader"),hf(gy(c),"invalid loader");let p;return Array.isArray(c)&amp;&amp;(p=c[1],c=c[0],c={...c,options:{...c.options,...p}}),((o=c)!==null&amp;&amp;o!==void 0&amp;&amp;o.parseTextSync||(u=c)!==null&amp;&amp;u!==void 0&amp;&amp;u.parseText)&amp;&amp;(c.text=!0),c.text||(c.binary=!0),c}const kA=()=&gt;{const c=DA();return c.loaderRegistry=c.loaderRegistry||[],c.loaderRegistry};function Sz(c){const o=kA();c=Array.isArray(c)?c:[c];for(const u of c){const p=yy(u);o.find(g=&gt;p===g)||o.unshift(p)}}function Az(){return kA()}const Mz=new _y({id:"loaders.gl"}),Iz=/\.([^.]+)$/;async function Pz(c){let o=arguments.length&gt;1&amp;&amp;arguments[1]!==void 0?arguments[1]:[],u=arguments.length&gt;2?arguments[2]:void 0,p=arguments.length&gt;3?arguments[3]:void 0;if(!zA(c))return null;let g=GE(c,o,{...u,nothrow:!0},p);if(g)return g;if(Da(c)&amp;&amp;(c=await c.slice(0,10).arrayBuffer(),g=GE(c,o,u,p)),!g&amp;&amp;!(u!=null&amp;&amp;u.nothrow))throw new Error(FA(c));return g}function GE(c){let o=arguments.length&gt;1&amp;&amp;arguments[1]!==void 0?arguments[1]:[],u=arguments.length&gt;2?arguments[2]:void 0,p=arguments.length&gt;3?arguments[3]:void 0;if(!zA(c))return null;if(o&amp;&amp;!Array.isArray(o))return yy(o);let g=[];o&amp;&amp;(g=g.concat(o)),u!=null&amp;&amp;u.ignoreRegisteredLoaders||g.push(...Az()),Lz(g);const v=Cz(c,g,u,p);if(!v&amp;&amp;!(u!=null&amp;&amp;u.nothrow))throw new Error(FA(c));return v}function Cz(c,o,u,p){const g=Cf(c),v=my(c),E=py(g)||(p==null?void 0:p.url);let A=null,R="";if(u!=null&amp;&amp;u.mimeType&amp;&amp;(A=gg(o,u==null?void 0:u.mimeType),R="match forced by supplied MIME type ".concat(u==null?void 0:u.mimeType)),A=A||Rz(o,E),R=R||(A?"matched url ".concat(E):""),A=A||gg(o,v),R=R||(A?"matched MIME type ".concat(v):""),A=A||Oz(o,c),R=R||(A?"matched initial data ".concat(BA(c)):""),A=A||gg(o,u==null?void 0:u.fallbackMimeType),R=R||(A?"matched fallback MIME type ".concat(v):""),R){var L;Mz.log(1,"selectLoader selected ".concat((L=A)===null||L===void 0?void 0:L.name,": ").concat(R,"."))}return A}function zA(c){return!(c instanceof Response&amp;&amp;c.status===204)}function FA(c){const o=Cf(c),u=my(c);let p="No valid loader found (";p+=o?"".concat(AA(o),", "):"no url provided, ",p+="MIME type: ".concat(u?'"'.concat(u,'"'):"not provided",", ");const g=c?BA(c):"";return p+=g?' first bytes: "'.concat(g,'"'):"first bytes: not available",p+=")",p}function Lz(c){for(const o of c)yy(o)}function Rz(c,o){const u=o&amp;&amp;Iz.exec(o),p=u&amp;&amp;u[1];return p?Dz(c,p):null}function Dz(c,o){o=o.toLowerCase();for(const u of c)for(const p of u.extensions)if(p.toLowerCase()===o)return u;return null}function gg(c,o){for(const u of c)if(u.mimeTypes&amp;&amp;u.mimeTypes.includes(o)||o==="application/x.".concat(u.id))return u;return null}function Oz(c,o){if(!o)return null;for(const u of c)if(typeof o=="string"){if(kz(o,u))return u}else if(ArrayBuffer.isView(o)){if(HE(o.buffer,o.byteOffset,u))return u}else if(o instanceof ArrayBuffer&amp;&amp;HE(o,0,u))return u;return null}function kz(c,o){return o.testText?o.testText(c):(Array.isArray(o.tests)?o.tests:[o.tests]).some(p=&gt;c.startsWith(p))}function HE(c,o,u){return(Array.isArray(u.tests)?u.tests:[u.tests]).some(g=&gt;zz(c,o,u,g))}function zz(c,o,u,p){if(p instanceof ArrayBuffer)return zk(p,c,p.byteLength);switch(typeof p){case"function":return p(c,u);case"string":const g=Ng(c,o,p.length);return p===g;default:return!1}}function BA(c){let o=arguments.length&gt;1&amp;&amp;arguments[1]!==void 0?arguments[1]:5;return typeof c=="string"?c.slice(0,o):ArrayBuffer.isView(c)?Ng(c.buffer,c.byteOffset,o):c instanceof ArrayBuffer?Ng(c,0,o):""}function Ng(c,o,u){if(c.byteLength&lt;o+u)return"";const p=new DataView(c);let g="";for(let v=0;v&lt;u;v++)g+=String.fromCharCode(p.getUint8(o+v));return g}const Fz=256*1024;function*Bz(c,o){const u=(o==null?void 0:o.chunkSize)||Fz;let p=0;const g=new TextEncoder;for(;p&lt;c.length;){const v=Math.min(c.length-p,u),E=c.slice(p,p+v);p+=v,yield g.encode(E)}}const Nz=256*1024;function Uz(c){let o=arguments.length&gt;1&amp;&amp;arguments[1]!==void 0?arguments[1]:{};return function*(){const{chunkSize:u=Nz}=o;let p=0;for(;p&lt;c.byteLength;){const g=Math.min(c.byteLength-p,u),v=new ArrayBuffer(g),E=new Uint8Array(c,p,g);new Uint8Array(v).set(E),p+=g,yield v}}()}const Vz=1024*1024;async function*jz(c,o){const u=(o==null?void 0:o.chunkSize)||Vz;let p=0;for(;p&lt;c.size;){const g=p+u,v=await c.slice(p,g).arrayBuffer();p=g,yield v}}function WE(c,o){return fy?Gz(c,o):Hz(c)}async function*Gz(c,o){const u=c.getReader();let p;try{for(;;){const g=p||u.read();o!=null&amp;&amp;o._streamReadAhead&amp;&amp;(p=u.read());const{done:v,value:E}=await g;if(v)return;yield SA(E)}}catch{u.releaseLock()}}async function*Hz(c,o){for await(const u of c)yield SA(u)}function Wz(c,o){if(typeof c=="string")return Bz(c,o);if(c instanceof ArrayBuffer)return Uz(c,o);if(Da(c))return jz(c,o);if(MA(c))return WE(c,o);if(Ra(c))return WE(c.body,o);throw new Error("makeIterator")}const NA="Cannot convert supplied data type";function qz(c,o,u){if(o.text&amp;&amp;typeof c=="string")return c;if(qk(c)&amp;&amp;(c=c.buffer),c instanceof ArrayBuffer){const p=c;return o.text&amp;&amp;!o.binary?new TextDecoder("utf8").decode(p):p}if(ArrayBuffer.isView(c)){if(o.text&amp;&amp;!o.binary)return new TextDecoder("utf8").decode(c);let p=c.buffer;const g=c.byteLength||c.length;return(c.byteOffset!==0||g!==p.byteLength)&amp;&amp;(p=p.slice(c.byteOffset,c.byteOffset+g)),p}throw new Error(NA)}async function Zz(c,o,u){const p=c instanceof ArrayBuffer||ArrayBuffer.isView(c);if(typeof c=="string"||p)return qz(c,o);if(Da(c)&amp;&amp;(c=await PA(c)),Ra(c)){const g=c;return await tz(g),o.binary?await g.arrayBuffer():await g.text()}if(MA(c)&amp;&amp;(c=Wz(c,u)),Hk(c)||Wk(c))return Bk(c);throw new Error(NA)}function UA(c,o){const u=OA(),p=c||u;return typeof p.fetch=="function"?p.fetch:Mu(p.fetch)?g=&gt;kE(g,p):o!=null&amp;&amp;o.fetch?o==null?void 0:o.fetch:kE}function $z(c,o,u){if(u)return u;const p={fetch:UA(o,c),...c};if(p.url){const g=py(p.url);p.baseUrl=g,p.queryString=Jk(p.url),p.filename=AA(g),p.baseUrl=jk(g)}return Array.isArray(p.loaders)||(p.loaders=null),p}function Xz(c,o){if(!o&amp;&amp;c&amp;&amp;!Array.isArray(c))return c;let u;if(c&amp;&amp;(u=Array.isArray(c)?c:[c]),o&amp;&amp;o.loaders){const p=Array.isArray(o.loaders)?o.loaders:[o.loaders];u=u?[...u,...p]:p}return u&amp;&amp;u.length?u:null}async function xy(c,o,u,p){no(!p||typeof p=="object"),o&amp;&amp;!Array.isArray(o)&amp;&amp;!gy(o)&amp;&amp;(p=void 0,u=o,o=void 0),c=await c,u=u||{};const g=Cf(c),E=Xz(o,p),A=await Pz(c,E,u);return A?(u=vz(u,A,E,g),p=$z({url:g,parse:xy,loaders:E},u,p||null),await Yz(A,c,u,p)):null}async function Yz(c,o,u,p){if(Rk(c),Ra(o)){const g=o,{ok:v,redirected:E,status:A,statusText:R,type:L,url:G}=g,j=Object.fromEntries(g.headers.entries());p.response={headers:j,ok:v,redirected:E,status:A,statusText:R,type:L,url:G}}if(o=await Zz(o,c,u),c.parseTextSync&amp;&amp;typeof o=="string")return u.dataType="text",c.parseTextSync(o,u,p,c);if(Dk(c,u))return await Ok(c,o,u,p,xy);if(c.parseText&amp;&amp;typeof o=="string")return await c.parseText(o,u,p,c);if(c.parse)return await c.parse(o,u,p,c);throw no(!c.parseSync),new Error("".concat(c.id," loader - no parser found and worker is disabled"))}async function Kz(c,o,u,p){!Array.isArray(o)&amp;&amp;!gy(o)&amp;&amp;(u=o,o=void 0);const g=UA(u);let v=c;return typeof c=="string"&amp;&amp;(v=await g(c)),Da(c)&amp;&amp;(v=await g(c)),await xy(v,o,u)}const Jz="3.4.14",{_parseImageNode:Qz}=globalThis,Ug=typeof Image&lt;"u",Vg=typeof ImageBitmap&lt;"u",tF=!!Qz,jg=fy?!0:tF;function eF(c){switch(c){case"auto":return Vg||Ug||jg;case"imagebitmap":return Vg;case"image":return Ug;case"data":return jg;default:throw new Error("@loaders.gl/images: image ".concat(c," not supported in this environment"))}}function iF(){if(Vg)return"imagebitmap";if(Ug)return"image";if(jg)return"data";throw new Error("Install '@loaders.gl/polyfills' to parse images under Node.js")}function rF(c){const o=sF(c);if(!o)throw new Error("Not an image");return o}function nF(c){switch(rF(c)){case"data":return c;case"image":case"imagebitmap":const o=document.createElement("canvas"),u=o.getContext("2d");if(!u)throw new Error("getImageData");return o.width=c.width,o.height=c.height,u.drawImage(c,0,0),u.getImageData(0,0,c.width,c.height);default:throw new Error("getImageData")}}function sF(c){return typeof ImageBitmap&lt;"u"&amp;&amp;c instanceof ImageBitmap?"imagebitmap":typeof Image&lt;"u"&amp;&amp;c instanceof Image?"image":c&amp;&amp;typeof c=="object"&amp;&amp;c.data&amp;&amp;c.width&amp;&amp;c.height?"data":null}const oF=/^data:image\/svg\+xml/,aF=/\.svg((\?|#).*)?$/;function vy(c){return c&amp;&amp;(oF.test(c)||aF.test(c))}function lF(c,o){if(vy(o)){let p=new TextDecoder().decode(c);try{typeof unescape=="function"&amp;&amp;typeof encodeURIComponent=="function"&amp;&amp;(p=unescape(encodeURIComponent(p)))}catch(v){throw new Error(v.message)}return"data:image/svg+xml;base64,".concat(btoa(p))}return VA(c,o)}function VA(c,o){if(vy(o))throw new Error("SVG cannot be parsed directly to imagebitmap");return new Blob([new Uint8Array(c)])}async function jA(c,o,u){const p=lF(c,u),g=self.URL||self.webkitURL,v=typeof p!="string"&amp;&amp;g.createObjectURL(p);try{return await cF(v||p,o)}finally{v&amp;&amp;g.revokeObjectURL(v)}}async function cF(c,o){const u=new Image;return u.src=c,o.image&amp;&amp;o.image.decode&amp;&amp;u.decode?(await u.decode(),u):await new Promise((p,g)=&gt;{try{u.onload=()=&gt;p(u),u.onerror=v=&gt;g(new Error("Could not load image ".concat(c,": ").concat(v)))}catch(v){g(v)}})}const uF={};let qE=!0;async function hF(c,o,u){let p;vy(u)?p=await jA(c,o,u):p=VA(c,u);const g=o&amp;&amp;o.imagebitmap;return await dF(p,g)}async function dF(c){let o=arguments.length&gt;1&amp;&amp;arguments[1]!==void 0?arguments[1]:null;if((fF(o)||!qE)&amp;&amp;(o=null),o)try{return await createImageBitmap(c,o)}catch(u){console.warn(u),qE=!1}return await createImageBitmap(c)}function fF(c){for(const o in c||uF)return!1;return!0}function pF(c){return!yF(c,"ftyp",4)||!(c[8]&amp;96)?null:mF(c)}function mF(c){switch(_F(c,8,12).replace("\0"," ").trim()){case"avif":case"avis":return{extension:"avif",mimeType:"image/avif"};default:return null}}function _F(c,o,u){return String.fromCharCode(...c.slice(o,u))}function gF(c){return[...c].map(o=&gt;o.charCodeAt(0))}function yF(c,o){let u=arguments.length&gt;2&amp;&amp;arguments[2]!==void 0?arguments[2]:0;const p=gF(o);for(let g=0;g&lt;p.length;++g)if(p[g]!==c[g+u])return!1;return!0}const Es=!1,_u=!0;function GA(c){const o=Pu(c);return vF(o)||TF(o)||bF(o)||wF(o)||xF(o)}function xF(c){const o=new Uint8Array(c instanceof DataView?c.buffer:c),u=pF(o);return u?{mimeType:u.mimeType,width:0,height:0}:null}function vF(c){const o=Pu(c);return o.byteLength&gt;=24&amp;&amp;o.getUint32(0,Es)===2303741511?{mimeType:"image/png",width:o.getUint32(16,Es),height:o.getUint32(20,Es)}:null}function bF(c){const o=Pu(c);return o.byteLength&gt;=10&amp;&amp;o.getUint32(0,Es)===1195984440?{mimeType:"image/gif",width:o.getUint16(6,_u),height:o.getUint16(8,_u)}:null}function wF(c){const o=Pu(c);return o.byteLength&gt;=14&amp;&amp;o.getUint16(0,Es)===16973&amp;&amp;o.getUint32(2,_u)===o.byteLength?{mimeType:"image/bmp",width:o.getUint32(18,_u),height:o.getUint32(22,_u)}:null}function TF(c){const o=Pu(c);if(!(o.byteLength&gt;=3&amp;&amp;o.getUint16(0,Es)===65496&amp;&amp;o.getUint8(2)===255))return null;const{tableMarkers:p,sofMarkers:g}=EF();let v=2;for(;v+9&lt;o.byteLength;){const E=o.getUint16(v,Es);if(g.has(E))return{mimeType:"image/jpeg",height:o.getUint16(v+5,Es),width:o.getUint16(v+7,Es)};if(!p.has(E))return null;v+=2,v+=o.getUint16(v,Es)}return null}function EF(){const c=new Set([65499,65476,65484,65501,65534]);for(let u=65504;u&lt;65520;++u)c.add(u);return{tableMarkers:c,sofMarkers:new Set([65472,65473,65474,65475,65477,65478,65479,65481,65482,65483,65485,65486,65487,65502])}}function Pu(c){if(c instanceof DataView)return c;if(ArrayBuffer.isView(c))return new DataView(c.buffer);if(c instanceof ArrayBuffer)return new DataView(c);throw new Error("toDataView")}async function SF(c,o){const{mimeType:u}=GA(c)||{},p=globalThis._parseImageNode;return hf(p),await p(c,u)}async function AF(c,o,u){o=o||{};const g=(o.image||{}).type||"auto",{url:v}=u||{},E=MF(g);let A;switch(E){case"imagebitmap":A=await hF(c,o,v);break;case"image":A=await jA(c,o,v);break;case"data":A=await SF(c);break;default:hf(!1)}return g==="data"&amp;&amp;(A=nF(A)),A}function MF(c){switch(c){case"auto":case"data":return iF();default:return eF(c),c}}const IF=["png","jpg","jpeg","gif","webp","bmp","ico","svg","avif"],PF=["image/png","image/jpeg","image/gif","image/webp","image/avif","image/bmp","image/vnd.microsoft.icon","image/svg+xml"],CF={image:{type:"auto",decode:!0}},LF={id:"image",module:"images",name:"Images",version:Jz,mimeTypes:PF,extensions:IF,parse:AF,tests:[c=&gt;!!GA(new DataView(c))],options:CF};function HA(c){if(typeof window&lt;"u"&amp;&amp;typeof window.process=="object"&amp;&amp;window.process.type==="renderer"||typeof process&lt;"u"&amp;&amp;typeof process.versions=="object"&amp;&amp;process.versions.electron)return!0;const u=typeof navigator=="object"&amp;&amp;typeof navigator.userAgent=="string"&amp;&amp;navigator.userAgent;return!!(u&amp;&amp;u.indexOf("Electron")&gt;=0)}function oo(){return!(typeof process=="object"&amp;&amp;String(process)==="[object process]"&amp;&amp;!1)||HA()}const of={self:typeof self&lt;"u"&amp;&amp;self,window:typeof window&lt;"u"&amp;&amp;window,global:typeof global&lt;"u"&amp;&amp;global,document:typeof document&lt;"u"&amp;&amp;document,process:typeof process=="object"&amp;&amp;process},Wd=of.window||of.self||of.global,ou=of.process||{},WA=typeof __VERSION__&lt;"u"?__VERSION__:"untranspiled source";oo();const yg=globalThis;function RF(c){if(!oo())return"Node";if(HA())return"Electron";const u=(typeof navigator&lt;"u"?navigator:{}).userAgent||"";if(u.indexOf("Edge")&gt;-1)return"Edge";const p=u.indexOf("MSIE ")!==-1,g=u.indexOf("Trident/")!==-1;return p||g?"IE":yg.chrome?"Chrome":yg.safari?"Safari":yg.mozInnerScreenX?"Firefox":"Unknown"}function DF(c){try{const o=window[c],u="__storage_test__";return o.setItem(u,u),o.removeItem(u),o}catch{return null}}class OF{constructor(o,u){let p=arguments.length&gt;2&amp;&amp;arguments[2]!==void 0?arguments[2]:"sessionStorage";et(this,"storage",void 0),et(this,"id",void 0),et(this,"config",void 0),this.storage=DF(p),this.id=o,this.config=u,this._loadConfiguration()}getConfiguration(){return this.config}setConfiguration(o){if(Object.assign(this.config,o),this.storage){const u=JSON.stringify(this.config);this.storage.setItem(this.id,u)}}_loadConfiguration(){let o={};if(this.storage){const u=this.storage.getItem(this.id);o=u?JSON.parse(u):{}}return Object.assign(this.config,o),this}}function kF(c){let o;return c&lt;10?o="".concat(c.toFixed(2),"ms"):c&lt;100?o="".concat(c.toFixed(1),"ms"):c&lt;1e3?o="".concat(c.toFixed(0),"ms"):o="".concat((c/1e3).toFixed(2),"s"),o}function zF(c){let o=arguments.length&gt;1&amp;&amp;arguments[1]!==void 0?arguments[1]:8;const u=Math.max(o-c.length,0);return"".concat(" ".repeat(u)).concat(c)}function xg(c,o,u){let p=arguments.length&gt;3&amp;&amp;arguments[3]!==void 0?arguments[3]:600;const g=c.src.replace(/\(/g,"%28").replace(/\)/g,"%29");c.width&gt;p&amp;&amp;(u=Math.min(u,p/c.width));const v=c.width*u,E=c.height*u,A=["font-size:1px;","padding:".concat(Math.floor(E/2),"px ").concat(Math.floor(v/2),"px;"),"line-height:".concat(E,"px;"),"background:url(".concat(g,");"),"background-size:".concat(v,"px ").concat(E,"px;"),"color:transparent;"].join("");return["".concat(o," %c+"),A]}let pf;(function(c){c[c.BLACK=30]="BLACK",c[c.RED=31]="RED",c[c.GREEN=32]="GREEN",c[c.YELLOW=33]="YELLOW",c[c.BLUE=34]="BLUE",c[c.MAGENTA=35]="MAGENTA",c[c.CYAN=36]="CYAN",c[c.WHITE=37]="WHITE",c[c.BRIGHT_BLACK=90]="BRIGHT_BLACK",c[c.BRIGHT_RED=91]="BRIGHT_RED",c[c.BRIGHT_GREEN=92]="BRIGHT_GREEN",c[c.BRIGHT_YELLOW=93]="BRIGHT_YELLOW",c[c.BRIGHT_BLUE=94]="BRIGHT_BLUE",c[c.BRIGHT_MAGENTA=95]="BRIGHT_MAGENTA",c[c.BRIGHT_CYAN=96]="BRIGHT_CYAN",c[c.BRIGHT_WHITE=97]="BRIGHT_WHITE"})(pf||(pf={}));function ZE(c){return typeof c=="string"?pf[c.toUpperCase()]||pf.WHITE:c}function FF(c,o,u){return!oo&amp;&amp;typeof c=="string"&amp;&amp;(o&amp;&amp;(o=ZE(o),c="\x1B[".concat(o,"m").concat(c,"\x1B[39m")),u&amp;&amp;(o=ZE(u),c="\x1B[".concat(u+10,"m").concat(c,"\x1B[49m"))),c}function BF(c){let o=arguments.length&gt;1&amp;&amp;arguments[1]!==void 0?arguments[1]:["constructor"];const u=Object.getPrototypeOf(c),p=Object.getOwnPropertyNames(u);for(const g of p)typeof c[g]=="function"&amp;&amp;(o.find(v=&gt;g===v)||(c[g]=c[g].bind(c)))}function mf(c,o){if(!c)throw new Error(o||"Assertion failed")}function Cl(){let c;if(oo&amp;&amp;"performance"in Wd){var o,u;c=Wd==null||(o=Wd.performance)===null||o===void 0||(u=o.now)===null||u===void 0?void 0:u.call(o)}else if("hrtime"in ou){var p;const g=ou==null||(p=ou.hrtime)===null||p===void 0?void 0:p.call(ou);c=g[0]*1e3+g[1]/1e6}else c=Date.now();return c}const Ll={debug:oo&amp;&amp;console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},NF={enabled:!0,level:0};function On(){}const $E={},XE={once:!0};class by{constructor(){let{id:o}=arguments.length&gt;0&amp;&amp;arguments[0]!==void 0?arguments[0]:{id:""};et(this,"id",void 0),et(this,"VERSION",WA),et(this,"_startTs",Cl()),et(this,"_deltaTs",Cl()),et(this,"_storage",void 0),et(this,"userData",{}),et(this,"LOG_THROTTLE_TIMEOUT",0),this.id=o,this.userData={},this._storage=new OF("__probe-".concat(this.id,"__"),NF),this.timeStamp("".concat(this.id," started")),BF(this),Object.seal(this)}set level(o){this.setLevel(o)}get level(){return this.getLevel()}isEnabled(){return this._storage.config.enabled}getLevel(){return this._storage.config.level}getTotal(){return Number((Cl()-this._startTs).toPrecision(10))}getDelta(){return Number((Cl()-this._deltaTs).toPrecision(10))}set priority(o){this.level=o}get priority(){return this.level}getPriority(){return this.level}enable(){let o=arguments.length&gt;0&amp;&amp;arguments[0]!==void 0?arguments[0]:!0;return this._storage.setConfiguration({enabled:o}),this}setLevel(o){return this._storage.setConfiguration({level:o}),this}get(o){return this._storage.config[o]}set(o,u){this._storage.setConfiguration({[o]:u})}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}assert(o,u){mf(o,u)}warn(o){return this._getLogFunction(0,o,Ll.warn,arguments,XE)}error(o){return this._getLogFunction(0,o,Ll.error,arguments)}deprecated(o,u){return this.warn("`".concat(o,"` is deprecated and will be removed in a later version. Use `").concat(u,"` instead"))}removed(o,u){return this.error("`".concat(o,"` has been removed. Use `").concat(u,"` instead"))}probe(o,u){return this._getLogFunction(o,u,Ll.log,arguments,{time:!0,once:!0})}log(o,u){return this._getLogFunction(o,u,Ll.debug,arguments)}info(o,u){return this._getLogFunction(o,u,console.info,arguments)}once(o,u){for(var p=arguments.length,g=new Array(p&gt;2?p-2:0),v=2;v&lt;p;v++)g[v-2]=arguments[v];return this._getLogFunction(o,u,Ll.debug||Ll.info,arguments,XE)}table(o,u,p){return u?this._getLogFunction(o,u,console.table||On,p&amp;&amp;[p],{tag:GF(u)}):On}image(o){let{logLevel:u,priority:p,image:g,message:v="",scale:E=1}=o;return this._shouldLog(u||p)?oo?jF({image:g,message:v,scale:E}):VF():On}time(o,u){return this._getLogFunction(o,u,console.time?console.time:console.info)}timeEnd(o,u){return this._getLogFunction(o,u,console.timeEnd?console.timeEnd:console.info)}timeStamp(o,u){return this._getLogFunction(o,u,console.timeStamp||On)}group(o,u){let p=arguments.length&gt;2&amp;&amp;arguments[2]!==void 0?arguments[2]:{collapsed:!1};const g=YE({logLevel:o,message:u,opts:p}),{collapsed:v}=p;return g.method=(v?console.groupCollapsed:console.group)||console.info,this._getLogFunction(g)}groupCollapsed(o,u){let p=arguments.length&gt;2&amp;&amp;arguments[2]!==void 0?arguments[2]:{};return this.group(o,u,Object.assign({},p,{collapsed:!0}))}groupEnd(o){return this._getLogFunction(o,"",console.groupEnd||On)}withGroup(o,u,p){this.group(o,u)();try{p()}finally{this.groupEnd(o)()}}trace(){console.trace&amp;&amp;console.trace()}_shouldLog(o){return this.isEnabled()&amp;&amp;this.getLevel()&gt;=qA(o)}_getLogFunction(o,u,p,g,v){if(this._shouldLog(o)){v=YE({logLevel:o,message:u,args:g,opts:v}),p=p||v.method,mf(p),v.total=this.getTotal(),v.delta=this.getDelta(),this._deltaTs=Cl();const E=v.tag||v.message;if(v.once)if(!$E[E])$E[E]=Cl();else return On;return u=UF(this.id,v.message,v),p.bind(console,u,...v.args)}return On}}et(by,"VERSION",WA);function qA(c){if(!c)return 0;let o;switch(typeof c){case"number":o=c;break;case"object":o=c.logLevel||c.priority||0;break;default:return 0}return mf(Number.isFinite(o)&amp;&amp;o&gt;=0),o}function YE(c){const{logLevel:o,message:u}=c;c.logLevel=qA(o);const p=c.args?Array.from(c.args):[];for(;p.length&amp;&amp;p.shift()!==u;);switch(typeof o){case"string":case"function":u!==void 0&amp;&amp;p.unshift(u),c.message=o;break;case"object":Object.assign(c,o);break}typeof c.message=="function"&amp;&amp;(c.message=c.message());const g=typeof c.message;return mf(g==="string"||g==="object"),Object.assign(c,{args:p},c.opts)}function UF(c,o,u){if(typeof o=="string"){const p=u.time?zF(kF(u.total)):"";o=u.time?"".concat(c,": ").concat(p,"  ").concat(o):"".concat(c,": ").concat(o),o=FF(o,u.color,u.background)}return o}function VF(c){return console.warn("removed"),On}function jF(c){let{image:o,message:u="",scale:p=1}=c;if(typeof o=="string"){const v=new Image;return v.onload=()=&gt;{const E=xg(v,u,p);console.log(...E)},v.src=o,On}const g=o.nodeName||"";if(g.toLowerCase()==="img")return console.log(...xg(o,u,p)),On;if(g.toLowerCase()==="canvas"){const v=new Image;return v.onload=()=&gt;console.log(...xg(v,u,p)),v.src=o.toDataURL(),On}return On}function GF(c){for(const o in c)for(const u in c[o])return u||"untitled";return"empty"}const Pr=new by({id:"deck"});let Gg={};function HF(c){Gg=c}function Hg(c,o,u,p){Pr.level&gt;0&amp;&amp;Gg[c]&amp;&amp;Gg[c].call(null,o,u,p)}function WF(c){const o=c[0],u=c[c.length-1];return o==="{"&amp;&amp;u==="}"||o==="["&amp;&amp;u==="]"}const qF={id:"JSON",name:"JSON",module:"",version:"",options:{},extensions:["json","geojson"],mimeTypes:["application/json","application/geo+json"],testText:WF,parseTextSync:JSON.parse};function ZF(){const c="8.9.34",o=globalThis.deck&amp;&amp;globalThis.deck.VERSION;if(o&amp;&amp;o!==c)throw new Error("deck.gl - multiple versions detected: ".concat(o," vs ").concat(c));return o||(Pr.log(1,"deck.gl ".concat(c))(),globalThis.deck={...globalThis.deck,VERSION:c,version:c,log:Pr,_registerLoggers:HF},Sz([qF,[LF,{imagebitmap:{premultiplyAlpha:"none"}}]])),c}const $F=ZF(),Tr={DEFAULT:-1,LNGLAT:1,METER_OFFSETS:2,LNGLAT_OFFSETS:3,CARTESIAN:0};Object.defineProperty(Tr,"IDENTITY",{get:()=&gt;(Pr.deprecated("COORDINATE_SYSTEM.IDENTITY","COORDINATE_SYSTEM.CARTESIAN")(),0)});const Ss={WEB_MERCATOR:1,GLOBE:2,WEB_MERCATOR_AUTO_OFFSET:4,IDENTITY:0},KE={common:0,meters:1,pixels:2},JE={click:{handler:"onClick"},panstart:{handler:"onDragStart"},panmove:{handler:"onDrag"},panend:{handler:"onDragEnd"}},Ye=new by({id:"luma.gl"});function Ur(c,o){if(!c)throw new Error(o||"luma.gl: assertion failed.")}const XF="Invalid WebGLRenderingContext",YF="Requires WebGL2";function wy(c){return typeof WebGLRenderingContext&lt;"u"&amp;&amp;c instanceof WebGLRenderingContext||typeof WebGL2RenderingContext&lt;"u"&amp;&amp;c instanceof WebGL2RenderingContext?!0:!!(c&amp;&amp;Number.isFinite(c._version))}function Li(c){return typeof WebGL2RenderingContext&lt;"u"&amp;&amp;c instanceof WebGL2RenderingContext?!0:!!(c&amp;&amp;c._version===2)}function KF(c){return Li(c)?c:null}function Lf(c){return Ur(wy(c),XF),c}function Vr(c){return Ur(Li(c),YF),c}const du={};function JF(c){globalThis.console&amp;&amp;globalThis.console.error&amp;&amp;globalThis.console.error(c)}function QF(c){globalThis.console&amp;&amp;globalThis.console.log&amp;&amp;globalThis.console.log(c)}function tB(c,o){du[c]=!0,JF(o)}function eB(c){const o=c.getError;c.getError=function(){let p;do p=o.apply(c),p!==0&amp;&amp;(du[p]=!0);while(p!==0);for(p in du)if(du[p])return delete du[p],parseInt(p,10);return 0}}const Cu=function c(o){const u=o.gl;this.ext=o,this.isAlive=!0,this.hasBeenBound=!1,this.elementArrayBuffer=null,this.attribs=new Array(o.maxVertexAttribs);for(let p=0;p&lt;this.attribs.length;p++){const g=new c.VertexAttrib(u);this.attribs[p]=g}this.maxAttrib=0};Cu.VertexAttrib=function(o){this.enabled=!1,this.buffer=null,this.size=4,this.type=5126,this.normalized=!1,this.stride=16,this.offset=0,this.cached="",this.recache()};Cu.VertexAttrib.prototype.recache=function(){this.cached=[this.size,this.type,this.normalized,this.stride,this.offset].join(":")};const Oa=function(o){const u=this;this.gl=o,eB(o);const p=this.original={getParameter:o.getParameter,enableVertexAttribArray:o.enableVertexAttribArray,disableVertexAttribArray:o.disableVertexAttribArray,bindBuffer:o.bindBuffer,getVertexAttrib:o.getVertexAttrib,vertexAttribPointer:o.vertexAttribPointer};o.getParameter=function(v){return v===u.VERTEX_ARRAY_BINDING_OES?u.currentVertexArrayObject===u.defaultVertexArrayObject?null:u.currentVertexArrayObject:p.getParameter.apply(this,arguments)},o.enableVertexAttribArray=function(v){const E=u.currentVertexArrayObject;E.maxAttrib=Math.max(E.maxAttrib,v);const A=E.attribs[v];return A.enabled=!0,p.enableVertexAttribArray.apply(this,arguments)},o.disableVertexAttribArray=function(v){const E=u.currentVertexArrayObject;E.maxAttrib=Math.max(E.maxAttrib,v);const A=E.attribs[v];return A.enabled=!1,p.disableVertexAttribArray.apply(this,arguments)},o.bindBuffer=function(v,E){switch(v){case 34962:u.currentArrayBuffer=E;break;case 34963:u.currentVertexArrayObject.elementArrayBuffer=E;break}return p.bindBuffer.apply(this,arguments)},o.getVertexAttrib=function(v,E){const R=u.currentVertexArrayObject.attribs[v];switch(E){case 34975:return R.buffer;case 34338:return R.enabled;case 34339:return R.size;case 34340:return R.stride;case 34341:return R.type;case 34922:return R.normalized;default:return p.getVertexAttrib.apply(this,arguments)}},o.vertexAttribPointer=function(v,E,A,R,L,G){const j=u.currentVertexArrayObject;j.maxAttrib=Math.max(j.maxAttrib,v);const H=j.attribs[v];return H.buffer=u.currentArrayBuffer,H.size=E,H.type=A,H.normalized=R,H.stride=L,H.offset=G,H.recache(),p.vertexAttribPointer.apply(this,arguments)},o.instrumentExtension&amp;&amp;o.instrumentExtension(this,"OES_vertex_array_object"),o.canvas&amp;&amp;o.canvas.addEventListener("webglcontextrestored",()=&gt;{QF("OESVertexArrayObject emulation library context restored"),u.reset_()},!0),this.reset_()};Oa.prototype.VERTEX_ARRAY_BINDING_OES=34229;Oa.prototype.reset_=function(){if(this.vertexArrayObjects!==void 0)for(let p=0;p&lt;this.vertexArrayObjects.length;++p)this.vertexArrayObjects.isAlive=!1;const u=this.gl;this.maxVertexAttribs=u.getParameter(34921),this.defaultVertexArrayObject=new Cu(this),this.currentVertexArrayObject=null,this.currentArrayBuffer=null,this.vertexArrayObjects=[this.defaultVertexArrayObject],this.bindVertexArrayOES(null)};Oa.prototype.createVertexArrayOES=function(){const o=new Cu(this);return this.vertexArrayObjects.push(o),o};Oa.prototype.deleteVertexArrayOES=function(o){o.isAlive=!1,this.vertexArrayObjects.splice(this.vertexArrayObjects.indexOf(o),1),this.currentVertexArrayObject===o&amp;&amp;this.bindVertexArrayOES(null)};Oa.prototype.isVertexArrayOES=function(o){return!!(o&amp;&amp;o instanceof Cu&amp;&amp;o.hasBeenBound&amp;&amp;o.ext===this)};Oa.prototype.bindVertexArrayOES=function(o){const u=this.gl;if(o&amp;&amp;!o.isAlive){tB(1282,"bindVertexArrayOES: attempt to bind deleted arrayObject");return}const p=this.original,g=this.currentVertexArrayObject;this.currentVertexArrayObject=o||this.defaultVertexArrayObject,this.currentVertexArrayObject.hasBeenBound=!0;const v=this.currentVertexArrayObject;if(g===v)return;(!g||v.elementArrayBuffer!==g.elementArrayBuffer)&amp;&amp;p.bindBuffer.call(u,34963,v.elementArrayBuffer);let E=this.currentArrayBuffer;const A=Math.max(g?g.maxAttrib:0,v.maxAttrib);for(let R=0;R&lt;=A;R++){const L=v.attribs[R],G=g?g.attribs[R]:null;if((!g||L.enabled!==G.enabled)&amp;&amp;(L.enabled?p.enableVertexAttribArray.call(u,R):p.disableVertexAttribArray.call(u,R)),L.enabled){let j=!1;(!g||L.buffer!==G.buffer)&amp;&amp;(E!==L.buffer&amp;&amp;(p.bindBuffer.call(u,34962,L.buffer),E=L.buffer),j=!0),(j||L.cached!==G.cached)&amp;&amp;p.vertexAttribPointer.call(u,R,L.size,L.type,L.normalized,L.stride,L.offset)}}this.currentArrayBuffer!==E&amp;&amp;p.bindBuffer.call(u,34962,this.currentArrayBuffer)};function iB(c){if(typeof c.createVertexArray=="function")return;const o=c.getSupportedExtensions;c.getSupportedExtensions=function(){const g=o.call(this)||[];return g.indexOf("OES_vertex_array_object")&lt;0&amp;&amp;g.push("OES_vertex_array_object"),g};const u=c.getExtension;c.getExtension=function(g){const v=u.call(this,g);return v||(g!=="OES_vertex_array_object"?null:(c.__OESVertexArrayObject||(this.__OESVertexArrayObject=new Oa(this)),this.__OESVertexArrayObject))}}const QE="OES_element_index",tS="WEBGL_draw_buffers",rB="EXT_disjoint_timer_query",nB="EXT_disjoint_timer_query_webgl2",sB="EXT_texture_filter_anisotropic",eS="WEBGL_debug_renderer_info",oB=35723,aB=4352,lB=36795,cB=34047,uB=37445,hB=37446,Vi=c=&gt;Li(c)?void 0:0,dB={3074:c=&gt;Li(c)?void 0:36064,[oB]:c=&gt;Li(c)?void 0:aB,35977:Vi,32937:Vi,[lB]:(c,o)=&gt;{const u=Li(c)?c.getExtension(nB):c.getExtension(rB);return u&amp;&amp;u.GPU_DISJOINT_EXT?o(u.GPU_DISJOINT_EXT):0},[uB]:(c,o)=&gt;{const u=c.getExtension(eS);return o(u&amp;&amp;u.UNMASKED_VENDOR_WEBGL||7936)},[hB]:(c,o)=&gt;{const u=c.getExtension(eS);return o(u&amp;&amp;u.UNMASKED_RENDERER_WEBGL||7937)},[cB]:(c,o)=&gt;{const u=c.luma.extensions[sB];return u?o(u.MAX_TEXTURE_MAX_ANISOTROPY_EXT):1},32883:Vi,35071:Vi,37447:Vi,36063:(c,o)=&gt;{if(!Li(c)){const u=c.getExtension(tS);return u?o(u.MAX_COLOR_ATTACHMENTS_WEBGL):0}},35379:Vi,35374:Vi,35377:Vi,34852:c=&gt;{if(!Li(c)){const o=c.getExtension(tS);return o?o.MAX_DRAW_BUFFERS_WEBGL:0}},36203:c=&gt;c.getExtension(QE)?2147483647:65535,33001:c=&gt;c.getExtension(QE)?16777216:65535,33e3:c=&gt;16777216,37157:Vi,35373:Vi,35657:Vi,36183:Vi,37137:Vi,34045:Vi,35978:Vi,35979:Vi,35968:Vi,35376:Vi,35375:Vi,35659:Vi,37154:Vi,35371:Vi,35658:Vi,35076:Vi,35077:Vi,35380:Vi};function fB(c,o,u){const p=dB[u],g=typeof p=="function"?p(c,o,u):p;return g!==void 0?g:o(u)}const pB="OES_vertex_array_object",ZA="ANGLE_instanced_arrays",mB="WEBGL_draw_buffers",_B="EXT_disjoint_timer_query",gB="EXT_texture_filter_anisotropic",yB="VertexArray requires WebGL2 or OES_vertex_array_object extension";function xB(c,o){return{webgl2:Li(c),ext:c.getExtension(o)}}const $A={[pB]:{meta:{suffix:"OES"},createVertexArray:()=&gt;{Ur(!1,yB)},deleteVertexArray:()=&gt;{},bindVertexArray:()=&gt;{},isVertexArray:()=&gt;!1},[ZA]:{meta:{suffix:"ANGLE"},vertexAttribDivisor(c,o){Ur(o===0,"WebGL instanced rendering not supported")},drawElementsInstanced:()=&gt;{},drawArraysInstanced:()=&gt;{}},[mB]:{meta:{suffix:"WEBGL"},drawBuffers:()=&gt;{Ur(!1)}},[_B]:{meta:{suffix:"EXT"},createQuery:()=&gt;{Ur(!1)},deleteQuery:()=&gt;{Ur(!1)},beginQuery:()=&gt;{Ur(!1)},endQuery:()=&gt;{},getQuery(c,o){return this.getQueryObject(c,o)},getQueryParameter(c,o){return this.getQueryObject(c,o)},getQueryObject:()=&gt;{}}},vg={readBuffer:(c,o,u)=&gt;{Li(c)&amp;&amp;o(u)},getVertexAttrib:(c,o,u,p)=&gt;{const{webgl2:g,ext:v}=xB(c,ZA);let E;switch(p){case 35069:E=g?void 0:!1;break;case 35070:E=!g&amp;&amp;!v?0:void 0;break}return E!==void 0?E:o(u,p)},getProgramParameter:(c,o,u,p)=&gt;{if(!Li(c))switch(p){case 35967:return 35981;case 35971:return 0;case 35382:return 0}return o(u,p)},getInternalformatParameter:(c,o,u,p,g)=&gt;{if(!Li(c))switch(g){case 32937:return new Int32Array([0])}return c.getInternalformatParameter(u,p,g)},getTexParameter(c,o,u,p){switch(p){case 34046:const{extensions:g}=c.luma,v=g[gB];p=v&amp;&amp;v.TEXTURE_MAX_ANISOTROPY_EXT||34046;break}return o(u,p)},getParameter:fB,hint(c,o,u,p){return o(u,p)}};function vB(c){c.luma=c.luma||{};const{luma:o}=c;return o.polyfilled||(iB(c),bB(c),TB(c,$A),wB(c,{target:o,target2:c}),o.polyfilled=!0),c}globalThis.polyfillContext=vB;function bB(c){c.luma.extensions={};const o=c.getSupportedExtensions()||[];for(const u of o)c.luma[u]=c.getExtension(u)}function wB(c,o){let{target:u,target2:p}=o;Object.keys(vg).forEach(g=&gt;{if(typeof vg[g]=="function"){const v=c[g]?c[g].bind(c):()=&gt;{},E=vg[g].bind(null,c,v);u[g]=E,p[g]=E}})}function TB(c,o){for(const u of Object.getOwnPropertyNames(o))u!=="overrides"&amp;&amp;EB(c,{extension:u,target:c.luma,target2:c})}function EB(c,o){let{extension:u,target:p,target2:g}=o;const v=$A[u];Ur(v);const{meta:E={}}=v,{suffix:A=""}=E,R=c.getExtension(u);for(const L of Object.keys(v)){const G="".concat(L).concat(A);let j=null;L==="meta"||typeof c[L]=="function"||(R&amp;&amp;typeof R[G]=="function"?j=function(){return R[G](...arguments)}:typeof v[L]=="function"&amp;&amp;(j=v[L].bind(p))),j&amp;&amp;(p[L]=j,g[L]=j)}}const Ty={3042:!1,32773:new Float32Array([0,0,0,0]),32777:32774,34877:32774,32969:1,32968:0,32971:1,32970:0,3106:new Float32Array([0,0,0,0]),3107:[!0,!0,!0,!0],2884:!1,2885:1029,2929:!1,2931:1,2932:513,2928:new Float32Array([0,1]),2930:!0,3024:!0,36006:null,2886:2305,33170:4352,2849:1,32823:!1,32824:0,10752:0,32938:1,32939:!1,3089:!1,3088:new Int32Array([0,0,1024,1024]),2960:!1,2961:0,2968:4294967295,36005:4294967295,2962:519,2967:0,2963:4294967295,34816:519,36003:0,36004:4294967295,2964:7680,2965:7680,2966:7680,34817:7680,34818:7680,34819:7680,2978:[0,0,1024,1024],3333:4,3317:4,37440:!1,37441:!1,37443:37444,35723:4352,36010:null,35977:!1,3330:0,3332:0,3331:0,3314:0,32878:0,3316:0,3315:0,32877:0},Uo=(c,o,u)=&gt;o?c.enable(u):c.disable(u),iS=(c,o,u)=&gt;c.hint(u,o),_n=(c,o,u)=&gt;c.pixelStorei(u,o),SB=(c,o)=&gt;{const u=Li(c)?36009:36160;return c.bindFramebuffer(u,o)},AB=(c,o)=&gt;c.bindFramebuffer(36008,o);function au(c){return Array.isArray(c)||ArrayBuffer.isView(c)}const MB={3042:Uo,32773:(c,o)=&gt;c.blendColor(...o),32777:"blendEquation",34877:"blendEquation",32969:"blendFunc",32968:"blendFunc",32971:"blendFunc",32970:"blendFunc",3106:(c,o)=&gt;c.clearColor(...o),3107:(c,o)=&gt;c.colorMask(...o),2884:Uo,2885:(c,o)=&gt;c.cullFace(o),2929:Uo,2931:(c,o)=&gt;c.clearDepth(o),2932:(c,o)=&gt;c.depthFunc(o),2928:(c,o)=&gt;c.depthRange(...o),2930:(c,o)=&gt;c.depthMask(o),3024:Uo,35723:iS,36006:SB,2886:(c,o)=&gt;c.frontFace(o),33170:iS,2849:(c,o)=&gt;c.lineWidth(o),32823:Uo,32824:"polygonOffset",10752:"polygonOffset",35977:Uo,32938:"sampleCoverage",32939:"sampleCoverage",3089:Uo,3088:(c,o)=&gt;c.scissor(...o),2960:Uo,2961:(c,o)=&gt;c.clearStencil(o),2968:(c,o)=&gt;c.stencilMaskSeparate(1028,o),36005:(c,o)=&gt;c.stencilMaskSeparate(1029,o),2962:"stencilFuncFront",2967:"stencilFuncFront",2963:"stencilFuncFront",34816:"stencilFuncBack",36003:"stencilFuncBack",36004:"stencilFuncBack",2964:"stencilOpFront",2965:"stencilOpFront",2966:"stencilOpFront",34817:"stencilOpBack",34818:"stencilOpBack",34819:"stencilOpBack",2978:(c,o)=&gt;c.viewport(...o),3333:_n,3317:_n,37440:_n,37441:_n,37443:_n,3330:_n,3332:_n,3331:_n,36010:AB,3314:_n,32878:_n,3316:_n,3315:_n,32877:_n,framebuffer:(c,o)=&gt;{const u=o&amp;&amp;"handle"in o?o.handle:o;return c.bindFramebuffer(36160,u)},blend:(c,o)=&gt;o?c.enable(3042):c.disable(3042),blendColor:(c,o)=&gt;c.blendColor(...o),blendEquation:(c,o)=&gt;{o=au(o)?o:[o,o],c.blendEquationSeparate(...o)},blendFunc:(c,o)=&gt;{o=au(o)&amp;&amp;o.length===2?[...o,...o]:o,c.blendFuncSeparate(...o)},clearColor:(c,o)=&gt;c.clearColor(...o),clearDepth:(c,o)=&gt;c.clearDepth(o),clearStencil:(c,o)=&gt;c.clearStencil(o),colorMask:(c,o)=&gt;c.colorMask(...o),cull:(c,o)=&gt;o?c.enable(2884):c.disable(2884),cullFace:(c,o)=&gt;c.cullFace(o),depthTest:(c,o)=&gt;o?c.enable(2929):c.disable(2929),depthFunc:(c,o)=&gt;c.depthFunc(o),depthMask:(c,o)=&gt;c.depthMask(o),depthRange:(c,o)=&gt;c.depthRange(...o),dither:(c,o)=&gt;o?c.enable(3024):c.disable(3024),derivativeHint:(c,o)=&gt;{c.hint(35723,o)},frontFace:(c,o)=&gt;c.frontFace(o),mipmapHint:(c,o)=&gt;c.hint(33170,o),lineWidth:(c,o)=&gt;c.lineWidth(o),polygonOffsetFill:(c,o)=&gt;o?c.enable(32823):c.disable(32823),polygonOffset:(c,o)=&gt;c.polygonOffset(...o),sampleCoverage:(c,o)=&gt;c.sampleCoverage(...o),scissorTest:(c,o)=&gt;o?c.enable(3089):c.disable(3089),scissor:(c,o)=&gt;c.scissor(...o),stencilTest:(c,o)=&gt;o?c.enable(2960):c.disable(2960),stencilMask:(c,o)=&gt;{o=au(o)?o:[o,o];const[u,p]=o;c.stencilMaskSeparate(1028,u),c.stencilMaskSeparate(1029,p)},stencilFunc:(c,o)=&gt;{o=au(o)&amp;&amp;o.length===3?[...o,...o]:o;const[u,p,g,v,E,A]=o;c.stencilFuncSeparate(1028,u,p,g),c.stencilFuncSeparate(1029,v,E,A)},stencilOp:(c,o)=&gt;{o=au(o)&amp;&amp;o.length===3?[...o,...o]:o;const[u,p,g,v,E,A]=o;c.stencilOpSeparate(1028,u,p,g),c.stencilOpSeparate(1029,v,E,A)},viewport:(c,o)=&gt;c.viewport(...o)};function or(c,o,u){return o[c]!==void 0?o[c]:u[c]}const IB={blendEquation:(c,o,u)=&gt;c.blendEquationSeparate(or(32777,o,u),or(34877,o,u)),blendFunc:(c,o,u)=&gt;c.blendFuncSeparate(or(32969,o,u),or(32968,o,u),or(32971,o,u),or(32970,o,u)),polygonOffset:(c,o,u)=&gt;c.polygonOffset(or(32824,o,u),or(10752,o,u)),sampleCoverage:(c,o,u)=&gt;c.sampleCoverage(or(32938,o,u),or(32939,o,u)),stencilFuncFront:(c,o,u)=&gt;c.stencilFuncSeparate(1028,or(2962,o,u),or(2967,o,u),or(2963,o,u)),stencilFuncBack:(c,o,u)=&gt;c.stencilFuncSeparate(1029,or(34816,o,u),or(36003,o,u),or(36004,o,u)),stencilOpFront:(c,o,u)=&gt;c.stencilOpSeparate(1028,or(2964,o,u),or(2965,o,u),or(2966,o,u)),stencilOpBack:(c,o,u)=&gt;c.stencilOpSeparate(1029,or(34817,o,u),or(34818,o,u),or(34819,o,u))},rS={enable:(c,o)=&gt;c({[o]:!0}),disable:(c,o)=&gt;c({[o]:!1}),pixelStorei:(c,o,u)=&gt;c({[o]:u}),hint:(c,o,u)=&gt;c({[o]:u}),bindFramebuffer:(c,o,u)=&gt;{switch(o){case 36160:return c({36006:u,36010:u});case 36009:return c({36006:u});case 36008:return c({36010:u});default:return null}},blendColor:(c,o,u,p,g)=&gt;c({32773:new Float32Array([o,u,p,g])}),blendEquation:(c,o)=&gt;c({32777:o,34877:o}),blendEquationSeparate:(c,o,u)=&gt;c({32777:o,34877:u}),blendFunc:(c,o,u)=&gt;c({32969:o,32968:u,32971:o,32970:u}),blendFuncSeparate:(c,o,u,p,g)=&gt;c({32969:o,32968:u,32971:p,32970:g}),clearColor:(c,o,u,p,g)=&gt;c({3106:new Float32Array([o,u,p,g])}),clearDepth:(c,o)=&gt;c({2931:o}),clearStencil:(c,o)=&gt;c({2961:o}),colorMask:(c,o,u,p,g)=&gt;c({3107:[o,u,p,g]}),cullFace:(c,o)=&gt;c({2885:o}),depthFunc:(c,o)=&gt;c({2932:o}),depthRange:(c,o,u)=&gt;c({2928:new Float32Array([o,u])}),depthMask:(c,o)=&gt;c({2930:o}),frontFace:(c,o)=&gt;c({2886:o}),lineWidth:(c,o)=&gt;c({2849:o}),polygonOffset:(c,o,u)=&gt;c({32824:o,10752:u}),sampleCoverage:(c,o,u)=&gt;c({32938:o,32939:u}),scissor:(c,o,u,p,g)=&gt;c({3088:new Int32Array([o,u,p,g])}),stencilMask:(c,o)=&gt;c({2968:o,36005:o}),stencilMaskSeparate:(c,o,u)=&gt;c({[o===1028?2968:36005]:u}),stencilFunc:(c,o,u,p)=&gt;c({2962:o,2967:u,2963:p,34816:o,36003:u,36004:p}),stencilFuncSeparate:(c,o,u,p,g)=&gt;c({[o===1028?2962:34816]:u,[o===1028?2967:36003]:p,[o===1028?2963:36004]:g}),stencilOp:(c,o,u,p)=&gt;c({2964:o,2965:u,2966:p,34817:o,34818:u,34819:p}),stencilOpSeparate:(c,o,u,p,g)=&gt;c({[o===1028?2964:34817]:u,[o===1028?2965:34818]:p,[o===1028?2966:34819]:g}),viewport:(c,o,u,p,g)=&gt;c({2978:[o,u,p,g]})},ws=(c,o)=&gt;c.isEnabled(o),nS={3042:ws,2884:ws,2929:ws,3024:ws,32823:ws,32926:ws,32928:ws,3089:ws,2960:ws,35977:ws};function XA(c){for(const o in c)return!1;return!0}function PB(c,o){if(c===o)return!0;const u=Array.isArray(c)||ArrayBuffer.isView(c),p=Array.isArray(o)||ArrayBuffer.isView(o);if(u&amp;&amp;p&amp;&amp;c.length===o.length){for(let g=0;g&lt;c.length;++g)if(c[g]!==o[g])return!1;return!0}return!1}function sS(c,o){const u=c[o].bind(c);c[o]=function(){const g=arguments.length&lt;=0?void 0:arguments[0];return g in c.state.cache?c.state.enable?c.state.cache[g]:u(...arguments):u(...arguments)},Object.defineProperty(c[o],"name",{value:"".concat(o,"-from-cache"),configurable:!1})}function CB(c,o,u){const p=c[o].bind(c);c[o]=function(){for(var v=arguments.length,E=new Array(v),A=0;A&lt;v;A++)E[A]=arguments[A];const{valueChanged:R,oldValue:L}=u(c.state._updateCache,...E);return R&amp;&amp;p(...E),L},Object.defineProperty(c[o],"name",{value:"".concat(o,"-to-cache"),configurable:!1})}function LB(c){const o=c.useProgram.bind(c);c.useProgram=function(p){c.state.program!==p&amp;&amp;(o(p),c.state.program=p)}}class RB{constructor(o){let{copyState:u=!1,log:p=()=&gt;{}}=arguments.length&gt;1&amp;&amp;arguments[1]!==void 0?arguments[1]:{};this.gl=o,this.program=null,this.stateStack=[],this.enable=!0,this.cache=u?OB(o):Object.assign({},Ty),this.log=p,this._updateCache=this._updateCache.bind(this),Object.seal(this)}push(){this.stateStack.push({})}pop(){Ur(this.stateStack.length&gt;0);const o=this.stateStack[this.stateStack.length-1];qo(this.gl,o),this.stateStack.pop()}_updateCache(o){let u=!1,p;const g=this.stateStack.length&gt;0&amp;&amp;this.stateStack[this.stateStack.length-1];for(const v in o){Ur(v!==void 0);const E=o[v],A=this.cache[v];PB(E,A)||(u=!0,p=A,g&amp;&amp;!(v in g)&amp;&amp;(g[v]=A),this.cache[v]=E)}return{valueChanged:u,oldValue:p}}}function YA(c){let o=arguments.length&gt;1&amp;&amp;arguments[1]!==void 0?arguments[1]:{};const{enable:u=!0,copyState:p}=o;if(Ur(p!==void 0),!c.state){const{polyfillContext:g}=globalThis;g&amp;&amp;g(c),c.state=new RB(c,{copyState:p}),LB(c);for(const v in rS){const E=rS[v];CB(c,v,E)}sS(c,"getParameter"),sS(c,"isEnabled")}return c.state.enable=u,c}function DB(c){c.state||YA(c,{copyState:!1}),c.state.push()}function oS(c){Ur(c.state),c.state.pop()}function qo(c,o){if(Ur(wy(c),"setParameters requires a WebGL context"),XA(o))return;const u={};for(const g in o){const v=Number(g),E=MB[g];E&amp;&amp;(typeof E=="string"?u[E]=!0:E(c,o[g],v))}const p=c.state&amp;&amp;c.state.cache;if(p)for(const g in u){const v=IB[g];v(c,o,p)}}function OB(c,o){if(o=o||Ty,typeof o=="number"){const g=o,v=nS[g];return v?v(c,g):c.getParameter(g)}const u=Array.isArray(o)?o:Object.keys(o),p={};for(const g of u){const v=nS[g];p[g]=v?v(c,Number(g)):c.getParameter(Number(g))}return p}function kB(c){qo(c,Ty)}function As(c,o,u){if(XA(o))return u(c);const{nocatch:p=!0}=o;DB(c),qo(c,o);let g;if(p)g=u(c),oS(c);else try{g=u(c)}finally{oS(c)}return g}function Ul(c){const{luma:o}=c;if(c.canvas&amp;&amp;o){const u=o.canvasSizeInfo,p="clientWidth"in u?u.clientWidth:c.canvas.clientWidth;return p?c.drawingBufferWidth/p:1}return 1}function bg(c,o){let u=arguments.length&gt;2&amp;&amp;arguments[2]!==void 0?arguments[2]:!0;const p=Ul(c),g=c.drawingBufferWidth,v=c.drawingBufferHeight;return FB(o,p,g,v,u)}function zB(c){const o=typeof window&gt;"u"?1:window.devicePixelRatio||1;return Number.isFinite(c)?c&lt;=0?1:c:c?o:1}function FB(c,o,u,p,g){const v=aS(c[0],o,u);let E=lS(c[1],o,p,g),A=aS(c[0]+1,o,u);const R=A===u-1?A:A-1;A=lS(c[1]+1,o,p,g);let L;return g?(A=A===0?A:A+1,L=E,E=A):L=A===p-1?A:A-1,{x:v,y:E,width:Math.max(R-v+1,1),height:Math.max(L-E+1,1)}}function aS(c,o,u){return Math.min(Math.round(c*o),u-1)}function lS(c,o,u,p){return p?Math.max(0,u-1-Math.round(c*o)):Math.min(Math.round(c*o),u-1)}const Ey=oo(),BB=Ey&amp;&amp;typeof document&lt;"u",KA={webgl2:!0,webgl1:!0,throwOnError:!0,manageState:!0,canvas:null,debug:!1,width:800,height:600};function JA(){let c=arguments.length&gt;0&amp;&amp;arguments[0]!==void 0?arguments[0]:{};Ur(Ey,`createGLContext only available in the browser.
Create your own headless context or use 'createHeadlessContext' from @luma.gl/test-utils`),c=Object.assign({},KA,c);const{width:o,height:u}=c;function p(A){if(c.throwOnError)throw new Error(A);return console.error(A),null}c.onError=p;let g;const{canvas:v}=c,E=jB({canvas:v,width:o,height:u,onError:p});return g=VB(E,c),g?(g=Sy(g,c),GB(g),g):null}function Sy(c){let o=arguments.length&gt;1&amp;&amp;arguments[1]!==void 0?arguments[1]:{};if(!c||c._instrumented)return c;c._version=c._version||HB(c),c.luma=c.luma||{},c.luma.canvasSizeInfo=c.luma.canvasSizeInfo||{},o=Object.assign({},KA,o);const{manageState:u,debug:p}=o;return u&amp;&amp;YA(c,{copyState:!1,log:function(){for(var g=arguments.length,v=new Array(g),E=0;E&lt;g;E++)v[E]=arguments[E];return Ye.log(1,...v)()}}),Ey&amp;&amp;p&amp;&amp;(globalThis.makeDebugContext?(c=globalThis.makeDebugContext(c,o),Ye.level=Math.max(Ye.level,1)):Ye.warn('WebGL debug mode not activated. import "@luma.gl/debug" to enable.')()),c._instrumented=!0,c}function NB(c){const o=c.getParameter(7936),u=c.getParameter(7937),p=c.getExtension("WEBGL_debug_renderer_info"),g=p&amp;&amp;c.getParameter(p.UNMASKED_VENDOR_WEBGL||7936),v=p&amp;&amp;c.getParameter(p.UNMASKED_RENDERER_WEBGL||7937);return{vendor:g||o,renderer:v||u,vendorMasked:o,rendererMasked:u,version:c.getParameter(7938),shadingLanguageVersion:c.getParameter(35724)}}function UB(c){let o=arguments.length&gt;1&amp;&amp;arguments[1]!==void 0?arguments[1]:{};if(c.canvas){const p=zB(o.useDevicePixels);WB(c,p,o);return}const u=c.getExtension("STACKGL_resize_drawingbuffer");u&amp;&amp;"width"in o&amp;&amp;"height"in o&amp;&amp;u.resize(o.width,o.height)}function VB(c,o){const{onError:u}=o;let p=null;const g=R=&gt;p=R.statusMessage||p;c.addEventListener("webglcontextcreationerror",g,!1);const{webgl1:v=!0,webgl2:E=!0}=o;let A=null;return E&amp;&amp;(A=A||c.getContext("webgl2",o),A=A||c.getContext("experimental-webgl2",o)),v&amp;&amp;(A=A||c.getContext("webgl",o),A=A||c.getContext("experimental-webgl",o)),c.removeEventListener("webglcontextcreationerror",g,!1),A?(o.onContextLost&amp;&amp;c.addEventListener("webglcontextlost",o.onContextLost,!1),o.onContextRestored&amp;&amp;c.addEventListener("webglcontextrestored",o.onContextRestored,!1),A):u("Failed to create ".concat(E&amp;&amp;!v?"WebGL2":"WebGL"," context: ").concat(p||"Unknown error"))}function jB(c){let{canvas:o,width:u=800,height:p=600,onError:g}=c,v;return typeof o=="string"?(BB&amp;&amp;document.readyState==="complete"||g("createGLContext called on canvas '".concat(o,"' before page was loaded")),v=document.getElementById(o)):o?v=o:(v=document.createElement("canvas"),v.id="lumagl-canvas",v.style.width=Number.isFinite(u)?"".concat(u,"px"):"100%",v.style.height=Number.isFinite(p)?"".concat(p,"px"):"100%",document.body.insertBefore(v,document.body.firstChild)),v}function GB(c){const o=Li(c)?"WebGL2":"WebGL1",u=NB(c),p=u?"(".concat(u.vendor,",").concat(u.renderer,")"):"",g=c.debug?" debug":"";Ye.info(1,"".concat(o).concat(g," context ").concat(p))()}function HB(c){return typeof WebGL2RenderingContext&lt;"u"&amp;&amp;c instanceof WebGL2RenderingContext?2:1}function WB(c,o,u){let p="width"in u?u.width:c.canvas.clientWidth,g="height"in u?u.height:c.canvas.clientHeight;(!p||!g)&amp;&amp;(Ye.log(1,"Canvas clientWidth/clientHeight is 0")(),o=1,p=c.canvas.width||1,g=c.canvas.height||1),c.luma=c.luma||{},c.luma.canvasSizeInfo=c.luma.canvasSizeInfo||{};const v=c.luma.canvasSizeInfo;if(v.clientWidth!==p||v.clientHeight!==g||v.devicePixelRatio!==o){let E=o;const A=Math.floor(p*E),R=Math.floor(g*E);c.canvas.width=A,c.canvas.height=R,(c.drawingBufferWidth!==A||c.drawingBufferHeight!==R)&amp;&amp;(Ye.warn("Device pixel ratio clamped")(),E=Math.min(c.drawingBufferWidth/p,c.drawingBufferHeight/g),c.canvas.width=Math.floor(p*E),c.canvas.height=Math.floor(g*E)),Object.assign(c.luma.canvasSizeInfo,{clientWidth:p,clientHeight:g,devicePixelRatio:o})}}function cS(){let c;if(typeof window&lt;"u"&amp;&amp;window.performance)c=window.performance.now();else if(typeof process&lt;"u"&amp;&amp;process.hrtime){const o=process.hrtime();c=o[0]*1e3+o[1]/1e6}else c=Date.now();return c}class uS{constructor(o,u){et(this,"name",void 0),et(this,"type",void 0),et(this,"sampleSize",1),et(this,"time",void 0),et(this,"count",void 0),et(this,"samples",void 0),et(this,"lastTiming",void 0),et(this,"lastSampleTime",void 0),et(this,"lastSampleCount",void 0),et(this,"_count",0),et(this,"_time",0),et(this,"_samples",0),et(this,"_startTime",0),et(this,"_timerPending",!1),this.name=o,this.type=u,this.reset()}setSampleSize(o){return this.sampleSize=o,this}incrementCount(){return this.addCount(1),this}decrementCount(){return this.subtractCount(1),this}addCount(o){return this._count+=o,this._samples++,this._checkSampling(),this}subtractCount(o){return this._count-=o,this._samples++,this._checkSampling(),this}addTime(o){return this._time+=o,this.lastTiming=o,this._samples++,this._checkSampling(),this}timeStart(){return this._startTime=cS(),this._timerPending=!0,this}timeEnd(){return this._timerPending?(this.addTime(cS()-this._startTime),this._timerPending=!1,this._checkSampling(),this):this}getSampleAverageCount(){return this.sampleSize&gt;0?this.lastSampleCount/this.sampleSize:0}getSampleAverageTime(){return this.sampleSize&gt;0?this.lastSampleTime/this.sampleSize:0}getSampleHz(){return this.lastSampleTime&gt;0?this.sampleSize/(this.lastSampleTime/1e3):0}getAverageCount(){return this.samples&gt;0?this.count/this.samples:0}getAverageTime(){return this.samples&gt;0?this.time/this.samples:0}getHz(){return this.time&gt;0?this.samples/(this.time/1e3):0}reset(){return this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this}_checkSampling(){this._samples===this.sampleSize&amp;&amp;(this.lastSampleTime=this._time,this.lastSampleCount=this._count,this.count+=this._count,this.time+=this._time,this.samples+=this._samples,this._time=0,this._count=0,this._samples=0)}}class Ay{constructor(o){et(this,"id",void 0),et(this,"stats",{}),this.id=o.id,this.stats={},this._initializeStats(o.stats),Object.seal(this)}get(o){let u=arguments.length&gt;1&amp;&amp;arguments[1]!==void 0?arguments[1]:"count";return this._getOrCreate({name:o,type:u})}get size(){return Object.keys(this.stats).length}reset(){for(const o in this.stats)this.stats[o].reset();return this}forEach(o){for(const u in this.stats)o(this.stats[u])}getTable(){const o={};return this.forEach(u=&gt;{o[u.name]={time:u.time||0,count:u.count||0,average:u.getAverageTime()||0,hz:u.getHz()||0}}),o}_initializeStats(){(arguments.length&gt;0&amp;&amp;arguments[0]!==void 0?arguments[0]:[]).forEach(u=&gt;this._getOrCreate(u))}_getOrCreate(o){if(!o||!o.name)return null;const{name:u,type:p}=o;return this.stats[u]||(o instanceof uS?this.stats[u]=o:this.stats[u]=new uS(u,p)),this.stats[u]}}const gu="8.5.21",qB="set luma.log.level=1 (or higher) to trace rendering";class ZB{constructor(){this.stats=new Map}get(o){return this.stats.has(o)||this.stats.set(o,new Ay({id:o})),this.stats.get(o)}}const Aa=new ZB;if(globalThis.luma&amp;&amp;globalThis.luma.VERSION!==gu)throw new Error("luma.gl - multiple VERSIONs detected: ".concat(globalThis.luma.VERSION," vs ").concat(gu));globalThis.luma||(oo()&amp;&amp;Ye.log(1,"luma.gl ".concat(gu," - ").concat(qB))(),globalThis.luma=globalThis.luma||{VERSION:gu,version:gu,log:Ye,stats:Aa,globals:{modules:{},nodeIO:{}}});function $B(c){return typeof window&lt;"u"&amp;&amp;window.requestAnimationFrame?window.requestAnimationFrame(c):setTimeout(c,1e3/60)}function XB(c){return typeof window&lt;"u"&amp;&amp;window.cancelAnimationFrame?window.cancelAnimationFrame(c):clearTimeout(c)}function qe(c,o){if(!c)throw new Error(o||"luma.gl: assertion failed.")}function wg(c,o){if(typeof o!="string")return o;const u=Number(o);if(!isNaN(u))return u;o=o.replace(/^.*\./,"");const p=c[o];return qe(p!==void 0,"Accessing undefined constant GL.".concat(o)),p}function Ia(c,o){o=Number(o);for(const u in c)if(c[u]===o)return"GL.".concat(u);return String(o)}const Tg={};function xu(){let c=arguments.length&gt;0&amp;&amp;arguments[0]!==void 0?arguments[0]:"id";Tg[c]=Tg[c]||1;const o=Tg[c]++;return"".concat(c,"-").concat(o)}function hS(c){return qe(typeof c=="number","Input must be a number"),c&amp;&amp;(c&amp;c-1)===0}function e8(c){let o=!0;for(const u in c){o=!1;break}return o}function YB(c,o,u,p){const g="See luma.gl ".concat(u," Upgrade Guide at https://luma.gl/docs/upgrade-guide"),v=Object.getPrototypeOf(c);p.forEach(E=&gt;{v.methodName||(v[E]=()=&gt;{throw Ye.removed("Calling removed method ".concat(o,".").concat(E,": "),g)(),new Error(E)})})}const Rl="Resource subclass must define virtual methods";let ka=class{get[Symbol.toStringTag](){return"Resource"}constructor(o){let u=arguments.length&gt;1&amp;&amp;arguments[1]!==void 0?arguments[1]:{};Lf(o);const{id:p,userData:g={}}=u;this.gl=o,this.gl2=o,this.id=p||xu(this[Symbol.toStringTag]),this.userData=g,this._bound=!1,this._handle=u.handle,this._handle===void 0&amp;&amp;(this._handle=this._createHandle()),this.byteLength=0,this._addStats()}toString(){return"".concat(this[Symbol.toStringTag]||this.constructor.name,"(").concat(this.id,")")}get handle(){return this._handle}delete(){let{deleteChildren:o=!1}=arguments.length&gt;0&amp;&amp;arguments[0]!==void 0?arguments[0]:{};const u=this._handle&amp;&amp;this._deleteHandle(this._handle);return this._handle&amp;&amp;this._removeStats(),this._handle=null,u&amp;&amp;o&amp;&amp;u.filter(Boolean).forEach(p=&gt;p.delete()),this}bind(){let o=arguments.length&gt;0&amp;&amp;arguments[0]!==void 0?arguments[0]:this.handle;if(typeof o!="function")return this._bindHandle(o),this;let u;return this._bound?u=o():(this._bindHandle(this.handle),this._bound=!0,u=o(),this._bound=!1,this._bindHandle(null)),u}unbind(){this.bind(null)}getParameter(o){let u=arguments.length&gt;1&amp;&amp;arguments[1]!==void 0?arguments[1]:{};o=wg(this.gl,o),qe(o);const g=(this.constructor.PARAMETERS||{})[o];if(g){const v=Li(this.gl);if(!((!("webgl2"in g)||v)&amp;&amp;(!("extension"in g)||this.gl.getExtension(g.extension)))){const A=g.webgl1,R="webgl2"in g?g.webgl2:g.webgl1;return v?R:A}}return this._getParameter(o,u)}getParameters(){let o=arguments.length&gt;0&amp;&amp;arguments[0]!==void 0?arguments[0]:{};const{parameters:u,keys:p}=o,g=this.constructor.PARAMETERS||{},v=Li(this.gl),E={},A=u||Object.keys(g);for(const R of A){const L=g[R];if(L&amp;&amp;(!("webgl2"in L)||v)&amp;&amp;(!("extension"in L)||this.gl.getExtension(L.extension))){const j=p?Ia(this.gl,R):R;E[j]=this.getParameter(R,o),p&amp;&amp;L.type==="GLenum"&amp;&amp;(E[j]=Ia(this.gl,E[j]))}}return E}setParameter(o,u){o=wg(this.gl,o),qe(o);const g=(this.constructor.PARAMETERS||{})[o];if(g){const v=Li(this.gl);if(!((!("webgl2"in g)||v)&amp;&amp;(!("extension"in g)||this.gl.getExtension(g.extension))))throw new Error("Parameter not available on this platform");g.type==="GLenum"&amp;&amp;(u=wg(u))}return this._setParameter(o,u),this}setParameters(o){for(const u in o)this.setParameter(u,o[u]);return this}stubRemovedMethods(o,u,p){return YB(this,o,u,p)}initialize(o){}_createHandle(){throw new Error(Rl)}_deleteHandle(){throw new Error(Rl)}_bindHandle(o){throw new Error(Rl)}_getOptsFromHandle(){throw new Error(Rl)}_getParameter(o,u){throw new Error(Rl)}_setParameter(o,u){throw new Error(Rl)}_context(){return this.gl.luma=this.gl.luma||{},this.gl.luma}_addStats(){const o=this[Symbol.toStringTag],u=Aa.get("Resource Counts");u.get("Resources Created").incrementCount(),u.get("".concat(o,"s Created")).incrementCount(),u.get("".concat(o,"s Active")).incrementCount()}_removeStats(){const o=this[Symbol.toStringTag];Aa.get("Resource Counts").get("".concat(o,"s Active")).decrementCount()}_trackAllocatedMemory(o){let u=arguments.length&gt;1&amp;&amp;arguments[1]!==void 0?arguments[1]:this[Symbol.toStringTag];this._trackAllocatedMemoryForContext(o,u),this._trackAllocatedMemoryForContext(o,u,this.gl.canvas&amp;&amp;this.gl.canvas.id),this.byteLength=o}_trackAllocatedMemoryForContext(o){let u=arguments.length&gt;1&amp;&amp;arguments[1]!==void 0?arguments[1]:this[Symbol.toStringTag],p=arguments.length&gt;2&amp;&amp;arguments[2]!==void 0?arguments[2]:"";const g=Aa.get("Memory Usage".concat(p));g.get("GPU Memory").addCount(o),g.get("".concat(u," Memory")).addCount(o)}_trackDeallocatedMemory(){let o=arguments.length&gt;0&amp;&amp;arguments[0]!==void 0?arguments[0]:this[Symbol.toStringTag];this._trackDeallocatedMemoryForContext(o),this._trackDeallocatedMemoryForContext(o,this.gl.canvas&amp;&amp;this.gl.canvas.id),this.byteLength=0}_trackDeallocatedMemoryForContext(){let o=arguments.length&gt;0&amp;&amp;arguments[0]!==void 0?arguments[0]:this[Symbol.toStringTag],u=arguments.length&gt;1&amp;&amp;arguments[1]!==void 0?arguments[1]:"";const p=Aa.get("Memory Usage".concat(u));p.get("GPU Memory").subtractCount(this.byteLength),p.get("".concat(o," Memory")).subtractCount(this.byteLength)}};const KB="Failed to deduce GL constant from typed array";function Wg(c){switch(ArrayBuffer.isView(c)?c.constructor:c){case Float32Array:return 5126;case Uint16Array:return 5123;case Uint32Array:return 5125;case Uint8Array:return 5121;case Uint8ClampedArray:return 5121;case Int8Array:return 5120;case Int16Array:return 5122;case Int32Array:return 5124;default:throw new Error(KB)}}function vu(c){let{clamped:o=!0}=arguments.length&gt;1&amp;&amp;arguments[1]!==void 0?arguments[1]:{};switch(c){case 5126:return Float32Array;case 5123:case 33635:case 32819:case 32820:return Uint16Array;case 5125:return Uint32Array;case 5121:return o?Uint8ClampedArray:Uint8Array;case 5120:return Int8Array;case 5122:return Int16Array;case 5124:return Int32Array;default:throw new Error("Failed to deduce typed array type from GL constant")}}function JB(c){let{data:o,width:u,height:p,bytesPerPixel:g=4,temp:v}=c;const E=u*g;v=v||new Uint8Array(E);for(let A=0;A&lt;p/2;++A){const R=A*E,L=(p-A-1)*E;v.set(o.subarray(R,R+E)),o.copyWithin(R,L,L+E),o.set(v,L)}}function QB(c){let{data:o,width:u,height:p}=c;const g=Math.round(u/2),v=Math.round(p/2),E=new Uint8Array(g*v*4);for(let A=0;A&lt;v;A++)for(let R=0;R&lt;g;R++)for(let L=0;L&lt;4;L++)E[(A*g+R)*4+L]=o[(A*2*u+R*2)*4+L];return{data:E,width:g,height:v}}function qg(c,o,u){const{removedProps:p={},deprecatedProps:g={},replacedProps:v={}}=u;for(const A in p)if(A in o){const L=p[A]?"".concat(c,".").concat(p[A]):"N/A";Ye.removed("".concat(c,".").concat(A),L)()}for(const A in g)if(A in o){const R=g[A];Ye.deprecated("".concat(c,".").concat(A),"".concat(c,".").concat(R))()}let E=null;for(const A in v)if(A in o){const R=v[A];Ye.deprecated("".concat(c,".").concat(A),"".concat(c,".").concat(R))(),E=E||Object.assign({},o),E[R]=o[A],delete E[A]}return E||o}const t4={offset:0,stride:0,type:5126,size:1,divisor:0,normalized:!1,integer:!1},e4={deprecatedProps:{instanced:"divisor",isInstanced:"divisor"}};class kn{static getBytesPerElement(o){return vu(o.type||5126).BYTES_PER_ELEMENT}static getBytesPerVertex(o){return qe(o.size),vu(o.type||5126).BYTES_PER_ELEMENT*o.size}static resolve(){for(var o=arguments.length,u=new Array(o),p=0;p&lt;o;p++)u[p]=arguments[p];return new kn(t4,...u)}constructor(){for(var o=arguments.length,u=new Array(o),p=0;p&lt;o;p++)u[p]=arguments[p];u.forEach(g=&gt;this._assign(g)),Object.freeze(this)}toString(){return JSON.stringify(this)}get BYTES_PER_ELEMENT(){return kn.getBytesPerElement(this)}get BYTES_PER_VERTEX(){return kn.getBytesPerVertex(this)}_assign(){let o=arguments.length&gt;0&amp;&amp;arguments[0]!==void 0?arguments[0]:{};return o=qg("Accessor",o,e4),o.type!==void 0&amp;&amp;(this.type=o.type,(o.type===5124||o.type===5125)&amp;&amp;(this.integer=!0)),o.size!==void 0&amp;&amp;(this.size=o.size),o.offset!==void 0&amp;&amp;(this.offset=o.offset),o.stride!==void 0&amp;&amp;(this.stride=o.stride),o.normalized!==void 0&amp;&amp;(this.normalized=o.normalized),o.integer!==void 0&amp;&amp;(this.integer=o.integer),o.divisor!==void 0&amp;&amp;(this.divisor=o.divisor),o.buffer!==void 0&amp;&amp;(this.buffer=o.buffer),o.index!==void 0&amp;&amp;(typeof o.index=="boolean"?this.index=o.index?1:0:this.index=o.index),o.instanced!==void 0&amp;&amp;(this.divisor=o.instanced?1:0),o.isInstanced!==void 0&amp;&amp;(this.divisor=o.isInstanced?1:0),this}}const dS=10,QA={offset:"accessor.offset",stride:"accessor.stride",type:"accessor.type",size:"accessor.size",divisor:"accessor.divisor",normalized:"accessor.normalized",integer:"accessor.integer",instanced:"accessor.divisor",isInstanced:"accessor.divisor"},i4={removedProps:{},replacedProps:{bytes:"byteLength"},deprecatedProps:QA},r4={removedProps:QA};class Zg extends ka{get[Symbol.toStringTag](){return"Buffer"}constructor(o){let u=arguments.length&gt;1&amp;&amp;arguments[1]!==void 0?arguments[1]:{};super(o,u),this.stubRemovedMethods("Buffer","v6.0",["layout","setLayout","getIndexedParameter"]),this.target=u.target||(this.gl.webgl2?36662:34962),this.initialize(u),Object.seal(this)}getElementCount(){let o=arguments.length&gt;0&amp;&amp;arguments[0]!==void 0?arguments[0]:this.accessor;return Math.round(this.byteLength/kn.getBytesPerElement(o))}getVertexCount(){let o=arguments.length&gt;0&amp;&amp;arguments[0]!==void 0?arguments[0]:this.accessor;return Math.round(this.byteLength/kn.getBytesPerVertex(o))}initialize(){let o=arguments.length&gt;0&amp;&amp;arguments[0]!==void 0?arguments[0]:{};return ArrayBuffer.isView(o)&amp;&amp;(o={data:o}),Number.isFinite(o)&amp;&amp;(o={byteLength:o}),o=qg("Buffer",o,i4),this.usage=o.usage||35044,this.debugData=null,this.setAccessor(Object.assign({},o,o.accessor)),o.data?this._setData(o.data,o.offset,o.byteLength):this._setByteLength(o.byteLength||0),this}setProps(o){return o=qg("Buffer",o,r4),"accessor"in o&amp;&amp;this.setAccessor(o.accessor),this}setAccessor(o){return o=Object.assign({},o),delete o.buffer,this.accessor=new kn(o),this}reallocate(o){return o&gt;this.byteLength?(this._setByteLength(o),!0):(this.bytesUsed=o,!1)}setData(o){return this.initialize(o)}subData(o){ArrayBuffer.isView(o)&amp;&amp;(o={data:o});const{data:u,offset:p=0,srcOffset:g=0}=o,v=o.byteLength||o.length;qe(u);const E=this.gl.webgl2?36663:this.target;return this.gl.bindBuffer(E,this.handle),g!==0||v!==void 0?(Vr(this.gl),this.gl.bufferSubData(this.target,p,u,g,v)):this.gl.bufferSubData(E,p,u),this.gl.bindBuffer(E,null),this.debugData=null,this._inferType(u),this}copyData(o){let{sourceBuffer:u,readOffset:p=0,writeOffset:g=0,size:v}=o;const{gl:E}=this;return Vr(E),E.bindBuffer(36662,u.handle),E.bindBuffer(36663,this.handle),E.copyBufferSubData(36662,36663,p,g,v),E.bindBuffer(36662,null),E.bindBuffer(36663,null),this.debugData=null,this}getData(){let{dstData:o=null,srcByteOffset:u=0,dstOffset:p=0,length:g=0}=arguments.length&gt;0&amp;&amp;arguments[0]!==void 0?arguments[0]:{};Vr(this.gl);const v=vu(this.accessor.type||5126,{clamped:!1}),E=this._getAvailableElementCount(u),A=p;let R,L;o?(L=o.length,R=L-A):(R=Math.min(E,g||E),L=A+R);const G=Math.min(E,R);return g=g||G,qe(g&lt;=G),o=o||new v(L),this.gl.bindBuffer(36662,this.handle),this.gl.getBufferSubData(36662,u,o,p,g),this.gl.bindBuffer(36662,null),o}bind(){let{target:o=this.target,index:u=this.accessor&amp;&amp;this.accessor.index,offset:p=0,size:g}=arguments.length&gt;0&amp;&amp;arguments[0]!==void 0?arguments[0]:{};return o===35345||o===35982?g!==void 0?this.gl.bindBufferRange(o,u,this.handle,p,g):(qe(p===0),this.gl.bindBufferBase(o,u,this.handle)):this.gl.bindBuffer(o,this.handle),this}unbind(){let{target:o=this.target,index:u=this.accessor&amp;&amp;this.accessor.index}=arguments.length&gt;0&amp;&amp;arguments[0]!==void 0?arguments[0]:{};return o===35345||o===35982?this.gl.bindBufferBase(o,u,null):this.gl.bindBuffer(o,null),this}getDebugData(){return this.debugData?{data:this.debugData,changed:!1}:(this.debugData=this.getData({length:Math.min(dS,this.byteLength)}),{data:this.debugData,changed:!0})}invalidateDebugData(){this.debugData=null}_setData(o){let u=arguments.length&gt;1&amp;&amp;arguments[1]!==void 0?arguments[1]:0,p=arguments.length&gt;2&amp;&amp;arguments[2]!==void 0?arguments[2]:o.byteLength+u;qe(ArrayBuffer.isView(o)),this._trackDeallocatedMemory();const g=this._getTarget();this.gl.bindBuffer(g,this.handle),this.gl.bufferData(g,p,this.usage),this.gl.bufferSubData(g,u,o),this.gl.bindBuffer(g,null),this.debugData=o.slice(0,dS),this.bytesUsed=p,this._trackAllocatedMemory(p);const v=Wg(o);return qe(v),this.setAccessor(new kn(this.accessor,{type:v})),this}_setByteLength(o){let u=arguments.length&gt;1&amp;&amp;arguments[1]!==void 0?arguments[1]:this.usage;qe(o&gt;=0),this._trackDeallocatedMemory();let p=o;o===0&amp;&amp;(p=new Float32Array(0));const g=this._getTarget();return this.gl.bindBuffer(g,this.handle),this.gl.bufferData(g,p,u),this.gl.bindBuffer(g,null),this.usage=u,this.debugData=null,this.bytesUsed=o,this._trackAllocatedMemory(o),this}_getTarget(){return this.gl.webgl2?36663:this.target}_getAvailableElementCount(o){const u=vu(this.accessor.type||5126,{clamped:!1}),p=o/u.BYTES_PER_ELEMENT;return this.getElementCount()-p}_inferType(o){this.accessor.type||this.setAccessor(new kn(this.accessor,{type:Wg(o)}))}_createHandle(){return this.gl.createBuffer()}_deleteHandle(){this.gl.deleteBuffer(this.handle),this._trackDeallocatedMemory()}_getParameter(o){this.gl.bindBuffer(this.target,this.handle);const u=this.gl.getBufferParameter(this.target,o);return this.gl.bindBuffer(this.target,null),u}get type(){return Ye.deprecated("Buffer.type","Buffer.accessor.type")(),this.accessor.type}get bytes(){return Ye.deprecated("Buffer.bytes","Buffer.byteLength")(),this.byteLength}setByteLength(o){return Ye.deprecated("setByteLength","reallocate")(),this.reallocate(o)}updateAccessor(o){return Ye.deprecated("updateAccessor(...)","setAccessor(new Accessor(buffer.accessor, ...)")(),this.accessor=new kn(this.accessor,o),this}}const My={6407:{dataFormat:6407,types:[5121,33635]},6408:{dataFormat:6408,types:[5121,32819,32820]},6406:{dataFormat:6406,types:[5121]},6409:{dataFormat:6409,types:[5121]},6410:{dataFormat:6410,types:[5121]},33326:{dataFormat:6403,types:[5126],gl2:!0},33328:{dataFormat:33319,types:[5126],gl2:!0},34837:{dataFormat:6407,types:[5126],gl2:!0},34836:{dataFormat:6408,types:[5126],gl2:!0}},tM={6403:1,36244:1,33319:2,33320:2,6407:3,36248:3,6408:4,36249:4,6402:1,34041:1,6406:1,6409:1,6410:2},eM={5126:4,5125:4,5124:4,5123:2,5122:2,5131:2,5120:1,5121:1};function n4(c,o){const u=My[o];if(!u)return!1;if(u.gl1===void 0&amp;&amp;u.gl2===void 0)return!0;const p=Li(c)&amp;&amp;u.gl2||u.gl1;return typeof p=="string"?c.getExtension(p):p}function s4(c,o){const u=My[o];switch(u&amp;&amp;u.types[0]){case 5126:return c.getExtension("OES_texture_float_linear");case 5131:return c.getExtension("OES_texture_half_float_linear");default:return!0}}const o4=[9729,9728],fS=globalThis.WebGLBuffer||function(){};class La extends ka{get[Symbol.toStringTag](){return"Texture"}static isSupported(o){let u=arguments.length&gt;1&amp;&amp;arguments[1]!==void 0?arguments[1]:{};const{format:p,linearFiltering:g}=u;let v=!0;return p&amp;&amp;(v=v&amp;&amp;n4(o,p),v=v&amp;&amp;(!g||s4(o,p))),v}constructor(o,u){const{id:p=xu("texture"),handle:g,target:v}=u;super(o,{id:p,handle:g}),this.target=v,this.textureUnit=void 0,this.loaded=!1,this.width=void 0,this.height=void 0,this.depth=void 0,this.format=void 0,this.type=void 0,this.dataFormat=void 0,this.border=void 0,this.textureUnit=void 0,this.mipmaps=void 0}toString(){return"Texture(".concat(this.id,",").concat(this.width,"x").concat(this.height,")")}initialize(){let o=arguments.length&gt;0&amp;&amp;arguments[0]!==void 0?arguments[0]:{},u=o.data;if(u instanceof Promise)return u.then(Nt=&gt;this.initialize(Object.assign({},o,{pixels:Nt,data:Nt}))),this;const p=typeof HTMLVideoElement&lt;"u"&amp;&amp;u instanceof HTMLVideoElement;if(p&amp;&amp;u.readyState&lt;HTMLVideoElement.HAVE_METADATA)return this._video=null,u.addEventListener("loadeddata",()=&gt;this.initialize(o)),this;const{pixels:g=null,format:v=6408,border:E=0,recreate:A=!1,parameters:R={},pixelStore:L={},textureUnit:G=void 0}=o;u||(u=g);let{width:j,height:H,dataFormat:ht,type:mt,compressed:gt=!1,mipmaps:Pt=!0}=o;const{depth:Vt=0}=o;return{width:j,height:H,compressed:gt,dataFormat:ht,type:mt}=this._deduceParameters({format:v,type:mt,dataFormat:ht,compressed:gt,data:u,width:j,height:H}),this.width=j,this.height=H,this.depth=Vt,this.format=v,this.type=mt,this.dataFormat=ht,this.border=E,this.textureUnit=G,Number.isFinite(this.textureUnit)&amp;&amp;(this.gl.activeTexture(33984+this.textureUnit),this.gl.bindTexture(this.target,this.handle)),Pt&amp;&amp;this._isNPOT()&amp;&amp;(Ye.warn("texture: ".concat(this," is Non-Power-Of-Two, disabling mipmaping"))(),Pt=!1,this._updateForNPOT(R)),this.mipmaps=Pt,this.setImageData({data:u,width:j,height:H,depth:Vt,format:v,type:mt,dataFormat:ht,border:E,mipmaps:Pt,parameters:L,compressed:gt}),Pt&amp;&amp;this.generateMipmap(),this.setParameters(R),A&amp;&amp;(this.data=u),p&amp;&amp;(this._video={video:u,parameters:R,lastTime:u.readyState&gt;=HTMLVideoElement.HAVE_CURRENT_DATA?u.currentTime:-1}),this}update(){if(this._video){const{video:o,parameters:u,lastTime:p}=this._video;if(p===o.currentTime||o.readyState&lt;HTMLVideoElement.HAVE_CURRENT_DATA)return;this.setSubImageData({data:o,parameters:u}),this.mipmaps&amp;&amp;this.generateMipmap(),this._video.lastTime=o.currentTime}}resize(o){let{height:u,width:p,mipmaps:g=!1}=o;return p!==this.width||u!==this.height?this.initialize({width:p,height:u,format:this.format,type:this.type,dataFormat:this.dataFormat,border:this.border,mipmaps:g}):this}generateMipmap(){let o=arguments.length&gt;0&amp;&amp;arguments[0]!==void 0?arguments[0]:{};return this._isNPOT()?(Ye.warn("texture: ".concat(this," is Non-Power-Of-Two, disabling mipmaping"))(),this):(this.mipmaps=!0,this.gl.bindTexture(this.target,this.handle),As(this.gl,o,()=&gt;{this.gl.generateMipmap(this.target)}),this.gl.bindTexture(this.target,null),this)}setImageData(o){this._trackDeallocatedMemory("Texture");const{target:u=this.target,pixels:p=null,level:g=0,format:v=this.format,border:E=this.border,offset:A=0,parameters:R={}}=o;let{data:L=null,type:G=this.type,width:j=this.width,height:H=this.height,dataFormat:ht=this.dataFormat,compressed:mt=!1}=o;L||(L=p),{type:G,dataFormat:ht,compressed:mt,width:j,height:H}=this._deduceParameters({format:v,type:G,dataFormat:ht,compressed:mt,data:L,width:j,height:H});const{gl:gt}=this;gt.bindTexture(this.target,this.handle);let Pt=null;({data:L,dataType:Pt}=this._getDataType({data:L,compressed:mt}));let Vt,Nt=0;if(As(this.gl,R,()=&gt;{switch(Pt){case"null":gt.texImage2D(u,g,v,j,H,E,ht,G,L);break;case"typed-array":gt.texImage2D(u,g,v,j,H,E,ht,G,L,A);break;case"buffer":Vt=Vr(gt),Vt.bindBuffer(35052,L.handle||L),Vt.texImage2D(u,g,v,j,H,E,ht,G,A),Vt.bindBuffer(35052,null);break;case"browser-object":Li(gt)?gt.texImage2D(u,g,v,j,H,E,ht,G,L):gt.texImage2D(u,g,v,ht,G,L);break;case"compressed":for(const[jt,Qt]of L.entries())gt.compressedTexImage2D(u,jt,Qt.format,Qt.width,Qt.height,E,Qt.data),Nt+=Qt.levelSize;break;default:qe(!1,"Unknown image data type")}}),Pt==="compressed")this._trackAllocatedMemory(Nt,"Texture");else if(L&amp;&amp;L.byteLength)this._trackAllocatedMemory(L.byteLength,"Texture");else{const jt=tM[this.dataFormat]||4,Qt=eM[this.type]||1;this._trackAllocatedMemory(this.width*this.height*jt*Qt,"Texture")}return this.loaded=!0,this}setSubImageData(o){let{target:u=this.target,pixels:p=null,data:g=null,x:v=0,y:E=0,width:A=this.width,height:R=this.height,level:L=0,format:G=this.format,type:j=this.type,dataFormat:H=this.dataFormat,compressed:ht=!1,offset:mt=0,border:gt=this.border,parameters:Pt={}}=o;if({type:j,dataFormat:H,compressed:ht,width:A,height:R}=this._deduceParameters({format:G,type:j,dataFormat:H,compressed:ht,data:g,width:A,height:R}),qe(this.depth===0,"texSubImage not supported for 3D textures"),g||(g=p),g&amp;&amp;g.data){const Vt=g;g=Vt.data,A=Vt.shape[0],R=Vt.shape[1]}g instanceof Zg&amp;&amp;(g=g.handle),this.gl.bindTexture(this.target,this.handle),As(this.gl,Pt,()=&gt;{if(ht)this.gl.compressedTexSubImage2D(u,L,v,E,A,R,G,g);else if(g===null)this.gl.texSubImage2D(u,L,v,E,A,R,H,j,null);else if(ArrayBuffer.isView(g))this.gl.texSubImage2D(u,L,v,E,A,R,H,j,g,mt);else if(g instanceof fS){const Vt=Vr(this.gl);Vt.bindBuffer(35052,g),Vt.texSubImage2D(u,L,v,E,A,R,H,j,mt),Vt.bindBuffer(35052,null)}else Li(this.gl)?Vr(this.gl).texSubImage2D(u,L,v,E,A,R,H,j,g):this.gl.texSubImage2D(u,L,v,E,H,j,g)}),this.gl.bindTexture(this.target,null)}copyFramebuffer(){return Ye.error("Texture.copyFramebuffer({...}) is no logner supported, use copyToTexture(source, target, opts})")(),null}getActiveUnit(){return this.gl.getParameter(34016)-33984}bind(){let o=arguments.length&gt;0&amp;&amp;arguments[0]!==void 0?arguments[0]:this.textureUnit;const{gl:u}=this;return o!==void 0&amp;&amp;(this.textureUnit=o,u.activeTexture(33984+o)),u.bindTexture(this.target,this.handle),o}unbind(){let o=arguments.length&gt;0&amp;&amp;arguments[0]!==void 0?arguments[0]:this.textureUnit;const{gl:u}=this;return o!==void 0&amp;&amp;(this.textureUnit=o,u.activeTexture(33984+o)),u.bindTexture(this.target,null),o}_getDataType(o){let{data:u,compressed:p=!1}=o;return p?{data:u,dataType:"compressed"}:u===null?{data:u,dataType:"null"}:ArrayBuffer.isView(u)?{data:u,dataType:"typed-array"}:u instanceof Zg?{data:u.handle,dataType:"buffer"}:u instanceof fS?{data:u,dataType:"buffer"}:{data:u,dataType:"browser-object"}}_deduceParameters(o){const{format:u,data:p}=o;let{width:g,height:v,dataFormat:E,type:A,compressed:R}=o;const L=My[u];return E=E||L&amp;&amp;L.dataFormat,A=A||L&amp;&amp;L.types[0],R=R||L&amp;&amp;L.compressed,{width:g,height:v}=this._deduceImageSize(p,g,v),{dataFormat:E,type:A,compressed:R,width:g,height:v,format:u,data:p}}_deduceImageSize(o,u,p){let g;return typeof ImageData&lt;"u"&amp;&amp;o instanceof ImageData?g={width:o.width,height:o.height}:typeof HTMLImageElement&lt;"u"&amp;&amp;o instanceof HTMLImageElement?g={width:o.naturalWidth,height:o.naturalHeight}:typeof HTMLCanvasElement&lt;"u"&amp;&amp;o instanceof HTMLCanvasElement?g={width:o.width,height:o.height}:typeof ImageBitmap&lt;"u"&amp;&amp;o instanceof ImageBitmap?g={width:o.width,height:o.height}:typeof HTMLVideoElement&lt;"u"&amp;&amp;o instanceof HTMLVideoElement?g={width:o.videoWidth,height:o.videoHeight}:o?g={width:u,height:p}:g={width:u&gt;=0?u:1,height:p&gt;=0?p:1},qe(g,"Could not deduced texture size"),qe(u===void 0||g.width===u,"Deduced texture width does not match supplied width"),qe(p===void 0||g.height===p,"Deduced texture height does not match supplied height"),g}_createHandle(){return this.gl.createTexture()}_deleteHandle(){this.gl.deleteTexture(this.handle),this._trackDeallocatedMemory("Texture")}_getParameter(o){switch(o){case 4096:return this.width;case 4097:return this.height;default:this.gl.bindTexture(this.target,this.handle);const u=this.gl.getTexParameter(this.target,o);return this.gl.bindTexture(this.target,null),u}}_setParameter(o,u){switch(this.gl.bindTexture(this.target,this.handle),u=this._getNPOTParam(o,u),o){case 33082:case 33083:this.gl.texParameterf(this.handle,o,u);break;case 4096:case 4097:qe(!1);break;default:this.gl.texParameteri(this.target,o,u);break}return this.gl.bindTexture(this.target,null),this}_isNPOT(){return Li(this.gl)||!this.width||!this.height?!1:!hS(this.width)||!hS(this.height)}_updateForNPOT(o){o[this.gl.TEXTURE_MIN_FILTER]===void 0&amp;&amp;(o[this.gl.TEXTURE_MIN_FILTER]=this.gl.LINEAR),o[this.gl.TEXTURE_WRAP_S]===void 0&amp;&amp;(o[this.gl.TEXTURE_WRAP_S]=this.gl.CLAMP_TO_EDGE),o[this.gl.TEXTURE_WRAP_T]===void 0&amp;&amp;(o[this.gl.TEXTURE_WRAP_T]=this.gl.CLAMP_TO_EDGE)}_getNPOTParam(o,u){if(this._isNPOT())switch(o){case 10241:o4.indexOf(u)===-1&amp;&amp;(u=9729);break;case 10242:case 10243:u!==33071&amp;&amp;(u=33071);break}return u}}let a4="";function l4(c,o){return qe(typeof c=="string"),c=a4+c,new Promise((u,p)=&gt;{try{const g=new Image;g.onload=()=&gt;u(g),g.onerror=()=&gt;p(new Error("Could not load image ".concat(c,"."))),g.crossOrigin=o&amp;&amp;o.crossOrigin||"anonymous",g.src=c}catch(g){p(g)}})}class $l extends La{get[Symbol.toStringTag](){return"Texture2D"}static isSupported(o,u){return La.isSupported(o,u)}constructor(o){let u=arguments.length&gt;1&amp;&amp;arguments[1]!==void 0?arguments[1]:{};Lf(o),(u instanceof Promise||typeof u=="string")&amp;&amp;(u={data:u}),typeof u.data=="string"&amp;&amp;(u=Object.assign({},u,{data:l4(u.data)})),super(o,Object.assign({},u,{target:3553})),this.initialize(u),Object.seal(this)}}const $g=[34069,34070,34071,34072,34073,34074];class iM extends La{get[Symbol.toStringTag](){return"TextureCube"}constructor(o){let u=arguments.length&gt;1&amp;&amp;arguments[1]!==void 0?arguments[1]:{};Lf(o),super(o,Object.assign({},u,{target:34067})),this.initialize(u),Object.seal(this)}initialize(){let o=arguments.length&gt;0&amp;&amp;arguments[0]!==void 0?arguments[0]:{};const{mipmaps:u=!0,parameters:p={}}=o;return this.opts=o,this.setCubeMapImageData(o).then(()=&gt;{this.loaded=!0,u&amp;&amp;this.generateMipmap(o),this.setParameters(p)}),this}subImage(o){let{face:u,data:p,x:g=0,y:v=0,mipmapLevel:E=0}=o;return this._subImage({target:u,data:p,x:g,y:v,mipmapLevel:E})}async setCubeMapImageData(o){let{width:u,height:p,pixels:g,data:v,border:E=0,format:A=6408,type:R=5121}=o;const{gl:L}=this,G=g||v,j=await Promise.all($g.map(H=&gt;{const ht=G[H];return Promise.all(Array.isArray(ht)?ht:[ht])}));this.bind(),$g.forEach((H,ht)=&gt;{j[ht].length&gt;1&amp;&amp;this.opts.mipmaps!==!1&amp;&amp;Ye.warn("".concat(this.id," has mipmap and multiple LODs."))(),j[ht].forEach((mt,gt)=&gt;{u&amp;&amp;p?L.texImage2D(H,gt,A,u,p,E,A,R,mt):L.texImage2D(H,gt,A,A,R,mt)})}),this.unbind()}setImageDataForFace(o){const{face:u,width:p,height:g,pixels:v,data:E,border:A=0,format:R=6408,type:L=5121}=o,{gl:G}=this,j=v||E;return this.bind(),j instanceof Promise?j.then(H=&gt;this.setImageDataForFace(Object.assign({},o,{face:u,data:H,pixels:H}))):this.width||this.height?G.texImage2D(u,0,R,p,g,A,R,L,j):G.texImage2D(u,0,R,R,L,j),this}}iM.FACES=$g;class c4 extends La{get[Symbol.toStringTag](){return"Texture3D"}static isSupported(o){return Li(o)}constructor(o){let u=arguments.length&gt;1&amp;&amp;arguments[1]!==void 0?arguments[1]:{};Vr(o),u=Object.assign({depth:1},u,{target:32879,unpackFlipY:!1}),super(o,u),this.initialize(u),Object.seal(this)}setImageData(o){let{level:u=0,dataFormat:p=6408,width:g,height:v,depth:E=1,border:A=0,format:R,type:L=5121,offset:G=0,data:j,parameters:H={}}=o;if(this._trackDeallocatedMemory("Texture"),this.gl.bindTexture(this.target,this.handle),As(this.gl,H,()=&gt;{ArrayBuffer.isView(j)&amp;&amp;this.gl.texImage3D(this.target,u,p,g,v,E,A,R,L,j),j instanceof Zg&amp;&amp;(this.gl.bindBuffer(35052,j.handle),this.gl.texImage3D(this.target,u,p,g,v,E,A,R,L,G))}),j&amp;&amp;j.byteLength)this._trackAllocatedMemory(j.byteLength,"Texture");else{const ht=tM[this.dataFormat]||4,mt=eM[this.type]||1;this._trackAllocatedMemory(this.width*this.height*this.depth*ht*mt,"Texture")}return this.loaded=!0,this}}const wa="EXT_color_buffer_float",pS={33189:{bpp:2},33190:{gl2:!0,bpp:3},36012:{gl2:!0,bpp:4},36168:{bpp:1},34041:{bpp:4},35056:{gl2:!0,bpp:4},36013:{gl2:!0,bpp:5},32854:{bpp:2},36194:{bpp:2},32855:{bpp:2},33321:{gl2:!0,bpp:1},33330:{gl2:!0,bpp:1},33329:{gl2:!0,bpp:1},33332:{gl2:!0,bpp:2},33331:{gl2:!0,bpp:2},33334:{gl2:!0,bpp:4},33333:{gl2:!0,bpp:4},33323:{gl2:!0,bpp:2},33336:{gl2:!0,bpp:2},33335:{gl2:!0,bpp:2},33338:{gl2:!0,bpp:4},33337:{gl2:!0,bpp:4},33340:{gl2:!0,bpp:8},33339:{gl2:!0,bpp:8},32849:{gl2:!0,bpp:3},32856:{gl2:!0,bpp:4},32857:{gl2:!0,bpp:4},36220:{gl2:!0,bpp:4},36238:{gl2:!0,bpp:4},36975:{gl2:!0,bpp:4},36214:{gl2:!0,bpp:8},36232:{gl2:!0,bpp:8},36226:{gl2:!0,bpp:16},36208:{gl2:!0,bpp:16},33325:{gl2:wa,bpp:2},33327:{gl2:wa,bpp:4},34842:{gl2:wa,bpp:8},33326:{gl2:wa,bpp:4},33328:{gl2:wa,bpp:8},34836:{gl2:wa,bpp:16},35898:{gl2:wa,bpp:4}};function u4(c,o,u){const p=u[o];if(!p)return!1;const g=Li(c)&amp;&amp;p.gl2||p.gl1;return typeof g=="string"?c.getExtension(g):g}class kl extends ka{get[Symbol.toStringTag](){return"Renderbuffer"}static isSupported(o){let{format:u}=arguments.length&gt;1&amp;&amp;arguments[1]!==void 0?arguments[1]:{format:null};return!u||u4(o,u,pS)}static getSamplesForFormat(o,u){let{format:p}=u;return o.getInternalformatParameter(36161,p,32937)}constructor(o){let u=arguments.length&gt;1&amp;&amp;arguments[1]!==void 0?arguments[1]:{};super(o,u),this.initialize(u),Object.seal(this)}initialize(o){let{format:u,width:p=1,height:g=1,samples:v=0}=o;return qe(u,"Needs format"),this._trackDeallocatedMemory(),this.gl.bindRenderbuffer(36161,this.handle),v!==0&amp;&amp;Li(this.gl)?this.gl.renderbufferStorageMultisample(36161,v,u,p,g):this.gl.renderbufferStorage(36161,u,p,g),this.format=u,this.width=p,this.height=g,this.samples=v,this._trackAllocatedMemory(this.width*this.height*(this.samples||1)*pS[this.format].bpp),this}resize(o){let{width:u,height:p}=o;return u!==this.width||p!==this.height?this.initialize({width:u,height:p,format:this.format,samples:this.samples}):this}_createHandle(){return this.gl.createRenderbuffer()}_deleteHandle(){this.gl.deleteRenderbuffer(this.handle),this._trackDeallocatedMemory()}_bindHandle(o){this.gl.bindRenderbuffer(36161,o)}_syncHandle(o){this.format=this.getParameter(36164),this.width=this.getParameter(36162),this.height=this.getParameter(36163),this.samples=this.getParameter(36011)}_getParameter(o){return this.gl.bindRenderbuffer(36161,this.handle),this.gl.getRenderbufferParameter(36161,o)}}const h4=256,d4=1024,f4=16384,mS=6144,_S=6145,gS=6146,yS=34041,rM="clear: bad arguments";function nM(c){let{framebuffer:o=null,color:u=null,depth:p=null,stencil:g=null}=arguments.length&gt;1&amp;&amp;arguments[1]!==void 0?arguments[1]:{};const v={};o&amp;&amp;(v.framebuffer=o);let E=0;u&amp;&amp;(E|=f4,u!==!0&amp;&amp;(v.clearColor=u)),p&amp;&amp;(E|=h4,p!==!0&amp;&amp;(v.clearDepth=p)),g&amp;&amp;(E|=d4,p!==!0&amp;&amp;(v.clearStencil=p)),qe(E!==0,rM),As(c,v,()=&gt;{c.clear(E)})}function p4(c){let{framebuffer:o=null,buffer:u=mS,drawBuffer:p=0,value:g=[0,0,0,0]}=arguments.length&gt;1&amp;&amp;arguments[1]!==void 0?arguments[1]:{};Vr(c),As(c,{framebuffer:o},()=&gt;{switch(u){case mS:switch(g.constructor){case Int32Array:c.clearBufferiv(u,p,g);break;case Uint32Array:c.clearBufferuiv(u,p,g);break;case Float32Array:default:c.clearBufferfv(u,p,g)}break;case _S:c.clearBufferfv(_S,0,[g]);break;case gS:c.clearBufferiv(gS,0,[g]);break;case yS:const[v,E]=g;c.clearBufferfi(yS,0,v,E);break;default:qe(!1,rM)}})}function m4(c){switch(c){case 6406:case 33326:case 6403:return 1;case 33328:case 33319:return 2;case 6407:case 34837:return 3;case 6408:case 34836:return 4;default:return qe(!1),0}}function sM(c){let o=arguments.length&gt;1&amp;&amp;arguments[1]!==void 0?arguments[1]:{};const{sourceX:u=0,sourceY:p=0,sourceFormat:g=6408}=o;let{sourceAttachment:v=36064,target:E=null,sourceWidth:A,sourceHeight:R,sourceType:L}=o;const{framebuffer:G,deleteFramebuffer:j}=oM(c);qe(G);const{gl:H,handle:ht,attachments:mt}=G;A=A||G.width,R=R||G.height,v===36064&amp;&amp;ht===null&amp;&amp;(v=1028),qe(mt[v]),L=L||mt[v].type,E=_4(E,L,g,A,R),L=L||Wg(E);const gt=H.bindFramebuffer(36160,ht);return H.readPixels(u,p,A,R,g,L,E),H.bindFramebuffer(36160,gt||null),j&amp;&amp;G.delete(),E}function xS(c){let{sourceAttachment:o=36064,targetMaxHeight:u=Number.MAX_SAFE_INTEGER}=arguments.length&gt;1&amp;&amp;arguments[1]!==void 0?arguments[1]:{},p=sM(c,{sourceAttachment:o}),{width:g,height:v}=c;for(;v&gt;u;)({data:p,width:g,height:v}=QB({data:p,width:g,height:v}));JB({data:p,width:g,height:v});const E=document.createElement("canvas");E.width=g,E.height=v;const A=E.getContext("2d"),R=A.createImageData(g,v);return R.data.set(p),A.putImageData(R,0,0),E.toDataURL()}function r8(c,o){let u=arguments.length&gt;2&amp;&amp;arguments[2]!==void 0?arguments[2]:{};const{sourceX:p=0,sourceY:g=0,targetMipmaplevel:v=0,targetInternalFormat:E=6408}=u;let{targetX:A,targetY:R,targetZ:L,width:G,height:j}=u;const{framebuffer:H,deleteFramebuffer:ht}=oM(c);qe(H);const{gl:mt,handle:gt}=H,Pt=typeof A&lt;"u"||typeof R&lt;"u"||typeof L&lt;"u";A=A||0,R=R||0,L=L||0;const Vt=mt.bindFramebuffer(36160,gt);qe(o);let Nt=null;if(o instanceof La&amp;&amp;(Nt=o,G=Number.isFinite(G)?G:Nt.width,j=Number.isFinite(j)?j:Nt.height,Nt.bind(0),o=Nt.target),!Pt)mt.copyTexImage2D(o,v,E,p,g,G,j,0);else switch(o){case 3553:case 34067:mt.copyTexSubImage2D(o,v,A,R,p,g,G,j);break;case 35866:case 32879:Vr(mt).copyTexSubImage3D(o,v,A,R,L,p,g,G,j);break}return Nt&amp;&amp;Nt.unbind(),mt.bindFramebuffer(36160,Vt||null),ht&amp;&amp;H.delete(),Nt}function oM(c){return c instanceof Cr?{framebuffer:c,deleteFramebuffer:!1}:{framebuffer:E4(c),deleteFramebuffer:!0}}function _4(c,o,u,p,g){if(c)return c;o=o||5121;const v=vu(o,{clamped:!1}),E=m4(u);return new v(p*g*E)}const rr={WEBGL2:"WEBGL2",VERTEX_ARRAY_OBJECT:"VERTEX_ARRAY_OBJECT",TIMER_QUERY:"TIMER_QUERY",INSTANCED_RENDERING:"INSTANCED_RENDERING",MULTIPLE_RENDER_TARGETS:"MULTIPLE_RENDER_TARGETS",ELEMENT_INDEX_UINT32:"ELEMENT_INDEX_UINT32",BLEND_EQUATION_MINMAX:"BLEND_EQUATION_MINMAX",FLOAT_BLEND:"FLOAT_BLEND",COLOR_ENCODING_SRGB:"COLOR_ENCODING_SRGB",TEXTURE_DEPTH:"TEXTURE_DEPTH",TEXTURE_FLOAT:"TEXTURE_FLOAT",TEXTURE_HALF_FLOAT:"TEXTURE_HALF_FLOAT",TEXTURE_FILTER_LINEAR_FLOAT:"TEXTURE_FILTER_LINEAR_FLOAT",TEXTURE_FILTER_LINEAR_HALF_FLOAT:"TEXTURE_FILTER_LINEAR_HALF_FLOAT",TEXTURE_FILTER_ANISOTROPIC:"TEXTURE_FILTER_ANISOTROPIC",COLOR_ATTACHMENT_RGBA32F:"COLOR_ATTACHMENT_RGBA32F",COLOR_ATTACHMENT_FLOAT:"COLOR_ATTACHMENT_FLOAT",COLOR_ATTACHMENT_HALF_FLOAT:"COLOR_ATTACHMENT_HALF_FLOAT",GLSL_FRAG_DATA:"GLSL_FRAG_DATA",GLSL_FRAG_DEPTH:"GLSL_FRAG_DEPTH",GLSL_DERIVATIVES:"GLSL_DERIVATIVES",GLSL_TEXTURE_LOD:"GLSL_TEXTURE_LOD"};function g4(c){const o=new $l(c,{format:6408,type:5126,dataFormat:6408}),u=new Cr(c,{id:"test-framebuffer",check:!1,attachments:{36064:o}}),p=u.getStatus();return o.delete(),u.delete(),p===36053}const aM={[rr.WEBGL2]:[!1,!0],[rr.VERTEX_ARRAY_OBJECT]:["OES_vertex_array_object",!0],[rr.TIMER_QUERY]:["EXT_disjoint_timer_query","EXT_disjoint_timer_query_webgl2"],[rr.INSTANCED_RENDERING]:["ANGLE_instanced_arrays",!0],[rr.MULTIPLE_RENDER_TARGETS]:["WEBGL_draw_buffers",!0],[rr.ELEMENT_INDEX_UINT32]:["OES_element_index_uint",!0],[rr.BLEND_EQUATION_MINMAX]:["EXT_blend_minmax",!0],[rr.FLOAT_BLEND]:["EXT_float_blend"],[rr.COLOR_ENCODING_SRGB]:["EXT_sRGB",!0],[rr.TEXTURE_DEPTH]:["WEBGL_depth_texture",!0],[rr.TEXTURE_FLOAT]:["OES_texture_float",!0],[rr.TEXTURE_HALF_FLOAT]:["OES_texture_half_float",!0],[rr.TEXTURE_FILTER_LINEAR_FLOAT]:["OES_texture_float_linear"],[rr.TEXTURE_FILTER_LINEAR_HALF_FLOAT]:["OES_texture_half_float_linear"],[rr.TEXTURE_FILTER_ANISOTROPIC]:["EXT_texture_filter_anisotropic"],[rr.COLOR_ATTACHMENT_RGBA32F]:[g4,"EXT_color_buffer_float"],[rr.COLOR_ATTACHMENT_FLOAT]:[!1,"EXT_color_buffer_float"],[rr.COLOR_ATTACHMENT_HALF_FLOAT]:["EXT_color_buffer_half_float"],[rr.GLSL_FRAG_DATA]:["WEBGL_draw_buffers",!0],[rr.GLSL_FRAG_DEPTH]:["EXT_frag_depth",!0],[rr.GLSL_DERIVATIVES]:["OES_standard_derivatives",!0],[rr.GLSL_TEXTURE_LOD]:["EXT_shader_texture_lod",!0]},y4=2;function n8(c,o){return lM(c,o)}function lM(c,o){return o=Array.isArray(o)?o:[o],o.every(u=&gt;cM(c,u))}function x4(c){c.luma=c.luma||{},c.luma.caps=c.luma.caps||{};for(const o in aM)c.luma.caps[o]===void 0&amp;&amp;(c.luma.caps[o]=cM(c,o));return c.luma.caps}function cM(c,o){return c.luma=c.luma||{},c.luma.caps=c.luma.caps||{},c.luma.caps[o]===void 0&amp;&amp;(c.luma.caps[o]=v4(c,o)),c.luma.caps[o]||Ye.log(y4,"Feature: ".concat(o," not supported"))(),c.luma.caps[o]}function v4(c,o){const u=aM[o];qe(u,o);let p;const g=Li(c)&amp;&amp;u[1]||u[0];if(typeof g=="function")p=g(c);else if(Array.isArray(g)){p=!0;for(const v of g)p=p&amp;&amp;!!c.getExtension(v)}else typeof g=="string"?p=!!c.getExtension(g):typeof g=="boolean"?p=g:qe(!1);return p}const vS="Multiple render targets not supported";class Cr extends ka{get[Symbol.toStringTag](){return"Framebuffer"}static isSupported(o){let u=arguments.length&gt;1&amp;&amp;arguments[1]!==void 0?arguments[1]:{};const{colorBufferFloat:p,colorBufferHalfFloat:g}=u;let v=!0;return p&amp;&amp;(v=!!(o.getExtension("EXT_color_buffer_float")||o.getExtension("WEBGL_color_buffer_float")||o.getExtension("OES_texture_float"))),g&amp;&amp;(v=v&amp;&amp;!!(o.getExtension("EXT_color_buffer_float")||o.getExtension("EXT_color_buffer_half_float"))),v}static getDefaultFramebuffer(o){return o.luma=o.luma||{},o.luma.defaultFramebuffer=o.luma.defaultFramebuffer||new Cr(o,{id:"default-framebuffer",handle:null,attachments:{}}),o.luma.defaultFramebuffer}get MAX_COLOR_ATTACHMENTS(){const o=Vr(this.gl);return o.getParameter(o.MAX_COLOR_ATTACHMENTS)}get MAX_DRAW_BUFFERS(){const o=Vr(this.gl);return o.getParameter(o.MAX_DRAW_BUFFERS)}constructor(o){let u=arguments.length&gt;1&amp;&amp;arguments[1]!==void 0?arguments[1]:{};super(o,u),this.width=null,this.height=null,this.attachments={},this.readBuffer=36064,this.drawBuffers=[36064],this.ownResources=[],this.initialize(u),Object.seal(this)}get color(){return this.attachments[36064]||null}get texture(){return this.attachments[36064]||null}get depth(){return this.attachments[36096]||this.attachments[33306]||null}get stencil(){return this.attachments[36128]||this.attachments[33306]||null}initialize(o){let{width:u=1,height:p=1,attachments:g=null,color:v=!0,depth:E=!0,stencil:A=!1,check:R=!0,readBuffer:L=void 0,drawBuffers:G=void 0}=o;if(qe(u&gt;=0&amp;&amp;p&gt;=0,"Width and height need to be integers"),this.width=u,this.height=p,g)for(const j in g){const H=g[j];(Array.isArray(H)?H[0]:H).resize({width:u,height:p})}else g=this._createDefaultAttachments(v,E,A,u,p);this.update({clearAttachments:!0,attachments:g,readBuffer:L,drawBuffers:G}),g&amp;&amp;R&amp;&amp;this.checkStatus()}delete(){for(const o of this.ownResources)o.delete();return super.delete(),this}update(o){let{attachments:u={},readBuffer:p,drawBuffers:g,clearAttachments:v=!1,resizeAttachments:E=!0}=o;this.attach(u,{clearAttachments:v,resizeAttachments:E});const{gl:A}=this,R=A.bindFramebuffer(36160,this.handle);return p&amp;&amp;this._setReadBuffer(p),g&amp;&amp;this._setDrawBuffers(g),A.bindFramebuffer(36160,R||null),this}resize(){let o=arguments.length&gt;0&amp;&amp;arguments[0]!==void 0?arguments[0]:{},{width:u,height:p}=o;if(this.handle===null)return qe(u===void 0&amp;&amp;p===void 0),this.width=this.gl.drawingBufferWidth,this.height=this.gl.drawingBufferHeight,this;u===void 0&amp;&amp;(u=this.gl.drawingBufferWidth),p===void 0&amp;&amp;(p=this.gl.drawingBufferHeight),u!==this.width&amp;&amp;p!==this.height&amp;&amp;Ye.log(2,"Resizing framebuffer ".concat(this.id," to ").concat(u,"x").concat(p))();for(const g in this.attachments)this.attachments[g].resize({width:u,height:p});return this.width=u,this.height=p,this}attach(o){let{clearAttachments:u=!1,resizeAttachments:p=!0}=arguments.length&gt;1&amp;&amp;arguments[1]!==void 0?arguments[1]:{};const g={};u&amp;&amp;Object.keys(this.attachments).forEach(E=&gt;{g[E]=null}),Object.assign(g,o);const v=this.gl.bindFramebuffer(36160,this.handle);for(const E in g){qe(E!==void 0,"Misspelled framebuffer binding point?");const A=Number(E),R=g[A];let L=R;if(!L)this._unattach(A);else if(L instanceof kl)this._attachRenderbuffer({attachment:A,renderbuffer:L});else if(Array.isArray(R)){const[G,j=0,H=0]=R;L=G,this._attachTexture({attachment:A,texture:G,layer:j,level:H})}else this._attachTexture({attachment:A,texture:L,layer:0,level:0});p&amp;&amp;L&amp;&amp;L.resize({width:this.width,height:this.height})}this.gl.bindFramebuffer(36160,v||null),Object.assign(this.attachments,o),Object.keys(this.attachments).filter(E=&gt;!this.attachments[E]).forEach(E=&gt;{delete this.attachments[E]})}checkStatus(){const o=this.getStatus();if(o!==36053)throw new Error(w4(o));return this}getStatus(){const{gl:o}=this,u=o.bindFramebuffer(36160,this.handle),p=o.checkFramebufferStatus(36160);return o.bindFramebuffer(36160,u||null),p}clear(){let o=arguments.length&gt;0&amp;&amp;arguments[0]!==void 0?arguments[0]:{};const{color:u,depth:p,stencil:g,drawBuffers:v=[]}=o,E=this.gl.bindFramebuffer(36160,this.handle);return(u||p||g)&amp;&amp;nM(this.gl,{color:u,depth:p,stencil:g}),v.forEach((A,R)=&gt;{p4(this.gl,{drawBuffer:R,value:A})}),this.gl.bindFramebuffer(36160,E||null),this}readPixels(){return Ye.error("Framebuffer.readPixels() is no logner supported, use readPixelsToArray(framebuffer)")(),null}readPixelsToBuffer(){return Ye.error("Framebuffer.readPixelsToBuffer()is no logner supported, use readPixelsToBuffer(framebuffer)")(),null}copyToDataUrl(){return Ye.error("Framebuffer.copyToDataUrl() is no logner supported, use copyToDataUrl(framebuffer)")(),null}copyToImage(){return Ye.error("Framebuffer.copyToImage() is no logner supported, use copyToImage(framebuffer)")(),null}copyToTexture(){return Ye.error("Framebuffer.copyToTexture({...}) is no logner supported, use copyToTexture(source, target, opts})")(),null}blit(){return Ye.error("Framebuffer.blit({...}) is no logner supported, use blit(source, target, opts)")(),null}invalidate(o){let{attachments:u=[],x:p=0,y:g=0,width:v,height:E}=o;const A=Vr(this.gl),R=A.bindFramebuffer(36008,this.handle);return p===0&amp;&amp;g===0&amp;&amp;v===void 0&amp;&amp;E===void 0?A.invalidateFramebuffer(36008,u):A.invalidateFramebuffer(36008,u,p,g,v,E),A.bindFramebuffer(36008,R),this}getAttachmentParameter(o,u,p){let g=this._getAttachmentParameterFallback(u);return g===null&amp;&amp;(this.gl.bindFramebuffer(36160,this.handle),g=this.gl.getFramebufferAttachmentParameter(36160,o,u),this.gl.bindFramebuffer(36160,null)),p&amp;&amp;g&gt;1e3&amp;&amp;(g=Ia(this.gl,g)),g}getAttachmentParameters(){let o=arguments.length&gt;0&amp;&amp;arguments[0]!==void 0?arguments[0]:36064,u=arguments.length&gt;1?arguments[1]:void 0,p=arguments.length&gt;2&amp;&amp;arguments[2]!==void 0?arguments[2]:this.constructor.ATTACHMENT_PARAMETERS||[];const g={};for(const v of p){const E=u?Ia(this.gl,v):v;g[E]=this.getAttachmentParameter(o,v,u)}return g}getParameters(){let o=arguments.length&gt;0&amp;&amp;arguments[0]!==void 0?arguments[0]:!0;const u=Object.keys(this.attachments),p={};for(const g of u){const v=Number(g),E=o?Ia(this.gl,v):v;p[E]=this.getAttachmentParameters(v,o)}return p}show(){return typeof window&lt;"u"&amp;&amp;window.open(xS(this),"luma-debug-texture"),this}log(){let o=arguments.length&gt;0&amp;&amp;arguments[0]!==void 0?arguments[0]:0,u=arguments.length&gt;1&amp;&amp;arguments[1]!==void 0?arguments[1]:"";if(o&gt;Ye.level||typeof window&gt;"u")return this;u=u||"Framebuffer ".concat(this.id);const p=xS(this,{targetMaxHeight:100});return Ye.image({logLevel:o,message:u,image:p},u)(),this}bind(){let{target:o=36160}=arguments.length&gt;0&amp;&amp;arguments[0]!==void 0?arguments[0]:{};return this.gl.bindFramebuffer(o,this.handle),this}unbind(){let{target:o=36160}=arguments.length&gt;0&amp;&amp;arguments[0]!==void 0?arguments[0]:{};return this.gl.bindFramebuffer(o,null),this}_createDefaultAttachments(o,u,p,g,v){let E=null;return o&amp;&amp;(E=E||{},E[36064]=new $l(this.gl,{id:"".concat(this.id,"-color0"),pixels:null,format:6408,type:5121,width:g,height:v,mipmaps:!1,parameters:{10241:9729,10240:9729,10242:33071,10243:33071}}),this.ownResources.push(E[36064])),u&amp;&amp;p?(E=E||{},E[33306]=new kl(this.gl,{id:"".concat(this.id,"-depth-stencil"),format:35056,width:g,height:111}),this.ownResources.push(E[33306])):u?(E=E||{},E[36096]=new kl(this.gl,{id:"".concat(this.id,"-depth"),format:33189,width:g,height:v}),this.ownResources.push(E[36096])):p&amp;&amp;qe(!1),E}_unattach(o){const u=this.attachments[o];u&amp;&amp;(u instanceof kl?this.gl.framebufferRenderbuffer(36160,o,36161,null):this.gl.framebufferTexture2D(36160,o,3553,null,0),delete this.attachments[o])}_attachRenderbuffer(o){let{attachment:u=36064,renderbuffer:p}=o;const{gl:g}=this;g.framebufferRenderbuffer(36160,u,36161,p.handle),this.attachments[u]=p}_attachTexture(o){let{attachment:u=36064,texture:p,layer:g,level:v}=o;const{gl:E}=this;switch(E.bindTexture(p.target,p.handle),p.target){case 35866:case 32879:Vr(E).framebufferTextureLayer(36160,u,p.target,v,g);break;case 34067:const R=b4(g);E.framebufferTexture2D(36160,u,R,p.handle,v);break;case 3553:E.framebufferTexture2D(36160,u,3553,p.handle,v);break;default:qe(!1,"Illegal texture type")}E.bindTexture(p.target,null),this.attachments[u]=p}_setReadBuffer(o){const u=KF(this.gl);u?u.readBuffer(o):qe(o===36064||o===1029,vS),this.readBuffer=o}_setDrawBuffers(o){const{gl:u}=this,p=Vr(u);if(p)p.drawBuffers(o);else{const g=u.getExtension("WEBGL_draw_buffers");g?g.drawBuffersWEBGL(o):qe(o.length===1&amp;&amp;(o[0]===36064||o[0]===1029),vS)}this.drawBuffers=o}_getAttachmentParameterFallback(o){const u=x4(this.gl);switch(o){case 36052:return u.WEBGL2?null:0;case 33298:case 33299:case 33300:case 33301:case 33302:case 33303:return u.WEBGL2?null:8;case 33297:return u.WEBGL2?null:5125;case 33296:return!u.WEBGL2&amp;&amp;!u.EXT_sRGB?9729:null;default:return null}}_createHandle(){return this.gl.createFramebuffer()}_deleteHandle(){this.gl.deleteFramebuffer(this.handle)}_bindHandle(o){return this.gl.bindFramebuffer(36160,o)}}function b4(c){return c&lt;34069?c+34069:c}function w4(c){return(Cr.STATUS||{})[c]||"Framebuffer error ".concat(c)}const T4=[36049,36048,33296,33298,33299,33300,33301,33302,33303];Cr.ATTACHMENT_PARAMETERS=T4;function s8(c,o){qe(c instanceof $l||c instanceof iM||c instanceof c4);const u=c.constructor,{gl:p,width:g,height:v,format:E,type:A,dataFormat:R,border:L,mipmaps:G}=c,j=Object.assign({width:g,height:v,format:E,type:A,dataFormat:R,border:L,mipmaps:G},o);return new u(p,j)}function E4(c,o){const{gl:u,width:p,height:g,id:v}=c;return new Cr(u,Object.assign({},o,{id:"framebuffer-for-".concat(v),width:p,height:g,attachments:{36064:c}}))}function af(c){let o=arguments.length&gt;1&amp;&amp;arguments[1]!==void 0?arguments[1]:"unnamed";const u=/#define[\s*]SHADER_NAME[\s*]([A-Za-z0-9_-]+)[\s*]/,p=c.match(u);return p?p[1]:o}const S4=35632,A4=35633;function M4(c){switch(c){case S4:return"fragment";case A4:return"vertex";default:return"unknown type"}}function I4(c,o,u,p){const g=c.split(/\r?\n/),v={},E={},A=p||af(o)||"(unnamed)",R="".concat(M4(u)," shader ").concat(A);for(let G=0;G&lt;g.length;G++){const j=g[G];if(j.length&lt;=1)continue;const H=j.split(":"),ht=H[0],mt=parseInt(H[2],10);if(isNaN(mt))throw new Error("GLSL compilation error in ".concat(R,": ").concat(c));ht!=="WARNING"?v[mt]=j:E[mt]=j}const L=P4(o);return{shaderName:R,errors:bS(v,L),warnings:bS(E,L)}}function bS(c,o){let u="";for(let p=0;p&lt;o.length;p++){const g=o[p];if(!(!c[p+3]&amp;&amp;!c[p+2]&amp;&amp;!c[p+1])&amp;&amp;(u+="".concat(g,`
`),c[p+1])){const v=c[p+1],E=v.split(":",3),A=E[0],R=parseInt(E[1],10)||0,L=v.substring(E.join(":").length+1).trim();u+=uM("^^^ ".concat(A,": ").concat(L,`

`),R)}}return u}function P4(c){let o=arguments.length&gt;1&amp;&amp;arguments[1]!==void 0?arguments[1]:1,u=arguments.length&gt;2&amp;&amp;arguments[2]!==void 0?arguments[2]:": ";const p=c.split(/\r?\n/),g=String(p.length+o-1).length;return p.map((v,E)=&gt;{const A=String(E+o),R=A.length;return uM(A,g-R)+u+v})}function uM(c,o){let u="";for(let p=0;p&lt;o;++p)u+=" ";return"".concat(u).concat(c)}const C4="Shader: GLSL source code must be a JavaScript string";class bu extends ka{get[Symbol.toStringTag](){return"Shader"}static getTypeName(o){switch(o){case 35633:return"vertex-shader";case 35632:return"fragment-shader";default:return qe(!1),"unknown"}}constructor(o,u){Lf(o),qe(typeof u.source=="string",C4);const p=af(u.source,null)||u.id||xu("unnamed ".concat(bu.getTypeName(u.shaderType)));super(o,{id:p}),this.shaderType=u.shaderType,this.source=u.source,this.initialize(u)}initialize(o){let{source:u}=o;const p=af(u,null);p&amp;&amp;(this.id=xu(p)),this._compile(u)}getParameter(o){return this.gl.getShaderParameter(this.handle,o)}toString(){return"".concat(bu.getTypeName(this.shaderType),":").concat(this.id)}getName(){return af(this.source)||"unnamed-shader"}getSource(){return this.gl.getShaderSource(this.handle)}getTranslatedSource(){const o=this.gl.getExtension("WEBGL_debug_shaders");return o?o.getTranslatedShaderSource(this.handle):"No translated source available. WEBGL_debug_shaders not implemented"}_compile(){let o=arguments.length&gt;0&amp;&amp;arguments[0]!==void 0?arguments[0]:this.source;if(o.startsWith("#version ")||(o=`#version 100
`.concat(o)),this.source=o,this.gl.shaderSource(this.handle,this.source),this.gl.compileShader(this.handle),!this.getParameter(35713)){const p=this.gl.getShaderInfoLog(this.handle),{shaderName:g,errors:v,warnings:E}=I4(p,this.source,this.shaderType,this.id);throw Ye.error("GLSL compilation errors in ".concat(g,`
`).concat(v))(),Ye.warn("GLSL compilation warnings in ".concat(g,`
`).concat(E))(),new Error("GLSL compilation errors in ".concat(g))}}_deleteHandle(){this.gl.deleteShader(this.handle)}_getOptsFromHandle(){return{type:this.getParameter(35663),source:this.getSource()}}}class Eg extends bu{get[Symbol.toStringTag](){return"VertexShader"}constructor(o,u){typeof u=="string"&amp;&amp;(u={source:u}),super(o,Object.assign({},u,{shaderType:35633}))}_createHandle(){return this.gl.createShader(35633)}}class Sg extends bu{get[Symbol.toStringTag](){return"FragmentShader"}constructor(o,u){typeof u=="string"&amp;&amp;(u={source:u}),super(o,Object.assign({},u,{shaderType:35632}))}_createHandle(){return this.gl.createShader(35632)}}const L4={5126:Wi.bind(null,"uniform1fv",gn,1,Or),35664:Wi.bind(null,"uniform2fv",gn,2,Or),35665:Wi.bind(null,"uniform3fv",gn,3,Or),35666:Wi.bind(null,"uniform4fv",gn,4,Or),5124:Wi.bind(null,"uniform1iv",Vo,1,Or),35667:Wi.bind(null,"uniform2iv",Vo,2,Or),35668:Wi.bind(null,"uniform3iv",Vo,3,Or),35669:Wi.bind(null,"uniform4iv",Vo,4,Or),35670:Wi.bind(null,"uniform1iv",Vo,1,Or),35671:Wi.bind(null,"uniform2iv",Vo,2,Or),35672:Wi.bind(null,"uniform3iv",Vo,3,Or),35673:Wi.bind(null,"uniform4iv",Vo,4,Or),35674:Wi.bind(null,"uniformMatrix2fv",gn,4,eo),35675:Wi.bind(null,"uniformMatrix3fv",gn,9,eo),35676:Wi.bind(null,"uniformMatrix4fv",gn,16,eo),35678:Ir,35680:Ir,5125:Wi.bind(null,"uniform1uiv",qd,1,Or),36294:Wi.bind(null,"uniform2uiv",qd,2,Or),36295:Wi.bind(null,"uniform3uiv",qd,3,Or),36296:Wi.bind(null,"uniform4uiv",qd,4,Or),35685:Wi.bind(null,"uniformMatrix2x3fv",gn,6,eo),35686:Wi.bind(null,"uniformMatrix2x4fv",gn,8,eo),35687:Wi.bind(null,"uniformMatrix3x2fv",gn,6,eo),35688:Wi.bind(null,"uniformMatrix3x4fv",gn,12,eo),35689:Wi.bind(null,"uniformMatrix4x2fv",gn,8,eo),35690:Wi.bind(null,"uniformMatrix4x3fv",gn,12,eo),35678:Ir,35680:Ir,35679:Ir,35682:Ir,36289:Ir,36292:Ir,36293:Ir,36298:Ir,36299:Ir,36300:Ir,36303:Ir,36306:Ir,36307:Ir,36308:Ir,36311:Ir},R4={},D4={},O4={},wS=[0];function Iy(c,o,u,p){o===1&amp;&amp;typeof c=="boolean"&amp;&amp;(c=c?1:0),Number.isFinite(c)&amp;&amp;(wS[0]=c,c=wS);const g=c.length;if(g%o&amp;&amp;Ye.warn("Uniform size should be multiples of ".concat(o),c)(),c instanceof u)return c;let v=p[g];v||(v=new u(g),p[g]=v);for(let E=0;E&lt;g;E++)v[E]=c[E];return v}function gn(c,o){return Iy(c,o,Float32Array,R4)}function Vo(c,o){return Iy(c,o,Int32Array,D4)}function qd(c,o){return Iy(c,o,Uint32Array,O4)}function TS(c,o,u){const p=L4[u.type];if(!p)throw new Error("Unknown GLSL uniform type ".concat(u.type));return p().bind(null,c,o)}function k4(c){if(c[c.length-1]!=="]")return{name:c,length:1,isArray:!1};const o=/([^[]*)(\[[0-9]+\])?/,u=c.match(o);if(!u||u.length&lt;2)throw new Error("Failed to parse GLSL uniform name ".concat(c));return{name:u[1],length:u[2]||1,isArray:!!u[2]}}function z4(c,o,u){for(const p in c){const g=c[p];if((!u||!!u[p])&amp;&amp;!F4(g))throw o=o?"".concat(o," "):"",console.error("".concat(o," Bad uniform ").concat(p),g),new Error("".concat(o," Bad uniform ").concat(p))}return!0}function F4(c){return Array.isArray(c)||ArrayBuffer.isView(c)?N4(c):isFinite(c)||c===!0||c===!1||c instanceof La||c instanceof kl?!0:c instanceof Cr?!!c.texture:!1}function B4(c,o,u){if(Array.isArray(u)||ArrayBuffer.isView(u))if(c[o]){const p=c[o];for(let g=0,v=u.length;g&lt;v;++g)p[g]=u[g]}else c[o]=u.slice();else c[o]=u}function N4(c){if(c.length===0)return!1;const o=Math.min(c.length,16);for(let u=0;u&lt;o;++u)if(!Number.isFinite(c[u]))return!1;return!0}function Ir(){let c=null;return(o,u,p)=&gt;{const g=c!==p;return g&amp;&amp;(o.uniform1i(u,p),c=p),g}}function Wi(c,o,u,p){let g=null,v=null;return(E,A,R)=&gt;{const L=o(R,u),G=L.length;let j=!1;if(g===null)g=new Float32Array(G),v=G,j=!0;else{qe(v===G,"Uniform length cannot change.");for(let H=0;H&lt;G;++H)if(L[H]!==g[H]){j=!0;break}}return j&amp;&amp;(p(E,c,A,L),g.set(L)),j}}function Or(c,o,u,p){c[o](u,p)}function eo(c,o,u,p){c[o](u,!1,p)}const U4=5120,V4=5121,j4=5122,G4=5123,ES=0,Zd=1,H4=2,W4=3,$d=4,q4=5,Z4=6,br=5126,$4=35664,X4=35665,Y4=35666,lu=5124,K4=35667,J4=35668,Q4=35669,cu=5125,t5=36294,e5=36295,i5=36296,r5=35670,n5=35671,s5=35672,o5=35673,a5=35674,l5=35675,c5=35676,u5=35685,h5=35686,d5=35687,f5=35688,p5=35689,m5=35690,Xg={[br]:[br,1,"float"],[$4]:[br,2,"vec2"],[X4]:[br,3,"vec3"],[Y4]:[br,4,"vec4"],[lu]:[lu,1,"int"],[K4]:[lu,2,"ivec2"],[J4]:[lu,3,"ivec3"],[Q4]:[lu,4,"ivec4"],[cu]:[cu,1,"uint"],[t5]:[cu,2,"uvec2"],[e5]:[cu,3,"uvec3"],[i5]:[cu,4,"uvec4"],[r5]:[br,1,"bool"],[n5]:[br,2,"bvec2"],[s5]:[br,3,"bvec3"],[o5]:[br,4,"bvec4"],[a5]:[br,8,"mat2"],[u5]:[br,8,"mat2x3"],[h5]:[br,8,"mat2x4"],[l5]:[br,12,"mat3"],[d5]:[br,12,"mat3x2"],[f5]:[br,12,"mat3x4"],[c5]:[br,16,"mat4"],[p5]:[br,16,"mat4x2"],[m5]:[br,16,"mat4x3"]};function _5(c){switch(c){case ES:return ES;case Zd:return Zd;case W4:return Zd;case H4:return Zd;case $d:return $d;case q4:return $d;case Z4:return $d;default:return qe(!1),0}}function SS(c){const o=Xg[c];if(!o)return null;const[u,p]=o;return{type:u,components:p}}function o8(c,o){switch(c){case U4:case V4:case j4:case G4:c=br;break}for(const u in Xg){const[p,g,v]=Xg[u];if(p===c&amp;&amp;g===o)return{glType:u,name:v}}return null}class g5{constructor(o){this.id=o.id,this.attributeInfos=[],this.attributeInfosByName={},this.attributeInfosByLocation=[],this.varyingInfos=[],this.varyingInfosByName={},Object.seal(this),this._readAttributesFromProgram(o),this._readVaryingsFromProgram(o)}getAttributeInfo(o){const u=Number(o);return Number.isFinite(u)?this.attributeInfosByLocation[u]:this.attributeInfosByName[o]||null}getAttributeLocation(o){const u=this.getAttributeInfo(o);return u?u.location:-1}getAttributeAccessor(o){const u=this.getAttributeInfo(o);return u?u.accessor:null}getVaryingInfo(o){const u=Number(o);return Number.isFinite(u)?this.varyingInfos[u]:this.varyingInfosByName[o]||null}getVaryingIndex(o){const u=this.getVaryingInfo();return u?u.location:-1}getVaryingAccessor(o){const u=this.getVaryingInfo();return u?u.accessor:null}_readAttributesFromProgram(o){const{gl:u}=o,p=u.getProgramParameter(o.handle,35721);for(let g=0;g&lt;p;g++){const{name:v,type:E,size:A}=u.getActiveAttrib(o.handle,g),R=u.getAttribLocation(o.handle,v);R&gt;=0&amp;&amp;this._addAttribute(R,v,E,A)}this.attributeInfos.sort((g,v)=&gt;g.location-v.location)}_readVaryingsFromProgram(o){const{gl:u}=o;if(!Li(u))return;const p=u.getProgramParameter(o.handle,35971);for(let g=0;g&lt;p;g++){const{name:v,type:E,size:A}=u.getTransformFeedbackVarying(o.handle,g);this._addVarying(g,v,E,A)}this.varyingInfos.sort((g,v)=&gt;g.location-v.location)}_addAttribute(o,u,p,g){const{type:v,components:E}=SS(p),A={type:v,size:g*E};this._inferProperties(o,u,A);const R={location:o,name:u,accessor:new kn(A)};this.attributeInfos.push(R),this.attributeInfosByLocation[o]=R,this.attributeInfosByName[R.name]=R}_inferProperties(o,u,p){/instance/i.test(u)&amp;&amp;(p.divisor=1)}_addVarying(o,u,p,g){const{type:v,components:E}=SS(p),A=new kn({type:v,size:g*E}),R={location:o,name:u,accessor:A};this.varyingInfos.push(R),this.varyingInfosByName[R.name]=R}}const AS=4,y5=35981,x5=["setVertexArray","setAttributes","setBuffers","unsetBuffers","use","getUniformCount","getUniformInfo","getUniformLocation","getUniformValue","getVarying","getFragDataLocation","getAttachedShaders","getAttributeCount","getAttributeLocation","getAttributeInfo"];class v5 extends ka{get[Symbol.toStringTag](){return"Program"}constructor(o){let u=arguments.length&gt;1&amp;&amp;arguments[1]!==void 0?arguments[1]:{};super(o,u),this.stubRemovedMethods("Program","v6.0",x5),this._isCached=!1,this.initialize(u),Object.seal(this),this._setId(u.id)}initialize(){let o=arguments.length&gt;0&amp;&amp;arguments[0]!==void 0?arguments[0]:{};const{hash:u,vs:p,fs:g,varyings:v,bufferMode:E=y5}=o;return this.hash=u||"",this.vs=typeof p=="string"?new Eg(this.gl,{id:"".concat(o.id,"-vs"),source:p}):p,this.fs=typeof g=="string"?new Sg(this.gl,{id:"".concat(o.id,"-fs"),source:g}):g,qe(this.vs instanceof Eg),qe(this.fs instanceof Sg),this.uniforms={},this._textureUniforms={},v&amp;&amp;v.length&gt;0&amp;&amp;(Vr(this.gl),this.varyings=v,this.gl2.transformFeedbackVaryings(this.handle,v,E)),this._compileAndLink(),this._readUniformLocationsFromLinkedProgram(),this.configuration=new g5(this),this.setProps(o)}delete(){let o=arguments.length&gt;0&amp;&amp;arguments[0]!==void 0?arguments[0]:{};return this._isCached?this:super.delete(o)}setProps(o){return"uniforms"in o&amp;&amp;this.setUniforms(o.uniforms),this}draw(o){let{logPriority:u,drawMode:p=4,vertexCount:g,offset:v=0,start:E,end:A,isIndexed:R=!1,indexType:L=5123,instanceCount:G=0,isInstanced:j=G&gt;0,vertexArray:H=null,transformFeedback:ht,framebuffer:mt,parameters:gt={},uniforms:Pt,samplers:Vt}=o;if((Pt||Vt)&amp;&amp;(Ye.deprecated("Program.draw({uniforms})","Program.setUniforms(uniforms)")(),this.setUniforms(Pt||{})),Ye.priority&gt;=u){const Nt=mt?mt.id:"default",jt="mode=".concat(Ia(this.gl,p)," verts=").concat(g," ")+"instances=".concat(G," indexType=").concat(Ia(this.gl,L)," ")+"isInstanced=".concat(j," isIndexed=").concat(R," ")+"Framebuffer=".concat(Nt);Ye.log(u,jt)()}return qe(H),this.gl.useProgram(this.handle),!this._areTexturesRenderable()||g===0||j&amp;&amp;G===0?!1:(H.bindForDraw(g,G,()=&gt;{if(mt!==void 0&amp;&amp;(gt=Object.assign({},gt,{framebuffer:mt})),ht){const Nt=_5(p);ht.begin(Nt)}this._bindTextures(),As(this.gl,gt,()=&gt;{R&amp;&amp;j?this.gl2.drawElementsInstanced(p,g,L,v,G):R&amp;&amp;Li(this.gl)&amp;&amp;!isNaN(E)&amp;&amp;!isNaN(A)?this.gl2.drawRangeElements(p,E,A,g,L,v):R?this.gl.drawElements(p,g,L,v):j?this.gl2.drawArraysInstanced(p,v,g,G):this.gl.drawArrays(p,v,g)}),ht&amp;&amp;ht.end()}),!0)}setUniforms(){let o=arguments.length&gt;0&amp;&amp;arguments[0]!==void 0?arguments[0]:{};Ye.priority&gt;=2&amp;&amp;z4(o,this.id,this._uniformSetters),this.gl.useProgram(this.handle);for(const u in o){const p=o[u],g=this._uniformSetters[u];if(g){let v=p,E=!1;if(v instanceof Cr&amp;&amp;(v=v.texture),v instanceof La)if(E=this.uniforms[u]!==p,E){g.textureIndex===void 0&amp;&amp;(g.textureIndex=this._textureIndexCounter++);const A=v,{textureIndex:R}=g;A.bind(R),v=R,this._textureUniforms[u]=A}else v=g.textureIndex;else this._textureUniforms[u]&amp;&amp;delete this._textureUniforms[u];(g(v)||E)&amp;&amp;B4(this.uniforms,u,p)}}return this}_areTexturesRenderable(){let o=!0;for(const u in this._textureUniforms){const p=this._textureUniforms[u];p.update(),o=o&amp;&amp;p.loaded}return o}_bindTextures(){for(const o in this._textureUniforms){const u=this._uniformSetters[o].textureIndex;this._textureUniforms[o].bind(u)}}_createHandle(){return this.gl.createProgram()}_deleteHandle(){this.gl.deleteProgram(this.handle)}_getOptionsFromHandle(o){const u=this.gl.getAttachedShaders(o),p={};for(const g of u)switch(this.gl.getShaderParameter(this.handle,35663)){case 35633:p.vs=new Eg({handle:g});break;case 35632:p.fs=new Sg({handle:g});break}return p}_getParameter(o){return this.gl.getProgramParameter(this.handle,o)}_setId(o){if(!o){const u=this._getName();this.id=xu(u)}}_getName(){let o=this.vs.getName()||this.fs.getName();return o=o.replace(/shader/i,""),o=o?"".concat(o,"-program"):"program",o}_compileAndLink(){const{gl:o}=this;if(o.attachShader(this.handle,this.vs.handle),o.attachShader(this.handle,this.fs.handle),Ye.time(AS,"linkProgram for ".concat(this._getName()))(),o.linkProgram(this.handle),Ye.timeEnd(AS,"linkProgram for ".concat(this._getName()))(),o.debug||Ye.level&gt;0){if(!o.getProgramParameter(this.handle,35714))throw new Error("Error linking: ".concat(o.getProgramInfoLog(this.handle)));if(o.validateProgram(this.handle),!o.getProgramParameter(this.handle,35715))throw new Error("Error validating: ".concat(o.getProgramInfoLog(this.handle)))}}_readUniformLocationsFromLinkedProgram(){const{gl:o}=this;this._uniformSetters={},this._uniformCount=this._getParameter(35718);for(let u=0;u&lt;this._uniformCount;u++){const p=this.gl.getActiveUniform(this.handle,u),{name:g}=k4(p.name);let v=o.getUniformLocation(this.handle,g);if(this._uniformSetters[g]=TS(o,v,p),p.size&gt;1)for(let E=0;E&lt;p.size;E++)v=o.getUniformLocation(this.handle,"".concat(g,"[").concat(E,"]")),this._uniformSetters["".concat(g,"[").concat(E,"]")]=TS(o,v,p)}this._textureIndexCounter=0}getActiveUniforms(o,u){return this.gl2.getActiveUniforms(this.handle,o,u)}getUniformBlockIndex(o){return this.gl2.getUniformBlockIndex(this.handle,o)}getActiveUniformBlockParameter(o,u){return this.gl2.getActiveUniformBlockParameter(this.handle,o,u)}uniformBlockBinding(o,u){this.gl2.uniformBlockBinding(this.handle,o,u)}}const b5=34918,w5=34919,T5=35007,E5=36795,S5=35976,A5=35887,M5=36202;class _f extends ka{get[Symbol.toStringTag](){return"Query"}static isSupported(o){let u=arguments.length&gt;1&amp;&amp;arguments[1]!==void 0?arguments[1]:[];const p=Li(o),g=lM(o,rr.TIMER_QUERY);let v=p||g;for(const E of u)switch(E){case"queries":v=v&amp;&amp;p;break;case"timers":v=v&amp;&amp;g;break;default:qe(!1)}return v}constructor(o){let u=arguments.length&gt;1&amp;&amp;arguments[1]!==void 0?arguments[1]:{};super(o,u),this.target=null,this._queryPending=!1,this._pollingPromise=null,Object.seal(this)}beginTimeElapsedQuery(){return this.begin(T5)}beginOcclusionQuery(){let{conservative:o=!1}=arguments.length&gt;0&amp;&amp;arguments[0]!==void 0?arguments[0]:{};return this.begin(o?M5:A5)}beginTransformFeedbackQuery(){return this.begin(S5)}begin(o){return this._queryPending?this:(this.target=o,this.gl2.beginQuery(this.target,this.handle),this)}end(){return this._queryPending?this:(this.target&amp;&amp;(this.gl2.endQuery(this.target),this.target=null,this._queryPending=!0),this)}isResultAvailable(){if(!this._queryPending)return!1;const o=this.gl2.getQueryParameter(this.handle,w5);return o&amp;&amp;(this._queryPending=!1),o}isTimerDisjoint(){return this.gl2.getParameter(E5)}getResult(){return this.gl2.getQueryParameter(this.handle,b5)}getTimerMilliseconds(){return this.getResult()/1e6}createPoll(){let o=arguments.length&gt;0&amp;&amp;arguments[0]!==void 0?arguments[0]:Number.POSITIVE_INFINITY;if(this._pollingPromise)return this._pollingPromise;let u=0;return this._pollingPromise=new Promise((p,g)=&gt;{const v=()=&gt;{this.isResultAvailable()?(p(this.getResult()),this._pollingPromise=null):u++&gt;o?(g("Timed out"),this._pollingPromise=null):requestAnimationFrame(v)};requestAnimationFrame(v)}),this._pollingPromise}_createHandle(){return _f.isSupported(this.gl)?this.gl2.createQuery():null}_deleteHandle(){this.gl2.deleteQuery(this.handle)}}const MS=oo()&amp;&amp;typeof document&lt;"u";let I5=0;class P5{constructor(){let o=arguments.length&gt;0&amp;&amp;arguments[0]!==void 0?arguments[0]:{};const{onCreateContext:u=Pt=&gt;JA(Pt),onAddHTML:p=null,onInitialize:g=()=&gt;{},onRender:v=()=&gt;{},onFinalize:E=()=&gt;{},onError:A,gl:R=null,glOptions:L={},debug:G=!1,createFramebuffer:j=!1,autoResizeViewport:H=!0,autoResizeDrawingBuffer:ht=!0,stats:mt=Aa.get("animation-loop-".concat(I5++))}=o;let{useDevicePixels:gt=!0}=o;"useDevicePixelRatio"in o&amp;&amp;(Ye.deprecated("useDevicePixelRatio","useDevicePixels")(),gt=o.useDevicePixelRatio),this.props={onCreateContext:u,onAddHTML:p,onInitialize:g,onRender:v,onFinalize:E,onError:A,gl:R,glOptions:L,debug:G,createFramebuffer:j},this.gl=R,this.needsRedraw=null,this.timeline=null,this.stats=mt,this.cpuTime=this.stats.get("CPU Time"),this.gpuTime=this.stats.get("GPU Time"),this.frameRate=this.stats.get("Frame Rate"),this._initialized=!1,this._running=!1,this._animationFrameId=null,this._nextFramePromise=null,this._resolveNextFrame=null,this._cpuStartTime=0,this.setProps({autoResizeViewport:H,autoResizeDrawingBuffer:ht,useDevicePixels:gt}),this.start=this.start.bind(this),this.stop=this.stop.bind(this),this._pageLoadPromise=null,this._onMousemove=this._onMousemove.bind(this),this._onMouseleave=this._onMouseleave.bind(this)}delete(){this.stop(),this._setDisplay(null)}setNeedsRedraw(o){return qe(typeof o=="string"),this.needsRedraw=this.needsRedraw||o,this}setProps(o){return"autoResizeViewport"in o&amp;&amp;(this.autoResizeViewport=o.autoResizeViewport),"autoResizeDrawingBuffer"in o&amp;&amp;(this.autoResizeDrawingBuffer=o.autoResizeDrawingBuffer),"useDevicePixels"in o&amp;&amp;(this.useDevicePixels=o.useDevicePixels),this}start(){let o=arguments.length&gt;0&amp;&amp;arguments[0]!==void 0?arguments[0]:{};if(this._running)return this;this._running=!0;const u=this._getPageLoadPromise().then(()=&gt;!this._running||this._initialized?null:(this._createWebGLContext(o),this._createFramebuffer(),this._startEventHandling(),this._initializeCallbackData(),this._updateCallbackData(),this._resizeCanvasDrawingBuffer(),this._resizeViewport(),this._gpuTimeQuery=_f.isSupported(this.gl,["timers"])?new _f(this.gl):null,this._initialized=!0,this.onInitialize(this.animationProps))).then(p=&gt;{this._running&amp;&amp;(this._addCallbackData(p||{}),p!==!1&amp;&amp;this._startLoop())});return this.props.onError&amp;&amp;u.catch(this.props.onError),this}redraw(){return this.isContextLost()?this:(this._beginTimers(),this._setupFrame(),this._updateCallbackData(),this._renderFrame(this.animationProps),this._clearNeedsRedraw(),this.offScreen&amp;&amp;this.gl.commit&amp;&amp;this.gl.commit(),this._resolveNextFrame&amp;&amp;(this._resolveNextFrame(this),this._nextFramePromise=null,this._resolveNextFrame=null),this._endTimers(),this)}stop(){return this._running&amp;&amp;(this._finalizeCallbackData(),this._cancelAnimationFrame(this._animationFrameId),this._nextFramePromise=null,this._resolveNextFrame=null,this._animationFrameId=null,this._running=!1),this}attachTimeline(o){return this.timeline=o,this.timeline}detachTimeline(){this.timeline=null}waitForRender(){return this.setNeedsRedraw("waitForRender"),this._nextFramePromise||(this._nextFramePromise=new Promise(o=&gt;{this._resolveNextFrame=o})),this._nextFramePromise}async toDataURL(){return this.setNeedsRedraw("toDataURL"),await this.waitForRender(),this.gl.canvas.toDataURL()}isContextLost(){return this.gl.isContextLost()}onCreateContext(){return this.props.onCreateContext(...arguments)}onInitialize(){return this.props.onInitialize(...arguments)}onRender(){return this.props.onRender(...arguments)}onFinalize(){return this.props.onFinalize(...arguments)}getHTMLControlValue(o){let u=arguments.length&gt;1&amp;&amp;arguments[1]!==void 0?arguments[1]:1;const p=document.getElementById(o);return p?Number(p.value):u}setViewParameters(){return Ye.removed("AnimationLoop.setViewParameters","AnimationLoop.setProps")(),this}_startLoop(){const o=()=&gt;{this._running&amp;&amp;(this.redraw(),this._animationFrameId=this._requestAnimationFrame(o))};this._cancelAnimationFrame(this._animationFrameId),this._animationFrameId=this._requestAnimationFrame(o)}_getPageLoadPromise(){return this._pageLoadPromise||(this._pageLoadPromise=MS?new Promise((o,u)=&gt;{if(MS&amp;&amp;document.readyState==="complete"){o(document);return}window.addEventListener("load",()=&gt;{o(document)})}):Promise.resolve({})),this._pageLoadPromise}_setDisplay(o){this.display&amp;&amp;(this.display.delete(),this.display.animationLoop=null),o&amp;&amp;(o.animationLoop=this),this.display=o}_cancelAnimationFrame(o){return this.display&amp;&amp;this.display.cancelAnimationFrame?this.display.cancelAnimationFrame(o):XB(o)}_requestAnimationFrame(o){if(this._running)return this.display&amp;&amp;this.display.requestAnimationFrame?this.display.requestAnimationFrame(o):$B(o)}_renderFrame(){if(this.display){this.display._renderFrame(...arguments);return}this.onRender(...arguments)}_clearNeedsRedraw(){this.needsRedraw=null}_setupFrame(){this._resizeCanvasDrawingBuffer(),this._resizeViewport(),this._resizeFramebuffer()}_initializeCallbackData(){this.animationProps={gl:this.gl,stop:this.stop,canvas:this.gl.canvas,framebuffer:this.framebuffer,useDevicePixels:this.useDevicePixels,needsRedraw:null,startTime:Date.now(),engineTime:0,tick:0,tock:0,time:0,_timeline:this.timeline,_loop:this,_animationLoop:this,_mousePosition:null}}_updateCallbackData(){const{width:o,height:u,aspect:p}=this._getSizeAndAspect();(o!==this.animationProps.width||u!==this.animationProps.height)&amp;&amp;this.setNeedsRedraw("drawing buffer resized"),p!==this.animationProps.aspect&amp;&amp;this.setNeedsRedraw("drawing buffer aspect changed"),this.animationProps.width=o,this.animationProps.height=u,this.animationProps.aspect=p,this.animationProps.needsRedraw=this.needsRedraw,this.animationProps.engineTime=Date.now()-this.animationProps.startTime,this.timeline&amp;&amp;this.timeline.update(this.animationProps.engineTime),this.animationProps.tick=Math.floor(this.animationProps.time/1e3*60),this.animationProps.tock++,this.animationProps.time=this.timeline?this.timeline.getTime():this.animationProps.engineTime,this.animationProps._offScreen=this.offScreen}_finalizeCallbackData(){this.onFinalize(this.animationProps)}_addCallbackData(o){typeof o=="object"&amp;&amp;o!==null&amp;&amp;(this.animationProps=Object.assign({},this.animationProps,o))}_createWebGLContext(o){if(this.offScreen=o.canvas&amp;&amp;typeof OffscreenCanvas&lt;"u"&amp;&amp;o.canvas instanceof OffscreenCanvas,o=Object.assign({},o,this.props.glOptions),this.gl=this.props.gl?Sy(this.props.gl,o):this.onCreateContext(o),!wy(this.gl))throw new Error("AnimationLoop.onCreateContext - illegal context returned");kB(this.gl),this._createInfoDiv()}_createInfoDiv(){if(this.gl.canvas&amp;&amp;this.props.onAddHTML){const o=document.createElement("div");document.body.appendChild(o),o.style.position="relative";const u=document.createElement("div");u.style.position="absolute",u.style.left="10px",u.style.bottom="10px",u.style.width="300px",u.style.background="white",o.appendChild(this.gl.canvas),o.appendChild(u);const p=this.props.onAddHTML(u);p&amp;&amp;(u.innerHTML=p)}}_getSizeAndAspect(){const o=this.gl.drawingBufferWidth,u=this.gl.drawingBufferHeight;let p=1;const{canvas:g}=this.gl;return g&amp;&amp;g.clientHeight?p=g.clientWidth/g.clientHeight:o&gt;0&amp;&amp;u&gt;0&amp;&amp;(p=o/u),{width:o,height:u,aspect:p}}_resizeViewport(){this.autoResizeViewport&amp;&amp;this.gl.viewport(0,0,this.gl.drawingBufferWidth,this.gl.drawingBufferHeight)}_resizeCanvasDrawingBuffer(){this.autoResizeDrawingBuffer&amp;&amp;UB(this.gl,{useDevicePixels:this.useDevicePixels})}_createFramebuffer(){this.props.createFramebuffer&amp;&amp;(this.framebuffer=new Cr(this.gl))}_resizeFramebuffer(){this.framebuffer&amp;&amp;this.framebuffer.resize({width:this.gl.drawingBufferWidth,height:this.gl.drawingBufferHeight})}_beginTimers(){this.frameRate.timeEnd(),this.frameRate.timeStart(),this._gpuTimeQuery&amp;&amp;this._gpuTimeQuery.isResultAvailable()&amp;&amp;!this._gpuTimeQuery.isTimerDisjoint()&amp;&amp;this.stats.get("GPU Time").addTime(this._gpuTimeQuery.getTimerMilliseconds()),this._gpuTimeQuery&amp;&amp;this._gpuTimeQuery.beginTimeElapsedQuery(),this.cpuTime.timeStart()}_endTimers(){this.cpuTime.timeEnd(),this._gpuTimeQuery&amp;&amp;this._gpuTimeQuery.end()}_startEventHandling(){const{canvas:o}=this.gl;o&amp;&amp;(o.addEventListener("mousemove",this._onMousemove),o.addEventListener("mouseleave",this._onMouseleave))}_onMousemove(o){this.animationProps._mousePosition=[o.offsetX,o.offsetY]}_onMouseleave(o){this.animationProps._mousePosition=null}}const Lu="vs",Py="fs";function Ms(c,o){if(!c)throw new Error(o||"shadertools: assertion failed.")}const Ag={number:{validate(c,o){return Number.isFinite(c)&amp;&amp;(!("max"in o)||c&lt;=o.max)&amp;&amp;(!("min"in o)||c&gt;=o.min)}},array:{validate(c,o){return Array.isArray(c)||ArrayBuffer.isView(c)}}};function C5(c){const o={};for(const u in c){const p=c[u],g=L5(p);o[u]=g}return o}function L5(c){let o=IS(c);return o==="object"?c?"type"in c?Object.assign({},c,Ag[c.type]):"value"in c?(o=IS(c.value),Object.assign({type:o},c,Ag[o])):{type:"object",value:c}:{type:"object",value:null}:Object.assign({type:o,value:c},Ag[o])}function IS(c){return Array.isArray(c)||ArrayBuffer.isView(c)?"array":typeof c}const R5="vs",D5="fs";class PS{constructor(o){let{name:u,vs:p,fs:g,dependencies:v=[],uniforms:E,getUniforms:A,deprecations:R=[],defines:L={},inject:G={},vertexShader:j,fragmentShader:H}=o;Ms(typeof u=="string"),this.name=u,this.vs=p||j,this.fs=g||H,this.getModuleUniforms=A,this.dependencies=v,this.deprecations=this._parseDeprecationDefinitions(R),this.defines=L,this.injections=O5(G),E&amp;&amp;(this.uniforms=C5(E))}getModuleSource(o){let u;switch(o){case R5:u=this.vs||"";break;case D5:u=this.fs||"";break;default:Ms(!1)}return"#define MODULE_".concat(this.name.toUpperCase().replace(/[^0-9a-z]/gi,"_"),`
`).concat(u,"// END MODULE_").concat(this.name,`

`)}getUniforms(o,u){return this.getModuleUniforms?this.getModuleUniforms(o,u):this.uniforms?this._defaultGetUniforms(o):{}}getDefines(){return this.defines}checkDeprecations(o,u){this.deprecations.forEach(p=&gt;{p.regex.test(o)&amp;&amp;(p.deprecated?u.deprecated(p.old,p.new)():u.removed(p.old,p.new)())})}_parseDeprecationDefinitions(o){return o.forEach(u=&gt;{switch(u.type){case"function":u.regex=new RegExp("\\b".concat(u.old,"\\("));break;default:u.regex=new RegExp("".concat(u.type," ").concat(u.old,";"))}}),o}_defaultGetUniforms(){let o=arguments.length&gt;0&amp;&amp;arguments[0]!==void 0?arguments[0]:{};const u={},p=this.uniforms;for(const g in p){const v=p[g];g in o&amp;&amp;!v.private?(v.validate&amp;&amp;Ms(v.validate(o[g],v),"".concat(this.name,": invalid ").concat(g)),u[g]=o[g]):u[g]=v.value}return u}}function O5(c){const o={vs:{},fs:{}};for(const u in c){let p=c[u];const g=u.slice(0,2);typeof p=="string"&amp;&amp;(p={order:0,injection:p}),o[g][u]=p}return o}function k5(c){return z5(dM(c))}function z5(c){const o={},u={};return hM({modules:c,level:0,moduleMap:o,moduleDepth:u}),Object.keys(u).sort((p,g)=&gt;u[g]-u[p]).map(p=&gt;o[p])}function hM(c){let{modules:o,level:u,moduleMap:p,moduleDepth:g}=c;if(u&gt;=5)throw new Error("Possible loop in shader dependency graph");for(const v of o)p[v.name]=v,(g[v.name]===void 0||g[v.name]&lt;u)&amp;&amp;(g[v.name]=u);for(const v of o)v.dependencies&amp;&amp;hM({modules:v.dependencies,level:u+1,moduleMap:p,moduleDepth:g})}function dM(c,o){return c.map(u=&gt;(u instanceof PS||(Ms(typeof u!="string","Shader module use by name is deprecated. Import shader module '".concat(u,"' and use it directly.")),Ms(u.name,"shader module has no name"),u=new PS(u),u.dependencies=dM(u.dependencies)),u))}function F5(){let c=arguments.length&gt;0&amp;&amp;arguments[0]!==void 0?arguments[0]:{};const o=typeof window&lt;"u"?window.navigator||{}:{},u=c.userAgent||o.userAgent||"",p=u.indexOf("MSIE ")!==-1,g=u.indexOf("Trident/")!==-1;return p||g}const B5=7936,N5=7937,U5=7938,V5=35724,Cy={GLSL_FRAG_DATA:["WEBGL_draw_buffers",!0],GLSL_FRAG_DEPTH:["EXT_frag_depth",!0],GLSL_DERIVATIVES:["OES_standard_derivatives",!0],GLSL_TEXTURE_LOD:["EXT_shader_texture_lod",!0]},Sa={};Object.keys(Cy).forEach(c=&gt;{Sa[c]=c});function j5(c){return typeof WebGL2RenderingContext&lt;"u"&amp;&amp;c instanceof WebGL2RenderingContext?!0:!!(c&amp;&amp;c._version===2)}function G5(c){const o=c.getExtension("WEBGL_debug_renderer_info"),u=c.getParameter(o&amp;&amp;o.UNMASKED_VENDOR_WEBGL||B5),p=c.getParameter(o&amp;&amp;o.UNMASKED_RENDERER_WEBGL||N5);return{gpuVendor:H5(u,p),vendor:u,renderer:p,version:c.getParameter(U5),shadingLanguageVersion:c.getParameter(V5)}}function H5(c,o){return c.match(/NVIDIA/i)||o.match(/NVIDIA/i)?"NVIDIA":c.match(/INTEL/i)||o.match(/INTEL/i)?"INTEL":c.match(/AMD/i)||o.match(/AMD/i)||c.match(/ATI/i)||o.match(/ATI/i)?"AMD":"UNKNOWN GPU"}const Mg={};function CS(c,o){let u=arguments.length&gt;2&amp;&amp;arguments[2]!==void 0?arguments[2]:{};const p=Cy[o];if(Ms(p,o),!F5(u))return!0;if(o in Mg)return Mg[o];const g=p[0],v=u.behavior||"enable",E="#extension GL_".concat(g," : ").concat(v,`
void main(void) {}`),A=c.createShader(35633);c.shaderSource(A,E),c.compileShader(A);const R=c.getShaderParameter(A,35713);return c.deleteShader(A),Mg[o]=R,R}function W5(c,o){const u=Cy[o];Ms(u,o);const p=j5(c)&amp;&amp;u[1]||u[0],g=typeof p=="string"?!!c.getExtension(p):p;return Ms(g===!1||g===!0),g}function Xd(c,o){return o=Array.isArray(o)?o:[o],o.every(u=&gt;W5(c,u))}function q5(c){switch(G5(c).gpuVendor.toLowerCase()){case"nvidia":return`#define NVIDIA_GPU
// Nvidia optimizes away the calculation necessary for emulated fp64
#define LUMA_FP64_CODE_ELIMINATION_WORKAROUND 1
`;case"intel":return`#define INTEL_GPU
// Intel optimizes away the calculation necessary for emulated fp64
#define LUMA_FP64_CODE_ELIMINATION_WORKAROUND 1
// Intel's built-in 'tan' function doesn't have acceptable precision
#define LUMA_FP32_TAN_PRECISION_WORKAROUND 1
// Intel GPU doesn't have full 32 bits precision in same cases, causes overflow
#define LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND 1
`;case"amd":return`#define AMD_GPU
`;default:return`#define DEFAULT_GPU
// Prevent driver from optimizing away the calculation necessary for emulated fp64
#define LUMA_FP64_CODE_ELIMINATION_WORKAROUND 1
// Intel's built-in 'tan' function doesn't have acceptable precision
#define LUMA_FP32_TAN_PRECISION_WORKAROUND 1
// Intel GPU doesn't have full 32 bits precision in same cases, causes overflow
#define LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND 1
`}}function Z5(c,o,u){let p=`#if (__VERSION__ &gt; 120)

# define FEATURE_GLSL_DERIVATIVES
# define FEATURE_GLSL_DRAW_BUFFERS
# define FEATURE_GLSL_FRAG_DEPTH
# define FEATURE_GLSL_TEXTURE_LOD

// DEPRECATED FLAGS, remove in v9
# define FRAG_DEPTH
# define DERIVATIVES
# define DRAW_BUFFERS
# define TEXTURE_LOD

#endif // __VERSION
`;return Xd(c,Sa.GLSL_FRAG_DEPTH)&amp;&amp;(p+=`
// FRAG_DEPTH =&gt; gl_FragDepth is available
#ifdef GL_EXT_frag_depth
#extension GL_EXT_frag_depth : enable
# define FEATURE_GLSL_FRAG_DEPTH
# define FRAG_DEPTH
# define gl_FragDepth gl_FragDepthEXT
#endif
`),Xd(c,Sa.GLSL_DERIVATIVES)&amp;&amp;CS(c,Sa.GLSL_DERIVATIVES)&amp;&amp;(p+=`
// DERIVATIVES =&gt; dxdF, dxdY and fwidth are available
#ifdef GL_OES_standard_derivatives
#extension GL_OES_standard_derivatives : enable
# define FEATURE_GLSL_DERIVATIVES
# define DERIVATIVES
#endif
`),Xd(c,Sa.GLSL_FRAG_DATA)&amp;&amp;CS(c,Sa.GLSL_FRAG_DATA,{behavior:"require"})&amp;&amp;(p+=`
// DRAW_BUFFERS =&gt; gl_FragData[] is available
#ifdef GL_EXT_draw_buffers
#extension GL_EXT_draw_buffers : require
#define FEATURE_GLSL_DRAW_BUFFERS
#define DRAW_BUFFERS
#endif
`),Xd(c,Sa.GLSL_TEXTURE_LOD)&amp;&amp;(p+=`// TEXTURE_LOD =&gt; texture2DLod etc are available
#ifdef GL_EXT_shader_texture_lod
#extension GL_EXT_shader_texture_lod : enable

# define FEATURE_GLSL_TEXTURE_LOD
# define TEXTURE_LOD

#endif
`),p}const $5=`#ifdef MODULE_LOGDEPTH
  logdepth_adjustPosition(gl_Position);
#endif
`,X5=`#ifdef MODULE_MATERIAL
  gl_FragColor = material_filterColor(gl_FragColor);
#endif

#ifdef MODULE_LIGHTING
  gl_FragColor = lighting_filterColor(gl_FragColor);
#endif

#ifdef MODULE_FOG
  gl_FragColor = fog_filterColor(gl_FragColor);
#endif

#ifdef MODULE_PICKING
  gl_FragColor = picking_filterHighlightColor(gl_FragColor);
  gl_FragColor = picking_filterPickingColor(gl_FragColor);
#endif

#ifdef MODULE_LOGDEPTH
  logdepth_setFragDepth();
#endif
`,Y5={[Lu]:$5,[Py]:X5},lf="__LUMA_INJECT_DECLARATIONS__",LS=/void\s+main\s*\([^)]*\)\s*\{\n?/,RS=/}\n?[^{}]*$/,Ig=[];function DS(c,o,u){let p=arguments.length&gt;3&amp;&amp;arguments[3]!==void 0?arguments[3]:!1;const g=o===Lu;for(const v in u){const E=u[v];E.sort((R,L)=&gt;R.order-L.order),Ig.length=E.length;for(let R=0,L=E.length;R&lt;L;++R)Ig[R]=E[R].injection;const A="".concat(Ig.join(`
`),`
`);switch(v){case"vs:#decl":g&amp;&amp;(c=c.replace(lf,A));break;case"vs:#main-start":g&amp;&amp;(c=c.replace(LS,R=&gt;R+A));break;case"vs:#main-end":g&amp;&amp;(c=c.replace(RS,R=&gt;A+R));break;case"fs:#decl":g||(c=c.replace(lf,A));break;case"fs:#main-start":g||(c=c.replace(LS,R=&gt;R+A));break;case"fs:#main-end":g||(c=c.replace(RS,R=&gt;A+R));break;default:c=c.replace(v,R=&gt;R+A)}}return c=c.replace(lf,""),p&amp;&amp;(c=c.replace(/\}\s*$/,v=&gt;v+Y5[o])),c}function a8(c){const o={};return Ms(Array.isArray(c)&amp;&amp;c.length&gt;1),c.forEach(u=&gt;{for(const p in u)o[p]=o[p]?"".concat(o[p],`
`).concat(u[p]):u[p]}),o}function Vl(c){return new RegExp("\\b".concat(c,"[ \\t]+(\\w+[ \\t]+\\w+(\\[\\w+\\])?;)"),"g")}const fM=[[/^(#version[ \t]+(100|300[ \t]+es))?[ \t]*\n/,`#version 300 es
`],[/\btexture(2D|2DProj|Cube)Lod(EXT)?\(/g,"textureLod("],[/\btexture(2D|2DProj|Cube)(EXT)?\(/g,"texture("]],K5=[...fM,[Vl("attribute"),"in $1"],[Vl("varying"),"out $1"]],J5=[...fM,[Vl("varying"),"in $1"]],pM=[[/^#version[ \t]+300[ \t]+es/,"#version 100"],[/\btexture(2D|2DProj|Cube)Lod\(/g,"texture$1LodEXT("],[/\btexture\(/g,"texture2D("],[/\btextureLod\(/g,"texture2DLodEXT("]],Q5=[...pM,[Vl("in"),"attribute $1"],[Vl("out"),"varying $1"]],tN=[...pM,[Vl("in"),"varying $1"]],Yg="gl_FragColor",Kg=/\bout[ \t]+vec4[ \t]+(\w+)[ \t]*;\n?/,eN=/void\s+main\s*\([^)]*\)\s*\{\n?/;function iN(c,o,u){switch(o){case 300:return u?gf(c,K5):rN(c);case 100:return u?gf(c,Q5):nN(c);default:throw new Error("unknown GLSL version ".concat(o))}}function gf(c,o){for(const[u,p]of o)c=c.replace(u,p);return c}function rN(c){c=gf(c,J5);const o=c.match(Kg);if(o){const u=o[1];c=c.replace(new RegExp("\\b".concat(Yg,"\\b"),"g"),u)}else{const u="fragmentColor";c=c.replace(eN,p=&gt;"out vec4 ".concat(u,`;
`).concat(p)).replace(new RegExp("\\b".concat(Yg,"\\b"),"g"),u)}return c}function nN(c){c=gf(c,tN);const o=c.match(Kg);if(o){const u=o[1];c=c.replace(Kg,"").replace(new RegExp("\\b".concat(u,"\\b"),"g"),Yg)}return c}const sN=`

`.concat(lf,`

`),mM={[Lu]:"vertex",[Py]:"fragment"},oN=`precision highp float;

`;function aN(c,o){const{vs:u,fs:p}=o,g=k5(o.modules||[]);return{gl:c,vs:OS(c,Object.assign({},o,{source:u,type:Lu,modules:g})),fs:OS(c,Object.assign({},o,{source:p,type:Py,modules:g})),getUniforms:lN(g)}}function OS(c,o){let{id:u,source:p,type:g,modules:v,defines:E={},hookFunctions:A=[],inject:R={},transpileToGLSL100:L=!1,prologue:G=!0,log:j}=o;Ms(typeof p=="string","shader source must be a string");const H=g===Lu,ht=p.split(`
`);let mt=100,gt="",Pt=p;ht[0].indexOf("#version ")===0?(mt=300,gt=ht[0],Pt=ht.slice(1).join(`
`)):gt="#version ".concat(mt);const Vt={};v.forEach(Oe=&gt;{Object.assign(Vt,Oe.getDefines())}),Object.assign(Vt,E);let Nt=G?"".concat(gt,`
`).concat(uN({id:u,source:p,type:g}),`
`).concat(cN({type:g}),`
`).concat(q5(c),`
`).concat(Z5(c),`
`).concat(hN(Vt),`
`).concat(H?"":oN,`
`):"".concat(gt,`
`);const jt=fN(A),Qt={},ae={},le={};for(const Oe in R){const Ge=typeof R[Oe]=="string"?{injection:R[Oe],order:0}:R[Oe],ve=Oe.match(/^(v|f)s:(#)?([\w-]+)$/);if(ve){const Q=ve[2],Lt=ve[3];Q?Lt==="decl"?ae[Oe]=[Ge]:le[Oe]=[Ge]:Qt[Oe]=[Ge]}else le[Oe]=[Ge]}for(const Oe of v){j&amp;&amp;Oe.checkDeprecations(Pt,j);const Ge=Oe.getModuleSource(g,mt);Nt+=Ge;const ve=Oe.injections[g];for(const Q in ve){const Lt=Q.match(/^(v|f)s:#([\w-]+)$/);if(Lt){const Ke=Lt[2]==="decl"?ae:le;Ke[Q]=Ke[Q]||[],Ke[Q].push(ve[Q])}else Qt[Q]=Qt[Q]||[],Qt[Q].push(ve[Q])}}return Nt+=sN,Nt=DS(Nt,g,ae),Nt+=dN(jt[g],Qt),Nt+=Pt,Nt=DS(Nt,g,le),Nt=iN(Nt,L?100:mt,H),Nt}function lN(c){return function(u){const p={};for(const g of c){const v=g.getUniforms(u,p);Object.assign(p,v)}return p}}function cN(c){let{type:o}=c;return`
#define SHADER_TYPE_`.concat(mM[o].toUpperCase(),`
`)}function uN(c){let{id:o,source:u,type:p}=c;return o&amp;&amp;typeof o=="string"&amp;&amp;u.indexOf("SHADER_NAME")===-1?`
#define SHADER_NAME `.concat(o,"_").concat(mM[p],`

`):""}function hN(){let c=arguments.length&gt;0&amp;&amp;arguments[0]!==void 0?arguments[0]:{},o=0,u="";for(const p in c){o===0&amp;&amp;(u+=`
// APPLICATION DEFINES
`),o++;const g=c[p];(g||Number.isFinite(g))&amp;&amp;(u+="#define ".concat(p.toUpperCase()," ").concat(c[p],`
`))}return o===0&amp;&amp;(u+=`
`),u}function dN(c,o){let u="";for(const p in c){const g=c[p];if(u+="void ".concat(g.signature,` {
`),g.header&amp;&amp;(u+="  ".concat(g.header)),o[p]){const v=o[p];v.sort((E,A)=&gt;E.order-A.order);for(const E of v)u+="  ".concat(E.injection,`
`)}g.footer&amp;&amp;(u+="  ".concat(g.footer)),u+=`}
`}return u}function fN(c){const o={vs:{},fs:{}};return c.forEach(u=&gt;{let p;typeof u!="string"?(p=u,u=p.hook):p={},u=u.trim();const[g,v]=u.split(":"),E=u.replace(/\(.+/,"");o[g][E]=Object.assign(p,{signature:v})}),o}const pN=`#ifdef LUMA_FP32_TAN_PRECISION_WORKAROUND
const float TWO_PI = 6.2831854820251465;
const float PI_2 = 1.5707963705062866;
const float PI_16 = 0.1963495463132858;

const float SIN_TABLE_0 = 0.19509032368659973;
const float SIN_TABLE_1 = 0.3826834261417389;
const float SIN_TABLE_2 = 0.5555702447891235;
const float SIN_TABLE_3 = 0.7071067690849304;

const float COS_TABLE_0 = 0.9807852506637573;
const float COS_TABLE_1 = 0.9238795042037964;
const float COS_TABLE_2 = 0.8314695954322815;
const float COS_TABLE_3 = 0.7071067690849304;

const float INVERSE_FACTORIAL_3 = 1.666666716337204e-01;
const float INVERSE_FACTORIAL_5 = 8.333333767950535e-03;
const float INVERSE_FACTORIAL_7 = 1.9841270113829523e-04;
const float INVERSE_FACTORIAL_9 = 2.75573188446287533e-06;

float sin_taylor_fp32(float a) {
  float r, s, t, x;

  if (a == 0.0) {
    return 0.0;
  }

  x = -a * a;
  s = a;
  r = a;

  r = r * x;
  t = r * INVERSE_FACTORIAL_3;
  s = s + t;

  r = r * x;
  t = r * INVERSE_FACTORIAL_5;
  s = s + t;

  r = r * x;
  t = r * INVERSE_FACTORIAL_7;
  s = s + t;

  r = r * x;
  t = r * INVERSE_FACTORIAL_9;
  s = s + t;

  return s;
}

void sincos_taylor_fp32(float a, out float sin_t, out float cos_t) {
  if (a == 0.0) {
    sin_t = 0.0;
    cos_t = 1.0;
  }
  sin_t = sin_taylor_fp32(a);
  cos_t = sqrt(1.0 - sin_t * sin_t);
}

float tan_taylor_fp32(float a) {
    float sin_a;
    float cos_a;

    if (a == 0.0) {
        return 0.0;
    }
    float z = floor(a / TWO_PI);
    float r = a - TWO_PI * z;

    float t;
    float q = floor(r / PI_2 + 0.5);
    int j = int(q);

    if (j &lt; -2 || j &gt; 2) {
        return 1.0 / 0.0;
    }

    t = r - PI_2 * q;

    q = floor(t / PI_16 + 0.5);
    int k = int(q);
    int abs_k = int(abs(float(k)));

    if (abs_k &gt; 4) {
        return 1.0 / 0.0;
    } else {
        t = t - PI_16 * q;
    }

    float u = 0.0;
    float v = 0.0;

    float sin_t, cos_t;
    float s, c;
    sincos_taylor_fp32(t, sin_t, cos_t);

    if (k == 0) {
        s = sin_t;
        c = cos_t;
    } else {
        if (abs(float(abs_k) - 1.0) &lt; 0.5) {
            u = COS_TABLE_0;
            v = SIN_TABLE_0;
        } else if (abs(float(abs_k) - 2.0) &lt; 0.5) {
            u = COS_TABLE_1;
            v = SIN_TABLE_1;
        } else if (abs(float(abs_k) - 3.0) &lt; 0.5) {
            u = COS_TABLE_2;
            v = SIN_TABLE_2;
        } else if (abs(float(abs_k) - 4.0) &lt; 0.5) {
            u = COS_TABLE_3;
            v = SIN_TABLE_3;
        }
        if (k &gt; 0) {
            s = u * sin_t + v * cos_t;
            c = u * cos_t - v * sin_t;
        } else {
            s = u * sin_t - v * cos_t;
            c = u * cos_t + v * sin_t;
        }
    }

    if (j == 0) {
        sin_a = s;
        cos_a = c;
    } else if (j == 1) {
        sin_a = c;
        cos_a = -s;
    } else if (j == -1) {
        sin_a = -c;
        cos_a = s;
    } else {
        sin_a = -s;
        cos_a = -c;
    }
    return sin_a / cos_a;
}
#endif

float tan_fp32(float a) {
#ifdef LUMA_FP32_TAN_PRECISION_WORKAROUND
  return tan_taylor_fp32(a);
#else
  return tan(a);
#endif
}
`,mN={name:"fp32",vs:pN,fs:null};function kS(c,o){if(!c)throw new Error("math.gl assertion ".concat(o))}const zn={EPSILON:1e-12,debug:!1,precision:4,printTypes:!1,printDegrees:!1,printRowMajor:!0};function _N(c,{precision:o=zn.precision}={}){return c=gN(c),"".concat(parseFloat(c.toPrecision(o)))}function jl(c){return Array.isArray(c)||ArrayBuffer.isView(c)&amp;&amp;!(c instanceof DataView)}function Wo(c,o,u){return xN(c,p=&gt;Math.max(o,Math.min(u,p)))}function Jg(c,o,u){return jl(c)?c.map((p,g)=&gt;Jg(p,o[g],u)):u*o+(1-u)*c}function wu(c,o,u){const p=zn.EPSILON;try{if(c===o)return!0;if(jl(c)&amp;&amp;jl(o)){if(c.length!==o.length)return!1;for(let g=0;g&lt;c.length;++g)if(!wu(c[g],o[g]))return!1;return!0}return c&amp;&amp;c.equals?c.equals(o):o&amp;&amp;o.equals?o.equals(c):typeof c=="number"&amp;&amp;typeof o=="number"?Math.abs(c-o)&lt;=zn.EPSILON*Math.max(1,Math.abs(c),Math.abs(o)):!1}finally{zn.EPSILON=p}}function gN(c){return Math.round(c/zn.EPSILON)*zn.EPSILON}function yN(c){return c.clone?c.clone():new Array(c.length)}function xN(c,o,u){if(jl(c)){const p=c;u=u||yN(p);for(let g=0;g&lt;u.length&amp;&amp;g&lt;p.length;++g)u[g]=o(c[g],g,u);return u}return o(c)}function vN(c){function o(){var u=Reflect.construct(c,Array.from(arguments));return Object.setPrototypeOf(u,Object.getPrototypeOf(this)),u}return o.prototype=Object.create(c.prototype,{constructor:{value:c,enumerable:!1,writable:!0,configurable:!0}}),Object.setPrototypeOf?Object.setPrototypeOf(o,c):o.__proto__=c,o}class _M extends vN(Array){clone(){return new this.constructor().copy(this)}fromArray(o,u=0){for(let p=0;p&lt;this.ELEMENTS;++p)this[p]=o[p+u];return this.check()}toArray(o=[],u=0){for(let p=0;p&lt;this.ELEMENTS;++p)o[u+p]=this[p];return o}from(o){return Array.isArray(o)?this.copy(o):this.fromObject(o)}to(o){return o===this?this:jl(o)?this.toArray(o):this.toObject(o)}toTarget(o){return o?this.to(o):this}toFloat32Array(){return new Float32Array(this)}toString(){return this.formatString(zn)}formatString(o){let u="";for(let p=0;p&lt;this.ELEMENTS;++p)u+=(p&gt;0?", ":"")+_N(this[p],o);return"".concat(o.printTypes?this.constructor.name:"","[").concat(u,"]")}equals(o){if(!o||this.length!==o.length)return!1;for(let u=0;u&lt;this.ELEMENTS;++u)if(!wu(this[u],o[u]))return!1;return!0}exactEquals(o){if(!o||this.length!==o.length)return!1;for(let u=0;u&lt;this.ELEMENTS;++u)if(this[u]!==o[u])return!1;return!0}negate(){for(let o=0;o&lt;this.ELEMENTS;++o)this[o]=-this[o];return this.check()}lerp(o,u,p){if(p===void 0)return this.lerp(this,o,u);for(let g=0;g&lt;this.ELEMENTS;++g){const v=o[g];this[g]=v+p*(u[g]-v)}return this.check()}min(o){for(let u=0;u&lt;this.ELEMENTS;++u)this[u]=Math.min(o[u],this[u]);return this.check()}max(o){for(let u=0;u&lt;this.ELEMENTS;++u)this[u]=Math.max(o[u],this[u]);return this.check()}clamp(o,u){for(let p=0;p&lt;this.ELEMENTS;++p)this[p]=Math.min(Math.max(this[p],o[p]),u[p]);return this.check()}add(...o){for(const u of o)for(let p=0;p&lt;this.ELEMENTS;++p)this[p]+=u[p];return this.check()}subtract(...o){for(const u of o)for(let p=0;p&lt;this.ELEMENTS;++p)this[p]-=u[p];return this.check()}scale(o){if(typeof o=="number")for(let u=0;u&lt;this.ELEMENTS;++u)this[u]*=o;else for(let u=0;u&lt;this.ELEMENTS&amp;&amp;u&lt;o.length;++u)this[u]*=o[u];return this.check()}multiplyByScalar(o){for(let u=0;u&lt;this.ELEMENTS;++u)this[u]*=o;return this.check()}check(){if(zn.debug&amp;&amp;!this.validate())throw new Error("math.gl: ".concat(this.constructor.name," some fields set to invalid numbers'"));return this}validate(){let o=this.length===this.ELEMENTS;for(let u=0;u&lt;this.ELEMENTS;++u)o=o&amp;&amp;Number.isFinite(this[u]);return o}sub(o){return this.subtract(o)}setScalar(o){for(let u=0;u&lt;this.ELEMENTS;++u)this[u]=o;return this.check()}addScalar(o){for(let u=0;u&lt;this.ELEMENTS;++u)this[u]+=o;return this.check()}subScalar(o){return this.addScalar(-o)}multiplyScalar(o){for(let u=0;u&lt;this.ELEMENTS;++u)this[u]*=o;return this.check()}divideScalar(o){return this.multiplyByScalar(1/o)}clampScalar(o,u){for(let p=0;p&lt;this.ELEMENTS;++p)this[p]=Math.min(Math.max(this[p],o),u);return this.check()}get elements(){return this}}function bN(c,o){if(c.length!==o)return!1;for(let u=0;u&lt;c.length;++u)if(!Number.isFinite(c[u]))return!1;return!0}function yn(c){if(!Number.isFinite(c))throw new Error("Invalid number ".concat(c));return c}function Pg(c,o,u=""){if(zn.debug&amp;&amp;!bN(c,o))throw new Error("math.gl: ".concat(u," some fields set to invalid numbers'"));return c}class wN extends _M{get x(){return this[0]}set x(o){this[0]=yn(o)}get y(){return this[1]}set y(o){this[1]=yn(o)}len(){return Math.sqrt(this.lengthSquared())}magnitude(){return this.len()}lengthSquared(){let o=0;for(let u=0;u&lt;this.ELEMENTS;++u)o+=this[u]*this[u];return o}magnitudeSquared(){return this.lengthSquared()}distance(o){return Math.sqrt(this.distanceSquared(o))}distanceSquared(o){let u=0;for(let p=0;p&lt;this.ELEMENTS;++p){const g=this[p]-o[p];u+=g*g}return yn(u)}dot(o){let u=0;for(let p=0;p&lt;this.ELEMENTS;++p)u+=this[p]*o[p];return yn(u)}normalize(){const o=this.magnitude();if(o!==0)for(let u=0;u&lt;this.ELEMENTS;++u)this[u]/=o;return this.check()}multiply(...o){for(const u of o)for(let p=0;p&lt;this.ELEMENTS;++p)this[p]*=u[p];return this.check()}divide(...o){for(const u of o)for(let p=0;p&lt;this.ELEMENTS;++p)this[p]/=u[p];return this.check()}lengthSq(){return this.lengthSquared()}distanceTo(o){return this.distance(o)}distanceToSquared(o){return this.distanceSquared(o)}getComponent(o){return kS(o&gt;=0&amp;&amp;o&lt;this.ELEMENTS,"index is out of range"),yn(this[o])}setComponent(o,u){return kS(o&gt;=0&amp;&amp;o&lt;this.ELEMENTS,"index is out of range"),this[o]=u,this.check()}addVectors(o,u){return this.copy(o).add(u)}subVectors(o,u){return this.copy(o).subtract(u)}multiplyVectors(o,u){return this.copy(o).multiply(u)}addScaledVector(o,u){return this.add(new this.constructor(o).multiplyScalar(u))}}var cf=1e-6,Gl=typeof Float32Array&lt;"u"?Float32Array:Array;Math.hypot||(Math.hypot=function(){for(var c=0,o=arguments.length;o--;)c+=arguments[o]*arguments[o];return Math.sqrt(c)});function TN(){var c=new Gl(2);return Gl!=Float32Array&amp;&amp;(c[0]=0,c[1]=0),c}function zS(c,o,u){return c[0]=o[0]+u[0],c[1]=o[1]+u[1],c}function EN(c,o){return c[0]=-o[0],c[1]=-o[1],c}function gM(c,o,u,p){var g=o[0],v=o[1];return c[0]=g+p*(u[0]-g),c[1]=v+p*(u[1]-v),c}function SN(c,o,u){var p=o[0],g=o[1];return c[0]=u[0]*p+u[4]*g+u[12],c[1]=u[1]*p+u[5]*g+u[13],c}(function(){var c=TN();return function(o,u,p,g,v,E){var A,R;for(u||(u=2),p||(p=0),g?R=Math.min(g*u+p,o.length):R=o.length,A=p;A&lt;R;A+=u)c[0]=o[A],c[1]=o[A+1],v(c,c,E),o[A]=c[0],o[A+1]=c[1];return o}})();function AN(c,o,u){const p=o[0],g=o[1],v=u[3]*p+u[7]*g||1;return c[0]=(u[0]*p+u[4]*g)/v,c[1]=(u[1]*p+u[5]*g)/v,c}function yM(c,o,u){const p=o[0],g=o[1],v=o[2],E=u[3]*p+u[7]*g+u[11]*v||1;return c[0]=(u[0]*p+u[4]*g+u[8]*v)/E,c[1]=(u[1]*p+u[5]*g+u[9]*v)/E,c[2]=(u[2]*p+u[6]*g+u[10]*v)/E,c}function MN(c,o,u){const p=o[0],g=o[1];return c[0]=u[0]*p+u[2]*g,c[1]=u[1]*p+u[3]*g,c[2]=o[2],c}function IN(){var c=new Gl(3);return Gl!=Float32Array&amp;&amp;(c[0]=0,c[1]=0,c[2]=0),c}function PN(c,o,u){return c[0]=o[0]-u[0],c[1]=o[1]-u[1],c[2]=o[2]-u[2],c}function CN(c,o){return c[0]=-o[0],c[1]=-o[1],c[2]=-o[2],c}function LN(c,o){return c[0]*o[0]+c[1]*o[1]+c[2]*o[2]}function RN(c,o,u){var p=o[0],g=o[1],v=o[2],E=u[0],A=u[1],R=u[2];return c[0]=g*R-v*A,c[1]=v*E-p*R,c[2]=p*A-g*E,c}function xM(c,o,u){var p=o[0],g=o[1],v=o[2],E=u[3]*p+u[7]*g+u[11]*v+u[15];return E=E||1,c[0]=(u[0]*p+u[4]*g+u[8]*v+u[12])/E,c[1]=(u[1]*p+u[5]*g+u[9]*v+u[13])/E,c[2]=(u[2]*p+u[6]*g+u[10]*v+u[14])/E,c}function DN(c,o,u){var p=o[0],g=o[1],v=o[2];return c[0]=p*u[0]+g*u[3]+v*u[6],c[1]=p*u[1]+g*u[4]+v*u[7],c[2]=p*u[2]+g*u[5]+v*u[8],c}function ON(c,o,u){var p=u[0],g=u[1],v=u[2],E=u[3],A=o[0],R=o[1],L=o[2],G=g*L-v*R,j=v*A-p*L,H=p*R-g*A,ht=g*H-v*j,mt=v*G-p*H,gt=p*j-g*G,Pt=E*2;return G*=Pt,j*=Pt,H*=Pt,ht*=2,mt*=2,gt*=2,c[0]=A+G+ht,c[1]=R+j+mt,c[2]=L+H+gt,c}function kN(c,o,u,p){var g=[],v=[];return g[0]=o[0]-u[0],g[1]=o[1]-u[1],g[2]=o[2]-u[2],v[0]=g[0],v[1]=g[1]*Math.cos(p)-g[2]*Math.sin(p),v[2]=g[1]*Math.sin(p)+g[2]*Math.cos(p),c[0]=v[0]+u[0],c[1]=v[1]+u[1],c[2]=v[2]+u[2],c}function zN(c,o,u,p){var g=[],v=[];return g[0]=o[0]-u[0],g[1]=o[1]-u[1],g[2]=o[2]-u[2],v[0]=g[2]*Math.sin(p)+g[0]*Math.cos(p),v[1]=g[1],v[2]=g[2]*Math.cos(p)-g[0]*Math.sin(p),c[0]=v[0]+u[0],c[1]=v[1]+u[1],c[2]=v[2]+u[2],c}function FN(c,o,u,p){var g=[],v=[];return g[0]=o[0]-u[0],g[1]=o[1]-u[1],g[2]=o[2]-u[2],v[0]=g[0]*Math.cos(p)-g[1]*Math.sin(p),v[1]=g[0]*Math.sin(p)+g[1]*Math.cos(p),v[2]=g[2],c[0]=v[0]+u[0],c[1]=v[1]+u[1],c[2]=v[2]+u[2],c}function BN(c,o){var u=c[0],p=c[1],g=c[2],v=o[0],E=o[1],A=o[2],R=Math.sqrt(u*u+p*p+g*g),L=Math.sqrt(v*v+E*E+A*A),G=R*L,j=G&amp;&amp;LN(c,o)/G;return Math.acos(Math.min(Math.max(j,-1),1))}var l8=PN;(function(){var c=IN();return function(o,u,p,g,v,E){var A,R;for(u||(u=3),p||(p=0),g?R=Math.min(g*u+p,o.length):R=o.length,A=p;A&lt;R;A+=u)c[0]=o[A],c[1]=o[A+1],c[2]=o[A+2],v(c,c,E),o[A]=c[0],o[A+1]=c[1],o[A+2]=c[2];return o}})();const Cg=[0,0,0];let Yd;class Ps extends wN{static get ZERO(){return Yd||(Yd=new Ps(0,0,0),Object.freeze(Yd)),Yd}constructor(o=0,u=0,p=0){super(-0,-0,-0),arguments.length===1&amp;&amp;jl(o)?this.copy(o):(zn.debug&amp;&amp;(yn(o),yn(u),yn(p)),this[0]=o,this[1]=u,this[2]=p)}set(o,u,p){return this[0]=o,this[1]=u,this[2]=p,this.check()}copy(o){return this[0]=o[0],this[1]=o[1],this[2]=o[2],this.check()}fromObject(o){return zn.debug&amp;&amp;(yn(o.x),yn(o.y),yn(o.z)),this[0]=o.x,this[1]=o.y,this[2]=o.z,this.check()}toObject(o){return o.x=this[0],o.y=this[1],o.z=this[2],o}get ELEMENTS(){return 3}get z(){return this[2]}set z(o){this[2]=yn(o)}angle(o){return BN(this,o)}cross(o){return RN(this,this,o),this.check()}rotateX({radians:o,origin:u=Cg}){return kN(this,this,u,o),this.check()}rotateY({radians:o,origin:u=Cg}){return zN(this,this,u,o),this.check()}rotateZ({radians:o,origin:u=Cg}){return FN(this,this,u,o),this.check()}transform(o){return this.transformAsPoint(o)}transformAsPoint(o){return xM(this,this,o),this.check()}transformAsVector(o){return yM(this,this,o),this.check()}transformByMatrix3(o){return DN(this,this,o),this.check()}transformByMatrix2(o){return MN(this,this,o),this.check()}transformByQuaternion(o){return ON(this,this,o),this.check()}}class NN extends _M{toString(){let o="[";if(zn.printRowMajor){o+="row-major:";for(let u=0;u&lt;this.RANK;++u)for(let p=0;p&lt;this.RANK;++p)o+=" ".concat(this[p*this.RANK+u])}else{o+="column-major:";for(let u=0;u&lt;this.ELEMENTS;++u)o+=" ".concat(this[u])}return o+="]",o}getElementIndex(o,u){return u*this.RANK+o}getElement(o,u){return this[u*this.RANK+o]}setElement(o,u,p){return this[u*this.RANK+o]=yn(p),this}getColumn(o,u=new Array(this.RANK).fill(-0)){const p=o*this.RANK;for(let g=0;g&lt;this.RANK;++g)u[g]=this[p+g];return u}setColumn(o,u){const p=o*this.RANK;for(let g=0;g&lt;this.RANK;++g)this[p+g]=u[g];return this}}function UN(c){return c[0]=1,c[1]=0,c[2]=0,c[3]=0,c[4]=0,c[5]=1,c[6]=0,c[7]=0,c[8]=0,c[9]=0,c[10]=1,c[11]=0,c[12]=0,c[13]=0,c[14]=0,c[15]=1,c}function VN(c,o){if(c===o){var u=o[1],p=o[2],g=o[3],v=o[6],E=o[7],A=o[11];c[1]=o[4],c[2]=o[8],c[3]=o[12],c[4]=u,c[6]=o[9],c[7]=o[13],c[8]=p,c[9]=v,c[11]=o[14],c[12]=g,c[13]=E,c[14]=A}else c[0]=o[0],c[1]=o[4],c[2]=o[8],c[3]=o[12],c[4]=o[1],c[5]=o[5],c[6]=o[9],c[7]=o[13],c[8]=o[2],c[9]=o[6],c[10]=o[10],c[11]=o[14],c[12]=o[3],c[13]=o[7],c[14]=o[11],c[15]=o[15];return c}function Qg(c,o){var u=o[0],p=o[1],g=o[2],v=o[3],E=o[4],A=o[5],R=o[6],L=o[7],G=o[8],j=o[9],H=o[10],ht=o[11],mt=o[12],gt=o[13],Pt=o[14],Vt=o[15],Nt=u*A-p*E,jt=u*R-g*E,Qt=u*L-v*E,ae=p*R-g*A,le=p*L-v*A,Oe=g*L-v*R,Ge=G*gt-j*mt,ve=G*Pt-H*mt,Q=G*Vt-ht*mt,Lt=j*Pt-H*gt,li=j*Vt-ht*gt,Ke=H*Vt-ht*Pt,$t=Nt*Ke-jt*li+Qt*Lt+ae*Q-le*ve+Oe*Ge;return $t?($t=1/$t,c[0]=(A*Ke-R*li+L*Lt)*$t,c[1]=(g*li-p*Ke-v*Lt)*$t,c[2]=(gt*Oe-Pt*le+Vt*ae)*$t,c[3]=(H*le-j*Oe-ht*ae)*$t,c[4]=(R*Q-E*Ke-L*ve)*$t,c[5]=(u*Ke-g*Q+v*ve)*$t,c[6]=(Pt*Qt-mt*Oe-Vt*jt)*$t,c[7]=(G*Oe-H*Qt+ht*jt)*$t,c[8]=(E*li-A*Q+L*Ge)*$t,c[9]=(p*Q-u*li-v*Ge)*$t,c[10]=(mt*le-gt*Qt+Vt*Nt)*$t,c[11]=(j*Qt-G*le-ht*Nt)*$t,c[12]=(A*ve-E*Lt-R*Ge)*$t,c[13]=(u*Lt-p*ve+g*Ge)*$t,c[14]=(gt*jt-mt*ae-Pt*Nt)*$t,c[15]=(G*ae-j*jt+H*Nt)*$t,c):null}function jN(c){var o=c[0],u=c[1],p=c[2],g=c[3],v=c[4],E=c[5],A=c[6],R=c[7],L=c[8],G=c[9],j=c[10],H=c[11],ht=c[12],mt=c[13],gt=c[14],Pt=c[15],Vt=o*E-u*v,Nt=o*A-p*v,jt=o*R-g*v,Qt=u*A-p*E,ae=u*R-g*E,le=p*R-g*A,Oe=L*mt-G*ht,Ge=L*gt-j*ht,ve=L*Pt-H*ht,Q=G*gt-j*mt,Lt=G*Pt-H*mt,li=j*Pt-H*gt;return Vt*li-Nt*Lt+jt*Q+Qt*ve-ae*Ge+le*Oe}function Pa(c,o,u){var p=o[0],g=o[1],v=o[2],E=o[3],A=o[4],R=o[5],L=o[6],G=o[7],j=o[8],H=o[9],ht=o[10],mt=o[11],gt=o[12],Pt=o[13],Vt=o[14],Nt=o[15],jt=u[0],Qt=u[1],ae=u[2],le=u[3];return c[0]=jt*p+Qt*A+ae*j+le*gt,c[1]=jt*g+Qt*R+ae*H+le*Pt,c[2]=jt*v+Qt*L+ae*ht+le*Vt,c[3]=jt*E+Qt*G+ae*mt+le*Nt,jt=u[4],Qt=u[5],ae=u[6],le=u[7],c[4]=jt*p+Qt*A+ae*j+le*gt,c[5]=jt*g+Qt*R+ae*H+le*Pt,c[6]=jt*v+Qt*L+ae*ht+le*Vt,c[7]=jt*E+Qt*G+ae*mt+le*Nt,jt=u[8],Qt=u[9],ae=u[10],le=u[11],c[8]=jt*p+Qt*A+ae*j+le*gt,c[9]=jt*g+Qt*R+ae*H+le*Pt,c[10]=jt*v+Qt*L+ae*ht+le*Vt,c[11]=jt*E+Qt*G+ae*mt+le*Nt,jt=u[12],Qt=u[13],ae=u[14],le=u[15],c[12]=jt*p+Qt*A+ae*j+le*gt,c[13]=jt*g+Qt*R+ae*H+le*Pt,c[14]=jt*v+Qt*L+ae*ht+le*Vt,c[15]=jt*E+Qt*G+ae*mt+le*Nt,c}function yf(c,o,u){var p=u[0],g=u[1],v=u[2],E,A,R,L,G,j,H,ht,mt,gt,Pt,Vt;return o===c?(c[12]=o[0]*p+o[4]*g+o[8]*v+o[12],c[13]=o[1]*p+o[5]*g+o[9]*v+o[13],c[14]=o[2]*p+o[6]*g+o[10]*v+o[14],c[15]=o[3]*p+o[7]*g+o[11]*v+o[15]):(E=o[0],A=o[1],R=o[2],L=o[3],G=o[4],j=o[5],H=o[6],ht=o[7],mt=o[8],gt=o[9],Pt=o[10],Vt=o[11],c[0]=E,c[1]=A,c[2]=R,c[3]=L,c[4]=G,c[5]=j,c[6]=H,c[7]=ht,c[8]=mt,c[9]=gt,c[10]=Pt,c[11]=Vt,c[12]=E*p+G*g+mt*v+o[12],c[13]=A*p+j*g+gt*v+o[13],c[14]=R*p+H*g+Pt*v+o[14],c[15]=L*p+ht*g+Vt*v+o[15]),c}function Ly(c,o,u){var p=u[0],g=u[1],v=u[2];return c[0]=o[0]*p,c[1]=o[1]*p,c[2]=o[2]*p,c[3]=o[3]*p,c[4]=o[4]*g,c[5]=o[5]*g,c[6]=o[6]*g,c[7]=o[7]*g,c[8]=o[8]*v,c[9]=o[9]*v,c[10]=o[10]*v,c[11]=o[11]*v,c[12]=o[12],c[13]=o[13],c[14]=o[14],c[15]=o[15],c}function GN(c,o,u,p){var g=p[0],v=p[1],E=p[2],A=Math.hypot(g,v,E),R,L,G,j,H,ht,mt,gt,Pt,Vt,Nt,jt,Qt,ae,le,Oe,Ge,ve,Q,Lt,li,Ke,$t,vi;return A&lt;cf?null:(A=1/A,g*=A,v*=A,E*=A,R=Math.sin(u),L=Math.cos(u),G=1-L,j=o[0],H=o[1],ht=o[2],mt=o[3],gt=o[4],Pt=o[5],Vt=o[6],Nt=o[7],jt=o[8],Qt=o[9],ae=o[10],le=o[11],Oe=g*g*G+L,Ge=v*g*G+E*R,ve=E*g*G-v*R,Q=g*v*G-E*R,Lt=v*v*G+L,li=E*v*G+g*R,Ke=g*E*G+v*R,$t=v*E*G-g*R,vi=E*E*G+L,c[0]=j*Oe+gt*Ge+jt*ve,c[1]=H*Oe+Pt*Ge+Qt*ve,c[2]=ht*Oe+Vt*Ge+ae*ve,c[3]=mt*Oe+Nt*Ge+le*ve,c[4]=j*Q+gt*Lt+jt*li,c[5]=H*Q+Pt*Lt+Qt*li,c[6]=ht*Q+Vt*Lt+ae*li,c[7]=mt*Q+Nt*Lt+le*li,c[8]=j*Ke+gt*$t+jt*vi,c[9]=H*Ke+Pt*$t+Qt*vi,c[10]=ht*Ke+Vt*$t+ae*vi,c[11]=mt*Ke+Nt*$t+le*vi,o!==c&amp;&amp;(c[12]=o[12],c[13]=o[13],c[14]=o[14],c[15]=o[15]),c)}function vM(c,o,u){var p=Math.sin(u),g=Math.cos(u),v=o[4],E=o[5],A=o[6],R=o[7],L=o[8],G=o[9],j=o[10],H=o[11];return o!==c&amp;&amp;(c[0]=o[0],c[1]=o[1],c[2]=o[2],c[3]=o[3],c[12]=o[12],c[13]=o[13],c[14]=o[14],c[15]=o[15]),c[4]=v*g+L*p,c[5]=E*g+G*p,c[6]=A*g+j*p,c[7]=R*g+H*p,c[8]=L*g-v*p,c[9]=G*g-E*p,c[10]=j*g-A*p,c[11]=H*g-R*p,c}function HN(c,o,u){var p=Math.sin(u),g=Math.cos(u),v=o[0],E=o[1],A=o[2],R=o[3],L=o[8],G=o[9],j=o[10],H=o[11];return o!==c&amp;&amp;(c[4]=o[4],c[5]=o[5],c[6]=o[6],c[7]=o[7],c[12]=o[12],c[13]=o[13],c[14]=o[14],c[15]=o[15]),c[0]=v*g-L*p,c[1]=E*g-G*p,c[2]=A*g-j*p,c[3]=R*g-H*p,c[8]=v*p+L*g,c[9]=E*p+G*g,c[10]=A*p+j*g,c[11]=R*p+H*g,c}function bM(c,o,u){var p=Math.sin(u),g=Math.cos(u),v=o[0],E=o[1],A=o[2],R=o[3],L=o[4],G=o[5],j=o[6],H=o[7];return o!==c&amp;&amp;(c[8]=o[8],c[9]=o[9],c[10]=o[10],c[11]=o[11],c[12]=o[12],c[13]=o[13],c[14]=o[14],c[15]=o[15]),c[0]=v*g+L*p,c[1]=E*g+G*p,c[2]=A*g+j*p,c[3]=R*g+H*p,c[4]=L*g-v*p,c[5]=G*g-E*p,c[6]=j*g-A*p,c[7]=H*g-R*p,c}function WN(c,o){var u=o[0],p=o[1],g=o[2],v=o[3],E=u+u,A=p+p,R=g+g,L=u*E,G=p*E,j=p*A,H=g*E,ht=g*A,mt=g*R,gt=v*E,Pt=v*A,Vt=v*R;return c[0]=1-j-mt,c[1]=G+Vt,c[2]=H-Pt,c[3]=0,c[4]=G-Vt,c[5]=1-L-mt,c[6]=ht+gt,c[7]=0,c[8]=H+Pt,c[9]=ht-gt,c[10]=1-L-j,c[11]=0,c[12]=0,c[13]=0,c[14]=0,c[15]=1,c}function qN(c,o,u,p,g,v,E){var A=1/(u-o),R=1/(g-p),L=1/(v-E);return c[0]=v*2*A,c[1]=0,c[2]=0,c[3]=0,c[4]=0,c[5]=v*2*R,c[6]=0,c[7]=0,c[8]=(u+o)*A,c[9]=(g+p)*R,c[10]=(E+v)*L,c[11]=-1,c[12]=0,c[13]=0,c[14]=E*v*2*L,c[15]=0,c}function ZN(c,o,u,p,g){var v=1/Math.tan(o/2),E;return c[0]=v/u,c[1]=0,c[2]=0,c[3]=0,c[4]=0,c[5]=v,c[6]=0,c[7]=0,c[8]=0,c[9]=0,c[11]=-1,c[12]=0,c[13]=0,c[15]=0,g!=null&amp;&amp;g!==1/0?(E=1/(p-g),c[10]=(g+p)*E,c[14]=2*g*p*E):(c[10]=-1,c[14]=-2*p),c}var $N=ZN;function XN(c,o,u,p,g,v,E){var A=1/(o-u),R=1/(p-g),L=1/(v-E);return c[0]=-2*A,c[1]=0,c[2]=0,c[3]=0,c[4]=0,c[5]=-2*R,c[6]=0,c[7]=0,c[8]=0,c[9]=0,c[10]=2*L,c[11]=0,c[12]=(o+u)*A,c[13]=(g+p)*R,c[14]=(E+v)*L,c[15]=1,c}var YN=XN;function KN(c,o,u,p){var g,v,E,A,R,L,G,j,H,ht,mt=o[0],gt=o[1],Pt=o[2],Vt=p[0],Nt=p[1],jt=p[2],Qt=u[0],ae=u[1],le=u[2];return Math.abs(mt-Qt)&lt;cf&amp;&amp;Math.abs(gt-ae)&lt;cf&amp;&amp;Math.abs(Pt-le)&lt;cf?UN(c):(G=mt-Qt,j=gt-ae,H=Pt-le,ht=1/Math.hypot(G,j,H),G*=ht,j*=ht,H*=ht,g=Nt*H-jt*j,v=jt*G-Vt*H,E=Vt*j-Nt*G,ht=Math.hypot(g,v,E),ht?(ht=1/ht,g*=ht,v*=ht,E*=ht):(g=0,v=0,E=0),A=j*E-H*v,R=H*g-G*E,L=G*v-j*g,ht=Math.hypot(A,R,L),ht?(ht=1/ht,A*=ht,R*=ht,L*=ht):(A=0,R=0,L=0),c[0]=g,c[1]=A,c[2]=G,c[3]=0,c[4]=v,c[5]=R,c[6]=j,c[7]=0,c[8]=E,c[9]=L,c[10]=H,c[11]=0,c[12]=-(g*mt+v*gt+E*Pt),c[13]=-(A*mt+R*gt+L*Pt),c[14]=-(G*mt+j*gt+H*Pt),c[15]=1,c)}function JN(){var c=new Gl(4);return Gl!=Float32Array&amp;&amp;(c[0]=0,c[1]=0,c[2]=0,c[3]=0),c}function QN(c,o,u){return c[0]=o[0]*u,c[1]=o[1]*u,c[2]=o[2]*u,c[3]=o[3]*u,c}function Rf(c,o,u){var p=o[0],g=o[1],v=o[2],E=o[3];return c[0]=u[0]*p+u[4]*g+u[8]*v+u[12]*E,c[1]=u[1]*p+u[5]*g+u[9]*v+u[13]*E,c[2]=u[2]*p+u[6]*g+u[10]*v+u[14]*E,c[3]=u[3]*p+u[7]*g+u[11]*v+u[15]*E,c}(function(){var c=JN();return function(o,u,p,g,v,E){var A,R;for(u||(u=4),p||(p=0),g?R=Math.min(g*u+p,o.length):R=o.length,A=p;A&lt;R;A+=u)c[0]=o[A],c[1]=o[A+1],c[2]=o[A+2],c[3]=o[A+3],v(c,c,E),o[A]=c[0],o[A+1]=c[1],o[A+2]=c[2],o[A+3]=c[3];return o}})();var ty;(function(c){c[c.COL0ROW0=0]="COL0ROW0",c[c.COL0ROW1=1]="COL0ROW1",c[c.COL0ROW2=2]="COL0ROW2",c[c.COL0ROW3=3]="COL0ROW3",c[c.COL1ROW0=4]="COL1ROW0",c[c.COL1ROW1=5]="COL1ROW1",c[c.COL1ROW2=6]="COL1ROW2",c[c.COL1ROW3=7]="COL1ROW3",c[c.COL2ROW0=8]="COL2ROW0",c[c.COL2ROW1=9]="COL2ROW1",c[c.COL2ROW2=10]="COL2ROW2",c[c.COL2ROW3=11]="COL2ROW3",c[c.COL3ROW0=12]="COL3ROW0",c[c.COL3ROW1=13]="COL3ROW1",c[c.COL3ROW2=14]="COL3ROW2",c[c.COL3ROW3=15]="COL3ROW3"})(ty||(ty={}));const t6=45*Math.PI/180,e6=1,Lg=.1,Rg=500,i6=Object.freeze([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]);class Cs extends NN{static get IDENTITY(){return n6()}static get ZERO(){return r6()}get ELEMENTS(){return 16}get RANK(){return 4}get INDICES(){return ty}constructor(o){super(-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0),arguments.length===1&amp;&amp;Array.isArray(o)?this.copy(o):this.identity()}copy(o){return this[0]=o[0],this[1]=o[1],this[2]=o[2],this[3]=o[3],this[4]=o[4],this[5]=o[5],this[6]=o[6],this[7]=o[7],this[8]=o[8],this[9]=o[9],this[10]=o[10],this[11]=o[11],this[12]=o[12],this[13]=o[13],this[14]=o[14],this[15]=o[15],this.check()}set(o,u,p,g,v,E,A,R,L,G,j,H,ht,mt,gt,Pt){return this[0]=o,this[1]=u,this[2]=p,this[3]=g,this[4]=v,this[5]=E,this[6]=A,this[7]=R,this[8]=L,this[9]=G,this[10]=j,this[11]=H,this[12]=ht,this[13]=mt,this[14]=gt,this[15]=Pt,this.check()}setRowMajor(o,u,p,g,v,E,A,R,L,G,j,H,ht,mt,gt,Pt){return this[0]=o,this[1]=v,this[2]=L,this[3]=ht,this[4]=u,this[5]=E,this[6]=G,this[7]=mt,this[8]=p,this[9]=A,this[10]=j,this[11]=gt,this[12]=g,this[13]=R,this[14]=H,this[15]=Pt,this.check()}toRowMajor(o){return o[0]=this[0],o[1]=this[4],o[2]=this[8],o[3]=this[12],o[4]=this[1],o[5]=this[5],o[6]=this[9],o[7]=this[13],o[8]=this[2],o[9]=this[6],o[10]=this[10],o[11]=this[14],o[12]=this[3],o[13]=this[7],o[14]=this[11],o[15]=this[15],o}identity(){return this.copy(i6)}fromObject(o){return this.check()}fromQuaternion(o){return WN(this,o),this.check()}frustum(o){const{left:u,right:p,bottom:g,top:v,near:E=Lg,far:A=Rg}=o;return A===1/0?s6(this,u,p,g,v,E):qN(this,u,p,g,v,E,A),this.check()}lookAt(o){const{eye:u,center:p=[0,0,0],up:g=[0,1,0]}=o;return KN(this,u,p,g),this.check()}ortho(o){const{left:u,right:p,bottom:g,top:v,near:E=Lg,far:A=Rg}=o;return YN(this,u,p,g,v,E,A),this.check()}orthographic(o){const{fovy:u=t6,aspect:p=e6,focalDistance:g=1,near:v=Lg,far:E=Rg}=o;FS(u);const A=u/2,R=g*Math.tan(A),L=R*p;return this.ortho({left:-L,right:L,bottom:-R,top:R,near:v,far:E})}perspective(o){const{fovy:u=45*Math.PI/180,aspect:p=1,near:g=.1,far:v=500}=o;return FS(u),$N(this,u,p,g,v),this.check()}determinant(){return jN(this)}getScale(o=[-0,-0,-0]){return o[0]=Math.sqrt(this[0]*this[0]+this[1]*this[1]+this[2]*this[2]),o[1]=Math.sqrt(this[4]*this[4]+this[5]*this[5]+this[6]*this[6]),o[2]=Math.sqrt(this[8]*this[8]+this[9]*this[9]+this[10]*this[10]),o}getTranslation(o=[-0,-0,-0]){return o[0]=this[12],o[1]=this[13],o[2]=this[14],o}getRotation(o,u){o=o||[-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0],u=u||[-0,-0,-0];const p=this.getScale(u),g=1/p[0],v=1/p[1],E=1/p[2];return o[0]=this[0]*g,o[1]=this[1]*v,o[2]=this[2]*E,o[3]=0,o[4]=this[4]*g,o[5]=this[5]*v,o[6]=this[6]*E,o[7]=0,o[8]=this[8]*g,o[9]=this[9]*v,o[10]=this[10]*E,o[11]=0,o[12]=0,o[13]=0,o[14]=0,o[15]=1,o}getRotationMatrix3(o,u){o=o||[-0,-0,-0,-0,-0,-0,-0,-0,-0],u=u||[-0,-0,-0];const p=this.getScale(u),g=1/p[0],v=1/p[1],E=1/p[2];return o[0]=this[0]*g,o[1]=this[1]*v,o[2]=this[2]*E,o[3]=this[4]*g,o[4]=this[5]*v,o[5]=this[6]*E,o[6]=this[8]*g,o[7]=this[9]*v,o[8]=this[10]*E,o}transpose(){return VN(this,this),this.check()}invert(){return Qg(this,this),this.check()}multiplyLeft(o){return Pa(this,o,this),this.check()}multiplyRight(o){return Pa(this,this,o),this.check()}rotateX(o){return vM(this,this,o),this.check()}rotateY(o){return HN(this,this,o),this.check()}rotateZ(o){return bM(this,this,o),this.check()}rotateXYZ(o){return this.rotateX(o[0]).rotateY(o[1]).rotateZ(o[2])}rotateAxis(o,u){return GN(this,this,o,u),this.check()}scale(o){return Ly(this,this,Array.isArray(o)?o:[o,o,o]),this.check()}translate(o){return yf(this,this,o),this.check()}transform(o,u){return o.length===4?(u=Rf(u||[-0,-0,-0,-0],o,this),Pg(u,4),u):this.transformAsPoint(o,u)}transformAsPoint(o,u){const{length:p}=o;let g;switch(p){case 2:g=SN(u||[-0,-0],o,this);break;case 3:g=xM(u||[-0,-0,-0],o,this);break;default:throw new Error("Illegal vector")}return Pg(g,o.length),g}transformAsVector(o,u){let p;switch(o.length){case 2:p=AN(u||[-0,-0],o,this);break;case 3:p=yM(u||[-0,-0,-0],o,this);break;default:throw new Error("Illegal vector")}return Pg(p,o.length),p}transformPoint(o,u){return this.transformAsPoint(o,u)}transformVector(o,u){return this.transformAsPoint(o,u)}transformDirection(o,u){return this.transformAsVector(o,u)}makeRotationX(o){return this.identity().rotateX(o)}makeTranslation(o,u,p){return this.identity().translate([o,u,p])}}let Kd,Jd;function r6(){return Kd||(Kd=new Cs([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),Object.freeze(Kd)),Kd}function n6(){return Jd||(Jd=new Cs,Object.freeze(Jd)),Jd}function FS(c){if(c&gt;Math.PI*2)throw Error("expected radians")}function s6(c,o,u,p,g,v){const E=2*v/(u-o),A=2*v/(g-p),R=(u+o)/(u-o),L=(g+p)/(g-p),G=-1,j=-1,H=-2*v;return c[0]=E,c[1]=0,c[2]=0,c[3]=0,c[4]=0,c[5]=A,c[6]=0,c[7]=0,c[8]=R,c[9]=L,c[10]=G,c[11]=j,c[12]=0,c[13]=0,c[14]=H,c[15]=0,c}class Df{static getDefaultProgramManager(o){return o.luma=o.luma||{},o.luma.defaultProgramManager=o.luma.defaultProgramManager||new Df(o),o.luma.defaultProgramManager}constructor(o){this.gl=o,this._programCache={},this._getUniforms={},this._registeredModules={},this._hookFunctions=[],this._defaultModules=[],this._hashes={},this._hashCounter=0,this.stateHash=0,this._useCounts={}}addDefaultModule(o){this._defaultModules.find(u=&gt;u.name===o.name)||this._defaultModules.push(o),this.stateHash++}removeDefaultModule(o){const u=typeof o=="string"?o:o.name;this._defaultModules=this._defaultModules.filter(p=&gt;p.name!==u),this.stateHash++}addShaderHook(o,u){u&amp;&amp;(o=Object.assign(u,{hook:o})),this._hookFunctions.push(o),this.stateHash++}get(){let o=arguments.length&gt;0&amp;&amp;arguments[0]!==void 0?arguments[0]:{};const{vs:u="",fs:p="",defines:g={},inject:v={},varyings:E=[],bufferMode:A=35981,transpileToGLSL100:R=!1}=o,L=this._getModuleList(o.modules),G=this._getHash(u),j=this._getHash(p),H=L.map(jt=&gt;this._getHash(jt.name)).sort(),ht=E.map(jt=&gt;this._getHash(jt)),mt=Object.keys(g).sort(),gt=Object.keys(v).sort(),Pt=[],Vt=[];for(const jt of mt)Pt.push(this._getHash(jt)),Pt.push(this._getHash(g[jt]));for(const jt of gt)Vt.push(this._getHash(jt)),Vt.push(this._getHash(v[jt]));const Nt="".concat(G,"/").concat(j,"D").concat(Pt.join("/"),"M").concat(H.join("/"),"I").concat(Vt.join("/"),"V").concat(ht.join("/"),"H").concat(this.stateHash,"B").concat(A).concat(R?"T":"");if(!this._programCache[Nt]){const jt=aN(this.gl,{vs:u,fs:p,modules:L,inject:v,defines:g,hookFunctions:this._hookFunctions,transpileToGLSL100:R});this._programCache[Nt]=new v5(this.gl,{hash:Nt,vs:jt.vs,fs:jt.fs,varyings:E,bufferMode:A}),this._getUniforms[Nt]=jt.getUniforms||(Qt=&gt;{}),this._useCounts[Nt]=0}return this._useCounts[Nt]++,this._programCache[Nt]}getUniforms(o){return this._getUniforms[o.hash]||null}release(o){const u=o.hash;this._useCounts[u]--,this._useCounts[u]===0&amp;&amp;(this._programCache[u].delete(),delete this._programCache[u],delete this._getUniforms[u],delete this._useCounts[u])}_getHash(o){return this._hashes[o]===void 0&amp;&amp;(this._hashes[o]=this._hashCounter++),this._hashes[o]}_getModuleList(){let o=arguments.length&gt;0&amp;&amp;arguments[0]!==void 0?arguments[0]:[];const u=new Array(this._defaultModules.length+o.length),p={};let g=0;for(let v=0,E=this._defaultModules.length;v&lt;E;++v){const A=this._defaultModules[v],R=A.name;u[g++]=A,p[R]=!0}for(let v=0,E=o.length;v&lt;E;++v){const A=o[v],R=A.name;p[R]||(u[g++]=A,p[R]=!0)}return u.length=g,u}}let o6=1,a6=1;class wM{constructor(){this.time=0,this.channels=new Map,this.animations=new Map,this.playing=!1,this.lastEngineTime=-1}addChannel(o){const{delay:u=0,duration:p=Number.POSITIVE_INFINITY,rate:g=1,repeat:v=1}=o,E=o6++,A={time:0,delay:u,duration:p,rate:g,repeat:v};return this._setChannelTime(A,this.time),this.channels.set(E,A),E}removeChannel(o){this.channels.delete(o);for(const[u,p]of this.animations)p.channel===o&amp;&amp;this.detachAnimation(u)}isFinished(o){const u=this.channels.get(o);return u===void 0?!1:this.time&gt;=u.delay+u.duration*u.repeat}getTime(o){if(o===void 0)return this.time;const u=this.channels.get(o);return u===void 0?-1:u.time}setTime(o){this.time=Math.max(0,o);const u=this.channels.values();for(const g of u)this._setChannelTime(g,this.time);const p=this.animations.values();for(const g of p){const{animation:v,channel:E}=g;v.setTime(this.getTime(E))}}play(){this.playing=!0}pause(){this.playing=!1,this.lastEngineTime=-1}reset(){this.setTime(0)}attachAnimation(o,u){const p=a6++;return this.animations.set(p,{animation:o,channel:u}),o.setTime(this.getTime(u)),p}detachAnimation(o){this.animations.delete(o)}update(o){this.playing&amp;&amp;(this.lastEngineTime===-1&amp;&amp;(this.lastEngineTime=o),this.setTime(this.time+(o-this.lastEngineTime)),this.lastEngineTime=o)}_setChannelTime(o,u){const p=u-o.delay,g=o.duration*o.repeat;p&gt;=g?o.time=o.duration*o.rate:(o.time=Math.max(0,p)%o.duration,o.time*=o.rate)}}const l6=[255,255,255],c6=1;let u6=0;class h6{constructor(o={}){et(this,"id",void 0),et(this,"color",void 0),et(this,"intensity",void 0),et(this,"type","ambient");const{color:u=l6}=o,{intensity:p=c6}=o;this.id=o.id||"ambient-".concat(u6++),this.color=u,this.intensity=p}}const d6=[255,255,255],f6=1,p6=[0,0,-1];let m6=0;class BS{constructor(o={}){et(this,"id",void 0),et(this,"color",void 0),et(this,"intensity",void 0),et(this,"type","directional"),et(this,"direction",void 0),et(this,"shadow",void 0);const{color:u=d6}=o,{intensity:p=f6}=o,{direction:g=p6}=o,{_shadow:v=!1}=o;this.id=o.id||"directional-".concat(m6++),this.color=u,this.intensity=p,this.type="directional",this.direction=new Ps(g).normalize().toArray(),this.shadow=v}getProjectedLight(o){return this}}class _6{constructor(o,u={id:"pass"}){et(this,"id",void 0),et(this,"gl",void 0),et(this,"props",void 0);const{id:p}=u;this.id=p,this.gl=o,this.props={...u}}setProps(o){Object.assign(this.props,o)}render(o){}cleanup(){}}class Ry extends _6{constructor(...o){super(...o),et(this,"_lastRenderIndex",-1)}render(o){const u=this.gl;return qo(u,{framebuffer:o.target}),this._drawLayers(o)}_drawLayers(o){const{target:u,moduleParameters:p,viewports:g,views:v,onViewportActive:E,clearStack:A=!0,clearCanvas:R=!0}=o;o.pass=o.pass||"unknown";const L=this.gl;R&amp;&amp;y6(L,u),A&amp;&amp;(this._lastRenderIndex=-1);const G=[];for(const j of g){const H=v&amp;&amp;v[j.id];E==null||E(j);const ht=this._getDrawLayerParams(j,o),mt=j.subViewports||[j];for(const gt of mt){const Pt=this._drawLayersInViewport(L,{target:u,moduleParameters:p,viewport:gt,view:H,pass:o.pass,layers:o.layers},ht);G.push(Pt)}}return G}_getDrawLayerParams(o,{layers:u,pass:p,isPicking:g=!1,layerFilter:v,cullRect:E,effects:A,moduleParameters:R},L=!1){const G=[],j=TM(this._lastRenderIndex+1),H={layer:u[0],viewport:o,isPicking:g,renderPass:p,cullRect:E},ht={};for(let mt=0;mt&lt;u.length;mt++){const gt=u[mt],Pt=this._shouldDrawLayer(gt,H,v,ht),Vt={shouldDrawLayer:Pt};Pt&amp;&amp;!L&amp;&amp;(Vt.layerRenderIndex=j(gt,Pt),Vt.moduleParameters=this._getModuleParameters(gt,A,p,R),Vt.layerParameters=this.getLayerParameters(gt,mt,o)),G[mt]=Vt}return G}_drawLayersInViewport(o,{layers:u,moduleParameters:p,pass:g,target:v,viewport:E,view:A},R){const L=g6(o,{moduleParameters:p,target:v,viewport:E});if(A&amp;&amp;A.props.clear){const j=A.props.clear===!0?{color:!0,depth:!0}:A.props.clear;As(o,{scissorTest:!0,scissor:L},()=&gt;nM(o,j))}const G={totalCount:u.length,visibleCount:0,compositeCount:0,pickableCount:0};qo(o,{viewport:L});for(let j=0;j&lt;u.length;j++){const H=u[j],{shouldDrawLayer:ht,layerRenderIndex:mt,moduleParameters:gt,layerParameters:Pt}=R[j];if(ht&amp;&amp;H.props.pickable&amp;&amp;G.pickableCount++,H.isComposite)G.compositeCount++;else if(ht){G.visibleCount++,this._lastRenderIndex=Math.max(this._lastRenderIndex,mt),gt.viewport=E;try{H._drawLayer({moduleParameters:gt,uniforms:{layerIndex:mt},parameters:Pt})}catch(Vt){H.raiseError(Vt,"drawing ".concat(H," to ").concat(g))}}}return G}shouldDrawLayer(o){return!0}getModuleParameters(o,u){return null}getLayerParameters(o,u,p){return o.props.parameters}_shouldDrawLayer(o,u,p,g){if(!(o.props.visible&amp;&amp;this.shouldDrawLayer(o)))return!1;u.layer=o;let E=o.parent;for(;E;){if(!E.props.visible||!E.filterSubLayer(u))return!1;u.layer=E,E=E.parent}if(p){const A=u.layer.id;if(A in g||(g[A]=p(u)),!g[A])return!1}return o.activateViewport(u.viewport),!0}_getModuleParameters(o,u,p,g){var v;const E=Object.assign(Object.create(((v=o.internalState)===null||v===void 0?void 0:v.propsInTransition)||o.props),{autoWrapLongitude:o.wrapLongitude,viewport:o.context.viewport,mousePosition:o.context.mousePosition,pickingActive:0,devicePixelRatio:Ul(this.gl)});if(u)for(const R of u){var A;Object.assign(E,(A=R.getModuleParameters)===null||A===void 0?void 0:A.call(R,o))}return Object.assign(E,this.getModuleParameters(o,u),g)}}function TM(c=0,o={}){const u={},p=(g,v)=&gt;{const E=g.props._offset,A=g.id,R=g.parent&amp;&amp;g.parent.id;let L;if(R&amp;&amp;!(R in o)&amp;&amp;p(g.parent,!1),R in u){const G=u[R]=u[R]||TM(o[R],o);L=G(g,v),u[A]=G}else Number.isFinite(E)?(L=E+(o[R]||0),u[A]=null):L=c;return v&amp;&amp;L&gt;=c&amp;&amp;(c=L+1),o[A]=L,L};return p}function g6(c,{moduleParameters:o,target:u,viewport:p}){const g=u&amp;&amp;u.id!=="default-framebuffer",v=o&amp;&amp;o.devicePixelRatio||Ul(c),E=g?u.height:c.drawingBufferHeight,A=p;return[A.x*v,E-(A.y+A.height)*v,A.width*v,A.height*v]}function y6(c,o){const u=o?o.width:c.drawingBufferWidth,p=o?o.height:c.drawingBufferHeight;qo(c,{viewport:[0,0,u,p]}),c.clear(16640)}class x6 extends Ry{constructor(o,u){super(o,u),et(this,"shadowMap",void 0),et(this,"depthBuffer",void 0),et(this,"fbo",void 0),this.shadowMap=new $l(o,{width:1,height:1,parameters:{10241:9729,10240:9729,10242:33071,10243:33071}}),this.depthBuffer=new kl(o,{format:33189,width:1,height:1}),this.fbo=new Cr(o,{id:"shadowmap",width:1,height:1,attachments:{36064:this.shadowMap,36096:this.depthBuffer}})}render(o){const u=this.fbo;As(this.gl,{depthRange:[0,1],depthTest:!0,blend:!1,clearColor:[1,1,1,1]},()=&gt;{const p=o.viewports[0],g=Ul(this.gl),v=p.width*g,E=p.height*g;(v!==u.width||E!==u.height)&amp;&amp;u.resize({width:v,height:E}),super.render({...o,target:u,pass:"shadow"})})}shouldDrawLayer(o){return o.props.shadowEnabled!==!1}getModuleParameters(){return{drawToShadowMap:!0}}delete(){this.fbo&amp;&amp;(this.fbo.delete(),this.fbo=null),this.shadowMap&amp;&amp;(this.shadowMap.delete(),this.shadowMap=null),this.depthBuffer&amp;&amp;(this.depthBuffer.delete(),this.depthBuffer=null)}}const EM="#define SMOOTH_EDGE_RADIUS 0.5",v6=`
`.concat(EM,`

struct VertexGeometry {
  vec4 position;
  vec3 worldPosition;
  vec3 worldPositionAlt;
  vec3 normal;
  vec2 uv;
  vec3 pickingColor;
} geometry = VertexGeometry(
  vec4(0.0, 0.0, 1.0, 0.0),
  vec3(0.0),
  vec3(0.0),
  vec3(0.0),
  vec2(0.0),
  vec3(0.0)
);
`),b6=`
`.concat(EM,`

struct FragmentGeometry {
  vec2 uv;
} geometry;

float smoothedge(float edge, float x) {
  return smoothstep(edge - SMOOTH_EDGE_RADIUS, edge + SMOOTH_EDGE_RADIUS, x);
}
`),w6={name:"geometry",vs:v6,fs:b6},T6=Object.keys(Tr).map(c=&gt;"const int COORDINATE_SYSTEM_".concat(c," = ").concat(Tr[c],";")).join(""),E6=Object.keys(Ss).map(c=&gt;"const int PROJECTION_MODE_".concat(c," = ").concat(Ss[c],";")).join(""),S6=Object.keys(KE).map(c=&gt;"const int UNIT_".concat(c.toUpperCase()," = ").concat(KE[c],";")).join(""),A6="".concat(T6,`
`).concat(E6,`
`).concat(S6,`

uniform int project_uCoordinateSystem;
uniform int project_uProjectionMode;
uniform float project_uScale;
uniform bool project_uWrapLongitude;
uniform vec3 project_uCommonUnitsPerMeter;
uniform vec3 project_uCommonUnitsPerWorldUnit;
uniform vec3 project_uCommonUnitsPerWorldUnit2;
uniform vec4 project_uCenter;
uniform mat4 project_uModelMatrix;
uniform mat4 project_uViewProjectionMatrix;
uniform vec2 project_uViewportSize;
uniform float project_uDevicePixelRatio;
uniform float project_uFocalDistance;
uniform vec3 project_uCameraPosition;
uniform vec3 project_uCoordinateOrigin;
uniform vec3 project_uCommonOrigin;
uniform bool project_uPseudoMeters;

const float TILE_SIZE = 512.0;
const float PI = 3.1415926536;
const float WORLD_SCALE = TILE_SIZE / (PI * 2.0);
const vec3 ZERO_64_LOW = vec3(0.0);
const float EARTH_RADIUS = 6370972.0;
const float GLOBE_RADIUS = 256.0;
float project_size_at_latitude(float lat) {
  float y = clamp(lat, -89.9, 89.9);
  return 1.0 / cos(radians(y));
}

float project_size() {
  if (project_uProjectionMode == PROJECTION_MODE_WEB_MERCATOR &amp;&amp;
    project_uCoordinateSystem == COORDINATE_SYSTEM_LNGLAT &amp;&amp;
    project_uPseudoMeters == false) {
    
    if (geometry.position.w == 0.0) {
      return project_size_at_latitude(geometry.worldPosition.y);
    }
  
    float y = geometry.position.y / TILE_SIZE * 2.0 - 1.0;
    float y2 = y * y;
    float y4 = y2 * y2;
    float y6 = y4 * y2;
    return 1.0 + 4.9348 * y2 + 4.0587 * y4 + 1.5642 * y6;
  }
  return 1.0;
}

float project_size_at_latitude(float meters, float lat) {
  return meters * project_uCommonUnitsPerMeter.z * project_size_at_latitude(lat);
}
float project_size(float meters) {
  return meters * project_uCommonUnitsPerMeter.z * project_size();
}

vec2 project_size(vec2 meters) {
  return meters * project_uCommonUnitsPerMeter.xy * project_size();
}

vec3 project_size(vec3 meters) {
  return meters * project_uCommonUnitsPerMeter * project_size();
}

vec4 project_size(vec4 meters) {
  return vec4(meters.xyz * project_uCommonUnitsPerMeter, meters.w);
}
mat3 project_get_orientation_matrix(vec3 up) {
  vec3 uz = normalize(up);
  vec3 ux = abs(uz.z) == 1.0 ? vec3(1.0, 0.0, 0.0) : normalize(vec3(uz.y, -uz.x, 0));
  vec3 uy = cross(uz, ux);
  return mat3(ux, uy, uz);
}

bool project_needs_rotation(vec3 commonPosition, out mat3 transform) {
  if (project_uProjectionMode == PROJECTION_MODE_GLOBE) {
    transform = project_get_orientation_matrix(commonPosition);
    return true;
  }
  return false;
}
vec3 project_normal(vec3 vector) {
  vec4 normal_modelspace = project_uModelMatrix * vec4(vector, 0.0);
  vec3 n = normalize(normal_modelspace.xyz * project_uCommonUnitsPerMeter);
  mat3 rotation;
  if (project_needs_rotation(geometry.position.xyz, rotation)) {
    n = rotation * n;
  }
  return n;
}

vec4 project_offset_(vec4 offset) {
  float dy = offset.y;
  vec3 commonUnitsPerWorldUnit = project_uCommonUnitsPerWorldUnit + project_uCommonUnitsPerWorldUnit2 * dy;
  return vec4(offset.xyz * commonUnitsPerWorldUnit, offset.w);
}
vec2 project_mercator_(vec2 lnglat) {
  float x = lnglat.x;
  if (project_uWrapLongitude) {
    x = mod(x + 180., 360.0) - 180.;
  }
  float y = clamp(lnglat.y, -89.9, 89.9);
  return vec2(
    radians(x) + PI,
    PI + log(tan_fp32(PI * 0.25 + radians(y) * 0.5))
  ) * WORLD_SCALE;
}

vec3 project_globe_(vec3 lnglatz) {
  float lambda = radians(lnglatz.x);
  float phi = radians(lnglatz.y);
  float cosPhi = cos(phi);
  float D = (lnglatz.z / EARTH_RADIUS + 1.0) * GLOBE_RADIUS;

  return vec3(
    sin(lambda) * cosPhi,
    -cos(lambda) * cosPhi,
    sin(phi)
  ) * D;
}
vec4 project_position(vec4 position, vec3 position64Low) {
  vec4 position_world = project_uModelMatrix * position;
  if (project_uProjectionMode == PROJECTION_MODE_WEB_MERCATOR) {
    if (project_uCoordinateSystem == COORDINATE_SYSTEM_LNGLAT) {
      return vec4(
        project_mercator_(position_world.xy),
        project_size_at_latitude(position_world.z, position_world.y),
        position_world.w
      );
    }
    if (project_uCoordinateSystem == COORDINATE_SYSTEM_CARTESIAN) {
      position_world.xyz += project_uCoordinateOrigin;
    }
  }
  if (project_uProjectionMode == PROJECTION_MODE_GLOBE) {
    if (project_uCoordinateSystem == COORDINATE_SYSTEM_LNGLAT) {
      return vec4(
        project_globe_(position_world.xyz),
        position_world.w
      );
    }
  }
  if (project_uProjectionMode == PROJECTION_MODE_WEB_MERCATOR_AUTO_OFFSET) {
    if (project_uCoordinateSystem == COORDINATE_SYSTEM_LNGLAT) {
      if (abs(position_world.y - project_uCoordinateOrigin.y) &gt; 0.25) {
        return vec4(
          project_mercator_(position_world.xy) - project_uCommonOrigin.xy,
          project_size(position_world.z),
          position_world.w
        );
      }
    }
  }
  if (project_uProjectionMode == PROJECTION_MODE_IDENTITY ||
    (project_uProjectionMode == PROJECTION_MODE_WEB_MERCATOR_AUTO_OFFSET &amp;&amp;
    (project_uCoordinateSystem == COORDINATE_SYSTEM_LNGLAT ||
     project_uCoordinateSystem == COORDINATE_SYSTEM_CARTESIAN))) {
    position_world.xyz -= project_uCoordinateOrigin;
  }
  return project_offset_(position_world + project_uModelMatrix * vec4(position64Low, 0.0));
}

vec4 project_position(vec4 position) {
  return project_position(position, ZERO_64_LOW);
}

vec3 project_position(vec3 position, vec3 position64Low) {
  vec4 projected_position = project_position(vec4(position, 1.0), position64Low);
  return projected_position.xyz;
}

vec3 project_position(vec3 position) {
  vec4 projected_position = project_position(vec4(position, 1.0), ZERO_64_LOW);
  return projected_position.xyz;
}

vec2 project_position(vec2 position) {
  vec4 projected_position = project_position(vec4(position, 0.0, 1.0), ZERO_64_LOW);
  return projected_position.xy;
}

vec4 project_common_position_to_clipspace(vec4 position, mat4 viewProjectionMatrix, vec4 center) {
  return viewProjectionMatrix * position + center;
}
vec4 project_common_position_to_clipspace(vec4 position) {
  return project_common_position_to_clipspace(position, project_uViewProjectionMatrix, project_uCenter);
}
vec2 project_pixel_size_to_clipspace(vec2 pixels) {
  vec2 offset = pixels / project_uViewportSize * project_uDevicePixelRatio * 2.0;
  return offset * project_uFocalDistance;
}

float project_size_to_pixel(float meters) {
  return project_size(meters) * project_uScale;
}
float project_size_to_pixel(float size, int unit) {
  if (unit == UNIT_METERS) return project_size_to_pixel(size);
  if (unit == UNIT_COMMON) return size * project_uScale;
  return size;
}
float project_pixel_size(float pixels) {
  return pixels / project_uScale;
}
vec2 project_pixel_size(vec2 pixels) {
  return pixels / project_uScale;
}
`);function M6(c,o){if(c===o)return!0;if(Array.isArray(c)){const u=c.length;if(!o||o.length!==u)return!1;for(let p=0;p&lt;u;p++)if(c[p]!==o[p])return!1;return!0}return!1}function Dy(c){let o={},u;return p=&gt;{for(const g in p)if(!M6(p[g],o[g])){u=c(p),o=p;break}return u}}const NS=[0,0,0,0],I6=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0],SM=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],P6=[0,0,0],AM=[0,0,0],C6=Dy(O6);function L6(c,o,u=AM){u.length&lt;3&amp;&amp;(u=[u[0],u[1],0]);let p=u,g,v=!0;switch(o===Tr.LNGLAT_OFFSETS||o===Tr.METER_OFFSETS?g=u:g=c.isGeospatial?[Math.fround(c.longitude),Math.fround(c.latitude),0]:null,c.projectionMode){case Ss.WEB_MERCATOR:(o===Tr.LNGLAT||o===Tr.CARTESIAN)&amp;&amp;(g=[0,0,0],v=!1);break;case Ss.WEB_MERCATOR_AUTO_OFFSET:o===Tr.LNGLAT?p=g:o===Tr.CARTESIAN&amp;&amp;(p=[Math.fround(c.center[0]),Math.fround(c.center[1]),0],g=c.unprojectPosition(p),p[0]-=u[0],p[1]-=u[1],p[2]-=u[2]);break;case Ss.IDENTITY:p=c.position.map(Math.fround),p[2]=p[2]||0;break;case Ss.GLOBE:v=!1,g=null;break;default:v=!1}return{geospatialOrigin:g,shaderCoordinateOrigin:p,offsetMode:v}}function R6(c,o,u){const{viewMatrixUncentered:p,projectionMatrix:g}=c;let{viewMatrix:v,viewProjectionMatrix:E}=c,A=NS,R=NS,L=c.cameraPosition;const{geospatialOrigin:G,shaderCoordinateOrigin:j,offsetMode:H}=L6(c,o,u);return H&amp;&amp;(R=c.projectPosition(G||j),L=[L[0]-R[0],L[1]-R[1],L[2]-R[2]],R[3]=1,A=Rf([],R,E),v=p||v,E=Pa([],g,v),E=Pa([],E,I6)),{viewMatrix:v,viewProjectionMatrix:E,projectionCenter:A,originCommon:R,cameraPosCommon:L,shaderCoordinateOrigin:j,geospatialOrigin:G}}function D6({viewport:c,devicePixelRatio:o=1,modelMatrix:u=null,coordinateSystem:p=Tr.DEFAULT,coordinateOrigin:g=AM,autoWrapLongitude:v=!1}){p===Tr.DEFAULT&amp;&amp;(p=c.isGeospatial?Tr.LNGLAT:Tr.CARTESIAN);const E=C6({viewport:c,devicePixelRatio:o,coordinateSystem:p,coordinateOrigin:g});return E.project_uWrapLongitude=v,E.project_uModelMatrix=u||SM,E}function O6({viewport:c,devicePixelRatio:o,coordinateSystem:u,coordinateOrigin:p}){const{projectionCenter:g,viewProjectionMatrix:v,originCommon:E,cameraPosCommon:A,shaderCoordinateOrigin:R,geospatialOrigin:L}=R6(c,u,p),G=c.getDistanceScales(),j=[c.width*o,c.height*o],H=Rf([],[0,0,-c.focalDistance,1],c.projectionMatrix)[3]||1,ht={project_uCoordinateSystem:u,project_uProjectionMode:c.projectionMode,project_uCoordinateOrigin:R,project_uCommonOrigin:E.slice(0,3),project_uCenter:g,project_uPseudoMeters:!!c._pseudoMeters,project_uViewportSize:j,project_uDevicePixelRatio:o,project_uFocalDistance:H,project_uCommonUnitsPerMeter:G.unitsPerMeter,project_uCommonUnitsPerWorldUnit:G.unitsPerMeter,project_uCommonUnitsPerWorldUnit2:P6,project_uScale:c.scale,project_uWrapLongitude:!1,project_uViewProjectionMatrix:v,project_uModelMatrix:SM,project_uCameraPosition:A};if(L){const mt=c.getDistanceScales(L);switch(u){case Tr.METER_OFFSETS:ht.project_uCommonUnitsPerWorldUnit=mt.unitsPerMeter,ht.project_uCommonUnitsPerWorldUnit2=mt.unitsPerMeter2;break;case Tr.LNGLAT:case Tr.LNGLAT_OFFSETS:c._pseudoMeters||(ht.project_uCommonUnitsPerMeter=mt.unitsPerMeter),ht.project_uCommonUnitsPerWorldUnit=mt.unitsPerDegree,ht.project_uCommonUnitsPerWorldUnit2=mt.unitsPerDegree2;break;case Tr.CARTESIAN:ht.project_uCommonUnitsPerWorldUnit=[1,1,mt.unitsPerMeter[2]],ht.project_uCommonUnitsPerWorldUnit2=[0,0,mt.unitsPerMeter2[2]];break}}return ht}const k6={};function z6(c=k6){return"viewport"in c?D6(c):{}}const MM={name:"project",dependencies:[mN,w6],vs:A6,getUniforms:z6};function F6(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}function Bl(c,o){const u=Rf([],o,c);return QN(u,u,1/u[3]),u}function US(c,o){const u=c%o;return u&lt;0?o+u:u}function ey(c,o,u){return c&lt;o?o:c&gt;u?u:c}function B6(c){return Math.log(c)*Math.LOG2E}const Oy=Math.log2||B6;function so(c,o){if(!c)throw new Error(o||"@math.gl/web-mercator: assertion failed.")}const Qn=Math.PI,IM=Qn/4,Fn=Qn/180,iy=180/Qn,Hl=512,xf=4003e4,Qd=85.051129,N6=1.5;function U6(c){return Oy(c)}function vf(c){const[o,u]=c;so(Number.isFinite(o)),so(Number.isFinite(u)&amp;&amp;u&gt;=-90&amp;&amp;u&lt;=90,"invalid latitude");const p=o*Fn,g=u*Fn,v=Hl*(p+Qn)/(2*Qn),E=Hl*(Qn+Math.log(Math.tan(IM+g*.5)))/(2*Qn);return[v,E]}function Wl(c){const[o,u]=c,p=o/Hl*(2*Qn)-Qn,g=2*(Math.atan(Math.exp(u/Hl*(2*Qn)-Qn))-IM);return[p*iy,g*iy]}function V6(c){const{latitude:o}=c;so(Number.isFinite(o));const u=Math.cos(o*Fn);return U6(xf*u)-9}function Dg(c){const o=Math.cos(c*Fn);return Hl/xf/o}function ry(c){const{latitude:o,longitude:u,highPrecision:p=!1}=c;so(Number.isFinite(o)&amp;&amp;Number.isFinite(u));const g=Hl,v=Math.cos(o*Fn),E=g/360,A=E/v,R=g/xf/v,L={unitsPerMeter:[R,R,R],metersPerUnit:[1/R,1/R,1/R],unitsPerDegree:[E,A,R],degreesPerUnit:[1/E,1/A,1/R]};if(p){const G=Fn*Math.tan(o*Fn)/v,j=E*G/2,H=g/xf*G,ht=H/A*R;L.unitsPerDegree2=[0,j,H],L.unitsPerMeter2=[ht,0,ht]}return L}function j6(c,o){const[u,p,g]=c,[v,E,A]=o,{unitsPerMeter:R,unitsPerMeter2:L}=ry({longitude:u,latitude:p,highPrecision:!0}),G=vf(c);G[0]+=v*(R[0]+L[0]*E),G[1]+=E*(R[1]+L[1]*E);const j=Wl(G),H=(g||0)+(A||0);return Number.isFinite(g)||Number.isFinite(A)?[j[0],j[1],H]:j}function G6(c){const{height:o,pitch:u,bearing:p,altitude:g,scale:v,center:E}=c,A=F6();yf(A,A,[0,0,-g]),vM(A,A,-u*Fn),bM(A,A,p*Fn);const R=v/o;return Ly(A,A,[R,R,R]),E&amp;&amp;yf(A,A,CN([],E)),A}function H6(c){const{width:o,height:u,altitude:p,pitch:g=0,offset:v,center:E,scale:A,nearZMultiplier:R=1,farZMultiplier:L=1}=c;let{fovy:G=bf(N6)}=c;p!==void 0&amp;&amp;(G=bf(p));const j=G*Fn,H=g*Fn,ht=PM(G);let mt=ht;E&amp;&amp;(mt+=E[2]*A/Math.cos(H)/u);const gt=j*(.5+(v?v[1]:0)/u),Pt=Math.sin(gt)*mt/Math.sin(ey(Math.PI/2-H-gt,.01,Math.PI-.01)),Vt=Math.sin(H)*Pt+mt,Nt=mt*10,jt=Math.min(Vt*L,Nt);return{fov:j,aspect:o/u,focalDistance:ht,near:R,far:jt}}function bf(c){return 2*Math.atan(.5/c)*iy}function PM(c){return .5/Math.tan(.5*c*Fn)}function W6(c,o){const[u,p,g=0]=c;return so(Number.isFinite(u)&amp;&amp;Number.isFinite(p)&amp;&amp;Number.isFinite(g)),Bl(o,[u,p,g,1])}function ky(c,o,u=0){const[p,g,v]=c;if(so(Number.isFinite(p)&amp;&amp;Number.isFinite(g),"invalid pixel coordinate"),Number.isFinite(v))return Bl(o,[p,g,v,1]);const E=Bl(o,[p,g,0,1]),A=Bl(o,[p,g,1,1]),R=E[2],L=A[2],G=R===L?0:((u||0)-R)/(L-R);return gM([],E,A,G)}function q6(c){const{width:o,height:u,bounds:p,minExtent:g=0,maxZoom:v=24,offset:E=[0,0]}=c,[[A,R],[L,G]]=p,j=Z6(c.padding),H=vf([A,ey(G,-Qd,Qd)]),ht=vf([L,ey(R,-Qd,Qd)]),mt=[Math.max(Math.abs(ht[0]-H[0]),g),Math.max(Math.abs(ht[1]-H[1]),g)],gt=[o-j.left-j.right-Math.abs(E[0])*2,u-j.top-j.bottom-Math.abs(E[1])*2];so(gt[0]&gt;0&amp;&amp;gt[1]&gt;0);const Pt=gt[0]/mt[0],Vt=gt[1]/mt[1],Nt=(j.right-j.left)/2/Pt,jt=(j.top-j.bottom)/2/Vt,Qt=[(ht[0]+H[0])/2+Nt,(ht[1]+H[1])/2+jt],ae=Wl(Qt),le=Math.min(v,Oy(Math.abs(Math.min(Pt,Vt))));return so(Number.isFinite(le)),{longitude:ae[0],latitude:ae[1],zoom:le}}function Z6(c=0){return typeof c=="number"?{top:c,bottom:c,left:c,right:c}:(so(Number.isFinite(c.top)&amp;&amp;Number.isFinite(c.bottom)&amp;&amp;Number.isFinite(c.left)&amp;&amp;Number.isFinite(c.right)),c)}const VS=Math.PI/180;function $6(c,o=0){const{width:u,height:p,unproject:g}=c,v={targetZ:o},E=g([0,p],v),A=g([u,p],v);let R,L;const G=c.fovy?.5*c.fovy*VS:Math.atan(.5/c.altitude),j=(90-c.pitch)*VS;return G&gt;j-.01?(R=jS(c,0,o),L=jS(c,u,o)):(R=g([0,0],v),L=g([u,0],v)),[E,A,L,R]}function jS(c,o,u){const{pixelUnprojectionMatrix:p}=c,g=Bl(p,[o,0,1,1]),v=Bl(p,[o,c.height,1,1]),A=(u*c.distanceScales.unitsPerMeter[2]-g[2])/(v[2]-g[2]),R=gM([],g,v,A),L=Wl(R);return L.push(u),L}const GS=512;function X6(c){const{width:o,height:u,pitch:p=0}=c;let{longitude:g,latitude:v,zoom:E,bearing:A=0}=c;(g&lt;-180||g&gt;180)&amp;&amp;(g=US(g+180,360)-180),(A&lt;-180||A&gt;180)&amp;&amp;(A=US(A+180,360)-180);const R=Oy(u/GS);if(E&lt;=R)E=R,v=0;else{const L=u/2/Math.pow(2,E),G=Wl([0,L])[1];if(v&lt;G)v=G;else{const j=Wl([0,GS-L])[1];v&gt;j&amp;&amp;(v=j)}}return{width:o,height:u,longitude:g,latitude:v,zoom:E,pitch:p,bearing:A}}const Y6=`
const int max_lights = 2;
uniform mat4 shadow_uViewProjectionMatrices[max_lights];
uniform vec4 shadow_uProjectCenters[max_lights];
uniform bool shadow_uDrawShadowMap;
uniform bool shadow_uUseShadowMap;
uniform int shadow_uLightId;
uniform float shadow_uLightCount;

varying vec3 shadow_vPosition[max_lights];

vec4 shadow_setVertexPosition(vec4 position_commonspace) {
  if (shadow_uDrawShadowMap) {
    return project_common_position_to_clipspace(position_commonspace, shadow_uViewProjectionMatrices[shadow_uLightId], shadow_uProjectCenters[shadow_uLightId]);
  }
  if (shadow_uUseShadowMap) {
    for (int i = 0; i &lt; max_lights; i++) {
      if(i &lt; int(shadow_uLightCount)) {
        vec4 shadowMap_position = project_common_position_to_clipspace(position_commonspace, shadow_uViewProjectionMatrices[i], shadow_uProjectCenters[i]);
        shadow_vPosition[i] = (shadowMap_position.xyz / shadowMap_position.w + 1.0) / 2.0;
      }
    }
  }
  return gl_Position;
}
`,K6=`
const int max_lights = 2;
uniform bool shadow_uDrawShadowMap;
uniform bool shadow_uUseShadowMap;
uniform sampler2D shadow_uShadowMap0;
uniform sampler2D shadow_uShadowMap1;
uniform vec4 shadow_uColor;
uniform float shadow_uLightCount;

varying vec3 shadow_vPosition[max_lights];

const vec4 bitPackShift = vec4(1.0, 255.0, 65025.0, 16581375.0);
const vec4 bitUnpackShift = 1.0 / bitPackShift;
const vec4 bitMask = vec4(1.0 / 255.0, 1.0 / 255.0, 1.0 / 255.0,  0.0);

float shadow_getShadowWeight(vec3 position, sampler2D shadowMap) {
  vec4 rgbaDepth = texture2D(shadowMap, position.xy);

  float z = dot(rgbaDepth, bitUnpackShift);
  return smoothstep(0.001, 0.01, position.z - z);
}

vec4 shadow_filterShadowColor(vec4 color) {
  if (shadow_uDrawShadowMap) {
    vec4 rgbaDepth = fract(gl_FragCoord.z * bitPackShift);
    rgbaDepth -= rgbaDepth.gbaa * bitMask;
    return rgbaDepth;
  }
  if (shadow_uUseShadowMap) {
    float shadowAlpha = 0.0;
    shadowAlpha += shadow_getShadowWeight(shadow_vPosition[0], shadow_uShadowMap0);
    if(shadow_uLightCount &gt; 1.0) {
      shadowAlpha += shadow_getShadowWeight(shadow_vPosition[1], shadow_uShadowMap1);
    }
    shadowAlpha *= shadow_uColor.a / shadow_uLightCount;
    float blendedAlpha = shadowAlpha + color.a * (1.0 - shadowAlpha);

    return vec4(
      mix(color.rgb, shadow_uColor.rgb, shadowAlpha / blendedAlpha),
      blendedAlpha
    );
  }
  return color;
}
`,J6=Dy(rU),Q6=Dy(nU),tU=[0,0,0,1],eU=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0];function iU(c,o){const[u,p,g]=c,v=ky([u,p,g],o);return Number.isFinite(g)?v:[v[0],v[1],0]}function rU({viewport:c,center:o}){return new Cs(c.viewProjectionMatrix).invert().transform(o)}function nU({viewport:c,shadowMatrices:o}){const u=[],p=c.pixelUnprojectionMatrix,g=c.isGeospatial?void 0:1,v=[[0,0,g],[c.width,0,g],[0,c.height,g],[c.width,c.height,g],[0,0,-1],[c.width,0,-1],[0,c.height,-1],[c.width,c.height,-1]].map(E=&gt;iU(E,p));for(const E of o){const A=E.clone().translate(new Ps(c.center).negate()),R=v.map(G=&gt;A.transform(G)),L=new Cs().ortho({left:Math.min(...R.map(G=&gt;G[0])),right:Math.max(...R.map(G=&gt;G[0])),bottom:Math.min(...R.map(G=&gt;G[1])),top:Math.max(...R.map(G=&gt;G[1])),near:Math.min(...R.map(G=&gt;-G[2])),far:Math.max(...R.map(G=&gt;-G[2]))});u.push(L.multiplyRight(E))}return u}function sU(c,o){const{shadowEnabled:u=!0}=c;if(!u||!c.shadowMatrices||!c.shadowMatrices.length)return{shadow_uDrawShadowMap:!1,shadow_uUseShadowMap:!1};const p={shadow_uDrawShadowMap:!!c.drawToShadowMap,shadow_uUseShadowMap:c.shadowMaps?c.shadowMaps.length&gt;0:!1,shadow_uColor:c.shadowColor||tU,shadow_uLightId:c.shadowLightId||0,shadow_uLightCount:c.shadowMatrices.length},g=J6({viewport:c.viewport,center:o.project_uCenter}),v=[],E=Q6({shadowMatrices:c.shadowMatrices,viewport:c.viewport}).slice();for(let A=0;A&lt;c.shadowMatrices.length;A++){const R=E[A],L=R.clone().translate(new Ps(c.viewport.center).negate());o.project_uCoordinateSystem===Tr.LNGLAT&amp;&amp;o.project_uProjectionMode===Ss.WEB_MERCATOR?(E[A]=L,v[A]=g):(E[A]=R.clone().multiplyRight(eU),v[A]=L.transform(g))}for(let A=0;A&lt;E.length;A++)p["shadow_uViewProjectionMatrices[".concat(A,"]")]=E[A],p["shadow_uProjectCenters[".concat(A,"]")]=v[A],c.shadowMaps&amp;&amp;c.shadowMaps.length&gt;0?p["shadow_uShadowMap".concat(A)]=c.shadowMaps[A]:p["shadow_uShadowMap".concat(A)]=c.dummyShadowMap;return p}const Og={name:"shadow",dependencies:[MM],vs:Y6,fs:K6,inject:{"vs:DECKGL_FILTER_GL_POSITION":`
    position = shadow_setVertexPosition(geometry.position);
    `,"fs:DECKGL_FILTER_COLOR":`
    color = shadow_filterShadowColor(color);
    `},getUniforms:(c={},o={})=&gt;"viewport"in c&amp;&amp;(c.drawToShadowMap||c.shadowMaps&amp;&amp;c.shadowMaps.length&gt;0)?sU(c,o):{}},oU={color:[255,255,255],intensity:1},HS=[{color:[255,255,255],intensity:1,direction:[-1,3,-1]},{color:[255,255,255],intensity:.9,direction:[1,-8,-2.5]}],aU=[0,0,0,200/255];class CM{constructor(o={}){et(this,"id","lighting-effect"),et(this,"props",void 0),et(this,"shadowColor",aU),et(this,"shadow",void 0),et(this,"ambientLight",void 0),et(this,"directionalLights",void 0),et(this,"pointLights",void 0),et(this,"shadowPasses",[]),et(this,"shadowMaps",[]),et(this,"dummyShadowMap",null),et(this,"programManager",void 0),et(this,"shadowMatrices",void 0),this.setProps(o)}setProps(o){this.ambientLight=null,this.directionalLights=[],this.pointLights=[];for(const u in o){const p=o[u];switch(p.type){case"ambient":this.ambientLight=p;break;case"directional":this.directionalLights.push(p);break;case"point":this.pointLights.push(p);break}}this._applyDefaultLights(),this.shadow=this.directionalLights.some(u=&gt;u.shadow),this.props=o}preRender(o,{layers:u,layerFilter:p,viewports:g,onViewportActive:v,views:E}){if(this.shadow){this.shadowMatrices=this._calculateMatrices(),this.shadowPasses.length===0&amp;&amp;this._createShadowPasses(o),this.programManager||(this.programManager=Df.getDefaultProgramManager(o),Og&amp;&amp;this.programManager.addDefaultModule(Og)),this.dummyShadowMap||(this.dummyShadowMap=new $l(o,{width:1,height:1}));for(let A=0;A&lt;this.shadowPasses.length;A++)this.shadowPasses[A].render({layers:u,layerFilter:p,viewports:g,onViewportActive:v,views:E,moduleParameters:{shadowLightId:A,dummyShadowMap:this.dummyShadowMap,shadowMatrices:this.shadowMatrices}})}}getModuleParameters(o){const u=this.shadow?{shadowMaps:this.shadowMaps,dummyShadowMap:this.dummyShadowMap,shadowColor:this.shadowColor,shadowMatrices:this.shadowMatrices}:{};return u.lightSources={ambientLight:this.ambientLight,directionalLights:this.directionalLights.map(p=&gt;p.getProjectedLight({layer:o})),pointLights:this.pointLights.map(p=&gt;p.getProjectedLight({layer:o}))},u}cleanup(){for(const o of this.shadowPasses)o.delete();this.shadowPasses.length=0,this.shadowMaps.length=0,this.dummyShadowMap&amp;&amp;(this.dummyShadowMap.delete(),this.dummyShadowMap=null),this.shadow&amp;&amp;this.programManager&amp;&amp;(this.programManager.removeDefaultModule(Og),this.programManager=null)}_calculateMatrices(){const o=[];for(const u of this.directionalLights){const p=new Cs().lookAt({eye:new Ps(u.direction).negate()});o.push(p)}return o}_createShadowPasses(o){for(let u=0;u&lt;this.directionalLights.length;u++){const p=new x6(o);this.shadowPasses[u]=p,this.shadowMaps[u]=p.shadowMap}}_applyDefaultLights(){const{ambientLight:o,pointLights:u,directionalLights:p}=this;!o&amp;&amp;u.length===0&amp;&amp;p.length===0&amp;&amp;(this.ambientLight=new h6(oU),this.directionalLights.push(new BS(HS[0]),new BS(HS[1])))}}class lU{constructor(o={}){et(this,"_pool",[]),et(this,"opts",{overAlloc:2,poolSize:100}),this.setOptions(o)}setOptions(o){Object.assign(this.opts,o)}allocate(o,u,{size:p=1,type:g,padding:v=0,copy:E=!1,initialize:A=!1,maxCount:R}){const L=g||o&amp;&amp;o.constructor||Float32Array,G=u*p+v;if(ArrayBuffer.isView(o)){if(G&lt;=o.length)return o;if(G*o.BYTES_PER_ELEMENT&lt;=o.buffer.byteLength)return new L(o.buffer,0,G)}let j=1/0;R&amp;&amp;(j=R*p+v);const H=this._allocate(L,G,A,j);return o&amp;&amp;E?H.set(o):A||H.fill(0,0,4),this._release(o),H}release(o){this._release(o)}_allocate(o,u,p,g){let v=Math.max(Math.ceil(u*this.opts.overAlloc),1);v&gt;g&amp;&amp;(v=g);const E=this._pool,A=o.BYTES_PER_ELEMENT*v,R=E.findIndex(L=&gt;L.byteLength&gt;=A);if(R&gt;=0){const L=new o(E.splice(R,1)[0],0,v);return p&amp;&amp;L.fill(0),L}return new o(v)}_release(o){if(!ArrayBuffer.isView(o))return;const u=this._pool,{buffer:p}=o,{byteLength:g}=p,v=u.findIndex(E=&gt;E.byteLength&gt;=g);v&lt;0?u.push(p):(v&gt;0||u.length&lt;this.opts.poolSize)&amp;&amp;u.splice(v,0,p),u.length&gt;this.opts.poolSize&amp;&amp;u.shift()}}const LM=new lU;function fu(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}function cU(c){return[c[12],c[13],c[14]]}function uU(c){return{left:Dl(c[3]+c[0],c[7]+c[4],c[11]+c[8],c[15]+c[12]),right:Dl(c[3]-c[0],c[7]-c[4],c[11]-c[8],c[15]-c[12]),bottom:Dl(c[3]+c[1],c[7]+c[5],c[11]+c[9],c[15]+c[13]),top:Dl(c[3]-c[1],c[7]-c[5],c[11]-c[9],c[15]-c[13]),near:Dl(c[3]+c[2],c[7]+c[6],c[11]+c[10],c[15]+c[14]),far:Dl(c[3]-c[2],c[7]-c[6],c[11]-c[10],c[15]-c[14])}}const WS=new Ps;function Dl(c,o,u,p){WS.set(c,o,u);const g=WS.len();return{distance:p/g,normal:new Ps(-c/g,-o/g,-u/g)}}function hU(c){return c-Math.fround(c)}let uu;function c8(c,o){const{size:u=1,startIndex:p=0}=o,g=o.endIndex!==void 0?o.endIndex:c.length,v=(g-p)/u;uu=LM.allocate(uu,v,{type:Float32Array,size:u*2});let E=p,A=0;for(;E&lt;g;){for(let R=0;R&lt;u;R++){const L=c[E++];uu[A+R]=L,uu[A+R+u]=hU(L)}A+=u*2}return uu.subarray(0,v*u*2)}function u8(c){let o=null,u=!1;for(const p of c)p&amp;&amp;(o?(u||(o=[[o[0][0],o[0][1]],[o[1][0],o[1][1]]],u=!0),o[0][0]=Math.min(o[0][0],p[0][0]),o[0][1]=Math.min(o[0][1],p[0][1]),o[1][0]=Math.max(o[1][0],p[1][0]),o[1][1]=Math.max(o[1][1],p[1][1])):o=p);return o}const dU=Math.PI/180,fU=fu(),qS=[0,0,0],pU={unitsPerMeter:[1,1,1],metersPerUnit:[1,1,1]};function mU({width:c,height:o,orthographic:u,fovyRadians:p,focalDistance:g,padding:v,near:E,far:A}){const R=c/o,L=u?new Cs().orthographic({fovy:p,aspect:R,focalDistance:g,near:E,far:A}):new Cs().perspective({fovy:p,aspect:R,near:E,far:A});if(v){const{left:G=0,right:j=0,top:H=0,bottom:ht=0}=v,mt=Wo((G+c-j)/2,0,c)-c/2,gt=Wo((H+o-ht)/2,0,o)-o/2;L[8]-=mt*2/c,L[9]+=gt*2/o}return L}class Xl{constructor(o={}){et(this,"id",void 0),et(this,"x",void 0),et(this,"y",void 0),et(this,"width",void 0),et(this,"height",void 0),et(this,"padding",void 0),et(this,"isGeospatial",void 0),et(this,"zoom",void 0),et(this,"focalDistance",void 0),et(this,"position",void 0),et(this,"modelMatrix",void 0),et(this,"distanceScales",void 0),et(this,"scale",void 0),et(this,"center",void 0),et(this,"cameraPosition",void 0),et(this,"projectionMatrix",void 0),et(this,"viewMatrix",void 0),et(this,"viewMatrixUncentered",void 0),et(this,"viewMatrixInverse",void 0),et(this,"viewProjectionMatrix",void 0),et(this,"pixelProjectionMatrix",void 0),et(this,"pixelUnprojectionMatrix",void 0),et(this,"resolution",void 0),et(this,"_frustumPlanes",{}),this.id=o.id||this.constructor.displayName||"viewport",this.x=o.x||0,this.y=o.y||0,this.width=o.width||1,this.height=o.height||1,this.zoom=o.zoom||0,this.padding=o.padding,this.distanceScales=o.distanceScales||pU,this.focalDistance=o.focalDistance||1,this.position=o.position||qS,this.modelMatrix=o.modelMatrix||null;const{longitude:u,latitude:p}=o;this.isGeospatial=Number.isFinite(p)&amp;&amp;Number.isFinite(u),this._initProps(o),this._initMatrices(o),this.equals=this.equals.bind(this),this.project=this.project.bind(this),this.unproject=this.unproject.bind(this),this.projectPosition=this.projectPosition.bind(this),this.unprojectPosition=this.unprojectPosition.bind(this),this.projectFlat=this.projectFlat.bind(this),this.unprojectFlat=this.unprojectFlat.bind(this)}get subViewports(){return null}get metersPerPixel(){return this.distanceScales.metersPerUnit[2]/this.scale}get projectionMode(){return this.isGeospatial?this.zoom&lt;12?Ss.WEB_MERCATOR:Ss.WEB_MERCATOR_AUTO_OFFSET:Ss.IDENTITY}equals(o){return o instanceof Xl?this===o?!0:o.width===this.width&amp;&amp;o.height===this.height&amp;&amp;o.scale===this.scale&amp;&amp;wu(o.projectionMatrix,this.projectionMatrix)&amp;&amp;wu(o.viewMatrix,this.viewMatrix):!1}project(o,{topLeft:u=!0}={}){const p=this.projectPosition(o),g=W6(p,this.pixelProjectionMatrix),[v,E]=g,A=u?E:this.height-E;return o.length===2?[v,A]:[v,A,g[2]]}unproject(o,{topLeft:u=!0,targetZ:p}={}){const[g,v,E]=o,A=u?v:this.height-v,R=p&amp;&amp;p*this.distanceScales.unitsPerMeter[2],L=ky([g,A,E],this.pixelUnprojectionMatrix,R),[G,j,H]=this.unprojectPosition(L);return Number.isFinite(E)?[G,j,H]:Number.isFinite(p)?[G,j,p]:[G,j]}projectPosition(o){const[u,p]=this.projectFlat(o),g=(o[2]||0)*this.distanceScales.unitsPerMeter[2];return[u,p,g]}unprojectPosition(o){const[u,p]=this.unprojectFlat(o),g=(o[2]||0)*this.distanceScales.metersPerUnit[2];return[u,p,g]}projectFlat(o){if(this.isGeospatial){const u=vf(o);return u[1]=Wo(u[1],-318,830),u}return o}unprojectFlat(o){return this.isGeospatial?Wl(o):o}getBounds(o={}){const u={targetZ:o.z||0},p=this.unproject([0,0],u),g=this.unproject([this.width,0],u),v=this.unproject([0,this.height],u),E=this.unproject([this.width,this.height],u);return[Math.min(p[0],g[0],v[0],E[0]),Math.min(p[1],g[1],v[1],E[1]),Math.max(p[0],g[0],v[0],E[0]),Math.max(p[1],g[1],v[1],E[1])]}getDistanceScales(o){return o?ry({longitude:o[0],latitude:o[1],highPrecision:!0}):this.distanceScales}containsPixel({x:o,y:u,width:p=1,height:g=1}){return o&lt;this.x+this.width&amp;&amp;this.x&lt;o+p&amp;&amp;u&lt;this.y+this.height&amp;&amp;this.y&lt;u+g}getFrustumPlanes(){return this._frustumPlanes.near?this._frustumPlanes:(Object.assign(this._frustumPlanes,uU(this.viewProjectionMatrix)),this._frustumPlanes)}panByPosition(o,u){return null}_initProps(o){const u=o.longitude,p=o.latitude;this.isGeospatial&amp;&amp;(Number.isFinite(o.zoom)||(this.zoom=V6({latitude:p})+Math.log2(this.focalDistance)),this.distanceScales=o.distanceScales||ry({latitude:p,longitude:u}));const g=Math.pow(2,this.zoom);this.scale=g;const{position:v,modelMatrix:E}=o;let A=qS;if(v&amp;&amp;(A=E?new Cs(E).transformAsVector(v,[]):v),this.isGeospatial){const R=this.projectPosition([u,p,0]);this.center=new Ps(A).scale(this.distanceScales.unitsPerMeter).add(R)}else this.center=this.projectPosition(A)}_initMatrices(o){const{viewMatrix:u=fU,projectionMatrix:p=null,orthographic:g=!1,fovyRadians:v,fovy:E=75,near:A=.1,far:R=1e3,padding:L=null,focalDistance:G=1}=o;this.viewMatrixUncentered=u,this.viewMatrix=new Cs().multiplyRight(u).translate(new Ps(this.center).negate()),this.projectionMatrix=p||mU({width:this.width,height:this.height,orthographic:g,fovyRadians:v||E*dU,focalDistance:G,padding:L,near:A,far:R});const j=fu();Pa(j,j,this.projectionMatrix),Pa(j,j,this.viewMatrix),this.viewProjectionMatrix=j,this.viewMatrixInverse=Qg([],this.viewMatrix)||this.viewMatrix,this.cameraPosition=cU(this.viewMatrixInverse);const H=fu(),ht=fu();Ly(H,H,[this.width/2,-this.height/2,1]),yf(H,H,[1,-1,0]),Pa(ht,H,this.viewProjectionMatrix),this.pixelProjectionMatrix=ht,this.pixelUnprojectionMatrix=Qg(fu(),this.pixelProjectionMatrix),this.pixelUnprojectionMatrix||Pr.warn("Pixel project matrix not invertible")()}}et(Xl,"displayName","Viewport");class Tu extends Xl{constructor(o={}){const{latitude:u=0,longitude:p=0,zoom:g=0,pitch:v=0,bearing:E=0,nearZMultiplier:A=.1,farZMultiplier:R=1.01,nearZ:L,farZ:G,orthographic:j=!1,projectionMatrix:H,repeat:ht=!1,worldOffset:mt=0,position:gt,padding:Pt,legacyMeterSizes:Vt=!1}=o;let{width:Nt,height:jt,altitude:Qt=1.5}=o;const ae=Math.pow(2,g);Nt=Nt||1,jt=jt||1;let le,Oe=null;if(H)Qt=H[5]/2,le=bf(Qt);else{o.fovy?(le=o.fovy,Qt=PM(le)):le=bf(Qt);let ve;if(Pt){const{top:Q=0,bottom:Lt=0}=Pt;ve=[0,Wo((Q+jt-Lt)/2,0,jt)-jt/2]}Oe=H6({width:Nt,height:jt,scale:ae,center:gt&amp;&amp;[0,0,gt[2]*Dg(u)],offset:ve,pitch:v,fovy:le,nearZMultiplier:A,farZMultiplier:R}),Number.isFinite(L)&amp;&amp;(Oe.near=L),Number.isFinite(G)&amp;&amp;(Oe.far=G)}let Ge=G6({height:jt,pitch:v,bearing:E,scale:ae,altitude:Qt});mt&amp;&amp;(Ge=new Cs().translate([512*mt,0,0]).multiplyLeft(Ge)),super({...o,width:Nt,height:jt,viewMatrix:Ge,longitude:p,latitude:u,zoom:g,...Oe,fovy:le,focalDistance:Qt}),et(this,"longitude",void 0),et(this,"latitude",void 0),et(this,"pitch",void 0),et(this,"bearing",void 0),et(this,"altitude",void 0),et(this,"fovy",void 0),et(this,"orthographic",void 0),et(this,"_subViewports",void 0),et(this,"_pseudoMeters",void 0),this.latitude=u,this.longitude=p,this.zoom=g,this.pitch=v,this.bearing=E,this.altitude=Qt,this.fovy=le,this.orthographic=j,this._subViewports=ht?[]:null,this._pseudoMeters=Vt,Object.freeze(this)}get subViewports(){if(this._subViewports&amp;&amp;!this._subViewports.length){const o=this.getBounds(),u=Math.floor((o[0]+180)/360),p=Math.ceil((o[2]-180)/360);for(let g=u;g&lt;=p;g++){const v=g?new Tu({...this,worldOffset:g}):this;this._subViewports.push(v)}}return this._subViewports}projectPosition(o){if(this._pseudoMeters)return super.projectPosition(o);const[u,p]=this.projectFlat(o),g=(o[2]||0)*Dg(o[1]);return[u,p,g]}unprojectPosition(o){if(this._pseudoMeters)return super.unprojectPosition(o);const[u,p]=this.unprojectFlat(o),g=(o[2]||0)/Dg(p);return[u,p,g]}addMetersToLngLat(o,u){return j6(o,u)}panByPosition(o,u){const p=ky(u,this.pixelUnprojectionMatrix),g=this.projectFlat(o),v=zS([],g,EN([],p)),E=zS([],this.center,v),[A,R]=this.unprojectFlat(E);return{longitude:A,latitude:R}}getBounds(o={}){const u=$6(this,o.z||0);return[Math.min(u[0][0],u[1][0],u[2][0],u[3][0]),Math.min(u[0][1],u[1][1],u[2][1],u[3][1]),Math.max(u[0][0],u[1][0],u[2][0],u[3][0]),Math.max(u[0][1],u[1][1],u[2][1],u[3][1])]}fitBounds(o,u={}){const{width:p,height:g}=this,{longitude:v,latitude:E,zoom:A}=q6({width:p,height:g,bounds:o,...u});return new Tu({width:p,height:g,longitude:v,latitude:E,zoom:A})}}et(Tu,"displayName","WebMercatorViewport");const ZS={blendFunc:[1,0,32771,0],blendEquation:32774};class RM extends Ry{constructor(...o){super(...o),et(this,"pickZ",void 0),et(this,"_colorEncoderState",null)}render(o){return"pickingFBO"in o?this._drawPickingBuffer(o):super.render(o)}_drawPickingBuffer({layers:o,layerFilter:u,views:p,viewports:g,onViewportActive:v,pickingFBO:E,deviceRect:{x:A,y:R,width:L,height:G},cullRect:j,effects:H,pass:ht="picking",pickZ:mt,moduleParameters:gt}){const Pt=this.gl;this.pickZ=mt;const Vt=this._resetColorEncoder(mt),Nt=As(Pt,{scissorTest:!0,scissor:[A,R,L,G],clearColor:[0,0,0,0],depthMask:!0,depthTest:!0,depthRange:[0,1],colorMask:[!0,!0,!0,!0],...ZS,blend:!mt},()=&gt;super.render({target:E,layers:o,layerFilter:u,views:p,viewports:g,onViewportActive:v,cullRect:j,effects:H==null?void 0:H.filter(Qt=&gt;Qt.useInPicking),pass:ht,isPicking:!0,moduleParameters:gt}));return this._colorEncoderState=null,{decodePickingColor:Vt&amp;&amp;gU.bind(null,Vt),stats:Nt}}shouldDrawLayer(o){const{pickable:u,operation:p}=o.props;return u&amp;&amp;p.includes("draw")||p.includes("terrain")||p.includes("mask")}getModuleParameters(){return{pickingActive:1,pickingAttribute:this.pickZ,lightSources:{}}}getLayerParameters(o,u,p){const g={...o.props.parameters},{pickable:v,operation:E}=o.props;return this._colorEncoderState?v&amp;&amp;E.includes("draw")&amp;&amp;(Object.assign(g,ZS),g.blend=!0,g.blendColor=_U(this._colorEncoderState,o,p)):g.blend=!1,E.includes("terrain")&amp;&amp;(g.blend=!1),g}_resetColorEncoder(o){return this._colorEncoderState=o?null:{byLayer:new Map,byAlpha:[]},this._colorEncoderState}}function _U(c,o,u){const{byLayer:p,byAlpha:g}=c;let v,E=p.get(o);return E?(E.viewports.push(u),v=E.a):(v=p.size+1,v&lt;=255?(E={a:v,layer:o,viewports:[u]},p.set(o,E),g[v]=E):(Pr.warn("Too many pickable layers, only picking the first 255")(),v=0)),[0,0,0,v/255]}function gU(c,o){const u=c.byAlpha[o[3]];return u&amp;&amp;{pickedLayer:u.layer,pickedViewports:u.viewports,pickedObjectIndex:u.layer.decodePickingColor(o)}}const hu={NO_STATE:"Awaiting state",MATCHED:"Matched. State transferred from previous layer",INITIALIZED:"Initialized",AWAITING_GC:"Discarded. Awaiting garbage collection",AWAITING_FINALIZATION:"No longer matched. Awaiting garbage collection",FINALIZED:"Finalized! Awaiting garbage collection"},h8=Symbol.for("component"),d8=Symbol.for("propTypes"),f8=Symbol.for("deprecatedProps"),p8=Symbol.for("asyncPropDefaults"),m8=Symbol.for("asyncPropOriginal"),_8=Symbol.for("asyncPropResolved");function DM(c,o=()=&gt;!0){return Array.isArray(c)?OM(c,o,[]):o(c)?[c]:[]}function OM(c,o,u){let p=-1;for(;++p&lt;c.length;){const g=c[p];Array.isArray(g)?OM(g,o,u):o(g)&amp;&amp;u.push(g)}return u}function g8({target:c,source:o,start:u=0,count:p=1}){const g=o.length,v=p*g;let E=0;for(let A=u;E&lt;g;E++)c[A++]=o[E];for(;E&lt;v;)E&lt;v-E?(c.copyWithin(u+E,u,u+E),E*=2):(c.copyWithin(u+E,u,u+v-E),E=v);return c}class yU{constructor(o,u,p){et(this,"id",void 0),et(this,"context",void 0),et(this,"isLoaded",void 0),et(this,"persistent",void 0),et(this,"_loadCount",0),et(this,"_subscribers",new Set),et(this,"_data",void 0),et(this,"_loader",void 0),et(this,"_error",void 0),et(this,"_content",void 0),this.id=o,this.context=p,this.setData(u)}subscribe(o){this._subscribers.add(o)}unsubscribe(o){this._subscribers.delete(o)}inUse(){return this._subscribers.size&gt;0}delete(){}getData(){return this.isLoaded?this._error?Promise.reject(this._error):this._content:this._loader.then(()=&gt;this.getData())}setData(o,u){if(o===this._data&amp;&amp;!u)return;this._data=o;const p=++this._loadCount;let g=o;typeof o=="string"&amp;&amp;(g=Kz(o)),g instanceof Promise?(this.isLoaded=!1,this._loader=g.then(v=&gt;{this._loadCount===p&amp;&amp;(this.isLoaded=!0,this._error=void 0,this._content=v)}).catch(v=&gt;{this._loadCount===p&amp;&amp;(this.isLoaded=!0,this._error=v||!0)})):(this.isLoaded=!0,this._error=void 0,this._content=o);for(const v of this._subscribers)v.onChange(this.getData())}}class xU{constructor({gl:o,protocol:u}){et(this,"protocol",void 0),et(this,"_context",void 0),et(this,"_resources",void 0),et(this,"_consumers",void 0),et(this,"_pruneRequest",void 0),this.protocol=u||"resource://",this._context={gl:o,resourceManager:this},this._resources={},this._consumers={},this._pruneRequest=null}contains(o){return o.startsWith(this.protocol)?!0:o in this._resources}add({resourceId:o,data:u,forceUpdate:p=!1,persistent:g=!0}){let v=this._resources[o];v?v.setData(u,p):(v=new yU(o,u,this._context),this._resources[o]=v),v.persistent=g}remove(o){const u=this._resources[o];u&amp;&amp;(u.delete(),delete this._resources[o])}unsubscribe({consumerId:o}){const u=this._consumers[o];if(u){for(const p in u){const g=u[p],v=this._resources[g.resourceId];v&amp;&amp;v.unsubscribe(g)}delete this._consumers[o],this.prune()}}subscribe({resourceId:o,onChange:u,consumerId:p,requestId:g="default"}){const{_resources:v,protocol:E}=this;o.startsWith(E)&amp;&amp;(o=o.replace(E,""),v[o]||this.add({resourceId:o,data:null,persistent:!1}));const A=v[o];if(this._track(p,g,A,u),A)return A.getData()}prune(){this._pruneRequest||(this._pruneRequest=setTimeout(()=&gt;this._prune(),0))}finalize(){for(const o in this._resources)this._resources[o].delete()}_track(o,u,p,g){const v=this._consumers,E=v[o]=v[o]||{},A=E[u]||{},R=A.resourceId&amp;&amp;this._resources[A.resourceId];R&amp;&amp;(R.unsubscribe(A),this.prune()),p&amp;&amp;(E[u]=A,A.onChange=g,A.resourceId=p.id,p.subscribe(A))}_prune(){this._pruneRequest=null;for(const o of Object.keys(this._resources)){const u=this._resources[o];!u.persistent&amp;&amp;!u.inUse()&amp;&amp;(u.delete(),delete this._resources[o])}}}const vU=[MM],bU=["vs:DECKGL_FILTER_SIZE(inout vec3 size, VertexGeometry geometry)","vs:DECKGL_FILTER_GL_POSITION(inout vec4 position, VertexGeometry geometry)","vs:DECKGL_FILTER_COLOR(inout vec4 color, VertexGeometry geometry)","fs:DECKGL_FILTER_COLOR(inout vec4 color, FragmentGeometry geometry)"];function wU(c){const o=Df.getDefaultProgramManager(c);for(const u of vU)o.addDefaultModule(u);for(const u of bU)o.addShaderHook(u);return o}const TU="layerManager.setLayers",EU="layerManager.activateViewport";class SU{constructor(o,{deck:u,stats:p,viewport:g,timeline:v}={}){et(this,"layers",void 0),et(this,"context",void 0),et(this,"resourceManager",void 0),et(this,"_lastRenderedLayers",[]),et(this,"_needsRedraw",!1),et(this,"_needsUpdate",!1),et(this,"_nextLayers",null),et(this,"_debug",!1),et(this,"activateViewport",E=&gt;{Hg(EU,this,E),E&amp;&amp;(this.context.viewport=E)}),this.layers=[],this.resourceManager=new xU({gl:o,protocol:"deck://"}),this.context={mousePosition:null,userData:{},layerManager:this,gl:o,deck:u,programManager:o&amp;&amp;wU(o),stats:p||new Ay({id:"deck.gl"}),viewport:g||new Xl({id:"DEFAULT-INITIAL-VIEWPORT"}),timeline:v||new wM,resourceManager:this.resourceManager,onError:void 0},Object.seal(this)}finalize(){this.resourceManager.finalize();for(const o of this.layers)this._finalizeLayer(o)}needsRedraw(o={clearRedrawFlags:!1}){let u=this._needsRedraw;o.clearRedrawFlags&amp;&amp;(this._needsRedraw=!1);for(const p of this.layers){const g=p.getNeedsRedraw(o);u=u||g}return u}needsUpdate(){return this._nextLayers&amp;&amp;this._nextLayers!==this._lastRenderedLayers?"layers changed":this._needsUpdate}setNeedsRedraw(o){this._needsRedraw=this._needsRedraw||o}setNeedsUpdate(o){this._needsUpdate=this._needsUpdate||o}getLayers({layerIds:o}={}){return o?this.layers.filter(u=&gt;o.find(p=&gt;u.id.indexOf(p)===0)):this.layers}setProps(o){"debug"in o&amp;&amp;(this._debug=o.debug),"userData"in o&amp;&amp;(this.context.userData=o.userData),"layers"in o&amp;&amp;(this._nextLayers=o.layers),"onError"in o&amp;&amp;(this.context.onError=o.onError)}setLayers(o,u){Hg(TU,this,u,o),this._lastRenderedLayers=o;const p=DM(o,Boolean);for(const g of p)g.context=this.context;this._updateLayers(this.layers,p)}updateLayers(){const o=this.needsUpdate();o&amp;&amp;(this.setNeedsRedraw("updating layers: ".concat(o)),this.setLayers(this._nextLayers||this._lastRenderedLayers,o)),this._nextLayers=null}_handleError(o,u,p){p.raiseError(u,"".concat(o," of ").concat(p))}_updateLayers(o,u){const p={};for(const E of o)p[E.id]?Pr.warn("Multiple old layers with same id ".concat(E.id))():p[E.id]=E;const g=[];this._updateSublayersRecursively(u,p,g),this._finalizeOldLayers(p);let v=!1;for(const E of g)if(E.hasUniformTransition()){v="Uniform transition in ".concat(E);break}this._needsUpdate=v,this.layers=g}_updateSublayersRecursively(o,u,p){for(const g of o){g.context=this.context;const v=u[g.id];v===null&amp;&amp;Pr.warn("Multiple new layers with same id ".concat(g.id))(),u[g.id]=null;let E=null;try{this._debug&amp;&amp;v!==g&amp;&amp;g.validateProps(),v?(this._transferLayerState(v,g),this._updateLayer(g)):this._initializeLayer(g),p.push(g),E=g.isComposite?g.getSubLayers():null}catch(A){this._handleError("matching",A,g)}E&amp;&amp;this._updateSublayersRecursively(E,u,p)}}_finalizeOldLayers(o){for(const u in o){const p=o[u];p&amp;&amp;this._finalizeLayer(p)}}_initializeLayer(o){try{o._initialize(),o.lifecycle=hu.INITIALIZED}catch(u){this._handleError("initialization",u,o)}}_transferLayerState(o,u){u._transferState(o),u.lifecycle=hu.MATCHED,u!==o&amp;&amp;(o.lifecycle=hu.AWAITING_GC)}_updateLayer(o){try{o._update()}catch(u){this._handleError("update",u,o)}}_finalizeLayer(o){this._needsRedraw=this._needsRedraw||"finalized ".concat(o),o.lifecycle=hu.AWAITING_FINALIZATION;try{o._finalize(),o.lifecycle=hu.FINALIZED}catch(u){this._handleError("finalization",u,o)}}}function ql(c,o,u){if(c===o)return!0;if(!u||!c||!o)return!1;if(Array.isArray(c)){if(!Array.isArray(o)||c.length!==o.length)return!1;for(let p=0;p&lt;c.length;p++)if(!ql(c[p],o[p],u-1))return!1;return!0}if(Array.isArray(o))return!1;if(typeof c=="object"&amp;&amp;typeof o=="object"){const p=Object.keys(c),g=Object.keys(o);if(p.length!==g.length)return!1;for(const v of p)if(!o.hasOwnProperty(v)||!ql(c[v],o[v],u-1))return!1;return!0}return!1}class AU{constructor(o){et(this,"width",void 0),et(this,"height",void 0),et(this,"views",void 0),et(this,"viewState",void 0),et(this,"controllers",void 0),et(this,"timeline",void 0),et(this,"_viewports",void 0),et(this,"_viewportMap",void 0),et(this,"_isUpdating",void 0),et(this,"_needsRedraw",void 0),et(this,"_needsUpdate",void 0),et(this,"_eventManager",void 0),et(this,"_eventCallbacks",void 0),this.views=[],this.width=100,this.height=100,this.viewState={},this.controllers={},this.timeline=o.timeline,this._viewports=[],this._viewportMap={},this._isUpdating=!1,this._needsRedraw="First render",this._needsUpdate="Initialize",this._eventManager=o.eventManager,this._eventCallbacks={onViewStateChange:o.onViewStateChange,onInteractionStateChange:o.onInteractionStateChange},Object.seal(this),this.setProps(o)}finalize(){for(const o in this.controllers){const u=this.controllers[o];u&amp;&amp;u.finalize()}this.controllers={}}needsRedraw(o={clearRedrawFlags:!1}){const u=this._needsRedraw;return o.clearRedrawFlags&amp;&amp;(this._needsRedraw=!1),u}setNeedsUpdate(o){this._needsUpdate=this._needsUpdate||o,this._needsRedraw=this._needsRedraw||o}updateViewStates(){for(const o in this.controllers){const u=this.controllers[o];u&amp;&amp;u.updateTransition()}}getViewports(o){return o?this._viewports.filter(u=&gt;u.containsPixel(o)):this._viewports}getViews(){const o={};return this.views.forEach(u=&gt;{o[u.id]=u}),o}getView(o){return this.views.find(u=&gt;u.id===o)}getViewState(o){const u=typeof o=="string"?this.getView(o):o,p=u&amp;&amp;this.viewState[u.getViewStateId()]||this.viewState;return u?u.filterViewState(p):p}getViewport(o){return this._viewportMap[o]}unproject(o,u){const p=this.getViewports(),g={x:o[0],y:o[1]};for(let v=p.length-1;v&gt;=0;--v){const E=p[v];if(E.containsPixel(g)){const A=o.slice();return A[0]-=E.x,A[1]-=E.y,E.unproject(A,u)}}return null}setProps(o){o.views&amp;&amp;this._setViews(o.views),o.viewState&amp;&amp;this._setViewState(o.viewState),("width"in o||"height"in o)&amp;&amp;this._setSize(o.width,o.height),this._isUpdating||this._update()}_update(){this._isUpdating=!0,this._needsUpdate&amp;&amp;(this._needsUpdate=!1,this._rebuildViewports()),this._needsUpdate&amp;&amp;(this._needsUpdate=!1,this._rebuildViewports()),this._isUpdating=!1}_setSize(o,u){(o!==this.width||u!==this.height)&amp;&amp;(this.width=o,this.height=u,this.setNeedsUpdate("Size changed"))}_setViews(o){o=DM(o,Boolean),this._diffViews(o,this.views)&amp;&amp;this.setNeedsUpdate("views changed"),this.views=o}_setViewState(o){o?(!ql(o,this.viewState,3)&amp;&amp;this.setNeedsUpdate("viewState changed"),this.viewState=o):Pr.warn("missing `viewState` or `initialViewState`")()}_onViewStateChange(o,u){this._eventCallbacks.onViewStateChange&amp;&amp;this._eventCallbacks.onViewStateChange({...u,viewId:o})}_createController(o,u){const p=u.type;return new p({timeline:this.timeline,eventManager:this._eventManager,onViewStateChange:this._onViewStateChange.bind(this,u.id),onStateChange:this._eventCallbacks.onInteractionStateChange,makeViewport:v=&gt;{var E;return(E=this.getView(o.id))===null||E===void 0?void 0:E.makeViewport({viewState:v,width:this.width,height:this.height})}})}_updateController(o,u,p,g){const v=o.controller;if(v&amp;&amp;p){const E={...u,...v,id:o.id,x:p.x,y:p.y,width:p.width,height:p.height};return(!g||g.constructor!==v.type)&amp;&amp;(g=this._createController(o,E)),g&amp;&amp;g.setProps(E),g}return null}_rebuildViewports(){const{views:o}=this,u=this.controllers;this._viewports=[],this.controllers={};let p=!1;for(let g=o.length;g--;){const v=o[g],E=this.getViewState(v),A=v.makeViewport({viewState:E,width:this.width,height:this.height});let R=u[v.id];const L=!!v.controller;L&amp;&amp;!R&amp;&amp;(p=!0),(p||!L)&amp;&amp;R&amp;&amp;(R.finalize(),R=null),this.controllers[v.id]=this._updateController(v,E,A,R),A&amp;&amp;this._viewports.unshift(A)}for(const g in u){const v=u[g];v&amp;&amp;!this.controllers[g]&amp;&amp;v.finalize()}this._buildViewportMap()}_buildViewportMap(){this._viewportMap={},this._viewports.forEach(o=&gt;{o.id&amp;&amp;(this._viewportMap[o.id]=this._viewportMap[o.id]||o)})}_diffViews(o,u){return o.length!==u.length?!0:o.some((p,g)=&gt;!o[g].equals(u[g]))}}const MU=/([0-9]+\.?[0-9]*)(%|px)/;function jo(c){switch(typeof c){case"number":return{position:c,relative:!1};case"string":const o=MU.exec(c);if(o&amp;&amp;o.length&gt;=3){const u=o[2]==="%",p=parseFloat(o[1]);return{position:u?p/100:p,relative:u}}default:throw new Error("Could not parse position string ".concat(c))}}function Go(c,o){return c.relative?Math.round(c.position*o):c.position}function ro(c,o){if(!c)throw new Error(o||"deck.gl: assertion failed.")}class IU{constructor(o){et(this,"id",void 0),et(this,"viewportInstance",void 0),et(this,"_x",void 0),et(this,"_y",void 0),et(this,"_width",void 0),et(this,"_height",void 0),et(this,"_padding",void 0),et(this,"props",void 0);const{id:u,x:p=0,y:g=0,width:v="100%",height:E="100%",padding:A=null,viewportInstance:R}=o||{};ro(!R||R instanceof Xl),this.viewportInstance=R,this.id=u||this.constructor.displayName||"view",this.props={...o,id:this.id},this._x=jo(p),this._y=jo(g),this._width=jo(v),this._height=jo(E),this._padding=A&amp;&amp;{left:jo(A.left||0),right:jo(A.right||0),top:jo(A.top||0),bottom:jo(A.bottom||0)},this.equals=this.equals.bind(this),Object.seal(this)}equals(o){return this===o?!0:this.viewportInstance?o.viewportInstance?this.viewportInstance.equals(o.viewportInstance):!1:this.ViewportType===o.ViewportType&amp;&amp;ql(this.props,o.props,2)}makeViewport({width:o,height:u,viewState:p}){if(this.viewportInstance)return this.viewportInstance;p=this.filterViewState(p);const g=this.getDimensions({width:o,height:u});return!g.height||!g.width?null:new this.ViewportType({...p,...this.props,...g})}getViewStateId(){const{viewState:o}=this.props;return typeof o=="string"?o:(o==null?void 0:o.id)||this.id}filterViewState(o){if(this.props.viewState&amp;&amp;typeof this.props.viewState=="object"){if(!this.props.viewState.id)return this.props.viewState;const u={...o};for(const p in this.props.viewState)p!=="id"&amp;&amp;(u[p]=this.props.viewState[p]);return u}return o}getDimensions({width:o,height:u}){const p={x:Go(this._x,o),y:Go(this._y,u),width:Go(this._width,o),height:Go(this._height,u)};return this._padding&amp;&amp;(p.padding={left:Go(this._padding.left,o),top:Go(this._padding.top,u),right:Go(this._padding.right,o),bottom:Go(this._padding.bottom,u)}),p}get controller(){const o=this.props.controller;return o?o===!0?{type:this.ControllerType}:typeof o=="function"?{type:o}:{type:this.ControllerType,...o}:null}}class PU{constructor(o){et(this,"_inProgress",void 0),et(this,"_handle",void 0),et(this,"_timeline",void 0),et(this,"time",void 0),et(this,"settings",void 0),this._inProgress=!1,this._handle=null,this._timeline=o,this.time=0,this.settings={duration:0}}get inProgress(){return this._inProgress}start(o){var u,p;this.cancel(),this.settings=o,this._inProgress=!0,(u=(p=this.settings).onStart)===null||u===void 0||u.call(p,this)}end(){if(this._inProgress){var o,u;this._timeline.removeChannel(this._handle),this._handle=null,this._inProgress=!1,(o=(u=this.settings).onEnd)===null||o===void 0||o.call(u,this)}}cancel(){if(this._inProgress){var o,u;(o=(u=this.settings).onInterrupt)===null||o===void 0||o.call(u,this),this._timeline.removeChannel(this._handle),this._handle=null,this._inProgress=!1}}update(){var o,u;if(!this._inProgress)return!1;if(this._handle===null){const{_timeline:p,settings:g}=this;this._handle=p.addChannel({delay:p.getTime(),duration:g.duration})}return this.time=this._timeline.getTime(this._handle),this._onUpdate(),(o=(u=this.settings).onUpdate)===null||o===void 0||o.call(u,this),this._timeline.isFinished(this._handle)&amp;&amp;this.end(),!0}_onUpdate(){}}const $S=()=&gt;{},ny={BREAK:1,SNAP_TO_END:2,IGNORE:3},CU=c=&gt;c,LU=ny.BREAK;class RU{constructor(o){et(this,"getControllerState",void 0),et(this,"props",void 0),et(this,"propsInTransition",void 0),et(this,"transition",void 0),et(this,"onViewStateChange",void 0),et(this,"onStateChange",void 0),et(this,"_onTransitionUpdate",u=&gt;{const{time:p,settings:{interpolator:g,startProps:v,endProps:E,duration:A,easing:R}}=u,L=R(p/A),G=g.interpolateProps(v,E,L);this.propsInTransition=this.getControllerState({...this.props,...G}).getViewportProps(),this.onViewStateChange({viewState:this.propsInTransition,oldViewState:this.props})}),this.getControllerState=o.getControllerState,this.propsInTransition=null,this.transition=new PU(o.timeline),this.onViewStateChange=o.onViewStateChange||$S,this.onStateChange=o.onStateChange||$S}finalize(){this.transition.cancel()}getViewportInTransition(){return this.propsInTransition}processViewStateChange(o){let u=!1;const p=this.props;if(this.props=o,!p||this._shouldIgnoreViewportChange(p,o))return!1;if(this._isTransitionEnabled(o)){let g=p;if(this.transition.inProgress){const{interruption:v,endProps:E}=this.transition.settings;g={...p,...v===ny.SNAP_TO_END?E:this.propsInTransition||p}}this._triggerTransition(g,o),u=!0}else this.transition.cancel();return u}updateTransition(){this.transition.update()}_isTransitionEnabled(o){const{transitionDuration:u,transitionInterpolator:p}=o;return(u&gt;0||u==="auto")&amp;&amp;!!p}_isUpdateDueToCurrentTransition(o){return this.transition.inProgress&amp;&amp;this.propsInTransition?this.transition.settings.interpolator.arePropsEqual(o,this.propsInTransition):!1}_shouldIgnoreViewportChange(o,u){return this.transition.inProgress?this.transition.settings.interruption===ny.IGNORE||this._isUpdateDueToCurrentTransition(u):this._isTransitionEnabled(u)?u.transitionInterpolator.arePropsEqual(o,u):!0}_triggerTransition(o,u){const p=this.getControllerState(o),g=this.getControllerState(u).shortestPathFrom(p),v=u.transitionInterpolator,E=v.getDuration?v.getDuration(o,u):u.transitionDuration;if(E===0)return;const A=v.initializeProps(o,g);this.propsInTransition={};const R={duration:E,easing:u.transitionEasing||CU,interpolator:v,interruption:u.transitionInterruption||LU,startProps:A.start,endProps:A.end,onStart:u.onTransitionStart,onUpdate:this._onTransitionUpdate,onInterrupt:this._onTransitionEnd(u.onTransitionInterrupt),onEnd:this._onTransitionEnd(u.onTransitionEnd)};this.transition.start(R),this.onStateChange({inTransition:!0}),this.updateTransition()}_onTransitionEnd(o){return u=&gt;{this.propsInTransition=null,this.onStateChange({inTransition:!1,isZooming:!1,isPanning:!1,isRotating:!1}),o==null||o(u)}}}class DU{constructor(o){et(this,"_propsToCompare",void 0),et(this,"_propsToExtract",void 0),et(this,"_requiredProps",void 0);const{compare:u,extract:p,required:g}=o;this._propsToCompare=u,this._propsToExtract=p||u,this._requiredProps=g}arePropsEqual(o,u){for(const p of this._propsToCompare)if(!(p in o)||!(p in u)||!wu(o[p],u[p]))return!1;return!0}initializeProps(o,u){const p={},g={};for(const v of this._propsToExtract)(v in o||v in u)&amp;&amp;(p[v]=o[v],g[v]=u[v]);return this._checkRequiredProps(p),this._checkRequiredProps(g),{start:p,end:g}}getDuration(o,u){return u.transitionDuration}_checkRequiredProps(o){this._requiredProps&amp;&amp;this._requiredProps.forEach(u=&gt;{const p=o[u];ro(Number.isFinite(p)||Array.isArray(p),"".concat(u," is required for transition"))})}}const OU=["longitude","latitude","zoom","bearing","pitch"],kU=["longitude","latitude","zoom"];class kM extends DU{constructor(o={}){const u=Array.isArray(o)?o:o.transitionProps,p=Array.isArray(o)?{}:o;p.transitionProps=Array.isArray(u)?{compare:u,required:u}:u||{compare:OU,required:kU},super(p.transitionProps),et(this,"opts",void 0),this.opts=p}initializeProps(o,u){const p=super.initializeProps(o,u),{makeViewport:g,around:v}=this.opts;if(g&amp;&amp;v){const E=g(o),A=g(u),R=E.unproject(v);p.start.around=v,Object.assign(p.end,{around:A.project(R),aroundPosition:R,width:u.width,height:u.height})}return p}interpolateProps(o,u,p){const g={};for(const v of this._propsToExtract)g[v]=Jg(o[v]||0,u[v]||0,p);if(u.aroundPosition&amp;&amp;this.opts.makeViewport){const v=this.opts.makeViewport({...u,...g});Object.assign(g,v.panByPosition(u.aroundPosition,Jg(o.around,u.around,p)))}return g}}const Ho={transitionDuration:0},zU=300,tf=c=&gt;1-(1-c)*(1-c),Ol={WHEEL:["wheel"],PAN:["panstart","panmove","panend"],PINCH:["pinchstart","pinchmove","pinchend"],TRIPLE_PAN:["tripanstart","tripanmove","tripanend"],DOUBLE_TAP:["doubletap"],KEYBOARD:["keydown"]},Ta={};class FU{constructor(o){et(this,"props",void 0),et(this,"state",{}),et(this,"transitionManager",void 0),et(this,"eventManager",void 0),et(this,"onViewStateChange",void 0),et(this,"onStateChange",void 0),et(this,"makeViewport",void 0),et(this,"_controllerState",void 0),et(this,"_events",{}),et(this,"_interactionState",{isDragging:!1}),et(this,"_customEvents",[]),et(this,"_eventStartBlocked",null),et(this,"_panMove",!1),et(this,"invertPan",!1),et(this,"dragMode","rotate"),et(this,"inertia",0),et(this,"scrollZoom",!0),et(this,"dragPan",!0),et(this,"dragRotate",!0),et(this,"doubleClickZoom",!0),et(this,"touchZoom",!0),et(this,"touchRotate",!1),et(this,"keyboard",!0),this.transitionManager=new RU({...o,getControllerState:u=&gt;new this.ControllerState(u),onViewStateChange:this._onTransition.bind(this),onStateChange:this._setInteractionState.bind(this)}),this.handleEvent=this.handleEvent.bind(this),this.eventManager=o.eventManager,this.onViewStateChange=o.onViewStateChange||(()=&gt;{}),this.onStateChange=o.onStateChange||(()=&gt;{}),this.makeViewport=o.makeViewport}set events(o){this.toggleEvents(this._customEvents,!1),this.toggleEvents(o,!0),this._customEvents=o,this.props&amp;&amp;this.setProps(this.props)}finalize(){for(const u in this._events)if(this._events[u]){var o;(o=this.eventManager)===null||o===void 0||o.off(u,this.handleEvent)}this.transitionManager.finalize()}handleEvent(o){this._controllerState=void 0;const u=this._eventStartBlocked;switch(o.type){case"panstart":return u?!1:this._onPanStart(o);case"panmove":return this._onPan(o);case"panend":return this._onPanEnd(o);case"pinchstart":return u?!1:this._onPinchStart(o);case"pinchmove":return this._onPinch(o);case"pinchend":return this._onPinchEnd(o);case"tripanstart":return u?!1:this._onTriplePanStart(o);case"tripanmove":return this._onTriplePan(o);case"tripanend":return this._onTriplePanEnd(o);case"doubletap":return this._onDoubleTap(o);case"wheel":return this._onWheel(o);case"keydown":return this._onKeyDown(o);default:return!1}}get controllerState(){return this._controllerState=this._controllerState||new this.ControllerState({makeViewport:this.makeViewport,...this.props,...this.state}),this._controllerState}getCenter(o){const{x:u,y:p}=this.props,{offsetCenter:g}=o;return[g.x-u,g.y-p]}isPointInBounds(o,u){const{width:p,height:g}=this.props;if(u&amp;&amp;u.handled)return!1;const v=o[0]&gt;=0&amp;&amp;o[0]&lt;=p&amp;&amp;o[1]&gt;=0&amp;&amp;o[1]&lt;=g;return v&amp;&amp;u&amp;&amp;u.stopPropagation(),v}isFunctionKeyPressed(o){const{srcEvent:u}=o;return!!(u.metaKey||u.altKey||u.ctrlKey||u.shiftKey)}isDragging(){return this._interactionState.isDragging||!1}blockEvents(o){const u=setTimeout(()=&gt;{this._eventStartBlocked===u&amp;&amp;(this._eventStartBlocked=null)},o);this._eventStartBlocked=u}setProps(o){o.dragMode&amp;&amp;(this.dragMode=o.dragMode),this.props=o,"transitionInterpolator"in o||(o.transitionInterpolator=this._getTransitionProps().transitionInterpolator),this.transitionManager.processViewStateChange(o);const{inertia:u}=o;this.inertia=Number.isFinite(u)?u:u===!0?zU:0;const{scrollZoom:p=!0,dragPan:g=!0,dragRotate:v=!0,doubleClickZoom:E=!0,touchZoom:A=!0,touchRotate:R=!1,keyboard:L=!0}=o,G=!!this.onViewStateChange;this.toggleEvents(Ol.WHEEL,G&amp;&amp;p),this.toggleEvents(Ol.PAN,G),this.toggleEvents(Ol.PINCH,G&amp;&amp;(A||R)),this.toggleEvents(Ol.TRIPLE_PAN,G&amp;&amp;R),this.toggleEvents(Ol.DOUBLE_TAP,G&amp;&amp;E),this.toggleEvents(Ol.KEYBOARD,G&amp;&amp;L),this.scrollZoom=p,this.dragPan=g,this.dragRotate=v,this.doubleClickZoom=E,this.touchZoom=A,this.touchRotate=R,this.keyboard=L}updateTransition(){this.transitionManager.updateTransition()}toggleEvents(o,u){this.eventManager&amp;&amp;o.forEach(p=&gt;{this._events[p]!==u&amp;&amp;(this._events[p]=u,u?this.eventManager.on(p,this.handleEvent):this.eventManager.off(p,this.handleEvent))})}updateViewport(o,u=null,p={}){const g={...o.getViewportProps(),...u},v=this.controllerState!==o;if(this.state=o.getState(),this._setInteractionState(p),v){const E=this.controllerState&amp;&amp;this.controllerState.getViewportProps();this.onViewStateChange&amp;&amp;this.onViewStateChange({viewState:g,interactionState:this._interactionState,oldViewState:E})}}_onTransition(o){this.onViewStateChange({...o,interactionState:this._interactionState})}_setInteractionState(o){Object.assign(this._interactionState,o),this.onStateChange(this._interactionState)}_onPanStart(o){const u=this.getCenter(o);if(!this.isPointInBounds(u,o))return!1;let p=this.isFunctionKeyPressed(o)||o.rightButton||!1;(this.invertPan||this.dragMode==="pan")&amp;&amp;(p=!p);const g=this.controllerState[p?"panStart":"rotateStart"]({pos:u});return this._panMove=p,this.updateViewport(g,Ho,{isDragging:!0}),!0}_onPan(o){return this.isDragging()?this._panMove?this._onPanMove(o):this._onPanRotate(o):!1}_onPanEnd(o){return this.isDragging()?this._panMove?this._onPanMoveEnd(o):this._onPanRotateEnd(o):!1}_onPanMove(o){if(!this.dragPan)return!1;const u=this.getCenter(o),p=this.controllerState.pan({pos:u});return this.updateViewport(p,Ho,{isDragging:!0,isPanning:!0}),!0}_onPanMoveEnd(o){const{inertia:u}=this;if(this.dragPan&amp;&amp;u&amp;&amp;o.velocity){const p=this.getCenter(o),g=[p[0]+o.velocityX*u/2,p[1]+o.velocityY*u/2],v=this.controllerState.pan({pos:g}).panEnd();this.updateViewport(v,{...this._getTransitionProps(),transitionDuration:u,transitionEasing:tf},{isDragging:!1,isPanning:!0})}else{const p=this.controllerState.panEnd();this.updateViewport(p,null,{isDragging:!1,isPanning:!1})}return!0}_onPanRotate(o){if(!this.dragRotate)return!1;const u=this.getCenter(o),p=this.controllerState.rotate({pos:u});return this.updateViewport(p,Ho,{isDragging:!0,isRotating:!0}),!0}_onPanRotateEnd(o){const{inertia:u}=this;if(this.dragRotate&amp;&amp;u&amp;&amp;o.velocity){const p=this.getCenter(o),g=[p[0]+o.velocityX*u/2,p[1]+o.velocityY*u/2],v=this.controllerState.rotate({pos:g}).rotateEnd();this.updateViewport(v,{...this._getTransitionProps(),transitionDuration:u,transitionEasing:tf},{isDragging:!1,isRotating:!0})}else{const p=this.controllerState.rotateEnd();this.updateViewport(p,null,{isDragging:!1,isRotating:!1})}return!0}_onWheel(o){if(!this.scrollZoom)return!1;const u=this.getCenter(o);if(!this.isPointInBounds(u,o))return!1;o.srcEvent.preventDefault();const{speed:p=.01,smooth:g=!1}=this.scrollZoom===!0?{}:this.scrollZoom,{delta:v}=o;let E=2/(1+Math.exp(-Math.abs(v*p)));v&lt;0&amp;&amp;E!==0&amp;&amp;(E=1/E);const A=this.controllerState.zoom({pos:u,scale:E});return this.updateViewport(A,{...this._getTransitionProps({around:u}),transitionDuration:g?250:1},{isZooming:!0,isPanning:!0}),!0}_onTriplePanStart(o){const u=this.getCenter(o);if(!this.isPointInBounds(u,o))return!1;const p=this.controllerState.rotateStart({pos:u});return this.updateViewport(p,Ho,{isDragging:!0}),!0}_onTriplePan(o){if(!this.touchRotate||!this.isDragging())return!1;const u=this.getCenter(o);u[0]-=o.deltaX;const p=this.controllerState.rotate({pos:u});return this.updateViewport(p,Ho,{isDragging:!0,isRotating:!0}),!0}_onTriplePanEnd(o){if(!this.isDragging())return!1;const{inertia:u}=this;if(this.touchRotate&amp;&amp;u&amp;&amp;o.velocityY){const p=this.getCenter(o),g=[p[0],p[1]+=o.velocityY*u/2],v=this.controllerState.rotate({pos:g});this.updateViewport(v,{...this._getTransitionProps(),transitionDuration:u,transitionEasing:tf},{isDragging:!1,isRotating:!0}),this.blockEvents(u)}else{const p=this.controllerState.rotateEnd();this.updateViewport(p,null,{isDragging:!1,isRotating:!1})}return!0}_onPinchStart(o){const u=this.getCenter(o);if(!this.isPointInBounds(u,o))return!1;const p=this.controllerState.zoomStart({pos:u}).rotateStart({pos:u});return Ta._startPinchRotation=o.rotation,Ta._lastPinchEvent=o,this.updateViewport(p,Ho,{isDragging:!0}),!0}_onPinch(o){if(!this.touchZoom&amp;&amp;!this.touchRotate||!this.isDragging())return!1;let u=this.controllerState;if(this.touchZoom){const{scale:p}=o,g=this.getCenter(o);u=u.zoom({pos:g,scale:p})}if(this.touchRotate){const{rotation:p}=o;u=u.rotate({deltaAngleX:Ta._startPinchRotation-p})}return this.updateViewport(u,Ho,{isDragging:!0,isPanning:this.touchZoom,isZooming:this.touchZoom,isRotating:this.touchRotate}),Ta._lastPinchEvent=o,!0}_onPinchEnd(o){if(!this.isDragging())return!1;const{inertia:u}=this,{_lastPinchEvent:p}=Ta;if(this.touchZoom&amp;&amp;u&amp;&amp;p&amp;&amp;o.scale!==p.scale){const g=this.getCenter(o);let v=this.controllerState.rotateEnd();const E=Math.log2(o.scale),A=(E-Math.log2(p.scale))/(o.deltaTime-p.deltaTime),R=Math.pow(2,E+A*u/2);v=v.zoom({pos:g,scale:R}).zoomEnd(),this.updateViewport(v,{...this._getTransitionProps({around:g}),transitionDuration:u,transitionEasing:tf},{isDragging:!1,isPanning:this.touchZoom,isZooming:this.touchZoom,isRotating:!1}),this.blockEvents(u)}else{const g=this.controllerState.zoomEnd().rotateEnd();this.updateViewport(g,null,{isDragging:!1,isPanning:!1,isZooming:!1,isRotating:!1})}return Ta._startPinchRotation=null,Ta._lastPinchEvent=null,!0}_onDoubleTap(o){if(!this.doubleClickZoom)return!1;const u=this.getCenter(o);if(!this.isPointInBounds(u,o))return!1;const p=this.isFunctionKeyPressed(o),g=this.controllerState.zoom({pos:u,scale:p?.5:2});return this.updateViewport(g,this._getTransitionProps({around:u}),{isZooming:!0,isPanning:!0}),this.blockEvents(100),!0}_onKeyDown(o){if(!this.keyboard)return!1;const u=this.isFunctionKeyPressed(o),{zoomSpeed:p,moveSpeed:g,rotateSpeedX:v,rotateSpeedY:E}=this.keyboard===!0?{}:this.keyboard,{controllerState:A}=this;let R;const L={};switch(o.srcEvent.code){case"Minus":R=u?A.zoomOut(p).zoomOut(p):A.zoomOut(p),L.isZooming=!0;break;case"Equal":R=u?A.zoomIn(p).zoomIn(p):A.zoomIn(p),L.isZooming=!0;break;case"ArrowLeft":u?(R=A.rotateLeft(v),L.isRotating=!0):(R=A.moveLeft(g),L.isPanning=!0);break;case"ArrowRight":u?(R=A.rotateRight(v),L.isRotating=!0):(R=A.moveRight(g),L.isPanning=!0);break;case"ArrowUp":u?(R=A.rotateUp(E),L.isRotating=!0):(R=A.moveUp(g),L.isPanning=!0);break;case"ArrowDown":u?(R=A.rotateDown(E),L.isRotating=!0):(R=A.moveDown(g),L.isPanning=!0);break;default:return!1}return this.updateViewport(R,this._getTransitionProps(),L),!0}_getTransitionProps(o){const{transition:u}=this;return!u||!u.transitionInterpolator?Ho:o?{...u,transitionInterpolator:new kM({...o,...u.transitionInterpolator.opts,makeViewport:this.controllerState.makeViewport})}:u}}class BU{constructor(o,u){et(this,"_viewportProps",void 0),et(this,"_state",void 0),this._viewportProps=this.applyConstraints(o),this._state=u}getViewportProps(){return this._viewportProps}getState(){return this._state}}const XS=5,NU=1.2;class UU extends BU{constructor(o){const{width:u,height:p,latitude:g,longitude:v,zoom:E,bearing:A=0,pitch:R=0,altitude:L=1.5,position:G=[0,0,0],maxZoom:j=20,minZoom:H=0,maxPitch:ht=60,minPitch:mt=0,startPanLngLat:gt,startZoomLngLat:Pt,startRotatePos:Vt,startBearing:Nt,startPitch:jt,startZoom:Qt,normalize:ae=!0}=o;ro(Number.isFinite(v)),ro(Number.isFinite(g)),ro(Number.isFinite(E)),super({width:u,height:p,latitude:g,longitude:v,zoom:E,bearing:A,pitch:R,altitude:L,maxZoom:j,minZoom:H,maxPitch:ht,minPitch:mt,normalize:ae,position:G},{startPanLngLat:gt,startZoomLngLat:Pt,startRotatePos:Vt,startBearing:Nt,startPitch:jt,startZoom:Qt}),et(this,"makeViewport",void 0),this.makeViewport=o.makeViewport}panStart({pos:o}){return this._getUpdatedState({startPanLngLat:this._unproject(o)})}pan({pos:o,startPos:u}){const p=this.getState().startPanLngLat||this._unproject(u);if(!p)return this;const v=this.makeViewport(this.getViewportProps()).panByPosition(p,o);return this._getUpdatedState(v)}panEnd(){return this._getUpdatedState({startPanLngLat:null})}rotateStart({pos:o}){return this._getUpdatedState({startRotatePos:o,startBearing:this.getViewportProps().bearing,startPitch:this.getViewportProps().pitch})}rotate({pos:o,deltaAngleX:u=0,deltaAngleY:p=0}){const{startRotatePos:g,startBearing:v,startPitch:E}=this.getState();if(!g||v===void 0||E===void 0)return this;let A;return o?A=this._getNewRotation(o,g,E,v):A={bearing:v+u,pitch:E+p},this._getUpdatedState(A)}rotateEnd(){return this._getUpdatedState({startBearing:null,startPitch:null})}zoomStart({pos:o}){return this._getUpdatedState({startZoomLngLat:this._unproject(o),startZoom:this.getViewportProps().zoom})}zoom({pos:o,startPos:u,scale:p}){let{startZoom:g,startZoomLngLat:v}=this.getState();if(v||(g=this.getViewportProps().zoom,v=this._unproject(u)||this._unproject(o)),!v)return this;const{maxZoom:E,minZoom:A}=this.getViewportProps();let R=g+Math.log2(p);R=Wo(R,A,E);const L=this.makeViewport({...this.getViewportProps(),zoom:R});return this._getUpdatedState({zoom:R,...L.panByPosition(v,o)})}zoomEnd(){return this._getUpdatedState({startZoomLngLat:null,startZoom:null})}zoomIn(o=2){return this._zoomFromCenter(o)}zoomOut(o=2){return this._zoomFromCenter(1/o)}moveLeft(o=100){return this._panFromCenter([o,0])}moveRight(o=100){return this._panFromCenter([-o,0])}moveUp(o=100){return this._panFromCenter([0,o])}moveDown(o=100){return this._panFromCenter([0,-o])}rotateLeft(o=15){return this._getUpdatedState({bearing:this.getViewportProps().bearing-o})}rotateRight(o=15){return this._getUpdatedState({bearing:this.getViewportProps().bearing+o})}rotateUp(o=10){return this._getUpdatedState({pitch:this.getViewportProps().pitch+o})}rotateDown(o=10){return this._getUpdatedState({pitch:this.getViewportProps().pitch-o})}shortestPathFrom(o){const u=o.getViewportProps(),p={...this.getViewportProps()},{bearing:g,longitude:v}=p;return Math.abs(g-u.bearing)&gt;180&amp;&amp;(p.bearing=g&lt;0?g+360:g-360),Math.abs(v-u.longitude)&gt;180&amp;&amp;(p.longitude=v&lt;0?v+360:v-360),p}applyConstraints(o){const{maxZoom:u,minZoom:p,zoom:g}=o;o.zoom=Wo(g,p,u);const{maxPitch:v,minPitch:E,pitch:A}=o;o.pitch=Wo(A,E,v);const{normalize:R=!0}=o;return R&amp;&amp;Object.assign(o,X6(o)),o}_zoomFromCenter(o){const{width:u,height:p}=this.getViewportProps();return this.zoom({pos:[u/2,p/2],scale:o})}_panFromCenter(o){const{width:u,height:p}=this.getViewportProps();return this.pan({startPos:[u/2,p/2],pos:[u/2+o[0],p/2+o[1]]})}_getUpdatedState(o){return new this.constructor({makeViewport:this.makeViewport,...this.getViewportProps(),...this.getState(),...o})}_unproject(o){const u=this.makeViewport(this.getViewportProps());return o&amp;&amp;u.unproject(o)}_getNewRotation(o,u,p,g){const v=o[0]-u[0],E=o[1]-u[1],A=o[1],R=u[1],{width:L,height:G}=this.getViewportProps(),j=v/L;let H=0;E&gt;0?Math.abs(G-R)&gt;XS&amp;&amp;(H=E/(R-G)*NU):E&lt;0&amp;&amp;R&gt;XS&amp;&amp;(H=1-A/R),H=Wo(H,-1,1);const{minPitch:ht,maxPitch:mt}=this.getViewportProps(),gt=g+180*j;let Pt=p;return H&gt;0?Pt=p+H*(mt-p):H&lt;0&amp;&amp;(Pt=p-H*(ht-p)),{pitch:Pt,bearing:gt}}}class VU extends FU{constructor(...o){super(...o),et(this,"ControllerState",UU),et(this,"transition",{transitionDuration:300,transitionInterpolator:new kM({transitionProps:{compare:["longitude","latitude","zoom","bearing","pitch","position"],required:["longitude","latitude","zoom"]}})}),et(this,"dragMode","pan")}setProps(o){o.position=o.position||[0,0,0];const u=this.props;super.setProps(o),(!u||u.height!==o.height)&amp;&amp;this.updateViewport(new this.ControllerState({makeViewport:this.makeViewport,...o,...this.state}))}}class zM extends IU{get ViewportType(){return Tu}get ControllerType(){return VU}}et(zM,"displayName","MapView");const jU=new CM;function GU(c,o){var u,p;const g=(u=c.order)!==null&amp;&amp;u!==void 0?u:1/0,v=(p=o.order)!==null&amp;&amp;p!==void 0?p:1/0;return g-v}class HU{constructor(){et(this,"effects",void 0),et(this,"_resolvedEffects",[]),et(this,"_defaultEffects",[]),et(this,"_needsRedraw",void 0),this.effects=[],this._needsRedraw="Initial render",this._setEffects([])}addDefaultEffect(o){const u=this._defaultEffects;if(!u.find(p=&gt;p.id===o.id)){const p=u.findIndex(g=&gt;GU(g,o)&gt;0);p&lt;0?u.push(o):u.splice(p,0,o),this._setEffects(this.effects)}}setProps(o){"effects"in o&amp;&amp;(ql(o.effects,this.effects,1)||this._setEffects(o.effects))}needsRedraw(o={clearRedrawFlags:!1}){const u=this._needsRedraw;return o.clearRedrawFlags&amp;&amp;(this._needsRedraw=!1),u}getEffects(){return this._resolvedEffects}_setEffects(o){const u={};for(const g of this.effects)u[g.id]=g;const p=[];for(const g of o){const v=u[g.id];v&amp;&amp;v!==g?v.setProps?(v.setProps(g.props),p.push(v)):(v.cleanup(),p.push(g)):p.push(g),delete u[g.id]}for(const g in u)u[g].cleanup();this.effects=p,this._resolvedEffects=p.concat(this._defaultEffects),o.some(g=&gt;g instanceof CM)||this._resolvedEffects.push(jU),this._needsRedraw="effects changed"}finalize(){for(const o of this._resolvedEffects)o.cleanup();this.effects.length=0,this._resolvedEffects.length=0,this._defaultEffects.length=0}}class WU extends Ry{shouldDrawLayer(o){const{operation:u}=o.props;return u.includes("draw")||u.includes("terrain")}}const qU="deckRenderer.renderLayers";class ZU{constructor(o){et(this,"gl",void 0),et(this,"layerFilter",void 0),et(this,"drawPickingColors",void 0),et(this,"drawLayersPass",void 0),et(this,"pickLayersPass",void 0),et(this,"renderCount",void 0),et(this,"_needsRedraw",void 0),et(this,"renderBuffers",void 0),et(this,"lastPostProcessEffect",void 0),this.gl=o,this.layerFilter=null,this.drawPickingColors=!1,this.drawLayersPass=new WU(o),this.pickLayersPass=new RM(o),this.renderCount=0,this._needsRedraw="Initial render",this.renderBuffers=[],this.lastPostProcessEffect=null}setProps(o){this.layerFilter!==o.layerFilter&amp;&amp;(this.layerFilter=o.layerFilter,this._needsRedraw="layerFilter changed"),this.drawPickingColors!==o.drawPickingColors&amp;&amp;(this.drawPickingColors=o.drawPickingColors,this._needsRedraw="drawPickingColors changed")}renderLayers(o){if(!o.viewports.length)return;const u=this.drawPickingColors?this.pickLayersPass:this.drawLayersPass,p={layerFilter:this.layerFilter,isPicking:this.drawPickingColors,...o,target:o.target||Cr.getDefaultFramebuffer(this.gl)};p.effects&amp;&amp;this._preRender(p.effects,p);const g=this.lastPostProcessEffect?this.renderBuffers[0]:p.target,v=u.render({...p,target:g});p.effects&amp;&amp;this._postRender(p.effects,p),this.renderCount++,Hg(qU,this,v,o)}needsRedraw(o={clearRedrawFlags:!1}){const u=this._needsRedraw;return o.clearRedrawFlags&amp;&amp;(this._needsRedraw=!1),u}finalize(){const{renderBuffers:o}=this;for(const u of o)u.delete();o.length=0}_preRender(o,u){this.lastPostProcessEffect=null,u.preRenderStats=u.preRenderStats||{};for(const p of o)u.preRenderStats[p.id]=p.preRender(this.gl,u),p.postRender&amp;&amp;(this.lastPostProcessEffect=p.id);this.lastPostProcessEffect&amp;&amp;this._resizeRenderBuffers()}_resizeRenderBuffers(){const{renderBuffers:o}=this;o.length===0&amp;&amp;o.push(new Cr(this.gl),new Cr(this.gl));for(const u of o)u.resize()}_postRender(o,u){const{renderBuffers:p}=this,g={...u,inputBuffer:p[0],swapBuffer:p[1],target:null};for(const v of o)if(v.postRender){if(v.id===this.lastPostProcessEffect){g.target=u.target,v.postRender(this.gl,g);break}const E=v.postRender(this.gl,g);g.inputBuffer=E,g.swapBuffer=E===p[0]?p[1]:p[0]}}}const $U={pickedColor:null,pickedObjectIndex:-1};function XU({pickedColors:c,decodePickingColor:o,deviceX:u,deviceY:p,deviceRadius:g,deviceRect:v}){const{x:E,y:A,width:R,height:L}=v;let G=g*g,j=-1,H=0;for(let ht=0;ht&lt;L;ht++){const mt=ht+A-p,gt=mt*mt;if(gt&gt;G)H+=4*R;else for(let Pt=0;Pt&lt;R;Pt++){if(c[H+3]-1&gt;=0){const Nt=Pt+E-u,jt=Nt*Nt+gt;jt&lt;=G&amp;&amp;(G=jt,j=H)}H+=4}}if(j&gt;=0){const ht=c.slice(j,j+4),mt=o(ht);if(mt){const gt=Math.floor(j/4/R),Pt=j/4-gt*R;return{...mt,pickedColor:ht,pickedX:E+Pt,pickedY:A+gt}}Pr.error("Picked non-existent layer. Is picking buffer corrupt?")()}return $U}function YU({pickedColors:c,decodePickingColor:o}){const u=new Map;if(c){for(let p=0;p&lt;c.length;p+=4)if(c[p+3]-1&gt;=0){const v=c.slice(p,p+4),E=v.join(",");if(!u.has(E)){const A=o(v);A?u.set(E,{...A,color:v}):Pr.error("Picked non-existent layer. Is picking buffer corrupt?")()}}}return Array.from(u.values())}function FM({pickInfo:c,viewports:o,pixelRatio:u,x:p,y:g,z:v}){let E=o[0];o.length&gt;1&amp;&amp;(E=JU((c==null?void 0:c.pickedViewports)||o,{x:p,y:g}));let A;if(E){const R=[p-E.x,g-E.y];v!==void 0&amp;&amp;(R[2]=v),A=E.unproject(R)}return{color:null,layer:null,viewport:E,index:-1,picked:!1,x:p,y:g,pixel:[p,g],coordinate:A,devicePixel:c&amp;&amp;"pickedX"in c?[c.pickedX,c.pickedY]:void 0,pixelRatio:u}}function KU(c){const{pickInfo:o,lastPickedInfo:u,mode:p,layers:g}=c,{pickedColor:v,pickedLayer:E,pickedObjectIndex:A}=o,R=E?[E]:[];if(p==="hover"){const j=u.index,H=u.layerId,ht=E?E.props.id:null;if(ht!==H||A!==j){if(ht!==H){const mt=g.find(gt=&gt;gt.props.id===H);mt&amp;&amp;R.unshift(mt)}u.layerId=ht,u.index=A,u.info=null}}const L=FM(c),G=new Map;return G.set(null,L),R.forEach(j=&gt;{let H={...L};j===E&amp;&amp;(H.color=v,H.index=A,H.picked=!0),H=BM({layer:j,info:H,mode:p});const ht=H.layer;j===E&amp;&amp;p==="hover"&amp;&amp;(u.info=H),G.set(ht.id,H),p==="hover"&amp;&amp;ht.updateAutoHighlight(H)}),G}function BM({layer:c,info:o,mode:u}){for(;c&amp;&amp;o;){const p=o.layer||null;o.sourceLayer=p,o.layer=c,o=c.getPickingInfo({info:o,mode:u,sourceLayer:p}),c=c.parent}return o}function JU(c,o){for(let u=c.length-1;u&gt;=0;u--){const p=c[u];if(p.containsPixel(o))return p}return c[0]}class QU{constructor(o){et(this,"gl",void 0),et(this,"pickingFBO",void 0),et(this,"depthFBO",void 0),et(this,"pickLayersPass",void 0),et(this,"layerFilter",void 0),et(this,"lastPickedInfo",void 0),et(this,"_pickable",!0),this.gl=o,this.pickLayersPass=new RM(o),this.lastPickedInfo={index:-1,layerId:null,info:null}}setProps(o){"layerFilter"in o&amp;&amp;(this.layerFilter=o.layerFilter),"_pickable"in o&amp;&amp;(this._pickable=o._pickable)}finalize(){this.pickingFBO&amp;&amp;this.pickingFBO.delete(),this.depthFBO&amp;&amp;(this.depthFBO.color.delete(),this.depthFBO.delete())}pickObject(o){return this._pickClosestObject(o)}pickObjects(o){return this._pickVisibleObjects(o)}getLastPickedObject({x:o,y:u,layers:p,viewports:g},v=this.lastPickedInfo.info){const E=v&amp;&amp;v.layer&amp;&amp;v.layer.id,A=v&amp;&amp;v.viewport&amp;&amp;v.viewport.id,R=E?p.find(H=&gt;H.id===E):null,L=A&amp;&amp;g.find(H=&gt;H.id===A)||g[0],G=L&amp;&amp;L.unproject([o-L.x,u-L.y]);return{...v,...{x:o,y:u,viewport:L,coordinate:G,layer:R}}}_resizeBuffer(){var o,u;const{gl:p}=this;if(!this.pickingFBO&amp;&amp;(this.pickingFBO=new Cr(p),Cr.isSupported(p,{colorBufferFloat:!0}))){const g=new Cr(p);g.attach({36064:new $l(p,{format:Li(p)?34836:6408,type:5126})}),this.depthFBO=g}(o=this.pickingFBO)===null||o===void 0||o.resize({width:p.canvas.width,height:p.canvas.height}),(u=this.depthFBO)===null||u===void 0||u.resize({width:p.canvas.width,height:p.canvas.height})}_getPickable(o){if(this._pickable===!1)return null;const u=o.filter(p=&gt;this.pickLayersPass.shouldDrawLayer(p)&amp;&amp;!p.isComposite);return u.length?u:null}_pickClosestObject({layers:o,views:u,viewports:p,x:g,y:v,radius:E=0,depth:A=1,mode:R="query",unproject3D:L,onViewportActive:G,effects:j}){const H=this._getPickable(o),ht=Ul(this.gl);if(!H)return{result:[],emptyInfo:FM({viewports:p,x:g,y:v,pixelRatio:ht})};this._resizeBuffer();const mt=bg(this.gl,[g,v],!0),gt=[mt.x+Math.floor(mt.width/2),mt.y+Math.floor(mt.height/2)],Pt=Math.round(E*ht),{width:Vt,height:Nt}=this.pickingFBO,jt=this._getPickingRect({deviceX:gt[0],deviceY:gt[1],deviceRadius:Pt,deviceWidth:Vt,deviceHeight:Nt}),Qt={x:g-E,y:v-E,width:E*2+1,height:E*2+1};let ae;const le=[],Oe=new Set;for(let Ge=0;Ge&lt;A;Ge++){let ve;if(jt){const Lt=this._drawAndSample({layers:H,views:u,viewports:p,onViewportActive:G,deviceRect:jt,cullRect:Qt,effects:j,pass:"picking:".concat(R)});ve=XU({...Lt,deviceX:gt[0],deviceY:gt[1],deviceRadius:Pt,deviceRect:jt})}else ve={pickedColor:null,pickedObjectIndex:-1};let Q;if(ve.pickedLayer&amp;&amp;L&amp;&amp;this.depthFBO){const{pickedColors:Lt}=this._drawAndSample({layers:[ve.pickedLayer],views:u,viewports:p,onViewportActive:G,deviceRect:{x:ve.pickedX,y:ve.pickedY,width:1,height:1},cullRect:Qt,effects:j,pass:"picking:".concat(R,":z")},!0);Lt[3]&amp;&amp;(Q=Lt[0])}ve.pickedLayer&amp;&amp;Ge+1&lt;A&amp;&amp;(Oe.add(ve.pickedLayer),ve.pickedLayer.disablePickingIndex(ve.pickedObjectIndex)),ae=KU({pickInfo:ve,lastPickedInfo:this.lastPickedInfo,mode:R,layers:H,viewports:p,x:g,y:v,z:Q,pixelRatio:ht});for(const Lt of ae.values())Lt.layer&amp;&amp;le.push(Lt);if(!ve.pickedColor)break}for(const Ge of Oe)Ge.restorePickingColors();return{result:le,emptyInfo:ae.get(null)}}_pickVisibleObjects({layers:o,views:u,viewports:p,x:g,y:v,width:E=1,height:A=1,mode:R="query",maxObjects:L=null,onViewportActive:G,effects:j}){const H=this._getPickable(o);if(!H)return[];this._resizeBuffer();const ht=Ul(this.gl),mt=bg(this.gl,[g,v],!0),gt=mt.x,Pt=mt.y+mt.height,Vt=bg(this.gl,[g+E,v+A],!0),Nt=Vt.x+Vt.width,jt=Vt.y,Qt={x:gt,y:jt,width:Nt-gt,height:Pt-jt},ae=this._drawAndSample({layers:H,views:u,viewports:p,onViewportActive:G,deviceRect:Qt,cullRect:{x:g,y:v,width:E,height:A},effects:j,pass:"picking:".concat(R)}),le=YU(ae),Oe=new Map,Ge=Number.isFinite(L);for(let Q=0;Q&lt;le.length;Q++){var ve;if(Ge&amp;&amp;L&amp;&amp;Oe.size&gt;=L)break;const Lt=le[Q];let li={color:Lt.pickedColor,layer:null,index:Lt.pickedObjectIndex,picked:!0,x:g,y:v,pixelRatio:ht};li=BM({layer:Lt.pickedLayer,info:li,mode:R});const Ke=(ve=li.object)!==null&amp;&amp;ve!==void 0?ve:"".concat(li.layer.id,"[").concat(li.index,"]");Oe.has(Ke)||Oe.set(Ke,li)}return Array.from(Oe.values())}_drawAndSample({layers:o,views:u,viewports:p,onViewportActive:g,deviceRect:v,cullRect:E,effects:A,pass:R},L=!1){const G=L?this.depthFBO:this.pickingFBO,j={layers:o,layerFilter:this.layerFilter,views:u,viewports:p,onViewportActive:g,pickingFBO:G,deviceRect:v,cullRect:E,effects:A,pass:R,pickZ:L,preRenderStats:{}};for(const Nt of A)Nt.useInPicking&amp;&amp;(j.preRenderStats[Nt.id]=Nt.preRender(this.gl,j));const{decodePickingColor:H}=this.pickLayersPass.render(j),{x:ht,y:mt,width:gt,height:Pt}=v,Vt=new(L?Float32Array:Uint8Array)(gt*Pt*4);return sM(G,{sourceX:ht,sourceY:mt,sourceWidth:gt,sourceHeight:Pt,target:Vt}),{pickedColors:Vt,decodePickingColor:H}}_getPickingRect({deviceX:o,deviceY:u,deviceRadius:p,deviceWidth:g,deviceHeight:v}){const E=Math.max(0,o-p),A=Math.max(0,u-p),R=Math.min(g,o+p+1)-E,L=Math.min(v,u+p+1)-A;return R&lt;=0||L&lt;=0?null:{x:E,y:A,width:R,height:L}}}const tV={zIndex:"1",position:"absolute",pointerEvents:"none",color:"#a0a7b4",backgroundColor:"#29323c",padding:"10px",top:"0",left:"0",display:"none"};class eV{constructor(o){et(this,"el",null),et(this,"isVisible",!1);const u=o.parentElement;u&amp;&amp;(this.el=document.createElement("div"),this.el.className="deck-tooltip",Object.assign(this.el.style,tV),u.appendChild(this.el))}setTooltip(o,u,p){const g=this.el;if(g){if(typeof o=="string")g.innerText=o;else if(o)o.text&amp;&amp;(g.innerText=o.text),o.html&amp;&amp;(g.innerHTML=o.html),o.className&amp;&amp;(g.className=o.className);else{this.isVisible=!1,g.style.display="none";return}this.isVisible=!0,g.style.display="block",g.style.transform="translate(".concat(u,"px, ").concat(p,"px)"),o&amp;&amp;typeof o=="object"&amp;&amp;"style"in o&amp;&amp;Object.assign(g.style,o.style)}}remove(){this.el&amp;&amp;(this.el.remove(),this.el=null)}}var iV=typeof globalThis&lt;"u"?globalThis:typeof window&lt;"u"?window:typeof global&lt;"u"?global:typeof self&lt;"u"?self:{};function NM(c){return c&amp;&amp;c.__esModule&amp;&amp;Object.prototype.hasOwnProperty.call(c,"default")?c.default:c}var UM={exports:{}};/*! Hammer.JS - v2.0.7 - 2016-04-22
 * http://hammerjs.github.io/
 *
 * Copyright (c) 2016 Jorik Tangelder;
 * Licensed under the MIT license */(function(c){(function(o,u,p,g){var v=["","webkit","Moz","MS","ms","o"],E=u.createElement("div"),A="function",R=Math.round,L=Math.abs,G=Date.now;function j(N,q,rt){return setTimeout(jt(N,rt),q)}function H(N,q,rt){return Array.isArray(N)?(ht(N,rt[q],rt),!0):!1}function ht(N,q,rt){var xt;if(N)if(N.forEach)N.forEach(q,rt);else if(N.length!==g)for(xt=0;xt&lt;N.length;)q.call(rt,N[xt],xt,N),xt++;else for(xt in N)N.hasOwnProperty(xt)&amp;&amp;q.call(rt,N[xt],xt,N)}function mt(N,q,rt){var xt="DEPRECATED METHOD: "+q+`
`+rt+` AT 
`;return function(){var Gt=new Error("get-stack-trace"),ce=Gt&amp;&amp;Gt.stack?Gt.stack.replace(/^[^\(]+?[\n$]/gm,"").replace(/^\s+at\s+/gm,"").replace(/^Object.&lt;anonymous&gt;\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",$e=o.console&amp;&amp;(o.console.warn||o.console.log);return $e&amp;&amp;$e.call(o.console,xt,ce),N.apply(this,arguments)}}var gt;typeof Object.assign!="function"?gt=function(q){if(q===g||q===null)throw new TypeError("Cannot convert undefined or null to object");for(var rt=Object(q),xt=1;xt&lt;arguments.length;xt++){var Gt=arguments[xt];if(Gt!==g&amp;&amp;Gt!==null)for(var ce in Gt)Gt.hasOwnProperty(ce)&amp;&amp;(rt[ce]=Gt[ce])}return rt}:gt=Object.assign;var Pt=mt(function(q,rt,xt){for(var Gt=Object.keys(rt),ce=0;ce&lt;Gt.length;)(!xt||xt&amp;&amp;q[Gt[ce]]===g)&amp;&amp;(q[Gt[ce]]=rt[Gt[ce]]),ce++;return q},"extend","Use `assign`."),Vt=mt(function(q,rt){return Pt(q,rt,!0)},"merge","Use `assign`.");function Nt(N,q,rt){var xt=q.prototype,Gt;Gt=N.prototype=Object.create(xt),Gt.constructor=N,Gt._super=xt,rt&amp;&amp;gt(Gt,rt)}function jt(N,q){return function(){return N.apply(q,arguments)}}function Qt(N,q){return typeof N==A?N.apply(q&amp;&amp;q[0]||g,q):N}function ae(N,q){return N===g?q:N}function le(N,q,rt){ht(Q(q),function(xt){N.addEventListener(xt,rt,!1)})}function Oe(N,q,rt){ht(Q(q),function(xt){N.removeEventListener(xt,rt,!1)})}function Ge(N,q){for(;N;){if(N==q)return!0;N=N.parentNode}return!1}function ve(N,q){return N.indexOf(q)&gt;-1}function Q(N){return N.trim().split(/\s+/g)}function Lt(N,q,rt){if(N.indexOf&amp;&amp;!rt)return N.indexOf(q);for(var xt=0;xt&lt;N.length;){if(rt&amp;&amp;N[xt][rt]==q||!rt&amp;&amp;N[xt]===q)return xt;xt++}return-1}function li(N){return Array.prototype.slice.call(N,0)}function Ke(N,q,rt){for(var xt=[],Gt=[],ce=0;ce&lt;N.length;){var $e=N[ce][q];Lt(Gt,$e)&lt;0&amp;&amp;xt.push(N[ce]),Gt[ce]=$e,ce++}return xt=xt.sort(function(mr,wr){return mr[q]&gt;wr[q]}),xt}function $t(N,q){for(var rt,xt,Gt=q[0].toUpperCase()+q.slice(1),ce=0;ce&lt;v.length;){if(rt=v[ce],xt=rt?rt+Gt:q,xt in N)return xt;ce++}return g}var vi=1;function ts(){return vi++}function jr(N){var q=N.ownerDocument||N;return q.defaultView||q.parentWindow||o}var es=/mobile|tablet|ip(ad|hone|od)|android/i,fr="ontouchstart"in o,Ls=$t(o,"PointerEvent")!==g,Gr=fr&amp;&amp;es.test(navigator.userAgent),Xt="touch",xn="pen",Hr="mouse",Rs="kinect",Ds=25,Bt=1,nr=2,qi=4,ar=8,Os=1,is=2,rs=4,Oi=8,vn=16,Er=is|rs,Mt=Oi|vn,V=Er|Mt,$=["x","y"],tt=["clientX","clientY"];function vt(N,q){var rt=this;this.manager=N,this.callback=q,this.element=N.element,this.target=N.options.inputTarget,this.domHandler=function(xt){Qt(N.options.enable,[N])&amp;&amp;rt.handler(xt)},this.init()}vt.prototype={handler:function(){},init:function(){this.evEl&amp;&amp;le(this.element,this.evEl,this.domHandler),this.evTarget&amp;&amp;le(this.target,this.evTarget,this.domHandler),this.evWin&amp;&amp;le(jr(this.element),this.evWin,this.domHandler)},destroy:function(){this.evEl&amp;&amp;Oe(this.element,this.evEl,this.domHandler),this.evTarget&amp;&amp;Oe(this.target,this.evTarget,this.domHandler),this.evWin&amp;&amp;Oe(jr(this.element),this.evWin,this.domHandler)}};function Tt(N){var q,rt=N.options.inputClass;return rt?q=rt:Ls?q=ns:Gr?q=Dt:fr?q=Je:q=Lr,new q(N,Wt)}function Wt(N,q,rt){var xt=rt.pointers.length,Gt=rt.changedPointers.length,ce=q&amp;Bt&amp;&amp;xt-Gt===0,$e=q&amp;(qi|ar)&amp;&amp;xt-Gt===0;rt.isFirst=!!ce,rt.isFinal=!!$e,ce&amp;&amp;(N.session={}),rt.eventType=q,te(N,rt),N.emit("hammer.input",rt),N.recognize(rt),N.session.prevInput=rt}function te(N,q){var rt=N.session,xt=q.pointers,Gt=xt.length;rt.firstInput||(rt.firstInput=he(q)),Gt&gt;1&amp;&amp;!rt.firstMultiple?rt.firstMultiple=he(q):Gt===1&amp;&amp;(rt.firstMultiple=!1);var ce=rt.firstInput,$e=rt.firstMultiple,Qi=$e?$e.center:ce.center,mr=q.center=me(xt);q.timeStamp=G(),q.deltaTime=q.timeStamp-ce.timeStamp,q.angle=gi(Qi,mr),q.distance=ji(Qi,mr),Et(rt,q),q.offsetDirection=bi(q.deltaX,q.deltaY);var wr=di(q.deltaTime,q.deltaX,q.deltaY);q.overallVelocityX=wr.x,q.overallVelocityY=wr.y,q.overallVelocity=L(wr.x)&gt;L(wr.y)?wr.x:wr.y,q.scale=$e?pi($e.pointers,xt):1,q.rotation=$e?Ri($e.pointers,xt):0,q.maxPointers=rt.prevInput?q.pointers.length&gt;rt.prevInput.maxPointers?q.pointers.length:rt.prevInput.maxPointers:q.pointers.length,se(rt,q);var un=N.element;Ge(q.srcEvent.target,un)&amp;&amp;(un=q.srcEvent.target),q.target=un}function Et(N,q){var rt=q.center,xt=N.offsetDelta||{},Gt=N.prevDelta||{},ce=N.prevInput||{};(q.eventType===Bt||ce.eventType===qi)&amp;&amp;(Gt=N.prevDelta={x:ce.deltaX||0,y:ce.deltaY||0},xt=N.offsetDelta={x:rt.x,y:rt.y}),q.deltaX=Gt.x+(rt.x-xt.x),q.deltaY=Gt.y+(rt.y-xt.y)}function se(N,q){var rt=N.lastInterval||q,xt=q.timeStamp-rt.timeStamp,Gt,ce,$e,Qi;if(q.eventType!=ar&amp;&amp;(xt&gt;Ds||rt.velocity===g)){var mr=q.deltaX-rt.deltaX,wr=q.deltaY-rt.deltaY,un=di(xt,mr,wr);ce=un.x,$e=un.y,Gt=L(un.x)&gt;L(un.y)?un.x:un.y,Qi=bi(mr,wr),N.lastInterval=q}else Gt=rt.velocity,ce=rt.velocityX,$e=rt.velocityY,Qi=rt.direction;q.velocity=Gt,q.velocityX=ce,q.velocityY=$e,q.direction=Qi}function he(N){for(var q=[],rt=0;rt&lt;N.pointers.length;)q[rt]={clientX:R(N.pointers[rt].clientX),clientY:R(N.pointers[rt].clientY)},rt++;return{timeStamp:G(),pointers:q,center:me(q),deltaX:N.deltaX,deltaY:N.deltaY}}function me(N){var q=N.length;if(q===1)return{x:R(N[0].clientX),y:R(N[0].clientY)};for(var rt=0,xt=0,Gt=0;Gt&lt;q;)rt+=N[Gt].clientX,xt+=N[Gt].clientY,Gt++;return{x:R(rt/q),y:R(xt/q)}}function di(N,q,rt){return{x:q/N||0,y:rt/N||0}}function bi(N,q){return N===q?Os:L(N)&gt;=L(q)?N&lt;0?is:rs:q&lt;0?Oi:vn}function ji(N,q,rt){rt||(rt=$);var xt=q[rt[0]]-N[rt[0]],Gt=q[rt[1]]-N[rt[1]];return Math.sqrt(xt*xt+Gt*Gt)}function gi(N,q,rt){rt||(rt=$);var xt=q[rt[0]]-N[rt[0]],Gt=q[rt[1]]-N[rt[1]];return Math.atan2(Gt,xt)*180/Math.PI}function Ri(N,q){return gi(q[1],q[0],tt)+gi(N[1],N[0],tt)}function pi(N,q){return ji(q[0],q[1],tt)/ji(N[0],N[1],tt)}var yr={mousedown:Bt,mousemove:nr,mouseup:qi},Sr="mousedown",Ar="mousemove mouseup";function Lr(){this.evEl=Sr,this.evWin=Ar,this.pressed=!1,vt.apply(this,arguments)}Nt(Lr,vt,{handler:function(q){var rt=yr[q.type];rt&amp;Bt&amp;&amp;q.button===0&amp;&amp;(this.pressed=!0),rt&amp;nr&amp;&amp;q.which!==1&amp;&amp;(rt=qi),this.pressed&amp;&amp;(rt&amp;qi&amp;&amp;(this.pressed=!1),this.callback(this.manager,rt,{pointers:[q],changedPointers:[q],pointerType:Hr,srcEvent:q}))}});var ao={pointerdown:Bt,pointermove:nr,pointerup:qi,pointercancel:ar,pointerout:ar},Rr={2:Xt,3:xn,4:Hr,5:Rs},bn="pointerdown",Bn="pointermove pointerup pointercancel";o.MSPointerEvent&amp;&amp;!o.PointerEvent&amp;&amp;(bn="MSPointerDown",Bn="MSPointerMove MSPointerUp MSPointerCancel");function ns(){this.evEl=bn,this.evWin=Bn,vt.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}Nt(ns,vt,{handler:function(q){var rt=this.store,xt=!1,Gt=q.type.toLowerCase().replace("ms",""),ce=ao[Gt],$e=Rr[q.pointerType]||q.pointerType,Qi=$e==Xt,mr=Lt(rt,q.pointerId,"pointerId");ce&amp;Bt&amp;&amp;(q.button===0||Qi)?mr&lt;0&amp;&amp;(rt.push(q),mr=rt.length-1):ce&amp;(qi|ar)&amp;&amp;(xt=!0),!(mr&lt;0)&amp;&amp;(rt[mr]=q,this.callback(this.manager,ce,{pointers:rt,changedPointers:[q],pointerType:$e,srcEvent:q}),xt&amp;&amp;rt.splice(mr,1))}});var pt={touchstart:Bt,touchmove:nr,touchend:qi,touchcancel:ar},yt="touchstart",St="touchstart touchmove touchend touchcancel";function Ct(){this.evTarget=yt,this.evWin=St,this.started=!1,vt.apply(this,arguments)}Nt(Ct,vt,{handler:function(q){var rt=pt[q.type];if(rt===Bt&amp;&amp;(this.started=!0),!!this.started){var xt=Rt.call(this,q,rt);rt&amp;(qi|ar)&amp;&amp;xt[0].length-xt[1].length===0&amp;&amp;(this.started=!1),this.callback(this.manager,rt,{pointers:xt[0],changedPointers:xt[1],pointerType:Xt,srcEvent:q})}}});function Rt(N,q){var rt=li(N.touches),xt=li(N.changedTouches);return q&amp;(qi|ar)&amp;&amp;(rt=Ke(rt.concat(xt),"identifier")),[rt,xt]}var zt={touchstart:Bt,touchmove:nr,touchend:qi,touchcancel:ar},Ut="touchstart touchmove touchend touchcancel";function Dt(){this.evTarget=Ut,this.targetIds={},vt.apply(this,arguments)}Nt(Dt,vt,{handler:function(q){var rt=zt[q.type],xt=Kt.call(this,q,rt);xt&amp;&amp;this.callback(this.manager,rt,{pointers:xt[0],changedPointers:xt[1],pointerType:Xt,srcEvent:q})}});function Kt(N,q){var rt=li(N.touches),xt=this.targetIds;if(q&amp;(Bt|nr)&amp;&amp;rt.length===1)return xt[rt[0].identifier]=!0,[rt,rt];var Gt,ce,$e=li(N.changedTouches),Qi=[],mr=this.target;if(ce=rt.filter(function(wr){return Ge(wr.target,mr)}),q===Bt)for(Gt=0;Gt&lt;ce.length;)xt[ce[Gt].identifier]=!0,Gt++;for(Gt=0;Gt&lt;$e.length;)xt[$e[Gt].identifier]&amp;&amp;Qi.push($e[Gt]),q&amp;(qi|ar)&amp;&amp;delete xt[$e[Gt].identifier],Gt++;if(Qi.length)return[Ke(ce.concat(Qi),"identifier"),Qi]}var Ft=2500,Te=25;function Je(){vt.apply(this,arguments);var N=jt(this.handler,this);this.touch=new Dt(this.manager,N),this.mouse=new Lr(this.manager,N),this.primaryTouch=null,this.lastTouches=[]}Nt(Je,vt,{handler:function(q,rt,xt){var Gt=xt.pointerType==Xt,ce=xt.pointerType==Hr;if(!(ce&amp;&amp;xt.sourceCapabilities&amp;&amp;xt.sourceCapabilities.firesTouchEvents)){if(Gt)oe.call(this,rt,xt);else if(ce&amp;&amp;Ei.call(this,xt))return;this.callback(q,rt,xt)}},destroy:function(){this.touch.destroy(),this.mouse.destroy()}});function oe(N,q){N&amp;Bt?(this.primaryTouch=q.changedPointers[0].identifier,Qe.call(this,q)):N&amp;(qi|ar)&amp;&amp;Qe.call(this,q)}function Qe(N){var q=N.changedPointers[0];if(q.identifier===this.primaryTouch){var rt={x:q.clientX,y:q.clientY};this.lastTouches.push(rt);var xt=this.lastTouches,Gt=function(){var ce=xt.indexOf(rt);ce&gt;-1&amp;&amp;xt.splice(ce,1)};setTimeout(Gt,Ft)}}function Ei(N){for(var q=N.srcEvent.clientX,rt=N.srcEvent.clientY,xt=0;xt&lt;this.lastTouches.length;xt++){var Gt=this.lastTouches[xt],ce=Math.abs(q-Gt.x),$e=Math.abs(rt-Gt.y);if(ce&lt;=Te&amp;&amp;$e&lt;=Te)return!0}return!1}var Pi=$t(E.style,"touchAction"),Ni=Pi!==g,pr="compute",kr="auto",Gi="manipulation",Ki="none",Ji="pan-x",wn="pan-y",an=Ou();function ss(N,q){this.manager=N,this.set(q)}ss.prototype={set:function(N){N==pr&amp;&amp;(N=this.compute()),Ni&amp;&amp;this.manager.element.style&amp;&amp;an[N]&amp;&amp;(this.manager.element.style[Pi]=N),this.actions=N.toLowerCase().trim()},update:function(){this.set(this.manager.options.touchAction)},compute:function(){var N=[];return ht(this.manager.recognizers,function(q){Qt(q.options.enable,[q])&amp;&amp;(N=N.concat(q.getTouchAction()))}),Yl(N.join(" "))},preventDefaults:function(N){var q=N.srcEvent,rt=N.offsetDirection;if(this.manager.session.prevented){q.preventDefault();return}var xt=this.actions,Gt=ve(xt,Ki)&amp;&amp;!an[Ki],ce=ve(xt,wn)&amp;&amp;!an[wn],$e=ve(xt,Ji)&amp;&amp;!an[Ji];if(Gt){var Qi=N.pointers.length===1,mr=N.distance&lt;2,wr=N.deltaTime&lt;250;if(Qi&amp;&amp;mr&amp;&amp;wr)return}if(!($e&amp;&amp;ce)&amp;&amp;(Gt||ce&amp;&amp;rt&amp;Er||$e&amp;&amp;rt&amp;Mt))return this.preventSrc(q)},preventSrc:function(N){this.manager.session.prevented=!0,N.preventDefault()}};function Yl(N){if(ve(N,Ki))return Ki;var q=ve(N,Ji),rt=ve(N,wn);return q&amp;&amp;rt?Ki:q||rt?q?Ji:wn:ve(N,Gi)?Gi:kr}function Ou(){if(!Ni)return!1;var N={},q=o.CSS&amp;&amp;o.CSS.supports;return["auto","manipulation","pan-y","pan-x","pan-x pan-y","none"].forEach(function(rt){N[rt]=q?o.CSS.supports("touch-action",rt):!0}),N}var za=1,zr=2,lo=4,Nn=8,Un=Nn,os=16,ln=32;function Wr(N){this.options=gt({},this.defaults,N||{}),this.id=ts(),this.manager=null,this.options.enable=ae(this.options.enable,!0),this.state=za,this.simultaneous={},this.requireFail=[]}Wr.prototype={defaults:{},set:function(N){return gt(this.options,N),this.manager&amp;&amp;this.manager.touchAction.update(),this},recognizeWith:function(N){if(H(N,"recognizeWith",this))return this;var q=this.simultaneous;return N=Fa(N,this),q[N.id]||(q[N.id]=N,N.recognizeWith(this)),this},dropRecognizeWith:function(N){return H(N,"dropRecognizeWith",this)?this:(N=Fa(N,this),delete this.simultaneous[N.id],this)},requireFailure:function(N){if(H(N,"requireFailure",this))return this;var q=this.requireFail;return N=Fa(N,this),Lt(q,N)===-1&amp;&amp;(q.push(N),N.requireFailure(this)),this},dropRequireFailure:function(N){if(H(N,"dropRequireFailure",this))return this;N=Fa(N,this);var q=Lt(this.requireFail,N);return q&gt;-1&amp;&amp;this.requireFail.splice(q,1),this},hasRequireFailures:function(){return this.requireFail.length&gt;0},canRecognizeWith:function(N){return!!this.simultaneous[N.id]},emit:function(N){var q=this,rt=this.state;function xt(Gt){q.manager.emit(Gt,N)}rt&lt;Nn&amp;&amp;xt(q.options.event+Kl(rt)),xt(q.options.event),N.additionalEvent&amp;&amp;xt(N.additionalEvent),rt&gt;=Nn&amp;&amp;xt(q.options.event+Kl(rt))},tryEmit:function(N){if(this.canEmit())return this.emit(N);this.state=ln},canEmit:function(){for(var N=0;N&lt;this.requireFail.length;){if(!(this.requireFail[N].state&amp;(ln|za)))return!1;N++}return!0},recognize:function(N){var q=gt({},N);if(!Qt(this.options.enable,[this,q])){this.reset(),this.state=ln;return}this.state&amp;(Un|os|ln)&amp;&amp;(this.state=za),this.state=this.process(q),this.state&amp;(zr|lo|Nn|os)&amp;&amp;this.tryEmit(q)},process:function(N){},getTouchAction:function(){},reset:function(){}};function Kl(N){return N&amp;os?"cancel":N&amp;Nn?"end":N&amp;lo?"move":N&amp;zr?"start":""}function ku(N){return N==vn?"down":N==Oi?"up":N==is?"left":N==rs?"right":""}function Fa(N,q){var rt=q.manager;return rt?rt.get(N):N}function qr(){Wr.apply(this,arguments)}Nt(qr,Wr,{defaults:{pointers:1},attrTest:function(N){var q=this.options.pointers;return q===0||N.pointers.length===q},process:function(N){var q=this.state,rt=N.eventType,xt=q&amp;(zr|lo),Gt=this.attrTest(N);return xt&amp;&amp;(rt&amp;ar||!Gt)?q|os:xt||Gt?rt&amp;qi?q|Nn:q&amp;zr?q|lo:zr:ln}});function Zo(){qr.apply(this,arguments),this.pX=null,this.pY=null}Nt(Zo,qr,{defaults:{event:"pan",threshold:10,pointers:1,direction:V},getTouchAction:function(){var N=this.options.direction,q=[];return N&amp;Er&amp;&amp;q.push(wn),N&amp;Mt&amp;&amp;q.push(Ji),q},directionTest:function(N){var q=this.options,rt=!0,xt=N.distance,Gt=N.direction,ce=N.deltaX,$e=N.deltaY;return Gt&amp;q.direction||(q.direction&amp;Er?(Gt=ce===0?Os:ce&lt;0?is:rs,rt=ce!=this.pX,xt=Math.abs(N.deltaX)):(Gt=$e===0?Os:$e&lt;0?Oi:vn,rt=$e!=this.pY,xt=Math.abs(N.deltaY))),N.direction=Gt,rt&amp;&amp;xt&gt;q.threshold&amp;&amp;Gt&amp;q.direction},attrTest:function(N){return qr.prototype.attrTest.call(this,N)&amp;&amp;(this.state&amp;zr||!(this.state&amp;zr)&amp;&amp;this.directionTest(N))},emit:function(N){this.pX=N.deltaX,this.pY=N.deltaY;var q=ku(N.direction);q&amp;&amp;(N.additionalEvent=this.options.event+q),this._super.emit.call(this,N)}});function $o(){qr.apply(this,arguments)}Nt($o,qr,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[Ki]},attrTest:function(N){return this._super.attrTest.call(this,N)&amp;&amp;(Math.abs(N.scale-1)&gt;this.options.threshold||this.state&amp;zr)},emit:function(N){if(N.scale!==1){var q=N.scale&lt;1?"in":"out";N.additionalEvent=this.options.event+q}this._super.emit.call(this,N)}});function Xo(){Wr.apply(this,arguments),this._timer=null,this._input=null}Nt(Xo,Wr,{defaults:{event:"press",pointers:1,time:251,threshold:9},getTouchAction:function(){return[kr]},process:function(N){var q=this.options,rt=N.pointers.length===q.pointers,xt=N.distance&lt;q.threshold,Gt=N.deltaTime&gt;q.time;if(this._input=N,!xt||!rt||N.eventType&amp;(qi|ar)&amp;&amp;!Gt)this.reset();else if(N.eventType&amp;Bt)this.reset(),this._timer=j(function(){this.state=Un,this.tryEmit()},q.time,this);else if(N.eventType&amp;qi)return Un;return ln},reset:function(){clearTimeout(this._timer)},emit:function(N){this.state===Un&amp;&amp;(N&amp;&amp;N.eventType&amp;qi?this.manager.emit(this.options.event+"up",N):(this._input.timeStamp=G(),this.manager.emit(this.options.event,this._input)))}});function Yo(){qr.apply(this,arguments)}Nt(Yo,qr,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[Ki]},attrTest:function(N){return this._super.attrTest.call(this,N)&amp;&amp;(Math.abs(N.rotation)&gt;this.options.threshold||this.state&amp;zr)}});function co(){qr.apply(this,arguments)}Nt(co,qr,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:Er|Mt,pointers:1},getTouchAction:function(){return Zo.prototype.getTouchAction.call(this)},attrTest:function(N){var q=this.options.direction,rt;return q&amp;(Er|Mt)?rt=N.overallVelocity:q&amp;Er?rt=N.overallVelocityX:q&amp;Mt&amp;&amp;(rt=N.overallVelocityY),this._super.attrTest.call(this,N)&amp;&amp;q&amp;N.offsetDirection&amp;&amp;N.distance&gt;this.options.threshold&amp;&amp;N.maxPointers==this.options.pointers&amp;&amp;L(rt)&gt;this.options.velocity&amp;&amp;N.eventType&amp;qi},emit:function(N){var q=ku(N.offsetDirection);q&amp;&amp;this.manager.emit(this.options.event+q,N),this.manager.emit(this.options.event,N)}});function uo(){Wr.apply(this,arguments),this.pTime=!1,this.pCenter=!1,this._timer=null,this._input=null,this.count=0}Nt(uo,Wr,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[Gi]},process:function(N){var q=this.options,rt=N.pointers.length===q.pointers,xt=N.distance&lt;q.threshold,Gt=N.deltaTime&lt;q.time;if(this.reset(),N.eventType&amp;Bt&amp;&amp;this.count===0)return this.failTimeout();if(xt&amp;&amp;Gt&amp;&amp;rt){if(N.eventType!=qi)return this.failTimeout();var ce=this.pTime?N.timeStamp-this.pTime&lt;q.interval:!0,$e=!this.pCenter||ji(this.pCenter,N.center)&lt;q.posThreshold;this.pTime=N.timeStamp,this.pCenter=N.center,!$e||!ce?this.count=1:this.count+=1,this._input=N;var Qi=this.count%q.taps;if(Qi===0)return this.hasRequireFailures()?(this._timer=j(function(){this.state=Un,this.tryEmit()},q.interval,this),zr):Un}return ln},failTimeout:function(){return this._timer=j(function(){this.state=ln},this.options.interval,this),ln},reset:function(){clearTimeout(this._timer)},emit:function(){this.state==Un&amp;&amp;(this._input.tapCount=this.count,this.manager.emit(this.options.event,this._input))}});function cn(N,q){return q=q||{},q.recognizers=ae(q.recognizers,cn.defaults.preset),new _e(N,q)}cn.VERSION="2.0.7",cn.defaults={domEvents:!1,touchAction:pr,enable:!0,inputTarget:null,inputClass:null,preset:[[Yo,{enable:!1}],[$o,{enable:!1},["rotate"]],[co,{direction:Er}],[Zo,{direction:Er},["swipe"]],[uo],[uo,{event:"doubletap",taps:2},["tap"]],[Xo]],cssProps:{userSelect:"none",touchSelect:"none",touchCallout:"none",contentZooming:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"}};var ks=1,Jl=2;function _e(N,q){this.options=gt({},cn.defaults,q||{}),this.options.inputTarget=this.options.inputTarget||N,this.handlers={},this.session={},this.recognizers=[],this.oldCssProps={},this.element=N,this.input=Tt(this),this.touchAction=new ss(this,this.options.touchAction),ci(this,!0),ht(this.options.recognizers,function(rt){var xt=this.add(new rt[0](rt[1]));rt[2]&amp;&amp;xt.recognizeWith(rt[2]),rt[3]&amp;&amp;xt.requireFailure(rt[3])},this)}_e.prototype={set:function(N){return gt(this.options,N),N.touchAction&amp;&amp;this.touchAction.update(),N.inputTarget&amp;&amp;(this.input.destroy(),this.input.target=N.inputTarget,this.input.init()),this},stop:function(N){this.session.stopped=N?Jl:ks},recognize:function(N){var q=this.session;if(!q.stopped){this.touchAction.preventDefaults(N);var rt,xt=this.recognizers,Gt=q.curRecognizer;(!Gt||Gt&amp;&amp;Gt.state&amp;Un)&amp;&amp;(Gt=q.curRecognizer=null);for(var ce=0;ce&lt;xt.length;)rt=xt[ce],q.stopped!==Jl&amp;&amp;(!Gt||rt==Gt||rt.canRecognizeWith(Gt))?rt.recognize(N):rt.reset(),!Gt&amp;&amp;rt.state&amp;(zr|lo|Nn)&amp;&amp;(Gt=q.curRecognizer=rt),ce++}},get:function(N){if(N instanceof Wr)return N;for(var q=this.recognizers,rt=0;rt&lt;q.length;rt++)if(q[rt].options.event==N)return q[rt];return null},add:function(N){if(H(N,"add",this))return this;var q=this.get(N.options.event);return q&amp;&amp;this.remove(q),this.recognizers.push(N),N.manager=this,this.touchAction.update(),N},remove:function(N){if(H(N,"remove",this))return this;if(N=this.get(N),N){var q=this.recognizers,rt=Lt(q,N);rt!==-1&amp;&amp;(q.splice(rt,1),this.touchAction.update())}return this},on:function(N,q){if(N!==g&amp;&amp;q!==g){var rt=this.handlers;return ht(Q(N),function(xt){rt[xt]=rt[xt]||[],rt[xt].push(q)}),this}},off:function(N,q){if(N!==g){var rt=this.handlers;return ht(Q(N),function(xt){q?rt[xt]&amp;&amp;rt[xt].splice(Lt(rt[xt],q),1):delete rt[xt]}),this}},emit:function(N,q){this.options.domEvents&amp;&amp;Vn(N,q);var rt=this.handlers[N]&amp;&amp;this.handlers[N].slice();if(!(!rt||!rt.length)){q.type=N,q.preventDefault=function(){q.srcEvent.preventDefault()};for(var xt=0;xt&lt;rt.length;)rt[xt](q),xt++}},destroy:function(){this.element&amp;&amp;ci(this,!1),this.handlers={},this.session={},this.input.destroy(),this.element=null}};function ci(N,q){var rt=N.element;if(rt.style){var xt;ht(N.options.cssProps,function(Gt,ce){xt=$t(rt.style,ce),q?(N.oldCssProps[xt]=rt.style[xt],rt.style[xt]=Gt):rt.style[xt]=N.oldCssProps[xt]||""}),q||(N.oldCssProps={})}}function Vn(N,q){var rt=u.createEvent("Event");rt.initEvent(N,!0,!0),rt.gesture=q,q.target.dispatchEvent(rt)}gt(cn,{INPUT_START:Bt,INPUT_MOVE:nr,INPUT_END:qi,INPUT_CANCEL:ar,STATE_POSSIBLE:za,STATE_BEGAN:zr,STATE_CHANGED:lo,STATE_ENDED:Nn,STATE_RECOGNIZED:Un,STATE_CANCELLED:os,STATE_FAILED:ln,DIRECTION_NONE:Os,DIRECTION_LEFT:is,DIRECTION_RIGHT:rs,DIRECTION_UP:Oi,DIRECTION_DOWN:vn,DIRECTION_HORIZONTAL:Er,DIRECTION_VERTICAL:Mt,DIRECTION_ALL:V,Manager:_e,Input:vt,TouchAction:ss,TouchInput:Dt,MouseInput:Lr,PointerEventInput:ns,TouchMouseInput:Je,SingleTouchInput:Ct,Recognizer:Wr,AttrRecognizer:qr,Tap:uo,Pan:Zo,Swipe:co,Pinch:$o,Rotate:Yo,Press:Xo,on:le,off:Oe,each:ht,merge:Vt,extend:Pt,assign:gt,inherit:Nt,bindFn:jt,prefixed:$t});var zs=typeof o&lt;"u"?o:typeof self&lt;"u"?self:{};zs.Hammer=cn,c.exports?c.exports=cn:o[p]=cn})(window,document,"Hammer")})(UM);var Ru=UM.exports;const rV=NM(Ru),Ts=xk({__proto__:null,default:rV},[Ru]),VM=1,jM=2,sy=4,nV={mousedown:VM,mousemove:jM,mouseup:sy};function sV(c,o){for(let u=0;u&lt;c.length;u++)if(o(c[u]))return!0;return!1}function oV(c){const o=c.prototype.handler;c.prototype.handler=function(p){const g=this.store;p.button&gt;0&amp;&amp;p.type==="pointerdown"&amp;&amp;(sV(g,v=&gt;v.pointerId===p.pointerId)||g.push(p)),o.call(this,p)}}function aV(c){c.prototype.handler=function(u){let p=nV[u.type];p&amp;VM&amp;&amp;u.button&gt;=0&amp;&amp;(this.pressed=!0),p&amp;jM&amp;&amp;u.which===0&amp;&amp;(p=sy),this.pressed&amp;&amp;(p&amp;sy&amp;&amp;(this.pressed=!1),this.callback(this.manager,p,{pointers:[u],changedPointers:[u],pointerType:"mouse",srcEvent:u}))}}oV(Ru.PointerEventInput);aV(Ru.MouseInput);const lV=Ru.Manager;class Of{constructor(o,u,p){this.element=o,this.callback=u,this.options={enable:!0,...p}}}const cV=Ts?[[Ts.Pan,{event:"tripan",pointers:3,threshold:0,enable:!1}],[Ts.Rotate,{enable:!1}],[Ts.Pinch,{enable:!1}],[Ts.Swipe,{enable:!1}],[Ts.Pan,{threshold:0,enable:!1}],[Ts.Press,{enable:!1}],[Ts.Tap,{event:"doubletap",taps:2,enable:!1}],[Ts.Tap,{event:"anytap",enable:!1}],[Ts.Tap,{enable:!1}]]:null,YS={tripan:["rotate","pinch","pan"],rotate:["pinch"],pinch:["pan"],pan:["press","doubletap","anytap","tap"],doubletap:["anytap"],anytap:["tap"]},uV={doubletap:["tap"]},hV={pointerdown:"pointerdown",pointermove:"pointermove",pointerup:"pointerup",touchstart:"pointerdown",touchmove:"pointermove",touchend:"pointerup",mousedown:"pointerdown",mousemove:"pointermove",mouseup:"pointerup"},zy={KEY_EVENTS:["keydown","keyup"],MOUSE_EVENTS:["mousedown","mousemove","mouseup","mouseover","mouseout","mouseleave"],WHEEL_EVENTS:["wheel","mousewheel"]},dV={tap:"tap",anytap:"anytap",doubletap:"doubletap",press:"press",pinch:"pinch",pinchin:"pinch",pinchout:"pinch",pinchstart:"pinch",pinchmove:"pinch",pinchend:"pinch",pinchcancel:"pinch",rotate:"rotate",rotatestart:"rotate",rotatemove:"rotate",rotateend:"rotate",rotatecancel:"rotate",tripan:"tripan",tripanstart:"tripan",tripanmove:"tripan",tripanup:"tripan",tripandown:"tripan",tripanleft:"tripan",tripanright:"tripan",tripanend:"tripan",tripancancel:"tripan",pan:"pan",panstart:"pan",panmove:"pan",panup:"pan",pandown:"pan",panleft:"pan",panright:"pan",panend:"pan",pancancel:"pan",swipe:"swipe",swipeleft:"swipe",swiperight:"swipe",swipeup:"swipe",swipedown:"swipe"},KS={click:"tap",anyclick:"anytap",dblclick:"doubletap",mousedown:"pointerdown",mousemove:"pointermove",mouseup:"pointerup",mouseover:"pointerover",mouseout:"pointerout",mouseleave:"pointerleave"},fV=typeof navigator&lt;"u"&amp;&amp;navigator.userAgent?navigator.userAgent.toLowerCase():"",zl=typeof window&lt;"u"?window:global;let oy=!1;try{const c={get passive(){return oy=!0,!0}};zl.addEventListener("test",null,c),zl.removeEventListener("test",null)}catch{oy=!1}const pV=fV.indexOf("firefox")!==-1,{WHEEL_EVENTS:mV}=zy,JS="wheel",QS=4.000244140625,_V=40,gV=.25;class yV extends Of{constructor(o,u,p){super(o,u,p),this.handleEvent=g=&gt;{if(!this.options.enable)return;let v=g.deltaY;zl.WheelEvent&amp;&amp;(pV&amp;&amp;g.deltaMode===zl.WheelEvent.DOM_DELTA_PIXEL&amp;&amp;(v/=zl.devicePixelRatio),g.deltaMode===zl.WheelEvent.DOM_DELTA_LINE&amp;&amp;(v*=_V)),v!==0&amp;&amp;v%QS===0&amp;&amp;(v=Math.floor(v/QS)),g.shiftKey&amp;&amp;v&amp;&amp;(v=v*gV),this.callback({type:JS,center:{x:g.clientX,y:g.clientY},delta:-v,srcEvent:g,pointerType:"mouse",target:g.target})},this.events=(this.options.events||[]).concat(mV),this.events.forEach(g=&gt;o.addEventListener(g,this.handleEvent,oy?{passive:!1}:!1))}destroy(){this.events.forEach(o=&gt;this.element.removeEventListener(o,this.handleEvent))}enableEventType(o,u){o===JS&amp;&amp;(this.options.enable=u)}}const{MOUSE_EVENTS:xV}=zy,tA="pointermove",eA="pointerover",iA="pointerout",rA="pointerenter",nA="pointerleave";class vV extends Of{constructor(o,u,p){super(o,u,p),this.handleEvent=v=&gt;{this.handleOverEvent(v),this.handleOutEvent(v),this.handleEnterEvent(v),this.handleLeaveEvent(v),this.handleMoveEvent(v)},this.pressed=!1;const{enable:g}=this.options;this.enableMoveEvent=g,this.enableLeaveEvent=g,this.enableEnterEvent=g,this.enableOutEvent=g,this.enableOverEvent=g,this.events=(this.options.events||[]).concat(xV),this.events.forEach(v=&gt;o.addEventListener(v,this.handleEvent))}destroy(){this.events.forEach(o=&gt;this.element.removeEventListener(o,this.handleEvent))}enableEventType(o,u){o===tA&amp;&amp;(this.enableMoveEvent=u),o===eA&amp;&amp;(this.enableOverEvent=u),o===iA&amp;&amp;(this.enableOutEvent=u),o===rA&amp;&amp;(this.enableEnterEvent=u),o===nA&amp;&amp;(this.enableLeaveEvent=u)}handleOverEvent(o){this.enableOverEvent&amp;&amp;o.type==="mouseover"&amp;&amp;this._emit(eA,o)}handleOutEvent(o){this.enableOutEvent&amp;&amp;o.type==="mouseout"&amp;&amp;this._emit(iA,o)}handleEnterEvent(o){this.enableEnterEvent&amp;&amp;o.type==="mouseenter"&amp;&amp;this._emit(rA,o)}handleLeaveEvent(o){this.enableLeaveEvent&amp;&amp;o.type==="mouseleave"&amp;&amp;this._emit(nA,o)}handleMoveEvent(o){if(this.enableMoveEvent)switch(o.type){case"mousedown":o.button&gt;=0&amp;&amp;(this.pressed=!0);break;case"mousemove":o.which===0&amp;&amp;(this.pressed=!1),this.pressed||this._emit(tA,o);break;case"mouseup":this.pressed=!1;break}}_emit(o,u){this.callback({type:o,center:{x:u.clientX,y:u.clientY},srcEvent:u,pointerType:"mouse",target:u.target})}}const{KEY_EVENTS:bV}=zy,sA="keydown",oA="keyup";class wV extends Of{constructor(o,u,p){super(o,u,p),this.handleEvent=g=&gt;{const v=g.target||g.srcElement;v.tagName==="INPUT"&amp;&amp;v.type==="text"||v.tagName==="TEXTAREA"||(this.enableDownEvent&amp;&amp;g.type==="keydown"&amp;&amp;this.callback({type:sA,srcEvent:g,key:g.key,target:g.target}),this.enableUpEvent&amp;&amp;g.type==="keyup"&amp;&amp;this.callback({type:oA,srcEvent:g,key:g.key,target:g.target}))},this.enableDownEvent=this.options.enable,this.enableUpEvent=this.options.enable,this.events=(this.options.events||[]).concat(bV),o.tabIndex=this.options.tabIndex||0,o.style.outline="none",this.events.forEach(g=&gt;o.addEventListener(g,this.handleEvent))}destroy(){this.events.forEach(o=&gt;this.element.removeEventListener(o,this.handleEvent))}enableEventType(o,u){o===sA&amp;&amp;(this.enableDownEvent=u),o===oA&amp;&amp;(this.enableUpEvent=u)}}const aA="contextmenu";class TV extends Of{constructor(o,u,p){super(o,u,p),this.handleEvent=g=&gt;{this.options.enable&amp;&amp;this.callback({type:aA,center:{x:g.clientX,y:g.clientY},srcEvent:g,pointerType:"mouse",target:g.target})},o.addEventListener("contextmenu",this.handleEvent)}destroy(){this.element.removeEventListener("contextmenu",this.handleEvent)}enableEventType(o,u){o===aA&amp;&amp;(this.options.enable=u)}}const ay=1,wf=2,ly=4,EV={pointerdown:ay,pointermove:wf,pointerup:ly,mousedown:ay,mousemove:wf,mouseup:ly},SV=1,AV=2,MV=3,IV=0,PV=1,CV=2,LV=1,RV=2,DV=4;function OV(c){const o=EV[c.srcEvent.type];if(!o)return null;const{buttons:u,button:p,which:g}=c.srcEvent;let v=!1,E=!1,A=!1;return o===ly||o===wf&amp;&amp;!Number.isFinite(u)?(v=g===SV,E=g===AV,A=g===MV):o===wf?(v=!!(u&amp;LV),E=!!(u&amp;DV),A=!!(u&amp;RV)):o===ay&amp;&amp;(v=p===IV,E=p===PV,A=p===CV),{leftButton:v,middleButton:E,rightButton:A}}function kV(c,o){const u=c.center;if(!u)return null;const p=o.getBoundingClientRect(),g=p.width/o.offsetWidth||1,v=p.height/o.offsetHeight||1,E={x:(u.x-p.left-o.clientLeft)/g,y:(u.y-p.top-o.clientTop)/v};return{center:u,offsetCenter:E}}const kg={srcElement:"root",priority:0};class zV{constructor(o){this.handleEvent=u=&gt;{if(this.isEmpty())return;const p=this._normalizeEvent(u);let g=u.srcEvent.target;for(;g&amp;&amp;g!==p.rootElement;){if(this._emit(p,g),p.handled)return;g=g.parentNode}this._emit(p,"root")},this.eventManager=o,this.handlers=[],this.handlersByElement=new Map,this._active=!1}isEmpty(){return!this._active}add(o,u,p,g=!1,v=!1){const{handlers:E,handlersByElement:A}=this;let R=kg;typeof p=="string"||p&amp;&amp;p.addEventListener?R={...kg,srcElement:p}:p&amp;&amp;(R={...kg,...p});let L=A.get(R.srcElement);L||(L=[],A.set(R.srcElement,L));const G={type:o,handler:u,srcElement:R.srcElement,priority:R.priority};g&amp;&amp;(G.once=!0),v&amp;&amp;(G.passive=!0),E.push(G),this._active=this._active||!G.passive;let j=L.length-1;for(;j&gt;=0&amp;&amp;!(L[j].priority&gt;=G.priority);)j--;L.splice(j+1,0,G)}remove(o,u){const{handlers:p,handlersByElement:g}=this;for(let v=p.length-1;v&gt;=0;v--){const E=p[v];if(E.type===o&amp;&amp;E.handler===u){p.splice(v,1);const A=g.get(E.srcElement);A.splice(A.indexOf(E),1),A.length===0&amp;&amp;g.delete(E.srcElement)}}this._active=p.some(v=&gt;!v.passive)}_emit(o,u){const p=this.handlersByElement.get(u);if(p){let g=!1;const v=()=&gt;{o.handled=!0},E=()=&gt;{o.handled=!0,g=!0},A=[];for(let R=0;R&lt;p.length;R++){const{type:L,handler:G,once:j}=p[R];if(G({...o,type:L,stopPropagation:v,stopImmediatePropagation:E}),j&amp;&amp;A.push(p[R]),g)break}for(let R=0;R&lt;A.length;R++){const{type:L,handler:G}=A[R];this.remove(L,G)}}}_normalizeEvent(o){const u=this.eventManager.getElement();return{...o,...OV(o),...kV(o,u),preventDefault:()=&gt;{o.srcEvent.preventDefault()},stopImmediatePropagation:null,stopPropagation:null,handled:!1,rootElement:u}}}const FV={events:null,recognizers:null,recognizerOptions:{},Manager:lV,touchAction:"none",tabIndex:0};class BV{constructor(o=null,u){this._onBasicInput=g=&gt;{const{srcEvent:v}=g,E=hV[v.type];E&amp;&amp;this.manager.emit(E,g)},this._onOtherEvent=g=&gt;{this.manager.emit(g.type,g)},this.options={...FV,...u},this.events=new Map,this.setElement(o);const{events:p}=this.options;p&amp;&amp;this.on(p)}getElement(){return this.element}setElement(o){if(this.element&amp;&amp;this.destroy(),this.element=o,!o)return;const{options:u}=this,p=u.Manager;this.manager=new p(o,{touchAction:u.touchAction,recognizers:u.recognizers||cV}).on("hammer.input",this._onBasicInput),u.recognizers||Object.keys(YS).forEach(g=&gt;{const v=this.manager.get(g);v&amp;&amp;YS[g].forEach(E=&gt;{v.recognizeWith(E)})});for(const g in u.recognizerOptions){const v=this.manager.get(g);if(v){const E=u.recognizerOptions[g];delete E.enable,v.set(E)}}this.wheelInput=new yV(o,this._onOtherEvent,{enable:!1}),this.moveInput=new vV(o,this._onOtherEvent,{enable:!1}),this.keyInput=new wV(o,this._onOtherEvent,{enable:!1,tabIndex:u.tabIndex}),this.contextmenuInput=new TV(o,this._onOtherEvent,{enable:!1});for(const[g,v]of this.events)v.isEmpty()||(this._toggleRecognizer(v.recognizerName,!0),this.manager.on(g,v.handleEvent))}destroy(){this.element&amp;&amp;(this.wheelInput.destroy(),this.moveInput.destroy(),this.keyInput.destroy(),this.contextmenuInput.destroy(),this.manager.destroy(),this.wheelInput=null,this.moveInput=null,this.keyInput=null,this.contextmenuInput=null,this.manager=null,this.element=null)}on(o,u,p){this._addEventHandler(o,u,p,!1)}once(o,u,p){this._addEventHandler(o,u,p,!0)}watch(o,u,p){this._addEventHandler(o,u,p,!1,!0)}off(o,u){this._removeEventHandler(o,u)}_toggleRecognizer(o,u){const{manager:p}=this;if(!p)return;const g=p.get(o);if(g&amp;&amp;g.options.enable!==u){g.set({enable:u});const v=uV[o];v&amp;&amp;!this.options.recognizers&amp;&amp;v.forEach(E=&gt;{const A=p.get(E);u?(A.requireFailure(o),g.dropRequireFailure(E)):A.dropRequireFailure(o)})}this.wheelInput.enableEventType(o,u),this.moveInput.enableEventType(o,u),this.keyInput.enableEventType(o,u),this.contextmenuInput.enableEventType(o,u)}_addEventHandler(o,u,p,g,v){if(typeof o!="string"){p=u;for(const G in o)this._addEventHandler(G,o[G],p,g,v);return}const{manager:E,events:A}=this,R=KS[o]||o;let L=A.get(R);L||(L=new zV(this),A.set(R,L),L.recognizerName=dV[R]||R,E&amp;&amp;E.on(R,L.handleEvent)),L.add(o,u,p,g,v),L.isEmpty()||this._toggleRecognizer(L.recognizerName,!0)}_removeEventHandler(o,u){if(typeof o!="string"){for(const E in o)this._removeEventHandler(E,o[E]);return}const{events:p}=this,g=KS[o]||o,v=p.get(g);if(v&amp;&amp;(v.remove(o,u),v.isEmpty())){const{recognizerName:E}=v;let A=!1;for(const R of p.values())if(R.recognizerName===E&amp;&amp;!R.isEmpty()){A=!0;break}A||this._toggleRecognizer(E,!1)}}}function Ea(){}const NV=({isDragging:c})=&gt;c?"grabbing":"grab",GM={id:"",width:"100%",height:"100%",style:null,viewState:null,initialViewState:null,pickingRadius:0,layerFilter:null,glOptions:{},parameters:{},parent:null,gl:null,canvas:null,layers:[],effects:[],views:null,controller:null,useDevicePixels:!0,touchAction:"none",eventRecognizerOptions:{},_framebuffer:null,_animate:!1,_pickable:!0,_typedArrayManagerProps:{},_customRender:null,onWebGLInitialized:Ea,onResize:Ea,onViewStateChange:Ea,onInteractionStateChange:Ea,onBeforeRender:Ea,onAfterRender:Ea,onLoad:Ea,onError:c=&gt;Pr.error(c.message,c.cause)(),onHover:null,onClick:null,onDragStart:null,onDrag:null,onDragEnd:null,_onMetrics:null,getCursor:NV,getTooltip:null,debug:!1,drawPickingColors:!1};class Fy{constructor(o){et(this,"props",void 0),et(this,"width",0),et(this,"height",0),et(this,"userData",{}),et(this,"canvas",null),et(this,"viewManager",null),et(this,"layerManager",null),et(this,"effectManager",null),et(this,"deckRenderer",null),et(this,"deckPicker",null),et(this,"eventManager",null),et(this,"tooltip",null),et(this,"metrics",void 0),et(this,"animationLoop",void 0),et(this,"stats",void 0),et(this,"viewState",void 0),et(this,"cursorState",void 0),et(this,"_needsRedraw",void 0),et(this,"_pickRequest",void 0),et(this,"_lastPointerDownInfo",null),et(this,"_metricsCounter",void 0),et(this,"_onPointerMove",u=&gt;{const{_pickRequest:p}=this;if(u.type==="pointerleave")p.x=-1,p.y=-1,p.radius=0;else{if(u.leftButton||u.rightButton)return;{const g=u.offsetCenter;if(!g)return;p.x=g.x,p.y=g.y,p.radius=this.props.pickingRadius}}this.layerManager&amp;&amp;(this.layerManager.context.mousePosition={x:p.x,y:p.y}),p.event=u}),et(this,"_onEvent",u=&gt;{const p=JE[u.type],g=u.offsetCenter;if(!p||!g||!this.layerManager)return;const v=this.layerManager.getLayers(),E=this.deckPicker.getLastPickedObject({x:g.x,y:g.y,layers:v,viewports:this.getViewports(g)},this._lastPointerDownInfo),{layer:A}=E,R=A&amp;&amp;(A[p.handler]||A.props[p.handler]),L=this.props[p.handler];let G=!1;R&amp;&amp;(G=R.call(A,E,u)),!G&amp;&amp;L&amp;&amp;L(E,u)}),et(this,"_onPointerDown",u=&gt;{const p=u.offsetCenter,g=this._pick("pickObject","pickObject Time",{x:p.x,y:p.y,radius:this.props.pickingRadius});this._lastPointerDownInfo=g.result[0]||g.emptyInfo}),this.props={...GM,...o},o=this.props,this._needsRedraw="Initial render",this._pickRequest={mode:"hover",x:-1,y:-1,radius:0,event:null},this.cursorState={isHovering:!1,isDragging:!1},o.viewState&amp;&amp;o.initialViewState&amp;&amp;Pr.warn("View state tracking is disabled. Use either `initialViewState` for auto update or `viewState` for manual update.")(),RF()==="IE"&amp;&amp;Pr.warn("IE 11 is not supported")(),this.viewState=o.initialViewState,o.gl||typeof document&lt;"u"&amp;&amp;(this.canvas=this._createCanvas(o)),this.animationLoop=this._createAnimationLoop(o),this.stats=new Ay({id:"deck.gl"}),this.metrics={fps:0,setPropsTime:0,updateAttributesTime:0,framesRedrawn:0,pickTime:0,pickCount:0,gpuTime:0,gpuTimePerFrame:0,cpuTime:0,cpuTimePerFrame:0,bufferMemory:0,textureMemory:0,renderbufferMemory:0,gpuMemory:0},this._metricsCounter=0,this.setProps(o),o._typedArrayManagerProps&amp;&amp;LM.setOptions(o._typedArrayManagerProps),this.animationLoop.start()}finalize(){var o,u,p,g,v,E,A,R;if((o=this.animationLoop)===null||o===void 0||o.stop(),this.animationLoop=null,this._lastPointerDownInfo=null,(u=this.layerManager)===null||u===void 0||u.finalize(),this.layerManager=null,(p=this.viewManager)===null||p===void 0||p.finalize(),this.viewManager=null,(g=this.effectManager)===null||g===void 0||g.finalize(),this.effectManager=null,(v=this.deckRenderer)===null||v===void 0||v.finalize(),this.deckRenderer=null,(E=this.deckPicker)===null||E===void 0||E.finalize(),this.deckPicker=null,(A=this.eventManager)===null||A===void 0||A.destroy(),this.eventManager=null,(R=this.tooltip)===null||R===void 0||R.remove(),this.tooltip=null,!this.props.canvas&amp;&amp;!this.props.gl&amp;&amp;this.canvas){var L;(L=this.canvas.parentElement)===null||L===void 0||L.removeChild(this.canvas),this.canvas=null}}setProps(o){this.stats.get("setProps Time").timeStart(),"onLayerHover"in o&amp;&amp;Pr.removed("onLayerHover","onHover")(),"onLayerClick"in o&amp;&amp;Pr.removed("onLayerClick","onClick")(),o.initialViewState&amp;&amp;!ql(this.props.initialViewState,o.initialViewState,3)&amp;&amp;(this.viewState=o.initialViewState),Object.assign(this.props,o),this._setCanvasSize(this.props);const u=Object.create(this.props);Object.assign(u,{views:this._getViews(),width:this.width,height:this.height,viewState:this._getViewState()}),this.animationLoop.setProps(u),this.layerManager&amp;&amp;(this.viewManager.setProps(u),this.layerManager.activateViewport(this.getViewports()[0]),this.layerManager.setProps(u),this.effectManager.setProps(u),this.deckRenderer.setProps(u),this.deckPicker.setProps(u)),this.stats.get("setProps Time").timeEnd()}needsRedraw(o={clearRedrawFlags:!1}){if(!this.layerManager)return!1;if(this.props._animate)return"Deck._animate";let u=this._needsRedraw;o.clearRedrawFlags&amp;&amp;(this._needsRedraw=!1);const p=this.viewManager.needsRedraw(o),g=this.layerManager.needsRedraw(o),v=this.effectManager.needsRedraw(o),E=this.deckRenderer.needsRedraw(o);return u=u||p||g||v||E,u}redraw(o){if(!this.layerManager)return;let u=this.needsRedraw({clearRedrawFlags:!0});u=o||u,u&amp;&amp;(this.stats.get("Redraw Count").incrementCount(),this.props._customRender?this.props._customRender(u):this._drawLayers(u))}get isInitialized(){return this.viewManager!==null}getViews(){return ro(this.viewManager),this.viewManager.views}getViewports(o){return ro(this.viewManager),this.viewManager.getViewports(o)}getCanvas(){return this.canvas}pickObject(o){const u=this._pick("pickObject","pickObject Time",o).result;return u.length?u[0]:null}pickMultipleObjects(o){return o.depth=o.depth||10,this._pick("pickObject","pickMultipleObjects Time",o).result}pickObjects(o){return this._pick("pickObjects","pickObjects Time",o)}_addResources(o,u=!1){for(const p in o)this.layerManager.resourceManager.add({resourceId:p,data:o[p],forceUpdate:u})}_removeResources(o){for(const u of o)this.layerManager.resourceManager.remove(u)}_addDefaultEffect(o){this.effectManager.addDefaultEffect(o)}_pick(o,u,p){ro(this.deckPicker);const{stats:g}=this;g.get("Pick Count").incrementCount(),g.get(u).timeStart();const v=this.deckPicker[o]({layers:this.layerManager.getLayers(p),views:this.viewManager.getViews(),viewports:this.getViewports(p),onViewportActive:this.layerManager.activateViewport,effects:this.effectManager.getEffects(),...p});return g.get(u).timeEnd(),v}_createCanvas(o){let u=o.canvas;return typeof u=="string"&amp;&amp;(u=document.getElementById(u),ro(u)),u||(u=document.createElement("canvas"),u.id=o.id||"deckgl-overlay",(o.parent||document.body).appendChild(u)),Object.assign(u.style,o.style),u}_setCanvasSize(o){if(!this.canvas)return;const{width:u,height:p}=o;if(u||u===0){const v=Number.isFinite(u)?"".concat(u,"px"):u;this.canvas.style.width=v}if(p||p===0){var g;const v=Number.isFinite(p)?"".concat(p,"px"):p;this.canvas.style.position=((g=o.style)===null||g===void 0?void 0:g.position)||"absolute",this.canvas.style.height=v}}_updateCanvasSize(){var o,u;const{canvas:p}=this;if(!p)return;const g=(o=p.clientWidth)!==null&amp;&amp;o!==void 0?o:p.width,v=(u=p.clientHeight)!==null&amp;&amp;u!==void 0?u:p.height;if(g!==this.width||v!==this.height){var E,A;this.width=g,this.height=v,(E=this.viewManager)===null||E===void 0||E.setProps({width:g,height:v}),(A=this.layerManager)===null||A===void 0||A.activateViewport(this.getViewports()[0]),this.props.onResize({width:g,height:v})}}_createAnimationLoop(o){const{width:u,height:p,gl:g,glOptions:v,debug:E,onError:A,onBeforeRender:R,onAfterRender:L,useDevicePixels:G}=o;return new P5({width:u,height:p,useDevicePixels:G,autoResizeDrawingBuffer:!g,autoResizeViewport:!1,gl:g,onCreateContext:j=&gt;JA({...v,...j,canvas:this.canvas,debug:E,onContextLost:()=&gt;this._onContextLost()}),onInitialize:j=&gt;this._setGLContext(j.gl),onRender:this._onRenderFrame.bind(this),onBeforeRender:R,onAfterRender:L,onError:A})}_getViewState(){return this.props.viewState||this.viewState}_getViews(){let o=this.props.views||[new zM({id:"default-view"})];return o=Array.isArray(o)?o:[o],o.length&amp;&amp;this.props.controller&amp;&amp;(o[0].props.controller=this.props.controller),o}_onContextLost(){const{onError:o}=this.props;this.animationLoop&amp;&amp;o&amp;&amp;o(new Error("WebGL context is lost"))}_pickAndCallback(){const{_pickRequest:o}=this;if(o.event){const{result:p,emptyInfo:g}=this._pick("pickObject","pickObject Time",o);this.cursorState.isHovering=p.length&gt;0;let v=g,E=!1;for(const A of p){var u;v=A,E=((u=A.layer)===null||u===void 0?void 0:u.onHover(A,o.event))||E}if(!E&amp;&amp;this.props.onHover&amp;&amp;this.props.onHover(v,o.event),this.props.getTooltip&amp;&amp;this.tooltip){const A=this.props.getTooltip(v);this.tooltip.setTooltip(A,v.x,v.y)}o.event=null}}_updateCursor(){const o=this.props.parent||this.canvas;o&amp;&amp;(o.style.cursor=this.props.getCursor(this.cursorState))}_setGLContext(o){if(this.layerManager)return;this.canvas||(this.canvas=o.canvas,Sy(o,{enable:!0,copyState:!0})),this.tooltip=new eV(this.canvas),qo(o,{blend:!0,blendFunc:[770,771,1,771],polygonOffsetFill:!0,depthTest:!0,depthFunc:515}),this.props.onWebGLInitialized(o);const u=new wM;u.play(),this.animationLoop.attachTimeline(u),this.eventManager=new BV(this.props.parent||o.canvas,{touchAction:this.props.touchAction,recognizerOptions:this.props.eventRecognizerOptions,events:{pointerdown:this._onPointerDown,pointermove:this._onPointerMove,pointerleave:this._onPointerMove}});for(const g in JE)this.eventManager.on(g,this._onEvent);this.viewManager=new AU({timeline:u,eventManager:this.eventManager,onViewStateChange:this._onViewStateChange.bind(this),onInteractionStateChange:this._onInteractionStateChange.bind(this),views:this._getViews(),viewState:this._getViewState(),width:this.width,height:this.height});const p=this.viewManager.getViewports()[0];this.layerManager=new SU(o,{deck:this,stats:this.stats,viewport:p,timeline:u}),this.effectManager=new HU,this.deckRenderer=new ZU(o),this.deckPicker=new QU(o),this.setProps(this.props),this._updateCanvasSize(),this.props.onLoad()}_drawLayers(o,u){const{gl:p}=this.layerManager.context;qo(p,this.props.parameters),this.props.onBeforeRender({gl:p}),this.deckRenderer.renderLayers({target:this.props._framebuffer,layers:this.layerManager.getLayers(),viewports:this.viewManager.getViewports(),onViewportActive:this.layerManager.activateViewport,views:this.viewManager.getViews(),pass:"screen",effects:this.effectManager.getEffects(),...u}),this.props.onAfterRender({gl:p})}_onRenderFrame(o){this._getFrameStats(),this._metricsCounter++%60===0&amp;&amp;(this._getMetrics(),this.stats.reset(),Pr.table(4,this.metrics)(),this.props._onMetrics&amp;&amp;this.props._onMetrics(this.metrics)),this._updateCanvasSize(),this._updateCursor(),this.tooltip.isVisible&amp;&amp;this.viewManager.needsRedraw()&amp;&amp;this.tooltip.setTooltip(null),this.layerManager.updateLayers(),this._pickAndCallback(),this.redraw(),this.viewManager&amp;&amp;this.viewManager.updateViewStates()}_onViewStateChange(o){const u=this.props.onViewStateChange(o)||o.viewState;this.viewState&amp;&amp;(this.viewState={...this.viewState,[o.viewId]:u},this.props.viewState||this.viewManager&amp;&amp;this.viewManager.setProps({viewState:this.viewState}))}_onInteractionStateChange(o){this.cursorState.isDragging=o.isDragging||!1,this.props.onInteractionStateChange(o)}_getFrameStats(){const{stats:o}=this;o.get("frameRate").timeEnd(),o.get("frameRate").timeStart();const u=this.animationLoop.stats;o.get("GPU Time").addTime(u.get("GPU Time").lastTiming),o.get("CPU Time").addTime(u.get("CPU Time").lastTiming)}_getMetrics(){const{metrics:o,stats:u}=this;o.fps=u.get("frameRate").getHz(),o.setPropsTime=u.get("setProps Time").time,o.updateAttributesTime=u.get("Update Attributes").time,o.framesRedrawn=u.get("Redraw Count").count,o.pickTime=u.get("pickObject Time").time+u.get("pickMultipleObjects Time").time+u.get("pickObjects Time").time,o.pickCount=u.get("Pick Count").count,o.gpuTime=u.get("GPU Time").time,o.cpuTime=u.get("CPU Time").time,o.gpuTimePerFrame=u.get("GPU Time").getAverageTime(),o.cpuTimePerFrame=u.get("CPU Time").getAverageTime();const p=Aa.get("Memory Usage");o.bufferMemory=p.get("Buffer Memory").count,o.textureMemory=p.get("Texture Memory").count,o.renderbufferMemory=p.get("Renderbuffer Memory").count,o.gpuMemory=p.get("GPU Memory").count}}et(Fy,"defaultProps",GM);et(Fy,"VERSION",$F);var HM={exports:{}};(function(c,o){var u={};(function(p,g){c.exports=g()})(iV,function(){var p,g,v;function E(R,L){if(!p)p=L;else if(!g)g=L;else{var G="self.onerror = function() { console.error('An error occurred while parsing the WebWorker bundle. This is most likely due to improper transpilation by Babel; please see https://docs.mapbox.com/mapbox-gl-js/guides/install/#transpiling'); }; var sharedChunk = {}; ("+p+")(sharedChunk); ("+g+")(sharedChunk); self.onerror = null;",j={};p(j),v=L(j),typeof window&lt;"u"&amp;&amp;window&amp;&amp;window.URL&amp;&amp;window.URL.createObjectURL&amp;&amp;(v.workerUrl=window.URL.createObjectURL(new Blob([G],{type:"text/javascript"})))}}E(["exports"],function(R){var L=typeof self&lt;"u"?self:{},G="3.1.0";let j;const H={API_URL:"https://api.mapbox.com",get API_URL_REGEX(){if(j==null){const e=/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/|\?|$)/i;try{j=u.API_URL_REGEX!=null?new RegExp(u.API_URL_REGEX):e}catch{j=e}}return j},get API_TILEJSON_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/v[0-9]*\/.*\.json.*$)/i},get API_SPRITE_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/styles\/v[0-9]*\/)(.*\/sprite.*\..*$)/i},get API_FONTS_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/fonts\/v[0-9]*\/)(.*\.pbf.*$)/i},get API_STYLE_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/styles\/v[0-9]*\/)(.*$)/i},get API_CDN_URL_REGEX(){return/^((https?:)?\/\/)?api\.mapbox\.c(n|om)(\/mapbox-gl-js\/)(.*$)/i},get EVENTS_URL(){if(!H.API_URL)return null;try{const e=new URL(H.API_URL);return e.hostname==="api.mapbox.cn"?"https://events.mapbox.cn/events/v2":e.hostname==="api.mapbox.com"?"https://events.mapbox.com/events/v2":null}catch{return null}},SESSION_PATH:"/map-sessions/v1",FEEDBACK_URL:"https://apps.mapbox.com/feedback",TILE_URL_VERSION:"v4",RASTER_URL_PREFIX:"raster/v1",REQUIRE_ACCESS_TOKEN:!0,ACCESS_TOKEN:null,DEFAULT_STYLE:"mapbox://styles/mapbox/standard",MAX_PARALLEL_IMAGE_REQUESTS:16,DRACO_URL:"https://api.mapbox.com/mapbox-gl-js/draco_decoder_gltf_v1.5.6.wasm",GLYPHS_URL:"mapbox://fonts/mapbox/{fontstack}/{range}.pbf"},ht={supported:!1,testSupport:function(e){!Pt&amp;&amp;gt&amp;&amp;(Vt?Nt(e):mt=e)}};let mt,gt,Pt=!1,Vt=!1;function Nt(e){const t=e.createTexture();e.bindTexture(e.TEXTURE_2D,t);try{if(e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,gt),e.isContextLost())return;ht.supported=!0}catch{}e.deleteTexture(t),Pt=!0}L.document&amp;&amp;(gt=L.document.createElement("img"),gt.onload=function(){mt&amp;&amp;Nt(mt),mt=null,Vt=!0},gt.onerror=function(){Pt=!0,mt=null},gt.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");const jt="01";function Qt(e){return e&amp;&amp;e.__esModule&amp;&amp;Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ae=le;function le(e,t,i,r){this.cx=3*e,this.bx=3*(i-e)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*t,this.by=3*(r-t)-this.cy,this.ay=1-this.cy-this.by,this.p1x=e,this.p1y=t,this.p2x=i,this.p2y=r}le.prototype={sampleCurveX:function(e){return((this.ax*e+this.bx)*e+this.cx)*e},sampleCurveY:function(e){return((this.ay*e+this.by)*e+this.cy)*e},sampleCurveDerivativeX:function(e){return(3*this.ax*e+2*this.bx)*e+this.cx},solveCurveX:function(e,t){if(t===void 0&amp;&amp;(t=1e-6),e&lt;0)return 0;if(e&gt;1)return 1;for(var i=e,r=0;r&lt;8;r++){var n=this.sampleCurveX(i)-e;if(Math.abs(n)&lt;t)return i;var s=this.sampleCurveDerivativeX(i);if(Math.abs(s)&lt;1e-6)break;i-=n/s}var a=0,l=1;for(i=e,r=0;r&lt;20&amp;&amp;(n=this.sampleCurveX(i),!(Math.abs(n-e)&lt;t));r++)e&gt;n?a=i:l=i,i=.5*(l-a)+a;return i},solve:function(e,t){return this.sampleCurveY(this.solveCurveX(e,t))}};var Oe=Qt(ae),Ge=ve;function ve(e,t){this.x=e,this.y=t}ve.prototype={clone:function(){return new ve(this.x,this.y)},add:function(e){return this.clone()._add(e)},sub:function(e){return this.clone()._sub(e)},multByPoint:function(e){return this.clone()._multByPoint(e)},divByPoint:function(e){return this.clone()._divByPoint(e)},mult:function(e){return this.clone()._mult(e)},div:function(e){return this.clone()._div(e)},rotate:function(e){return this.clone()._rotate(e)},rotateAround:function(e,t){return this.clone()._rotateAround(e,t)},matMult:function(e){return this.clone()._matMult(e)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(e){return this.x===e.x&amp;&amp;this.y===e.y},dist:function(e){return Math.sqrt(this.distSqr(e))},distSqr:function(e){var t=e.x-this.x,i=e.y-this.y;return t*t+i*i},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(e){return Math.atan2(this.y-e.y,this.x-e.x)},angleWith:function(e){return this.angleWithSep(e.x,e.y)},angleWithSep:function(e,t){return Math.atan2(this.x*t-this.y*e,this.x*e+this.y*t)},_matMult:function(e){var t=e[2]*this.x+e[3]*this.y;return this.x=e[0]*this.x+e[1]*this.y,this.y=t,this},_add:function(e){return this.x+=e.x,this.y+=e.y,this},_sub:function(e){return this.x-=e.x,this.y-=e.y,this},_mult:function(e){return this.x*=e,this.y*=e,this},_div:function(e){return this.x/=e,this.y/=e,this},_multByPoint:function(e){return this.x*=e.x,this.y*=e.y,this},_divByPoint:function(e){return this.x/=e.x,this.y/=e.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var e=this.y;return this.y=this.x,this.x=-e,this},_rotate:function(e){var t=Math.cos(e),i=Math.sin(e),r=i*this.x+t*this.y;return this.x=t*this.x-i*this.y,this.y=r,this},_rotateAround:function(e,t){var i=Math.cos(e),r=Math.sin(e),n=t.y+r*(this.x-t.x)+i*(this.y-t.y);return this.x=t.x+i*(this.x-t.x)-r*(this.y-t.y),this.y=n,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},ve.convert=function(e){return e instanceof ve?e:Array.isArray(e)?new ve(e[0],e[1]):e};var Q=Qt(Ge);function Lt(e,t){if(Array.isArray(e)){if(!Array.isArray(t)||e.length!==t.length)return!1;for(let i=0;i&lt;e.length;i++)if(!Lt(e[i],t[i]))return!1;return!0}if(typeof e=="object"&amp;&amp;e!==null&amp;&amp;t!==null){if(typeof t!="object"||Object.keys(e).length!==Object.keys(t).length)return!1;for(const i in e)if(!Lt(e[i],t[i]))return!1;return!0}return e===t}const li=Math.PI/180,Ke=180/Math.PI;function $t(e){return e*li}function vi(e){return e*Ke}const ts=[[0,0],[1,0],[1,1],[0,1]];function jr(e){if(e&lt;=0)return 0;if(e&gt;=1)return 1;const t=e*e,i=t*e;return 4*(e&lt;.5?i:3*(e-t)+i-.75)}function es(e){let t=1/0,i=1/0,r=-1/0,n=-1/0;for(const s of e)t=Math.min(t,s.x),i=Math.min(i,s.y),r=Math.max(r,s.x),n=Math.max(n,s.y);return{min:new Q(t,i),max:new Q(r,n)}}function fr(e,t,i=0,r=!0){const n=new Q(i,i),s=e.sub(n),a=t.add(n),l=[s,new Q(a.x,s.y),a,new Q(s.x,a.y)];return r&amp;&amp;l.push(s.clone()),l}function Ls(e,t,i,r){const n=new Oe(e,t,i,r);return function(s){return n.solve(s)}}const Gr=Ls(.25,.1,.25,1);function Xt(e,t,i){return Math.min(i,Math.max(t,e))}function xn(e,t,i){return(i=Xt((i-e)/(t-e),0,1))*i*(3-2*i)}function Hr(e,t,i){const r=i-t,n=((e-t)%r+r)%r+t;return n===t?i:n}function Rs(e,t,i){if(!e.length)return i(null,[]);let r=e.length;const n=new Array(e.length);let s=null;e.forEach((a,l)=&gt;{t(a,(h,d)=&gt;{h&amp;&amp;(s=h),n[l]=d,--r==0&amp;&amp;i(s,n)})})}function Ds(e){const t=[];for(const i in e)t.push(e[i]);return t}function Bt(e,...t){for(const i of t)for(const r in i)e[r]=i[r];return e}function nr(e,t){const i={};for(let r=0;r&lt;t.length;r++){const n=t[r];n in e&amp;&amp;(i[n]=e[n])}return i}let qi=1;function ar(){return qi++}function Os(){return function e(t){return t?(t^Math.random()*(16&gt;&gt;t/4)).toString(16):([1e7]+-[1e3]+-4e3+-8e3+-1e11).replace(/[018]/g,e)}()}function is(e){return e&lt;=1?1:Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))}function rs(e){return!!e&amp;&amp;/^[0-9a-f]{8}-[0-9a-f]{4}-[4][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(e)}function Oi(e,t){e.forEach(i=&gt;{t[i]&amp;&amp;(t[i]=t[i].bind(t))})}function vn(e,t){return e.indexOf(t,e.length-t.length)!==-1}function Er(e,t,i){const r={};for(const n in e)r[n]=t.call(this,e[n],n,e);return r}function Mt(e,t,i){const r={};for(const n in e)t.call(this,e[n],n,e)&amp;&amp;(r[n]=e[n]);return r}function V(e){return Array.isArray(e)?e.map(V):typeof e=="object"&amp;&amp;e?Er(e,V):e}const $={};function tt(e){$[e]||(typeof console&lt;"u"&amp;&amp;console.warn(e),$[e]=!0)}function vt(e,t,i){return(i.y-e.y)*(t.x-e.x)&gt;(t.y-e.y)*(i.x-e.x)}function Tt(e){let t=0;for(let i,r,n=0,s=e.length,a=s-1;n&lt;s;a=n++)i=e[n],r=e[a],t+=(r.x-i.x)*(i.y+r.y);return t}function Wt([e,t,i]){const r=$t(t+90),n=$t(i);return{x:e*Math.cos(r)*Math.sin(n),y:e*Math.sin(r)*Math.sin(n),z:e*Math.cos(n),azimuthal:t,polar:i}}function te(e,t,i){const r=Math.sqrt(e*e+t*t+i*i),n=r&gt;0?Math.acos(i/r)*Ke:0;let s=e!==0||t!==0?Math.atan2(-t,-e)*Ke+90:0;return s&lt;0&amp;&amp;(s+=360),[r,s,n]}function Et(){return typeof WorkerGlobalScope&lt;"u"&amp;&amp;typeof self&lt;"u"&amp;&amp;self instanceof WorkerGlobalScope}function se(e){const t={};if(e.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)&lt;&gt;@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)&lt;&gt;@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(i,r,n,s)=&gt;{const a=n||s;return t[r]=!a||a.toLowerCase(),""}),t["max-age"]){const i=parseInt(t["max-age"],10);isNaN(i)?delete t["max-age"]:t["max-age"]=i}return t}let he=null;function me(){return!!L.document.fullscreenElement||!!L.document.webkitFullscreenElement}function di(e){try{const t=L[e];return t.setItem("_mapbox_test_",1),t.removeItem("_mapbox_test_"),!0}catch{return!1}}function bi(e,t){return[e[4*t],e[4*t+1],e[4*t+2],e[4*t+3]]}function ji(e,t,i){e[4*t+0]=i[0],e[4*t+1]=i[1],e[4*t+2]=i[2],e[4*t+3]=i[3]}function gi(e,t){return[Math.pow(e[0],2.2)*t,Math.pow(e[1],2.2)*t,Math.pow(e[2],2.2)*t]}function Ri(e){return[Math.pow(e[0],1/2.2),Math.pow(e[1],1/2.2),Math.pow(e[2],1/2.2)]}const pi="mapbox-tiles";let yr=500,Sr=50,Ar,Lr;function ao(){try{return L.caches}catch{}}function Rr(){ao()&amp;&amp;!Ar&amp;&amp;(Ar=L.caches.open(pi))}function bn(e){const t=e.indexOf("?");if(t&lt;0)return e;const i=function(n){const s=n.indexOf("?");return s&gt;0?n.slice(s+1).split("&amp;"):[]}(e),r=i.filter(n=&gt;{const s=n.split("=");return s[0]==="language"||s[0]==="worldview"});return r.length?`${e.slice(0,t)}?${r.join("&amp;")}`:e.slice(0,t)}let Bn=1/0;function ns(e){Bn++,Bn&gt;Sr&amp;&amp;(e.getActor().send("enforceCacheSizeLimit",yr),Bn=0)}const pt={Unknown:"Unknown",Style:"Style",Source:"Source",Tile:"Tile",Glyphs:"Glyphs",SpriteImage:"SpriteImage",SpriteJSON:"SpriteJSON",Image:"Image",Model:"Model"};typeof Object.freeze=="function"&amp;&amp;Object.freeze(pt);class yt extends Error{constructor(t,i,r){i===401&amp;&amp;Ei(r)&amp;&amp;(t+=": you may have provided an invalid Mapbox access token. See https://docs.mapbox.com/api/overview/#access-tokens-and-token-scopes"),super(t),this.status=i,this.url=r}toString(){return`${this.name}: ${this.message} (${this.status}): ${this.url}`}}const St=Et()?()=&gt;self.worker&amp;&amp;self.worker.referrer:()=&gt;(L.location.protocol==="blob:"?L.parent:L).location.href,Ct=function(e,t){if(!(/^file:/.test(i=e.url)||/^file:/.test(St())&amp;&amp;!/^\w+:/.test(i))){if(L.fetch&amp;&amp;L.Request&amp;&amp;L.AbortController&amp;&amp;L.Request.prototype.hasOwnProperty("signal"))return function(r,n){const s=new L.AbortController,a=new L.Request(r.url,{method:r.method||"GET",body:r.body,credentials:r.credentials,headers:r.headers,referrer:St(),referrerPolicy:r.referrerPolicy,signal:s.signal});let l=!1,h=!1;const d=(f=a.url).indexOf("sku=")&gt;0&amp;&amp;Ei(f);var f;r.type==="json"&amp;&amp;a.headers.set("Accept","application/json");const m=(y,x,b)=&gt;{if(h)return;if(y&amp;&amp;y.message!=="SecurityError"&amp;&amp;tt(y.toString()),x&amp;&amp;b)return _(x);const w=Date.now();L.fetch(a).then(T=&gt;{if(T.ok){const S=d?T.clone():null;return _(T,S,w)}return n(new yt(T.statusText,T.status,r.url))}).catch(T=&gt;{T.name!=="AbortError"&amp;&amp;n(new Error(`${T.message} ${r.url}`))})},_=(y,x,b)=&gt;{(r.type==="arrayBuffer"?y.arrayBuffer():r.type==="json"?y.json():y.text()).then(w=&gt;{h||(x&amp;&amp;b&amp;&amp;function(T,S,I){if(Rr(),!Ar)return;const P={status:S.status,statusText:S.statusText,headers:new L.Headers};S.headers.forEach((D,O)=&gt;P.headers.set(O,D));const M=se(S.headers.get("Cache-Control")||"");if(M["no-store"])return;M["max-age"]&amp;&amp;P.headers.set("Expires",new Date(I+1e3*M["max-age"]).toUTCString());const C=P.headers.get("Expires");C&amp;&amp;(new Date(C).getTime()-I&lt;42e4||function(D,O){if(Lr===void 0)try{new Response(new ReadableStream),Lr=!0}catch{Lr=!1}Lr?O(D.body):D.blob().then(O)}(S,D=&gt;{const O=new L.Response(D,P);Rr(),Ar&amp;&amp;Ar.then(k=&gt;k.put(bn(T.url),O)).catch(k=&gt;tt(k.message))}))}(a,x,b),l=!0,n(null,w,y.headers.get("Cache-Control"),y.headers.get("Expires")))}).catch(w=&gt;{h||n(new Error(w.message))})};return d?function(y,x){if(Rr(),!Ar)return x(null);const b=bn(y.url);Ar.then(w=&gt;{w.match(b).then(T=&gt;{const S=function(I){if(!I)return!1;const P=new Date(I.headers.get("Expires")||0),M=se(I.headers.get("Cache-Control")||"");return P&gt;Date.now()&amp;&amp;!M["no-cache"]}(T);w.delete(b),S&amp;&amp;w.put(b,T.clone()),x(null,T,S)}).catch(x)}).catch(x)}(a,m):m(null,null),{cancel:()=&gt;{h=!0,l||s.abort()}}}(e,t);if(Et()&amp;&amp;self.worker&amp;&amp;self.worker.actor)return self.worker.actor.send("getResource",e,t,void 0,!0)}var i;return function(r,n){const s=new L.XMLHttpRequest;s.open(r.method||"GET",r.url,!0),r.type==="arrayBuffer"&amp;&amp;(s.responseType="arraybuffer");for(const a in r.headers)s.setRequestHeader(a,r.headers[a]);return r.type==="json"&amp;&amp;(s.responseType="text",s.setRequestHeader("Accept","application/json")),s.withCredentials=r.credentials==="include",s.onerror=()=&gt;{n(new Error(s.statusText))},s.onload=()=&gt;{if((s.status&gt;=200&amp;&amp;s.status&lt;300||s.status===0)&amp;&amp;s.response!==null){let a=s.response;if(r.type==="json")try{a=JSON.parse(s.response)}catch(l){return n(l)}n(null,a,s.getResponseHeader("Cache-Control"),s.getResponseHeader("Expires"))}else n(new yt(s.statusText,s.status,r.url))},s.send(r.body),{cancel:()=&gt;s.abort()}}(e,t)},Rt=function(e,t){return Ct(Bt(e,{type:"json"}),t)},zt=function(e,t){return Ct(Bt(e,{type:"arrayBuffer"}),t)};function Ut(e){const t=L.document.createElement("a");return t.href=e,t.protocol===L.document.location.protocol&amp;&amp;t.host===L.document.location.host}const Dt="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";let Kt,Ft;Kt=[],Ft=0;const Te=function(e,t){if(ht.supported&amp;&amp;(e.headers||(e.headers={}),e.headers.accept="image/webp,*/*"),Ft&gt;=H.MAX_PARALLEL_IMAGE_REQUESTS){const s={requestParameters:e,callback:t,cancelled:!1,cancel(){this.cancelled=!0}};return Kt.push(s),s}Ft++;let i=!1;const r=()=&gt;{if(!i)for(i=!0,Ft--;Kt.length&amp;&amp;Ft&lt;H.MAX_PARALLEL_IMAGE_REQUESTS;){const s=Kt.shift(),{requestParameters:a,callback:l,cancelled:h}=s;h||(s.cancel=Te(a,l).cancel)}},n=zt(e,(s,a,l,h)=&gt;{r(),s?t(s):a&amp;&amp;(L.createImageBitmap?function(d,f){const m=new L.Blob([new Uint8Array(d)],{type:"image/png"});L.createImageBitmap(m).then(_=&gt;{f(null,_)}).catch(_=&gt;{f(new Error(`Could not load image because of ${_.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`))})}(a,(d,f)=&gt;t(d,f,l,h)):function(d,f){const m=new L.Image,_=L.URL;m.onload=()=&gt;{f(null,m),_.revokeObjectURL(m.src),m.onload=null,L.requestAnimationFrame(()=&gt;{m.src=Dt})},m.onerror=()=&gt;f(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."));const y=new L.Blob([new Uint8Array(d)],{type:"image/png"});m.src=d.byteLength?_.createObjectURL(y):Dt}(a,(d,f)=&gt;t(d,f,l,h)))});return{cancel:()=&gt;{n.cancel(),r()}}},Je="NO_ACCESS_TOKEN";class oe{constructor(t,i,r){this._transformRequestFn=t,this._customAccessToken=i,this._silenceAuthErrors=!!r,this._createSkuToken()}_createSkuToken(){const t=function(){let i="";for(let r=0;r&lt;10;r++)i+="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"[Math.floor(62*Math.random())];return{token:["1",jt,i].join(""),tokenExpiresAt:Date.now()+432e5}}();this._skuToken=t.token,this._skuTokenExpiresAt=t.tokenExpiresAt}_isSkuTokenExpired(){return Date.now()&gt;this._skuTokenExpiresAt}transformRequest(t,i){return this._transformRequestFn&amp;&amp;this._transformRequestFn(t,i)||{url:t}}normalizeStyleURL(t,i){if(!Qe(t))return t;const r=Gi(t);return r.params.push(`sdk=js-${G}`),r.path=`/styles/v1${r.path}`,this._makeAPIURL(r,this._customAccessToken||i)}normalizeGlyphsURL(t,i){if(!Qe(t))return t;const r=Gi(t);return r.path=`/fonts/v1${r.path}`,this._makeAPIURL(r,this._customAccessToken||i)}normalizeModelURL(t,i){if(!Qe(t))return t;const r=Gi(t);return r.path=`/models/v1${r.path}`,this._makeAPIURL(r,this._customAccessToken||i)}normalizeSourceURL(t,i,r,n){if(!Qe(t))return t;const s=Gi(t);return s.path=`/v4/${s.authority}.json`,s.params.push("secure"),r&amp;&amp;s.params.push(`language=${r}`),n&amp;&amp;s.params.push(`worldview=${n}`),this._makeAPIURL(s,this._customAccessToken||i)}normalizeSpriteURL(t,i,r,n){const s=Gi(t);return Qe(t)?(s.path=`/styles/v1${s.path}/sprite${i}${r}`,this._makeAPIURL(s,this._customAccessToken||n)):(s.path+=`${i}${r}`,Ki(s))}normalizeTileURL(t,i,r){if(this._isSkuTokenExpired()&amp;&amp;this._createSkuToken(),t&amp;&amp;!Qe(t))return t;const n=Gi(t);n.path=n.path.replace(/(\.(png|jpg)\d*)(?=$)/,`${i||r&amp;&amp;n.authority!=="raster"&amp;&amp;r===512?"@2x":""}${ht.supported?".webp":"$1"}`),n.authority==="raster"?n.path=`/${H.RASTER_URL_PREFIX}${n.path}`:(n.path=n.path.replace(/^.+\/v4\//,"/"),n.path=`/${H.TILE_URL_VERSION}${n.path}`);const s=this._customAccessToken||function(a){for(const l of a){const h=l.match(/^access_token=(.*)$/);if(h)return h[1]}return null}(n.params)||H.ACCESS_TOKEN;return H.REQUIRE_ACCESS_TOKEN&amp;&amp;s&amp;&amp;this._skuToken&amp;&amp;n.params.push(`sku=${this._skuToken}`),this._makeAPIURL(n,s)}canonicalizeTileURL(t,i){const r=Gi(t);if(!r.path.match(/^(\/v4\/|\/raster\/v1\/)/)||!r.path.match(/\.[\w]+$/))return t;let n="mapbox://";r.path.match(/^\/raster\/v1\//)?n+=`raster/${r.path.replace(`/${H.RASTER_URL_PREFIX}/`,"")}`:n+=`tiles/${r.path.replace(`/${H.TILE_URL_VERSION}/`,"")}`;let s=r.params;return i&amp;&amp;(s=s.filter(a=&gt;!a.match(/^access_token=/))),s.length&amp;&amp;(n+=`?${s.join("&amp;")}`),n}canonicalizeTileset(t,i){const r=!!i&amp;&amp;Qe(i),n=[];for(const s of t.tiles||[])Ei(s)?n.push(this.canonicalizeTileURL(s,r)):n.push(s);return n}_makeAPIURL(t,i){const r="See https://docs.mapbox.com/api/overview/#access-tokens-and-token-scopes",n=Gi(H.API_URL);if(t.protocol=n.protocol,t.authority=n.authority,t.protocol==="http"){const s=t.params.indexOf("secure");s&gt;=0&amp;&amp;t.params.splice(s,1)}if(n.path!=="/"&amp;&amp;(t.path=`${n.path}${t.path}`),!H.REQUIRE_ACCESS_TOKEN)return Ki(t);if(i=i||H.ACCESS_TOKEN,!this._silenceAuthErrors){if(!i)throw new Error(`An API access token is required to use Mapbox GL. ${r}`);if(i[0]==="s")throw new Error(`Use a public access token (pk.*) with Mapbox GL, not a secret access token (sk.*). ${r}`)}return t.params=t.params.filter(s=&gt;s.indexOf("access_token")===-1),t.params.push(`access_token=${i||""}`),Ki(t)}}function Qe(e){return e.indexOf("mapbox:")===0}function Ei(e){return H.API_URL_REGEX.test(e)}function Pi(e){return H.API_CDN_URL_REGEX.test(e)}function Ni(e){return H.API_STYLE_REGEX.test(e)&amp;&amp;!pr(e)}function pr(e){return H.API_SPRITE_REGEX.test(e)}const kr=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function Gi(e){const t=e.match(kr);if(!t)throw new Error("Unable to parse URL object");return{protocol:t[1],authority:t[2],path:t[3]||"/",params:t[4]?t[4].split("&amp;"):[]}}function Ki(e){const t=e.params.length?`?${e.params.join("&amp;")}`:"";return`${e.protocol}://${e.authority}${e.path}${t}`}const Ji="mapbox.eventData";function wn(e){if(!e)return null;const t=e.split(".");if(!t||t.length!==3)return null;try{return JSON.parse(decodeURIComponent(L.atob(t[1]).split("").map(i=&gt;"%"+("00"+i.charCodeAt(0).toString(16)).slice(-2)).join("")))}catch{return null}}class an{constructor(t){this.type=t,this.anonId=null,this.eventData={},this.queue=[],this.pendingRequest=null}getStorageKey(t){const i=wn(H.ACCESS_TOKEN);let r="";return r=i&amp;&amp;i.u?L.btoa(encodeURIComponent(i.u).replace(/%([0-9A-F]{2})/g,(n,s)=&gt;String.fromCharCode(+("0x"+s)))):H.ACCESS_TOKEN||"",t?`${Ji}.${t}:${r}`:`${Ji}:${r}`}fetchEventData(){const t=di("localStorage"),i=this.getStorageKey(),r=this.getStorageKey("uuid");if(t)try{const n=L.localStorage.getItem(i);n&amp;&amp;(this.eventData=JSON.parse(n));const s=L.localStorage.getItem(r);s&amp;&amp;(this.anonId=s)}catch{tt("Unable to read from LocalStorage")}}saveEventData(){const t=di("localStorage"),i=this.getStorageKey(),r=this.getStorageKey("uuid");if(t)try{L.localStorage.setItem(r,this.anonId),Object.keys(this.eventData).length&gt;=1&amp;&amp;L.localStorage.setItem(i,JSON.stringify(this.eventData))}catch{tt("Unable to write to LocalStorage")}}processRequests(t){}postEvent(t,i,r,n){if(!H.EVENTS_URL)return;const s=Gi(H.EVENTS_URL);s.params.push(`access_token=${n||H.ACCESS_TOKEN||""}`);const a={event:this.type,created:new Date(t).toISOString()},l=i?Bt(a,i):a,h={url:Ki(s),headers:{"Content-Type":"text/plain"},body:JSON.stringify([l])};this.pendingRequest=function(d,f){return Ct(Bt(d,{method:"POST"}),f)}(h,d=&gt;{this.pendingRequest=null,r(d),this.saveEventData(),this.processRequests(n)})}queueRequest(t,i){this.queue.push(t),this.processRequests(i)}}const ss=new class extends an{constructor(e){super("appUserTurnstile"),this._customAccessToken=e}postTurnstileEvent(e,t){H.EVENTS_URL&amp;&amp;H.ACCESS_TOKEN&amp;&amp;Array.isArray(e)&amp;&amp;e.some(i=&gt;Qe(i)||Ei(i))&amp;&amp;this.queueRequest(Date.now(),t)}processRequests(e){if(this.pendingRequest||this.queue.length===0)return;this.anonId&amp;&amp;this.eventData.lastSuccess&amp;&amp;this.eventData.tokenU||this.fetchEventData();const t=wn(H.ACCESS_TOKEN),i=t?t.u:H.ACCESS_TOKEN;let r=i!==this.eventData.tokenU;rs(this.anonId)||(this.anonId=Os(),r=!0);const n=this.queue.shift();if(this.eventData.lastSuccess){const s=new Date(this.eventData.lastSuccess),a=new Date(n),l=(n-this.eventData.lastSuccess)/864e5;r=r||l&gt;=1||l&lt;-1||s.getDate()!==a.getDate()}else r=!0;r?this.postEvent(n,{sdkIdentifier:"mapbox-gl-js",sdkVersion:G,skuId:jt,"enabled.telemetry":!1,userId:this.anonId},s=&gt;{s||(this.eventData.lastSuccess=n,this.eventData.tokenU=i)},e):this.processRequests()}},Yl=ss.postTurnstileEvent.bind(ss),Ou=new class extends an{constructor(){super("map.load"),this.success={},this.skuToken=""}postMapLoadEvent(e,t,i,r){this.skuToken=t,this.errorCb=r,H.EVENTS_URL&amp;&amp;(i||H.ACCESS_TOKEN?this.queueRequest({id:e,timestamp:Date.now()},i):this.errorCb(new Error(Je)))}processRequests(e){if(this.pendingRequest||this.queue.length===0)return;const{id:t,timestamp:i}=this.queue.shift();t&amp;&amp;this.success[t]||(this.anonId||this.fetchEventData(),rs(this.anonId)||(this.anonId=Os()),this.postEvent(i,{sdkIdentifier:"mapbox-gl-js",sdkVersion:G,skuId:jt,skuToken:this.skuToken,userId:this.anonId},r=&gt;{r?this.errorCb(r):t&amp;&amp;(this.success[t]=!0)},e))}},za=Ou.postMapLoadEvent.bind(Ou),zr=new class extends an{constructor(){super("gljs.performance")}postPerformanceEvent(e,t){H.EVENTS_URL&amp;&amp;(e||H.ACCESS_TOKEN)&amp;&amp;this.queueRequest({timestamp:Date.now(),performanceData:t},e)}processRequests(e){if(this.pendingRequest||this.queue.length===0)return;const{timestamp:t,performanceData:i}=this.queue.shift(),r=function(n){const s=L.performance.getEntriesByType("resource"),a=L.performance.getEntriesByType("mark"),l=function(_){const y={};if(_){for(const x in _)if(x!=="other")for(const b of _[x]){const w=`${x}ResolveRangeMin`,T=`${x}ResolveRangeMax`,S=`${x}RequestCount`,I=`${x}RequestCachedCount`;y[w]=Math.min(y[w]||1/0,b.startTime),y[T]=Math.max(y[T]||-1/0,b.responseEnd);const P=M=&gt;{y[M]===void 0&amp;&amp;(y[M]=0),++y[M]};b.transferSize!==void 0&amp;&amp;b.transferSize===0&amp;&amp;P(I),P(S)}}return y}(function(_,y){const x={};if(_)for(const b of _){const w=y(b);x[w]===void 0&amp;&amp;(x[w]=[]),x[w].push(b)}return x}(s,ku)),h=L.devicePixelRatio,d=L.navigator.connection||L.navigator.mozConnection||L.navigator.webkitConnection,f={counters:[],metadata:[],attributes:[]},m=(_,y,x)=&gt;{x!=null&amp;&amp;_.push({name:y,value:x.toString()})};for(const _ in l)m(f.counters,_,l[_]);if(n.interactionRange[0]!==1/0&amp;&amp;n.interactionRange[1]!==-1/0&amp;&amp;(m(f.counters,"interactionRangeMin",n.interactionRange[0]),m(f.counters,"interactionRangeMax",n.interactionRange[1])),a)for(const _ of Object.keys(Wr)){const y=Wr[_],x=a.find(b=&gt;b.name===y);x&amp;&amp;m(f.counters,y,x.startTime)}return m(f.counters,"visibilityHidden",n.visibilityHidden),m(f.attributes,"style",function(_){if(_)for(const y of _){const x=y.name.split("?")[0];if(Ni(x)){const b=x.split("/").slice(-2);if(b.length===2)return`mapbox://styles/${b[0]}/${b[1]}`}}}(s)),m(f.attributes,"terrainEnabled",n.terrainEnabled?"true":"false"),m(f.attributes,"fogEnabled",n.fogEnabled?"true":"false"),m(f.attributes,"projection",n.projection),m(f.attributes,"zoom",n.zoom),m(f.metadata,"devicePixelRatio",h),m(f.metadata,"connectionEffectiveType",d?d.effectiveType:void 0),m(f.metadata,"navigatorUserAgent",L.navigator.userAgent),m(f.metadata,"screenWidth",L.screen.width),m(f.metadata,"screenHeight",L.screen.height),m(f.metadata,"windowWidth",L.innerWidth),m(f.metadata,"windowHeight",L.innerHeight),m(f.metadata,"mapWidth",n.width/h),m(f.metadata,"mapHeight",n.height/h),m(f.metadata,"webglRenderer",n.renderer),m(f.metadata,"webglVendor",n.vendor),m(f.metadata,"sdkVersion",G),m(f.metadata,"sdkIdentifier","mapbox-gl-js"),f}(i);for(const n of r.metadata);for(const n of r.counters);for(const n of r.attributes);this.postEvent(t,r,()=&gt;{},e)}},lo=zr.postPerformanceEvent.bind(zr),Nn=new class extends an{constructor(){super("map.auth"),this.success={},this.skuToken=""}getSession(e,t,i,r){if(!H.API_URL||!H.SESSION_PATH)return;const n=Gi(H.API_URL+H.SESSION_PATH);n.params.push(`sku=${t||""}`),n.params.push(`access_token=${r||H.ACCESS_TOKEN||""}`);const s={url:Ki(n),headers:{"Content-Type":"text/plain"}};this.pendingRequest=function(a,l){return Ct(Bt(a,{method:"GET"}),l)}(s,a=&gt;{this.pendingRequest=null,i(a),this.saveEventData(),this.processRequests(r)})}getSessionAPI(e,t,i,r){this.skuToken=t,this.errorCb=r,H.SESSION_PATH&amp;&amp;H.API_URL&amp;&amp;(i||H.ACCESS_TOKEN?this.queueRequest({id:e,timestamp:Date.now()},i):this.errorCb(new Error(Je)))}processRequests(e){if(this.pendingRequest||this.queue.length===0)return;const{id:t,timestamp:i}=this.queue.shift();t&amp;&amp;this.success[t]||this.getSession(i,this.skuToken,r=&gt;{r?this.errorCb(r):t&amp;&amp;(this.success[t]=!0)},e)}},Un=Nn.getSessionAPI.bind(Nn),os=new Set;function ln(e,t){t?os.add(e):os.delete(e)}const Wr={create:"create",load:"load",fullLoad:"fullLoad"},Kl={mark(e){L.performance.mark(e)},measure(e,t,i){L.performance.measure(e,t,i)}};function ku(e){const t=e.name.split("?")[0];return Pi(t)&amp;&amp;t.includes("mapbox-gl.js")?"javascript":Pi(t)&amp;&amp;t.includes("mapbox-gl.css")?"css":function(i){return H.API_FONTS_REGEX.test(i)}(t)?"fontRange":pr(t)?"sprite":Ni(t)?"style":function(i){return H.API_TILEJSON_REGEX.test(i)}(t)?"tilejson":"other"}const Fa=L.performance;function qr(e){const t=e?e.url.toString():void 0;return Fa.getEntriesByName(t)}var Zo=$o;function $o(e){return!function(t){return typeof window&gt;"u"||typeof document&gt;"u"?"not a browser":Array.prototype&amp;&amp;Array.prototype.every&amp;&amp;Array.prototype.filter&amp;&amp;Array.prototype.forEach&amp;&amp;Array.prototype.indexOf&amp;&amp;Array.prototype.lastIndexOf&amp;&amp;Array.prototype.map&amp;&amp;Array.prototype.some&amp;&amp;Array.prototype.reduce&amp;&amp;Array.prototype.reduceRight&amp;&amp;Array.isArray?Function.prototype&amp;&amp;Function.prototype.bind?Object.keys&amp;&amp;Object.create&amp;&amp;Object.getPrototypeOf&amp;&amp;Object.getOwnPropertyNames&amp;&amp;Object.isSealed&amp;&amp;Object.isFrozen&amp;&amp;Object.isExtensible&amp;&amp;Object.getOwnPropertyDescriptor&amp;&amp;Object.defineProperty&amp;&amp;Object.defineProperties&amp;&amp;Object.seal&amp;&amp;Object.freeze&amp;&amp;Object.preventExtensions?"JSON"in window&amp;&amp;"parse"in JSON&amp;&amp;"stringify"in JSON?function(){if(!("Worker"in window&amp;&amp;"Blob"in window&amp;&amp;"URL"in window))return!1;var r,n,s=new Blob([""],{type:"text/javascript"}),a=URL.createObjectURL(s);try{n=new Worker(a),r=!0}catch{r=!1}return n&amp;&amp;n.terminate(),URL.revokeObjectURL(a),r}()?"Uint8ClampedArray"in window?ArrayBuffer.isView?function(){var r=document.createElement("canvas");r.width=r.height=1;var n=r.getContext("2d");if(!n)return!1;var s=n.getImageData(0,0,1,1);return s&amp;&amp;s.width===r.width}()?(Xo[i=t&amp;&amp;t.failIfMajorPerformanceCaveat]===void 0&amp;&amp;(Xo[i]=function(r){var n,s=function(a){var l=document.createElement("canvas"),h=Object.create($o.webGLContextAttributes);return h.failIfMajorPerformanceCaveat=a,l.getContext("webgl",h)||l.getContext("experimental-webgl",h)}(r);if(!s)return!1;try{n=s.createShader(s.VERTEX_SHADER)}catch{return!1}return!(!n||s.isContextLost())&amp;&amp;(s.shaderSource(n,"void main() {}"),s.compileShader(n),s.getShaderParameter(n,s.COMPILE_STATUS)===!0)}(i)),Xo[i]?document.documentMode?"insufficient ECMAScript 6 support":void 0:"insufficient WebGL support"):"insufficient Canvas/getImageData support":"insufficient ArrayBuffer support":"insufficient Uint8ClampedArray support":"insufficient worker support":"insufficient JSON support":"insufficient Object support":"insufficient Function support":"insufficent Array support";var i}(e)}var Xo={};let Yo,co,uo,cn,ks;function Jl(){return Yo==null&amp;&amp;(Yo=L.OffscreenCanvas&amp;&amp;new L.OffscreenCanvas(1,1).getContext("2d")&amp;&amp;typeof L.createImageBitmap=="function"),Yo}$o.webGLContextAttributes={antialias:!1,alpha:!0,stencil:!0,depth:!0};const _e={now:()=&gt;cn!==void 0?cn:L.performance.now(),setNow(e){cn=e},restoreNow(){cn=void 0},frame(e){const t=L.requestAnimationFrame(e);return{cancel:()=&gt;L.cancelAnimationFrame(t)}},getImageData(e,t=0){const{width:i,height:r}=e;ks||(ks=L.document.createElement("canvas"));const n=ks.getContext("2d",{willReadFrequently:!0});if(!n)throw new Error("failed to create canvas 2d context");return(i&gt;ks.width||r&gt;ks.height)&amp;&amp;(ks.width=i,ks.height=r),n.clearRect(-t,-t,i+2*t,r+2*t),n.drawImage(e,0,0,i,r),n.getImageData(-t,-t,i+2*t,r+2*t)},resolveURL:e=&gt;(co||(co=L.document.createElement("a")),co.href=e,co.href),get devicePixelRatio(){return L.devicePixelRatio},get prefersReducedMotion(){return!!L.matchMedia&amp;&amp;(uo==null&amp;&amp;(uo=L.matchMedia("(prefers-reduced-motion: reduce)")),uo.matches)},hasCanvasFingerprintNoise(){if(!Jl())return!1;const e=new L.OffscreenCanvas(85,1),t=e.getContext("2d",{willReadFrequently:!0});let i=0;for(let n=0;n&lt;e.width;++n)t.fillStyle=`rgba(${i++},${i++},${i++}, 255)`,t.fillRect(n,0,1,1);const r=t.getImageData(0,0,e.width,e.height);i=0;for(let n=0;n&lt;r.data.length;++n)if(n%4!=3&amp;&amp;i++!==r.data[n])return!0;return!1}};function ci(e,t,i){const r=L.document.createElement(e);return t!==void 0&amp;&amp;(r.className=t),i&amp;&amp;i.appendChild(r),r}function Vn(e,t,i){const r=L.document.createElementNS("http://www.w3.org/2000/svg",e);for(const n of Object.keys(t))r.setAttributeNS(null,n,t[n]);return i&amp;&amp;i.appendChild(r),r}const zs=L.document&amp;&amp;L.document.documentElement.style,N=zs&amp;&amp;zs.userSelect!==void 0?"userSelect":"WebkitUserSelect";let q;function rt(){zs&amp;&amp;N&amp;&amp;(q=zs[N],zs[N]="none")}function xt(){zs&amp;&amp;N&amp;&amp;(zs[N]=q)}function Gt(e){e.preventDefault(),e.stopPropagation(),L.removeEventListener("click",Gt,!0)}function ce(){L.addEventListener("click",Gt,!0),L.setTimeout(()=&gt;{L.removeEventListener("click",Gt,!0)},0)}function $e(e,t){const i=e.getBoundingClientRect();return wr(e,i,t)}function Qi(e,t){const i=e.getBoundingClientRect(),r=[];for(let n=0;n&lt;t.length;n++)r.push(wr(e,i,t[n]));return r}function mr(e){return L.InstallTrigger!==void 0&amp;&amp;e.button===2&amp;&amp;e.ctrlKey&amp;&amp;L.navigator.platform.toUpperCase().indexOf("MAC")&gt;=0?0:e.button}function wr(e,t,i){const r=e.offsetWidth===t.width?1:e.offsetWidth/t.width;return new Q((i.clientX-t.left)*r,(i.clientY-t.top)*r)}function un(e,t,i){i[e]&amp;&amp;i[e].indexOf(t)!==-1||(i[e]=i[e]||[],i[e].push(t))}function kf(e,t,i){if(i&amp;&amp;i[e]){const r=i[e].indexOf(t);r!==-1&amp;&amp;i[e].splice(r,1)}}class It{constructor(t,i={}){Bt(this,i),this.type=t}}class xe extends It{constructor(t,i={}){super("error",Bt({error:t},i))}}class Zi{on(t,i){return this._listeners=this._listeners||{},un(t,i,this._listeners),this}off(t,i){return kf(t,i,this._listeners),kf(t,i,this._oneTimeListeners),this}once(t,i){return i?(this._oneTimeListeners=this._oneTimeListeners||{},un(t,i,this._oneTimeListeners),this):new Promise(r=&gt;this.once(t,r))}fire(t,i){typeof t=="string"&amp;&amp;(t=new It(t,i||{}));const r=t.type;if(this.listens(r)){t.target=this;const n=this._listeners&amp;&amp;this._listeners[r]?this._listeners[r].slice():[];for(const l of n)l.call(this,t);const s=this._oneTimeListeners&amp;&amp;this._oneTimeListeners[r]?this._oneTimeListeners[r].slice():[];for(const l of s)kf(r,l,this._oneTimeListeners),l.call(this,t);const a=this._eventedParent;a&amp;&amp;(Bt(t,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),a.fire(t))}else t instanceof xe&amp;&amp;console.error(t.error);return this}listens(t){return!!(this._listeners&amp;&amp;this._listeners[t]&amp;&amp;this._listeners[t].length&gt;0||this._oneTimeListeners&amp;&amp;this._oneTimeListeners[t]&amp;&amp;this._oneTimeListeners[t].length&gt;0||this._eventedParent&amp;&amp;this._eventedParent.listens(t))}setEventedParent(t,i){return this._eventedParent=t,this._eventedParentData=i,this}}var st=JSON.parse('{"$version":8,"$root":{"version":{"required":true,"type":"enum","values":[8]},"fragment":{"type":"boolean"},"name":{"type":"string"},"metadata":{"type":"*"},"center":{"type":"array","value":"number"},"zoom":{"type":"number"},"bearing":{"type":"number","default":0,"period":360},"pitch":{"type":"number","default":0},"light":{"type":"light"},"lights":{"required":false,"type":"array","value":"light-3d"},"terrain":{"type":"terrain","optional":true},"fog":{"type":"fog"},"camera":{"type":"camera"},"imports":{"type":"array","value":"import"},"schema":{"type":"schema"},"sources":{"required":true,"type":"sources"},"sprite":{"type":"string"},"glyphs":{"type":"string","default":"mapbox://fonts/mapbox/{fontstack}/{range}.pbf"},"transition":{"type":"transition"},"projection":{"type":"projection"},"layers":{"required":true,"type":"array","value":"layer"},"models":{"type":"models"}},"model":{"type":"string","required":true},"import":{"id":{"type":"string","required":true},"url":{"type":"string","required":true},"config":{"type":"config"},"data":{"type":"$root"}},"config":{"*":{"type":"*"}},"schema":{"*":{"type":"option"}},"option":{"default":{"type":"*","required":true},"type":{"type":"enum","values":{"string":1,"number":1,"boolean":1,"color":1}},"array":{"type":"boolean"},"minValue":{"type":"number"},"maxValue":{"type":"number"},"stepValue":{"type":"number"},"values":{"type":"array","value":"*"},"metadata":{"type":"*"}},"models":{"*":{"type":"model"}},"light-3d":{"id":{"type":"string","required":true},"properties":{"type":"properties"},"type":{"type":"enum","values":{"ambient":{},"directional":{},"flat":{}}}},"properties":["properties_light_directional","properties_light_ambient","properties_light_flat"],"properties_light_directional":{"direction":{"type":"array","default":[210,30],"minimum":[0,0],"maximum":[360,90],"length":2,"value":"number","property-type":"data-constant","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"color":{"type":"color","property-type":"data-constant","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"intensity":{"type":"number","property-type":"data-constant","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"cast-shadows":{"type":"boolean","default":false,"expression":{},"property-type":"data-constant"},"shadow-intensity":{"type":"number","property-type":"data-constant","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"properties_light_ambient":{"color":{"type":"color","property-type":"data-constant","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"intensity":{"type":"number","property-type":"data-constant","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"properties_light_flat":{"anchor":{"type":"enum","default":"viewport","values":{"map":1,"viewport":1},"property-type":"data-constant","expression":{"parameters":["zoom"]}},"position":{"type":"array","default":[1.15,210,30],"length":3,"value":"number","property-type":"data-constant","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"color":{"type":"color","property-type":"data-constant","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"intensity":{"type":"number","property-type":"data-constant","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"sources":{"*":{"type":"source"}},"source":["source_vector","source_raster","source_raster_dem","source_raster_array","source_geojson","source_video","source_image","source_model"],"source_vector":{"type":{"required":true,"type":"enum","values":{"vector":1}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"scheme":{"type":"enum","values":{"xyz":1,"tms":1},"default":"xyz"},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"attribution":{"type":"string"},"promoteId":{"type":"promoteId"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_raster":{"type":{"required":true,"type":"enum","values":{"raster":1}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"tileSize":{"type":"number","default":512},"scheme":{"type":"enum","values":{"xyz":1,"tms":1},"default":"xyz"},"attribution":{"type":"string"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_raster_dem":{"type":{"required":true,"type":"enum","values":{"raster-dem":1}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"tileSize":{"type":"number","default":512},"attribution":{"type":"string"},"encoding":{"type":"enum","values":{"terrarium":1,"mapbox":1},"default":"mapbox"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_raster_array":{"type":{"required":true,"type":"enum","values":{"raster-array":1}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"tileSize":{"type":"number","default":512},"attribution":{"type":"string"},"rasterLayers":{"type":"*"},"*":{"type":"*"}},"source_geojson":{"type":{"required":true,"type":"enum","values":{"geojson":1}},"data":{"type":"*"},"maxzoom":{"type":"number","default":18},"attribution":{"type":"string"},"buffer":{"type":"number","default":128,"maximum":512,"minimum":0},"filter":{"type":"*"},"tolerance":{"type":"number","default":0.375},"cluster":{"type":"boolean","default":false},"clusterRadius":{"type":"number","default":50,"minimum":0},"clusterMaxZoom":{"type":"number"},"clusterMinPoints":{"type":"number"},"clusterProperties":{"type":"*"},"lineMetrics":{"type":"boolean","default":false},"generateId":{"type":"boolean","default":false},"promoteId":{"type":"promoteId"}},"source_video":{"type":{"required":true,"type":"enum","values":{"video":1}},"urls":{"required":true,"type":"array","value":"string"},"coordinates":{"required":true,"type":"array","length":4,"value":{"type":"array","length":2,"value":"number"}}},"source_image":{"type":{"required":true,"type":"enum","values":{"image":1}},"url":{"required":false,"type":"string"},"coordinates":{"required":true,"type":"array","length":4,"value":{"type":"array","length":2,"value":"number"}}},"source_model":{"type":{"required":true,"type":"enum","values":{"model":1,"batched-model":1}},"maxzoom":{"type":"number","default":18},"minzoom":{"type":"number","default":0},"tiles":{"type":"array","value":"string"}},"layer":{"id":{"type":"string","required":true},"type":{"type":"enum","values":{"fill":{},"line":{},"symbol":{},"circle":{},"heatmap":{},"fill-extrusion":{},"raster":{},"hillshade":{},"model":{},"background":{},"sky":{},"slot":{}},"required":true},"metadata":{"type":"*"},"source":{"type":"string"},"source-layer":{"type":"string"},"slot":{"type":"string"},"minzoom":{"type":"number","minimum":0,"maximum":24},"maxzoom":{"type":"number","minimum":0,"maximum":24},"filter":{"type":"filter"},"layout":{"type":"layout"},"paint":{"type":"paint"}},"layout":["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_background","layout_sky","layout_model"],"layout_background":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"}},"layout_sky":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"}},"layout_model":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"},"model-id":{"type":"string","default":"","property-type":"data-driven","expression":{"parameters":["zoom","feature"]}}},"layout_fill":{"fill-sort-key":{"type":"number","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"}},"layout_circle":{"circle-sort-key":{"type":"number","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"}},"layout_heatmap":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"}},"layout_fill-extrusion":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"},"fill-extrusion-edge-radius":{"type":"number","private":true,"default":0,"minimum":0,"maximum":1,"expression":{},"property-type":"constant"}},"layout_line":{"line-cap":{"type":"enum","values":{"butt":1,"round":1,"square":1},"default":"butt","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-join":{"type":"enum","values":{"bevel":1,"round":1,"miter":1},"default":"miter","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{"type":"number","default":2,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"line-round-limit":{"type":"number","default":1.05,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"line-sort-key":{"type":"number","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"}},"layout_symbol":{"symbol-placement":{"type":"enum","values":{"point":1,"line":1,"line-center":1},"default":"point","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"symbol-spacing":{"type":"number","default":250,"minimum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{"type":"number","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{"type":"enum","values":{"auto":1,"viewport-y":1,"source":1},"default":"auto","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"symbol-z-elevate":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"icon-optional":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{"type":"enum","values":{"map":1,"viewport":1,"auto":1},"default":"auto","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"icon-size":{"type":"number","default":1,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{"type":"enum","values":{"none":1,"width":1,"height":1,"both":1},"default":"none","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit-padding":{"type":"array","value":"number","length":4,"default":[0,0,0,0],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-image":{"type":"resolvedImage","tokens":true,"expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{"type":"number","default":0,"period":360,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{"type":"number","default":2,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"icon-keep-upright":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"icon-offset":{"type":"array","value":"number","length":2,"default":[0,0],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{"type":"enum","values":{"center":1,"left":1,"right":1,"top":1,"bottom":1,"top-left":1,"top-right":1,"bottom-left":1,"bottom-right":1},"default":"center","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{"type":"enum","values":{"map":1,"viewport":1,"auto":1},"default":"auto","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{"type":"enum","values":{"map":1,"viewport":1,"auto":1},"default":"auto","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{"type":"enum","values":{"map":1,"viewport":1,"auto":1},"default":"auto","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"text-field":{"type":"formatted","default":"","tokens":true,"expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-font":{"type":"array","value":"string","default":["Open Sans Regular","Arial Unicode MS Regular"],"expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-size":{"type":"number","default":16,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{"type":"number","default":10,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{"type":"number","default":1.2,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-letter-spacing":{"type":"number","default":0,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-justify":{"type":"enum","values":{"auto":1,"left":1,"center":1,"right":1},"default":"center","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{"type":"number","default":0,"property-type":"data-driven","expression":{"interpolated":true,"parameters":["zoom","feature"]}},"text-variable-anchor":{"type":"array","value":"enum","values":{"center":1,"left":1,"right":1,"top":1,"bottom":1,"top-left":1,"top-right":1,"bottom-left":1,"bottom-right":1},"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"text-anchor":{"type":"enum","values":{"center":1,"left":1,"right":1,"top":1,"bottom":1,"top-left":1,"top-right":1,"bottom-left":1,"bottom-right":1},"default":"center","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{"type":"number","default":45,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"text-writing-mode":{"type":"array","value":"enum","values":{"horizontal":1,"vertical":1},"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"text-rotate":{"type":"number","default":0,"period":360,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-padding":{"type":"number","default":2,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"text-keep-upright":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"text-transform":{"type":"enum","values":{"none":1,"uppercase":1,"lowercase":1},"default":"none","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-offset":{"type":"array","value":"number","length":2,"default":[0,0],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"text-optional":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"}},"layout_raster":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"}},"layout_hillshade":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"}},"filter":{"type":"array","value":"*"},"filter_symbol":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature","pitch","distance-from-center"]}},"filter_fill":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_line":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_circle":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_fill-extrusion":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_heatmap":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_operator":{"type":"enum","values":{"==":1,"!=":1,"&gt;":1,"&gt;=":1,"&lt;":1,"&lt;=":1,"in":1,"!in":1,"all":1,"any":1,"none":1,"has":1,"!has":1}},"geometry_type":{"type":"enum","values":{"Point":1,"LineString":1,"Polygon":1}},"function":{"expression":{"type":"expression"},"stops":{"type":"array","value":"function_stop"},"base":{"type":"number","default":1,"minimum":0},"property":{"type":"string","default":"$zoom"},"type":{"type":"enum","values":{"identity":1,"exponential":1,"interval":1,"categorical":1},"default":"exponential"},"colorSpace":{"type":"enum","values":{"rgb":1,"lab":1,"hcl":1},"default":"rgb"},"default":{"type":"*","required":false}},"function_stop":{"type":"array","minimum":0,"maximum":24,"value":["number","color"],"length":2},"expression":{"type":"array","value":"*","minimum":1},"fog":{"range":{"type":"array","default":[0.5,10],"minimum":-20,"maximum":20,"length":2,"value":"number","property-type":"data-constant","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}},"color":{"type":"color","property-type":"data-constant","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"high-color":{"type":"color","property-type":"data-constant","default":"#245cdf","expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"space-color":{"type":"color","property-type":"data-constant","default":["interpolate",["linear"],["zoom"],4,"#010b19",7,"#367ab9"],"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"horizon-blend":{"type":"number","property-type":"data-constant","default":["interpolate",["linear"],["zoom"],4,0.2,7,0.1],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"star-intensity":{"type":"number","property-type":"data-constant","default":["interpolate",["linear"],["zoom"],5,0.35,6,0],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vertical-range":{"type":"array","default":[0,0],"minimum":0,"length":2,"value":"number","property-type":"data-constant","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}}},"camera":{"camera-projection":{"type":"enum","values":{"perspective":1,"orthographic":1},"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"default":"perspective","property-type":"data-constant"}},"light":{"anchor":{"type":"enum","default":"viewport","values":{"map":1,"viewport":1},"property-type":"data-constant","expression":{"parameters":["zoom"]}},"position":{"type":"array","default":[1.15,210,30],"length":3,"value":"number","property-type":"data-constant","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"color":{"type":"color","property-type":"data-constant","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"intensity":{"type":"number","property-type":"data-constant","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"projection":{"name":{"type":"enum","values":{"albers":1,"equalEarth":1,"equirectangular":1,"lambertConformalConic":1,"mercator":1,"naturalEarth":1,"winkelTripel":1,"globe":1},"default":"mercator","required":true},"center":{"type":"array","length":2,"value":"number","property-type":"data-constant","minimum":[-180,-90],"maximum":[180,90]},"parallels":{"type":"array","length":2,"value":"number","property-type":"data-constant","minimum":[-90,-90],"maximum":[90,90]}},"terrain":{"source":{"type":"string","required":true},"exaggeration":{"type":"number","property-type":"data-constant","default":1,"minimum":0,"maximum":1000,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"paint":["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_background","paint_sky","paint_model"],"paint_fill":{"fill-antialias":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"fill-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-outline-color":{"type":"color","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"fill-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"fill-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-extrusion-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"fill-extrusion-height":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"fill-extrusion-ambient-occlusion-intensity":{"property-type":"data-constant","type":"number","private":true,"default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-radius":{"property-type":"data-constant","type":"number","private":true,"default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-wall-radius":{"property-type":"data-constant","type":"number","default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-ground-radius":{"property-type":"data-constant","type":"number","default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-ground-attenuation":{"property-type":"data-constant","type":"number","default":0.69,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-flood-light-color":{"property-type":"data-constant","type":"color","default":"#ffffff","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-extrusion-flood-light-intensity":{"property-type":"data-constant","type":"number","default":0,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-extrusion-flood-light-wall-radius":{"property-type":"data-driven","type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state"]}},"fill-extrusion-flood-light-ground-radius":{"property-type":"data-driven","type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state"]}},"fill-extrusion-flood-light-ground-attenuation":{"property-type":"data-constant","type":"number","default":0.69,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-vertical-scale":{"property-type":"data-constant","type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-rounded-roof":{"property-type":"data-constant","type":"boolean","default":true,"expression":{"parameters":["zoom"]}},"fill-extrusion-cutoff-fade-range":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{},"property-type":"data-constant"},"fill-extrusion-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"}},"paint_line":{"line-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"line-width":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-gap-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-offset":{"type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-blur":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-dasharray":{"type":"array","value":"number","minimum":0,"expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-gradient":{"type":"color","expression":{"interpolated":true,"parameters":["line-progress"]},"property-type":"color-ramp"},"line-trim-offset":{"type":"array","value":"number","length":2,"default":[0,0],"minimum":[0,0],"maximum":[1,1],"property-type":"constant"},"line-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"},"line-border-width":{"type":"number","private":true,"default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-border-color":{"type":"color","private":true,"default":"rgba(0, 0, 0, 0)","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"}},"paint_circle":{"circle-radius":{"type":"number","default":5,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-blur":{"type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{"type":"enum","values":{"map":1,"viewport":1},"default":"viewport","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-stroke-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-stroke-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"}},"paint_heatmap":{"heatmap-radius":{"type":"number","default":30,"minimum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"heatmap-weight":{"type":"number","default":1,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"heatmap-intensity":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"heatmap-color":{"type":"color","default":["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",0.1,"royalblue",0.3,"cyan",0.5,"lime",0.7,"yellow",1,"red"],"expression":{"interpolated":true,"parameters":["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_symbol":{"icon-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-emissive-strength":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-driven"},"text-emissive-strength":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-driven"},"icon-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-halo-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-halo-blur":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"icon-image-cross-fade":{"type":"number","property-type":"data-driven","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"transition":true},"text-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-color":{"type":"color","default":"#000000","transition":true,"overridable":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-halo-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-halo-blur":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"icon-color-saturation":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{},"property-type":"data-constant"}},"paint_raster":{"raster-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-color":{"type":"color","expression":{"interpolated":true,"parameters":["raster-value"]},"property-type":"color-ramp"},"raster-color-mix":{"type":"array","default":[0.2126,0.7152,0.0722,0],"length":4,"value":"number","property-type":"data-constant","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-color-range":{"type":"array","default":[0,1],"length":2,"value":"number","property-type":"data-constant","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-hue-rotate":{"type":"number","default":0,"period":360,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{"type":"number","default":0,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-saturation":{"type":"number","default":0,"minimum":-1,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-contrast":{"type":"number","default":0,"minimum":-1,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-resampling":{"type":"enum","values":{"linear":1,"nearest":1},"default":"linear","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{"type":"number","default":300,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"},"raster-array-band":{"type":"string","required":false,"property-type":"data-constant"},"raster-elevation":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_hillshade":{"hillshade-illumination-direction":{"type":"number","default":335,"minimum":0,"maximum":359,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"viewport","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{"type":"number","default":0.5,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"},"hillshade-highlight-color":{"type":"color","default":"#FFFFFF","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"},"hillshade-accent-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"},"hillshade-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"}},"paint_background":{"background-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"background-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"background-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"background-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"}},"paint_sky":{"sky-type":{"type":"enum","values":{"gradient":1,"atmosphere":1},"default":"atmosphere","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"sky-atmosphere-sun":{"type":"array","value":"number","length":2,"minimum":[0,0],"maximum":[360,180],"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"sky-atmosphere-sun-intensity":{"type":"number","default":10,"minimum":0,"maximum":100,"property-type":"data-constant"},"sky-gradient-center":{"type":"array","value":"number","default":[0,0],"length":2,"minimum":[0,0],"maximum":[360,180],"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"sky-gradient-radius":{"type":"number","default":90,"minimum":0,"maximum":180,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"sky-gradient":{"type":"color","default":["interpolate",["linear"],["sky-radial-progress"],0.8,"#87ceeb",1,"white"],"expression":{"interpolated":true,"parameters":["sky-radial-progress"]},"property-type":"color-ramp"},"sky-atmosphere-halo-color":{"type":"color","default":"white","property-type":"data-constant"},"sky-atmosphere-color":{"type":"color","default":"white","property-type":"data-constant"},"sky-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_model":{"model-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"model-rotation":{"type":"array","value":"number","length":3,"default":[0,0,0],"period":360,"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"transition":true},"model-scale":{"type":"array","value":"number","length":3,"default":[1,1,1],"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"transition":true},"model-translation":{"type":"array","value":"number","length":3,"default":[0,0,0],"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"transition":true},"model-color":{"type":"color","default":"#ffffff","property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":true},"model-color-mix-intensity":{"type":"number","property-type":"data-driven","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"transition":true},"model-type":{"type":"enum","values":{"common-3d":1,"location-indicator":1},"default":"common-3d","property-type":"data-constant"},"model-cast-shadows":{"type":"boolean","default":true,"expression":{},"property-type":"data-constant"},"model-receive-shadows":{"type":"boolean","default":true,"expression":{},"property-type":"data-constant"},"model-ambient-occlusion-intensity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant","transition":true},"model-emissive-strength":{"type":"number","property-type":"data-driven","default":0,"minimum":0,"maximum":5,"expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"transition":true},"model-roughness":{"type":"number","default":1,"minimum":0,"maximum":1,"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state"]},"transition":true},"model-height-based-emissive-strength-multiplier":{"type":"array","default":[1,1,1,1,0],"length":5,"value":"number","property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"transition":true},"model-cutoff-fade-range":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{},"property-type":"data-constant"}},"transition":{"duration":{"type":"number","default":300,"minimum":0},"delay":{"type":"number","default":0,"minimum":0}},"property-type":{"data-driven":{"type":"property-type"},"color-ramp":{"type":"property-type"},"data-constant":{"type":"property-type"},"constant":{"type":"property-type"}},"promoteId":{"*":{"type":"string"}}}');class Yt{constructor(t,i,r,n){this.message=(t?`${t}: `:"")+r,n&amp;&amp;(this.identifier=n),i!=null&amp;&amp;i.__line__&amp;&amp;(this.line=i.__line__)}}class Ko extends Yt{}function Fs(e,...t){for(const i of t)for(const r in i)e[r]=i[r];return e}function tr(e){return e instanceof Number||e instanceof String||e instanceof Boolean?e.valueOf():e}function Bs(e){if(Array.isArray(e))return e.map(Bs);if(e instanceof Object&amp;&amp;!(e instanceof Number||e instanceof String||e instanceof Boolean)){const t={};for(const i in e)t[i]=Bs(e[i]);return t}return tr(e)}class tI extends Error{constructor(t,i){super(i),this.message=i,this.key=t}}var as=tI;class zf{constructor(t,i=[]){this.parent=t,this.bindings={};for(const[r,n]of i)this.bindings[r]=n}concat(t){return new zf(this,t)}get(t){if(this.bindings[t])return this.bindings[t];if(this.parent)return this.parent.get(t);throw new Error(`${t} not found in scope.`)}has(t){return!!this.bindings[t]||!!this.parent&amp;&amp;this.parent.has(t)}}var eI=zf;const Ba={kind:"null"},qt={kind:"number"},He={kind:"string"},ti={kind:"boolean"},Tn={kind:"color"},Na={kind:"object"},Ze={kind:"value"},zu={kind:"collator"},Ql={kind:"formatted"},tc={kind:"resolvedImage"};function Zr(e,t){return{kind:"array",itemType:e,N:t}}function $i(e){if(e.kind==="array"){const t=$i(e.itemType);return typeof e.N=="number"?`array&lt;${t}, ${e.N}&gt;`:e.itemType.kind==="value"?"array":`array&lt;${t}&gt;`}return e.kind}const iI=[Ba,qt,He,ti,Tn,Ql,Na,Zr(Ze),tc];function ec(e,t){if(t.kind==="error")return null;if(e.kind==="array"){if(t.kind==="array"&amp;&amp;(t.N===0&amp;&amp;t.itemType.kind==="value"||!ec(e.itemType,t.itemType))&amp;&amp;(typeof e.N!="number"||e.N===t.N))return null}else{if(e.kind===t.kind)return null;if(e.kind==="value"){for(const i of iI)if(!ec(i,t))return null}}return`Expected ${$i(e)} but found ${$i(t)} instead.`}function Ff(e,t){return t.some(i=&gt;i.kind===e.kind)}function ic(e,t){return t.some(i=&gt;i==="null"?e===null:i==="array"?Array.isArray(e):i==="object"?e&amp;&amp;!Array.isArray(e)&amp;&amp;typeof e=="object":i===typeof e)}var Bf,jy={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],rebeccapurple:[102,51,153,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};function Fu(e){return(e=Math.round(e))&lt;0?0:e&gt;255?255:e}function Nf(e){return Fu(e[e.length-1]==="%"?parseFloat(e)/100*255:parseInt(e))}function Bu(e){return(t=e[e.length-1]==="%"?parseFloat(e)/100:parseFloat(e))&lt;0?0:t&gt;1?1:t;var t}function Uf(e,t,i){return i&lt;0?i+=1:i&gt;1&amp;&amp;(i-=1),6*i&lt;1?e+(t-e)*i*6:2*i&lt;1?t:3*i&lt;2?e+(t-e)*(2/3-i)*6:e}try{Bf={}.parseCSSColor=function(e){var t,i=e.replace(/ /g,"").toLowerCase();if(i in jy)return jy[i].slice();if(i[0]==="#")return i.length===4?(t=parseInt(i.substr(1),16))&gt;=0&amp;&amp;t&lt;=4095?[(3840&amp;t)&gt;&gt;4|(3840&amp;t)&gt;&gt;8,240&amp;t|(240&amp;t)&gt;&gt;4,15&amp;t|(15&amp;t)&lt;&lt;4,1]:null:i.length===7&amp;&amp;(t=parseInt(i.substr(1),16))&gt;=0&amp;&amp;t&lt;=16777215?[(16711680&amp;t)&gt;&gt;16,(65280&amp;t)&gt;&gt;8,255&amp;t,1]:null;var r=i.indexOf("("),n=i.indexOf(")");if(r!==-1&amp;&amp;n+1===i.length){var s=i.substr(0,r),a=i.substr(r+1,n-(r+1)).split(","),l=1;switch(s){case"rgba":if(a.length!==4)return null;l=Bu(a.pop());case"rgb":return a.length!==3?null:[Nf(a[0]),Nf(a[1]),Nf(a[2]),l];case"hsla":if(a.length!==4)return null;l=Bu(a.pop());case"hsl":if(a.length!==3)return null;var h=(parseFloat(a[0])%360+360)%360/360,d=Bu(a[1]),f=Bu(a[2]),m=f&lt;=.5?f*(d+1):f+d-f*d,_=2*f-m;return[Fu(255*Uf(_,m,h+1/3)),Fu(255*Uf(_,m,h)),Fu(255*Uf(_,m,h-1/3)),l];default:return null}}return null}}catch{}class $r{constructor(t,i,r,n=1){this.r=t,this.g=i,this.b=r,this.a=n}static parse(t){if(!t)return;if(t instanceof $r)return t;if(typeof t!="string")return;const i=Bf(t);return i?new $r(i[0]/255*i[3],i[1]/255*i[3],i[2]/255*i[3],i[3]):void 0}toString(){const[t,i,r,n]=this.toArray();return`rgba(${Math.round(t)},${Math.round(i)},${Math.round(r)},${n})`}toArray(){const{r:t,g:i,b:r,a:n}=this;return n===0?[0,0,0,0]:[255*t/n,255*i/n,255*r/n,n]}toArray01(){const{r:t,g:i,b:r,a:n}=this;return n===0?[0,0,0,0]:[t/n,i/n,r/n,n]}toArray01Scaled(t){const{r:i,g:r,b:n,a:s}=this;return s===0?[0,0,0]:[i/s*t,r/s*t,n/s*t]}toArray01PremultipliedAlpha(){const{r:t,g:i,b:r,a:n}=this;return[t,i,r,n]}toArray01Linear(){const{r:t,g:i,b:r,a:n}=this;return n===0?[0,0,0,0]:[Math.pow(t/n,2.2),Math.pow(i/n,2.2),Math.pow(r/n,2.2),n]}}$r.black=new $r(0,0,0,1),$r.white=new $r(1,1,1,1),$r.transparent=new $r(0,0,0,0),$r.red=new $r(1,0,0,1),$r.blue=new $r(0,0,1,1);var Ie=$r;class Vf{constructor(t,i,r){this.sensitivity=t?i?"variant":"case":i?"accent":"base",this.locale=r,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(t,i){return this.collator.compare(t,i)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class jf{constructor(t,i,r,n,s){this.text=t.normalize?t.normalize():t,this.image=i,this.scale=r,this.fontStack=n,this.textColor=s}}class Xr{constructor(t){this.sections=t}static fromString(t){return new Xr([new jf(t,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some(t=&gt;t.text.length!==0||t.image&amp;&amp;t.image.namePrimary.length!==0)}static factory(t){return t instanceof Xr?t:Xr.fromString(t)}toString(){return this.sections.length===0?"":this.sections.map(t=&gt;t.text).join("")}serialize(){const t=["format"];for(const i of this.sections){if(i.image){t.push(["image",i.image.namePrimary]);continue}t.push(i.text);const r={};i.fontStack&amp;&amp;(r["text-font"]=["literal",i.fontStack.split(",")]),i.scale&amp;&amp;(r["font-scale"]=i.scale),i.textColor&amp;&amp;(r["text-color"]=["rgba"].concat(i.textColor.toArray())),t.push(r)}return t}}class En{constructor(t){this.namePrimary=t.namePrimary,t.nameSecondary&amp;&amp;(this.nameSecondary=t.nameSecondary),this.available=t.available}toString(){return this.nameSecondary?`[${this.namePrimary},${this.nameSecondary}]`:this.namePrimary}static fromString(t,i){return t?new En({namePrimary:t,nameSecondary:i,available:!1}):null}serialize(){return this.nameSecondary?["image",this.namePrimary,this.nameSecondary]:["image",this.namePrimary]}}function Gy(e,t,i,r){return typeof e=="number"&amp;&amp;e&gt;=0&amp;&amp;e&lt;=255&amp;&amp;typeof t=="number"&amp;&amp;t&gt;=0&amp;&amp;t&lt;=255&amp;&amp;typeof i=="number"&amp;&amp;i&gt;=0&amp;&amp;i&lt;=255?r===void 0||typeof r=="number"&amp;&amp;r&gt;=0&amp;&amp;r&lt;=1?null:`Invalid rgba value [${[e,t,i,r].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof r=="number"?[e,t,i,r]:[e,t,i]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function Ua(e){if(e===null||typeof e=="string"||typeof e=="boolean"||typeof e=="number"||e instanceof Ie||e instanceof Vf||e instanceof Xr||e instanceof En)return!0;if(Array.isArray(e)){for(const t of e)if(!Ua(t))return!1;return!0}if(typeof e=="object"){for(const t in e)if(!Ua(e[t]))return!1;return!0}return!1}function lr(e){if(e===null)return Ba;if(typeof e=="string")return He;if(typeof e=="boolean")return ti;if(typeof e=="number")return qt;if(e instanceof Ie)return Tn;if(e instanceof Vf)return zu;if(e instanceof Xr)return Ql;if(e instanceof En)return tc;if(Array.isArray(e)){const t=e.length;let i;for(const r of e){const n=lr(r);if(i){if(i===n)continue;i=Ze;break}i=n}return Zr(i||Ze,t)}return Na}function rc(e){const t=typeof e;return e===null?"":t==="string"||t==="number"||t==="boolean"?String(e):e instanceof Ie||e instanceof Xr||e instanceof En?e.toString():JSON.stringify(e)}class Gf{constructor(t,i){this.type=t,this.value=i}static parse(t,i){if(t.length!==2)return i.error(`'literal' expression requires exactly one argument, but found ${t.length-1} instead.`);if(!Ua(t[1]))return i.error("invalid value");const r=t[1];let n=lr(r);const s=i.expectedType;return n.kind!=="array"||n.N!==0||!s||s.kind!=="array"||typeof s.N=="number"&amp;&amp;s.N!==0||(n=s),new Gf(n,r)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}serialize(){return this.type.kind==="array"||this.type.kind==="object"?["literal",this.value]:this.value instanceof Ie?["rgba"].concat(this.value.toArray()):this.value instanceof Xr?this.value.serialize():this.value}}var nc=Gf,_r=class{constructor(e){this.name="ExpressionEvaluationError",this.message=e}toJSON(){return this.message}};const Hf={string:He,number:qt,boolean:ti,object:Na};class Wf{constructor(t,i){this.type=t,this.args=i}static parse(t,i){if(t.length&lt;2)return i.error("Expected at least one argument.");let r,n=1;const s=t[0];if(s==="array"){let l,h;if(t.length&gt;2){const d=t[1];if(typeof d!="string"||!(d in Hf)||d==="object")return i.error('The item type argument of "array" must be one of string, number, boolean',1);l=Hf[d],n++}else l=Ze;if(t.length&gt;3){if(t[2]!==null&amp;&amp;(typeof t[2]!="number"||t[2]&lt;0||t[2]!==Math.floor(t[2])))return i.error('The length argument to "array" must be a positive integer literal',2);h=t[2],n++}r=Zr(l,h)}else r=Hf[s];const a=[];for(;n&lt;t.length;n++){const l=i.parse(t[n],n,Ze);if(!l)return null;a.push(l)}return new Wf(r,a)}evaluate(t){for(let i=0;i&lt;this.args.length;i++){const r=this.args[i].evaluate(t);if(!ec(this.type,lr(r)))return r;if(i===this.args.length-1)throw new _r(`Expected value to be of type ${$i(this.type)}, but found ${$i(lr(r))} instead.`)}return null}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=&gt;t.outputDefined())}serialize(){const t=this.type,i=[t.kind];if(t.kind==="array"){const r=t.itemType;if(r.kind==="string"||r.kind==="number"||r.kind==="boolean"){i.push(r.kind);const n=t.N;(typeof n=="number"||this.args.length&gt;1)&amp;&amp;i.push(n)}}return i.concat(this.args.map(r=&gt;r.serialize()))}}var Ns=Wf;class sc{constructor(t){this.type=Ql,this.sections=t}static parse(t,i){if(t.length&lt;2)return i.error("Expected at least one argument.");const r=t[1];if(!Array.isArray(r)&amp;&amp;typeof r=="object")return i.error("First argument must be an image or text section.");const n=[];let s=!1;for(let a=1;a&lt;=t.length-1;++a){const l=t[a];if(s&amp;&amp;typeof l=="object"&amp;&amp;!Array.isArray(l)){s=!1;let h=null;if(l["font-scale"]&amp;&amp;(h=i.parse(l["font-scale"],1,qt),!h))return null;let d=null;if(l["text-font"]&amp;&amp;(d=i.parse(l["text-font"],1,Zr(He)),!d))return null;let f=null;if(l["text-color"]&amp;&amp;(f=i.parse(l["text-color"],1,Tn),!f))return null;const m=n[n.length-1];m.scale=h,m.font=d,m.textColor=f}else{const h=i.parse(t[a],1,Ze);if(!h)return null;const d=h.type.kind;if(d!=="string"&amp;&amp;d!=="value"&amp;&amp;d!=="null"&amp;&amp;d!=="resolvedImage")return i.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");s=!0,n.push({content:h,scale:null,font:null,textColor:null})}}return new sc(n)}evaluate(t){return new Xr(this.sections.map(i=&gt;{const r=i.content.evaluate(t);return lr(r)===tc?new jf("",r,null,null,null):new jf(rc(r),null,i.scale?i.scale.evaluate(t):null,i.font?i.font.evaluate(t).join(","):null,i.textColor?i.textColor.evaluate(t):null)}))}eachChild(t){for(const i of this.sections)t(i.content),i.scale&amp;&amp;t(i.scale),i.font&amp;&amp;t(i.font),i.textColor&amp;&amp;t(i.textColor)}outputDefined(){return!1}serialize(){const t=["format"];for(const i of this.sections){t.push(i.content.serialize());const r={};i.scale&amp;&amp;(r["font-scale"]=i.scale.serialize()),i.font&amp;&amp;(r["text-font"]=i.font.serialize()),i.textColor&amp;&amp;(r["text-color"]=i.textColor.serialize()),t.push(r)}return t}}class oc{constructor(t,i){this.type=tc,this.inputPrimary=t,this.inputSecondary=i}static parse(t,i){if(t.length&lt;2)return i.error("Expected two or more arguments.");const r=i.parse(t[1],1,He);if(!r)return i.error("No image name provided.");if(t.length===2)return new oc(r);const n=i.parse(t[2],1,He);return n?new oc(r,n):i.error("Secondary image variant is not a string.")}evaluate(t){const i=En.fromString(this.inputPrimary.evaluate(t),this.inputSecondary?this.inputSecondary.evaluate(t):void 0);return i&amp;&amp;t.availableImages&amp;&amp;(i.available=t.availableImages.indexOf(i.namePrimary)&gt;-1,i.nameSecondary&amp;&amp;i.available&amp;&amp;t.availableImages&amp;&amp;(i.available=t.availableImages.indexOf(i.nameSecondary)&gt;-1)),i}eachChild(t){t(this.inputPrimary),this.inputSecondary&amp;&amp;t(this.inputSecondary)}outputDefined(){return!1}serialize(){return this.inputSecondary?["image",this.inputPrimary.serialize(),this.inputSecondary.serialize()]:["image",this.inputPrimary.serialize()]}}function ni(e){return e instanceof Number?"number":e instanceof String?"string":e instanceof Boolean?"boolean":Array.isArray(e)?"array":e===null?"null":typeof e}const rI={"to-boolean":ti,"to-color":Tn,"to-number":qt,"to-string":He};class qf{constructor(t,i){this.type=t,this.args=i}static parse(t,i){if(t.length&lt;2)return i.error("Expected at least one argument.");const r=t[0],n=[];let s=Ba;if(r==="to-array"){if(!Array.isArray(t[1]))return null;const a=t[1].length;if(i.expectedType){if(i.expectedType.kind!=="array")return i.error(`Expected ${i.expectedType.kind} but found array.`);s=Zr(i.expectedType.itemType,a)}else{if(!(a&gt;0&amp;&amp;Ua(t[1][0])))return null;s=Zr(lr(t[1][0]),a)}for(let l=0;l&lt;a;l++){const h=t[1][l];let d;if(ni(h)==="array")d=i.parse(h,void 0,s.itemType);else{const f=ni(h);if(f!==s.itemType.kind)return i.error(`Expected ${s.itemType.kind} but found ${f}.`);d=i.registry.literal.parse(["literal",h===void 0?null:h],i)}if(!d)return null;n.push(d)}}else{if((r==="to-boolean"||r==="to-string")&amp;&amp;t.length!==2)return i.error("Expected one argument.");s=rI[r];for(let a=1;a&lt;t.length;a++){const l=i.parse(t[a],a,Ze);if(!l)return null;n.push(l)}}return new qf(s,n)}evaluate(t){if(this.type.kind==="boolean")return!!this.args[0].evaluate(t);if(this.type.kind==="color"){let i,r;for(const n of this.args){if(i=n.evaluate(t),r=null,i instanceof Ie)return i;if(typeof i=="string"){const s=t.parseColor(i);if(s)return s}else if(Array.isArray(i)&amp;&amp;(r=i.length&lt;3||i.length&gt;4?`Invalid rbga value ${JSON.stringify(i)}: expected an array containing either three or four numeric values.`:Gy(i[0],i[1],i[2],i[3]),!r))return new Ie(i[0]/255,i[1]/255,i[2]/255,i[3])}throw new _r(r||`Could not parse color from value '${typeof i=="string"?i:String(JSON.stringify(i))}'`)}if(this.type.kind==="number"){let i=null;for(const r of this.args){if(i=r.evaluate(t),i===null)return 0;const n=Number(i);if(!isNaN(n))return n}throw new _r(`Could not convert ${JSON.stringify(i)} to number.`)}return this.type.kind==="formatted"?Xr.fromString(rc(this.args[0].evaluate(t))):this.type.kind==="resolvedImage"?En.fromString(rc(this.args[0].evaluate(t))):this.type.kind==="array"?this.args.map(i=&gt;i.evaluate(t)):rc(this.args[0].evaluate(t))}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=&gt;t.outputDefined())}serialize(){if(this.type.kind==="formatted")return new sc([{content:this.args[0],scale:null,font:null,textColor:null}]).serialize();if(this.type.kind==="resolvedImage")return new oc(this.args[0]).serialize();const t=this.type.kind==="array"?[]:[`to-${this.type.kind}`];return this.eachChild(i=&gt;{t.push(i.serialize())}),t}}var Jo=qf;const nI=["Unknown","Point","LineString","Polygon"];var Hy=class{constructor(e){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},this.availableImages=null,this.canonical=null,this.featureTileCoord=null,this.featureDistanceData=null,this.options=e}id(){return this.feature&amp;&amp;this.feature.id!==void 0?this.feature.id:null}geometryType(){return this.feature?typeof this.feature.type=="number"?nI[this.feature.type]:this.feature.type:null}geometry(){return this.feature&amp;&amp;"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&amp;&amp;this.feature.properties||{}}measureLight(e){return this.globals.brightness||0}distanceFromCenter(){if(this.featureTileCoord&amp;&amp;this.featureDistanceData){const e=this.featureDistanceData.center,t=this.featureDistanceData.scale,{x:i,y:r}=this.featureTileCoord;return this.featureDistanceData.bearing[0]*(i*t-e[0])+this.featureDistanceData.bearing[1]*(r*t-e[1])}return 0}parseColor(e){let t=this._parseColorCache[e];return t||(t=this._parseColorCache[e]=Ie.parse(e)),t}getConfig(e){return this.options?this.options.get(e):null}};class Qo{constructor(t,i,r,n,s){this.name=t,this.type=i,this._evaluate=r,this.args=n,this._overloadIndex=s}evaluate(t){if(!this._evaluate){const i=Qo.definitions[this.name];this._evaluate=Array.isArray(i)?i[2]:i.overloads[this._overloadIndex][1]}return this._evaluate(t,this.args)}eachChild(t){this.args.forEach(t)}outputDefined(){return!1}serialize(){return[this.name].concat(this.args.map(t=&gt;t.serialize()))}static parse(t,i){const r=t[0],n=Qo.definitions[r];if(!n)return i.error(`Unknown expression "${r}". If you wanted a literal array, use ["literal", [...]].`,0);const s=Array.isArray(n)?n[0]:n.type,a=Array.isArray(n)?[[n[1],n[2]]]:n.overloads,l=[];let h=null,d=-1;for(const[f,m]of a){if(Array.isArray(f)&amp;&amp;f.length!==t.length-1)continue;l.push(f),d++,h=new a0(i.registry,i.path,null,i.scope,void 0,i.options);const _=[];let y=!1;for(let x=1;x&lt;t.length;x++){const b=t[x],w=Array.isArray(f)?f[x-1]:f.type,T=h.parse(b,1+_.length,w);if(!T){y=!0;break}_.push(T)}if(!y)if(Array.isArray(f)&amp;&amp;f.length!==_.length)h.error(`Expected ${f.length} arguments, but found ${_.length} instead.`);else{for(let x=0;x&lt;_.length;x++){const b=Array.isArray(f)?f[x]:f.type,w=_[x];h.concat(x+1).checkSubtype(b,w.type)}if(h.errors.length===0)return new Qo(r,s,m,_,d)}}if(l.length===1)i.errors.push(...h.errors);else{const f=(l.length?l:a.map(([_])=&gt;_)).map(sI).join(" | "),m=[];for(let _=1;_&lt;t.length;_++){const y=i.parse(t[_],1+m.length);if(!y)return null;m.push($i(y.type))}i.error(`Expected arguments of type ${f}, but found (${m.join(", ")}) instead.`)}return null}static register(t,i){Qo.definitions=i;for(const r in i)t[r]=Qo}}function sI(e){return Array.isArray(e)?`(${e.map($i).join(", ")})`:`(${$i(e.type)}...)`}var ls=Qo;class Nu{constructor(t,i,r){this.type=zu,this.locale=r,this.caseSensitive=t,this.diacriticSensitive=i}static parse(t,i){if(t.length!==2)return i.error("Expected one argument.");const r=t[1];if(typeof r!="object"||Array.isArray(r))return i.error("Collator options argument must be an object.");const n=i.parse(r["case-sensitive"]!==void 0&amp;&amp;r["case-sensitive"],1,ti);if(!n)return null;const s=i.parse(r["diacritic-sensitive"]!==void 0&amp;&amp;r["diacritic-sensitive"],1,ti);if(!s)return null;let a=null;return r.locale&amp;&amp;(a=i.parse(r.locale,1,He),!a)?null:new Nu(n,s,a)}evaluate(t){return new Vf(this.caseSensitive.evaluate(t),this.diacriticSensitive.evaluate(t),this.locale?this.locale.evaluate(t):null)}eachChild(t){t(this.caseSensitive),t(this.diacriticSensitive),this.locale&amp;&amp;t(this.locale)}outputDefined(){return!1}serialize(){const t={};return t["case-sensitive"]=this.caseSensitive.serialize(),t["diacritic-sensitive"]=this.diacriticSensitive.serialize(),this.locale&amp;&amp;(t.locale=this.locale.serialize()),["collator",t]}}var Wy={exports:{}};Wy.exports=function(){function e(r,n,s,a,l){for(;a&gt;s;){if(a-s&gt;600){var h=a-s+1,d=n-s+1,f=Math.log(h),m=.5*Math.exp(2*f/3),_=.5*Math.sqrt(f*m*(h-m)/h)*(d-h/2&lt;0?-1:1);e(r,n,Math.max(s,Math.floor(n-d*m/h+_)),Math.min(a,Math.floor(n+(h-d)*m/h+_)),l)}var y=r[n],x=s,b=a;for(t(r,s,n),l(r[a],y)&gt;0&amp;&amp;t(r,s,a);x&lt;b;){for(t(r,x,b),x++,b--;l(r[x],y)&lt;0;)x++;for(;l(r[b],y)&gt;0;)b--}l(r[s],y)===0?t(r,s,b):t(r,++b,a),b&lt;=n&amp;&amp;(s=b+1),n&lt;=b&amp;&amp;(a=b-1)}}function t(r,n,s){var a=r[n];r[n]=r[s],r[s]=a}function i(r,n){return r&lt;n?-1:r&gt;n?1:0}return function(r,n,s,a,l){e(r,n,s||0,a||r.length-1,l||i)}}();var oI=Qt(Wy.exports);function aI(e){let t=0;for(let i,r,n=0,s=e.length,a=s-1;n&lt;s;a=n++)i=e[n],r=e[a],t+=(r.x-i.x)*(i.y+r.y);return t}function ac(e,t){e[0]=Math.min(e[0],t[0]),e[1]=Math.min(e[1],t[1]),e[2]=Math.max(e[2],t[0]),e[3]=Math.max(e[3],t[1])}function lc(e,t){return!(e[0]&lt;=t[0]||e[2]&gt;=t[2]||e[1]&lt;=t[1]||e[3]&gt;=t[3])}function lI(e,t,i){const r=e[0]-t[0],n=e[1]-t[1],s=e[0]-i[0],a=e[1]-i[1];return r*a-s*n==0&amp;&amp;r*s&lt;=0&amp;&amp;n*a&lt;=0}function Va(e,t,i=!1){let r=!1;for(let l=0,h=t.length;l&lt;h;l++){const d=t[l];for(let f=0,m=d.length,_=m-1;f&lt;m;_=f++){const y=d[_],x=d[f];if(lI(e,y,x))return i;(s=y)[1]&gt;(n=e)[1]!=(a=x)[1]&gt;n[1]&amp;&amp;n[0]&lt;(a[0]-s[0])*(n[1]-s[1])/(a[1]-s[1])+s[0]&amp;&amp;(r=!r)}}var n,s,a;return r}function qy(e,t,i,r){const n=r[0]-i[0],s=r[1]-i[1],a=(e[0]-i[0])*s-n*(e[1]-i[1]),l=(t[0]-i[0])*s-n*(t[1]-i[1]);return a&gt;0&amp;&amp;l&lt;0||a&lt;0&amp;&amp;l&gt;0}function Uu(e,t,i,r){return(n=[r[0]-i[0],r[1]-i[1]])[0]*(s=[t[0]-e[0],t[1]-e[1]])[1]-n[1]*s[0]!=0&amp;&amp;!(!qy(e,t,i,r)||!qy(i,r,e,t));var n,s}const ho=8192;function cI(e,t){const i=(180+e[0])/360,r=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+e[1]*Math.PI/360)))/360,n=Math.pow(2,t.z);return[Math.round(i*n*ho),Math.round(r*n*ho)]}function uI(e,t){for(let i=0;i&lt;t.length;i++)if(Va(e,t[i]))return!0;return!1}function hI(e,t,i){for(const r of i)for(let n=0,s=r.length,a=s-1;n&lt;s;a=n++)if(Uu(e,t,r[a],r[n]))return!0;return!1}function Zy(e,t){for(let i=0;i&lt;e.length;++i)if(!Va(e[i],t))return!1;for(let i=0;i&lt;e.length-1;++i)if(hI(e[i],e[i+1],t))return!1;return!0}function dI(e,t){for(let i=0;i&lt;t.length;i++)if(Zy(e,t[i]))return!0;return!1}function Zf(e,t,i){const r=[];for(let n=0;n&lt;e.length;n++){const s=[];for(let a=0;a&lt;e[n].length;a++){const l=cI(e[n][a],i);ac(t,l),s.push(l)}r.push(s)}return r}function $y(e,t,i){const r=[];for(let n=0;n&lt;e.length;n++){const s=Zf(e[n],t,i);r.push(s)}return r}function Xy(e,t,i,r){if(e[0]&lt;i[0]||e[0]&gt;i[2]){const n=.5*r;let s=e[0]-i[0]&gt;n?-r:i[0]-e[0]&gt;n?r:0;s===0&amp;&amp;(s=e[0]-i[2]&gt;n?-r:i[2]-e[0]&gt;n?r:0),e[0]+=s}ac(t,e)}function Yy(e,t,i,r){const n=Math.pow(2,r.z)*ho,s=[r.x*ho,r.y*ho],a=[];if(!e)return a;for(const l of e)for(const h of l){const d=[h.x+s[0],h.y+s[1]];Xy(d,t,i,n),a.push(d)}return a}function Ky(e,t,i,r){const n=Math.pow(2,r.z)*ho,s=[r.x*ho,r.y*ho],a=[];if(!e)return a;for(const h of e){const d=[];for(const f of h){const m=[f.x+s[0],f.y+s[1]];ac(t,m),d.push(m)}a.push(d)}if(t[2]-t[0]&lt;=n/2){(l=t)[0]=l[1]=1/0,l[2]=l[3]=-1/0;for(const h of a)for(const d of h)Xy(d,t,i,n)}var l;return a}class cc{constructor(t,i){this.type=ti,this.geojson=t,this.geometries=i}static parse(t,i){if(t.length!==2)return i.error(`'within' expression requires exactly one argument, but found ${t.length-1} instead.`);if(Ua(t[1])){const r=t[1];if(r.type==="FeatureCollection")for(let n=0;n&lt;r.features.length;++n){const s=r.features[n].geometry.type;if(s==="Polygon"||s==="MultiPolygon")return new cc(r,r.features[n].geometry)}else if(r.type==="Feature"){const n=r.geometry.type;if(n==="Polygon"||n==="MultiPolygon")return new cc(r,r.geometry)}else if(r.type==="Polygon"||r.type==="MultiPolygon")return new cc(r,r)}return i.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(t){if(t.geometry()!=null&amp;&amp;t.canonicalID()!=null){if(t.geometryType()==="Point")return function(i,r){const n=[1/0,1/0,-1/0,-1/0],s=[1/0,1/0,-1/0,-1/0],a=i.canonicalID();if(!a)return!1;if(r.type==="Polygon"){const l=Zf(r.coordinates,s,a),h=Yy(i.geometry(),n,s,a);if(!lc(n,s))return!1;for(const d of h)if(!Va(d,l))return!1}if(r.type==="MultiPolygon"){const l=$y(r.coordinates,s,a),h=Yy(i.geometry(),n,s,a);if(!lc(n,s))return!1;for(const d of h)if(!uI(d,l))return!1}return!0}(t,this.geometries);if(t.geometryType()==="LineString")return function(i,r){const n=[1/0,1/0,-1/0,-1/0],s=[1/0,1/0,-1/0,-1/0],a=i.canonicalID();if(!a)return!1;if(r.type==="Polygon"){const l=Zf(r.coordinates,s,a),h=Ky(i.geometry(),n,s,a);if(!lc(n,s))return!1;for(const d of h)if(!Zy(d,l))return!1}if(r.type==="MultiPolygon"){const l=$y(r.coordinates,s,a),h=Ky(i.geometry(),n,s,a);if(!lc(n,s))return!1;for(const d of h)if(!dI(d,l))return!1}return!0}(t,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}serialize(){return["within",this.geojson]}}var $f=cc,Jy={exports:{}};Jy.exports=function(){var e={kilometers:1,miles:.621371192237334,nauticalmiles:.5399568034557235,meters:1e3,metres:1e3,yards:1093.6132983377079,feet:3280.839895013123,inches:39370.078740157485},t=1/298.257223563,i=t*(2-t),r=Math.PI/180,n=function(d,f){if(d===void 0)throw new Error("No latitude given.");if(f&amp;&amp;!e[f])throw new Error("Unknown unit "+f+". Use one of: "+Object.keys(e).join(", "));var m=6378.137*r*(f?e[f]:1),_=Math.cos(d*r),y=1/(1-i*(1-_*_)),x=Math.sqrt(y);this.kx=m*x*_,this.ky=m*x*y*(1-i)},s={units:{configurable:!0}};function a(d,f){return d[0]===f[0]&amp;&amp;d[1]===f[1]}function l(d,f,m){var _=h(f[0]-d[0]);return[d[0]+_*m,d[1]+(f[1]-d[1])*m]}function h(d){for(;d&lt;-180;)d+=360;for(;d&gt;180;)d-=360;return d}return n.fromTile=function(d,f,m){var _=Math.PI*(1-2*(d+.5)/Math.pow(2,f)),y=Math.atan(.5*(Math.exp(_)-Math.exp(-_)))/r;return new n(y,m)},s.units.get=function(){return e},n.prototype.distance=function(d,f){var m=h(d[0]-f[0])*this.kx,_=(d[1]-f[1])*this.ky;return Math.sqrt(m*m+_*_)},n.prototype.bearing=function(d,f){var m=h(f[0]-d[0])*this.kx;return Math.atan2(m,(f[1]-d[1])*this.ky)/r},n.prototype.destination=function(d,f,m){var _=m*r;return this.offset(d,Math.sin(_)*f,Math.cos(_)*f)},n.prototype.offset=function(d,f,m){return[d[0]+f/this.kx,d[1]+m/this.ky]},n.prototype.lineDistance=function(d){for(var f=0,m=0;m&lt;d.length-1;m++)f+=this.distance(d[m],d[m+1]);return f},n.prototype.area=function(d){for(var f=0,m=0;m&lt;d.length;m++)for(var _=d[m],y=0,x=_.length,b=x-1;y&lt;x;b=y++)f+=h(_[y][0]-_[b][0])*(_[y][1]+_[b][1])*(m?-1:1);return Math.abs(f)/2*this.kx*this.ky},n.prototype.along=function(d,f){var m=0;if(f&lt;=0)return d[0];for(var _=0;_&lt;d.length-1;_++){var y=d[_],x=d[_+1],b=this.distance(y,x);if((m+=b)&gt;f)return l(y,x,(f-(m-b))/b)}return d[d.length-1]},n.prototype.pointToSegmentDistance=function(d,f,m){var _=f[0],y=f[1],x=h(m[0]-_)*this.kx,b=(m[1]-y)*this.ky,w=0;return x===0&amp;&amp;b===0||((w=(h(d[0]-_)*this.kx*x+(d[1]-y)*this.ky*b)/(x*x+b*b))&gt;1?(_=m[0],y=m[1]):w&gt;0&amp;&amp;(_+=x/this.kx*w,y+=b/this.ky*w)),x=h(d[0]-_)*this.kx,b=(d[1]-y)*this.ky,Math.sqrt(x*x+b*b)},n.prototype.pointOnLine=function(d,f){for(var m,_,y,x,b=1/0,w=0;w&lt;d.length-1;w++){var T=d[w][0],S=d[w][1],I=h(d[w+1][0]-T)*this.kx,P=(d[w+1][1]-S)*this.ky,M=0;I===0&amp;&amp;P===0||((M=(h(f[0]-T)*this.kx*I+(f[1]-S)*this.ky*P)/(I*I+P*P))&gt;1?(T=d[w+1][0],S=d[w+1][1]):M&gt;0&amp;&amp;(T+=I/this.kx*M,S+=P/this.ky*M));var C=(I=h(f[0]-T)*this.kx)*I+(P=(f[1]-S)*this.ky)*P;C&lt;b&amp;&amp;(b=C,m=T,_=S,y=w,x=M)}return{point:[m,_],index:y,t:Math.max(0,Math.min(1,x))}},n.prototype.lineSlice=function(d,f,m){var _=this.pointOnLine(m,d),y=this.pointOnLine(m,f);if(_.index&gt;y.index||_.index===y.index&amp;&amp;_.t&gt;y.t){var x=_;_=y,y=x}var b=[_.point],w=_.index+1,T=y.index;!a(m[w],b[0])&amp;&amp;w&lt;=T&amp;&amp;b.push(m[w]);for(var S=w+1;S&lt;=T;S++)b.push(m[S]);return a(m[T],y.point)||b.push(y.point),b},n.prototype.lineSliceAlong=function(d,f,m){for(var _=0,y=[],x=0;x&lt;m.length-1;x++){var b=m[x],w=m[x+1],T=this.distance(b,w);if((_+=T)&gt;d&amp;&amp;y.length===0&amp;&amp;y.push(l(b,w,(d-(_-T))/T)),_&gt;=f)return y.push(l(b,w,(f-(_-T))/T)),y;_&gt;d&amp;&amp;y.push(w)}return y},n.prototype.bufferPoint=function(d,f){var m=f/this.ky,_=f/this.kx;return[d[0]-_,d[1]-m,d[0]+_,d[1]+m]},n.prototype.bufferBBox=function(d,f){var m=f/this.ky,_=f/this.kx;return[d[0]-_,d[1]-m,d[2]+_,d[3]+m]},n.prototype.insideBBox=function(d,f){return h(d[0]-f[0])&gt;=0&amp;&amp;h(d[0]-f[2])&lt;=0&amp;&amp;d[1]&gt;=f[1]&amp;&amp;d[1]&lt;=f[3]},Object.defineProperties(n,s),n}();var Xf=Qt(Jy.exports),Qy={exports:{}};Qy.exports=function(){var e=function(i,r){if(i===void 0&amp;&amp;(i=[]),r===void 0&amp;&amp;(r=t),this.data=i,this.length=this.data.length,this.compare=r,this.length&gt;0)for(var n=(this.length&gt;&gt;1)-1;n&gt;=0;n--)this._down(n)};function t(i,r){return i&lt;r?-1:i&gt;r?1:0}return e.prototype.push=function(i){this.data.push(i),this.length++,this._up(this.length-1)},e.prototype.pop=function(){if(this.length!==0){var i=this.data[0],r=this.data.pop();return this.length--,this.length&gt;0&amp;&amp;(this.data[0]=r,this._down(0)),i}},e.prototype.peek=function(){return this.data[0]},e.prototype._up=function(i){for(var r=this.data,n=this.compare,s=r[i];i&gt;0;){var a=i-1&gt;&gt;1,l=r[a];if(n(s,l)&gt;=0)break;r[i]=l,i=a}r[i]=s},e.prototype._down=function(i){for(var r=this.data,n=this.compare,s=this.length&gt;&gt;1,a=r[i];i&lt;s;){var l=1+(i&lt;&lt;1),h=r[l],d=l+1;if(d&lt;this.length&amp;&amp;n(r[d],h)&lt;0&amp;&amp;(l=d,h=r[d]),n(h,a)&gt;=0)break;r[i]=h,i=l}r[i]=a},e}();var Yf=Qt(Qy.exports),ut=8192;function t0(e,t){return t.dist-e.dist}const Kf=100,Jf=50;function e0(e){const t=[1/0,1/0,-1/0,-1/0];if(t.length!==e.length)return!1;for(let i=0;i&lt;t.length;i++)if(t[i]!==e[i])return!1;return!0}function Vu(e){return e[1]-e[0]+1}function Us(e,t){const i=e[1]&gt;=e[0]&amp;&amp;e[1]&lt;t;return i||console.warn("Distance Expression: Index is out of range"),i}function Qf(e,t){if(e[0]&gt;e[1])return[null,null];const i=Vu(e);if(t){if(i===2)return[e,null];const r=Math.floor(i/2);return[[e[0],e[0]+r],[e[0]+r,e[1]]]}{if(i===1)return[e,null];const r=Math.floor(i/2)-1;return[[e[0],e[0]+r],[e[0]+r+1,e[1]]]}}function ta(e,t){const i=[1/0,1/0,-1/0,-1/0];if(!Us(t,e.length))return i;for(let r=t[0];r&lt;=t[1];++r)ac(i,e[r]);return i}function ju(e){const t=[1/0,1/0,-1/0,-1/0];for(let i=0;i&lt;e.length;++i)for(let r=0;r&lt;e[i].length;++r)ac(t,e[i][r]);return t}function ja(e,t,i){if(e0(e)||e0(t))return NaN;let r=0,n=0;return e[2]&lt;t[0]&amp;&amp;(r=t[0]-e[2]),e[0]&gt;t[2]&amp;&amp;(r=e[0]-t[2]),e[1]&gt;t[3]&amp;&amp;(n=e[1]-t[3]),e[3]&lt;t[1]&amp;&amp;(n=t[1]-e[3]),i.distance([0,0],[r,n])}function tp(e,t){const i=Math.pow(2,t.z);return[(n=(e.x/ut+t.x)/i,360*n-180),(r=(e.y/ut+t.y)/i,360/Math.PI*Math.atan(Math.exp((180-360*r)*Math.PI/180))-90)];var r,n}function fI(e,t){const i=[];for(let r=0;r&lt;e.length;++r)i.push(tp(e[r],t));return i}function i0(e,t,i){const r=i.pointOnLine(t,e).point;return i.distance(e,r)}function r0(e,t,i,r,n){const s=i.slice(r[0],r[1]+1);let a=1/0;for(let l=t[0];l&lt;=t[1];++l)if((a=Math.min(a,i0(e[l],s,n)))===0)return 0;return a}function ep(e,t,i,r,n){const s=Math.min(n.pointToSegmentDistance(e,i,r),n.pointToSegmentDistance(t,i,r)),a=Math.min(n.pointToSegmentDistance(i,e,t),n.pointToSegmentDistance(r,e,t));return Math.min(s,a)}function pI(e,t,i,r,n){if(!Us(t,e.length)||!Us(r,i.length))return NaN;let s=1/0;for(let a=t[0];a&lt;t[1];++a)for(let l=r[0];l&lt;r[1];++l){if(Uu(e[a],e[a+1],i[l],i[l+1]))return 0;s=Math.min(s,ep(e[a],e[a+1],i[l],i[l+1],n))}return s}function mI(e,t,i,r,n){if(!Us(t,e.length)||!Us(r,i.length))return NaN;let s=1/0;for(let a=t[0];a&lt;=t[1];++a)for(let l=r[0];l&lt;=r[1];++l)if((s=Math.min(s,n.distance(e[a],i[l])))===0)return s;return s}function _I(e,t,i){if(Va(e,t,!0))return 0;let r=1/0;for(const n of t){const s=n.length;if(s&lt;2)return console.warn("Distance Expression: Invalid polygon!"),NaN;if(n[0]!==n[s-1]&amp;&amp;(r=Math.min(r,i.pointToSegmentDistance(e,n[s-1],n[0])))===0||(r=Math.min(r,i0(e,n,i)))===0)return r}return r}function gI(e,t,i,r){if(!Us(t,e.length))return NaN;for(let s=t[0];s&lt;=t[1];++s)if(Va(e[s],i,!0))return 0;let n=1/0;for(let s=t[0];s&lt;t[1];++s)for(const a of i)for(let l=0,h=a.length,d=h-1;l&lt;h;d=l++){if(Uu(e[s],e[s+1],a[d],a[l]))return 0;n=Math.min(n,ep(e[s],e[s+1],a[d],a[l],r))}return n}function n0(e,t){for(const i of e)for(let r=0;r&lt;=i.length-1;++r)if(Va(i[r],t,!0))return!0;return!1}function yI(e,t,i,r=1/0){const n=ju(e),s=ju(t);if(r!==1/0&amp;&amp;ja(n,s,i)&gt;=r)return r;if(lc(n,s)){if(n0(e,t))return 0}else if(n0(t,e))return 0;let a=r;for(const l of e)for(let h=0,d=l.length,f=d-1;h&lt;d;f=h++)for(const m of t)for(let _=0,y=m.length,x=y-1;_&lt;y;x=_++){if(Uu(l[f],l[h],m[x],m[_]))return 0;a=Math.min(a,ep(l[f],l[h],m[x],m[_],i))}return a}function Gu(e,t,i,r,n,s,a){if(s===null||a===null)return;const l=ja(ta(r,s),ta(n,a),i);l&lt;t&amp;&amp;e.push({dist:l,range1:s,range2:a})}function xI(e,t,i,r,n=1/0){let s=Math.min(r.distance(e[0],i[0][0]),n);if(s===0)return s;const a=new Yf([{dist:0,range1:[0,e.length-1],range2:[0,0]}],t0),l=t?Jf:Kf,h=ju(i);for(;a.length;){const d=a.pop();if(d.dist&gt;=s)continue;const f=d.range1;if(Vu(f)&lt;=l){if(!Us(f,e.length))return NaN;if(t){const m=gI(e,f,i,r);if((s=Math.min(s,m))===0)return s}else for(let m=f[0];m&lt;=f[1];++m){const _=_I(e[m],i,r);if((s=Math.min(s,_))===0)return s}}else{const m=Qf(f,t);if(m[0]!==null){const _=ja(ta(e,m[0]),h,r);_&lt;s&amp;&amp;a.push({dist:_,range1:m[0],range2:[0,0]})}if(m[1]!==null){const _=ja(ta(e,m[1]),h,r);_&lt;s&amp;&amp;a.push({dist:_,range1:m[1],range2:[0,0]})}}}return s}function s0(e,t,i,r,n,s=1/0){let a=Math.min(s,n.distance(e[0],i[0]));if(a===0)return a;const l=new Yf([{dist:0,range1:[0,e.length-1],range2:[0,i.length-1]}],t0),h=t?Jf:Kf,d=r?Jf:Kf;for(;l.length;){const f=l.pop();if(f.dist&gt;=a)continue;const m=f.range1,_=f.range2;if(Vu(m)&lt;=h&amp;&amp;Vu(_)&lt;=d){if(!Us(m,e.length)||!Us(_,i.length))return NaN;if(t&amp;&amp;r?a=Math.min(a,pI(e,m,i,_,n)):t||r?t&amp;&amp;!r?a=Math.min(a,r0(i,_,e,m,n)):!t&amp;&amp;r&amp;&amp;(a=Math.min(a,r0(e,m,i,_,n))):a=Math.min(a,mI(e,m,i,_,n)),a===0)return a}else{const y=Qf(m,t),x=Qf(_,r);Gu(l,a,n,e,i,y[0],x[0]),Gu(l,a,n,e,i,y[0],x[1]),Gu(l,a,n,e,i,y[1],x[0]),Gu(l,a,n,e,i,y[1],x[1])}}return a}function ip(e,t,i,r,n=1/0){let s=n;const a=ta(e,[0,e.length-1]);for(const l of i)if(!(s!==1/0&amp;&amp;ja(a,ta(l,[0,l.length-1]),r)&gt;=s)&amp;&amp;(s=Math.min(s,s0(e,t,l,!0,r,s)),s===0))return s;return s}function Hu(e,t,i,r,n=1/0){let s=n;const a=ta(e,[0,e.length-1]);for(const l of i){if(s!==1/0&amp;&amp;ja(a,ju(l),r)&gt;=s)continue;const h=xI(e,t,l,r,s);if(isNaN(h))return h;if((s=Math.min(s,h))===0)return s}return s}function rp(e){return e==="Point"||e==="MultiPoint"||e==="LineString"||e==="MultiLineString"||e==="Polygon"||e==="MultiPolygon"}class uc{constructor(t,i){this.type=qt,this.geojson=t,this.geometries=i}static parse(t,i){if(t.length!==2)return i.error(`'distance' expression requires either one argument, but found ' ${t.length-1} instead.`);if(Ua(t[1])){const r=t[1];if(r.type==="FeatureCollection"){for(let n=0;n&lt;r.features.length;++n)if(rp(r.features[n].geometry.type))return new uc(r,r.features[n].geometry)}else if(r.type==="Feature"){if(rp(r.geometry.type))return new uc(r,r.geometry)}else if(rp(r.type))return new uc(r,r)}return i.error("'distance' expression needs to be an array with format ['Distance', GeoJSONObj].")}evaluate(t){const i=t.geometry(),r=t.canonicalID();if(i!=null&amp;&amp;r!=null){if(t.geometryType()==="Point")return function(n,s,a){const l=[];for(const d of n)for(const f of d)l.push(tp(f,s));const h=new Xf(l[0][1],"meters");return a.type==="Point"||a.type==="MultiPoint"||a.type==="LineString"?s0(l,!1,a.type==="Point"?[a.coordinates]:a.coordinates,a.type==="LineString",h):a.type==="MultiLineString"?ip(l,!1,a.coordinates,h):a.type==="Polygon"||a.type==="MultiPolygon"?Hu(l,!1,a.type==="Polygon"?[a.coordinates]:a.coordinates,h):null}(i,r,this.geometries);if(t.geometryType()==="LineString")return function(n,s,a){const l=[];for(const d of n){const f=[];for(const m of d)f.push(tp(m,s));l.push(f)}const h=new Xf(l[0][0][1],"meters");if(a.type==="Point"||a.type==="MultiPoint"||a.type==="LineString")return ip(a.type==="Point"?[a.coordinates]:a.coordinates,a.type==="LineString",l,h);if(a.type==="MultiLineString"){let d=1/0;for(let f=0;f&lt;a.coordinates.length;f++){const m=ip(a.coordinates[f],!0,l,h,d);if(isNaN(m))return m;if((d=Math.min(d,m))===0)return d}return d}if(a.type==="Polygon"||a.type==="MultiPolygon"){let d=1/0;for(let f=0;f&lt;l.length;f++){const m=Hu(l[f],!0,a.type==="Polygon"?[a.coordinates]:a.coordinates,h,d);if(isNaN(m))return m;if((d=Math.min(d,m))===0)return d}return d}return null}(i,r,this.geometries);if(t.geometryType()==="Polygon")return function(n,s,a){const l=[];for(const d of function(f,m){const _=f.length;if(_&lt;=1)return[f];const y=[];let x,b;for(let w=0;w&lt;_;w++){const T=aI(f[w]);T!==0&amp;&amp;(f[w].area=Math.abs(T),b===void 0&amp;&amp;(b=T&lt;0),b===T&lt;0?(x&amp;&amp;y.push(x),x=[f[w]]):x.push(f[w]))}return x&amp;&amp;y.push(x),y}(n)){const f=[];for(let m=0;m&lt;d.length;++m)f.push(fI(d[m],s));l.push(f)}const h=new Xf(l[0][0][0][1],"meters");if(a.type==="Point"||a.type==="MultiPoint"||a.type==="LineString")return Hu(a.type==="Point"?[a.coordinates]:a.coordinates,a.type==="LineString",l,h);if(a.type==="MultiLineString"){let d=1/0;for(let f=0;f&lt;a.coordinates.length;f++){const m=Hu(a.coordinates[f],!0,l,h,d);if(isNaN(m))return m;if((d=Math.min(d,m))===0)return d}return d}return a.type==="Polygon"||a.type==="MultiPolygon"?function(d,f,m){let _=1/0;for(const y of d)for(const x of f){const b=yI(y,x,m,_);if(isNaN(b))return b;if((_=Math.min(_,b))===0)return _}return _}(a.type==="Polygon"?[a.coordinates]:a.coordinates,l,h):null}(i,r,this.geometries);console.warn("Distance Expression: currently only evaluates valid Point/LineString/Polygon geometries.")}else console.warn("Distance Expression: requirs valid feature and canonical information.");return null}eachChild(){}outputDefined(){return!0}serialize(){return["distance",this.geojson]}}var np=uc;function Ga(e){if(e instanceof ls&amp;&amp;(e.name==="get"&amp;&amp;e.args.length===1||e.name==="feature-state"||e.name==="has"&amp;&amp;e.args.length===1||e.name==="properties"||e.name==="geometry-type"||e.name==="id"||/^filter-/.test(e.name))||e instanceof $f||e instanceof np)return!1;let t=!0;return e.eachChild(i=&gt;{t&amp;&amp;!Ga(i)&amp;&amp;(t=!1)}),t}function hc(e){if(e instanceof ls&amp;&amp;e.name==="feature-state")return!1;let t=!0;return e.eachChild(i=&gt;{t&amp;&amp;!hc(i)&amp;&amp;(t=!1)}),t}function sp(e){if(e instanceof ls&amp;&amp;e.name==="config")return!1;let t=!0;return e.eachChild(i=&gt;{t&amp;&amp;!sp(i)&amp;&amp;(t=!1)}),t}function Ha(e,t){if(e instanceof ls&amp;&amp;t.indexOf(e.name)&gt;=0)return!1;let i=!0;return e.eachChild(r=&gt;{i&amp;&amp;!Ha(r,t)&amp;&amp;(i=!1)}),i}class op{constructor(t,i){this.type=i.type,this.name=t,this.boundExpression=i}static parse(t,i){if(t.length!==2||typeof t[1]!="string")return i.error("'var' expression requires exactly one string literal argument.");const r=t[1];return i.scope.has(r)?new op(r,i.scope.get(r)):i.error(`Unknown variable "${r}". Make sure "${r}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(t){return this.boundExpression.evaluate(t)}eachChild(){}outputDefined(){return!1}serialize(){return["var",this.name]}}var o0=op;class ap{constructor(t,i=[],r,n=new eI,s=[],a){this.registry=t,this.path=i,this.key=i.map(l=&gt;`[${l}]`).join(""),this.scope=n,this.errors=s,this.expectedType=r,this.options=a}parse(t,i,r,n,s={}){return i||r?this.concat(i,r,n)._parse(t,s):this._parse(t,s)}_parse(t,i){function r(n,s,a){return a==="assert"?new Ns(s,[n]):a==="coerce"?new Jo(s,[n]):n}if(t!==null&amp;&amp;typeof t!="string"&amp;&amp;typeof t!="boolean"&amp;&amp;typeof t!="number"||(t=["literal",t]),Array.isArray(t)){if(t.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const n=typeof t[0]=="string"?this.registry[t[0]]:void 0;if(n){let s=n.parse(t,this);if(!s)return null;if(this.expectedType){const a=this.expectedType,l=s.type;if(a.kind!=="string"&amp;&amp;a.kind!=="number"&amp;&amp;a.kind!=="boolean"&amp;&amp;a.kind!=="object"&amp;&amp;a.kind!=="array"||l.kind!=="value")if(a.kind!=="color"&amp;&amp;a.kind!=="formatted"&amp;&amp;a.kind!=="resolvedImage"||l.kind!=="value"&amp;&amp;l.kind!=="string"){if(this.checkSubtype(a,l))return null}else s=r(s,a,i.typeAnnotation||"coerce");else s=r(s,a,i.typeAnnotation||"assert")}if(!(s instanceof nc)&amp;&amp;s.type.kind!=="resolvedImage"&amp;&amp;lp(s)){const a=new Hy(this.options);try{s=new nc(s.type,s.evaluate(a))}catch(l){return this.error(l.message),null}}return s}return Jo.parse(["to-array",t],this)}return this.error(t===void 0?"'undefined' value invalid. Use null instead.":typeof t=="object"?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof t} instead.`)}concat(t,i,r){const n=typeof t=="number"?this.path.concat(t):this.path,s=r?this.scope.concat(r):this.scope;return new ap(this.registry,n,i||null,s,this.errors,this.options)}error(t,...i){const r=`${this.key}${i.map(n=&gt;`[${n}]`).join("")}`;this.errors.push(new as(r,t))}checkSubtype(t,i){const r=ec(t,i);return r&amp;&amp;this.error(r),r}}var a0=ap;function lp(e){if(e instanceof o0)return lp(e.boundExpression);if(e instanceof ls&amp;&amp;e.name==="error"||e instanceof ls&amp;&amp;e.name==="config"||e instanceof Nu||e instanceof $f||e instanceof np)return!1;const t=e instanceof Jo||e instanceof Ns;let i=!0;return e.eachChild(r=&gt;{i=t?i&amp;&amp;lp(r):i&amp;&amp;r instanceof nc}),!!i&amp;&amp;Ga(e)&amp;&amp;Ha(e,["zoom","heatmap-density","line-progress","raster-value","sky-radial-progress","accumulated","is-supported-script","pitch","distance-from-center","measure-light"])}function Wu(e,t){const i=e.length-1;let r,n,s=0,a=i,l=0;for(;s&lt;=a;)if(l=Math.floor((s+a)/2),r=e[l],n=e[l+1],r&lt;=t){if(l===i||t&lt;n)return l;s=l+1}else{if(!(r&gt;t))throw new _r("Input is not a number.");a=l-1}return 0}class cp{constructor(t,i,r){this.type=t,this.input=i,this.labels=[],this.outputs=[];for(const[n,s]of r)this.labels.push(n),this.outputs.push(s)}static parse(t,i){if(t.length-1&lt;4)return i.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return i.error("Expected an even number of arguments.");const r=i.parse(t[1],1,qt);if(!r)return null;const n=[];let s=null;i.expectedType&amp;&amp;i.expectedType.kind!=="value"&amp;&amp;(s=i.expectedType);for(let a=1;a&lt;t.length;a+=2){const l=a===1?-1/0:t[a],h=t[a+1],d=a,f=a+1;if(typeof l!="number")return i.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',d);if(n.length&amp;&amp;n[n.length-1][0]&gt;=l)return i.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',d);const m=i.parse(h,f,s);if(!m)return null;s=s||m.type,n.push([l,m])}return new cp(s,r,n)}evaluate(t){const i=this.labels,r=this.outputs;if(i.length===1)return r[0].evaluate(t);const n=this.input.evaluate(t);if(n&lt;=i[0])return r[0].evaluate(t);const s=i.length;return n&gt;=i[s-1]?r[s-1].evaluate(t):r[Wu(i,n)].evaluate(t)}eachChild(t){t(this.input);for(const i of this.outputs)t(i)}outputDefined(){return this.outputs.every(t=&gt;t.outputDefined())}serialize(){const t=["step",this.input.serialize()];for(let i=0;i&lt;this.labels.length;i++)i&gt;0&amp;&amp;t.push(this.labels[i]),t.push(this.outputs[i].serialize());return t}}var up=cp;function ge(e,t,i){return e*(1-i)+t*i}function l0(e,t,i){return e.map((r,n)=&gt;ge(r,t[n],i))}var qu=Object.freeze({__proto__:null,array:l0,color:function(e,t,i){return new Ie(ge(e.r,t.r,i),ge(e.g,t.g,i),ge(e.b,t.b,i),ge(e.a,t.a,i))},number:ge});const c0=.95047,u0=1.08883,h0=4/29,Wa=6/29,d0=3*Wa*Wa,vI=Wa*Wa*Wa,bI=Math.PI/180,wI=180/Math.PI;function hp(e){return e&gt;vI?Math.pow(e,1/3):e/d0+h0}function dp(e){return e&gt;Wa?e*e*e:d0*(e-h0)}function fp(e){return 255*(e&lt;=.0031308?12.92*e:1.055*Math.pow(e,1/2.4)-.055)}function pp(e){return(e/=255)&lt;=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function f0(e){const t=pp(e.r),i=pp(e.g),r=pp(e.b),n=hp((.4124564*t+.3575761*i+.1804375*r)/c0),s=hp((.2126729*t+.7151522*i+.072175*r)/1);return{l:116*s-16,a:500*(n-s),b:200*(s-hp((.0193339*t+.119192*i+.9503041*r)/u0)),alpha:e.a}}function p0(e){let t=(e.l+16)/116,i=isNaN(e.a)?t:t+e.a/500,r=isNaN(e.b)?t:t-e.b/200;return t=1*dp(t),i=c0*dp(i),r=u0*dp(r),new Ie(fp(3.2404542*i-1.5371385*t-.4985314*r),fp(-.969266*i+1.8760108*t+.041556*r),fp(.0556434*i-.2040259*t+1.0572252*r),e.alpha)}function TI(e,t,i){const r=t-e;return e+i*(r&gt;180||r&lt;-180?r-360*Math.round(r/360):r)}const dc={forward:f0,reverse:p0,interpolate:function(e,t,i){return{l:ge(e.l,t.l,i),a:ge(e.a,t.a,i),b:ge(e.b,t.b,i),alpha:ge(e.alpha,t.alpha,i)}}},fc={forward:function(e){const{l:t,a:i,b:r}=f0(e),n=Math.atan2(r,i)*wI;return{h:n&lt;0?n+360:n,c:Math.sqrt(i*i+r*r),l:t,alpha:e.a}},reverse:function(e){const t=e.h*bI,i=e.c;return p0({l:e.l,a:Math.cos(t)*i,b:Math.sin(t)*i,alpha:e.alpha})},interpolate:function(e,t,i){return{h:TI(e.h,t.h,i),c:ge(e.c,t.c,i),l:ge(e.l,t.l,i),alpha:ge(e.alpha,t.alpha,i)}}};var m0=Object.freeze({__proto__:null,hcl:fc,lab:dc});class Zu{constructor(t,i,r,n,s){this.type=t,this.operator=i,this.interpolation=r,this.input=n,this.labels=[],this.outputs=[];for(const[a,l]of s)this.labels.push(a),this.outputs.push(l)}static interpolationFactor(t,i,r,n){let s=0;if(t.name==="exponential")s=mp(i,t.base,r,n);else if(t.name==="linear")s=mp(i,1,r,n);else if(t.name==="cubic-bezier"){const a=t.controlPoints;s=new Oe(a[0],a[1],a[2],a[3]).solve(mp(i,1,r,n))}return s}static parse(t,i){let[r,n,s,...a]=t;if(!Array.isArray(n)||n.length===0)return i.error("Expected an interpolation type expression.",1);if(n[0]==="linear")n={name:"linear"};else if(n[0]==="exponential"){const d=n[1];if(typeof d!="number")return i.error("Exponential interpolation requires a numeric base.",1,1);n={name:"exponential",base:d}}else{if(n[0]!=="cubic-bezier")return i.error(`Unknown interpolation type ${String(n[0])}`,1,0);{const d=n.slice(1);if(d.length!==4||d.some(f=&gt;typeof f!="number"||f&lt;0||f&gt;1))return i.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);n={name:"cubic-bezier",controlPoints:d}}}if(t.length-1&lt;4)return i.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return i.error("Expected an even number of arguments.");if(s=i.parse(s,2,qt),!s)return null;const l=[];let h=null;r==="interpolate-hcl"||r==="interpolate-lab"?h=Tn:i.expectedType&amp;&amp;i.expectedType.kind!=="value"&amp;&amp;(h=i.expectedType);for(let d=0;d&lt;a.length;d+=2){const f=a[d],m=a[d+1],_=d+3,y=d+4;if(typeof f!="number")return i.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',_);if(l.length&amp;&amp;l[l.length-1][0]&gt;=f)return i.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',_);const x=i.parse(m,y,h);if(!x)return null;h=h||x.type,l.push([f,x])}return h.kind==="number"||h.kind==="color"||h.kind==="array"&amp;&amp;h.itemType.kind==="number"&amp;&amp;typeof h.N=="number"?new Zu(h,r,n,s,l):i.error(`Type ${$i(h)} is not interpolatable.`)}evaluate(t){const i=this.labels,r=this.outputs;if(i.length===1)return r[0].evaluate(t);const n=this.input.evaluate(t);if(n&lt;=i[0])return r[0].evaluate(t);const s=i.length;if(n&gt;=i[s-1])return r[s-1].evaluate(t);const a=Wu(i,n),l=Zu.interpolationFactor(this.interpolation,n,i[a],i[a+1]),h=r[a].evaluate(t),d=r[a+1].evaluate(t);return this.operator==="interpolate"?qu[this.type.kind.toLowerCase()](h,d,l):this.operator==="interpolate-hcl"?fc.reverse(fc.interpolate(fc.forward(h),fc.forward(d),l)):dc.reverse(dc.interpolate(dc.forward(h),dc.forward(d),l))}eachChild(t){t(this.input);for(const i of this.outputs)t(i)}outputDefined(){return this.outputs.every(t=&gt;t.outputDefined())}serialize(){let t;t=this.interpolation.name==="linear"?["linear"]:this.interpolation.name==="exponential"?this.interpolation.base===1?["linear"]:["exponential",this.interpolation.base]:["cubic-bezier"].concat(this.interpolation.controlPoints);const i=[this.operator,t,this.input.serialize()];for(let r=0;r&lt;this.labels.length;r++)i.push(this.labels[r],this.outputs[r].serialize());return i}}function mp(e,t,i,r){const n=r-i,s=e-i;return n===0?0:t===1?s/n:(Math.pow(t,s)-1)/(Math.pow(t,n)-1)}var cs=Zu;class _p{constructor(t,i){this.type=t,this.args=i}static parse(t,i){if(t.length&lt;2)return i.error("Expectected at least one argument.");let r=null;const n=i.expectedType;n&amp;&amp;n.kind!=="value"&amp;&amp;(r=n);const s=[];for(const l of t.slice(1)){const h=i.parse(l,1+s.length,r,void 0,{typeAnnotation:"omit"});if(!h)return null;r=r||h.type,s.push(h)}const a=n&amp;&amp;s.some(l=&gt;ec(n,l.type));return new _p(a?Ze:r,s)}evaluate(t){let i,r=null,n=0;for(const s of this.args){if(n++,r=s.evaluate(t),r&amp;&amp;r instanceof En&amp;&amp;!r.available&amp;&amp;(i||(i=r),r=null,n===this.args.length))return i;if(r!==null)break}return r}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=&gt;t.outputDefined())}serialize(){const t=["coalesce"];return this.eachChild(i=&gt;{t.push(i.serialize())}),t}}var _0=_p;class gp{constructor(t,i){this.type=i.type,this.bindings=[].concat(t),this.result=i}evaluate(t){return this.result.evaluate(t)}eachChild(t){for(const i of this.bindings)t(i[1]);t(this.result)}static parse(t,i){if(t.length&lt;4)return i.error(`Expected at least 3 arguments, but found ${t.length-1} instead.`);const r=[];for(let s=1;s&lt;t.length-1;s+=2){const a=t[s];if(typeof a!="string")return i.error(`Expected string, but found ${typeof a} instead.`,s);if(/[^a-zA-Z0-9_]/.test(a))return i.error("Variable names must contain only alphanumeric characters or '_'.",s);const l=i.parse(t[s+1],s+1);if(!l)return null;r.push([a,l])}const n=i.parse(t[t.length-1],t.length-1,i.expectedType,r);return n?new gp(r,n):null}outputDefined(){return this.result.outputDefined()}serialize(){const t=["let"];for(const[i,r]of this.bindings)t.push(i,r.serialize());return t.push(this.result.serialize()),t}}var g0=gp;class yp{constructor(t,i,r){this.type=t,this.index=i,this.input=r}static parse(t,i){if(t.length!==3)return i.error(`Expected 2 arguments, but found ${t.length-1} instead.`);const r=i.parse(t[1],1,qt),n=i.parse(t[2],2,Zr(i.expectedType||Ze));return r&amp;&amp;n?new yp(n.type.itemType,r,n):null}evaluate(t){const i=this.index.evaluate(t),r=this.input.evaluate(t);if(i&lt;0)throw new _r(`Array index out of bounds: ${i} &lt; 0.`);if(i&gt;=r.length)throw new _r(`Array index out of bounds: ${i} &gt; ${r.length-1}.`);if(i!==Math.floor(i))throw new _r(`Array index must be an integer, but found ${i} instead.`);return r[i]}eachChild(t){t(this.index),t(this.input)}outputDefined(){return!1}serialize(){return["at",this.index.serialize(),this.input.serialize()]}}var EI=yp;class xp{constructor(t,i){this.type=ti,this.needle=t,this.haystack=i}static parse(t,i){if(t.length!==3)return i.error(`Expected 2 arguments, but found ${t.length-1} instead.`);const r=i.parse(t[1],1,Ze),n=i.parse(t[2],2,Ze);return r&amp;&amp;n?Ff(r.type,[ti,He,qt,Ba,Ze])?new xp(r,n):i.error(`Expected first argument to be of type boolean, string, number or null, but found ${$i(r.type)} instead`):null}evaluate(t){const i=this.needle.evaluate(t),r=this.haystack.evaluate(t);if(r==null)return!1;if(!ic(i,["boolean","string","number","null"]))throw new _r(`Expected first argument to be of type boolean, string, number or null, but found ${$i(lr(i))} instead.`);if(!ic(r,["string","array"]))throw new _r(`Expected second argument to be of type array or string, but found ${$i(lr(r))} instead.`);return r.indexOf(i)&gt;=0}eachChild(t){t(this.needle),t(this.haystack)}outputDefined(){return!0}serialize(){return["in",this.needle.serialize(),this.haystack.serialize()]}}var SI=xp;class $u{constructor(t,i,r){this.type=qt,this.needle=t,this.haystack=i,this.fromIndex=r}static parse(t,i){if(t.length&lt;=2||t.length&gt;=5)return i.error(`Expected 3 or 4 arguments, but found ${t.length-1} instead.`);const r=i.parse(t[1],1,Ze),n=i.parse(t[2],2,Ze);if(!r||!n)return null;if(!Ff(r.type,[ti,He,qt,Ba,Ze]))return i.error(`Expected first argument to be of type boolean, string, number or null, but found ${$i(r.type)} instead`);if(t.length===4){const s=i.parse(t[3],3,qt);return s?new $u(r,n,s):null}return new $u(r,n)}evaluate(t){const i=this.needle.evaluate(t),r=this.haystack.evaluate(t);if(!ic(i,["boolean","string","number","null"]))throw new _r(`Expected first argument to be of type boolean, string, number or null, but found ${$i(lr(i))} instead.`);if(!ic(r,["string","array"]))throw new _r(`Expected second argument to be of type array or string, but found ${$i(lr(r))} instead.`);if(this.fromIndex){const n=this.fromIndex.evaluate(t);return r.indexOf(i,n)}return r.indexOf(i)}eachChild(t){t(this.needle),t(this.haystack),this.fromIndex&amp;&amp;t(this.fromIndex)}outputDefined(){return!1}serialize(){if(this.fromIndex!=null&amp;&amp;this.fromIndex!==void 0){const t=this.fromIndex.serialize();return["index-of",this.needle.serialize(),this.haystack.serialize(),t]}return["index-of",this.needle.serialize(),this.haystack.serialize()]}}var AI=$u;class vp{constructor(t,i,r,n,s,a){this.inputType=t,this.type=i,this.input=r,this.cases=n,this.outputs=s,this.otherwise=a}static parse(t,i){if(t.length&lt;5)return i.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if(t.length%2!=1)return i.error("Expected an even number of arguments.");let r,n;i.expectedType&amp;&amp;i.expectedType.kind!=="value"&amp;&amp;(n=i.expectedType);const s={},a=[];for(let d=2;d&lt;t.length-1;d+=2){let f=t[d];const m=t[d+1];Array.isArray(f)||(f=[f]);const _=i.concat(d);if(f.length===0)return _.error("Expected at least one branch label.");for(const x of f){if(typeof x!="number"&amp;&amp;typeof x!="string")return _.error("Branch labels must be numbers or strings.");if(typeof x=="number"&amp;&amp;Math.abs(x)&gt;Number.MAX_SAFE_INTEGER)return _.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof x=="number"&amp;&amp;Math.floor(x)!==x)return _.error("Numeric branch labels must be integer values.");if(r){if(_.checkSubtype(r,lr(x)))return null}else r=lr(x);if(s[String(x)]!==void 0)return _.error("Branch labels must be unique.");s[String(x)]=a.length}const y=i.parse(m,d,n);if(!y)return null;n=n||y.type,a.push(y)}const l=i.parse(t[1],1,Ze);if(!l)return null;const h=i.parse(t[t.length-1],t.length-1,n);return h?l.type.kind!=="value"&amp;&amp;i.concat(1).checkSubtype(r,l.type)?null:new vp(r,n,l,s,a,h):null}evaluate(t){const i=this.input.evaluate(t);return(lr(i)===this.inputType&amp;&amp;this.outputs[this.cases[i]]||this.otherwise).evaluate(t)}eachChild(t){t(this.input),this.outputs.forEach(t),t(this.otherwise)}outputDefined(){return this.outputs.every(t=&gt;t.outputDefined())&amp;&amp;this.otherwise.outputDefined()}serialize(){const t=["match",this.input.serialize()],i=Object.keys(this.cases).sort(),r=[],n={};for(const a of i){const l=n[this.cases[a]];l===void 0?(n[this.cases[a]]=r.length,r.push([this.cases[a],[a]])):r[l][1].push(a)}const s=a=&gt;this.inputType.kind==="number"?Number(a):a;for(const[a,l]of r)t.push(l.length===1?s(l[0]):l.map(s)),t.push(this.outputs[a].serialize());return t.push(this.otherwise.serialize()),t}}var MI=vp;class bp{constructor(t,i,r){this.type=t,this.branches=i,this.otherwise=r}static parse(t,i){if(t.length&lt;4)return i.error(`Expected at least 3 arguments, but found only ${t.length-1}.`);if(t.length%2!=0)return i.error("Expected an odd number of arguments.");let r;i.expectedType&amp;&amp;i.expectedType.kind!=="value"&amp;&amp;(r=i.expectedType);const n=[];for(let a=1;a&lt;t.length-1;a+=2){const l=i.parse(t[a],a,ti);if(!l)return null;const h=i.parse(t[a+1],a+1,r);if(!h)return null;n.push([l,h]),r=r||h.type}const s=i.parse(t[t.length-1],t.length-1,r);return s?new bp(r,n,s):null}evaluate(t){for(const[i,r]of this.branches)if(i.evaluate(t))return r.evaluate(t);return this.otherwise.evaluate(t)}eachChild(t){for(const[i,r]of this.branches)t(i),t(r);t(this.otherwise)}outputDefined(){return this.branches.every(([t,i])=&gt;i.outputDefined())&amp;&amp;this.otherwise.outputDefined()}serialize(){const t=["case"];return this.eachChild(i=&gt;{t.push(i.serialize())}),t}}var II=bp;class Xu{constructor(t,i,r,n){this.type=t,this.input=i,this.beginIndex=r,this.endIndex=n}static parse(t,i){if(t.length&lt;=2||t.length&gt;=5)return i.error(`Expected 3 or 4 arguments, but found ${t.length-1} instead.`);const r=i.parse(t[1],1,Ze),n=i.parse(t[2],2,qt);if(!r||!n)return null;if(!Ff(r.type,[Zr(Ze),He,Ze]))return i.error(`Expected first argument to be of type array or string, but found ${$i(r.type)} instead`);if(t.length===4){const s=i.parse(t[3],3,qt);return s?new Xu(r.type,r,n,s):null}return new Xu(r.type,r,n)}evaluate(t){const i=this.input.evaluate(t),r=this.beginIndex.evaluate(t);if(!ic(i,["string","array"]))throw new _r(`Expected first argument to be of type array or string, but found ${$i(lr(i))} instead.`);if(this.endIndex){const n=this.endIndex.evaluate(t);return i.slice(r,n)}return i.slice(r)}eachChild(t){t(this.input),t(this.beginIndex),this.endIndex&amp;&amp;t(this.endIndex)}outputDefined(){return!1}serialize(){if(this.endIndex!=null&amp;&amp;this.endIndex!==void 0){const t=this.endIndex.serialize();return["slice",this.input.serialize(),this.beginIndex.serialize(),t]}return["slice",this.input.serialize(),this.beginIndex.serialize()]}}var PI=Xu;function y0(e,t){return e==="=="||e==="!="?t.kind==="boolean"||t.kind==="string"||t.kind==="number"||t.kind==="null"||t.kind==="value":t.kind==="string"||t.kind==="number"||t.kind==="value"}function x0(e,t,i,r){return r.compare(t,i)===0}function qa(e,t,i){const r=e!=="=="&amp;&amp;e!=="!=";return class WM{constructor(s,a,l){this.type=ti,this.lhs=s,this.rhs=a,this.collator=l,this.hasUntypedArgument=s.type.kind==="value"||a.type.kind==="value"}static parse(s,a){if(s.length!==3&amp;&amp;s.length!==4)return a.error("Expected two or three arguments.");const l=s[0];let h=a.parse(s[1],1,Ze);if(!h)return null;if(!y0(l,h.type))return a.concat(1).error(`"${l}" comparisons are not supported for type '${$i(h.type)}'.`);let d=a.parse(s[2],2,Ze);if(!d)return null;if(!y0(l,d.type))return a.concat(2).error(`"${l}" comparisons are not supported for type '${$i(d.type)}'.`);if(h.type.kind!==d.type.kind&amp;&amp;h.type.kind!=="value"&amp;&amp;d.type.kind!=="value")return a.error(`Cannot compare types '${$i(h.type)}' and '${$i(d.type)}'.`);r&amp;&amp;(h.type.kind==="value"&amp;&amp;d.type.kind!=="value"?h=new Ns(d.type,[h]):h.type.kind!=="value"&amp;&amp;d.type.kind==="value"&amp;&amp;(d=new Ns(h.type,[d])));let f=null;if(s.length===4){if(h.type.kind!=="string"&amp;&amp;d.type.kind!=="string"&amp;&amp;h.type.kind!=="value"&amp;&amp;d.type.kind!=="value")return a.error("Cannot use collator to compare non-string types.");if(f=a.parse(s[3],3,zu),!f)return null}return new WM(h,d,f)}evaluate(s){const a=this.lhs.evaluate(s),l=this.rhs.evaluate(s);if(r&amp;&amp;this.hasUntypedArgument){const h=lr(a),d=lr(l);if(h.kind!==d.kind||h.kind!=="string"&amp;&amp;h.kind!=="number")throw new _r(`Expected arguments for "${e}" to be (string, string) or (number, number), but found (${h.kind}, ${d.kind}) instead.`)}if(this.collator&amp;&amp;!r&amp;&amp;this.hasUntypedArgument){const h=lr(a),d=lr(l);if(h.kind!=="string"||d.kind!=="string")return t(s,a,l)}return this.collator?i(s,a,l,this.collator.evaluate(s)):t(s,a,l)}eachChild(s){s(this.lhs),s(this.rhs),this.collator&amp;&amp;s(this.collator)}outputDefined(){return!0}serialize(){const s=[e];return this.eachChild(a=&gt;{s.push(a.serialize())}),s}}}const CI=qa("==",function(e,t,i){return t===i},x0),LI=qa("!=",function(e,t,i){return t!==i},function(e,t,i,r){return!x0(0,t,i,r)}),RI=qa("&lt;",function(e,t,i){return t&lt;i},function(e,t,i,r){return r.compare(t,i)&lt;0}),DI=qa("&gt;",function(e,t,i){return t&gt;i},function(e,t,i,r){return r.compare(t,i)&gt;0}),OI=qa("&lt;=",function(e,t,i){return t&lt;=i},function(e,t,i,r){return r.compare(t,i)&lt;=0}),kI=qa("&gt;=",function(e,t,i){return t&gt;=i},function(e,t,i,r){return r.compare(t,i)&gt;=0});class wp{constructor(t,i,r,n,s,a){this.type=He,this.number=t,this.locale=i,this.currency=r,this.unit=n,this.minFractionDigits=s,this.maxFractionDigits=a}static parse(t,i){if(t.length!==3)return i.error("Expected two arguments.");const r=i.parse(t[1],1,qt);if(!r)return null;const n=t[2];if(typeof n!="object"||Array.isArray(n))return i.error("NumberFormat options argument must be an object.");let s=null;if(n.locale&amp;&amp;(s=i.parse(n.locale,1,He),!s))return null;let a=null;if(n.currency&amp;&amp;(a=i.parse(n.currency,1,He),!a))return null;let l=null;if(n.unit&amp;&amp;(l=i.parse(n.unit,1,He),!l))return null;let h=null;if(n["min-fraction-digits"]&amp;&amp;(h=i.parse(n["min-fraction-digits"],1,qt),!h))return null;let d=null;return n["max-fraction-digits"]&amp;&amp;(d=i.parse(n["max-fraction-digits"],1,qt),!d)?null:new wp(r,s,a,l,h,d)}evaluate(t){return new Intl.NumberFormat(this.locale?this.locale.evaluate(t):[],{style:(this.currency?"currency":this.unit&amp;&amp;"unit")||"decimal",currency:this.currency?this.currency.evaluate(t):void 0,unit:this.unit?this.unit.evaluate(t):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(t):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(t):void 0}).format(this.number.evaluate(t))}eachChild(t){t(this.number),this.locale&amp;&amp;t(this.locale),this.currency&amp;&amp;t(this.currency),this.unit&amp;&amp;t(this.unit),this.minFractionDigits&amp;&amp;t(this.minFractionDigits),this.maxFractionDigits&amp;&amp;t(this.maxFractionDigits)}outputDefined(){return!1}serialize(){const t={};return this.locale&amp;&amp;(t.locale=this.locale.serialize()),this.currency&amp;&amp;(t.currency=this.currency.serialize()),this.unit&amp;&amp;(t.unit=this.unit.serialize()),this.minFractionDigits&amp;&amp;(t["min-fraction-digits"]=this.minFractionDigits.serialize()),this.maxFractionDigits&amp;&amp;(t["max-fraction-digits"]=this.maxFractionDigits.serialize()),["number-format",this.number.serialize(),t]}}class Tp{constructor(t){this.type=qt,this.input=t}static parse(t,i){if(t.length!==2)return i.error(`Expected 1 argument, but found ${t.length-1} instead.`);const r=i.parse(t[1],1);return r?r.type.kind!=="array"&amp;&amp;r.type.kind!=="string"&amp;&amp;r.type.kind!=="value"?i.error(`Expected argument of type string or array, but found ${$i(r.type)} instead.`):new Tp(r):null}evaluate(t){const i=this.input.evaluate(t);if(typeof i=="string"||Array.isArray(i))return i.length;throw new _r(`Expected value to be of type string or array, but found ${$i(lr(i))} instead.`)}eachChild(t){t(this.input)}outputDefined(){return!1}serialize(){const t=["length"];return this.eachChild(i=&gt;{t.push(i.serialize())}),t}}function Ep(e){return function(){e=1831565813+(e|=0)|0;let t=Math.imul(e^e&gt;&gt;&gt;15,1|e);return t=t+Math.imul(t^t&gt;&gt;&gt;7,61|t)^t,((t^t&gt;&gt;&gt;14)&gt;&gt;&gt;0)/4294967296}}const v0={"==":CI,"!=":LI,"&gt;":DI,"&lt;":RI,"&gt;=":kI,"&lt;=":OI,array:Ns,at:EI,boolean:Ns,case:II,coalesce:_0,collator:Nu,format:sc,image:oc,in:SI,"index-of":AI,interpolate:cs,"interpolate-hcl":cs,"interpolate-lab":cs,length:Tp,let:g0,literal:nc,match:MI,number:Ns,"number-format":wp,object:Ns,slice:PI,step:up,string:Ns,"to-boolean":Jo,"to-color":Jo,"to-number":Jo,"to-string":Jo,var:o0,within:$f,distance:np};function b0(e,[t,i,r,n]){t=t.evaluate(e),i=i.evaluate(e),r=r.evaluate(e);const s=n?n.evaluate(e):1,a=Gy(t,i,r,s);if(a)throw new _r(a);return new Ie(t/255*s,i/255*s,r/255*s,s)}function w0(e,[t,i,r,n]){t=t.evaluate(e),i=i.evaluate(e),r=r.evaluate(e);const s=n?n.evaluate(e):1,a=function(d,f,m,_){return typeof d=="number"&amp;&amp;d&gt;=0&amp;&amp;d&lt;=360?typeof f=="number"&amp;&amp;f&gt;=0&amp;&amp;f&lt;=100&amp;&amp;typeof m=="number"&amp;&amp;m&gt;=0&amp;&amp;m&lt;=100?_===void 0||typeof _=="number"&amp;&amp;_&gt;=0&amp;&amp;_&lt;=1?null:`Invalid hsla value [${[d,f,m,_].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid hsla value [${(typeof _=="number"?[d,f,m,_]:[d,f,m]).join(", ")}]: 's', and 'l' must be between 0 and 100.`:`Invalid hsla value [${(typeof _=="number"?[d,f,m,_]:[d,f,m]).join(", ")}]: 'h' must be between 0 and 360.`}(t,i,r,s);if(a)throw new _r(a);const l=`hsla(${t}, ${i}%, ${r}%, ${s})`,h=Ie.parse(l);if(!h)throw new _r(`Failed to parse HSLA color: ${l}`);return h}function T0(e,t){return e in t}function Sp(e,t){const i=t[e];return i===void 0?null:i}function E0(e,t){switch(e){case"string":return String(t);case"number":return+t;case"boolean":return!!t;case"color":return Ie.parse(t)}return t}function S0(e,t,i,r){return r!==void 0&amp;&amp;(e=r*Math.round(e/r)),t!==void 0&amp;&amp;e&lt;t&amp;&amp;(e=t),i!==void 0&amp;&amp;e&gt;i&amp;&amp;(e=i),e}function A0(e,t,i){i.length&amp;&amp;(t+=`${i}`);const r=e.getConfig(t);if(!r)return null;const{type:n,value:s,values:a,minValue:l,maxValue:h,stepValue:d}=r,f=r.default.evaluate(e);let m=s?s.evaluate(e):f;return n&amp;&amp;(m=E0(n,m)),s!==void 0&amp;&amp;m!==void 0&amp;&amp;a&amp;&amp;!a.includes(m)&amp;&amp;(m=f,n&amp;&amp;(m=E0(n,m))),m===void 0||l===void 0&amp;&amp;h===void 0&amp;&amp;d===void 0||(typeof m=="number"?m=S0(m,l,h,d):Array.isArray(m)&amp;&amp;(m=m.map(_=&gt;typeof _=="number"?S0(_,l,h,d):_))),m}function ea(e){return{type:e}}ls.register(v0,{error:[{kind:"error"},[He],(e,[t])=&gt;{throw new _r(t.evaluate(e))}],typeof:[He,[Ze],(e,[t])=&gt;$i(lr(t.evaluate(e)))],"to-rgba":[Zr(qt,4),[Tn],(e,[t])=&gt;t.evaluate(e).toArray()],rgb:[Tn,[qt,qt,qt],b0],rgba:[Tn,[qt,qt,qt,qt],b0],hsl:[Tn,[qt,qt,qt],w0],hsla:[Tn,[qt,qt,qt,qt],w0],has:{type:ti,overloads:[[[He],(e,[t])=&gt;T0(t.evaluate(e),e.properties())],[[He,Na],(e,[t,i])=&gt;T0(t.evaluate(e),i.evaluate(e))]]},get:{type:Ze,overloads:[[[He],(e,[t])=&gt;Sp(t.evaluate(e),e.properties())],[[He,Na],(e,[t,i])=&gt;Sp(t.evaluate(e),i.evaluate(e))]]},config:{type:Ze,overloads:[[[He],(e,[t])=&gt;A0(e,t.evaluate(e),"")],[[He,He],(e,[t,i])=&gt;A0(e,t.evaluate(e),i.evaluate(e))]]},"feature-state":[Ze,[He],(e,[t])=&gt;Sp(t.evaluate(e),e.featureState||{})],properties:[Na,[],e=&gt;e.properties()],"geometry-type":[He,[],e=&gt;e.geometryType()],id:[Ze,[],e=&gt;e.id()],zoom:[qt,[],e=&gt;e.globals.zoom],pitch:[qt,[],e=&gt;e.globals.pitch||0],"distance-from-center":[qt,[],e=&gt;e.distanceFromCenter()],"measure-light":[qt,[He],(e,[t])=&gt;e.measureLight(t.evaluate(e))],"heatmap-density":[qt,[],e=&gt;e.globals.heatmapDensity||0],"line-progress":[qt,[],e=&gt;e.globals.lineProgress||0],"raster-value":[qt,[],e=&gt;e.globals.rasterValue||0],"sky-radial-progress":[qt,[],e=&gt;e.globals.skyRadialProgress||0],accumulated:[Ze,[],e=&gt;e.globals.accumulated===void 0?null:e.globals.accumulated],"+":[qt,ea(qt),(e,t)=&gt;{let i=0;for(const r of t)i+=r.evaluate(e);return i}],"*":[qt,ea(qt),(e,t)=&gt;{let i=1;for(const r of t)i*=r.evaluate(e);return i}],"-":{type:qt,overloads:[[[qt,qt],(e,[t,i])=&gt;t.evaluate(e)-i.evaluate(e)],[[qt],(e,[t])=&gt;-t.evaluate(e)]]},"/":[qt,[qt,qt],(e,[t,i])=&gt;t.evaluate(e)/i.evaluate(e)],"%":[qt,[qt,qt],(e,[t,i])=&gt;t.evaluate(e)%i.evaluate(e)],ln2:[qt,[],()=&gt;Math.LN2],pi:[qt,[],()=&gt;Math.PI],e:[qt,[],()=&gt;Math.E],"^":[qt,[qt,qt],(e,[t,i])=&gt;Math.pow(t.evaluate(e),i.evaluate(e))],sqrt:[qt,[qt],(e,[t])=&gt;Math.sqrt(t.evaluate(e))],log10:[qt,[qt],(e,[t])=&gt;Math.log(t.evaluate(e))/Math.LN10],ln:[qt,[qt],(e,[t])=&gt;Math.log(t.evaluate(e))],log2:[qt,[qt],(e,[t])=&gt;Math.log(t.evaluate(e))/Math.LN2],sin:[qt,[qt],(e,[t])=&gt;Math.sin(t.evaluate(e))],cos:[qt,[qt],(e,[t])=&gt;Math.cos(t.evaluate(e))],tan:[qt,[qt],(e,[t])=&gt;Math.tan(t.evaluate(e))],asin:[qt,[qt],(e,[t])=&gt;Math.asin(t.evaluate(e))],acos:[qt,[qt],(e,[t])=&gt;Math.acos(t.evaluate(e))],atan:[qt,[qt],(e,[t])=&gt;Math.atan(t.evaluate(e))],min:[qt,ea(qt),(e,t)=&gt;Math.min(...t.map(i=&gt;i.evaluate(e)))],max:[qt,ea(qt),(e,t)=&gt;Math.max(...t.map(i=&gt;i.evaluate(e)))],abs:[qt,[qt],(e,[t])=&gt;Math.abs(t.evaluate(e))],round:[qt,[qt],(e,[t])=&gt;{const i=t.evaluate(e);return i&lt;0?-Math.round(-i):Math.round(i)}],floor:[qt,[qt],(e,[t])=&gt;Math.floor(t.evaluate(e))],ceil:[qt,[qt],(e,[t])=&gt;Math.ceil(t.evaluate(e))],"filter-==":[ti,[He,Ze],(e,[t,i])=&gt;e.properties()[t.value]===i.value],"filter-id-==":[ti,[Ze],(e,[t])=&gt;e.id()===t.value],"filter-type-==":[ti,[He],(e,[t])=&gt;e.geometryType()===t.value],"filter-&lt;":[ti,[He,Ze],(e,[t,i])=&gt;{const r=e.properties()[t.value],n=i.value;return typeof r==typeof n&amp;&amp;r&lt;n}],"filter-id-&lt;":[ti,[Ze],(e,[t])=&gt;{const i=e.id(),r=t.value;return typeof i==typeof r&amp;&amp;i&lt;r}],"filter-&gt;":[ti,[He,Ze],(e,[t,i])=&gt;{const r=e.properties()[t.value],n=i.value;return typeof r==typeof n&amp;&amp;r&gt;n}],"filter-id-&gt;":[ti,[Ze],(e,[t])=&gt;{const i=e.id(),r=t.value;return typeof i==typeof r&amp;&amp;i&gt;r}],"filter-&lt;=":[ti,[He,Ze],(e,[t,i])=&gt;{const r=e.properties()[t.value],n=i.value;return typeof r==typeof n&amp;&amp;r&lt;=n}],"filter-id-&lt;=":[ti,[Ze],(e,[t])=&gt;{const i=e.id(),r=t.value;return typeof i==typeof r&amp;&amp;i&lt;=r}],"filter-&gt;=":[ti,[He,Ze],(e,[t,i])=&gt;{const r=e.properties()[t.value],n=i.value;return typeof r==typeof n&amp;&amp;r&gt;=n}],"filter-id-&gt;=":[ti,[Ze],(e,[t])=&gt;{const i=e.id(),r=t.value;return typeof i==typeof r&amp;&amp;i&gt;=r}],"filter-has":[ti,[Ze],(e,[t])=&gt;t.value in e.properties()],"filter-has-id":[ti,[],e=&gt;e.id()!==null&amp;&amp;e.id()!==void 0],"filter-type-in":[ti,[Zr(He)],(e,[t])=&gt;t.value.indexOf(e.geometryType())&gt;=0],"filter-id-in":[ti,[Zr(Ze)],(e,[t])=&gt;t.value.indexOf(e.id())&gt;=0],"filter-in-small":[ti,[He,Zr(Ze)],(e,[t,i])=&gt;i.value.indexOf(e.properties()[t.value])&gt;=0],"filter-in-large":[ti,[He,Zr(Ze)],(e,[t,i])=&gt;function(r,n,s,a){for(;s&lt;=a;){const l=s+a&gt;&gt;1;if(n[l]===r)return!0;n[l]&gt;r?a=l-1:s=l+1}return!1}(e.properties()[t.value],i.value,0,i.value.length-1)],all:{type:ti,overloads:[[[ti,ti],(e,[t,i])=&gt;t.evaluate(e)&amp;&amp;i.evaluate(e)],[ea(ti),(e,t)=&gt;{for(const i of t)if(!i.evaluate(e))return!1;return!0}]]},any:{type:ti,overloads:[[[ti,ti],(e,[t,i])=&gt;t.evaluate(e)||i.evaluate(e)],[ea(ti),(e,t)=&gt;{for(const i of t)if(i.evaluate(e))return!0;return!1}]]},"!":[ti,[ti],(e,[t])=&gt;!t.evaluate(e)],"is-supported-script":[ti,[He],(e,[t])=&gt;{const i=e.globals&amp;&amp;e.globals.isSupportedScript;return!i||i(t.evaluate(e))}],upcase:[He,[He],(e,[t])=&gt;t.evaluate(e).toUpperCase()],downcase:[He,[He],(e,[t])=&gt;t.evaluate(e).toLowerCase()],concat:[He,ea(Ze),(e,t)=&gt;t.map(i=&gt;rc(i.evaluate(e))).join("")],"resolved-locale":[He,[zu],(e,[t])=&gt;t.evaluate(e).resolvedLocale()],random:[qt,[qt,qt,Ze],(e,t)=&gt;{const[i,r,n]=t.map(a=&gt;a.evaluate(e));if(i&gt;r||i===r)return i;let s;if(typeof n=="string")s=function(a){let l=0;if(a.length===0)return l;for(let h=0;h&lt;a.length;h++)l=(l&lt;&lt;5)-l+a.charCodeAt(h),l&amp;=l;return l}(n);else{if(typeof n!="number")throw new _r(`Invalid seed input: ${n}`);s=n}return i+Ep(s)()*(r-i)}]});var pc=v0;function M0(e){return{result:"success",value:e}}function ia(e){return{result:"error",value:e}}function I0(e,t){return!!e&amp;&amp;!!e.parameters&amp;&amp;e.parameters.indexOf(t)&gt;-1}function ra(e){return e["property-type"]==="data-driven"}function P0(e){return I0(e.expression,"measure-light")}function Ap(e){return I0(e.expression,"zoom")}function Mp(e){return!!e.expression&amp;&amp;e.expression.interpolated}function Yu(e){return typeof e=="object"&amp;&amp;e!==null&amp;&amp;!Array.isArray(e)}function zI(e){return e}function C0(e,t){const i=t.type==="color",r=e.stops&amp;&amp;typeof e.stops[0][0]=="object",n=r||!(r||e.property!==void 0),s=e.type||(Mp(t)?"exponential":"interval");if(i&amp;&amp;((e=Fs({},e)).stops&amp;&amp;(e.stops=e.stops.map(d=&gt;[d[0],Ie.parse(d[1])])),e.default=Ie.parse(e.default?e.default:t.default)),e.colorSpace&amp;&amp;e.colorSpace!=="rgb"&amp;&amp;!m0[e.colorSpace])throw new Error(`Unknown color space: ${e.colorSpace}`);let a,l,h;if(s==="exponential")a=L0;else if(s==="interval")a=BI;else if(s==="categorical"){a=FI,l=Object.create(null);for(const d of e.stops)l[d[0]]=d[1];h=typeof e.stops[0][0]}else{if(s!=="identity")throw new Error(`Unknown function type "${s}"`);a=NI}if(r){const d={},f=[];for(let y=0;y&lt;e.stops.length;y++){const x=e.stops[y],b=x[0].zoom;d[b]===void 0&amp;&amp;(d[b]={zoom:b,type:e.type,property:e.property,default:e.default,stops:[]},f.push(b)),d[b].stops.push([x[0].value,x[1]])}const m=[];for(const y of f)m.push([d[y].zoom,C0(d[y],t)]);const _={name:"linear"};return{kind:"composite",interpolationType:_,interpolationFactor:cs.interpolationFactor.bind(void 0,_),zoomStops:m.map(y=&gt;y[0]),evaluate:({zoom:y},x)=&gt;L0({stops:m,base:e.base},t,y).evaluate(y,x)}}if(n){const d=s==="exponential"?{name:"exponential",base:e.base!==void 0?e.base:1}:null;return{kind:"camera",interpolationType:d,interpolationFactor:cs.interpolationFactor.bind(void 0,d),zoomStops:e.stops.map(f=&gt;f[0]),evaluate:({zoom:f})=&gt;a(e,t,f,l,h)}}return{kind:"source",evaluate(d,f){const m=f&amp;&amp;f.properties?f.properties[e.property]:void 0;return m===void 0?mc(e.default,t.default):a(e,t,m,l,h)}}}function mc(e,t,i){return e!==void 0?e:t!==void 0?t:i!==void 0?i:void 0}function FI(e,t,i,r,n){return mc(typeof i===n?r[i]:void 0,e.default,t.default)}function BI(e,t,i){if(ni(i)!=="number")return mc(e.default,t.default);const r=e.stops.length;if(r===1||i&lt;=e.stops[0][0])return e.stops[0][1];if(i&gt;=e.stops[r-1][0])return e.stops[r-1][1];const n=Wu(e.stops.map(s=&gt;s[0]),i);return e.stops[n][1]}function L0(e,t,i){const r=e.base!==void 0?e.base:1;if(ni(i)!=="number")return mc(e.default,t.default);const n=e.stops.length;if(n===1||i&lt;=e.stops[0][0])return e.stops[0][1];if(i&gt;=e.stops[n-1][0])return e.stops[n-1][1];const s=Wu(e.stops.map(f=&gt;f[0]),i),a=function(f,m,_,y){const x=y-_,b=f-_;return x===0?0:m===1?b/x:(Math.pow(m,b)-1)/(Math.pow(m,x)-1)}(i,r,e.stops[s][0],e.stops[s+1][0]),l=e.stops[s][1],h=e.stops[s+1][1];let d=qu[t.type]||zI;if(e.colorSpace&amp;&amp;e.colorSpace!=="rgb"){const f=m0[e.colorSpace];d=(m,_)=&gt;f.reverse(f.interpolate(f.forward(m),f.forward(_),a))}return typeof l.evaluate=="function"?{evaluate(...f){const m=l.evaluate.apply(void 0,f),_=h.evaluate.apply(void 0,f);if(m!==void 0&amp;&amp;_!==void 0)return d(m,_,a)}}:d(l,h,a)}function NI(e,t,i){return t.type==="color"?i=Ie.parse(i):t.type==="formatted"?i=Xr.fromString(i.toString()):t.type==="resolvedImage"?i=En.fromString(i.toString()):ni(i)===t.type||t.type==="enum"&amp;&amp;t.values[i]||(i=void 0),mc(i,e.default,t.default)}class Ip{constructor(t,i,r){this.expression=t,this._warningHistory={},this._evaluator=new Hy(r),this._defaultValue=i?function(n){return n.type==="color"&amp;&amp;(Yu(n.default)||Array.isArray(n.default))?new Ie(0,0,0,0):n.type==="color"?Ie.parse(n.default)||null:n.default===void 0?null:n.default}(i):null,this._enumValues=i&amp;&amp;i.type==="enum"?i.values:null}evaluateWithoutErrorHandling(t,i,r,n,s,a,l,h){return this._evaluator.globals=t,this._evaluator.feature=i,this._evaluator.featureState=r,this._evaluator.canonical=n||null,this._evaluator.availableImages=s||null,this._evaluator.formattedSection=a,this._evaluator.featureTileCoord=l||null,this._evaluator.featureDistanceData=h||null,this.expression.evaluate(this._evaluator)}evaluate(t,i,r,n,s,a,l,h){this._evaluator.globals=t,this._evaluator.feature=i||null,this._evaluator.featureState=r||null,this._evaluator.canonical=n||null,this._evaluator.availableImages=s||null,this._evaluator.formattedSection=a||null,this._evaluator.featureTileCoord=l||null,this._evaluator.featureDistanceData=h||null;try{const d=this.expression.evaluate(this._evaluator);if(d==null||typeof d=="number"&amp;&amp;d!=d)return this._defaultValue;if(this._enumValues&amp;&amp;!(d in this._enumValues))throw new _r(`Expected value to be one of ${Object.keys(this._enumValues).map(f=&gt;JSON.stringify(f)).join(", ")}, but found ${JSON.stringify(d)} instead.`);return d}catch(d){return this._warningHistory[d.message]||(this._warningHistory[d.message]=!0,typeof console&lt;"u"&amp;&amp;console.warn(d.message)),this._defaultValue}}}function Ku(e){return Array.isArray(e)&amp;&amp;e.length&gt;0&amp;&amp;typeof e[0]=="string"&amp;&amp;e[0]in pc}function fo(e,t,i){const r=new a0(pc,[],t?function(s){const a={color:Tn,string:He,number:qt,enum:He,boolean:ti,formatted:Ql,resolvedImage:tc};return s.type==="array"?Zr(a[s.value]||Ze,s.length):a[s.type]}(t):void 0,void 0,void 0,i),n=r.parse(e,void 0,void 0,void 0,t&amp;&amp;t.type==="string"?{typeAnnotation:"coerce"}:void 0);return n?M0(new Ip(n,t,i)):ia(r.errors)}class Pp{constructor(t,i,r){this.kind=t,this._styleExpression=i,this.isLightConstant=r,this.isStateDependent=t!=="constant"&amp;&amp;!hc(i.expression),this.isConfigDependent=!sp(i.expression)}evaluateWithoutErrorHandling(t,i,r,n,s,a){return this._styleExpression.evaluateWithoutErrorHandling(t,i,r,n,s,a)}evaluate(t,i,r,n,s,a){return this._styleExpression.evaluate(t,i,r,n,s,a)}}class po{constructor(t,i,r,n,s){this.kind=t,this.zoomStops=r,this._styleExpression=i,this.isStateDependent=t!=="camera"&amp;&amp;!hc(i.expression),this.isLightConstant=s,this.isConfigDependent=!sp(i.expression),this.interpolationType=n}evaluateWithoutErrorHandling(t,i,r,n,s,a){return this._styleExpression.evaluateWithoutErrorHandling(t,i,r,n,s,a)}evaluate(t,i,r,n,s,a){return this._styleExpression.evaluate(t,i,r,n,s,a)}interpolationFactor(t,i,r){return this.interpolationType?cs.interpolationFactor(this.interpolationType,t,i,r):0}}function Cp(e,t,i){if((e=fo(e,t,i)).result==="error")return e;const r=e.value.expression,n=Ga(r);if(!n&amp;&amp;!ra(t))return ia([new as("","data expressions not supported")]);const s=Ha(r,["zoom","pitch","distance-from-center"]);if(!s&amp;&amp;!Ap(t))return ia([new as("","zoom expressions not supported")]);const a=Ha(r,["measure-light"]);if(!a&amp;&amp;!P0(t))return ia([new as("","measure-light expression not supported")]);const l=t.expression&amp;&amp;t.expression.relaxZoomRestriction,h=Qu(r);return h||s||l?h instanceof as?ia([h]):h instanceof cs&amp;&amp;!Mp(t)?ia([new as("",'"interpolate" expressions cannot be used with this property')]):M0(h?new po(n?"camera":"composite",e.value,h.labels,h instanceof cs?h.interpolation:void 0,a):new Pp(n?"constant":"source",e.value,a)):ia([new as("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression, or in the properties of atmosphere.')])}class Ju{constructor(t,i){this._parameters=t,this._specification=i,Fs(this,C0(this._parameters,this._specification))}static deserialize(t){return new Ju(t._parameters,t._specification)}static serialize(t){return{_parameters:t._parameters,_specification:t._specification}}}function Qu(e){let t=null;if(e instanceof g0)t=Qu(e.result);else if(e instanceof _0){for(const i of e.args)if(t=Qu(i),t)break}else(e instanceof up||e instanceof cs)&amp;&amp;e.input instanceof ls&amp;&amp;e.input.name==="zoom"&amp;&amp;(t=e);return t instanceof as||e.eachChild(i=&gt;{const r=Qu(i);r instanceof as?t=r:t&amp;&amp;r&amp;&amp;t!==r&amp;&amp;(t=new as("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),t}function Sn(e){const t=e.key,i=e.value,r=e.valueSpec||{},n=e.objectElementValidators||{},s=e.style,a=e.styleSpec;let l=[];const h=ni(i);if(h!=="object")return[new Yt(t,i,`object expected, ${h} found`)];for(const d in i){const f=d.split(".")[0];let m;n[f]?m=n[f]:r[f]?m=xr:n["*"]?m=n["*"]:r["*"]&amp;&amp;(m=xr),m?l=l.concat(m({key:(t&amp;&amp;`${t}.`)+d,value:i[d],valueSpec:r[f]||r["*"],style:s,styleSpec:a,object:i,objectKey:d},i)):l.push(new Ko(t,i[d],`unknown property "${d}"`))}for(const d in r)n[d]||r[d].required&amp;&amp;r[d].default===void 0&amp;&amp;i[d]===void 0&amp;&amp;l.push(new Yt(t,i,`missing required property "${d}"`));return l}function R0(e){const t=e.value,i=e.valueSpec,r=e.style,n=e.styleSpec,s=e.key,a=e.arrayElementValidator||xr;if(ni(t)!=="array")return[new Yt(s,t,`array expected, ${ni(t)} found`)];if(i.length&amp;&amp;t.length!==i.length)return[new Yt(s,t,`array length ${i.length} expected, length ${t.length} found`)];if(i["min-length"]&amp;&amp;t.length&lt;i["min-length"])return[new Yt(s,t,`array length at least ${i["min-length"]} expected, length ${t.length} found`)];let l={type:i.value,values:i.values,minimum:i.minimum,maximum:i.maximum,function:void 0};n.$version&lt;7&amp;&amp;(l.function=i.function),ni(i.value)==="object"&amp;&amp;(l=i.value);let h=[];for(let d=0;d&lt;t.length;d++)h=h.concat(a({array:t,arrayIndex:d,value:t[d],valueSpec:l,style:r,styleSpec:n,key:`${s}[${d}]`},!0));return h}function D0(e){const t=e.key,i=e.value,r=e.valueSpec;let n=ni(i);if(n==="number"&amp;&amp;i!=i&amp;&amp;(n="NaN"),n!=="number")return[new Yt(t,i,`number expected, ${n} found`)];if("minimum"in r){let s=r.minimum;if(ni(r.minimum)==="array"&amp;&amp;(s=r.minimum[e.arrayIndex]),i&lt;s)return[new Yt(t,i,`${i} is less than the minimum value ${s}`)]}if("maximum"in r){let s=r.maximum;if(ni(r.maximum)==="array"&amp;&amp;(s=r.maximum[e.arrayIndex]),i&gt;s)return[new Yt(t,i,`${i} is greater than the maximum value ${s}`)]}return[]}function O0(e){const t=e.valueSpec,i=tr(e.value.type);let r,n,s,a={};const l=i!=="categorical"&amp;&amp;e.value.property===void 0,h=!l,d=ni(e.value.stops)==="array"&amp;&amp;ni(e.value.stops[0])==="array"&amp;&amp;ni(e.value.stops[0][0])==="object",f=Sn({key:e.key,value:e.value,valueSpec:e.styleSpec.function,style:e.style,styleSpec:e.styleSpec,objectElementValidators:{stops:function(y){if(i==="identity")return[new Yt(y.key,y.value,'identity function may not have a "stops" property')];let x=[];const b=y.value;return x=x.concat(R0({key:y.key,value:b,valueSpec:y.valueSpec,style:y.style,styleSpec:y.styleSpec,arrayElementValidator:m})),ni(b)==="array"&amp;&amp;b.length===0&amp;&amp;x.push(new Yt(y.key,b,"array must have at least one stop")),x},default:function(y){return xr({key:y.key,value:y.value,valueSpec:t,style:y.style,styleSpec:y.styleSpec})}}});return i==="identity"&amp;&amp;l&amp;&amp;f.push(new Yt(e.key,e.value,'missing required property "property"')),i==="identity"||e.value.stops||f.push(new Yt(e.key,e.value,'missing required property "stops"')),i==="exponential"&amp;&amp;e.valueSpec.expression&amp;&amp;!Mp(e.valueSpec)&amp;&amp;f.push(new Yt(e.key,e.value,"exponential functions not supported")),e.styleSpec.$version&gt;=8&amp;&amp;(h&amp;&amp;!ra(e.valueSpec)?f.push(new Yt(e.key,e.value,"property functions not supported")):l&amp;&amp;!Ap(e.valueSpec)&amp;&amp;f.push(new Yt(e.key,e.value,"zoom functions not supported"))),i!=="categorical"&amp;&amp;!d||e.value.property!==void 0||f.push(new Yt(e.key,e.value,'"property" property is required')),f;function m(y){let x=[];const b=y.value,w=y.key;if(ni(b)!=="array")return[new Yt(w,b,`array expected, ${ni(b)} found`)];if(b.length!==2)return[new Yt(w,b,`array length 2 expected, length ${b.length} found`)];if(d){if(ni(b[0])!=="object")return[new Yt(w,b,`object expected, ${ni(b[0])} found`)];if(b[0].zoom===void 0)return[new Yt(w,b,"object stop key must have zoom")];if(b[0].value===void 0)return[new Yt(w,b,"object stop key must have value")];const T=tr(b[0].zoom);if(typeof T!="number")return[new Yt(w,b[0].zoom,"stop zoom values must be numbers")];if(s&amp;&amp;s&gt;T)return[new Yt(w,b[0].zoom,"stop zoom values must appear in ascending order")];T!==s&amp;&amp;(s=T,n=void 0,a={}),x=x.concat(Sn({key:`${w}[0]`,value:b[0],valueSpec:{zoom:{}},style:y.style,styleSpec:y.styleSpec,objectElementValidators:{zoom:D0,value:_}}))}else x=x.concat(_({key:`${w}[0]`,value:b[0],valueSpec:{},style:y.style,styleSpec:y.styleSpec},b));return Ku(Bs(b[1]))?x.concat([new Yt(`${w}[1]`,b[1],"expressions are not allowed in function stops.")]):x.concat(xr({key:`${w}[1]`,value:b[1],valueSpec:t,style:y.style,styleSpec:y.styleSpec}))}function _(y,x){const b=ni(y.value),w=tr(y.value),T=y.value!==null?y.value:x;if(r){if(b!==r)return[new Yt(y.key,T,`${b} stop domain type must match previous stop domain type ${r}`)]}else r=b;if(b!=="number"&amp;&amp;b!=="string"&amp;&amp;b!=="boolean"&amp;&amp;typeof w!="number"&amp;&amp;typeof w!="string"&amp;&amp;typeof w!="boolean")return[new Yt(y.key,T,"stop domain value must be a number, string, or boolean")];if(b!=="number"&amp;&amp;i!=="categorical"){let S=`number expected, ${b} found`;return ra(t)&amp;&amp;i===void 0&amp;&amp;(S+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new Yt(y.key,T,S)]}return i!=="categorical"||b!=="number"||typeof w=="number"&amp;&amp;isFinite(w)&amp;&amp;Math.floor(w)===w?i!=="categorical"&amp;&amp;b==="number"&amp;&amp;typeof w=="number"&amp;&amp;typeof n=="number"&amp;&amp;n!==void 0&amp;&amp;w&lt;n?[new Yt(y.key,T,"stop domain values must appear in ascending order")]:(n=w,i==="categorical"&amp;&amp;w in a?[new Yt(y.key,T,"stop domain values must be unique")]:(a[w]=!0,[])):[new Yt(y.key,T,`integer expected, found ${String(w)}`)]}}function na(e){const t=(e.expressionContext==="property"?Cp:fo)(Bs(e.value),e.valueSpec);if(t.result==="error")return t.value.map(r=&gt;new Yt(`${e.key}${r.key}`,e.value,r.message));const i=t.value.expression||t.value._styleExpression.expression;if(e.expressionContext==="property"&amp;&amp;e.propertyKey==="text-font"&amp;&amp;!i.outputDefined())return[new Yt(e.key,e.value,`Invalid data expression for "${e.propertyKey}". Output values must be contained as literals within the expression.`)];if(e.expressionContext==="property"&amp;&amp;e.propertyType==="layout"&amp;&amp;!hc(i))return[new Yt(e.key,e.value,'"feature-state" data expressions are not supported with layout properties.')];if(e.expressionContext==="filter")return k0(i,e);if(e.expressionContext&amp;&amp;e.expressionContext.indexOf("cluster")===0){if(!Ha(i,["zoom","feature-state"]))return[new Yt(e.key,e.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(e.expressionContext==="cluster-initial"&amp;&amp;!Ga(i))return[new Yt(e.key,e.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function k0(e,t){const i=new Set(["zoom","feature-state","pitch","distance-from-center"]);if(t.valueSpec&amp;&amp;t.valueSpec.expression)for(const n of t.valueSpec.expression.parameters)i.delete(n);if(i.size===0)return[];const r=[];return e instanceof ls&amp;&amp;i.has(e.name)?[new Yt(t.key,t.value,`["${e.name}"] expression is not supported in a filter for a ${t.object.type} layer with id: ${t.object.id}`)]:(e.eachChild(n=&gt;{r.push(...k0(n,t))}),r)}function th(e){const t=e.key,i=e.value,r=e.valueSpec,n=[];return Array.isArray(r.values)?r.values.indexOf(tr(i))===-1&amp;&amp;n.push(new Yt(t,i,`expected one of [${r.values.join(", ")}], ${JSON.stringify(i)} found`)):Object.keys(r.values).indexOf(tr(i))===-1&amp;&amp;n.push(new Yt(t,i,`expected one of [${Object.keys(r.values).join(", ")}], ${JSON.stringify(i)} found`)),n}function Lp(e){if(e===!0||e===!1)return!0;if(!Array.isArray(e)||e.length===0)return!1;switch(e[0]){case"has":return e.length&gt;=2&amp;&amp;e[1]!=="$id"&amp;&amp;e[1]!=="$type";case"in":return e.length&gt;=3&amp;&amp;(typeof e[1]!="string"||Array.isArray(e[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case"&gt;":case"&gt;=":case"&lt;":case"&lt;=":return e.length!==3||Array.isArray(e[1])||Array.isArray(e[2]);case"any":case"all":for(const t of e.slice(1))if(!Lp(t)&amp;&amp;typeof t!="boolean")return!1;return!0;default:return!0}}function eh(e,t="fill"){if(e==null)return{filter:()=&gt;!0,needGeometry:!1,needFeature:!1};Lp(e)||(e=ih(e));const i=e;let r=!0;try{r=function(d){if(!Za(d))return d;let f=Bs(d);return F0(f),f=z0(f),f}(i)}catch{console.warn(`Failed to extract static filter. Filter will continue working, but at higher memory usage and slower framerate.
This is most likely a bug, please report this via https://github.com/mapbox/mapbox-gl-js/issues/new?assignees=&amp;labels=&amp;template=Bug_report.md
and paste the contents of this message in the report.
Thank you!
Filter Expression:
${JSON.stringify(i,null,2)}
        `)}const n=st[`filter_${t}`],s=fo(r,n);let a=null;if(s.result==="error")throw new Error(s.value.map(d=&gt;`${d.key}: ${d.message}`).join(", "));a=(d,f,m)=&gt;s.value.evaluate(d,f,{},m);let l=null,h=null;if(r!==i){const d=fo(i,n);if(d.result==="error")throw new Error(d.value.map(f=&gt;`${f.key}: ${f.message}`).join(", "));l=(f,m,_,y,x)=&gt;d.value.evaluate(f,m,{},_,void 0,void 0,y,x),h=!Ga(d.value.expression)}return{filter:a,dynamicFilter:l||void 0,needGeometry:B0(r),needFeature:!!h}}function z0(e){if(!Array.isArray(e))return e;const t=function(i){if(UI.has(i[0])){for(let r=1;r&lt;i.length;r++)if(Za(i[r]))return!0}return i}(e);return t===!0?t:t.map(i=&gt;z0(i))}function F0(e){let t=!1;const i=[];if(e[0]==="case"){for(let r=1;r&lt;e.length-1;r+=2)t=t||Za(e[r]),i.push(e[r+1]);i.push(e[e.length-1])}else if(e[0]==="match"){t=t||Za(e[1]);for(let r=2;r&lt;e.length-1;r+=2)i.push(e[r+1]);i.push(e[e.length-1])}else if(e[0]==="step"){t=t||Za(e[1]);for(let r=1;r&lt;e.length-1;r+=2)i.push(e[r+1])}t&amp;&amp;(e.length=0,e.push("any",...i));for(let r=1;r&lt;e.length;r++)F0(e[r])}function Za(e){if(!Array.isArray(e))return!1;if((t=e[0])==="pitch"||t==="distance-from-center")return!0;var t;for(let i=1;i&lt;e.length;i++)if(Za(e[i]))return!0;return!1}const UI=new Set(["in","==","!=","&gt;","&gt;=","&lt;","&lt;=","to-boolean"]);function VI(e,t){return e&lt;t?-1:e&gt;t?1:0}function B0(e){if(!Array.isArray(e))return!1;if(e[0]==="within"||e[0]==="distance")return!0;for(let t=1;t&lt;e.length;t++)if(B0(e[t]))return!0;return!1}function ih(e){if(!e)return!0;const t=e[0];return e.length&lt;=1?t!=="any":t==="=="?Rp(e[1],e[2],"=="):t==="!="?rh(Rp(e[1],e[2],"==")):t==="&lt;"||t==="&gt;"||t==="&lt;="||t==="&gt;="?Rp(e[1],e[2],t):t==="any"?(i=e.slice(1),["any"].concat(i.map(ih))):t==="all"?["all"].concat(e.slice(1).map(ih)):t==="none"?["all"].concat(e.slice(1).map(ih).map(rh)):t==="in"?N0(e[1],e.slice(2)):t==="!in"?rh(N0(e[1],e.slice(2))):t==="has"?U0(e[1]):t!=="!has"||rh(U0(e[1]));var i}function Rp(e,t,i){switch(e){case"$type":return[`filter-type-${i}`,t];case"$id":return[`filter-id-${i}`,t];default:return[`filter-${i}`,e,t]}}function N0(e,t){if(t.length===0)return!1;switch(e){case"$type":return["filter-type-in",["literal",t]];case"$id":return["filter-id-in",["literal",t]];default:return t.length&gt;200&amp;&amp;!t.some(i=&gt;typeof i!=typeof t[0])?["filter-in-large",e,["literal",t.sort(VI)]]:["filter-in-small",e,["literal",t]]}}function U0(e){switch(e){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",e]}}function rh(e){return["!",e]}function Dp(e){return Lp(Bs(e.value))?na(Fs({},e,{expressionContext:"filter",valueSpec:e.styleSpec[`filter_${e.layerType||"fill"}`]})):V0(e)}function V0(e){const t=e.value,i=e.key;if(ni(t)!=="array")return[new Yt(i,t,`array expected, ${ni(t)} found`)];const r=e.styleSpec;let n,s=[];if(t.length&lt;1)return[new Yt(i,t,"filter array must have at least 1 element")];switch(s=s.concat(th({key:`${i}[0]`,value:t[0],valueSpec:r.filter_operator,style:e.style,styleSpec:e.styleSpec})),tr(t[0])){case"&lt;":case"&lt;=":case"&gt;":case"&gt;=":t.length&gt;=2&amp;&amp;tr(t[1])==="$type"&amp;&amp;s.push(new Yt(i,t,`"$type" cannot be use with operator "${t[0]}"`));case"==":case"!=":t.length!==3&amp;&amp;s.push(new Yt(i,t,`filter array for operator "${t[0]}" must have 3 elements`));case"in":case"!in":t.length&gt;=2&amp;&amp;(n=ni(t[1]),n!=="string"&amp;&amp;s.push(new Yt(`${i}[1]`,t[1],`string expected, ${n} found`)));for(let a=2;a&lt;t.length;a++)n=ni(t[a]),tr(t[1])==="$type"?s=s.concat(th({key:`${i}[${a}]`,value:t[a],valueSpec:r.geometry_type,style:e.style,styleSpec:e.styleSpec})):n!=="string"&amp;&amp;n!=="number"&amp;&amp;n!=="boolean"&amp;&amp;s.push(new Yt(`${i}[${a}]`,t[a],`string, number, or boolean expected, ${n} found`));break;case"any":case"all":case"none":for(let a=1;a&lt;t.length;a++)s=s.concat(V0({key:`${i}[${a}]`,value:t[a],style:e.style,styleSpec:e.styleSpec}));break;case"has":case"!has":n=ni(t[1]),t.length!==2?s.push(new Yt(i,t,`filter array for "${t[0]}" operator must have 2 elements`)):n!=="string"&amp;&amp;s.push(new Yt(`${i}[1]`,t[1],`string expected, ${n} found`))}return s}function j0(e,t){const i=e.key,r=e.style,n=e.layer,s=e.styleSpec,a=e.value,l=e.objectKey,h=s[`${t}_${e.layerType}`];if(!h)return[];const d=l.match(/^(.*)-transition$/);if(t==="paint"&amp;&amp;d&amp;&amp;h[d[1]]&amp;&amp;h[d[1]].transition)return xr({key:i,value:a,valueSpec:s.transition,style:r,styleSpec:s});const f=e.valueSpec||h[l];if(!f)return[new Ko(i,a,`unknown property "${l}"`)];let m;if(ni(a)==="string"&amp;&amp;ra(f)&amp;&amp;!f.tokens&amp;&amp;(m=/^{([^}]+)}$/.exec(a))){const y=`\`{ "type": "identity", "property": ${m?JSON.stringify(m[1]):'"_"'} }\``;return[new Yt(i,a,`"${l}" does not support interpolation syntax
Use an identity property function instead: ${y}.`)]}const _=[];if(e.layerType==="symbol")l!=="text-field"||!r||r.glyphs||r.imports||_.push(new Yt(i,a,'use of "text-field" requires a style "glyphs" property')),l==="text-font"&amp;&amp;Yu(Bs(a))&amp;&amp;tr(a.type)==="identity"&amp;&amp;_.push(new Yt(i,a,'"text-font" does not support identity functions'));else if(e.layerType==="model"&amp;&amp;t==="paint"&amp;&amp;n&amp;&amp;n.layout&amp;&amp;n.layout.hasOwnProperty("model-id")&amp;&amp;ra(f)&amp;&amp;(P0(f)||Ap(f))){const y=Cp(Bs(a),f),x=y.value.expression||y.value._styleExpression.expression;x&amp;&amp;!Ha(x,["measure-light"])&amp;&amp;(l==="model-emissive-strength"&amp;&amp;Ga(x)&amp;&amp;hc(x)||_.push(new Yt(i,a,`${l} does not support measure-light expressions when the model layer source is vector tile or GeoJSON.`)))}return _.concat(xr({key:e.key,value:a,valueSpec:f,style:r,styleSpec:s,expressionContext:"property",propertyType:t,propertyKey:l}))}function G0(e){return j0(e,"paint")}function H0(e){return j0(e,"layout")}function W0(e){let t=[];const i=e.value,r=e.key,n=e.style,s=e.styleSpec;i.type||i.ref||t.push(new Yt(r,i,'either "type" or "ref" is required'));let a=tr(i.type);const l=tr(i.ref);if(i.id){const h=tr(i.id);for(let d=0;d&lt;e.arrayIndex;d++){const f=n.layers[d];tr(f.id)===h&amp;&amp;t.push(new Yt(r,i.id,`duplicate layer id "${i.id}", previously used at line ${f.id.__line__}`))}}if("ref"in i){let h;["type","source","source-layer","filter","layout"].forEach(d=&gt;{d in i&amp;&amp;t.push(new Yt(r,i[d],`"${d}" is prohibited for ref layers`))}),n.layers.forEach(d=&gt;{tr(d.id)===l&amp;&amp;(h=d)}),h?h.ref?t.push(new Yt(r,i.ref,"ref cannot reference another ref layer")):a=tr(h.type):typeof l=="string"&amp;&amp;t.push(new Yt(r,i.ref,`ref layer "${l}" not found`))}else if(a!=="background"&amp;&amp;a!=="sky"&amp;&amp;a!=="slot")if(i.source){const h=n.sources&amp;&amp;n.sources[i.source],d=h&amp;&amp;tr(h.type);h?d==="vector"&amp;&amp;a==="raster"?t.push(new Yt(r,i.source,`layer "${i.id}" requires a raster source`)):d==="raster"&amp;&amp;a!=="raster"?t.push(new Yt(r,i.source,`layer "${i.id}" requires a vector source`)):d!=="vector"||i["source-layer"]?d==="raster-dem"&amp;&amp;a!=="hillshade"?t.push(new Yt(r,i.source,"raster-dem source can only be used with layer type 'hillshade'.")):a!=="line"||!i.paint||!i.paint["line-gradient"]&amp;&amp;!i.paint["line-trim-offset"]||d==="geojson"&amp;&amp;h.lineMetrics||t.push(new Yt(r,i,`layer "${i.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):t.push(new Yt(r,i,`layer "${i.id}" must specify a "source-layer"`)):t.push(new Yt(r,i.source,`source "${i.source}" not found`))}else t.push(new Yt(r,i,'missing required property "source"'));return t=t.concat(Sn({key:r,value:i,valueSpec:s.layer,style:e.style,styleSpec:e.styleSpec,objectElementValidators:{"*":()=&gt;[],type:()=&gt;xr({key:`${r}.type`,value:i.type,valueSpec:s.layer.type,style:e.style,styleSpec:e.styleSpec,object:i,objectKey:"type"}),filter:h=&gt;Dp(Fs({layerType:a},h)),layout:h=&gt;Sn({layer:i,key:h.key,value:h.value,valueSpec:{},style:h.style,styleSpec:h.styleSpec,objectElementValidators:{"*":d=&gt;H0(Fs({layerType:a},d))}}),paint:h=&gt;Sn({layer:i,key:h.key,value:h.value,valueSpec:{},style:h.style,styleSpec:h.styleSpec,objectElementValidators:{"*":d=&gt;G0(Fs({layerType:a,layer:i},d))}})}})),t}function $a(e){const t=e.value,i=e.key,r=ni(t);return r!=="string"?[new Yt(i,t,`string expected, ${r} found`)]:[]}const q0={promoteId:function({key:e,value:t}){if(ni(t)==="string")return $a({key:e,value:t});{const i=[];for(const r in t)i.push(...$a({key:`${e}.${r}`,value:t[r]}));return i}}};function Z0(e){const t=e.value,i=e.key,r=e.styleSpec,n=e.style;if(!t.type)return[new Yt(i,t,'"type" is required')];const s=tr(t.type);let a=[];switch(["vector","raster","raster-dem"].includes(s)&amp;&amp;(t.url||t.tiles||a.push(new Yt(i,t,'Either "url" or "tiles" is required.'))),s){case"vector":case"raster":case"raster-dem":return a=a.concat(Sn({key:i,value:t,valueSpec:r[`source_${s.replace("-","_")}`],style:e.style,styleSpec:r,objectElementValidators:q0})),a;case"geojson":if(a=Sn({key:i,value:t,valueSpec:r.source_geojson,style:n,styleSpec:r,objectElementValidators:q0}),t.cluster)for(const l in t.clusterProperties){const[h,d]=t.clusterProperties[l],f=typeof h=="string"?[h,["accumulated"],["get",l]]:h;a.push(...na({key:`${i}.${l}.map`,value:d,expressionContext:"cluster-map"})),a.push(...na({key:`${i}.${l}.reduce`,value:f,expressionContext:"cluster-reduce"}))}return a;case"video":return Sn({key:i,value:t,valueSpec:r.source_video,style:n,styleSpec:r});case"image":return Sn({key:i,value:t,valueSpec:r.source_image,style:n,styleSpec:r});case"canvas":return[new Yt(i,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return th({key:`${i}.type`,value:t.type,valueSpec:{values:jI(r)},style:n,styleSpec:r})}}function jI(e){return e.source.reduce((t,i)=&gt;{const r=e[i];return r.type.type==="enum"&amp;&amp;(t=t.concat(Object.keys(r.type.values))),t},[])}function $0(e){const t=e.value;let i=[];if(!t)return i;const r=ni(t);return r!=="string"?(i=i.concat([new Yt(e.key,t,`string expected, "${r}" found`)]),i):(function(n){const s=n.indexOf("://")===-1;try{return new URL(n,s?"http://example.com":void 0),!0}catch{return!1}}(t)||(i=i.concat([new Yt(e.key,t,`invalid url "${t}"`)])),i)}function X0(e){const t=e.value,i=e.styleSpec,r=i.light,n=e.style;let s=[];const a=ni(t);if(t===void 0)return s;if(a!=="object")return s=s.concat([new Yt("light",t,`object expected, ${a} found`)]),s;for(const l in t){const h=l.match(/^(.*)-transition$/);s=s.concat(h&amp;&amp;r[h[1]]&amp;&amp;r[h[1]].transition?xr({key:l,value:t[l],valueSpec:i.transition,style:n,styleSpec:i}):r[l]?xr({key:l,value:t[l],valueSpec:r[l],style:n,styleSpec:i}):[new Yt(l,t[l],`unknown property "${l}"`)])}return s}function Y0(e){const t=e.value;let i=[];if(!t)return i;const r=ni(t);if(r!=="object")return i=i.concat([new Yt("light-3d",t,`object expected, ${r} found`)]),i;const n=e.styleSpec,s=n["light-3d"],a=e.key,l=e.style,h=e.style.lights;for(const m of["type","id"])if(!(m in t))return i=i.concat([new Yt("light-3d",t,`missing property ${m} on light`)]),i;if(t.type&amp;&amp;h)for(let m=0;m&lt;e.arrayIndex;m++){const _=tr(t.type),y=h[m];tr(y.type)===_&amp;&amp;i.push(new Yt(a,t.id,`duplicate light type "${t.type}", previously defined at line ${y.id.__line__}`))}const d=`properties_light_${t.type}`;if(!(d in n))return i=i.concat([new Yt("light-3d",t,`Invalid light type ${t.type}`)]),i;const f=n[d];for(const m in t)if(m==="properties"){const _=t[m],y=ni(_);if(y!=="object")return i=i.concat([new Yt("properties",_,`object expected, ${y} found`)]),i;for(const x in _)i=i.concat(f[x]?xr({key:x,value:_[x],valueSpec:f[x],style:l,styleSpec:n}):[new Ko(e.key,_[x],`unknown property "${x}"`)])}else{const _=m.match(/^(.*)-transition$/);i=i.concat(_&amp;&amp;s[_[1]]&amp;&amp;s[_[1]].transition?xr({key:m,value:t[m],valueSpec:n.transition,style:l,styleSpec:n}):s[m]?xr({key:m,value:t[m],valueSpec:s[m],style:l,styleSpec:n}):[new Ko(m,t[m],`unknown property "${m}"`)])}return i}function K0(e){const t=e.value,i=e.key,r=e.style,n=e.styleSpec,s=n.terrain;let a=[];const l=ni(t);if(t===void 0||l==="null")return a;if(l!=="object")return a=a.concat([new Yt("terrain",t,`object expected, ${l} found`)]),a;for(const h in t){const d=h.match(/^(.*)-transition$/);a=a.concat(d&amp;&amp;s[d[1]]&amp;&amp;s[d[1]].transition?xr({key:h,value:t[h],valueSpec:n.transition,style:r,styleSpec:n}):s[h]?xr({key:h,value:t[h],valueSpec:s[h],style:r,styleSpec:n}):[new Ko(h,t[h],`unknown property "${h}"`)])}if(t.source){const h=r.sources&amp;&amp;r.sources[t.source],d=h&amp;&amp;tr(h.type);h?d!=="raster-dem"&amp;&amp;a.push(new Yt(i,t.source,`terrain cannot be used with a source of type ${String(d)}, it only be used with a "raster-dem" source type`)):a.push(new Yt(i,t.source,`source "${t.source}" not found`))}else a.push(new Yt(i,t,'terrain is missing required property "source"'));return a}function J0(e){const t=e.value,i=e.style,r=e.styleSpec,n=r.fog;let s=[];const a=ni(t);if(t===void 0)return s;if(a!=="object")return s=s.concat([new Yt("fog",t,`object expected, ${a} found`)]),s;for(const l in t){const h=l.match(/^(.*)-transition$/);s=s.concat(h&amp;&amp;n[h[1]]&amp;&amp;n[h[1]].transition?xr({key:l,value:t[l],valueSpec:r.transition,style:i,styleSpec:r}):n[l]?xr({key:l,value:t[l],valueSpec:n[l],style:i,styleSpec:r}):[new Ko(l,t[l],`unknown property "${l}"`)])}return s}const Q0={"*":()=&gt;[],array:R0,boolean:function(e){const t=e.value,i=e.key,r=ni(t);return r!=="boolean"?[new Yt(i,t,`boolean expected, ${r} found`)]:[]},number:D0,color:function(e){const t=e.key,i=e.value,r=ni(i);return r!=="string"?[new Yt(t,i,`color expected, ${r} found`)]:Bf(i)===null?[new Yt(t,i,`color expected, "${i}" found`)]:[]},enum:th,filter:Dp,function:O0,layer:W0,object:Sn,source:Z0,model:$0,light:X0,"light-3d":Y0,terrain:K0,fog:J0,string:$a,formatted:function(e){return $a(e).length===0?[]:na(e)},resolvedImage:function(e){return $a(e).length===0?[]:na(e)},projection:function(e){const t=e.value,i=e.styleSpec,r=i.projection,n=e.style;let s=[];const a=ni(t);if(a==="object")for(const l in t)s=s.concat(xr({key:l,value:t[l],valueSpec:r[l],style:n,styleSpec:i}));else a!=="string"&amp;&amp;(s=s.concat([new Yt("projection",t,`object or string expected, ${a} found`)]));return s},import:function(e){const{value:t,styleSpec:i}=e,{data:r,...n}=t;Object.defineProperty(n,"__line__",{value:t.__line__,enumerable:!1});let s=Sn(Fs({},e,{value:n,valueSpec:i.import}));return tr(n.id)===""&amp;&amp;s.push(new Yt(`${e.key}.id`,n,"import id can't be an empty string")),r&amp;&amp;(s=s.concat(tx(r,i,{key:`${e.key}.data`}))),s}};function xr(e,t=!1){const i=e.value,r=e.valueSpec,n=e.styleSpec;if(r.expression&amp;&amp;Yu(tr(i)))return O0(e);if(r.expression&amp;&amp;Ku(Bs(i)))return na(e);if(r.type&amp;&amp;Q0[r.type]){const s=Q0[r.type](e);return t===!0&amp;&amp;s.length&gt;0&amp;&amp;ni(e.value)==="array"?na(e):s}return Sn(Fs({},e,{valueSpec:r.type?n[r.type]:r}))}function GI(e){const t=e.value,i=e.key,r=$a(e);return r.length||(t.indexOf("{fontstack}")===-1&amp;&amp;r.push(new Yt(i,t,'"glyphs" url must include a "{fontstack}" token')),t.indexOf("{range}")===-1&amp;&amp;r.push(new Yt(i,t,'"glyphs" url must include a "{range}" token'))),r}function tx(e,t=st,i={}){return xr({key:i.key||"",value:e,valueSpec:t.$root,styleSpec:t,style:e,objectElementValidators:{glyphs:GI,"*":()=&gt;[]}})}function Xa(e,t=st){return jn(tx(e,t))}const HI=e=&gt;jn(Z0(e)),WI=e=&gt;jn(X0(e)),qI=e=&gt;jn(Y0(e)),ZI=e=&gt;jn(K0(e)),$I=e=&gt;jn(J0(e)),XI=e=&gt;jn(W0(e)),Op=e=&gt;jn(Dp(e)),YI=e=&gt;jn(G0(e)),KI=e=&gt;jn(H0(e)),JI=e=&gt;jn($0(e));function jn(e){return e.slice().sort((t,i)=&gt;t.line&amp;&amp;i.line?t.line-i.line:0)}function nh(e,t){let i=!1;if(t&amp;&amp;t.length)for(const r of t)r instanceof Ko?tt(r.message):(e.fire(new xe(new Error(r.message))),i=!0);return i}var QI=us,mo=3;function us(e,t,i){var r=this.cells=[];if(e instanceof ArrayBuffer){this.arrayBuffer=e;var n=new Int32Array(this.arrayBuffer);e=n[0],this.d=(t=n[1])+2*(i=n[2]);for(var s=0;s&lt;this.d*this.d;s++){var a=n[mo+s],l=n[mo+s+1];r.push(a===l?null:n.subarray(a,l))}var h=n[mo+r.length+1];this.keys=n.subarray(n[mo+r.length],h),this.bboxes=n.subarray(h),this.insert=this._insertReadonly}else{this.d=t+2*i;for(var d=0;d&lt;this.d*this.d;d++)r.push([]);this.keys=[],this.bboxes=[]}this.n=t,this.extent=e,this.padding=i,this.scale=t/e,this.uid=0;var f=i/t*e;this.min=-f,this.max=e+f}us.prototype.insert=function(e,t,i,r,n){this._forEachCell(t,i,r,n,this._insertCell,this.uid++),this.keys.push(e),this.bboxes.push(t),this.bboxes.push(i),this.bboxes.push(r),this.bboxes.push(n)},us.prototype._insertReadonly=function(){throw"Cannot insert into a GridIndex created from an ArrayBuffer."},us.prototype._insertCell=function(e,t,i,r,n,s){this.cells[n].push(s)},us.prototype.query=function(e,t,i,r,n){var s=this.min,a=this.max;if(e&lt;=s&amp;&amp;t&lt;=s&amp;&amp;a&lt;=i&amp;&amp;a&lt;=r&amp;&amp;!n)return Array.prototype.slice.call(this.keys);var l=[];return this._forEachCell(e,t,i,r,this._queryCell,l,{},n),l},us.prototype._queryCell=function(e,t,i,r,n,s,a,l){var h=this.cells[n];if(h!==null)for(var d=this.keys,f=this.bboxes,m=0;m&lt;h.length;m++){var _=h[m];if(a[_]===void 0){var y=4*_;(l?l(f[y+0],f[y+1],f[y+2],f[y+3]):e&lt;=f[y+2]&amp;&amp;t&lt;=f[y+3]&amp;&amp;i&gt;=f[y+0]&amp;&amp;r&gt;=f[y+1])?(a[_]=!0,s.push(d[_])):a[_]=!1}}},us.prototype._forEachCell=function(e,t,i,r,n,s,a,l){for(var h=this._convertToCellCoord(e),d=this._convertToCellCoord(t),f=this._convertToCellCoord(i),m=this._convertToCellCoord(r),_=h;_&lt;=f;_++)for(var y=d;y&lt;=m;y++){var x=this.d*y+_;if((!l||l(this._convertFromCellCoord(_),this._convertFromCellCoord(y),this._convertFromCellCoord(_+1),this._convertFromCellCoord(y+1)))&amp;&amp;n.call(this,e,t,i,r,x,s,a,l))return}},us.prototype._convertFromCellCoord=function(e){return(e-this.padding)/this.scale},us.prototype._convertToCellCoord=function(e){return Math.max(0,Math.min(this.d-1,Math.floor(e*this.scale)+this.padding))},us.prototype.toArrayBuffer=function(){if(this.arrayBuffer)return this.arrayBuffer;for(var e=this.cells,t=mo+this.cells.length+1+1,i=0,r=0;r&lt;this.cells.length;r++)i+=this.cells[r].length;var n=new Int32Array(t+i+this.keys.length+this.bboxes.length);n[0]=this.extent,n[1]=this.n,n[2]=this.padding;for(var s=t,a=0;a&lt;e.length;a++){var l=e[a];n[mo+a]=s,n.set(l,s),s+=l.length}return n[mo+e.length]=s,n.set(this.keys,s),n[mo+e.length+1]=s+=this.keys.length,n.set(this.bboxes,s),s+=this.bboxes.length,n.buffer};var Ya=Qt(QI);const sh={};function Jt(e,t,i={}){Object.defineProperty(e,"_classRegistryKey",{value:t,writeable:!1}),sh[t]={klass:e,omit:i.omit||[]}}Jt(Object,"Object"),Ya.serialize=function(e,t){const i=e.toArrayBuffer();return t&amp;&amp;t.add(i),{buffer:i}},Ya.deserialize=function(e){return new Ya(e.buffer)},Object.defineProperty(Ya,"name",{value:"Grid"}),Jt(Ya,"Grid"),Jt(Ie,"Color"),Jt(Error,"Error"),Jt(yt,"AJAXError"),Jt(En,"ResolvedImage"),Jt(Ju,"StylePropertyFunction"),Jt(Ip,"StyleExpression",{omit:["_evaluator"]}),Jt(po,"ZoomDependentExpression"),Jt(Pp,"ZoomConstantExpression"),Jt(ls,"CompoundExpression",{omit:["_evaluate"]});for(const e in pc)sh[pc[e]._classRegistryKey]||Jt(pc[e],`Expression${e}`);function ex(e){return e&amp;&amp;typeof ArrayBuffer&lt;"u"&amp;&amp;(e instanceof ArrayBuffer||e.constructor&amp;&amp;e.constructor.name==="ArrayBuffer")}function ix(e){return L.ImageBitmap&amp;&amp;e instanceof L.ImageBitmap}function Ka(e,t){if(e==null||typeof e=="boolean"||typeof e=="number"||typeof e=="string"||e instanceof Boolean||e instanceof Number||e instanceof String||e instanceof Date||e instanceof RegExp)return e;if(ex(e)||ix(e))return t&amp;&amp;t.add(e),e;if(ArrayBuffer.isView(e)){const i=e;return t&amp;&amp;t.add(i.buffer),i}if(e instanceof L.ImageData)return t&amp;&amp;t.add(e.data.buffer),e;if(Array.isArray(e)){const i=[];for(const r of e)i.push(Ka(r,t));return i}if(e instanceof Map){const i={$name:"Map"};for(const[r,n]of e.entries())i[r]=Ka(n);return i}if(typeof e=="object"){const i=e.constructor,r=i._classRegistryKey;if(!r)throw new Error(`can't serialize object of unregistered class ${r}`);const n=i.serialize?i.serialize(e,t):{};if(!i.serialize){for(const s in e)e.hasOwnProperty(s)&amp;&amp;(sh[r].omit.indexOf(s)&gt;=0||(n[s]=Ka(e[s],t)));e instanceof Error&amp;&amp;(n.message=e.message)}if(n.$name)throw new Error("$name property is reserved for worker serialization logic.");return r!=="Object"&amp;&amp;(n.$name=r),n}throw new Error("can't serialize object of type "+typeof e)}function Ja(e){if(e==null||typeof e=="boolean"||typeof e=="number"||typeof e=="string"||e instanceof Boolean||e instanceof Number||e instanceof String||e instanceof Date||e instanceof RegExp||ex(e)||ix(e)||ArrayBuffer.isView(e)||e instanceof L.ImageData)return e;if(Array.isArray(e))return e.map(Ja);if(typeof e=="object"){const t=e.$name||"Object";if(t==="Map"){const n=new Map;for(const s of Object.keys(e))s!=="$name"&amp;&amp;n.set(s,Ja(e[s]));return n}const{klass:i}=sh[t];if(!i)throw new Error(`can't deserialize unregistered class ${t}`);if(i.deserialize)return i.deserialize(e);const r=Object.create(i.prototype);for(const n of Object.keys(e))n!=="$name"&amp;&amp;(r[n]=Ja(e[n]));return r}throw new Error("can't deserialize object of type "+typeof e)}const ee={"Latin-1 Supplement":e=&gt;e&gt;=128&amp;&amp;e&lt;=255,Arabic:e=&gt;e&gt;=1536&amp;&amp;e&lt;=1791,"Arabic Supplement":e=&gt;e&gt;=1872&amp;&amp;e&lt;=1919,"Arabic Extended-A":e=&gt;e&gt;=2208&amp;&amp;e&lt;=2303,"Hangul Jamo":e=&gt;e&gt;=4352&amp;&amp;e&lt;=4607,"Unified Canadian Aboriginal Syllabics":e=&gt;e&gt;=5120&amp;&amp;e&lt;=5759,Khmer:e=&gt;e&gt;=6016&amp;&amp;e&lt;=6143,"Unified Canadian Aboriginal Syllabics Extended":e=&gt;e&gt;=6320&amp;&amp;e&lt;=6399,"General Punctuation":e=&gt;e&gt;=8192&amp;&amp;e&lt;=8303,"Letterlike Symbols":e=&gt;e&gt;=8448&amp;&amp;e&lt;=8527,"Number Forms":e=&gt;e&gt;=8528&amp;&amp;e&lt;=8591,"Miscellaneous Technical":e=&gt;e&gt;=8960&amp;&amp;e&lt;=9215,"Control Pictures":e=&gt;e&gt;=9216&amp;&amp;e&lt;=9279,"Optical Character Recognition":e=&gt;e&gt;=9280&amp;&amp;e&lt;=9311,"Enclosed Alphanumerics":e=&gt;e&gt;=9312&amp;&amp;e&lt;=9471,"Geometric Shapes":e=&gt;e&gt;=9632&amp;&amp;e&lt;=9727,"Miscellaneous Symbols":e=&gt;e&gt;=9728&amp;&amp;e&lt;=9983,"Miscellaneous Symbols and Arrows":e=&gt;e&gt;=11008&amp;&amp;e&lt;=11263,"CJK Radicals Supplement":e=&gt;e&gt;=11904&amp;&amp;e&lt;=12031,"Kangxi Radicals":e=&gt;e&gt;=12032&amp;&amp;e&lt;=12255,"Ideographic Description Characters":e=&gt;e&gt;=12272&amp;&amp;e&lt;=12287,"CJK Symbols and Punctuation":e=&gt;e&gt;=12288&amp;&amp;e&lt;=12351,Hiragana:e=&gt;e&gt;=12352&amp;&amp;e&lt;=12447,Katakana:e=&gt;e&gt;=12448&amp;&amp;e&lt;=12543,Bopomofo:e=&gt;e&gt;=12544&amp;&amp;e&lt;=12591,"Hangul Compatibility Jamo":e=&gt;e&gt;=12592&amp;&amp;e&lt;=12687,Kanbun:e=&gt;e&gt;=12688&amp;&amp;e&lt;=12703,"Bopomofo Extended":e=&gt;e&gt;=12704&amp;&amp;e&lt;=12735,"CJK Strokes":e=&gt;e&gt;=12736&amp;&amp;e&lt;=12783,"Katakana Phonetic Extensions":e=&gt;e&gt;=12784&amp;&amp;e&lt;=12799,"Enclosed CJK Letters and Months":e=&gt;e&gt;=12800&amp;&amp;e&lt;=13055,"CJK Compatibility":e=&gt;e&gt;=13056&amp;&amp;e&lt;=13311,"CJK Unified Ideographs Extension A":e=&gt;e&gt;=13312&amp;&amp;e&lt;=19903,"Yijing Hexagram Symbols":e=&gt;e&gt;=19904&amp;&amp;e&lt;=19967,"CJK Unified Ideographs":e=&gt;e&gt;=19968&amp;&amp;e&lt;=40959,"Yi Syllables":e=&gt;e&gt;=40960&amp;&amp;e&lt;=42127,"Yi Radicals":e=&gt;e&gt;=42128&amp;&amp;e&lt;=42191,"Hangul Jamo Extended-A":e=&gt;e&gt;=43360&amp;&amp;e&lt;=43391,"Hangul Syllables":e=&gt;e&gt;=44032&amp;&amp;e&lt;=55215,"Hangul Jamo Extended-B":e=&gt;e&gt;=55216&amp;&amp;e&lt;=55295,"Private Use Area":e=&gt;e&gt;=57344&amp;&amp;e&lt;=63743,"CJK Compatibility Ideographs":e=&gt;e&gt;=63744&amp;&amp;e&lt;=64255,"Arabic Presentation Forms-A":e=&gt;e&gt;=64336&amp;&amp;e&lt;=65023,"Vertical Forms":e=&gt;e&gt;=65040&amp;&amp;e&lt;=65055,"CJK Compatibility Forms":e=&gt;e&gt;=65072&amp;&amp;e&lt;=65103,"Small Form Variants":e=&gt;e&gt;=65104&amp;&amp;e&lt;=65135,"Arabic Presentation Forms-B":e=&gt;e&gt;=65136&amp;&amp;e&lt;=65279,"Halfwidth and Fullwidth Forms":e=&gt;e&gt;=65280&amp;&amp;e&lt;=65519,"CJK Unified Ideographs Extension B":e=&gt;e&gt;=131072&amp;&amp;e&lt;=173791};function kp(e){for(const t of e)if(zp(t.charCodeAt(0)))return!0;return!1}function tP(e){for(const t of e)if(!eP(t.charCodeAt(0)))return!1;return!0}function eP(e){return!(ee.Arabic(e)||ee["Arabic Supplement"](e)||ee["Arabic Extended-A"](e)||ee["Arabic Presentation Forms-A"](e)||ee["Arabic Presentation Forms-B"](e))}function zp(e){return!(e!==746&amp;&amp;e!==747&amp;&amp;(e&lt;4352||!(ee["Bopomofo Extended"](e)||ee.Bopomofo(e)||ee["CJK Compatibility Forms"](e)&amp;&amp;!(e&gt;=65097&amp;&amp;e&lt;=65103)||ee["CJK Compatibility Ideographs"](e)||ee["CJK Compatibility"](e)||ee["CJK Radicals Supplement"](e)||ee["CJK Strokes"](e)||!(!ee["CJK Symbols and Punctuation"](e)||e&gt;=12296&amp;&amp;e&lt;=12305||e&gt;=12308&amp;&amp;e&lt;=12319||e===12336)||ee["CJK Unified Ideographs Extension A"](e)||ee["CJK Unified Ideographs"](e)||ee["Enclosed CJK Letters and Months"](e)||ee["Hangul Compatibility Jamo"](e)||ee["Hangul Jamo Extended-A"](e)||ee["Hangul Jamo Extended-B"](e)||ee["Hangul Jamo"](e)||ee["Hangul Syllables"](e)||ee.Hiragana(e)||ee["Ideographic Description Characters"](e)||ee.Kanbun(e)||ee["Kangxi Radicals"](e)||ee["Katakana Phonetic Extensions"](e)||ee.Katakana(e)&amp;&amp;e!==12540||!(!ee["Halfwidth and Fullwidth Forms"](e)||e===65288||e===65289||e===65293||e&gt;=65306&amp;&amp;e&lt;=65310||e===65339||e===65341||e===65343||e&gt;=65371&amp;&amp;e&lt;=65503||e===65507||e&gt;=65512&amp;&amp;e&lt;=65519)||!(!ee["Small Form Variants"](e)||e&gt;=65112&amp;&amp;e&lt;=65118||e&gt;=65123&amp;&amp;e&lt;=65126)||ee["Unified Canadian Aboriginal Syllabics"](e)||ee["Unified Canadian Aboriginal Syllabics Extended"](e)||ee["Vertical Forms"](e)||ee["Yijing Hexagram Symbols"](e)||ee["Yi Syllables"](e)||ee["Yi Radicals"](e))))}function rx(e){return!(zp(e)||function(t){return!!(ee["Latin-1 Supplement"](t)&amp;&amp;(t===167||t===169||t===174||t===177||t===188||t===189||t===190||t===215||t===247)||ee["General Punctuation"](t)&amp;&amp;(t===8214||t===8224||t===8225||t===8240||t===8241||t===8251||t===8252||t===8258||t===8263||t===8264||t===8265||t===8273)||ee["Letterlike Symbols"](t)||ee["Number Forms"](t)||ee["Miscellaneous Technical"](t)&amp;&amp;(t&gt;=8960&amp;&amp;t&lt;=8967||t&gt;=8972&amp;&amp;t&lt;=8991||t&gt;=8996&amp;&amp;t&lt;=9e3||t===9003||t&gt;=9085&amp;&amp;t&lt;=9114||t&gt;=9150&amp;&amp;t&lt;=9165||t===9167||t&gt;=9169&amp;&amp;t&lt;=9179||t&gt;=9186&amp;&amp;t&lt;=9215)||ee["Control Pictures"](t)&amp;&amp;t!==9251||ee["Optical Character Recognition"](t)||ee["Enclosed Alphanumerics"](t)||ee["Geometric Shapes"](t)||ee["Miscellaneous Symbols"](t)&amp;&amp;!(t&gt;=9754&amp;&amp;t&lt;=9759)||ee["Miscellaneous Symbols and Arrows"](t)&amp;&amp;(t&gt;=11026&amp;&amp;t&lt;=11055||t&gt;=11088&amp;&amp;t&lt;=11097||t&gt;=11192&amp;&amp;t&lt;=11243)||ee["CJK Symbols and Punctuation"](t)||ee.Katakana(t)||ee["Private Use Area"](t)||ee["CJK Compatibility Forms"](t)||ee["Small Form Variants"](t)||ee["Halfwidth and Fullwidth Forms"](t)||t===8734||t===8756||t===8757||t&gt;=9984&amp;&amp;t&lt;=10087||t&gt;=10102&amp;&amp;t&lt;=10131||t===65532||t===65533)}(e))}function nx(e){return e&gt;=1424&amp;&amp;e&lt;=2303||ee["Arabic Presentation Forms-A"](e)||ee["Arabic Presentation Forms-B"](e)}function iP(e,t){return!(!t&amp;&amp;nx(e)||e&gt;=2304&amp;&amp;e&lt;=3583||e&gt;=3840&amp;&amp;e&lt;=4255||ee.Khmer(e))}function rP(e){for(const t of e)if(nx(t.charCodeAt(0)))return!0;return!1}const Fp="deferred",Bp="loading",Np="loaded";let Up=null,Yr="unavailable",_o=null;const sx=function(e){e&amp;&amp;typeof e=="string"&amp;&amp;e.indexOf("NetworkError")&gt;-1&amp;&amp;(Yr="error"),Up&amp;&amp;Up(e)};function Vp(){jp.fire(new It("pluginStateChange",{pluginStatus:Yr,pluginURL:_o}))}const jp=new Zi,Gp=function(){return Yr},ox=function(){if(Yr!==Fp||!_o)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");Yr=Bp,Vp(),_o&amp;&amp;zt({url:_o},e=&gt;{e?sx(e):(Yr=Np,Vp())})},An={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=&gt;Yr===Np||An.applyArabicShaping!=null,isLoading:()=&gt;Yr===Bp,setState(e){Yr=e.pluginStatus,_o=e.pluginURL},isParsed:()=&gt;An.applyArabicShaping!=null&amp;&amp;An.processBidirectionalText!=null&amp;&amp;An.processStyledBidirectionalText!=null,getPluginURL:()=&gt;_o};class Si{constructor(t,i){this.zoom=t,i?(this.now=i.now,this.fadeDuration=i.fadeDuration,this.transition=i.transition,this.pitch=i.pitch,this.brightness=i.brightness):(this.now=0,this.fadeDuration=0,this.transition={},this.pitch=0,this.brightness=0)}isSupportedScript(t){return function(i,r){for(const n of i)if(!iP(n.charCodeAt(0),r))return!1;return!0}(t,An.isLoaded())}}class oh{constructor(t,i,r){this.property=t,this.value=i,this.expression=function(n,s,a){if(Yu(n))return new Ju(n,s);if(Ku(n)||Array.isArray(n)&amp;&amp;n.length&gt;0){const l=Cp(n,s,a);if(l.result==="error")throw new Error(l.value.map(h=&gt;`${h.key}: ${h.message}`).join(", "));return l.value}{let l=n;return typeof n=="string"&amp;&amp;s.type==="color"&amp;&amp;(l=Ie.parse(n)),{kind:"constant",isConfigDependent:!1,evaluate:()=&gt;l}}}(i===void 0?t.specification.default:i,t.specification,r)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(t,i,r){return this.property.possiblyEvaluate(this,t,i,r)}}class Hp{constructor(t,i){this.property=t,this.value=new oh(t,void 0,i)}transitioned(t,i){return new ax(this.property,this.value,i,Bt({},t.transition,this.transition),t.now)}untransitioned(){return new ax(this.property,this.value,null,{},0)}}class _c{constructor(t,i){this._properties=t,this._values=Object.create(t.defaultTransitionablePropertyValues),this._options=i,this.isConfigDependent=!1}getValue(t){return V(this._values[t].value.value)}setValue(t,i){this._values.hasOwnProperty(t)||(this._values[t]=new Hp(this._values[t].property,this._options)),this._values[t].value=new oh(this._values[t].property,i===null?void 0:V(i),this._options),this.isConfigDependent=this.isConfigDependent||this._values[t].value.expression.isConfigDependent}setTransitionOrValue(t,i){i&amp;&amp;(this._options=i);const r=this._properties.properties;if(t)for(const n in t){const s=t[n];if(vn(n,"-transition")){const a=n.slice(0,-11);r[a]&amp;&amp;this.setTransition(a,s)}else r[n]&amp;&amp;this.setValue(n,s)}}getTransition(t){return V(this._values[t].transition)}setTransition(t,i){this._values.hasOwnProperty(t)||(this._values[t]=new Hp(this._values[t].property)),this._values[t].transition=V(i)||void 0}serialize(){const t={};for(const i of Object.keys(this._values)){const r=this.getValue(i);r!==void 0&amp;&amp;(t[i]=r);const n=this.getTransition(i);n!==void 0&amp;&amp;(t[`${i}-transition`]=n)}return t}transitioned(t,i){const r=new lx(this._properties);for(const n of Object.keys(this._values))r._values[n]=this._values[n].transitioned(t,i._values[n]);return r}untransitioned(){const t=new lx(this._properties);for(const i of Object.keys(this._values))t._values[i]=this._values[i].untransitioned();return t}}class ax{constructor(t,i,r,n,s){const a=n.delay||0,l=n.duration||0;s=s||0,this.property=t,this.value=i,this.begin=s+a,this.end=this.begin+l,t.specification.transition&amp;&amp;(n.delay||n.duration)&amp;&amp;(this.prior=r)}possiblyEvaluate(t,i,r){const n=t.now||0,s=this.value.possiblyEvaluate(t,i,r),a=this.prior;if(a){if(n&gt;this.end)return this.prior=null,s;if(this.value.isDataDriven())return this.prior=null,s;if(n&lt;this.begin)return a.possiblyEvaluate(t,i,r);{const l=(n-this.begin)/(this.end-this.begin);return this.property.interpolate(a.possiblyEvaluate(t,i,r),s,jr(l))}}return s}}class lx{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitioningPropertyValues)}possiblyEvaluate(t,i,r){const n=new gc(this._properties);for(const s of Object.keys(this._values))n._values[s]=this._values[s].possiblyEvaluate(t,i,r);return n}hasTransition(){for(const t of Object.keys(this._values))if(this._values[t].prior)return!0;return!1}}class nP{constructor(t,i){this._properties=t,this._values=Object.create(t.defaultPropertyValues),this._options=i,this.isConfigDependent=!1}getValue(t){return V(this._values[t].value)}setValue(t,i){this._values[t]=new oh(this._values[t].property,i===null?void 0:V(i),this._options),this.isConfigDependent=this.isConfigDependent||this._values[t].expression.isConfigDependent}serialize(){const t={};for(const i of Object.keys(this._values)){const r=this.getValue(i);r!==void 0&amp;&amp;(t[i]=r)}return t}possiblyEvaluate(t,i,r){const n=new gc(this._properties);for(const s of Object.keys(this._values))n._values[s]=this._values[s].possiblyEvaluate(t,i,r);return n}}class Qa{constructor(t,i,r){this.property=t,this.value=i,this.parameters=r}isConstant(){return this.value.kind==="constant"}constantOr(t){return this.value.kind==="constant"?this.value.value:t}evaluate(t,i,r,n){return this.property.evaluate(this.value,this.parameters,t,i,r,n)}}class gc{constructor(t){this._properties=t,this._values=Object.create(t.defaultPossiblyEvaluatedValues)}get(t){return this._values[t]}}class At{constructor(t){this.specification=t}possiblyEvaluate(t,i){return t.expression.evaluate(i)}interpolate(t,i,r){const n=qu[this.specification.type];return n?n(t,i,r):t}}class ne{constructor(t,i){this.specification=t,this.overrides=i}possiblyEvaluate(t,i,r,n){return new Qa(this,t.expression.kind==="constant"||t.expression.kind==="camera"?{kind:"constant",value:t.expression.evaluate(i,null,{},r,n)}:t.expression,i)}interpolate(t,i,r){if(t.value.kind!=="constant"||i.value.kind!=="constant")return t;if(t.value.value===void 0||i.value.value===void 0)return new Qa(this,{kind:"constant",value:void 0},t.parameters);const n=qu[this.specification.type];return n?new Qa(this,{kind:"constant",value:n(t.value.value,i.value.value,r)},t.parameters):t}evaluate(t,i,r,n,s,a){return t.kind==="constant"?t.value:t.evaluate(i,r,n,s,a)}}class yc{constructor(t){this.specification=t}possiblyEvaluate(t,i,r,n){return!!t.expression.evaluate(i,null,{},r,n)}interpolate(){return!1}}class Di{constructor(t){this.properties=t,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];const i=new Si(0,{});for(const r in t){const n=t[r];n.specification.overridable&amp;&amp;this.overridableProperties.push(r);const s=this.defaultPropertyValues[r]=new oh(n,void 0),a=this.defaultTransitionablePropertyValues[r]=new Hp(n);this.defaultTransitioningPropertyValues[r]=a.untransitioned(),this.defaultPossiblyEvaluatedValues[r]=s.possiblyEvaluate(i)}}}Jt(ne,"DataDrivenProperty"),Jt(At,"DataConstantProperty"),Jt(yc,"ColorRampProperty");const ah="";function cx(e){return e.indexOf(ah)&gt;=0}function Mr(e,t){return t?`${e}${ah}${t}`:e}function lh(e){const t=e.indexOf(ah);return t&gt;=0?e.slice(0,t):e}const ux="-transition";class hn extends Zi{constructor(t,i,r){if(super(),this.id=t.id,this.type=t.type,this._featureFilter={filter:()=&gt;!0,needGeometry:!1,needFeature:!1},this._filterCompiled=!1,this.isConfigDependent=!1,t.type!=="custom"&amp;&amp;(this.metadata=t.metadata,this.minzoom=t.minzoom,this.maxzoom=t.maxzoom,t.type!=="background"&amp;&amp;t.type!=="sky"&amp;&amp;t.type!=="slot"&amp;&amp;(this.source=t.source,this.sourceLayer=t["source-layer"],this.filter=t.filter),this.options=r,t.slot&amp;&amp;(this.slot=t.slot),i.layout&amp;&amp;(this._unevaluatedLayout=new nP(i.layout,r),this.isConfigDependent=this.isConfigDependent||this._unevaluatedLayout.isConfigDependent),i.paint)){this._transitionablePaint=new _c(i.paint,r);for(const n in t.paint)this.setPaintProperty(n,t.paint[n],{validate:!1});for(const n in t.layout)this.setLayoutProperty(n,t.layout[n],{validate:!1});this.isConfigDependent=this.isConfigDependent||this._transitionablePaint.isConfigDependent,this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new gc(i.paint)}}setScope(t){this.scope=t,this.fqid=Mr(this.id,t)}getLayoutProperty(t){return t==="visibility"?this.visibility:this._unevaluatedLayout.getValue(t)}setLayoutProperty(t,i,r={}){if(i!=null&amp;&amp;this._validate(KI,`layers.${this.id}.layout.${t}`,t,i,r))return;if(this.type==="custom"&amp;&amp;t==="visibility")return void(this.visibility=i);const n=this._unevaluatedLayout;n._properties.properties[t]&amp;&amp;(n.setValue(t,i),this.isConfigDependent=this.isConfigDependent||n.isConfigDependent,t==="visibility"&amp;&amp;this.possiblyEvaluateVisibility())}possiblyEvaluateVisibility(){this.visibility=this._unevaluatedLayout._values.visibility.possiblyEvaluate({zoom:0})}getPaintProperty(t){return vn(t,ux)?this._transitionablePaint.getTransition(t.slice(0,-11)):this._transitionablePaint.getValue(t)}setPaintProperty(t,i,r={}){if(i!=null&amp;&amp;this._validate(YI,`layers.${this.id}.paint.${t}`,t,i,r))return!1;const n=this._transitionablePaint,s=n._properties.properties;if(vn(t,ux)){const _=t.slice(0,-11);return s[_]&amp;&amp;n.setTransition(_,i||void 0),!1}if(!s[t])return!1;const a=n._values[t],l=a.value.isDataDriven(),h=a.value;n.setValue(t,i),this.isConfigDependent=this.isConfigDependent||n.isConfigDependent,this._handleSpecialPaintPropertyUpdate(t);const d=n._values[t].value,f=d.isDataDriven(),m=vn(t,"pattern")||t==="line-dasharray";return f||l||m||this._handleOverridablePaintPropertyUpdate(t,h,d)}_handleSpecialPaintPropertyUpdate(t){}getProgramIds(){return null}getDefaultProgramParams(t,i){return null}_handleOverridablePaintPropertyUpdate(t,i,r){return!1}isHidden(t){return!!(this.minzoom&amp;&amp;t&lt;this.minzoom)||!!(this.maxzoom&amp;&amp;t&gt;=this.maxzoom)||this.visibility==="none"}updateTransitions(t){this._transitioningPaint=this._transitionablePaint.transitioned(t,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(t,i){this._unevaluatedLayout&amp;&amp;(this.layout=this._unevaluatedLayout.possiblyEvaluate(t,void 0,i)),this.paint=this._transitioningPaint.possiblyEvaluate(t,void 0,i)}serialize(){return Mt({id:this.id,type:this.type,slot:this.slot,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&amp;&amp;this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&amp;&amp;this._transitionablePaint.serialize()},(t,i)=&gt;!(t===void 0||i==="layout"&amp;&amp;!Object.keys(t).length||i==="paint"&amp;&amp;!Object.keys(t).length))}_validate(t,i,r,n,s={}){return(!s||s.validate!==!1)&amp;&amp;nh(this,t.call(Xa,{key:i,layerType:this.type,objectKey:r,value:n,styleSpec:st,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isSky(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}hasShadowPass(){return!1}canCastShadows(){return!1}hasLightBeamPass(){return!1}cutoffRange(){return 0}resize(){}isStateDependent(){for(const t in this.paint._values){const i=this.paint.get(t);if(i instanceof Qa&amp;&amp;ra(i.property.specification)&amp;&amp;(i.value.kind==="source"||i.value.kind==="composite")&amp;&amp;i.value.isStateDependent)return!0}return!1}compileFilter(){this._filterCompiled||(this._featureFilter=eh(this.filter),this._filterCompiled=!0)}invalidateCompiledFilter(){this._filterCompiled=!1}dynamicFilter(){return this._featureFilter.dynamicFilter}dynamicFilterNeedsFeature(){return this._featureFilter.needFeature}getLayerRenderingStats(){return this._stats}resetLayerRenderingStats(){this._stats&amp;&amp;(this._stats.numRenderedVerticesInShadowPass=0,this._stats.numRenderedVerticesInTransparentPass=0)}}class sP{constructor(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSourceCaches={},this._updatedPaintProps=new Set,this._updatedImages=new Set}isDirty(){return this._changed}setDirty(){this._changed=!0}getUpdatedSourceCaches(){return this._updatedSourceCaches}updateSourceCache(t,i){this._updatedSourceCaches[t]=i,this.setDirty()}discardSourceCacheUpdate(t){delete this._updatedSourceCaches[t]}updateLayer(t){const i=t.scope;this._updatedLayers[i]=this._updatedLayers[i]||new Set,this._updatedLayers[i].add(t.id),this.setDirty()}removeLayer(t){const i=t.scope;this._removedLayers[i]=this._removedLayers[i]||{},this._updatedLayers[i]=this._updatedLayers[i]||new Set,this._removedLayers[i][t.id]=t,this._updatedLayers[i].delete(t.id),this._updatedPaintProps.delete(t.fqid),this.setDirty()}getRemovedLayer(t){return this._removedLayers[t.scope]?this._removedLayers[t.scope][t.id]:null}discardLayerRemoval(t){this._removedLayers[t.scope]&amp;&amp;delete this._removedLayers[t.scope][t.id]}getLayerUpdatesByScope(){const t={};for(const i in this._updatedLayers)t[i]=t[i]||{},t[i].updatedIds=Array.from(this._updatedLayers[i].values());for(const i in this._removedLayers)t[i]=t[i]||{},t[i].removedIds=Object.keys(this._removedLayers[i]);return t}getUpdatedPaintProperties(){return this._updatedPaintProps}updatePaintProperties(t){this._updatedPaintProps.add(t.fqid),this.setDirty()}getUpdatedImages(){return Array.from(this._updatedImages.values())}updateImage(t){this._updatedImages.add(t),this.setDirty()}resetUpdatedImages(){this._updatedImages.clear()}reset(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSourceCaches={},this._updatedPaintProps.clear(),this._updatedImages.clear()}}const oP={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class ch{constructor(t,i){this._structArray=t,this._pos1=i*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class Ai{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(t,i){return t._trim(),i&amp;&amp;(t.isTransferred=!0,i.add(t.arrayBuffer)),{length:t.length,arrayBuffer:t.arrayBuffer}}static deserialize(t){const i=Object.create(this.prototype);return i.arrayBuffer=t.arrayBuffer,i.length=t.length,i.capacity=t.arrayBuffer.byteLength/i.bytesPerElement,i._refreshViews(),i}_trim(){this.length!==this.capacity&amp;&amp;(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())}clear(){this.length=0}resize(t){this.reserve(t),this.length=t}reserve(t){if(t&gt;this.capacity){this.capacity=Math.max(t,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const i=this.uint8;this._refreshViews(),i&amp;&amp;this.uint8.set(i)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}destroy(){this.int8=this.uint8=this.int16=this.uint16=this.int32=this.uint32=this.float32=null,this.arrayBuffer=null}}function ei(e,t=1){let i=0,r=0;return{members:e.map(n=&gt;{const s=oP[n.type].BYTES_PER_ELEMENT,a=i=hx(i,Math.max(t,s)),l=n.components||1;return r=Math.max(r,s),i+=s*l,{name:n.name,type:n.type,components:l,offset:a}}),size:hx(i,Math.max(r,t)),alignment:t}}function hx(e,t){return Math.ceil(e/t)*t}class Kr extends Ai{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,i){const r=this.length;return this.resize(r+1),this.emplace(r,t,i)}emplace(t,i,r){const n=2*t;return this.int16[n+0]=i,this.int16[n+1]=r,t}}Kr.prototype.bytesPerElement=4,Jt(Kr,"StructArrayLayout2i4");class uh extends Ai{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,i,r){const n=this.length;return this.resize(n+1),this.emplace(n,t,i,r)}emplace(t,i,r,n){const s=3*t;return this.int16[s+0]=i,this.int16[s+1]=r,this.int16[s+2]=n,t}}uh.prototype.bytesPerElement=6,Jt(uh,"StructArrayLayout3i6");class sa extends Ai{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,i,r,n){const s=this.length;return this.resize(s+1),this.emplace(s,t,i,r,n)}emplace(t,i,r,n,s){const a=4*t;return this.int16[a+0]=i,this.int16[a+1]=r,this.int16[a+2]=n,this.int16[a+3]=s,t}}sa.prototype.bytesPerElement=8,Jt(sa,"StructArrayLayout4i8");class Wp extends Ai{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,i,r,n,s){const a=this.length;return this.resize(a+1),this.emplace(a,t,i,r,n,s)}emplace(t,i,r,n,s,a){const l=5*t;return this.int16[l+0]=i,this.int16[l+1]=r,this.int16[l+2]=n,this.int16[l+3]=s,this.int16[l+4]=a,t}}Wp.prototype.bytesPerElement=10,Jt(Wp,"StructArrayLayout5i10");class qp extends Ai{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,i,r,n,s,a,l){const h=this.length;return this.resize(h+1),this.emplace(h,t,i,r,n,s,a,l)}emplace(t,i,r,n,s,a,l,h){const d=6*t,f=12*t,m=3*t;return this.int16[d+0]=i,this.int16[d+1]=r,this.uint8[f+4]=n,this.uint8[f+5]=s,this.uint8[f+6]=a,this.uint8[f+7]=l,this.float32[m+2]=h,t}}qp.prototype.bytesPerElement=12,Jt(qp,"StructArrayLayout2i4ub1f12");class Vs extends Ai{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,i,r,n){const s=this.length;return this.resize(s+1),this.emplace(s,t,i,r,n)}emplace(t,i,r,n,s){const a=4*t;return this.float32[a+0]=i,this.float32[a+1]=r,this.float32[a+2]=n,this.float32[a+3]=s,t}}Vs.prototype.bytesPerElement=16,Jt(Vs,"StructArrayLayout4f16");class go extends Ai{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,i,r,n,s){const a=this.length;return this.resize(a+1),this.emplace(a,t,i,r,n,s)}emplace(t,i,r,n,s,a){const l=6*t,h=3*t;return this.uint16[l+0]=i,this.uint16[l+1]=r,this.uint16[l+2]=n,this.uint16[l+3]=s,this.float32[h+2]=a,t}}go.prototype.bytesPerElement=12,Jt(go,"StructArrayLayout4ui1f12");class hh extends Ai{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,i,r,n){const s=this.length;return this.resize(s+1),this.emplace(s,t,i,r,n)}emplace(t,i,r,n,s){const a=4*t;return this.uint16[a+0]=i,this.uint16[a+1]=r,this.uint16[a+2]=n,this.uint16[a+3]=s,t}}hh.prototype.bytesPerElement=8,Jt(hh,"StructArrayLayout4ui8");class dh extends Ai{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,i,r,n,s,a){const l=this.length;return this.resize(l+1),this.emplace(l,t,i,r,n,s,a)}emplace(t,i,r,n,s,a,l){const h=6*t;return this.int16[h+0]=i,this.int16[h+1]=r,this.int16[h+2]=n,this.int16[h+3]=s,this.int16[h+4]=a,this.int16[h+5]=l,t}}dh.prototype.bytesPerElement=12,Jt(dh,"StructArrayLayout6i12");class Zp extends Ai{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,i,r,n,s,a,l,h,d,f,m,_){const y=this.length;return this.resize(y+1),this.emplace(y,t,i,r,n,s,a,l,h,d,f,m,_)}emplace(t,i,r,n,s,a,l,h,d,f,m,_,y){const x=12*t;return this.int16[x+0]=i,this.int16[x+1]=r,this.int16[x+2]=n,this.int16[x+3]=s,this.uint16[x+4]=a,this.uint16[x+5]=l,this.uint16[x+6]=h,this.uint16[x+7]=d,this.int16[x+8]=f,this.int16[x+9]=m,this.int16[x+10]=_,this.int16[x+11]=y,t}}Zp.prototype.bytesPerElement=24,Jt(Zp,"StructArrayLayout4i4ui4i24");class $p extends Ai{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,i,r,n,s,a){const l=this.length;return this.resize(l+1),this.emplace(l,t,i,r,n,s,a)}emplace(t,i,r,n,s,a,l){const h=10*t,d=5*t;return this.int16[h+0]=i,this.int16[h+1]=r,this.int16[h+2]=n,this.float32[d+2]=s,this.float32[d+3]=a,this.float32[d+4]=l,t}}$p.prototype.bytesPerElement=20,Jt($p,"StructArrayLayout3i3f20");class Xp extends Ai{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(t){const i=this.length;return this.resize(i+1),this.emplace(i,t)}emplace(t,i){return this.uint32[1*t+0]=i,t}}Xp.prototype.bytesPerElement=4,Jt(Xp,"StructArrayLayout1ul4");class yo extends Ai{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,i){const r=this.length;return this.resize(r+1),this.emplace(r,t,i)}emplace(t,i,r){const n=2*t;return this.uint16[n+0]=i,this.uint16[n+1]=r,t}}yo.prototype.bytesPerElement=4,Jt(yo,"StructArrayLayout2ui4");class Yp extends Ai{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,i,r,n,s,a,l,h,d,f,m,_,y){const x=this.length;return this.resize(x+1),this.emplace(x,t,i,r,n,s,a,l,h,d,f,m,_,y)}emplace(t,i,r,n,s,a,l,h,d,f,m,_,y,x){const b=20*t,w=10*t;return this.int16[b+0]=i,this.int16[b+1]=r,this.int16[b+2]=n,this.int16[b+3]=s,this.int16[b+4]=a,this.float32[w+3]=l,this.float32[w+4]=h,this.float32[w+5]=d,this.float32[w+6]=f,this.int16[b+14]=m,this.uint32[w+8]=_,this.uint16[b+18]=y,this.uint16[b+19]=x,t}}Yp.prototype.bytesPerElement=40,Jt(Yp,"StructArrayLayout5i4f1i1ul2ui40");class fh extends Ai{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,i,r,n,s,a,l){const h=this.length;return this.resize(h+1),this.emplace(h,t,i,r,n,s,a,l)}emplace(t,i,r,n,s,a,l,h){const d=8*t;return this.int16[d+0]=i,this.int16[d+1]=r,this.int16[d+2]=n,this.int16[d+4]=s,this.int16[d+5]=a,this.int16[d+6]=l,this.int16[d+7]=h,t}}fh.prototype.bytesPerElement=16,Jt(fh,"StructArrayLayout3i2i2i16");class Kp extends Ai{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,i,r,n,s){const a=this.length;return this.resize(a+1),this.emplace(a,t,i,r,n,s)}emplace(t,i,r,n,s,a){const l=4*t,h=8*t;return this.float32[l+0]=i,this.float32[l+1]=r,this.float32[l+2]=n,this.int16[h+6]=s,this.int16[h+7]=a,t}}Kp.prototype.bytesPerElement=16,Jt(Kp,"StructArrayLayout2f1f2i16");class Jp extends Ai{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,i,r,n){const s=this.length;return this.resize(s+1),this.emplace(s,t,i,r,n)}emplace(t,i,r,n,s){const a=12*t,l=3*t;return this.uint8[a+0]=i,this.uint8[a+1]=r,this.float32[l+1]=n,this.float32[l+2]=s,t}}Jp.prototype.bytesPerElement=12,Jt(Jp,"StructArrayLayout2ub2f12");class Xi extends Ai{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,i,r){const n=this.length;return this.resize(n+1),this.emplace(n,t,i,r)}emplace(t,i,r,n){const s=3*t;return this.uint16[s+0]=i,this.uint16[s+1]=r,this.uint16[s+2]=n,t}}Xi.prototype.bytesPerElement=6,Jt(Xi,"StructArrayLayout3ui6");class Qp extends Ai{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(t,i,r,n,s,a,l,h,d,f,m,_,y,x,b,w,T,S,I,P,M){const C=this.length;return this.resize(C+1),this.emplace(C,t,i,r,n,s,a,l,h,d,f,m,_,y,x,b,w,T,S,I,P,M)}emplace(t,i,r,n,s,a,l,h,d,f,m,_,y,x,b,w,T,S,I,P,M,C){const D=30*t,O=15*t,k=60*t;return this.int16[D+0]=i,this.int16[D+1]=r,this.int16[D+2]=n,this.float32[O+2]=s,this.float32[O+3]=a,this.uint16[D+8]=l,this.uint16[D+9]=h,this.uint32[O+5]=d,this.uint32[O+6]=f,this.uint32[O+7]=m,this.uint16[D+16]=_,this.uint16[D+17]=y,this.uint16[D+18]=x,this.float32[O+10]=b,this.float32[O+11]=w,this.uint8[k+48]=T,this.uint8[k+49]=S,this.uint8[k+50]=I,this.uint32[O+13]=P,this.int16[D+28]=M,this.uint8[k+58]=C,t}}Qp.prototype.bytesPerElement=60,Jt(Qp,"StructArrayLayout3i2f2ui3ul3ui2f3ub1ul1i1ub60");class tm extends Ai{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(t,i,r,n,s,a,l,h,d,f,m,_,y,x,b,w,T,S,I,P,M,C,D,O,k,z,B,U,Z,F,Y,J){const it=this.length;return this.resize(it+1),this.emplace(it,t,i,r,n,s,a,l,h,d,f,m,_,y,x,b,w,T,S,I,P,M,C,D,O,k,z,B,U,Z,F,Y,J)}emplace(t,i,r,n,s,a,l,h,d,f,m,_,y,x,b,w,T,S,I,P,M,C,D,O,k,z,B,U,Z,F,Y,J,it){const X=20*t,K=40*t,ot=80*t;return this.float32[X+0]=i,this.float32[X+1]=r,this.int16[K+4]=n,this.int16[K+5]=s,this.int16[K+6]=a,this.int16[K+7]=l,this.int16[K+8]=h,this.int16[K+9]=d,this.int16[K+10]=f,this.int16[K+11]=m,this.int16[K+12]=_,this.uint16[K+13]=y,this.uint16[K+14]=x,this.uint16[K+15]=b,this.uint16[K+16]=w,this.uint16[K+17]=T,this.uint16[K+18]=S,this.uint16[K+19]=I,this.uint16[K+20]=P,this.uint16[K+21]=M,this.uint16[K+22]=C,this.uint16[K+23]=D,this.uint16[K+24]=O,this.uint16[K+25]=k,this.uint16[K+26]=z,this.uint16[K+27]=B,this.uint32[X+14]=U,this.float32[X+15]=Z,this.float32[X+16]=F,this.float32[X+17]=Y,this.float32[X+18]=J,this.uint8[ot+76]=it,t}}tm.prototype.bytesPerElement=80,Jt(tm,"StructArrayLayout2f9i15ui1ul4f1ub80");class xc extends Ai{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t){const i=this.length;return this.resize(i+1),this.emplace(i,t)}emplace(t,i){return this.float32[1*t+0]=i,t}}xc.prototype.bytesPerElement=4,Jt(xc,"StructArrayLayout1f4");class oa extends Ai{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,i,r,n,s){const a=this.length;return this.resize(a+1),this.emplace(a,t,i,r,n,s)}emplace(t,i,r,n,s,a){const l=5*t;return this.float32[l+0]=i,this.float32[l+1]=r,this.float32[l+2]=n,this.float32[l+3]=s,this.float32[l+4]=a,t}}oa.prototype.bytesPerElement=20,Jt(oa,"StructArrayLayout5f20");class em extends Ai{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,i,r,n,s,a,l){const h=this.length;return this.resize(h+1),this.emplace(h,t,i,r,n,s,a,l)}emplace(t,i,r,n,s,a,l,h){const d=7*t;return this.float32[d+0]=i,this.float32[d+1]=r,this.float32[d+2]=n,this.float32[d+3]=s,this.float32[d+4]=a,this.float32[d+5]=l,this.float32[d+6]=h,t}}em.prototype.bytesPerElement=28,Jt(em,"StructArrayLayout7f28");class im extends Ai{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,i,r,n){const s=this.length;return this.resize(s+1),this.emplace(s,t,i,r,n)}emplace(t,i,r,n,s){const a=6*t;return this.uint32[3*t+0]=i,this.uint16[a+2]=r,this.uint16[a+3]=n,this.uint16[a+4]=s,t}}im.prototype.bytesPerElement=12,Jt(im,"StructArrayLayout1ul3ui12");class vc extends Ai{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t){const i=this.length;return this.resize(i+1),this.emplace(i,t)}emplace(t,i){return this.uint16[1*t+0]=i,t}}vc.prototype.bytesPerElement=2,Jt(vc,"StructArrayLayout1ui2");class aa extends Ai{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,i,r){const n=this.length;return this.resize(n+1),this.emplace(n,t,i,r)}emplace(t,i,r,n){const s=3*t;return this.float32[s+0]=i,this.float32[s+1]=r,this.float32[s+2]=n,t}}aa.prototype.bytesPerElement=12,Jt(aa,"StructArrayLayout3f12");class bc extends Ai{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,i){const r=this.length;return this.resize(r+1),this.emplace(r,t,i)}emplace(t,i,r){const n=2*t;return this.float32[n+0]=i,this.float32[n+1]=r,t}}bc.prototype.bytesPerElement=8,Jt(bc,"StructArrayLayout2f8");class rm extends Ai{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,i,r,n,s,a,l,h,d,f,m,_,y,x,b,w){const T=this.length;return this.resize(T+1),this.emplace(T,t,i,r,n,s,a,l,h,d,f,m,_,y,x,b,w)}emplace(t,i,r,n,s,a,l,h,d,f,m,_,y,x,b,w,T){const S=16*t;return this.float32[S+0]=i,this.float32[S+1]=r,this.float32[S+2]=n,this.float32[S+3]=s,this.float32[S+4]=a,this.float32[S+5]=l,this.float32[S+6]=h,this.float32[S+7]=d,this.float32[S+8]=f,this.float32[S+9]=m,this.float32[S+10]=_,this.float32[S+11]=y,this.float32[S+12]=x,this.float32[S+13]=b,this.float32[S+14]=w,this.float32[S+15]=T,t}}rm.prototype.bytesPerElement=64,Jt(rm,"StructArrayLayout16f64");class ph extends Ai{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,i,r,n,s,a,l){const h=this.length;return this.resize(h+1),this.emplace(h,t,i,r,n,s,a,l)}emplace(t,i,r,n,s,a,l,h){const d=10*t,f=5*t;return this.uint16[d+0]=i,this.uint16[d+1]=r,this.uint16[d+2]=n,this.uint16[d+3]=s,this.float32[f+2]=a,this.float32[f+3]=l,this.float32[f+4]=h,t}}ph.prototype.bytesPerElement=20,Jt(ph,"StructArrayLayout4ui3f20");class nm extends Ai{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer)}emplaceBack(t){const i=this.length;return this.resize(i+1),this.emplace(i,t)}emplace(t,i){return this.uint8[1*t+0]=i,t}}nm.prototype.bytesPerElement=1,Jt(nm,"StructArrayLayout1ub1");class dx extends ch{get projectedAnchorX(){return this._structArray.int16[this._pos2+0]}get projectedAnchorY(){return this._structArray.int16[this._pos2+1]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+2]}get tileAnchorX(){return this._structArray.int16[this._pos2+3]}get tileAnchorY(){return this._structArray.int16[this._pos2+4]}get x1(){return this._structArray.float32[this._pos4+3]}get y1(){return this._structArray.float32[this._pos4+4]}get x2(){return this._structArray.float32[this._pos4+5]}get y2(){return this._structArray.float32[this._pos4+6]}get padding(){return this._structArray.int16[this._pos2+14]}get featureIndex(){return this._structArray.uint32[this._pos4+8]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+18]}get bucketIndex(){return this._structArray.uint16[this._pos2+19]}}dx.prototype.size=40;class sm extends Yp{get(t){return new dx(this,t)}}Jt(sm,"CollisionBoxArray");class fx extends ch{get projectedAnchorX(){return this._structArray.int16[this._pos2+0]}get projectedAnchorY(){return this._structArray.int16[this._pos2+1]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+2]}get tileAnchorX(){return this._structArray.float32[this._pos4+2]}get tileAnchorY(){return this._structArray.float32[this._pos4+3]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+8]}get numGlyphs(){return this._structArray.uint16[this._pos2+9]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+5]}get lineStartIndex(){return this._structArray.uint32[this._pos4+6]}get lineLength(){return this._structArray.uint32[this._pos4+7]}get segment(){return this._structArray.uint16[this._pos2+16]}get lowerSize(){return this._structArray.uint16[this._pos2+17]}get upperSize(){return this._structArray.uint16[this._pos2+18]}get lineOffsetX(){return this._structArray.float32[this._pos4+10]}get lineOffsetY(){return this._structArray.float32[this._pos4+11]}get writingMode(){return this._structArray.uint8[this._pos1+48]}get placedOrientation(){return this._structArray.uint8[this._pos1+49]}set placedOrientation(t){this._structArray.uint8[this._pos1+49]=t}get hidden(){return this._structArray.uint8[this._pos1+50]}set hidden(t){this._structArray.uint8[this._pos1+50]=t}get crossTileID(){return this._structArray.uint32[this._pos4+13]}set crossTileID(t){this._structArray.uint32[this._pos4+13]=t}get associatedIconIndex(){return this._structArray.int16[this._pos2+28]}get flipState(){return this._structArray.uint8[this._pos1+58]}set flipState(t){this._structArray.uint8[this._pos1+58]=t}}fx.prototype.size=60;class px extends Qp{get(t){return new fx(this,t)}}Jt(px,"PlacedSymbolArray");class mx extends ch{get tileAnchorX(){return this._structArray.float32[this._pos4+0]}get tileAnchorY(){return this._structArray.float32[this._pos4+1]}get projectedAnchorX(){return this._structArray.int16[this._pos2+4]}get projectedAnchorY(){return this._structArray.int16[this._pos2+5]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+6]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+7]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+8]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+9]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+10]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+11]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+12]}get key(){return this._structArray.uint16[this._pos2+13]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+14]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+15]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+16]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+17]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+18]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+19]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+20]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+21]}get featureIndex(){return this._structArray.uint16[this._pos2+22]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+23]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+24]}get numIconVertices(){return this._structArray.uint16[this._pos2+25]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+26]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+27]}get crossTileID(){return this._structArray.uint32[this._pos4+14]}set crossTileID(t){this._structArray.uint32[this._pos4+14]=t}get textOffset0(){return this._structArray.float32[this._pos4+15]}get textOffset1(){return this._structArray.float32[this._pos4+16]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+17]}get zOffset(){return this._structArray.float32[this._pos4+18]}set zOffset(t){this._structArray.float32[this._pos4+18]=t}get hasIconTextFit(){return this._structArray.uint8[this._pos1+76]}}mx.prototype.size=80;class _x extends tm{get(t){return new mx(this,t)}}Jt(_x,"SymbolInstanceArray");class gx extends xc{getoffsetX(t){return this.float32[1*t+0]}}Jt(gx,"GlyphOffsetArray");class yx extends Kr{getx(t){return this.int16[2*t+0]}gety(t){return this.int16[2*t+1]}}Jt(yx,"SymbolLineVertexArray");class xx extends ch{get featureIndex(){return this._structArray.uint32[this._pos4+0]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+2]}get bucketIndex(){return this._structArray.uint16[this._pos2+3]}get layoutVertexArrayOffset(){return this._structArray.uint16[this._pos2+4]}}xx.prototype.size=12;class vx extends im{get(t){return new xx(this,t)}}Jt(vx,"FeatureIndexArray");class bx extends yo{geta_centroid_pos0(t){return this.uint16[2*t+0]}geta_centroid_pos1(t){return this.uint16[2*t+1]}}Jt(bx,"FillExtrusionCentroidArray");const aP=ei([{name:"a_pos",components:2,type:"Int16"}],4),lP=ei([{name:"a_pos_3",components:3,type:"Int16"},{name:"a_pos_normal_3",components:3,type:"Int16"}]);class si{constructor(t=[]){this.segments=t}_prepareSegment(t,i,r,n){let s=this.segments[this.segments.length-1];return t&gt;si.MAX_VERTEX_ARRAY_LENGTH&amp;&amp;tt(`Max vertices per segment is ${si.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${t}`),(!s||s.vertexLength+t&gt;si.MAX_VERTEX_ARRAY_LENGTH||s.sortKey!==n)&amp;&amp;(s={vertexOffset:i,primitiveOffset:r,vertexLength:0,primitiveLength:0},n!==void 0&amp;&amp;(s.sortKey=n),this.segments.push(s)),s}prepareSegment(t,i,r,n){return this._prepareSegment(t,i.length,r.length,n)}get(){return this.segments}destroy(){for(const t of this.segments)for(const i in t.vaos)t.vaos[i].destroy()}static simpleSegment(t,i,r,n){return new si([{vertexOffset:t,primitiveOffset:i,vertexLength:r,primitiveLength:n,vaos:{},sortKey:0}])}}function wx(e,t){return 256*(e=Xt(Math.floor(e),0,255))+Xt(Math.floor(t),0,255)}si.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,Jt(si,"SegmentVector");const cP=ei([{name:"a_pattern",components:4,type:"Uint16"},{name:"a_pixel_ratio",components:1,type:"Float32"}]),uP=ei([{name:"a_dash",components:4,type:"Uint16"}]);var mh={exports:{}},Tx={exports:{}};(function(e){e.exports=function(t,i){var r,n,s,a,l,h,d,f;for(n=t.length-(r=3&amp;t.length),s=i,l=3432918353,h=461845907,f=0;f&lt;n;)d=255&amp;t.charCodeAt(f)|(255&amp;t.charCodeAt(++f))&lt;&lt;8|(255&amp;t.charCodeAt(++f))&lt;&lt;16|(255&amp;t.charCodeAt(++f))&lt;&lt;24,++f,s=27492+(65535&amp;(a=5*(65535&amp;(s=(s^=d=(65535&amp;(d=(d=(65535&amp;d)*l+(((d&gt;&gt;&gt;16)*l&amp;65535)&lt;&lt;16)&amp;4294967295)&lt;&lt;15|d&gt;&gt;&gt;17))*h+(((d&gt;&gt;&gt;16)*h&amp;65535)&lt;&lt;16)&amp;4294967295)&lt;&lt;13|s&gt;&gt;&gt;19))+((5*(s&gt;&gt;&gt;16)&amp;65535)&lt;&lt;16)&amp;4294967295))+((58964+(a&gt;&gt;&gt;16)&amp;65535)&lt;&lt;16);switch(d=0,r){case 3:d^=(255&amp;t.charCodeAt(f+2))&lt;&lt;16;case 2:d^=(255&amp;t.charCodeAt(f+1))&lt;&lt;8;case 1:s^=d=(65535&amp;(d=(d=(65535&amp;(d^=255&amp;t.charCodeAt(f)))*l+(((d&gt;&gt;&gt;16)*l&amp;65535)&lt;&lt;16)&amp;4294967295)&lt;&lt;15|d&gt;&gt;&gt;17))*h+(((d&gt;&gt;&gt;16)*h&amp;65535)&lt;&lt;16)&amp;4294967295}return s^=t.length,s=2246822507*(65535&amp;(s^=s&gt;&gt;&gt;16))+((2246822507*(s&gt;&gt;&gt;16)&amp;65535)&lt;&lt;16)&amp;4294967295,s=3266489909*(65535&amp;(s^=s&gt;&gt;&gt;13))+((3266489909*(s&gt;&gt;&gt;16)&amp;65535)&lt;&lt;16)&amp;4294967295,(s^=s&gt;&gt;&gt;16)&gt;&gt;&gt;0}})(Tx);var hP=Tx.exports,Ex={exports:{}};(function(e){e.exports=function(t,i){for(var r,n=t.length,s=i^n,a=0;n&gt;=4;)r=1540483477*(65535&amp;(r=255&amp;t.charCodeAt(a)|(255&amp;t.charCodeAt(++a))&lt;&lt;8|(255&amp;t.charCodeAt(++a))&lt;&lt;16|(255&amp;t.charCodeAt(++a))&lt;&lt;24))+((1540483477*(r&gt;&gt;&gt;16)&amp;65535)&lt;&lt;16),s=1540483477*(65535&amp;s)+((1540483477*(s&gt;&gt;&gt;16)&amp;65535)&lt;&lt;16)^(r=1540483477*(65535&amp;(r^=r&gt;&gt;&gt;24))+((1540483477*(r&gt;&gt;&gt;16)&amp;65535)&lt;&lt;16)),n-=4,++a;switch(n){case 3:s^=(255&amp;t.charCodeAt(a+2))&lt;&lt;16;case 2:s^=(255&amp;t.charCodeAt(a+1))&lt;&lt;8;case 1:s=1540483477*(65535&amp;(s^=255&amp;t.charCodeAt(a)))+((1540483477*(s&gt;&gt;&gt;16)&amp;65535)&lt;&lt;16)}return s=1540483477*(65535&amp;(s^=s&gt;&gt;&gt;13))+((1540483477*(s&gt;&gt;&gt;16)&amp;65535)&lt;&lt;16),(s^=s&gt;&gt;&gt;15)&gt;&gt;&gt;0}})(Ex);var Sx=hP,dP=Ex.exports;mh.exports=Sx,mh.exports.murmur3=Sx,mh.exports.murmur2=dP;var om=Qt(mh.exports);class wc{constructor(){this.ids=[],this.uniqueIds=[],this.positions=[],this.indexed=!1}add(t,i,r,n){this.ids.push(Ax(t)),this.positions.push(i,r,n)}eachPosition(t,i){const r=Ax(t);let n=0,s=this.ids.length-1;for(;n&lt;s;){const a=n+s&gt;&gt;1;this.ids[a]&gt;=r?s=a:n=a+1}for(;this.ids[n]===r;)i(this.positions[3*n],this.positions[3*n+1],this.positions[3*n+2]),n++}static serialize(t,i){const r=new Float64Array(t.ids),n=new Uint32Array(t.positions);return am(r,n,0,r.length-1),i&amp;&amp;(i.add(r.buffer),i.add(n.buffer)),{ids:r,positions:n}}static deserialize(t){const i=new wc;let r;i.ids=t.ids,i.positions=t.positions;for(const n of i.ids)n!==r&amp;&amp;i.uniqueIds.push(n),r=n;return i.indexed=!0,i}}function Ax(e){const t=+e;return!isNaN(t)&amp;&amp;Number.MIN_SAFE_INTEGER&lt;=t&amp;&amp;t&lt;=Number.MAX_SAFE_INTEGER?t:om(String(e))}function am(e,t,i,r){for(;i&lt;r;){const n=e[i+r&gt;&gt;1];let s=i-1,a=r+1;for(;;){do s++;while(e[s]&lt;n);do a--;while(e[a]&gt;n);if(s&gt;=a)break;_h(e,s,a),_h(t,3*s,3*a),_h(t,3*s+1,3*a+1),_h(t,3*s+2,3*a+2)}a-i&lt;r-a?(am(e,t,i,a),i=a+1):(am(e,t,a+1,r),r=a)}}function _h(e,t,i){const r=e[t];e[t]=e[i],e[i]=r}Jt(wc,"FeaturePositionMap");class js{constructor(t){this.gl=t.gl,this.initialized=!1}fetchUniformLocation(t,i){return this.location||this.initialized||(this.location=this.gl.getUniformLocation(t,i),this.initialized=!0),!!this.location}}class Re extends js{constructor(t){super(t),this.current=0}set(t,i,r){this.fetchUniformLocation(t,i)&amp;&amp;this.current!==r&amp;&amp;(this.current=r,this.gl.uniform1i(this.location,r))}}class wt extends js{constructor(t){super(t),this.current=0}set(t,i,r){this.fetchUniformLocation(t,i)&amp;&amp;this.current!==r&amp;&amp;(this.current=r,this.gl.uniform1f(this.location,r))}}class De extends js{constructor(t){super(t),this.current=[0,0]}set(t,i,r){this.fetchUniformLocation(t,i)&amp;&amp;(r[0]===this.current[0]&amp;&amp;r[1]===this.current[1]||(this.current=r,this.gl.uniform2f(this.location,r[0],r[1])))}}class Ee extends js{constructor(t){super(t),this.current=[0,0,0]}set(t,i,r){this.fetchUniformLocation(t,i)&amp;&amp;(r[0]===this.current[0]&amp;&amp;r[1]===this.current[1]&amp;&amp;r[2]===this.current[2]||(this.current=r,this.gl.uniform3f(this.location,r[0],r[1],r[2])))}}class Jr extends js{constructor(t){super(t),this.current=[0,0,0,0]}set(t,i,r){this.fetchUniformLocation(t,i)&amp;&amp;(r[0]===this.current[0]&amp;&amp;r[1]===this.current[1]&amp;&amp;r[2]===this.current[2]&amp;&amp;r[3]===this.current[3]||(this.current=r,this.gl.uniform4f(this.location,r[0],r[1],r[2],r[3])))}}class tl extends js{constructor(t){super(t),this.current=Ie.transparent}set(t,i,r){this.fetchUniformLocation(t,i)&amp;&amp;(r.r===this.current.r&amp;&amp;r.g===this.current.g&amp;&amp;r.b===this.current.b&amp;&amp;r.a===this.current.a||(this.current=r,this.gl.uniform4f(this.location,r.r,r.g,r.b,r.a)))}}const fP=new Float32Array(16);class be extends js{constructor(t){super(t),this.current=fP}set(t,i,r){if(this.fetchUniformLocation(t,i)){if(r[12]!==this.current[12]||r[0]!==this.current[0])return this.current=r,void this.gl.uniformMatrix4fv(this.location,!1,r);for(let n=1;n&lt;16;n++)if(r[n]!==this.current[n]){this.current=r,this.gl.uniformMatrix4fv(this.location,!1,r);break}}}}const pP=new Float32Array(9);class lm extends js{constructor(t){super(t),this.current=pP}set(t,i,r){if(this.fetchUniformLocation(t,i)){for(let n=0;n&lt;9;n++)if(r[n]!==this.current[n]){this.current=r,this.gl.uniformMatrix3fv(this.location,!1,r);break}}}}const mP=new Float32Array(4);class cm extends js{constructor(t){super(t),this.current=mP}set(t,i,r){if(this.fetchUniformLocation(t,i)){for(let n=0;n&lt;4;n++)if(r[n]!==this.current[n]){this.current=r,this.gl.uniformMatrix2fv(this.location,!1,r);break}}}}function um(e){return[wx(255*e.r,255*e.g),wx(255*e.b,255*e.a)]}class Tc{constructor(t,i,r){this.value=t,this.uniformNames=i.map(n=&gt;`u_${n}`),this.type=r}setUniform(t,i,r,n,s){i.set(t,s,n.constantOr(this.value))}getBinding(t,i){return this.type==="color"?new tl(t):new wt(t)}}class el{constructor(t,i){this.uniformNames=i.map(r=&gt;`u_${r}`),this.pattern=null,this.pixelRatio=1}setConstantPatternPositions(t){this.pixelRatio=t.pixelRatio||1,this.pattern=t.tl.concat(t.br)}setUniform(t,i,r,n,s){const a=s==="u_pattern"||s==="u_dash"?this.pattern:s==="u_pixel_ratio"?this.pixelRatio:null;a&amp;&amp;i.set(t,s,a)}getBinding(t,i){return i==="u_pattern"||i==="u_dash"?new Jr(t):new wt(t)}}class Gs{constructor(t,i,r,n){this.expression=t,this.type=r,this.maxValue=0,this.paintVertexAttributes=i.map(s=&gt;({name:`a_${s}`,type:"Float32",components:r==="color"?2:1,offset:0})),this.paintVertexArray=new n}populatePaintArray(t,i,r,n,s,a,l){const h=this.paintVertexArray.length,d=this.expression.evaluate(new Si(0,{brightness:a}),i,{},s,n,l);this.paintVertexArray.resize(t),this._setPaintValue(h,t,d)}updatePaintArray(t,i,r,n,s,a,l){const h=this.expression.evaluate({zoom:0,brightness:l},r,n,void 0,s);this._setPaintValue(t,i,h)}_setPaintValue(t,i,r){if(this.type==="color"){const n=um(r);for(let s=t;s&lt;i;s++)this.paintVertexArray.emplace(s,n[0],n[1])}else{for(let n=t;n&lt;i;n++)this.paintVertexArray.emplace(n,r);this.maxValue=Math.max(this.maxValue,Math.abs(r))}}upload(t){this.paintVertexArray&amp;&amp;this.paintVertexArray.arrayBuffer&amp;&amp;(this.paintVertexBuffer&amp;&amp;this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=t.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent||!this.expression.isLightConstant))}destroy(){this.paintVertexBuffer&amp;&amp;this.paintVertexBuffer.destroy()}}class Gn{constructor(t,i,r,n,s,a){this.expression=t,this.uniformNames=i.map(l=&gt;`u_${l}_t`),this.type=r,this.useIntegerZoom=n,this.zoom=s,this.maxValue=0,this.paintVertexAttributes=i.map(l=&gt;({name:`a_${l}`,type:"Float32",components:r==="color"?4:2,offset:0})),this.paintVertexArray=new a}populatePaintArray(t,i,r,n,s,a,l){const h=this.expression.evaluate(new Si(this.zoom,{brightness:a}),i,{},s,n,l),d=this.expression.evaluate(new Si(this.zoom+1,{brightness:a}),i,{},s,n,l),f=this.paintVertexArray.length;this.paintVertexArray.resize(t),this._setPaintValue(f,t,h,d)}updatePaintArray(t,i,r,n,s,a,l){const h=this.expression.evaluate({zoom:this.zoom,brightness:l},r,n,void 0,s),d=this.expression.evaluate({zoom:this.zoom+1,brightness:l},r,n,void 0,s);this._setPaintValue(t,i,h,d)}_setPaintValue(t,i,r,n){if(this.type==="color"){const s=um(r),a=um(n);for(let l=t;l&lt;i;l++)this.paintVertexArray.emplace(l,s[0],s[1],a[0],a[1])}else{for(let s=t;s&lt;i;s++)this.paintVertexArray.emplace(s,r,n);this.maxValue=Math.max(this.maxValue,Math.abs(r),Math.abs(n))}}upload(t){this.paintVertexArray&amp;&amp;this.paintVertexArray.arrayBuffer&amp;&amp;(this.paintVertexBuffer&amp;&amp;this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=t.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent||!this.expression.isLightConstant))}destroy(){this.paintVertexBuffer&amp;&amp;this.paintVertexBuffer.destroy()}setUniform(t,i,r,n,s){const a=this.useIntegerZoom?Math.floor(r.zoom):r.zoom,l=Xt(this.expression.interpolationFactor(a,this.zoom,this.zoom+1),0,1);i.set(t,s,l)}getBinding(t,i){return new wt(t)}}class xo{constructor(t,i,r,n,s){this.expression=t,this.layerId=s,this.paintVertexAttributes=(r==="array"?uP:cP).members;for(let a=0;a&lt;i.length;++a);this.paintVertexArray=new n}populatePaintArray(t,i,r){const n=this.paintVertexArray.length;this.paintVertexArray.resize(t),this._setPaintValues(n,t,i.patterns&amp;&amp;i.patterns[this.layerId],r)}updatePaintArray(t,i,r,n,s,a,l){this._setPaintValues(t,i,r.patterns&amp;&amp;r.patterns[this.layerId],a)}_setPaintValues(t,i,r,n){if(!n||!r)return;const s=n[r];if(!s)return;const{tl:a,br:l,pixelRatio:h}=s;for(let d=t;d&lt;i;d++)this.paintVertexArray.emplace(d,a[0],a[1],l[0],l[1],h)}upload(t){this.paintVertexArray&amp;&amp;this.paintVertexArray.arrayBuffer&amp;&amp;(this.paintVertexBuffer=t.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent||!this.expression.isLightConstant))}destroy(){this.paintVertexBuffer&amp;&amp;this.paintVertexBuffer.destroy()}}class la{constructor(t,i,r=()=&gt;!0){this.binders={},this._buffers=[];const n=[];for(const s in t.paint._values){const a=t.paint.get(s);if(!r(s)||!(a instanceof Qa&amp;&amp;ra(a.property.specification)))continue;const l=gP(s,t.type),h=a.value,d=a.property.specification.type,f=!!a.property.useIntegerZoom,m=s==="line-dasharray"||s.endsWith("pattern"),_=s==="line-dasharray"&amp;&amp;t.layout.get("line-cap").value.kind!=="constant";if(h.kind!=="constant"||_)if(h.kind==="source"||_||m){const y=Mx(s,d,"source");this.binders[s]=m?new xo(h,l,d,y,t.id):new Gs(h,l,d,y),n.push(`/a_${s}`)}else{const y=Mx(s,d,"composite");this.binders[s]=new Gn(h,l,d,f,i,y),n.push(`/z_${s}`)}else this.binders[s]=m?new el(h.value,l):new Tc(h.value,l,d),n.push(`/u_${s}`)}this.cacheKey=n.sort().join("")}getMaxValue(t){const i=this.binders[t];return i instanceof Gs||i instanceof Gn?i.maxValue:0}populatePaintArrays(t,i,r,n,s,a,l){for(const h in this.binders){const d=this.binders[h];(d instanceof Gs||d instanceof Gn||d instanceof xo)&amp;&amp;d.populatePaintArray(t,i,r,n,s,a,l)}}setConstantPatternPositions(t){for(const i in this.binders){const r=this.binders[i];r instanceof el&amp;&amp;r.setConstantPatternPositions(t)}}updatePaintArrays(t,i,r,n,s,a,l,h){let d=!1;const f=Object.keys(t),m=f.length!==0,_=m?f:i.uniqueIds;for(const y in this.binders){const x=this.binders[y];if((x instanceof Gs||x instanceof Gn||x instanceof xo)&amp;&amp;(x.expression.isStateDependent===!0||x.expression.isLightConstant===!1)){const b=s.paint.get(y);x.expression=b.value;for(const w of _){const T=t[w.toString()];i.eachPosition(w,(S,I,P)=&gt;{const M=n.feature(S);x.updatePaintArray(I,P,M,T,a,l,h)})}if(!m)for(const w of r.uniqueIds){const T=t[w.toString()];r.eachPosition(w,(S,I,P)=&gt;{const M=n.feature(S);x.updatePaintArray(I,P,M,T,a,l,h)})}d=!0}}return d}defines(){const t=[];for(const i in this.binders){const r=this.binders[i];(r instanceof Tc||r instanceof el)&amp;&amp;t.push(...r.uniformNames.map(n=&gt;`#define HAS_UNIFORM_${n}`))}return t}getBinderAttributes(){const t=[];for(const i in this.binders){const r=this.binders[i];if(r instanceof Gs||r instanceof Gn||r instanceof xo)for(let n=0;n&lt;r.paintVertexAttributes.length;n++)t.push(r.paintVertexAttributes[n].name)}return t}getBinderUniforms(){const t=[];for(const i in this.binders){const r=this.binders[i];if(r instanceof Tc||r instanceof el||r instanceof Gn)for(const n of r.uniformNames)t.push(n)}return t}getPaintVertexBuffers(){return this._buffers}getUniforms(t){const i=[];for(const r in this.binders){const n=this.binders[r];if(n instanceof Tc||n instanceof el||n instanceof Gn)for(const s of n.uniformNames)i.push({name:s,property:r,binding:n.getBinding(t,s)})}return i}setUniforms(t,i,r,n,s){for(const{name:a,property:l,binding:h}of r)this.binders[l].setUniform(t,h,s,n.get(l),a)}updatePaintBuffers(){this._buffers=[];for(const t in this.binders){const i=this.binders[t];(i instanceof Gs||i instanceof Gn||i instanceof xo)&amp;&amp;i.paintVertexBuffer&amp;&amp;this._buffers.push(i.paintVertexBuffer)}}upload(t){for(const i in this.binders){const r=this.binders[i];(r instanceof Gs||r instanceof Gn||r instanceof xo)&amp;&amp;r.upload(t)}this.updatePaintBuffers()}destroy(){for(const t in this.binders){const i=this.binders[t];(i instanceof Gs||i instanceof Gn||i instanceof xo)&amp;&amp;i.destroy()}}}class vo{constructor(t,i,r=()=&gt;!0){this.programConfigurations={};for(const n of t)this.programConfigurations[n.id]=new la(n,i,r);this.needsUpload=!1,this._featureMap=new wc,this._featureMapWithoutIds=new wc,this._bufferOffset=0,this._idlessCounter=0}populatePaintArrays(t,i,r,n,s,a,l,h){for(const d in this.programConfigurations)this.programConfigurations[d].populatePaintArrays(t,i,n,s,a,l,h);i.id!==void 0?this._featureMap.add(i.id,r,this._bufferOffset,t):(this._featureMapWithoutIds.add(this._idlessCounter,r,this._bufferOffset,t),this._idlessCounter+=1),this._bufferOffset=t,this.needsUpload=!0}updatePaintArrays(t,i,r,n,s,a){for(const l of r)this.needsUpload=this.programConfigurations[l.id].updatePaintArrays(t,this._featureMap,this._featureMapWithoutIds,i,l,n,s,a||0)||this.needsUpload}get(t){return this.programConfigurations[t]}upload(t){if(this.needsUpload){for(const i in this.programConfigurations)this.programConfigurations[i].upload(t);this.needsUpload=!1}}destroy(){for(const t in this.programConfigurations)this.programConfigurations[t].destroy()}}const _P={"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-emissive-strength":["emissive_strength"],"icon-emissive-strength":["emissive_strength"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"line-gap-width":["gapwidth"],"line-pattern":["pattern","pixel_ratio"],"fill-pattern":["pattern","pixel_ratio"],"fill-extrusion-pattern":["pattern","pixel_ratio"],"line-dasharray":["dash"]};function gP(e,t){return _P[e]||[e.replace(`${t}-`,"").replace(/-/g,"_")]}const yP={"line-pattern":{source:go,composite:go},"fill-pattern":{source:go,composite:go},"fill-extrusion-pattern":{source:go,composite:go},"line-dasharray":{source:hh,composite:hh}},xP={color:{source:bc,composite:Vs},number:{source:xc,composite:bc}};function Mx(e,t,i){const r=yP[e];return r&amp;&amp;r[i]||xP[t][i]}Jt(Tc,"ConstantBinder"),Jt(el,"PatternConstantBinder"),Jt(Gs,"SourceExpressionBinder"),Jt(xo,"PatternCompositeBinder"),Jt(Gn,"CompositeExpressionBinder"),Jt(la,"ProgramConfiguration",{omit:["_buffers"]}),Jt(vo,"ProgramConfigurationSet");class Qr{constructor(t,i){t&amp;&amp;(i?this.setSouthWest(t).setNorthEast(i):t.length===4?this.setSouthWest([t[0],t[1]]).setNorthEast([t[2],t[3]]):this.setSouthWest(t[0]).setNorthEast(t[1]))}setNorthEast(t){return this._ne=t instanceof ye?new ye(t.lng,t.lat):ye.convert(t),this}setSouthWest(t){return this._sw=t instanceof ye?new ye(t.lng,t.lat):ye.convert(t),this}extend(t){const i=this._sw,r=this._ne;let n,s;if(t instanceof ye)n=t,s=t;else{if(!(t instanceof Qr))return Array.isArray(t)?t.length===4||t.every(Array.isArray)?this.extend(Qr.convert(t)):this.extend(ye.convert(t)):typeof t=="object"&amp;&amp;t!==null&amp;&amp;t.hasOwnProperty("lat")&amp;&amp;(t.hasOwnProperty("lon")||t.hasOwnProperty("lng"))?this.extend(ye.convert(t)):this;if(n=t._sw,s=t._ne,!n||!s)return this}return i||r?(i.lng=Math.min(n.lng,i.lng),i.lat=Math.min(n.lat,i.lat),r.lng=Math.max(s.lng,r.lng),r.lat=Math.max(s.lat,r.lat)):(this._sw=new ye(n.lng,n.lat),this._ne=new ye(s.lng,s.lat)),this}getCenter(){return new ye((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)}getSouthWest(){return this._sw}getNorthEast(){return this._ne}getNorthWest(){return new ye(this.getWest(),this.getNorth())}getSouthEast(){return new ye(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&amp;&amp;this._ne)}contains(t){const{lng:i,lat:r}=ye.convert(t);let n=this._sw.lng&lt;=i&amp;&amp;i&lt;=this._ne.lng;return this._sw.lng&gt;this._ne.lng&amp;&amp;(n=this._sw.lng&gt;=i&amp;&amp;i&gt;=this._ne.lng),this._sw.lat&lt;=r&amp;&amp;r&lt;=this._ne.lat&amp;&amp;n}static convert(t){return!t||t instanceof Qr?t:new Qr(t)}}var cr={},ur={};Object.defineProperty(ur,"__esModule",{value:!0}),ur.setMatrixArrayType=function(e){ur.ARRAY_TYPE=Px=e},ur.toRadian=function(e){return e*bP},ur.equals=function(e,t){return Math.abs(e-t)&lt;=Ix*Math.max(1,Math.abs(e),Math.abs(t))},ur.RANDOM=ur.ARRAY_TYPE=ur.EPSILON=void 0;var Ix=1e-6;ur.EPSILON=Ix;var Px=typeof Float32Array&lt;"u"?Float32Array:Array;ur.ARRAY_TYPE=Px;var vP=Math.random;ur.RANDOM=vP;var bP=Math.PI/180;Math.hypot||(Math.hypot=function(){for(var e=0,t=arguments.length;t--;)e+=arguments[t]*arguments[t];return Math.sqrt(e)});var Mi={};function hm(e){return hm=typeof Symbol=="function"&amp;&amp;typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&amp;&amp;typeof Symbol=="function"&amp;&amp;t.constructor===Symbol&amp;&amp;t!==Symbol.prototype?"symbol":typeof t},hm(e)}Object.defineProperty(Mi,"__esModule",{value:!0}),Mi.create=function(){var e=new bo.ARRAY_TYPE(4);return bo.ARRAY_TYPE!=Float32Array&amp;&amp;(e[1]=0,e[2]=0),e[0]=1,e[3]=1,e},Mi.clone=function(e){var t=new bo.ARRAY_TYPE(4);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t},Mi.copy=function(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e},Mi.identity=function(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=1,e},Mi.fromValues=function(e,t,i,r){var n=new bo.ARRAY_TYPE(4);return n[0]=e,n[1]=t,n[2]=i,n[3]=r,n},Mi.set=function(e,t,i,r,n){return e[0]=t,e[1]=i,e[2]=r,e[3]=n,e},Mi.transpose=function(e,t){if(e===t){var i=t[1];e[1]=t[2],e[2]=i}else e[0]=t[0],e[1]=t[2],e[2]=t[1],e[3]=t[3];return e},Mi.invert=function(e,t){var i=t[0],r=t[1],n=t[2],s=t[3],a=i*s-n*r;return a?(e[0]=s*(a=1/a),e[1]=-r*a,e[2]=-n*a,e[3]=i*a,e):null},Mi.adjoint=function(e,t){var i=t[0];return e[0]=t[3],e[1]=-t[1],e[2]=-t[2],e[3]=i,e},Mi.determinant=function(e){return e[0]*e[3]-e[2]*e[1]},Mi.multiply=Lx,Mi.rotate=function(e,t,i){var r=t[0],n=t[1],s=t[2],a=t[3],l=Math.sin(i),h=Math.cos(i);return e[0]=r*h+s*l,e[1]=n*h+a*l,e[2]=r*-l+s*h,e[3]=n*-l+a*h,e},Mi.scale=function(e,t,i){var r=t[1],n=t[2],s=t[3],a=i[0],l=i[1];return e[0]=t[0]*a,e[1]=r*a,e[2]=n*l,e[3]=s*l,e},Mi.fromRotation=function(e,t){var i=Math.sin(t),r=Math.cos(t);return e[0]=r,e[1]=i,e[2]=-i,e[3]=r,e},Mi.fromScaling=function(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=t[1],e},Mi.str=function(e){return"mat2("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+")"},Mi.frob=function(e){return Math.hypot(e[0],e[1],e[2],e[3])},Mi.LDU=function(e,t,i,r){return e[2]=r[2]/r[0],i[0]=r[0],i[1]=r[1],i[3]=r[3]-e[2]*i[1],[e,t,i]},Mi.add=function(e,t,i){return e[0]=t[0]+i[0],e[1]=t[1]+i[1],e[2]=t[2]+i[2],e[3]=t[3]+i[3],e},Mi.subtract=Rx,Mi.exactEquals=function(e,t){return e[0]===t[0]&amp;&amp;e[1]===t[1]&amp;&amp;e[2]===t[2]&amp;&amp;e[3]===t[3]},Mi.equals=function(e,t){var i=e[0],r=e[1],n=e[2],s=e[3],a=t[0],l=t[1],h=t[2],d=t[3];return Math.abs(i-a)&lt;=bo.EPSILON*Math.max(1,Math.abs(i),Math.abs(a))&amp;&amp;Math.abs(r-l)&lt;=bo.EPSILON*Math.max(1,Math.abs(r),Math.abs(l))&amp;&amp;Math.abs(n-h)&lt;=bo.EPSILON*Math.max(1,Math.abs(n),Math.abs(h))&amp;&amp;Math.abs(s-d)&lt;=bo.EPSILON*Math.max(1,Math.abs(s),Math.abs(d))},Mi.multiplyScalar=function(e,t,i){return e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e[3]=t[3]*i,e},Mi.multiplyScalarAndAdd=function(e,t,i,r){return e[0]=t[0]+i[0]*r,e[1]=t[1]+i[1]*r,e[2]=t[2]+i[2]*r,e[3]=t[3]+i[3]*r,e},Mi.sub=Mi.mul=void 0;var bo=function(e,t){if(e&amp;&amp;e.__esModule)return e;if(e===null||hm(e)!=="object"&amp;&amp;typeof e!="function")return{default:e};var i=Cx(void 0);if(i&amp;&amp;i.has(e))return i.get(e);var r={},n=Object.defineProperty&amp;&amp;Object.getOwnPropertyDescriptor;for(var s in e)if(s!=="default"&amp;&amp;Object.prototype.hasOwnProperty.call(e,s)){var a=n?Object.getOwnPropertyDescriptor(e,s):null;a&amp;&amp;(a.get||a.set)?Object.defineProperty(r,s,a):r[s]=e[s]}return r.default=e,i&amp;&amp;i.set(e,r),r}(ur);function Cx(e){if(typeof WeakMap!="function")return null;var t=new WeakMap,i=new WeakMap;return(Cx=function(r){return r?i:t})(e)}function Lx(e,t,i){var r=t[0],n=t[1],s=t[2],a=t[3],l=i[0],h=i[1],d=i[2],f=i[3];return e[0]=r*l+s*h,e[1]=n*l+a*h,e[2]=r*d+s*f,e[3]=n*d+a*f,e}function Rx(e,t,i){return e[0]=t[0]-i[0],e[1]=t[1]-i[1],e[2]=t[2]-i[2],e[3]=t[3]-i[3],e}Mi.mul=Lx,Mi.sub=Rx;var Ci={};function dm(e){return dm=typeof Symbol=="function"&amp;&amp;typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&amp;&amp;typeof Symbol=="function"&amp;&amp;t.constructor===Symbol&amp;&amp;t!==Symbol.prototype?"symbol":typeof t},dm(e)}Object.defineProperty(Ci,"__esModule",{value:!0}),Ci.create=function(){var e=new hs.ARRAY_TYPE(6);return hs.ARRAY_TYPE!=Float32Array&amp;&amp;(e[1]=0,e[2]=0,e[4]=0,e[5]=0),e[0]=1,e[3]=1,e},Ci.clone=function(e){var t=new hs.ARRAY_TYPE(6);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t},Ci.copy=function(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e},Ci.identity=function(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=1,e[4]=0,e[5]=0,e},Ci.fromValues=function(e,t,i,r,n,s){var a=new hs.ARRAY_TYPE(6);return a[0]=e,a[1]=t,a[2]=i,a[3]=r,a[4]=n,a[5]=s,a},Ci.set=function(e,t,i,r,n,s,a){return e[0]=t,e[1]=i,e[2]=r,e[3]=n,e[4]=s,e[5]=a,e},Ci.invert=function(e,t){var i=t[0],r=t[1],n=t[2],s=t[3],a=t[4],l=t[5],h=i*s-r*n;return h?(e[0]=s*(h=1/h),e[1]=-r*h,e[2]=-n*h,e[3]=i*h,e[4]=(n*l-s*a)*h,e[5]=(r*a-i*l)*h,e):null},Ci.determinant=function(e){return e[0]*e[3]-e[1]*e[2]},Ci.multiply=Ox,Ci.rotate=function(e,t,i){var r=t[0],n=t[1],s=t[2],a=t[3],l=t[4],h=t[5],d=Math.sin(i),f=Math.cos(i);return e[0]=r*f+s*d,e[1]=n*f+a*d,e[2]=r*-d+s*f,e[3]=n*-d+a*f,e[4]=l,e[5]=h,e},Ci.scale=function(e,t,i){var r=t[1],n=t[2],s=t[3],a=t[4],l=t[5],h=i[0],d=i[1];return e[0]=t[0]*h,e[1]=r*h,e[2]=n*d,e[3]=s*d,e[4]=a,e[5]=l,e},Ci.translate=function(e,t,i){var r=t[0],n=t[1],s=t[2],a=t[3],l=t[4],h=t[5],d=i[0],f=i[1];return e[0]=r,e[1]=n,e[2]=s,e[3]=a,e[4]=r*d+s*f+l,e[5]=n*d+a*f+h,e},Ci.fromRotation=function(e,t){var i=Math.sin(t),r=Math.cos(t);return e[0]=r,e[1]=i,e[2]=-i,e[3]=r,e[4]=0,e[5]=0,e},Ci.fromScaling=function(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=t[1],e[4]=0,e[5]=0,e},Ci.fromTranslation=function(e,t){return e[0]=1,e[1]=0,e[2]=0,e[3]=1,e[4]=t[0],e[5]=t[1],e},Ci.str=function(e){return"mat2d("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+", "+e[4]+", "+e[5]+")"},Ci.frob=function(e){return Math.hypot(e[0],e[1],e[2],e[3],e[4],e[5],1)},Ci.add=function(e,t,i){return e[0]=t[0]+i[0],e[1]=t[1]+i[1],e[2]=t[2]+i[2],e[3]=t[3]+i[3],e[4]=t[4]+i[4],e[5]=t[5]+i[5],e},Ci.subtract=kx,Ci.multiplyScalar=function(e,t,i){return e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e[3]=t[3]*i,e[4]=t[4]*i,e[5]=t[5]*i,e},Ci.multiplyScalarAndAdd=function(e,t,i,r){return e[0]=t[0]+i[0]*r,e[1]=t[1]+i[1]*r,e[2]=t[2]+i[2]*r,e[3]=t[3]+i[3]*r,e[4]=t[4]+i[4]*r,e[5]=t[5]+i[5]*r,e},Ci.exactEquals=function(e,t){return e[0]===t[0]&amp;&amp;e[1]===t[1]&amp;&amp;e[2]===t[2]&amp;&amp;e[3]===t[3]&amp;&amp;e[4]===t[4]&amp;&amp;e[5]===t[5]},Ci.equals=function(e,t){var i=e[0],r=e[1],n=e[2],s=e[3],a=e[4],l=e[5],h=t[0],d=t[1],f=t[2],m=t[3],_=t[4],y=t[5];return Math.abs(i-h)&lt;=hs.EPSILON*Math.max(1,Math.abs(i),Math.abs(h))&amp;&amp;Math.abs(r-d)&lt;=hs.EPSILON*Math.max(1,Math.abs(r),Math.abs(d))&amp;&amp;Math.abs(n-f)&lt;=hs.EPSILON*Math.max(1,Math.abs(n),Math.abs(f))&amp;&amp;Math.abs(s-m)&lt;=hs.EPSILON*Math.max(1,Math.abs(s),Math.abs(m))&amp;&amp;Math.abs(a-_)&lt;=hs.EPSILON*Math.max(1,Math.abs(a),Math.abs(_))&amp;&amp;Math.abs(l-y)&lt;=hs.EPSILON*Math.max(1,Math.abs(l),Math.abs(y))},Ci.sub=Ci.mul=void 0;var hs=function(e,t){if(e&amp;&amp;e.__esModule)return e;if(e===null||dm(e)!=="object"&amp;&amp;typeof e!="function")return{default:e};var i=Dx(void 0);if(i&amp;&amp;i.has(e))return i.get(e);var r={},n=Object.defineProperty&amp;&amp;Object.getOwnPropertyDescriptor;for(var s in e)if(s!=="default"&amp;&amp;Object.prototype.hasOwnProperty.call(e,s)){var a=n?Object.getOwnPropertyDescriptor(e,s):null;a&amp;&amp;(a.get||a.set)?Object.defineProperty(r,s,a):r[s]=e[s]}return r.default=e,i&amp;&amp;i.set(e,r),r}(ur);function Dx(e){if(typeof WeakMap!="function")return null;var t=new WeakMap,i=new WeakMap;return(Dx=function(r){return r?i:t})(e)}function Ox(e,t,i){var r=t[0],n=t[1],s=t[2],a=t[3],l=t[4],h=t[5],d=i[0],f=i[1],m=i[2],_=i[3],y=i[4],x=i[5];return e[0]=r*d+s*f,e[1]=n*d+a*f,e[2]=r*m+s*_,e[3]=n*m+a*_,e[4]=r*y+s*x+l,e[5]=n*y+a*x+h,e}function kx(e,t,i){return e[0]=t[0]-i[0],e[1]=t[1]-i[1],e[2]=t[2]-i[2],e[3]=t[3]-i[3],e[4]=t[4]-i[4],e[5]=t[5]-i[5],e}Ci.mul=Ox,Ci.sub=kx;var fi={};function fm(e){return fm=typeof Symbol=="function"&amp;&amp;typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&amp;&amp;typeof Symbol=="function"&amp;&amp;t.constructor===Symbol&amp;&amp;t!==Symbol.prototype?"symbol":typeof t},fm(e)}Object.defineProperty(fi,"__esModule",{value:!0}),fi.create=function(){var e=new dn.ARRAY_TYPE(9);return dn.ARRAY_TYPE!=Float32Array&amp;&amp;(e[1]=0,e[2]=0,e[3]=0,e[5]=0,e[6]=0,e[7]=0),e[0]=1,e[4]=1,e[8]=1,e},fi.fromMat4=function(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[4],e[4]=t[5],e[5]=t[6],e[6]=t[8],e[7]=t[9],e[8]=t[10],e},fi.clone=function(e){var t=new dn.ARRAY_TYPE(9);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t},fi.copy=function(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e},fi.fromValues=function(e,t,i,r,n,s,a,l,h){var d=new dn.ARRAY_TYPE(9);return d[0]=e,d[1]=t,d[2]=i,d[3]=r,d[4]=n,d[5]=s,d[6]=a,d[7]=l,d[8]=h,d},fi.set=function(e,t,i,r,n,s,a,l,h,d){return e[0]=t,e[1]=i,e[2]=r,e[3]=n,e[4]=s,e[5]=a,e[6]=l,e[7]=h,e[8]=d,e},fi.identity=function(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e},fi.transpose=function(e,t){if(e===t){var i=t[1],r=t[2],n=t[5];e[1]=t[3],e[2]=t[6],e[3]=i,e[5]=t[7],e[6]=r,e[7]=n}else e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8];return e},fi.invert=function(e,t){var i=t[0],r=t[1],n=t[2],s=t[3],a=t[4],l=t[5],h=t[6],d=t[7],f=t[8],m=f*a-l*d,_=-f*s+l*h,y=d*s-a*h,x=i*m+r*_+n*y;return x?(e[0]=m*(x=1/x),e[1]=(-f*r+n*d)*x,e[2]=(l*r-n*a)*x,e[3]=_*x,e[4]=(f*i-n*h)*x,e[5]=(-l*i+n*s)*x,e[6]=y*x,e[7]=(-d*i+r*h)*x,e[8]=(a*i-r*s)*x,e):null},fi.adjoint=function(e,t){var i=t[0],r=t[1],n=t[2],s=t[3],a=t[4],l=t[5],h=t[6],d=t[7],f=t[8];return e[0]=a*f-l*d,e[1]=n*d-r*f,e[2]=r*l-n*a,e[3]=l*h-s*f,e[4]=i*f-n*h,e[5]=n*s-i*l,e[6]=s*d-a*h,e[7]=r*h-i*d,e[8]=i*a-r*s,e},fi.determinant=function(e){var t=e[3],i=e[4],r=e[5],n=e[6],s=e[7],a=e[8];return e[0]*(a*i-r*s)+e[1]*(-a*t+r*n)+e[2]*(s*t-i*n)},fi.multiply=Fx,fi.translate=function(e,t,i){var r=t[0],n=t[1],s=t[2],a=t[3],l=t[4],h=t[5],d=t[6],f=t[7],m=t[8],_=i[0],y=i[1];return e[0]=r,e[1]=n,e[2]=s,e[3]=a,e[4]=l,e[5]=h,e[6]=_*r+y*a+d,e[7]=_*n+y*l+f,e[8]=_*s+y*h+m,e},fi.rotate=function(e,t,i){var r=t[0],n=t[1],s=t[2],a=t[3],l=t[4],h=t[5],d=t[6],f=t[7],m=t[8],_=Math.sin(i),y=Math.cos(i);return e[0]=y*r+_*a,e[1]=y*n+_*l,e[2]=y*s+_*h,e[3]=y*a-_*r,e[4]=y*l-_*n,e[5]=y*h-_*s,e[6]=d,e[7]=f,e[8]=m,e},fi.scale=function(e,t,i){var r=i[0],n=i[1];return e[0]=r*t[0],e[1]=r*t[1],e[2]=r*t[2],e[3]=n*t[3],e[4]=n*t[4],e[5]=n*t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e},fi.fromTranslation=function(e,t){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=t[0],e[7]=t[1],e[8]=1,e},fi.fromRotation=function(e,t){var i=Math.sin(t),r=Math.cos(t);return e[0]=r,e[1]=i,e[2]=0,e[3]=-i,e[4]=r,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e},fi.fromScaling=function(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=0,e[4]=t[1],e[5]=0,e[6]=0,e[7]=0,e[8]=1,e},fi.fromMat2d=function(e,t){return e[0]=t[0],e[1]=t[1],e[2]=0,e[3]=t[2],e[4]=t[3],e[5]=0,e[6]=t[4],e[7]=t[5],e[8]=1,e},fi.fromQuat=function(e,t){var i=t[0],r=t[1],n=t[2],s=t[3],a=i+i,l=r+r,h=n+n,d=i*a,f=r*a,m=r*l,_=n*a,y=n*l,x=n*h,b=s*a,w=s*l,T=s*h;return e[0]=1-m-x,e[3]=f-T,e[6]=_+w,e[1]=f+T,e[4]=1-d-x,e[7]=y-b,e[2]=_-w,e[5]=y+b,e[8]=1-d-m,e},fi.normalFromMat4=function(e,t){var i=t[0],r=t[1],n=t[2],s=t[3],a=t[4],l=t[5],h=t[6],d=t[7],f=t[8],m=t[9],_=t[10],y=t[11],x=t[12],b=t[13],w=t[14],T=t[15],S=i*l-r*a,I=i*h-n*a,P=i*d-s*a,M=r*h-n*l,C=r*d-s*l,D=n*d-s*h,O=f*b-m*x,k=f*w-_*x,z=f*T-y*x,B=m*w-_*b,U=m*T-y*b,Z=_*T-y*w,F=S*Z-I*U+P*B+M*z-C*k+D*O;return F?(e[0]=(l*Z-h*U+d*B)*(F=1/F),e[1]=(h*z-a*Z-d*k)*F,e[2]=(a*U-l*z+d*O)*F,e[3]=(n*U-r*Z-s*B)*F,e[4]=(i*Z-n*z+s*k)*F,e[5]=(r*z-i*U-s*O)*F,e[6]=(b*D-w*C+T*M)*F,e[7]=(w*P-x*D-T*I)*F,e[8]=(x*C-b*P+T*S)*F,e):null},fi.projection=function(e,t,i){return e[0]=2/t,e[1]=0,e[2]=0,e[3]=0,e[4]=-2/i,e[5]=0,e[6]=-1,e[7]=1,e[8]=1,e},fi.str=function(e){return"mat3("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+", "+e[4]+", "+e[5]+", "+e[6]+", "+e[7]+", "+e[8]+")"},fi.frob=function(e){return Math.hypot(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])},fi.add=function(e,t,i){return e[0]=t[0]+i[0],e[1]=t[1]+i[1],e[2]=t[2]+i[2],e[3]=t[3]+i[3],e[4]=t[4]+i[4],e[5]=t[5]+i[5],e[6]=t[6]+i[6],e[7]=t[7]+i[7],e[8]=t[8]+i[8],e},fi.subtract=Bx,fi.multiplyScalar=function(e,t,i){return e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e[3]=t[3]*i,e[4]=t[4]*i,e[5]=t[5]*i,e[6]=t[6]*i,e[7]=t[7]*i,e[8]=t[8]*i,e},fi.multiplyScalarAndAdd=function(e,t,i,r){return e[0]=t[0]+i[0]*r,e[1]=t[1]+i[1]*r,e[2]=t[2]+i[2]*r,e[3]=t[3]+i[3]*r,e[4]=t[4]+i[4]*r,e[5]=t[5]+i[5]*r,e[6]=t[6]+i[6]*r,e[7]=t[7]+i[7]*r,e[8]=t[8]+i[8]*r,e},fi.exactEquals=function(e,t){return e[0]===t[0]&amp;&amp;e[1]===t[1]&amp;&amp;e[2]===t[2]&amp;&amp;e[3]===t[3]&amp;&amp;e[4]===t[4]&amp;&amp;e[5]===t[5]&amp;&amp;e[6]===t[6]&amp;&amp;e[7]===t[7]&amp;&amp;e[8]===t[8]},fi.equals=function(e,t){var i=e[0],r=e[1],n=e[2],s=e[3],a=e[4],l=e[5],h=e[6],d=e[7],f=e[8],m=t[0],_=t[1],y=t[2],x=t[3],b=t[4],w=t[5],T=t[6],S=t[7],I=t[8];return Math.abs(i-m)&lt;=dn.EPSILON*Math.max(1,Math.abs(i),Math.abs(m))&amp;&amp;Math.abs(r-_)&lt;=dn.EPSILON*Math.max(1,Math.abs(r),Math.abs(_))&amp;&amp;Math.abs(n-y)&lt;=dn.EPSILON*Math.max(1,Math.abs(n),Math.abs(y))&amp;&amp;Math.abs(s-x)&lt;=dn.EPSILON*Math.max(1,Math.abs(s),Math.abs(x))&amp;&amp;Math.abs(a-b)&lt;=dn.EPSILON*Math.max(1,Math.abs(a),Math.abs(b))&amp;&amp;Math.abs(l-w)&lt;=dn.EPSILON*Math.max(1,Math.abs(l),Math.abs(w))&amp;&amp;Math.abs(h-T)&lt;=dn.EPSILON*Math.max(1,Math.abs(h),Math.abs(T))&amp;&amp;Math.abs(d-S)&lt;=dn.EPSILON*Math.max(1,Math.abs(d),Math.abs(S))&amp;&amp;Math.abs(f-I)&lt;=dn.EPSILON*Math.max(1,Math.abs(f),Math.abs(I))},fi.sub=fi.mul=void 0;var dn=function(e,t){if(e&amp;&amp;e.__esModule)return e;if(e===null||fm(e)!=="object"&amp;&amp;typeof e!="function")return{default:e};var i=zx(void 0);if(i&amp;&amp;i.has(e))return i.get(e);var r={},n=Object.defineProperty&amp;&amp;Object.getOwnPropertyDescriptor;for(var s in e)if(s!=="default"&amp;&amp;Object.prototype.hasOwnProperty.call(e,s)){var a=n?Object.getOwnPropertyDescriptor(e,s):null;a&amp;&amp;(a.get||a.set)?Object.defineProperty(r,s,a):r[s]=e[s]}return r.default=e,i&amp;&amp;i.set(e,r),r}(ur);function zx(e){if(typeof WeakMap!="function")return null;var t=new WeakMap,i=new WeakMap;return(zx=function(r){return r?i:t})(e)}function Fx(e,t,i){var r=t[0],n=t[1],s=t[2],a=t[3],l=t[4],h=t[5],d=t[6],f=t[7],m=t[8],_=i[0],y=i[1],x=i[2],b=i[3],w=i[4],T=i[5],S=i[6],I=i[7],P=i[8];return e[0]=_*r+y*a+x*d,e[1]=_*n+y*l+x*f,e[2]=_*s+y*h+x*m,e[3]=b*r+w*a+T*d,e[4]=b*n+w*l+T*f,e[5]=b*s+w*h+T*m,e[6]=S*r+I*a+P*d,e[7]=S*n+I*l+P*f,e[8]=S*s+I*h+P*m,e}function Bx(e,t,i){return e[0]=t[0]-i[0],e[1]=t[1]-i[1],e[2]=t[2]-i[2],e[3]=t[3]-i[3],e[4]=t[4]-i[4],e[5]=t[5]-i[5],e[6]=t[6]-i[6],e[7]=t[7]-i[7],e[8]=t[8]-i[8],e}fi.mul=Fx,fi.sub=Bx;var Ae={};function pm(e){return pm=typeof Symbol=="function"&amp;&amp;typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&amp;&amp;typeof Symbol=="function"&amp;&amp;t.constructor===Symbol&amp;&amp;t!==Symbol.prototype?"symbol":typeof t},pm(e)}Object.defineProperty(Ae,"__esModule",{value:!0}),Ae.create=function(){var e=new ki.ARRAY_TYPE(16);return ki.ARRAY_TYPE!=Float32Array&amp;&amp;(e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0),e[0]=1,e[5]=1,e[10]=1,e[15]=1,e},Ae.clone=function(e){var t=new ki.ARRAY_TYPE(16);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t},Ae.copy=function(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e},Ae.fromValues=function(e,t,i,r,n,s,a,l,h,d,f,m,_,y,x,b){var w=new ki.ARRAY_TYPE(16);return w[0]=e,w[1]=t,w[2]=i,w[3]=r,w[4]=n,w[5]=s,w[6]=a,w[7]=l,w[8]=h,w[9]=d,w[10]=f,w[11]=m,w[12]=_,w[13]=y,w[14]=x,w[15]=b,w},Ae.set=function(e,t,i,r,n,s,a,l,h,d,f,m,_,y,x,b,w){return e[0]=t,e[1]=i,e[2]=r,e[3]=n,e[4]=s,e[5]=a,e[6]=l,e[7]=h,e[8]=d,e[9]=f,e[10]=m,e[11]=_,e[12]=y,e[13]=x,e[14]=b,e[15]=w,e},Ae.identity=Ux,Ae.transpose=function(e,t){if(e===t){var i=t[1],r=t[2],n=t[3],s=t[6],a=t[7],l=t[11];e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=i,e[6]=t[9],e[7]=t[13],e[8]=r,e[9]=s,e[11]=t[14],e[12]=n,e[13]=a,e[14]=l}else e[0]=t[0],e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=t[1],e[5]=t[5],e[6]=t[9],e[7]=t[13],e[8]=t[2],e[9]=t[6],e[10]=t[10],e[11]=t[14],e[12]=t[3],e[13]=t[7],e[14]=t[11],e[15]=t[15];return e},Ae.invert=function(e,t){var i=t[0],r=t[1],n=t[2],s=t[3],a=t[4],l=t[5],h=t[6],d=t[7],f=t[8],m=t[9],_=t[10],y=t[11],x=t[12],b=t[13],w=t[14],T=t[15],S=i*l-r*a,I=i*h-n*a,P=i*d-s*a,M=r*h-n*l,C=r*d-s*l,D=n*d-s*h,O=f*b-m*x,k=f*w-_*x,z=f*T-y*x,B=m*w-_*b,U=m*T-y*b,Z=_*T-y*w,F=S*Z-I*U+P*B+M*z-C*k+D*O;return F?(e[0]=(l*Z-h*U+d*B)*(F=1/F),e[1]=(n*U-r*Z-s*B)*F,e[2]=(b*D-w*C+T*M)*F,e[3]=(_*C-m*D-y*M)*F,e[4]=(h*z-a*Z-d*k)*F,e[5]=(i*Z-n*z+s*k)*F,e[6]=(w*P-x*D-T*I)*F,e[7]=(f*D-_*P+y*I)*F,e[8]=(a*U-l*z+d*O)*F,e[9]=(r*z-i*U-s*O)*F,e[10]=(x*C-b*P+T*S)*F,e[11]=(m*P-f*C-y*S)*F,e[12]=(l*k-a*B-h*O)*F,e[13]=(i*B-r*k+n*O)*F,e[14]=(b*I-x*M-w*S)*F,e[15]=(f*M-m*I+_*S)*F,e):null},Ae.adjoint=function(e,t){var i=t[0],r=t[1],n=t[2],s=t[3],a=t[4],l=t[5],h=t[6],d=t[7],f=t[8],m=t[9],_=t[10],y=t[11],x=t[12],b=t[13],w=t[14],T=t[15];return e[0]=l*(_*T-y*w)-m*(h*T-d*w)+b*(h*y-d*_),e[1]=-(r*(_*T-y*w)-m*(n*T-s*w)+b*(n*y-s*_)),e[2]=r*(h*T-d*w)-l*(n*T-s*w)+b*(n*d-s*h),e[3]=-(r*(h*y-d*_)-l*(n*y-s*_)+m*(n*d-s*h)),e[4]=-(a*(_*T-y*w)-f*(h*T-d*w)+x*(h*y-d*_)),e[5]=i*(_*T-y*w)-f*(n*T-s*w)+x*(n*y-s*_),e[6]=-(i*(h*T-d*w)-a*(n*T-s*w)+x*(n*d-s*h)),e[7]=i*(h*y-d*_)-a*(n*y-s*_)+f*(n*d-s*h),e[8]=a*(m*T-y*b)-f*(l*T-d*b)+x*(l*y-d*m),e[9]=-(i*(m*T-y*b)-f*(r*T-s*b)+x*(r*y-s*m)),e[10]=i*(l*T-d*b)-a*(r*T-s*b)+x*(r*d-s*l),e[11]=-(i*(l*y-d*m)-a*(r*y-s*m)+f*(r*d-s*l)),e[12]=-(a*(m*w-_*b)-f*(l*w-h*b)+x*(l*_-h*m)),e[13]=i*(m*w-_*b)-f*(r*w-n*b)+x*(r*_-n*m),e[14]=-(i*(l*w-h*b)-a*(r*w-n*b)+x*(r*h-n*l)),e[15]=i*(l*_-h*m)-a*(r*_-n*m)+f*(r*h-n*l),e},Ae.determinant=function(e){var t=e[0],i=e[1],r=e[2],n=e[3],s=e[4],a=e[5],l=e[6],h=e[7],d=e[8],f=e[9],m=e[10],_=e[11],y=e[12],x=e[13],b=e[14],w=e[15];return(t*a-i*s)*(m*w-_*b)-(t*l-r*s)*(f*w-_*x)+(t*h-n*s)*(f*b-m*x)+(i*l-r*a)*(d*w-_*y)-(i*h-n*a)*(d*b-m*y)+(r*h-n*l)*(d*x-f*y)},Ae.multiply=Vx,Ae.translate=function(e,t,i){var r,n,s,a,l,h,d,f,m,_,y,x,b=i[0],w=i[1],T=i[2];return t===e?(e[12]=t[0]*b+t[4]*w+t[8]*T+t[12],e[13]=t[1]*b+t[5]*w+t[9]*T+t[13],e[14]=t[2]*b+t[6]*w+t[10]*T+t[14],e[15]=t[3]*b+t[7]*w+t[11]*T+t[15]):(n=t[1],s=t[2],a=t[3],l=t[4],h=t[5],d=t[6],f=t[7],m=t[8],_=t[9],y=t[10],x=t[11],e[0]=r=t[0],e[1]=n,e[2]=s,e[3]=a,e[4]=l,e[5]=h,e[6]=d,e[7]=f,e[8]=m,e[9]=_,e[10]=y,e[11]=x,e[12]=r*b+l*w+m*T+t[12],e[13]=n*b+h*w+_*T+t[13],e[14]=s*b+d*w+y*T+t[14],e[15]=a*b+f*w+x*T+t[15]),e},Ae.scale=function(e,t,i){var r=i[0],n=i[1],s=i[2];return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e[4]=t[4]*n,e[5]=t[5]*n,e[6]=t[6]*n,e[7]=t[7]*n,e[8]=t[8]*s,e[9]=t[9]*s,e[10]=t[10]*s,e[11]=t[11]*s,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e},Ae.rotate=function(e,t,i,r){var n,s,a,l,h,d,f,m,_,y,x,b,w,T,S,I,P,M,C,D,O,k,z,B,U=r[0],Z=r[1],F=r[2],Y=Math.hypot(U,Z,F);return Y&lt;ki.EPSILON?null:(U*=Y=1/Y,Z*=Y,F*=Y,n=Math.sin(i),s=Math.cos(i),h=t[1],d=t[2],f=t[3],_=t[5],y=t[6],x=t[7],w=t[9],T=t[10],S=t[11],C=U*Z*(a=1-s)-F*n,D=Z*Z*a+s,O=F*Z*a+U*n,k=U*F*a+Z*n,z=Z*F*a-U*n,B=F*F*a+s,e[0]=(l=t[0])*(I=U*U*a+s)+(m=t[4])*(P=Z*U*a+F*n)+(b=t[8])*(M=F*U*a-Z*n),e[1]=h*I+_*P+w*M,e[2]=d*I+y*P+T*M,e[3]=f*I+x*P+S*M,e[4]=l*C+m*D+b*O,e[5]=h*C+_*D+w*O,e[6]=d*C+y*D+T*O,e[7]=f*C+x*D+S*O,e[8]=l*k+m*z+b*B,e[9]=h*k+_*z+w*B,e[10]=d*k+y*z+T*B,e[11]=f*k+x*z+S*B,t!==e&amp;&amp;(e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e)},Ae.rotateX=function(e,t,i){var r=Math.sin(i),n=Math.cos(i),s=t[4],a=t[5],l=t[6],h=t[7],d=t[8],f=t[9],m=t[10],_=t[11];return t!==e&amp;&amp;(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[4]=s*n+d*r,e[5]=a*n+f*r,e[6]=l*n+m*r,e[7]=h*n+_*r,e[8]=d*n-s*r,e[9]=f*n-a*r,e[10]=m*n-l*r,e[11]=_*n-h*r,e},Ae.rotateY=function(e,t,i){var r=Math.sin(i),n=Math.cos(i),s=t[0],a=t[1],l=t[2],h=t[3],d=t[8],f=t[9],m=t[10],_=t[11];return t!==e&amp;&amp;(e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=s*n-d*r,e[1]=a*n-f*r,e[2]=l*n-m*r,e[3]=h*n-_*r,e[8]=s*r+d*n,e[9]=a*r+f*n,e[10]=l*r+m*n,e[11]=h*r+_*n,e},Ae.rotateZ=function(e,t,i){var r=Math.sin(i),n=Math.cos(i),s=t[0],a=t[1],l=t[2],h=t[3],d=t[4],f=t[5],m=t[6],_=t[7];return t!==e&amp;&amp;(e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=s*n+d*r,e[1]=a*n+f*r,e[2]=l*n+m*r,e[3]=h*n+_*r,e[4]=d*n-s*r,e[5]=f*n-a*r,e[6]=m*n-l*r,e[7]=_*n-h*r,e},Ae.fromTranslation=function(e,t){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=t[0],e[13]=t[1],e[14]=t[2],e[15]=1,e},Ae.fromScaling=function(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=t[1],e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=t[2],e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e},Ae.fromRotation=function(e,t,i){var r,n,s,a=i[0],l=i[1],h=i[2],d=Math.hypot(a,l,h);return d&lt;ki.EPSILON?null:(a*=d=1/d,l*=d,h*=d,r=Math.sin(t),n=Math.cos(t),e[0]=a*a*(s=1-n)+n,e[1]=l*a*s+h*r,e[2]=h*a*s-l*r,e[3]=0,e[4]=a*l*s-h*r,e[5]=l*l*s+n,e[6]=h*l*s+a*r,e[7]=0,e[8]=a*h*s+l*r,e[9]=l*h*s-a*r,e[10]=h*h*s+n,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e)},Ae.fromXRotation=function(e,t){var i=Math.sin(t),r=Math.cos(t);return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=r,e[6]=i,e[7]=0,e[8]=0,e[9]=-i,e[10]=r,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e},Ae.fromYRotation=function(e,t){var i=Math.sin(t),r=Math.cos(t);return e[0]=r,e[1]=0,e[2]=-i,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=i,e[9]=0,e[10]=r,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e},Ae.fromZRotation=function(e,t){var i=Math.sin(t),r=Math.cos(t);return e[0]=r,e[1]=i,e[2]=0,e[3]=0,e[4]=-i,e[5]=r,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e},Ae.fromRotationTranslation=jx,Ae.fromQuat2=function(e,t){var i=new ki.ARRAY_TYPE(3),r=-t[0],n=-t[1],s=-t[2],a=t[3],l=t[4],h=t[5],d=t[6],f=t[7],m=r*r+n*n+s*s+a*a;return m&gt;0?(i[0]=2*(l*a+f*r+h*s-d*n)/m,i[1]=2*(h*a+f*n+d*r-l*s)/m,i[2]=2*(d*a+f*s+l*n-h*r)/m):(i[0]=2*(l*a+f*r+h*s-d*n),i[1]=2*(h*a+f*n+d*r-l*s),i[2]=2*(d*a+f*s+l*n-h*r)),jx(e,t,i),e},Ae.getTranslation=function(e,t){return e[0]=t[12],e[1]=t[13],e[2]=t[14],e},Ae.getScaling=Gx,Ae.getRotation=function(e,t){var i=new ki.ARRAY_TYPE(3);Gx(i,t);var r=1/i[0],n=1/i[1],s=1/i[2],a=t[0]*r,l=t[1]*n,h=t[2]*s,d=t[4]*r,f=t[5]*n,m=t[6]*s,_=t[8]*r,y=t[9]*n,x=t[10]*s,b=a+f+x,w=0;return b&gt;0?(w=2*Math.sqrt(b+1),e[3]=.25*w,e[0]=(m-y)/w,e[1]=(_-h)/w,e[2]=(l-d)/w):a&gt;f&amp;&amp;a&gt;x?(w=2*Math.sqrt(1+a-f-x),e[3]=(m-y)/w,e[0]=.25*w,e[1]=(l+d)/w,e[2]=(_+h)/w):f&gt;x?(w=2*Math.sqrt(1+f-a-x),e[3]=(_-h)/w,e[0]=(l+d)/w,e[1]=.25*w,e[2]=(m+y)/w):(w=2*Math.sqrt(1+x-a-f),e[3]=(l-d)/w,e[0]=(_+h)/w,e[1]=(m+y)/w,e[2]=.25*w),e},Ae.fromRotationTranslationScale=function(e,t,i,r){var n=t[0],s=t[1],a=t[2],l=t[3],h=n+n,d=s+s,f=a+a,m=n*h,_=n*d,y=n*f,x=s*d,b=s*f,w=a*f,T=l*h,S=l*d,I=l*f,P=r[0],M=r[1],C=r[2];return e[0]=(1-(x+w))*P,e[1]=(_+I)*P,e[2]=(y-S)*P,e[3]=0,e[4]=(_-I)*M,e[5]=(1-(m+w))*M,e[6]=(b+T)*M,e[7]=0,e[8]=(y+S)*C,e[9]=(b-T)*C,e[10]=(1-(m+x))*C,e[11]=0,e[12]=i[0],e[13]=i[1],e[14]=i[2],e[15]=1,e},Ae.fromRotationTranslationScaleOrigin=function(e,t,i,r,n){var s=t[0],a=t[1],l=t[2],h=t[3],d=s+s,f=a+a,m=l+l,_=s*d,y=s*f,x=s*m,b=a*f,w=a*m,T=l*m,S=h*d,I=h*f,P=h*m,M=r[0],C=r[1],D=r[2],O=n[0],k=n[1],z=n[2],B=(1-(b+T))*M,U=(y+P)*M,Z=(x-I)*M,F=(y-P)*C,Y=(1-(_+T))*C,J=(w+S)*C,it=(x+I)*D,X=(w-S)*D,K=(1-(_+b))*D;return e[0]=B,e[1]=U,e[2]=Z,e[3]=0,e[4]=F,e[5]=Y,e[6]=J,e[7]=0,e[8]=it,e[9]=X,e[10]=K,e[11]=0,e[12]=i[0]+O-(B*O+F*k+it*z),e[13]=i[1]+k-(U*O+Y*k+X*z),e[14]=i[2]+z-(Z*O+J*k+K*z),e[15]=1,e},Ae.fromQuat=function(e,t){var i=t[0],r=t[1],n=t[2],s=t[3],a=i+i,l=r+r,h=n+n,d=i*a,f=r*a,m=r*l,_=n*a,y=n*l,x=n*h,b=s*a,w=s*l,T=s*h;return e[0]=1-m-x,e[1]=f+T,e[2]=_-w,e[3]=0,e[4]=f-T,e[5]=1-d-x,e[6]=y+b,e[7]=0,e[8]=_+w,e[9]=y-b,e[10]=1-d-m,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e},Ae.frustum=function(e,t,i,r,n,s,a){var l=1/(i-t),h=1/(n-r),d=1/(s-a);return e[0]=2*s*l,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=2*s*h,e[6]=0,e[7]=0,e[8]=(i+t)*l,e[9]=(n+r)*h,e[10]=(a+s)*d,e[11]=-1,e[12]=0,e[13]=0,e[14]=a*s*2*d,e[15]=0,e},Ae.perspectiveNO=Hx,Ae.perspectiveZO=function(e,t,i,r,n){var s,a=1/Math.tan(t/2);return e[0]=a/i,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=a,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,n!=null&amp;&amp;n!==1/0?(e[10]=n*(s=1/(r-n)),e[14]=n*r*s):(e[10]=-1,e[14]=-r),e},Ae.perspectiveFromFieldOfView=function(e,t,i,r){var n=Math.tan(t.upDegrees*Math.PI/180),s=Math.tan(t.downDegrees*Math.PI/180),a=Math.tan(t.leftDegrees*Math.PI/180),l=Math.tan(t.rightDegrees*Math.PI/180),h=2/(a+l),d=2/(n+s);return e[0]=h,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=d,e[6]=0,e[7]=0,e[8]=-(a-l)*h*.5,e[9]=(n-s)*d*.5,e[10]=r/(i-r),e[11]=-1,e[12]=0,e[13]=0,e[14]=r*i/(i-r),e[15]=0,e},Ae.orthoNO=Wx,Ae.orthoZO=function(e,t,i,r,n,s,a){var l=1/(t-i),h=1/(r-n),d=1/(s-a);return e[0]=-2*l,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*h,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=d,e[11]=0,e[12]=(t+i)*l,e[13]=(n+r)*h,e[14]=s*d,e[15]=1,e},Ae.lookAt=function(e,t,i,r){var n,s,a,l,h,d,f,m,_,y,x=t[0],b=t[1],w=t[2],T=r[0],S=r[1],I=r[2],P=i[0],M=i[1],C=i[2];return Math.abs(x-P)&lt;ki.EPSILON&amp;&amp;Math.abs(b-M)&lt;ki.EPSILON&amp;&amp;Math.abs(w-C)&lt;ki.EPSILON?Ux(e):(f=x-P,m=b-M,_=w-C,n=S*(_*=y=1/Math.hypot(f,m,_))-I*(m*=y),s=I*(f*=y)-T*_,a=T*m-S*f,(y=Math.hypot(n,s,a))?(n*=y=1/y,s*=y,a*=y):(n=0,s=0,a=0),l=m*a-_*s,h=_*n-f*a,d=f*s-m*n,(y=Math.hypot(l,h,d))?(l*=y=1/y,h*=y,d*=y):(l=0,h=0,d=0),e[0]=n,e[1]=l,e[2]=f,e[3]=0,e[4]=s,e[5]=h,e[6]=m,e[7]=0,e[8]=a,e[9]=d,e[10]=_,e[11]=0,e[12]=-(n*x+s*b+a*w),e[13]=-(l*x+h*b+d*w),e[14]=-(f*x+m*b+_*w),e[15]=1,e)},Ae.targetTo=function(e,t,i,r){var n=t[0],s=t[1],a=t[2],l=r[0],h=r[1],d=r[2],f=n-i[0],m=s-i[1],_=a-i[2],y=f*f+m*m+_*_;y&gt;0&amp;&amp;(f*=y=1/Math.sqrt(y),m*=y,_*=y);var x=h*_-d*m,b=d*f-l*_,w=l*m-h*f;return(y=x*x+b*b+w*w)&gt;0&amp;&amp;(x*=y=1/Math.sqrt(y),b*=y,w*=y),e[0]=x,e[1]=b,e[2]=w,e[3]=0,e[4]=m*w-_*b,e[5]=_*x-f*w,e[6]=f*b-m*x,e[7]=0,e[8]=f,e[9]=m,e[10]=_,e[11]=0,e[12]=n,e[13]=s,e[14]=a,e[15]=1,e},Ae.str=function(e){return"mat4("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+", "+e[4]+", "+e[5]+", "+e[6]+", "+e[7]+", "+e[8]+", "+e[9]+", "+e[10]+", "+e[11]+", "+e[12]+", "+e[13]+", "+e[14]+", "+e[15]+")"},Ae.frob=function(e){return Math.hypot(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15])},Ae.add=function(e,t,i){return e[0]=t[0]+i[0],e[1]=t[1]+i[1],e[2]=t[2]+i[2],e[3]=t[3]+i[3],e[4]=t[4]+i[4],e[5]=t[5]+i[5],e[6]=t[6]+i[6],e[7]=t[7]+i[7],e[8]=t[8]+i[8],e[9]=t[9]+i[9],e[10]=t[10]+i[10],e[11]=t[11]+i[11],e[12]=t[12]+i[12],e[13]=t[13]+i[13],e[14]=t[14]+i[14],e[15]=t[15]+i[15],e},Ae.subtract=qx,Ae.multiplyScalar=function(e,t,i){return e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e[3]=t[3]*i,e[4]=t[4]*i,e[5]=t[5]*i,e[6]=t[6]*i,e[7]=t[7]*i,e[8]=t[8]*i,e[9]=t[9]*i,e[10]=t[10]*i,e[11]=t[11]*i,e[12]=t[12]*i,e[13]=t[13]*i,e[14]=t[14]*i,e[15]=t[15]*i,e},Ae.multiplyScalarAndAdd=function(e,t,i,r){return e[0]=t[0]+i[0]*r,e[1]=t[1]+i[1]*r,e[2]=t[2]+i[2]*r,e[3]=t[3]+i[3]*r,e[4]=t[4]+i[4]*r,e[5]=t[5]+i[5]*r,e[6]=t[6]+i[6]*r,e[7]=t[7]+i[7]*r,e[8]=t[8]+i[8]*r,e[9]=t[9]+i[9]*r,e[10]=t[10]+i[10]*r,e[11]=t[11]+i[11]*r,e[12]=t[12]+i[12]*r,e[13]=t[13]+i[13]*r,e[14]=t[14]+i[14]*r,e[15]=t[15]+i[15]*r,e},Ae.exactEquals=function(e,t){return e[0]===t[0]&amp;&amp;e[1]===t[1]&amp;&amp;e[2]===t[2]&amp;&amp;e[3]===t[3]&amp;&amp;e[4]===t[4]&amp;&amp;e[5]===t[5]&amp;&amp;e[6]===t[6]&amp;&amp;e[7]===t[7]&amp;&amp;e[8]===t[8]&amp;&amp;e[9]===t[9]&amp;&amp;e[10]===t[10]&amp;&amp;e[11]===t[11]&amp;&amp;e[12]===t[12]&amp;&amp;e[13]===t[13]&amp;&amp;e[14]===t[14]&amp;&amp;e[15]===t[15]},Ae.equals=function(e,t){var i=e[0],r=e[1],n=e[2],s=e[3],a=e[4],l=e[5],h=e[6],d=e[7],f=e[8],m=e[9],_=e[10],y=e[11],x=e[12],b=e[13],w=e[14],T=e[15],S=t[0],I=t[1],P=t[2],M=t[3],C=t[4],D=t[5],O=t[6],k=t[7],z=t[8],B=t[9],U=t[10],Z=t[11],F=t[12],Y=t[13],J=t[14],it=t[15];return Math.abs(i-S)&lt;=ki.EPSILON*Math.max(1,Math.abs(i),Math.abs(S))&amp;&amp;Math.abs(r-I)&lt;=ki.EPSILON*Math.max(1,Math.abs(r),Math.abs(I))&amp;&amp;Math.abs(n-P)&lt;=ki.EPSILON*Math.max(1,Math.abs(n),Math.abs(P))&amp;&amp;Math.abs(s-M)&lt;=ki.EPSILON*Math.max(1,Math.abs(s),Math.abs(M))&amp;&amp;Math.abs(a-C)&lt;=ki.EPSILON*Math.max(1,Math.abs(a),Math.abs(C))&amp;&amp;Math.abs(l-D)&lt;=ki.EPSILON*Math.max(1,Math.abs(l),Math.abs(D))&amp;&amp;Math.abs(h-O)&lt;=ki.EPSILON*Math.max(1,Math.abs(h),Math.abs(O))&amp;&amp;Math.abs(d-k)&lt;=ki.EPSILON*Math.max(1,Math.abs(d),Math.abs(k))&amp;&amp;Math.abs(f-z)&lt;=ki.EPSILON*Math.max(1,Math.abs(f),Math.abs(z))&amp;&amp;Math.abs(m-B)&lt;=ki.EPSILON*Math.max(1,Math.abs(m),Math.abs(B))&amp;&amp;Math.abs(_-U)&lt;=ki.EPSILON*Math.max(1,Math.abs(_),Math.abs(U))&amp;&amp;Math.abs(y-Z)&lt;=ki.EPSILON*Math.max(1,Math.abs(y),Math.abs(Z))&amp;&amp;Math.abs(x-F)&lt;=ki.EPSILON*Math.max(1,Math.abs(x),Math.abs(F))&amp;&amp;Math.abs(b-Y)&lt;=ki.EPSILON*Math.max(1,Math.abs(b),Math.abs(Y))&amp;&amp;Math.abs(w-J)&lt;=ki.EPSILON*Math.max(1,Math.abs(w),Math.abs(J))&amp;&amp;Math.abs(T-it)&lt;=ki.EPSILON*Math.max(1,Math.abs(T),Math.abs(it))},Ae.sub=Ae.mul=Ae.ortho=Ae.perspective=void 0;var ki=function(e,t){if(e&amp;&amp;e.__esModule)return e;if(e===null||pm(e)!=="object"&amp;&amp;typeof e!="function")return{default:e};var i=Nx(void 0);if(i&amp;&amp;i.has(e))return i.get(e);var r={},n=Object.defineProperty&amp;&amp;Object.getOwnPropertyDescriptor;for(var s in e)if(s!=="default"&amp;&amp;Object.prototype.hasOwnProperty.call(e,s)){var a=n?Object.getOwnPropertyDescriptor(e,s):null;a&amp;&amp;(a.get||a.set)?Object.defineProperty(r,s,a):r[s]=e[s]}return r.default=e,i&amp;&amp;i.set(e,r),r}(ur);function Nx(e){if(typeof WeakMap!="function")return null;var t=new WeakMap,i=new WeakMap;return(Nx=function(r){return r?i:t})(e)}function Ux(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function Vx(e,t,i){var r=t[0],n=t[1],s=t[2],a=t[3],l=t[4],h=t[5],d=t[6],f=t[7],m=t[8],_=t[9],y=t[10],x=t[11],b=t[12],w=t[13],T=t[14],S=t[15],I=i[0],P=i[1],M=i[2],C=i[3];return e[0]=I*r+P*l+M*m+C*b,e[1]=I*n+P*h+M*_+C*w,e[2]=I*s+P*d+M*y+C*T,e[3]=I*a+P*f+M*x+C*S,e[4]=(I=i[4])*r+(P=i[5])*l+(M=i[6])*m+(C=i[7])*b,e[5]=I*n+P*h+M*_+C*w,e[6]=I*s+P*d+M*y+C*T,e[7]=I*a+P*f+M*x+C*S,e[8]=(I=i[8])*r+(P=i[9])*l+(M=i[10])*m+(C=i[11])*b,e[9]=I*n+P*h+M*_+C*w,e[10]=I*s+P*d+M*y+C*T,e[11]=I*a+P*f+M*x+C*S,e[12]=(I=i[12])*r+(P=i[13])*l+(M=i[14])*m+(C=i[15])*b,e[13]=I*n+P*h+M*_+C*w,e[14]=I*s+P*d+M*y+C*T,e[15]=I*a+P*f+M*x+C*S,e}function jx(e,t,i){var r=t[0],n=t[1],s=t[2],a=t[3],l=r+r,h=n+n,d=s+s,f=r*l,m=r*h,_=r*d,y=n*h,x=n*d,b=s*d,w=a*l,T=a*h,S=a*d;return e[0]=1-(y+b),e[1]=m+S,e[2]=_-T,e[3]=0,e[4]=m-S,e[5]=1-(f+b),e[6]=x+w,e[7]=0,e[8]=_+T,e[9]=x-w,e[10]=1-(f+y),e[11]=0,e[12]=i[0],e[13]=i[1],e[14]=i[2],e[15]=1,e}function Gx(e,t){var i=t[4],r=t[5],n=t[6],s=t[8],a=t[9],l=t[10];return e[0]=Math.hypot(t[0],t[1],t[2]),e[1]=Math.hypot(i,r,n),e[2]=Math.hypot(s,a,l),e}function Hx(e,t,i,r,n){var s,a=1/Math.tan(t/2);return e[0]=a/i,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=a,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,n!=null&amp;&amp;n!==1/0?(e[10]=(n+r)*(s=1/(r-n)),e[14]=2*n*r*s):(e[10]=-1,e[14]=-2*r),e}function Wx(e,t,i,r,n,s,a){var l=1/(t-i),h=1/(r-n),d=1/(s-a);return e[0]=-2*l,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*h,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*d,e[11]=0,e[12]=(t+i)*l,e[13]=(n+r)*h,e[14]=(a+s)*d,e[15]=1,e}function qx(e,t,i){return e[0]=t[0]-i[0],e[1]=t[1]-i[1],e[2]=t[2]-i[2],e[3]=t[3]-i[3],e[4]=t[4]-i[4],e[5]=t[5]-i[5],e[6]=t[6]-i[6],e[7]=t[7]-i[7],e[8]=t[8]-i[8],e[9]=t[9]-i[9],e[10]=t[10]-i[10],e[11]=t[11]-i[11],e[12]=t[12]-i[12],e[13]=t[13]-i[13],e[14]=t[14]-i[14],e[15]=t[15]-i[15],e}Ae.perspective=Hx,Ae.ortho=Wx,Ae.mul=Vx,Ae.sub=qx;var we={},Se={};function mm(e){return mm=typeof Symbol=="function"&amp;&amp;typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&amp;&amp;typeof Symbol=="function"&amp;&amp;t.constructor===Symbol&amp;&amp;t!==Symbol.prototype?"symbol":typeof t},mm(e)}Object.defineProperty(Se,"__esModule",{value:!0}),Se.create=$x,Se.clone=function(e){var t=new Hs.ARRAY_TYPE(3);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t},Se.length=Xx,Se.fromValues=function(e,t,i){var r=new Hs.ARRAY_TYPE(3);return r[0]=e,r[1]=t,r[2]=i,r},Se.copy=function(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e},Se.set=function(e,t,i,r){return e[0]=t,e[1]=i,e[2]=r,e},Se.add=function(e,t,i){return e[0]=t[0]+i[0],e[1]=t[1]+i[1],e[2]=t[2]+i[2],e},Se.subtract=Yx,Se.multiply=Kx,Se.divide=Jx,Se.ceil=function(e,t){return e[0]=Math.ceil(t[0]),e[1]=Math.ceil(t[1]),e[2]=Math.ceil(t[2]),e},Se.floor=function(e,t){return e[0]=Math.floor(t[0]),e[1]=Math.floor(t[1]),e[2]=Math.floor(t[2]),e},Se.min=function(e,t,i){return e[0]=Math.min(t[0],i[0]),e[1]=Math.min(t[1],i[1]),e[2]=Math.min(t[2],i[2]),e},Se.max=function(e,t,i){return e[0]=Math.max(t[0],i[0]),e[1]=Math.max(t[1],i[1]),e[2]=Math.max(t[2],i[2]),e},Se.round=function(e,t){return e[0]=Math.round(t[0]),e[1]=Math.round(t[1]),e[2]=Math.round(t[2]),e},Se.scale=function(e,t,i){return e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e},Se.scaleAndAdd=function(e,t,i,r){return e[0]=t[0]+i[0]*r,e[1]=t[1]+i[1]*r,e[2]=t[2]+i[2]*r,e},Se.distance=Qx,Se.squaredDistance=tv,Se.squaredLength=ev,Se.negate=function(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e},Se.inverse=function(e,t){return e[0]=1/t[0],e[1]=1/t[1],e[2]=1/t[2],e},Se.normalize=function(e,t){var i=t[0],r=t[1],n=t[2],s=i*i+r*r+n*n;return s&gt;0&amp;&amp;(s=1/Math.sqrt(s)),e[0]=t[0]*s,e[1]=t[1]*s,e[2]=t[2]*s,e},Se.dot=iv,Se.cross=function(e,t,i){var r=t[0],n=t[1],s=t[2],a=i[0],l=i[1],h=i[2];return e[0]=n*h-s*l,e[1]=s*a-r*h,e[2]=r*l-n*a,e},Se.lerp=function(e,t,i,r){var n=t[0],s=t[1],a=t[2];return e[0]=n+r*(i[0]-n),e[1]=s+r*(i[1]-s),e[2]=a+r*(i[2]-a),e},Se.hermite=function(e,t,i,r,n,s){var a=s*s,l=a*(2*s-3)+1,h=a*(s-2)+s,d=a*(s-1),f=a*(3-2*s);return e[0]=t[0]*l+i[0]*h+r[0]*d+n[0]*f,e[1]=t[1]*l+i[1]*h+r[1]*d+n[1]*f,e[2]=t[2]*l+i[2]*h+r[2]*d+n[2]*f,e},Se.bezier=function(e,t,i,r,n,s){var a=1-s,l=a*a,h=s*s,d=l*a,f=3*s*l,m=3*h*a,_=h*s;return e[0]=t[0]*d+i[0]*f+r[0]*m+n[0]*_,e[1]=t[1]*d+i[1]*f+r[1]*m+n[1]*_,e[2]=t[2]*d+i[2]*f+r[2]*m+n[2]*_,e},Se.random=function(e,t){t=t||1;var i=2*Hs.RANDOM()*Math.PI,r=2*Hs.RANDOM()-1,n=Math.sqrt(1-r*r)*t;return e[0]=Math.cos(i)*n,e[1]=Math.sin(i)*n,e[2]=r*t,e},Se.transformMat4=function(e,t,i){var r=t[0],n=t[1],s=t[2],a=i[3]*r+i[7]*n+i[11]*s+i[15];return e[0]=(i[0]*r+i[4]*n+i[8]*s+i[12])/(a=a||1),e[1]=(i[1]*r+i[5]*n+i[9]*s+i[13])/a,e[2]=(i[2]*r+i[6]*n+i[10]*s+i[14])/a,e},Se.transformMat3=function(e,t,i){var r=t[0],n=t[1],s=t[2];return e[0]=r*i[0]+n*i[3]+s*i[6],e[1]=r*i[1]+n*i[4]+s*i[7],e[2]=r*i[2]+n*i[5]+s*i[8],e},Se.transformQuat=function(e,t,i){var r=i[0],n=i[1],s=i[2],a=t[0],l=t[1],h=t[2],d=n*h-s*l,f=s*a-r*h,m=r*l-n*a,_=n*m-s*f,y=s*d-r*m,x=r*f-n*d,b=2*i[3];return f*=b,m*=b,y*=2,x*=2,e[0]=a+(d*=b)+(_*=2),e[1]=l+f+y,e[2]=h+m+x,e},Se.rotateX=function(e,t,i,r){var n=[],s=[];return n[0]=t[0]-i[0],n[1]=t[1]-i[1],n[2]=t[2]-i[2],s[0]=n[0],s[1]=n[1]*Math.cos(r)-n[2]*Math.sin(r),s[2]=n[1]*Math.sin(r)+n[2]*Math.cos(r),e[0]=s[0]+i[0],e[1]=s[1]+i[1],e[2]=s[2]+i[2],e},Se.rotateY=function(e,t,i,r){var n=[],s=[];return n[0]=t[0]-i[0],n[1]=t[1]-i[1],n[2]=t[2]-i[2],s[0]=n[2]*Math.sin(r)+n[0]*Math.cos(r),s[1]=n[1],s[2]=n[2]*Math.cos(r)-n[0]*Math.sin(r),e[0]=s[0]+i[0],e[1]=s[1]+i[1],e[2]=s[2]+i[2],e},Se.rotateZ=function(e,t,i,r){var n=[],s=[];return n[0]=t[0]-i[0],n[1]=t[1]-i[1],n[2]=t[2]-i[2],s[0]=n[0]*Math.cos(r)-n[1]*Math.sin(r),s[1]=n[0]*Math.sin(r)+n[1]*Math.cos(r),s[2]=n[2],e[0]=s[0]+i[0],e[1]=s[1]+i[1],e[2]=s[2]+i[2],e},Se.angle=function(e,t){var i=e[0],r=e[1],n=e[2],s=t[0],a=t[1],l=t[2],h=Math.sqrt(i*i+r*r+n*n)*Math.sqrt(s*s+a*a+l*l),d=h&amp;&amp;iv(e,t)/h;return Math.acos(Math.min(Math.max(d,-1),1))},Se.zero=function(e){return e[0]=0,e[1]=0,e[2]=0,e},Se.str=function(e){return"vec3("+e[0]+", "+e[1]+", "+e[2]+")"},Se.exactEquals=function(e,t){return e[0]===t[0]&amp;&amp;e[1]===t[1]&amp;&amp;e[2]===t[2]},Se.equals=function(e,t){var i=e[0],r=e[1],n=e[2],s=t[0],a=t[1],l=t[2];return Math.abs(i-s)&lt;=Hs.EPSILON*Math.max(1,Math.abs(i),Math.abs(s))&amp;&amp;Math.abs(r-a)&lt;=Hs.EPSILON*Math.max(1,Math.abs(r),Math.abs(a))&amp;&amp;Math.abs(n-l)&lt;=Hs.EPSILON*Math.max(1,Math.abs(n),Math.abs(l))},Se.forEach=Se.sqrLen=Se.len=Se.sqrDist=Se.dist=Se.div=Se.mul=Se.sub=void 0;var Hs=function(e,t){if(e&amp;&amp;e.__esModule)return e;if(e===null||mm(e)!=="object"&amp;&amp;typeof e!="function")return{default:e};var i=Zx(void 0);if(i&amp;&amp;i.has(e))return i.get(e);var r={},n=Object.defineProperty&amp;&amp;Object.getOwnPropertyDescriptor;for(var s in e)if(s!=="default"&amp;&amp;Object.prototype.hasOwnProperty.call(e,s)){var a=n?Object.getOwnPropertyDescriptor(e,s):null;a&amp;&amp;(a.get||a.set)?Object.defineProperty(r,s,a):r[s]=e[s]}return r.default=e,i&amp;&amp;i.set(e,r),r}(ur);function Zx(e){if(typeof WeakMap!="function")return null;var t=new WeakMap,i=new WeakMap;return(Zx=function(r){return r?i:t})(e)}function $x(){var e=new Hs.ARRAY_TYPE(3);return Hs.ARRAY_TYPE!=Float32Array&amp;&amp;(e[0]=0,e[1]=0,e[2]=0),e}function Xx(e){return Math.hypot(e[0],e[1],e[2])}function Yx(e,t,i){return e[0]=t[0]-i[0],e[1]=t[1]-i[1],e[2]=t[2]-i[2],e}function Kx(e,t,i){return e[0]=t[0]*i[0],e[1]=t[1]*i[1],e[2]=t[2]*i[2],e}function Jx(e,t,i){return e[0]=t[0]/i[0],e[1]=t[1]/i[1],e[2]=t[2]/i[2],e}function Qx(e,t){return Math.hypot(t[0]-e[0],t[1]-e[1],t[2]-e[2])}function tv(e,t){var i=t[0]-e[0],r=t[1]-e[1],n=t[2]-e[2];return i*i+r*r+n*n}function ev(e){var t=e[0],i=e[1],r=e[2];return t*t+i*i+r*r}function iv(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}Se.sub=Yx,Se.mul=Kx,Se.div=Jx,Se.dist=Qx,Se.sqrDist=tv,Se.len=Xx,Se.sqrLen=ev;var Ws,wP=(Ws=$x(),function(e,t,i,r,n,s){var a,l;for(t||(t=3),i||(i=0),l=r?Math.min(r*t+i,e.length):e.length,a=i;a&lt;l;a+=t)Ws[0]=e[a],Ws[1]=e[a+1],Ws[2]=e[a+2],n(Ws,Ws,s),e[a]=Ws[0],e[a+1]=Ws[1],e[a+2]=Ws[2];return e});Se.forEach=wP;var ze={};function _m(e){return _m=typeof Symbol=="function"&amp;&amp;typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&amp;&amp;typeof Symbol=="function"&amp;&amp;t.constructor===Symbol&amp;&amp;t!==Symbol.prototype?"symbol":typeof t},_m(e)}Object.defineProperty(ze,"__esModule",{value:!0}),ze.create=nv,ze.clone=function(e){var t=new Mn.ARRAY_TYPE(4);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t},ze.fromValues=function(e,t,i,r){var n=new Mn.ARRAY_TYPE(4);return n[0]=e,n[1]=t,n[2]=i,n[3]=r,n},ze.copy=function(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e},ze.set=function(e,t,i,r,n){return e[0]=t,e[1]=i,e[2]=r,e[3]=n,e},ze.add=function(e,t,i){return e[0]=t[0]+i[0],e[1]=t[1]+i[1],e[2]=t[2]+i[2],e[3]=t[3]+i[3],e},ze.subtract=sv,ze.multiply=ov,ze.divide=av,ze.ceil=function(e,t){return e[0]=Math.ceil(t[0]),e[1]=Math.ceil(t[1]),e[2]=Math.ceil(t[2]),e[3]=Math.ceil(t[3]),e},ze.floor=function(e,t){return e[0]=Math.floor(t[0]),e[1]=Math.floor(t[1]),e[2]=Math.floor(t[2]),e[3]=Math.floor(t[3]),e},ze.min=function(e,t,i){return e[0]=Math.min(t[0],i[0]),e[1]=Math.min(t[1],i[1]),e[2]=Math.min(t[2],i[2]),e[3]=Math.min(t[3],i[3]),e},ze.max=function(e,t,i){return e[0]=Math.max(t[0],i[0]),e[1]=Math.max(t[1],i[1]),e[2]=Math.max(t[2],i[2]),e[3]=Math.max(t[3],i[3]),e},ze.round=function(e,t){return e[0]=Math.round(t[0]),e[1]=Math.round(t[1]),e[2]=Math.round(t[2]),e[3]=Math.round(t[3]),e},ze.scale=function(e,t,i){return e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e[3]=t[3]*i,e},ze.scaleAndAdd=function(e,t,i,r){return e[0]=t[0]+i[0]*r,e[1]=t[1]+i[1]*r,e[2]=t[2]+i[2]*r,e[3]=t[3]+i[3]*r,e},ze.distance=lv,ze.squaredDistance=cv,ze.length=uv,ze.squaredLength=hv,ze.negate=function(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=-t[3],e},ze.inverse=function(e,t){return e[0]=1/t[0],e[1]=1/t[1],e[2]=1/t[2],e[3]=1/t[3],e},ze.normalize=function(e,t){var i=t[0],r=t[1],n=t[2],s=t[3],a=i*i+r*r+n*n+s*s;return a&gt;0&amp;&amp;(a=1/Math.sqrt(a)),e[0]=i*a,e[1]=r*a,e[2]=n*a,e[3]=s*a,e},ze.dot=function(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]},ze.cross=function(e,t,i,r){var n=i[0]*r[1]-i[1]*r[0],s=i[0]*r[2]-i[2]*r[0],a=i[0]*r[3]-i[3]*r[0],l=i[1]*r[2]-i[2]*r[1],h=i[1]*r[3]-i[3]*r[1],d=i[2]*r[3]-i[3]*r[2],f=t[0],m=t[1],_=t[2],y=t[3];return e[0]=m*d-_*h+y*l,e[1]=-f*d+_*a-y*s,e[2]=f*h-m*a+y*n,e[3]=-f*l+m*s-_*n,e},ze.lerp=function(e,t,i,r){var n=t[0],s=t[1],a=t[2],l=t[3];return e[0]=n+r*(i[0]-n),e[1]=s+r*(i[1]-s),e[2]=a+r*(i[2]-a),e[3]=l+r*(i[3]-l),e},ze.random=function(e,t){var i,r,n,s,a,l;t=t||1;do a=(i=2*Mn.RANDOM()-1)*i+(r=2*Mn.RANDOM()-1)*r;while(a&gt;=1);do l=(n=2*Mn.RANDOM()-1)*n+(s=2*Mn.RANDOM()-1)*s;while(l&gt;=1);var h=Math.sqrt((1-a)/l);return e[0]=t*i,e[1]=t*r,e[2]=t*n*h,e[3]=t*s*h,e},ze.transformMat4=function(e,t,i){var r=t[0],n=t[1],s=t[2],a=t[3];return e[0]=i[0]*r+i[4]*n+i[8]*s+i[12]*a,e[1]=i[1]*r+i[5]*n+i[9]*s+i[13]*a,e[2]=i[2]*r+i[6]*n+i[10]*s+i[14]*a,e[3]=i[3]*r+i[7]*n+i[11]*s+i[15]*a,e},ze.transformQuat=function(e,t,i){var r=t[0],n=t[1],s=t[2],a=i[0],l=i[1],h=i[2],d=i[3],f=d*r+l*s-h*n,m=d*n+h*r-a*s,_=d*s+a*n-l*r,y=-a*r-l*n-h*s;return e[0]=f*d+y*-a+m*-h-_*-l,e[1]=m*d+y*-l+_*-a-f*-h,e[2]=_*d+y*-h+f*-l-m*-a,e[3]=t[3],e},ze.zero=function(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=0,e},ze.str=function(e){return"vec4("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+")"},ze.exactEquals=function(e,t){return e[0]===t[0]&amp;&amp;e[1]===t[1]&amp;&amp;e[2]===t[2]&amp;&amp;e[3]===t[3]},ze.equals=function(e,t){var i=e[0],r=e[1],n=e[2],s=e[3],a=t[0],l=t[1],h=t[2],d=t[3];return Math.abs(i-a)&lt;=Mn.EPSILON*Math.max(1,Math.abs(i),Math.abs(a))&amp;&amp;Math.abs(r-l)&lt;=Mn.EPSILON*Math.max(1,Math.abs(r),Math.abs(l))&amp;&amp;Math.abs(n-h)&lt;=Mn.EPSILON*Math.max(1,Math.abs(n),Math.abs(h))&amp;&amp;Math.abs(s-d)&lt;=Mn.EPSILON*Math.max(1,Math.abs(s),Math.abs(d))},ze.forEach=ze.sqrLen=ze.len=ze.sqrDist=ze.dist=ze.div=ze.mul=ze.sub=void 0;var Mn=function(e,t){if(e&amp;&amp;e.__esModule)return e;if(e===null||_m(e)!=="object"&amp;&amp;typeof e!="function")return{default:e};var i=rv(void 0);if(i&amp;&amp;i.has(e))return i.get(e);var r={},n=Object.defineProperty&amp;&amp;Object.getOwnPropertyDescriptor;for(var s in e)if(s!=="default"&amp;&amp;Object.prototype.hasOwnProperty.call(e,s)){var a=n?Object.getOwnPropertyDescriptor(e,s):null;a&amp;&amp;(a.get||a.set)?Object.defineProperty(r,s,a):r[s]=e[s]}return r.default=e,i&amp;&amp;i.set(e,r),r}(ur);function rv(e){if(typeof WeakMap!="function")return null;var t=new WeakMap,i=new WeakMap;return(rv=function(r){return r?i:t})(e)}function nv(){var e=new Mn.ARRAY_TYPE(4);return Mn.ARRAY_TYPE!=Float32Array&amp;&amp;(e[0]=0,e[1]=0,e[2]=0,e[3]=0),e}function sv(e,t,i){return e[0]=t[0]-i[0],e[1]=t[1]-i[1],e[2]=t[2]-i[2],e[3]=t[3]-i[3],e}function ov(e,t,i){return e[0]=t[0]*i[0],e[1]=t[1]*i[1],e[2]=t[2]*i[2],e[3]=t[3]*i[3],e}function av(e,t,i){return e[0]=t[0]/i[0],e[1]=t[1]/i[1],e[2]=t[2]/i[2],e[3]=t[3]/i[3],e}function lv(e,t){return Math.hypot(t[0]-e[0],t[1]-e[1],t[2]-e[2],t[3]-e[3])}function cv(e,t){var i=t[0]-e[0],r=t[1]-e[1],n=t[2]-e[2],s=t[3]-e[3];return i*i+r*r+n*n+s*s}function uv(e){return Math.hypot(e[0],e[1],e[2],e[3])}function hv(e){var t=e[0],i=e[1],r=e[2],n=e[3];return t*t+i*i+r*r+n*n}ze.sub=sv,ze.mul=ov,ze.div=av,ze.dist=lv,ze.sqrDist=cv,ze.len=uv,ze.sqrLen=hv;var TP=function(){var e=nv();return function(t,i,r,n,s,a){var l,h;for(i||(i=4),r||(r=0),h=n?Math.min(n*i+r,t.length):t.length,l=r;l&lt;h;l+=i)e[0]=t[l],e[1]=t[l+1],e[2]=t[l+2],e[3]=t[l+3],s(e,e,a),t[l]=e[0],t[l+1]=e[1],t[l+2]=e[2],t[l+3]=e[3];return t}}();function gm(e){return gm=typeof Symbol=="function"&amp;&amp;typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&amp;&amp;typeof Symbol=="function"&amp;&amp;t.constructor===Symbol&amp;&amp;t!==Symbol.prototype?"symbol":typeof t},gm(e)}ze.forEach=TP,Object.defineProperty(we,"__esModule",{value:!0}),we.create=ym,we.identity=function(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e},we.setAxisAngle=fv,we.getAxisAngle=function(e,t){var i=2*Math.acos(t[3]),r=Math.sin(i/2);return r&gt;ca.EPSILON?(e[0]=t[0]/r,e[1]=t[1]/r,e[2]=t[2]/r):(e[0]=1,e[1]=0,e[2]=0),i},we.getAngle=function(e,t){var i=xv(e,t);return Math.acos(2*i*i-1)},we.multiply=pv,we.rotateX=function(e,t,i){i*=.5;var r=t[0],n=t[1],s=t[2],a=t[3],l=Math.sin(i),h=Math.cos(i);return e[0]=r*h+a*l,e[1]=n*h+s*l,e[2]=s*h-n*l,e[3]=a*h-r*l,e},we.rotateY=function(e,t,i){i*=.5;var r=t[0],n=t[1],s=t[2],a=t[3],l=Math.sin(i),h=Math.cos(i);return e[0]=r*h-s*l,e[1]=n*h+a*l,e[2]=s*h+r*l,e[3]=a*h-n*l,e},we.rotateZ=function(e,t,i){i*=.5;var r=t[0],n=t[1],s=t[2],a=t[3],l=Math.sin(i),h=Math.cos(i);return e[0]=r*h+n*l,e[1]=n*h-r*l,e[2]=s*h+a*l,e[3]=a*h-s*l,e},we.calculateW=function(e,t){var i=t[0],r=t[1],n=t[2];return e[0]=i,e[1]=r,e[2]=n,e[3]=Math.sqrt(Math.abs(1-i*i-r*r-n*n)),e},we.exp=mv,we.ln=_v,we.pow=function(e,t,i){return _v(e,t),yv(e,e,i),mv(e,e),e},we.slerp=yh,we.random=function(e){var t=ca.RANDOM(),i=ca.RANDOM(),r=ca.RANDOM(),n=Math.sqrt(1-t),s=Math.sqrt(t);return e[0]=n*Math.sin(2*Math.PI*i),e[1]=n*Math.cos(2*Math.PI*i),e[2]=s*Math.sin(2*Math.PI*r),e[3]=s*Math.cos(2*Math.PI*r),e},we.invert=function(e,t){var i=t[0],r=t[1],n=t[2],s=t[3],a=i*i+r*r+n*n+s*s,l=a?1/a:0;return e[0]=-i*l,e[1]=-r*l,e[2]=-n*l,e[3]=s*l,e},we.conjugate=function(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=t[3],e},we.fromMat3=gv,we.fromEuler=function(e,t,i,r){var n=.5*Math.PI/180;t*=n,i*=n,r*=n;var s=Math.sin(t),a=Math.cos(t),l=Math.sin(i),h=Math.cos(i),d=Math.sin(r),f=Math.cos(r);return e[0]=s*h*f-a*l*d,e[1]=a*l*f+s*h*d,e[2]=a*h*d-s*l*f,e[3]=a*h*f+s*l*d,e},we.str=function(e){return"quat("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+")"},we.setAxes=we.sqlerp=we.rotationTo=we.equals=we.exactEquals=we.normalize=we.sqrLen=we.squaredLength=we.len=we.length=we.lerp=we.dot=we.scale=we.mul=we.add=we.set=we.copy=we.fromValues=we.clone=void 0;var ca=gh(ur),EP=gh(fi),qs=gh(Se),fn=gh(ze);function dv(e){if(typeof WeakMap!="function")return null;var t=new WeakMap,i=new WeakMap;return(dv=function(r){return r?i:t})(e)}function gh(e,t){if(e&amp;&amp;e.__esModule)return e;if(e===null||gm(e)!=="object"&amp;&amp;typeof e!="function")return{default:e};var i=dv(t);if(i&amp;&amp;i.has(e))return i.get(e);var r={},n=Object.defineProperty&amp;&amp;Object.getOwnPropertyDescriptor;for(var s in e)if(s!=="default"&amp;&amp;Object.prototype.hasOwnProperty.call(e,s)){var a=n?Object.getOwnPropertyDescriptor(e,s):null;a&amp;&amp;(a.get||a.set)?Object.defineProperty(r,s,a):r[s]=e[s]}return r.default=e,i&amp;&amp;i.set(e,r),r}function ym(){var e=new ca.ARRAY_TYPE(4);return ca.ARRAY_TYPE!=Float32Array&amp;&amp;(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}function fv(e,t,i){i*=.5;var r=Math.sin(i);return e[0]=r*t[0],e[1]=r*t[1],e[2]=r*t[2],e[3]=Math.cos(i),e}function pv(e,t,i){var r=t[0],n=t[1],s=t[2],a=t[3],l=i[0],h=i[1],d=i[2],f=i[3];return e[0]=r*f+a*l+n*d-s*h,e[1]=n*f+a*h+s*l-r*d,e[2]=s*f+a*d+r*h-n*l,e[3]=a*f-r*l-n*h-s*d,e}function mv(e,t){var i=t[0],r=t[1],n=t[2],s=t[3],a=Math.sqrt(i*i+r*r+n*n),l=Math.exp(s),h=a&gt;0?l*Math.sin(a)/a:0;return e[0]=i*h,e[1]=r*h,e[2]=n*h,e[3]=l*Math.cos(a),e}function _v(e,t){var i=t[0],r=t[1],n=t[2],s=t[3],a=Math.sqrt(i*i+r*r+n*n),l=a&gt;0?Math.atan2(a,s)/a:0;return e[0]=i*l,e[1]=r*l,e[2]=n*l,e[3]=.5*Math.log(i*i+r*r+n*n+s*s),e}function yh(e,t,i,r){var n,s,a,l,h,d=t[0],f=t[1],m=t[2],_=t[3],y=i[0],x=i[1],b=i[2],w=i[3];return(s=d*y+f*x+m*b+_*w)&lt;0&amp;&amp;(s=-s,y=-y,x=-x,b=-b,w=-w),1-s&gt;ca.EPSILON?(n=Math.acos(s),a=Math.sin(n),l=Math.sin((1-r)*n)/a,h=Math.sin(r*n)/a):(l=1-r,h=r),e[0]=l*d+h*y,e[1]=l*f+h*x,e[2]=l*m+h*b,e[3]=l*_+h*w,e}function gv(e,t){var i,r=t[0]+t[4]+t[8];if(r&gt;0)i=Math.sqrt(r+1),e[3]=.5*i,e[0]=(t[5]-t[7])*(i=.5/i),e[1]=(t[6]-t[2])*i,e[2]=(t[1]-t[3])*i;else{var n=0;t[4]&gt;t[0]&amp;&amp;(n=1),t[8]&gt;t[3*n+n]&amp;&amp;(n=2);var s=(n+1)%3,a=(n+2)%3;i=Math.sqrt(t[3*n+n]-t[3*s+s]-t[3*a+a]+1),e[n]=.5*i,e[3]=(t[3*s+a]-t[3*a+s])*(i=.5/i),e[s]=(t[3*s+n]+t[3*n+s])*i,e[a]=(t[3*a+n]+t[3*n+a])*i}return e}we.clone=fn.clone,we.fromValues=fn.fromValues,we.copy=fn.copy,we.set=fn.set,we.add=fn.add,we.mul=pv;var yv=fn.scale;we.scale=yv;var xv=fn.dot;we.dot=xv,we.lerp=fn.lerp;var vv=fn.length;we.length=vv,we.len=vv;var bv=fn.squaredLength;we.squaredLength=bv,we.sqrLen=bv;var xm=fn.normalize;we.normalize=xm,we.exactEquals=fn.exactEquals,we.equals=fn.equals;var Hn,wv,Tv,SP=(Hn=qs.create(),wv=qs.fromValues(1,0,0),Tv=qs.fromValues(0,1,0),function(e,t,i){var r=qs.dot(t,i);return r&lt;-.999999?(qs.cross(Hn,wv,t),qs.len(Hn)&lt;1e-6&amp;&amp;qs.cross(Hn,Tv,t),qs.normalize(Hn,Hn),fv(e,Hn,Math.PI),e):r&gt;.999999?(e[0]=0,e[1]=0,e[2]=0,e[3]=1,e):(qs.cross(Hn,t,i),e[0]=Hn[0],e[1]=Hn[1],e[2]=Hn[2],e[3]=1+r,xm(e,e))});we.rotationTo=SP;var vm,bm,AP=(vm=ym(),bm=ym(),function(e,t,i,r,n,s){return yh(vm,t,n,s),yh(bm,i,r,s),yh(e,vm,bm,2*s*(1-s)),e});we.sqlerp=AP;var Wn,MP=(Wn=EP.create(),function(e,t,i,r){return Wn[0]=i[0],Wn[3]=i[1],Wn[6]=i[2],Wn[1]=r[0],Wn[4]=r[1],Wn[7]=r[2],Wn[2]=-t[0],Wn[5]=-t[1],Wn[8]=-t[2],xm(e,gv(e,Wn))});we.setAxes=MP;var Ne={};function wm(e){return wm=typeof Symbol=="function"&amp;&amp;typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&amp;&amp;typeof Symbol=="function"&amp;&amp;t.constructor===Symbol&amp;&amp;t!==Symbol.prototype?"symbol":typeof t},wm(e)}Object.defineProperty(Ne,"__esModule",{value:!0}),Ne.create=function(){var e=new Fr.ARRAY_TYPE(8);return Fr.ARRAY_TYPE!=Float32Array&amp;&amp;(e[0]=0,e[1]=0,e[2]=0,e[4]=0,e[5]=0,e[6]=0,e[7]=0),e[3]=1,e},Ne.clone=function(e){var t=new Fr.ARRAY_TYPE(8);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t},Ne.fromValues=function(e,t,i,r,n,s,a,l){var h=new Fr.ARRAY_TYPE(8);return h[0]=e,h[1]=t,h[2]=i,h[3]=r,h[4]=n,h[5]=s,h[6]=a,h[7]=l,h},Ne.fromRotationTranslationValues=function(e,t,i,r,n,s,a){var l=new Fr.ARRAY_TYPE(8);l[0]=e,l[1]=t,l[2]=i,l[3]=r;var h=.5*n,d=.5*s,f=.5*a;return l[4]=h*r+d*i-f*t,l[5]=d*r+f*e-h*i,l[6]=f*r+h*t-d*e,l[7]=-h*e-d*t-f*i,l},Ne.fromRotationTranslation=Av,Ne.fromTranslation=function(e,t){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e[4]=.5*t[0],e[5]=.5*t[1],e[6]=.5*t[2],e[7]=0,e},Ne.fromRotation=function(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=0,e[5]=0,e[6]=0,e[7]=0,e},Ne.fromMat4=function(e,t){var i=Zs.create();Ev.getRotation(i,t);var r=new Fr.ARRAY_TYPE(3);return Ev.getTranslation(r,t),Av(e,i,r),e},Ne.copy=Mv,Ne.identity=function(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e[4]=0,e[5]=0,e[6]=0,e[7]=0,e},Ne.set=function(e,t,i,r,n,s,a,l,h){return e[0]=t,e[1]=i,e[2]=r,e[3]=n,e[4]=s,e[5]=a,e[6]=l,e[7]=h,e},Ne.getDual=function(e,t){return e[0]=t[4],e[1]=t[5],e[2]=t[6],e[3]=t[7],e},Ne.setDual=function(e,t){return e[4]=t[0],e[5]=t[1],e[6]=t[2],e[7]=t[3],e},Ne.getTranslation=function(e,t){var i=t[4],r=t[5],n=t[6],s=t[7],a=-t[0],l=-t[1],h=-t[2],d=t[3];return e[0]=2*(i*d+s*a+r*h-n*l),e[1]=2*(r*d+s*l+n*a-i*h),e[2]=2*(n*d+s*h+i*l-r*a),e},Ne.translate=function(e,t,i){var r=t[0],n=t[1],s=t[2],a=t[3],l=.5*i[0],h=.5*i[1],d=.5*i[2],f=t[4],m=t[5],_=t[6],y=t[7];return e[0]=r,e[1]=n,e[2]=s,e[3]=a,e[4]=a*l+n*d-s*h+f,e[5]=a*h+s*l-r*d+m,e[6]=a*d+r*h-n*l+_,e[7]=-r*l-n*h-s*d+y,e},Ne.rotateX=function(e,t,i){var r=-t[0],n=-t[1],s=-t[2],a=t[3],l=t[4],h=t[5],d=t[6],f=t[7],m=l*a+f*r+h*s-d*n,_=h*a+f*n+d*r-l*s,y=d*a+f*s+l*n-h*r,x=f*a-l*r-h*n-d*s;return Zs.rotateX(e,t,i),e[4]=m*(a=e[3])+x*(r=e[0])+_*(s=e[2])-y*(n=e[1]),e[5]=_*a+x*n+y*r-m*s,e[6]=y*a+x*s+m*n-_*r,e[7]=x*a-m*r-_*n-y*s,e},Ne.rotateY=function(e,t,i){var r=-t[0],n=-t[1],s=-t[2],a=t[3],l=t[4],h=t[5],d=t[6],f=t[7],m=l*a+f*r+h*s-d*n,_=h*a+f*n+d*r-l*s,y=d*a+f*s+l*n-h*r,x=f*a-l*r-h*n-d*s;return Zs.rotateY(e,t,i),e[4]=m*(a=e[3])+x*(r=e[0])+_*(s=e[2])-y*(n=e[1]),e[5]=_*a+x*n+y*r-m*s,e[6]=y*a+x*s+m*n-_*r,e[7]=x*a-m*r-_*n-y*s,e},Ne.rotateZ=function(e,t,i){var r=-t[0],n=-t[1],s=-t[2],a=t[3],l=t[4],h=t[5],d=t[6],f=t[7],m=l*a+f*r+h*s-d*n,_=h*a+f*n+d*r-l*s,y=d*a+f*s+l*n-h*r,x=f*a-l*r-h*n-d*s;return Zs.rotateZ(e,t,i),e[4]=m*(a=e[3])+x*(r=e[0])+_*(s=e[2])-y*(n=e[1]),e[5]=_*a+x*n+y*r-m*s,e[6]=y*a+x*s+m*n-_*r,e[7]=x*a-m*r-_*n-y*s,e},Ne.rotateByQuatAppend=function(e,t,i){var r=i[0],n=i[1],s=i[2],a=i[3],l=t[0],h=t[1],d=t[2],f=t[3];return e[0]=l*a+f*r+h*s-d*n,e[1]=h*a+f*n+d*r-l*s,e[2]=d*a+f*s+l*n-h*r,e[3]=f*a-l*r-h*n-d*s,e[4]=(l=t[4])*a+(f=t[7])*r+(h=t[5])*s-(d=t[6])*n,e[5]=h*a+f*n+d*r-l*s,e[6]=d*a+f*s+l*n-h*r,e[7]=f*a-l*r-h*n-d*s,e},Ne.rotateByQuatPrepend=function(e,t,i){var r=t[0],n=t[1],s=t[2],a=t[3],l=i[0],h=i[1],d=i[2],f=i[3];return e[0]=r*f+a*l+n*d-s*h,e[1]=n*f+a*h+s*l-r*d,e[2]=s*f+a*d+r*h-n*l,e[3]=a*f-r*l-n*h-s*d,e[4]=r*(f=i[7])+a*(l=i[4])+n*(d=i[6])-s*(h=i[5]),e[5]=n*f+a*h+s*l-r*d,e[6]=s*f+a*d+r*h-n*l,e[7]=a*f-r*l-n*h-s*d,e},Ne.rotateAroundAxis=function(e,t,i,r){if(Math.abs(r)&lt;Fr.EPSILON)return Mv(e,t);var n=Math.hypot(i[0],i[1],i[2]);r*=.5;var s=Math.sin(r),a=s*i[0]/n,l=s*i[1]/n,h=s*i[2]/n,d=Math.cos(r),f=t[0],m=t[1],_=t[2],y=t[3];e[0]=f*d+y*a+m*h-_*l,e[1]=m*d+y*l+_*a-f*h,e[2]=_*d+y*h+f*l-m*a,e[3]=y*d-f*a-m*l-_*h;var x=t[4],b=t[5],w=t[6],T=t[7];return e[4]=x*d+T*a+b*h-w*l,e[5]=b*d+T*l+w*a-x*h,e[6]=w*d+T*h+x*l-b*a,e[7]=T*d-x*a-b*l-w*h,e},Ne.add=function(e,t,i){return e[0]=t[0]+i[0],e[1]=t[1]+i[1],e[2]=t[2]+i[2],e[3]=t[3]+i[3],e[4]=t[4]+i[4],e[5]=t[5]+i[5],e[6]=t[6]+i[6],e[7]=t[7]+i[7],e},Ne.multiply=Iv,Ne.scale=function(e,t,i){return e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e[3]=t[3]*i,e[4]=t[4]*i,e[5]=t[5]*i,e[6]=t[6]*i,e[7]=t[7]*i,e},Ne.lerp=function(e,t,i,r){var n=1-r;return Pv(t,i)&lt;0&amp;&amp;(r=-r),e[0]=t[0]*n+i[0]*r,e[1]=t[1]*n+i[1]*r,e[2]=t[2]*n+i[2]*r,e[3]=t[3]*n+i[3]*r,e[4]=t[4]*n+i[4]*r,e[5]=t[5]*n+i[5]*r,e[6]=t[6]*n+i[6]*r,e[7]=t[7]*n+i[7]*r,e},Ne.invert=function(e,t){var i=xh(t);return e[0]=-t[0]/i,e[1]=-t[1]/i,e[2]=-t[2]/i,e[3]=t[3]/i,e[4]=-t[4]/i,e[5]=-t[5]/i,e[6]=-t[6]/i,e[7]=t[7]/i,e},Ne.conjugate=function(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=t[3],e[4]=-t[4],e[5]=-t[5],e[6]=-t[6],e[7]=t[7],e},Ne.normalize=function(e,t){var i=xh(t);if(i&gt;0){i=Math.sqrt(i);var r=t[0]/i,n=t[1]/i,s=t[2]/i,a=t[3]/i,l=t[4],h=t[5],d=t[6],f=t[7],m=r*l+n*h+s*d+a*f;e[0]=r,e[1]=n,e[2]=s,e[3]=a,e[4]=(l-r*m)/i,e[5]=(h-n*m)/i,e[6]=(d-s*m)/i,e[7]=(f-a*m)/i}return e},Ne.str=function(e){return"quat2("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+", "+e[4]+", "+e[5]+", "+e[6]+", "+e[7]+")"},Ne.exactEquals=function(e,t){return e[0]===t[0]&amp;&amp;e[1]===t[1]&amp;&amp;e[2]===t[2]&amp;&amp;e[3]===t[3]&amp;&amp;e[4]===t[4]&amp;&amp;e[5]===t[5]&amp;&amp;e[6]===t[6]&amp;&amp;e[7]===t[7]},Ne.equals=function(e,t){var i=e[0],r=e[1],n=e[2],s=e[3],a=e[4],l=e[5],h=e[6],d=e[7],f=t[0],m=t[1],_=t[2],y=t[3],x=t[4],b=t[5],w=t[6],T=t[7];return Math.abs(i-f)&lt;=Fr.EPSILON*Math.max(1,Math.abs(i),Math.abs(f))&amp;&amp;Math.abs(r-m)&lt;=Fr.EPSILON*Math.max(1,Math.abs(r),Math.abs(m))&amp;&amp;Math.abs(n-_)&lt;=Fr.EPSILON*Math.max(1,Math.abs(n),Math.abs(_))&amp;&amp;Math.abs(s-y)&lt;=Fr.EPSILON*Math.max(1,Math.abs(s),Math.abs(y))&amp;&amp;Math.abs(a-x)&lt;=Fr.EPSILON*Math.max(1,Math.abs(a),Math.abs(x))&amp;&amp;Math.abs(l-b)&lt;=Fr.EPSILON*Math.max(1,Math.abs(l),Math.abs(b))&amp;&amp;Math.abs(h-w)&lt;=Fr.EPSILON*Math.max(1,Math.abs(h),Math.abs(w))&amp;&amp;Math.abs(d-T)&lt;=Fr.EPSILON*Math.max(1,Math.abs(d),Math.abs(T))},Ne.sqrLen=Ne.squaredLength=Ne.len=Ne.length=Ne.dot=Ne.mul=Ne.setReal=Ne.getReal=void 0;var Fr=Tm(ur),Zs=Tm(we),Ev=Tm(Ae);function Sv(e){if(typeof WeakMap!="function")return null;var t=new WeakMap,i=new WeakMap;return(Sv=function(r){return r?i:t})(e)}function Tm(e,t){if(e&amp;&amp;e.__esModule)return e;if(e===null||wm(e)!=="object"&amp;&amp;typeof e!="function")return{default:e};var i=Sv(t);if(i&amp;&amp;i.has(e))return i.get(e);var r={},n=Object.defineProperty&amp;&amp;Object.getOwnPropertyDescriptor;for(var s in e)if(s!=="default"&amp;&amp;Object.prototype.hasOwnProperty.call(e,s)){var a=n?Object.getOwnPropertyDescriptor(e,s):null;a&amp;&amp;(a.get||a.set)?Object.defineProperty(r,s,a):r[s]=e[s]}return r.default=e,i&amp;&amp;i.set(e,r),r}function Av(e,t,i){var r=.5*i[0],n=.5*i[1],s=.5*i[2],a=t[0],l=t[1],h=t[2],d=t[3];return e[0]=a,e[1]=l,e[2]=h,e[3]=d,e[4]=r*d+n*h-s*l,e[5]=n*d+s*a-r*h,e[6]=s*d+r*l-n*a,e[7]=-r*a-n*l-s*h,e}function Mv(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e}function Iv(e,t,i){var r=t[0],n=t[1],s=t[2],a=t[3],l=i[4],h=i[5],d=i[6],f=i[7],m=t[4],_=t[5],y=t[6],x=t[7],b=i[0],w=i[1],T=i[2],S=i[3];return e[0]=r*S+a*b+n*T-s*w,e[1]=n*S+a*w+s*b-r*T,e[2]=s*S+a*T+r*w-n*b,e[3]=a*S-r*b-n*w-s*T,e[4]=r*f+a*l+n*d-s*h+m*S+x*b+_*T-y*w,e[5]=n*f+a*h+s*l-r*d+_*S+x*w+y*b-m*T,e[6]=s*f+a*d+r*h-n*l+y*S+x*T+m*w-_*b,e[7]=a*f-r*l-n*h-s*d+x*S-m*b-_*w-y*T,e}Ne.getReal=Zs.copy,Ne.setReal=Zs.copy,Ne.mul=Iv;var Pv=Zs.dot;Ne.dot=Pv;var Cv=Zs.length;Ne.length=Cv,Ne.len=Cv;var xh=Zs.squaredLength;Ne.squaredLength=xh,Ne.sqrLen=xh;var Ce={};function Em(e){return Em=typeof Symbol=="function"&amp;&amp;typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&amp;&amp;typeof Symbol=="function"&amp;&amp;t.constructor===Symbol&amp;&amp;t!==Symbol.prototype?"symbol":typeof t},Em(e)}Object.defineProperty(Ce,"__esModule",{value:!0}),Ce.create=Rv,Ce.clone=function(e){var t=new ua.ARRAY_TYPE(2);return t[0]=e[0],t[1]=e[1],t},Ce.fromValues=function(e,t){var i=new ua.ARRAY_TYPE(2);return i[0]=e,i[1]=t,i},Ce.copy=function(e,t){return e[0]=t[0],e[1]=t[1],e},Ce.set=function(e,t,i){return e[0]=t,e[1]=i,e},Ce.add=function(e,t,i){return e[0]=t[0]+i[0],e[1]=t[1]+i[1],e},Ce.subtract=Dv,Ce.multiply=Ov,Ce.divide=kv,Ce.ceil=function(e,t){return e[0]=Math.ceil(t[0]),e[1]=Math.ceil(t[1]),e},Ce.floor=function(e,t){return e[0]=Math.floor(t[0]),e[1]=Math.floor(t[1]),e},Ce.min=function(e,t,i){return e[0]=Math.min(t[0],i[0]),e[1]=Math.min(t[1],i[1]),e},Ce.max=function(e,t,i){return e[0]=Math.max(t[0],i[0]),e[1]=Math.max(t[1],i[1]),e},Ce.round=function(e,t){return e[0]=Math.round(t[0]),e[1]=Math.round(t[1]),e},Ce.scale=function(e,t,i){return e[0]=t[0]*i,e[1]=t[1]*i,e},Ce.scaleAndAdd=function(e,t,i,r){return e[0]=t[0]+i[0]*r,e[1]=t[1]+i[1]*r,e},Ce.distance=zv,Ce.squaredDistance=Fv,Ce.length=Bv,Ce.squaredLength=Nv,Ce.negate=function(e,t){return e[0]=-t[0],e[1]=-t[1],e},Ce.inverse=function(e,t){return e[0]=1/t[0],e[1]=1/t[1],e},Ce.normalize=function(e,t){var i=t[0],r=t[1],n=i*i+r*r;return n&gt;0&amp;&amp;(n=1/Math.sqrt(n)),e[0]=t[0]*n,e[1]=t[1]*n,e},Ce.dot=function(e,t){return e[0]*t[0]+e[1]*t[1]},Ce.cross=function(e,t,i){var r=t[0]*i[1]-t[1]*i[0];return e[0]=e[1]=0,e[2]=r,e},Ce.lerp=function(e,t,i,r){var n=t[0],s=t[1];return e[0]=n+r*(i[0]-n),e[1]=s+r*(i[1]-s),e},Ce.random=function(e,t){t=t||1;var i=2*ua.RANDOM()*Math.PI;return e[0]=Math.cos(i)*t,e[1]=Math.sin(i)*t,e},Ce.transformMat2=function(e,t,i){var r=t[0],n=t[1];return e[0]=i[0]*r+i[2]*n,e[1]=i[1]*r+i[3]*n,e},Ce.transformMat2d=function(e,t,i){var r=t[0],n=t[1];return e[0]=i[0]*r+i[2]*n+i[4],e[1]=i[1]*r+i[3]*n+i[5],e},Ce.transformMat3=function(e,t,i){var r=t[0],n=t[1];return e[0]=i[0]*r+i[3]*n+i[6],e[1]=i[1]*r+i[4]*n+i[7],e},Ce.transformMat4=function(e,t,i){var r=t[0],n=t[1];return e[0]=i[0]*r+i[4]*n+i[12],e[1]=i[1]*r+i[5]*n+i[13],e},Ce.rotate=function(e,t,i,r){var n=t[0]-i[0],s=t[1]-i[1],a=Math.sin(r),l=Math.cos(r);return e[0]=n*l-s*a+i[0],e[1]=n*a+s*l+i[1],e},Ce.angle=function(e,t){var i=e[0],r=e[1],n=t[0],s=t[1],a=Math.sqrt(i*i+r*r)*Math.sqrt(n*n+s*s);return Math.acos(Math.min(Math.max(a&amp;&amp;(i*n+r*s)/a,-1),1))},Ce.zero=function(e){return e[0]=0,e[1]=0,e},Ce.str=function(e){return"vec2("+e[0]+", "+e[1]+")"},Ce.exactEquals=function(e,t){return e[0]===t[0]&amp;&amp;e[1]===t[1]},Ce.equals=function(e,t){var i=e[0],r=e[1],n=t[0],s=t[1];return Math.abs(i-n)&lt;=ua.EPSILON*Math.max(1,Math.abs(i),Math.abs(n))&amp;&amp;Math.abs(r-s)&lt;=ua.EPSILON*Math.max(1,Math.abs(r),Math.abs(s))},Ce.forEach=Ce.sqrLen=Ce.sqrDist=Ce.dist=Ce.div=Ce.mul=Ce.sub=Ce.len=void 0;var ua=function(e,t){if(e&amp;&amp;e.__esModule)return e;if(e===null||Em(e)!=="object"&amp;&amp;typeof e!="function")return{default:e};var i=Lv(void 0);if(i&amp;&amp;i.has(e))return i.get(e);var r={},n=Object.defineProperty&amp;&amp;Object.getOwnPropertyDescriptor;for(var s in e)if(s!=="default"&amp;&amp;Object.prototype.hasOwnProperty.call(e,s)){var a=n?Object.getOwnPropertyDescriptor(e,s):null;a&amp;&amp;(a.get||a.set)?Object.defineProperty(r,s,a):r[s]=e[s]}return r.default=e,i&amp;&amp;i.set(e,r),r}(ur);function Lv(e){if(typeof WeakMap!="function")return null;var t=new WeakMap,i=new WeakMap;return(Lv=function(r){return r?i:t})(e)}function Rv(){var e=new ua.ARRAY_TYPE(2);return ua.ARRAY_TYPE!=Float32Array&amp;&amp;(e[0]=0,e[1]=0),e}function Dv(e,t,i){return e[0]=t[0]-i[0],e[1]=t[1]-i[1],e}function Ov(e,t,i){return e[0]=t[0]*i[0],e[1]=t[1]*i[1],e}function kv(e,t,i){return e[0]=t[0]/i[0],e[1]=t[1]/i[1],e}function zv(e,t){return Math.hypot(t[0]-e[0],t[1]-e[1])}function Fv(e,t){var i=t[0]-e[0],r=t[1]-e[1];return i*i+r*r}function Bv(e){return Math.hypot(e[0],e[1])}function Nv(e){var t=e[0],i=e[1];return t*t+i*i}Ce.len=Bv,Ce.sub=Dv,Ce.mul=Ov,Ce.div=kv,Ce.dist=zv,Ce.sqrDist=Fv,Ce.sqrLen=Nv;var IP=function(){var e=Rv();return function(t,i,r,n,s,a){var l,h;for(i||(i=2),r||(r=0),h=n?Math.min(n*i+r,t.length):t.length,l=r;l&lt;h;l+=i)e[0]=t[l],e[1]=t[l+1],s(e,e,a),t[l]=e[0],t[l+1]=e[1];return t}}();function Sm(e){return Sm=typeof Symbol=="function"&amp;&amp;typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&amp;&amp;typeof Symbol=="function"&amp;&amp;t.constructor===Symbol&amp;&amp;t!==Symbol.prototype?"symbol":typeof t},Sm(e)}Ce.forEach=IP,Object.defineProperty(cr,"__esModule",{value:!0});var oi=cr.vec4=W=cr.vec3=cr.vec2=cr.quat2=vr=cr.quat=nt=cr.mat4=Br=cr.mat3=cr.mat2d=il=cr.mat2=cr.glMatrix=void 0,PP=ds(ur);cr.glMatrix=PP;var CP=ds(Mi),il=cr.mat2=CP,LP=ds(Ci);cr.mat2d=LP;var RP=ds(fi),Br=cr.mat3=RP,DP=ds(Ae),nt=cr.mat4=DP,OP=ds(we),vr=cr.quat=OP,kP=ds(Ne);cr.quat2=kP;var zP=ds(Ce);cr.vec2=zP;var FP=ds(Se),W=cr.vec3=FP,BP=ds(ze);function Uv(e){if(typeof WeakMap!="function")return null;var t=new WeakMap,i=new WeakMap;return(Uv=function(r){return r?i:t})(e)}function ds(e,t){if(e&amp;&amp;e.__esModule)return e;if(e===null||Sm(e)!=="object"&amp;&amp;typeof e!="function")return{default:e};var i=Uv(t);if(i&amp;&amp;i.has(e))return i.get(e);var r={},n=Object.defineProperty&amp;&amp;Object.getOwnPropertyDescriptor;for(var s in e)if(s!=="default"&amp;&amp;Object.prototype.hasOwnProperty.call(e,s)){var a=n?Object.getOwnPropertyDescriptor(e,s):null;a&amp;&amp;(a.get||a.set)?Object.defineProperty(r,s,a):r[s]=e[s]}return r.default=e,i&amp;&amp;i.set(e,r),r}oi=cr.vec4=BP;const NP=ei([{type:"Float32",name:"a_globe_pos",components:3},{type:"Float32",name:"a_uv",components:2}]),{members:vh}=NP,Vv=ei([{name:"a_pos_3",components:3,type:"Int16"}]);var wo=ei([{name:"a_pos",type:"Int16",components:2}]),jv={};(function(e,t){(function(i){function r(s,a,l){var h=n(256*s,256*(a=Math.pow(2,l)-a-1),l),d=n(256*(s+1),256*(a+1),l);return h[0]+","+h[1]+","+d[0]+","+d[1]}function n(s,a,l){var h=2*Math.PI*6378137/256/Math.pow(2,l);return[s*h-2*Math.PI*6378137/2,a*h-2*Math.PI*6378137/2]}i.getURL=function(s,a,l,h,d,f){return f=f||{},s+"?"+["bbox="+r(l,h,d),"format="+(f.format||"image/png"),"service="+(f.service||"WMS"),"version="+(f.version||"1.1.1"),"request="+(f.request||"GetMap"),"srs="+(f.srs||"EPSG:3857"),"width="+(f.width||256),"height="+(f.height||256),"layers="+a].join("&amp;")},i.getTileBBox=r,i.getMercCoords=n,Object.defineProperty(i,"__esModule",{value:!0})})(t)})(0,jv);var UP=jv;class In{constructor(t,i,r){this.z=t,this.x=i,this.y=r,this.key=Ec(0,t,t,i,r)}equals(t){return this.z===t.z&amp;&amp;this.x===t.x&amp;&amp;this.y===t.y}url(t,i){const r=UP.getTileBBox(this.x,this.y,this.z),n=function(s,a,l){let h,d="";for(let f=s;f&gt;0;f--)h=1&lt;&lt;f-1,d+=(a&amp;h?1:0)+(l&amp;h?2:0);return d}(this.z,this.x,this.y);return t[(this.x+this.y)%t.length].replace("{prefix}",(this.x%16).toString(16)+(this.y%16).toString(16)).replace(/{z}/g,String(this.z)).replace(/{x}/g,String(this.x)).replace(/{y}/g,String(i==="tms"?Math.pow(2,this.z)-this.y-1:this.y)).replace("{quadkey}",n).replace("{bbox-epsg-3857}",r)}toString(){return`${this.z}/${this.x}/${this.y}`}}class Am{constructor(t,i){this.wrap=t,this.canonical=i,this.key=Ec(t,i.z,i.z,i.x,i.y)}}class We{constructor(t,i,r,n,s){this.overscaledZ=t,this.wrap=i,this.canonical=new In(r,+n,+s),this.key=i===0&amp;&amp;t===r?this.canonical.key:Ec(i,t,r,n,s)}equals(t){return this.overscaledZ===t.overscaledZ&amp;&amp;this.wrap===t.wrap&amp;&amp;this.canonical.equals(t.canonical)}scaledTo(t){const i=this.canonical.z-t;return t&gt;this.canonical.z?new We(t,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new We(t,this.wrap,t,this.canonical.x&gt;&gt;i,this.canonical.y&gt;&gt;i)}calculateScaledKey(t,i=!0){if(this.overscaledZ===t&amp;&amp;i)return this.key;if(t&gt;this.canonical.z)return Ec(this.wrap*+i,t,this.canonical.z,this.canonical.x,this.canonical.y);{const r=this.canonical.z-t;return Ec(this.wrap*+i,t,t,this.canonical.x&gt;&gt;r,this.canonical.y&gt;&gt;r)}}isChildOf(t){if(t.wrap!==this.wrap)return!1;const i=this.canonical.z-t.canonical.z;return t.overscaledZ===0||t.overscaledZ&lt;this.overscaledZ&amp;&amp;t.canonical.z&lt;this.canonical.z&amp;&amp;t.canonical.x===this.canonical.x&gt;&gt;i&amp;&amp;t.canonical.y===this.canonical.y&gt;&gt;i}children(t){if(this.overscaledZ&gt;=t)return[new We(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const i=this.canonical.z+1,r=2*this.canonical.x,n=2*this.canonical.y;return[new We(i,this.wrap,i,r,n),new We(i,this.wrap,i,r+1,n),new We(i,this.wrap,i,r,n+1),new We(i,this.wrap,i,r+1,n+1)]}isLessThan(t){return this.wrap&lt;t.wrap||!(this.wrap&gt;t.wrap)&amp;&amp;(this.overscaledZ&lt;t.overscaledZ||!(this.overscaledZ&gt;t.overscaledZ)&amp;&amp;(this.canonical.x&lt;t.canonical.x||!(this.canonical.x&gt;t.canonical.x)&amp;&amp;this.canonical.y&lt;t.canonical.y))}wrapped(){return new We(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(t){return new We(this.overscaledZ,t,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return Math.pow(2,this.overscaledZ-this.canonical.z)}toUnwrapped(){return new Am(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}}function Ec(e,t,i,r,n){const s=1&lt;&lt;Math.min(i,22);let a=s*(n%s)+r%s;return e&amp;&amp;i&lt;22&amp;&amp;(a+=s*s*((e&lt;0?-2*e-1:2*e)%(1&lt;&lt;2*(22-i)))),16*(32*a+i)+(t-i)}const Gv=[e=&gt;{let t=e.canonical.x-1,i=e.wrap;return t&lt;0&amp;&amp;(t=(1&lt;&lt;e.canonical.z)-1,i--),new We(e.overscaledZ,i,e.canonical.z,t,e.canonical.y)},e=&gt;{let t=e.canonical.x+1,i=e.wrap;return t===1&lt;&lt;e.canonical.z&amp;&amp;(t=0,i++),new We(e.overscaledZ,i,e.canonical.z,t,e.canonical.y)},e=&gt;new We(e.overscaledZ,e.wrap,e.canonical.z,e.canonical.x,(e.canonical.y===0?1&lt;&lt;e.canonical.z:e.canonical.y)-1),e=&gt;new We(e.overscaledZ,e.wrap,e.canonical.z,e.canonical.x,e.canonical.y===(1&lt;&lt;e.canonical.z)-1?0:e.canonical.y+1)];Jt(In,"CanonicalTileID"),Jt(We,"OverscaledTileID",{omit:["projMatrix","expandedProjMatrix"]});class bh{constructor(t,i){this.pos=t,this.dir=i}intersectsPlane(t,i,r){const n=W.dot(i,this.dir);if(Math.abs(n)&lt;1e-6)return!1;const s=((t[0]-this.pos[0])*i[0]+(t[1]-this.pos[1])*i[1]+(t[2]-this.pos[2])*i[2])/n;return r[0]=this.pos[0]+this.dir[0]*s,r[1]=this.pos[1]+this.dir[1]*s,r[2]=this.pos[2]+this.dir[2]*s,!0}closestPointOnSphere(t,i,r){if(W.equals(this.pos,t)||i===0)return r[0]=r[1]=r[2]=0,!1;const[n,s,a]=this.dir,l=this.pos[0]-t[0],h=this.pos[1]-t[1],d=this.pos[2]-t[2],f=n*n+s*s+a*a,m=2*(l*n+h*s+d*a),_=m*m-4*f*(l*l+h*h+d*d-i*i);if(_&lt;0){const y=Math.max(-m/2,0),x=l+n*y,b=h+s*y,w=d+a*y,T=Math.hypot(x,b,w);return r[0]=x*i/T,r[1]=b*i/T,r[2]=w*i/T,!1}{const y=(-m-Math.sqrt(_))/(2*f);if(y&lt;0){const x=Math.hypot(l,h,d);return r[0]=l*i/x,r[1]=h*i/x,r[2]=d*i/x,!1}return r[0]=l+n*y,r[1]=h+s*y,r[2]=d+a*y,!0}}}class Mm{constructor(t,i,r,n,s){this.TL=t,this.TR=i,this.BR=r,this.BL=n,this.horizon=s}static fromInvProjectionMatrix(t,i,r){const n=[-1,1,1],s=[1,1,1],a=[1,-1,1],l=[-1,-1,1],h=W.transformMat4(n,n,t),d=W.transformMat4(s,s,t),f=W.transformMat4(a,a,t),m=W.transformMat4(l,l,t);return new Mm(h,d,f,m,i/r)}}function Sc(e,t,i){let r=1/0,n=-1/0;const s=[];for(const a of e){W.sub(s,a,t);const l=W.dot(s,i);r=Math.min(r,l),n=Math.max(n,l)}return[r,n]}function Hv(e,t){let i=!0;for(let r=0;r&lt;e.planes.length;r++){const n=e.planes[r];let s=0;for(let a=0;a&lt;t.length;a++)s+=W.dot(n,t[a])+n[3]&gt;=0;if(s===0)return 0;s!==t.length&amp;&amp;(i=!1)}return i?2:1}function Wv(e,t){for(const i of e.projections){const r=Sc(t,e.points[0],i.axis);if(i.projection[1]&lt;r[0]||i.projection[0]&gt;r[1])return 0}return 1}function qv(e,t){let i=0;const r=[0,0,0,0];for(let n=0;n&lt;e.length;n++)r[0]=e[n][0],r[1]=e[n][1],r[2]=e[n][2],r[3]=1,oi.dot(r,t)&gt;=0&amp;&amp;i++;return i}class $s{constructor(t,i){this.points=t||new Array(8).fill([0,0,0]),this.planes=i||new Array(6).fill([0,0,0,0]),this.bounds=mi.fromPoints(this.points),this.projections=[],this.frustumEdges=[W.sub([],this.points[2],this.points[3]),W.sub([],this.points[0],this.points[3]),W.sub([],this.points[4],this.points[0]),W.sub([],this.points[5],this.points[1]),W.sub([],this.points[6],this.points[2]),W.sub([],this.points[7],this.points[3])];for(const r of this.frustumEdges){const n=[0,-r[2],r[1]],s=[r[2],0,-r[0]];this.projections.push({axis:n,projection:Sc(this.points,this.points[0],n)}),this.projections.push({axis:s,projection:Sc(this.points,this.points[0],s)})}}static fromInvProjectionMatrix(t,i,r,n){const s=Math.pow(2,r),a=[[-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(d=&gt;{const f=oi.transformMat4([],d,t),m=1/f[3]/i*s;return oi.mul(f,f,[m,m,n?1/f[3]:m,m])}),l=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(d=&gt;{const f=W.sub([],a[d[0]],a[d[1]]),m=W.sub([],a[d[2]],a[d[1]]),_=W.normalize([],W.cross([],f,m)),y=-W.dot(_,a[d[1]]);return _.concat(y)}),h=[];for(let d=0;d&lt;a.length;d++)h.push([a[d][0],a[d][1],a[d][2]]);return new $s(h,l)}intersectsPrecise(t,i,r){for(let n=0;n&lt;i.length;n++)if(!qv(t,i[n]))return 0;for(let n=0;n&lt;this.planes.length;n++)if(!qv(t,this.planes[n]))return 0;for(const n of r)for(const s of this.frustumEdges){const a=W.cross([],n,s),l=W.length(a);if(l===0)continue;W.scale(a,a,1/l);const h=Sc(this.points,this.points[0],a),d=Sc(t,this.points[0],a);if(h[0]&gt;d[1]||d[0]&gt;h[1])return 0}return 1}}class mi{static fromPoints(t){const i=[1/0,1/0,1/0],r=[-1/0,-1/0,-1/0];for(const n of t)W.min(i,i,n),W.max(r,r,n);return new mi(i,r)}static fromTileIdAndHeight(t,i,r){const n=1&lt;&lt;t.canonical.z,s=t.canonical.x,a=t.canonical.y;return new mi([s/n,a/n,i],[(s+1)/n,(a+1)/n,r])}static applyTransform(t,i){const r=t.getCorners();for(let n=0;n&lt;r.length;++n)W.transformMat4(r[n],r[n],i);return mi.fromPoints(r)}static projectAabbCorners(t,i){const r=t.getCorners();for(let n=0;n&lt;r.length;++n)W.transformMat4(r[n],r[n],i);return r}constructor(t,i){this.min=t,this.max=i,this.center=W.scale([],W.add([],this.min,this.max),.5)}quadrant(t){const i=[t%2==0,t&lt;2],r=W.clone(this.min),n=W.clone(this.max);for(let s=0;s&lt;i.length;s++)r[s]=i[s]?this.min[s]:this.center[s],n[s]=i[s]?this.center[s]:this.max[s];return n[2]=this.max[2],new mi(r,n)}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]}distanceZ(t){return Math.max(Math.min(this.max[2],t[2]),this.min[2])-t[2]}getCorners(){const t=this.min,i=this.max;return[[t[0],t[1],t[2]],[i[0],t[1],t[2]],[i[0],i[1],t[2]],[t[0],i[1],t[2]],[t[0],t[1],i[2]],[i[0],t[1],i[2]],[i[0],i[1],i[2]],[t[0],i[1],i[2]]]}intersects(t){return this.intersectsAabb(t.bounds)?Hv(t,this.getCorners()):0}intersectsFlat(t){return this.intersectsAabb(t.bounds)?Hv(t,[[this.min[0],this.min[1],0],[this.max[0],this.min[1],0],[this.max[0],this.max[1],0],[this.min[0],this.max[1],0]]):0}intersectsPrecise(t,i){return i||this.intersects(t)?Wv(t,this.getCorners()):0}intersectsPreciseFlat(t,i){return i||this.intersectsFlat(t)?Wv(t,[[this.min[0],this.min[1],0],[this.max[0],this.min[1],0],[this.max[0],this.max[1],0],[this.min[0],this.max[1],0]]):0}intersectsAabb(t){for(let i=0;i&lt;3;++i)if(this.min[i]&gt;t.max[i]||t.min[i]&gt;this.max[i])return!1;return!0}intersectsAabbXY(t){return!(this.min[0]&gt;t.max[0]||t.min[0]&gt;this.max[0]||this.min[1]&gt;t.max[1]||t.min[1]&gt;this.max[1])}encapsulate(t){for(let i=0;i&lt;3;i++)this.min[i]=Math.min(this.min[i],t.min[i]),this.max[i]=Math.max(this.max[i],t.max[i])}encapsulatePoint(t){for(let i=0;i&lt;3;i++)this.min[i]=Math.min(this.min[i],t[i]),this.max[i]=Math.max(this.max[i],t[i])}closestPoint(t){return[Math.max(Math.min(this.max[0],t[0]),this.min[0]),Math.max(Math.min(this.max[1],t[1]),this.min[1]),Math.max(Math.min(this.max[2],t[2]),this.min[2])]}}Jt(mi,"Aabb");const Ac=5,To=6,Dr=ut/Math.PI/2,VP=16383,rl=64,Im=[rl,32,16],Pn=-Dr,Cn=Dr,jP=[new mi([Pn,Pn,Pn],[Cn,Cn,Cn]),new mi([Pn,Pn,Pn],[0,0,Cn]),new mi([0,Pn,Pn],[Cn,0,Cn]),new mi([Pn,0,Pn],[0,Cn,Cn]),new mi([0,0,Pn],[Cn,Cn,Cn])];function wh(e){return e*Dr/sl}function Zv(e,t,i,r=!0){const n=W.scale([],e._camera.position,e.worldSize),s=[t,i,1,1];oi.transformMat4(s,s,e.pixelMatrixInverse),oi.scale(s,s,1/s[3]);const a=W.sub([],s,n),l=W.normalize([],a),h=e.globeMatrix,d=[h[12],h[13],h[14]],f=W.sub([],d,n),m=W.length(f),_=W.normalize([],f),y=e.worldSize/(2*Math.PI),x=W.dot(_,l),b=Math.asin(y/m);if(b&lt;Math.acos(x)){if(!r)return null;const B=[],U=[];W.scale(B,l,m/x),W.normalize(U,W.sub(U,B,f)),W.normalize(l,W.add(l,f,W.scale(l,U,Math.tan(b)*m)))}const w=[];new bh(n,l).closestPointOnSphere(d,y,w);const T=W.normalize([],bi(h,0)),S=W.normalize([],bi(h,1)),I=W.normalize([],bi(h,2)),P=W.dot(T,w),M=W.dot(S,w),C=W.dot(I,w),D=vi(Math.asin(-M/y));let O=vi(Math.atan2(P,C));O=e.center.lng+function(B,U){const Z=(U-B+180)%360-180;return Z&lt;-180?Z+360:Z}(e.center.lng,O);const k=er(O),z=Xt(sr(D),0,1);return new Be(k,z)}class GP{constructor(t,i,r){this.a=W.sub([],t,r),this.b=W.sub([],i,r),this.center=r;const n=W.normalize([],this.a),s=W.normalize([],this.b);this.angle=Math.acos(W.dot(n,s))}}function Pm(e,t){if(e.angle===0)return null;let i;return i=e.a[t]===0?1/e.angle*.5*Math.PI:1/e.angle*Math.atan(e.b[t]/e.a[t]/Math.sin(e.angle)-1/Math.tan(e.angle)),i&lt;0||i&gt;1?null:function(r,n,s,a){const l=Math.sin(s);return r*(Math.sin((1-a)*s)/l)+n*(Math.sin(a*s)/l)}(e.a[t],e.b[t],e.angle,Xt(i,0,1))+e.center[t]}function pn(e){if(e.z&lt;=1)return jP[e.z+2*e.y+e.x];const t=Lm(Th(e));return mi.fromPoints(t)}function Xs(e,t,i){return W.scale(e,e,1-i),W.scaleAndAdd(e,e,t,i)}function $v(e,t){const i=hr(t.zoom);if(i===0)return pn(e);const r=Th(e),n=Lm(r),s=er(r.getWest())*t.worldSize,a=er(r.getEast())*t.worldSize,l=sr(r.getNorth())*t.worldSize,h=sr(r.getSouth())*t.worldSize,d=[s,l,0],f=[a,l,0],m=[s,h,0],_=[a,h,0],y=nt.invert([],t.globeMatrix);return W.transformMat4(d,d,y),W.transformMat4(f,f,y),W.transformMat4(m,m,y),W.transformMat4(_,_,y),n[0]=Xs(n[0],m,i),n[1]=Xs(n[1],_,i),n[2]=Xs(n[2],f,i),n[3]=Xs(n[3],d,i),mi.fromPoints(n)}function Xv(e,t,i){for(const r of e)W.transformMat4(r,r,t),W.scale(r,r,i)}function Cm(e,t,i,r){const n=t/e.worldSize,s=e.globeMatrix;if(i.z&lt;=1){const k=pn(i).getCorners();return Xv(k,s,n),mi.fromPoints(k)}const a=Th(i,r),l=Lm(a);Xv(l,s,n);const h=Number.MAX_VALUE,d=[-h,-h,-h],f=[h,h,h];if(a.contains(e.center)){for(const B of l)W.min(f,f,B),W.max(d,d,B);d[2]=0;const k=e.point,z=[k.x*n,k.y*n,0];return W.min(f,f,z),W.max(d,d,z),new mi(f,d)}const m=[s[12]*n,s[13]*n,s[14]*n],_=a.getCenter(),y=Xt(e.center.lat,-zi,zi),x=Xt(_.lat,-zi,zi),b=er(e.center.lng),w=sr(y);let T=b-er(_.lng);const S=w-sr(x);T&gt;.5?T-=1:T&lt;-.5&amp;&amp;(T+=1);let I=0;if(Math.abs(T)&gt;Math.abs(S))I=T&gt;=0?1:3;else{I=S&gt;=0?0:2;const k=[s[4]*n,s[5]*n,s[6]*n],z=-Math.sin($t(S&gt;=0?a.getSouth():a.getNorth()))*Dr;W.scaleAndAdd(m,m,k,z)}const P=l[I],M=l[(I+1)%4],C=new GP(P,M,m),D=[Pm(C,0)||P[0],Pm(C,1)||P[1],Pm(C,2)||P[2]],O=hr(e.zoom);if(O&gt;0){const k=function({x:B,y:U,z:Z},F,Y,J,it){const X=1/(1&lt;&lt;Z);let K=B*X,ot=K+X,lt=U*X,at=lt+X,dt=0;const ft=(K+ot)/2-J;return ft&gt;.5?dt=-1:ft&lt;-.5&amp;&amp;(dt=1),K=((K+dt)*F-(J*=F))*Y+J,ot=((ot+dt)*F-J)*Y+J,lt=(lt*F-(it*=F))*Y+it,at=(at*F-it)*Y+it,[[K,at,0],[ot,at,0],[ot,lt,0],[K,lt,0]]}(i,t,e._pixelsPerMercatorPixel,b,w);for(let B=0;B&lt;l.length;B++)Xs(l[B],k[B],O);const z=W.add([],k[I],k[(I+1)%4]);W.scale(z,z,.5),Xs(D,z,O)}for(const k of l)W.min(f,f,k),W.max(d,d,k);return f[2]=Math.min(P[2],M[2]),W.min(f,f,D),W.max(d,d,D),new mi(f,d)}function Th({x:e,y:t,z:i},r=!1){const n=1/(1&lt;&lt;i),s=new ye(tn(e*n),t===(1&lt;&lt;i)-1&amp;&amp;r?-90:Yi((t+1)*n)),a=new ye(tn((e+1)*n),t===0&amp;&amp;r?90:Yi(t*n));return new Qr(s,a)}function Lm(e){const t=$t(e.getNorth()),i=$t(e.getSouth()),r=Math.cos(t),n=Math.cos(i),s=Math.sin(t),a=Math.sin(i),l=e.getWest(),h=e.getEast();return[nl(n,a,l),nl(n,a,h),nl(r,s,h),nl(r,s,l)]}function nl(e,t,i,r=Dr){return i=$t(i),[e*Math.sin(i)*r,-t*r,e*Math.cos(i)*r]}function Nr(e,t,i){return nl(Math.cos($t(e)),Math.sin($t(e)),t,i)}function Mc(e,t,i,r){const n=1&lt;&lt;i.z,s=(e/ut+i.x)/n;return Nr(Yi((t/ut+i.y)/n),tn(s),r)}function Eh({min:e,max:t}){return VP/Math.max(t[0]-e[0],t[1]-e[1],t[2]-e[2])}const Yv=new Float64Array(16);function Eo(e){const t=Eh(e),i=nt.fromScaling(Yv,[t,t,t]);return nt.translate(i,i,W.negate([],e.min))}function Rm(e){const t=nt.fromTranslation(Yv,e.min),i=1/Eh(e);return nt.scale(t,t,[i,i,i])}function Dm(e){const t=ut/(2*Math.PI);return e/(2*Math.PI)/t}function Kv(e,t){return ut/(512*Math.pow(2,e))*Eh(pn(t))}function Jv(e,t,i,r,n){const s=Dm(i),a=[e,t,-i/(2*Math.PI)],l=nt.identity(new Float64Array(16));return nt.translate(l,l,a),nt.scale(l,l,[s,s,s]),nt.rotateX(l,l,$t(-n)),nt.rotateY(l,l,$t(-r)),l}function Qv(e){const t=e.pixelsPerMeter,i=t/ui(1,e.center.lat),r=nt.identity(new Float64Array(16));return nt.translate(r,r,[e.point.x,e.point.y,0]),nt.scale(r,r,[i,i,t]),Float32Array.from(r)}function hr(e){return xn(Ac,To,e)}function t1(e,t,i){const r=nt.identity(new Float64Array(16)),n=(t/(1&lt;&lt;e)-.5)*Math.PI*2;return nt.rotateY(r,i.globeMatrix,n),Float32Array.from(r)}function e1(e,t,i){const r=hr(i.zoom),n=e.style.map._antialias,s=t.options.extStandardDerivativesForceOff||e.terrain&amp;&amp;e.terrain.exaggeration()&gt;0;return r===0&amp;&amp;!n&amp;&amp;!s}function i1(e,t,i,r){const n=t.getNorth(),s=t.getSouth(),a=t.getWest(),l=t.getEast(),h=1&lt;&lt;e.z,d=l-a,f=n-s,m=d/rl,_=-f/Im[i],y=[0,m,0,_,0,0,n,a,0];if(e.z&gt;0){const x=180/r;Br.multiply(y,y,[x/d+1,0,0,0,x/f+1,0,-.5*x/m,.5*x/_,1])}return y[2]=h,y[5]=e.x,y[8]=e.y,y}function HP(e){const t=zi-5;e=Xt(e,-t,t)/t*90;const i=Math.pow(Math.abs(Math.sin($t(e))),3);return Math.round(i*(Im.length-1))}function r1(e){const t=[0,0,0],i=nt.identity(new Float64Array(16));return nt.multiply(i,e.pixelMatrix,e.globeMatrix),W.transformMat4(t,t,i),new Q(t[0],t[1])}function n1(e,t){const i=Nr(t.lat,t.lng),r=function(s){const a=Nr(s._center.lat,s._center.lng),l=W.fromValues(0,1,0);let h=W.cross([],l,a);const d=nt.fromRotation([],-s.angle,a);h=W.transformMat4(h,h,d),nt.fromRotation(d,-s._pitch,h);const f=W.normalize([],a);return W.scale(f,f,wh(s.cameraToCenterDistance/s.pixelsPerMeter)),W.transformMat4(f,f,d),W.add([],a,f)}(e),n=W.subtract([],r,i);return W.angle(n,i)}function Sh(e,t){return n1(e,t)&gt;Math.PI/2*1.01}const s1=$t(85),WP=Math.cos(s1),qP=Math.sin(s1);class ZP{constructor(t){this._createGrid(t),this._createPoles(t)}destroy(){this._poleIndexBuffer.destroy(),this._gridBuffer.destroy(),this._gridIndexBuffer.destroy(),this._poleNorthVertexBuffer.destroy(),this._poleSouthVertexBuffer.destroy();for(const t of this._poleSegments)t.destroy();for(const t of this._gridSegments)t.withSkirts.destroy(),t.withoutSkirts.destroy()}_fillGridMeshWithLods(t,i){const r=new Kr,n=new Xi,s=[],a=t+1+2,l=i[0]+1,h=i[0]+1+(1+i.length),d=(f,m,_)=&gt;{let y=f===a-1?f-2:f===0?f:f-1;return y+=_?24575:0,[y,m]};for(let f=0;f&lt;a;++f)r.emplaceBack(...d(f,0,!0));for(let f=0;f&lt;l;++f)for(let m=0;m&lt;a;++m)r.emplaceBack(...d(m,f,(m===0||m===a-1)&amp;&amp;!0));for(let f=0;f&lt;i.length;++f){const m=i[f];for(let _=0;_&lt;a;++_)r.emplaceBack(...d(_,m,!0))}for(let f=0;f&lt;i.length;++f){const m=n.length,_=i[f]+1+2,y=new Xi;for(let w=0;w&lt;_-1;w++){const T=w===_-2,S=T?a*(h-i.length+f-w):a;for(let I=0;I&lt;a-1;I++){const P=w*a+I;w===0||T||I===0||I===a-2?(y.emplaceBack(P+1,P,P+S),y.emplaceBack(P+S,P+S+1,P+1)):(n.emplaceBack(P+1,P,P+S),n.emplaceBack(P+S,P+S+1,P+1))}}const x=si.simpleSegment(0,m,r.length,n.length-m);for(let w=0;w&lt;y.uint16.length;w+=3)n.emplaceBack(y.uint16[w],y.uint16[w+1],y.uint16[w+2]);const b=si.simpleSegment(0,m,r.length,n.length-m);s.push({withoutSkirts:x,withSkirts:b})}return{vertices:r,indices:n,segments:s}}_createGrid(t){const i=this._fillGridMeshWithLods(rl,Im);this._gridSegments=i.segments,this._gridBuffer=t.createVertexBuffer(i.vertices,wo.members),this._gridIndexBuffer=t.createIndexBuffer(i.indices,!0)}_createPoles(t){const i=new Xi;for(let l=0;l&lt;=rl;l++)i.emplaceBack(0,l+1,l+2);this._poleIndexBuffer=t.createIndexBuffer(i,!0);const r=new oa,n=new oa,s=new oa,a=new oa;this._poleSegments=[];for(let l=0,h=0;l&lt;Ac;l++){const d=360/(1&lt;&lt;l);r.emplaceBack(0,-Dr,0,.5,0),n.emplaceBack(0,-Dr,0,.5,1),s.emplaceBack(0,-Dr,0,.5,.5),a.emplaceBack(0,-Dr,0,.5,.5);for(let f=0;f&lt;=rl;f++){let m=f/rl,_=0;const y=ge(0,d,m),[x,b,w]=nl(WP,qP,y,Dr);r.emplaceBack(x,b,w,m,_),n.emplaceBack(x,b,w,m,1-_);const T=$t(y);m=.5+.5*Math.sin(T),_=.5+.5*Math.cos(T),s.emplaceBack(x,b,w,m,_),a.emplaceBack(x,b,w,m,1-_)}this._poleSegments.push(si.simpleSegment(h,0,66,64)),h+=66}this._poleNorthVertexBuffer=t.createVertexBuffer(r,vh,!1),this._poleSouthVertexBuffer=t.createVertexBuffer(n,vh,!1),this._texturedPoleNorthVertexBuffer=t.createVertexBuffer(s,vh,!1),this._texturedPoleSouthVertexBuffer=t.createVertexBuffer(a,vh,!1)}getGridBuffers(t,i){return[this._gridBuffer,this._gridIndexBuffer,i?this._gridSegments[t].withSkirts:this._gridSegments[t].withoutSkirts]}getPoleBuffers(t,i){return[i?this._texturedPoleNorthVertexBuffer:this._poleNorthVertexBuffer,i?this._texturedPoleSouthVertexBuffer:this._poleSouthVertexBuffer,this._poleIndexBuffer,this._poleSegments[t]]}}const sl=63710088e-1,Om=2*Math.PI*sl;class So{constructor(t,i){if(isNaN(t)||isNaN(i))throw new Error(`Invalid LngLat object: (${t}, ${i})`);if(this.lng=+t,this.lat=+i,this.lat&gt;90||this.lat&lt;-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new So(Hr(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(t){const i=Math.PI/180,r=this.lat*i,n=t.lat*i,s=Math.sin(r)*Math.sin(n)+Math.cos(r)*Math.cos(n)*Math.cos((t.lng-this.lng)*i);return sl*Math.acos(Math.min(s,1))}toBounds(t=0){const i=360*t/40075017,r=i/Math.cos(Math.PI/180*this.lat);return new Qr(new So(this.lng-r,this.lat-i),new So(this.lng+r,this.lat+i))}toEcef(t){const i=wh(t);return Nr(this.lat,this.lng,Dr+i)}static convert(t){if(t instanceof So)return t;if(Array.isArray(t)&amp;&amp;(t.length===2||t.length===3))return new So(Number(t[0]),Number(t[1]));if(!Array.isArray(t)&amp;&amp;typeof t=="object"&amp;&amp;t!==null)return new So(Number("lng"in t?t.lng:t.lon),Number(t.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: &lt;lng&gt;, lat: &lt;lat&gt;}, an object {lon: &lt;lng&gt;, lat: &lt;lat&gt;}, or an array of [&lt;lng&gt;, &lt;lat&gt;]")}}var ye=So;const $P=0,XP=25.5;function Ah(e){return Om*Math.cos(e*Math.PI/180)}function er(e){return(180+e)/360}function sr(e){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+e*Math.PI/360)))/360}function ui(e,t){return e/Ah(t)}function tn(e){return 360*e-180}function Yi(e){return 360/Math.PI*Math.atan(Math.exp((180-360*e)*Math.PI/180))-90}function o1(e,t){return e*Ah(Yi(t))}const zi=85.051129;function a1(e){return Math.cos($t(Xt(e,-zi,zi)))}function Ao(e,t){const i=Xt(t,$P,XP),r=Math.pow(2,i);return a1(e)*Om/(512*r)}function km(e){return 1/Math.cos(e*Math.PI/180)}function Ic(e,t=0){const i=Math.exp(Math.PI*(1-(e.y+t/ut)/(1&lt;&lt;e.z)*2));return 80150034*i/(i*i+1)/ut/(1&lt;&lt;e.z)}class Be{constructor(t,i,r=0){this.x=+t,this.y=+i,this.z=+r}static fromLngLat(t,i=0){const r=ye.convert(t);return new Be(er(r.lng),sr(r.lat),ui(i,r.lat))}toLngLat(){return new ye(tn(this.x),Yi(this.y))}toAltitude(){return o1(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/Om*km(Yi(this.y))}}function zm(e,t,i,r,n,s,a,l,h){const d=(t+r)/2,f=(i+n)/2,m=new Q(d,f);l(m),function(_,y,x,b,w,T){const S=x-w,I=b-T;return Math.abs((b-y)*S-(x-_)*I)/Math.hypot(S,I)}(m.x,m.y,s.x,s.y,a.x,a.y)&gt;=h?(zm(e,t,i,d,f,s,m,l,h),zm(e,d,f,r,n,m,a,l,h)):e.push(a)}function l1(e,t,i){let r=e[0],n=r.x,s=r.y;t(r);const a=[r];for(let l=1;l&lt;e.length;l++){const h=e[l],{x:d,y:f}=h;t(h),zm(a,n,s,d,f,r,h,t,i),n=d,s=f,r=h}return a}function Fm(e,t,i,r){if(r(t,i)){const n=t.add(i)._mult(.5);Fm(e,t,n,r),Fm(e,n,i,r)}else e.push(i)}function YP(e,t){let i=e[0];const r=[i];for(let n=1;n&lt;e.length;n++){const s=e[n];Fm(r,i,s,t),i=s}return r}const Bm=Math.pow(2,14)-1,c1=-Bm-1;function KP(e,t){const i=Math.round(e.x*t),r=Math.round(e.y*t);return e.x=Xt(i,c1,Bm),e.y=Xt(r,c1,Bm),(i&lt;e.x||i&gt;e.x+1||r&lt;e.y||r&gt;e.y+1)&amp;&amp;tt("Geometry exceeds allowed extent, reduce your vector tile buffer size"),e}function fs(e,t,i){const r=e.loadGeometry(),n=e.extent,s=ut/n;if(t&amp;&amp;i&amp;&amp;i.projection.isReprojectedInTileSpace){const a=1&lt;&lt;t.z,{scale:l,x:h,y:d,projection:f}=i,m=_=&gt;{const y=tn((t.x+_.x/n)/a),x=Yi((t.y+_.y/n)/a),b=f.project(y,x);_.x=(b.x*l-h)*n,_.y=(b.y*l-d)*n};for(let _=0;_&lt;r.length;_++)if(e.type!==1)r[_]=l1(r[_],m,1);else{const y=[];for(const x of r[_])x.x&lt;0||x.x&gt;=n||x.y&lt;0||x.y&gt;=n||(m(x),y.push(x));r[_]=y}}for(const a of r)for(const l of a)KP(l,s);return r}function Mo(e,t){return{type:e.type,id:e.id,properties:e.properties,geometry:t?fs(e):[]}}function Mh(e,t,i,r,n){e.emplaceBack(2*t+(r+1)/2,2*i+(n+1)/2)}function Ih(e,t,i){e.emplaceBack(t.x,t.y,t.z,i[0]*16384,i[1]*16384,i[2]*16384)}class Nm{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(i=&gt;i.fqid),this.index=t.index,this.hasPattern=!1,this.projection=t.projection,this.layoutVertexArray=new Kr,this.indexArray=new Xi,this.segments=new si,this.programConfigurations=new vo(t.layers,t.zoom),this.stateDependentLayerIds=this.layers.filter(i=&gt;i.isStateDependent()).map(i=&gt;i.id)}populate(t,i,r,n){const s=this.layers[0],a=[];let l=null;s.type==="circle"&amp;&amp;(l=s.layout.get("circle-sort-key"));for(const{feature:d,id:f,index:m,sourceLayerIndex:_}of t){const y=this.layers[0]._featureFilter.needGeometry,x=Mo(d,y);if(!this.layers[0]._featureFilter.filter(new Si(this.zoom),x,r))continue;const b=l?l.evaluate(x,{},r):void 0,w={id:f,properties:d.properties,type:d.type,sourceLayerIndex:_,index:m,geometry:y?x.geometry:fs(d,r,n),patterns:{},sortKey:b};a.push(w)}l&amp;&amp;a.sort((d,f)=&gt;d.sortKey-f.sortKey);let h=null;n.projection.name==="globe"&amp;&amp;(this.globeExtVertexArray=new dh,h=n.projection);for(const d of a){const{geometry:f,index:m,sourceLayerIndex:_}=d,y=t[m].feature;this.addFeature(d,f,m,i.availableImages,r,h,i.brightness),i.featureIndex.insert(y,f,m,_,this.index)}}update(t,i,r,n,s){const a=Object.keys(t).length!==0;a&amp;&amp;!this.stateDependentLayers.length||this.programConfigurations.updatePaintArrays(t,i,a?this.stateDependentLayers:this.layers,r,n,s)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,aP.members),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.globeExtVertexArray&amp;&amp;(this.globeExtVertexBuffer=t.createVertexBuffer(this.globeExtVertexArray,lP.members))),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&amp;&amp;(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.globeExtVertexBuffer&amp;&amp;this.globeExtVertexBuffer.destroy())}addFeature(t,i,r,n,s,a,l){for(const h of i)for(const d of h){const f=d.x,m=d.y;if(f&lt;0||f&gt;=ut||m&lt;0||m&gt;=ut)continue;if(a){const x=a.projectTilePoint(f,m,s),b=a.upVector(s,f,m),w=this.globeExtVertexArray;Ih(w,x,b),Ih(w,x,b),Ih(w,x,b),Ih(w,x,b)}const _=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,t.sortKey),y=_.vertexLength;Mh(this.layoutVertexArray,f,m,-1,-1),Mh(this.layoutVertexArray,f,m,1,-1),Mh(this.layoutVertexArray,f,m,1,1),Mh(this.layoutVertexArray,f,m,-1,1),this.indexArray.emplaceBack(y,y+1,y+2),this.indexArray.emplaceBack(y,y+2,y+3),_.vertexLength+=4,_.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,r,{},n,s,l)}}function u1(e,t){for(let i=0;i&lt;e.length;i++)if(Io(t,e[i]))return!0;for(let i=0;i&lt;t.length;i++)if(Io(e,t[i]))return!0;return!!Um(e,t)}function JP(e,t,i){return!!Io(e,t)||!!Vm(t,e,i)}function h1(e,t){if(e.length===1)return f1(t,e[0]);for(let i=0;i&lt;t.length;i++){const r=t[i];for(let n=0;n&lt;r.length;n++)if(Io(e,r[n]))return!0}for(let i=0;i&lt;e.length;i++)if(f1(t,e[i]))return!0;for(let i=0;i&lt;t.length;i++)if(Um(e,t[i]))return!0;return!1}function QP(e,t,i){if(e.length&gt;1){if(Um(e,t))return!0;for(let r=0;r&lt;t.length;r++)if(Vm(t[r],e,i))return!0}for(let r=0;r&lt;e.length;r++)if(Vm(e[r],t,i))return!0;return!1}function Um(e,t){if(e.length===0||t.length===0)return!1;for(let i=0;i&lt;e.length-1;i++){const r=e[i],n=e[i+1];for(let s=0;s&lt;t.length-1;s++)if(tC(r,n,t[s],t[s+1]))return!0}return!1}function tC(e,t,i,r){return vt(e,i,r)!==vt(t,i,r)&amp;&amp;vt(e,t,i)!==vt(e,t,r)}function Vm(e,t,i){const r=i*i;if(t.length===1)return e.distSqr(t[0])&lt;r;for(let n=1;n&lt;t.length;n++)if(d1(e,t[n-1],t[n])&lt;r)return!0;return!1}function d1(e,t,i){const r=t.distSqr(i);if(r===0)return e.distSqr(t);const n=((e.x-t.x)*(i.x-t.x)+(e.y-t.y)*(i.y-t.y))/r;return e.distSqr(n&lt;0?t:n&gt;1?i:i.sub(t)._mult(n)._add(t))}function f1(e,t){let i,r,n,s=!1;for(let a=0;a&lt;e.length;a++){i=e[a];for(let l=0,h=i.length-1;l&lt;i.length;h=l++)r=i[l],n=i[h],r.y&gt;t.y!=n.y&gt;t.y&amp;&amp;t.x&lt;(n.x-r.x)*(t.y-r.y)/(n.y-r.y)+r.x&amp;&amp;(s=!s)}return s}function Io(e,t){let i=!1;for(let r=0,n=e.length-1;r&lt;e.length;n=r++){const s=e[r],a=e[n];s.y&gt;t.y!=a.y&gt;t.y&amp;&amp;t.x&lt;(a.x-s.x)*(t.y-s.y)/(a.y-s.y)+s.x&amp;&amp;(i=!i)}return i}function p1(e,t,i,r,n){for(const a of e)if(t&lt;=a.x&amp;&amp;i&lt;=a.y&amp;&amp;r&gt;=a.x&amp;&amp;n&gt;=a.y)return!0;const s=[new Q(t,i),new Q(t,n),new Q(r,n),new Q(r,i)];if(e.length&gt;2){for(const a of s)if(Io(e,a))return!0}for(let a=0;a&lt;e.length-1;a++)if(eC(e[a],e[a+1],s))return!0;return!1}function eC(e,t,i){const r=i[0],n=i[2];if(e.x&lt;r.x&amp;&amp;t.x&lt;r.x||e.x&gt;n.x&amp;&amp;t.x&gt;n.x||e.y&lt;r.y&amp;&amp;t.y&lt;r.y||e.y&gt;n.y&amp;&amp;t.y&gt;n.y)return!1;const s=vt(e,t,i[0]);return s!==vt(e,t,i[1])||s!==vt(e,t,i[2])||s!==vt(e,t,i[3])}function ol(e,t,i,r,n,s){let a=t.y-e.y,l=e.x-t.x;if(s=s||0){const h=a*a+l*l;if(h===0)return!0;const d=Math.sqrt(h);a/=d,l/=d}return!((i.x-e.x)*a+(i.y-e.y)*l-s&lt;0||(r.x-e.x)*a+(r.y-e.y)*l-s&lt;0||(n.x-e.x)*a+(n.y-e.y)*l-s&lt;0)}function jm(e,t,i,r,n,s,a){return!(ol(e,t,r,n,s,a)||ol(t,i,r,n,s,a)||ol(i,e,r,n,s,a)||ol(r,n,e,t,i,a)||ol(n,s,e,t,i,a)||ol(s,r,e,t,i,a))}function al(e,t,i){const r=t.paint.get(e).value;return r.kind==="constant"?r.value:i.programConfigurations.get(t.id).getMaxValue(e)}function Ph(e){return Math.sqrt(e[0]*e[0]+e[1]*e[1])}function m1(e,t,i,r,n){if(!t[0]&amp;&amp;!t[1])return e;const s=Q.convert(t)._mult(n);i==="viewport"&amp;&amp;s._rotate(-r);const a=[];for(let l=0;l&lt;e.length;l++)a.push(e[l].sub(s));return a}function _1(e,t,i,r){const n=Q.convert(e)._mult(r);return t==="viewport"&amp;&amp;n._rotate(-i),n}Jt(Nm,"CircleBucket",{omit:["layers"]});const iC=new Di({"circle-sort-key":new ne(st.layout_circle["circle-sort-key"]),visibility:new At(st.layout_circle.visibility)});var rC={paint:new Di({"circle-radius":new ne(st.paint_circle["circle-radius"]),"circle-color":new ne(st.paint_circle["circle-color"]),"circle-blur":new ne(st.paint_circle["circle-blur"]),"circle-opacity":new ne(st.paint_circle["circle-opacity"]),"circle-translate":new At(st.paint_circle["circle-translate"]),"circle-translate-anchor":new At(st.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new At(st.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new At(st.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new ne(st.paint_circle["circle-stroke-width"]),"circle-stroke-color":new ne(st.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new ne(st.paint_circle["circle-stroke-opacity"]),"circle-emissive-strength":new At(st.paint_circle["circle-emissive-strength"])}),layout:iC};const nC=nt.create(),sC=(e,t,i,r,n,s)=&gt;{const a=e.transform,l=a.projection.name==="globe";let h;if(s.paint.get("circle-pitch-alignment")==="map")if(l){const f=Kv(a.zoom,t.canonical)*a._pixelsPerMercatorPixel;h=Float32Array.from([f,0,0,f])}else h=a.calculatePixelsToTileUnitsMatrix(i);else h=new Float32Array([a.pixelsToGLUnits[0],0,0,a.pixelsToGLUnits[1]]);const d={u_camera_to_center_distance:e.transform.getCameraToCenterDistance(a.projection),u_matrix:e.translatePosMatrix(t.projMatrix,i,s.paint.get("circle-translate"),s.paint.get("circle-translate-anchor")),u_device_pixel_ratio:_e.devicePixelRatio,u_extrude_scale:h,u_inv_rot_matrix:nC,u_merc_center:[0,0],u_tile_id:[0,0,0],u_zoom_transition:0,u_up_dir:[0,0,0],u_emissive_strength:s.paint.get("circle-emissive-strength")};if(l){d.u_inv_rot_matrix=r,d.u_merc_center=n,d.u_tile_id=[t.canonical.x,t.canonical.y,1&lt;&lt;t.canonical.z],d.u_zoom_transition=hr(a.zoom);const f=n[0]*ut,m=n[1]*ut;d.u_up_dir=a.projection.upVector(new In(0,0,0),f,m)}return d},g1=e=&gt;{const t=[];return e.paint.get("circle-pitch-alignment")==="map"&amp;&amp;t.push("PITCH_WITH_MAP"),e.paint.get("circle-pitch-scale")==="map"&amp;&amp;t.push("SCALE_WITH_MAP"),t};function y1(e,t,i,r,n,s,a,l,h){if(s&amp;&amp;e.queryGeometry.isAboveHorizon)return!1;s&amp;&amp;(h*=e.pixelToTileUnitsFactor);const d=e.tileID.canonical,f=i.projection.upVectorScale(d,i.center.lat,i.worldSize).metersToTile;for(const m of t)for(const _ of m){const y=_.add(l),x=n&amp;&amp;i.elevation?i.elevation.exaggeration()*n.getElevationAt(y.x,y.y,!0):0,b=i.projection.projectTilePoint(y.x,y.y,d);if(x&gt;0){const I=i.projection.upVector(d,y.x,y.y);b.x+=I[0]*f*x,b.y+=I[1]*f*x,b.z+=I[2]*f*x}const w=s?y:oC(b.x,b.y,b.z,r),T=s?e.tilespaceRays.map(I=&gt;lC(I,x)):e.queryGeometry.screenGeometry,S=oi.transformMat4([],[b.x,b.y,b.z,1],r);if(!a&amp;&amp;s?h*=S[3]/i.cameraToCenterDistance:a&amp;&amp;!s&amp;&amp;(h*=i.cameraToCenterDistance/S[3]),s){const I=Yi((_.y/ut+d.y)/(1&lt;&lt;d.z));h/=i.projection.pixelsPerMeter(I,1)/ui(1,I)}if(JP(T,w,h))return!0}return!1}function oC(e,t,i,r){const n=oi.transformMat4([],[e,t,i,1],r);return new Q(n[0]/n[3],n[1]/n[3])}const x1=W.fromValues(0,0,0),aC=W.fromValues(0,0,1);function lC(e,t){const i=W.create();return x1[2]=t,e.intersectsPlane(x1,aC,i),new Q(i[0],i[1])}class v1 extends Nm{}function b1(e,{width:t,height:i},r,n){if(n){if(n instanceof Uint8ClampedArray)n=new Uint8Array(n.buffer);else if(n.length!==t*i*r)throw new RangeError("mismatched image size")}else n=new Uint8Array(t*i*r);return e.width=t,e.height=i,e.data=n,e}function w1(e,t,i){const{width:r,height:n}=t;r===e.width&amp;&amp;n===e.height||(Gm(e,t,{x:0,y:0},{x:0,y:0},{width:Math.min(e.width,r),height:Math.min(e.height,n)},i),e.width=r,e.height=n,e.data=t.data)}function Gm(e,t,i,r,n,s){if(n.width===0||n.height===0)return t;if(n.width&gt;e.width||n.height&gt;e.height||i.x&gt;e.width-n.width||i.y&gt;e.height-n.height)throw new RangeError("out of range source coordinates for image copy");if(n.width&gt;t.width||n.height&gt;t.height||r.x&gt;t.width-n.width||r.y&gt;t.height-n.height)throw new RangeError("out of range destination coordinates for image copy");const a=e.data,l=t.data;for(let h=0;h&lt;n.height;h++){const d=((i.y+h)*e.width+i.x)*s,f=((r.y+h)*t.width+r.x)*s;for(let m=0;m&lt;n.width*s;m++)l[f+m]=a[d+m]}return t}Jt(v1,"HeatmapBucket",{omit:["layers"]});class Ys{constructor(t,i){b1(this,t,1,i)}resize(t){w1(this,new Ys(t),1)}clone(){return new Ys({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,i,r,n,s){Gm(t,i,r,n,s,1)}}class Hi{constructor(t,i){b1(this,t,4,i)}resize(t){w1(this,new Hi(t),4)}replace(t,i){i?this.data.set(t):this.data=t instanceof Uint8ClampedArray?new Uint8Array(t.buffer):t}clone(){return new Hi({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,i,r,n,s){Gm(t,i,r,n,s,4)}}class T1{constructor(t,i){this.width=t.width,this.height=t.height,this.data=i instanceof Uint8Array?new Float32Array(i.buffer):i}}Jt(Ys,"AlphaImage"),Jt(Hi,"RGBAImage");const cC=new Di({visibility:new At(st.layout_heatmap.visibility)});var uC={paint:new Di({"heatmap-radius":new ne(st.paint_heatmap["heatmap-radius"]),"heatmap-weight":new ne(st.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new At(st.paint_heatmap["heatmap-intensity"]),"heatmap-color":new yc(st.paint_heatmap["heatmap-color"]),"heatmap-opacity":new At(st.paint_heatmap["heatmap-opacity"])}),layout:cC};function Ch(e){const t={},i=e.resolution||256,r=e.clips?e.clips.length:1,n=e.image||new Hi({width:i,height:r}),s=(a,l,h)=&gt;{t[e.evaluationKey]=h;const d=e.expression.evaluate(t);d&amp;&amp;(n.data[a+l+0]=Math.floor(255*d.r/d.a),n.data[a+l+1]=Math.floor(255*d.g/d.a),n.data[a+l+2]=Math.floor(255*d.b/d.a),n.data[a+l+3]=Math.floor(255*d.a))};if(e.clips)for(let a=0,l=0;a&lt;r;++a,l+=4*i)for(let h=0,d=0;h&lt;i;h++,d+=4){const f=h/(i-1),{start:m,end:_}=e.clips[a];s(l,d,m*(1-f)+_*f)}else for(let a=0,l=0;a&lt;i;a++,l+=4)s(0,l,a/(i-1));return n}const hC=new Di({visibility:new At(st.layout_hillshade.visibility)});var dC={paint:new Di({"hillshade-illumination-direction":new At(st.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new At(st.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new At(st.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new At(st.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new At(st.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new At(st.paint_hillshade["hillshade-accent-color"]),"hillshade-emissive-strength":new At(st.paint_hillshade["hillshade-emissive-strength"])}),layout:hC};const fC=ei([{name:"a_pos",components:2,type:"Int16"}],4),{members:pC}=fC;var Hm={exports:{}};function Lh(e,t,i){i=i||2;var r,n,s,a,l,h,d,f=t&amp;&amp;t.length,m=f?t[0]*i:e.length,_=E1(e,0,m,i,!0),y=[];if(!_||_.next===_.prev)return y;if(f&amp;&amp;(_=function(b,w,T,S){var I,P,M,C=[];for(I=0,P=w.length;I&lt;P;I++)(M=E1(b,w[I]*S,I&lt;P-1?w[I+1]*S:b.length,S,!1))===M.next&amp;&amp;(M.steiner=!0),C.push(wC(M));for(C.sort(xC),I=0;I&lt;C.length;I++)T=vC(C[I],T);return T}(e,t,_,i)),e.length&gt;80*i){r=s=e[0],n=a=e[1];for(var x=i;x&lt;m;x+=i)(l=e[x])&lt;r&amp;&amp;(r=l),(h=e[x+1])&lt;n&amp;&amp;(n=h),l&gt;s&amp;&amp;(s=l),h&gt;a&amp;&amp;(a=h);d=(d=Math.max(s-r,a-n))!==0?32767/d:0}return Pc(_,y,i,r,n,d,0),y}function E1(e,t,i,r,n){var s,a;if(n===Zm(e,t,i,r)&gt;0)for(s=t;s&lt;i;s+=r)a=M1(s,e[s],e[s+1],a);else for(s=i-r;s&gt;=t;s-=r)a=M1(s,e[s],e[s+1],a);return a&amp;&amp;Rh(a,a.next)&amp;&amp;(Lc(a),a=a.next),a}function ha(e,t){if(!e)return e;t||(t=e);var i,r=e;do if(i=!1,r.steiner||!Rh(r,r.next)&amp;&amp;ir(r.prev,r,r.next)!==0)r=r.next;else{if(Lc(r),(r=t=r.prev)===r.next)break;i=!0}while(i||r!==t);return t}function Pc(e,t,i,r,n,s,a){if(e){!a&amp;&amp;s&amp;&amp;function(f,m,_,y){var x=f;do x.z===0&amp;&amp;(x.z=Wm(x.x,x.y,m,_,y)),x.prevZ=x.prev,x.nextZ=x.next,x=x.next;while(x!==f);x.prevZ.nextZ=null,x.prevZ=null,function(b){var w,T,S,I,P,M,C,D,O=1;do{for(T=b,b=null,P=null,M=0;T;){for(M++,S=T,C=0,w=0;w&lt;O&amp;&amp;(C++,S=S.nextZ);w++);for(D=O;C&gt;0||D&gt;0&amp;&amp;S;)C!==0&amp;&amp;(D===0||!S||T.z&lt;=S.z)?(I=T,T=T.nextZ,C--):(I=S,S=S.nextZ,D--),P?P.nextZ=I:b=I,I.prevZ=P,P=I;T=S}P.nextZ=null,O*=2}while(M&gt;1)}(x)}(e,r,n,s);for(var l,h,d=e;e.prev!==e.next;)if(l=e.prev,h=e.next,s?_C(e,r,n,s):mC(e))t.push(l.i/i|0),t.push(e.i/i|0),t.push(h.i/i|0),Lc(e),e=h.next,d=h.next;else if((e=h)===d){a?a===1?Pc(e=gC(ha(e),t,i),t,i,r,n,s,2):a===2&amp;&amp;yC(e,t,i,r,n,s):Pc(ha(e),t,i,r,n,s,1);break}}}function mC(e){var t=e.prev,i=e,r=e.next;if(ir(t,i,r)&gt;=0)return!1;for(var n=t.x,s=i.x,a=r.x,l=t.y,h=i.y,d=r.y,f=n&lt;s?n&lt;a?n:a:s&lt;a?s:a,m=l&lt;h?l&lt;d?l:d:h&lt;d?h:d,_=n&gt;s?n&gt;a?n:a:s&gt;a?s:a,y=l&gt;h?l&gt;d?l:d:h&gt;d?h:d,x=r.next;x!==t;){if(x.x&gt;=f&amp;&amp;x.x&lt;=_&amp;&amp;x.y&gt;=m&amp;&amp;x.y&lt;=y&amp;&amp;ll(n,l,s,h,a,d,x.x,x.y)&amp;&amp;ir(x.prev,x,x.next)&gt;=0)return!1;x=x.next}return!0}function _C(e,t,i,r){var n=e.prev,s=e,a=e.next;if(ir(n,s,a)&gt;=0)return!1;for(var l=n.x,h=s.x,d=a.x,f=n.y,m=s.y,_=a.y,y=l&lt;h?l&lt;d?l:d:h&lt;d?h:d,x=f&lt;m?f&lt;_?f:_:m&lt;_?m:_,b=l&gt;h?l&gt;d?l:d:h&gt;d?h:d,w=f&gt;m?f&gt;_?f:_:m&gt;_?m:_,T=Wm(y,x,t,i,r),S=Wm(b,w,t,i,r),I=e.prevZ,P=e.nextZ;I&amp;&amp;I.z&gt;=T&amp;&amp;P&amp;&amp;P.z&lt;=S;){if(I.x&gt;=y&amp;&amp;I.x&lt;=b&amp;&amp;I.y&gt;=x&amp;&amp;I.y&lt;=w&amp;&amp;I!==n&amp;&amp;I!==a&amp;&amp;ll(l,f,h,m,d,_,I.x,I.y)&amp;&amp;ir(I.prev,I,I.next)&gt;=0||(I=I.prevZ,P.x&gt;=y&amp;&amp;P.x&lt;=b&amp;&amp;P.y&gt;=x&amp;&amp;P.y&lt;=w&amp;&amp;P!==n&amp;&amp;P!==a&amp;&amp;ll(l,f,h,m,d,_,P.x,P.y)&amp;&amp;ir(P.prev,P,P.next)&gt;=0))return!1;P=P.nextZ}for(;I&amp;&amp;I.z&gt;=T;){if(I.x&gt;=y&amp;&amp;I.x&lt;=b&amp;&amp;I.y&gt;=x&amp;&amp;I.y&lt;=w&amp;&amp;I!==n&amp;&amp;I!==a&amp;&amp;ll(l,f,h,m,d,_,I.x,I.y)&amp;&amp;ir(I.prev,I,I.next)&gt;=0)return!1;I=I.prevZ}for(;P&amp;&amp;P.z&lt;=S;){if(P.x&gt;=y&amp;&amp;P.x&lt;=b&amp;&amp;P.y&gt;=x&amp;&amp;P.y&lt;=w&amp;&amp;P!==n&amp;&amp;P!==a&amp;&amp;ll(l,f,h,m,d,_,P.x,P.y)&amp;&amp;ir(P.prev,P,P.next)&gt;=0)return!1;P=P.nextZ}return!0}function gC(e,t,i){var r=e;do{var n=r.prev,s=r.next.next;!Rh(n,s)&amp;&amp;S1(n,r,r.next,s)&amp;&amp;Cc(n,s)&amp;&amp;Cc(s,n)&amp;&amp;(t.push(n.i/i|0),t.push(r.i/i|0),t.push(s.i/i|0),Lc(r),Lc(r.next),r=e=s),r=r.next}while(r!==e);return ha(r)}function yC(e,t,i,r,n,s){var a=e;do{for(var l=a.next.next;l!==a.prev;){if(a.i!==l.i&amp;&amp;TC(a,l)){var h=A1(a,l);return a=ha(a,a.next),h=ha(h,h.next),Pc(a,t,i,r,n,s,0),void Pc(h,t,i,r,n,s,0)}l=l.next}a=a.next}while(a!==e)}function xC(e,t){return e.x-t.x}function vC(e,t){var i=function(n,s){var a,l=s,h=n.x,d=n.y,f=-1/0;do{if(d&lt;=l.y&amp;&amp;d&gt;=l.next.y&amp;&amp;l.next.y!==l.y){var m=l.x+(d-l.y)*(l.next.x-l.x)/(l.next.y-l.y);if(m&lt;=h&amp;&amp;m&gt;f&amp;&amp;(f=m,a=l.x&lt;l.next.x?l:l.next,m===h))return a}l=l.next}while(l!==s);if(!a)return null;var _,y=a,x=a.x,b=a.y,w=1/0;l=a;do h&gt;=l.x&amp;&amp;l.x&gt;=x&amp;&amp;h!==l.x&amp;&amp;ll(d&lt;b?h:f,d,x,b,d&lt;b?f:h,d,l.x,l.y)&amp;&amp;(_=Math.abs(d-l.y)/(h-l.x),Cc(l,n)&amp;&amp;(_&lt;w||_===w&amp;&amp;(l.x&gt;a.x||l.x===a.x&amp;&amp;bC(a,l)))&amp;&amp;(a=l,w=_)),l=l.next;while(l!==y);return a}(e,t);if(!i)return t;var r=A1(i,e);return ha(r,r.next),ha(i,i.next)}function bC(e,t){return ir(e.prev,e,t.prev)&lt;0&amp;&amp;ir(t.next,e,e.next)&lt;0}function Wm(e,t,i,r,n){return(e=1431655765&amp;((e=858993459&amp;((e=252645135&amp;((e=16711935&amp;((e=(e-i)*n|0)|e&lt;&lt;8))|e&lt;&lt;4))|e&lt;&lt;2))|e&lt;&lt;1))|(t=1431655765&amp;((t=858993459&amp;((t=252645135&amp;((t=16711935&amp;((t=(t-r)*n|0)|t&lt;&lt;8))|t&lt;&lt;4))|t&lt;&lt;2))|t&lt;&lt;1))&lt;&lt;1}function wC(e){var t=e,i=e;do(t.x&lt;i.x||t.x===i.x&amp;&amp;t.y&lt;i.y)&amp;&amp;(i=t),t=t.next;while(t!==e);return i}function ll(e,t,i,r,n,s,a,l){return(n-a)*(t-l)&gt;=(e-a)*(s-l)&amp;&amp;(e-a)*(r-l)&gt;=(i-a)*(t-l)&amp;&amp;(i-a)*(s-l)&gt;=(n-a)*(r-l)}function TC(e,t){return e.next.i!==t.i&amp;&amp;e.prev.i!==t.i&amp;&amp;!function(i,r){var n=i;do{if(n.i!==i.i&amp;&amp;n.next.i!==i.i&amp;&amp;n.i!==r.i&amp;&amp;n.next.i!==r.i&amp;&amp;S1(n,n.next,i,r))return!0;n=n.next}while(n!==i);return!1}(e,t)&amp;&amp;(Cc(e,t)&amp;&amp;Cc(t,e)&amp;&amp;function(i,r){var n=i,s=!1,a=(i.x+r.x)/2,l=(i.y+r.y)/2;do n.y&gt;l!=n.next.y&gt;l&amp;&amp;n.next.y!==n.y&amp;&amp;a&lt;(n.next.x-n.x)*(l-n.y)/(n.next.y-n.y)+n.x&amp;&amp;(s=!s),n=n.next;while(n!==i);return s}(e,t)&amp;&amp;(ir(e.prev,e,t.prev)||ir(e,t.prev,t))||Rh(e,t)&amp;&amp;ir(e.prev,e,e.next)&gt;0&amp;&amp;ir(t.prev,t,t.next)&gt;0)}function ir(e,t,i){return(t.y-e.y)*(i.x-t.x)-(t.x-e.x)*(i.y-t.y)}function Rh(e,t){return e.x===t.x&amp;&amp;e.y===t.y}function S1(e,t,i,r){var n=Oh(ir(e,t,i)),s=Oh(ir(e,t,r)),a=Oh(ir(i,r,e)),l=Oh(ir(i,r,t));return n!==s&amp;&amp;a!==l||!(n!==0||!Dh(e,i,t))||!(s!==0||!Dh(e,r,t))||!(a!==0||!Dh(i,e,r))||!(l!==0||!Dh(i,t,r))}function Dh(e,t,i){return t.x&lt;=Math.max(e.x,i.x)&amp;&amp;t.x&gt;=Math.min(e.x,i.x)&amp;&amp;t.y&lt;=Math.max(e.y,i.y)&amp;&amp;t.y&gt;=Math.min(e.y,i.y)}function Oh(e){return e&gt;0?1:e&lt;0?-1:0}function Cc(e,t){return ir(e.prev,e,e.next)&lt;0?ir(e,t,e.next)&gt;=0&amp;&amp;ir(e,e.prev,t)&gt;=0:ir(e,t,e.prev)&lt;0||ir(e,e.next,t)&lt;0}function A1(e,t){var i=new qm(e.i,e.x,e.y),r=new qm(t.i,t.x,t.y),n=e.next,s=t.prev;return e.next=t,t.prev=e,i.next=n,n.prev=i,r.next=i,i.prev=r,s.next=r,r.prev=s,r}function M1(e,t,i,r){var n=new qm(e,t,i);return r?(n.next=r.next,n.prev=r,r.next.prev=n,r.next=n):(n.prev=n,n.next=n),n}function Lc(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&amp;&amp;(e.prevZ.nextZ=e.nextZ),e.nextZ&amp;&amp;(e.nextZ.prevZ=e.prevZ)}function qm(e,t,i){this.i=e,this.x=t,this.y=i,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function Zm(e,t,i,r){for(var n=0,s=t,a=i-r;s&lt;i;s+=r)n+=(e[a]-e[s])*(e[s+1]+e[a+1]),a=s;return n}Hm.exports=Lh,Hm.exports.default=Lh,Lh.deviation=function(e,t,i,r){var n=t&amp;&amp;t.length,s=Math.abs(Zm(e,0,n?t[0]*i:e.length,i));if(n)for(var a=0,l=t.length;a&lt;l;a++)s-=Math.abs(Zm(e,t[a]*i,a&lt;l-1?t[a+1]*i:e.length,i));var h=0;for(a=0;a&lt;r.length;a+=3){var d=r[a]*i,f=r[a+1]*i,m=r[a+2]*i;h+=Math.abs((e[d]-e[m])*(e[f+1]-e[d+1])-(e[d]-e[f])*(e[m+1]-e[d+1]))}return s===0&amp;&amp;h===0?0:Math.abs((h-s)/s)},Lh.flatten=function(e){for(var t=e[0][0].length,i={vertices:[],holes:[],dimensions:t},r=0,n=0;n&lt;e.length;n++){for(var s=0;s&lt;e[n].length;s++)for(var a=0;a&lt;t;a++)i.vertices.push(e[n][s][a]);n&gt;0&amp;&amp;i.holes.push(r+=e[n-1].length)}return i};var kh=Qt(Hm.exports);function $m(e,t){const i=e.length;if(i&lt;=1)return[e];const r=[];let n,s;for(let a=0;a&lt;i;a++){const l=Tt(e[a]);l!==0&amp;&amp;(e[a].area=Math.abs(l),s===void 0&amp;&amp;(s=l&lt;0),s===l&lt;0?(n&amp;&amp;r.push(n),n=[e[a]]):n.push(e[a]))}if(n&amp;&amp;r.push(n),t&gt;1)for(let a=0;a&lt;r.length;a++)r[a].length&lt;=t||(oI(r[a],t,1,r[a].length-1,EC),r[a]=r[a].slice(0,t));return r}function EC(e,t){return t.area-e.area}function Xm(e,t,i){const r=i.patternDependencies;let n=!1;for(const s of t){const a=s.paint.get(`${e}-pattern`);a.isConstant()||(n=!0);const l=a.constantOr(null);l&amp;&amp;(n=!0,r[l]=!0)}return n}function Ym(e,t,i,r,n){const s=n.patternDependencies;for(const a of t){const l=a.paint.get(`${e}-pattern`).value;if(l.kind!=="constant"){let h=l.evaluate({zoom:r},i,{},n.availableImages);h=h&amp;&amp;h.name?h.name:h,s[h]=!0,i.patterns[a.id]=h}}return i}class zh{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(i=&gt;i.fqid),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new Kr,this.indexArray=new Xi,this.indexArray2=new yo,this.programConfigurations=new vo(t.layers,t.zoom),this.segments=new si,this.segments2=new si,this.stateDependentLayerIds=this.layers.filter(i=&gt;i.isStateDependent()).map(i=&gt;i.id),this.projection=t.projection}populate(t,i,r,n){this.hasPattern=Xm("fill",this.layers,i);const s=this.layers[0].layout.get("fill-sort-key"),a=[];for(const{feature:l,id:h,index:d,sourceLayerIndex:f}of t){const m=this.layers[0]._featureFilter.needGeometry,_=Mo(l,m);if(!this.layers[0]._featureFilter.filter(new Si(this.zoom),_,r))continue;const y=s?s.evaluate(_,{},r,i.availableImages):void 0,x={id:h,properties:l.properties,type:l.type,sourceLayerIndex:f,index:d,geometry:m?_.geometry:fs(l,r,n),patterns:{},sortKey:y};a.push(x)}s&amp;&amp;a.sort((l,h)=&gt;l.sortKey-h.sortKey);for(const l of a){const{geometry:h,index:d,sourceLayerIndex:f}=l;if(this.hasPattern){const m=Ym("fill",this.layers,l,this.zoom,i);this.patternFeatures.push(m)}else this.addFeature(l,h,d,r,{},i.availableImages,i.brightness);i.featureIndex.insert(t[d].feature,h,d,f,this.index)}}update(t,i,r,n,s){const a=Object.keys(t).length!==0;a&amp;&amp;!this.stateDependentLayers.length||this.programConfigurations.updatePaintArrays(t,i,a?this.stateDependentLayers:this.layers,r,n,s)}addFeatures(t,i,r,n,s,a){for(const l of this.patternFeatures)this.addFeature(l,l.geometry,l.index,i,r,n,a)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,pC),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.indexBuffer2=t.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&amp;&amp;(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy())}addFeature(t,i,r,n,s,a=[],l){for(const h of $m(i,500)){let d=0;for(const b of h)d+=b.length;const f=this.segments.prepareSegment(d,this.layoutVertexArray,this.indexArray),m=f.vertexLength,_=[],y=[];for(const b of h){if(b.length===0)continue;b!==h[0]&amp;&amp;y.push(_.length/2);const w=this.segments2.prepareSegment(b.length,this.layoutVertexArray,this.indexArray2),T=w.vertexLength;this.layoutVertexArray.emplaceBack(b[0].x,b[0].y),this.indexArray2.emplaceBack(T+b.length-1,T),_.push(b[0].x),_.push(b[0].y);for(let S=1;S&lt;b.length;S++)this.layoutVertexArray.emplaceBack(b[S].x,b[S].y),this.indexArray2.emplaceBack(T+S-1,T+S),_.push(b[S].x),_.push(b[S].y);w.vertexLength+=b.length,w.primitiveLength+=b.length}const x=kh(_,y);for(let b=0;b&lt;x.length;b+=3)this.indexArray.emplaceBack(m+x[b],m+x[b+1],m+x[b+2]);f.vertexLength+=d,f.primitiveLength+=x.length/3}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,r,s,a,n,l)}}Jt(zh,"FillBucket",{omit:["layers","patternFeatures"]});const SC=new Di({"fill-sort-key":new ne(st.layout_fill["fill-sort-key"]),visibility:new At(st.layout_fill.visibility)});var AC={paint:new Di({"fill-antialias":new At(st.paint_fill["fill-antialias"]),"fill-opacity":new ne(st.paint_fill["fill-opacity"]),"fill-color":new ne(st.paint_fill["fill-color"]),"fill-outline-color":new ne(st.paint_fill["fill-outline-color"]),"fill-translate":new At(st.paint_fill["fill-translate"]),"fill-translate-anchor":new At(st.paint_fill["fill-translate-anchor"]),"fill-pattern":new ne(st.paint_fill["fill-pattern"]),"fill-emissive-strength":new At(st.paint_fill["fill-emissive-strength"])}),layout:SC};const MC=ei([{name:"a_pos_normal_ed",components:4,type:"Int16"}]),IC=ei([{name:"a_pos_end",components:4,type:"Int16"},{name:"a_angular_offset_factor",components:1,type:"Int16"}]),PC=ei([{name:"a_centroid_pos",components:2,type:"Uint16"}]),CC=ei([{name:"a_hidden_by_landmark",components:1,type:"Uint8"}]),LC=ei([{name:"a_pos_3",components:3,type:"Int16"},{name:"a_pos_normal_3",components:3,type:"Int16"}]),{members:RC}=MC;var Fh={},DC=Ge,I1=cl;function cl(e,t,i,r,n){this.properties={},this.extent=i,this.type=0,this._pbf=e,this._geometry=-1,this._keys=r,this._values=n,e.readFields(OC,this,t)}function OC(e,t,i){e==1?t.id=i.readVarint():e==2?function(r,n){for(var s=r.readVarint()+r.pos;r.pos&lt;s;){var a=n._keys[r.readVarint()],l=n._values[r.readVarint()];n.properties[a]=l}}(i,t):e==3?t.type=i.readVarint():e==4&amp;&amp;(t._geometry=i.pos)}function kC(e){for(var t,i,r=0,n=0,s=e.length,a=s-1;n&lt;s;a=n++)r+=((i=e[a]).x-(t=e[n]).x)*(t.y+i.y);return r}cl.types=["Unknown","Point","LineString","Polygon"],cl.prototype.loadGeometry=function(){var e=this._pbf;e.pos=this._geometry;for(var t,i=e.readVarint()+e.pos,r=1,n=0,s=0,a=0,l=[];e.pos&lt;i;){if(n&lt;=0){var h=e.readVarint();r=7&amp;h,n=h&gt;&gt;3}if(n--,r===1||r===2)s+=e.readSVarint(),a+=e.readSVarint(),r===1&amp;&amp;(t&amp;&amp;l.push(t),t=[]),t.push(new DC(s,a));else{if(r!==7)throw new Error("unknown command "+r);t&amp;&amp;t.push(t[0].clone())}}return t&amp;&amp;l.push(t),l},cl.prototype.bbox=function(){var e=this._pbf;e.pos=this._geometry;for(var t=e.readVarint()+e.pos,i=1,r=0,n=0,s=0,a=1/0,l=-1/0,h=1/0,d=-1/0;e.pos&lt;t;){if(r&lt;=0){var f=e.readVarint();i=7&amp;f,r=f&gt;&gt;3}if(r--,i===1||i===2)(n+=e.readSVarint())&lt;a&amp;&amp;(a=n),n&gt;l&amp;&amp;(l=n),(s+=e.readSVarint())&lt;h&amp;&amp;(h=s),s&gt;d&amp;&amp;(d=s);else if(i!==7)throw new Error("unknown command "+i)}return[a,h,l,d]},cl.prototype.toGeoJSON=function(e,t,i){var r,n,s=this.extent*Math.pow(2,i),a=this.extent*e,l=this.extent*t,h=this.loadGeometry(),d=cl.types[this.type];function f(y){for(var x=0;x&lt;y.length;x++){var b=y[x];y[x]=[360*(b.x+a)/s-180,360/Math.PI*Math.atan(Math.exp((180-360*(b.y+l)/s)*Math.PI/180))-90]}}switch(this.type){case 1:var m=[];for(r=0;r&lt;h.length;r++)m[r]=h[r][0];f(h=m);break;case 2:for(r=0;r&lt;h.length;r++)f(h[r]);break;case 3:for(h=function(y){var x=y.length;if(x&lt;=1)return[y];for(var b,w,T=[],S=0;S&lt;x;S++){var I=kC(y[S]);I!==0&amp;&amp;(w===void 0&amp;&amp;(w=I&lt;0),w===I&lt;0?(b&amp;&amp;T.push(b),b=[y[S]]):b.push(y[S]))}return b&amp;&amp;T.push(b),T}(h),r=0;r&lt;h.length;r++)for(n=0;n&lt;h[r].length;n++)f(h[r][n])}h.length===1?h=h[0]:d="Multi"+d;var _={type:"Feature",geometry:{type:d,coordinates:h},properties:this.properties};return"id"in this&amp;&amp;(_.id=this.id),_};var zC=I1,P1=C1;function C1(e,t){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=e,this._keys=[],this._values=[],this._features=[],e.readFields(FC,this,t),this.length=this._features.length}function FC(e,t,i){e===15?t.version=i.readVarint():e===1?t.name=i.readString():e===5?t.extent=i.readVarint():e===2?t._features.push(i.pos):e===3?t._keys.push(i.readString()):e===4&amp;&amp;t._values.push(function(r){for(var n=null,s=r.readVarint()+r.pos;r.pos&lt;s;){var a=r.readVarint()&gt;&gt;3;n=a===1?r.readString():a===2?r.readFloat():a===3?r.readDouble():a===4?r.readVarint64():a===5?r.readVarint():a===6?r.readSVarint():a===7?r.readBoolean():null}return n}(i))}C1.prototype.feature=function(e){if(e&lt;0||e&gt;=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[e];var t=this._pbf.readVarint()+this._pbf.pos;return new zC(this._pbf,t,this.extent,this._keys,this._values)};var BC=P1;function NC(e,t,i){if(e===3){var r=new BC(i,i.readVarint()+i.pos);r.length&amp;&amp;(t[r.name]=r)}}var Km=Fh.VectorTile=function(e,t){this.layers=e.readFields(NC,{},t)},Bh=Fh.VectorTileFeature=I1;function Nh(e,t,i,r){const n=[],s=r===0?(a,l,h,d,f,m)=&gt;{a.push(new Q(m,h+(m-l)/(d-l)*(f-h)))}:(a,l,h,d,f,m)=&gt;{a.push(new Q(l+(m-h)/(f-h)*(d-l),m))};for(const a of e){const l=[];for(const h of a){if(h.length&lt;=2)continue;const d=[];for(let _=0;_&lt;h.length-1;_++){const y=h[_].x,x=h[_].y,b=h[_+1].x,w=h[_+1].y,T=r===0?y:x,S=r===0?b:w;T&lt;t?S&gt;t&amp;&amp;s(d,y,x,b,w,t):T&gt;i?S&lt;i&amp;&amp;s(d,y,x,b,w,i):d.push(h[_]),S&lt;t&amp;&amp;T&gt;=t&amp;&amp;s(d,y,x,b,w,t),S&gt;i&amp;&amp;T&lt;=i&amp;&amp;s(d,y,x,b,w,i)}let f=h[h.length-1];const m=r===0?f.x:f.y;m&gt;=t&amp;&amp;m&lt;=i&amp;&amp;d.push(f),d.length&amp;&amp;(f=d[d.length-1],d[0].x===f.x&amp;&amp;d[0].y===f.y||d.push(d[0]),l.push(d))}l.length&amp;&amp;n.push(l)}return n}Fh.VectorTileLayer=P1;class L1{constructor(t){this._stringToNumber={},this._numberToString=[];for(let i=0;i&lt;t.length;i++){const r=t[i];this._stringToNumber[r]=i,this._numberToString[i]=r}}encode(t){return this._stringToNumber[t]}decode(t){return this._numberToString[t]}}var UC={read:function(e,t,i,r,n){var s,a,l=8*n-r-1,h=(1&lt;&lt;l)-1,d=h&gt;&gt;1,f=-7,m=i?n-1:0,_=i?-1:1,y=e[t+m];for(m+=_,s=y&amp;(1&lt;&lt;-f)-1,y&gt;&gt;=-f,f+=l;f&gt;0;s=256*s+e[t+m],m+=_,f-=8);for(a=s&amp;(1&lt;&lt;-f)-1,s&gt;&gt;=-f,f+=r;f&gt;0;a=256*a+e[t+m],m+=_,f-=8);if(s===0)s=1-d;else{if(s===h)return a?NaN:1/0*(y?-1:1);a+=Math.pow(2,r),s-=d}return(y?-1:1)*a*Math.pow(2,s-r)},write:function(e,t,i,r,n,s){var a,l,h,d=8*s-n-1,f=(1&lt;&lt;d)-1,m=f&gt;&gt;1,_=n===23?Math.pow(2,-24)-Math.pow(2,-77):0,y=r?0:s-1,x=r?1:-1,b=t&lt;0||t===0&amp;&amp;1/t&lt;0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(l=isNaN(t)?1:0,a=f):(a=Math.floor(Math.log(t)/Math.LN2),t*(h=Math.pow(2,-a))&lt;1&amp;&amp;(a--,h*=2),(t+=a+m&gt;=1?_/h:_*Math.pow(2,1-m))*h&gt;=2&amp;&amp;(a++,h/=2),a+m&gt;=f?(l=0,a=f):a+m&gt;=1?(l=(t*h-1)*Math.pow(2,n),a+=m):(l=t*Math.pow(2,m-1)*Math.pow(2,n),a=0));n&gt;=8;e[i+y]=255&amp;l,y+=x,l/=256,n-=8);for(a=a&lt;&lt;n|l,d+=n;d&gt;0;e[i+y]=255&amp;a,y+=x,a/=256,d-=8);e[i+y-x]|=128*b}},R1=wi,Uh=UC;function wi(e){this.buf=ArrayBuffer.isView&amp;&amp;ArrayBuffer.isView(e)?e:new Uint8Array(e||0),this.pos=0,this.type=0,this.length=this.buf.length}wi.Varint=0,wi.Fixed64=1,wi.Bytes=2,wi.Fixed32=5;var Jm=4294967296,D1=1/Jm,O1=typeof TextDecoder&gt;"u"?null:new TextDecoder("utf8");function Ks(e){return e.type===wi.Bytes?e.readVarint()+e.pos:e.pos+1}function ul(e,t,i){return i?4294967296*t+(e&gt;&gt;&gt;0):4294967296*(t&gt;&gt;&gt;0)+(e&gt;&gt;&gt;0)}function k1(e,t,i){var r=t&lt;=16383?1:t&lt;=2097151?2:t&lt;=268435455?3:Math.floor(Math.log(t)/(7*Math.LN2));i.realloc(r);for(var n=i.pos-1;n&gt;=e;n--)i.buf[n+r]=i.buf[n]}function VC(e,t){for(var i=0;i&lt;e.length;i++)t.writeVarint(e[i])}function jC(e,t){for(var i=0;i&lt;e.length;i++)t.writeSVarint(e[i])}function GC(e,t){for(var i=0;i&lt;e.length;i++)t.writeFloat(e[i])}function HC(e,t){for(var i=0;i&lt;e.length;i++)t.writeDouble(e[i])}function WC(e,t){for(var i=0;i&lt;e.length;i++)t.writeBoolean(e[i])}function qC(e,t){for(var i=0;i&lt;e.length;i++)t.writeFixed32(e[i])}function ZC(e,t){for(var i=0;i&lt;e.length;i++)t.writeSFixed32(e[i])}function $C(e,t){for(var i=0;i&lt;e.length;i++)t.writeFixed64(e[i])}function XC(e,t){for(var i=0;i&lt;e.length;i++)t.writeSFixed64(e[i])}function Vh(e,t){return(e[t]|e[t+1]&lt;&lt;8|e[t+2]&lt;&lt;16)+16777216*e[t+3]}function hl(e,t,i){e[i]=t,e[i+1]=t&gt;&gt;&gt;8,e[i+2]=t&gt;&gt;&gt;16,e[i+3]=t&gt;&gt;&gt;24}function z1(e,t){return(e[t]|e[t+1]&lt;&lt;8|e[t+2]&lt;&lt;16)+(e[t+3]&lt;&lt;24)}wi.prototype={destroy:function(){this.buf=null},readFields:function(e,t,i){for(i=i||this.length;this.pos&lt;i;){var r=this.readVarint(),n=r&gt;&gt;3,s=this.pos;this.type=7&amp;r,e(n,t,this),this.pos===s&amp;&amp;this.skip(r)}return t},readMessage:function(e,t){return this.readFields(e,t,this.readVarint()+this.pos)},readFixed32:function(){var e=Vh(this.buf,this.pos);return this.pos+=4,e},readSFixed32:function(){var e=z1(this.buf,this.pos);return this.pos+=4,e},readFixed64:function(){var e=Vh(this.buf,this.pos)+Vh(this.buf,this.pos+4)*Jm;return this.pos+=8,e},readSFixed64:function(){var e=Vh(this.buf,this.pos)+z1(this.buf,this.pos+4)*Jm;return this.pos+=8,e},readFloat:function(){var e=Uh.read(this.buf,this.pos,!0,23,4);return this.pos+=4,e},readDouble:function(){var e=Uh.read(this.buf,this.pos,!0,52,8);return this.pos+=8,e},readVarint:function(e){var t,i,r=this.buf;return t=127&amp;(i=r[this.pos++]),i&lt;128?t:(t|=(127&amp;(i=r[this.pos++]))&lt;&lt;7,i&lt;128?t:(t|=(127&amp;(i=r[this.pos++]))&lt;&lt;14,i&lt;128?t:(t|=(127&amp;(i=r[this.pos++]))&lt;&lt;21,i&lt;128?t:function(n,s,a){var l,h,d=a.buf;if(l=(112&amp;(h=d[a.pos++]))&gt;&gt;4,h&lt;128||(l|=(127&amp;(h=d[a.pos++]))&lt;&lt;3,h&lt;128)||(l|=(127&amp;(h=d[a.pos++]))&lt;&lt;10,h&lt;128)||(l|=(127&amp;(h=d[a.pos++]))&lt;&lt;17,h&lt;128)||(l|=(127&amp;(h=d[a.pos++]))&lt;&lt;24,h&lt;128)||(l|=(1&amp;(h=d[a.pos++]))&lt;&lt;31,h&lt;128))return ul(n,l,s);throw new Error("Expected varint not more than 10 bytes")}(t|=(15&amp;(i=r[this.pos]))&lt;&lt;28,e,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var e=this.readVarint();return e%2==1?(e+1)/-2:e/2},readBoolean:function(){return!!this.readVarint()},readString:function(){var e=this.readVarint()+this.pos,t=this.pos;return this.pos=e,e-t&gt;=12&amp;&amp;O1?function(i,r,n){return O1.decode(i.subarray(r,n))}(this.buf,t,e):function(i,r,n){for(var s="",a=r;a&lt;n;){var l,h,d,f=i[a],m=null,_=f&gt;239?4:f&gt;223?3:f&gt;191?2:1;if(a+_&gt;n)break;_===1?f&lt;128&amp;&amp;(m=f):_===2?(192&amp;(l=i[a+1]))==128&amp;&amp;(m=(31&amp;f)&lt;&lt;6|63&amp;l)&lt;=127&amp;&amp;(m=null):_===3?(h=i[a+2],(192&amp;(l=i[a+1]))==128&amp;&amp;(192&amp;h)==128&amp;&amp;((m=(15&amp;f)&lt;&lt;12|(63&amp;l)&lt;&lt;6|63&amp;h)&lt;=2047||m&gt;=55296&amp;&amp;m&lt;=57343)&amp;&amp;(m=null)):_===4&amp;&amp;(h=i[a+2],d=i[a+3],(192&amp;(l=i[a+1]))==128&amp;&amp;(192&amp;h)==128&amp;&amp;(192&amp;d)==128&amp;&amp;((m=(15&amp;f)&lt;&lt;18|(63&amp;l)&lt;&lt;12|(63&amp;h)&lt;&lt;6|63&amp;d)&lt;=65535||m&gt;=1114112)&amp;&amp;(m=null)),m===null?(m=65533,_=1):m&gt;65535&amp;&amp;(m-=65536,s+=String.fromCharCode(m&gt;&gt;&gt;10&amp;1023|55296),m=56320|1023&amp;m),s+=String.fromCharCode(m),a+=_}return s}(this.buf,t,e)},readBytes:function(){var e=this.readVarint()+this.pos,t=this.buf.subarray(this.pos,e);return this.pos=e,t},readPackedVarint:function(e,t){if(this.type!==wi.Bytes)return e.push(this.readVarint(t));var i=Ks(this);for(e=e||[];this.pos&lt;i;)e.push(this.readVarint(t));return e},readPackedSVarint:function(e){if(this.type!==wi.Bytes)return e.push(this.readSVarint());var t=Ks(this);for(e=e||[];this.pos&lt;t;)e.push(this.readSVarint());return e},readPackedBoolean:function(e){if(this.type!==wi.Bytes)return e.push(this.readBoolean());var t=Ks(this);for(e=e||[];this.pos&lt;t;)e.push(this.readBoolean());return e},readPackedFloat:function(e){if(this.type!==wi.Bytes)return e.push(this.readFloat());var t=Ks(this);for(e=e||[];this.pos&lt;t;)e.push(this.readFloat());return e},readPackedDouble:function(e){if(this.type!==wi.Bytes)return e.push(this.readDouble());var t=Ks(this);for(e=e||[];this.pos&lt;t;)e.push(this.readDouble());return e},readPackedFixed32:function(e){if(this.type!==wi.Bytes)return e.push(this.readFixed32());var t=Ks(this);for(e=e||[];this.pos&lt;t;)e.push(this.readFixed32());return e},readPackedSFixed32:function(e){if(this.type!==wi.Bytes)return e.push(this.readSFixed32());var t=Ks(this);for(e=e||[];this.pos&lt;t;)e.push(this.readSFixed32());return e},readPackedFixed64:function(e){if(this.type!==wi.Bytes)return e.push(this.readFixed64());var t=Ks(this);for(e=e||[];this.pos&lt;t;)e.push(this.readFixed64());return e},readPackedSFixed64:function(e){if(this.type!==wi.Bytes)return e.push(this.readSFixed64());var t=Ks(this);for(e=e||[];this.pos&lt;t;)e.push(this.readSFixed64());return e},skip:function(e){var t=7&amp;e;if(t===wi.Varint)for(;this.buf[this.pos++]&gt;127;);else if(t===wi.Bytes)this.pos=this.readVarint()+this.pos;else if(t===wi.Fixed32)this.pos+=4;else{if(t!==wi.Fixed64)throw new Error("Unimplemented type: "+t);this.pos+=8}},writeTag:function(e,t){this.writeVarint(e&lt;&lt;3|t)},realloc:function(e){for(var t=this.length||16;t&lt;this.pos+e;)t*=2;if(t!==this.length){var i=new Uint8Array(t);i.set(this.buf),this.buf=i,this.length=t}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(e){this.realloc(4),hl(this.buf,e,this.pos),this.pos+=4},writeSFixed32:function(e){this.realloc(4),hl(this.buf,e,this.pos),this.pos+=4},writeFixed64:function(e){this.realloc(8),hl(this.buf,-1&amp;e,this.pos),hl(this.buf,Math.floor(e*D1),this.pos+4),this.pos+=8},writeSFixed64:function(e){this.realloc(8),hl(this.buf,-1&amp;e,this.pos),hl(this.buf,Math.floor(e*D1),this.pos+4),this.pos+=8},writeVarint:function(e){(e=+e||0)&gt;268435455||e&lt;0?function(t,i){var r,n;if(t&gt;=0?(r=t%4294967296|0,n=t/4294967296|0):(n=~(-t/4294967296),4294967295^(r=~(-t%4294967296))?r=r+1|0:(r=0,n=n+1|0)),t&gt;=18446744073709552e3||t&lt;-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");i.realloc(10),function(s,a,l){l.buf[l.pos++]=127&amp;s|128,s&gt;&gt;&gt;=7,l.buf[l.pos++]=127&amp;s|128,s&gt;&gt;&gt;=7,l.buf[l.pos++]=127&amp;s|128,s&gt;&gt;&gt;=7,l.buf[l.pos++]=127&amp;s|128,l.buf[l.pos]=127&amp;(s&gt;&gt;&gt;=7)}(r,0,i),function(s,a){var l=(7&amp;s)&lt;&lt;4;a.buf[a.pos++]|=l|((s&gt;&gt;&gt;=3)?128:0),s&amp;&amp;(a.buf[a.pos++]=127&amp;s|((s&gt;&gt;&gt;=7)?128:0),s&amp;&amp;(a.buf[a.pos++]=127&amp;s|((s&gt;&gt;&gt;=7)?128:0),s&amp;&amp;(a.buf[a.pos++]=127&amp;s|((s&gt;&gt;&gt;=7)?128:0),s&amp;&amp;(a.buf[a.pos++]=127&amp;s|((s&gt;&gt;&gt;=7)?128:0),s&amp;&amp;(a.buf[a.pos++]=127&amp;s)))))}(n,i)}(e,this):(this.realloc(4),this.buf[this.pos++]=127&amp;e|(e&gt;127?128:0),e&lt;=127||(this.buf[this.pos++]=127&amp;(e&gt;&gt;&gt;=7)|(e&gt;127?128:0),e&lt;=127||(this.buf[this.pos++]=127&amp;(e&gt;&gt;&gt;=7)|(e&gt;127?128:0),e&lt;=127||(this.buf[this.pos++]=e&gt;&gt;&gt;7&amp;127))))},writeSVarint:function(e){this.writeVarint(e&lt;0?2*-e-1:2*e)},writeBoolean:function(e){this.writeVarint(!!e)},writeString:function(e){e=String(e),this.realloc(4*e.length),this.pos++;var t=this.pos;this.pos=function(r,n,s){for(var a,l,h=0;h&lt;n.length;h++){if((a=n.charCodeAt(h))&gt;55295&amp;&amp;a&lt;57344){if(!l){a&gt;56319||h+1===n.length?(r[s++]=239,r[s++]=191,r[s++]=189):l=a;continue}if(a&lt;56320){r[s++]=239,r[s++]=191,r[s++]=189,l=a;continue}a=l-55296&lt;&lt;10|a-56320|65536,l=null}else l&amp;&amp;(r[s++]=239,r[s++]=191,r[s++]=189,l=null);a&lt;128?r[s++]=a:(a&lt;2048?r[s++]=a&gt;&gt;6|192:(a&lt;65536?r[s++]=a&gt;&gt;12|224:(r[s++]=a&gt;&gt;18|240,r[s++]=a&gt;&gt;12&amp;63|128),r[s++]=a&gt;&gt;6&amp;63|128),r[s++]=63&amp;a|128)}return s}(this.buf,e,this.pos);var i=this.pos-t;i&gt;=128&amp;&amp;k1(t,i,this),this.pos=t-1,this.writeVarint(i),this.pos+=i},writeFloat:function(e){this.realloc(4),Uh.write(this.buf,e,this.pos,!0,23,4),this.pos+=4},writeDouble:function(e){this.realloc(8),Uh.write(this.buf,e,this.pos,!0,52,8),this.pos+=8},writeBytes:function(e){var t=e.length;this.writeVarint(t),this.realloc(t);for(var i=0;i&lt;t;i++)this.buf[this.pos++]=e[i]},writeRawMessage:function(e,t){this.pos++;var i=this.pos;e(t,this);var r=this.pos-i;r&gt;=128&amp;&amp;k1(i,r,this),this.pos=i-1,this.writeVarint(r),this.pos+=r},writeMessage:function(e,t,i){this.writeTag(e,wi.Bytes),this.writeRawMessage(t,i)},writePackedVarint:function(e,t){t.length&amp;&amp;this.writeMessage(e,VC,t)},writePackedSVarint:function(e,t){t.length&amp;&amp;this.writeMessage(e,jC,t)},writePackedBoolean:function(e,t){t.length&amp;&amp;this.writeMessage(e,WC,t)},writePackedFloat:function(e,t){t.length&amp;&amp;this.writeMessage(e,GC,t)},writePackedDouble:function(e,t){t.length&amp;&amp;this.writeMessage(e,HC,t)},writePackedFixed32:function(e,t){t.length&amp;&amp;this.writeMessage(e,qC,t)},writePackedSFixed32:function(e,t){t.length&amp;&amp;this.writeMessage(e,ZC,t)},writePackedFixed64:function(e,t){t.length&amp;&amp;this.writeMessage(e,$C,t)},writePackedSFixed64:function(e,t){t.length&amp;&amp;this.writeMessage(e,XC,t)},writeBytesField:function(e,t){this.writeTag(e,wi.Bytes),this.writeBytes(t)},writeFixed32Field:function(e,t){this.writeTag(e,wi.Fixed32),this.writeFixed32(t)},writeSFixed32Field:function(e,t){this.writeTag(e,wi.Fixed32),this.writeSFixed32(t)},writeFixed64Field:function(e,t){this.writeTag(e,wi.Fixed64),this.writeFixed64(t)},writeSFixed64Field:function(e,t){this.writeTag(e,wi.Fixed64),this.writeSFixed64(t)},writeVarintField:function(e,t){this.writeTag(e,wi.Varint),this.writeVarint(t)},writeSVarintField:function(e,t){this.writeTag(e,wi.Varint),this.writeSVarint(t)},writeStringField:function(e,t){this.writeTag(e,wi.Bytes),this.writeString(t)},writeFloatField:function(e,t){this.writeTag(e,wi.Fixed32),this.writeFloat(t)},writeDoubleField:function(e,t){this.writeTag(e,wi.Fixed64),this.writeDouble(t)},writeBooleanField:function(e,t){this.writeVarintField(e,!!t)}};var jh=Qt(R1);const YC=["tile","layer","source","sourceLayer","state"];class F1{constructor(t,i,r,n,s){this.type="Feature",this._vectorTileFeature=t,this._z=i,this._x=r,this._y=n,this.properties=t.properties,this.id=s}get geometry(){return this._geometry===void 0&amp;&amp;(this._geometry=this._vectorTileFeature.toGeoJSON(this._x,this._y,this._z).geometry),this._geometry}set geometry(t){this._geometry=t}toJSON(){const t={type:"Feature",state:void 0,geometry:this.geometry,properties:this.properties};this.id!==void 0&amp;&amp;(t.id=this.id);for(const i of YC)this[i]!==void 0&amp;&amp;(t[i]=this[i]);return t}}class KC{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(t,i,r){const n=String(i);if(this.stateChanges[t]=this.stateChanges[t]||{},this.stateChanges[t][n]=this.stateChanges[t][n]||{},Bt(this.stateChanges[t][n],r),this.deletedStates[t]===null){this.deletedStates[t]={};for(const s in this.state[t])s!==n&amp;&amp;(this.deletedStates[t][s]=null)}else if(this.deletedStates[t]&amp;&amp;this.deletedStates[t][n]===null){this.deletedStates[t][n]={};for(const s in this.state[t][n])r[s]||(this.deletedStates[t][n][s]=null)}else for(const s in r)this.deletedStates[t]&amp;&amp;this.deletedStates[t][n]&amp;&amp;this.deletedStates[t][n][s]===null&amp;&amp;delete this.deletedStates[t][n][s]}removeFeatureState(t,i,r){if(this.deletedStates[t]===null)return;const n=String(i);if(this.deletedStates[t]=this.deletedStates[t]||{},r&amp;&amp;i!==void 0)this.deletedStates[t][n]!==null&amp;&amp;(this.deletedStates[t][n]=this.deletedStates[t][n]||{},this.deletedStates[t][n][r]=null);else if(i!==void 0)if(this.stateChanges[t]&amp;&amp;this.stateChanges[t][n])for(r in this.deletedStates[t][n]={},this.stateChanges[t][n])this.deletedStates[t][n][r]=null;else this.deletedStates[t][n]=null;else this.deletedStates[t]=null}getState(t,i){const r=String(i),n=Bt({},(this.state[t]||{})[r],(this.stateChanges[t]||{})[r]);if(this.deletedStates[t]===null)return{};if(this.deletedStates[t]){const s=this.deletedStates[t][i];if(s===null)return{};for(const a in s)delete n[a]}return n}initializeTileState(t,i){t.setFeatureState(this.state,i)}coalesceChanges(t,i){const r={};for(const n in this.stateChanges){this.state[n]=this.state[n]||{};const s={};for(const a in this.stateChanges[n])this.state[n][a]||(this.state[n][a]={}),Bt(this.state[n][a],this.stateChanges[n][a]),s[a]=this.state[n][a];r[n]=s}for(const n in this.deletedStates){this.state[n]=this.state[n]||{};const s={};if(this.deletedStates[n]===null)for(const a in this.state[n])s[a]={},this.state[n][a]={};else for(const a in this.deletedStates[n]){if(this.deletedStates[n][a]===null)this.state[n][a]={};else if(this.state[n][a])for(const l of Object.keys(this.deletedStates[n][a]))delete this.state[n][a][l];s[a]=this.state[n][a]}r[n]=r[n]||{},Bt(r[n],s)}if(this.stateChanges={},this.deletedStates={},Object.keys(r).length!==0)for(const n in t)t[n].setFeatureState(r,i)}}class B1{constructor(t){this.size=t,this.minimums=[],this.maximums=[],this.leaves=[]}getElevation(t,i){const r=this.toIdx(t,i);return{min:this.minimums[r],max:this.maximums[r]}}isLeaf(t,i){return this.leaves[this.toIdx(t,i)]}toIdx(t,i){return i*this.size+t}}function N1(e,t,i,r){let n=0,s=Number.MAX_VALUE;for(let a=0;a&lt;3;a++)if(Math.abs(r[a])&lt;1e-15){if(i[a]&lt;e[a]||i[a]&gt;t[a])return null}else{const l=1/r[a];let h=(e[a]-i[a])*l,d=(t[a]-i[a])*l;if(h&gt;d){const f=h;h=d,d=f}if(h&gt;n&amp;&amp;(n=h),d&lt;s&amp;&amp;(s=d),n&gt;s)return null}return n}function U1(e,t,i,r,n,s,a,l,h,d,f){const m=r-e,_=n-t,y=s-i,x=a-e,b=l-t,w=h-i,T=f[1]*w-f[2]*b,S=f[2]*x-f[0]*w,I=f[0]*b-f[1]*x,P=m*T+_*S+y*I;if(Math.abs(P)&lt;1e-15)return null;const M=1/P,C=d[0]-e,D=d[1]-t,O=d[2]-i,k=(C*T+D*S+O*I)*M;if(k&lt;0||k&gt;1)return null;const z=D*y-O*_,B=O*m-C*y,U=C*_-D*m,Z=(f[0]*z+f[1]*B+f[2]*U)*M;return Z&lt;0||k+Z&gt;1?null:(x*z+b*B+w*U)*M}function V1(e,t,i){return(e-t)/(i-t)}function j1(e,t,i,r,n,s,a,l,h){const d=1&lt;&lt;i,f=s-r,m=a-n,_=(e+1)/d*f+r,y=(t+0)/d*m+n,x=(t+1)/d*m+n;l[0]=(e+0)/d*f+r,l[1]=y,h[0]=_,h[1]=x}class G1{constructor(t){if(this.maximums=[],this.minimums=[],this.leaves=[],this.childOffsets=[],this.nodeCount=0,this.dem=t,this._siblingOffset=[[0,0],[1,0],[0,1],[1,1]],!this.dem)return;const i=function(s){const a=Math.ceil(Math.log2(s.dim/8)),l=[];let h=Math.ceil(Math.pow(2,a));const d=1/h,f=(y,x,b,w,T)=&gt;{const S=w?1:0,I=(y+1)*b-S,P=x*b,M=(x+1)*b-S;T[0]=y*b,T[1]=P,T[2]=I,T[3]=M};let m=new B1(h);const _=[];for(let y=0;y&lt;h*h;y++){f(y%h,Math.floor(y/h),d,!1,_);const x=Po(_[0],_[1],s),b=Po(_[2],_[1],s),w=Po(_[2],_[3],s),T=Po(_[0],_[3],s);m.minimums.push(Math.min(x,b,w,T)),m.maximums.push(Math.max(x,b,w,T)),m.leaves.push(1)}for(l.push(m),h/=2;h&gt;=1;h/=2){const y=l[l.length-1];m=new B1(h);for(let x=0;x&lt;h*h;x++){f(x%h,Math.floor(x/h),2,!0,_);const b=y.getElevation(_[0],_[1]),w=y.getElevation(_[2],_[1]),T=y.getElevation(_[2],_[3]),S=y.getElevation(_[0],_[3]),I=y.isLeaf(_[0],_[1]),P=y.isLeaf(_[2],_[1]),M=y.isLeaf(_[2],_[3]),C=y.isLeaf(_[0],_[3]),D=Math.min(b.min,w.min,T.min,S.min),O=Math.max(b.max,w.max,T.max,S.max),k=I&amp;&amp;P&amp;&amp;M&amp;&amp;C;m.maximums.push(O),m.minimums.push(D),m.leaves.push(O-D&lt;=5&amp;&amp;k?1:0)}l.push(m)}return l}(this.dem),r=i.length-1,n=i[r];this._addNode(n.minimums[0],n.maximums[0],n.leaves[0]),this._construct(i,0,0,r,0)}raycastRoot(t,i,r,n,s,a,l=1){return N1([t,i,-100],[r,n,this.maximums[0]*l],s,a)}raycast(t,i,r,n,s,a,l=1){if(!this.nodeCount)return null;const h=this.raycastRoot(t,i,r,n,s,a,l);if(h==null)return null;const d=[],f=[],m=[],_=[],y=[{idx:0,t:h,nodex:0,nodey:0,depth:0}];for(;y.length&gt;0;){const{idx:x,t:b,nodex:w,nodey:T,depth:S}=y.pop();if(this.leaves[x]){j1(w,T,S,t,i,r,n,m,_);const P=1&lt;&lt;S,M=(w+0)/P,C=(w+1)/P,D=(T+0)/P,O=(T+1)/P,k=Po(M,D,this.dem)*l,z=Po(C,D,this.dem)*l,B=Po(C,O,this.dem)*l,U=Po(M,O,this.dem)*l,Z=U1(m[0],m[1],k,_[0],m[1],z,_[0],_[1],B,s,a),F=U1(_[0],_[1],B,m[0],_[1],U,m[0],m[1],k,s,a),Y=Math.min(Z!==null?Z:Number.MAX_VALUE,F!==null?F:Number.MAX_VALUE);if(Y!==Number.MAX_VALUE)return Y;{const J=W.scaleAndAdd([],s,a,b);if(H1(k,z,U,B,V1(J[0],m[0],_[0]),V1(J[1],m[1],_[1]))&gt;=J[2])return b}continue}let I=0;for(let P=0;P&lt;this._siblingOffset.length;P++){j1((w&lt;&lt;1)+this._siblingOffset[P][0],(T&lt;&lt;1)+this._siblingOffset[P][1],S+1,t,i,r,n,m,_),m[2]=-100,_[2]=this.maximums[this.childOffsets[x]+P]*l;const M=N1(m,_,s,a);if(M!=null){const C=M;d[P]=C;let D=!1;for(let O=0;O&lt;I&amp;&amp;!D;O++)C&gt;=d[f[O]]&amp;&amp;(f.splice(O,0,P),D=!0);D||(f[I]=P),I++}}for(let P=0;P&lt;I;P++){const M=f[P];y.push({idx:this.childOffsets[x]+M,t:d[M],nodex:(w&lt;&lt;1)+this._siblingOffset[M][0],nodey:(T&lt;&lt;1)+this._siblingOffset[M][1],depth:S+1})}}return null}_addNode(t,i,r){return this.minimums.push(t),this.maximums.push(i),this.leaves.push(r),this.childOffsets.push(0),this.nodeCount++}_construct(t,i,r,n,s){if(t[n].isLeaf(i,r)===1)return;this.childOffsets[s]||(this.childOffsets[s]=this.nodeCount);const a=n-1,l=t[a];let h=0,d=0;for(let f=0;f&lt;this._siblingOffset.length;f++){const m=2*i+this._siblingOffset[f][0],_=2*r+this._siblingOffset[f][1],y=l.getElevation(m,_),x=l.isLeaf(m,_),b=this._addNode(y.min,y.max,x);x&amp;&amp;(h|=1&lt;&lt;f),d||(d=b)}for(let f=0;f&lt;this._siblingOffset.length;f++)h&amp;1&lt;&lt;f||this._construct(t,2*i+this._siblingOffset[f][0],2*r+this._siblingOffset[f][1],a,d+f)}}function H1(e,t,i,r,n,s){return ge(ge(e,i,s),ge(t,r,s),n)}function Po(e,t,i){const r=i.dim,n=Xt(e*r-.5,0,r-1),s=Xt(t*r-.5,0,r-1),a=Math.floor(n),l=Math.floor(s),h=Math.min(a+1,r-1),d=Math.min(l+1,r-1);return H1(i.get(a,l),i.get(h,l),i.get(a,d),i.get(h,d),n-a,s-l)}const JC={mapbox:[6553.6,25.6,.1,1e4],terrarium:[256,1,1/256,32768]};function QC(e,t,i){return(256*e*256+256*t+i)/10-1e4}function t3(e,t,i){return 256*e+t+i/256-32768}class Gh{get tree(){return this._tree||this._buildQuadTree(),this._tree}constructor(t,i,r,n=!1){if(this.uid=t,i.height!==i.width)throw new RangeError("DEM tiles must be square");if(r&amp;&amp;r!=="mapbox"&amp;&amp;r!=="terrarium")return tt(`"${r}" is not a valid encoding type. Valid types include "mapbox" and "terrarium".`);this.stride=i.height;const s=this.dim=i.height-2,a=new Uint32Array(i.data.buffer);if(this.pixels=new Uint8Array(i.data.buffer),this.floatView=new Float32Array(i.data.buffer),this.borderReady=n,this._modifiedForSources={},!n){for(let h=0;h&lt;s;h++)a[this._idx(-1,h)]=a[this._idx(0,h)],a[this._idx(s,h)]=a[this._idx(s-1,h)],a[this._idx(h,-1)]=a[this._idx(h,0)],a[this._idx(h,s)]=a[this._idx(h,s-1)];a[this._idx(-1,-1)]=a[this._idx(0,0)],a[this._idx(s,-1)]=a[this._idx(s-1,0)],a[this._idx(-1,s)]=a[this._idx(0,s-1)],a[this._idx(s,s)]=a[this._idx(s-1,s-1)]}const l=r==="terrarium"?t3:QC;for(let h=0;h&lt;a.length;++h){const d=4*h;this.floatView[h]=l(this.pixels[d],this.pixels[d+1],this.pixels[d+2])}this._timestamp=_e.now()}_buildQuadTree(){this._tree=new G1(this)}get(t,i,r=!1){r&amp;&amp;(t=Xt(t,-1,this.dim),i=Xt(i,-1,this.dim));const n=this._idx(t,i);return this.floatView[n]}set(t,i,r){const n=this._idx(t,i),s=this.floatView[n];return this.floatView[n]=r,r-s}static getUnpackVector(t){return JC[t]}_idx(t,i){if(t&lt;-1||t&gt;=this.dim+1||i&lt;-1||i&gt;=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(i+1)*this.stride+(t+1)}static pack(t,i){const r=[0,0,0,0],n=Gh.getUnpackVector(i);let s=Math.floor((t+n[3])/n[2]);return r[2]=s%256,s=Math.floor(s/256),r[1]=s%256,s=Math.floor(s/256),r[0]=s,r}getPixels(){return new T1({width:this.stride,height:this.stride},this.pixels)}backfillBorder(t,i,r){if(this.dim!==t.dim)throw new Error("dem dimension mismatch");let n=i*this.dim,s=i*this.dim+this.dim,a=r*this.dim,l=r*this.dim+this.dim;switch(i){case-1:n=s-1;break;case 1:s=n+1}switch(r){case-1:a=l-1;break;case 1:l=a+1}const h=-i*this.dim,d=-r*this.dim;for(let f=a;f&lt;l;f++)for(let m=n;m&lt;s;m++){const _=4*this._idx(m,f),y=4*this._idx(m+h,f+d);this.pixels[_+0]=t.pixels[y+0],this.pixels[_+1]=t.pixels[y+1],this.pixels[_+2]=t.pixels[y+2],this.pixels[_+3]=t.pixels[y+3]}}onDeserialize(){this._tree&amp;&amp;(this._tree.dem=this)}}Jt(Gh,"DEMData"),Jt(G1,"DemMinMaxQuadTree",{omit:["dem"]});class e3{isDataAvailableAtPoint(t){const i=this._source();if(this.isUsingMockSource()||!i||t.y&lt;0||t.y&gt;1)return!1;const r=i.getSource().maxzoom,n=1&lt;&lt;r,s=Math.floor(t.x),a=Math.floor((t.x-s)*n),l=Math.floor(t.y*n),h=this.findDEMTileFor(new We(r,s,r,a,l));return!(!h||!h.dem)}getAtPointOrZero(t,i=0){return this.getAtPoint(t,i)||0}getAtPoint(t,i,r=!0){if(this.isUsingMockSource())return null;i==null&amp;&amp;(i=null);const n=this._source();if(!n||t.y&lt;0||t.y&gt;1)return i;const s=n.getSource().maxzoom,a=1&lt;&lt;s,l=Math.floor(t.x),h=t.x-l,d=new We(s,l,s,Math.floor(h*a),Math.floor(t.y*a)),f=this.findDEMTileFor(d);if(!f||!f.dem)return i;const m=f.dem,_=1&lt;&lt;f.tileID.canonical.z,y=(h*_-f.tileID.canonical.x)*m.dim,x=(t.y*_-f.tileID.canonical.y)*m.dim,b=Math.floor(y),w=Math.floor(x);return(r?this.exaggeration():1)*ge(ge(m.get(b,w),m.get(b,w+1),x-w),ge(m.get(b+1,w),m.get(b+1,w+1),x-w),y-b)}getAtTileOffset(t,i,r){const n=1&lt;&lt;t.canonical.z;return this.getAtPointOrZero(new Be(t.wrap+(t.canonical.x+i/ut)/n,(t.canonical.y+r/ut)/n))}getAtTileOffsetFunc(t,i,r,n){return s=&gt;{const a=this.getAtTileOffset(t,s.x,s.y),l=n.upVector(t.canonical,s.x,s.y),h=n.upVectorScale(t.canonical,i,r).metersToTile;return W.scale(l,l,a*h),l}}getForTilePoints(t,i,r,n){if(this.isUsingMockSource())return!1;const s=dl.create(this,t,n);return!!s&amp;&amp;(i.forEach(a=&gt;{a[2]=this.exaggeration()*s.getElevationAt(a[0],a[1],r)}),!0)}getMinMaxForTile(t){if(this.isUsingMockSource())return null;const i=this.findDEMTileFor(t);if(!i||!i.dem)return null;const r=i.dem.tree,n=i.tileID,s=1&lt;&lt;t.canonical.z-n.canonical.z;let a=t.canonical.x/s-n.canonical.x,l=t.canonical.y/s-n.canonical.y,h=0;for(let d=0;d&lt;t.canonical.z-n.canonical.z&amp;&amp;!r.leaves[h];d++){a*=2,l*=2;const f=2*Math.floor(l)+Math.floor(a);h=r.childOffsets[h]+f,a%=1,l%=1}return{min:this.exaggeration()*r.minimums[h],max:this.exaggeration()*r.maximums[h]}}getMinElevationBelowMSL(){throw new Error("Pure virtual method called.")}raycast(t,i,r){throw new Error("Pure virtual method called.")}pointCoordinate(t){throw new Error("Pure virtual method called.")}_source(){throw new Error("Pure virtual method called.")}isUsingMockSource(){throw new Error("Pure virtual method called.")}exaggeration(){throw new Error("Pure virtual method called.")}findDEMTileFor(t){throw new Error("Pure virtual method called.")}get visibleDemTiles(){throw new Error("Getter must be implemented in subclass.")}getMinMaxForVisibleTiles(){const t=this.visibleDemTiles;if(t.length===0)return null;let i=!1,r=Number.MAX_VALUE,n=Number.MIN_VALUE;for(const s of t){const a=this.getMinMaxForTile(s.tileID);a&amp;&amp;(r=Math.min(r,a.min),n=Math.max(n,a.max),i=!0)}return i?{min:r,max:n}:null}}class dl{constructor(t,i,r){this._demTile=t,this._dem=this._demTile.dem,this._scale=i,this._offset=r}static create(t,i,r){const n=r||t.findDEMTileFor(i);if(!n||!n.dem)return;const s=n.dem,a=n.tileID,l=1&lt;&lt;i.canonical.z-a.canonical.z;return new dl(n,s.dim/ut/l,[(i.canonical.x/l-a.canonical.x)*s.dim,(i.canonical.y/l-a.canonical.y)*s.dim])}tileCoordToPixel(t,i){const r=i*this._scale+this._offset[1],n=Math.floor(t*this._scale+this._offset[0]),s=Math.floor(r);return new Q(n,s)}getElevationAt(t,i,r,n){const s=t*this._scale+this._offset[0],a=i*this._scale+this._offset[1],l=Math.floor(s),h=Math.floor(a),d=this._dem;return n=!!n,r?ge(ge(d.get(l,h,n),d.get(l,h+1,n),a-h),ge(d.get(l+1,h,n),d.get(l+1,h+1,n),a-h),s-l):d.get(l,h,n)}getElevationAtPixel(t,i,r){return this._dem.get(t,i,!!r)}getMeterToDEM(t){return(1&lt;&lt;this._demTile.tileID.canonical.z)*ui(1,t)*this._dem.stride}}class Qm{constructor(t,i){this.tileID=t,this.x=t.canonical.x,this.y=t.canonical.y,this.z=t.canonical.z,this.grid=new Ya(ut,16,0),this.featureIndexArray=new vx,this.promoteId=i}insert(t,i,r,n,s,a=0){const l=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(r,n,s,a);const h=this.grid;for(let d=0;d&lt;i.length;d++){const f=i[d],m=[1/0,1/0,-1/0,-1/0];for(let _=0;_&lt;f.length;_++){const y=f[_];m[0]=Math.min(m[0],y.x),m[1]=Math.min(m[1],y.y),m[2]=Math.max(m[2],y.x),m[3]=Math.max(m[3],y.y)}m[0]&lt;ut&amp;&amp;m[1]&lt;ut&amp;&amp;m[2]&gt;=0&amp;&amp;m[3]&gt;=0&amp;&amp;h.insert(l,m[0],m[1],m[2],m[3])}}loadVTLayers(){if(!this.vtLayers){this.vtLayers=new Km(new jh(this.rawTileData)).layers,this.sourceLayerCoder=new L1(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"]),this.vtFeatures={};for(const t in this.vtLayers)this.vtFeatures[t]=[]}return this.vtLayers}query(t,i,r,n){this.loadVTLayers();const s=t.params||{},a=eh(s.filter),l=t.tileResult,h=t.transform,d=l.bufferedTilespaceBounds,f=this.grid.query(d.min.x,d.min.y,d.max.x,d.max.y,(x,b,w,T)=&gt;p1(l.bufferedTilespaceGeometry,x,b,w,T));f.sort(i3);let m=null;h.elevation&amp;&amp;f.length&gt;0&amp;&amp;(m=dl.create(h.elevation,this.tileID));const _={};let y;for(let x=0;x&lt;f.length;x++){const b=f[x];if(b===y)continue;y=b;const w=this.featureIndexArray.get(b);let T=null;this.loadMatchingFeature(_,w,a,s.layers,s.availableImages,i,r,n,(S,I,P,M=0)=&gt;(T||(T=fs(S,this.tileID.canonical,t.tileTransform)),I.queryIntersectsFeature(l,S,P,T,this.z,t.transform,t.pixelPosMatrix,m,M)))}return _}loadMatchingFeature(t,i,r,n,s,a,l,h,d){const{featureIndex:f,bucketIndex:m,sourceLayerIndex:_,layoutVertexArrayOffset:y}=i,x=this.bucketLayerIDs[m];if(n&amp;&amp;!function(S,I){for(let P=0;P&lt;S.length;P++)if(I.indexOf(S[P])&gt;=0)return!0;return!1}(n,x))return;const b=this.sourceLayerCoder.decode(_),w=this.vtLayers[b].feature(f);if(r.needGeometry){const S=Mo(w,!0);if(!r.filter(new Si(this.tileID.overscaledZ),S,this.tileID.canonical))return}else if(!r.filter(new Si(this.tileID.overscaledZ),w))return;const T=this.getId(w,b);for(let S=0;S&lt;x.length;S++){const I=x[S];if(n&amp;&amp;n.indexOf(I)&lt;0)continue;const P=a[I];if(!P)continue;let M={};T!==void 0&amp;&amp;h&amp;&amp;(M=h.getState(P.sourceLayer||"_geojsonTileLayer",T));const C=Bt({},l[I]);C.paint=W1(C.paint,P.paint,w,M,s),C.layout=W1(C.layout,P.layout,w,M,s);const D=!d||d(w,P,M,y);if(!D)continue;const O=new F1(w,this.z,this.x,this.y,T);O.layer=C;let k=t[I];k===void 0&amp;&amp;(k=t[I]=[]),k.push({featureIndex:f,feature:O,intersectionZ:D})}}lookupSymbolFeatures(t,i,r,n,s,a,l,h){const d={};this.loadVTLayers();const f=eh(s);for(const m of t)this.loadMatchingFeature(d,{bucketIndex:r,sourceLayerIndex:n,featureIndex:m,layoutVertexArrayOffset:0},f,a,l,h,i);return d}loadFeature(t){const{featureIndex:i,sourceLayerIndex:r}=t;this.loadVTLayers();const n=this.sourceLayerCoder.decode(r),s=this.vtFeatures[n];if(s[i])return s[i];const a=this.vtLayers[n].feature(i);return s[i]=a,a}hasLayer(t){for(const i of this.bucketLayerIDs)for(const r of i)if(t===r)return!0;return!1}getId(t,i){let r=t.id;if(this.promoteId){const n=typeof this.promoteId=="string"?this.promoteId:this.promoteId[i];n!=null&amp;&amp;(r=t.properties[n]),typeof r=="boolean"&amp;&amp;(r=Number(r))}return r}}function W1(e,t,i,r,n){return Er(e,(s,a)=&gt;{const l=t instanceof gc?t.get(a):null;return l&amp;&amp;l.evaluate?l.evaluate(i,r,n):l})}function i3(e,t){return t-e}Jt(Qm,"FeatureIndex",{omit:["rawTileData","sourceLayerCoder"]});const r3=ei([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_tex_size",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),n3=ei([{name:"a_globe_anchor",components:3,type:"Int16"},{name:"a_globe_normal",components:3,type:"Float32"}],4),s3=ei([{name:"a_projected_pos",components:4,type:"Float32"}],4);ei([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const o3=ei([{name:"a_z_offset",components:1,type:"Float32"}],4),a3=ei([{name:"a_texb",components:2,type:"Uint16"}]),l3=ei([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}]),c3=ei([{name:"a_size_scale",components:1,type:"Float32"},{name:"a_padding",components:2,type:"Float32"},{name:"a_z_offset",components:1,type:"Float32"}]);ei([{type:"Int16",name:"projectedAnchorX"},{type:"Int16",name:"projectedAnchorY"},{type:"Int16",name:"projectedAnchorZ"},{type:"Int16",name:"tileAnchorX"},{type:"Int16",name:"tileAnchorY"},{type:"Float32",name:"x1"},{type:"Float32",name:"y1"},{type:"Float32",name:"x2"},{type:"Float32",name:"y2"},{type:"Int16",name:"padding"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]);const q1=ei([{name:"a_pos",components:3,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),u3=ei([{name:"a_pos_2f",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);ei([{name:"triangle",components:3,type:"Uint16"}]),ei([{type:"Int16",name:"projectedAnchorX"},{type:"Int16",name:"projectedAnchorY"},{type:"Int16",name:"projectedAnchorZ"},{type:"Float32",name:"tileAnchorX"},{type:"Float32",name:"tileAnchorY"},{type:"Uint16",name:"glyphStartIndex"},{type:"Uint16",name:"numGlyphs"},{type:"Uint32",name:"vertexStartIndex"},{type:"Uint32",name:"lineStartIndex"},{type:"Uint32",name:"lineLength"},{type:"Uint16",name:"segment"},{type:"Uint16",name:"lowerSize"},{type:"Uint16",name:"upperSize"},{type:"Float32",name:"lineOffsetX"},{type:"Float32",name:"lineOffsetY"},{type:"Uint8",name:"writingMode"},{type:"Uint8",name:"placedOrientation"},{type:"Uint8",name:"hidden"},{type:"Uint32",name:"crossTileID"},{type:"Int16",name:"associatedIconIndex"},{type:"Uint8",name:"flipState"}]),ei([{type:"Float32",name:"tileAnchorX"},{type:"Float32",name:"tileAnchorY"},{type:"Int16",name:"projectedAnchorX"},{type:"Int16",name:"projectedAnchorY"},{type:"Int16",name:"projectedAnchorZ"},{type:"Int16",name:"rightJustifiedTextSymbolIndex"},{type:"Int16",name:"centerJustifiedTextSymbolIndex"},{type:"Int16",name:"leftJustifiedTextSymbolIndex"},{type:"Int16",name:"verticalPlacedTextSymbolIndex"},{type:"Int16",name:"placedIconSymbolIndex"},{type:"Int16",name:"verticalPlacedIconSymbolIndex"},{type:"Uint16",name:"key"},{type:"Uint16",name:"textBoxStartIndex"},{type:"Uint16",name:"textBoxEndIndex"},{type:"Uint16",name:"verticalTextBoxStartIndex"},{type:"Uint16",name:"verticalTextBoxEndIndex"},{type:"Uint16",name:"iconBoxStartIndex"},{type:"Uint16",name:"iconBoxEndIndex"},{type:"Uint16",name:"verticalIconBoxStartIndex"},{type:"Uint16",name:"verticalIconBoxEndIndex"},{type:"Uint16",name:"featureIndex"},{type:"Uint16",name:"numHorizontalGlyphVertices"},{type:"Uint16",name:"numVerticalGlyphVertices"},{type:"Uint16",name:"numIconVertices"},{type:"Uint16",name:"numVerticalIconVertices"},{type:"Uint16",name:"useRuntimeCollisionCircles"},{type:"Uint32",name:"crossTileID"},{type:"Float32",components:2,name:"textOffset"},{type:"Float32",name:"collisionCircleDiameter"},{type:"Float32",name:"zOffset"},{type:"Uint8",name:"hasIconTextFit"}]),ei([{type:"Float32",name:"offsetX"}]),ei([{type:"Int16",name:"x"},{type:"Int16",name:"y"}]);var dr=24;const qn=128;function t_(e,t){const{expression:i}=t;if(i.kind==="constant")return{kind:"constant",layoutSize:i.evaluate(new Si(e+1))};if(i.kind==="source")return{kind:"source"};{const{zoomStops:r,interpolationType:n}=i;let s=0;for(;s&lt;r.length&amp;&amp;r[s]&lt;=e;)s++;s=Math.max(0,s-1);let a=s;for(;a&lt;r.length&amp;&amp;r[a]&lt;e+1;)a++;a=Math.min(r.length-1,a);const l=r[s],h=r[a];return i.kind==="composite"?{kind:"composite",minZoom:l,maxZoom:h,interpolationType:n}:{kind:"camera",minZoom:l,maxZoom:h,minSize:i.evaluate(new Si(l)),maxSize:i.evaluate(new Si(h)),interpolationType:n}}}function Rc(e,{uSize:t,uSizeT:i},{lowerSize:r,upperSize:n}){return e.kind==="source"?r/qn:e.kind==="composite"?ge(r/qn,n/qn,i):t}function ps(e,t){let i=0,r=0;if(e.kind==="constant")r=e.layoutSize;else if(e.kind!=="source"){const{interpolationType:n,minZoom:s,maxZoom:a}=e,l=n?Xt(cs.interpolationFactor(n,t,s,a),0,1):0;e.kind==="camera"?r=ge(e.minSize,e.maxSize,l):i=l}return{uSizeT:i,uSize:r}}var h3=Object.freeze({__proto__:null,SIZE_PACK_FACTOR:qn,evaluateSizeForFeature:Rc,evaluateSizeForZoom:ps,getSizeData:t_});function d3(e,t,i){return e.sections.forEach(r=&gt;{r.text=function(n,s,a){const l=s.layout.get("text-transform").evaluate(a,{});return l==="uppercase"?n=n.toLocaleUpperCase():l==="lowercase"&amp;&amp;(n=n.toLocaleLowerCase()),An.applyArabicShaping&amp;&amp;(n=An.applyArabicShaping(n)),n}(r.text,t,i)}),e}const Dc={"!":"︕","#":"＃",$:"＄","%":"％","&amp;":"＆","(":"︵",")":"︶","*":"＊","+":"＋",",":"︐","-":"︲",".":"・","/":"／",":":"︓",";":"︔","&lt;":"︿","=":"＝","&gt;":"﹀","?":"︖","@":"＠","[":"﹇","\\":"＼","]":"﹈","^":"＾",_:"︳","`":"｀","{":"︷","|":"―","}":"︸","~":"～","¢":"￠","£":"￡","¥":"￥","¦":"￤","¬":"￢","¯":"￣","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"￦","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","！":"︕","（":"︵","）":"︶","，":"︐","－":"︲","．":"・","：":"︓","；":"︔","＜":"︿","＞":"﹀","？":"︖","［":"﹇","］":"﹈","＿":"︳","｛":"︷","｜":"―","｝":"︸","｟":"︵","｠":"︶","｡":"︒","｢":"﹁","｣":"﹂","←":"↑","→":"↓"};function f3(e){return e==="︶"||e==="﹈"||e==="︸"||e==="﹄"||e==="﹂"||e==="︾"||e==="︼"||e==="︺"||e==="︘"||e==="﹀"||e==="︐"||e==="︓"||e==="︔"||e==="｀"||e==="￣"||e==="︑"||e==="︒"}function p3(e){return e==="︵"||e==="﹇"||e==="︷"||e==="﹃"||e==="﹁"||e==="︽"||e==="︻"||e==="︹"||e==="︗"||e==="︿"}const e_=3;function m3(e,t,i){t.glyphs=[],e===1&amp;&amp;i.readMessage(_3,t)}function _3(e,t,i){if(e===3){const{id:r,bitmap:n,width:s,height:a,left:l,top:h,advance:d}=i.readMessage(g3,{});t.glyphs.push({id:r,bitmap:new Ys({width:s+2*e_,height:a+2*e_},n),metrics:{width:s,height:a,left:l,top:h,advance:d}})}else e===4?t.ascender=i.readSVarint():e===5&amp;&amp;(t.descender=i.readSVarint())}function g3(e,t,i){e===1?t.id=i.readVarint():e===2?t.bitmap=i.readBytes():e===3?t.width=i.readVarint():e===4?t.height=i.readVarint():e===5?t.left=i.readSVarint():e===6?t.top=i.readSVarint():e===7&amp;&amp;(t.advance=i.readVarint())}const Z1=e_,Ti={horizontal:1,vertical:2,horizontalOnly:3},$1=-17;class Oc{constructor(){this.scale=1,this.fontStack="",this.imageName=null}static forText(t,i){const r=new Oc;return r.scale=t||1,r.fontStack=i,r}static forImage(t){const i=new Oc;return i.imageName=t,i}}class fl{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(t,i){const r=new fl;for(let n=0;n&lt;t.sections.length;n++){const s=t.sections[n];s.image?r.addImageSection(s):r.addTextSection(s,i)}return r}length(){return this.text.length}getSection(t){return this.sections[this.sectionIndex[t]]}getSections(){return this.sections}getSectionIndex(t){return this.sectionIndex[t]}getCodePoint(t){return this.text.codePointAt(t)}verticalizePunctuation(t){this.text=function(i,r){let n="";for(let s=0;s&lt;i.length;s++){const a=i.charCodeAt(s+1)||null,l=i.charCodeAt(s-1)||null;n+=!r&amp;&amp;(a&amp;&amp;rx(a)&amp;&amp;!Dc[i[s+1]]||l&amp;&amp;rx(l)&amp;&amp;!Dc[i[s-1]])||!Dc[i[s]]?i[s]:Dc[i[s]]}return n}(this.text,t)}trim(){let t=0;for(let r=0;r&lt;this.text.length&amp;&amp;Hh[this.text.charCodeAt(r)];r++)t++;let i=this.text.length;for(let r=this.text.length-1;r&gt;=0&amp;&amp;r&gt;=t&amp;&amp;Hh[this.text.charCodeAt(r)];r--)i--;this.text=this.text.substring(t,i),this.sectionIndex=this.sectionIndex.slice(t,i)}substring(t,i){const r=new fl;return r.text=this.text.substring(t,i),r.sectionIndex=this.sectionIndex.slice(t,i),r.sections=this.sections,r}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((t,i)=&gt;Math.max(t,this.sections[i].scale),0)}addTextSection(t,i){this.text+=t.text,this.sections.push(Oc.forText(t.scale,t.fontStack||i));const r=this.sections.length-1;for(let n=0;n&lt;t.text.length;++n)this.sectionIndex.push(r)}addImageSection(t){const i=t.image?t.image.namePrimary:"";if(i.length===0)return void tt("Can't add FormattedSection with an empty image.");const r=this.getNextImageSectionCharCode();r?(this.text+=String.fromCodePoint(r),this.sections.push(Oc.forImage(i)),this.sectionIndex.push(this.sections.length-1)):tt("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID&gt;=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function i_(e,t,i,r,n,s,a,l,h,d,f,m,_,y,x){const b=fl.fromFeature(e,n);m===Ti.vertical&amp;&amp;b.verticalizePunctuation(_);let w=[];const T=function(C,D,O,k,z,B){if(!C)return[];const U=[],Z=function(it,X,K,ot,lt,at){let dt=0;for(let ft=0;ft&lt;it.length();ft++){const _t=it.getSection(ft);dt+=X1(it.getCodePoint(ft),_t,ot,lt,X,at)}return dt/Math.max(1,Math.ceil(dt/K))}(C,D,O,k,z,B),F=C.text.indexOf("​")&gt;=0;let Y=0;for(let it=0;it&lt;C.length();it++){const X=C.getSection(it),K=C.getCodePoint(it);if(Hh[K]||(Y+=X1(K,X,k,z,D,B)),it&lt;C.length()-1){const ot=!((J=K)&lt;11904||!(ee["Bopomofo Extended"](J)||ee.Bopomofo(J)||ee["CJK Compatibility Forms"](J)||ee["CJK Compatibility Ideographs"](J)||ee["CJK Compatibility"](J)||ee["CJK Radicals Supplement"](J)||ee["CJK Strokes"](J)||ee["CJK Symbols and Punctuation"](J)||ee["CJK Unified Ideographs Extension A"](J)||ee["CJK Unified Ideographs"](J)||ee["Enclosed CJK Letters and Months"](J)||ee["Halfwidth and Fullwidth Forms"](J)||ee.Hiragana(J)||ee["Ideographic Description Characters"](J)||ee["Kangxi Radicals"](J)||ee["Katakana Phonetic Extensions"](J)||ee.Katakana(J)||ee["Vertical Forms"](J)||ee["Yi Radicals"](J)||ee["Yi Syllables"](J)));(y3[K]||ot||X.imageName)&amp;&amp;U.push(K1(it+1,Y,Z,U,x3(K,C.getCodePoint(it+1),ot&amp;&amp;F),!1))}}var J;return J1(K1(C.length(),Y,Z,U,0,!0))}(b,d,s,t,r,y),{processBidirectionalText:S,processStyledBidirectionalText:I}=An;if(S&amp;&amp;b.sections.length===1){const C=S(b.toString(),T);for(const D of C){const O=new fl;O.text=D,O.sections=b.sections;for(let k=0;k&lt;D.length;k++)O.sectionIndex.push(0);w.push(O)}}else if(I){const C=I(b.text,b.sectionIndex,T);for(const D of C){const O=new fl;O.text=D[0],O.sectionIndex=D[1],O.sections=b.sections,w.push(O)}}else w=function(C,D){const O=[],k=C.text;let z=0;for(const B of D)O.push(C.substring(z,B)),z=B;return z&lt;k.length&amp;&amp;O.push(C.substring(z,k.length)),O}(b,T);const P=[],M={positionedLines:P,text:b.toString(),top:f[1],bottom:f[1],left:f[0],right:f[0],writingMode:m,iconsInText:!1,verticalizable:!1,hasBaseline:!1};return function(C,D,O,k,z,B,U,Z,F,Y,J,it){let X=0,K=0,ot=0;const lt=Z==="right"?1:Z==="left"?0:.5;let at=!1;for(const Ot of z){const kt=Ot.getSections();for(const Ht of kt){if(Ht.imageName)continue;const Zt=D[Ht.fontStack];if(Zt&amp;&amp;(at=Zt.ascender!==void 0&amp;&amp;Zt.descender!==void 0,!at))break}if(!at)break}let dt=0;for(const Ot of z){Ot.trim();const kt=Ot.getMaxScale(),Ht=(kt-1)*dr,Zt={positionedGlyphs:[],lineOffset:0};C.positionedLines[dt]=Zt;const fe=Zt.positionedGlyphs;let ie=0;if(!Ot.length()){K+=B,++dt;continue}let Ve=0,ke=0;for(let ue=0;ue&lt;Ot.length();ue++){const re=Ot.getSection(ue),Fe=Ot.getSectionIndex(ue),Ue=Ot.getCodePoint(ue);let Me=re.scale,hi=null,Fi=null,ai=null,_i=dr,Ui=0;const Bi=!(F===Ti.horizontal||!J&amp;&amp;!zp(Ue)||J&amp;&amp;(Hh[Ue]||(ft=Ue,ee.Arabic(ft)||ee["Arabic Supplement"](ft)||ee["Arabic Extended-A"](ft)||ee["Arabic Presentation Forms-A"](ft)||ee["Arabic Presentation Forms-B"](ft))));if(re.imageName){const xi=k[re.imageName];if(!xi)continue;ai=re.imageName,C.iconsInText=C.iconsInText||!0,Fi=xi.paddedRect;const ri=xi.displaySize;Me=Me*dr/it,hi={width:ri[0],height:ri[1],left:0,top:-Z1,advance:Bi?ri[1]:ri[0],localGlyph:!1},Ui=at?-hi.height*Me:$1+kt*dr-ri[1]*Me,_i=hi.advance;const gr=(Bi?ri[0]:ri[1])*Me-dr*kt;gr&gt;0&amp;&amp;gr&gt;ie&amp;&amp;(ie=gr)}else{const xi=O[re.fontStack];if(!xi)continue;xi[Ue]&amp;&amp;(Fi=xi[Ue]);const ri=D[re.fontStack];if(!ri)continue;const gr=ri.glyphs[Ue];if(!gr)continue;if(hi=gr.metrics,_i=Ue!==8203?dr:0,at){const vs=ri.ascender!==void 0?Math.abs(ri.ascender):0,Qs=ri.descender!==void 0?Math.abs(ri.descender):0,to=(vs+Qs)*Me;Ve&lt;to&amp;&amp;(Ve=to,ke=(vs-Qs)/2*Me),Ui=-vs*Me}else Ui=$1+(kt-Me)*dr}Bi?(C.verticalizable=!0,fe.push({glyph:Ue,imageName:ai,x:X,y:K+Ui,vertical:Bi,scale:Me,localGlyph:hi.localGlyph,fontStack:re.fontStack,sectionIndex:Fe,metrics:hi,rect:Fi}),X+=_i*Me+Y):(fe.push({glyph:Ue,imageName:ai,x:X,y:K+Ui,vertical:Bi,scale:Me,localGlyph:hi.localGlyph,fontStack:re.fontStack,sectionIndex:Fe,metrics:hi,rect:Fi}),X+=hi.advance*Me+Y)}fe.length!==0&amp;&amp;(ot=Math.max(X-Y,ot),at?Q1(fe,lt,ie,ke,B*kt/2):Q1(fe,lt,ie,0,B/2)),X=0;const pe=B*kt+ie;Zt.lineOffset=Math.max(ie,Ht),K+=pe,++dt}var ft;const _t=K,{horizontalAlign:ct,verticalAlign:bt}=Wh(U);(function(Ot,kt,Ht,Zt,fe,ie){const Ve=(kt-Ht)*fe,ke=-ie*Zt;for(const pe of Ot)for(const ue of pe.positionedGlyphs)ue.x+=Ve,ue.y+=ke})(C.positionedLines,lt,ct,bt,ot,_t),C.top+=-bt*_t,C.bottom=C.top+_t,C.left+=-ct*ot,C.right=C.left+ot,C.hasBaseline=at}(M,t,i,r,w,a,l,h,m,d,_,x),!function(C){for(const D of C)if(D.positionedGlyphs.length!==0)return!1;return!0}(P)&amp;&amp;M}const Hh={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},y3={10:!0,32:!0,38:!0,40:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0};function X1(e,t,i,r,n,s){if(t.imageName){const a=r[t.imageName];return a?a.displaySize[0]*t.scale*dr/s+n:0}{const a=i[t.fontStack],l=a&amp;&amp;a.glyphs[e];return l?l.metrics.advance*t.scale+n:0}}function Y1(e,t,i,r){const n=Math.pow(e-t,2);return r?e&lt;t?n/2:2*n:n+Math.abs(i)*i}function x3(e,t,i){let r=0;return e===10&amp;&amp;(r-=1e4),i&amp;&amp;(r+=150),e!==40&amp;&amp;e!==65288||(r+=50),t!==41&amp;&amp;t!==65289||(r+=50),r}function K1(e,t,i,r,n,s){let a=null,l=Y1(t,i,n,s);for(const h of r){const d=Y1(t-h.x,i,n,s)+h.badness;d&lt;=l&amp;&amp;(a=h,l=d)}return{index:e,x:t,priorBreak:a,badness:l}}function J1(e){return e?J1(e.priorBreak).concat(e.index):[]}function Wh(e){let t=.5,i=.5;switch(e){case"right":case"top-right":case"bottom-right":t=1;break;case"left":case"top-left":case"bottom-left":t=0}switch(e){case"bottom":case"bottom-right":case"bottom-left":i=1;break;case"top":case"top-right":case"top-left":i=0}return{horizontalAlign:t,verticalAlign:i}}function Q1(e,t,i,r,n){if(!(t||i||r||n))return;const s=e.length-1,a=e[s],l=(a.x+a.metrics.advance*a.scale)*t;for(let h=0;h&lt;=s;h++)e[h].x-=l,e[h].y+=i+r+n}function v3(e,t,i,r){const{horizontalAlign:n,verticalAlign:s}=Wh(r),a=i[0]-e.displaySize[0]*n,l=i[1]-e.displaySize[1]*s;return{imagePrimary:e,imageSecondary:t,top:l,bottom:l+e.displaySize[1],left:a,right:a+e.displaySize[0]}}function tb(e,t,i,r,n,s){const a=e.imagePrimary;let l;if(a.content){const w=a.content,T=a.pixelRatio||1;l=[w[0]/T,w[1]/T,a.displaySize[0]-w[2]/T,a.displaySize[1]-w[3]/T]}const h=t.left*s,d=t.right*s;let f,m,_,y;i==="width"||i==="both"?(y=n[0]+h-r[3],m=n[0]+d+r[1]):(y=n[0]+(h+d-a.displaySize[0])/2,m=y+a.displaySize[0]);const x=t.top*s,b=t.bottom*s;return i==="height"||i==="both"?(f=n[1]+x-r[0],_=n[1]+b+r[2]):(f=n[1]+(x+b-a.displaySize[1])/2,_=f+a.displaySize[1]),{imagePrimary:a,imageSecondary:void 0,top:f,right:m,bottom:_,left:y,collisionPadding:l}}class Js extends Q{constructor(t,i,r,n,s){super(t,i),this.angle=n,this.z=r,s!==void 0&amp;&amp;(this.segment=s)}clone(){return new Js(this.x,this.y,this.z,this.angle,this.segment)}}function eb(e,t,i,r,n){if(t.segment===void 0)return!0;let s=t,a=t.segment+1,l=0;for(;l&gt;-i/2;){if(a--,a&lt;0)return!1;l-=e[a].dist(s),s=e[a]}l+=e[a].dist(e[a+1]),a++;const h=[];let d=0;for(;l&lt;i/2;){const f=e[a],m=e[a+1];if(!m)return!1;let _=e[a-1].angleTo(f)-f.angleTo(m);for(_=Math.abs((_+3*Math.PI)%(2*Math.PI)-Math.PI),h.push({distance:l,angleDelta:_}),d+=_;l-h[0].distance&gt;r;)d-=h.shift().angleDelta;if(d&gt;n)return!1;a++,l+=f.dist(m)}return!0}function ib(e){let t=0;for(let i=0;i&lt;e.length-1;i++)t+=e[i].dist(e[i+1]);return t}function rb(e,t,i){return e?.6*t*i:0}function nb(e,t){return Math.max(e?e.right-e.left:0,t?t.right-t.left:0)}function b3(e,t,i,r,n,s){const a=rb(i,n,s),l=nb(i,r)*s;let h=0;const d=ib(e)/2;for(let f=0;f&lt;e.length-1;f++){const m=e[f],_=e[f+1],y=m.dist(_);if(h+y&gt;d){const x=(d-h)/y,b=ge(m.x,_.x,x),w=ge(m.y,_.y,x),T=new Js(b,w,0,_.angleTo(m),f);return!a||eb(e,T,l,a,t)?T:void 0}h+=y}}function w3(e,t,i,r,n,s,a,l,h){const d=rb(r,s,a),f=nb(r,n),m=f*a,_=e[0].x===0||e[0].x===h||e[0].y===0||e[0].y===h;return t-m&lt;t/4&amp;&amp;(t=m+t/4),sb(e,_?t/2*l%t:(f/2+2*s)*a*l%t,t,d,i,m,_,!1,h)}function sb(e,t,i,r,n,s,a,l,h){const d=s/2,f=ib(e);let m=0,_=t-i,y=[];for(let x=0;x&lt;e.length-1;x++){const b=e[x],w=e[x+1],T=b.dist(w),S=w.angleTo(b);for(;_+i&lt;m+T;){_+=i;const I=(_-m)/T,P=ge(b.x,w.x,I),M=ge(b.y,w.y,I);if(P&gt;=0&amp;&amp;P&lt;h&amp;&amp;M&gt;=0&amp;&amp;M&lt;h&amp;&amp;_-d&gt;=0&amp;&amp;_+d&lt;=f){const C=new Js(P,M,0,S,x);r&amp;&amp;!eb(e,C,s,r,n)||y.push(C)}}m+=T}return l||y.length||a||(y=sb(e,m/2,i,r,n,s,a,!0,h)),y}function ob(e,t,i,r,n){const s=[];for(let a=0;a&lt;e.length;a++){const l=e[a];let h;for(let d=0;d&lt;l.length-1;d++){let f=l[d],m=l[d+1];f.x&lt;t&amp;&amp;m.x&lt;t||(f.x&lt;t?f=new Q(t,f.y+(t-f.x)/(m.x-f.x)*(m.y-f.y))._round():m.x&lt;t&amp;&amp;(m=new Q(t,f.y+(t-f.x)/(m.x-f.x)*(m.y-f.y))._round()),f.y&lt;i&amp;&amp;m.y&lt;i||(f.y&lt;i?f=new Q(f.x+(i-f.y)/(m.y-f.y)*(m.x-f.x),i)._round():m.y&lt;i&amp;&amp;(m=new Q(f.x+(i-f.y)/(m.y-f.y)*(m.x-f.x),i)._round()),f.x&gt;=r&amp;&amp;m.x&gt;=r||(f.x&gt;=r?f=new Q(r,f.y+(r-f.x)/(m.x-f.x)*(m.y-f.y))._round():m.x&gt;=r&amp;&amp;(m=new Q(r,f.y+(r-f.x)/(m.x-f.x)*(m.y-f.y))._round()),f.y&gt;=n&amp;&amp;m.y&gt;=n||(f.y&gt;=n?f=new Q(f.x+(n-f.y)/(m.y-f.y)*(m.x-f.x),n)._round():m.y&gt;=n&amp;&amp;(m=new Q(f.x+(n-f.y)/(m.y-f.y)*(m.x-f.x),n)._round()),h&amp;&amp;f.equals(h[h.length-1])||(h=[f],s.push(h)),h.push(m)))))}}return s}function r_(e){let t=0,i=0;for(const a of e)t+=a.w*a.h,i=Math.max(i,a.w);e.sort((a,l)=&gt;l.h-a.h);const r=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(t/.95)),i),h:1/0}];let n=0,s=0;for(const a of e)for(let l=r.length-1;l&gt;=0;l--){const h=r[l];if(!(a.w&gt;h.w||a.h&gt;h.h)){if(a.x=h.x,a.y=h.y,s=Math.max(s,a.y+a.h),n=Math.max(n,a.x+a.w),a.w===h.w&amp;&amp;a.h===h.h){const d=r.pop();l&lt;r.length&amp;&amp;(r[l]=d)}else a.h===h.h?(h.x+=a.w,h.w-=a.w):a.w===h.w?(h.y+=a.h,h.h-=a.h):(r.push({x:h.x+a.w,y:h.y,w:h.w-a.w,h:a.h}),h.y+=a.h,h.h-=a.h);break}}return{w:n,h:s,fill:t/(n*s)||0}}Jt(Js,"Anchor");const en=1;class n_{constructor(t,{pixelRatio:i,version:r,stretchX:n,stretchY:s,content:a}){this.paddedRect=t,this.pixelRatio=i,this.stretchX=n,this.stretchY=s,this.content=a,this.version=r}get tl(){return[this.paddedRect.x+en,this.paddedRect.y+en]}get br(){return[this.paddedRect.x+this.paddedRect.w-en,this.paddedRect.y+this.paddedRect.h-en]}get displaySize(){return[(this.paddedRect.w-2*en)/this.pixelRatio,(this.paddedRect.h-2*en)/this.pixelRatio]}}class ab{constructor(t,i){const r={},n={};this.haveRenderCallbacks=[];const s=[];this.addImages(t,r,s),this.addImages(i,n,s);const{w:a,h:l}=r_(s),h=new Hi({width:a||1,height:l||1});for(const d in t){const f=t[d],m=r[d].paddedRect;Hi.copy(f.data,h,{x:0,y:0},{x:m.x+en,y:m.y+en},f.data)}for(const d in i){const f=i[d],m=n[d].paddedRect,_=m.x+en,y=m.y+en,x=f.data.width,b=f.data.height;Hi.copy(f.data,h,{x:0,y:0},{x:_,y},f.data),Hi.copy(f.data,h,{x:0,y:b-1},{x:_,y:y-1},{width:x,height:1}),Hi.copy(f.data,h,{x:0,y:0},{x:_,y:y+b},{width:x,height:1}),Hi.copy(f.data,h,{x:x-1,y:0},{x:_-1,y},{width:1,height:b}),Hi.copy(f.data,h,{x:0,y:0},{x:_+x,y},{width:1,height:b})}this.image=h,this.iconPositions=r,this.patternPositions=n}addImages(t,i,r){for(const n in t){const s=t[n],a={x:0,y:0,w:s.data.width+2*en,h:s.data.height+2*en};r.push(a),i[n]=new n_(a,s),s.hasRenderCallback&amp;&amp;this.haveRenderCallbacks.push(n)}}patchUpdatedImages(t,i,r){this.haveRenderCallbacks=this.haveRenderCallbacks.filter(n=&gt;t.hasImage(n,r)),t.dispatchRenderCallbacks(this.haveRenderCallbacks,r);for(const n in t.getUpdatedImages(r))this.patchUpdatedImage(this.iconPositions[n],t.getImage(n,r),i),this.patchUpdatedImage(this.patternPositions[n],t.getImage(n,r),i)}patchUpdatedImage(t,i,r){if(!t||!i||t.version===i.version)return;t.version=i.version;const[n,s]=t.tl;r.update(i.data,void 0,{x:n,y:s})}}Jt(n_,"ImagePosition"),Jt(ab,"ImageAtlas");const kc=1e20;function lb(e,t,i,r,n,s,a,l,h){for(let d=t;d&lt;t+r;d++)cb(e,i*s+d,s,n,a,l,h);for(let d=i;d&lt;i+n;d++)cb(e,d*s+t,1,r,a,l,h)}function cb(e,t,i,r,n,s,a){s[0]=0,a[0]=-kc,a[1]=kc,n[0]=e[t];for(let l=1,h=0,d=0;l&lt;r;l++){n[l]=e[t+l*i];const f=l*l;do{const m=s[h];d=(n[l]-n[m]+f-m*m)/(l-m)/2}while(d&lt;=a[h]&amp;&amp;--h&gt;-1);h++,s[h]=l,a[h]=d,a[h+1]=kc}for(let l=0,h=0;l&lt;r;l++){for(;a[h+1]&lt;l;)h++;const d=s[h],f=l-d;e[t+l*i]=n[d]+f*f}}const Zn=2;class pl{constructor(t,i,r){this.requestManager=t,this.localGlyphMode=i,this.localFontFamily=r,this.urls={},this.entries={},this.localGlyphs={200:{},400:{},500:{},900:{}}}setURL(t,i){this.urls[i]=t}getGlyphs(t,i,r){const n=[],s=this.urls[i]||H.GLYPHS_URL;for(const a in t)for(const l of t[a])n.push({stack:a,id:l});Rs(n,({stack:a,id:l},h)=&gt;{let d=this.entries[a];d||(d=this.entries[a]={glyphs:{},requests:{},ranges:{},ascender:void 0,descender:void 0});let f=d.glyphs[l];if(f!==void 0)return void h(null,{stack:a,id:l,glyph:f});if(f=this._tinySDF(d,a,l),f)return d.glyphs[l]=f,void h(null,{stack:a,id:l,glyph:f});const m=Math.floor(l/256);if(256*m&gt;65535)return void h(new Error("glyphs &gt; 65535 not supported"));if(d.ranges[m])return void h(null,{stack:a,id:l,glyph:f});let _=d.requests[m];_||(_=d.requests[m]=[],pl.loadGlyphRange(a,m,s,this.requestManager,(y,x)=&gt;{if(x){d.ascender=x.ascender,d.descender=x.descender;for(const b in x.glyphs)this._doesCharSupportLocalGlyph(+b)||(d.glyphs[+b]=x.glyphs[+b]);d.ranges[m]=!0}for(const b of _)b(y,x);delete d.requests[m]})),_.push((y,x)=&gt;{y?h(y):x&amp;&amp;h(null,{stack:a,id:l,glyph:x.glyphs[l]||null})})},(a,l)=&gt;{if(a)r(a);else if(l){const h={};for(const{stack:d,id:f,glyph:m}of l)h[d]===void 0&amp;&amp;(h[d]={}),h[d].glyphs===void 0&amp;&amp;(h[d].glyphs={}),h[d].glyphs[f]=m&amp;&amp;{id:m.id,bitmap:m.bitmap.clone(),metrics:m.metrics},h[d].ascender=this.entries[d].ascender,h[d].descender=this.entries[d].descender;r(null,h)}})}_doesCharSupportLocalGlyph(t){return this.localGlyphMode!==0&amp;&amp;(this.localGlyphMode===2?!!this.localFontFamily:!!this.localFontFamily&amp;&amp;(ee["CJK Unified Ideographs"](t)||ee["Hangul Syllables"](t)||ee.Hiragana(t)||ee.Katakana(t)||ee["CJK Symbols and Punctuation"](t)||ee["CJK Unified Ideographs Extension A"](t)||ee["CJK Unified Ideographs Extension B"](t)))}_tinySDF(t,i,r){const n=this.localFontFamily;if(!n||!this._doesCharSupportLocalGlyph(r))return;let s=t.tinySDF;if(!s){let b="400";/bold/i.test(i)?b="900":/medium/i.test(i)?b="500":/light/i.test(i)&amp;&amp;(b="200"),s=t.tinySDF=new pl.TinySDF({fontFamily:n,fontWeight:b,fontSize:24*Zn,buffer:3*Zn,radius:8*Zn}),s.fontWeight=b}if(this.localGlyphs[s.fontWeight][r])return this.localGlyphs[s.fontWeight][r];const a=String.fromCodePoint(r),{data:l,width:h,height:d,glyphWidth:f,glyphHeight:m,glyphLeft:_,glyphTop:y,glyphAdvance:x}=s.draw(a);return this.localGlyphs[s.fontWeight][r]={id:r,bitmap:new Ys({width:h,height:d},l),metrics:{width:f/Zn,height:m/Zn,left:_/Zn,top:y/Zn-27,advance:x/Zn,localGlyph:!0}}}}pl.loadGlyphRange=function(e,t,i,r,n){const s=256*t,a=s+255,l=r.transformRequest(r.normalizeGlyphsURL(i).replace("{fontstack}",e).replace("{range}",`${s}-${a}`),pt.Glyphs);zt(l,(h,d)=&gt;{if(h)n(h);else if(d){const f={},m=function(_){return new jh(_).readFields(m3,{})}(d);for(const _ of m.glyphs)f[_.id]=_;n(null,{glyphs:f,ascender:m.ascender,descender:m.descender})}})},pl.TinySDF=class{constructor({fontSize:e=24,buffer:t=3,radius:i=8,cutoff:r=.25,fontFamily:n="sans-serif",fontWeight:s="normal",fontStyle:a="normal"}={}){this.buffer=t,this.cutoff=r,this.radius=i;const l=this.size=e+4*t,h=this._createCanvas(l),d=this.ctx=h.getContext("2d",{willReadFrequently:!0});d.font=`${a} ${s} ${e}px ${n}`,d.textBaseline="alphabetic",d.textAlign="left",d.fillStyle="black",this.gridOuter=new Float64Array(l*l),this.gridInner=new Float64Array(l*l),this.f=new Float64Array(l),this.z=new Float64Array(l+1),this.v=new Uint16Array(l)}_createCanvas(e){const t=document.createElement("canvas");return t.width=t.height=e,t}draw(e){const{width:t,actualBoundingBoxAscent:i,actualBoundingBoxDescent:r,actualBoundingBoxLeft:n,actualBoundingBoxRight:s}=this.ctx.measureText(e),a=Math.ceil(i),l=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(s-n))),h=Math.min(this.size-this.buffer,a+Math.ceil(r)),d=l+2*this.buffer,f=h+2*this.buffer,m=Math.max(d*f,0),_=new Uint8ClampedArray(m),y={data:_,width:d,height:f,glyphWidth:l,glyphHeight:h,glyphTop:a,glyphLeft:0,glyphAdvance:t};if(l===0||h===0)return y;const{ctx:x,buffer:b,gridInner:w,gridOuter:T}=this;x.clearRect(b,b,l,h),x.fillText(e,b,b+a);const S=x.getImageData(b,b,l,h);T.fill(kc,0,m),w.fill(0,0,m);for(let I=0;I&lt;h;I++)for(let P=0;P&lt;l;P++){const M=S.data[4*(I*l+P)+3]/255;if(M===0)continue;const C=(I+b)*d+P+b;if(M===1)T[C]=0,w[C]=kc;else{const D=.5-M;T[C]=D&gt;0?D*D:0,w[C]=D&lt;0?D*D:0}}lb(T,0,0,d,f,d,this.f,this.v,this.z),lb(w,b,b,l,h,d,this.f,this.v,this.z);for(let I=0;I&lt;m;I++){const P=Math.sqrt(T[I])-Math.sqrt(w[I]);_[I]=Math.round(255-255*(P/this.radius+this.cutoff))}return y}};const Co=en;function ub(e,t,i,r){const n=[],s=e.imagePrimary,a=s.pixelRatio,l=s.paddedRect.w-2*Co,h=s.paddedRect.h-2*Co,d=e.right-e.left,f=e.bottom-e.top,m=s.stretchX||[[0,l]],_=s.stretchY||[[0,h]],y=(B,U)=&gt;B+U[1]-U[0],x=m.reduce(y,0),b=_.reduce(y,0),w=l-x,T=h-b;let S=0,I=x,P=0,M=b,C=0,D=w,O=0,k=T;if(s.content&amp;&amp;r){const B=s.content;S=qh(m,0,B[0]),P=qh(_,0,B[1]),I=qh(m,B[0],B[2]),M=qh(_,B[1],B[3]),C=B[0]-S,O=B[1]-P,D=B[2]-B[0]-I,k=B[3]-B[1]-M}const z=(B,U,Z,F)=&gt;{const Y=Zh(B.stretch-S,I,d,e.left),J=$h(B.fixed-C,D,B.stretch,x),it=Zh(U.stretch-P,M,f,e.top),X=$h(U.fixed-O,k,U.stretch,b),K=Zh(Z.stretch-S,I,d,e.left),ot=$h(Z.fixed-C,D,Z.stretch,x),lt=Zh(F.stretch-P,M,f,e.top),at=$h(F.fixed-O,k,F.stretch,b),dt=new Q(Y,it),ft=new Q(K,it),_t=new Q(K,lt),ct=new Q(Y,lt),bt=new Q(J/a,X/a),Ot=new Q(ot/a,at/a),kt=t*Math.PI/180;if(kt){const ke=Math.sin(kt),pe=Math.cos(kt),ue=[pe,-ke,ke,pe];dt._matMult(ue),ft._matMult(ue),ct._matMult(ue),_t._matMult(ue)}const Ht=B.stretch+B.fixed,Zt=Z.stretch+Z.fixed,fe=U.stretch+U.fixed,ie=F.stretch+F.fixed,Ve=e.imageSecondary;return{tl:dt,tr:ft,bl:ct,br:_t,texPrimary:{x:s.paddedRect.x+Co+Ht,y:s.paddedRect.y+Co+fe,w:Zt-Ht,h:ie-fe},texSecondary:Ve?{x:Ve.paddedRect.x+Co+Ht,y:Ve.paddedRect.y+Co+fe,w:Zt-Ht,h:ie-fe}:void 0,writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:bt,pixelOffsetBR:Ot,minFontScaleX:D/a/d,minFontScaleY:k/a/f,isSDF:i}};if(r&amp;&amp;(s.stretchX||s.stretchY)){const B=hb(m,w,x),U=hb(_,T,b);for(let Z=0;Z&lt;B.length-1;Z++){const F=B[Z],Y=B[Z+1];for(let J=0;J&lt;U.length-1;J++)n.push(z(F,U[J],Y,U[J+1]))}}else n.push(z({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:l+1},{fixed:0,stretch:h+1}));return n}function qh(e,t,i){let r=0;for(const n of e)r+=Math.max(t,Math.min(i,n[1]))-Math.max(t,Math.min(i,n[0]));return r}function hb(e,t,i){const r=[{fixed:-Co,stretch:0}];for(const[n,s]of e){const a=r[r.length-1];r.push({fixed:n-a.stretch,stretch:a.stretch}),r.push({fixed:n-a.stretch,stretch:a.stretch+(s-n)})}return r.push({fixed:t+Co,stretch:i}),r}function Zh(e,t,i,r){return e/t*i+r}function $h(e,t,i,r){return e-t*i/r}function T3(e,t,i,r){const n=t+e.positionedLines[r].lineOffset;return r===0?i+n/2:i+(n+(t+e.positionedLines[r-1].lineOffset))/2}function E3(e,t=1,i=!1){let r=1/0,n=1/0,s=-1/0,a=-1/0;const l=e[0];for(let y=0;y&lt;l.length;y++){const x=l[y];(!y||x.x&lt;r)&amp;&amp;(r=x.x),(!y||x.y&lt;n)&amp;&amp;(n=x.y),(!y||x.x&gt;s)&amp;&amp;(s=x.x),(!y||x.y&gt;a)&amp;&amp;(a=x.y)}const h=Math.min(s-r,a-n);let d=h/2;const f=new Yf([],S3);if(h===0)return new Q(r,n);for(let y=r;y&lt;s;y+=h)for(let x=n;x&lt;a;x+=h)f.push(new ml(y+d,x+d,d,e));let m=function(y){let x=0,b=0,w=0;const T=y[0];for(let S=0,I=T.length,P=I-1;S&lt;I;P=S++){const M=T[S],C=T[P],D=M.x*C.y-C.x*M.y;b+=(M.x+C.x)*D,w+=(M.y+C.y)*D,x+=3*D}return new ml(b/x,w/x,0,y)}(e),_=f.length;for(;f.length;){const y=f.pop();(y.d&gt;m.d||!m.d)&amp;&amp;(m=y,i&amp;&amp;console.log("found best %d after %d probes",Math.round(1e4*y.d)/1e4,_)),y.max-m.d&lt;=t||(d=y.h/2,f.push(new ml(y.p.x-d,y.p.y-d,d,e)),f.push(new ml(y.p.x+d,y.p.y-d,d,e)),f.push(new ml(y.p.x-d,y.p.y+d,d,e)),f.push(new ml(y.p.x+d,y.p.y+d,d,e)),_+=4)}return i&amp;&amp;(console.log(`num probes: ${_}`),console.log(`best distance: ${m.d}`)),m.p}function S3(e,t){return t.max-e.max}class ml{constructor(t,i,r,n){this.p=new Q(t,i),this.h=r,this.d=function(s,a){let l=!1,h=1/0;for(let d=0;d&lt;a.length;d++){const f=a[d];for(let m=0,_=f.length,y=_-1;m&lt;_;y=m++){const x=f[m],b=f[y];x.y&gt;s.y!=b.y&gt;s.y&amp;&amp;s.x&lt;(b.x-x.x)*(s.y-x.y)/(b.y-x.y)+x.x&amp;&amp;(l=!l),h=Math.min(h,d1(s,x,b))}}return(l?1:-1)*Math.sqrt(h)}(this.p,n),this.max=this.d+this.h*Math.SQRT2}}const _l=7,s_=Number.POSITIVE_INFINITY,A3=Math.sqrt(2);function o_(e,[t,i]){let r=0,n=0;if(i===s_){t&lt;0&amp;&amp;(t=0);const s=t/A3;switch(e){case"top-right":case"top-left":n=s-_l;break;case"bottom-right":case"bottom-left":n=-s+_l;break;case"bottom":n=-t+_l;break;case"top":n=t-_l}switch(e){case"top-right":case"bottom-right":r=-s;break;case"top-left":case"bottom-left":r=s;break;case"left":r=t;break;case"right":r=-t}}else{switch(t=Math.abs(t),i=Math.abs(i),e){case"top-right":case"top-left":case"top":n=i-_l;break;case"bottom-right":case"bottom-left":case"bottom":n=-i+_l}switch(e){case"top-right":case"bottom-right":case"right":r=-t;break;case"top-left":case"bottom-left":case"left":r=t}}return[r,n]}function M3(e,t,i,r,n,s,a,l,h,d,f){e.createArrays(),e.tilePixelRatio=ut/(512*e.overscaling),e.compareText={},e.iconsNeedLinear=!1;const m=e.layers[0].layout,_=e.layers[0]._unevaluatedLayout._values,y={};if(e.textSizeData.kind==="composite"){const{minZoom:T,maxZoom:S}=e.textSizeData;y.compositeTextSizes=[_["text-size"].possiblyEvaluate(new Si(T),l),_["text-size"].possiblyEvaluate(new Si(S),l)]}if(e.iconSizeData.kind==="composite"){const{minZoom:T,maxZoom:S}=e.iconSizeData;y.compositeIconSizes=[_["icon-size"].possiblyEvaluate(new Si(T),l),_["icon-size"].possiblyEvaluate(new Si(S),l)]}y.layoutTextSize=_["text-size"].possiblyEvaluate(new Si(h+1),l),y.layoutIconSize=_["icon-size"].possiblyEvaluate(new Si(h+1),l),y.textMaxSize=_["text-size"].possiblyEvaluate(new Si(18),l);const x=m.get("text-rotation-alignment")==="map"&amp;&amp;m.get("symbol-placement")!=="point",b=m.get("text-size");let w=!1;for(const T of e.features)if(T.icon&amp;&amp;T.icon.nameSecondary){w=!0;break}for(const T of e.features){const S=m.get("text-font").evaluate(T,{},l).join(","),I=b.evaluate(T,{},l),P=y.layoutTextSize.evaluate(T,{},l),M=(y.layoutIconSize.evaluate(T,{},l),{horizontal:{},vertical:void 0}),C=T.text;let D,O=[0,0];if(C){const B=C.toString(),U=m.get("text-letter-spacing").evaluate(T,{},l)*dr,Z=m.get("text-line-height").evaluate(T,{},l)*dr,F=tP(B)?U:0,Y=m.get("text-anchor").evaluate(T,{},l),J=m.get("text-variable-anchor");if(!J){const lt=m.get("text-radial-offset").evaluate(T,{},l);O=lt?o_(Y,[lt*dr,s_]):m.get("text-offset").evaluate(T,{},l).map(at=&gt;at*dr)}let it=x?"center":m.get("text-justify").evaluate(T,{},l);const X=m.get("symbol-placement")==="point",K=X?m.get("text-max-width").evaluate(T,{},l)*dr:1/0,ot=lt=&gt;{e.allowVerticalPlacement&amp;&amp;kp(B)&amp;&amp;(M.vertical=i_(C,t,i,n,S,K,Z,Y,lt,F,O,Ti.vertical,!0,P,I))};if(!x&amp;&amp;J){const lt=it==="auto"?J.map(dt=&gt;a_(dt)):[it];let at=!1;for(let dt=0;dt&lt;lt.length;dt++){const ft=lt[dt];if(!M.horizontal[ft])if(at)M.horizontal[ft]=M.horizontal[0];else{const _t=i_(C,t,i,n,S,K,Z,"center",ft,F,O,Ti.horizontal,!1,P,I);_t&amp;&amp;(M.horizontal[ft]=_t,at=_t.positionedLines.length===1)}}ot("left")}else{if(it==="auto"&amp;&amp;(it=a_(Y)),X||m.get("text-writing-mode").indexOf("horizontal")&gt;=0||!kp(B)){const lt=i_(C,t,i,n,S,K,Z,Y,it,F,O,Ti.horizontal,!1,P,I);lt&amp;&amp;(M.horizontal[it]=lt)}ot(X?"left":it)}}let k=!1;if(T.icon&amp;&amp;T.icon.namePrimary){const B=r[T.icon.namePrimary];B&amp;&amp;(D=v3(n[T.icon.namePrimary],T.icon.nameSecondary?n[T.icon.nameSecondary]:void 0,m.get("icon-offset").evaluate(T,{},l),m.get("icon-anchor").evaluate(T,{},l)),k=B.sdf,e.sdfIcons===void 0?e.sdfIcons=B.sdf:e.sdfIcons!==B.sdf&amp;&amp;tt("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(B.pixelRatio!==e.pixelRatio||m.get("icon-rotate").constantOr(1)!==0)&amp;&amp;(e.iconsNeedLinear=!0))}const z=fb(M.horizontal)||M.vertical;e.iconsInText||(e.iconsInText=!!z&amp;&amp;z.iconsInText),(z||D)&amp;&amp;I3(e,T,M,D,r,y,P,0,O,k,a,l,d,f,w)}s&amp;&amp;e.generateCollisionDebugBuffers(h,e.collisionBoxArray)}function a_(e){switch(e){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function I3(e,t,i,r,n,s,a,l,h,d,f,m,_,y,x){let b=s.textMaxSize.evaluate(t,{},m);b===void 0&amp;&amp;(b=a);const w=e.layers[0].layout,T=w.get("icon-offset").evaluate(t,{},m),S=fb(i.horizontal)||i.vertical,I=_.name==="globe",P=dr,M=a/P,C=e.tilePixelRatio*b/P,D=(Y=e.overscaling,e.zoom&gt;18&amp;&amp;Y&gt;2&amp;&amp;(Y&gt;&gt;=1),Math.max(ut/(512*Y),1)*w.get("symbol-spacing")),O=w.get("text-padding")*e.tilePixelRatio,k=w.get("icon-padding")*e.tilePixelRatio,z=$t(w.get("text-max-angle")),B=w.get("text-rotation-alignment")==="map"&amp;&amp;w.get("symbol-placement")!=="point",U=w.get("icon-rotation-alignment")==="map"&amp;&amp;w.get("symbol-placement")!=="point",Z=w.get("symbol-placement"),F=D/2;var Y;const J=w.get("icon-text-fit").evaluate(t,{},m),it=w.get("icon-text-fit-padding").evaluate(t,{},m),X=J!=="none";let K;e.hasAnyIconTextFit===!1&amp;&amp;X&amp;&amp;(e.hasAnyIconTextFit=!0),r&amp;&amp;X&amp;&amp;(e.allowVerticalPlacement&amp;&amp;i.vertical&amp;&amp;(K=tb(r,i.vertical,J,it,T,M)),S&amp;&amp;(r=tb(r,S,J,it,T,M)));const ot=(lt,at,dt)=&gt;{if(at.x&lt;0||at.x&gt;=ut||at.y&lt;0||at.y&gt;=ut)return;let ft=null;if(I){const{x:_t,y:ct,z:bt}=_.projectTilePoint(at.x,at.y,dt);ft={anchor:new Js(_t,ct,bt,0,void 0),up:_.upVector(dt,at.x,at.y)}}(function(_t,ct,bt,Ot,kt,Ht,Zt,fe,ie,Ve,ke,pe,ue,re,Fe,Ue,Me,hi,Fi,ai,_i,Ui,Bi,xi,ri,gr,vs){const Qs=_t.addToLineVertexArray(ct,Ot);let to,ru,nu,Gd,xE,vE,bE,wE=0,TE=0,EE=0,SE=0,ag=-1,lg=-1;const bs={};let AE=om("");const va=bt?bt.anchor:ct,cg=ie.layout.get("icon-text-fit").evaluate(_i,{},ri)!=="none";let ug=0,hg=0;if(ie._unevaluatedLayout.getValue("text-radial-offset")===void 0?[ug,hg]=ie.layout.get("text-offset").evaluate(_i,{},ri).map(nn=&gt;nn*dr):(ug=ie.layout.get("text-radial-offset").evaluate(_i,{},ri)*dr,hg=s_),_t.allowVerticalPlacement&amp;&amp;kt.vertical){const nn=kt.vertical;if(Fe)vE=l_(nn),fe&amp;&amp;(bE=l_(fe));else{const sn=ie.layout.get("text-rotate").evaluate(_i,{},ri)+90;nu=Xh(Ve,va,ct,ke,pe,ue,nn,re,sn,Ue),fe&amp;&amp;(Gd=Xh(Ve,va,ct,ke,pe,ue,fe,hi,sn))}}if(Ht){const nn=ie.layout.get("icon-rotate").evaluate(_i,{},ri),sn=ub(Ht,nn,Bi,cg),Ml=fe?ub(fe,nn,Bi,cg):void 0;ru=Xh(Ve,va,ct,ke,pe,ue,Ht,hi,nn),wE=4*sn.length;const ME=_t.iconSizeData;let ba=null;ME.kind==="source"?(ba=[qn*ie.layout.get("icon-size").evaluate(_i,{},ri)],ba[0]&gt;Lo&amp;&amp;tt(`${_t.layerIds[0]}: Value for "icon-size" is &gt;= ${zc}. Reduce your "icon-size".`)):ME.kind==="composite"&amp;&amp;(ba=[qn*Ui.compositeIconSizes[0].evaluate(_i,{},ri),qn*Ui.compositeIconSizes[1].evaluate(_i,{},ri)],(ba[0]&gt;Lo||ba[1]&gt;Lo)&amp;&amp;tt(`${_t.layerIds[0]}: Value for "icon-size" is &gt;= ${zc}. Reduce your "icon-size".`)),_t.addSymbols(_t.icon,sn,ba,ai,Fi,_i,!1,bt,ct,Qs.lineStartIndex,Qs.lineLength,-1,xi,ri,gr,vs),ag=_t.icon.placedSymbolArray.length-1,Ml&amp;&amp;(TE=4*Ml.length,_t.addSymbols(_t.icon,Ml,ba,ai,Fi,_i,Ti.vertical,bt,ct,Qs.lineStartIndex,Qs.lineLength,-1,xi,ri,gr,vs),lg=_t.icon.placedSymbolArray.length-1)}for(const nn in kt.horizontal){const sn=kt.horizontal[nn];to||(AE=om(sn.text),Fe?xE=l_(sn):to=Xh(Ve,va,ct,ke,pe,ue,sn,re,ie.layout.get("text-rotate").evaluate(_i,{},ri),Ue));const Ml=sn.positionedLines.length===1;if(EE+=db(_t,bt,ct,sn,Zt,ie,Fe,_i,Ue,Qs,kt.vertical?Ti.horizontal:Ti.horizontalOnly,Ml?Object.keys(kt.horizontal):[nn],bs,ag,Ui,xi,ri,gr),Ml)break}kt.vertical&amp;&amp;(SE+=db(_t,bt,ct,kt.vertical,Zt,ie,Fe,_i,Ue,Qs,Ti.vertical,["vertical"],bs,lg,Ui,xi,ri,gr));let No=-1;const dg=(nn,sn)=&gt;nn?Math.max(nn,sn):sn;No=dg(xE,No),No=dg(vE,No),No=dg(bE,No);const dk=No&gt;-1?1:0;_t.glyphOffsetArray.length&gt;=Vc.MAX_GLYPHS&amp;&amp;tt("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),_i.sortKey!==void 0&amp;&amp;_t.addToSortKeyRanges(_t.symbolInstances.length,_i.sortKey),_t.symbolInstances.emplaceBack(ct.x,ct.y,va.x,va.y,va.z,bs.right&gt;=0?bs.right:-1,bs.center&gt;=0?bs.center:-1,bs.left&gt;=0?bs.left:-1,bs.vertical&gt;=0?bs.vertical:-1,ag,lg,AE,to!==void 0?to:_t.collisionBoxArray.length,to!==void 0?to+1:_t.collisionBoxArray.length,nu!==void 0?nu:_t.collisionBoxArray.length,nu!==void 0?nu+1:_t.collisionBoxArray.length,ru!==void 0?ru:_t.collisionBoxArray.length,ru!==void 0?ru+1:_t.collisionBoxArray.length,Gd||_t.collisionBoxArray.length,Gd?Gd+1:_t.collisionBoxArray.length,ke,EE,SE,wE,TE,dk,0,ug,hg,No,0,cg?1:0)})(e,at,ft,lt,i,r,n,K,e.layers[0],e.collisionBoxArray,t.index,t.sourceLayerIndex,e.index,O,B,h,0,k,U,T,t,s,d,f,m,y,x)};if(Z==="line")for(const lt of ob(t.geometry,0,0,ut,ut)){const at=w3(lt,D,z,i.vertical||S,r,P,C,e.overscaling,ut);for(const dt of at)S&amp;&amp;P3(e,S.text,F,dt)||ot(lt,dt,m)}else if(Z==="line-center"){for(const lt of t.geometry)if(lt.length&gt;1){const at=b3(lt,z,i.vertical||S,r,P,C);at&amp;&amp;ot(lt,at,m)}}else if(t.type==="Polygon")for(const lt of $m(t.geometry,0)){const at=E3(lt,16);ot(lt[0],new Js(at.x,at.y,0,0,void 0),m)}else if(t.type==="LineString")for(const lt of t.geometry)ot(lt,new Js(lt[0].x,lt[0].y,0,0,void 0),m);else if(t.type==="Point")for(const lt of t.geometry)for(const at of lt)ot([at],new Js(at.x,at.y,0,0,void 0),m)}const zc=255,Lo=zc*qn;function db(e,t,i,r,n,s,a,l,h,d,f,m,_,y,x,b,w,T){const S=function(M,C,D,O,k,z,B,U){const Z=[];if(C.positionedLines.length===0)return Z;const F=O.layout.get("text-rotate").evaluate(z,{})*Math.PI/180,Y=function(ot){const lt=ot[0],at=ot[1],dt=lt*at;return dt&gt;0?[lt,-at]:dt&lt;0?[-lt,at]:lt===0?[at,lt]:[at,-lt]}(D);let J=Math.abs(C.top-C.bottom);for(const ot of C.positionedLines)J-=ot.lineOffset;const it=C.positionedLines.length,X=J/it;let K=C.top-D[1];for(let ot=0;ot&lt;it;++ot){const lt=C.positionedLines[ot];K=T3(C,X,K,ot);for(const at of lt.positionedGlyphs){if(!at.rect)continue;const dt=at.rect||{};let ft=Z1+1,_t=!0,ct=1,bt=0;if(at.imageName){const ai=B[at.imageName];if(!ai)continue;if(ai.sdf){tt("SDF images are not supported in formatted text and will be ignored.");continue}_t=!1,ct=ai.pixelRatio,ft=en/ct}const Ot=(k||U)&amp;&amp;at.vertical,kt=at.metrics.advance*at.scale/2,Ht=at.metrics,Zt=at.rect;if(Zt===null)continue;U&amp;&amp;C.verticalizable&amp;&amp;(bt=at.imageName?kt-at.metrics.width*at.scale/2:0);const fe=k?[at.x+kt,at.y]:[0,0];let ie=[0,0],Ve=[0,0],ke=!1;k||(Ot?(Ve=[at.x+kt+Y[0],at.y+Y[1]-bt],ke=!0):ie=[at.x+kt+D[0],at.y+D[1]-bt]);const pe=Zt.w*at.scale/(ct*(at.localGlyph?Zn:1)),ue=Zt.h*at.scale/(ct*(at.localGlyph?Zn:1));let re,Fe,Ue,Me;if(Ot){const ai=at.y-K,_i=new Q(-kt,kt-ai),Ui=-Math.PI/2,Bi=new Q(...Ve);re=new Q(-kt+ie[0],ie[1]),re._rotateAround(Ui,_i)._add(Bi),re.x+=-ai+kt,re.y-=(Ht.left-ft)*at.scale;const xi=at.imageName?Ht.advance*at.scale:dr*at.scale,ri=String.fromCodePoint(at.glyph);f3(ri)?re.x+=(1-ft)*at.scale:p3(ri)?re.x+=xi-Ht.height*at.scale+(-ft-1)*at.scale:re.x+=at.imageName||Ht.width+2*ft===Zt.w&amp;&amp;Ht.height+2*ft===Zt.h?(xi-ue)/2:(xi-(Ht.height+2*ft)*at.scale)/2,Fe=new Q(re.x,re.y-pe),Ue=new Q(re.x+ue,re.y),Me=new Q(re.x+ue,re.y-pe)}else{const ai=(Ht.left-ft)*at.scale-kt+ie[0],_i=(-Ht.top-ft)*at.scale+ie[1],Ui=ai+pe,Bi=_i+ue;re=new Q(ai,_i),Fe=new Q(Ui,_i),Ue=new Q(ai,Bi),Me=new Q(Ui,Bi)}if(F){let ai;ai=k?new Q(0,0):ke?new Q(Y[0],Y[1]):new Q(D[0],D[1]),re._rotateAround(F,ai),Fe._rotateAround(F,ai),Ue._rotateAround(F,ai),Me._rotateAround(F,ai)}const hi=new Q(0,0),Fi=new Q(0,0);Z.push({tl:re,tr:Fe,bl:Ue,br:Me,texPrimary:dt,texSecondary:void 0,writingMode:C.writingMode,glyphOffset:fe,sectionIndex:at.sectionIndex,isSDF:_t,pixelOffsetTL:hi,pixelOffsetBR:Fi,minFontScaleX:0,minFontScaleY:0})}}return Z}(0,r,h,s,a,l,n,e.allowVerticalPlacement),I=e.textSizeData;let P=null;I.kind==="source"?(P=[qn*s.layout.get("text-size").evaluate(l,{},w)],P[0]&gt;Lo&amp;&amp;tt(`${e.layerIds[0]}: Value for "text-size" is &gt;= ${zc}. Reduce your "text-size".`)):I.kind==="composite"&amp;&amp;(P=[qn*x.compositeTextSizes[0].evaluate(l,{},w),qn*x.compositeTextSizes[1].evaluate(l,{},w)],(P[0]&gt;Lo||P[1]&gt;Lo)&amp;&amp;tt(`${e.layerIds[0]}: Value for "text-size" is &gt;= ${zc}. Reduce your "text-size".`)),e.addSymbols(e.text,S,P,h,a,l,f,t,i,d.lineStartIndex,d.lineLength,y,b,w,T,!1);for(const M of m)_[M]=e.text.placedSymbolArray.length-1;return 4*S.length}function fb(e){for(const t in e)return e[t];return null}function Xh(e,t,i,r,n,s,a,l,h,d){let f=a.top,m=a.bottom,_=a.left,y=a.right;const x=a.collisionPadding;if(x&amp;&amp;(_-=x[0],f-=x[1],y+=x[2],m+=x[3]),h){const b=new Q(_,f),w=new Q(y,f),T=new Q(_,m),S=new Q(y,m),I=$t(h);let P=new Q(0,0);d&amp;&amp;(P=new Q(d[0],d[1])),b._rotateAround(I,P),w._rotateAround(I,P),T._rotateAround(I,P),S._rotateAround(I,P),_=Math.min(b.x,w.x,T.x,S.x),y=Math.max(b.x,w.x,T.x,S.x),f=Math.min(b.y,w.y,T.y,S.y),m=Math.max(b.y,w.y,T.y,S.y)}return e.emplaceBack(t.x,t.y,t.z,i.x,i.y,_,f,y,m,l,r,n,s),e.length-1}function l_(e){e.collisionPadding&amp;&amp;(e.top-=e.collisionPadding[1],e.bottom+=e.collisionPadding[3]);const t=e.bottom-e.top;return t&gt;0?Math.max(10,t):null}function P3(e,t,i,r){const n=e.compareText;if(t in n){const s=n[t];for(let a=s.length-1;a&gt;=0;a--)if(r.dist(s[a])&lt;i)return!0}else n[t]=[];return n[t].push(r),!1}function pb(e,t){const i=e.fovAboveCenter,r=e.elevation?e.elevation.getMinElevationBelowMSL()*t:0,n=(e._camera.position[2]*e.worldSize-r)/Math.cos(e._pitch),s=Math.sin(i)*n/Math.sin(Math.max(Math.PI/2-e._pitch-i,.01)),a=Math.sin(e._pitch)*s+n;return Math.min(1.01*a,n*(1/e._horizonShift))}function da(e,t){if(!t.isReprojectedInTileSpace)return{scale:1&lt;&lt;e.z,x:e.x,y:e.y,x2:e.x+1,y2:e.y+1,projection:t};const i=Math.pow(2,-e.z),r=e.x*i,n=(e.x+1)*i,s=e.y*i,a=(e.y+1)*i,l=tn(r),h=tn(n),d=Yi(s),f=Yi(a),m=t.project(l,d),_=t.project(h,d),y=t.project(h,f),x=t.project(l,f);let b=Math.min(m.x,_.x,y.x,x.x),w=Math.min(m.y,_.y,y.y,x.y),T=Math.max(m.x,_.x,y.x,x.x),S=Math.max(m.y,_.y,y.y,x.y);const I=i/16;function P(C,D,O,k,z,B){const U=(O+z)/2,Z=(k+B)/2,F=t.project(tn(U),Yi(Z)),Y=Math.max(0,b-F.x,w-F.y,F.x-T,F.y-S);b=Math.min(b,F.x),T=Math.max(T,F.x),w=Math.min(w,F.y),S=Math.max(S,F.y),Y&gt;I&amp;&amp;(P(C,F,O,k,U,Z),P(F,D,U,Z,z,B))}P(m,_,r,s,n,s),P(_,y,n,s,n,a),P(y,x,n,a,r,a),P(x,m,r,a,r,s),b-=I,w-=I,T+=I,S+=I;const M=1/Math.max(T-b,S-w);return{scale:M,x:b*M,y:w*M,x2:T*M,y2:S*M,projection:t}}function mb(e,t,i,r,n,s,a,l,h){if(h.name==="globe")return Cm(e,t,new In(i,r,n),!1);const d=da({z:i,x:r,y:n},h);return new mi([(s+d.x/d.scale)*t,t*(d.y/d.scale),a],[(s+d.x2/d.scale)*t,t*(d.y2/d.scale),l])}function _b(e,{x:t,y:i},r=0){return new Q(((t-r)*e.scale-e.x)*ut,(i*e.scale-e.y)*ut)}function gb(e,t,i=0){return W.fromValues(((t.x-i)*e.scale-e.x)*ut,(t.y*e.scale-e.y)*ut,o1(t.z,t.y))}const C3=nt.identity(new Float32Array(16));class Ro{constructor(t){this.spec=t,this.name=t.name,this.wrap=!1,this.requiresDraping=!1,this.supportsWorldCopies=!1,this.supportsTerrain=!1,this.supportsFog=!1,this.supportsFreeCamera=!1,this.zAxisUnit="meters",this.isReprojectedInTileSpace=!0,this.unsupportedLayers=["custom"],this.center=[0,0],this.range=[3.5,7]}project(t,i){return{x:0,y:0,z:0}}unproject(t,i){return new ye(0,0)}projectTilePoint(t,i,r){return{x:t,y:i,z:0}}locationPoint(t,i,r=!0){return t._coordinatePoint(t.locationCoordinate(i),r)}pixelsPerMeter(t,i){return ui(1,t)*i}pixelSpaceConversion(t,i,r){return 1}farthestPixelDistance(t){return pb(t,t.pixelsPerMeter)}pointCoordinate(t,i,r,n){const s=t.horizonLineFromTop(!1),a=new Q(i,Math.max(s,r));return t.rayIntersectionCoordinate(t.pointRayIntersection(a,n))}pointCoordinate3D(t,i,r){const n=new Q(i,r);if(t.elevation)return t.elevation.pointCoordinate(n);{const s=this.pointCoordinate(t,n.x,n.y,0);return[s.x,s.y,s.z]}}isPointAboveHorizon(t,i){if(t.elevation)return!this.pointCoordinate3D(t,i.x,i.y);const r=t.horizonLineFromTop();return i.y&lt;r}createInversionMatrix(t,i){return C3}createTileMatrix(t,i,r){let n,s,a;const l=r.canonical,h=nt.identity(new Float64Array(16));if(this.isReprojectedInTileSpace){const d=da(l,this);n=1,s=d.x+r.wrap*d.scale,a=d.y,nt.scale(h,h,[n/d.scale,n/d.scale,t.pixelsPerMeter/i])}else n=i/t.zoomScale(l.z),s=(l.x+Math.pow(2,l.z)*r.wrap)*n,a=l.y*n;return nt.translate(h,h,[s,a,0]),nt.scale(h,h,[n/ut,n/ut,1]),h}upVector(t,i,r){return[0,0,1]}upVectorScale(t,i,r){return{metersToTile:1}}}class L3 extends Ro{constructor(t){super(t),this.range=[4,7],this.center=t.center||[-96,37.5];const[i,r]=this.parallels=t.parallels||[29.5,45.5],n=Math.sin($t(i));this.n=(n+Math.sin($t(r)))/2,this.c=1+n*(2*this.n-n),this.r0=Math.sqrt(this.c)/this.n}project(t,i){const{n:r,c:n,r0:s}=this,a=$t(t-this.center[0]),l=$t(i),h=Math.sqrt(n-2*r*Math.sin(l))/r;return{x:h*Math.sin(a*r),y:h*Math.cos(a*r)-s,z:0}}unproject(t,i){const{n:r,c:n,r0:s}=this,a=s+i;let l=Math.atan2(t,Math.abs(a))*Math.sign(a);a*r&lt;0&amp;&amp;(l-=Math.PI*Math.sign(t)*Math.sign(a));const h=$t(this.center[0])*r;l=Hr(l,-Math.PI-h,Math.PI-h);const d=Xt(vi(l/r)+this.center[0],-180,180),f=Math.asin(Xt((n-(t*t+a*a)*r*r)/(2*r),-1,1)),m=Xt(vi(f),-zi,zi);return new ye(d,m)}}const Fc=1.340264,Bc=-.081106,Nc=893e-6,Uc=.003796,Yh=Math.sqrt(3)/2;class R3 extends Ro{project(t,i){i=i/180*Math.PI,t=t/180*Math.PI;const r=Math.asin(Yh*Math.sin(i)),n=r*r,s=n*n*n;return{x:.5*(t*Math.cos(r)/(Yh*(Fc+3*Bc*n+s*(7*Nc+9*Uc*n)))/Math.PI+.5),y:1-.5*(r*(Fc+Bc*n+s*(Nc+Uc*n))/Math.PI+1),z:0}}unproject(t,i){t=(2*t-.5)*Math.PI;let r=i=(2*(1-i)-1)*Math.PI,n=r*r,s=n*n*n;for(let f,m,_,y=0;y&lt;12&amp;&amp;(m=r*(Fc+Bc*n+s*(Nc+Uc*n))-i,_=Fc+3*Bc*n+s*(7*Nc+9*Uc*n),f=m/_,r=Xt(r-f,-Math.PI/3,Math.PI/3),n=r*r,s=n*n*n,!(Math.abs(f)&lt;1e-12));++y);const a=Yh*t*(Fc+3*Bc*n+s*(7*Nc+9*Uc*n))/Math.cos(r),l=Math.asin(Math.sin(r)/Yh),h=Xt(180*a/Math.PI,-180,180),d=Xt(180*l/Math.PI,-zi,zi);return new ye(h,d)}}class D3 extends Ro{constructor(t){super(t),this.wrap=!0,this.supportsWorldCopies=!0}project(t,i){return{x:.5+t/360,y:.5-i/360,z:0}}unproject(t,i){const r=360*(t-.5),n=Xt(360*(.5-i),-zi,zi);return new ye(r,n)}}const gl=Math.PI/2;function Kh(e){return Math.tan((gl+e)/2)}class O3 extends Ro{constructor(t){super(t),this.center=t.center||[0,30];const[i,r]=this.parallels=t.parallels||[30,30];let n=$t(i),s=$t(r);this.southernCenter=n+s&lt;0,this.southernCenter&amp;&amp;(n=-n,s=-s);const a=Math.cos(n),l=Kh(n);this.n=n===s?Math.sin(n):Math.log(a/Math.cos(s))/Math.log(Kh(s)/l),this.f=a*Math.pow(Kh(n),this.n)/this.n}project(t,i){i=$t(i),this.southernCenter&amp;&amp;(i=-i),t=$t(t-this.center[0]);const r=1e-6,{n,f:s}=this;s&gt;0?i&lt;-gl+r&amp;&amp;(i=-gl+r):i&gt;gl-r&amp;&amp;(i=gl-r);const a=s/Math.pow(Kh(i),n);let l=a*Math.sin(n*t),h=s-a*Math.cos(n*t);return l=.5*(l/Math.PI+.5),h=.5*(h/Math.PI+.5),{x:l,y:this.southernCenter?h:1-h,z:0}}unproject(t,i){t=(2*t-.5)*Math.PI,this.southernCenter&amp;&amp;(i=1-i),i=(2*(1-i)-.5)*Math.PI;const{n:r,f:n}=this,s=n-i,a=Math.sign(s),l=Math.sign(r)*Math.sqrt(t*t+s*s);let h=Math.atan2(t,Math.abs(s))*a;s*r&lt;0&amp;&amp;(h-=Math.PI*Math.sign(t)*a);const d=Xt(vi(h/r)+this.center[0],-180,180),f=Xt(vi(2*Math.atan(Math.pow(n/l,1/r))-gl),-zi,zi);return new ye(d,this.southernCenter?-f:f)}}class yb extends Ro{constructor(t){super(t),this.wrap=!0,this.supportsWorldCopies=!0,this.supportsTerrain=!0,this.supportsFog=!0,this.supportsFreeCamera=!0,this.isReprojectedInTileSpace=!1,this.unsupportedLayers=[],this.range=null}project(t,i){return{x:er(t),y:sr(i),z:0}}unproject(t,i){const r=tn(t),n=Yi(i);return new ye(r,n)}}const xb=$t(zi);class k3 extends Ro{project(t,i){const r=(i=$t(i))*i,n=r*r;return{x:.5*((t=$t(t))*(.8707-.131979*r+n*(n*(.003971*r-.001529*n)-.013791))/Math.PI+.5),y:1-.5*(i*(1.007226+r*(.015085+n*(.028874*r-.044475-.005916*n)))/Math.PI+1),z:0}}unproject(t,i){t=(2*t-.5)*Math.PI;let r=i=(2*(1-i)-1)*Math.PI,n=25,s=0,a=r*r;do{a=r*r;const d=a*a;s=(r*(1.007226+a*(.015085+d*(.028874*a-.044475-.005916*d)))-i)/(1.007226+a*(.045255+d*(.259866*a-.311325-.005916*11*d))),r=Xt(r-s,-xb,xb)}while(Math.abs(s)&gt;1e-6&amp;&amp;--n&gt;0);a=r*r;const l=Xt(vi(t/(.8707+a*(a*(a*a*a*(.003971-.001529*a)-.013791)-.131979))),-180,180),h=vi(r);return new ye(l,h)}}const vb=$t(zi);class z3 extends Ro{project(t,i){i=$t(i),t=$t(t);const r=Math.cos(i),n=2/Math.PI,s=Math.acos(r*Math.cos(t/2)),a=Math.sin(s)/s,l=.5*(t*n+2*r*Math.sin(t/2)/a)||0,h=.5*(i+Math.sin(i)/a)||0;return{x:.5*(l/Math.PI+.5),y:1-.5*(h/Math.PI+1),z:0}}unproject(t,i){let r=t=(2*t-.5)*Math.PI,n=i=(2*(1-i)-1)*Math.PI,s=25;const a=1e-6;let l=0,h=0;do{const d=Math.cos(n),f=Math.sin(n),m=2*f*d,_=f*f,y=d*d,x=Math.cos(r/2),b=Math.sin(r/2),w=2*x*b,T=b*b,S=1-y*x*x,I=S?1/S:0,P=S?Math.acos(d*x)*Math.sqrt(1/S):0,M=.5*(2*P*d*b+2*r/Math.PI)-t,C=.5*(P*f+n)-i,D=.5*I*(y*T+P*d*x*_)+1/Math.PI,O=I*(w*m/4-P*f*b),k=.125*I*(m*b-P*f*y*w),z=.5*I*(_*x+P*T*d)+.5,B=O*k-z*D;l=(C*O-M*z)/B,h=(M*k-C*D)/B,r=Xt(r-l,-Math.PI,Math.PI),n=Xt(n-h,-vb,vb)}while((Math.abs(l)&gt;a||Math.abs(h)&gt;a)&amp;&amp;--s&gt;0);return new ye(vi(r),vi(n))}}class bb extends Ro{constructor(t){super(t),this.center=t.center||[0,0],this.parallels=t.parallels||[0,0],this.cosPhi=Math.max(.01,Math.cos($t(this.parallels[0]))),this.scale=1/(2*Math.max(Math.PI*this.cosPhi,1/this.cosPhi)),this.wrap=!0,this.supportsWorldCopies=!0}project(t,i){const{scale:r,cosPhi:n}=this;return{x:$t(t)*n*r+.5,y:-Math.sin($t(i))/n*r+.5,z:0}}unproject(t,i){const{scale:r,cosPhi:n}=this,s=-(i-.5)/r,a=Xt(vi((t-.5)/r)/n,-180,180),l=Math.asin(Xt(s*n,-1,1)),h=Xt(vi(l),-zi,zi);return new ye(a,h)}}class F3 extends yb{constructor(t){super(t),this.requiresDraping=!0,this.supportsWorldCopies=!1,this.supportsFog=!0,this.zAxisUnit="pixels",this.unsupportedLayers=["debug"],this.range=[3,5]}projectTilePoint(t,i,r){const n=Mc(t,i,r),s=Eo(pn(r));return W.transformMat4(n,n,s),{x:n[0],y:n[1],z:n[2]}}locationPoint(t,i){const r=Nr(i.lat,i.lng),n=W.normalize([],r),s=t.elevation?t.elevation.getAtPointOrZero(t.locationCoordinate(i),t._centerAltitude):t._centerAltitude,a=ui(1,0)*ut*s;W.scaleAndAdd(r,r,n,a);const l=nt.identity(new Float64Array(16));return nt.multiply(l,t.pixelMatrix,t.globeMatrix),W.transformMat4(r,r,l),new Q(r[0],r[1])}pixelsPerMeter(t,i){return ui(1,0)*i}pixelSpaceConversion(t,i,r){const n=ui(1,t)*i,s=ge(ui(1,45)*i,n,r);return this.pixelsPerMeter(t,i)/s}createTileMatrix(t,i,r){const n=Rm(pn(r.canonical));return nt.multiply(new Float64Array(16),t.globeMatrix,n)}createInversionMatrix(t,i){const{center:r}=t,n=Eo(pn(i));return nt.rotateY(n,n,$t(r.lng)),nt.rotateX(n,n,$t(r.lat)),nt.scale(n,n,[t._pixelsPerMercatorPixel,t._pixelsPerMercatorPixel,1]),Float32Array.from(n)}pointCoordinate(t,i,r,n){return Zv(t,i,r,!0)||new Be(0,0)}pointCoordinate3D(t,i,r){const n=this.pointCoordinate(t,i,r,0);return[n.x,n.y,n.z]}isPointAboveHorizon(t,i){return!Zv(t,i.x,i.y,!1)}farthestPixelDistance(t){const i=function(n,s){const a=n.cameraToCenterDistance,l=n._centerAltitude*s,h=n._camera,d=n._camera.forward(),f=W.add([],W.scale([],d,-a),[0,0,l]),m=n.worldSize/(2*Math.PI),_=[0,0,-m],y=n.width/n.height,x=Math.tan(n.fovAboveCenter),b=W.scale([],h.up(),x),w=W.scale([],h.right(),x*y),T=W.normalize([],W.add([],W.add([],d,b),w)),S=[];let I;if(new bh(f,T).closestPointOnSphere(_,m,S)){const P=W.add([],S,_),M=W.sub([],P,f);I=Math.cos(n.fovAboveCenter)*W.length(M)}else{const P=W.sub([],f,_),M=W.sub([],_,f);W.normalize(M,M);const C=W.length(P)-m;I=Math.sqrt(C*(C+2*m));const D=Math.acos(I/(m+C))-Math.acos(W.dot(d,M));I*=Math.cos(D)}return 1.01*I}(t,this.pixelsPerMeter(t.center.lat,t.worldSize)),r=hr(t.zoom);if(r&gt;0){const n=pb(t,ui(1,t.center.lat)*t.worldSize),s=t.worldSize/(2*Math.PI),a=Math.max(t.width,t.height)/t.worldSize*Math.PI;return ge(i,n+s*(1-Math.cos(a)),Math.pow(r,10))}return i}upVector(t,i,r){return Mc(i,r,t,1)}upVectorScale(t){return{metersToTile:wh(Eh(pn(t)))}}}function Jh(e){const t=e.parallels,i=!!t&amp;&amp;Math.abs(t[0]+t[1])&lt;.01;switch(e.name){case"mercator":return new yb(e);case"equirectangular":return new D3(e);case"naturalEarth":return new k3(e);case"equalEarth":return new R3(e);case"winkelTripel":return new z3(e);case"albers":return i?new bb(e):new L3(e);case"lambertConformalConic":return i?new bb(e):new O3(e);case"globe":return new F3(e)}throw new Error(`Invalid projection name: ${e.name}`)}const B3=new Di({"symbol-placement":new At(st.layout_symbol["symbol-placement"]),"symbol-spacing":new At(st.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new At(st.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new ne(st.layout_symbol["symbol-sort-key"]),"symbol-z-order":new At(st.layout_symbol["symbol-z-order"]),"symbol-z-elevate":new At(st.layout_symbol["symbol-z-elevate"]),"icon-allow-overlap":new At(st.layout_symbol["icon-allow-overlap"]),"icon-ignore-placement":new At(st.layout_symbol["icon-ignore-placement"]),"icon-optional":new At(st.layout_symbol["icon-optional"]),"icon-rotation-alignment":new At(st.layout_symbol["icon-rotation-alignment"]),"icon-size":new ne(st.layout_symbol["icon-size"]),"icon-text-fit":new ne(st.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new ne(st.layout_symbol["icon-text-fit-padding"]),"icon-image":new ne(st.layout_symbol["icon-image"]),"icon-rotate":new ne(st.layout_symbol["icon-rotate"]),"icon-padding":new At(st.layout_symbol["icon-padding"]),"icon-keep-upright":new At(st.layout_symbol["icon-keep-upright"]),"icon-offset":new ne(st.layout_symbol["icon-offset"]),"icon-anchor":new ne(st.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new At(st.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new At(st.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new At(st.layout_symbol["text-rotation-alignment"]),"text-field":new ne(st.layout_symbol["text-field"]),"text-font":new ne(st.layout_symbol["text-font"]),"text-size":new ne(st.layout_symbol["text-size"]),"text-max-width":new ne(st.layout_symbol["text-max-width"]),"text-line-height":new ne(st.layout_symbol["text-line-height"]),"text-letter-spacing":new ne(st.layout_symbol["text-letter-spacing"]),"text-justify":new ne(st.layout_symbol["text-justify"]),"text-radial-offset":new ne(st.layout_symbol["text-radial-offset"]),"text-variable-anchor":new At(st.layout_symbol["text-variable-anchor"]),"text-anchor":new ne(st.layout_symbol["text-anchor"]),"text-max-angle":new At(st.layout_symbol["text-max-angle"]),"text-writing-mode":new At(st.layout_symbol["text-writing-mode"]),"text-rotate":new ne(st.layout_symbol["text-rotate"]),"text-padding":new At(st.layout_symbol["text-padding"]),"text-keep-upright":new At(st.layout_symbol["text-keep-upright"]),"text-transform":new ne(st.layout_symbol["text-transform"]),"text-offset":new ne(st.layout_symbol["text-offset"]),"text-allow-overlap":new At(st.layout_symbol["text-allow-overlap"]),"text-ignore-placement":new At(st.layout_symbol["text-ignore-placement"]),"text-optional":new At(st.layout_symbol["text-optional"]),visibility:new At(st.layout_symbol.visibility)});var c_={paint:new Di({"icon-opacity":new ne(st.paint_symbol["icon-opacity"]),"icon-emissive-strength":new ne(st.paint_symbol["icon-emissive-strength"]),"text-emissive-strength":new ne(st.paint_symbol["text-emissive-strength"]),"icon-color":new ne(st.paint_symbol["icon-color"]),"icon-halo-color":new ne(st.paint_symbol["icon-halo-color"]),"icon-halo-width":new ne(st.paint_symbol["icon-halo-width"]),"icon-halo-blur":new ne(st.paint_symbol["icon-halo-blur"]),"icon-translate":new At(st.paint_symbol["icon-translate"]),"icon-translate-anchor":new At(st.paint_symbol["icon-translate-anchor"]),"icon-image-cross-fade":new ne(st.paint_symbol["icon-image-cross-fade"]),"text-opacity":new ne(st.paint_symbol["text-opacity"]),"text-color":new ne(st.paint_symbol["text-color"],{runtimeType:Tn,getOverride:e=&gt;e.textColor,hasOverride:e=&gt;!!e.textColor}),"text-halo-color":new ne(st.paint_symbol["text-halo-color"]),"text-halo-width":new ne(st.paint_symbol["text-halo-width"]),"text-halo-blur":new ne(st.paint_symbol["text-halo-blur"]),"text-translate":new At(st.paint_symbol["text-translate"]),"text-translate-anchor":new At(st.paint_symbol["text-translate-anchor"]),"icon-color-saturation":new At(st.paint_symbol["icon-color-saturation"])}),layout:B3};class wb{constructor(t){this.type=t.property.overrides?t.property.overrides.runtimeType:Ba,this.defaultValue=t}evaluate(t){if(t.formattedSection){const i=this.defaultValue.property.overrides;if(i&amp;&amp;i.hasOverride(t.formattedSection))return i.getOverride(t.formattedSection)}return t.feature&amp;&amp;t.featureState?this.defaultValue.evaluate(t.feature,t.featureState):this.defaultValue.property.specification.default}eachChild(t){this.defaultValue.isConstant()||t(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}Jt(wb,"FormatSectionOverride",{omit:["defaultValue"]});class Qh extends hn{constructor(t,i){super(t,c_,i)}recalculate(t,i){super.recalculate(t,i),this.layout.get("icon-rotation-alignment")==="auto"&amp;&amp;(this.layout._values["icon-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-rotation-alignment")==="auto"&amp;&amp;(this.layout._values["text-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-pitch-alignment")==="auto"&amp;&amp;(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")),this.layout.get("icon-pitch-alignment")==="auto"&amp;&amp;(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment"));const r=this.layout.get("text-writing-mode");if(r){const n=[];for(const s of r)n.indexOf(s)&lt;0&amp;&amp;n.push(s);this.layout._values["text-writing-mode"]=n}else this.layout._values["text-writing-mode"]=this.layout.get("symbol-placement")==="point"?["horizontal"]:["horizontal","vertical"];this._setPaintOverrides()}getValueAndResolveTokens(t,i,r,n){const s=this.layout.get(t).evaluate(i,{},r,n),a=this._unevaluatedLayout._values[t];return a.isDataDriven()||Ku(a.value)||!s?s:function(l,h){return h.replace(/{([^{}]+)}/g,(d,f)=&gt;f in l?String(l[f]):"")}(i.properties,s)}createBucket(t){return new Vc(t)}queryRadius(){return 0}queryIntersectsFeature(){return!1}_setPaintOverrides(){for(const t of c_.paint.overridableProperties){if(!Qh.hasPaintOverride(this.layout,t))continue;const i=this.paint.get(t),r=new wb(i),n=new Ip(r,i.property.specification);let s=null;s=i.value.kind==="constant"||i.value.kind==="source"?new Pp("source",n):new po("composite",n,i.value.zoomStops,i.value._interpolationType),this.paint._values[t]=new Qa(i.property,s,i.parameters)}}_handleOverridablePaintPropertyUpdate(t,i,r){return!(!this.layout||i.isDataDriven()||r.isDataDriven())&amp;&amp;Qh.hasPaintOverride(this.layout,t)}static hasPaintOverride(t,i){const r=t.get("text-field"),n=c_.paint.properties[i];let s=!1;const a=l=&gt;{for(const h of l)if(n.overrides&amp;&amp;n.overrides.hasOverride(h))return void(s=!0)};if(r.value.kind==="constant"&amp;&amp;r.value.value instanceof Xr)a(r.value.value.sections);else if(r.value.kind==="source"){const l=d=&gt;{s||(d instanceof nc&amp;&amp;lr(d.value)===Ql?a(d.value.sections):d instanceof sc?a(d.sections):d.eachChild(l))},h=r.value;h._styleExpression&amp;&amp;l(h._styleExpression.expression)}return s}getProgramIds(){const t=this.paint.get("icon-opacity").constantOr(1)!==0,i=this.paint.get("text-opacity").constantOr(1)!==0,r=[];return t&amp;&amp;r.push("symbolIcon"),i&amp;&amp;r.push("symbolSDF"),r}getDefaultProgramParams(t,i){return{config:new la(this,i),overrideFog:!1}}}const N3=Bh.types,U3=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function td(e,t,i,r,n,s,a,l,h,d,f,m,_){const y=l?Math.min(Lo,Math.round(l[0])):0,x=l?Math.min(Lo,Math.round(l[1])):0;e.emplaceBack(t,i,Math.round(32*r),Math.round(32*n),s,a,(y&lt;&lt;1)+(h?1:0),x,16*d,16*f,256*m,256*_)}function ed(e,t,i){e.emplaceBack(t,i)}function id(e,t,i,r,n,s,a){e.emplaceBack(t,i,r,n,s,a)}function rd(e,t,i,r,n){const s=5*t+2;e.float32[s+0]=i,e.float32[s+1]=r,e.float32[s+2]=n}function yl(e,t,i,r,n){e.emplaceBack(t,i,r,n),e.emplaceBack(t,i,r,n),e.emplaceBack(t,i,r,n),e.emplaceBack(t,i,r,n)}function V3(e){for(const t of e.sections)if(rP(t.text))return!0;return!1}class u_{constructor(t){this.layoutVertexArray=new Zp,this.indexArray=new Xi,this.programConfigurations=t,this.segments=new si,this.dynamicLayoutVertexArray=new Vs,this.opacityVertexArray=new Xp,this.placedSymbolArray=new px,this.iconTransitioningVertexArray=new yo,this.globeExtVertexArray=new $p,this.zOffsetVertexArray=new xc}isEmpty(){return this.layoutVertexArray.length===0&amp;&amp;this.indexArray.length===0&amp;&amp;this.dynamicLayoutVertexArray.length===0&amp;&amp;this.opacityVertexArray.length===0&amp;&amp;this.iconTransitioningVertexArray.length===0}upload(t,i,r,n,s){this.isEmpty()||(r&amp;&amp;(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,r3.members),this.indexBuffer=t.createIndexBuffer(this.indexArray,i),this.dynamicLayoutVertexBuffer=t.createVertexBuffer(this.dynamicLayoutVertexArray,s3.members,!0),this.opacityVertexBuffer=t.createVertexBuffer(this.opacityVertexArray,U3,!0),this.iconTransitioningVertexArray.length&gt;0&amp;&amp;(this.iconTransitioningVertexBuffer=t.createVertexBuffer(this.iconTransitioningVertexArray,a3.members,!0)),this.globeExtVertexArray.length&gt;0&amp;&amp;(this.globeExtVertexBuffer=t.createVertexBuffer(this.globeExtVertexArray,n3.members,!0)),!this.zOffsetVertexBuffer&amp;&amp;(this.zOffsetVertexArray.length&gt;0||s)&amp;&amp;(this.zOffsetVertexBuffer=t.createVertexBuffer(this.zOffsetVertexArray,o3.members,!0)),this.opacityVertexBuffer.itemSize=1),(r||n)&amp;&amp;this.programConfigurations.upload(t))}destroy(){this.layoutVertexBuffer&amp;&amp;(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy(),this.iconTransitioningVertexBuffer&amp;&amp;this.iconTransitioningVertexBuffer.destroy(),this.globeExtVertexBuffer&amp;&amp;this.globeExtVertexBuffer.destroy(),this.zOffsetVertexBuffer&amp;&amp;this.zOffsetVertexBuffer.destroy())}}Jt(u_,"SymbolBuffers");class h_{constructor(t,i,r){this.layoutVertexArray=new t,this.layoutAttributes=i,this.indexArray=new r,this.segments=new si,this.collisionVertexArray=new Jp,this.collisionVertexArrayExt=new Vs}upload(t){this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=t.createVertexBuffer(this.collisionVertexArray,l3.members,!0),this.collisionVertexBufferExt=t.createVertexBuffer(this.collisionVertexArrayExt,c3.members,!0)}destroy(){this.layoutVertexBuffer&amp;&amp;(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy(),this.collisionVertexBufferExt.destroy())}}Jt(h_,"CollisionBuffers");class nd{constructor(t){this.collisionBoxArray=t.collisionBoxArray,this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(a=&gt;a.fqid),this.index=t.index,this.pixelRatio=t.pixelRatio,this.sourceLayerIndex=t.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.fullyClipped=!1,this.hasAnyIconTextFit=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=nt.identity([]),this.placementViewportMatrix=nt.identity([]);const i=this.layers[0]._unevaluatedLayout._values;this.textSizeData=t_(this.zoom,i["text-size"]),this.iconSizeData=t_(this.zoom,i["icon-size"]);const r=this.layers[0].layout,n=r.get("symbol-sort-key"),s=r.get("symbol-z-order");this.canOverlap=r.get("text-allow-overlap")||r.get("icon-allow-overlap")||r.get("text-ignore-placement")||r.get("icon-ignore-placement"),this.sortFeaturesByKey=s!=="viewport-y"&amp;&amp;n.constantOr(1)!==void 0,this.sortFeaturesByY=(s==="viewport-y"||s==="auto"&amp;&amp;!this.sortFeaturesByKey)&amp;&amp;this.canOverlap,this.writingModes=r.get("text-writing-mode").map(a=&gt;Ti[a]),this.stateDependentLayerIds=this.layers.filter(a=&gt;a.isStateDependent()).map(a=&gt;a.id),this.sourceID=t.sourceID,this.projection=t.projection,this.hasAnyZOffset=!1,this.zOffsetSortDirty=!1,this.zOffsetBuffersNeedUpload=r.get("symbol-z-elevate")}createArrays(){this.text=new u_(new vo(this.layers,this.zoom,t=&gt;/^text/.test(t))),this.icon=new u_(new vo(this.layers,this.zoom,t=&gt;/^icon/.test(t))),this.glyphOffsetArray=new gx,this.lineVertexArray=new yx,this.symbolInstances=new _x}calculateGlyphDependencies(t,i,r,n,s){for(let a=0;a&lt;t.length;a++){const l=t.codePointAt(a);if(l===void 0)break;if(i[l]=!0,n&amp;&amp;s&amp;&amp;l&lt;=65535){const h=Dc[t.charAt(a)];h&amp;&amp;(i[h.charCodeAt(0)]=!0)}}}populate(t,i,r,n){const s=this.layers[0],a=s.layout,l=this.projection.name==="globe",h=a.get("text-font"),d=a.get("text-field"),f=a.get("icon-image"),m=(d.value.kind!=="constant"||d.value.value instanceof Xr&amp;&amp;!d.value.value.isEmpty()||d.value.value.toString().length&gt;0)&amp;&amp;(h.value.kind!=="constant"||h.value.value.length&gt;0),_=f.value.kind!=="constant"||!!f.value.value||Object.keys(f.parameters).length&gt;0,y=a.get("symbol-sort-key");if(this.features=[],!m&amp;&amp;!_)return;const x=i.iconDependencies,b=i.glyphDependencies,w=i.availableImages,T=new Si(this.zoom);for(const{feature:S,id:I,index:P,sourceLayerIndex:M}of t){const C=s._featureFilter.needGeometry,D=Mo(S,C);if(!s._featureFilter.filter(T,D,r))continue;if(C||(D.geometry=fs(S,r,n)),l&amp;&amp;S.type!==1&amp;&amp;r.z&lt;=5){const B=D.geometry,U=.98078528056,Z=(F,Y)=&gt;{const J=Mc(F.x,F.y,r,1),it=Mc(Y.x,Y.y,r,1);return W.dot(J,it)&lt;U};for(let F=0;F&lt;B.length;F++)B[F]=YP(B[F],Z)}let O,k;if(m){const B=s.getValueAndResolveTokens("text-field",D,r,w),U=Xr.factory(B);V3(U)&amp;&amp;(this.hasRTLText=!0),(!this.hasRTLText||Gp()==="unavailable"||this.hasRTLText&amp;&amp;An.isParsed())&amp;&amp;(O=d3(U,s,D))}if(_){const B=s.getValueAndResolveTokens("icon-image",D,r,w);k=B instanceof En?B:En.fromString(B)}if(!O&amp;&amp;!k)continue;const z=this.sortFeaturesByKey?y.evaluate(D,{},r):void 0;if(this.features.push({id:I,text:O,icon:k,index:P,sourceLayerIndex:M,geometry:D.geometry,properties:S.properties,type:N3[S.type],sortKey:z}),k&amp;&amp;(x[k.namePrimary]=!0,k.nameSecondary&amp;&amp;(x[k.nameSecondary]=!0)),O){const B=h.evaluate(D,{},r).join(","),U=a.get("text-rotation-alignment")==="map"&amp;&amp;a.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&amp;&amp;this.writingModes.indexOf(Ti.vertical)&gt;=0;for(const Z of O.sections)if(Z.image)x[Z.image.namePrimary]=!0;else{const F=kp(O.toString()),Y=Z.fontStack||B,J=b[Y]=b[Y]||{};this.calculateGlyphDependencies(Z.text,J,U,this.allowVerticalPlacement,F)}}}a.get("symbol-placement")==="line"&amp;&amp;(this.features=function(S){const I={},P={},M=[];let C=0;function D(B){M.push(S[B]),C++}function O(B,U,Z){const F=P[B];return delete P[B],P[U]=F,M[F].geometry[0].pop(),M[F].geometry[0]=M[F].geometry[0].concat(Z[0]),F}function k(B,U,Z){const F=I[U];return delete I[U],I[B]=F,M[F].geometry[0].shift(),M[F].geometry[0]=Z[0].concat(M[F].geometry[0]),F}function z(B,U,Z){const F=Z?U[0][U[0].length-1]:U[0][0];return`${B}:${F.x}:${F.y}`}for(let B=0;B&lt;S.length;B++){const U=S[B],Z=U.geometry,F=U.text?U.text.toString():null;if(!F){D(B);continue}const Y=z(F,Z),J=z(F,Z,!0);if(Y in P&amp;&amp;J in I&amp;&amp;P[Y]!==I[J]){const it=k(Y,J,Z),X=O(Y,J,M[it].geometry);delete I[Y],delete P[J],P[z(F,M[X].geometry,!0)]=X,M[it].geometry=null}else Y in P?O(Y,J,Z):J in I?k(Y,J,Z):(D(B),I[Y]=C-1,P[J]=C-1)}return M.filter(B=&gt;B.geometry)}(this.features)),this.sortFeaturesByKey&amp;&amp;this.features.sort((S,I)=&gt;S.sortKey-I.sortKey)}update(t,i,r,n,s){const a=Object.keys(t).length!==0;if(a&amp;&amp;!this.stateDependentLayers.length)return;const l=a?this.stateDependentLayers:this.layers;this.text.programConfigurations.updatePaintArrays(t,i,l,r,n,s),this.icon.programConfigurations.updatePaintArrays(t,i,l,r,n,s)}updateZOffset(){const t=(s,a,l)=&gt;{r+=a,r&gt;s.length&amp;&amp;s.resize(r);for(let h=-a;h&lt;0;h++)s.emplace(h+r,l)},i=(s,a,l)=&gt;{n+=a,n&gt;s.length&amp;&amp;s.resize(n);for(let h=-a;h&lt;0;h++)s.emplace(h+n,l)};if(!this.zOffsetBuffersNeedUpload)return;this.zOffsetBuffersNeedUpload=!1;let r=0,n=0;for(let s=0;s&lt;this.symbolInstances.length;s++){const a=this.symbolInstances.get(s),{numHorizontalGlyphVertices:l,numVerticalGlyphVertices:h,numIconVertices:d}=a,f=a.zOffset,m=d&gt;0;if((l&gt;0||h&gt;0)&amp;&amp;(t(this.text.zOffsetVertexArray,l,f),t(this.text.zOffsetVertexArray,h,f)),m){const{placedIconSymbolIndex:_,verticalPlacedIconSymbolIndex:y}=a;_&gt;=0&amp;&amp;i(this.icon.zOffsetVertexArray,d,f),y&gt;=0&amp;&amp;i(this.icon.zOffsetVertexArray,a.numVerticalIconVertices,f)}}this.text.zOffsetVertexBuffer&amp;&amp;this.text.zOffsetVertexBuffer.updateData(this.text.zOffsetVertexArray),this.icon.zOffsetVertexBuffer&amp;&amp;this.icon.zOffsetVertexBuffer.updateData(this.icon.zOffsetVertexArray)}isEmpty(){return this.symbolInstances.length===0&amp;&amp;!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(t){!this.uploaded&amp;&amp;this.hasDebugData()&amp;&amp;(this.textCollisionBox.upload(t),this.iconCollisionBox.upload(t)),this.text.upload(t,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload,this.zOffsetBuffersNeedUpload),this.icon.upload(t,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload,this.zOffsetBuffersNeedUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}getProjection(){return this.projectionInstance||(this.projectionInstance=Jh(this.projection)),this.projectionInstance}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&amp;&amp;this.destroyDebugData()}addToLineVertexArray(t,i){const r=this.lineVertexArray.length;if(t.segment!==void 0)for(const{x:n,y:s}of i)this.lineVertexArray.emplaceBack(n,s);return{lineStartIndex:r,lineLength:this.lineVertexArray.length-r}}addSymbols(t,i,r,n,s,a,l,h,d,f,m,_,y,x,b,w){const T=t.indexArray,S=t.layoutVertexArray,I=t.globeExtVertexArray,P=t.segments.prepareSegment(4*i.length,S,T,this.canOverlap?a.sortKey:void 0),M=this.glyphOffsetArray.length,C=P.vertexLength,D=this.allowVerticalPlacement&amp;&amp;l===Ti.vertical?Math.PI/2:0,O=a.text&amp;&amp;a.text.sections;for(let z=0;z&lt;i.length;z++){const{tl:B,tr:U,bl:Z,br:F,texPrimary:Y,texSecondary:J,pixelOffsetTL:it,pixelOffsetBR:X,minFontScaleX:K,minFontScaleY:ot,glyphOffset:lt,isSDF:at,sectionIndex:dt}=i[z],ft=P.vertexLength,_t=lt[1];if(td(S,d.x,d.y,B.x,_t+B.y,Y.x,Y.y,r,at,it.x,it.y,K,ot),td(S,d.x,d.y,U.x,_t+U.y,Y.x+Y.w,Y.y,r,at,X.x,it.y,K,ot),td(S,d.x,d.y,Z.x,_t+Z.y,Y.x,Y.y+Y.h,r,at,it.x,X.y,K,ot),td(S,d.x,d.y,F.x,_t+F.y,Y.x+Y.w,Y.y+Y.h,r,at,X.x,X.y,K,ot),h){const{x:ct,y:bt,z:Ot}=h.anchor,[kt,Ht,Zt]=h.up;id(I,ct,bt,Ot,kt,Ht,Zt),id(I,ct,bt,Ot,kt,Ht,Zt),id(I,ct,bt,Ot,kt,Ht,Zt),id(I,ct,bt,Ot,kt,Ht,Zt),yl(t.dynamicLayoutVertexArray,ct,bt,Ot,D)}else yl(t.dynamicLayoutVertexArray,d.x,d.y,d.z,D);if(w){const ct=J||Y;ed(t.iconTransitioningVertexArray,ct.x,ct.y),ed(t.iconTransitioningVertexArray,ct.x+ct.w,ct.y),ed(t.iconTransitioningVertexArray,ct.x,ct.y+ct.h),ed(t.iconTransitioningVertexArray,ct.x+ct.w,ct.y+ct.h)}T.emplaceBack(ft,ft+1,ft+2),T.emplaceBack(ft+1,ft+2,ft+3),P.vertexLength+=4,P.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(lt[0]),z!==i.length-1&amp;&amp;dt===i[z+1].sectionIndex||t.programConfigurations.populatePaintArrays(S.length,a,a.index,{},y,x,b,O&amp;&amp;O[dt])}const k=h?h.anchor:d;t.placedSymbolArray.emplaceBack(k.x,k.y,k.z,d.x,d.y,M,this.glyphOffsetArray.length-M,C,f,m,d.segment,r?r[0]:0,r?r[1]:0,n[0],n[1],l,0,!1,0,_,0)}_commitLayoutVertex(t,i,r,n,s,a,l){t.emplaceBack(i,r,n,s,a,Math.round(l.x),Math.round(l.y))}_addCollisionDebugVertices(t,i,r,n,s,a,l){const h=r.segments.prepareSegment(4,r.layoutVertexArray,r.indexArray),d=h.vertexLength,f=l.tileAnchorX,m=l.tileAnchorY;for(let y=0;y&lt;4;y++)r.collisionVertexArray.emplaceBack(0,0,0,0);this._commitDebugCollisionVertexUpdate(r.collisionVertexArrayExt,i,t.padding,l.zOffset),this._commitLayoutVertex(r.layoutVertexArray,n,s,a,f,m,new Q(t.x1,t.y1)),this._commitLayoutVertex(r.layoutVertexArray,n,s,a,f,m,new Q(t.x2,t.y1)),this._commitLayoutVertex(r.layoutVertexArray,n,s,a,f,m,new Q(t.x2,t.y2)),this._commitLayoutVertex(r.layoutVertexArray,n,s,a,f,m,new Q(t.x1,t.y2)),h.vertexLength+=4;const _=r.indexArray;_.emplaceBack(d,d+1),_.emplaceBack(d+1,d+2),_.emplaceBack(d+2,d+3),_.emplaceBack(d+3,d),h.primitiveLength+=4}_addTextDebugCollisionBoxes(t,i,r,n,s,a){for(let l=n;l&lt;s;l++){const h=r.get(l),d=this.getSymbolInstanceTextSize(t,a,i,l);this._addCollisionDebugVertices(h,d,this.textCollisionBox,h.projectedAnchorX,h.projectedAnchorY,h.projectedAnchorZ,a)}}_addIconDebugCollisionBoxes(t,i,r,n,s,a){for(let l=n;l&lt;s;l++){const h=r.get(l),d=this.getSymbolInstanceIconSize(t,i,a.placedIconSymbolIndex);this._addCollisionDebugVertices(h,d,this.iconCollisionBox,h.projectedAnchorX,h.projectedAnchorY,h.projectedAnchorZ,a)}}generateCollisionDebugBuffers(t,i){this.hasDebugData()&amp;&amp;this.destroyDebugData(),this.textCollisionBox=new h_(fh,q1.members,yo),this.iconCollisionBox=new h_(fh,q1.members,yo);const r=ps(this.iconSizeData,t),n=ps(this.textSizeData,t);for(let s=0;s&lt;this.symbolInstances.length;s++){const a=this.symbolInstances.get(s);this._addTextDebugCollisionBoxes(n,t,i,a.textBoxStartIndex,a.textBoxEndIndex,a),this._addTextDebugCollisionBoxes(n,t,i,a.verticalTextBoxStartIndex,a.verticalTextBoxEndIndex,a),this._addIconDebugCollisionBoxes(r,t,i,a.iconBoxStartIndex,a.iconBoxEndIndex,a),this._addIconDebugCollisionBoxes(r,t,i,a.verticalIconBoxStartIndex,a.verticalIconBoxEndIndex,a)}}getSymbolInstanceTextSize(t,i,r,n){const s=this.text.placedSymbolArray.get(i.rightJustifiedTextSymbolIndex&gt;=0?i.rightJustifiedTextSymbolIndex:i.centerJustifiedTextSymbolIndex&gt;=0?i.centerJustifiedTextSymbolIndex:i.leftJustifiedTextSymbolIndex&gt;=0?i.leftJustifiedTextSymbolIndex:i.verticalPlacedTextSymbolIndex&gt;=0?i.verticalPlacedTextSymbolIndex:n),a=Rc(this.textSizeData,t,s)/dr;return this.tilePixelRatio*a}getSymbolInstanceIconSize(t,i,r){const n=this.icon.placedSymbolArray.get(r),s=Rc(this.iconSizeData,t,n);return this.tilePixelRatio*s}_commitDebugCollisionVertexUpdate(t,i,r,n){t.emplaceBack(i,-r,-r,n),t.emplaceBack(i,r,-r,n),t.emplaceBack(i,r,r,n),t.emplaceBack(i,-r,r,n)}_updateTextDebugCollisionBoxes(t,i,r,n,s,a){for(let l=n;l&lt;s;l++){const h=r.get(l),d=this.getSymbolInstanceTextSize(t,a,i,l);this._commitDebugCollisionVertexUpdate(this.textCollisionBox.collisionVertexArrayExt,d,h.padding,a.zOffset)}}_updateIconDebugCollisionBoxes(t,i,r,n,s,a){for(let l=n;l&lt;s;l++){const h=r.get(l),d=this.getSymbolInstanceIconSize(t,i,a.placedIconSymbolIndex);this._commitDebugCollisionVertexUpdate(this.iconCollisionBox.collisionVertexArrayExt,d,h.padding,a.zOffset)}}updateCollisionDebugBuffers(t,i){if(!this.hasDebugData())return;this.hasTextCollisionBoxData()&amp;&amp;this.textCollisionBox.collisionVertexArrayExt.clear(),this.hasIconCollisionBoxData()&amp;&amp;this.iconCollisionBox.collisionVertexArrayExt.clear();const r=ps(this.iconSizeData,t),n=ps(this.textSizeData,t);for(let s=0;s&lt;this.symbolInstances.length;s++){const a=this.symbolInstances.get(s);this._updateTextDebugCollisionBoxes(n,t,i,a.textBoxStartIndex,a.textBoxEndIndex,a),this._updateTextDebugCollisionBoxes(n,t,i,a.verticalTextBoxStartIndex,a.verticalTextBoxEndIndex,a),this._updateIconDebugCollisionBoxes(r,t,i,a.iconBoxStartIndex,a.iconBoxEndIndex,a),this._updateIconDebugCollisionBoxes(r,t,i,a.verticalIconBoxStartIndex,a.verticalIconBoxEndIndex,a)}this.hasTextCollisionBoxData()&amp;&amp;this.textCollisionBox.collisionVertexBufferExt&amp;&amp;this.textCollisionBox.collisionVertexBufferExt.updateData(this.textCollisionBox.collisionVertexArrayExt),this.hasIconCollisionBoxData()&amp;&amp;this.iconCollisionBox.collisionVertexBufferExt&amp;&amp;this.iconCollisionBox.collisionVertexBufferExt.updateData(this.iconCollisionBox.collisionVertexArrayExt)}_deserializeCollisionBoxesForSymbol(t,i,r,n,s,a,l,h,d){const f={};if(i&lt;r){const{x1:m,y1:_,x2:y,y2:x,padding:b,projectedAnchorX:w,projectedAnchorY:T,projectedAnchorZ:S,tileAnchorX:I,tileAnchorY:P,featureIndex:M}=t.get(i);f.textBox={x1:m,y1:_,x2:y,y2:x,padding:b,projectedAnchorX:w,projectedAnchorY:T,projectedAnchorZ:S,tileAnchorX:I,tileAnchorY:P},f.textFeatureIndex=M}if(n&lt;s){const{x1:m,y1:_,x2:y,y2:x,padding:b,projectedAnchorX:w,projectedAnchorY:T,projectedAnchorZ:S,tileAnchorX:I,tileAnchorY:P,featureIndex:M}=t.get(n);f.verticalTextBox={x1:m,y1:_,x2:y,y2:x,padding:b,projectedAnchorX:w,projectedAnchorY:T,projectedAnchorZ:S,tileAnchorX:I,tileAnchorY:P},f.verticalTextFeatureIndex=M}if(a&lt;l){const{x1:m,y1:_,x2:y,y2:x,padding:b,projectedAnchorX:w,projectedAnchorY:T,projectedAnchorZ:S,tileAnchorX:I,tileAnchorY:P,featureIndex:M}=t.get(a);f.iconBox={x1:m,y1:_,x2:y,y2:x,padding:b,projectedAnchorX:w,projectedAnchorY:T,projectedAnchorZ:S,tileAnchorX:I,tileAnchorY:P},f.iconFeatureIndex=M}if(h&lt;d){const{x1:m,y1:_,x2:y,y2:x,padding:b,projectedAnchorX:w,projectedAnchorY:T,projectedAnchorZ:S,tileAnchorX:I,tileAnchorY:P,featureIndex:M}=t.get(h);f.verticalIconBox={x1:m,y1:_,x2:y,y2:x,padding:b,projectedAnchorX:w,projectedAnchorY:T,projectedAnchorZ:S,tileAnchorX:I,tileAnchorY:P},f.verticalIconFeatureIndex=M}return f}deserializeCollisionBoxes(t){this.collisionArrays=[];for(let i=0;i&lt;this.symbolInstances.length;i++){const r=this.symbolInstances.get(i);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(t,r.textBoxStartIndex,r.textBoxEndIndex,r.verticalTextBoxStartIndex,r.verticalTextBoxEndIndex,r.iconBoxStartIndex,r.iconBoxEndIndex,r.verticalIconBoxStartIndex,r.verticalIconBoxEndIndex))}}hasTextData(){return this.text.segments.get().length&gt;0}hasIconData(){return this.icon.segments.get().length&gt;0}hasDebugData(){return this.textCollisionBox&amp;&amp;this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&amp;&amp;this.textCollisionBox.segments.get().length&gt;0}hasIconCollisionBoxData(){return this.hasDebugData()&amp;&amp;this.iconCollisionBox.segments.get().length&gt;0}hasIconTextFit(){return this.hasAnyIconTextFit}addIndicesForPlacedSymbol(t,i){const r=t.placedSymbolArray.get(i),n=r.vertexStartIndex+4*r.numGlyphs;for(let s=r.vertexStartIndex;s&lt;n;s+=4)t.indexArray.emplaceBack(s,s+1,s+2),t.indexArray.emplaceBack(s+1,s+2,s+3)}getSortedSymbolIndexes(t){if(this.sortedAngle===t&amp;&amp;this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;const i=Math.sin(t),r=Math.cos(t),n=[],s=[],a=[];for(let l=0;l&lt;this.symbolInstances.length;++l){a.push(l);const h=this.symbolInstances.get(l);n.push(0|Math.round(i*h.tileAnchorX+r*h.tileAnchorY)),s.push(h.featureIndex)}return a.sort((l,h)=&gt;n[l]-n[h]||s[h]-s[l]),a}getSortedIndexesByZOffset(){if(!this.zOffsetSortDirty)return this.symbolInstanceIndexesSortedZOffset;if(!this.symbolInstanceIndexesSortedZOffset){this.symbolInstanceIndexesSortedZOffset=[];for(let t=0;t&lt;this.symbolInstances.length;++t)this.symbolInstanceIndexesSortedZOffset.push(t)}return this.zOffsetSortDirty=!1,this.symbolInstanceIndexesSortedZOffset.sort((t,i)=&gt;this.symbolInstances.get(i).zOffset-this.symbolInstances.get(t).zOffset)}addToSortKeyRanges(t,i){const r=this.sortKeyRanges[this.sortKeyRanges.length-1];r&amp;&amp;r.sortKey===i?r.symbolInstanceEnd=t+1:this.sortKeyRanges.push({sortKey:i,symbolInstanceStart:t,symbolInstanceEnd:t+1})}sortFeatures(t){if(this.sortFeaturesByY&amp;&amp;this.sortedAngle!==t&amp;&amp;!(this.text.segments.get().length&gt;1||this.icon.segments.get().length&gt;1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(t),this.sortedAngle=t,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const i of this.symbolInstanceIndexes){const r=this.symbolInstances.get(i);this.featureSortOrder.push(r.featureIndex);const{rightJustifiedTextSymbolIndex:n,centerJustifiedTextSymbolIndex:s,leftJustifiedTextSymbolIndex:a,verticalPlacedTextSymbolIndex:l,placedIconSymbolIndex:h,verticalPlacedIconSymbolIndex:d}=r;n&gt;=0&amp;&amp;this.addIndicesForPlacedSymbol(this.text,n),s&gt;=0&amp;&amp;s!==n&amp;&amp;this.addIndicesForPlacedSymbol(this.text,s),a&gt;=0&amp;&amp;a!==s&amp;&amp;a!==n&amp;&amp;this.addIndicesForPlacedSymbol(this.text,a),l&gt;=0&amp;&amp;this.addIndicesForPlacedSymbol(this.text,l),h&gt;=0&amp;&amp;this.addIndicesForPlacedSymbol(this.icon,h),d&gt;=0&amp;&amp;this.addIndicesForPlacedSymbol(this.icon,d)}this.text.indexBuffer&amp;&amp;this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&amp;&amp;this.icon.indexBuffer.updateData(this.icon.indexArray)}}}Jt(nd,"SymbolBucket",{omit:["layers","collisionBoxArray","features","compareText"]}),nd.MAX_GLYPHS=65535,nd.addDynamicAttributes=yl;var Vc=nd;const j3=ei([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"},{name:"a_linesofar",components:1,type:"Float32"}],4),{members:G3}=j3,H3=ei([{name:"a_packed",components:4,type:"Float32"}]),{members:W3}=H3,q3=Bh.types,Z3=Math.cos(Math.PI/180*37.5);class sd{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(i=&gt;i.fqid),this.index=t.index,this.projection=t.projection,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(i=&gt;{this.gradients[i.id]={}}),this.layoutVertexArray=new qp,this.layoutVertexArray2=new Vs,this.indexArray=new Xi,this.programConfigurations=new vo(t.layers,t.zoom),this.segments=new si,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(i=&gt;i.isStateDependent()).map(i=&gt;i.id)}populate(t,i,r,n){this.hasPattern=Xm("line",this.layers,i);const s=this.layers[0].layout.get("line-sort-key"),a=[];for(const{feature:f,id:m,index:_,sourceLayerIndex:y}of t){const x=this.layers[0]._featureFilter.needGeometry,b=Mo(f,x);if(!this.layers[0]._featureFilter.filter(new Si(this.zoom),b,r))continue;const w=s?s.evaluate(b,{},r):void 0,T={id:m,properties:f.properties,type:f.type,sourceLayerIndex:y,index:_,geometry:x?b.geometry:fs(f,r,n),patterns:{},sortKey:w};a.push(T)}s&amp;&amp;a.sort((f,m)=&gt;f.sortKey-m.sortKey);const{lineAtlas:l,featureIndex:h}=i,d=this.addConstantDashes(l);for(const f of a){const{geometry:m,index:_,sourceLayerIndex:y}=f;if(d&amp;&amp;this.addFeatureDashes(f,l),this.hasPattern){const x=Ym("line",this.layers,f,this.zoom,i);this.patternFeatures.push(x)}else this.addFeature(f,m,_,r,l.positions,i.availableImages,i.brightness);h.insert(t[_].feature,m,_,y,this.index)}}addConstantDashes(t){let i=!1;for(const r of this.layers){const n=r.paint.get("line-dasharray").value,s=r.layout.get("line-cap").value;if(n.kind!=="constant"||s.kind!=="constant")i=!0;else{const a=s.value,l=n.value;if(!l)continue;t.addDash(l,a)}}return i}addFeatureDashes(t,i){const r=this.zoom;for(const n of this.layers){const s=n.paint.get("line-dasharray").value,a=n.layout.get("line-cap").value;if(s.kind==="constant"&amp;&amp;a.kind==="constant")continue;let l,h;if(s.kind==="constant"){if(l=s.value,!l)continue}else l=s.evaluate({zoom:r},t);h=a.kind==="constant"?a.value:a.evaluate({zoom:r},t),i.addDash(l,h),t.patterns[n.id]=i.getKey(l,h)}}update(t,i,r,n,s){const a=Object.keys(t).length!==0;a&amp;&amp;!this.stateDependentLayers.length||this.programConfigurations.updatePaintArrays(t,i,a?this.stateDependentLayers:this.layers,r,n,s)}addFeatures(t,i,r,n,s,a){for(const l of this.patternFeatures)this.addFeature(l,l.geometry,l.index,i,r,n,a)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexArray2.length!==0&amp;&amp;(this.layoutVertexBuffer2=t.createVertexBuffer(this.layoutVertexArray2,W3)),this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,G3),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&amp;&amp;(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(t){if(t.properties&amp;&amp;t.properties.hasOwnProperty("mapbox_clip_start")&amp;&amp;t.properties.hasOwnProperty("mapbox_clip_end"))return{start:+t.properties.mapbox_clip_start,end:+t.properties.mapbox_clip_end}}addFeature(t,i,r,n,s,a,l){const h=this.layers[0].layout,d=h.get("line-join").evaluate(t,{}),f=h.get("line-cap").evaluate(t,{}),m=h.get("line-miter-limit"),_=h.get("line-round-limit");this.lineClips=this.lineFeatureClips(t);for(const y of i)this.addLine(y,t,d,f,m,_);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,r,s,a,n,l)}addLine(t,i,r,n,s,a){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineSoFar=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let T=0;T&lt;t.length-1;T++)this.totalDistance+=t[T].dist(t[T+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}const l=q3[i.type]==="Polygon";let h=t.length;for(;h&gt;=2&amp;&amp;t[h-1].equals(t[h-2]);)h--;let d=0;for(;d&lt;h-1&amp;&amp;t[d].equals(t[d+1]);)d++;if(h&lt;(l?3:2))return;r==="bevel"&amp;&amp;(s=1.05);const f=this.overscaling&lt;=16?15*ut/(512*this.overscaling):0,m=this.segments.prepareSegment(10*h,this.layoutVertexArray,this.indexArray);let _,y,x,b,w;this.e1=this.e2=-1,l&amp;&amp;(_=t[h-2],w=t[d].sub(_)._unit()._perp());for(let T=d;T&lt;h;T++){if(x=T===h-1?l?t[d+1]:void 0:t[T+1],x&amp;&amp;t[T].equals(x))continue;w&amp;&amp;(b=w),_&amp;&amp;(y=_),_=t[T],w=x?x.sub(_)._unit()._perp():b,b=b||w;let S=b.add(w);S.x===0&amp;&amp;S.y===0||S._unit();const I=b.x*w.x+b.y*w.y,P=S.x*w.x+S.y*w.y,M=P!==0?1/P:1/0,C=2*Math.sqrt(2-2*P),D=P&lt;Z3&amp;&amp;y&amp;&amp;x,O=b.x*w.y-b.y*w.x&gt;0;if(D&amp;&amp;T&gt;d){const B=_.dist(y);if(B&gt;2*f){const U=_.sub(_.sub(y)._mult(f/B)._round());this.updateDistance(y,U),this.addCurrentVertex(U,b,0,0,m),y=U}}const k=y&amp;&amp;x;let z=k?r:l?"butt":n;if(k&amp;&amp;z==="round"&amp;&amp;(M&lt;a?z="miter":M&lt;=2&amp;&amp;(z="fakeround")),z==="miter"&amp;&amp;M&gt;s&amp;&amp;(z="bevel"),z==="bevel"&amp;&amp;(M&gt;2&amp;&amp;(z="flipbevel"),M&lt;s&amp;&amp;(z="miter")),y&amp;&amp;this.updateDistance(y,_),z==="miter")S._mult(M),this.addCurrentVertex(_,S,0,0,m);else if(z==="flipbevel"){if(M&gt;100)S=w.mult(-1);else{const B=M*b.add(w).mag()/b.sub(w).mag();S._perp()._mult(B*(O?-1:1))}this.addCurrentVertex(_,S,0,0,m),this.addCurrentVertex(_,S.mult(-1),0,0,m)}else if(z==="bevel"||z==="fakeround"){const B=-Math.sqrt(M*M-1),U=O?B:0,Z=O?0:B;if(y&amp;&amp;this.addCurrentVertex(_,b,U,Z,m),z==="fakeround"){const F=Math.round(180*C/Math.PI/20);for(let Y=1;Y&lt;F;Y++){let J=Y/F;if(J!==.5){const X=J-.5;J+=J*X*(J-1)*((1.0904+I*(I*(3.55645-1.43519*I)-3.2452))*X*X+(.848013+I*(.215638*I-1.06021)))}const it=w.sub(b)._mult(J)._add(b)._unit()._mult(O?-1:1);this.addHalfVertex(_,it.x,it.y,!1,O,0,m)}}x&amp;&amp;this.addCurrentVertex(_,w,-U,-Z,m)}else if(z==="butt")this.addCurrentVertex(_,S,0,0,m);else if(z==="square"){const B=y?1:-1;y||this.addCurrentVertex(_,S,B,B,m),this.addCurrentVertex(_,S,0,0,m),y&amp;&amp;this.addCurrentVertex(_,S,B,B,m)}else z==="round"&amp;&amp;(y&amp;&amp;(this.addCurrentVertex(_,b,0,0,m),this.addCurrentVertex(_,b,1,1,m,!0)),x&amp;&amp;(this.addCurrentVertex(_,w,-1,-1,m,!0),this.addCurrentVertex(_,w,0,0,m)));if(D&amp;&amp;T&lt;h-1){const B=_.dist(x);if(B&gt;2*f){const U=_.add(x.sub(_)._mult(f/B)._round());this.updateDistance(_,U),this.addCurrentVertex(U,w,0,0,m),_=U}}}}addCurrentVertex(t,i,r,n,s,a=!1){const l=i.y*n-i.x,h=-i.y-i.x*n;this.addHalfVertex(t,i.x+i.y*r,i.y-i.x*r,a,!1,r,s),this.addHalfVertex(t,l,h,a,!0,-n,s)}addHalfVertex({x:t,y:i},r,n,s,a,l,h){this.layoutVertexArray.emplaceBack((t&lt;&lt;1)+(s?1:0),(i&lt;&lt;1)+(a?1:0),Math.round(63*r)+128,Math.round(63*n)+128,1+(l===0?0:l&lt;0?-1:1),0,this.lineSoFar),this.lineClips&amp;&amp;this.layoutVertexArray2.emplaceBack(this.scaledDistance,this.lineClipsArray.length,this.lineClips.start,this.lineClips.end);const d=h.vertexLength++;this.e1&gt;=0&amp;&amp;this.e2&gt;=0&amp;&amp;(this.indexArray.emplaceBack(this.e1,this.e2,d),h.primitiveLength++),a?this.e2=d:this.e1=d}updateScaledDistance(){if(this.lineClips){const t=this.totalDistance/(this.lineClips.end-this.lineClips.start);this.scaledDistance=this.distance/this.totalDistance,this.lineSoFar=t*this.lineClips.start+this.distance}else this.lineSoFar=this.distance}updateDistance(t,i){this.distance+=t.dist(i),this.updateScaledDistance()}}Jt(sd,"LineBucket",{omit:["layers","patternFeatures"]});class Ii{constructor(t,i,r,n){this.context=t,this.format=r,this.texture=t.gl.createTexture(),this.update(i,n)}update(t,i,r){const{width:n,height:s}=t,{context:a}=this,{gl:l}=a,{HTMLImageElement:h,HTMLCanvasElement:d,HTMLVideoElement:f,ImageData:m,ImageBitmap:_}=L;if(l.bindTexture(l.TEXTURE_2D,this.texture),a.pixelStoreUnpackFlipY.set(!1),a.pixelStoreUnpack.set(1),a.pixelStoreUnpackPremultiplyAlpha.set(this.format===l.RGBA&amp;&amp;(!i||i.premultiply!==!1)),r||this.size&amp;&amp;this.size[0]===n&amp;&amp;this.size[1]===s){const{x:y,y:x}=r||{x:0,y:0};if(t instanceof h||t instanceof d||t instanceof f||t instanceof m||_&amp;&amp;t instanceof _)l.texSubImage2D(l.TEXTURE_2D,0,y,x,l.RGBA,l.UNSIGNED_BYTE,t);else{let b=this.format,w=l.UNSIGNED_BYTE;this.format===l.R32F&amp;&amp;(b=l.RED,w=l.FLOAT),l.texSubImage2D(l.TEXTURE_2D,0,y,x,n,s,b,w,t.data)}}else if(this.size=[n,s],t instanceof h||t instanceof d||t instanceof f||t instanceof m||_&amp;&amp;t instanceof _){let y=this.format;this.format===l.R8&amp;&amp;(y=l.RED),l.texImage2D(l.TEXTURE_2D,0,this.format,y,l.UNSIGNED_BYTE,t)}else{let y=this.format,x=this.format,b=l.UNSIGNED_BYTE;this.format===l.DEPTH_COMPONENT&amp;&amp;(y=l.DEPTH_COMPONENT16,b=l.UNSIGNED_SHORT),this.format===l.R32F&amp;&amp;(b=l.FLOAT,x=l.RED),l.texImage2D(l.TEXTURE_2D,0,y,n,s,0,x,b,t.data)}this.useMipmap=!!(i&amp;&amp;i.useMipmap),this.useMipmap&amp;&amp;l.generateMipmap(l.TEXTURE_2D)}bind(t,i){const{context:r}=this,{gl:n}=r;n.bindTexture(n.TEXTURE_2D,this.texture),t!==this.minFilter&amp;&amp;(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,t),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,this.useMipmap?t===n.NEAREST?n.NEAREST_MIPMAP_NEAREST:n.LINEAR_MIPMAP_NEAREST:t),this.minFilter=t),i!==this.wrapS&amp;&amp;(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,i),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,i),this.wrapS=i)}bindExtraParam(t,i,r,n){const{context:s}=this,{gl:a}=s;a.bindTexture(a.TEXTURE_2D,this.texture),i!==this.magFilter&amp;&amp;(a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MAG_FILTER,i),this.magFilter=i),t!==this.minFilter&amp;&amp;(a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,this.useMipmap?t===a.NEAREST?a.NEAREST_MIPMAP_NEAREST:a.LINEAR_MIPMAP_NEAREST:t),this.minFilter=t),r!==this.wrapS&amp;&amp;(a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_S,r),this.wrapS=r),n!==this.wrapT&amp;&amp;(a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_T,n),this.wrapT=n)}destroy(){const{gl:t}=this.context;t.deleteTexture(this.texture),this.texture=null}}class od{constructor(t,i){this.context=t,this.texture=i}bind(t,i){const{context:r}=this,{gl:n}=r;n.bindTexture(n.TEXTURE_2D,this.texture),t!==this.minFilter&amp;&amp;(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,t),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,t),this.minFilter=t),i!==this.wrapS&amp;&amp;(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,i),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,i),this.wrapS=i)}}const Ln=32,ms=33,Do=new Uint16Array(8184);for(let e=0;e&lt;2046;e++){let t=e+2,i=0,r=0,n=0,s=0,a=0,l=0;for(1&amp;t?n=s=a=Ln:i=r=l=Ln;(t&gt;&gt;=1)&gt;1;){const d=i+n&gt;&gt;1,f=r+s&gt;&gt;1;1&amp;t?(n=i,s=r,i=a,r=l):(i=n,r=s,n=a,s=l),a=d,l=f}const h=4*e;Do[h+0]=i,Do[h+1]=r,Do[h+2]=n,Do[h+3]=s}const _s=new Uint16Array(2178),Oo=new Uint8Array(1089),ad=new Uint16Array(1089);function Tb(e){return e===0?-.03125:e===32?.03125:0}var d_=ei([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);const Eb={type:2,extent:ut,loadGeometry:()=&gt;[[new Q(0,0),new Q(ut+1,0),new Q(ut+1,ut+1),new Q(0,ut+1),new Q(0,0)]]};class jc{constructor(t,i,r,n,s){this.tileID=t,this.uid=ar(),this.uses=0,this.tileSize=i,this.tileZoom=r,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.isRaster=s,n&amp;&amp;n.style&amp;&amp;(this._lastUpdatedBrightness=n.style.getBrightness()),this.expiredRequestCount=0,this.state="loading",n&amp;&amp;n.transform&amp;&amp;(this.projection=n.transform.projection)}registerFadeDuration(t){const i=t+this.timeAdded;i&lt;_e.now()||this.fadeEndTime&amp;&amp;i&lt;this.fadeEndTime||(this.fadeEndTime=i)}wasRequested(){return this.state==="errored"||this.state==="loaded"||this.state==="reloading"}get tileTransform(){return this._tileTransform||(this._tileTransform=da(this.tileID.canonical,this.projection)),this._tileTransform}loadVectorData(t,i,r){if(this.unloadVectorData(),this.state="loaded",t){t.featureIndex&amp;&amp;(this.latestFeatureIndex=t.featureIndex,t.rawTileData?(this.latestRawTileData=t.rawTileData,this.latestFeatureIndex.rawTileData=t.rawTileData):this.latestRawTileData&amp;&amp;(this.latestFeatureIndex.rawTileData=this.latestRawTileData)),this.collisionBoxArray=t.collisionBoxArray,this.buckets=function(n,s){const a={};if(!s)return a;for(const l of n){const h=l.layerIds.map(d=&gt;s.getLayer(d)).filter(Boolean);if(h.length!==0){l.layers=h,l.stateDependentLayerIds&amp;&amp;(l.stateDependentLayers=l.stateDependentLayerIds.map(d=&gt;h.filter(f=&gt;f.id===d)[0]));for(const d of h)a[d.fqid]=l}}return a}(t.buckets,i.style),this.hasSymbolBuckets=!1;for(const n in this.buckets){const s=this.buckets[n];if(s instanceof Vc){if(this.hasSymbolBuckets=!0,!r)break;s.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const n in this.buckets){const s=this.buckets[n];if(s instanceof Vc&amp;&amp;s.hasRTLText){this.hasRTLText=!0,An.isLoading()||An.isLoaded()||Gp()!=="deferred"||ox();break}}this.queryPadding=0;for(const n in this.buckets){const s=this.buckets[n],a=i.style.getOwnLayer(n);if(!a)continue;const l=a.queryRadius(s);this.queryPadding=Math.max(this.queryPadding,l)}t.imageAtlas&amp;&amp;(this.imageAtlas=t.imageAtlas),t.glyphAtlasImage&amp;&amp;(this.glyphAtlasImage=t.glyphAtlasImage),t.lineAtlas&amp;&amp;(this.lineAtlas=t.lineAtlas),this._lastUpdatedBrightness=t.brightness}else this.collisionBoxArray=new sm}unloadVectorData(){if(this.hasData()){for(const t in this.buckets)this.buckets[t].destroy();this.buckets={},this.imageAtlas&amp;&amp;(this.imageAtlas=null),this.lineAtlas&amp;&amp;(this.lineAtlas=null),this.imageAtlasTexture&amp;&amp;this.imageAtlasTexture.destroy(),this.glyphAtlasTexture&amp;&amp;this.glyphAtlasTexture.destroy(),this.lineAtlasTexture&amp;&amp;this.lineAtlasTexture.destroy(),this._tileBoundsBuffer&amp;&amp;(this._tileBoundsBuffer.destroy(),this._tileBoundsIndexBuffer.destroy(),this._tileBoundsSegments.destroy(),this._tileBoundsBuffer=null),this._tileDebugBuffer&amp;&amp;(this._tileDebugBuffer.destroy(),this._tileDebugSegments.destroy(),this._tileDebugBuffer=null),this._tileDebugIndexBuffer&amp;&amp;(this._tileDebugIndexBuffer.destroy(),this._tileDebugIndexBuffer=null),this._globeTileDebugBorderBuffer&amp;&amp;(this._globeTileDebugBorderBuffer.destroy(),this._globeTileDebugBorderBuffer=null),this._tileDebugTextBuffer&amp;&amp;(this._tileDebugTextBuffer.destroy(),this._tileDebugTextSegments.destroy(),this._tileDebugTextIndexBuffer.destroy(),this._tileDebugTextBuffer=null),this._globeTileDebugTextBuffer&amp;&amp;(this._globeTileDebugTextBuffer.destroy(),this._globeTileDebugTextBuffer=null),this.latestFeatureIndex=null,this.state="unloaded"}}getBucket(t){return this.buckets[t.fqid]}upload(t){for(const r in this.buckets){const n=this.buckets[r];n.uploadPending()&amp;&amp;n.upload(t)}const i=t.gl;this.imageAtlas&amp;&amp;!this.imageAtlas.uploaded&amp;&amp;(this.imageAtlasTexture=new Ii(t,this.imageAtlas.image,i.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&amp;&amp;(this.glyphAtlasTexture=new Ii(t,this.glyphAtlasImage,i.ALPHA),this.glyphAtlasImage=null),this.lineAtlas&amp;&amp;!this.lineAtlas.uploaded&amp;&amp;(this.lineAtlasTexture=new Ii(t,this.lineAtlas.image,i.ALPHA),this.lineAtlas.uploaded=!0)}prepare(t,i,r){if(this.imageAtlas&amp;&amp;this.imageAtlasTexture&amp;&amp;this.imageAtlas.patchUpdatedImages(t,this.imageAtlasTexture,r),!i||!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData)return;const n=i.style.getBrightness();(this._lastUpdatedBrightness||n)&amp;&amp;(this._lastUpdatedBrightness&amp;&amp;n&amp;&amp;Math.abs(this._lastUpdatedBrightness-n)&lt;.001||(this._lastUpdatedBrightness=n,this.updateBuckets(void 0,i)))}queryRenderedFeatures(t,i,r,n,s,a,l,h){return this.latestFeatureIndex&amp;&amp;this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({tileResult:n,pixelPosMatrix:l,transform:a,params:s,tileTransform:this.tileTransform},t,i,r):{}}querySourceFeatures(t,i){const r=this.latestFeatureIndex;if(!r||!r.rawTileData)return;const n=r.loadVTLayers(),s=i?i.sourceLayer:"",a=n._geojsonTileLayer||n[s];if(!a)return;const l=eh(i&amp;&amp;i.filter),{z:h,x:d,y:f}=this.tileID.canonical,m={z:h,x:d,y:f};for(let _=0;_&lt;a.length;_++){const y=a.feature(_);if(l.needGeometry){const w=Mo(y,!0);if(!l.filter(new Si(this.tileID.overscaledZ),w,this.tileID.canonical))continue}else if(!l.filter(new Si(this.tileID.overscaledZ),y))continue;const x=r.getId(y,s),b=new F1(y,h,d,f,x);b.tile=m,t.push(b)}}hasData(){return this.state==="loaded"||this.state==="reloading"||this.state==="expired"}bucketsLoaded(){for(const t in this.buckets)if(this.buckets[t].uploadPending())return!1;return!0}patternsLoaded(){return!!this.imageAtlas&amp;&amp;!!Object.keys(this.imageAtlas.patternPositions).length}setExpiryData(t){const i=this.expirationTime;if(t.cacheControl){const r=se(t.cacheControl);r["max-age"]&amp;&amp;(this.expirationTime=Date.now()+1e3*r["max-age"])}else t.expires&amp;&amp;(this.expirationTime=new Date(t.expires).getTime());if(this.expirationTime){const r=Date.now();let n=!1;if(this.expirationTime&gt;r)n=!1;else if(i)if(this.expirationTime&lt;i)n=!0;else{const s=this.expirationTime-i;s?this.expirationTime=r+Math.max(s,3e4):n=!0}else n=!0;n?(this.expiredRequestCount++,this.state="expired"):this.expiredRequestCount=0}}getExpiryTimeout(){if(this.expirationTime)return this.expiredRequestCount?1e3*(1&lt;&lt;Math.min(this.expiredRequestCount-1,31)):Math.min(this.expirationTime-new Date().getTime(),Math.pow(2,31)-1)}setFeatureState(t,i){this.latestFeatureIndex&amp;&amp;this.latestFeatureIndex.rawTileData&amp;&amp;Object.keys(t).length!==0&amp;&amp;i&amp;&amp;this.updateBuckets(t,i)}updateBuckets(t,i){if(!this.latestFeatureIndex)return;const r=this.latestFeatureIndex.loadVTLayers(),n=i.style.listImages(),s=i.style.getBrightness();for(const a in this.buckets){if(!i.style.hasLayer(a))continue;const l=this.buckets[a],h=l.layers[0].sourceLayer||"_geojsonTileLayer",d=r[h];let f={};if(t&amp;&amp;(f=t[h],!d||!f||Object.keys(f).length===0))continue;if(l.update(f,d,n,this.imageAtlas&amp;&amp;this.imageAtlas.patternPositions||{},s),l instanceof sd||l instanceof zh){const _=i.style.getOwnSourceCache(l.layers[0].source);i._terrain&amp;&amp;i._terrain.enabled&amp;&amp;_&amp;&amp;l.programConfigurations.needsUpload&amp;&amp;i._terrain._clearRenderCacheForTile(_.id,this.tileID)}const m=i&amp;&amp;i.style&amp;&amp;i.style.getOwnLayer(a);m&amp;&amp;(this.queryPadding=Math.max(this.queryPadding,m.queryRadius(l)))}}holdingForFade(){return this.symbolFadeHoldUntil!==void 0}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil&lt;_e.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0}setHoldDuration(t){this.symbolFadeHoldUntil=_e.now()+t}setTexture(t,i){const r=i.context,n=r.gl;this.texture=this.texture||i.getTileTexture(t.width),this.texture&amp;&amp;this.texture instanceof Ii?this.texture.update(t,{useMipmap:!0}):(this.texture=new Ii(r,t,n.RGBA,{useMipmap:!0}),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE))}setDependencies(t,i){const r={};for(const n of i)r[n]=!0;this.dependencies[t]=r}hasDependency(t,i){for(const r of t){const n=this.dependencies[r];if(n){for(const s of i)if(n[s])return!0}}return!1}clearQueryDebugViz(){}_makeDebugTileBoundsBuffers(t,i){if(!i||i.name==="mercator"||this._tileDebugBuffer)return;const r=fs(Eb,this.tileID.canonical,this.tileTransform)[0],n=new Kr,s=new vc;for(let a=0;a&lt;r.length;a++){const{x:l,y:h}=r[a];n.emplaceBack(l,h),s.emplaceBack(a)}s.emplaceBack(0),this._tileDebugIndexBuffer=t.createIndexBuffer(s),this._tileDebugBuffer=t.createVertexBuffer(n,wo.members),this._tileDebugSegments=si.simpleSegment(0,0,n.length,s.length)}_makeTileBoundsBuffers(t,i){if(this._tileBoundsBuffer||!i||i.name==="mercator")return;const r=fs(Eb,this.tileID.canonical,this.tileTransform)[0];let n,s;if(this.isRaster){const a=function(l,h){const d=da(l,h),f=Math.pow(2,l.z);for(let w=0;w&lt;ms;w++)for(let T=0;T&lt;ms;T++){const S=tn((l.x+(T+Tb(T))/Ln)/f),I=Yi((l.y+(w+Tb(w))/Ln)/f),P=h.project(S,I),M=w*ms+T;_s[2*M+0]=Math.round((P.x*d.scale-d.x)*ut),_s[2*M+1]=Math.round((P.y*d.scale-d.y)*ut)}Oo.fill(0),ad.fill(0);for(let w=2045;w&gt;=0;w--){const T=4*w,S=Do[T+0],I=Do[T+1],P=Do[T+2],M=Do[T+3],C=S+P&gt;&gt;1,D=I+M&gt;&gt;1,O=C+D-I,k=D+S-C,z=I*ms+S,B=M*ms+P,U=D*ms+C,Z=Math.hypot((_s[2*z+0]+_s[2*B+0])/2-_s[2*U+0],(_s[2*z+1]+_s[2*B+1])/2-_s[2*U+1])&gt;=16;Oo[U]=Oo[U]||(Z?1:0),w&lt;1022&amp;&amp;(Oo[U]=Oo[U]||Oo[(I+k&gt;&gt;1)*ms+(S+O&gt;&gt;1)]||Oo[(M+k&gt;&gt;1)*ms+(P+O&gt;&gt;1)])}const m=new sa,_=new Xi;let y=0;function x(w,T){const S=T*ms+w;return ad[S]===0&amp;&amp;(m.emplaceBack(_s[2*S+0],_s[2*S+1],w*ut/Ln,T*ut/Ln),ad[S]=++y),ad[S]-1}function b(w,T,S,I,P,M){const C=w+S&gt;&gt;1,D=T+I&gt;&gt;1;if(Math.abs(w-P)+Math.abs(T-M)&gt;1&amp;&amp;Oo[D*ms+C])b(P,M,w,T,C,D),b(S,I,P,M,C,D);else{const O=x(w,T),k=x(S,I),z=x(P,M);_.emplaceBack(O,k,z)}}return b(0,0,Ln,Ln,Ln,0),b(Ln,Ln,0,0,0,Ln),{vertices:m,indices:_}}(this.tileID.canonical,i);n=a.vertices,s=a.indices}else{n=new sa,s=new Xi;for(const{x:l,y:h}of r)n.emplaceBack(l,h,0,0);const a=kh(n.int16,void 0,4);for(let l=0;l&lt;a.length;l+=3)s.emplaceBack(a[l],a[l+1],a[l+2])}this._tileBoundsBuffer=t.createVertexBuffer(n,d_.members),this._tileBoundsIndexBuffer=t.createIndexBuffer(s),this._tileBoundsSegments=si.simpleSegment(0,0,n.length,s.length)}_makeGlobeTileDebugBuffers(t,i){const r=i.projection;if(!r||r.name!=="globe"||i.freezeTileCoverage)return;const n=this.tileID.canonical,s=Eo($v(n,i)),a=hr(i.zoom);let l;a&gt;0&amp;&amp;(l=nt.invert(new Float64Array(16),i.globeMatrix)),this._makeGlobeTileDebugBorderBuffer(t,n,i,s,l,a),this._makeGlobeTileDebugTextBuffer(t,n,i,s,l,a)}_globePoint(t,i,r,n,s,a,l){let h=Mc(t,i,r);if(a){const d=1&lt;&lt;r.z,f=er(n.center.lng),m=sr(n.center.lat),_=(r.x+.5)/d-f;let y=0;_&gt;.5?y=-1:_&lt;-.5&amp;&amp;(y=1);let x=(t/ut+r.x)/d+y,b=(i/ut+r.y)/d;x=(x-f)*n._pixelsPerMercatorPixel+f,b=(b-m)*n._pixelsPerMercatorPixel+m;const w=[x*n.worldSize,b*n.worldSize,0];W.transformMat4(w,w,a),h=Xs(h,w,l)}return W.transformMat4(h,h,s)}_makeGlobeTileDebugBorderBuffer(t,i,r,n,s,a){const l=new Kr,h=new vc,d=new uh,f=(_,y,x,b,w)=&gt;{const T=(x-_)/(w-1),S=(b-y)/(w-1),I=l.length;for(let P=0;P&lt;w;P++){const M=_+P*T,C=y+P*S;l.emplaceBack(M,C);const D=this._globePoint(M,C,i,r,n,s,a);d.emplaceBack(D[0],D[1],D[2]),h.emplaceBack(I+P)}},m=ut;f(0,0,m,0,16),f(m,0,m,m,16),f(m,m,0,m,16),f(0,m,0,0,16),this._tileDebugIndexBuffer=t.createIndexBuffer(h),this._tileDebugBuffer=t.createVertexBuffer(l,wo.members),this._globeTileDebugBorderBuffer=t.createVertexBuffer(d,Vv.members),this._tileDebugSegments=si.simpleSegment(0,0,l.length,h.length)}_makeGlobeTileDebugTextBuffer(t,i,r,n,s,a){const l=ut/4,h=new Kr,d=new Xi,f=new uh,m=25;d.reserve(32),h.reserve(m),f.reserve(m);const _=(y,x)=&gt;m*y+x;for(let y=0;y&lt;m;y++){const x=y*l;for(let b=0;b&lt;m;b++){const w=b*l;h.emplaceBack(w,x);const T=this._globePoint(w,x,i,r,n,s,a);f.emplaceBack(T[0],T[1],T[2])}}for(let y=0;y&lt;4;y++)for(let x=0;x&lt;4;x++){const b=_(y,x),w=_(y,x+1),T=_(y+1,x),S=_(y+1,x+1);d.emplaceBack(b,w,T),d.emplaceBack(T,w,S)}this._tileDebugTextIndexBuffer=t.createIndexBuffer(d),this._tileDebugTextBuffer=t.createVertexBuffer(h,wo.members),this._globeTileDebugTextBuffer=t.createVertexBuffer(f,Vv.members),this._tileDebugTextSegments=si.simpleSegment(0,0,m,32)}destroy(t=!1){for(const i in this.buckets)this.buckets[i].destroy();this.buckets={},this.imageAtlas&amp;&amp;(this.imageAtlas=null),this.lineAtlas&amp;&amp;(this.lineAtlas=null),this.imageAtlasTexture&amp;&amp;(this.imageAtlasTexture.destroy(),delete this.imageAtlasTexture),this.glyphAtlasTexture&amp;&amp;(this.glyphAtlasTexture.destroy(),delete this.glyphAtlasTexture),this.lineAtlasTexture&amp;&amp;(this.lineAtlasTexture.destroy(),delete this.lineAtlasTexture),this._tileBoundsBuffer&amp;&amp;(this._tileBoundsBuffer.destroy(),this._tileBoundsIndexBuffer.destroy(),this._tileBoundsSegments.destroy(),this._tileBoundsBuffer=null),this._tileDebugBuffer&amp;&amp;(this._tileDebugBuffer.destroy(),this._tileDebugSegments.destroy(),this._tileDebugBuffer=null),this._tileDebugIndexBuffer&amp;&amp;(this._tileDebugIndexBuffer.destroy(),this._tileDebugIndexBuffer=null),this._globeTileDebugBorderBuffer&amp;&amp;(this._globeTileDebugBorderBuffer.destroy(),this._globeTileDebugBorderBuffer=null),this._tileDebugTextBuffer&amp;&amp;(this._tileDebugTextBuffer.destroy(),this._tileDebugTextSegments.destroy(),this._tileDebugTextIndexBuffer.destroy(),this._tileDebugTextBuffer=null),this._globeTileDebugTextBuffer&amp;&amp;(this._globeTileDebugTextBuffer.destroy(),this._globeTileDebugTextBuffer=null),!t&amp;&amp;this.texture&amp;&amp;this.texture instanceof Ii&amp;&amp;(this.texture.destroy(),delete this.texture),this.hillshadeFBO&amp;&amp;(this.hillshadeFBO.destroy(),delete this.hillshadeFBO),this.dem&amp;&amp;delete this.dem,this.neighboringTiles&amp;&amp;delete this.neighboringTiles,this.demTexture&amp;&amp;(this.demTexture.destroy(),delete this.demTexture),this.latestFeatureIndex=null,this.state="unloaded"}}class $3{constructor(t,i){this.max=t,this.onRemove=i,this.reset()}reset(){for(const t in this.data)for(const i of this.data[t])i.timeout&amp;&amp;clearTimeout(i.timeout),this.onRemove(i.value);return this.data={},this.order=[],this}add(t,i,r){const n=t.wrapped().key;this.data[n]===void 0&amp;&amp;(this.data[n]=[]);const s={value:i,timeout:void 0};if(r!==void 0&amp;&amp;(s.timeout=setTimeout(()=&gt;{this.remove(t,s)},r)),this.data[n].push(s),this.order.push(n),this.order.length&gt;this.max){const a=this._getAndRemoveByKey(this.order[0]);a&amp;&amp;this.onRemove(a)}return this}has(t){return t.wrapped().key in this.data}getAndRemove(t){return this.has(t)?this._getAndRemoveByKey(t.wrapped().key):null}_getAndRemoveByKey(t){const i=this.data[t].shift();return i.timeout&amp;&amp;clearTimeout(i.timeout),this.data[t].length===0&amp;&amp;delete this.data[t],this.order.splice(this.order.indexOf(t),1),i.value}getByKey(t){const i=this.data[t];return i?i[0].value:null}get(t){return this.has(t)?this.data[t.wrapped().key][0].value:null}remove(t,i){if(!this.has(t))return this;const r=t.wrapped().key,n=i===void 0?0:this.data[r].indexOf(i),s=this.data[r][n];return this.data[r].splice(n,1),s.timeout&amp;&amp;clearTimeout(s.timeout),this.data[r].length===0&amp;&amp;delete this.data[r],this.onRemove(s.value),this.order.splice(this.order.indexOf(r),1),this}setMaxSize(t){for(this.max=t;this.order.length&gt;this.max;){const i=this._getAndRemoveByKey(this.order[0]);i&amp;&amp;this.onRemove(i)}return this}filter(t){const i=[];for(const r in this.data)for(const n of this.data[r])t(n.value)||i.push(n);for(const r of i)this.remove(r.value.tileID,r)}}class ko{constructor(t,i,r,n){this.id=ko.uniqueIdxCounter,ko.uniqueIdxCounter++,this.context=t;const s=t.gl;this.buffer=s.createBuffer(),this.dynamicDraw=!!r,this.context.unbindVAO(),t.bindElementBuffer.set(this.buffer),s.bufferData(s.ELEMENT_ARRAY_BUFFER,i.arrayBuffer,this.dynamicDraw?s.DYNAMIC_DRAW:s.STATIC_DRAW),this.dynamicDraw||n||i.destroy()}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(t){this.id=ko.uniqueIdxCounter,ko.uniqueIdxCounter++;const i=this.context.gl;this.context.unbindVAO(),this.bind(),i.bufferSubData(i.ELEMENT_ARRAY_BUFFER,0,t.arrayBuffer)}destroy(){this.buffer&amp;&amp;(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}ko.uniqueIdxCounter=0;const X3={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class Y3{constructor(t,i,r,n,s,a){this.length=i.length,this.attributes=r,this.itemSize=i.bytesPerElement,this.dynamicDraw=n,this.instanceCount=a,this.context=t;const l=t.gl;this.buffer=l.createBuffer(),t.bindVertexBuffer.set(this.buffer),l.bufferData(l.ARRAY_BUFFER,i.arrayBuffer,this.dynamicDraw?l.DYNAMIC_DRAW:l.STATIC_DRAW),this.dynamicDraw||s||i.destroy()}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(t){const i=this.context.gl;this.bind(),i.bufferSubData(i.ARRAY_BUFFER,0,t.arrayBuffer)}enableAttributes(t,i){for(let r=0;r&lt;this.attributes.length;r++){const n=i.attributes[this.attributes[r].name];n!==void 0&amp;&amp;t.enableVertexAttribArray(n)}}setVertexAttribPointers(t,i,r){for(let n=0;n&lt;this.attributes.length;n++){const s=this.attributes[n],a=i.attributes[s.name];a!==void 0&amp;&amp;t.vertexAttribPointer(a,s.components,t[X3[s.type]],!1,this.itemSize,s.offset+this.itemSize*(r||0))}}setVertexAttribDivisor(t,i,r){for(let n=0;n&lt;this.attributes.length;n++){const s=i.attributes[this.attributes[n].name];s!==void 0&amp;&amp;this.instanceCount&amp;&amp;this.instanceCount&gt;0&amp;&amp;t.vertexAttribDivisor(s,r)}}destroy(){this.buffer&amp;&amp;(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}class yi{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)}}class K3 extends yi{getDefault(){return Ie.transparent}set(t){const i=this.current;(t.r!==i.r||t.g!==i.g||t.b!==i.b||t.a!==i.a||this.dirty)&amp;&amp;(this.gl.clearColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)}}class J3 extends yi{getDefault(){return 1}set(t){(t!==this.current||this.dirty)&amp;&amp;(this.gl.clearDepth(t),this.current=t,this.dirty=!1)}}class Q3 extends yi{getDefault(){return 0}set(t){(t!==this.current||this.dirty)&amp;&amp;(this.gl.clearStencil(t),this.current=t,this.dirty=!1)}}class tL extends yi{getDefault(){return[!0,!0,!0,!0]}set(t){const i=this.current;(t[0]!==i[0]||t[1]!==i[1]||t[2]!==i[2]||t[3]!==i[3]||this.dirty)&amp;&amp;(this.gl.colorMask(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}}class eL extends yi{getDefault(){return!0}set(t){(t!==this.current||this.dirty)&amp;&amp;(this.gl.depthMask(t),this.current=t,this.dirty=!1)}}class iL extends yi{getDefault(){return 255}set(t){(t!==this.current||this.dirty)&amp;&amp;(this.gl.stencilMask(t),this.current=t,this.dirty=!1)}}class rL extends yi{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(t){const i=this.current;(t.func!==i.func||t.ref!==i.ref||t.mask!==i.mask||this.dirty)&amp;&amp;(this.gl.stencilFunc(t.func,t.ref,t.mask),this.current=t,this.dirty=!1)}}class nL extends yi{getDefault(){const t=this.gl;return[t.KEEP,t.KEEP,t.KEEP]}set(t){const i=this.current;(t[0]!==i[0]||t[1]!==i[1]||t[2]!==i[2]||this.dirty)&amp;&amp;(this.gl.stencilOp(t[0],t[1],t[2]),this.current=t,this.dirty=!1)}}class sL extends yi{getDefault(){return!1}set(t){if(t===this.current&amp;&amp;!this.dirty)return;const i=this.gl;t?i.enable(i.STENCIL_TEST):i.disable(i.STENCIL_TEST),this.current=t,this.dirty=!1}}class oL extends yi{getDefault(){return[0,1]}set(t){const i=this.current;(t[0]!==i[0]||t[1]!==i[1]||this.dirty)&amp;&amp;(this.gl.depthRange(t[0],t[1]),this.current=t,this.dirty=!1)}}class aL extends yi{getDefault(){return!1}set(t){if(t===this.current&amp;&amp;!this.dirty)return;const i=this.gl;t?i.enable(i.DEPTH_TEST):i.disable(i.DEPTH_TEST),this.current=t,this.dirty=!1}}class lL extends yi{getDefault(){return this.gl.LESS}set(t){(t!==this.current||this.dirty)&amp;&amp;(this.gl.depthFunc(t),this.current=t,this.dirty=!1)}}class cL extends yi{getDefault(){return!1}set(t){if(t===this.current&amp;&amp;!this.dirty)return;const i=this.gl;t?i.enable(i.BLEND):i.disable(i.BLEND),this.current=t,this.dirty=!1}}class uL extends yi{getDefault(){const t=this.gl;return[t.ONE,t.ZERO,t.ONE,t.ZERO]}set(t){const i=this.current;(t[0]!==i[0]||t[1]!==i[1]||t[2]!==i[2]||t[3]!==i[3]||this.dirty)&amp;&amp;(this.gl.blendFuncSeparate(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}}class hL extends yi{getDefault(){return Ie.transparent}set(t){const i=this.current;(t.r!==i.r||t.g!==i.g||t.b!==i.b||t.a!==i.a||this.dirty)&amp;&amp;(this.gl.blendColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)}}class dL extends yi{getDefault(){return this.gl.FUNC_ADD}set(t){(t!==this.current||this.dirty)&amp;&amp;(this.gl.blendEquationSeparate(t,t),this.current=t,this.dirty=!1)}}class fL extends yi{getDefault(){return!1}set(t){if(t===this.current&amp;&amp;!this.dirty)return;const i=this.gl;t?i.enable(i.CULL_FACE):i.disable(i.CULL_FACE),this.current=t,this.dirty=!1}}class pL extends yi{getDefault(){return this.gl.BACK}set(t){(t!==this.current||this.dirty)&amp;&amp;(this.gl.cullFace(t),this.current=t,this.dirty=!1)}}class mL extends yi{getDefault(){return this.gl.CCW}set(t){(t!==this.current||this.dirty)&amp;&amp;(this.gl.frontFace(t),this.current=t,this.dirty=!1)}}let _L=class extends yi{getDefault(){return null}set(e){(e!==this.current||this.dirty)&amp;&amp;(this.gl.useProgram(e),this.current=e,this.dirty=!1)}};class gL extends yi{getDefault(){return this.gl.TEXTURE0}set(t){(t!==this.current||this.dirty)&amp;&amp;(this.gl.activeTexture(t),this.current=t,this.dirty=!1)}}class yL extends yi{getDefault(){const t=this.gl;return[0,0,t.drawingBufferWidth,t.drawingBufferHeight]}set(t){const i=this.current;(t[0]!==i[0]||t[1]!==i[1]||t[2]!==i[2]||t[3]!==i[3]||this.dirty)&amp;&amp;(this.gl.viewport(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}}class xL extends yi{getDefault(){return null}set(t){if(t===this.current&amp;&amp;!this.dirty)return;const i=this.gl;i.bindFramebuffer(i.FRAMEBUFFER,t),this.current=t,this.dirty=!1}}class vL extends yi{getDefault(){return null}set(t){if(t===this.current&amp;&amp;!this.dirty)return;const i=this.gl;i.bindRenderbuffer(i.RENDERBUFFER,t),this.current=t,this.dirty=!1}}class bL extends yi{getDefault(){return null}set(t){if(t===this.current&amp;&amp;!this.dirty)return;const i=this.gl;i.bindTexture(i.TEXTURE_2D,t),this.current=t,this.dirty=!1}}class wL extends yi{getDefault(){return null}set(t){if(t===this.current&amp;&amp;!this.dirty)return;const i=this.gl;i.bindBuffer(i.ARRAY_BUFFER,t),this.current=t,this.dirty=!1}}class TL extends yi{getDefault(){return null}set(t){const i=this.gl;i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,t),this.current=t,this.dirty=!1}}class EL extends yi{getDefault(){return null}set(t){this.gl&amp;&amp;(t!==this.current||this.dirty)&amp;&amp;(this.gl.bindVertexArray(t),this.current=t,this.dirty=!1)}}class SL extends yi{getDefault(){return 4}set(t){if(t===this.current&amp;&amp;!this.dirty)return;const i=this.gl;i.pixelStorei(i.UNPACK_ALIGNMENT,t),this.current=t,this.dirty=!1}}class AL extends yi{getDefault(){return!1}set(t){if(t===this.current&amp;&amp;!this.dirty)return;const i=this.gl;i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t),this.current=t,this.dirty=!1}}class ML extends yi{getDefault(){return!1}set(t){if(t===this.current&amp;&amp;!this.dirty)return;const i=this.gl;i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,t),this.current=t,this.dirty=!1}}class f_ extends yi{constructor(t,i){super(t),this.context=t,this.parent=i}getDefault(){return null}}class IL extends f_{setDirty(){this.dirty=!0}set(t){if(t===this.current&amp;&amp;!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const i=this.gl;i.framebufferTexture2D(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,t,0),this.current=t,this.dirty=!1}}class Sb extends f_{attachment(){return this.gl.DEPTH_ATTACHMENT}set(t){if(t===this.current&amp;&amp;!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const i=this.gl;i.framebufferRenderbuffer(i.FRAMEBUFFER,this.attachment(),i.RENDERBUFFER,t),this.current=t,this.dirty=!1}}class PL extends f_{attachment(){return this.gl.DEPTH_ATTACHMENT}set(t){if(t===this.current&amp;&amp;!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const i=this.gl;i.framebufferTexture2D(i.FRAMEBUFFER,this.attachment(),i.TEXTURE_2D,t,0),this.current=t,this.dirty=!1}}class CL extends Sb{attachment(){return this.gl.DEPTH_STENCIL_ATTACHMENT}}class LL{constructor(t,i,r,n,s){this.context=t,this.width=i,this.height=r;const a=this.framebuffer=t.gl.createFramebuffer();n&amp;&amp;(this.colorAttachment=new IL(t,a)),s&amp;&amp;(this.depthAttachmentType=s,this.depthAttachment=s==="renderbuffer"?new Sb(t,a):new PL(t,a))}destroy(){const t=this.context.gl;if(this.colorAttachment){const i=this.colorAttachment.get();i&amp;&amp;t.deleteTexture(i)}if(this.depthAttachment&amp;&amp;this.depthAttachmentType)if(this.depthAttachmentType==="renderbuffer"){const i=this.depthAttachment.get();i&amp;&amp;t.deleteRenderbuffer(i)}else{const i=this.depthAttachment.get();i&amp;&amp;t.deleteTexture(i)}t.deleteFramebuffer(this.framebuffer)}}class de{constructor(t,i,r){this.func=t,this.mask=i,this.range=r}}de.ReadOnly=!1,de.ReadWrite=!0,de.disabled=new de(519,de.ReadOnly,[0,1]);const p_=7680;class Pe{constructor(t,i,r,n,s,a){this.test=t,this.ref=i,this.mask=r,this.fail=n,this.depthFail=s,this.pass=a}}Pe.disabled=new Pe({func:519,mask:0},0,0,p_,p_,p_);const ld=771;class je{constructor(t,i,r,n){this.blendFunction=t,this.blendColor=i,this.mask=r,this.blendEquation=n}}je.Replace=[1,0,1,0],je.disabled=new je(je.Replace,Ie.transparent,[!1,!1,!1,!1]),je.unblended=new je(je.Replace,Ie.transparent,[!0,!0,!0,!0]),je.alphaBlended=new je([1,ld,1,ld],Ie.transparent,[!0,!0,!0,!0]),je.multiply=new je([774,0,774,0],Ie.transparent,[!0,!0,!0,!0]);const m_=1029,__=2305;class Le{constructor(t,i,r){this.enable=t,this.mode=i,this.frontFace=r}}Le.disabled=new Le(!1,m_,__),Le.backCCW=new Le(!0,m_,__),Le.backCW=new Le(!0,m_,2304),Le.frontCW=new Le(!0,1028,2304),Le.frontCCW=new Le(!0,1028,__);class RL{constructor(t,i){this.gl=t,this.clearColor=new K3(this),this.clearDepth=new J3(this),this.clearStencil=new Q3(this),this.colorMask=new tL(this),this.depthMask=new eL(this),this.stencilMask=new iL(this),this.stencilFunc=new rL(this),this.stencilOp=new nL(this),this.stencilTest=new sL(this),this.depthRange=new oL(this),this.depthTest=new aL(this),this.depthFunc=new lL(this),this.blend=new cL(this),this.blendFunc=new uL(this),this.blendColor=new hL(this),this.blendEquation=new dL(this),this.cullFace=new fL(this),this.cullFaceSide=new pL(this),this.frontFace=new mL(this),this.program=new _L(this),this.activeTexture=new gL(this),this.viewport=new yL(this),this.bindFramebuffer=new xL(this),this.bindRenderbuffer=new vL(this),this.bindTexture=new bL(this),this.bindVertexBuffer=new wL(this),this.bindElementBuffer=new TL(this),this.bindVertexArrayOES=new EL(this),this.pixelStoreUnpack=new SL(this),this.pixelStoreUnpackPremultiplyAlpha=new AL(this),this.pixelStoreUnpackFlipY=new ML(this),this.options=i?{...i}:{},this.options.extTextureFilterAnisotropicForceOff||(this.extTextureFilterAnisotropic=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&amp;&amp;(this.extTextureFilterAnisotropicMax=t.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT))),this.extDebugRendererInfo=t.getExtension("WEBGL_debug_renderer_info"),this.extDebugRendererInfo&amp;&amp;(this.renderer=t.getParameter(this.extDebugRendererInfo.UNMASKED_RENDERER_WEBGL),this.vendor=t.getParameter(this.extDebugRendererInfo.UNMASKED_VENDOR_WEBGL)),this.options.extTextureFloatLinearForceOff||(this.extTextureFloatLinear=t.getExtension("OES_texture_float_linear")),this.extRenderToTextureHalfFloat=t.getExtension("EXT_color_buffer_half_float"),this.extTimerQuery=t.getExtension("EXT_disjoint_timer_query_webgl2"),this.maxTextureSize=t.getParameter(t.MAX_TEXTURE_SIZE)}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.bindVertexArrayOES.dirty=!0,this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0}createIndexBuffer(t,i,r){return new ko(this,t,i,r)}createVertexBuffer(t,i,r,n,s){return new Y3(this,t,i,r,n,s)}createRenderbuffer(t,i,r){const n=this.gl,s=n.createRenderbuffer();return this.bindRenderbuffer.set(s),n.renderbufferStorage(n.RENDERBUFFER,t,i,r),this.bindRenderbuffer.set(null),s}createFramebuffer(t,i,r,n){return new LL(this,t,i,r,n)}clear({color:t,depth:i,stencil:r,colorMask:n}){const s=this.gl;let a=0;t&amp;&amp;(a|=s.COLOR_BUFFER_BIT,this.clearColor.set(t),this.colorMask.set(n||[!0,!0,!0,!0])),i!==void 0&amp;&amp;(a|=s.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(i),this.depthMask.set(!0)),r!==void 0&amp;&amp;(a|=s.STENCIL_BUFFER_BIT,this.clearStencil.set(r),this.stencilMask.set(255)),s.clear(a)}setCullFace(t){t.enable===!1?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){Lt(t.blendFunction,je.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(t.blendFunction),this.blendColor.set(t.blendColor),t.blendEquation?this.blendEquation.set(t.blendEquation):this.blendEquation.setDefault()),this.colorMask.set(t.mask)}unbindVAO(){this.bindVertexArrayOES.set(null)}}class $n extends Zi{constructor(t,i,r){super(),this.id=t,this._onlySymbols=r,i.on("data",n=&gt;{n.dataType==="source"&amp;&amp;n.sourceDataType==="metadata"&amp;&amp;(this._sourceLoaded=!0),this._sourceLoaded&amp;&amp;!this._paused&amp;&amp;n.dataType==="source"&amp;&amp;n.sourceDataType==="content"&amp;&amp;(this.reload(),this.transform&amp;&amp;this.update(this.transform))}),i.on("error",()=&gt;{this._sourceErrored=!0}),this._source=i,this._tiles={},this._cache=new $3(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={},this._minTileCacheSize=i.minTileCacheSize,this._maxTileCacheSize=i.maxTileCacheSize,this._loadedParentTiles={},this.castsShadows=!1,this._coveredTiles={},this._shadowCasterTiles={},this._state=new KC,this._isRaster=this._source.type==="raster"||this._source.type==="raster-dem"||this._source.type==="custom"&amp;&amp;this._source._dataType==="raster"}onAdd(t){this.map=t,this._minTileCacheSize=this._minTileCacheSize===void 0&amp;&amp;t?t._minTileCacheSize:this._minTileCacheSize,this._maxTileCacheSize=this._maxTileCacheSize===void 0&amp;&amp;t?t._maxTileCacheSize:this._maxTileCacheSize}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;for(const t in this._tiles){const i=this._tiles[t];if(i.state!=="errored"&amp;&amp;(i.state!=="loaded"||!i.bucketsLoaded()))return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const t=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,t&amp;&amp;this.reload(),this.transform&amp;&amp;this.update(this.transform)}_loadTile(t,i){return t.isSymbolTile=this._onlySymbols,t.isExtraShadowCaster=this._shadowCasterTiles[t.tileID.key],this._source.loadTile(t,i)}_unloadTile(t){if(this._source.unloadTile)return this._source.unloadTile(t,()=&gt;{})}_abortTile(t){if(this._source.abortTile)return this._source.abortTile(t,()=&gt;{})}serialize(){return this._source.serialize()}prepare(t){this._source.prepare&amp;&amp;this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const i in this._tiles){const r=this._tiles[i];r.upload(t),r.prepare(this.map.style.imageManager,this.map?this.map.painter:null,this._source.scope)}}getIds(){return Ds(this._tiles).map(t=&gt;t.tileID).sort(Ab).map(t=&gt;t.key)}getRenderableIds(t,i){const r=[];for(const n in this._tiles)this._isIdRenderable(+n,t,i)&amp;&amp;r.push(this._tiles[n]);return t?r.sort((n,s)=&gt;{const a=n.tileID,l=s.tileID,h=new Q(a.canonical.x,a.canonical.y)._rotate(this.transform.angle),d=new Q(l.canonical.x,l.canonical.y)._rotate(this.transform.angle);return a.overscaledZ-l.overscaledZ||d.y-h.y||d.x-h.x}).map(n=&gt;n.tileID.key):r.map(n=&gt;n.tileID).sort(Ab).map(n=&gt;n.key)}hasRenderableParent(t){const i=this.findLoadedParent(t,0);return!!i&amp;&amp;this._isIdRenderable(i.tileID.key)}_isIdRenderable(t,i,r){return this._tiles[t]&amp;&amp;this._tiles[t].hasData()&amp;&amp;!this._coveredTiles[t]&amp;&amp;(i||!this._tiles[t].holdingForFade())&amp;&amp;(r||!this._shadowCasterTiles[t])}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const t in this._tiles)this._tiles[t].state!=="errored"&amp;&amp;this._reloadTile(+t,"reloading")}}_reloadTile(t,i){const r=this._tiles[t];r&amp;&amp;(r.state!=="loading"&amp;&amp;(r.state=i),this._loadTile(r,this._tileLoaded.bind(this,r,t,i)))}_tileLoaded(t,i,r,n){if(n)if(t.state="errored",n.status!==404)this._source.fire(new xe(n,{tile:t}));else{if(!(t.tileID.key in this._loadedParentTiles))return void this._source.fire(new It("data",{dataType:"source",sourceDataType:"error",sourceId:this._source.id}));if(this._source.type==="raster-dem"&amp;&amp;this.usedForTerrain&amp;&amp;this.map.painter.terrain){const s=this.map.painter.terrain;this.update(this.transform,s.getScaledDemTileSize(),!0),s.resetTileLookupCache(this.id)}else this.update(this.transform)}else t.timeAdded=_e.now(),r==="expired"&amp;&amp;(t.refreshedUponExpiration=!0),this._setTileReloadTimer(i,t),this._source.type==="raster-dem"&amp;&amp;t.dem&amp;&amp;this._backfillDEM(t),this._state.initializeTileState(t,this.map?this.map.painter:null),this._source.fire(new It("data",{dataType:"source",tile:t,coord:t.tileID,sourceCacheId:this.id}))}_backfillDEM(t){const i=this.getRenderableIds();for(let n=0;n&lt;i.length;n++){const s=i[n];if(t.neighboringTiles&amp;&amp;t.neighboringTiles[s]){const a=this.getTileByID(s);r(t,a),r(a,t)}}function r(n,s){if(!n.dem||n.dem.borderReady)return;n.needsHillshadePrepare=!0,n.needsDEMTextureUpload=!0;let a=s.tileID.canonical.x-n.tileID.canonical.x;const l=s.tileID.canonical.y-n.tileID.canonical.y,h=Math.pow(2,n.tileID.canonical.z),d=s.tileID.key;a===0&amp;&amp;l===0||Math.abs(l)&gt;1||(Math.abs(a)&gt;1&amp;&amp;(Math.abs(a+h)===1?a+=h:Math.abs(a-h)===1&amp;&amp;(a-=h)),s.dem&amp;&amp;n.dem&amp;&amp;(n.dem.backfillBorder(s.dem,a,l),n.neighboringTiles&amp;&amp;n.neighboringTiles[d]&amp;&amp;(n.neighboringTiles[d].backfilled=!0)))}}getTile(t){return this.getTileByID(t.key)}getTileByID(t){return this._tiles[t]}_retainLoadedChildren(t,i,r,n){for(const s in this._tiles){let a=this._tiles[s];if(n[s]||!a.hasData()||a.tileID.overscaledZ&lt;=i||a.tileID.overscaledZ&gt;r)continue;let l=a.tileID;for(;a&amp;&amp;a.tileID.overscaledZ&gt;i+1;){const d=a.tileID.scaledTo(a.tileID.overscaledZ-1);a=this._tiles[d.key],a&amp;&amp;a.hasData()&amp;&amp;(l=d)}let h=l;for(;h.overscaledZ&gt;i;)if(h=h.scaledTo(h.overscaledZ-1),t[h.key]){n[l.key]=l;break}}}findLoadedParent(t,i){if(t.key in this._loadedParentTiles){const r=this._loadedParentTiles[t.key];return r&amp;&amp;r.tileID.overscaledZ&gt;=i?r:null}for(let r=t.overscaledZ-1;r&gt;=i;r--){const n=t.scaledTo(r),s=this._getLoadedTile(n);if(s)return s}}_getLoadedTile(t){const i=this._tiles[t.key];return i&amp;&amp;i.hasData()?i:this._cache.getByKey(this._source.reparseOverscaled?t.wrapped().key:t.canonical.key)}updateCacheSize(t,i){i=i||this._source.tileSize;const r=Math.ceil(t.width/i)+1,n=Math.ceil(t.height/i)+1,s=Math.floor(r*n*5),a=typeof this._minTileCacheSize=="number"?Math.max(this._minTileCacheSize,s):s,l=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,a):a;this._cache.setMaxSize(l)}handleWrapJump(t){const i=Math.round((t-(this._prevLng===void 0?t:this._prevLng))/360);if(this._prevLng=t,i){const r={};for(const n in this._tiles){const s=this._tiles[n];s.tileID=s.tileID.unwrapTo(s.tileID.wrap+i),r[s.tileID.key]=s}this._tiles=r;for(const n in this._timers)clearTimeout(this._timers[n]),delete this._timers[n];for(const n in this._tiles)this._setTileReloadTimer(+n,this._tiles[n])}}update(t,i,r,n){if(this.transform=t,!this._sourceLoaded||this._paused||this.transform.freezeTileCoverage||this.usedForTerrain&amp;&amp;!r)return;let s;if(this.updateCacheSize(t,i),this.transform.projection.name!=="globe"&amp;&amp;this.handleWrapJump(this.transform.center.lng),this._shadowCasterTiles={},this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?s=t.getVisibleUnwrappedCoordinates(this._source.tileID).map(h=&gt;new We(h.canonical.z,h.wrap,h.canonical.z,h.canonical.x,h.canonical.y)):(s=t.coveringTiles({tileSize:i||this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom&amp;&amp;!r,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain}),this._source.hasTile&amp;&amp;(s=s.filter(h=&gt;this._source.hasTile(h)))):s=[],s.length&gt;0&amp;&amp;this.castsShadows&amp;&amp;n&amp;&amp;this.transform.projection.name!=="globe"&amp;&amp;!this.usedForTerrain&amp;&amp;!g_(this._source.type)){const h=t.coveringZoomLevel({tileSize:i||this._source.tileSize,roundZoom:this._source.roundZoom&amp;&amp;!r}),d=Math.min(h,this._source.maxzoom),f=t.extendTileCoverForShadows(s,n,d);for(const m of f)this._shadowCasterTiles[m.key]=!0,s.push(m)}const a=this._updateRetainedTiles(s);if(g_(this._source.type)&amp;&amp;s.length!==0){const h={},d={},f=Object.keys(a);for(const _ of f){const y=a[_],x=this._tiles[_];if(!x||x.fadeEndTime&amp;&amp;x.fadeEndTime&lt;=_e.now())continue;const b=this.findLoadedParent(y,Math.max(y.overscaledZ-$n.maxOverzooming,this._source.minzoom));b&amp;&amp;(this._addTile(b.tileID),h[b.tileID.key]=b.tileID),d[_]=y}const m=s[s.length-1].overscaledZ;for(const _ in this._tiles){const y=this._tiles[_];if(a[_]||!y.hasData())continue;let x=y.tileID;for(;x.overscaledZ&gt;m;){x=x.scaledTo(x.overscaledZ-1);const b=this._tiles[x.key];if(b&amp;&amp;b.hasData()&amp;&amp;d[x.key]){a[_]=y.tileID;break}}}for(const _ in h)a[_]||(this._coveredTiles[_]=!0,a[_]=h[_])}for(const h in a)this._tiles[h].clearFadeHold();const l=function(h,d){const f=[];for(const m in h)m in d||f.push(m);return f}(this._tiles,a);for(const h of l){const d=this._tiles[h];d.hasSymbolBuckets&amp;&amp;!d.holdingForFade()?d.setHoldDuration(this.map._fadeDuration):d.hasSymbolBuckets&amp;&amp;!d.symbolFadeFinished()||this._removeTile(+h)}this._updateLoadedParentTileCache(),this._onlySymbols&amp;&amp;this._source.afterUpdate&amp;&amp;this._source.afterUpdate()}releaseSymbolFadeTiles(){for(const t in this._tiles)this._tiles[t].holdingForFade()&amp;&amp;this._removeTile(+t)}_updateRetainedTiles(t){const i={};if(t.length===0)return i;const r={},n=t.reduce((d,f)=&gt;Math.min(d,f.overscaledZ),1/0),s=t[0].overscaledZ,a=Math.max(s-$n.maxOverzooming,this._source.minzoom),l=Math.max(s+$n.maxUnderzooming,this._source.minzoom),h={};for(const d of t){const f=this._addTile(d);i[d.key]=d,f.hasData()||n&lt;this._source.maxzoom&amp;&amp;(h[d.key]=d)}this._retainLoadedChildren(h,n,l,i);for(const d of t){let f=this._tiles[d.key];if(f.hasData())continue;if(d.canonical.z&gt;=this._source.maxzoom){const _=d.children(this._source.maxzoom)[0],y=this.getTile(_);if(y&amp;&amp;y.hasData()){i[_.key]=_;continue}}else{const _=d.children(this._source.maxzoom);if(i[_[0].key]&amp;&amp;i[_[1].key]&amp;&amp;i[_[2].key]&amp;&amp;i[_[3].key])continue}let m=f.wasRequested();for(let _=d.overscaledZ-1;_&gt;=a;--_){const y=d.scaledTo(_);if(r[y.key]||(r[y.key]=!0,f=this.getTile(y),!f&amp;&amp;m&amp;&amp;(f=this._addTile(y)),f&amp;&amp;(i[y.key]=y,m=f.wasRequested(),f.hasData())))break}}return i}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const t in this._tiles){const i=[];let r,n=this._tiles[t].tileID;for(;n.overscaledZ&gt;0;){if(n.key in this._loadedParentTiles){r=this._loadedParentTiles[n.key];break}i.push(n.key);const s=n.scaledTo(n.overscaledZ-1);if(r=this._getLoadedTile(s),r)break;n=s}for(const s of i)this._loadedParentTiles[s]=r}}_addTile(t){let i=this._tiles[t.key];if(i)return i.isExtraShadowCaster!==!0||this._shadowCasterTiles[t.key]||this._reloadTile(t.key,"reloading"),i;i=this._cache.getAndRemove(t),i&amp;&amp;(this._setTileReloadTimer(t.key,i),i.tileID=t,this._state.initializeTileState(i,this.map?this.map.painter:null),this._cacheTimers[t.key]&amp;&amp;(clearTimeout(this._cacheTimers[t.key]),delete this._cacheTimers[t.key],this._setTileReloadTimer(t.key,i)));const r=!!i;if(!r){const n=this.map?this.map.painter:null;i=new jc(t,this._source.tileSize*t.overscaleFactor(),this.transform.tileZoom,n,this._isRaster),this._loadTile(i,this._tileLoaded.bind(this,i,t.key,i.state))}return i?(i.uses++,this._tiles[t.key]=i,r||this._source.fire(new It("dataloading",{tile:i,coord:i.tileID,dataType:"source"})),i):null}_setTileReloadTimer(t,i){t in this._timers&amp;&amp;(clearTimeout(this._timers[t]),delete this._timers[t]);const r=i.getExpiryTimeout();r&amp;&amp;(this._timers[t]=setTimeout(()=&gt;{this._reloadTile(t,"expired"),delete this._timers[t]},r))}_removeTile(t){const i=this._tiles[t];i&amp;&amp;(i.uses--,delete this._tiles[t],this._timers[t]&amp;&amp;(clearTimeout(this._timers[t]),delete this._timers[t]),i.uses&gt;0||(i.hasData()&amp;&amp;i.state!=="reloading"?this._cache.add(i.tileID,i,i.getExpiryTimeout()):(i.aborted=!0,this._abortTile(i),this._unloadTile(i))))}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const t in this._tiles)this._removeTile(+t);this._source._clear&amp;&amp;this._source._clear(),this._cache.reset(),this.map&amp;&amp;this.usedForTerrain&amp;&amp;this.map.painter.terrain&amp;&amp;this.map.painter.terrain.resetTileLookupCache(this.id)}tilesIn(t,i,r){const n=[],s=this.transform;if(!s)return n;const a=s.projection.name==="globe",l=er(s.center.lng);for(const h in this._tiles){const d=this._tiles[h];if(r&amp;&amp;d.clearQueryDebugViz(),d.holdingForFade())continue;let f;if(a){const m=d.tileID.canonical;if(m.z===0){const _=[Math.abs(Xt(l,...Gc(m,-1))-l),Math.abs(Xt(l,...Gc(m,1))-l)];f=[0,2*_.indexOf(Math.min(..._))-1]}else{const _=[Math.abs(Xt(l,...Gc(m,-1))-l),Math.abs(Xt(l,...Gc(m,0))-l),Math.abs(Xt(l,...Gc(m,1))-l)];f=[_.indexOf(Math.min(..._))-1]}}else f=[0];for(const m of f){const _=t.containsTile(d,s,i,m);_&amp;&amp;n.push(_)}}return n}getShadowCasterCoordinates(){return this._getRenderableCoordinates(!1,!0)}getVisibleCoordinates(t){return this._getRenderableCoordinates(t)}_getRenderableCoordinates(t,i){const r=this.getRenderableIds(t,i).map(s=&gt;this._tiles[s].tileID),n=this.transform.projection.name==="globe";for(const s of r)s.projMatrix=this.transform.calculateProjMatrix(s.toUnwrapped()),s.expandedProjMatrix=n?this.transform.calculateProjMatrix(s.toUnwrapped(),!1,!0):s.projMatrix;return r}sortCoordinatesByDistance(t){const i=t.slice(),r=this.transform._camera.position,n=this.transform._camera.forward(),s={};for(const a of i){const l=1/(1&lt;&lt;a.canonical.z);s[a.key]=((a.canonical.x+.5)*l+a.wrap-r[0])*n[0]+((a.canonical.y+.5)*l-r[1])*n[1]-r[2]*n[2]}return i.sort((a,l)=&gt;s[a.key]-s[l.key]),i}hasTransition(){if(this._source.hasTransition())return!0;if(g_(this._source.type))for(const t in this._tiles){const i=this._tiles[t];if(i.fadeEndTime!==void 0&amp;&amp;i.fadeEndTime&gt;=_e.now())return!0}return!1}setFeatureState(t,i,r){this._state.updateState(t=t||"_geojsonTileLayer",i,r)}removeFeatureState(t,i,r){this._state.removeFeatureState(t=t||"_geojsonTileLayer",i,r)}getFeatureState(t,i){return this._state.getState(t=t||"_geojsonTileLayer",i)}setDependencies(t,i,r){const n=this._tiles[t];n&amp;&amp;n.setDependencies(i,r)}reloadTilesForDependencies(t,i){for(const r in this._tiles)this._tiles[r].hasDependency(t,i)&amp;&amp;this._reloadTile(+r,"reloading");this._cache.filter(r=&gt;!r.hasDependency(t,i))}_preloadTiles(t,i){if(!this._sourceLoaded){const l=()=&gt;{this._sourceLoaded&amp;&amp;(this._source.off("data",l),this._preloadTiles(t,i))};return void this._source.on("data",l)}const r=new Map,n=Array.isArray(t)?t:[t],s=this.map.painter.terrain,a=this.usedForTerrain&amp;&amp;s?s.getScaledDemTileSize():this._source.tileSize;for(const l of n){const h=l.coveringTiles({tileSize:a,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom&amp;&amp;!this.usedForTerrain,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain});for(const d of h)r.set(d.key,d);this.usedForTerrain&amp;&amp;l.updateElevation(!1)}Rs(Array.from(r.values()),(l,h)=&gt;{const d=new jc(l,this._source.tileSize*l.overscaleFactor(),this.transform.tileZoom,this.map.painter,this._isRaster);this._loadTile(d,f=&gt;{this._source.type==="raster-dem"&amp;&amp;d.dem&amp;&amp;this._backfillDEM(d),h(f,d)})},i)}}function Ab(e,t){const i=Math.abs(2*e.wrap)-+(e.wrap&lt;0),r=Math.abs(2*t.wrap)-+(t.wrap&lt;0);return e.overscaledZ-t.overscaledZ||r-i||t.canonical.y-e.canonical.y||t.canonical.x-e.canonical.x}function g_(e){return e==="raster"||e==="image"||e==="video"||e==="custom"}function Gc(e,t){const i=1&lt;&lt;e.z;return[e.x/i+t,(e.x+1)/i+t]}$n.maxOverzooming=10,$n.maxUnderzooming=3;const DL=ei([{name:"a_pos_3f",components:3,type:"Float32"}]),OL=ei([{name:"a_color_3f",components:3,type:"Float32"}]),kL=ei([{name:"a_color_4f",components:4,type:"Float32"}]),zL=ei([{name:"a_uv_2f",components:2,type:"Float32"}]),FL=ei([{name:"a_normal_3f",components:3,type:"Float32"}]),BL=ei([{name:"a_normal_matrix0",components:4,type:"Float32"},{name:"a_normal_matrix1",components:4,type:"Float32"},{name:"a_normal_matrix2",components:4,type:"Float32"},{name:"a_normal_matrix3",components:4,type:"Float32"}]),NL=ei([{name:"a_pbr",components:4,type:"Uint16"},{name:"a_heightBasedEmissiveStrength",components:3,type:"Float32"}]);class y_{constructor(t=0,i=0,r=0,n=0){if(isNaN(t)||t&lt;0||isNaN(i)||i&lt;0||isNaN(r)||r&lt;0||isNaN(n)||n&lt;0)throw new 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=n}interpolate(t,i,r){return i.top!=null&amp;&amp;t.top!=null&amp;&amp;(this.top=ge(t.top,i.top,r)),i.bottom!=null&amp;&amp;t.bottom!=null&amp;&amp;(this.bottom=ge(t.bottom,i.bottom,r)),i.left!=null&amp;&amp;t.left!=null&amp;&amp;(this.left=ge(t.left,i.left,r)),i.right!=null&amp;&amp;t.right!=null&amp;&amp;(this.right=ge(t.right,i.right,r)),this}getCenter(t,i){const r=Xt((this.left+t-this.right)/2,0,t),n=Xt((this.top+i-this.bottom)/2,0,i);return new Q(r,n)}equals(t){return this.top===t.top&amp;&amp;this.bottom===t.bottom&amp;&amp;this.left===t.left&amp;&amp;this.right===t.right}clone(){return new y_(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}function Mb(e,t){const i=bi(e,3);nt.fromQuat(e,t),ji(e,3,i)}function x_(e,t){const i=vr.identity([]);return vr.rotateZ(i,i,-t),vr.rotateX(i,i,-e),i}function Ib(e,t){const i=[e[0],e[1],0],r=[t[0],t[1],0];if(W.length(i)&gt;=1e-15){const a=W.normalize([],i);W.scale(r,a,W.dot(r,a)),t[0]=r[0],t[1]=r[1]}const n=W.cross([],t,e);if(W.len(n)&lt;1e-15)return null;const s=Math.atan2(-n[1],n[0]);return x_(Math.atan2(Math.sqrt(e[0]*e[0]+e[1]*e[1]),-e[2]),s)}class Pb{constructor(t,i){this.position=t,this.orientation=i}get position(){return this._position}set position(t){if(t){const i=t instanceof Be?t:new Be(t[0],t[1],t[2]);this._renderWorldCopies&amp;&amp;(i.x=Hr(i.x,0,1)),this._position=i}else this._position=null}lookAtPoint(t,i){if(this.orientation=null,!this.position)return;const r=this.position,n=this._elevation?this._elevation.getAtPointOrZero(Be.fromLngLat(t)):0,s=Be.fromLngLat(t,n),a=[s.x-r.x,s.y-r.y,s.z-r.z];i||(i=[0,0,1]),i[2]=Math.abs(i[2]),this.orientation=Ib(a,i)}setPitchBearing(t,i){this.orientation=x_($t(t),$t(-i))}}class cd{constructor(t,i){this._transform=nt.identity([]),this.orientation=i,this.position=t}get mercatorPosition(){const t=this.position;return new Be(t[0],t[1],t[2])}get position(){const t=bi(this._transform,3);return[t[0],t[1],t[2]]}set position(t){var i;t&amp;&amp;ji(this._transform,3,[(i=t)[0],i[1],i[2],1])}get orientation(){return this._orientation}set orientation(t){this._orientation=t||vr.identity([]),t&amp;&amp;Mb(this._transform,this._orientation)}getPitchBearing(){const t=this.forward(),i=this.right();return{bearing:Math.atan2(-i[1],i[0]),pitch:Math.atan2(Math.sqrt(t[0]*t[0]+t[1]*t[1]),-t[2])}}setPitchBearing(t,i){this._orientation=x_(t,i),Mb(this._transform,this._orientation)}forward(){const t=bi(this._transform,2);return[-t[0],-t[1],-t[2]]}up(){const t=bi(this._transform,1);return[-t[0],-t[1],-t[2]]}right(){const t=bi(this._transform,0);return[t[0],t[1],t[2]]}getCameraToWorld(t,i){const r=new Float64Array(16);return nt.invert(r,this.getWorldToCamera(t,i)),r}getCameraToWorldMercator(){return this._transform}getWorldToCameraPosition(t,i,r){const n=this.position;W.scale(n,n,-t);const s=new Float64Array(16);return nt.fromScaling(s,[r,r,r]),nt.translate(s,s,n),s[10]*=i,s}getWorldToCamera(t,i){const r=new Float64Array(16),n=new Float64Array(4),s=this.position;return vr.conjugate(n,this._orientation),W.scale(s,s,-t),nt.fromQuat(r,n),nt.translate(r,r,s),r[1]*=-1,r[5]*=-1,r[9]*=-1,r[13]*=-1,r[8]*=i,r[9]*=i,r[10]*=i,r[11]*=i,r}getCameraToClipPerspective(t,i,r,n){const s=new Float64Array(16);return nt.perspective(s,t,i,r,n),s}getCameraToClipOrthographic(t,i,r,n,s,a){const l=new Float64Array(16);return nt.ortho(l,t,i,r,n,s,a),l}getDistanceToElevation(t,i=!1){const r=t===0?0:ui(t,i?Yi(this.position[1]):this.position[1]),n=this.forward();return(r-this.position[2])/n[2]}clone(){return new cd([...this.position],[...this.orientation])}}function Cb(e,t){const i=Hc(e.projection,e.zoom,e.width,e.height),r=function(s,a,l,h,d){const f=new ye(l.lng-180*zo,l.lat),m=new ye(l.lng+180*zo,l.lat),_=s.project(f.lng,f.lat),y=s.project(m.lng,m.lat),x=-Math.atan2(y.y-_.y,y.x-_.x),b=Be.fromLngLat(l);b.y=Xt(b.y,-1+zo,1-zo);const w=b.toLngLat(),T=s.project(w.lng,w.lat),S=Be.fromLngLat(w);S.x+=zo;const I=S.toLngLat(),P=s.project(I.lng,I.lat),M=Db(P.x-T.x,P.y-T.y,x),C=Be.fromLngLat(w);C.y+=zo;const D=C.toLngLat(),O=s.project(D.lng,D.lat),k=Db(O.x-T.x,O.y-T.y,x),z=Math.abs(M.x)/Math.abs(k.y),B=nt.identity([]);nt.rotateZ(B,B,-x*(1-(d?0:h)));const U=nt.identity([]);return nt.scale(U,U,[1,1-(1-z)*h,1]),U[4]=-k.x/k.y*h,nt.rotateZ(U,U,x),nt.multiply(U,B,U),U}(e.projection,0,e.center,i,t),n=Lb(e);return nt.scale(r,r,[n,n,1]),r}function Lb(e){const t=e.projection,i=Hc(e.projection,e.zoom,e.width,e.height),r=Rb(t,e.center),n=Rb(t,ye.convert(t.center));return Math.pow(2,r*i+(1-i)*n)}function Hc(e,t,i,r,n=1/0){const s=e.range;if(!s)return 0;const a=Math.min(n,Math.max(i,r)),l=Math.log(a/1024)/Math.LN2;return xn(s[0]+l,s[1]+l,t)}const zo=1/4e4;function Rb(e,t){const i=Xt(t.lat,-zi,zi),r=new ye(t.lng-180*zo,i),n=new ye(t.lng+180*zo,i),s=e.project(r.lng,i),a=e.project(n.lng,i),l=Be.fromLngLat(r),h=Be.fromLngLat(n),d=a.x-s.x,f=a.y-s.y,m=h.x-l.x,_=h.y-l.y,y=Math.sqrt((m*m+_*_)/(d*d+f*f));return Math.log(y)/Math.LN2}function Db(e,t,i){const r=Math.cos(i),n=Math.sin(i);return{x:e*r-t*n,y:e*n+t*r}}function fa(e,t,i){return t*(ut/(e.tileSize*Math.pow(2,i-e.tileID.overscaledZ)))}const xl={unknown:0,flipRequired:1,flipNotRequired:2},UL=Math.tan(85*Math.PI/180);function ud(e,t,i,r,n,s,a){const l=nt.create();if(i)if(s.name==="globe"){const h=function(d,f){const{x:m,y:_}=d.point,y=Jv(m,_,d.worldSize/d._pixelsPerMercatorPixel,0,0);return nt.multiply(y,y,Rm(pn(f)))}(n,t);nt.multiply(l,l,h)}else{const h=il.invert([],a);l[0]=h[0],l[1]=h[1],l[4]=h[2],l[5]=h[3],r||nt.rotateZ(l,l,n.angle)}else nt.multiply(l,n.labelPlaneMatrix,e);return l}function Ob(e,t,i,r,n,s,a){const l=ud(e,t,i,r,n,s,a);return s.name==="globe"&amp;&amp;i||(l[2]=l[6]=l[10]=l[14]=0),l}function kb(e,t,i,r,n,s,a){if(i){if(s.name==="globe"){const l=ud(e,t,i,r,n,s,a);return nt.invert(l,l),nt.multiply(l,e,l),l}{const l=nt.clone(e),h=nt.identity([]);return h[0]=a[0],h[1]=a[1],h[4]=a[2],h[5]=a[3],nt.multiply(l,l,h),r||nt.rotateZ(l,l,-n.angle),l}}return n.glCoordMatrix}function Xn(e,t,i,r){const n=[e,t,i,1];i?oi.transformMat4(n,n,r):jb(n,n,r);const s=n[3];return n[0]/=s,n[1]/=s,n[2]/=s,n}function zb(e,t){return Math.min(.5+e/t*.5,1.5)}function VL(e,t){const i=e[0]/e[3],r=e[1]/e[3];return i&gt;=-t[0]&amp;&amp;i&lt;=t[0]&amp;&amp;r&gt;=-t[1]&amp;&amp;r&lt;=t[1]}function jL(e,t,i,r,n,s,a,l,h,d){const f=i.transform,m=r?e.textSizeData:e.iconSizeData,_=ps(m,i.transform.zoom),y=f.projection.name==="globe",x=[256/i.width*2+1,256/i.height*2+1],b=r?e.text.dynamicLayoutVertexArray:e.icon.dynamicLayoutVertexArray;b.clear();let w=null;y&amp;&amp;(w=r?e.text.globeExtVertexArray:e.icon.globeExtVertexArray);const T=e.lineVertexArray,S=r?e.text.placedSymbolArray:e.icon.placedSymbolArray,I=i.transform.width/i.transform.height;let P,M=!1;for(let C=0;C&lt;S.length;C++){const D=S.get(C),{numGlyphs:O,writingMode:k}=D;if(k!==Ti.vertical||M||P===Ti.horizontal||(M=!0),P=k,(D.hidden||k===Ti.vertical)&amp;&amp;!M){vl(O,b);continue}M=!1;const z=new Q(D.tileAnchorX,D.tileAnchorY);let{x:B,y:U,z:Z}=f.projection.projectTilePoint(z.x,z.y,d.canonical);if(h){const[dt,ft,_t]=h(z);B+=dt,U+=ft,Z+=_t}const F=[B,U,Z,1];if(oi.transformMat4(F,F,t),!VL(F,x)){vl(O,b);continue}const Y=F[3],J=zb(i.transform.getCameraToCenterDistance(f.projection),Y),it=Rc(m,_,D),X=a?it/J:it*J,K=Xn(B,U,Z,n);if(K[3]&lt;=0){vl(O,b);continue}let ot={};const lt=a?null:h,at=Nb(D,X,!1,l,t,n,s,e.glyphOffsetArray,T,b,w,K,z,ot,I,lt,f.projection,d,a);M=at.useVertical,lt&amp;&amp;at.needsFlipping&amp;&amp;(ot={}),(at.notEnoughRoom||M||at.needsFlipping&amp;&amp;Nb(D,X,!0,l,t,n,s,e.glyphOffsetArray,T,b,w,K,z,ot,I,lt,f.projection,d,a).notEnoughRoom)&amp;&amp;vl(O,b)}r?(e.text.dynamicLayoutVertexBuffer.updateData(b),w&amp;&amp;e.text.globeExtVertexBuffer&amp;&amp;e.text.globeExtVertexBuffer.updateData(w)):(e.icon.dynamicLayoutVertexBuffer.updateData(b),w&amp;&amp;e.icon.globeExtVertexBuffer&amp;&amp;e.icon.globeExtVertexBuffer.updateData(w))}function Fb(e,t,i,r,n,s,a,l,h,d,f,m,_,y,x,b){const{lineStartIndex:w,glyphStartIndex:T,segment:S}=l,I=T+l.numGlyphs,P=w+l.lineLength,M=t.getoffsetX(T),C=t.getoffsetX(I-1),D=hd(e*M,i,r,n,s,a,S,w,P,h,d,f,m,_,!0,y,x,b);if(!D)return null;const O=hd(e*C,i,r,n,s,a,S,w,P,h,d,f,m,_,!0,y,x,b);return O?{first:D,last:O}:null}function Bb(e,t,i,r){return e===Ti.horizontal&amp;&amp;Math.abs(r)&gt;Math.abs(i)?{useVertical:!0}:e===Ti.vertical?r&gt;0?{needsFlipping:!0}:null:t!==xl.unknown&amp;&amp;function(n,s){return n===0||Math.abs(s/n)&gt;UL}(i,r)?t===xl.flipRequired?{needsFlipping:!0}:null:i&lt;0?{needsFlipping:!0}:null}function Nb(e,t,i,r,n,s,a,l,h,d,f,m,_,y,x,b,w,T,S){const I=t/24,P=e.lineOffsetX*I,M=e.lineOffsetY*I,{lineStartIndex:C,glyphStartIndex:D,numGlyphs:O,segment:k,writingMode:z,flipState:B}=e,U=C+e.lineLength,Z=F=&gt;{if(f){const[X,K,ot]=F.up,lt=d.length;rd(f,lt+0,X,K,ot),rd(f,lt+1,X,K,ot),rd(f,lt+2,X,K,ot),rd(f,lt+3,X,K,ot)}const[Y,J,it]=F.point;yl(d,Y,J,it,F.angle)};if(O&gt;1){const F=Fb(I,l,P,M,i,m,_,e,h,s,y,b,!1,w,T,S);if(!F)return{notEnoughRoom:!0};if(r&amp;&amp;!i){let[Y,J,it]=F.first.point,[X,K,ot]=F.last.point;[Y,J]=Xn(Y,J,it,a),[X,K]=Xn(X,K,ot,a);const lt=Bb(z,B,(X-Y)*x,K-J);if(e.flipState=lt&amp;&amp;lt.needsFlipping?xl.flipRequired:xl.flipNotRequired,lt)return lt}Z(F.first);for(let Y=D+1;Y&lt;D+O-1;Y++){const J=hd(I*l.getoffsetX(Y),P,M,i,m,_,k,C,U,h,s,y,b,!1,!1,w,T,S);if(!J)return d.length-=4*(Y-D),{notEnoughRoom:!0};Z(J)}Z(F.last)}else{if(r&amp;&amp;!i){const Y=Xn(_.x,_.y,0,n),J=C+k+1,it=new Q(h.getx(J),h.gety(J)),X=Xn(it.x,it.y,0,n),K=X[3]&gt;0?X:Vb(_,it,Y,1,n,void 0,w,T.canonical),ot=Bb(z,B,(K[0]-Y[0])*x,K[1]-Y[1]);if(e.flipState=ot&amp;&amp;ot.needsFlipping?xl.flipRequired:xl.flipNotRequired,ot)return ot}const F=hd(I*l.getoffsetX(D),P,M,i,m,_,k,C,U,h,s,y,b,!1,!1,w,T,S);if(!F)return{notEnoughRoom:!0};Z(F)}return{}}function Ub(e,t,i,r,n){const{x:s,y:a,z:l}=r.projectTilePoint(e.x,e.y,t);if(!n)return Xn(s,a,l,i);const[h,d,f]=n(e);return Xn(s+h,a+d,l+f,i)}function Vb(e,t,i,r,n,s,a,l){const h=Ub(e.sub(t)._unit()._add(e),l,n,a,s);return W.sub(h,i,h),W.normalize(h,h),W.scaleAndAdd(h,i,h,r)}function hd(e,t,i,r,n,s,a,l,h,d,f,m,_,y,x,b,w,T){const S=r?e-t:e+t;let I=S&gt;0?1:-1,P=0;r&amp;&amp;(I*=-1,P=Math.PI),I&lt;0&amp;&amp;(P+=Math.PI);let M=l+a+(I&gt;0?0:1)|0,C=n,D=n,O=0,k=0;const z=Math.abs(S),B=[],U=[];let Z=s,F=Z;const Y=()=&gt;Vb(F,Z,D,z-O+1,f,_,b,w.canonical);for(;O+k&lt;=z;){if(M+=I,M&lt;l||M&gt;=h)return null;if(D=C,F=Z,B.push(D),y&amp;&amp;U.push(F),Z=new Q(d.getx(M),d.gety(M)),C=m[M],!C){const ft=Ub(Z,w.canonical,f,b,_);C=ft[3]&gt;0?m[M]=ft:Y()}O+=k,k=W.distance(D,C)}x&amp;&amp;_&amp;&amp;(m[M]&amp;&amp;(C=Y(),k=W.distance(D,C)),m[M]=C);const J=(z-O)/k,it=Z.sub(F)._mult(J)._add(F),X=W.sub([],C,D),K=W.scaleAndAdd([],D,X,J);let ot=[0,0,1],lt=X[0],at=X[1];if(T&amp;&amp;(ot=b.upVector(w.canonical,it.x,it.y),ot[0]!==0||ot[1]!==0||ot[2]!==1)){const ft=[ot[2],0,-ot[0]],_t=W.cross([],ot,ft);W.normalize(ft,ft),W.normalize(_t,_t),lt=W.dot(X,ft),at=W.dot(X,_t)}if(i){const ft=W.cross([],ot,X);W.normalize(ft,ft),W.scaleAndAdd(K,K,ft,i*I)}const dt=P+Math.atan2(at,lt);return B.push(K),y&amp;&amp;U.push(it),{point:K,angle:dt,path:B,tilePath:U,up:ot}}function vl(e,t){const i=t.length,r=i+4*e;t.resize(r),t.float32.fill(-1/0,4*i,4*r)}function jb(e,t,i){const r=t[0],n=t[1];return e[0]=i[0]*r+i[4]*n+i[12],e[1]=i[1]*r+i[5]*n+i[13],e[3]=i[3]*r+i[7]*n+i[15],e}const Gb=(e,t,i)=&gt;(1-i)*e+i*t,Hb=e=&gt;e*e*e*e*e;class v_{constructor(t,i,r,n,s,a,l){this.tileSize=512,this._renderWorldCopies=s===void 0||s,this._minZoom=t||0,this._maxZoom=i||22,this._minPitch=r??0,this._maxPitch=n??60,this.setProjection(a),this.setMaxBounds(l),this.width=0,this.height=0,this._center=new ye(0,0),this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._nearZ=0,this._farZ=0,this._unmodified=!0,this._edgeInsets=new y_,this._projMatrixCache={},this._alignedProjMatrixCache={},this._fogTileMatrixCache={},this._expandedProjMatrixCache={},this._distanceTileDataCache={},this._camera=new cd,this._centerAltitude=0,this._averageElevation=0,this.cameraElevationReference="ground",this._pixelsPerMercatorPixel=1,this.globeRadius=0,this.globeCenterInViewSpace=[0,0,0],this._horizonShift=.1,this._orthographicProjectionAtLowPitch=!1}clone(){const t=new v_(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies,this.getProjection());return t._elevation=this._elevation,t._centerAltitude=this._centerAltitude,t._centerAltitudeValidForExaggeration=this._centerAltitudeValidForExaggeration,t.tileSize=this.tileSize,t.mercatorFromTransition=this.mercatorFromTransition,t.width=this.width,t.height=this.height,t.cameraElevationReference=this.cameraElevationReference,t._center=this._center,t._setZoom(this.zoom),t._seaLevelZoom=this._seaLevelZoom,t.angle=this.angle,t._fov=this._fov,t._pitch=this._pitch,t._nearZ=this._nearZ,t._farZ=this._farZ,t._averageElevation=this._averageElevation,t._orthographicProjectionAtLowPitch=this._orthographicProjectionAtLowPitch,t._unmodified=this._unmodified,t._edgeInsets=this._edgeInsets.clone(),t._camera=this._camera.clone(),t._calcMatrices(),t.freezeTileCoverage=this.freezeTileCoverage,t.frustumCorners=this.frustumCorners,t}get isOrthographic(){return this.projection.name!=="globe"&amp;&amp;this._orthographicProjectionAtLowPitch&amp;&amp;this.pitch&lt;15}get elevation(){return this._elevation}set elevation(t){this._elevation!==t&amp;&amp;(this._elevation=t,this._updateCameraOnTerrain(),this._calcMatrices())}get depthOcclusionForSymbolsAndCircles(){return this.projection.name!=="globe"&amp;&amp;!this.isOrthographic}updateElevation(t,i=!1){const r=this._elevation&amp;&amp;this._elevation.exaggeration()!==this._centerAltitudeValidForExaggeration;(this._seaLevelZoom==null||r)&amp;&amp;this._updateCameraOnTerrain(),(t||r)&amp;&amp;this._constrainCamera(i),this._calcMatrices()}getProjection(){return nr(this.projection,["name","center","parallels"])}setProjection(t){this.projectionOptions=t||{name:"mercator"};const i=this.projection?this.getProjection():void 0;this.projection=Jh(this.projectionOptions);const r=!Lt(i,this.getProjection());return r&amp;&amp;this._calcMatrices(),this.mercatorFromTransition=!1,r}setOrthographicProjectionAtLowPitch(t){return this._orthographicProjectionAtLowPitch!==t&amp;&amp;(this._orthographicProjectionAtLowPitch=t,this._calcMatrices(),!0)}setMercatorFromTransition(){const t=this.projection.name;this.mercatorFromTransition=!0,this.projectionOptions={name:"mercator"},this.projection=Jh({name:"mercator"});const i=t!==this.projection.name;return i&amp;&amp;this._calcMatrices(),i}get minZoom(){return this._minZoom}set minZoom(t){this._minZoom!==t&amp;&amp;(this._minZoom=t,this.zoom=Math.max(this.zoom,t))}get maxZoom(){return this._maxZoom}set maxZoom(t){this._maxZoom!==t&amp;&amp;(this._maxZoom=t,this.zoom=Math.min(this.zoom,t))}get minPitch(){return this._minPitch}set minPitch(t){this._minPitch!==t&amp;&amp;(this._minPitch=t,this.pitch=Math.max(this.pitch,t))}get maxPitch(){return this._maxPitch}set maxPitch(t){this._maxPitch!==t&amp;&amp;(this._maxPitch=t,this.pitch=Math.min(this.pitch,t))}get renderWorldCopies(){return this._renderWorldCopies&amp;&amp;this.projection.supportsWorldCopies===!0}set renderWorldCopies(t){t===void 0?t=!0:t===null&amp;&amp;(t=!1),this._renderWorldCopies=t}get worldSize(){return this.tileSize*this.scale}get cameraWorldSizeForFog(){const t=Math.max(this._camera.getDistanceToElevation(this._averageElevation),Number.EPSILON);return this._worldSizeFromZoom(this._zoomFromMercatorZ(t))}get cameraWorldSize(){const t=Math.max(this._camera.getDistanceToElevation(this._averageElevation,!0),Number.EPSILON);return this._worldSizeFromZoom(this._zoomFromMercatorZ(t))}get pixelsPerMeter(){return this.projection.pixelsPerMeter(this.center.lat,this.worldSize)}get cameraPixelsPerMeter(){return ui(1,this.center.lat)*this.cameraWorldSizeForFog}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new Q(this.width,this.height)}get bearing(){return Hr(this.rotation,-180,180)}set bearing(t){this.rotation=t}get rotation(){return-this.angle/Math.PI*180}set rotation(t){const i=-t*Math.PI/180;this.angle!==i&amp;&amp;(this._unmodified=!1,this.angle=i,this._calcMatrices(),this.rotationMatrix=il.create(),il.rotate(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(t){const i=Xt(t,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==i&amp;&amp;(this._unmodified=!1,this._pitch=i,this._calcMatrices())}get aspect(){return this.width/this.height}get fov(){return this._fov/Math.PI*180}get fovX(){return this._fov}get fovY(){const t=1/Math.tan(.5*this.fovX);return 2*Math.atan(1/this.aspect/t)}set fov(t){t=Math.max(.01,Math.min(60,t)),this._fov!==t&amp;&amp;(this._unmodified=!1,this._fov=$t(t),this._calcMatrices())}get averageElevation(){return this._averageElevation}set averageElevation(t){this._averageElevation=t,this._calcFogMatrices(),this._distanceTileDataCache={}}get zoom(){return this._zoom}set zoom(t){const i=Math.min(Math.max(t,this.minZoom),this.maxZoom);this._zoom!==i&amp;&amp;(this._unmodified=!1,this._setZoom(i),this._updateSeaLevelZoom(),this._constrain(),this._calcMatrices())}_setZoom(t){this._zoom=t,this.scale=this.zoomScale(t),this.tileZoom=Math.floor(t),this.zoomFraction=t-this.tileZoom}_updateCameraOnTerrain(){const t=this.elevation?this.elevation.getAtPoint(this.locationCoordinate(this.center),Number.NEGATIVE_INFINITY):Number.NEGATIVE_INFINITY,i=this.elevation&amp;&amp;t===Number.NEGATIVE_INFINITY&amp;&amp;this.elevation.visibleDemTiles.length&gt;0&amp;&amp;this.elevation.exaggeration()&gt;0&amp;&amp;this._centerAltitudeValidForExaggeration;if(!this._elevation||t===Number.NEGATIVE_INFINITY&amp;&amp;(!i||!this._centerAltitude))return this._centerAltitude=0,this._seaLevelZoom=null,void(this._centerAltitudeValidForExaggeration=void 0);const r=this._elevation;i||this._centerAltitude&amp;&amp;this._centerAltitudeValidForExaggeration&amp;&amp;r.exaggeration()&amp;&amp;this._centerAltitudeValidForExaggeration!==r.exaggeration()?(this._centerAltitude=this._centerAltitude/this._centerAltitudeValidForExaggeration*r.exaggeration(),this._centerAltitudeValidForExaggeration=r.exaggeration()):(this._centerAltitude=t||0,this._centerAltitudeValidForExaggeration=r.exaggeration()),this._updateSeaLevelZoom()}_updateSeaLevelZoom(){this._centerAltitudeValidForExaggeration!==void 0&amp;&amp;(this._seaLevelZoom=this._zoomFromMercatorZ((this.pixelsPerMeter*this._centerAltitude+this.cameraToCenterDistance)/this.worldSize))}sampleAverageElevation(){if(!this._elevation)return 0;const t=this._elevation,i=[[.5,.2],[.3,.5],[.5,.5],[.7,.5],[.5,.8]],r=this.horizonLineFromTop();let n=0,s=0;for(let a=0;a&lt;i.length;a++){const l=new Q(i[a][0]*this.width,r+i[a][1]*(this.height-r)),h=t.pointCoordinate(l);if(!h)continue;const d=1/Math.hypot(h[0]-this._camera.position[0],h[1]-this._camera.position[1]);n+=h[3]*d,s+=d}return s===0?NaN:n/s}get center(){return this._center}set center(t){t.lat===this._center.lat&amp;&amp;t.lng===this._center.lng||(this._unmodified=!1,this._center=t,this._terrainEnabled()&amp;&amp;(this.cameraElevationReference==="ground"?this._updateCameraOnTerrain():this._updateZoomFromElevation()),this._constrain(),this._calcMatrices())}_updateZoomFromElevation(){if(this._seaLevelZoom==null||!this._elevation)return;const t=this._seaLevelZoom,i=this._elevation.getAtPointOrZero(this.locationCoordinate(this.center)),r=this.pixelsPerMeter/this.worldSize*i,n=this._mercatorZfromZoom(t),s=this._mercatorZfromZoom(this._maxZoom),a=Math.max(n-r,s);this._setZoom(this._zoomFromMercatorZ(a))}get padding(){return this._edgeInsets.toJSON()}set padding(t){this._edgeInsets.equals(t)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,t,1),this._calcMatrices())}computeZoomRelativeTo(t){const i=this.rayIntersectionCoordinate(this.pointRayIntersection(this.centerPoint,t.toAltitude()));let r;r=t.z&lt;this._camera.position[2]?[i.x,i.y,i.z]:[t.x,t.y,t.z];const n=W.length(W.sub([],this._camera.position,r));return Xt(this._zoomFromMercatorZ(n),this._minZoom,this._maxZoom)}setFreeCameraOptions(t){if(!this.height||!t.position&amp;&amp;!t.orientation)return;this._updateCameraState();let i=!1;if(t.orientation&amp;&amp;!vr.exactEquals(t.orientation,this._camera.orientation)&amp;&amp;(i=this._setCameraOrientation(t.orientation)),t.position){const r=[t.position.x,t.position.y,t.position.z];W.exactEquals(r,this._camera.position)||(this._setCameraPosition(r),i=!0)}i&amp;&amp;(this._updateStateFromCamera(),this.recenterOnTerrain())}getFreeCameraOptions(){this._updateCameraState();const t=this._camera.position,i=new Pb;return i.position=new Be(t[0],t[1],t[2]),i.orientation=this._camera.orientation,i._elevation=this.elevation,i._renderWorldCopies=this.renderWorldCopies,i}_setCameraOrientation(t){if(!vr.length(t))return!1;vr.normalize(t,t);const i=W.transformQuat([],[0,0,-1],t),r=W.transformQuat([],[0,-1,0],t);if(r[2]&lt;0)return!1;const n=Ib(i,r);return!!n&amp;&amp;(this._camera.orientation=n,!0)}_setCameraPosition(t){const i=this.zoomScale(this.minZoom)*this.tileSize,r=this.zoomScale(this.maxZoom)*this.tileSize,n=this.cameraToCenterDistance;t[2]=Xt(t[2],n/r,n/i),this._camera.position=t}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}get fovAboveCenter(){return this._fov*(.5+this.centerOffset.y/this.height)}isPaddingEqual(t){return this._edgeInsets.equals(t)}interpolatePadding(t,i,r){this._unmodified=!1,this._edgeInsets.interpolate(t,i,r),this._constrain(),this._calcMatrices()}coveringZoomLevel(t){const i=(t.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/t.tileSize));return Math.max(0,i)}getVisibleUnwrappedCoordinates(t){const i=[new Am(0,t)];if(this.renderWorldCopies){const r=this.pointCoordinate(new Q(0,0)),n=this.pointCoordinate(new Q(this.width,0)),s=this.pointCoordinate(new Q(this.width,this.height)),a=this.pointCoordinate(new Q(0,this.height)),l=Math.floor(Math.min(r.x,n.x,s.x,a.x)),h=Math.floor(Math.max(r.x,n.x,s.x,a.x)),d=1;for(let f=l-d;f&lt;=h+d;f++)f!==0&amp;&amp;i.push(new Am(f,t))}return i}isLODDisabled(t){return(!t||this.pitch&lt;=60)&amp;&amp;this._edgeInsets.top&lt;=this._edgeInsets.bottom&amp;&amp;!this._elevation&amp;&amp;!this.projection.isReprojectedInTileSpace}extendTileCoverForShadows(t,i,r){let n=[];if(i[0]===0&amp;&amp;i[1]===0)return n;for(const a of t){const l=a.canonical,h=a.overscaledZ,d=a.wrap,f=1&lt;&lt;l.z,m=l.x+1&lt;f,_=l.x&gt;0,y=l.y+1&lt;f,x=l.y&gt;0,b=a.wrap-(_?0:1),w=a.wrap+(m?0:1),T=_?l.x-1:f-1,S=m?l.x+1:0;i[0]&lt;0?(n.push(new We(h,w,l.z,S,l.y)),i[1]&lt;0&amp;&amp;y&amp;&amp;(n.push(new We(h,d,l.z,l.x,l.y+1)),n.push(new We(h,w,l.z,S,l.y+1))),i[1]&gt;0&amp;&amp;x&amp;&amp;(n.push(new We(h,d,l.z,l.x,l.y-1)),n.push(new We(h,w,l.z,S,l.y-1)))):i[0]&gt;0?(n.push(new We(h,b,l.z,T,l.y)),i[1]&lt;0&amp;&amp;y&amp;&amp;(n.push(new We(h,d,l.z,l.x,l.y+1)),n.push(new We(h,b,l.z,T,l.y+1))),i[1]&gt;0&amp;&amp;x&amp;&amp;(n.push(new We(h,d,l.z,l.x,l.y-1)),n.push(new We(h,b,l.z,T,l.y-1)))):i[1]&lt;0&amp;&amp;y?n.push(new We(h,d,l.z,l.x,l.y+1)):x&amp;&amp;n.push(new We(h,d,l.z,l.x,l.y-1))}if(n.length&gt;1){n.sort((h,d)=&gt;h.overscaledZ-d.overscaledZ||h.wrap-d.wrap||h.canonical.z-d.canonical.z||h.canonical.x-d.canonical.x||h.canonical.y-d.canonical.y);let a=0,l=0;for(;l&lt;n.length;)n[l].equals(n[a])?++l:n[++a]=n[l++];n.length=a+1}const s=[];for(const a of n)n.some(l=&gt;a.isChildOf(l))||s.push(a);return n=s.filter(a=&gt;!t.some(l=&gt;!!(a.overscaledZ&lt;r&amp;&amp;l.isChildOf(a))||a.equals(l)||a.isChildOf(l))),n}coveringTiles(t){let i=this.coveringZoomLevel(t);const r=i,n=this.elevation&amp;&amp;this.elevation.exaggeration(),s=n&amp;&amp;!t.isTerrainDEM,a=this.projection.name==="mercator";if(t.minzoom!==void 0&amp;&amp;i&lt;t.minzoom)return[];t.maxzoom!==void 0&amp;&amp;i&gt;t.maxzoom&amp;&amp;(i=t.maxzoom);const l=this.locationCoordinate(this.center),h=this.center.lat,d=1&lt;&lt;i,f=[d*l.x,d*l.y,0],m=this.projection.name==="globe",_=!m,y=$s.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,i,_),x=m?this._camera.mercatorPosition:this.pointCoordinate(this.getCameraPoint()),b=d*ui(1,this.center.lat),w=this._camera.position[2]/ui(1,this.center.lat),T=[d*x.x,d*x.y,w*(_?1:b)],S=m||n,I=this.cameraToCenterDistance/t.tileSize*(t.roundZoom?1:.502),P=this.isLODDisabled(!0)?i:0;let M;if(this._elevation&amp;&amp;t.isTerrainDEM)M=1e4*this._elevation.exaggeration();else if(this._elevation){const X=this._elevation.getMinMaxForVisibleTiles();M=X?X.max:this._centerAltitude}else M=this._centerAltitude;const C=t.isTerrainDEM?-M:this._elevation?this._elevation.getMinElevationBelowMSL():0,D=this.projection.isReprojectedInTileSpace?Lb(this):1,O=X=&gt;{const ot=new Be(X.x+25e-6,X.y,X.z),lt=new Be(X.x,X.y+25e-6,X.z),at=X.toLngLat(),dt=ot.toLngLat(),ft=lt.toLngLat(),_t=this.locationCoordinate(at),ct=this.locationCoordinate(dt),bt=this.locationCoordinate(ft),Ot=Math.hypot(ct.x-_t.x,ct.y-_t.y),kt=Math.hypot(bt.x-_t.x,bt.y-_t.y);return Math.sqrt(Ot*kt)*D/25e-6},k=X=&gt;{const K=M,ot=C;return{aabb:mb(this,d,0,0,0,X,ot,K,this.projection),zoom:0,x:0,y:0,minZ:ot,maxZ:K,wrap:X,fullyVisible:!1}},z=[];let B=[];const U=i,Z=t.reparseOverscaled?r:i,F=X=&gt;X*X,Y=F((w-this._centerAltitude)*b),J=X=&gt;{if(!this._elevation||!X.tileID||!a)return;const K=this._elevation.getMinMaxForTile(X.tileID),ot=X.aabb;K?(ot.min[2]=K.min,ot.max[2]=K.max,ot.center[2]=(ot.min[2]+ot.max[2])/2):(X.shouldSplit=it(X),X.shouldSplit||(ot.min[2]=ot.max[2]=ot.center[2]=this._centerAltitude))},it=X=&gt;{if(X.zoom&lt;P)return!0;if(X.zoom===U)return!1;if(X.shouldSplit!=null)return X.shouldSplit;const K=X.aabb.distanceX(T),ot=X.aabb.distanceY(T);let lt=Y,at=1;if(m){lt=F(X.aabb.distanceZ(T));const _t=Math.pow(2,X.zoom),ct=Yi((X.y+1)/_t),bt=Yi(X.y/_t),Ot=Math.min(Math.max(h,ct),bt),kt=Ah(Ot)/Ah(h);if(at=Ot===h?1/Math.max(1,this._mercatorScaleRatio-.3):Math.min(1,kt/this._mercatorScaleRatio),this.zoom&lt;=Ac&amp;&amp;X.zoom===U-1&amp;&amp;kt&gt;=.9)return!0}else if(s&amp;&amp;(lt=F(X.aabb.distanceZ(T)*b)),this.projection.isReprojectedInTileSpace&amp;&amp;r&lt;=5){const _t=Math.pow(2,X.zoom),ct=O(new Be((X.x+.5)/_t,(X.y+.5)/_t));at=ct&gt;.85?1:ct}const dt=K*K+ot*ot+lt,ft=F((1&lt;&lt;U-X.zoom)*I*at*((_t,ct)=&gt;{if(ct*F(.707)&lt;_t)return 1;const bt=Math.sqrt(ct/_t);return bt/(1.4144271570014144+(Math.pow(1.1,bt-1.4144271570014144+1)-1)/(1.1-1)-1)})(Math.max(lt,Y),dt));return dt&lt;ft};if(this.renderWorldCopies)for(let X=1;X&lt;=3;X++)z.push(k(-X)),z.push(k(X));for(z.push(k(0));z.length&gt;0;){const X=z.pop(),K=X.x,ot=X.y;let lt=X.fullyVisible;const at=()=&gt;this.projection.name==="globe"&amp;&amp;(X.y===0||X.y===(1&lt;&lt;X.zoom)-1);if(!lt){let dt=S?X.aabb.intersects(y):X.aabb.intersectsFlat(y);if(dt===0&amp;&amp;at()){const ft=new In(X.zoom,K,ot);dt=Cm(this,d,ft,!0).intersects(y)}if(dt===0)continue;lt=dt===2}if(X.zoom!==U&amp;&amp;it(X))for(let dt=0;dt&lt;4;dt++){const ft=(K&lt;&lt;1)+dt%2,_t=(ot&lt;&lt;1)+(dt&gt;&gt;1),ct={aabb:a?X.aabb.quadrant(dt):mb(this,d,X.zoom+1,ft,_t,X.wrap,X.minZ,X.maxZ,this.projection),zoom:X.zoom+1,x:ft,y:_t,wrap:X.wrap,fullyVisible:lt,tileID:void 0,shouldSplit:void 0,minZ:X.minZ,maxZ:X.maxZ};s&amp;&amp;!m&amp;&amp;(ct.tileID=new We(X.zoom+1===U?Z:X.zoom+1,X.wrap,X.zoom+1,ft,_t),J(ct)),z.push(ct)}else{const dt=X.zoom===U?Z:X.zoom;if(t.minzoom&amp;&amp;t.minzoom&gt;dt)continue;if(!lt){let bt=S?X.aabb.intersectsPrecise(y):X.aabb.intersectsPreciseFlat(y);if(bt===0&amp;&amp;at()){const Ot=new In(X.zoom,K,ot);bt=Cm(this,d,Ot,!0).intersectsPrecise(y)}if(bt===0)continue}const ft=f[0]-(.5+K+(X.wrap&lt;&lt;X.zoom))*(1&lt;&lt;i-X.zoom),_t=f[1]-.5-ot,ct=X.tileID?X.tileID:new We(dt,X.wrap,X.zoom,K,ot);B.push({tileID:ct,distanceSq:ft*ft+_t*_t})}}if(this.fogCullDistSq){const X=this.fogCullDistSq,K=this.horizonLineFromTop();B=B.filter(ot=&gt;{const lt=[0,0,0,1],at=[ut,ut,0,1],dt=this.calculateFogTileMatrix(ot.tileID.toUnwrapped());oi.transformMat4(lt,lt,dt),oi.transformMat4(at,at,dt);const ft=function(bt,Ot,kt){let Ht=0;for(let Zt=0;Zt&lt;2;++Zt)bt[Zt]&gt;0&amp;&amp;(Ht+=(bt[Zt]-0)*(bt[Zt]-0)),Ot[Zt]&lt;0&amp;&amp;(Ht+=(0-Ot[Zt])*(0-Ot[Zt]));return Ht}(oi.min([],lt,at),oi.max([],lt,at));if(ft===0)return!0;let _t=!1;const ct=this._elevation;if(ct&amp;&amp;ft&gt;X&amp;&amp;K!==0){const bt=this.calculateProjMatrix(ot.tileID.toUnwrapped());let Ot;t.isTerrainDEM||(Ot=ct.getMinMaxForTile(ot.tileID)),Ot||(Ot={min:C,max:M});const kt=function(Zt){const fe=Math.round((Zt+45+360)%360/90)%4;return ts[fe]}(this.rotation),Ht=[kt[0]*ut,kt[1]*ut,Ot.max];W.transformMat4(Ht,Ht,bt),_t=(1-Ht[1])*this.height*.5&lt;K}return ft&lt;X||_t})}return B.sort((X,K)=&gt;X.distanceSq-K.distanceSq).map(X=&gt;X.tileID)}resize(t,i){this.width=t,this.height=i,this.pixelsToGLUnits=[2/t,-2/i],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(t){return Math.pow(2,t)}scaleZoom(t){return Math.log(t)/Math.LN2}project(t){const i=Xt(t.lat,-zi,zi),r=this.projection.project(t.lng,i);return new Q(r.x*this.worldSize,r.y*this.worldSize)}unproject(t){return this.projection.unproject(t.x/this.worldSize,t.y/this.worldSize)}get point(){return this.project(this.center)}get pointMerc(){return this.point._div(this.worldSize)}get pixelsPerMeterRatio(){return this.pixelsPerMeter/ui(1,this.center.lat)/this.worldSize}setLocationAtPoint(t,i){let r,n;const s=this.centerPoint;if(this.projection.name==="globe"){const l=this.worldSize;r=(i.x-s.x)/l,n=(i.y-s.y)/l}else{const l=this.pointCoordinate(i),h=this.pointCoordinate(s);r=l.x-h.x,n=l.y-h.y}const a=this.locationCoordinate(t);this.setLocation(new Be(a.x-r,a.y-n))}setLocation(t){this.center=this.coordinateLocation(t),this.projection.wrap&amp;&amp;(this.center=this.center.wrap())}locationPoint(t){return this.projection.locationPoint(this,t)}locationPoint3D(t){return this.projection.locationPoint(this,t,!0)}pointLocation(t){return this.coordinateLocation(this.pointCoordinate(t))}pointLocation3D(t){return this.coordinateLocation(this.pointCoordinate3D(t))}locationCoordinate(t,i){const r=i?ui(i,t.lat):void 0,n=this.projection.project(t.lng,t.lat);return new Be(n.x,n.y,r)}coordinateLocation(t){return this.projection.unproject(t.x,t.y)}pointRayIntersection(t,i){const r=i??this._centerAltitude,n=[t.x,t.y,0,1],s=[t.x,t.y,1,1];oi.transformMat4(n,n,this.pixelMatrixInverse),oi.transformMat4(s,s,this.pixelMatrixInverse);const a=s[3];oi.scale(n,n,1/n[3]),oi.scale(s,s,1/a);const l=n[2],h=s[2];return{p0:n,p1:s,t:l===h?0:(r-l)/(h-l)}}screenPointToMercatorRay(t){const i=[t.x,t.y,0,1],r=[t.x,t.y,1,1];return oi.transformMat4(i,i,this.pixelMatrixInverse),oi.transformMat4(r,r,this.pixelMatrixInverse),oi.scale(i,i,1/i[3]),oi.scale(r,r,1/r[3]),i[2]=ui(i[2],this._center.lat)*this.worldSize,r[2]=ui(r[2],this._center.lat)*this.worldSize,oi.scale(i,i,1/this.worldSize),oi.scale(r,r,1/this.worldSize),new bh([i[0],i[1],i[2]],W.normalize([],W.sub([],r,i)))}rayIntersectionCoordinate(t){const{p0:i,p1:r,t:n}=t,s=ui(i[2],this._center.lat),a=ui(r[2],this._center.lat);return new Be(ge(i[0],r[0],n)/this.worldSize,ge(i[1],r[1],n)/this.worldSize,ge(s,a,n))}pointCoordinate(t,i=this._centerAltitude){return this.projection.pointCoordinate(this,t.x,t.y,i)}pointCoordinate3D(t){if(!this.elevation)return this.pointCoordinate(t);let i=this.projection.pointCoordinate3D(this,t.x,t.y);if(i)return new Be(i[0],i[1],i[2]);let r=0,n=this.horizonLineFromTop();if(t.y&gt;n)return this.pointCoordinate(t);const s=.02*n,a=t.clone();for(let l=0;l&lt;10&amp;&amp;n-r&gt;s;l++){a.y=ge(r,n,.66);const h=this.projection.pointCoordinate3D(this,a.x,a.y);h?(n=a.y,i=h):r=a.y}return i?new Be(i[0],i[1],i[2]):this.pointCoordinate(t)}isPointAboveHorizon(t){return this.projection.isPointAboveHorizon(this,t)}isPointOnSurface(t){if(t.y&lt;0||t.y&gt;this.height||t.x&lt;0||t.x&gt;this.width)return!1;if(this.elevation||this.zoom&gt;=To)return!this.isPointAboveHorizon(t);const i=this.pointCoordinate(t);return i.y&gt;=0&amp;&amp;i.y&lt;=1}_coordinatePoint(t,i){const r=i&amp;&amp;this.elevation?this.elevation.getAtPointOrZero(t,this._centerAltitude):this._centerAltitude,n=[t.x*this.worldSize,t.y*this.worldSize,r+t.toAltitude(),1];return oi.transformMat4(n,n,this.pixelMatrix),n[3]&gt;0?new Q(n[0]/n[3],n[1]/n[3]):new Q(Number.MAX_VALUE,Number.MAX_VALUE)}_getBoundsNonRectangular(){const{top:t,left:i}=this._edgeInsets,r=this.height-this._edgeInsets.bottom,n=this.width-this._edgeInsets.right,s=this.pointLocation3D(new Q(i,t)),a=this.pointLocation3D(new Q(n,t)),l=this.pointLocation3D(new Q(n,r)),h=this.pointLocation3D(new Q(i,r));let d=Math.min(s.lng,a.lng,l.lng,h.lng),f=Math.max(s.lng,a.lng,l.lng,h.lng),m=Math.min(s.lat,a.lat,l.lat,h.lat),_=Math.max(s.lat,a.lat,l.lat,h.lat);const y=Math.pow(2,-this.zoom)/16*270,x=this.projection.name==="globe"?1:4,b=(w,T,S,I,P)=&gt;{const M=(w+S)/2,C=(T+I)/2,D=new Q(M,C),{lng:O,lat:k}=this.pointLocation3D(D),z=Math.max(0,d-O,m-k,O-f,k-_);d=Math.min(d,O),f=Math.max(f,O),m=Math.min(m,k),_=Math.max(_,k),(P&lt;x||z&gt;y)&amp;&amp;(b(w,T,M,C,P+1),b(M,C,S,I,P+1))};if(b(i,t,n,t,1),b(n,t,n,r,1),b(n,r,i,r,1),b(i,r,i,t,1),this.projection.name==="globe"){const[w,T]=function(S){const I=nt.identity(new Float64Array(16));nt.multiply(I,S.pixelMatrix,S.globeMatrix);const P=[0,Pn,0],M=[0,Cn,0];return W.transformMat4(P,P,I),W.transformMat4(M,M,I),[P[0]&gt;0&amp;&amp;P[0]&lt;=S.width&amp;&amp;P[1]&gt;0&amp;&amp;P[1]&lt;=S.height&amp;&amp;!Sh(S,new ye(S.center.lat,90)),M[0]&gt;0&amp;&amp;M[0]&lt;=S.width&amp;&amp;M[1]&gt;0&amp;&amp;M[1]&lt;=S.height&amp;&amp;!Sh(S,new ye(S.center.lat,-90))]}(this);w?(_=90,f=180,d=-180):T&amp;&amp;(m=-90,f=180,d=-180)}return new Qr(new ye(d,m),new ye(f,_))}_getBoundsRectangular(t,i){const{top:r,left:n}=this._edgeInsets,s=this.height-this._edgeInsets.bottom,a=this.width-this._edgeInsets.right,l=new Q(n,r),h=new Q(a,r),d=new Q(a,s),f=new Q(n,s);let m=this.pointCoordinate(l,t),_=this.pointCoordinate(h,t);const y=this.pointCoordinate(d,i),x=this.pointCoordinate(f,i),b=(w,T)=&gt;(T.y-w.y)/(T.x-w.x);return m.y&gt;1&amp;&amp;_.y&gt;=0?m=new Be((1-x.y)/b(x,m)+x.x,1):m.y&lt;0&amp;&amp;_.y&lt;=1&amp;&amp;(m=new Be(-x.y/b(x,m)+x.x,0)),_.y&gt;1&amp;&amp;m.y&gt;=0?_=new Be((1-y.y)/b(y,_)+y.x,1):_.y&lt;0&amp;&amp;m.y&lt;=1&amp;&amp;(_=new Be(-y.y/b(y,_)+y.x,0)),new Qr().extend(this.coordinateLocation(m)).extend(this.coordinateLocation(_)).extend(this.coordinateLocation(x)).extend(this.coordinateLocation(y))}_getBoundsRectangularTerrain(){const t=this.elevation;if(!t.visibleDemTiles.length||t.isUsingMockSource())return this._getBoundsRectangular(0,0);const i=t.visibleDemTiles.reduce((r,n)=&gt;{if(n.dem){const s=n.dem.tree;r.min=Math.min(r.min,s.minimums[0]),r.max=Math.max(r.max,s.maximums[0])}return r},{min:Number.MAX_VALUE,max:0});return this._getBoundsRectangular(i.min*t.exaggeration(),i.max*t.exaggeration())}getBounds(){return this.projection.name==="mercator"||this.projection.name==="equirectangular"?this._terrainEnabled()?this._getBoundsRectangularTerrain():this._getBoundsRectangular(0,0):this._getBoundsNonRectangular()}horizonLineFromTop(t=!0){const i=this.height/2/Math.tan(this._fov/2)/Math.tan(Math.max(this._pitch,.1))-this.centerOffset.y,r=this.height/2-i*(1-this._horizonShift);return t?Math.max(0,r):r}getMaxBounds(){return this.maxBounds}setMaxBounds(t){this.maxBounds=t,this.minLat=-zi,this.maxLat=zi,this.minLng=-180,this.maxLng=180,t&amp;&amp;(this.minLat=t.getSouth(),this.maxLat=t.getNorth(),this.minLng=t.getWest(),this.maxLng=t.getEast(),this.maxLng&lt;this.minLng&amp;&amp;(this.maxLng+=360)),this.worldMinX=er(this.minLng)*this.tileSize,this.worldMaxX=er(this.maxLng)*this.tileSize,this.worldMinY=sr(this.maxLat)*this.tileSize,this.worldMaxY=sr(this.minLat)*this.tileSize,this._constrain()}calculatePosMatrix(t,i){return this.projection.createTileMatrix(this,i,t)}calculateDistanceTileData(t){const i=t.key,r=this._distanceTileDataCache;if(r[i])return r[i];const n=t.canonical,s=1/this.height,a=this.cameraWorldSize,l=a/this.zoomScale(n.z),h=(n.x+Math.pow(2,n.z)*t.wrap)*l,d=n.y*l,f=this.point;f.x*=a/this.worldSize,f.y*=a/this.worldSize;const m=this.angle,_=Math.sin(-m),y=-Math.cos(-m);return r[i]={bearing:[_,y],center:[(f.x-h)*s,(f.y-d)*s],scale:l/ut*s},r[i]}calculateFogTileMatrix(t){const i=t.key,r=this._fogTileMatrixCache;if(r[i])return r[i];const n=this.projection.createTileMatrix(this,this.cameraWorldSizeForFog,t);return nt.multiply(n,this.worldToFogMatrix,n),r[i]=new Float32Array(n),r[i]}calculateProjMatrix(t,i=!1,r=!1){const n=t.key;let s;if(s=r?this._expandedProjMatrixCache:i?this._alignedProjMatrixCache:this._projMatrixCache,s[n])return s[n];const a=this.calculatePosMatrix(t,this.worldSize);let l;return l=this.projection.isReprojectedInTileSpace?this.mercatorMatrix:r?this.expandedFarZProjMatrix:i?this.alignedProjMatrix:this.projMatrix,nt.multiply(a,l,a),s[n]=new Float32Array(a),s[n]}calculatePixelsToTileUnitsMatrix(t){const i=t.tileID.key,r=this._pixelsToTileUnitsCache;if(r[i])return r[i];const n=function(s,a){const{scale:l}=s.tileTransform,h=l*ut/(s.tileSize*Math.pow(2,a.zoom-s.tileID.overscaledZ+s.tileID.canonical.z));return il.scale(new Float32Array(4),a.inverseAdjustmentMatrix,[h,h])}(t,this);return r[i]=n,r[i]}customLayerMatrix(){return this.mercatorMatrix.slice()}globeToMercatorMatrix(){if(this.projection.name==="globe"){const t=1/this.worldSize,i=nt.fromScaling([],[t,t,t]);return nt.multiply(i,i,this.globeMatrix),i}}recenterOnTerrain(){if(!this._elevation||this.projection.name==="globe")return;const t=this._elevation;this._updateCameraState();const i=ui(1,this._center.lat)*this.worldSize,r=this._computeCameraPosition(i),n=this._camera.forward(),s=ui(1,this._center.lat);r[2]/=s,n[2]/=s,W.normalize(n,n);const a=t.raycast(r,n,t.exaggeration());if(a){const l=W.scaleAndAdd([],r,n,a),h=new Be(l[0],l[1],ui(l[2],Yi(l[1]))),d=(h.z+W.length([h.x-r[0],h.y-r[1],h.z-r[2]*s]))*this._pixelsPerMercatorPixel;this._seaLevelZoom=this._zoomFromMercatorZ(d),this._centerAltitude=h.toAltitude(),this._center=this.coordinateLocation(h),this._updateZoomFromElevation(),this._constrain(),this._calcMatrices()}}_constrainCamera(t=!1){if(!this._elevation)return;const i=this._elevation,r=ui(1,this._center.lat)*this.worldSize,n=this._computeCameraPosition(r),s=i.getAtPointOrZero(new Be(...n)),a=this.pixelsPerMeter/this.worldSize*s,l=this._minimumHeightOverTerrain(),h=n[2]-a;if(h&lt;=l)if(h&lt;0||t){const d=this.locationCoordinate(this._center,this._centerAltitude),f=[n[0],n[1],d.z-n[2]],m=W.length(f);f[2]-=(l-h)/this._pixelsPerMercatorPixel;const _=W.length(f);if(_===0)return;W.scale(f,f,m/_*this._pixelsPerMercatorPixel),this._camera.position=[n[0],n[1],d.z*this._pixelsPerMercatorPixel-f[2]],this._updateStateFromCamera()}else this._isCameraConstrained=!0}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;const t=this.projection.name==="globe"||this.mercatorFromTransition;if(this.projection.isReprojectedInTileSpace||t){const _=this.center;return _.lat=Xt(_.lat,this.minLat,this.maxLat),(this.maxBounds||!this.renderWorldCopies&amp;&amp;!t)&amp;&amp;(_.lng=Xt(_.lng,this.minLng,this.maxLng)),this.center=_,void(this._constraining=!1)}const i=this._unmodified,{x:r,y:n}=this.point;let s=0,a=r,l=n;const h=this.width/2,d=this.height/2,f=this.worldMinY*this.scale,m=this.worldMaxY*this.scale;if(n-d&lt;f&amp;&amp;(l=f+d),n+d&gt;m&amp;&amp;(l=m-d),m-f&lt;this.height&amp;&amp;(s=Math.max(s,this.height/(m-f)),l=(m+f)/2),this.maxBounds||!this._renderWorldCopies||!this.projection.wrap){const _=this.worldMinX*this.scale,y=this.worldMaxX*this.scale,x=this.worldSize/2-(_+y)/2;a=(r+x+this.worldSize)%this.worldSize-x,a-h&lt;_&amp;&amp;(a=_+h),a+h&gt;y&amp;&amp;(a=y-h),y-_&lt;this.width&amp;&amp;(s=Math.max(s,this.width/(y-_)),a=(y+_)/2)}a===r&amp;&amp;l===n||(this.center=this.unproject(new Q(a,l))),s&amp;&amp;(this.zoom+=this.scaleZoom(s)),this._constrainCamera(),this._unmodified=i,this._constraining=!1}_minZoomForBounds(){let t=Math.max(0,this.scaleZoom(this.height/(this.worldMaxY-this.worldMinY)));return this.maxBounds&amp;&amp;(t=Math.max(t,this.scaleZoom(this.width/(this.worldMaxX-this.worldMinX)))),t}_maxCameraBoundsDistance(){return this._mercatorZfromZoom(this._minZoomForBounds())}_calcMatrices(){if(!this.height)return;const t=this.centerOffset,i=this.projection.name==="globe",r=this.pixelsPerMeter;this.projection.name==="globe"&amp;&amp;(this._mercatorScaleRatio=ui(1,this.center.lat)/ui(1,45));const n=Hc(this.projection,this.zoom,this.width,this.height,1024);this._pixelsPerMercatorPixel=this.projection.pixelSpaceConversion(this.center.lat,this.worldSize,n),this.cameraToCenterDistance=.5/Math.tan(.5*this._fov)*this.height*this._pixelsPerMercatorPixel,this._updateCameraState(),this._farZ=this.projection.farthestPixelDistance(this),this._nearZ=this.height/50;const s=this.projection.zAxisUnit==="meters"?r:1,a=this._camera.getWorldToCamera(this.worldSize,s);let l;const h=this._camera.getCameraToClipPerspective(this._fov,this.width/this.height,this._nearZ,this._farZ);if(h[8]=2*-t.x/this.width,h[9]=2*t.y/this.height,this.isOrthographic){let k=.5*this.height/Math.tan(this._fov/2)*1*Math.tan(.5*this._fov),z=k*this.aspect,B=-z,U=-k;z-=t.x,B-=t.x,k+=t.y,U+=t.y,l=this._camera.getCameraToClipOrthographic(B,z,U,k,this._nearZ,this._farZ),((Z,F,Y,J)=&gt;{for(let it=0;it&lt;16;it++)Z[it]=Gb(F[it],Y[it],J)})(l,l,h,Hb(this.pitch&gt;=15?1:this.pitch/15))}else l=h;const d=nt.mul([],h,a);let f=nt.mul([],l,a);if(this.projection.isReprojectedInTileSpace){const k=this.locationCoordinate(this.center),z=nt.identity([]);nt.translate(z,z,[k.x*this.worldSize,k.y*this.worldSize,0]),nt.multiply(z,z,Cb(this)),nt.translate(z,z,[-k.x*this.worldSize,-k.y*this.worldSize,0]),nt.multiply(f,f,z),nt.multiply(d,d,z),this.inverseAdjustmentMatrix=function(B){const U=Cb(B,!0);return il.invert([],[U[0],U[1],U[4],U[5]])}(this)}else this.inverseAdjustmentMatrix=[1,0,0,1];if(this.mercatorMatrix=nt.scale([],f,[this.worldSize,this.worldSize,this.worldSize/s,1]),this.projMatrix=f,this.invProjMatrix=nt.invert(new Float64Array(16),this.projMatrix),i){const k=this._camera.getCameraToClipPerspective(this._fov,this.width/this.height,this._nearZ,1/0);k[8]=2*-t.x/this.width,k[9]=2*t.y/this.height,this.expandedFarZProjMatrix=nt.mul([],k,a)}else this.expandedFarZProjMatrix=this.projMatrix;const m=nt.invert([],l);this.frustumCorners=Mm.fromInvProjectionMatrix(m,this.horizonLineFromTop(),this.height),this.cameraFrustum=$s.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,0,!i);const _=new Float32Array(16);nt.identity(_),nt.scale(_,_,[1,-1,1]),nt.rotateX(_,_,this._pitch),nt.rotateZ(_,_,this.angle);const y=nt.perspective(new Float32Array(16),this._fov,this.width/this.height,this._nearZ,this._farZ);this.starsProjMatrix=nt.clone(y);const x=(Math.PI/2-this._pitch)*(this.height/this._fov)*this._horizonShift;y[8]=2*-t.x/this.width,y[9]=2*(t.y+x)/this.height,this.skyboxMatrix=nt.multiply(_,y,_);const b=this.point,w=b.x,T=b.y,S=this.width%2/2,I=this.height%2/2,P=Math.cos(this.angle),M=Math.sin(this.angle),C=w-Math.round(w)+P*S+M*I,D=T-Math.round(T)+P*I+M*S,O=new Float64Array(f);if(nt.translate(O,O,[C&gt;.5?C-1:C,D&gt;.5?D-1:D,0]),this.alignedProjMatrix=O,f=nt.create(),nt.scale(f,f,[this.width/2,-this.height/2,1]),nt.translate(f,f,[1,-1,0]),this.labelPlaneMatrix=f,f=nt.create(),nt.scale(f,f,[1,-1,1]),nt.translate(f,f,[-1,-1,0]),nt.scale(f,f,[2/this.width,2/this.height,1]),this.glCoordMatrix=f,this.pixelMatrix=nt.multiply(new Float64Array(16),this.labelPlaneMatrix,d),this._calcFogMatrices(),this._distanceTileDataCache={},f=nt.invert(new Float64Array(16),this.pixelMatrix),!f)throw new Error("failed to invert matrix");if(this.pixelMatrixInverse=f,this.projection.name==="globe"||this.mercatorFromTransition){this.globeMatrix=function(z){const{x:B,y:U}=z.point,{lng:Z,lat:F}=z._center;return Jv(B,U,z.worldSize,Z,F)}(this);const k=[this.globeMatrix[12],this.globeMatrix[13],this.globeMatrix[14]];this.globeCenterInViewSpace=W.transformMat4(k,k,a),this.globeRadius=this.worldSize/2/Math.PI-1}else this.globeMatrix=f;this._projMatrixCache={},this._alignedProjMatrixCache={},this._pixelsToTileUnitsCache={},this._expandedProjMatrixCache={}}_calcFogMatrices(){this._fogTileMatrixCache={};const t=this.cameraWorldSizeForFog,i=this.cameraPixelsPerMeter,r=this._camera.position,n=1/this.height/this._pixelsPerMercatorPixel,s=[t,t,i];W.scale(s,s,n),W.scale(r,r,-1),W.multiply(r,r,s);const a=nt.create();nt.translate(a,a,r),nt.scale(a,a,s),this.mercatorFogMatrix=a,this.worldToFogMatrix=this._camera.getWorldToCameraPosition(t,i,n)}_computeCameraPosition(t){const i=(t=t||this.pixelsPerMeter)/this.pixelsPerMeter,r=this._camera.forward(),n=this.point,s=this._mercatorZfromZoom(this._seaLevelZoom?this._seaLevelZoom:this._zoom)*i-t/this.worldSize*this._centerAltitude;return[n.x/this.worldSize-r[0]*s,n.y/this.worldSize-r[1]*s,t/this.worldSize*this._centerAltitude-r[2]*s]}_updateCameraState(){this.height&amp;&amp;(this._camera.setPitchBearing(this._pitch,this.angle),this._camera.position=this._computeCameraPosition())}_translateCameraConstrained(t){const i=this._maxCameraBoundsDistance()*Math.cos(this._pitch),r=this._camera.position[2],n=t[2];let s=1;this.projection.wrap&amp;&amp;(this.center=this.center.wrap()),n&gt;0&amp;&amp;(s=Math.min((i-r)/n,1)),this._camera.position=W.scaleAndAdd([],this._camera.position,t,s),this._updateStateFromCamera()}_updateStateFromCamera(){const t=this._camera.position,i=this._camera.forward(),{pitch:r,bearing:n}=this._camera.getPitchBearing(),s=ui(this._centerAltitude,this.center.lat)*this._pixelsPerMercatorPixel,a=this._mercatorZfromZoom(this._maxZoom)*Math.cos($t(this._maxPitch)),l=Math.max((t[2]-s)/Math.cos(r),a),h=this._zoomFromMercatorZ(l);W.scaleAndAdd(t,t,i,l),this._pitch=Xt(r,$t(this.minPitch),$t(this.maxPitch)),this.angle=Hr(n,-Math.PI,Math.PI),this._setZoom(Xt(h,this._minZoom,this._maxZoom)),this._updateSeaLevelZoom(),this._center=this.coordinateLocation(new Be(t[0],t[1],t[2])),this._unmodified=!1,this._constrain(),this._calcMatrices()}_worldSizeFromZoom(t){return Math.pow(2,t)*this.tileSize}_mercatorZfromZoom(t){return this.cameraToCenterDistance/this._worldSizeFromZoom(t)}_minimumHeightOverTerrain(){const t=Math.min((this._seaLevelZoom!=null?this._seaLevelZoom:this._zoom)+4,this._maxZoom);return this._mercatorZfromZoom(t)}_zoomFromMercatorZ(t){return this.scaleZoom(this.cameraToCenterDistance/(t*this.tileSize))}zoomFromMercatorZAdjusted(t){let i=0,r=To,n=0,s=1/0;for(;r-i&gt;1e-6&amp;&amp;r&gt;i;){const a=i+.5*(r-i),l=this.tileSize*Math.pow(2,a),h=this.getCameraToCenterDistance(this.projection,a,l),d=this.scaleZoom(h/(t*this.tileSize)),f=Math.abs(a-d);f&lt;s&amp;&amp;(s=f,n=a),a&lt;d?i=a:r=a}return n}_terrainEnabled(){return!(!this._elevation||!this.projection.supportsTerrain&amp;&amp;(tt("Terrain is not yet supported with alternate projections. Use mercator or globe to enable terrain."),1))}anyCornerOffEdge(t,i){const r=Math.min(t.x,i.x),n=Math.max(t.x,i.x),s=Math.min(t.y,i.y),a=Math.max(t.y,i.y);if(s&lt;this.horizonLineFromTop(!1))return!0;if(this.projection.name!=="mercator")return!1;const l=[new Q(r,s),new Q(n,a),new Q(r,a),new Q(n,s)],h=this.renderWorldCopies?-3:0,d=this.renderWorldCopies?4:1;for(const f of l){const m=this.pointRayIntersection(f);if(m.t&lt;0)return!0;const _=this.rayIntersectionCoordinate(m);if(_.x&lt;h||_.y&lt;0||_.x&gt;d||_.y&gt;1)return!0}return!1}isHorizonVisible(){return this.pitch+vi(this.fovAboveCenter)&gt;88||this.anyCornerOffEdge(new Q(0,0),new Q(this.width,this.height))}zoomDeltaToMovement(t,i){const r=W.length(W.sub([],this._camera.position,t)),n=this._zoomFromMercatorZ(r)+i;return r-this._mercatorZfromZoom(n)}getCameraPoint(){if(this.projection.name==="globe"){const t=function([i,r,n],s){const a=[i,r,n,1];oi.transformMat4(a,a,s);const l=a[3]=Math.max(a[3],1e-6);return a[0]/=l,a[1]/=l,a[2]/=l,a}([this.globeMatrix[12],this.globeMatrix[13],this.globeMatrix[14]],this.pixelMatrix);return new Q(t[0],t[1])}{const t=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new Q(0,t))}}getCameraToCenterDistance(t,i=this.zoom,r=this.worldSize){const n=Hc(t,i,this.width,this.height,1024),s=t.pixelSpaceConversion(this.center.lat,r,n);let a=.5/Math.tan(.5*this._fov)*this.height*s;return this.isOrthographic&amp;&amp;(a=Gb(1,a,Hb(this.pitch&gt;=15?1:this.pitch/15))),a}getWorldToCameraMatrix(){const t=this._camera.getWorldToCamera(this.worldSize,this.projection.zAxisUnit==="meters"?this.pixelsPerMeter:1);return this.projection.name==="globe"&amp;&amp;nt.multiply(t,t,this.globeMatrix),t}getFrustum(t){return $s.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,t,this.projection.zAxisUnit==="meters")}}function Wb(e,t,i){nt.identity(e),nt.rotateZ(e,e,$t(t[2])),nt.rotateX(e,e,$t(t[0])),nt.rotateY(e,e,$t(t[1])),nt.scale(e,e,i),nt.multiply(e,e,[1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,1])}function dd(e,t,i,r,n,s,a,l){const h=[i[0]-t[0],i[1]-t[1],0],d=[r[0]-t[0],r[1]-t[1],0];if(W.length(h)&lt;1e-12||W.length(d)&lt;1e-12)return vr.identity(e);const f=W.cross([],h,d);W.normalize(f,f),W.subtract(d,r,t),h[2]=(s-n)*l,d[2]=(a-n)*l;const m=h;return W.cross(m,h,d),W.normalize(m,m),vr.rotationTo(e,f,m)}function qb(e,t,i=!1){const r=hr(t.zoom),n=function(s,a,l){const h=a.worldSize,d=[s[12],s[13],s[14]],f=Yi(d[1]/h),m=tn(d[0]/h),_=nt.identity([]),y=ui(1,f)*h,x=ui(1,0)*h*Ao(f,a.zoom),b=1/Dm(h);let w=x*b;if(l){const P=Hc(a.projection,a.zoom,a.width,a.height,1024);w=b*a.projection.pixelSpaceConversion(a.center.lat,h,P)}const T=Nr(f,m);W.add(T,T,W.scale([],W.normalize([],T),y*w*d[2]));const S=function(P){const M=[P[0],P[1],P[2]];let C=[0,1,0];const D=W.cross([],C,M);return W.cross(C,M,D),W.squaredLength(C)===0&amp;&amp;(C=[0,1,0],W.cross(D,M,C)),W.normalize(D,D),W.normalize(C,C),W.normalize(M,M),[D[0],D[1],D[2],0,C[0],C[1],C[2],0,M[0],M[1],M[2],0,P[0],P[1],P[2],1]}(T);nt.scale(_,_,[w,w,w*y]),nt.translate(_,_,[-d[0],-d[1],-d[2]]);const I=nt.multiply([],a.globeMatrix,S);return nt.multiply(I,I,_),nt.multiply(I,I,s),I}(e,t,i);if(r&gt;0){const s=function(a,l){const h=l.worldSize,d=ui(1,0)*h*Ao(l.center.lat,l.zoom)/Dm(h),f=ui(1,l.center.lat)*h,m=nt.identity([]);return nt.rotateY(m,m,$t(l.center.lng)),nt.rotateX(m,m,$t(l.center.lat)),nt.translate(m,m,[0,0,Dr]),nt.scale(m,m,[d,d,d*f]),nt.translate(m,m,[l.point.x-.5*h,l.point.y-.5*h,0]),nt.multiply(m,m,a),nt.multiply(m,l.globeMatrix,m)}(e,t);return function(a,l,h){const d=(x,b,w)=&gt;{const T=W.length(x),S=W.length(b),I=Xs(x,b,w);return W.scale(I,I,1/W.length(I)*ge(T,S,w))},f=d([a[0],a[1],a[2]],[l[0],l[1],l[2]],h),m=d([a[4],a[5],a[6]],[l[4],l[5],l[6]],h),_=d([a[8],a[9],a[10]],[l[8],l[9],l[10]],h),y=Xs([a[12],a[13],a[14]],[l[12],l[13],l[14]],h);return[f[0],f[1],f[2],0,m[0],m[1],m[2],0,_[0],_[1],_[2],0,y[0],y[1],y[2],1]}(n,s,r)}return n}const pa=64,GL=[1,1,1];class Zb{constructor(t,i,r,n){this.id=t,this.position=i!=null?new ye(i[0],i[1]):new ye(0,0),this.orientation=r??[0,0,0],this.nodes=n,this.uploaded=!1,this.aabb=new mi([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),this.matrix=[]}_applyTransformations(t,i){if(nt.multiply(t.matrix,i,t.matrix),t.meshes)for(const r of t.meshes){const n=mi.applyTransform(r.aabb,t.matrix);this.aabb.encapsulate(n)}if(t.children)for(const r of t.children)this._applyTransformations(r,t.matrix)}computeBoundsAndApplyParent(){const t=nt.identity([]);for(const i of this.nodes)this._applyTransformations(i,t)}_positionModelOnTerrain(t,i){const r=t.elevation;if(!r)return 0;const n=mi.projectAabbCorners(this.aabb,this.matrix),s=ui(1,this.position.lat)*t.worldSize,a=function(T,S){const I=[0,0,1],P=[{corners:[0,1,3,2],dotProductWithUp:0},{corners:[1,5,2,6],dotProductWithUp:0},{corners:[0,4,1,5],dotProductWithUp:0},{corners:[2,6,3,7],dotProductWithUp:0},{corners:[4,7,5,6],dotProductWithUp:0},{corners:[0,3,4,7],dotProductWithUp:0}];for(const M of P){const C=T[M.corners[0]],D=T[M.corners[1]],O=T[M.corners[2]],k=[D[0]-C[0],D[1]-C[1],S*(D[2]-C[2])],z=W.cross(k,k,[O[0]-C[0],O[1]-C[1],S*(O[2]-C[2])]);W.normalize(z,z),M.dotProductWithUp=W.dot(z,I)}return P.sort((M,C)=&gt;M.dotProductWithUp-C.dotProductWithUp),P[0].corners}(n,s),l=n[a[0]],h=n[a[1]],d=n[a[2]],f=n[a[3]],m=r.getAtPointOrZero(new Be(l[0]/t.worldSize,l[1]/t.worldSize),0),_=r.getAtPointOrZero(new Be(h[0]/t.worldSize,h[1]/t.worldSize),0),y=r.getAtPointOrZero(new Be(d[0]/t.worldSize,d[1]/t.worldSize),0),x=r.getAtPointOrZero(new Be(f[0]/t.worldSize,f[1]/t.worldSize),0),b=(m+x)/2,w=(_+y)/2;return b&gt;w?_&lt;y?dd(i,h,f,l,_,x,m,s):dd(i,d,l,f,y,m,x,s):m&lt;x?dd(i,l,h,d,m,_,y,s):dd(i,f,d,h,x,y,_,s),Math.max(b,w)}computeModelMatrix(t,i,r,n,s,a,l=!1){const h=t.transform,d=h.zoom,f=h.project(this.position),m=Ao(this.position.lat,d),_=1/m;nt.identity(this.matrix),nt.translate(this.matrix,this.matrix,[f.x+n[0]*_,f.y+n[1]*_,n[2]]);let y=1,x=1;const b=h.worldSize;if(l){if(h.projection.name==="mercator"){let I=0;h.elevation&amp;&amp;(I=h.elevation.getAtPointOrZero(new Be(f.x/b,f.y/b),0));const P=oi.transformMat4([],[f.x,f.y,I,1],h.projMatrix)[3]/h.cameraToCenterDistance;y=P,x=P*Ao(h.center.lat,d)}else if(h.projection.name==="globe"){const I=qb(this.matrix,h),P=nt.multiply([],h.projMatrix,I),M=[0,0,0,1];oi.transformMat4(M,M,P);const C=M[3]/h.cameraToCenterDistance,D=hr(d),O=h.projection.pixelsPerMeter(this.position.lat,b)*Ao(this.position.lat,d),k=h.projection.pixelsPerMeter(h.center.lat,b)*Ao(h.center.lat,d);y=C/ge(O,a1(h.center.lat),D),x=C*m/O,y*=k,x*=k}}else y=_;nt.scale(this.matrix,this.matrix,[y,y,x]);const w=[...this.matrix],T=this.orientation,S=[];if(Wb(S,[T[0]+i[0],T[1]+i[1],T[2]+i[2]],r),nt.multiply(this.matrix,w,S),s&amp;&amp;h.elevation){let I=0;const P=[];if(a&amp;&amp;h.elevation){I=this._positionModelOnTerrain(h,P);const M=nt.fromQuat([],P),C=nt.multiply([],M,S);nt.multiply(this.matrix,w,C)}else I=h.elevation.getAtPointOrZero(new Be(f.x/b,f.y/b),0);I!==0&amp;&amp;(this.matrix[14]+=I)}}upload(t){if(!this.uploaded){for(const i of this.nodes)b_(i,t);for(const i of this.nodes)fd(i);this.uploaded=!0}}destroy(){for(const t of this.nodes)pd(t)}}function Wc(e,t,i=!1){e.uploaded||(e.gfxTexture=new Ii(t,e.image,i?t.gl.R8:t.gl.RGBA,{useMipmap:e.sampler.minFilter&gt;=t.gl.NEAREST_MIPMAP_NEAREST}),e.uploaded=!0,e.image=null)}function HL(e,t,i){e.indexBuffer=t.createIndexBuffer(e.indexArray,!1,!0),e.vertexBuffer=t.createVertexBuffer(e.vertexArray,DL.members,!1,!0),e.normalArray&amp;&amp;(e.normalBuffer=t.createVertexBuffer(e.normalArray,FL.members,!1,!0)),e.texcoordArray&amp;&amp;(e.texcoordBuffer=t.createVertexBuffer(e.texcoordArray,zL.members,!1,!0)),e.colorArray&amp;&amp;(e.colorBuffer=t.createVertexBuffer(e.colorArray,(e.colorArray.bytesPerElement===12?OL:kL).members,!1,!0)),e.featureArray&amp;&amp;(e.pbrBuffer=t.createVertexBuffer(e.featureArray,NL.members,!0)),e.segments=si.simpleSegment(0,0,e.vertexArray.length,e.indexArray.length);const r=e.material;r.pbrMetallicRoughness.baseColorTexture&amp;&amp;Wc(r.pbrMetallicRoughness.baseColorTexture,t),r.pbrMetallicRoughness.metallicRoughnessTexture&amp;&amp;Wc(r.pbrMetallicRoughness.metallicRoughnessTexture,t),r.normalTexture&amp;&amp;Wc(r.normalTexture,t),r.occlusionTexture&amp;&amp;Wc(r.occlusionTexture,t,i),r.emissionTexture&amp;&amp;Wc(r.emissionTexture,t)}function b_(e,t,i){if(e.meshes)for(const r of e.meshes)HL(r,t,i);if(e.children)for(const r of e.children)b_(r,t,i)}function fd(e){if(e.meshes)for(const t of e.meshes)t.indexArray.destroy(),t.vertexArray.destroy(),t.colorArray&amp;&amp;t.colorArray.destroy(),t.normalArray&amp;&amp;t.normalArray.destroy(),t.texcoordArray&amp;&amp;t.texcoordArray.destroy(),t.featureArray&amp;&amp;t.featureArray.destroy();if(e.children)for(const t of e.children)fd(t)}function pd(e){if(e.meshes)for(const i of e.meshes)i.vertexBuffer&amp;&amp;(i.vertexBuffer.destroy(),i.indexBuffer.destroy(),i.normalBuffer&amp;&amp;i.normalBuffer.destroy(),i.texcoordBuffer&amp;&amp;i.texcoordBuffer.destroy(),i.colorBuffer&amp;&amp;i.colorBuffer.destroy(),i.pbrBuffer&amp;&amp;i.pbrBuffer.destroy(),i.segments.destroy(),i.material&amp;&amp;((t=i.material).pbrMetallicRoughness.baseColorTexture&amp;&amp;t.pbrMetallicRoughness.baseColorTexture.gfxTexture&amp;&amp;t.pbrMetallicRoughness.baseColorTexture.gfxTexture.destroy(),t.pbrMetallicRoughness.metallicRoughnessTexture&amp;&amp;t.pbrMetallicRoughness.metallicRoughnessTexture.gfxTexture&amp;&amp;t.pbrMetallicRoughness.metallicRoughnessTexture.gfxTexture.destroy(),t.normalTexture&amp;&amp;t.normalTexture.gfxTexture&amp;&amp;t.normalTexture.gfxTexture.destroy(),t.emissionTexture&amp;&amp;t.emissionTexture.gfxTexture&amp;&amp;t.emissionTexture.gfxTexture.destroy(),t.occlusionTexture&amp;&amp;t.occlusionTexture.gfxTexture&amp;&amp;t.occlusionTexture.gfxTexture.destroy()));var t;if(e.children)for(const i of e.children)pd(i)}class $b{constructor(t,i){this.feature=t,this.instancedDataOffset=i,this.instancedDataCount=0,this.rotation=[0,0,0],this.scale=[1,1,1],this.translation=[0,0,0]}}class Xb{constructor(){this.instancedDataArray=new rm,this.instancesEvaluatedElevation=[],this.features=[],this.idToFeaturesIndex={}}}class Yb{constructor(t){this.zoom=t.zoom,this.canonical=t.canonical,this.layers=t.layers,this.layerIds=this.layers.map(i=&gt;i.fqid),this.projection=t.projection,this.index=t.index,this.hasZoomDependentProperties=this.layers[0].isZoomDependent(),this.stateDependentLayerIds=this.layers.filter(i=&gt;i.isStateDependent()).map(i=&gt;i.id),this.hasPattern=!1,this.instancesPerModel={},this.validForExaggeration=0,this.maxVerticalOffset=0,this.maxScale=0,this.maxHeight=0,this.lookupDim=this.zoom&gt;this.canonical.z?256:this.zoom&gt;15?75:100,this.instanceCount=0,this.terrainElevationMin=0,this.terrainElevationMax=0,this.validForDEMTile={id:null,timestamp:0}}populate(t,i,r,n){this.tileToMeter=Ic(r);const s=this.layers[0]._featureFilter.needGeometry;this.lookup=new Uint8Array(this.lookupDim*this.lookupDim);for(const{feature:a,id:l,index:h,sourceLayerIndex:d}of t){const f=Mo(a,s);if(!this.layers[0]._featureFilter.filter(new Si(this.zoom),f,r))continue;const m={id:l,sourceLayerIndex:d,index:h,geometry:s?f.geometry:fs(a,r,n),properties:a.properties,type:a.type,patterns:{}},_=this.addFeature(m,m.geometry,f);_&amp;&amp;i.featureIndex.insert(a,m.geometry,h,d,this.index,this.instancesPerModel[_].instancedDataArray.length)}this.lookup=null}update(t,i,r,n){for(const s in this.instancesPerModel){const a=this.instancesPerModel[s];for(const l in t)a.idToFeaturesIndex.hasOwnProperty(l)&amp;&amp;this.evaluate(a.features[a.idToFeaturesIndex[l]],t[l],a,!0)}this.maxHeight=0}updateZoomBasedPaintProperties(){if(!this.hasZoomDependentProperties)return!1;let t=!1;for(const i in this.instancesPerModel){const r=this.instancesPerModel[i];for(const n of r.features){const s=this.layers[0],a=n.feature,l=this.canonical,h=s.paint.get("model-rotation").evaluate(a,{},l),d=s.paint.get("model-scale").evaluate(a,{},l),f=s.paint.get("model-translation").evaluate(a,{},l);W.exactEquals(n.rotation,h)&amp;&amp;W.exactEquals(n.scale,d)&amp;&amp;W.exactEquals(n.translation,f)||(this.evaluate(n,n.featureStates,r,!0),t=!0)}}return t}isEmpty(){for(const t in this.instancesPerModel)if(this.instancesPerModel[t].instancedDataArray.length!==0)return!1;return!0}uploadPending(){return!this.uploaded}upload(t){if(!this.uploaded)for(const i in this.instancesPerModel){const r=this.instancesPerModel[i];r.instancedDataArray.length&lt;0||r.instancedDataArray.length===0||(r.instancedDataBuffer?r.instancedDataBuffer.updateData(r.instancedDataArray):r.instancedDataBuffer=t.createVertexBuffer(r.instancedDataArray,BL.members,!0,void 0,this.instanceCount))}this.uploaded=!0}destroy(){for(const t in this.instancesPerModel){const i=this.instancesPerModel[t];i.instancedDataArray.length!==0&amp;&amp;i.instancedDataBuffer&amp;&amp;i.instancedDataBuffer.destroy()}}addFeature(t,i,r){const n=this.layers[0],s=n.layout.get("model-id").evaluate(r,{},this.canonical);if(!s)return tt(`modelId is not evaluated for layer ${n.id} and it is not going to get rendered.`),s;this.instancesPerModel[s]||(this.instancesPerModel[s]=new Xb);const a=this.instancesPerModel[s],l=a.instancedDataArray,h=new $b(r,l.length);for(const d of i)for(const f of d){if(f.x&lt;0||f.x&gt;=ut||f.y&lt;0||f.y&gt;=ut)continue;const m=(this.lookupDim-1)/ut,_=this.lookupDim*(f.y*m|0)+f.x*m|0;if(this.lookup){if(this.lookup[_]!==0)continue;this.lookup[_]=1}this.instanceCount++;const y=l.length;l.resize(y+1),a.instancesEvaluatedElevation.push(0),l.float32[16*y]=f.x,l.float32[16*y+1]=f.y}return h.instancedDataCount=a.instancedDataArray.length-h.instancedDataOffset,h.instancedDataCount&gt;0&amp;&amp;(t.id&amp;&amp;(a.idToFeaturesIndex[t.id]=a.features.length),a.features.push(h),this.evaluate(h,{},a,!1)),s}evaluate(t,i,r,n){const s=this.layers[0],a=t.feature,l=this.canonical,h=t.rotation=s.paint.get("model-rotation").evaluate(a,i,l),d=t.scale=s.paint.get("model-scale").evaluate(a,i,l),f=t.translation=s.paint.get("model-translation").evaluate(a,i,l),m=s.paint.get("model-color").evaluate(a,i,l);m.a=s.paint.get("model-color-mix-intensity").evaluate(a,i,l);const _=[];this.maxVerticalOffset&lt;f[2]&amp;&amp;(this.maxVerticalOffset=f[2]),this.maxScale=Math.max(Math.max(this.maxScale,d[0]),Math.max(d[1],d[2])),Wb(_,h,d);const y=Math.round(100*m.a)+m.b/1.05;for(let x=0;x&lt;t.instancedDataCount;++x){const b=t.instancedDataOffset+x,w=16*b,T=r.instancedDataArray.float32;let S=0;n&amp;&amp;(S=T[w+6]-r.instancesEvaluatedElevation[b]);const I=0|T[w+1];T[w]=(0|T[w])+m.r/1.05,T[w+1]=I+m.g/1.05,T[w+2]=y,T[w+3]=1/(l.z&gt;10?this.tileToMeter:Ic(l,I)),T[w+4]=f[0],T[w+5]=f[1],T[w+6]=f[2]+S,T[w+7]=_[0],T[w+8]=_[1],T[w+9]=_[2],T[w+10]=_[4],T[w+11]=_[5],T[w+12]=_[6],T[w+13]=_[8],T[w+14]=_[9],T[w+15]=_[10],r.instancesEvaluatedElevation[b]=f[2]}}}Jt(Yb,"ModelBucket",{omit:["layers"]}),Jt(Xb,"PerModelAttributes"),Jt($b,"ModelFeature");const WL=new Di({visibility:new At(st.layout_model.visibility),"model-id":new ne(st.layout_model["model-id"])});var qL={paint:new Di({"model-opacity":new At(st.paint_model["model-opacity"]),"model-rotation":new ne(st.paint_model["model-rotation"]),"model-scale":new ne(st.paint_model["model-scale"]),"model-translation":new ne(st.paint_model["model-translation"]),"model-color":new ne(st.paint_model["model-color"]),"model-color-mix-intensity":new ne(st.paint_model["model-color-mix-intensity"]),"model-type":new At(st.paint_model["model-type"]),"model-cast-shadows":new At(st.paint_model["model-cast-shadows"]),"model-receive-shadows":new At(st.paint_model["model-receive-shadows"]),"model-ambient-occlusion-intensity":new At(st.paint_model["model-ambient-occlusion-intensity"]),"model-emissive-strength":new ne(st.paint_model["model-emissive-strength"]),"model-roughness":new ne(st.paint_model["model-roughness"]),"model-height-based-emissive-strength-multiplier":new ne(st.paint_model["model-height-based-emissive-strength-multiplier"]),"model-cutoff-fade-range":new At(st.paint_model["model-cutoff-fade-range"])}),layout:WL};const w_=new Float32Array(262144),ma=new Uint8Array(262144);function Kb(e){let t=0;if(e.meshes)for(const i of e.meshes)t=Math.max(t,i.aabb.max[2]);if(e.children)for(const i of e.children)t=Math.max(t,Kb(i));return t}const Jb=["","wall","door","roof","window","lamp","logo"];class Qb{constructor(t){this.node=t,this.evaluatedRMEA=[[1,0,0,1],[1,0,0,1],[1,0,0,1],[1,0,0,1],[.4,1,0,1],[1,0,0,1],[1,0,0,1]],this.hiddenByReplacement=!1,this.evaluatedScale=[1,1,1],this.evaluatedColor=[],this.emissionHeightBasedParams=[],this.feature={type:"Point",id:t.id,geometry:[],properties:{height:Kb(t)}}}}class tw{constructor(t,i,r,n){this.nodes=t,this.id=i,this.modelTraits|=1,this.uploaded=!1,this.hasPattern=!1,r&amp;&amp;(this.modelTraits|=4),this.zoom=-1,this.terrainExaggeration=1,this.projection={name:"mercator"},this.replacementUpdateTime=0,this.elevationReadFromZ=255,this.brightness=n,this.dirty=!0,this.needsUpload=!1}update(){console.log("Update 3D model bucket")}populate(){console.log("populate 3D model bucket")}uploadPending(){return!this.uploaded||this.needsUpload}upload(t){if(!this.needsUpload)return;const i=this.getNodesInfo();for(const r of i){const n=r.node;this.uploaded?this.updatePbrBuffer(n):b_(n,t,!0)}for(const r of i)fd(r.node);this.uploaded=!0,this.needsUpload=!1}updatePbrBuffer(t){let i=!1;if(!t.meshes)return i;for(const r of t.meshes)r.pbrBuffer&amp;&amp;(r.pbrBuffer.updateData(r.featureArray),i=!0);return i}needsReEvaluation(t,i,r){const n=t.transform.projectionOptions,s=t.style.getBrightness(),a=this.brightness!==s;return!!(!this.uploaded||this.dirty||n.name!==this.projection.name||qc(r.paint.get("model-color").value,a)||qc(r.paint.get("model-color-mix-intensity").value,a)||qc(r.paint.get("model-roughness").value,a)||qc(r.paint.get("model-emissive-strength").value,a)||qc(r.paint.get("model-height-based-emissive-strength-multiplier").value,a))&amp;&amp;(this.projection=n,this.brightness=s,!0)}evaluateScale(t,i){if(t.transform.zoom===this.zoom)return;this.zoom=t.transform.zoom;const r=this.getNodesInfo(),n=this.id.canonical;for(const s of r){const a=s.feature;s.evaluatedScale=i.paint.get("model-scale").evaluate(a,{},n)}}evaluate(t){const i=this.getNodesInfo();for(const r of i){if(!r.node.meshes)continue;const n=r.feature,s=r.node.meshes&amp;&amp;r.node.meshes[0].featureData,a=r.evaluatedColor[2],l=r.evaluatedRMEA[2],h=this.id.canonical;if(r.hasTranslucentParts=!1,s){for(let d=0;d&lt;Jb.length;d++){const f=Jb[d];f.length&amp;&amp;(n.properties.part=f);const m=t.paint.get("model-color").evaluate(n,{},h),_=t.paint.get("model-color-mix-intensity").evaluate(n,{},h);r.evaluatedColor[d]=[m.r,m.g,m.b,_],r.evaluatedRMEA[d][0]=t.paint.get("model-roughness").evaluate(n,{},h),r.evaluatedRMEA[d][2]=t.paint.get("model-emissive-strength").evaluate(n,{},h),r.evaluatedRMEA[d][3]=m.a,r.emissionHeightBasedParams[d]=t.paint.get("model-height-based-emissive-strength-multiplier").evaluate(n,{},h),!r.hasTranslucentParts&amp;&amp;m.a&lt;1&amp;&amp;(r.hasTranslucentParts=!0)}delete n.properties.part,$L(r,a!==r.evaluatedColor[2]||l!==r.evaluatedRMEA[2])}r.evaluatedScale=t.paint.get("model-scale").evaluate(n,{},h),this.updatePbrBuffer(r.node)||(this.needsUpload=!0)}this.dirty=!1}elevationUpdate(t,i,r,n){const s=t.findDEMTileFor(r);if(s&amp;&amp;(s.tileID.canonical!==this.terrainTile||i!==this.terrainExaggeration)){if(s.dem&amp;&amp;s.tileID.overscaledZ!==this.elevationReadFromZ){this.elevationReadFromZ=s.tileID.overscaledZ;const a=dl.create(t,r,s);if(!a)return;4&amp;this.modelTraits&amp;&amp;this.updateDEM(t,a,r,n);for(const l of this.getNodesInfo()){const h=l.node;if(!h.footprint||!h.footprint.vertices||!h.footprint.vertices.length)continue;const d=h.footprint.vertices;let f=a.getElevationAt(d[0].x,d[0].y,!0,!0);for(let m=1;m&lt;d.length;m++)f=Math.min(f,a.getElevationAt(d[m].x,d[m].y,!0,!0));h.elevation=f}}this.terrainTile=s.tileID.canonical,this.terrainExaggeration=i}}updateDEM(t,i,r,n){let s=i._dem._modifiedForSources[n];if(s===void 0&amp;&amp;(i._dem._modifiedForSources[n]=[],s=i._dem._modifiedForSources[n]),s.includes(r.canonical))return;const a=i._dem.dim;s.push(r.canonical);let l=!1;for(const h of this.getNodesInfo()){const d=h.node;if(!d.footprint||!d.footprint.grid)continue;const f=d.footprint.grid,m=i.tileCoordToPixel(f.min.x,f.min.y),_=i.tileCoordToPixel(f.max.x,f.max.y),y=Math.min(Math.min(a-_.y,m.x),Math.min(m.y,a-_.x));if(y&lt;0)continue;const x=Xt(y,2,5);let b=Math.max(0,m.x-x),w=Math.max(0,m.y-x),T=Math.min(_.x+x,a-1),S=Math.min(_.y+x,a-1);for(let C=w;C&lt;=S;++C)for(let D=b;D&lt;=T;++D)ma[C*a+D]=255;let I=0,P=0;for(let C=0;C&lt;f.cellsY;++C)for(let D=0;D&lt;f.cellsX;++D){if(!f.cells[C*f.cellsX+D])continue;const O=i.tileCoordToPixel(f.min.x+D/f.xScale,f.min.y+C/f.yScale),k=i.tileCoordToPixel(f.min.x+(D+1)/f.xScale,f.min.y+(C+1)/f.yScale);for(let z=O.y;z&lt;=Math.min(k.y+1,a-1);++z)for(let B=O.x;B&lt;=Math.min(k.x+1,a-1);++B)ma[z*a+B]===255&amp;&amp;(ma[z*a+B]=0,I+=i.getElevationAtPixel(B,z),P++)}const M=I/P;b=Math.max(1,m.x-x),w=Math.max(1,m.y-x),T=Math.min(_.x+x,a-2),S=Math.min(_.y+x,a-2),l=!0;for(let C=w;C&lt;=S;++C)for(let D=b;D&lt;=T;++D)ma[C*a+D]===0&amp;&amp;(w_[C*a+D]=i._dem.set(D,C,M));for(let C=1;C&lt;x;++C){b=Math.max(1,m.x-C),w=Math.max(1,m.y-C),T=Math.min(_.x+C,a-2),S=Math.min(_.y+C,a-2);for(let D=w;D&lt;=S;++D)for(let O=b;O&lt;=T;++O){const k=D*a+O;if(ma[k]===255){let z=0,B=0,U=-1,Z=-1;for(let F=-1;F&lt;=1;++F)for(let Y=-1;Y&lt;=1;++Y){const J=(D+F)*a+O+Y;if(ma[J]&gt;=C)continue;const it=w_[J],X=Math.abs(it);X&gt;B&amp;&amp;(z=it,B=X,U=Y,Z=F)}if(B&gt;.1){const F=1-(C+.5*Math.abs(U*Z))/x;let Y=i._dem.get(O,D)+z*F;const J=i._dem.get(O+U,D+Z),it=i._dem.get(O-U,D-Z,!0);(Y-J)*(Y-it)&gt;0&amp;&amp;(Y=(J+it)/2),w_[k]=i._dem.set(O,D,Y),ma[k]=C}}}}}l&amp;&amp;(i._demTile.needsDEMTextureUpload=!0,i._dem._timestamp=_e.now())}getNodesInfo(){if(!this.nodesInfo){this.nodesInfo=[];for(const t of this.nodes)this.nodesInfo.push(new Qb(t));this.freeNodes()}return this.nodesInfo}freeNodes(){if(this.nodes){for(const t of this.nodes)pd(t);this.nodes.splice(0,this.nodes.length)}}destroy(){this.freeNodes();const t=this.getNodesInfo();for(const i of t)fd(i.node),pd(i.node)}isEmpty(){return!this.nodes.length}updateReplacement(t,i){if(i.updateTime===this.replacementUpdateTime)return;this.replacementUpdateTime=i.updateTime;const r=i.getReplacementRegionsForTile(t.toUnwrapped()),n=this.getNodesInfo();for(let s=0;s&lt;this.nodesInfo.length;s++){const a=n[s].node;n[s].hiddenByReplacement=!!a.footprint&amp;&amp;!r.find(l=&gt;l.footprint===a.footprint)}}getHeightAtTileCoord(t,i){const r=this.getNodesInfo(),n=[];for(let s=0;s&lt;this.nodesInfo.length;s++){const a=r[s],l=a.node.meshes[0];if(t&lt;l.aabb.min[0]||i&lt;l.aabb.min[1]||t&gt;l.aabb.max[0]||i&gt;l.aabb.max[1])continue;const h=(t-l.aabb.min[0])/(l.aabb.max[0]-l.aabb.min[0])*pa|0,d=Math.min(63,(i-l.aabb.min[1])/(l.aabb.max[1]-l.aabb.min[1])*pa|0)*pa+Math.min(63,h);if(!(l.heightmap[d]&lt;0&amp;&amp;a.node.footprint))return a.hiddenByReplacement?void 0:{height:l.heightmap[d],maxHeight:a.feature.properties.height,hidden:!1,verticalScale:a.evaluatedScale[2]};if(a.node.footprint.grid.query(new Q(t,i),new Q(t,i),n),n.length&gt;0)return{height:void 0,maxHeight:a.feature.properties.height,hidden:a.hiddenByReplacement,verticalScale:a.evaluatedScale[2]}}}}function qc(e,t){return!e.isLightConstant&amp;&amp;t}function ZL(e,t,i,r,n,s,a,l){let h=(61440&amp;t|(61440&amp;t)&gt;&gt;4)&gt;&gt;8,d=(3840&amp;t|(3840&amp;t)&gt;&gt;4)&gt;&gt;4,f=240&amp;t|(240&amp;t)&gt;&gt;4;i[3]&gt;0&amp;&amp;(h=ge(h,255*i[0],i[3]),d=ge(d,255*i[1],i[3]),f=ge(f,255*i[2],i[3]));const m=h&lt;&lt;8|d,_=f&lt;&lt;8|Math.floor(255*r[3]),y=function(C){const D=Xt(C,0,2);return Math.min(Math.round(.5*D*255),255)}(r[2])&lt;&lt;8|15*r[0]&lt;&lt;4|15*r[1],x=Xt(n[0],0,1),b=Xt(n[1],0,1),w=Xt(n[2],0,1),T=Xt(n[3],0,1);let S,I,P,M;if(x!==b&amp;&amp;a!==s&amp;&amp;b!==x){const C=a-s;I=1/(C*(b-x)),P=-(s+C*x)/(C*(b-x));const D=Xt(n[4],-1,1);M=Math.pow(10,D),S=255*w&lt;&lt;8|255*T}else S=65535,I=0,P=1,M=1;if(e.emplaceBack(m,_,y,S,I,P,M),l){const C=l.length;l.clear();for(let D=0;D&lt;C;D++)l.emplaceBack(m,_,y,S,I,P,M)}}function $L(e,t){const i=e.node;let r=0;for(const n of i.meshes){if(i.lights&amp;&amp;i.lightMeshIndex===r||!n.featureData)continue;n.featureArray=new ph,n.featureArray.reserve(n.featureData.length);let s=t;for(const a of n.featureData){let l;const h=65535&amp;a,d=(15&amp;h)&lt;8?15&amp;h:0,f=a&gt;&gt;16&amp;65535,m=e.evaluatedRMEA[d],_=e.evaluatedColor[d],y=e.emissionHeightBasedParams[d];if(s&amp;&amp;d===2&amp;&amp;i.lights&amp;&amp;(l=new ph,l.resize(10*i.lights.length)),ZL(n.featureArray,f,_,m,y,n.aabb.min[2],n.aabb.max[2],l),l&amp;&amp;s){s=!1;const x=i.meshes[i.lightMeshIndex];x.featureArray=l,x.featureArray._trim()}}n.featureArray._trim(),r++}}Jt(tw,"Tiled3dModelBucket",{omit:["layers"]}),Jt(Qb,"Tiled3dModelFeature");class XL{constructor(){this._updateTime=0,this._sourceIds=[],this._activeRegions=[],this._prevRegions=[]}clear(){this._activeRegions.length&gt;0&amp;&amp;++this._updateTime,this._activeRegions=[],this._prevRegions=[]}get updateTime(){return this._updateTime}getReplacementRegionsForTile(t){const i=rw(new Q(0,0),new Q(ut,ut),t),r=[];for(const n of this._activeRegions){if(n.hiddenByOverlap||!iw(i,n))continue;const s=YL(n.min,n.max,t);r.push({min:s.min,max:s.max,sourceId:this._sourceIds[n.priority],footprint:n.footprint,footprintTileId:n.tileId})}return r}setSources(t){this._setSources(t.map(i=&gt;({getSourceId:()=&gt;i.cache.id,getFootprints:()=&gt;{const r=[];for(const n of i.cache.getVisibleCoordinates()){const s=i.cache.getTile(n).buckets[i.layer];if(s)for(const a of s.getNodesInfo()){const l=a.node;l.footprint&amp;&amp;r.push({footprint:l.footprint,id:n.toUnwrapped()})}}return r}})))}_addSource(t){const i=t.getFootprints();if(i.length!==0){for(const r of i){if(!r.footprint)continue;const n=rw(r.footprint.min,r.footprint.max,r.id);this._activeRegions.push({min:n.min,max:n.max,hiddenByOverlap:!1,priority:this._sourceIds.length,tileId:r.id,footprint:r.footprint})}this._sourceIds.push(t.getSourceId())}}_computeReplacement(){this._activeRegions.sort((i,r)=&gt;i.priority-r.priority||md(i.min,r.min)||md(i.max,r.max));let t=this._activeRegions.length!==this._prevRegions.length;if(!t){let i=0,r=0;for(;!t&amp;&amp;i!==this._activeRegions.length;){const n=this._activeRegions[i],s=this._prevRegions[r];t=n.priority!==s.priority||!ew(n,s),++i,++r}}if(t){++this._updateTime;const i=r=&gt;{const n=this._activeRegions;if(r&gt;=n.length)return r;const s=n[r].priority;for(;r&lt;n.length&amp;&amp;n[r].priority===s;)++r;return r};if(this._sourceIds.length&gt;1){let r=0,n=i(r);for(;r!==n;){let s=r;const a=r;for(;s!==n;){const l=this._activeRegions[s];l.hiddenByOverlap=!1;for(let h=0;h&lt;a;h++){const d=this._activeRegions[h];if(!d.hiddenByOverlap&amp;&amp;iw(l,d)&amp;&amp;(l.hiddenByOverlap=sw(l.footprint,l.tileId,d.footprint,d.tileId),l.hiddenByOverlap))break}++s}r=n,n=i(r)}}}}_setSources(t){[this._prevRegions,this._activeRegions]=[this._activeRegions,[]],this._sourceIds=[];for(let i=t.length-1;i&gt;=0;i--)this._addSource(t[i]);this._computeReplacement()}}function md(e,t){return e.x-t.x||e.y-t.y}function ew(e,t){return md(e.min,t.min)===0&amp;&amp;md(e.max,t.max)===0}function iw(e,t){return!(e.min.x&gt;t.max.x||e.max.x&lt;t.min.x||e.min.y&gt;t.max.y||e.max.y&lt;t.min.y)}function rw(e,t,i){const r=1/ut,n=1/(1&lt;&lt;i.canonical.z),s=(t.x*r+i.canonical.x)*n+i.wrap,a=(t.y*r+i.canonical.y)*n;return{min:new Q((e.x*r+i.canonical.x)*n+i.wrap,(e.y*r+i.canonical.y)*n),max:new Q(s,a)}}function YL(e,t,i){const r=1&lt;&lt;i.canonical.z,n=((t.x-i.wrap)*r-i.canonical.x)*ut,s=(t.y*r-i.canonical.y)*ut;return{min:new Q(((e.x-i.wrap)*r-i.canonical.x)*ut,(e.y*r-i.canonical.y)*ut),max:new Q(n,s)}}function nw(e,t,i,r,n,s,a){const l=e.indices,h=e.vertices,d=[];for(let f=r;f&lt;r+n;f+=3){const m=t[i[f+0]+s],_=t[i[f+1]+s],y=t[i[f+2]+s],x=Math.min(m.x,_.x,y.x),b=Math.max(m.x,_.x,y.x),w=Math.min(m.y,_.y,y.y),T=Math.max(m.y,_.y,y.y);d.length=0,e.grid.query(new Q(x,w),new Q(b,T),d);for(let S=0;S&lt;d.length;S++){const I=d[S];if(jm(h[l[3*I+0]],h[l[3*I+1]],h[l[3*I+2]],m,_,y,a))return!0}}return!1}function sw(e,t,i,r){if(!e||!i)return!1;let n=e.vertices;if(!t.canonical.equals(r.canonical)||t.wrap!==r.wrap){if(i.vertices.length&lt;e.vertices.length)return sw(i,r,e,t);const s=t.canonical,a=r.canonical,l=Math.pow(2,a.z-s.z);n=e.vertices.map(h=&gt;new Q(h.x*s.x*ut*l-a.x*ut,h.y*s.y*ut*l-a.y*ut))}return nw(i,n,e.indices,0,e.indices.length,0,0)}const KL=Bh.types,JL=["fill-extrusion-base","fill-extrusion-height","fill-extrusion-color","fill-extrusion-pattern","fill-extrusion-flood-light-wall-radius"],QL=["fill-extrusion-flood-light-ground-radius"],tR=Math.pow(2,13),eR=Math.pow(2,15)-1,ow=new Q(0,1),gs=2147483648;function Zc(e,t,i,r,n,s,a,l){e.emplaceBack((t&lt;&lt;1)+a,(i&lt;&lt;1)+s,(Math.floor(r*tR)&lt;&lt;1)+n,Math.round(l))}function _d(e,t,i,r,n,s){e.emplaceBack(t.x,t.y,(i.x&lt;&lt;1)+r,(i.y&lt;&lt;1)+n,s)}function $c(e,t,i){e.emplaceBack(t.x,t.y,t.z,i[0]*16384,i[1]*16384,i[2]*16384)}class aw{constructor(){this.vertexOffset=0,this.vertexCount=0,this.indexOffset=0,this.indexCount=0}}class lw{constructor(){this.centroidXY=new Q(0,0),this.vertexArrayOffset=0,this.vertexCount=0,this.groundVertexArrayOffset=0,this.groundVertexCount=0,this.flags=0,this.footprintSegIdx=-1,this.footprintSegLen=0,this.polygonSegIdx=-1,this.polygonSegLen=0,this.min=new Q(Number.MAX_VALUE,Number.MAX_VALUE),this.max=new Q(-Number.MAX_VALUE,-Number.MAX_VALUE),this.height=0}span(){return new Q(this.max.x-this.min.x,this.max.y-this.min.y)}}class cw{constructor(){this.acc=new Q(0,0),this.accCount=0,this.centroidDataIndex=0}startRing(t,i){t.min.x===Number.MAX_VALUE&amp;&amp;(t.min.x=t.max.x=i.x,t.min.y=t.max.y=i.y)}appendEdge(t,i,r){this.accCount++,this.acc._add(i);let n=!!this.borders;i.x&lt;t.min.x?(t.min.x=i.x,n=!0):i.x&gt;t.max.x&amp;&amp;(t.max.x=i.x,n=!0),i.y&lt;t.min.y?(t.min.y=i.y,n=!0):i.y&gt;t.max.y&amp;&amp;(t.max.y=i.y,n=!0),((i.x===0||i.x===ut)&amp;&amp;i.x===r.x)!=((i.y===0||i.y===ut)&amp;&amp;i.y===r.y)&amp;&amp;this.processBorderOverlap(i,r),n&amp;&amp;this.checkBorderIntersection(i,r)}checkBorderIntersection(t,i){i.x&lt;0!=t.x&lt;0&amp;&amp;this.addBorderIntersection(0,ge(i.y,t.y,(0-i.x)/(t.x-i.x))),i.x&gt;ut!=t.x&gt;ut&amp;&amp;this.addBorderIntersection(1,ge(i.y,t.y,(ut-i.x)/(t.x-i.x))),i.y&lt;0!=t.y&lt;0&amp;&amp;this.addBorderIntersection(2,ge(i.x,t.x,(0-i.y)/(t.y-i.y))),i.y&gt;ut!=t.y&gt;ut&amp;&amp;this.addBorderIntersection(3,ge(i.x,t.x,(ut-i.y)/(t.y-i.y)))}addBorderIntersection(t,i){this.borders||(this.borders=[[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE]]);const r=this.borders[t];i&lt;r[0]&amp;&amp;(r[0]=i),i&gt;r[1]&amp;&amp;(r[1]=i)}processBorderOverlap(t,i){if(t.x===i.x){if(t.y===i.y)return;const r=t.x===0?0:1;this.addBorderIntersection(r,i.y),this.addBorderIntersection(r,t.y)}else{const r=t.y===0?2:3;this.addBorderIntersection(r,i.x),this.addBorderIntersection(r,t.x)}}centroid(){return this.accCount===0?new Q(0,0):new Q(Math.floor(Math.max(0,this.acc.x)/this.accCount),Math.floor(Math.max(0,this.acc.y)/this.accCount))}intersectsCount(){return this.borders?this.borders.reduce((t,i)=&gt;t+ +(i[0]!==Number.MAX_VALUE),0):0}}function uw(e,t){const i=e.add(t)._unit(),r=Xt(e.x*i.x+e.y*i.y,-1,1);var n,s,a;return n=Math.acos(r),Math.min(4,Math.max(-4,Math.tan(n)))/4*eR*((s=e).x*(a=t).y-s.y*a.x&lt;0?-1:1)}const iR=[e=&gt;e.x&lt;0,e=&gt;e.x&gt;ut,e=&gt;e.y&lt;0,e=&gt;e.y&gt;ut];function rR(e,t,i,r){const n=[4];if(r===0)return n;i._mult(r);const s=e.sub(i),a=t.sub(i),l=[e,t,s,a];for(let h=0;h&lt;4;h++)for(const d of l)if(iR[h](d)){n.push(h);break}return n}class hw{constructor(t){this.vertexArray=new Wp,this.indexArray=new Xi,this.programConfigurations=new vo(t.layers,t.zoom,i=&gt;QL.includes(i)),this._segments=new si,this.hiddenByLandmarkVertexArray=new nm,this._segmentToGroundQuads={},this._segmentToGroundQuads[0]=[],this._segmentToRegionTriCounts={},this._segmentToRegionTriCounts[0]=[0,0,0,0,0],this.regionSegments={},this.regionSegments[4]=new si}getDefaultSegment(){return this.regionSegments[4]}hasData(){return this.vertexArray.length!==0}addData(t,i,r,n=!1){const s=t.length;if(s&gt;2){let a=Math.max(0,this._segments.get().length-1);const l=this._segments._prepareSegment(4*s,this.vertexArray.length,2*this._segmentToGroundQuads[a].length);let h;a!==this._segments.get().length-1&amp;&amp;(a++,this._segmentToGroundQuads[a]=[],this._segmentToRegionTriCounts[a]=[0,0,0,0,0]);{const d=t[0],f=t[1];h=uw(d.sub(t[s-1])._perp()._unit(),f.sub(d)._perp()._unit())}for(let d=0;d&lt;s;d++){const f=d===s-1?0:d+1,m=t[d],_=t[f],y=t[f===s-1?0:f+1],x=_.sub(m)._perp()._unit(),b=uw(x,y.sub(_)._perp()._unit()),w=h,T=b;if(T_(m,_,i)||n&amp;&amp;pw(m,i)&amp;&amp;pw(_,i)){h=b;continue}const S=l.vertexLength;_d(this.vertexArray,m,_,1,1,w),_d(this.vertexArray,m,_,1,0,w),_d(this.vertexArray,m,_,0,1,T),_d(this.vertexArray,m,_,0,0,T),l.vertexLength+=4;const I=rR(m,_,x,r);for(const P of I)this._segmentToGroundQuads[a].push({id:S,region:P}),this._segmentToRegionTriCounts[a][P]+=2,l.primitiveLength+=2;h=b}}}prepareBorderSegments(){if(!this.hasData())return;const t=this._segments.get(),i=t.length;for(let r=0;r&lt;i;r++)this._segmentToGroundQuads[r].sort((n,s)=&gt;n.region-s.region);for(let r=0;r&lt;i;r++){const n=this._segmentToGroundQuads[r],s=t[r],a=this._segmentToRegionTriCounts[r];a.reduce((h,d)=&gt;h+d,0);let l=0;for(let h=0;h&lt;=4;h++){const d=a[h];if(d!==0){let f=this.regionSegments[h];f||(f=this.regionSegments[h]=new si);const m={vertexOffset:s.vertexOffset,primitiveOffset:s.primitiveOffset+l,vertexLength:s.vertexLength,primitiveLength:d};f.get().push(m)}l+=d}for(let h=0;h&lt;n.length;h++){const d=n[h].id;this.indexArray.emplaceBack(d,d+1,d+3),this.indexArray.emplaceBack(d,d+3,d+2)}}this._segmentToGroundQuads=null,this._segmentToRegionTriCounts=null,this._segments.destroy(),this._segments=null}addPaintPropertiesData(t,i,r,n,s,a){this.hasData()&amp;&amp;this.programConfigurations.populatePaintArrays(this.vertexArray.length,t,i,r,n,s,a)}upload(t){this.hasData()&amp;&amp;(this.vertexBuffer=t.createVertexBuffer(this.vertexArray,IC.members),this.indexBuffer=t.createIndexBuffer(this.indexArray))}uploadPaintProperties(t){this.hasData()&amp;&amp;this.programConfigurations.upload(t)}update(t,i,r,n,s,a){this.hasData()&amp;&amp;this.programConfigurations.updatePaintArrays(t,i,r,n,s,a)}updateHiddenByLandmark(t){if(!this.hasData())return;const i=t.groundVertexCount+t.groundVertexArrayOffset;if(t.groundVertexCount===0)return;const r=t.flags&amp;gs?1:0;for(let n=t.groundVertexArrayOffset;n&lt;i;++n)this.hiddenByLandmarkVertexArray.emplace(n,r);this._needsHiddenByLandmarkUpdate=!0}uploadHiddenByLandmark(t){this.hasData()&amp;&amp;this._needsHiddenByLandmarkUpdate&amp;&amp;(!this.hiddenByLandmarkVertexBuffer&amp;&amp;this.hiddenByLandmarkVertexArray.length&gt;0?this.hiddenByLandmarkVertexBuffer=t.createVertexBuffer(this.hiddenByLandmarkVertexArray,CC.members,!0):this.hiddenByLandmarkVertexBuffer&amp;&amp;this.hiddenByLandmarkVertexBuffer.updateData(this.hiddenByLandmarkVertexArray),this._needsHiddenByLandmarkUpdate=!1)}destroy(){if(this.vertexBuffer){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.hiddenByLandmarkVertexBuffer&amp;&amp;this.hiddenByLandmarkVertexBuffer.destroy(),this._segments&amp;&amp;this._segments.destroy(),this.programConfigurations.destroy();for(let t=0;t&lt;=4;t++){const i=this.regionSegments[t];i&amp;&amp;i.destroy()}}}}class Xc{constructor(t){this.zoom=t.zoom,this.canonical=t.canonical,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(i=&gt;i.fqid),this.index=t.index,this.hasPattern=!1,this.edgeRadius=0,this.projection=t.projection,this.activeReplacements=[],this.replacementUpdateTime=0,this.centroidData=[],this.footprintIndices=new Xi,this.footprintVertices=new Kr,this.footprintSegments=[],this.layoutVertexArray=new sa,this.centroidVertexArray=new bx,this.indexArray=new Xi,this.programConfigurations=new vo(t.layers,t.zoom,i=&gt;JL.includes(i)),this.segments=new si,this.stateDependentLayerIds=this.layers.filter(i=&gt;i.isStateDependent()).map(i=&gt;i.id),this.groundEffect=new hw(t),this.maxHeight=0,this.partLookup={},this.triangleSubSegments=[],this.polygonSegments=[]}populate(t,i,r,n){this.features=[],this.hasPattern=Xm("fill-extrusion",this.layers,i),this.featuresOnBorder=[],this.borderFeatureIndices=[[],[],[],[]],this.borderDoneWithNeighborZ=[-1,-1,-1,-1],this.tileToMeter=Ic(r),this.edgeRadius=this.layers[0].layout.get("fill-extrusion-edge-radius")/this.tileToMeter;for(const{feature:s,id:a,index:l,sourceLayerIndex:h}of t){const d=this.layers[0]._featureFilter.needGeometry,f=Mo(s,d);if(!this.layers[0]._featureFilter.filter(new Si(this.zoom),f,r))continue;const m={id:a,sourceLayerIndex:h,index:l,geometry:d?f.geometry:fs(s,r,n),properties:s.properties,type:s.type,patterns:{}},_=this.layoutVertexArray.length;this.hasPattern?this.features.push(Ym("fill-extrusion",this.layers,m,this.zoom,i)):this.addFeature(m,m.geometry,l,r,{},i.availableImages,n,i.brightness),i.featureIndex.insert(s,m.geometry,l,h,this.index,_)}this.sortBorders(),this.projection.name!=="globe"&amp;&amp;this.splitToSubtiles(),this.groundEffect.prepareBorderSegments(),this.polygonSegments.length=0}addFeatures(t,i,r,n,s,a){for(const l of this.features){const{geometry:h}=l;this.addFeature(l,h,l.index,i,r,n,s,a)}this.sortBorders(),this.projection.name!=="globe"&amp;&amp;this.splitToSubtiles()}update(t,i,r,n,s){const a=Object.keys(t).length!==0;if(a&amp;&amp;!this.stateDependentLayers.length)return;const l=a?this.stateDependentLayers:this.layers;this.programConfigurations.updatePaintArrays(t,i,l,r,n,s),this.groundEffect.update(t,i,l,r,n,s)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload||this.groundEffect.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,RC),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.layoutVertexExtArray&amp;&amp;(this.layoutVertexExtBuffer=t.createVertexBuffer(this.layoutVertexExtArray,LC.members,!0)),this.groundEffect.upload(t)),this.groundEffect.uploadPaintProperties(t),this.programConfigurations.upload(t),this.uploaded=!0}uploadCentroid(t){this.groundEffect.uploadHiddenByLandmark(t),this.needsCentroidUpdate&amp;&amp;(!this.centroidVertexBuffer&amp;&amp;this.centroidVertexArray.length&gt;0?this.centroidVertexBuffer=t.createVertexBuffer(this.centroidVertexArray,PC.members,!0):this.centroidVertexBuffer&amp;&amp;this.centroidVertexBuffer.updateData(this.centroidVertexArray),this.needsCentroidUpdate=!1)}destroy(){this.layoutVertexBuffer&amp;&amp;(this.layoutVertexBuffer.destroy(),this.centroidVertexBuffer&amp;&amp;this.centroidVertexBuffer.destroy(),this.layoutVertexExtBuffer&amp;&amp;this.layoutVertexExtBuffer.destroy(),this.groundEffect.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(t,i,r,n,s,a,l,h){const d=this.layers[0].paint.get("fill-extrusion-flood-light-ground-radius").evaluate(t,{})/this.tileToMeter,f=[new Q(0,0),new Q(ut,ut)],m=l.projection,_=m.name==="globe",y=KL[t.type]==="Polygon",x=new cw;x.centroidDataIndex=this.centroidData.length;const b=new lw,w=this.layers[0].paint.get("fill-extrusion-base").evaluate(t,{},n)&lt;=0,T=this.layers[0].paint.get("fill-extrusion-height").evaluate(t,{},n);b.height=T,b.vertexArrayOffset=this.layoutVertexArray.length,b.groundVertexArrayOffset=this.groundEffect.vertexArray.length,_&amp;&amp;!this.layoutVertexExtArray&amp;&amp;(this.layoutVertexExtArray=new dh);const S=$m(i,500);for(let O=S.length-1;O&gt;=0;O--){const k=S[O];(k.length===0||(I=k[0]).every(z=&gt;z.x&lt;=0)||I.every(z=&gt;z.x&gt;=ut)||I.every(z=&gt;z.y&lt;=0)||I.every(z=&gt;z.y&gt;=ut))&amp;&amp;S.splice(O,1)}var I;let P;if(_)P=yw(S,f,n);else{P=[];for(const O of S)P.push({polygon:O,bounds:f})}const M=y?this.edgeRadius:0,C=M&gt;0&amp;&amp;this.zoom&lt;17,D=(O,k)=&gt;{if(O.length===0)return!1;const z=O[O.length-1];return k.x===z.x&amp;&amp;k.y===z.y};for(const{polygon:O,bounds:k}of P){let z=0,B=0;for(const Y of O)y&amp;&amp;!Y[0].equals(Y[Y.length-1])&amp;&amp;Y.push(Y[0]),B+=y?Y.length-1:Y.length;const U=this.segments.prepareSegment((y?5:4)*B,this.layoutVertexArray,this.indexArray);b.footprintSegIdx&lt;0&amp;&amp;(b.footprintSegIdx=this.footprintSegments.length),b.polygonSegIdx&lt;0&amp;&amp;(b.polygonSegIdx=this.polygonSegments.length);const Z={triangleArrayOffset:this.indexArray.length,triangleCount:0,triangleSegIdx:this.segments.segments.length-1},F=new aw;if(F.vertexOffset=this.footprintVertices.length,F.indexOffset=3*this.footprintIndices.length,F.ringIndices=[],y){const Y=[],J=[];z=U.vertexLength;for(let X=0;X&lt;O.length;X++){const K=O[X];K.length&amp;&amp;X!==0&amp;&amp;J.push(Y.length/2);const ot=[];let lt,at;lt=K[1].sub(K[0])._perp()._unit(),F.ringIndices.push(K.length-1);for(let dt=1;dt&lt;K.length;dt++){const ft=K[dt],_t=K[dt===K.length-1?1:dt+1],ct=ft.clone();if(M){at=_t.sub(ft)._perp()._unit();const bt=lt.add(at)._unit(),Ot=M*Math.min(4,1/(lt.x*bt.x+lt.y*bt.y));ct.x+=Ot*bt.x,ct.y+=Ot*bt.y,ct.x=Math.round(ct.x),ct.y=Math.round(ct.y),lt=at}!w||M!==0&amp;&amp;!C||D(ot,ct)||ot.push(ct),Zc(this.layoutVertexArray,ct.x,ct.y,0,0,1,1,0),U.vertexLength++,this.footprintVertices.emplaceBack(ft.x,ft.y),Y.push(ft.x,ft.y),_&amp;&amp;$c(this.layoutVertexExtArray,m.projectTilePoint(ct.x,ct.y,n),m.upVector(n,ct.x,ct.y))}w&amp;&amp;(M===0||C)&amp;&amp;(ot.length!==0&amp;&amp;D(ot,ot[0])&amp;&amp;ot.pop(),this.groundEffect.addData(ot,k,d))}const it=kh(Y,J);for(let X=0;X&lt;it.length;X+=3)this.footprintIndices.emplaceBack(F.vertexOffset+it[X+0],F.vertexOffset+it[X+1],F.vertexOffset+it[X+2]),this.indexArray.emplaceBack(z+it[X],z+it[X+2],z+it[X+1]),U.primitiveLength++;F.indexCount+=it.length,F.vertexCount+=this.footprintVertices.length-F.vertexOffset}for(let Y=0;Y&lt;O.length;Y++){const J=O[Y];x.startRing(b,J[0]);let it=J.length&gt;4&amp;&amp;mw(J[J.length-2],J[0],J[1]),X=M?nR(J[J.length-2],J[0],J[1],M):0;const K=[];let ot,lt,at;lt=J[1].sub(J[0])._perp()._unit();let dt=!0;for(let ft=1,_t=0;ft&lt;J.length;ft++){let ct=J[ft-1],bt=J[ft];const Ot=J[ft===J.length-1?1:ft+1];if(x.appendEdge(b,bt,ct),T_(bt,ct,k)){M&amp;&amp;(lt=Ot.sub(bt)._perp()._unit(),dt=!dt);continue}const kt=bt.sub(ct)._perp(),Ht=kt.x/(Math.abs(kt.x)+Math.abs(kt.y)),Zt=kt.y&gt;0?1:0,fe=ct.dist(bt);if(_t+fe&gt;32768&amp;&amp;(_t=0),M){at=Ot.sub(bt)._perp()._unit();let pe=fw(ct,bt,Ot,dw(lt,at),M);isNaN(pe)&amp;&amp;(pe=0);const ue=bt.sub(ct)._unit();ct=ct.add(ue.mult(X))._round(),bt=bt.add(ue.mult(-pe))._round(),X=pe,lt=at,w&amp;&amp;this.zoom&gt;=17&amp;&amp;(D(K,ct)||K.push(ct),D(K,bt)||K.push(bt))}const ie=U.vertexLength,Ve=J.length&gt;4&amp;&amp;mw(ct,bt,Ot);let ke=_w(_t,it,dt);if(Zc(this.layoutVertexArray,ct.x,ct.y,Ht,Zt,0,0,ke),Zc(this.layoutVertexArray,ct.x,ct.y,Ht,Zt,0,1,ke),_t+=fe,ke=_w(_t,Ve,!dt),it=Ve,Zc(this.layoutVertexArray,bt.x,bt.y,Ht,Zt,0,0,ke),Zc(this.layoutVertexArray,bt.x,bt.y,Ht,Zt,0,1,ke),U.vertexLength+=4,this.indexArray.emplaceBack(ie+0,ie+1,ie+2),this.indexArray.emplaceBack(ie+1,ie+3,ie+2),U.primitiveLength+=2,M){const pe=z+(ft===1?J.length-2:ft-2),ue=ft===1?z:pe+1;if(this.indexArray.emplaceBack(ie+1,pe,ie+3),this.indexArray.emplaceBack(pe,ue,ie+3),U.primitiveLength+=2,ot===void 0&amp;&amp;(ot=ie),!T_(Ot,J[ft],k)){const re=ft===J.length-1?ot:U.vertexLength;this.indexArray.emplaceBack(ie+2,ie+3,re),this.indexArray.emplaceBack(ie+3,re+1,re),this.indexArray.emplaceBack(ie+3,ue,re+1),U.primitiveLength+=3}dt=!dt}if(_){const pe=this.layoutVertexExtArray,ue=m.projectTilePoint(ct.x,ct.y,n),re=m.projectTilePoint(bt.x,bt.y,n),Fe=m.upVector(n,ct.x,ct.y),Ue=m.upVector(n,bt.x,bt.y);$c(pe,ue,Fe),$c(pe,ue,Fe),$c(pe,re,Ue),$c(pe,re,Ue)}}y&amp;&amp;(z+=J.length-1),w&amp;&amp;M&amp;&amp;this.zoom&gt;=17&amp;&amp;(K.length!==0&amp;&amp;D(K,K[0])&amp;&amp;K.pop(),this.groundEffect.addData(K,k,d,M&gt;0))}this.footprintSegments.push(F),Z.triangleCount=this.indexArray.length-Z.triangleArrayOffset,this.polygonSegments.push(Z),++b.footprintSegLen,++b.polygonSegLen}if(b.vertexCount=this.layoutVertexArray.length-b.vertexArrayOffset,b.groundVertexCount=this.groundEffect.vertexArray.length-b.groundVertexArrayOffset,b.vertexCount!==0){if(b.centroidXY=x.borders?ow:this.encodeCentroid(x,b),this.centroidData.push(b),x.borders){this.featuresOnBorder.push(x);const O=this.featuresOnBorder.length-1;for(let k=0;k&lt;x.borders.length;k++)x.borders[k][0]!==Number.MAX_VALUE&amp;&amp;this.borderFeatureIndices[k].push(O)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,r,s,a,n,h),this.groundEffect.addPaintPropertiesData(t,r,s,a,n,h),this.maxHeight=Math.max(this.maxHeight,T)}}sortBorders(){for(let t=0;t&lt;this.borderFeatureIndices.length;t++)this.borderFeatureIndices[t].sort((i,r)=&gt;this.featuresOnBorder[i].borders[t][0]-this.featuresOnBorder[r].borders[t][0])}splitToSubtiles(){const t=[];for(let l=0;l&lt;this.centroidData.length;l++){const h=this.centroidData[l],d=+(h.min.y+h.max.y&gt;ut),f=2*d+(+(h.min.x+h.max.x&gt;ut)^d);for(let m=0;m&lt;h.polygonSegLen;m++){const _=h.polygonSegIdx+m;t.push({centroidIdx:l,subtile:f,polygonSegmentIdx:_,triangleSegmentIdx:this.polygonSegments[_].triangleSegIdx})}}const i=new Xi;t.sort((l,h)=&gt;l.triangleSegmentIdx===h.triangleSegmentIdx?l.subtile-h.subtile:l.triangleSegmentIdx-h.triangleSegmentIdx);let r=0,n=0,s=0;for(const l of t){if(l.triangleSegmentIdx!==r)break;s++}const a=t.length;for(;n!==t.length;){r=t[n].triangleSegmentIdx;let l=0,h=n,d=n;for(let f=h;f&lt;s&amp;&amp;t[f].subtile===l;f++)d++;for(;h!==s;){const f=t[h];l=f.subtile;const m=this.centroidData[f.centroidIdx].min.clone(),_=this.centroidData[f.centroidIdx].max.clone(),y={vertexOffset:this.segments.segments[r].vertexOffset,primitiveOffset:i.length,vertexLength:this.segments.segments[r].vertexLength,primitiveLength:0,sortKey:void 0,vaos:{}};for(let x=h;x&lt;d;x++){const b=t[x],w=this.polygonSegments[b.polygonSegmentIdx],T=this.centroidData[b.centroidIdx].min,S=this.centroidData[b.centroidIdx].max,I=this.indexArray.uint16;for(let P=w.triangleArrayOffset;P&lt;w.triangleArrayOffset+w.triangleCount;P++)i.emplaceBack(I[3*P],I[3*P+1],I[3*P+2]);y.primitiveLength+=w.triangleCount,m.x=Math.min(m.x,T.x),m.y=Math.min(m.y,T.y),_.x=Math.max(_.x,S.x),_.y=Math.max(_.y,S.y)}y.primitiveLength&gt;0&amp;&amp;this.triangleSubSegments.push({segment:y,min:m,max:_}),h=d;for(let x=h;x&lt;s&amp;&amp;t[x].subtile===t[h].subtile;x++)d++}n=s;for(let f=n;f&lt;a&amp;&amp;t[f].triangleSegmentIdx===t[n].triangleSegmentIdx;f++)s++}i._trim(),this.indexArray=i}getVisibleSegments(t,i,r){let n=0,s=0;const a=1&lt;&lt;t.canonical.z;if(i){const b=i.getMinMaxForTile(t);b&amp;&amp;(n=b.min,s=b.max)}s+=this.maxHeight;const l=t.toUnwrapped();let h;const d=[l.canonical.x/a+l.wrap,l.canonical.y/a],f=[(l.canonical.x+1)/a+l.wrap,(l.canonical.y+1)/a],m=new si,_=(b,w,T)=&gt;[b[0]*(1-T[0])+w[0]*T[0],b[1]*(1-T[1])+w[1]*T[1]],y=[],x=[];for(const b of this.triangleSubSegments){y[0]=b.min.x/ut,y[1]=b.min.y/ut,x[0]=b.max.x/ut,x[1]=b.max.y/ut;const w=_(d,f,y),T=_(d,f,x);if(new mi([w[0],w[1],n],[T[0],T[1],s]).intersectsPrecise(r)===0){h&amp;&amp;(m.segments.push(h),h=void 0);continue}const S=b.segment;h&amp;&amp;h.vertexOffset!==S.vertexOffset&amp;&amp;(m.segments.push(h),h=void 0),h?(h.vertexLength+=S.vertexLength,h.primitiveLength+=S.primitiveLength):h={vertexOffset:S.vertexOffset,primitiveLength:S.primitiveLength,vertexLength:S.vertexLength,primitiveOffset:S.primitiveOffset,sortKey:void 0,vaos:{}}}return h&amp;&amp;m.segments.push(h),m}encodeCentroid(t,i){const r=t.centroid(),n=i.span(),s=Math.min(7,Math.round(n.x*this.tileToMeter/10)),a=Math.min(7,Math.round(n.y*this.tileToMeter/10));return new Q(Xt(r.x,1,ut-1)&lt;&lt;3|s,Xt(r.y,1,ut-1)&lt;&lt;3|a)}showCentroid(t){const i=this.centroidData[t.centroidDataIndex];i.flags&amp;=gs,i.centroidXY.x=0,i.centroidXY.y=0,this.writeCentroidToBuffer(i)}writeCentroidToBuffer(t){this.groundEffect.updateHiddenByLandmark(t);const i=t.vertexArrayOffset,r=t.vertexCount+t.vertexArrayOffset,n=t.flags&amp;gs?ow:t.centroidXY,s=this.centroidVertexArray.geta_centroid_pos0(i);if(this.centroidVertexArray.geta_centroid_pos1(i)!==n.y||s!==n.x){for(let a=i;a&lt;r;++a)this.centroidVertexArray.emplace(a,n.x,n.y);this.needsCentroidUpdate=!0}}createCentroidsBuffer(){this.centroidVertexArray.resize(this.layoutVertexArray.length),this.groundEffect.hiddenByLandmarkVertexArray.resize(this.groundEffect.vertexArray.length);for(const t of this.centroidData)this.writeCentroidToBuffer(t)}updateReplacement(t,i){if(i.updateTime===this.replacementUpdateTime)return;this.replacementUpdateTime=i.updateTime;const r=i.getReplacementRegionsForTile(t.toUnwrapped());if(function(s,a){if(s.length!==a.length)return!1;for(let l=0;l&lt;s.length;l++)if(s[l].sourceId!==a[l].sourceId||!ew(s[l],a[l]))return!1;return!0}(this.activeReplacements,r))return;if(this.activeReplacements=r,this.centroidVertexArray.length===0)this.createCentroidsBuffer();else for(const s of this.centroidData)s.flags&amp;=2147483647;const n=[];for(const s of this.activeReplacements){const a=Math.pow(2,s.footprintTileId.canonical.z-t.canonical.z);for(const l of this.centroidData)if(!(l.flags&amp;gs||s.min.x&gt;l.max.x||l.min.x&gt;s.max.x||s.min.y&gt;l.max.y||l.min.y&gt;s.max.y))for(let h=0;h&lt;l.footprintSegLen;h++){const d=this.footprintSegments[l.footprintSegIdx+h];if(n.length=0,sR(this.footprintVertices,d.vertexOffset,d.vertexCount,s.footprintTileId.canonical,t.canonical,n),nw(s.footprint,n,this.footprintIndices.uint16,d.indexOffset,d.indexCount,-d.vertexOffset,-a)){l.flags|=gs;break}}}for(const s of this.centroidData)this.writeCentroidToBuffer(s);this.borderDoneWithNeighborZ=[-1,-1,-1,-1]}footprintContainsPoint(t,i,r){let n=!1;for(let s=0;s&lt;r.footprintSegLen;s++){const a=this.footprintSegments[r.footprintSegIdx+s];let l=0;for(const h of a.ringIndices){for(let d=l,f=h+l-1;d&lt;h+l;f=d++){const m=this.footprintVertices.int16[2*(d+a.vertexOffset)+0],_=this.footprintVertices.int16[2*(d+a.vertexOffset)+1],y=this.footprintVertices.int16[2*(f+a.vertexOffset)+1];_&gt;i!=y&gt;i&amp;&amp;t&lt;(this.footprintVertices.int16[2*(f+a.vertexOffset)+0]-m)*(i-_)/(y-_)+m&amp;&amp;(n=!n)}l=h}}return n}getHeightAtTileCoord(t,i){let r=Number.NEGATIVE_INFINITY,n=!0;const s=4*(t+ut)*ut+(i+ut);if(this.partLookup.hasOwnProperty(s)){const a=this.partLookup[s];return a?{height:a.height,hidden:!!(a.flags&amp;gs)}:void 0}for(const a of this.centroidData)t&gt;a.max.x||a.min.x&gt;t||i&gt;a.max.y||a.min.y&gt;i||this.footprintContainsPoint(t,i,a)&amp;&amp;a&amp;&amp;a.height&gt;r&amp;&amp;(r=a.height,this.partLookup[s]=a,n=!!(a.flags&amp;gs));if(r!==Number.NEGATIVE_INFINITY)return{height:r,hidden:n};this.partLookup[s]=void 0}}function dw(e,t){const i=e.add(t)._unit();return e.x*i.x+e.y*i.y}function nR(e,t,i,r){const n=t.sub(e)._perp()._unit(),s=i.sub(t)._perp()._unit();return fw(e,t,i,dw(n,s),r)}function fw(e,t,i,r,n){const s=Math.sqrt(1-r*r);return Math.min(e.dist(t)/3,t.dist(i)/3,n*s/r)}function T_(e,t,i){return e.x&lt;i[0].x&amp;&amp;t.x&lt;i[0].x||e.x&gt;i[1].x&amp;&amp;t.x&gt;i[1].x||e.y&lt;i[0].y&amp;&amp;t.y&lt;i[0].y||e.y&gt;i[1].y&amp;&amp;t.y&gt;i[1].y}function pw(e,t){return e.x&lt;t[0].x||e.x&gt;t[1].x||e.y&lt;t[0].y||e.y&gt;t[1].y}function mw(e,t,i){if(e.x&lt;0||e.x&gt;=ut||t.x&lt;0||t.x&gt;=ut||i.x&lt;0||i.x&gt;=ut)return!1;const r=i.sub(t),n=r.perp(),s=e.sub(t);return(r.x*s.x+r.y*s.y)/Math.sqrt((r.x*r.x+r.y*r.y)*(s.x*s.x+s.y*s.y))&gt;-.866&amp;&amp;n.x*s.x+n.y*s.y&lt;0}function _w(e,t,i){const r=t?2|e:-3&amp;e;return i?1|r:-2&amp;r}function gw(){const e=Math.PI/32,t=Math.tan(e),i=sl;return i*Math.sqrt(1+2*t*t)-i}function yw(e,t,i){const r=1&lt;&lt;i.z,n=tn(i.x/r),s=tn((i.x+1)/r),a=Yi(i.y/r),l=Yi((i.y+1)/r);return function(h,d,f,m,_=0,y){const x=[];if(!h.length||!f||!m)return x;const b=(C,D)=&gt;{for(const O of C)x.push({polygon:O,bounds:D})},w=Math.ceil(Math.log2(f)),T=Math.ceil(Math.log2(m)),S=w-T,I=[];for(let C=0;C&lt;Math.abs(S);C++)I.push(S&gt;0?0:1);for(let C=0;C&lt;Math.min(w,T);C++)I.push(0),I.push(1);let P=h;if(P=Nh(P,d[0].y-_,d[1].y+_,1),P=Nh(P,d[0].x-_,d[1].x+_,0),!P.length)return x;const M=[];for(I.length?M.push({polygons:P,bounds:d,depth:0}):b(P,d);M.length;){const C=M.pop(),D=C.depth,O=I[D],k=C.bounds[0],z=C.bounds[1],B=O===0?k.x:k.y,U=O===0?z.x:z.y,Z=y?y(O,B,U):.5*(B+U),F=Nh(C.polygons,B-_,Z+_,O),Y=Nh(C.polygons,Z-_,U+_,O);if(F.length){const J=[k,new Q(O===0?Z:z.x,O===1?Z:z.y)];I.length&gt;D+1?M.push({polygons:F,bounds:J,depth:D+1}):b(F,J)}if(Y.length){const J=[new Q(O===0?Z:k.x,O===1?Z:k.y),z];I.length&gt;D+1?M.push({polygons:Y,bounds:J,depth:D+1}):b(Y,J)}}return x}(e,t,Math.ceil((s-n)/11.25),Math.ceil((a-l)/11.25),1,(h,d,f)=&gt;{if(h===0)return .5*(d+f);{const m=Yi((i.y+d/ut)/r);return(sr(.5*(Yi((i.y+f/ut)/r)+m))*r-i.y)*ut}})}function sR(e,t,i,r,n,s){const a=Math.pow(2,r.z-n.z);for(let l=0;l&lt;i;l++){let h=e.int16[2*(l+t)+0],d=e.int16[2*(l+t)+1];h=(h+n.x*ut)*a-r.x*ut,d=(d+n.y*ut)*a-r.y*ut,s.push(new Q(h,d))}}Jt(Xc,"FillExtrusionBucket",{omit:["layers","features"]}),Jt(lw,"PartData"),Jt(aw,"FootprintSegment"),Jt(cw,"BorderCentroidData"),Jt(hw,"GroundEffect");const oR=new Di({visibility:new At(st["layout_fill-extrusion"].visibility),"fill-extrusion-edge-radius":new At(st["layout_fill-extrusion"]["fill-extrusion-edge-radius"])});var aR={paint:new Di({"fill-extrusion-opacity":new At(st["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new ne(st["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new At(st["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new At(st["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new ne(st["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new ne(st["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new ne(st["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new At(st["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"]),"fill-extrusion-ambient-occlusion-intensity":new At(st["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-intensity"]),"fill-extrusion-ambient-occlusion-radius":new At(st["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-radius"]),"fill-extrusion-ambient-occlusion-wall-radius":new At(st["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-wall-radius"]),"fill-extrusion-ambient-occlusion-ground-radius":new At(st["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-ground-radius"]),"fill-extrusion-ambient-occlusion-ground-attenuation":new At(st["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-ground-attenuation"]),"fill-extrusion-flood-light-color":new At(st["paint_fill-extrusion"]["fill-extrusion-flood-light-color"]),"fill-extrusion-flood-light-intensity":new At(st["paint_fill-extrusion"]["fill-extrusion-flood-light-intensity"]),"fill-extrusion-flood-light-wall-radius":new ne(st["paint_fill-extrusion"]["fill-extrusion-flood-light-wall-radius"]),"fill-extrusion-flood-light-ground-radius":new ne(st["paint_fill-extrusion"]["fill-extrusion-flood-light-ground-radius"]),"fill-extrusion-flood-light-ground-attenuation":new At(st["paint_fill-extrusion"]["fill-extrusion-flood-light-ground-attenuation"]),"fill-extrusion-vertical-scale":new At(st["paint_fill-extrusion"]["fill-extrusion-vertical-scale"]),"fill-extrusion-rounded-roof":new At(st["paint_fill-extrusion"]["fill-extrusion-rounded-roof"]),"fill-extrusion-cutoff-fade-range":new At(st["paint_fill-extrusion"]["fill-extrusion-cutoff-fade-range"]),"fill-extrusion-emissive-strength":new At(st["paint_fill-extrusion"]["fill-extrusion-emissive-strength"])}),layout:oR};class bl extends Q{constructor(t,i,r){super(t,i),this.z=r}}function Yc(e,t){return e.x*t.x+e.y*t.y}function xw(e,t){if(e.length===1){let i=0;const r=t[i++];let n;for(;!n||r.equals(n);)if(n=t[i++],!n)return 1/0;for(;i&lt;t.length;i++){const s=t[i],a=e[0],l=n.sub(r),h=s.sub(r),d=a.sub(r),f=Yc(l,l),m=Yc(l,h),_=Yc(h,h),y=Yc(d,l),x=Yc(d,h),b=f*_-m*m,w=(_*y-m*x)/b,T=(f*x-m*y)/b,S=r.z*(1-w-T)+n.z*w+s.z*T;if(isFinite(S))return S}return 1/0}{let i=1/0;for(const r of t)i=Math.min(i,r.z);return i}}function vw(e,t,i,r,n,s,a,l){const h=a*n.getElevationAt(e,t,!0,!0),d=s[0]!==0,f=d?s[1]===0?a*(s[0]/7-450):a*function(m,_,y){const x=Math.floor(_[0]/8),b=Math.floor(_[1]/8),w=10*(_[0]-8*x),T=10*(_[1]-8*b),S=m.getElevationAt(x,b,!0,!0),I=m.getMeterToDEM(y),P=Math.floor(.5*(w*I-1)),M=Math.floor(.5*(T*I-1)),C=m.tileCoordToPixel(x,b),D=2*P+1,O=2*M+1,k=function(Y,J,it,X,K){return[Y.getElevationAtPixel(J,it,!0),Y.getElevationAtPixel(J+K,it,!0),Y.getElevationAtPixel(J,it+K,!0),Y.getElevationAtPixel(J+X,it+K,!0)]}(m,C.x-P,C.y-M,D,O),z=Math.abs(k[0]-k[1]),B=Math.abs(k[2]-k[3]),U=Math.abs(k[0]-k[2])+Math.abs(k[1]-k[3]),Z=Math.min(.25,.5*I*(z+B)/D),F=Math.min(.25,.5*I*U/O);return S+Math.max(Z*w,F*T)}(n,s,l):h;return{base:h+(i===0)?-1:i,top:d?Math.max(f+r,h+i+2):h+r}}const lR=new Di({"line-cap":new ne(st.layout_line["line-cap"]),"line-join":new ne(st.layout_line["line-join"]),"line-miter-limit":new At(st.layout_line["line-miter-limit"]),"line-round-limit":new At(st.layout_line["line-round-limit"]),"line-sort-key":new ne(st.layout_line["line-sort-key"]),visibility:new At(st.layout_line.visibility)});var bw={paint:new Di({"line-opacity":new ne(st.paint_line["line-opacity"]),"line-color":new ne(st.paint_line["line-color"]),"line-translate":new At(st.paint_line["line-translate"]),"line-translate-anchor":new At(st.paint_line["line-translate-anchor"]),"line-width":new ne(st.paint_line["line-width"]),"line-gap-width":new ne(st.paint_line["line-gap-width"]),"line-offset":new ne(st.paint_line["line-offset"]),"line-blur":new ne(st.paint_line["line-blur"]),"line-dasharray":new ne(st.paint_line["line-dasharray"]),"line-pattern":new ne(st.paint_line["line-pattern"]),"line-gradient":new yc(st.paint_line["line-gradient"]),"line-trim-offset":new At(st.paint_line["line-trim-offset"]),"line-emissive-strength":new At(st.paint_line["line-emissive-strength"]),"line-border-width":new ne(st.paint_line["line-border-width"]),"line-border-color":new ne(st.paint_line["line-border-color"])}),layout:lR};const cR=(e,t,i,r,n,s,a)=&gt;{const l=e.transform,h=l.calculatePixelsToTileUnitsMatrix(t);return{u_matrix:Tw(e,t,i,r),u_pixels_to_tile_units:h,u_device_pixel_ratio:s,u_units_to_pixels:[1/l.pixelsToGLUnits[0],1/l.pixelsToGLUnits[1]],u_dash_image:0,u_gradient_image:1,u_image_height:n,u_texsize:Sw(i)&amp;&amp;t.lineAtlasTexture?t.lineAtlasTexture.size:[0,0],u_tile_units_to_pixels:ww(t,e.transform),u_alpha_discard_threshold:0,u_trim_offset:a,u_emissive_strength:i.paint.get("line-emissive-strength")}},uR=(e,t,i,r,n)=&gt;{const s=e.transform;return{u_matrix:Tw(e,t,i,r),u_texsize:t.imageAtlasTexture?t.imageAtlasTexture.size:[0,0],u_pixels_to_tile_units:s.calculatePixelsToTileUnitsMatrix(t),u_device_pixel_ratio:n,u_image:0,u_tile_units_to_pixels:ww(t,s),u_units_to_pixels:[1/s.pixelsToGLUnits[0],1/s.pixelsToGLUnits[1]],u_alpha_discard_threshold:0}};function ww(e,t){return 1/fa(e,1,t.tileZoom)}function Tw(e,t,i,r){return e.translatePosMatrix(r||t.tileID.projMatrix,t,i.paint.get("line-translate"),i.paint.get("line-translate-anchor"))}const Ew=e=&gt;{const t=[];Sw(e)&amp;&amp;t.push("RENDER_LINE_DASH"),e.paint.get("line-gradient")&amp;&amp;t.push("RENDER_LINE_GRADIENT");const i=e.paint.get("line-trim-offset");return i[0]===0&amp;&amp;i[1]===0||t.push("RENDER_LINE_TRIM_OFFSET"),e.paint.get("line-border-width").constantOr(1)!==0&amp;&amp;t.push("RENDER_LINE_BORDER"),t};function Sw(e){const t=e.paint.get("line-dasharray").value;return t.value||t.kind!=="constant"}const Aw=new class extends ne{possiblyEvaluate(e,t){return t=new Si(Math.floor(t.zoom),{now:t.now,fadeDuration:t.fadeDuration,transition:t.transition}),super.possiblyEvaluate(e,t)}evaluate(e,t,i,r){return t=Bt({},t,{zoom:Math.floor(t.zoom)}),super.evaluate(e,t,i,r)}}(bw.paint.properties["line-width"].specification);function Mw(e,t){return t&gt;0?t+2*e:e}Aw.useIntegerZoom=!0;const hR=new Di({visibility:new At(st.layout_background.visibility)});var dR={paint:new Di({"background-color":new At(st.paint_background["background-color"]),"background-pattern":new At(st.paint_background["background-pattern"]),"background-opacity":new At(st.paint_background["background-opacity"]),"background-emissive-strength":new At(st.paint_background["background-emissive-strength"])}),layout:hR};const fR=new Di({visibility:new At(st.layout_raster.visibility)});var pR={paint:new Di({"raster-opacity":new At(st.paint_raster["raster-opacity"]),"raster-color":new yc(st.paint_raster["raster-color"]),"raster-color-mix":new At(st.paint_raster["raster-color-mix"]),"raster-color-range":new At(st.paint_raster["raster-color-range"]),"raster-hue-rotate":new At(st.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new At(st.paint_raster["raster-brightness-min"]),"raster-brightness-max":new At(st.paint_raster["raster-brightness-max"]),"raster-saturation":new At(st.paint_raster["raster-saturation"]),"raster-contrast":new At(st.paint_raster["raster-contrast"]),"raster-resampling":new At(st.paint_raster["raster-resampling"]),"raster-fade-duration":new At(st.paint_raster["raster-fade-duration"]),"raster-emissive-strength":new At(st.paint_raster["raster-emissive-strength"]),"raster-array-band":new At(st.paint_raster["raster-array-band"]),"raster-elevation":new At(st.paint_raster["raster-elevation"])}),layout:fR};function Iw(e,t,i,r,n,s,a,l){const h=[e,i,n,t,r,s,1,1,1],d=[a,l,1],f=Br.adjoint([],h),[m,_,y]=W.transformMat3(d,d,Br.transpose(f,f));return Br.multiply(h,[m,0,0,0,_,0,0,0,y],h)}class Rn extends Zi{constructor(t,i,r,n){super(),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.onNorthPole=!1,this.onSouthPole=!1,this.setEventedParent(n),this.options=i,this._dirty=!1}load(t,i){if(this._loaded=i||!1,this.fire(new It("dataloading",{dataType:"source"})),this.url=this.options.url,!this.url)return t&amp;&amp;(this.coordinates=t),this._loaded=!0,void this._finishLoading();this._imageRequest=Te(this.map._requestManager.transformRequest(this.url,pt.Image),(r,n)=&gt;{if(this._imageRequest=null,this._loaded=!0,r)this.fire(new xe(r));else if(n){const{HTMLImageElement:s}=L;this.image=n instanceof s?_e.getImageData(n):n,this._dirty=!0,this.width=this.image.width,this.height=this.image.height,t&amp;&amp;(this.coordinates=t),this._finishLoading()}})}loaded(){return this._loaded}updateImage(t){return t.url?(this._imageRequest&amp;&amp;t.url!==this.options.url&amp;&amp;(this._imageRequest.cancel(),this._imageRequest=null),this.options.url=t.url,this.load(t.coordinates,this._loaded),this):this}setTexture(t){if(!(t.handle instanceof WebGLTexture))throw new Error("The provided handle is not a WebGLTexture instance");return this.texture=new od(this.map.painter.context,t.handle),this.width=t.dimensions[0],this.height=t.dimensions[1],this._dirty=!1,this._loaded=!0,this._finishLoading(),this}_finishLoading(){this.map&amp;&amp;(this.setCoordinates(this.coordinates),this.fire(new It("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(t){this.map=t,this.load()}onRemove(){this._imageRequest&amp;&amp;(this._imageRequest.cancel(),this._imageRequest=null),!this.texture||this.texture instanceof od||this.texture.destroy()}setCoordinates(t){if(this.coordinates=t,this._boundsArray=void 0,!t.length)return this;this.onNorthPole=!1,this.onSouthPole=!1;let i=t[0][1],r=t[0][1];for(const s of t)s[1]&gt;r&amp;&amp;(r=s[1]),s[1]&lt;i&amp;&amp;(i=s[1]);const n=(r+i)/2;if(n&gt;zi?this.onNorthPole=!0:n&lt;-zi&amp;&amp;(this.onSouthPole=!0),!this.onNorthPole&amp;&amp;!this.onSouthPole){const s=t.map(Be.fromLngLat);this.tileID=function(a){let l=1/0,h=1/0,d=-1/0,f=-1/0;for(const x of a)l=Math.min(l,x.x),h=Math.min(h,x.y),d=Math.max(d,x.x),f=Math.max(f,x.y);const m=Math.max(d-l,f-h),_=Math.max(0,Math.floor(-Math.log(m)/Math.LN2)),y=Math.pow(2,_);return new In(_,Math.floor((l+d)/2*y),Math.floor((h+f)/2*y))}(s),this.minzoom=this.maxzoom=this.tileID.z}return this.fire(new It("data",{dataType:"source",sourceDataType:"content"})),this}_clear(){this._boundsArray=void 0}_prepareData(t){for(const h in this.tiles){const d=this.tiles[h];d.state!=="loaded"&amp;&amp;(d.state="loaded",d.texture=this.texture)}if(this._boundsArray)return;const i=da(this.tileID,this.map.transform.projection),[r,n,s,a]=this.coordinates.map(h=&gt;{const d=i.projection.project(h[0],h[1]);return _b(i,d)._round()});this.perspectiveTransform=function(h,d,f,m,_,y,x,b,w,T){const S=Iw(0,0,h,0,0,d,h,d),I=Iw(f,m,_,y,x,b,w,T);return Br.multiply(I,Br.adjoint(S,S),I),[I[6]/I[8]*h/ut,I[7]/I[8]*d/ut]}(this.width,this.height,r.x,r.y,n.x,n.y,a.x,a.y,s.x,s.y);const l=this._boundsArray=new sa;l.emplaceBack(r.x,r.y,0,0),l.emplaceBack(n.x,n.y,ut,0),l.emplaceBack(a.x,a.y,0,ut),l.emplaceBack(s.x,s.y,ut,ut),this.boundsBuffer&amp;&amp;this.boundsBuffer.destroy(),this.boundsBuffer=t.createVertexBuffer(l,d_.members),this.boundsSegments=si.simpleSegment(0,0,4,2)}prepare(){const t=Object.keys(this.tiles).length!==0;if(this.tileID&amp;&amp;!t)return;const i=this.map.painter.context,r=i.gl;!this._dirty||this.texture instanceof od||(this.texture?this.texture.update(this.image):(this.texture=new Ii(i,this.image,r.RGBA),this.texture.bind(r.LINEAR,r.CLAMP_TO_EDGE)),this._dirty=!1),t&amp;&amp;this._prepareData(i)}loadTile(t,i){this.tileID&amp;&amp;this.tileID.equals(t.tileID.canonical)?(this.tiles[String(t.tileID.wrap)]=t,t.buckets={},i(null)):(t.state="errored",i(null))}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}}class mR extends hn{constructor(t){super(t,{}),this.implementation=t,t.slot&amp;&amp;(this.slot=t.slot)}is3D(){return this.implementation.renderingMode==="3d"}hasOffscreenPass(){return this.implementation.prerender!==void 0}isLayerDraped(t){return this.implementation.renderToTile!==void 0}shouldRedrape(){return!!this.implementation.shouldRerenderTiles&amp;&amp;this.implementation.shouldRerenderTiles()}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){}onAdd(t){this.implementation.onAdd&amp;&amp;this.implementation.onAdd(t,t.painter.context.gl)}onRemove(t){this.implementation.onRemove&amp;&amp;this.implementation.onRemove(t,t.painter.context.gl)}}const _R=new Di({visibility:new At(st.layout_sky.visibility)});var gR={paint:new Di({"sky-type":new At(st.paint_sky["sky-type"]),"sky-atmosphere-sun":new At(st.paint_sky["sky-atmosphere-sun"]),"sky-atmosphere-sun-intensity":new At(st.paint_sky["sky-atmosphere-sun-intensity"]),"sky-gradient-center":new At(st.paint_sky["sky-gradient-center"]),"sky-gradient-radius":new At(st.paint_sky["sky-gradient-radius"]),"sky-gradient":new yc(st.paint_sky["sky-gradient"]),"sky-atmosphere-halo-color":new At(st.paint_sky["sky-atmosphere-halo-color"]),"sky-atmosphere-color":new At(st.paint_sky["sky-atmosphere-color"]),"sky-opacity":new At(st.paint_sky["sky-opacity"])}),layout:_R};function E_(e,t,i){const r=[0,0,1],n=vr.identity([]);return vr.rotateY(n,n,i?-$t(e)+Math.PI:$t(e)),vr.rotateX(n,n,-$t(t)),W.transformQuat(r,r,n),W.normalize(r,r)}var yR={paint:new Di({})};const xR={circle:class extends hn{constructor(e,t){super(e,rC,t)}createBucket(e){return new Nm(e)}queryRadius(e){const t=e;return al("circle-radius",this,t)+al("circle-stroke-width",this,t)+Ph(this.paint.get("circle-translate"))}queryIntersectsFeature(e,t,i,r,n,s,a,l){const h=_1(this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),s.angle,e.pixelToTileUnitsFactor),d=this.paint.get("circle-radius").evaluate(t,i)+this.paint.get("circle-stroke-width").evaluate(t,i);return y1(e,r,s,a,l,this.paint.get("circle-pitch-alignment")==="map",this.paint.get("circle-pitch-scale")==="map",h,d)}getProgramIds(){return["circle"]}getDefaultProgramParams(e,t){const i=g1(this);return{config:new la(this,t),defines:i,overrideFog:!1}}},heatmap:class extends hn{createBucket(e){return new v1(e)}constructor(e,t){super(e,uC,t),this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(e){e==="heatmap-color"&amp;&amp;this._updateColorRamp()}_updateColorRamp(){this.colorRamp=Ch({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbo&amp;&amp;(this.heatmapFbo.destroy(),this.heatmapFbo=null)}queryRadius(e){return al("heatmap-radius",this,e)}queryIntersectsFeature(e,t,i,r,n,s,a,l){const h=this.paint.get("heatmap-radius").evaluate(t,i);return y1(e,r,s,a,l,!0,!0,new Q(0,0),h)}hasOffscreenPass(){return this.paint.get("heatmap-opacity")!==0&amp;&amp;this.visibility!=="none"}getProgramIds(){return["heatmap","heatmapTexture"]}getDefaultProgramParams(e,t){return e==="heatmap"?{config:new la(this,t),overrideFog:!1}:{}}},hillshade:class extends hn{constructor(e,t){super(e,dC,t)}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&amp;&amp;this.visibility!=="none"}getProgramIds(){return["hillshade","hillshadePrepare"]}getDefaultProgramParams(e,t){return{overrideFog:!1}}},fill:class extends hn{constructor(e,t){super(e,AC,t)}getProgramIds(){const e=this.paint.get("fill-pattern"),t=e&amp;&amp;e.constantOr(1),i=[t?"fillPattern":"fill"];return this.paint.get("fill-antialias")&amp;&amp;i.push(t&amp;&amp;!this.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline"),i}getDefaultProgramParams(e,t){return{config:new la(this,t),overrideFog:!1}}recalculate(e,t){super.recalculate(e,t);const i=this.paint._values["fill-outline-color"];i.value.kind==="constant"&amp;&amp;i.value.value===void 0&amp;&amp;(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(e){return new zh(e)}queryRadius(){return Ph(this.paint.get("fill-translate"))}queryIntersectsFeature(e,t,i,r,n,s){return!e.queryGeometry.isAboveHorizon&amp;&amp;h1(m1(e.tilespaceGeometry,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),s.angle,e.pixelToTileUnitsFactor),r)}isTileClipped(){return!0}},"fill-extrusion":class extends hn{constructor(e,t){super(e,aR,t),this._stats={numRenderedVerticesInShadowPass:0,numRenderedVerticesInTransparentPass:0}}createBucket(e){return new Xc(e)}queryRadius(){return Ph(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}hasShadowPass(){return!0}cutoffRange(){return this.paint.get("fill-extrusion-cutoff-fade-range")}canCastShadows(){return!0}getProgramIds(){return[this.paint.get("fill-extrusion-pattern").constantOr(1)?"fillExtrusionPattern":"fillExtrusion"]}queryIntersectsFeature(e,t,i,r,n,s,a,l,h){const d=_1(this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),s.angle,e.pixelToTileUnitsFactor),f=this.paint.get("fill-extrusion-height").evaluate(t,i),m=this.paint.get("fill-extrusion-base").evaluate(t,i),_=[0,0],y=l&amp;&amp;s.elevation,x=s.elevation?s.elevation.exaggeration():1,b=e.tile.getBucket(this);if(y&amp;&amp;b instanceof Xc){const P=b.centroidVertexArray,M=h+1;M&lt;P.length&amp;&amp;(_[0]=P.geta_centroid_pos0(M),_[1]=P.geta_centroid_pos1(M))}if(_[0]===0&amp;&amp;_[1]===1)return!1;s.projection.name==="globe"&amp;&amp;(r=yw([r],[new Q(0,0),new Q(ut,ut)],e.tileID.canonical).map(P=&gt;P.polygon).flat());const w=y?l:null,[T,S]=function(P,M,C,D,O,k,z,B,U,Z,F){return P.projection.name==="globe"?function(Y,J,it,X,K,ot,lt,at,dt,ft,_t){const ct=[],bt=[],Ot=Y.projection.upVectorScale(_t,Y.center.lat,Y.worldSize).metersToTile,kt=[0,0,0,1],Ht=[0,0,0,1],Zt=(ie,Ve,ke,pe)=&gt;{ie[0]=Ve,ie[1]=ke,ie[2]=pe,ie[3]=1},fe=gw();it&gt;0&amp;&amp;(it+=fe),X+=fe;for(const ie of J){const Ve=[],ke=[];for(const pe of ie){const ue=pe.x+K.x,re=pe.y+K.y,Fe=Y.projection.projectTilePoint(ue,re,_t),Ue=Y.projection.upVector(_t,pe.x,pe.y);let Me=it,hi=X;if(lt){const Fi=vw(ue,re,it,X,lt,at,dt,ft);Me+=Fi.base,hi+=Fi.top}it!==0?Zt(kt,Fe.x+Ue[0]*Ot*Me,Fe.y+Ue[1]*Ot*Me,Fe.z+Ue[2]*Ot*Me):Zt(kt,Fe.x,Fe.y,Fe.z),Zt(Ht,Fe.x+Ue[0]*Ot*hi,Fe.y+Ue[1]*Ot*hi,Fe.z+Ue[2]*Ot*hi),W.transformMat4(kt,kt,ot),W.transformMat4(Ht,Ht,ot),Ve.push(new bl(kt[0],kt[1],kt[2])),ke.push(new bl(Ht[0],Ht[1],Ht[2]))}ct.push(Ve),bt.push(ke)}return[ct,bt]}(P,M,C,D,O,k,z,B,U,Z,F):z?function(Y,J,it,X,K,ot,lt,at,dt){const ft=[],_t=[],ct=[0,0,0,1];for(const bt of Y){const Ot=[],kt=[];for(const Ht of bt){const Zt=Ht.x+X.x,fe=Ht.y+X.y,ie=vw(Zt,fe,J,it,ot,lt,at,dt);ct[0]=Zt,ct[1]=fe,ct[2]=ie.base,ct[3]=1,oi.transformMat4(ct,ct,K),ct[3]=Math.max(ct[3],1e-5);const Ve=new bl(ct[0]/ct[3],ct[1]/ct[3],ct[2]/ct[3]);ct[0]=Zt,ct[1]=fe,ct[2]=ie.top,ct[3]=1,oi.transformMat4(ct,ct,K),ct[3]=Math.max(ct[3],1e-5);const ke=new bl(ct[0]/ct[3],ct[1]/ct[3],ct[2]/ct[3]);Ot.push(Ve),kt.push(ke)}ft.push(Ot),_t.push(kt)}return[ft,_t]}(M,C,D,O,k,z,B,U,Z):function(Y,J,it,X,K){const ot=[],lt=[],at=K[8]*J,dt=K[9]*J,ft=K[10]*J,_t=K[11]*J,ct=K[8]*it,bt=K[9]*it,Ot=K[10]*it,kt=K[11]*it;for(const Ht of Y){const Zt=[],fe=[];for(const ie of Ht){const Ve=ie.x+X.x,ke=ie.y+X.y,pe=K[0]*Ve+K[4]*ke+K[12],ue=K[1]*Ve+K[5]*ke+K[13],re=K[2]*Ve+K[6]*ke+K[14],Fe=K[3]*Ve+K[7]*ke+K[15],Ue=pe+at,Me=ue+dt,hi=re+ft,Fi=Math.max(Fe+_t,1e-5),ai=pe+ct,_i=ue+bt,Ui=re+Ot,Bi=Math.max(Fe+kt,1e-5);Zt.push(new bl(Ue/Fi,Me/Fi,hi/Fi)),fe.push(new bl(ai/Bi,_i/Bi,Ui/Bi))}ot.push(Zt),lt.push(fe)}return[ot,lt]}(M,C,D,O,k)}(s,r,m,f,d,a,w,_,x,s.center.lat,e.tileID.canonical),I=e.queryGeometry;return function(P,M,C){let D=1/0;h1(C,M)&amp;&amp;(D=xw(C,M[0]));for(let O=0;O&lt;M.length;O++){const k=M[O],z=P[O];for(let B=0;B&lt;k.length-1;B++){const U=k[B],Z=[U,k[B+1],z[B+1],z[B],U];u1(C,Z)&amp;&amp;(D=Math.min(D,xw(C,Z)))}}return D!==1/0&amp;&amp;D}(T,S,I.isPointQuery()?I.screenBounds:I.screenGeometry)}},line:class extends hn{constructor(e,t){super(e,bw,t),this.gradientVersion=0}_handleSpecialPaintPropertyUpdate(e){if(e==="line-gradient"){const t=this._transitionablePaint._values["line-gradient"].value.expression;this.stepInterpolant=t._styleExpression&amp;&amp;t._styleExpression.expression instanceof up,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}widthExpression(){return this._transitionablePaint._values["line-width"].value.expression}recalculate(e,t){super.recalculate(e,t),this.paint._values["line-floorwidth"]=Aw.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,e)}createBucket(e){return new sd(e)}getProgramIds(){return[this.paint.get("line-pattern").constantOr(1)?"linePattern":"line"]}getDefaultProgramParams(e,t){const i=Ew(this);return{config:new la(this,t),defines:i,overrideFog:!1}}queryRadius(e){const t=e,i=Mw(al("line-width",this,t),al("line-gap-width",this,t)),r=al("line-offset",this,t);return i/2+Math.abs(r)+Ph(this.paint.get("line-translate"))}queryIntersectsFeature(e,t,i,r,n,s){if(e.queryGeometry.isAboveHorizon)return!1;const a=m1(e.tilespaceGeometry,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),s.angle,e.pixelToTileUnitsFactor),l=e.pixelToTileUnitsFactor/2*Mw(this.paint.get("line-width").evaluate(t,i),this.paint.get("line-gap-width").evaluate(t,i)),h=this.paint.get("line-offset").evaluate(t,i);return h&amp;&amp;(r=function(d,f){const m=[],_=new Q(0,0);for(let y=0;y&lt;d.length;y++){const x=d[y],b=[];for(let w=0;w&lt;x.length;w++){const T=x[w],S=x[w+1],I=w===0?_:T.sub(x[w-1])._unit()._perp(),P=w===x.length-1?_:S.sub(T)._unit()._perp(),M=I._add(P)._unit();M._mult(1/(M.x*P.x+M.y*P.y)),b.push(M._mult(f)._add(T))}m.push(b)}return m}(r,h*e.pixelToTileUnitsFactor)),function(d,f,m){for(let _=0;_&lt;f.length;_++){const y=f[_];if(d.length&gt;=3){for(let x=0;x&lt;y.length;x++)if(Io(d,y[x]))return!0}if(QP(d,y,m))return!0}return!1}(a,r,l)}isTileClipped(){return!0}},symbol:Qh,background:class extends hn{constructor(e,t){super(e,dR,t)}getProgramIds(){return[this.paint.get("background-pattern")?"backgroundPattern":"background"]}getDefaultProgramParams(e,t){return{overrideFog:!1}}},raster:class extends hn{constructor(e,t){super(e,pR,t),this._updateColorRamp()}getProgramIds(){return["raster"]}hasColorMap(){return!!this._transitionablePaint._values["raster-color"].value.value}isLayerDraped(e){return!(e&amp;&amp;e._source instanceof Rn)||!e._source.onNorthPole&amp;&amp;!e._source.onSouthPole&amp;&amp;this.paint.get("raster-elevation")===0}_handleSpecialPaintPropertyUpdate(e){e!=="raster-color"&amp;&amp;e!=="raster-color-range"||this._updateColorRamp()}_updateColorRamp(){if(!this.hasColorMap())return;const e=this._transitionablePaint._values["raster-color"].value.expression,[t,i]=this._transitionablePaint._values["raster-color-range"].value.expression.evaluate({zoom:0});this.colorRamp=Ch({expression:e,evaluationKey:"rasterValue",image:this.colorRamp,clips:[{start:t,end:i}],resolution:256}),this.colorRampTexture=null}},sky:class extends hn{constructor(e,t){super(e,gR,t),this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(e){e==="sky-gradient"?this._updateColorRamp():e!=="sky-atmosphere-sun"&amp;&amp;e!=="sky-atmosphere-halo-color"&amp;&amp;e!=="sky-atmosphere-color"&amp;&amp;e!=="sky-atmosphere-sun-intensity"||(this._skyboxInvalidated=!0)}_updateColorRamp(){this.colorRamp=Ch({expression:this._transitionablePaint._values["sky-gradient"].value.expression,evaluationKey:"skyRadialProgress"}),this.colorRampTexture&amp;&amp;(this.colorRampTexture.destroy(),this.colorRampTexture=null)}needsSkyboxCapture(e){if(this._skyboxInvalidated||!this.skyboxTexture||!this.skyboxGeometry)return!0;if(!this.paint.get("sky-atmosphere-sun")){const t=e.style.light.properties.get("position");return this._lightPosition.azimuthal!==t.azimuthal||this._lightPosition.polar!==t.polar}return!1}getCenter(e,t){if(this.paint.get("sky-type")==="atmosphere"){const r=this.paint.get("sky-atmosphere-sun"),n=!r,s=e.style.light,a=s.properties.get("position");return n&amp;&amp;s.properties.get("anchor")==="viewport"&amp;&amp;tt("The sun direction is attached to a light with viewport anchor, lighting may behave unexpectedly."),n?E_(a.azimuthal,90-a.polar,t):E_(r[0],90-r[1],t)}const i=this.paint.get("sky-gradient-center");return E_(i[0],90-i[1],t)}isSky(){return!0}markSkyboxValid(e){this._skyboxInvalidated=!1,this._lightPosition=e.style.light.properties.get("position")}hasOffscreenPass(){return!0}getProgramIds(){const e=this.paint.get("sky-type");return e==="atmosphere"?["skyboxCapture","skybox"]:e==="gradient"?["skyboxGradient"]:null}},slot:class extends hn{constructor(e,t){super(e,yR)}},model:class extends hn{constructor(e,t){super(e,qL,t)}createBucket(e){return new Yb(e)}getProgramIds(){return["model"]}is3D(){return!0}hasShadowPass(){return!0}canCastShadows(){return!0}hasLightBeamPass(){return!0}cutoffRange(){return this.paint.get("model-cutoff-fade-range")}queryRadius(){return 0}queryIntersectsFeature(){return!1}_handleOverridablePaintPropertyUpdate(e,t,i){return!(!this.layout||t.isDataDriven()||i.isDataDriven()||e!=="model-color"&amp;&amp;e!=="model-color-mix-intensity"&amp;&amp;e!=="model-rotation"&amp;&amp;e!=="model-scale"&amp;&amp;e!=="model-translation"&amp;&amp;e!=="model-emissive-strength")}_isPropertyZoomDependent(e){const t=this._transitionablePaint._values[e];return t!=null&amp;&amp;t.value!=null&amp;&amp;t.value.expression!=null&amp;&amp;t.value.expression instanceof po}isZoomDependent(){return this._isPropertyZoomDependent("model-scale")||this._isPropertyZoomDependent("model-rotation")||this._isPropertyZoomDependent("model-translation")}}};function gd(e,t){return e.type==="custom"?new mR(e):new xR[e.type](e,t)}function vR(e){const{userImage:t}=e;return!!(t&amp;&amp;t.render&amp;&amp;t.render())&amp;&amp;(e.data.replace(new Uint8Array(t.data.buffer)),!0)}class bR extends Zi{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded={},this.requestors=[],this.patterns={},this.atlasImage={},this.atlasTexture={},this.dirty=!0}createScope(t){this.images[t]={},this.loaded[t]=!1,this.updatedImages[t]={},this.patterns[t]={},this.callbackDispatchedThisFrame[t]={},this.atlasImage[t]=new Hi({width:1,height:1})}isLoaded(){for(const t in this.loaded)if(!this.loaded[t])return!1;return!0}setLoaded(t,i){if(this.loaded[i]!==t&amp;&amp;(this.loaded[i]=t,t)){for(const{ids:r,callback:n}of this.requestors)this._notify(r,i,n);this.requestors=[]}}hasImage(t,i){return!!this.getImage(t,i)}getImage(t,i){return this.images[i][t]}addImage(t,i,r){this._validate(t,r)&amp;&amp;(this.images[i][t]=r)}_validate(t,i){let r=!0;return this._validateStretch(i.stretchX,i.data&amp;&amp;i.data.width)||(this.fire(new xe(new Error(`Image "${t}" has invalid "stretchX" value`))),r=!1),this._validateStretch(i.stretchY,i.data&amp;&amp;i.data.height)||(this.fire(new xe(new Error(`Image "${t}" has invalid "stretchY" value`))),r=!1),this._validateContent(i.content,i)||(this.fire(new xe(new Error(`Image "${t}" has invalid "content" value`))),r=!1),r}_validateStretch(t,i){if(!t)return!0;let r=0;for(const n of t){if(n[0]&lt;r||n[1]&lt;n[0]||i&lt;n[1])return!1;r=n[1]}return!0}_validateContent(t,i){return!(t&amp;&amp;(t.length!==4||t[0]&lt;0||i.data.width&lt;t[0]||t[1]&lt;0||i.data.height&lt;t[1]||t[2]&lt;0||i.data.width&lt;t[2]||t[3]&lt;0||i.data.height&lt;t[3]||t[2]&lt;t[0]||t[3]&lt;t[1]))}updateImage(t,i,r){r.version=this.images[i][t].version+1,this.images[i][t]=r,this.updatedImages[i][t]=!0}removeImage(t,i){const r=this.images[i][t];delete this.images[i][t],delete this.patterns[i][t],r.userImage&amp;&amp;r.userImage.onRemove&amp;&amp;r.userImage.onRemove()}listImages(t){return Object.keys(this.images[t])}getImages(t,i,r){let n=!0;const s=!!this.loaded[i];if(!s)for(const a of t)this.images[i][a]||(n=!1);s||n?this._notify(t,i,r):this.requestors.push({ids:t,scope:i,callback:r})}getUpdatedImages(t){return this.updatedImages[t]}_notify(t,i,r){const n={};for(const s of t){this.images[i][s]||this.fire(new It("styleimagemissing",{id:s}));const a=this.images[i][s];a?n[s]={data:a.data.clone(),pixelRatio:a.pixelRatio,sdf:a.sdf,version:a.version,stretchX:a.stretchX,stretchY:a.stretchY,content:a.content,hasRenderCallback:!!(a.userImage&amp;&amp;a.userImage.render)}:tt(`Image "${s}" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.`)}r(null,n)}getPixelSize(t){const{width:i,height:r}=this.atlasImage[t];return{width:i,height:r}}getPattern(t,i){const r=this.patterns[i][t],n=this.getImage(t,i);if(!n)return null;if(r&amp;&amp;r.position.version===n.version)return r.position;if(r)r.position.version=n.version;else{const s={w:n.data.width+2,h:n.data.height+2,x:0,y:0},a=new n_(s,n);this.patterns[i][t]={bin:s,position:a}}return this._updatePatternAtlas(i),this.patterns[i][t].position}bind(t,i){const r=t.gl;let n=this.atlasTexture[i];n?this.dirty&amp;&amp;(n.update(this.atlasImage[i]),this.dirty=!1):(n=new Ii(t,this.atlasImage[i],r.RGBA),this.atlasTexture[i]=n),n.bind(r.LINEAR,r.CLAMP_TO_EDGE)}_updatePatternAtlas(t){const i=[];for(const a in this.patterns[t])i.push(this.patterns[t][a].bin);const{w:r,h:n}=r_(i),s=this.atlasImage[t];s.resize({width:r||1,height:n||1});for(const a in this.patterns[t]){const{bin:l}=this.patterns[t][a],h=l.x+1,d=l.y+1,f=this.images[t][a].data,m=f.width,_=f.height;Hi.copy(f,s,{x:0,y:0},{x:h,y:d},{width:m,height:_}),Hi.copy(f,s,{x:0,y:_-1},{x:h,y:d-1},{width:m,height:1}),Hi.copy(f,s,{x:0,y:0},{x:h,y:d+_},{width:m,height:1}),Hi.copy(f,s,{x:m-1,y:0},{x:h-1,y:d},{width:1,height:_}),Hi.copy(f,s,{x:0,y:0},{x:h+m,y:d},{width:1,height:_})}this.dirty=!0}beginFrame(){for(const t in this.images)this.callbackDispatchedThisFrame[t]={}}dispatchRenderCallbacks(t,i){for(const r of t){if(this.callbackDispatchedThisFrame[i][r])continue;this.callbackDispatchedThisFrame[i][r]=!0;const n=this.images[i][r];vR(n)&amp;&amp;this.updateImage(r,i,n)}}}const wR=new Di({anchor:new At(st.light.anchor),position:new class{constructor(e){this.specification=e}possiblyEvaluate(e,t){return Wt(e.expression.evaluate(t))}interpolate(e,t,i){return{x:ge(e.x,t.x,i),y:ge(e.y,t.y,i),z:ge(e.z,t.z,i),azimuthal:ge(e.azimuthal,t.azimuthal,i),polar:ge(e.polar,t.polar,i)}}}(st.light.position),color:new At(st.light.color),intensity:new At(st.light.intensity)});class Pw extends Zi{constructor(t,i="flat"){super(),this._transitionable=new _c(wR),this.setLight(t,i),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(t,i,r={}){this._validate(WI,t,r)||(this._transitionable.setTransitionOrValue(t),this.id=i)}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(!r||r.validate!==!1)&amp;&amp;nh(this,t.call(Xa,Bt({value:i,style:{glyphs:!0,sprite:!0},styleSpec:st})))}}const TR=new Di({source:new At(st.terrain.source),exaggeration:new At(st.terrain.exaggeration)});let ER=class extends Zi{constructor(e,t,i,r){super(),this.scope=i,this._transitionable=new _c(TR,r),this._transitionable.setTransitionOrValue(e,r),this._transitioning=this._transitionable.untransitioned(),this.drapeRenderMode=t}get(){return this._transitionable.serialize()}set(e,t){this._transitionable.setTransitionOrValue(e,t)}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}getExaggeration(e){return this._transitioning.possiblyEvaluate(new Si(e)).get("exaggeration")}isZoomDependent(){const e=this._transitionable._values.exaggeration;return e!=null&amp;&amp;e.value!=null&amp;&amp;e.value.expression!=null&amp;&amp;e.value.expression instanceof po}};const Cw=45,Lw=65,_a=.05;function yd(e,t,i,r){const n=xn(Cw,Lw,i),[s,a]=Rw(e,r);let l=1-Math.min(1,Math.exp((t-s)/(a-s)*-6));return l*=l*l,l=Math.min(1,1.00747*l),l*n*e.alpha}function Rw(e,t){const i=.5/Math.tan(.5*t);return[e.range[0]+i,e.range[1]+i]}function Dw(e,t,i,r,n){const s=W.transformMat4([],[t,i,r],n.mercatorFogMatrix);return yd(e,W.length(s),n.pitch,n._fov)}function Ow(e,t,i,r,n,s,a){const l=[[i,r,0],[n,r,0],[n,s,0],[i,s,0]];let h=Number.MAX_VALUE,d=-Number.MAX_VALUE;for(const f of l){const m=W.transformMat4([],f,t),_=W.length(m);h=Math.min(h,_),d=Math.max(d,_)}return[yd(e,h,a.pitch,a._fov),yd(e,d,a.pitch,a._fov)]}const SR=new Di({range:new At(st.fog.range),color:new At(st.fog.color),"high-color":new At(st.fog["high-color"]),"space-color":new At(st.fog["space-color"]),"horizon-blend":new At(st.fog["horizon-blend"]),"star-intensity":new At(st.fog["star-intensity"]),"vertical-range":new At(st.fog["vertical-range"])});class AR extends Zi{constructor(t,i){super(),this._transitionable=new _c(SR),this.set(t),this._transitioning=this._transitionable.untransitioned(),this._transform=i}get state(){const t=this._transform,i=t.projection.name==="globe",r=hr(t.zoom),n=this.properties.get("range"),s=[.5,3];return{range:i?[ge(s[0],n[0],r),ge(s[1],n[1],r)]:n,horizonBlend:this.properties.get("horizon-blend"),alpha:this.properties.get("color").a}}get(){return this._transitionable.serialize()}set(t,i={}){if(this._validate($I,t,i))return;const r=Bt({},t);for(const n of Object.keys(st.fog))r[n]===void 0&amp;&amp;(r[n]=st.fog[n].default);this._transitionable.setTransitionOrValue(r)}getOpacity(t){if(!this._transform.projection.supportsFog)return 0;const i=this.properties&amp;&amp;this.properties.get("color")||1;return(this._transform.projection.name==="globe"?1:xn(Cw,Lw,t))*i.a}getOpacityAtLatLng(t,i){return this._transform.projection.supportsFog?function(r,n,s){const a=Be.fromLngLat(n),l=s.elevation?s.elevation.getAtPointOrZero(a):0;return Dw(r,a.x,a.y,l,s)}(this.state,t,i):0}getOpacityForTile(t){if(!this._transform.projection.supportsFog)return[1,1];const i=this._transform.calculateFogTileMatrix(t.toUnwrapped());return Ow(this.state,i,0,0,ut,ut,this._transform)}getOpacityForBounds(t,i,r,n,s){return this._transform.projection.supportsFog?Ow(this.state,t,i,r,n,s,this._transform):[1,1]}getFovAdjustedRange(t){return this._transform.projection.supportsFog?Rw(this.state,t):[0,1]}isVisibleOnFrustum(t){if(!this._transform.projection.supportsFog)return!1;const i=[4,5,6,7];for(const r of i){const n=t.points[r];let s;if(n[2]&gt;=0)s=n;else{const a=t.points[r-4];s=l0(a,n,a[2]/(a[2]-n[2]))}if(Dw(this.state,s[0],s[1],0,this._transform)&gt;=_a)return!0}return!1}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(!r||r.validate!==!1)&amp;&amp;nh(this,t.call(Xa,Bt({value:i,style:{glyphs:!0,sprite:!0},styleSpec:st})))}}class MR{constructor(t){this._callback=t,this._triggered=!1,typeof MessageChannel&lt;"u"&amp;&amp;(this._channel=new MessageChannel,this._channel.port2.onmessage=()=&gt;{this._triggered=!1,this._callback()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(()=&gt;{this._triggered=!1,this._callback()},0))}remove(){this._channel=void 0,this._callback=()=&gt;{}}}class IR{constructor(){this.tasks={},this.taskQueue=[],Oi(["process"],this),this.invoker=new MR(this.process),this.nextId=0}add(t,i){const r=this.nextId++,n=function({type:s,isSymbolTile:a,zoom:l}){return l=l||0,s==="message"?0:s!=="maybePrepare"||a?s!=="parseTile"||a?s==="parseTile"&amp;&amp;a?300-l:s==="maybePrepare"&amp;&amp;a?400-l:500:200-l:100-l}(i);if(n===0){Et();try{t()}finally{}return{cancel:()=&gt;{}}}return this.tasks[r]={fn:t,metadata:i,priority:n,id:r},this.taskQueue.push(r),this.invoker.trigger(),{cancel:()=&gt;{delete this.tasks[r]}}}process(){Et();try{if(this.taskQueue=this.taskQueue.filter(r=&gt;!!this.tasks[r]),!this.taskQueue.length)return;const t=this.pick();if(t===null)return;const i=this.tasks[t];if(delete this.tasks[t],this.taskQueue.length&amp;&amp;this.invoker.trigger(),!i)return;i.fn()}finally{}}pick(){let t=null,i=1/0;for(let n=0;n&lt;this.taskQueue.length;n++){const s=this.tasks[this.taskQueue[n]];s.priority&lt;i&amp;&amp;(i=s.priority,t=n)}if(t===null)return null;const r=this.taskQueue[t];return this.taskQueue.splice(t,1),r}remove(){this.invoker.remove()}}class kw{constructor(t,i,r){this.target=t,this.parent=i,this.mapId=r,this.callbacks={},this.cancelCallbacks={},Oi(["receive"],this),this.target.addEventListener("message",this.receive,!1),this.scheduler=new IR}send(t,i,r,n,s=!1,a){const l=Math.round(1e18*Math.random()).toString(36).substring(0,10);r&amp;&amp;(r.metadata=a,this.callbacks[l]=r);const h=new Set;return this.target.postMessage({id:l,type:t,hasCallback:!!r,targetMapId:n,mustQueue:s,sourceMapId:this.mapId,data:Ka(i,h)},h),{cancel:()=&gt;{r&amp;&amp;delete this.callbacks[l],this.target.postMessage({id:l,type:"&lt;cancel&gt;",targetMapId:n,sourceMapId:this.mapId})}}}receive(t){const i=t.data,r=i.id;if(r&amp;&amp;(!i.targetMapId||this.mapId===i.targetMapId))if(i.type==="&lt;cancel&gt;"){const n=this.cancelCallbacks[r];delete this.cancelCallbacks[r],n&amp;&amp;n.cancel()}else if(i.mustQueue||Et()){const n=this.callbacks[r];this.cancelCallbacks[r]=this.scheduler.add(()=&gt;this.processTask(r,i),n&amp;&amp;n.metadata||{type:"message"})}else this.processTask(r,i)}processTask(t,i){if(i.type==="&lt;response&gt;"){const r=this.callbacks[t];delete this.callbacks[t],r&amp;&amp;(i.error?r(Ja(i.error)):r(null,Ja(i.data)))}else{const r=new Set,n=i.hasCallback?(a,l)=&gt;{delete this.cancelCallbacks[t],this.target.postMessage({id:t,type:"&lt;response&gt;",sourceMapId:this.mapId,error:a?Ka(a):null,data:Ka(l,r)},r)}:a=&gt;{},s=Ja(i.data);if(this.parent[i.type])this.parent[i.type](i.sourceMapId,s,n);else if(this.parent.getWorkerSource){const a=i.type.split(".");this.parent.getWorkerSource(i.sourceMapId,a[0],s.source,s.scope)[a[1]](s,n)}else n(new Error(`Could not find function ${i.type}`))}}remove(){this.scheduler.remove(),this.target.removeEventListener("message",this.receive,!1)}}class ga{constructor(t,i){this.workerPool=t,this.actors=[],this.currentActor=0,this.id=ar();const r=this.workerPool.acquire(this.id);for(let n=0;n&lt;r.length;n++){const s=new ga.Actor(r[n],i,this.id);s.name=`Worker ${n}`,this.actors.push(s)}this.ready=!1,this.broadcast("checkIfReady",null,()=&gt;{this.ready=!0})}broadcast(t,i,r){Rs(this.actors,(n,s)=&gt;{n.send(t,i,s)},r=r||function(){})}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(){this.actors.forEach(t=&gt;{t.remove()}),this.actors=[],this.workerPool.release(this.id)}}ga.Actor=kw;class zw extends Zi{constructor(t,i,r,n){super(),this.scope=r,this._options=t,this.properties=new gc(i),this._transitionable=new _c(i,new Map(n)),this._transitionable.setTransitionOrValue(t.properties),this._transitioning=this._transitionable.untransitioned()}updateConfig(t){this._transitionable.setTransitionOrValue(this._options.properties,new Map(t))}updateTransitions(t){this._transitioning=this._transitionable.transitioned(t,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(t){this.properties=this._transitioning.possiblyEvaluate(t)}get(){return this._options.properties=this._transitionable.serialize(),this._options}set(t,i){this._options=t,this._transitionable.setTransitionOrValue(t.properties,i)}shadowsEnabled(){return!!this.properties&amp;&amp;this.properties.get("cast-shadows")===!0}}const PR=new Di({color:new At(st.properties_light_ambient.color),intensity:new At(st.properties_light_ambient.intensity)}),CR=new Di({direction:new class{constructor(e){this.specification=e}possiblyEvaluate(e,t){return function([i,r]){const n=Wt([1,i,r]);return{x:n.x,y:n.y,z:n.z}}(e.expression.evaluate(t))}interpolate(e,t,i){return{x:ge(e.x,t.x,i),y:ge(e.y,t.y,i),z:ge(e.z,t.z,i)}}}(st.properties_light_directional.direction),color:new At(st.properties_light_directional.color),intensity:new At(st.properties_light_directional.intensity),"cast-shadows":new At(st.properties_light_directional["cast-shadows"]),"shadow-intensity":new At(st.properties_light_directional["shadow-intensity"])});class S_{constructor(t,i,r,n){this.screenBounds=t,this.cameraPoint=i,this._screenRaycastCache={},this._cameraRaycastCache={},this.isAboveHorizon=r,this.screenGeometry=this.bufferedScreenGeometry(0),this.screenGeometryMercator=this._bufferedScreenMercator(0,n)}static createFromScreenPoints(t,i){let r,n;if(t instanceof Q||typeof t[0]=="number"){const s=Q.convert(t);r=[s],n=i.isPointAboveHorizon(s)}else{const s=Q.convert(t[0]),a=Q.convert(t[1]);r=[s,a],n=fr(s,a).every(l=&gt;i.isPointAboveHorizon(l))}return new S_(r,i.getCameraPoint(),n,i)}isPointQuery(){return this.screenBounds.length===1}bufferedScreenGeometry(t){return fr(this.screenBounds[0],this.screenBounds.length===1?this.screenBounds[0]:this.screenBounds[1],t)}bufferedCameraGeometry(t){const i=this.screenBounds[0],r=this.screenBounds.length===1?this.screenBounds[0].add(new Q(1,1)):this.screenBounds[1],n=fr(i,r,0,!1);return this.cameraPoint.y&gt;r.y&amp;&amp;(this.cameraPoint.x&gt;i.x&amp;&amp;this.cameraPoint.x&lt;r.x?n.splice(3,0,this.cameraPoint):this.cameraPoint.x&gt;=r.x?n[2]=this.cameraPoint:this.cameraPoint.x&lt;=i.x&amp;&amp;(n[3]=this.cameraPoint)),function(s,a){const l=[];for(let h=0;h&lt;s.length;h++){const d=Hr(h-1,-1,s.length-1),f=Hr(h+1,-1,s.length-1),m=s[h],_=s[f],y=s[d].sub(m).unit(),x=_.sub(m).unit(),b=x.angleWithSep(y.x,y.y),w=y.add(x).unit().mult(-1*a/Math.sin(b/2));l.push(m.add(w))}return l}(n,t)}bufferedCameraGeometryGlobe(t){const i=this.screenBounds[0],r=this.screenBounds.length===1?this.screenBounds[0].add(new Q(1,1)):this.screenBounds[1],n=fr(i,r,t),s=this.cameraPoint.clone();switch(3*((s.y&gt;i.y)+(s.y&gt;r.y))+((s.x&gt;i.x)+(s.x&gt;r.x))){case 0:n[0]=s,n[4]=s.clone();break;case 1:n.splice(1,0,s);break;case 2:n[1]=s;break;case 3:n.splice(4,0,s);break;case 5:n.splice(2,0,s);break;case 6:n[3]=s;break;case 7:n.splice(3,0,s);break;case 8:n[2]=s}return n}containsTile(t,i,r,n=0){const s=t.queryPadding/i._pixelsPerMercatorPixel+1,a=r?this._bufferedCameraMercator(s,i):this._bufferedScreenMercator(s,i);let l=t.tileID.wrap+(a.unwrapped?n:0);const h=a.polygon.map(w=&gt;_b(t.tileTransform,w,l));if(!p1(h,0,0,ut,ut))return;l=t.tileID.wrap+(this.screenGeometryMercator.unwrapped?n:0);const d=this.screenGeometryMercator.polygon.map(w=&gt;gb(t.tileTransform,w,l)),f=d.map(w=&gt;new Q(w[0],w[1])),m=i.getFreeCameraOptions().position||new Be(0,0,0),_=gb(t.tileTransform,m,l),y=d.map(w=&gt;{const T=W.sub(w,w,_);return W.normalize(T,T),new bh(_,T)}),x=fa(t,1,i.zoom)*i._pixelsPerMercatorPixel;return{queryGeometry:this,tilespaceGeometry:f,tilespaceRays:y,bufferedTilespaceGeometry:h,bufferedTilespaceBounds:(b=es(h),b.min.x=Xt(b.min.x,0,ut),b.min.y=Xt(b.min.y,0,ut),b.max.x=Xt(b.max.x,0,ut),b.max.y=Xt(b.max.y,0,ut),b),tile:t,tileID:t.tileID,pixelToTileUnitsFactor:x};var b}_bufferedScreenMercator(t,i){const r=Fw(t);if(this._screenRaycastCache[r])return this._screenRaycastCache[r];{let n;return n=i.projection.name==="globe"?this._projectAndResample(this.bufferedScreenGeometry(t),i):{polygon:this.bufferedScreenGeometry(t).map(s=&gt;i.pointCoordinate3D(s)),unwrapped:!0},this._screenRaycastCache[r]=n,n}}_bufferedCameraMercator(t,i){const r=Fw(t);if(this._cameraRaycastCache[r])return this._cameraRaycastCache[r];{let n;return n=i.projection.name==="globe"?this._projectAndResample(this.bufferedCameraGeometryGlobe(t),i):{polygon:this.bufferedCameraGeometry(t).map(s=&gt;i.pointCoordinate3D(s)),unwrapped:!0},this._cameraRaycastCache[r]=n,n}}_projectAndResample(t,i){const r=function(s,a){const l=nt.multiply([],a.pixelMatrix,a.globeMatrix),h=[0,-Dr,0,1],d=[0,Dr,0,1],f=[0,0,0,1];oi.transformMat4(h,h,l),oi.transformMat4(d,d,l),oi.transformMat4(f,f,l);const m=new Q(h[0]/h[3],h[1]/h[3]),_=new Q(d[0]/d[3],d[1]/d[3]),y=Io(s,m)&amp;&amp;h[3]&lt;f[3],x=Io(s,_)&amp;&amp;d[3]&lt;f[3];if(!y&amp;&amp;!x)return null;const b=function(D,O,k){for(let z=1;z&lt;D.length;z++){const B=Kc(O.pointCoordinate3D(D[z-1]).x),U=Kc(O.pointCoordinate3D(D[z]).x);if(k&lt;0){if(B&lt;U)return{idx:z,t:-B/(U-1-B)}}else if(U&lt;B)return{idx:z,t:(1-B)/(U+1-B)}}return null}(s,a,y?-1:1);if(!b)return null;const{idx:w,t:T}=b;let S=w&gt;1?A_(s.slice(0,w),a):[],I=w&lt;s.length?A_(s.slice(w),a):[];S=S.map(D=&gt;new Q(Kc(D.x),D.y)),I=I.map(D=&gt;new Q(Kc(D.x),D.y));const P=[...S];P.length===0&amp;&amp;P.push(I[I.length-1]);const M=ge(P[P.length-1].y,(I.length===0?S[0]:I[0]).y,T);let C;return C=y?[new Q(0,M),new Q(0,0),new Q(1,0),new Q(1,M)]:[new Q(1,M),new Q(1,1),new Q(0,1),new Q(0,M)],P.push(...C),I.length===0?P.push(S[0]):P.push(...I),{polygon:P.map(D=&gt;new Be(D.x,D.y)),unwrapped:!1}}(t,i);if(r)return r;const n=function(s,a){let l=!1,h=-1/0,d=0;for(let m=0;m&lt;s.length-1;m++)s[m].x&gt;h&amp;&amp;(h=s[m].x,d=m);for(let m=0;m&lt;s.length-1;m++){const _=(d+m)%(s.length-1),y=s[_],x=s[_+1];Math.abs(y.x-x.x)&gt;.5&amp;&amp;(y.x&lt;x.x?(y.x+=1,_===0&amp;&amp;(s[s.length-1].x+=1)):(x.x+=1,_+1===s.length-1&amp;&amp;(s[0].x+=1)),l=!0)}const f=er(a.center.lng);return l&amp;&amp;f&lt;Math.abs(f-1)&amp;&amp;s.forEach(m=&gt;{m.x-=1}),{polygon:s,unwrapped:l}}(A_(t,i).map(s=&gt;new Q(Kc(s.x),s.y)),i);return{polygon:n.polygon.map(s=&gt;new Be(s.x,s.y)),unwrapped:n.unwrapped}}}function A_(e,t){return l1(e,i=&gt;{const r=t.pointCoordinate3D(i);i.x=r.x,i.y=r.y},1/256)}function Kc(e){return e&lt;0?1+e%1:e%1}function Fw(e){return 100*e|0}function M_(e,t,i,r,n){const s=function(a,l){if(a)return n(a);if(l){e.url&amp;&amp;l.tiles&amp;&amp;e.tiles&amp;&amp;delete e.tiles;const h=nr(Bt(l,e),["tiles","minzoom","maxzoom","attribution","mapbox_logo","bounds","scheme","tileSize","encoding"]);l.vector_layers&amp;&amp;(h.vectorLayers=l.vector_layers,h.vectorLayerIds=h.vectorLayers.map(d=&gt;d.id)),h.tiles=t.canonicalizeTileset(h,e.url),n(null,h)}};return e.url?Rt(t.transformRequest(t.normalizeSourceURL(e.url,null,i,r),pt.Source),s):_e.frame(()=&gt;s(null,e))}class xd{constructor(t,i,r){this.bounds=Qr.convert(this.validateBounds(t)),this.minzoom=i||0,this.maxzoom=r||24}validateBounds(t){return Array.isArray(t)&amp;&amp;t.length===4?[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){const i=Math.pow(2,t.z),r=Math.floor(er(this.bounds.getWest())*i),n=Math.floor(sr(this.bounds.getNorth())*i),s=Math.ceil(er(this.bounds.getEast())*i),a=Math.ceil(sr(this.bounds.getSouth())*i);return t.x&gt;=r&amp;&amp;t.x&lt;s&amp;&amp;t.y&gt;=n&amp;&amp;t.y&lt;a}}class Bw{constructor(t,i){this.width=t,this.height=i,this.nextRow=0,this.image=new Ys({width:t,height:i}),this.positions={},this.uploaded=!1}getDash(t,i){const r=this.getKey(t,i);return this.positions[r]}trim(){const t=this.width,i=this.height=is(this.nextRow);this.image.resize({width:t,height:i})}getKey(t,i){return t.join(",")+i}getDashRanges(t,i,r){const n=[];let s=t.length%2==1?-t[t.length-1]*r:0,a=t[0]*r,l=!0;n.push({left:s,right:a,isDash:l,zeroLength:t[0]===0});let h=t[0];for(let d=1;d&lt;t.length;d++){l=!l;const f=t[d];s=h*r,h+=f,a=h*r,n.push({left:s,right:a,isDash:l,zeroLength:f===0})}return n}addRoundDash(t,i,r){const n=i/2;for(let s=-r;s&lt;=r;s++){const a=this.width*(this.nextRow+r+s);let l=0,h=t[l];for(let d=0;d&lt;this.width;d++){d/h.right&gt;1&amp;&amp;(h=t[++l]);const f=Math.abs(d-h.left),m=Math.abs(d-h.right),_=Math.min(f,m);let y;const x=s/r*(n+1);if(h.isDash){const b=n-Math.abs(x);y=Math.sqrt(_*_+b*b)}else y=n-Math.sqrt(_*_+x*x);this.image.data[a+d]=Math.max(0,Math.min(255,y+128))}}}addRegularDash(t,i){for(let h=t.length-1;h&gt;=0;--h){const d=t[h],f=t[h+1];d.zeroLength?t.splice(h,1):f&amp;&amp;f.isDash===d.isDash&amp;&amp;(f.left=d.left,t.splice(h,1))}const r=t[0],n=t[t.length-1];r.isDash===n.isDash&amp;&amp;(r.left=n.left-this.width,n.right=r.right+this.width);const s=this.width*this.nextRow;let a=0,l=t[a];for(let h=0;h&lt;this.width;h++){h/l.right&gt;1&amp;&amp;(l=t[++a]);const d=Math.abs(h-l.left),f=Math.abs(h-l.right),m=Math.min(d,f);this.image.data[s+h]=Math.max(0,Math.min(255,(l.isDash?m:-m)+i+128))}}addDash(t,i){const r=this.getKey(t,i);if(this.positions[r])return this.positions[r];const n=i==="round",s=n?7:0,a=2*s+1;if(this.nextRow+a&gt;this.height)return tt("LineAtlas out of space"),null;t.length===0&amp;&amp;t.push(1);let l=0;for(let f=0;f&lt;t.length;f++)t[f]&lt;0&amp;&amp;(tt("Negative value is found in line dasharray, replacing values with 0"),t[f]=0),l+=t[f];if(l!==0){const f=this.width/l,m=this.getDashRanges(t,this.width,f);n?this.addRoundDash(m,f,s):this.addRegularDash(m,i==="square"?.5*f:0)}const h=this.nextRow+s;this.nextRow+=a;const d={tl:[h,s],br:[l,0]};return this.positions[r]=d,d}}Jt(Bw,"LineAtlas");const Nw=1*Zn;class Uw{constructor(t){const i={},r=[];for(const l in t){const h=t[l],d=i[l]={};for(const f in h.glyphs){const m=h.glyphs[+f];if(!m||m.bitmap.width===0||m.bitmap.height===0)continue;const _=m.metrics.localGlyph?Nw:1,y={x:0,y:0,w:m.bitmap.width+2*_,h:m.bitmap.height+2*_};r.push(y),d[f]=y}}const{w:n,h:s}=r_(r),a=new Ys({width:n||1,height:s||1});for(const l in t){const h=t[l];for(const d in h.glyphs){const f=h.glyphs[+d];if(!f||f.bitmap.width===0||f.bitmap.height===0)continue;const m=i[l][d],_=f.metrics.localGlyph?Nw:1;Ys.copy(f.bitmap,a,{x:0,y:0},{x:m.x+_,y:m.y+_},f.bitmap)}}this.image=a,this.positions=i}}Jt(Uw,"GlyphAtlas");class LR{constructor(t){this.tileID=new We(t.tileID.overscaledZ,t.tileID.wrap,t.tileID.canonical.z,t.tileID.canonical.x,t.tileID.canonical.y),this.tileZoom=t.tileZoom,this.uid=t.uid,this.zoom=t.zoom,this.canonical=t.tileID.canonical,this.pixelRatio=t.pixelRatio,this.tileSize=t.tileSize,this.source=t.source,this.scope=t.scope,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=t.showCollisionBoxes,this.collectResourceTiming=!!t.collectResourceTiming,this.promoteId=t.promoteId,this.isSymbolTile=t.isSymbolTile,this.tileTransform=da(t.tileID.canonical,t.projection),this.projection=t.projection,this.brightness=t.brightness,this.extraShadowCaster=!!t.extraShadowCaster}parse(t,i,r,n,s){this.status="parsing",this.data=t,this.collisionBoxArray=new sm;const a=new L1(Object.keys(t.layers).sort()),l=new Qm(this.tileID,this.promoteId);l.bucketLayerIDs=[];const h={},d=new Bw(256,256),f={featureIndex:l,iconDependencies:{},patternDependencies:{},glyphDependencies:{},lineAtlas:d,availableImages:r,brightness:this.brightness},m=i.familiesBySource[this.source];for(const S in m){const I=t.layers[S];if(!I)continue;let P=!1,M=!1,C=!1;for(const k of m[S])k[0].type==="symbol"?P=!0:M=!0,k[0].is3D()&amp;&amp;k[0].type!=="model"&amp;&amp;(C=!0);if(this.extraShadowCaster&amp;&amp;!C||this.isSymbolTile===!0&amp;&amp;!P||this.isSymbolTile===!1&amp;&amp;!M)continue;I.version===1&amp;&amp;tt(`Vector tile source "${this.source}" layer "${S}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const D=a.encode(S),O=[];for(let k=0;k&lt;I.length;k++){const z=I.feature(k),B=l.getId(z,S);O.push({feature:z,id:B,index:k,sourceLayerIndex:D})}for(const k of m[S]){const z=k[0];(!this.extraShadowCaster||z.is3D()&amp;&amp;z.type!=="model")&amp;&amp;(this.isSymbolTile!==void 0&amp;&amp;z.type==="symbol"!==this.isSymbolTile||z.minzoom&amp;&amp;this.zoom&lt;Math.floor(z.minzoom)||z.maxzoom&amp;&amp;this.zoom&gt;=z.maxzoom||z.visibility!=="none"&amp;&amp;(I_(k,this.zoom,f.brightness,r),(h[z.id]=z.createBucket({index:l.bucketLayerIDs.length,layers:k,zoom:this.zoom,canonical:this.canonical,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:D,sourceID:this.source,projection:this.projection.spec})).populate(O,f,this.tileID.canonical,this.tileTransform),l.bucketLayerIDs.push(k.map(B=&gt;B.id))))}}let _,y,x,b;d.trim();const w={type:"maybePrepare",isSymbolTile:this.isSymbolTile,zoom:this.zoom},T=()=&gt;{if(_)return this.status="done",s(_);if(this.extraShadowCaster)this.status="done",s(null,{buckets:Ds(h).filter(S=&gt;!S.isEmpty()),featureIndex:l,collisionBoxArray:null,glyphAtlasImage:null,lineAtlas:null,imageAtlas:null,brightness:f.brightness,glyphMap:null,iconMap:null,glyphPositions:null});else if(y&amp;&amp;x&amp;&amp;b){const S=new Uw(y),I=new ab(x,b);for(const P in h){const M=h[P];M instanceof Vc?(I_(M.layers,this.zoom,f.brightness,r),M3(M,y,S.positions,x,I.iconPositions,this.showCollisionBoxes,r,this.tileID.canonical,this.tileZoom,this.projection,this.brightness)):M.hasPattern&amp;&amp;(M instanceof sd||M instanceof zh||M instanceof Xc)&amp;&amp;(I_(M.layers,this.zoom,f.brightness,r),M.addFeatures(f,this.tileID.canonical,I.patternPositions,r,this.tileTransform,this.brightness))}this.status="done",s(null,{buckets:Ds(h).filter(P=&gt;!P.isEmpty()),featureIndex:l,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:S.image,lineAtlas:d,imageAtlas:I,brightness:f.brightness})}};if(!this.extraShadowCaster){const S=Er(f.glyphDependencies,M=&gt;Object.keys(M).map(Number));Object.keys(S).length?n.send("getGlyphs",{uid:this.uid,stacks:S,scope:this.scope},(M,C)=&gt;{_||(_=M,y=C,T())},void 0,!1,w):y={};const I=Object.keys(f.iconDependencies);I.length?n.send("getImages",{icons:I,source:this.source,scope:this.scope,tileID:this.tileID,type:"icons"},(M,C)=&gt;{_||(_=M,x=C,T())},void 0,!1,w):x={};const P=Object.keys(f.patternDependencies);P.length?n.send("getImages",{icons:P,source:this.source,scope:this.scope,tileID:this.tileID,type:"patterns"},(M,C)=&gt;{_||(_=M,b=C,T())},void 0,!1,w):b={}}T()}}function I_(e,t,i,r){const n=new Si(t,{brightness:i});for(const s of e)s.recalculate(n,r)}class Vw{constructor(t){this.entries={},this.scheduler=t}request(t,i,r,n){const s=this.entries[t]=this.entries[t]||{callbacks:[]};if(s.result){const[a,l]=s.result;return this.scheduler?this.scheduler.add(()=&gt;{n(a,l)},i):n(a,l),()=&gt;{}}return s.callbacks.push(n),s.cancel||(s.cancel=r((a,l)=&gt;{s.result=[a,l];for(const h of s.callbacks)this.scheduler?this.scheduler.add(()=&gt;{h(a,l)},i):h(a,l);setTimeout(()=&gt;delete this.entries[t],3e3)})),()=&gt;{s.result||(s.callbacks=s.callbacks.filter(a=&gt;a!==n),s.callbacks.length||(s.cancel(),delete this.entries[t]))}}}function jw(e,t,i){const r=JSON.stringify(e.request);return e.data&amp;&amp;(this.deduped.entries[r]={result:[null,e.data]}),this.deduped.request(r,{type:"parseTile",isSymbolTile:e.isSymbolTile,zoom:e.tileZoom},n=&gt;{const s=zt(e.request,(a,l,h,d)=&gt;{a?n(a):l&amp;&amp;n(null,{vectorTile:i?void 0:new Km(new jh(l)),rawData:l,cacheControl:h,expires:d})});return()=&gt;{s.cancel(),n()}},t)}class Gw extends Zi{constructor(t,i,r,n){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,Bt(this,nr(i,["url","scheme","tileSize","promoteId"])),this._options=Bt({type:"vector"},i),this._collectResourceTiming=!!i.collectResourceTiming,this.tileSize!==512)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(n),this._tileWorkers={},this._deduped=new Vw}load(t){this._loaded=!1,this.fire(new It("dataloading",{dataType:"source"}));const i=Array.isArray(this.map._language)?this.map._language.join():this.map._language,r=this.map._worldview;this._tileJSONRequest=M_(this._options,this.map._requestManager,i,r,(n,s)=&gt;{this._tileJSONRequest=null,this._loaded=!0,n?(i&amp;&amp;console.warn(`Ensure that your requested language string is a valid BCP-47 code or list of codes. Found: ${i}`),r&amp;&amp;r.length!==2&amp;&amp;console.warn(`Requested worldview strings must be a valid ISO alpha-2 code. Found: ${r}`),this.fire(new xe(n))):s&amp;&amp;(Bt(this,s),s.bounds&amp;&amp;(this.tileBounds=new xd(s.bounds,this.minzoom,this.maxzoom)),Yl(s.tiles,this.map._requestManager._customAccessToken),this.fire(new It("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new It("data",{dataType:"source",sourceDataType:"content"}))),t&amp;&amp;t(n)})}loaded(){return this._loaded}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}onAdd(t){this.map=t,this.load()}reload(){this.cancelTileJSONRequest();const t=Mr(this.id,this.scope);this.load(()=&gt;this.map.style.clearSource(t))}setTiles(t){return this._options.tiles=t,this.reload(),this}setUrl(t){return this.url=t,this._options.url=t,this.reload(),this}onRemove(){this.cancelTileJSONRequest()}serialize(){return Bt({},this._options)}loadTile(t,i){const r=this.map._requestManager.normalizeTileURL(t.tileID.canonical.url(this.tiles,this.scheme)),n={request:this.map._requestManager.transformRequest(r,pt.Tile),data:void 0,uid:t.uid,tileID:t.tileID,tileZoom:t.tileZoom,zoom:t.tileID.overscaledZ,tileSize:this.tileSize*t.tileID.overscaleFactor(),type:this.type,source:this.id,scope:this.scope,pixelRatio:_e.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,isSymbolTile:t.isSymbolTile,brightness:this.map.style&amp;&amp;this.map.style.getBrightness()||0,extraShadowCaster:t.isExtraShadowCaster};if(n.request.collectResourceTiming=this._collectResourceTiming,t.actor&amp;&amp;t.state!=="expired")t.state==="loading"?t.reloadCallback=i:t.request=t.actor.send("reloadTile",n,s.bind(this));else if(t.actor=this._tileWorkers[r]=this._tileWorkers[r]||this.dispatcher.getActor(),this.dispatcher.ready)t.request=t.actor.send("loadTile",n,s.bind(this),void 0,!0);else{const a=jw.call({deduped:this._deduped},n,(l,h)=&gt;{l||!h?s.call(this,l):(n.data={cacheControl:h.cacheControl,expires:h.expires,rawData:h.rawData.slice(0)},t.actor&amp;&amp;t.actor.send("loadTile",n,s.bind(this),void 0,!0))},!0);t.request={cancel:a}}function s(a,l){return delete t.request,t.aborted?i(null):a&amp;&amp;a.status!==404?i(a):(l&amp;&amp;l.resourceTiming&amp;&amp;(t.resourceTiming=l.resourceTiming),this.map._refreshExpiredTiles&amp;&amp;l&amp;&amp;t.setExpiryData(l),t.loadVectorData(l,this.map.painter),ns(this.dispatcher),i(null),void(t.reloadCallback&amp;&amp;(this.loadTile(t,t.reloadCallback),t.reloadCallback=null)))}}abortTile(t){t.request&amp;&amp;(t.request.cancel(),delete t.request),t.actor&amp;&amp;t.actor.send("abortTile",{uid:t.uid,type:this.type,source:this.id,scope:this.scope})}unloadTile(t){t.actor&amp;&amp;t.actor.send("removeTile",{uid:t.uid,type:this.type,source:this.id,scope:this.scope}),t.destroy()}hasTransition(){return!1}afterUpdate(){this._tileWorkers={}}cancelTileJSONRequest(){this._tileJSONRequest&amp;&amp;(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}}class P_ extends Zi{constructor(t,i,r,n){super(),this.id=t,this.dispatcher=r,this.setEventedParent(n),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=Bt({type:"raster"},i),Bt(this,nr(i,["url","scheme","tileSize"]))}load(t){this._loaded=!1,this.fire(new It("dataloading",{dataType:"source"})),this._tileJSONRequest=M_(this._options,this.map._requestManager,null,null,(i,r)=&gt;{this._tileJSONRequest=null,this._loaded=!0,i?this.fire(new xe(i)):r&amp;&amp;(Bt(this,r),r.bounds&amp;&amp;(this.tileBounds=new xd(r.bounds,this.minzoom,this.maxzoom)),Yl(r.tiles),this.fire(new It("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new It("data",{dataType:"source",sourceDataType:"content"}))),t&amp;&amp;t(i)})}loaded(){return this._loaded}onAdd(t){this.map=t,this.load()}reload(){this.cancelTileJSONRequest();const t=Mr(this.id,this.scope);this.load(()=&gt;this.map.style.clearSource(t))}setTiles(t){return this._options.tiles=t,this.reload(),this}setUrl(t){return this.url=t,this._options.url=t,this.reload(),this}onRemove(){this.cancelTileJSONRequest()}serialize(){return Bt({},this._options)}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}loadTile(t,i){const r=_e.devicePixelRatio&gt;=2,n=this.map._requestManager.normalizeTileURL(t.tileID.canonical.url(this.tiles,this.scheme),r,this.tileSize);t.request=Te(this.map._requestManager.transformRequest(n,pt.Tile),(s,a,l,h)=&gt;(delete t.request,t.aborted?(t.state="unloaded",i(null)):s?(t.state="errored",i(s)):a?(this.map._refreshExpiredTiles&amp;&amp;t.setExpiryData({cacheControl:l,expires:h}),t.setTexture(a,this.map.painter),t.state="loaded",ns(this.dispatcher),void i(null)):i(null)))}abortTile(t,i){t.request&amp;&amp;(t.request.cancel(),delete t.request),i()}unloadTile(t,i){t.texture&amp;&amp;t.texture instanceof Ii?(t.destroy(!0),t.texture&amp;&amp;t.texture instanceof Ii&amp;&amp;this.map.painter.saveTileTexture(t.texture)):t.destroy(),i()}hasTransition(){return!1}cancelTileJSONRequest(){this._tileJSONRequest&amp;&amp;(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}}function RR(){return jd.workerClass!=null?new jd.workerClass:new L.Worker(jd.workerUrl)}const C_="mapboxgl_preloaded_worker_pool";class wl{constructor(){this.active={}}acquire(t){if(!this.workers)for(this.workers=[];this.workers.length&lt;wl.workerCount;)this.workers.push(new RR);return this.active[t]=!0,this.workers.slice()}release(t){delete this.active[t],this.workers&amp;&amp;this.numActive()===0&amp;&amp;(this.workers.forEach(i=&gt;{i.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[C_]}numActive(){return Object.keys(this.active).length}}let Jc;function Qc(){return Jc||(Jc=new wl),Jc}wl.workerCount=2;let vd,L_,Yn,R_=null;function Hw(){return Et()&amp;&amp;self.worker&amp;&amp;self.worker.dracoUrl?self.worker.dracoUrl:L_||H.DRACO_URL}const D_=5123,O_=5126,k_={5120:Int8Array,5121:Uint8Array,5122:Int16Array,[D_]:Uint16Array,5125:Uint32Array,[O_]:Float32Array},DR={5120:"DT_INT8",5121:"DT_UINT8",5122:"DT_INT16",[D_]:"DT_UINT16",5125:"DT_UINT32",[O_]:"DT_FLOAT32"},z_={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16};function Ww(e,t,i){const r=i.json.bufferViews.length,n=i.buffers.length;t.bufferView=r,i.json.bufferViews[r]={buffer:n,byteLength:e.byteLength},i.buffers[n]=e}const F_="KHR_draco_mesh_compression";function OR(e,t){const i=e.extensions&amp;&amp;e.extensions[F_];if(!i)return;const r=new Yn.Decoder,n=Xw(t,i.bufferView),s=new Yn.Mesh;if(!r.DecodeArrayToMesh(n,n.byteLength,s))throw new Error("Failed to decode Draco mesh");const a=t.json.accessors[e.indices],l=k_[a.componentType],h=a.count*l.BYTES_PER_ELEMENT,d=Yn._malloc(h);l===Uint16Array?r.GetTrianglesUInt16Array(s,h,d):r.GetTrianglesUInt32Array(s,h,d),Ww(Yn.memory.buffer.slice(d,d+h),a,t),Yn._free(d);for(const f of Object.keys(i.attributes)){const m=r.GetAttributeByUniqueId(s,i.attributes[f]),_=t.json.accessors[e.attributes[f]],y=DR[_.componentType],x=_.count*z_[_.type]*k_[_.componentType].BYTES_PER_ELEMENT,b=Yn._malloc(x);r.GetAttributeDataArrayForAllPoints(s,m,Yn[y],x,b),Ww(Yn.memory.buffer.slice(b,b+x),_,t),Yn._free(b)}r.destroy(),s.destroy(),delete e.extensions[F_]}const qw=1179937895,Zw=new TextDecoder("utf8");function $w(e,t){return new URL(e,t).href}function kR(e,t,i,r){return fetch($w(e.uri,r)).then(n=&gt;n.arrayBuffer()).then(n=&gt;{t.buffers[i]=n})}function Xw(e,t){const i=e.json.bufferViews[t];return new Uint8Array(e.buffers[i.buffer],i.byteOffset||0,i.byteLength)}function zR(e,t,i,r){if(e.uri){const n=$w(e.uri,r);return fetch(n).then(s=&gt;s.blob()).then(s=&gt;L.createImageBitmap(s)).then(s=&gt;{t.images[i]=s})}if(e.bufferView!==void 0){const n=Xw(t,e.bufferView),s=new L.Blob([n],{type:e.mimeType});return L.createImageBitmap(s).then(a=&gt;{t.images[i]=a})}}function Yw(e,t=0,i){const r={json:null,images:[],buffers:[]};if(new Uint32Array(e,t,1)[0]===qw){const d=new Uint32Array(e,t);let f=2;const m=(d[f++]&gt;&gt;2)-3,_=d[f++]&gt;&gt;2;if(f++,r.json=JSON.parse(Zw.decode(d.subarray(f,f+_))),f+=_,f&lt;m){const y=d[f++];f++;const x=t+(f&lt;&lt;2);r.buffers[0]=e.slice(x,x+y)}}else r.json=JSON.parse(Zw.decode(new Uint8Array(e,t)));const{buffers:n,images:s,meshes:a,extensionsUsed:l}=r.json;let h=Promise.resolve();if(n){const d=[];for(let f=0;f&lt;n.length;f++){const m=n[f];m.uri?d.push(kR(m,r,f,i)):r.buffers[f]||(r.buffers[f]=null)}h=Promise.all(d)}return h.then(()=&gt;{const d=[],f=l&amp;&amp;l.includes(F_);if(f&amp;&amp;d.push(function(){if(!Yn)return vd||(vd=function(m){let _,y=null;function x(){_=new Uint8Array(y.buffer)}function b(){throw new Error("Unexpected Draco error.")}const w={a:{a:b,d:function(T,S,I){return _.copyWithin(T,S,S+I)},c:function(T){const S=_.length,I=Math.max(T&gt;&gt;&gt;0,Math.ceil(1.2*S)),P=Math.ceil((I-S)/65536);try{return y.grow(P),x(),!0}catch{return!1}},b}};return(WebAssembly.instantiateStreaming?WebAssembly.instantiateStreaming(m,w):m.then(T=&gt;T.arrayBuffer()).then(T=&gt;WebAssembly.instantiate(T,w))).then(T=&gt;{const{Rb:S,Qb:I,P,T:M,X:C,Ja:D,La:O,Qa:k,Va:z,Wa:B,eb:U,jb:Z,f:F,e:Y,yb:J,zb:it,Ab:X,Bb:K,Db:ot,Gb:lt}=T.instance.exports;y=Y;const at=(()=&gt;{let dt=0,ft=0,_t=0,ct=0;return bt=&gt;{_t&amp;&amp;(S(ct),S(dt),ft+=_t,_t=dt=0),dt||(ft+=128,dt=I(ft));const Ot=bt.length+7&amp;-8;let kt=dt;Ot&gt;=ft&amp;&amp;(_t=Ot,kt=ct=I(Ot));for(let Ht=0;Ht&lt;bt.length;Ht++)_[kt+Ht]=bt[Ht];return kt}})();return x(),F(),{memory:Y,_free:S,_malloc:I,Mesh:class{constructor(){this.ptr=P()}destroy(){M(this.ptr)}},Decoder:class{constructor(){this.ptr=D()}destroy(){Z(this.ptr)}DecodeArrayToMesh(dt,ft,_t){const ct=at(dt),bt=O(this.ptr,ct,ft,_t.ptr);return!!C(bt)}GetAttributeByUniqueId(dt,ft){return{ptr:k(this.ptr,dt.ptr,ft)}}GetTrianglesUInt16Array(dt,ft,_t){z(this.ptr,dt.ptr,ft,_t)}GetTrianglesUInt32Array(dt,ft,_t){B(this.ptr,dt.ptr,ft,_t)}GetAttributeDataArrayForAllPoints(dt,ft,_t,ct,bt){U(this.ptr,dt.ptr,ft.ptr,_t,ct,bt)}},DT_INT8:J(),DT_UINT8:it(),DT_INT16:X(),DT_UINT16:K(),DT_UINT32:ot(),DT_FLOAT32:lt()}})}(fetch(Hw())),vd.then(m=&gt;{Yn=m,vd=void 0}))}()),s)for(let m=0;m&lt;s.length;m++)d.push(zR(s[m],r,m,i));return(d.length?Promise.all(d):Promise.resolve()).then(()=&gt;{if(f&amp;&amp;a)for(const{primitives:m}of a)for(const _ of m)OR(_,r);return r})})}function Kw(e){return fetch(e).then(t=&gt;t.arrayBuffer()).then(t=&gt;Yw(t,0,e))}class Jw{constructor(t,i,r){if(this.triangleCount=i.length/3,this.min=new Q(0,0),this.max=new Q(0,0),this.xScale=0,this.yScale=0,this.cellsX=0,this.cellsY=0,this.cells=[],this.payload=[],this.triangleCount===0||t.length===0||r===0)return;const n=t.map(f=&gt;f.x),s=t.map(f=&gt;f.y);this.min=new Q(Math.min(...n),Math.min(...s)),this.max=new Q(Math.max(...n),Math.max(...s));const a=this.max.sub(this.min);a.x=Math.max(a.x,1),a.y=Math.max(a.y,1);const l=Math.max(a.x,a.y)/r;this.cellsX=Math.max(1,Math.ceil(a.x/l)),this.cellsY=Math.max(1,Math.ceil(a.y/l)),this.xScale=1/l,this.yScale=1/l;const h=[];for(let f=0;f&lt;this.triangleCount;f++){const m=t[i[3*f+0]].sub(this.min),_=t[i[3*f+1]].sub(this.min),y=t[i[3*f+2]].sub(this.min),x=Fo(Math.floor(Math.min(m.x,_.x,y.x)),this.xScale,this.cellsX),b=Fo(Math.floor(Math.max(m.x,_.x,y.x)),this.xScale,this.cellsX),w=Fo(Math.floor(Math.min(m.y,_.y,y.y)),this.yScale,this.cellsY),T=Fo(Math.floor(Math.max(m.y,_.y,y.y)),this.yScale,this.cellsY),S=new Q(0,0),I=new Q(0,0),P=new Q(0,0),M=new Q(0,0);for(let C=w;C&lt;=T;++C){S.y=I.y=C*l,P.y=M.y=(C+1)*l;for(let D=x;D&lt;=b;++D)S.x=P.x=D*l,I.x=M.x=(D+1)*l,(jm(m,_,y,S,I,M)||jm(m,_,y,S,M,P))&amp;&amp;h.push({cellIdx:C*this.cellsX+D,triIdx:f})}}if(h.length===0)return;h.sort((f,m)=&gt;f.cellIdx-m.cellIdx||f.triIdx-m.triIdx);let d=0;for(;d&lt;h.length;){const f=h[d].cellIdx,m={start:this.payload.length,len:0};for(;d&lt;h.length&amp;&amp;h[d].cellIdx===f;)++m.len,this.payload.push(h[d++].triIdx);this.cells[f]=m}}query(t,i,r){if(this.triangleCount===0||this.cells.length===0||t.x&gt;this.max.x||this.min.x&gt;i.x||t.y&gt;this.max.y||this.min.y&gt;i.y)return;this.lookup||(this.lookup=new Uint8Array(Math.ceil(this.triangleCount/8)));for(let h=0;h&lt;this.lookup.length;h++)this.lookup[h]=0;const n=Fo(t.x-this.min.x,this.xScale,this.cellsX),s=Fo(i.x-this.min.x,this.xScale,this.cellsX),a=Fo(t.y-this.min.y,this.yScale,this.cellsY),l=Fo(i.y-this.min.y,this.yScale,this.cellsY);for(let h=a;h&lt;=l;h++)for(let d=n;d&lt;=s;d++){const f=this.cells[h*this.cellsX+d];if(f)for(let m=0;m&lt;f.len;m++){const _=this.payload[f.start+m],y=Math.floor(_/8),x=1&lt;&lt;_%8;if(!(this.lookup[y]&amp;x)&amp;&amp;(this.lookup[y]|=x,r.push(_),r.length===this.triangleCount))return}}}}function Fo(e,t,i){return Math.max(0,Math.min(i-1,Math.floor(e*t)))}function ya(e,t){const i=e.json.bufferViews[t.bufferView];return new k_[t.componentType](e.buffers[i.buffer],(t.byteOffset||0)+(i.byteOffset||0),t.count*z_[t.type])}function FR(e,t,i){const r=e.indices,n=e.attributes,s={};s.indexArray=new Xi;const a=t.json.accessors[r],l=a.count/3;s.indexArray.reserve(l);const h=ya(t,a);for(let _=0;_&lt;l;_++)s.indexArray.emplaceBack(h[3*_],h[3*_+1],h[3*_+2]);s.indexArray._trim(),s.vertexArray=new aa;const d=t.json.accessors[n.POSITION];s.vertexArray.reserve(d.count);const f=ya(t,d);for(let _=0;_&lt;d.count;_++)s.vertexArray.emplaceBack(f[3*_],f[3*_+1],f[3*_+2]);if(s.vertexArray._trim(),s.aabb=new mi(d.min,d.max),s.centroid=function(_,y){const x=[0,0,0],b=_.length;if(b&gt;0){for(let w=0;w&lt;b;w++){const T=3*_[w];x[0]+=y[T],x[1]+=y[T+1],x[2]+=y[T+2]}x[0]/=b,x[1]/=b,x[2]/=b}return x}(h,f),n.COLOR_0!==void 0){const _=t.json.accessors[n.COLOR_0],y=z_[_.type];if(_.componentType===O_){s.colorArray=y===3?new aa:new Vs,s.colorArray.reserve(_.count);const x=ya(t,_);if(y===3)for(let b=0;b&lt;_.count;b++)s.colorArray.emplaceBack(x[3*b],x[3*b+1],x[3*b+2]);else for(let b=0;b&lt;_.count;b++)s.colorArray.emplaceBack(x[4*b],x[4*b+1],x[4*b+2],x[4*b+3]);s.colorArray._trim()}else if(_.componentType===D_&amp;&amp;y===4){s.colorArray=new Vs,s.colorArray.resize(_.count);const x=ya(t,_),b=1/65535,w=s.colorArray.float32;for(let T=0;T&lt;4*x.length;++T)w[T]=x[T]*b}else tt(`glTF color buffer parsing for accessor ${JSON.stringify(_)} is not supported`)}if(n.NORMAL!==void 0){s.normalArray=new aa;const _=t.json.accessors[n.NORMAL];s.normalArray.reserve(_.count);const y=ya(t,_);for(let x=0;x&lt;_.count;x++)s.normalArray.emplaceBack(y[3*x],y[3*x+1],y[3*x+2]);s.normalArray._trim()}if(n.TEXCOORD_0!==void 0&amp;&amp;i.length&gt;0){s.texcoordArray=new bc;const _=t.json.accessors[n.TEXCOORD_0];s.texcoordArray.reserve(_.count);const y=ya(t,_);for(let x=0;x&lt;_.count;x++)s.texcoordArray.emplaceBack(y[2*x],y[2*x+1]);s.texcoordArray._trim()}const m=e.material;return s.material=function(_,y){const{emissiveFactor:x=[0,0,0],alphaMode:b="OPAQUE",alphaCutoff:w=.5,normalTexture:T,occlusionTexture:S,emissiveTexture:I,doubleSided:P}=_,{baseColorFactor:M=[1,1,1,1],metallicFactor:C=1,roughnessFactor:D=1,baseColorTexture:O,metallicRoughnessTexture:k}=_.pbrMetallicRoughness||{};return{pbrMetallicRoughness:{baseColorFactor:new Ie(...M),metallicFactor:C,roughnessFactor:D,baseColorTexture:O?y[O.index]:void 0,metallicRoughnessTexture:k?y[k.index]:void 0},doubleSided:P,emissiveFactor:x,alphaMode:b,alphaCutoff:w,normalTexture:T?y[T.index]:void 0,occlusionTexture:S?y[S.index]:void 0,emissionTexture:I?y[I.index]:void 0,defined:_.defined===void 0}}(m!==void 0?t.json.materials[m]:{defined:!1},i),n._FEATURE_RGBA4444!==void 0&amp;&amp;(s.featureData=new Uint32Array(ya(t,t.json.accessors[n._FEATURE_RGBA4444]).buffer)),s}function Qw(e,t,i){const{matrix:r,rotation:n,translation:s,scale:a,mesh:l,extras:h,children:d}=e,f={};if(f.matrix=r||nt.fromRotationTranslationScale([],n||[0,0,0,1],s||[0,0,0],a||[1,1,1]),l!==void 0){f.meshes=i[l];const m=f.anchor=[0,0];for(const _ of f.meshes){const{min:y,max:x}=_.aabb;m[0]+=y[0]+x[0],m[1]+=y[1]+x[1]}m[0]=Math.floor(m[0]/f.meshes.length/2),m[1]=Math.floor(m[1]/f.meshes.length/2)}if(h&amp;&amp;(h.id&amp;&amp;(f.id=h.id),h.lights&amp;&amp;(f.lights=function(m){if(!m.length)return[];const _=function(T){const S=atob(T),I=new Uint8Array(S.length);for(let P=0;P&lt;S.length;P++)I[P]=S.codePointAt(P);return I}(m),y=[],x=_.length/24,b=new Uint16Array(_.buffer),w=new Float32Array(_.buffer);for(let T=0;T&lt;x;T++){const S=b[2*T*6]/30,I=b[2*T*6+1]/30,P=b[2*T*6+10]/100,M=w[6*T+1],C=w[6*T+2],D=w[6*T+3],O=w[6*T+4],k=D-M,z=O-C,B=Math.hypot(k,z);y.push({pos:[M+.5*k,C+.5*z,I],normal:[z/B,-k/B,0],width:B,height:S,depth:P,points:[M,C,D,O]})}return y}(h.lights))),d){const m=[];for(const _ of d)m.push(Qw(t.json.nodes[_],t,i));f.children=m}return f}function BR(e){if(e.vertices.length===0||e.indices.length===0)return null;const[t,i]=[e.vertices[0].clone(),e.vertices[0].clone()];for(let a=1;a&lt;e.vertices.length;++a){const l=e.vertices[a];t.x=Math.min(t.x,l.x),t.y=Math.min(t.y,l.y),i.x=Math.max(i.x,l.x),i.y=Math.max(i.y,l.y)}const r=Math.ceil(Math.max(i.x-t.x,i.y-t.y)/256),n=Math.max(8,r),s=new Jw(e.vertices,e.indices,n);return{vertices:e.vertices,indices:e.indices,grid:s,min:t,max:i}}function NR(e){if(!e.extras||!e.extras.ground)return null;const t=e.extras.ground;if(!t||!Array.isArray(t)||t.length===0)return null;const i=t[0];if(!i||!Array.isArray(i)||i.length===0)return null;const r=[];for(const a of i){if(!Array.isArray(a)||a.length!==2)continue;const l=a[0],h=a[1];typeof l=="number"&amp;&amp;typeof h=="number"&amp;&amp;r.push(new Q(l,h))}if(r.length&lt;3)return null;r.length&gt;1&amp;&amp;r[r.length-1].equals(r[0])&amp;&amp;r.pop();let n=0;for(let a=0;a&lt;r.length;a++){const l=r[a],h=r[(a+1)%r.length],d=r[(a+2)%r.length];n+=(l.x-h.x)*(d.y-h.y)-(d.x-h.x)*(l.y-h.y)}n&gt;0&amp;&amp;r.reverse();const s=kh(r.flatMap(a=&gt;[a.x,a.y]),[]);return s.length===0?null:{vertices:r,indices:s}}function UR(e){const t=[],i=[];let r=0;for(const n of e){r=t.length;const s=n.vertexArray.float32,a=n.indexArray.uint16;for(let l=0;l&lt;n.vertexArray.length;l++)t.push(new Q(s[3*l+0],s[3*l+1]));for(let l=0;l&lt;3*n.indexArray.length;l++)i.push(a[l]+r)}if(i.length%3!=0)return null;for(let n=0;n&lt;i.length;n+=3){const s=t[i[n+0]],a=t[i[n+1]],l=t[i[n+2]];(s.x-a.x)*(l.y-a.y)-(l.x-a.x)*(s.y-a.y)&gt;0&amp;&amp;([i[n+1],i[n+2]]=[i[n+2],i[n+1]])}return{vertices:t,indices:i}}function B_(e){const t=function(h,d){const f=[],m=L.WebGL2RenderingContext;if(h.json.textures)for(const _ of h.json.textures){const y={magFilter:m.LINEAR,minFilter:m.NEAREST,wrapS:m.REPEAT,wrapT:m.REPEAT};_.sampler!==void 0&amp;&amp;Object.assign(y,h.json.samplers[_.sampler]),f.push({image:d[_.source],sampler:y,uploaded:!1})}return f}(e,e.images),i=function(h,d){const f=[];for(const m of h.json.meshes){const _=[];for(const y of m.primitives)_.push(FR(y,h,d));f.push(_)}return f}(e,t),{scenes:r,scene:n,nodes:s}=e.json,a=r?r[n||0].nodes:s,l=[];for(const h of a)l.push(Qw(s[h],e,i));return function(h,d,f){const m={},_=new Set;for(let y=0;y&lt;h.length;y++){const x=f[d[y]];if(!x.extras)continue;const b=x.extras["mapbox:footprint:version"],w=x.extras["mapbox:footprint:id"];(b||w)&amp;&amp;_.add(y),b==="1.0.0"&amp;&amp;w&amp;&amp;(m[w]=y)}for(let y=0;y&lt;h.length;y++){if(_.has(y))continue;const x=h[y],b=f[d[y]];if(!b.extras)continue;let w=null;x.id in m&amp;&amp;(w=UR(h[m[x.id]].meshes)),w||(w=NR(b)),w&amp;&amp;(x.footprint=BR(w))}if(_.size&gt;0){const y=Array.from(_.values()).sort((x,b)=&gt;x-b);for(let x=y.length-1;x&gt;=0;x--)h.splice(y[x],1)}}(l,a,e.json.nodes),l}function VR(e){e.heightmap=new Float32Array(4096),e.heightmap.fill(-1);const t=e.vertexArray.float32,i=e.aabb.min[0]-1,r=e.aabb.min[1]-1,n=pa/(e.aabb.max[0]-i+2),s=pa/(e.aabb.max[1]-r+2);for(let a=0;a&lt;t.length;a+=3){const l=t[a+2],h=(t[a+0]-i)*n|0,d=(t[a+1]-r)*s|0;l&gt;e.heightmap[d*pa+h]&amp;&amp;(e.heightmap[d*pa+h]=l)}}function jR(e,t){const i={};i.indexArray=new Xi,i.indexArray.reserve(4*e.length),i.vertexArray=new aa,i.vertexArray.reserve(10*e.length),i.colorArray=new Vs,i.vertexArray.reserve(10*e.length);let r=0;for(const a of e){const l=Math.min(10,Math.max(4,1.3*a.height))*t,h=[-a.normal[1],a.normal[0],0],d=Math.min(.29,.1*a.width/a.depth),f=a.width-2*a.depth*t*(d+.01),m=W.scaleAndAdd([],a.pos,h,f/2),_=W.scaleAndAdd([],a.pos,h,-f/2),y=[m[0],m[1],m[2]+a.height],x=[_[0],_[1],_[2]+a.height],b=W.scaleAndAdd([],a.normal,h,d);W.scale(b,b,l);const w=W.scaleAndAdd([],a.normal,h,-d);W.scale(w,w,l),W.add(b,m,b),W.add(w,_,w),m[2]+=.1,_[2]+=.1,i.vertexArray.emplaceBack(b[0],b[1],b[2]),i.vertexArray.emplaceBack(w[0],w[1],w[2]),i.vertexArray.emplaceBack(m[0],m[1],m[2]),i.vertexArray.emplaceBack(_[0],_[1],_[2]),i.vertexArray.emplaceBack(y[0],y[1],y[2]),i.vertexArray.emplaceBack(x[0],x[1],x[2]),i.vertexArray.emplaceBack(m[0],m[1],m[2]),i.vertexArray.emplaceBack(_[0],_[1],_[2]),i.vertexArray.emplaceBack(b[0],b[1],b[2]),i.vertexArray.emplaceBack(w[0],w[1],w[2]);const T=f/l/2;i.colorArray.emplaceBack(-T-d,-1,T,.8),i.colorArray.emplaceBack(T+d,-1,T,.8),i.colorArray.emplaceBack(-T,0,T,1.3),i.colorArray.emplaceBack(T,0,T,1.3),i.colorArray.emplaceBack(T+d,-.8,T,.7),i.colorArray.emplaceBack(T+d,-.8,T,.7),i.colorArray.emplaceBack(0,0,T,1.3),i.colorArray.emplaceBack(0,0,T,1.3),i.colorArray.emplaceBack(T+d,-1.2,T,.8),i.colorArray.emplaceBack(T+d,-1.2,T,.8),i.indexArray.emplaceBack(6+r,4+r,8+r),i.indexArray.emplaceBack(7+r,9+r,5+r),i.indexArray.emplaceBack(0+r,1+r,2+r),i.indexArray.emplaceBack(1+r,3+r,2+r),r+=10}const n={defined:!0,emissiveFactor:[0,0,0]},s={};return s.baseColorFactor=Ie.white,n.pbrMetallicRoughness=s,i.material=n,i.aabb=new mi([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),i}Jt(Jw,"TriangleGridIndex");const N_={vector:Gw,raster:P_,"raster-dem":class extends P_{constructor(e,t,i,r){super(e,t,i,r),this.type="raster-dem",this.maxzoom=22,this._options=Bt({type:"raster-dem"},t),this.encoding=t.encoding||"mapbox"}loadTile(e,t){const i=this.map._requestManager.normalizeTileURL(e.tileID.canonical.url(this.tiles,this.scheme),!1,this.tileSize);function r(n,s){n&amp;&amp;(e.state="errored",t(n)),s&amp;&amp;(e.dem=s,e.dem.onDeserialize(),e.needsHillshadePrepare=!0,e.needsDEMTextureUpload=!0,e.state="loaded",t(null))}e.request=Te(this.map._requestManager.transformRequest(i,pt.Tile),(function(n,s,a,l){if(delete e.request,e.aborted)e.state="unloaded",t(null);else if(n)e.state="errored",t(n);else if(s){this.map._refreshExpiredTiles&amp;&amp;e.setExpiryData({cacheControl:a,expires:l});const d=L.ImageBitmap&amp;&amp;s instanceof L.ImageBitmap&amp;&amp;Jl(),f=1-(s.width-((h=s.width)&lt;=1?1:Math.pow(2,Math.floor(Math.log(h)/Math.LN2))))/2;f&lt;1||e.neighboringTiles||(e.neighboringTiles=this._getNeighboringTiles(e.tileID));const m=d?s:_e.getImageData(s,f),_={uid:e.uid,coord:e.tileID,source:this.id,scope:this.scope,rawImageData:m,encoding:this.encoding,padding:f};e.actor&amp;&amp;e.state!=="expired"||(e.actor=this.dispatcher.getActor(),e.actor.send("loadDEMTile",_,r.bind(this),void 0,!0))}var h}).bind(this))}_getNeighboringTiles(e){const t=e.canonical,i=Math.pow(2,t.z),r=(t.x-1+i)%i,n=t.x===0?e.wrap-1:e.wrap,s=(t.x+1+i)%i,a=t.x+1===i?e.wrap+1:e.wrap,l={};return l[new We(e.overscaledZ,n,t.z,r,t.y).key]={backfilled:!1},l[new We(e.overscaledZ,a,t.z,s,t.y).key]={backfilled:!1},t.y&gt;0&amp;&amp;(l[new We(e.overscaledZ,n,t.z,r,t.y-1).key]={backfilled:!1},l[new We(e.overscaledZ,e.wrap,t.z,t.x,t.y-1).key]={backfilled:!1},l[new We(e.overscaledZ,a,t.z,s,t.y-1).key]={backfilled:!1}),t.y+1&lt;i&amp;&amp;(l[new We(e.overscaledZ,n,t.z,r,t.y+1).key]={backfilled:!1},l[new We(e.overscaledZ,e.wrap,t.z,t.x,t.y+1).key]={backfilled:!1},l[new We(e.overscaledZ,a,t.z,s,t.y+1).key]={backfilled:!1}),l}},geojson:class extends Zi{constructor(e,t,i,r){super(),this.id=e,this.type="geojson",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._loaded=!1,this.actor=i.getActor(),this.setEventedParent(r),this._data=t.data,this._options=Bt({},t),this._collectResourceTiming=t.collectResourceTiming,t.maxzoom!==void 0&amp;&amp;(this.maxzoom=t.maxzoom),t.type&amp;&amp;(this.type=t.type),t.attribution&amp;&amp;(this.attribution=t.attribution),this.promoteId=t.promoteId;const n=ut/this.tileSize;this.workerOptions=Bt({source:this.id,scope:this.scope,cluster:t.cluster||!1,geojsonVtOptions:{buffer:(t.buffer!==void 0?t.buffer:128)*n,tolerance:(t.tolerance!==void 0?t.tolerance:.375)*n,extent:ut,maxZoom:this.maxzoom,lineMetrics:t.lineMetrics||!1,generateId:t.generateId||!1},superclusterOptions:{maxZoom:t.clusterMaxZoom!==void 0?t.clusterMaxZoom:this.maxzoom-1,minPoints:Math.max(2,t.clusterMinPoints||2),extent:ut,radius:(t.clusterRadius!==void 0?t.clusterRadius:50)*n,log:!1,generateId:t.generateId||!1},clusterProperties:t.clusterProperties,filter:t.filter},t.workerOptions)}onAdd(e){this.map=e,this.setData(this._data)}setData(e){return this._data=e,this._updateWorkerData(),this}getClusterExpansionZoom(e,t){return this.actor.send("geojson.getClusterExpansionZoom",{clusterId:e,source:this.id,scope:this.scope},t),this}getClusterChildren(e,t){return this.actor.send("geojson.getClusterChildren",{clusterId:e,source:this.id,scope:this.scope},t),this}getClusterLeaves(e,t,i,r){return this.actor.send("geojson.getClusterLeaves",{source:this.id,scope:this.scope,clusterId:e,limit:t,offset:i},r),this}_updateWorkerData(){if(this._pendingLoad)return void(this._coalesce=!0);this.fire(new It("dataloading",{dataType:"source"})),this._loaded=!1;const e=Bt({},this.workerOptions);e.scope=this.scope;const t=this._data;typeof t=="string"?(e.request=this.map._requestManager.transformRequest(_e.resolveURL(t),pt.Source),e.request.collectResourceTiming=this._collectResourceTiming):e.data=JSON.stringify(t),this._pendingLoad=this.actor.send(`${this.type}.loadData`,e,(i,r)=&gt;{if(this._loaded=!0,this._pendingLoad=null,i)this.fire(new xe(i));else{const n={dataType:"source",sourceDataType:this._metadataFired?"content":"metadata"};this._collectResourceTiming&amp;&amp;r&amp;&amp;r.resourceTiming&amp;&amp;r.resourceTiming[this.id]&amp;&amp;(n.resourceTiming=r.resourceTiming[this.id]),this.fire(new It("data",n)),this._metadataFired=!0}this._coalesce&amp;&amp;(this._updateWorkerData(),this._coalesce=!1)})}loaded(){return this._loaded}loadTile(e,t){const i=e.actor?"reloadTile":"loadTile";e.actor=this.actor;const r={type:this.type,uid:e.uid,tileID:e.tileID,tileZoom:e.tileZoom,zoom:e.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,scope:this.scope,pixelRatio:_e.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,brightness:this.map.style&amp;&amp;this.map.style.getBrightness()||0};e.request=this.actor.send(i,r,(n,s)=&gt;(delete e.request,e.destroy(),e.aborted?t(null):n?t(n):(e.loadVectorData(s,this.map.painter,i==="reloadTile"),t(null))),void 0,i==="loadTile")}abortTile(e){e.request&amp;&amp;(e.request.cancel(),delete e.request),e.aborted=!0}unloadTile(e){this.actor.send("removeTile",{uid:e.uid,type:this.type,source:this.id,scope:this.scope}),e.destroy()}onRemove(){this._pendingLoad&amp;&amp;this._pendingLoad.cancel()}serialize(){return Bt({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}},video:class extends Rn{constructor(e,t,i,r){super(e,t,i,r),this.roundZoom=!0,this.type="video",this.options=t}load(){this._loaded=!1;const e=this.options;this.urls=[];for(const t of e.urls)this.urls.push(this.map._requestManager.transformRequest(t,pt.Source).url);(function(t,i){const r=L.document.createElement("video");r.muted=!0,r.onloadstart=function(){i(null,r)};for(let n=0;n&lt;t.length;n++){const s=L.document.createElement("source");Ut(t[n])||(r.crossOrigin="Anonymous"),s.src=t[n],r.appendChild(s)}})(this.urls,(t,i)=&gt;{this._loaded=!0,t?this.fire(new xe(t)):i&amp;&amp;(this.video=i,this.video.loop=!0,this.video.setAttribute("playsinline",""),this.video.addEventListener("playing",()=&gt;{this.map.triggerRepaint()}),this.map&amp;&amp;this.video.play(),this._finishLoading())})}pause(){this.video&amp;&amp;this.video.pause()}play(){this.video&amp;&amp;this.video.play()}seek(e){if(this.video){const t=this.video.seekable;e&lt;t.start(0)||e&gt;t.end(0)?this.fire(new xe(new Yt(`sources.${this.id}`,null,`Playback for this video can be set only between the ${t.start(0)} and ${t.end(0)}-second mark.`))):this.video.currentTime=e}}getVideo(){return this.video}onAdd(e){this.map||(this.map=e,this.load(),this.video&amp;&amp;(this.video.play(),this.setCoordinates(this.coordinates)))}prepare(){if(Object.keys(this.tiles).length===0||this.video.readyState&lt;2)return;const e=this.map.painter.context,t=e.gl;this.texture?this.video.paused||(this.texture.bind(t.LINEAR,t.CLAMP_TO_EDGE),t.texSubImage2D(t.TEXTURE_2D,0,0,0,t.RGBA,t.UNSIGNED_BYTE,this.video)):(this.texture=new Ii(e,this.video,t.RGBA),this.texture.bind(t.LINEAR,t.CLAMP_TO_EDGE),this.width=this.video.videoWidth,this.height=this.video.videoHeight),this._prepareData(e)}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&amp;&amp;!this.video.paused}},image:Rn,model:class extends Zi{constructor(e,t,i,r){super(),this.id=e,this.type="model",this.models=[],this._loaded=!1,this._options=t}load(){const e=[];for(const t in this._options.models){const i=this._options.models[t],r=Kw(this.map._requestManager.transformRequest(i.uri,pt.Model).url).then(n=&gt;{if(!n)return;const s=B_(n),a=new Zb(t,i.position,i.orientation,s);a.computeBoundsAndApplyParent(),this.models.push(a)}).catch(n=&gt;{this.fire(new xe(new Error(`Could not load model ${t} from ${i.uri}: ${n.message}`)))});e.push(r)}return Promise.allSettled(e).then(()=&gt;{this._loaded=!0,this.fire(new It("data",{dataType:"source",sourceDataType:"metadata"}))}).catch(t=&gt;{this.fire(new xe(new Error(`Could not load models: ${t.message}`)))})}onAdd(e){this.map=e,this.load()}hasTransition(){return!1}loaded(){return this._loaded}getModels(){return this.models}loadTile(e,t){}serialize(){return{type:"model"}}},"batched-model":class extends Zi{constructor(e,t,i,r){super(),this.type="batched-model",this.id=e,this.tileSize=512,this._options=t,this.tiles=this._options.tiles,this.maxzoom=t.maxzoom||19,this.minzoom=t.minzoom||0,this.roundZoom=!0,this.usedInConflation=!0,this.dispatcher=i,this.reparseOverscaled=!1,this.scheme="xyz",this._loaded=!1,this.setEventedParent(r)}onAdd(e){this.map=e,this.load()}load(e){this._loaded=!1,this.fire(new It("dataloading",{dataType:"source"}));const t=Array.isArray(this.map._language)?this.map._language.join():this.map._language,i=this.map._worldview;this._tileJSONRequest=M_(this._options,this.map._requestManager,t,i,(r,n)=&gt;{this._tileJSONRequest=null,this._loaded=!0,r?(t&amp;&amp;console.warn(`Ensure that your requested language string is a valid BCP-47 code or list of codes. Found: ${t}`),i&amp;&amp;i.length!==2&amp;&amp;console.warn(`Requested worldview strings must be a valid ISO alpha-2 code. Found: ${i}`),this.fire(new xe(r))):n&amp;&amp;(Bt(this,n),n.bounds&amp;&amp;(this.tileBounds=new xd(n.bounds,this.minzoom,this.maxzoom)),Yl(n.tiles,this.map._requestManager._customAccessToken),this.fire(new It("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new It("data",{dataType:"source",sourceDataType:"content"}))),e&amp;&amp;e(r)})}hasTransition(){return!1}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}loaded(){return this._loaded}loadTile(e,t){const i=this.map._requestManager.normalizeTileURL(e.tileID.canonical.url(this.tiles,this.scheme)),r={request:this.map._requestManager.transformRequest(i,pt.Tile),data:void 0,uid:e.uid,tileID:e.tileID,tileZoom:e.tileZoom,zoom:e.tileID.overscaledZ,tileSize:this.tileSize*e.tileID.overscaleFactor(),type:this.type,source:this.id,scope:this.scope,showCollisionBoxes:this.map.showCollisionBoxes,isSymbolTile:e.isSymbolTile,brightness:this.map.style&amp;&amp;this.map.style.getBrightness()||0};if(e.actor&amp;&amp;e.state!=="expired")if(e.state==="loading")e.reloadCallback=t;else{if(e.buckets){const s=Object.values(e.buckets);for(const a of s)a.dirty=!0;return void(e.state="loaded")}e.request=e.actor.send("reloadTile",r,n.bind(this))}else e.actor=this.dispatcher.getActor(),e.request=e.actor.send("loadTile",r,n.bind(this),void 0,!0);function n(s,a){return e.aborted?t(null):s&amp;&amp;s.status!==404?t(s):(a&amp;&amp;(a.resourceTiming&amp;&amp;(e.resourceTiming=a.resourceTiming),this.map._refreshExpiredTiles&amp;&amp;e.setExpiryData(a),e.buckets={...e.buckets,...a.buckets}),e.state="loaded",void t(null))}}serialize(){return Bt({},this._options)}},canvas:class extends Rn{constructor(e,t,i,r){super(e,t,i,r),t.coordinates?Array.isArray(t.coordinates)&amp;&amp;t.coordinates.length===4&amp;&amp;!t.coordinates.some(n=&gt;!Array.isArray(n)||n.length!==2||n.some(s=&gt;typeof s!="number"))||this.fire(new xe(new Yt(`sources.${e}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new xe(new Yt(`sources.${e}`,null,'missing required property "coordinates"'))),t.animate&amp;&amp;typeof t.animate!="boolean"&amp;&amp;this.fire(new xe(new Yt(`sources.${e}`,null,'optional "animate" property must be a boolean value'))),t.canvas?typeof t.canvas=="string"||t.canvas instanceof L.HTMLCanvasElement||this.fire(new xe(new Yt(`sources.${e}`,null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new xe(new Yt(`sources.${e}`,null,'missing required property "canvas"'))),this.options=t,this.animate=t.animate===void 0||t.animate}load(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof L.HTMLCanvasElement?this.options.canvas:L.document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new xe(new Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&amp;&amp;(this.prepare(),this._playing=!1)},this._finishLoading())}getCanvas(){return this.canvas}onAdd(e){this.map=e,this.load(),this.canvas&amp;&amp;this.animate&amp;&amp;this.play()}onRemove(){this.pause()}prepare(){let e=!1;if(this.canvas.width!==this.width&amp;&amp;(this.width=this.canvas.width,e=!0),this.canvas.height!==this.height&amp;&amp;(this.height=this.canvas.height,e=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;const t=this.map.painter.context;this.texture?!e&amp;&amp;!this._playing||this.texture instanceof od||this.texture.update(this.canvas,{premultiply:!0}):this.texture=new Ii(t,this.canvas,t.gl.RGBA,{premultiply:!0}),this._prepareData(t)}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const e of[this.canvas.width,this.canvas.height])if(isNaN(e)||e&lt;=0)return!0;return!1}},custom:class extends Zi{constructor(e,t,i,r){super(),this.id=e,this.type="custom",this._dataType="raster",this._dispatcher=i,this._implementation=t,this.setEventedParent(r),this.scheme="xyz",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this._loaded=!1,this.roundZoom=!0,this._implementation||this.fire(new xe(new Error(`Missing implementation for ${this.id} custom source`))),this._implementation.loadTile||this.fire(new xe(new Error(`Missing loadTile implementation for ${this.id} custom source`))),this._implementation.bounds&amp;&amp;(this.tileBounds=new xd(this._implementation.bounds,this.minzoom,this.maxzoom)),t.update=this._update.bind(this),t.clearTiles=this._clearTiles.bind(this),t.coveringTiles=this._coveringTiles.bind(this),Bt(this,nr(t,["dataType","scheme","minzoom","maxzoom","tileSize","attribution","minTileCacheSize","maxTileCacheSize"]))}serialize(){return nr(this,["type","scheme","minzoom","maxzoom","tileSize","attribution"])}load(){this._loaded=!0,this.fire(new It("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new It("data",{dataType:"source",sourceDataType:"content"}))}loaded(){return this._loaded}onAdd(e){this._map=e,this._loaded=!1,this.fire(new It("dataloading",{dataType:"source"})),this._implementation.onAdd&amp;&amp;this._implementation.onAdd(e),this.load()}onRemove(e){this._implementation.onRemove&amp;&amp;this._implementation.onRemove(e)}hasTile(e){if(this._implementation.hasTile){const{x:t,y:i,z:r}=e.canonical;return this._implementation.hasTile({x:t,y:i,z:r})}return!this.tileBounds||this.tileBounds.contains(e.canonical)}loadTile(e,t){const{x:i,y:r,z:n}=e.tileID.canonical,s=new L.AbortController;e.request=Promise.resolve(this._implementation.loadTile({x:i,y:r,z:n},{signal:s.signal})).then((function(a){return delete e.request,e.aborted?(e.state="unloaded",t(null)):a===void 0?(e.state="errored",t(null)):a===null?(this.loadTileData(e,{width:this.tileSize,height:this.tileSize,data:null}),e.state="loaded",t(null)):function(l){return l instanceof L.ImageData||l instanceof L.HTMLCanvasElement||l instanceof L.ImageBitmap||l instanceof L.HTMLImageElement}(a)?(this.loadTileData(e,a),e.state="loaded",void t(null)):(e.state="errored",t(new Error(`Can't infer data type for ${this.id}, only raster data supported at the moment`)))}).bind(this)).catch(a=&gt;{a.code!==20&amp;&amp;(e.state="errored",t(a))}),e.request.cancel=()=&gt;s.abort()}loadTileData(e,t){e.setTexture(t,this._map.painter)}unloadTile(e,t){if(e.texture&amp;&amp;e.texture instanceof Ii?(e.destroy(!0),e.texture&amp;&amp;e.texture instanceof Ii&amp;&amp;this._map.painter.saveTileTexture(e.texture)):e.destroy(),this._implementation.unloadTile){const{x:i,y:r,z:n}=e.tileID.canonical;this._implementation.unloadTile({x:i,y:r,z:n})}t()}abortTile(e,t){e.request&amp;&amp;e.request.cancel&amp;&amp;(e.request.cancel(),delete e.request),t()}hasTransition(){return!1}_coveringTiles(){return this._map.transform.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,roundZoom:this.roundZoom}).map(e=&gt;({x:e.canonical.x,y:e.canonical.y,z:e.canonical.z}))}_clearTiles(){const e=Mr(this.id,this.scope);this._map.style.clearSource(e)}_update(){this.fire(new It("data",{dataType:"source",sourceDataType:"content"}))}}},U_=function(e,t,i,r){const n=new N_[t.type](e,t,i,r);if(n.id!==e)throw new Error(`Expected Source id to be ${e} instead of ${n.id}`);return Oi(["load","abort","unload","serialize","prepare"],n),n};function GR(e,t){const i=nt.identity([]);return nt.scale(i,i,[.5*e.width,.5*-e.height,1]),nt.translate(i,i,[1,-1,0]),nt.multiply(i,i,e.calculateProjMatrix(t.toUnwrapped())),Float32Array.from(i)}function HR(e,t,i,r,n,s,a,l=!1){const h=e.tilesIn(r,a,l);h.sort(tT);const d=[];for(const m of h)d.push({wrappedTileID:m.tile.tileID.wrapped().key,queryResults:m.tile.queryRenderedFeatures(t,i,e._state,m,n,s,GR(e.transform,m.tile.tileID),l)});const f=function(m){const _={},y={};for(const x of m){const b=x.queryResults,w=x.wrappedTileID,T=y[w]=y[w]||{};for(const S in b){const I=b[S],P=T[S]=T[S]||{},M=_[S]=_[S]||[];for(const C of I)P[C.featureIndex]||(P[C.featureIndex]=!0,M.push(C))}}return _}(d);for(const m in f)f[m].forEach(_=&gt;{const y=_.feature,x=y.layer;x&amp;&amp;x.type!=="background"&amp;&amp;x.type!=="sky"&amp;&amp;x.type!=="slot"&amp;&amp;(y.source=x.source,x["source-layer"]&amp;&amp;(y.sourceLayer=x["source-layer"]),y.state=y.id!==void 0?e.getFeatureState(x["source-layer"],y.id):{})});return f}function WR(e,t){const i=e.getRenderableIds().map(s=&gt;e.getTileByID(s)),r=[],n={};for(let s=0;s&lt;i.length;s++){const a=i[s],l=a.tileID.canonical.key;n[l]||(n[l]=!0,a.querySourceFeatures(r,t))}return r}function tT(e,t){const i=e.tileID,r=t.tileID;return i.overscaledZ-r.overscaledZ||i.canonical.y-r.canonical.y||i.wrap-r.wrap||i.canonical.x-r.canonical.x}class qR{constructor(t){this.style=t}processLayersChanged(){this.layers=[];for(const t in this.style._mergedLayers){const i=this.style._mergedLayers[t];if(i.type==="fill-extrusion")this.layers.push(i);else if(i.type==="model"){const r=this.style.getLayerSource(i);r&amp;&amp;r.type==="batched-model"&amp;&amp;this.layers.push(i)}}}updateZOffset(t,i){this.currentBuildingBuckets=[];for(let n=0;n&lt;this.layers.length;++n){const s=this.layers[n],a=this.style.getLayerSourceCache(s);let l=1;s.type==="fill-extrusion"&amp;&amp;(l=s.paint.get("fill-extrusion-opacity")&gt;0?s.paint.get("fill-extrusion-vertical-scale"):0);let h=a?a.getTile(i):null;if(!h&amp;&amp;a&amp;&amp;i.canonical.z&gt;a.getSource().minzoom){let d=i.scaledTo(Math.min(a.getSource().maxzoom,i.overscaledZ-1));for(;d.overscaledZ&gt;=a.getSource().minzoom&amp;&amp;(h=a.getTile(d),!h&amp;&amp;d.overscaledZ!==0);)d=d.scaledTo(d.overscaledZ-1)}this.currentBuildingBuckets.push({bucket:h?h.getBucket(s):null,tileID:h?h.tileID:i,verticalScale:l})}t.hasAnyZOffset=!1;let r=!1;for(let n=0;n&lt;t.symbolInstances.length;n++){const s=t.symbolInstances.get(n),a=s.zOffset,l=this._getHeightAtTileOffset(i,s.tileAnchorX,s.tileAnchorY);s.zOffset=l!==-1?l:a,r||a===s.zOffset||(r=!0),t.hasAnyZOffset||s.zOffset===0||(t.hasAnyZOffset=!0)}r&amp;&amp;(t.zOffsetBuffersNeedUpload=!0,t.zOffsetSortDirty=!0)}_mapCoordToOverlappingTile(t,i,r,n){let s=i,a=r;if(t.canonical.z!==n.canonical.z){const l=n.canonical,h=1/(1&lt;&lt;t.canonical.z-l.z);s=(i+t.canonical.x*ut)*h-l.x*ut|0,a=(r+t.canonical.y*ut)*h-l.y*ut|0}return{tileX:s,tileY:a}}_getHeightAtTileOffset(t,i,r){let n;for(let s=0;s&lt;this.layers.length;++s){if(this.layers[s].type!=="fill-extrusion")continue;const{bucket:a,tileID:l,verticalScale:h}=this.currentBuildingBuckets[s];if(!a)continue;const{tileX:d,tileY:f}=this._mapCoordToOverlappingTile(t,i,r,l),m=a.getHeightAtTileCoord(d,f);if(m&amp;&amp;m.height!==void 0){if(!m.hidden)return m.height*h;n=m.height}}for(let s=0;s&lt;this.layers.length;++s){if(this.layers[s].type!=="model")continue;const{bucket:a,tileID:l}=this.currentBuildingBuckets[s];if(!a)continue;const{tileX:h,tileY:d}=this._mapCoordToOverlappingTile(t,i,r,l),f=a.getHeightAtTileCoord(h,d);if(f&amp;&amp;!f.hidden)return f.height===void 0&amp;&amp;n!==void 0?Math.min(f.maxHeight,n)*f.verticalScale:(f.height||0)*f.verticalScale}return-1}}var eT=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function ZR(e,t){const i={};for(const r in e)r!=="ref"&amp;&amp;(i[r]=e[r]);return eT.forEach(r=&gt;{r in t&amp;&amp;(i[r]=t[r])}),i}function iT(e){e=e.slice();const t=Object.create(null);for(let i=0;i&lt;e.length;i++)t[e[i].id]=e[i];for(let i=0;i&lt;e.length;i++)"ref"in e[i]&amp;&amp;(e[i]=ZR(e[i],t[e[i].ref]));return e}const Xe={setStyle:"setStyle",addLayer:"addLayer",removeLayer:"removeLayer",setPaintProperty:"setPaintProperty",setLayoutProperty:"setLayoutProperty",setSlot:"setSlot",setFilter:"setFilter",addSource:"addSource",removeSource:"removeSource",setGeoJSONSourceData:"setGeoJSONSourceData",setLayerZoomRange:"setLayerZoomRange",setLayerProperty:"setLayerProperty",setCenter:"setCenter",setZoom:"setZoom",setBearing:"setBearing",setPitch:"setPitch",setSprite:"setSprite",setGlyphs:"setGlyphs",setTransition:"setTransition",setLight:"setLight",setTerrain:"setTerrain",setFog:"setFog",setCamera:"setCamera",setLights:"setLights",setProjection:"setProjection",addImport:"addImport",removeImport:"removeImport",setImportUrl:"setImportUrl",setImportData:"setImportData",setImportConfig:"setImportConfig"};function rT(e,t,i){i.push({command:Xe.addSource,args:[e,t[e]]})}function nT(e,t,i){t.push({command:Xe.removeSource,args:[e]}),i[e]=!0}function $R(e,t,i,r){nT(e,i,r),rT(e,t,i)}function XR(e,t,i){let r;for(r in e[i])if(e[i].hasOwnProperty(r)&amp;&amp;r!=="data"&amp;&amp;!Lt(e[i][r],t[i][r]))return!1;for(r in t[i])if(t[i].hasOwnProperty(r)&amp;&amp;r!=="data"&amp;&amp;!Lt(e[i][r],t[i][r]))return!1;return!0}function bd(e,t,i,r,n,s){let a;for(a in t=t||{},e=e||{})e.hasOwnProperty(a)&amp;&amp;(Lt(e[a],t[a])||i.push({command:s,args:[r,a,t[a],n]}));for(a in t)t.hasOwnProperty(a)&amp;&amp;!e.hasOwnProperty(a)&amp;&amp;(Lt(e[a],t[a])||i.push({command:s,args:[r,a,t[a],n]}))}function wd(e){return e.id}function Td(e,t){return e[t.id]=t,e}class YR{constructor(t,i){this.reset(t,i)}reset(t,i){this.points=t||[],this._distances=[0];for(let r=1;r&lt;this.points.length;r++)this._distances[r]=this._distances[r-1]+this.points[r].dist(this.points[r-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(this.points.length===1)return this.points[0];t=Xt(t,0,1);let i=1,r=this._distances[i];const n=t*this.paddedLength+this.padding;for(;r&lt;n&amp;&amp;i&lt;this._distances.length;)r=this._distances[++i];const s=i-1,a=this._distances[s],l=r-a,h=l&gt;0?(n-a)/l:0;return this.points[s].mult(1-h).add(this.points[i].mult(h))}}class sT{constructor(t,i,r){const n=this.boxCells=[],s=this.circleCells=[];this.xCellCount=Math.ceil(t/r),this.yCellCount=Math.ceil(i/r);for(let a=0;a&lt;this.xCellCount*this.yCellCount;a++)n.push([]),s.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,n,s){this._forEachCell(i,r,n,s,this._insertBoxCell,this.boxUid++),this.boxKeys.push(t),this.bboxes.push(i),this.bboxes.push(r),this.bboxes.push(n),this.bboxes.push(s)}insertCircle(t,i,r,n){this._forEachCell(i-n,r-n,i+n,r+n,this._insertCircleCell,this.circleUid++),this.circleKeys.push(t),this.circles.push(i),this.circles.push(r),this.circles.push(n)}_insertBoxCell(t,i,r,n,s,a){this.boxCells[s].push(a)}_insertCircleCell(t,i,r,n,s,a){this.circleCells[s].push(a)}_query(t,i,r,n,s,a){if(r&lt;0||t&gt;this.width||n&lt;0||i&gt;this.height)return!s&amp;&amp;[];const l=[];if(t&lt;=0&amp;&amp;i&lt;=0&amp;&amp;this.width&lt;=r&amp;&amp;this.height&lt;=n){if(s)return!0;for(let h=0;h&lt;this.boxKeys.length;h++)l.push({key:this.boxKeys[h],x1:this.bboxes[4*h],y1:this.bboxes[4*h+1],x2:this.bboxes[4*h+2],y2:this.bboxes[4*h+3]});for(let h=0;h&lt;this.circleKeys.length;h++){const d=this.circles[3*h],f=this.circles[3*h+1],m=this.circles[3*h+2];l.push({key:this.circleKeys[h],x1:d-m,y1:f-m,x2:d+m,y2:f+m})}return a?l.filter(a):l}return this._forEachCell(t,i,r,n,this._queryCell,l,{hitTest:s,seenUids:{box:{},circle:{}}},a),s?l.length&gt;0:l}_queryCircle(t,i,r,n,s){const a=t-r,l=t+r,h=i-r,d=i+r;if(l&lt;0||a&gt;this.width||d&lt;0||h&gt;this.height)return!n&amp;&amp;[];const f=[];return this._forEachCell(a,h,l,d,this._queryCellCircle,f,{hitTest:n,circle:{x:t,y:i,radius:r},seenUids:{box:{},circle:{}}},s),n?f.length&gt;0:f}query(t,i,r,n,s){return this._query(t,i,r,n,!1,s)}hitTest(t,i,r,n,s){return this._query(t,i,r,n,!0,s)}hitTestCircle(t,i,r,n){return this._queryCircle(t,i,r,!0,n)}_queryCell(t,i,r,n,s,a,l,h){const d=l.seenUids,f=this.boxCells[s];if(f!==null){const _=this.bboxes;for(const y of f)if(!d.box[y]){d.box[y]=!0;const x=4*y;if(t&lt;=_[x+2]&amp;&amp;i&lt;=_[x+3]&amp;&amp;r&gt;=_[x+0]&amp;&amp;n&gt;=_[x+1]&amp;&amp;(!h||h(this.boxKeys[y]))){if(l.hitTest)return a.push(!0),!0;a.push({key:this.boxKeys[y],x1:_[x],y1:_[x+1],x2:_[x+2],y2:_[x+3]})}}}const m=this.circleCells[s];if(m!==null){const _=this.circles;for(const y of m)if(!d.circle[y]){d.circle[y]=!0;const x=3*y;if(this._circleAndRectCollide(_[x],_[x+1],_[x+2],t,i,r,n)&amp;&amp;(!h||h(this.circleKeys[y]))){if(l.hitTest)return a.push(!0),!0;{const b=_[x],w=_[x+1],T=_[x+2];a.push({key:this.circleKeys[y],x1:b-T,y1:w-T,x2:b+T,y2:w+T})}}}}}_queryCellCircle(t,i,r,n,s,a,l,h){const d=l.circle,f=l.seenUids,m=this.boxCells[s];if(m!==null){const y=this.bboxes;for(const x of m)if(!f.box[x]){f.box[x]=!0;const b=4*x;if(this._circleAndRectCollide(d.x,d.y,d.radius,y[b+0],y[b+1],y[b+2],y[b+3])&amp;&amp;(!h||h(this.boxKeys[x])))return a.push(!0),!0}}const _=this.circleCells[s];if(_!==null){const y=this.circles;for(const x of _)if(!f.circle[x]){f.circle[x]=!0;const b=3*x;if(this._circlesCollide(y[b],y[b+1],y[b+2],d.x,d.y,d.radius)&amp;&amp;(!h||h(this.circleKeys[x])))return a.push(!0),!0}}}_forEachCell(t,i,r,n,s,a,l,h){const d=this._convertToXCellCoord(t),f=this._convertToYCellCoord(i),m=this._convertToXCellCoord(r),_=this._convertToYCellCoord(n);for(let y=d;y&lt;=m;y++)for(let x=f;x&lt;=_;x++)if(s.call(this,t,i,r,n,this.xCellCount*x+y,a,l,h))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,n,s,a){const l=n-t,h=s-i,d=r+a;return d*d&gt;l*l+h*h}_circleAndRectCollide(t,i,r,n,s,a,l){const h=(a-n)/2,d=Math.abs(t-(n+h));if(d&gt;h+r)return!1;const f=(l-s)/2,m=Math.abs(i-(s+f));if(m&gt;f+r)return!1;if(d&lt;=h||m&lt;=f)return!0;const _=d-h,y=m-f;return _*_+y*y&lt;=r*r}}const ys=100;class KR{constructor(t,i,r=new sT(t.width+200,t.height+200,25),n=new sT(t.width+200,t.height+200,25)){this.transform=t,this.grid=r,this.ignoredGrid=n,this.pitchfactor=Math.cos(t._pitch)*t.cameraToCenterDistance,this.screenRightBoundary=t.width+ys,this.screenBottomBoundary=t.height+ys,this.gridRightBoundary=t.width+200,this.gridBottomBoundary=t.height+200,this.fogState=i}placeCollisionBox(t,i,r,n,s,a,l,h){let d=r.projectedAnchorX,f=r.projectedAnchorY,m=r.projectedAnchorZ;const _=r.elevation,y=r.tileID,x=t.getProjection();if(_&amp;&amp;y){const[C,D,O]=x.upVector(y.canonical,r.tileAnchorX,r.tileAnchorY),k=x.upVectorScale(y.canonical,this.transform.center.lat,this.transform.worldSize).metersToTile;d+=C*_*k,f+=D*_*k,m+=O*_*k}const b=this.projectAndGetPerspectiveRatio(l,d,f,m,r.tileID,x.name==="globe"||!!_||this.transform.pitch&gt;0,x),w=a*b.perspectiveRatio,T=(r.x1*i+n.x-r.padding)*w+b.point.x,S=(r.y1*i+n.y-r.padding)*w+b.point.y,I=(r.x2*i+n.x+r.padding)*w+b.point.x,P=(r.y2*i+n.y+r.padding)*w+b.point.y,M=b.perspectiveRatio&lt;=.55||b.occluded;return!this.isInsideGrid(T,S,I,P)||!s&amp;&amp;this.grid.hitTest(T,S,I,P,h)||M?{box:[],offscreen:!1,occluded:b.occluded}:{box:[T,S,I,P],offscreen:this.isOffscreen(T,S,I,P),occluded:!1}}placeCollisionCircles(t,i,r,n,s,a,l,h,d,f,m,_,y,x,b){const w=[],T=this.transform.elevation,S=t.getProjection(),I=T?T.getAtTileOffsetFunc(b,this.transform.center.lat,this.transform.worldSize,S):null,P=new Q(r.tileAnchorX,r.tileAnchorY);let{x:M,y:C,z:D}=S.projectTilePoint(P.x,P.y,b.canonical);if(I){const[it,X,K]=I(P);M+=it,C+=X,D+=K}const O=S.name==="globe",k=this.projectAndGetPerspectiveRatio(l,M,C,D,b,O||!!T||this.transform.pitch&gt;0,S),{perspectiveRatio:z}=k,B=(m?a/z:a*z)/dr,U=Xn(M,C,D,h),Z=k.signedDistanceFromCamera&gt;0?Fb(B,s,r.lineOffsetX*B,r.lineOffsetY*B,!1,U,P,r,n,h,{},T&amp;&amp;!m?I:null,m&amp;&amp;!!T,S,b,m):null;let F=!1,Y=!1,J=!0;if(Z&amp;&amp;!k.occluded){const it=.5*y*z+x,X=new Q(-100,-100),K=new Q(this.screenRightBoundary,this.screenBottomBoundary),ot=new YR,{first:lt,last:at}=Z,dt=lt.path.length;let ft=[];for(let bt=dt-1;bt&gt;=1;bt--)ft.push(lt.path[bt]);for(let bt=1;bt&lt;at.path.length;bt++)ft.push(at.path[bt]);const _t=2.5*it;d&amp;&amp;(ft=ft.map(([bt,Ot,kt],Ht)=&gt;(I&amp;&amp;!O&amp;&amp;(kt=I(Ht&lt;dt-1?lt.tilePath[dt-1-Ht]:at.tilePath[Ht-dt+2])[2]),Xn(bt,Ot,kt,d))),ft.some(bt=&gt;bt[3]&lt;=0)&amp;&amp;(ft=[]));let ct=[];if(ft.length&gt;0){let bt=1/0,Ot=-1/0,kt=1/0,Ht=-1/0;for(const Zt of ft)bt=Math.min(bt,Zt[0]),kt=Math.min(kt,Zt[1]),Ot=Math.max(Ot,Zt[0]),Ht=Math.max(Ht,Zt[1]);Ot&gt;=X.x&amp;&amp;bt&lt;=K.x&amp;&amp;Ht&gt;=X.y&amp;&amp;kt&lt;=K.y&amp;&amp;(ct=[ft.map(Zt=&gt;new Q(Zt[0],Zt[1]))],(bt&lt;X.x||Ot&gt;K.x||kt&lt;X.y||Ht&gt;K.y)&amp;&amp;(ct=ob(ct,X.x,X.y,K.x,K.y)))}for(const bt of ct){ot.reset(bt,.25*it);let Ot=0;Ot=ot.length&lt;=.5*it?1:Math.ceil(ot.paddedLength/_t)+1;for(let kt=0;kt&lt;Ot;kt++){const Ht=kt/Math.max(Ot-1,1),Zt=ot.lerp(Ht),fe=Zt.x+ys,ie=Zt.y+ys;w.push(fe,ie,it,0);const Ve=fe-it,ke=ie-it,pe=fe+it,ue=ie+it;if(J=J&amp;&amp;this.isOffscreen(Ve,ke,pe,ue),Y=Y||this.isInsideGrid(Ve,ke,pe,ue),!i&amp;&amp;this.grid.hitTestCircle(fe,ie,it,_)&amp;&amp;(F=!0,!f))return{circles:[],offscreen:!1,collisionDetected:F,occluded:!1}}}}return{circles:!f&amp;&amp;F||!Y?[]:w,offscreen:J,collisionDetected:F,occluded:k.occluded}}queryRenderedSymbols(t){if(t.length===0||this.grid.keysLength()===0&amp;&amp;this.ignoredGrid.keysLength()===0)return{};const i=[];let r=1/0,n=1/0,s=-1/0,a=-1/0;for(const f of t){const m=new Q(f.x+ys,f.y+ys);r=Math.min(r,m.x),n=Math.min(n,m.y),s=Math.max(s,m.x),a=Math.max(a,m.y),i.push(m)}const l=this.grid.query(r,n,s,a).concat(this.ignoredGrid.query(r,n,s,a)),h={},d={};for(const f of l){const m=f.key;h[m.bucketInstanceId]===void 0&amp;&amp;(h[m.bucketInstanceId]={}),h[m.bucketInstanceId][m.featureIndex]||u1(i,[new Q(f.x1,f.y1),new Q(f.x2,f.y1),new Q(f.x2,f.y2),new Q(f.x1,f.y2)])&amp;&amp;(h[m.bucketInstanceId][m.featureIndex]=!0,d[m.bucketInstanceId]===void 0&amp;&amp;(d[m.bucketInstanceId]=[]),d[m.bucketInstanceId].push(m.featureIndex))}return d}insertCollisionBox(t,i,r,n,s){(i?this.ignoredGrid:this.grid).insert({bucketInstanceId:r,featureIndex:n,collisionGroupID:s},t[0],t[1],t[2],t[3])}insertCollisionCircles(t,i,r,n,s){const a=i?this.ignoredGrid:this.grid,l={bucketInstanceId:r,featureIndex:n,collisionGroupID:s};for(let h=0;h&lt;t.length;h+=4)a.insertCircle(l,t[h],t[h+1],t[h+2])}projectAndGetPerspectiveRatio(t,i,r,n,s,a,l){const h=[i,r,n,1];let d=!1;n||this.transform.pitch&gt;0?(oi.transformMat4(h,h,t),this.fogState&amp;&amp;s&amp;&amp;l.name!=="globe"&amp;&amp;(d=function(_,y,x,b,w,T){const S=T.calculateFogTileMatrix(w),I=[y,x,b];return W.transformMat4(I,I,S),yd(_,W.length(I),T.pitch,T._fov)}(this.fogState,i,r,n,s.toUnwrapped(),this.transform)&gt;.9)):jb(h,h,t);const f=h[3];return{point:new Q((h[0]/f+1)/2*this.transform.width+ys,(-h[1]/f+1)/2*this.transform.height+ys),perspectiveRatio:Math.min(.5+this.transform.getCameraToCenterDistance(l)/f*.5,1.5),signedDistanceFromCamera:f,occluded:a&amp;&amp;h[2]&gt;f||d}}isOffscreen(t,i,r,n){return r&lt;ys||t&gt;=this.screenRightBoundary||n&lt;ys||i&gt;this.screenBottomBoundary}isInsideGrid(t,i,r,n){return r&gt;=0&amp;&amp;t&lt;this.gridRightBoundary&amp;&amp;n&gt;=0&amp;&amp;i&lt;this.gridBottomBoundary}getViewportMatrix(){const t=nt.identity([]);return nt.translate(t,t,[-100,-100,0]),t}}function V_(e,t,i){const r=t.createTileMatrix(e,e.worldSize,i.toUnwrapped());return nt.multiply(new Float32Array(16),e.projMatrix,r)}function JR(e,t,i){if(t.projection.name===i.projection.name)return e.projMatrix;const r=i.clone();return r.setProjection(t.projection),V_(r,t.getProjection(),e)}function j_(e,t,i){return t.name===i.projection.name?e.projMatrix:V_(i,t,e)}class oT{constructor(t,i,r,n){this.opacity=t?Math.max(0,Math.min(1,t.opacity+(t.placed?i:-i))):n&amp;&amp;r?1:0,this.placed=r}isHidden(){return this.opacity===0&amp;&amp;!this.placed}}class tu{constructor(t,i,r,n,s,a=!1){this.text=new oT(t?t.text:null,i,r,s),this.icon=new oT(t?t.icon:null,i,n,s),this.clipped=a}isHidden(){return this.text.isHidden()&amp;&amp;this.icon.isHidden()}}class G_{constructor(t,i,r,n=!1){this.text=t,this.icon=i,this.skipFade=r,this.clipped=n}}class QR{constructor(){this.invProjMatrix=nt.create(),this.viewportMatrix=nt.create(),this.circles=[]}}class tD{constructor(t,i,r,n,s){this.bucketInstanceId=t,this.featureIndex=i,this.sourceLayerIndex=r,this.bucketIndex=n,this.tileID=s}}class eD{constructor(t){this.crossSourceCollisions=t,this.maxGroupID=0,this.collisionGroups={}}get(t){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[t]){const i=++this.maxGroupID;this.collisionGroups[t]={ID:i,predicate:r=&gt;r.collisionGroupID===i}}return this.collisionGroups[t]}}function aT(e,t,i,r,n){const{horizontalAlign:s,verticalAlign:a}=Wh(e),l=-(s-.5)*t,h=-(a-.5)*i,d=o_(e,r);return new Q(l+d[0]*n,h+d[1]*n)}function H_(e,t,i,r,n){const s=new Q(e,t);return i&amp;&amp;s._rotate(r?n:-n),s}class iD{constructor(t,i,r,n,s,a){this.transform=t.clone(),this.projection=t.projection.name,this.collisionIndex=new KR(this.transform,s),this.buildingIndex=a,this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=i,this.retainedQueryData={},this.collisionGroups=new eD(r),this.collisionCircleArrays={},this.prevPlacement=n,n&amp;&amp;(n.prevPlacement=void 0),this.placedOrientations={}}getBucketParts(t,i,r,n){const s=r.getBucket(i),a=r.latestFeatureIndex;if(!s||!a||i.fqid!==s.layerIds[0])return;const l=s.layers[0].layout,h=r.collisionBoxArray,d=Math.pow(2,this.transform.zoom-r.tileID.overscaledZ),f=r.tileSize/ut,m=r.tileID.toUnwrapped();this.transform.setProjection(s.projection);const _=(y=r.tileID,x=s.getProjection(),b=this.transform,x.name===this.projection?b.calculateProjMatrix(y.toUnwrapped()):V_(b,x,y));var y,x,b;const w=l.get("text-pitch-alignment")==="map",T=l.get("text-rotation-alignment")==="map";i.compileFilter();const S=i.dynamicFilter(),I=i.dynamicFilterNeedsFeature(),P=this.transform.calculatePixelsToTileUnitsMatrix(r),M=Ob(_,r.tileID.canonical,w,T,this.transform,s.getProjection(),P);let C=null;if(w){const k=kb(_,r.tileID.canonical,w,T,this.transform,s.getProjection(),P);C=nt.multiply([],this.transform.labelPlaneMatrix,k)}let D=null;S&amp;&amp;r.latestFeatureIndex&amp;&amp;(D={unwrappedTileID:m,dynamicFilter:S,dynamicFilterNeedsFeature:I,featureIndex:r.latestFeatureIndex}),this.retainedQueryData[s.bucketInstanceId]=new tD(s.bucketInstanceId,a,s.sourceLayerIndex,s.index,r.tileID);const O={bucket:s,layout:l,posMatrix:_,textLabelPlaneMatrix:M,labelToScreenMatrix:C,clippingData:D,scale:d,textPixelRatio:f,holdingForFade:r.holdingForFade(),collisionBoxArray:h,partiallyEvaluatedTextSize:ps(s.textSizeData,this.transform.zoom),partiallyEvaluatedIconSize:ps(s.iconSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(s.sourceID)};if(n)for(const k of s.sortKeyRanges){const{sortKey:z,symbolInstanceStart:B,symbolInstanceEnd:U}=k;t.push({sortKey:z,symbolInstanceStart:B,symbolInstanceEnd:U,parameters:O})}else t.push({symbolInstanceStart:0,symbolInstanceEnd:s.symbolInstances.length,parameters:O})}attemptAnchorPlacement(t,i,r,n,s,a,l,h,d,f,m,_,y,x,b,w,T,S){const{textOffset0:I,textOffset1:P,crossTileID:M}=_,C=[I,P],D=aT(t,r,n,C,s),O=this.collisionIndex.placeCollisionBox(x,s,i,H_(D.x,D.y,a,l,this.transform.angle),m,h,d,f.predicate);if(w){const k=x.getSymbolInstanceIconSize(S,this.transform.zoom,_.placedIconSymbolIndex);if(this.collisionIndex.placeCollisionBox(x,k,w,H_(D.x,D.y,a,l,this.transform.angle),m,h,d,f.predicate).box.length===0)return}if(O.box.length&gt;0){let k;return this.prevPlacement&amp;&amp;this.prevPlacement.variableOffsets[M]&amp;&amp;this.prevPlacement.placements[M]&amp;&amp;this.prevPlacement.placements[M].text&amp;&amp;(k=this.prevPlacement.variableOffsets[M].anchor),this.variableOffsets[M]={textOffset:C,width:r,height:n,anchor:t,textScale:s,prevAnchor:k},this.markUsedJustification(x,t,_,b),x.allowVerticalPlacement&amp;&amp;(this.markUsedOrientation(x,b,_),this.placedOrientations[M]=b),{shift:D,placedGlyphBoxes:O}}}placeLayerBucketPart(t,i,r,n){const{bucket:s,layout:a,posMatrix:l,textLabelPlaneMatrix:h,labelToScreenMatrix:d,clippingData:f,textPixelRatio:m,holdingForFade:_,collisionBoxArray:y,partiallyEvaluatedTextSize:x,partiallyEvaluatedIconSize:b,collisionGroup:w}=t.parameters,T=a.get("text-optional"),S=a.get("icon-optional"),I=a.get("text-allow-overlap"),P=a.get("icon-allow-overlap"),M=a.get("text-rotation-alignment")==="map",C=a.get("text-pitch-alignment")==="map",D=a.get("symbol-z-order")==="viewport-y",O=a.get("symbol-z-elevate");this.transform.setProjection(s.projection);let k=I&amp;&amp;(P||!s.hasIconData()||S),z=P&amp;&amp;(I||!s.hasTextData()||T);!s.collisionArrays&amp;&amp;y&amp;&amp;s.deserializeCollisionBoxes(y),r&amp;&amp;n&amp;&amp;s.updateCollisionDebugBuffers(this.transform.zoom,y);const B=(U,Z,F)=&gt;{const{crossTileID:Y,numVerticalGlyphVertices:J}=U;if(f){const pe={zoom:this.transform.zoom,pitch:this.transform.pitch};let ue=null;if(f.dynamicFilterNeedsFeature){const re=this.retainedQueryData[s.bucketInstanceId];ue=f.featureIndex.loadFeature({featureIndex:U.featureIndex,bucketIndex:re.bucketIndex,sourceLayerIndex:re.sourceLayerIndex,layoutVertexArrayOffset:0})}if(!(0,f.dynamicFilter)(pe,ue,this.retainedQueryData[s.bucketInstanceId].tileID.canonical,new Q(U.tileAnchorX,U.tileAnchorY),this.transform.calculateDistanceTileData(f.unwrappedTileID)))return this.placements[Y]=new G_(!1,!1,!1,!0),void i.add(Y)}if(i.has(Y))return;if(_)return void(this.placements[Y]=new G_(!1,!1,!1));let it=!1,X=!1,K=!0,ot=!1,lt=!1,at=null,dt={box:null,offscreen:null,occluded:null},ft={box:null,offscreen:null,occluded:null},_t=null,ct=null,bt=null,Ot=0,kt=0,Ht=0;F.textFeatureIndex?Ot=F.textFeatureIndex:U.useRuntimeCollisionCircles&amp;&amp;(Ot=U.featureIndex),F.verticalTextFeatureIndex&amp;&amp;(kt=F.verticalTextFeatureIndex);const Zt=pe=&gt;{pe.tileID=this.retainedQueryData[s.bucketInstanceId].tileID;const ue=this.transform.elevation;pe.elevation=U.zOffset+(ue?ue.getAtTileOffset(pe.tileID,pe.tileAnchorX,pe.tileAnchorY):0)},fe=F.textBox;if(fe){Zt(fe);const pe=re=&gt;{let Fe=Ti.horizontal;if(s.allowVerticalPlacement&amp;&amp;!re&amp;&amp;this.prevPlacement){const Ue=this.prevPlacement.placedOrientations[Y];Ue&amp;&amp;(this.placedOrientations[Y]=Ue,Fe=Ue,this.markUsedOrientation(s,Fe,U))}return Fe},ue=(re,Fe)=&gt;{if(s.allowVerticalPlacement&amp;&amp;J&gt;0&amp;&amp;F.verticalTextBox){for(const Ue of s.writingModes)if(Ue===Ti.vertical?(dt=Fe(),ft=dt):dt=re(),dt&amp;&amp;dt.box&amp;&amp;dt.box.length)break}else dt=re()};if(a.get("text-variable-anchor")){let re=a.get("text-variable-anchor");if(this.prevPlacement&amp;&amp;this.prevPlacement.variableOffsets[Y]){const Me=this.prevPlacement.variableOffsets[Y];re.indexOf(Me.anchor)&gt;0&amp;&amp;(re=re.filter(hi=&gt;hi!==Me.anchor),re.unshift(Me.anchor))}const Fe=(Me,hi,Fi)=&gt;{const ai=s.getSymbolInstanceTextSize(x,U,this.transform.zoom,Z),_i=(Me.x2-Me.x1)*ai+2*Me.padding,Ui=(Me.y2-Me.y1)*ai+2*Me.padding,Bi=U.hasIconTextFit&amp;&amp;!P?hi:null;Bi&amp;&amp;Zt(Bi);let xi={box:[],offscreen:!1,occluded:!1};const ri=I?2*re.length:re.length;for(let gr=0;gr&lt;ri;++gr){const vs=this.attemptAnchorPlacement(re[gr%re.length],Me,_i,Ui,ai,M,C,m,l,w,gr&gt;=re.length,U,Z,s,Fi,Bi,x,b);if(vs&amp;&amp;(xi=vs.placedGlyphBoxes,xi&amp;&amp;xi.box&amp;&amp;xi.box.length)){it=!0,at=vs.shift;break}}return xi};ue(()=&gt;Fe(fe,F.iconBox,Ti.horizontal),()=&gt;{const Me=F.verticalTextBox;return Me&amp;&amp;Zt(Me),s.allowVerticalPlacement&amp;&amp;!(dt&amp;&amp;dt.box&amp;&amp;dt.box.length)&amp;&amp;J&gt;0&amp;&amp;Me?Fe(Me,F.verticalIconBox,Ti.vertical):{box:null,offscreen:null,occluded:null}}),dt&amp;&amp;(it=dt.box,K=dt.offscreen,ot=dt.occluded);const Ue=pe(!(!dt||!dt.box));if(!it&amp;&amp;this.prevPlacement){const Me=this.prevPlacement.variableOffsets[Y];Me&amp;&amp;(this.variableOffsets[Y]=Me,this.markUsedJustification(s,Me.anchor,U,Ue))}}else{const re=(Fe,Ue)=&gt;{const Me=s.getSymbolInstanceTextSize(x,U,this.transform.zoom,Z),hi=this.collisionIndex.placeCollisionBox(s,Me,Fe,new Q(0,0),I,m,l,w.predicate);return hi&amp;&amp;hi.box&amp;&amp;hi.box.length&amp;&amp;(this.markUsedOrientation(s,Ue,U),this.placedOrientations[Y]=Ue),hi};ue(()=&gt;re(fe,Ti.horizontal),()=&gt;{const Fe=F.verticalTextBox;return s.allowVerticalPlacement&amp;&amp;J&gt;0&amp;&amp;Fe?(Zt(Fe),re(Fe,Ti.vertical)):{box:null,offscreen:null,occluded:null}}),pe(!!(dt&amp;&amp;dt.box&amp;&amp;dt.box.length))}}if(_t=dt,it=_t&amp;&amp;_t.box&amp;&amp;_t.box.length&gt;0,K=_t&amp;&amp;_t.offscreen,ot=_t&amp;&amp;_t.occluded,U.useRuntimeCollisionCircles){const pe=s.text.placedSymbolArray.get(U.centerJustifiedTextSymbolIndex&gt;=0?U.centerJustifiedTextSymbolIndex:U.verticalPlacedTextSymbolIndex),ue=Rc(s.textSizeData,x,pe),re=a.get("text-padding");ct=this.collisionIndex.placeCollisionCircles(s,I,pe,s.lineVertexArray,s.glyphOffsetArray,ue,l,h,d,r,C,w.predicate,U.collisionCircleDiameter*ue/dr,re,this.retainedQueryData[s.bucketInstanceId].tileID),it=I||ct.circles.length&gt;0&amp;&amp;!ct.collisionDetected,K=K&amp;&amp;ct.offscreen,ot=ct.occluded}if(F.iconFeatureIndex&amp;&amp;(Ht=F.iconFeatureIndex),F.iconBox){const pe=ue=&gt;{Zt(ue);const re=U.hasIconTextFit&amp;&amp;at?H_(at.x,at.y,M,C,this.transform.angle):new Q(0,0),Fe=s.getSymbolInstanceIconSize(b,this.transform.zoom,U.placedIconSymbolIndex);return this.collisionIndex.placeCollisionBox(s,Fe,ue,re,P,m,l,w.predicate)};ft&amp;&amp;ft.box&amp;&amp;ft.box.length&amp;&amp;F.verticalIconBox?(bt=pe(F.verticalIconBox),X=bt.box.length&gt;0):(bt=pe(F.iconBox),X=bt.box.length&gt;0),K=K&amp;&amp;bt.offscreen,lt=bt.occluded}const ie=T||U.numHorizontalGlyphVertices===0&amp;&amp;J===0,Ve=S||U.numIconVertices===0;if(ie||Ve?Ve?ie||(X=X&amp;&amp;it):it=X&amp;&amp;it:X=it=X&amp;&amp;it,it&amp;&amp;_t&amp;&amp;_t.box&amp;&amp;this.collisionIndex.insertCollisionBox(_t.box,a.get("text-ignore-placement"),s.bucketInstanceId,ft&amp;&amp;ft.box&amp;&amp;kt?kt:Ot,w.ID),X&amp;&amp;bt&amp;&amp;this.collisionIndex.insertCollisionBox(bt.box,a.get("icon-ignore-placement"),s.bucketInstanceId,Ht,w.ID),ct&amp;&amp;(it&amp;&amp;this.collisionIndex.insertCollisionCircles(ct.circles,a.get("text-ignore-placement"),s.bucketInstanceId,Ot,w.ID),r)){const pe=s.bucketInstanceId;let ue=this.collisionCircleArrays[pe];ue===void 0&amp;&amp;(ue=this.collisionCircleArrays[pe]=new QR);for(let re=0;re&lt;ct.circles.length;re+=4)ue.circles.push(ct.circles[re+0]),ue.circles.push(ct.circles[re+1]),ue.circles.push(ct.circles[re+2]),ue.circles.push(ct.collisionDetected?1:0)}const ke=s.projection.name!=="globe";k=k&amp;&amp;(ke||!ot),z=z&amp;&amp;(ke||!lt),this.placements[Y]=new G_(it||k,X||z,K||s.justReloaded),i.add(Y)};if(O&amp;&amp;this.buildingIndex&amp;&amp;(this.buildingIndex.updateZOffset(s,this.retainedQueryData[s.bucketInstanceId].tileID),s.updateZOffset()),D){const U=s.getSortedSymbolIndexes(this.transform.angle);for(let Z=U.length-1;Z&gt;=0;--Z){const F=U[Z];B(s.symbolInstances.get(F),F,s.collisionArrays[F])}s.hasAnyZOffset&amp;&amp;tt(`${s.layerIds[0]} layer symbol-z-elevate: symbols are not sorted by elevation if symbol-z-order is evaluated to viewport-y`)}else if(s.hasAnyZOffset){const U=s.getSortedIndexesByZOffset();for(let Z=0;Z&lt;U.length;++Z){const F=U[Z];B(s.symbolInstances.get(F),F,s.collisionArrays[F])}}else for(let U=t.symbolInstanceStart;U&lt;t.symbolInstanceEnd;U++)B(s.symbolInstances.get(U),U,s.collisionArrays[U]);if(r&amp;&amp;s.bucketInstanceId in this.collisionCircleArrays){const U=this.collisionCircleArrays[s.bucketInstanceId];nt.invert(U.invProjMatrix,l),U.viewportMatrix=this.collisionIndex.getViewportMatrix()}s.justReloaded=!1}markUsedJustification(t,i,r,n){const{leftJustifiedTextSymbolIndex:s,centerJustifiedTextSymbolIndex:a,rightJustifiedTextSymbolIndex:l,verticalPlacedTextSymbolIndex:h,crossTileID:d}=r,f=a_(i),m=n===Ti.vertical?h:f==="left"?s:f==="center"?a:f==="right"?l:-1;s&gt;=0&amp;&amp;(t.text.placedSymbolArray.get(s).crossTileID=m&gt;=0&amp;&amp;s!==m?0:d),a&gt;=0&amp;&amp;(t.text.placedSymbolArray.get(a).crossTileID=m&gt;=0&amp;&amp;a!==m?0:d),l&gt;=0&amp;&amp;(t.text.placedSymbolArray.get(l).crossTileID=m&gt;=0&amp;&amp;l!==m?0:d),h&gt;=0&amp;&amp;(t.text.placedSymbolArray.get(h).crossTileID=m&gt;=0&amp;&amp;h!==m?0:d)}markUsedOrientation(t,i,r){const n=i===Ti.horizontal||i===Ti.horizontalOnly?i:0,s=i===Ti.vertical?i:0,{leftJustifiedTextSymbolIndex:a,centerJustifiedTextSymbolIndex:l,rightJustifiedTextSymbolIndex:h,verticalPlacedTextSymbolIndex:d}=r,f=t.text.placedSymbolArray;a&gt;=0&amp;&amp;(f.get(a).placedOrientation=n),l&gt;=0&amp;&amp;(f.get(l).placedOrientation=n),h&gt;=0&amp;&amp;(f.get(h).placedOrientation=n),d&gt;=0&amp;&amp;(f.get(d).placedOrientation=s)}commit(t){this.commitTime=t,this.zoomAtLastRecencyCheck=this.transform.zoom;const i=this.prevPlacement;let r=!1;this.prevZoomAdjustment=i?i.zoomAdjustment(this.transform.zoom):0;const n=i?i.symbolFadeChange(t):1,s=i?i.opacities:{},a=i?i.variableOffsets:{},l=i?i.placedOrientations:{};for(const h in this.placements){const d=this.placements[h],f=s[h];f?(this.opacities[h]=new tu(f,n,d.text,d.icon,null,d.clipped),r=r||d.text!==f.text.placed||d.icon!==f.icon.placed):(this.opacities[h]=new tu(null,n,d.text,d.icon,d.skipFade,d.clipped),r=r||d.text||d.icon)}for(const h in s){const d=s[h];if(!this.opacities[h]){const f=new tu(d,n,!1,!1);f.isHidden()||(this.opacities[h]=f,r=r||d.text.placed||d.icon.placed)}}for(const h in a)this.variableOffsets[h]||!this.opacities[h]||this.opacities[h].isHidden()||(this.variableOffsets[h]=a[h]);for(const h in l)this.placedOrientations[h]||!this.opacities[h]||this.opacities[h].isHidden()||(this.placedOrientations[h]=l[h]);r?this.lastPlacementChangeTime=t:typeof this.lastPlacementChangeTime!="number"&amp;&amp;(this.lastPlacementChangeTime=i?i.lastPlacementChangeTime:t)}updateLayerOpacities(t,i){const r=new Set;for(const n of i){const s=n.getBucket(t);s&amp;&amp;n.latestFeatureIndex&amp;&amp;t.fqid===s.layerIds[0]&amp;&amp;(this.updateBucketOpacities(s,r,n.collisionBoxArray),s.layers[0].layout.get("symbol-z-elevate")&amp;&amp;this.buildingIndex&amp;&amp;(this.buildingIndex.updateZOffset(s,n.tileID),s.updateZOffset()))}}updateBucketOpacities(t,i,r){t.hasTextData()&amp;&amp;t.text.opacityVertexArray.clear(),t.hasIconData()&amp;&amp;t.icon.opacityVertexArray.clear(),t.hasIconCollisionBoxData()&amp;&amp;t.iconCollisionBox.collisionVertexArray.clear(),t.hasTextCollisionBoxData()&amp;&amp;t.textCollisionBox.collisionVertexArray.clear();const n=t.layers[0].layout,s=!!t.layers[0].dynamicFilter(),a=new tu(null,0,!1,!1,!0),l=n.get("text-allow-overlap"),h=n.get("icon-allow-overlap"),d=n.get("text-variable-anchor"),f=n.get("text-rotation-alignment")==="map",m=n.get("text-pitch-alignment")==="map",_=new tu(null,0,l&amp;&amp;(h||!t.hasIconData()||n.get("icon-optional")),h&amp;&amp;(l||!t.hasTextData()||n.get("text-optional")),!0);!t.collisionArrays&amp;&amp;r&amp;&amp;(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData())&amp;&amp;t.deserializeCollisionBoxes(r);const y=(b,w,T)=&gt;{for(let S=0;S&lt;w/4;S++)b.opacityVertexArray.emplaceBack(T)};let x=0;for(let b=0;b&lt;t.symbolInstances.length;b++){const w=t.symbolInstances.get(b),{numHorizontalGlyphVertices:T,numVerticalGlyphVertices:S,crossTileID:I,numIconVertices:P}=w,M=i.has(I);let C=this.opacities[I];M?C=a:C||(C=_,this.opacities[I]=C),i.add(I);const D=T&gt;0||S&gt;0,O=P&gt;0,k=this.placedOrientations[I],z=k===Ti.vertical,B=k===Ti.horizontal||k===Ti.horizontalOnly;if(!D&amp;&amp;!O||C.isHidden()||x++,D){const U=lT(C.text);y(t.text,T,z?Sd:U),y(t.text,S,B?Sd:U);const Z=C.text.isHidden(),{leftJustifiedTextSymbolIndex:F,centerJustifiedTextSymbolIndex:Y,rightJustifiedTextSymbolIndex:J,verticalPlacedTextSymbolIndex:it}=w,X=t.text.placedSymbolArray,K=Z||z?1:0;F&gt;=0&amp;&amp;(X.get(F).hidden=K),Y&gt;=0&amp;&amp;(X.get(Y).hidden=K),J&gt;=0&amp;&amp;(X.get(J).hidden=K),it&gt;=0&amp;&amp;(X.get(it).hidden=Z||B?1:0);const ot=this.variableOffsets[I];ot&amp;&amp;this.markUsedJustification(t,ot.anchor,w,k);const lt=this.placedOrientations[I];lt&amp;&amp;(this.markUsedJustification(t,"left",w,lt),this.markUsedOrientation(t,lt,w))}if(O){const U=lT(C.icon),{placedIconSymbolIndex:Z,verticalPlacedIconSymbolIndex:F}=w,Y=t.icon.placedSymbolArray,J=C.icon.isHidden()?1:0;Z&gt;=0&amp;&amp;(y(t.icon,P,z?Sd:U),Y.get(Z).hidden=J),F&gt;=0&amp;&amp;(y(t.icon,w.numVerticalIconVertices,B?Sd:U),Y.get(F).hidden=J)}if(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData()){const U=t.collisionArrays[b];if(U){let Z=new Q(0,0),F=!0;if(U.textBox||U.verticalTextBox){if(d){const J=this.variableOffsets[I];J?(Z=aT(J.anchor,J.width,J.height,J.textOffset,J.textScale),f&amp;&amp;Z._rotate(m?this.transform.angle:-this.transform.angle)):F=!1}s&amp;&amp;(F=!C.clipped),U.textBox&amp;&amp;Ed(t.textCollisionBox.collisionVertexArray,C.text.placed,!F||z,Z.x,Z.y),U.verticalTextBox&amp;&amp;Ed(t.textCollisionBox.collisionVertexArray,C.text.placed,!F||B,Z.x,Z.y)}const Y=F&amp;&amp;!!(!B&amp;&amp;U.verticalIconBox);U.iconBox&amp;&amp;Ed(t.iconCollisionBox.collisionVertexArray,C.icon.placed,Y,w.hasIconTextFit?Z.x:0,w.hasIconTextFit?Z.y:0),U.verticalIconBox&amp;&amp;Ed(t.iconCollisionBox.collisionVertexArray,C.icon.placed,!Y,w.hasIconTextFit?Z.x:0,w.hasIconTextFit?Z.y:0)}}}if(t.fullyClipped=x===0,t.sortFeatures(this.transform.angle),this.retainedQueryData[t.bucketInstanceId]&amp;&amp;(this.retainedQueryData[t.bucketInstanceId].featureSortOrder=t.featureSortOrder),t.hasTextData()&amp;&amp;t.text.opacityVertexBuffer&amp;&amp;t.text.opacityVertexBuffer.updateData(t.text.opacityVertexArray),t.hasIconData()&amp;&amp;t.icon.opacityVertexBuffer&amp;&amp;t.icon.opacityVertexBuffer.updateData(t.icon.opacityVertexArray),t.hasIconCollisionBoxData()&amp;&amp;t.iconCollisionBox.collisionVertexBuffer&amp;&amp;t.iconCollisionBox.collisionVertexBuffer.updateData(t.iconCollisionBox.collisionVertexArray),t.hasTextCollisionBoxData()&amp;&amp;t.textCollisionBox.collisionVertexBuffer&amp;&amp;t.textCollisionBox.collisionVertexBuffer.updateData(t.textCollisionBox.collisionVertexArray),t.bucketInstanceId in this.collisionCircleArrays){const b=this.collisionCircleArrays[t.bucketInstanceId];t.placementInvProjMatrix=b.invProjMatrix,t.placementViewportMatrix=b.viewportMatrix,t.collisionCircleArray=b.circles,delete this.collisionCircleArrays[t.bucketInstanceId]}}symbolFadeChange(t){return this.fadeDuration===0?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&lt;this.fadeDuration}stillRecent(t,i){const r=this.zoomAtLastRecencyCheck===i?1-this.zoomAdjustment(i):1;return this.zoomAtLastRecencyCheck=i,this.commitTime+this.fadeDuration*r&gt;t}setStale(){this.stale=!0}}function Ed(e,t,i,r,n){e.emplaceBack(t?1:0,i?1:0,r||0,n||0),e.emplaceBack(t?1:0,i?1:0,r||0,n||0),e.emplaceBack(t?1:0,i?1:0,r||0,n||0),e.emplaceBack(t?1:0,i?1:0,r||0,n||0)}const rD=Math.pow(2,25),nD=Math.pow(2,24),sD=Math.pow(2,17),oD=Math.pow(2,16),aD=Math.pow(2,9),lD=Math.pow(2,8),cD=Math.pow(2,1);function lT(e){if(e.opacity===0&amp;&amp;!e.placed)return 0;if(e.opacity===1&amp;&amp;e.placed)return 4294967295;const t=e.placed?1:0,i=Math.floor(127*e.opacity);return i*rD+t*nD+i*sD+t*oD+i*aD+t*lD+i*cD+t}const Sd=0;class uD{constructor(t){this._sortAcrossTiles=t.layout.get("symbol-z-order")!=="viewport-y"&amp;&amp;t.layout.get("symbol-sort-key").constantOr(1)!==void 0,this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs=new Set,this._bucketParts=[]}continuePlacement(t,i,r,n,s){const a=this._bucketParts;for(;this._currentTileIndex&lt;t.length;)if(i.getBucketParts(a,n,t[this._currentTileIndex],this._sortAcrossTiles),this._currentTileIndex++,s())return!0;for(this._sortAcrossTiles&amp;&amp;(this._sortAcrossTiles=!1,a.sort((l,h)=&gt;l.sortKey-h.sortKey));this._currentPartIndex&lt;a.length;){const l=a[this._currentPartIndex];if(i.placeLayerBucketPart(l,this._seenCrossTileIDs,r,l.symbolInstanceStart===0),this._currentPartIndex++,s())return!0}return!1}}class hD{constructor(t,i,r,n,s,a,l,h,d){this.placement=new iD(t,s,a,l,h,d),this._currentPlacementIndex=i.length-1,this._forceFullPlacement=r,this._showCollisionBoxes=n,this._done=!1}isDone(){return this._done}continuePlacement(t,i,r,n){const s=_e.now(),a=()=&gt;{const l=_e.now()-s;return!this._forceFullPlacement&amp;&amp;l&gt;2};for(;this._currentPlacementIndex&gt;=0;){const l=i[t[this._currentPlacementIndex]],h=this.placement.collisionIndex.transform.zoom;if(l.type==="symbol"&amp;&amp;(!l.minzoom||l.minzoom&lt;=h)&amp;&amp;(!l.maxzoom||l.maxzoom&gt;h)){const d=l,f=d.layout.get("symbol-z-elevate"),m=this._inProgressLayer=this._inProgressLayer||new uD(d),_=Mr(l.source,l.scope);if(m.continuePlacement(f?n[_]:r[_],this.placement,this._showCollisionBoxes,l,a))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(t){return this.placement.commit(t),this.placement}}const cT=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class Ad{static from(t){if(!(t instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[i,r]=new Uint8Array(t,0,2);if(i!==219)throw new Error("Data does not appear to be in a KDBush format.");const n=r&gt;&gt;4;if(n!==1)throw new Error(`Got v${n} data when expected v1.`);const s=cT[15&amp;r];if(!s)throw new Error("Unrecognized array type.");const[a]=new Uint16Array(t,2,1),[l]=new Uint32Array(t,4,1);return new Ad(l,a,s,t)}constructor(t,i=64,r=Float64Array,n){if(isNaN(t)||t&lt;0)throw new Error(`Unpexpected numItems value: ${t}.`);this.numItems=+t,this.nodeSize=Math.min(Math.max(+i,2),65535),this.ArrayType=r,this.IndexArrayType=t&lt;65536?Uint16Array:Uint32Array;const s=cT.indexOf(this.ArrayType),a=2*t*this.ArrayType.BYTES_PER_ELEMENT,l=t*this.IndexArrayType.BYTES_PER_ELEMENT,h=(8-l%8)%8;if(s&lt;0)throw new Error(`Unexpected typed array class: ${r}.`);n&amp;&amp;n instanceof ArrayBuffer?(this.data=n,this.ids=new this.IndexArrayType(this.data,8,t),this.coords=new this.ArrayType(this.data,8+l+h,2*t),this._pos=2*t,this._finished=!0):(this.data=new ArrayBuffer(8+a+l+h),this.ids=new this.IndexArrayType(this.data,8,t),this.coords=new this.ArrayType(this.data,8+l+h,2*t),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+s]),new Uint16Array(this.data,2,1)[0]=i,new Uint32Array(this.data,4,1)[0]=t)}add(t,i){const r=this._pos&gt;&gt;1;return this.ids[r]=r,this.coords[this._pos++]=t,this.coords[this._pos++]=i,r}finish(){const t=this._pos&gt;&gt;1;if(t!==this.numItems)throw new Error(`Added ${t} items when expected ${this.numItems}.`);return W_(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(t,i,r,n){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:s,coords:a,nodeSize:l}=this,h=[0,s.length-1,0],d=[];for(;h.length;){const f=h.pop()||0,m=h.pop()||0,_=h.pop()||0;if(m-_&lt;=l){for(let w=_;w&lt;=m;w++){const T=a[2*w],S=a[2*w+1];T&gt;=t&amp;&amp;T&lt;=r&amp;&amp;S&gt;=i&amp;&amp;S&lt;=n&amp;&amp;d.push(s[w])}continue}const y=_+m&gt;&gt;1,x=a[2*y],b=a[2*y+1];x&gt;=t&amp;&amp;x&lt;=r&amp;&amp;b&gt;=i&amp;&amp;b&lt;=n&amp;&amp;d.push(s[y]),(f===0?t&lt;=x:i&lt;=b)&amp;&amp;(h.push(_),h.push(y-1),h.push(1-f)),(f===0?r&gt;=x:n&gt;=b)&amp;&amp;(h.push(y+1),h.push(m),h.push(1-f))}return d}within(t,i,r){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:n,coords:s,nodeSize:a}=this,l=[0,n.length-1,0],h=[],d=r*r;for(;l.length;){const f=l.pop()||0,m=l.pop()||0,_=l.pop()||0;if(m-_&lt;=a){for(let w=_;w&lt;=m;w++)hT(s[2*w],s[2*w+1],t,i)&lt;=d&amp;&amp;h.push(n[w]);continue}const y=_+m&gt;&gt;1,x=s[2*y],b=s[2*y+1];hT(x,b,t,i)&lt;=d&amp;&amp;h.push(n[y]),(f===0?t-r&lt;=x:i-r&lt;=b)&amp;&amp;(l.push(_),l.push(y-1),l.push(1-f)),(f===0?t+r&gt;=x:i+r&gt;=b)&amp;&amp;(l.push(y+1),l.push(m),l.push(1-f))}return h}}function W_(e,t,i,r,n,s){if(n-r&lt;=i)return;const a=r+n&gt;&gt;1;uT(e,t,a,r,n,s),W_(e,t,i,r,a-1,1-s),W_(e,t,i,a+1,n,1-s)}function uT(e,t,i,r,n,s){for(;n&gt;r;){if(n-r&gt;600){const d=n-r+1,f=i-r+1,m=Math.log(d),_=.5*Math.exp(2*m/3),y=.5*Math.sqrt(m*_*(d-_)/d)*(f-d/2&lt;0?-1:1);uT(e,t,i,Math.max(r,Math.floor(i-f*_/d+y)),Math.min(n,Math.floor(i+(d-f)*_/d+y)),s)}const a=t[2*i+s];let l=r,h=n;for(eu(e,t,r,i),t[2*n+s]&gt;a&amp;&amp;eu(e,t,r,n);l&lt;h;){for(eu(e,t,l,h),l++,h--;t[2*l+s]&lt;a;)l++;for(;t[2*h+s]&gt;a;)h--}t[2*r+s]===a?eu(e,t,r,h):(h++,eu(e,t,h,n)),h&lt;=i&amp;&amp;(r=h+1),i&lt;=h&amp;&amp;(n=h-1)}}function eu(e,t,i,r){q_(e,i,r),q_(t,2*i,2*r),q_(t,2*i+1,2*r+1)}function q_(e,t,i){const r=e[t];e[t]=e[i],e[i]=r}function hT(e,t,i,r){const n=e-i,s=t-r;return n*n+s*s}const Z_=512/ut/2;class dD{constructor(t,i,r){this.tileID=t,this.bucketInstanceId=r,this.index=new Ad(i.length,16,Int32Array),this.keys=[],this.crossTileIDs=[];const n=t.canonical.x*ut,s=t.canonical.y*ut;for(let a=0;a&lt;i.length;a++){const{key:l,crossTileID:h,tileAnchorX:d,tileAnchorY:f}=i.get(a),m=Math.floor((n+d)*Z_),_=Math.floor((s+f)*Z_);this.index.add(m,_),this.keys.push(l),this.crossTileIDs.push(h)}this.index.finish()}findMatches(t,i,r){const n=this.tileID.canonical.z&lt;i.canonical.z?1:Math.pow(2,this.tileID.canonical.z-i.canonical.z),s=Z_/Math.pow(2,i.canonical.z-this.tileID.canonical.z),a=i.canonical.x*ut,l=i.canonical.y*ut;for(let h=0;h&lt;t.length;h++){const d=t.get(h);if(d.crossTileID)continue;const{key:f,tileAnchorX:m,tileAnchorY:_}=d,y=Math.floor((a+m)*s),x=Math.floor((l+_)*s),b=this.index.range(y-n,x-n,y+n,x+n);for(const w of b){const T=this.crossTileIDs[w];if(this.keys[w]===f&amp;&amp;!r.has(T)){r.add(T),d.crossTileID=T;break}}}}}class fD{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class pD{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(t){const i=Math.round((t-this.lng)/360);if(i!==0)for(const r in this.indexes){const n=this.indexes[r],s={};for(const a in n){const l=n[a];l.tileID=l.tileID.unwrapTo(l.tileID.wrap+i),s[l.tileID.key]=l}this.indexes[r]=s}this.lng=t}addBucket(t,i,r){if(this.indexes[t.overscaledZ]&amp;&amp;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 s=0;s&lt;i.symbolInstances.length;s++)i.symbolInstances.get(s).crossTileID=0;this.usedCrossTileIDs[t.overscaledZ]||(this.usedCrossTileIDs[t.overscaledZ]=new Set);const n=this.usedCrossTileIDs[t.overscaledZ];for(const s in this.indexes){const a=this.indexes[s];if(Number(s)&gt;t.overscaledZ)for(const l in a){const h=a[l];h.tileID.isChildOf(t)&amp;&amp;h.findMatches(i.symbolInstances,t,n)}else{const l=a[t.scaledTo(Number(s)).key];l&amp;&amp;l.findMatches(i.symbolInstances,t,n)}}for(let s=0;s&lt;i.symbolInstances.length;s++){const a=i.symbolInstances.get(s);a.crossTileID||(a.crossTileID=r.generate(),n.add(a.crossTileID))}return this.indexes[t.overscaledZ]===void 0&amp;&amp;(this.indexes[t.overscaledZ]={}),this.indexes[t.overscaledZ][t.key]=new dD(t,i.symbolInstances,i.bucketInstanceId),!0}removeBucketCrossTileIDs(t,i){for(const r of i.crossTileIDs)this.usedCrossTileIDs[t].delete(r)}removeStaleBuckets(t){let i=!1;for(const r in this.indexes){const n=this.indexes[r];for(const s in n)t[n[s].bucketInstanceId]||(this.removeBucketCrossTileIDs(r,n[s]),delete n[s],i=!0)}return i}}class mD{constructor(){this.layerIndexes={},this.crossTileIDs=new fD,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(t,i,r,n){let s=this.layerIndexes[t.fqid];s===void 0&amp;&amp;(s=this.layerIndexes[t.fqid]=new pD);let a=!1;const l={};n.name!=="globe"&amp;&amp;s.handleWrapJump(r);for(const h of i){const d=h.getBucket(t);d&amp;&amp;t.fqid===d.layerIds[0]&amp;&amp;(d.bucketInstanceId||(d.bucketInstanceId=++this.maxBucketInstanceId),s.addBucket(h.tileID,d,this.crossTileIDs)&amp;&amp;(a=!0),l[d.bucketInstanceId]=!0)}return s.removeStaleBuckets(l)&amp;&amp;(a=!0),a}pruneUnusedLayers(t){const i={};t.forEach(r=&gt;{i[r]=!0});for(const r in this.layerIndexes)i[r]||delete this.layerIndexes[r]}}var dT=`
#define EPSILON 0.0000001
#define PI 3.141592653589793
#ifdef RENDER_CUTOFF
float cutoff_opacity(vec4 cutoff_params,float depth) {float near=cutoff_params.x;float far=cutoff_params.y;float cutoffStart=cutoff_params.z;float cutoffEnd=cutoff_params.w-0.0001;float linearDepth=(depth-near)/(far-near);return clamp((linearDepth-cutoffStart)/(cutoffEnd-cutoffStart),0.0,1.0);}
#endif`,fT="in highp vec3 a_pos_3f;uniform lowp mat4 u_matrix;out highp vec3 v_uv;void main() {const mat3 half_neg_pi_around_x=mat3(1.0,0.0, 0.0,0.0,0.0,-1.0,0.0,1.0, 0.0);v_uv=half_neg_pi_around_x*a_pos_3f;vec4 pos=u_matrix*vec4(a_pos_3f,1.0);gl_Position=pos.xyww;}",pT=`
#define ELEVATION_SCALE 7.0
#define ELEVATION_OFFSET 450.0
#ifdef PROJECTION_GLOBE_VIEW
uniform vec3 u_tile_tl_up;uniform vec3 u_tile_tr_up;uniform vec3 u_tile_br_up;uniform vec3 u_tile_bl_up;uniform float u_tile_up_scale;vec3 elevationVector(vec2 pos) {vec2 uv=pos/EXTENT;vec3 up=normalize(mix(
mix(u_tile_tl_up,u_tile_tr_up,uv.xxx),mix(u_tile_bl_up,u_tile_br_up,uv.xxx),uv.yyy));return up*u_tile_up_scale;}
#else
vec3 elevationVector(vec2 pos) { return vec3(0,0,1); }
#endif
#ifdef TERRAIN
uniform highp sampler2D u_dem;uniform highp sampler2D u_dem_prev;uniform vec2 u_dem_tl;uniform vec2 u_dem_tl_prev;uniform float u_dem_scale;uniform float u_dem_scale_prev;uniform float u_dem_size;uniform float u_dem_lerp;uniform float u_exaggeration;uniform float u_meter_to_dem;uniform mat4 u_label_plane_matrix_inv;uniform sampler2D u_depth;uniform vec2 u_depth_size_inv;vec4 tileUvToDemSample(vec2 uv,float dem_size,float dem_scale,vec2 dem_tl) {vec2 pos=dem_size*(uv*dem_scale+dem_tl)+1.0;vec2 f=fract(pos);return vec4((pos-f+0.5)/(dem_size+2.0),f);}float currentElevation(vec2 apos) {
#ifdef TERRAIN_DEM_FLOAT_FORMAT
vec2 pos=(u_dem_size*(apos/8192.0*u_dem_scale+u_dem_tl)+1.5)/(u_dem_size+2.0);return u_exaggeration*texture(u_dem,pos).r;
#else
float dd=1.0/(u_dem_size+2.0);vec4 r=tileUvToDemSample(apos/8192.0,u_dem_size,u_dem_scale,u_dem_tl);vec2 pos=r.xy;vec2 f=r.zw;float tl=texture(u_dem,pos).r;float tr=texture(u_dem,pos+vec2(dd,0)).r;float bl=texture(u_dem,pos+vec2(0,dd)).r;float br=texture(u_dem,pos+vec2(dd,dd)).r;return u_exaggeration*mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);
#endif
}float prevElevation(vec2 apos) {
#ifdef TERRAIN_DEM_FLOAT_FORMAT
vec2 pos=(u_dem_size*(apos/8192.0*u_dem_scale_prev+u_dem_tl_prev)+1.5)/(u_dem_size+2.0);return u_exaggeration*texture(u_dem_prev,pos).r;
#else
float dd=1.0/(u_dem_size+2.0);vec4 r=tileUvToDemSample(apos/8192.0,u_dem_size,u_dem_scale_prev,u_dem_tl_prev);vec2 pos=r.xy;vec2 f=r.zw;float tl=texture(u_dem_prev,pos).r;float tr=texture(u_dem_prev,pos+vec2(dd,0)).r;float bl=texture(u_dem_prev,pos+vec2(0,dd)).r;float br=texture(u_dem_prev,pos+vec2(dd,dd)).r;return u_exaggeration*mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);
#endif
}
#ifdef TERRAIN_VERTEX_MORPHING
float elevation(vec2 apos) {
#ifdef ZERO_EXAGGERATION
return 0.0;
#endif
float nextElevation=currentElevation(apos);float prevElevation=prevElevation(apos);return mix(prevElevation,nextElevation,u_dem_lerp);}
#else
float elevation(vec2 apos) {
#ifdef ZERO_EXAGGERATION
return 0.0;
#endif
return currentElevation(apos);}
#endif
highp float unpack_depth(highp vec4 rgba_depth)
{const highp vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);return dot(rgba_depth,bit_shift)*2.0-1.0;}bool isOccluded(vec4 frag) {vec3 coord=frag.xyz/frag.w;float depth=unpack_depth(texture(u_depth,(coord.xy+1.0)*0.5));return coord.z &gt; depth+0.0005;}float occlusionFade(vec4 frag) {vec3 coord=frag.xyz/frag.w;vec3 df=vec3(5.0*u_depth_size_inv,0.0);vec2 uv=0.5*coord.xy+0.5;vec4 depth=vec4(
unpack_depth(texture(u_depth,uv-df.xz)),unpack_depth(texture(u_depth,uv+df.xz)),unpack_depth(texture(u_depth,uv-df.zy)),unpack_depth(texture(u_depth,uv+df.zy))
);return dot(vec4(0.25),vec4(1.0)-clamp(300.0*(vec4(coord.z-0.001)-depth),0.0,1.0));}vec4 fourSample(vec2 pos,vec2 off) {float tl=texture(u_dem,pos).r;float tr=texture(u_dem,pos+vec2(off.x,0.0)).r;float bl=texture(u_dem,pos+vec2(0.0,off.y)).r;float br=texture(u_dem,pos+off).r;return vec4(tl,tr,bl,br);}float flatElevation(vec2 pack) {vec2 apos=floor(pack/8.0);vec2 span=10.0*(pack-apos*8.0);vec2 uvTex=(apos-vec2(1.0,1.0))/8190.0;float size=u_dem_size+2.0;float dd=1.0/size;vec2 pos=u_dem_size*(uvTex*u_dem_scale+u_dem_tl)+1.0;vec2 f=fract(pos);pos=(pos-f+0.5)*dd;vec4 h=fourSample(pos,vec2(dd));float z=mix(mix(h.x,h.y,f.x),mix(h.z,h.w,f.x),f.y);vec2 w=floor(0.5*(span*u_meter_to_dem-1.0));vec2 d=dd*w;h=fourSample(pos-d,2.0*d+vec2(dd));vec4 diff=abs(h.xzxy-h.ywzw);vec2 slope=min(vec2(0.25),u_meter_to_dem*0.5*(diff.xz+diff.yw)/(2.0*w+vec2(1.0)));vec2 fix=slope*span;float base=z+max(fix.x,fix.y);return u_exaggeration*base;}float elevationFromUint16(float word) {return u_exaggeration*(word/ELEVATION_SCALE-ELEVATION_OFFSET);}
#else
float elevation(vec2 pos) { return 0.0; }bool isOccluded(vec4 frag) { return false; }float occlusionFade(vec4 frag) { return 1.0; }
#endif`,mT=`#ifdef FOG
uniform mediump vec4 u_fog_color;uniform mediump vec2 u_fog_range;uniform mediump float u_fog_horizon_blend;uniform mediump mat4 u_fog_matrix;out vec3 v_fog_pos;float fog_range(float depth) {return (depth-u_fog_range[0])/(u_fog_range[1]-u_fog_range[0]);}float fog_horizon_blending(vec3 camera_dir) {float t=max(0.0,camera_dir.z/u_fog_horizon_blend);return u_fog_color.a*exp(-3.0*t*t);}float fog_opacity(float t) {const float decay=6.0;float falloff=1.0-min(1.0,exp(-decay*t));falloff*=falloff*falloff;return u_fog_color.a*min(1.0,1.00747*falloff);}vec3 fog_position(vec3 pos) {return (u_fog_matrix*vec4(pos,1.0)).xyz;}vec3 fog_position(vec2 pos) {return fog_position(vec3(pos,0.0));}float fog(vec3 pos) {float depth=length(pos);float opacity=fog_opacity(fog_range(depth));return opacity*fog_horizon_blending(pos/depth);}
#endif`,_T=`highp vec3 hash(highp vec2 p) {highp vec3 p3=fract(p.xyx*vec3(443.8975,397.2973,491.1871));p3+=dot(p3,p3.yxz+19.19);return fract((p3.xxy+p3.yzz)*p3.zyx);}vec3 dither(vec3 color,highp vec2 seed) {vec3 rnd=hash(seed)+hash(seed+0.59374)-0.5;return color+rnd/255.0;}
#ifdef FOG
uniform mediump vec4 u_fog_color;uniform mediump vec2 u_fog_range;uniform mediump float u_fog_horizon_blend;uniform mediump vec2 u_fog_vertical_limit;uniform mediump float u_fog_temporal_offset;in vec3 v_fog_pos;uniform highp vec3 u_frustum_tl;uniform highp vec3 u_frustum_tr;uniform highp vec3 u_frustum_br;uniform highp vec3 u_frustum_bl;uniform highp vec3 u_globe_pos;uniform highp float u_globe_radius;uniform highp vec2 u_viewport;uniform float u_globe_transition;uniform int u_is_globe;float fog_range(float depth) {return (depth-u_fog_range[0])/(u_fog_range[1]-u_fog_range[0]);}float fog_horizon_blending(vec3 camera_dir) {float t=max(0.0,camera_dir.z/u_fog_horizon_blend);return u_fog_color.a*exp(-3.0*t*t);}float fog_opacity(float t) {const float decay=6.0;float falloff=1.0-min(1.0,exp(-decay*t));falloff*=falloff*falloff;return u_fog_color.a*min(1.0,1.00747*falloff);}float globe_glow_progress() {highp vec2 uv=gl_FragCoord.xy/u_viewport;highp vec3 ray_dir=mix(
mix(u_frustum_tl,u_frustum_tr,uv.x),mix(u_frustum_bl,u_frustum_br,uv.x),1.0-uv.y);highp vec3 dir=normalize(ray_dir);highp vec3 closest_point=dot(u_globe_pos,dir)*dir;highp float sdf=length(closest_point-u_globe_pos)/u_globe_radius;return sdf+PI*0.5;}float fog_opacity(vec3 pos) {float depth=length(pos);return fog_opacity(fog_range(depth));}vec3 fog_apply(vec3 color,vec3 pos,float opacity_limit) {float depth=length(pos);float opacity;if (u_is_globe==1) {float glow_progress=globe_glow_progress();float t=mix(glow_progress,depth,u_globe_transition);opacity=fog_opacity(fog_range(t));} else {opacity=fog_opacity(fog_range(depth));opacity*=fog_horizon_blending(pos/depth);}return mix(color,u_fog_color.rgb,min(opacity,opacity_limit));}vec3 fog_apply(vec3 color,vec3 pos) {return fog_apply(color,pos,1.0);}vec4 fog_apply_from_vert(vec4 color,float fog_opac) {float alpha=EPSILON+color.a;color.rgb=mix(color.rgb/alpha,u_fog_color.rgb,fog_opac)*alpha;return color;}vec3 fog_apply_sky_gradient(vec3 camera_ray,vec3 sky_color) {float horizon_blend=fog_horizon_blending(normalize(camera_ray));return mix(sky_color,u_fog_color.rgb,horizon_blend);}vec4 fog_apply_premultiplied(vec4 color,vec3 pos) {float alpha=EPSILON+color.a;color.rgb=fog_apply(color.rgb/alpha,pos)*alpha;return color;}vec4 fog_apply_premultiplied(vec4 color,vec3 pos,float heightMeters) {float verticalProgress=(u_fog_vertical_limit.x &gt; 0.0 || u_fog_vertical_limit.y &gt; 0.0) ? smoothstep(u_fog_vertical_limit.x,u_fog_vertical_limit.y,heightMeters) : 0.0;float opacityLimit=1.0-smoothstep(0.9,1.0,fog_opacity(pos));return mix(fog_apply_premultiplied(color,pos),color,min(verticalProgress,opacityLimit));}vec3 fog_dither(vec3 color) {
#ifdef FOG_DITHERING
vec2 dither_seed=gl_FragCoord.xy+u_fog_temporal_offset;return dither(color,dither_seed);
#else
return color;
#endif
}vec4 fog_dither(vec4 color) {return vec4(fog_dither(color.rgb),color.a);}
#endif`,gT=`#ifdef RASTER_ARRAY
uniform sampler2D u_image0;uniform sampler2D u_image1;const vec4 NODATA=vec4(1);vec4 _raTexLinearCoord(vec2 texCoord,vec2 texResolution,out vec2 fxy) {texCoord=texCoord*texResolution-0.5;fxy=fract(texCoord);texCoord-=fxy;return (texCoord.xxyy+vec2(1.5,0.5).xyxy)/texResolution.xxyy;}vec2 _raTexLinearMix(vec2 fxy,vec4 colorMix,float colorOffset,vec4 t00,vec4 t10,vec4 t01,vec4 t11) {vec2 c00=t00==NODATA ? vec2(0) : vec2(colorOffset+dot(t00,colorMix),1);vec2 c10=t10==NODATA ? vec2(0) : vec2(colorOffset+dot(t10,colorMix),1);vec2 c01=t01==NODATA ? vec2(0) : vec2(colorOffset+dot(t01,colorMix),1);vec2 c11=t11==NODATA ? vec2(0) : vec2(colorOffset+dot(t11,colorMix),1);return mix(mix(c01,c11,fxy.x),mix(c00,c10,fxy.x),fxy.y);}vec2 raTexture2D_image0_linear(vec2 texCoord,vec2 texResolution,vec4 colorMix,float colorOffset) {vec2 fxy;vec4 c=_raTexLinearCoord(texCoord,texResolution,fxy);return _raTexLinearMix(fxy,colorMix,colorOffset,texture(u_image0,c.yz),texture(u_image0,c.xz),texture(u_image0,c.yw),texture(u_image0,c.xw)
);}vec2 raTexture2D_image1_linear(vec2 texCoord,vec2 texResolution,vec4 colorMix,float colorOffset) {vec2 fxy;vec4 c=_raTexLinearCoord(texCoord,texResolution,fxy);return _raTexLinearMix(fxy,colorMix,colorOffset,texture(u_image1,c.yz),texture(u_image1,c.xz),texture(u_image1,c.yw),texture(u_image1,c.xw)
);}vec2 raTexture2D_image0_nearest(vec2 texCoord,vec2 texResolution,vec4 colorMix,float colorOffset) {vec4 t=texture(u_image0,texCoord);return t==NODATA ? vec2(0) : vec2(colorOffset+dot(t,colorMix),1);}vec2 raTexture2D_image1_nearest(vec2 texCoord,vec2 texResolution,vec4 colorMix,float colorOffset) {vec4 t=texture(u_image1,texCoord);return t==NODATA ? vec2(0) : vec2(colorOffset+dot(t,colorMix),1);}
#endif`,yT=`#ifdef RENDER_SHADOWS
uniform mediump vec3 u_shadow_direction;uniform highp vec3 u_shadow_normal_offset;vec3 shadow_normal_offset(vec3 normal) {float tileInMeters=u_shadow_normal_offset[0];vec3 n=vec3(-normal.xy,tileInMeters*normal.z);float dotScale=min(1.0-dot(normal,u_shadow_direction),1.0)*0.5+0.5;return n*dotScale;}vec3 shadow_normal_offset_model(vec3 normal) {float dotScale=min(1.0-dot(normal,u_shadow_direction),1.0)*0.5+0.5;return normal*dotScale;}float shadow_normal_offset_multiplier0() {return u_shadow_normal_offset[1];}float shadow_normal_offset_multiplier1() {return u_shadow_normal_offset[2];}
#endif//RENDER_SHADOWS`,xT=`#ifdef RENDER_SHADOWS
#ifdef DEPTH_TEXTURE
uniform highp sampler2D u_shadowmap_0;uniform highp sampler2D u_shadowmap_1;
#else
uniform sampler2D u_shadowmap_0;uniform sampler2D u_shadowmap_1;
#endif
uniform float u_shadow_intensity;uniform float u_shadow_map_resolution;uniform float u_shadow_texel_size;uniform highp vec3 u_shadow_normal_offset;uniform vec2 u_fade_range;uniform mediump vec3 u_shadow_direction;uniform highp vec3 u_shadow_bias;highp float shadow_sample_1(highp vec2 uv,highp float compare) {highp float shadow_depth;
#ifdef DEPTH_TEXTURE
shadow_depth=texture(u_shadowmap_1,uv).r;
#else
shadow_depth=unpack_depth(texture(u_shadowmap_1,uv))*0.5+0.5;
#endif
return step(shadow_depth,compare);}highp float shadow_sample_0(highp vec2 uv,highp float compare) {highp float shadow_depth;
#ifdef DEPTH_TEXTURE
shadow_depth=texture(u_shadowmap_0,uv).r;
#else
shadow_depth=unpack_depth(texture(u_shadowmap_0,uv))*0.5+0.5;
#endif
return step(shadow_depth,compare);}float shadow_occlusion_1(highp vec4 pos,highp float bias) {highp vec2 uv=pos.xy;return shadow_sample_1(uv,pos.z-bias);}float shadow_occlusion_0(highp vec4 pos,highp float bias) {highp float compare0=pos.z-bias;
#ifdef NATIVE
highp vec2 uv=pos.xy;highp vec4 samples=textureGather(u_shadowmap_0,uv,0);lowp vec4 stepSamples=step(samples,vec4(compare0));
#else
highp vec2 uv00=pos.xy-vec2(0.5*u_shadow_texel_size);highp vec2 uv10=uv00+vec2(u_shadow_texel_size,0.0);highp vec2 uv01=uv00+vec2(0.0,u_shadow_texel_size);highp vec2 uv11=uv01+vec2(u_shadow_texel_size,0.0);lowp vec4 stepSamples=vec4(
shadow_sample_0(uv01,compare0),shadow_sample_0(uv11,compare0),shadow_sample_0(uv10,compare0),shadow_sample_0(uv00,compare0)
);
#endif
vec2 f=fract(pos.xy*u_shadow_map_resolution-vec2(0.5));lowp vec2 lerpx=mix(stepSamples.wx,stepSamples.zy,f.xx);return mix(lerpx.x,lerpx.y,f.y);}float shadow_occlusion(highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth,highp float bias) {
#ifdef SHADOWS_SINGLE_CASCADE
light_view_pos0.xyz=light_view_pos0.xyz/light_view_pos0.w*0.5+0.5;return shadow_occlusion_0(light_view_pos0,bias);
#else
light_view_pos0.xyz/=light_view_pos0.w;light_view_pos1.xyz/=light_view_pos1.w;vec4 uv=vec4(light_view_pos0.xy,light_view_pos1.xy);vec4 abs_bounds=abs(uv);if (abs_bounds.x &lt; 1.0 &amp;&amp; abs_bounds.y &lt; 1.0) {light_view_pos0.xyz=light_view_pos0.xyz*0.5+0.5;return shadow_occlusion_0(light_view_pos0,bias);}if (abs_bounds.z &gt;=1.0 || abs_bounds.w &gt;=1.0) {return 0.0;}light_view_pos1.xyz=light_view_pos1.xyz*0.5+0.5;float occlusion1=shadow_occlusion_1(light_view_pos1,bias);return mix(occlusion1,0.0,smoothstep(u_fade_range.x,u_fade_range.y,view_depth));
#endif
}highp float calculate_shadow_bias(float NDotL) {
#ifdef NORMAL_OFFSET
return 0.5*u_shadow_bias.x;
#else
return 0.5*(u_shadow_bias.x+clamp(u_shadow_bias.y*tan(acos(NDotL)),0.0,u_shadow_bias.z));
#endif
}float shadowed_light_factor_normal(vec3 N,highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float NDotL=dot(N,u_shadow_direction);float bias=calculate_shadow_bias(NDotL);float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);return mix(0.0,(1.0-(u_shadow_intensity*occlusion))*NDotL,step(0.0,NDotL));}float shadowed_light_factor_normal_unbiased(vec3 N,highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float NDotL=dot(N,u_shadow_direction);float bias=0.0;float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);return mix(0.0,(1.0-(u_shadow_intensity*occlusion))*NDotL,step(0.0,NDotL));}float shadowed_light_factor(highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float bias=0.0;float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);return 1.0-(u_shadow_intensity*occlusion);}float shadow_occlusion(float ndotl,highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float bias=calculate_shadow_bias(ndotl);return shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);}
#endif`;const vT=[];Pd(dT,vT);const Md={"_prelude_fog.vertex.glsl":mT,"_prelude_terrain.vertex.glsl":pT,"_prelude_shadow.vertex.glsl":yT,"_prelude_fog.fragment.glsl":_T,"_prelude_shadow.fragment.glsl":xT,"_prelude_lighting.glsl":`
#ifdef LIGHTING_3D_MODE
uniform mediump vec3 u_lighting_ambient_color;uniform mediump vec3 u_lighting_directional_dir;uniform mediump vec3 u_lighting_directional_color;uniform mediump vec3 u_ground_radiance;float calculate_ambient_directional_factor(vec3 normal) {float NdotL=dot(normal,u_lighting_directional_dir);const float factor_reduction_max=0.3;float dir_luminance=dot(u_lighting_directional_color,vec3(0.2126,0.7152,0.0722));float directional_factor_min=1.0-factor_reduction_max*min(dir_luminance,1.0);float ambient_directional_factor=mix(directional_factor_min,1.0,min((NdotL+1.0),1.0));const float vertical_factor_min=0.92;float vertical_factor=mix(vertical_factor_min,1.0,normal.z*0.5+0.5);return vertical_factor*ambient_directional_factor;}vec3 linearProduct(vec3 srgbIn,vec3 k) {return srgbIn*pow(k,vec3(1./2.2));}vec3 apply_lighting(vec3 color,vec3 normal,float dir_factor) {float ambient_directional_factor=calculate_ambient_directional_factor(normal);vec3 ambient_contrib=ambient_directional_factor*u_lighting_ambient_color;vec3 directional_contrib=u_lighting_directional_color*dir_factor;return linearProduct(color,ambient_contrib+directional_contrib);}vec4 apply_lighting(vec4 color,vec3 normal,float dir_factor) {return vec4(apply_lighting(color.rgb,normal,dir_factor),color.a);}vec3 apply_lighting(vec3 color,vec3 normal) {float dir_factor=max(dot(normal,u_lighting_directional_dir),0.0);return apply_lighting(color.rgb,normal,dir_factor);}vec4 apply_lighting(vec4 color,vec3 normal) {float dir_factor=max(dot(normal,u_lighting_directional_dir),0.0);return vec4(apply_lighting(color.rgb,normal,dir_factor),color.a);}vec3 apply_lighting_ground(vec3 color) {return color*u_ground_radiance;}vec4 apply_lighting_ground(vec4 color) {return vec4(apply_lighting_ground(color.rgb),color.a);}float calculate_NdotL(vec3 normal) {const float ext=0.70710678118;return (clamp(dot(normal,u_lighting_directional_dir),-ext,1.0)+ext)/(1.0+ext);}vec4 apply_lighting_with_emission_ground(vec4 color,float emissive_strength) {return mix(apply_lighting_ground(color),color,emissive_strength);}vec3 compute_flood_lighting(vec3 flood_light_color,float fully_occluded_factor,float occlusion,vec3 ground_shadow_factor) {vec3 fully_occluded_color=flood_light_color*mix(ground_shadow_factor,vec3(1.0),fully_occluded_factor);float occlusion_ramp=smoothstep(0.0,0.2,1.0-occlusion);return mix(fully_occluded_color,flood_light_color,occlusion_ramp);}vec3 compute_emissive_draped(vec3 unlit_color,float fully_occluded_factor,float occlusion,vec3 ground_shadow_factor) {vec3 fully_occluded_color=unlit_color*mix(ground_shadow_factor,vec3(1.0),fully_occluded_factor);return mix(fully_occluded_color,unlit_color,1.0-occlusion);}
#endif//LIGHTING_3D_MODE`,"_prelude_raster_array.glsl":gT},Id={};ii("",pT),ii(_T,mT),ii(xT,yT),ii(gT,"");const bT=ii(`
out vec4 glFragColor;highp float unpack_depth(highp vec4 rgba_depth)
{const highp vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);return dot(rgba_depth,bit_shift)*2.0-1.0;}highp vec4 pack_depth(highp float ndc_z) {highp float depth=ndc_z*0.5+0.5;const highp vec4 bit_shift=vec4(255.0*255.0*255.0,255.0*255.0,255.0,1.0);const highp vec4 bit_mask =vec4(0.0,1.0/255.0,1.0/255.0,1.0/255.0);highp vec4 res=fract(depth*bit_shift);res-=res.xxyz*bit_mask;return res;}
#ifdef INDICATOR_CUTOUT
uniform vec2 u_indicator_cutout_centers;uniform vec4 u_indicator_cutout_params;
#endif
vec4 applyCutout(vec4 color) {
#ifdef INDICATOR_CUTOUT
float holeMinOpacity=u_indicator_cutout_params.x;float holeRadius=max(u_indicator_cutout_params.y,0.0);float holeAspectRatio=u_indicator_cutout_params.z;float fadeStart=u_indicator_cutout_params.w;float distA=distance(vec2(gl_FragCoord.x,gl_FragCoord.y*holeAspectRatio),vec2(u_indicator_cutout_centers[0],u_indicator_cutout_centers[1]*holeAspectRatio));return color*min(smoothstep(fadeStart,holeRadius,distA)+holeMinOpacity,1.0);
#else
return color;
#endif
}
#ifdef DEBUG_WIREFRAME
#define HANDLE_WIREFRAME_DEBUG \\
glFragColor=vec4(0.7,0.0,0.0,0.7); \\
gl_FragDepth=gl_FragCoord.z-0.0001;
#else
#define HANDLE_WIREFRAME_DEBUG
#endif
#ifdef RENDER_CUTOFF
uniform highp vec4 u_cutoff_params;in float v_cutoff_opacity;
#endif`,`
#define EXTENT 8192.0
#define RAD_TO_DEG 180.0/PI
#define DEG_TO_RAD PI/180.0
#define GLOBE_RADIUS EXTENT/PI/2.0
float wrap(float n,float min,float max) {float d=max-min;float w=mod(mod(n-min,d)+d,d)+min;return (w==min) ? max : w;}
#ifdef PROJECTION_GLOBE_VIEW
vec3 mercator_tile_position(mat4 matrix,vec2 tile_anchor,vec3 tile_id,vec2 mercator_center) {
#ifndef PROJECTED_POS_ON_VIEWPORT
float tiles=tile_id.z;vec2 mercator=(tile_anchor/EXTENT+tile_id.xy)/tiles;mercator-=mercator_center;mercator.x=wrap(mercator.x,-0.5,0.5);vec4 mercator_tile=vec4(mercator.xy*EXTENT,EXTENT/(2.0*PI),1.0);mercator_tile=matrix*mercator_tile;return mercator_tile.xyz;
#else
return vec3(0.0);
#endif
}vec3 mix_globe_mercator(vec3 globe,vec3 mercator,float t) {return mix(globe,mercator,t);}mat3 globe_mercator_surface_vectors(vec3 pos_normal,vec3 up_dir,float zoom_transition) {vec3 normal=zoom_transition==0.0 ? pos_normal : normalize(mix(pos_normal,up_dir,zoom_transition));vec3 xAxis=normalize(vec3(normal.z,0.0,-normal.x));vec3 yAxis=normalize(cross(normal,xAxis));return mat3(xAxis,yAxis,normal);}
#endif
vec2 unpack_float(const float packedValue) {int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}vec2 unpack_opacity(const float packedOpacity) {int intOpacity=int(packedOpacity)/2;return vec2(float(intOpacity)/127.0,mod(packedOpacity,2.0));}vec4 decode_color(const vec2 encodedColor) {return vec4(
unpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0
);}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);return (tile_units_to_pixels*pos+offset)/pattern_size;}float mercatorXfromLng(float lng) {return (180.0+lng)/360.0;}float mercatorYfromLat(float lat) {return (180.0-(RAD_TO_DEG*log(tan(PI/4.0+lat/2.0*DEG_TO_RAD))))/360.0;}vec3 latLngToECEF(vec2 latLng) {latLng=DEG_TO_RAD*latLng;float cosLat=cos(latLng[0]);float sinLat=sin(latLng[0]);float cosLng=cos(latLng[1]);float sinLng=sin(latLng[1]);float sx=cosLat*sinLng*GLOBE_RADIUS;float sy=-sinLat*GLOBE_RADIUS;float sz=cosLat*cosLng*GLOBE_RADIUS;return vec3(sx,sy,sz);}
#ifdef RENDER_CUTOFF
uniform vec4 u_cutoff_params;out float v_cutoff_opacity;
#endif
const vec4 AWAY=vec4(-1000.0,-1000.0,-1000.0,1);const float skirtOffset=24575.0;vec3 decomposeToPosAndSkirt(vec2 posWithComposedSkirt)
{float skirt=float(posWithComposedSkirt.x &gt;=skirtOffset);vec2 pos=posWithComposedSkirt-vec2(skirt*skirtOffset,0.0);return vec3(pos,skirt);}`),wT=dT;var TT={background:ii(`#include "_prelude_fog.fragment.glsl"
#include "_prelude_lighting.glsl"
uniform vec4 u_color;uniform float u_opacity;
#ifdef LIGHTING_3D_MODE
in vec4 v_color;
#endif
void main() {vec4 out_color;
#ifdef LIGHTING_3D_MODE
out_color=v_color;
#else
out_color=u_color;
#endif
#ifdef FOG
out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));
#endif
glFragColor=out_color*u_opacity;
#ifdef OVERDRAW_INSPECTOR
glFragColor=vec4(1.0);
#endif
HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
#include "_prelude_lighting.glsl"
in vec2 a_pos;uniform mat4 u_matrix;
#ifdef LIGHTING_3D_MODE
uniform mediump vec4 u_color;out vec4 v_color;uniform float u_emissive_strength;
#endif
void main() {gl_Position=u_matrix*vec4(a_pos,0,1);
#ifdef LIGHTING_3D_MODE
v_color=apply_lighting_with_emission_ground(u_color,u_emissive_strength);
#endif
#ifdef FOG
v_fog_pos=fog_position(a_pos);
#endif
}`),backgroundPattern:ii(`#include "_prelude_fog.fragment.glsl"
#include "_prelude_lighting.glsl"
uniform vec2 u_pattern_tl;uniform vec2 u_pattern_br;uniform vec2 u_texsize;uniform float u_opacity;uniform float u_emissive_strength;uniform sampler2D u_image;in vec2 v_pos;void main() {vec2 imagecoord=mod(v_pos,1.0);vec2 pos=mix(u_pattern_tl/u_texsize,u_pattern_br/u_texsize,imagecoord);vec4 out_color=texture(u_image,pos);
#ifdef LIGHTING_3D_MODE
out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);
#endif
#ifdef FOG
out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));
#endif
glFragColor=out_color*u_opacity;
#ifdef OVERDRAW_INSPECTOR
glFragColor=vec4(1.0);
#endif
HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
uniform mat4 u_matrix;uniform vec2 u_pattern_size;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_tile_units_to_pixels;in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_pattern_size,u_tile_units_to_pixels,a_pos);
#ifdef FOG
v_fog_pos=fog_position(a_pos);
#endif
}`),circle:ii(`#include "_prelude_fog.fragment.glsl"
#include "_prelude_lighting.glsl"
in vec3 v_data;in float v_visibility;
#pragma mapbox: define highp vec4 color
#pragma mapbox: define mediump float radius
#pragma mapbox: define lowp float blur
#pragma mapbox: define lowp float opacity
#pragma mapbox: define highp vec4 stroke_color
#pragma mapbox: define mediump float stroke_width
#pragma mapbox: define lowp float stroke_opacity
uniform float u_emissive_strength;void main() {
#pragma mapbox: initialize highp vec4 color
#pragma mapbox: initialize mediump float radius
#pragma mapbox: initialize lowp float blur
#pragma mapbox: initialize lowp float opacity
#pragma mapbox: initialize highp vec4 stroke_color
#pragma mapbox: initialize mediump float stroke_width
#pragma mapbox: initialize lowp float stroke_opacity
vec2 extrude=v_data.xy;float extrude_length=length(extrude);lowp float antialiasblur=v_data.z;float antialiased_blur=-max(blur,antialiasblur);float opacity_t=smoothstep(0.0,antialiased_blur,extrude_length-1.0);float color_t=stroke_width &lt; 0.01 ? 0.0 : smoothstep(
antialiased_blur,0.0,extrude_length-radius/(radius+stroke_width)
);vec4 out_color=mix(color*opacity,stroke_color*stroke_opacity,color_t);
#ifdef LIGHTING_3D_MODE
out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);
#endif
#ifdef FOG
out_color=fog_apply_premultiplied(out_color,v_fog_pos);
#endif
glFragColor=out_color*(v_visibility*opacity_t);
#ifdef OVERDRAW_INSPECTOR
glFragColor=vec4(1.0);
#endif
}`,`#include "_prelude_fog.vertex.glsl"
#include "_prelude_terrain.vertex.glsl"
#define NUM_VISIBILITY_RINGS 2
#define INV_SQRT2 0.70710678
#define ELEVATION_BIAS 0.0001
#define NUM_SAMPLES_PER_RING 16
uniform mat4 u_matrix;uniform mat2 u_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;in vec2 a_pos;
#ifdef PROJECTION_GLOBE_VIEW
in vec3 a_pos_3;in vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;
#endif
out vec3 v_data;out float v_visibility;
#pragma mapbox: define highp vec4 color
#pragma mapbox: define mediump float radius
#pragma mapbox: define lowp float blur
#pragma mapbox: define lowp float opacity
#pragma mapbox: define highp vec4 stroke_color
#pragma mapbox: define mediump float stroke_width
#pragma mapbox: define lowp float stroke_opacity
vec2 calc_offset(vec2 extrusion,float radius,float stroke_width, float view_scale) {return extrusion*(radius+stroke_width)*u_extrude_scale*view_scale;}float cantilevered_elevation(vec2 pos,float radius,float stroke_width,float view_scale) {vec2 c1=pos+calc_offset(vec2(-1,-1),radius,stroke_width,view_scale);vec2 c2=pos+calc_offset(vec2(1,-1),radius,stroke_width,view_scale);vec2 c3=pos+calc_offset(vec2(1,1),radius,stroke_width,view_scale);vec2 c4=pos+calc_offset(vec2(-1,1),radius,stroke_width,view_scale);float h1=elevation(c1)+ELEVATION_BIAS;float h2=elevation(c2)+ELEVATION_BIAS;float h3=elevation(c3)+ELEVATION_BIAS;float h4=elevation(c4)+ELEVATION_BIAS;return max(h4,max(h3,max(h1,h2)));}float circle_elevation(vec2 pos) {
#if defined(TERRAIN)
return elevation(pos)+ELEVATION_BIAS;
#else
return 0.0;
#endif
}vec4 project_vertex(vec2 extrusion,vec4 world_center,vec4 projected_center,float radius,float stroke_width, float view_scale,mat3 surface_vectors) {vec2 sample_offset=calc_offset(extrusion,radius,stroke_width,view_scale);
#ifdef PITCH_WITH_MAP
#ifdef PROJECTION_GLOBE_VIEW
return u_matrix*( world_center+vec4(sample_offset.x*surface_vectors[0]+sample_offset.y*surface_vectors[1],0) );
#else
return u_matrix*( world_center+vec4(sample_offset,0,0) );
#endif
#else
return projected_center+vec4(sample_offset,0,0);
#endif
}float get_sample_step() {
#ifdef PITCH_WITH_MAP
return 2.0*PI/float(NUM_SAMPLES_PER_RING);
#else
return PI/float(NUM_SAMPLES_PER_RING);
#endif
}void main(void) {
#pragma mapbox: initialize highp vec4 color
#pragma mapbox: initialize mediump float radius
#pragma mapbox: initialize lowp float blur
#pragma mapbox: initialize lowp float opacity
#pragma mapbox: initialize highp vec4 stroke_color
#pragma mapbox: initialize mediump float stroke_width
#pragma mapbox: initialize lowp float stroke_opacity
vec2 extrude=vec2(mod(a_pos,2.0)*2.0-1.0);vec2 circle_center=floor(a_pos*0.5);vec4 world_center;mat3 surface_vectors;
#ifdef PROJECTION_GLOBE_VIEW
vec3 pos_normal_3=a_pos_normal_3/16384.0;surface_vectors=globe_mercator_surface_vectors(pos_normal_3,u_up_dir,u_zoom_transition);vec3 surface_extrusion=extrude.x*surface_vectors[0]+extrude.y*surface_vectors[1];vec3 globe_elevation=elevationVector(circle_center)*circle_elevation(circle_center);vec3 globe_pos=a_pos_3+surface_extrusion+globe_elevation;vec3 mercator_elevation=u_up_dir*u_tile_up_scale*circle_elevation(circle_center);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,circle_center,u_tile_id,u_merc_center)+surface_extrusion+mercator_elevation;vec3 pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);world_center=vec4(pos,1);
#else 
surface_vectors=mat3(1.0);float height=circle_elevation(circle_center);world_center=vec4(circle_center,height,1);
#endif
vec4 projected_center=u_matrix*world_center;float view_scale=0.0;
#ifdef PITCH_WITH_MAP
#ifdef SCALE_WITH_MAP
view_scale=1.0;
#else
view_scale=projected_center.w/u_camera_to_center_distance;
#endif
#else
#ifdef SCALE_WITH_MAP
view_scale=u_camera_to_center_distance;
#else
view_scale=projected_center.w;
#endif
#endif
gl_Position=project_vertex(extrude,world_center,projected_center,radius,stroke_width,view_scale,surface_vectors);float visibility=0.0;
#ifdef TERRAIN
float step=get_sample_step();vec4 occlusion_world_center;vec4 occlusion_projected_center;
#ifdef PITCH_WITH_MAP
float cantilevered_height=cantilevered_elevation(circle_center,radius,stroke_width,view_scale);occlusion_world_center=vec4(circle_center,cantilevered_height,1);occlusion_projected_center=u_matrix*occlusion_world_center;
#else
occlusion_world_center=world_center;occlusion_projected_center=projected_center;
#endif
for(int ring=0; ring &lt; NUM_VISIBILITY_RINGS; ring++) {float scale=(float(ring)+1.0)/float(NUM_VISIBILITY_RINGS);for(int i=0; i &lt; NUM_SAMPLES_PER_RING; i++) {vec2 extrusion=vec2(cos(step*float(i)),-sin(step*float(i)))*scale;vec4 frag_pos=project_vertex(extrusion,occlusion_world_center,occlusion_projected_center,radius,stroke_width,view_scale,surface_vectors);visibility+=float(!isOccluded(frag_pos));}}visibility/=float(NUM_VISIBILITY_RINGS)*float(NUM_SAMPLES_PER_RING);
#else
visibility=1.0;
#endif
#ifdef PROJECTION_GLOBE_VIEW
visibility=1.0;
#endif
v_visibility=visibility;lowp float antialiasblur=1.0/u_device_pixel_ratio/(radius+stroke_width);v_data=vec3(extrude.x,extrude.y,antialiasblur);
#ifdef FOG
v_fog_pos=fog_position(world_center.xyz);
#endif
}`),clippingMask:ii("void main() {glFragColor=vec4(1.0);}","in vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),heatmap:ii(`#include "_prelude_fog.fragment.glsl"
uniform highp float u_intensity;in vec2 v_extrude;
#pragma mapbox: define highp float weight
#define GAUSS_COEF 0.3989422804014327
void main() {
#pragma mapbox: initialize highp float weight
float d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);glFragColor=vec4(val,1.0,1.0,1.0);
#ifdef FOG
if (u_is_globe==0) {glFragColor.r*=pow(1.0-fog_opacity(v_fog_pos),2.0);}
#endif
#ifdef OVERDRAW_INSPECTOR
glFragColor=vec4(1.0);
#endif
HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_terrain.vertex.glsl"
#include "_prelude_fog.vertex.glsl"
uniform mat4 u_matrix;uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;in vec2 a_pos;
#ifdef PROJECTION_GLOBE_VIEW
in vec3 a_pos_3;in vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;
#endif
out vec2 v_extrude;
#pragma mapbox: define highp float weight
#pragma mapbox: define mediump float radius
const highp float ZERO=1.0/255.0/16.0;
#define GAUSS_COEF 0.3989422804014327
void main(void) {
#pragma mapbox: initialize highp float weight
#pragma mapbox: initialize mediump float radius
vec2 unscaled_extrude=vec2(mod(a_pos,2.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 tilePos=floor(a_pos*0.5);vec3 pos;
#ifdef PROJECTION_GLOBE_VIEW
vec3 pos_normal_3=a_pos_normal_3/16384.0;mat3 surface_vectors=globe_mercator_surface_vectors(pos_normal_3,u_up_dir,u_zoom_transition);vec3 surface_extrusion=extrude.x*surface_vectors[0]+extrude.y*surface_vectors[1];vec3 globe_elevation=elevationVector(tilePos)*elevation(tilePos);vec3 globe_pos=a_pos_3+surface_extrusion+globe_elevation;vec3 mercator_elevation=u_up_dir*u_tile_up_scale*elevation(tilePos);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,tilePos,u_tile_id,u_merc_center)+surface_extrusion+mercator_elevation;pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);
#else
pos=vec3(tilePos+extrude,elevation(tilePos));
#endif
gl_Position=u_matrix*vec4(pos,1);
#ifdef FOG
v_fog_pos=fog_position(pos);
#endif
}`),heatmapTexture:ii(`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));glFragColor=color*u_opacity;
#ifdef OVERDRAW_INSPECTOR
glFragColor=vec4(0.0);
#endif
HANDLE_WIREFRAME_DEBUG;}`,"in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=vec4(a_pos,0,1);v_pos=a_pos*0.5+0.5;}"),collisionBox:ii("in float v_placed;in float v_notUsed;void main() {vec4 red =vec4(1.0,0.0,0.0,1.0);vec4 blue=vec4(0.0,0.0,1.0,0.5);glFragColor =mix(red,blue,step(0.5,v_placed))*0.5;glFragColor*=mix(1.0,0.1,step(0.5,v_notUsed));}",`#include "_prelude_terrain.vertex.glsl"
in vec3 a_pos;in vec2 a_anchor_pos;in vec2 a_extrude;in vec2 a_placed;in vec2 a_shift;in float a_size_scale;in vec2 a_padding;in float a_z_offset;uniform mat4 u_matrix;uniform vec2 u_extrude_scale;uniform float u_camera_to_center_distance;out float v_placed;out float v_notUsed;void main() {vec4 projectedPoint=u_matrix*vec4(a_pos+elevationVector(a_anchor_pos)*(a_z_offset+elevation(a_anchor_pos)),1);highp float camera_to_anchor_distance=projectedPoint.w;highp float collision_perspective_ratio=clamp(
0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,1.5);gl_Position=projectedPoint;gl_Position.xy+=(a_extrude*a_size_scale+a_shift+a_padding)*u_extrude_scale*gl_Position.w*collision_perspective_ratio;v_placed=a_placed.x;v_notUsed=a_placed.y;}`),collisionCircle:ii("in float v_radius;in vec2 v_extrude;in float v_perspective_ratio;in float v_collision;void main() {float alpha=0.5*min(v_perspective_ratio,1.0);float stroke_radius=0.9*max(v_perspective_ratio,1.0);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);glFragColor=color*alpha*opacity_t;}",`in vec2 a_pos_2f;in float a_radius;in vec2 a_flags;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform vec2 u_viewport_size;uniform float u_camera_to_center_distance;out float v_radius;out vec2 v_extrude;out float v_perspective_ratio;out float v_collision;vec3 toTilePosition(vec2 screenPos) {vec4 rayStart=u_inv_matrix*vec4(screenPos,-1.0,1.0);vec4 rayEnd  =u_inv_matrix*vec4(screenPos, 1.0,1.0);rayStart.xyz/=rayStart.w;rayEnd.xyz  /=rayEnd.w;highp float t=(0.0-rayStart.z)/(rayEnd.z-rayStart.z);return mix(rayStart.xyz,rayEnd.xyz,t);}void main() {vec2 quadCenterPos=a_pos_2f;float radius=a_radius;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2(
mix(-1.0,1.0,float(vertexIdx &gt;=2.0)),mix(-1.0,1.0,float(vertexIdx &gt;=1.0 &amp;&amp; vertexIdx &lt;=2.0)));vec2 quadVertexExtent=quadVertexOffset*radius;vec3 tilePos=toTilePosition(quadCenterPos);vec4 clipPos=u_matrix*vec4(tilePos,1.0);highp float camera_to_anchor_distance=clipPos.w;highp float collision_perspective_ratio=clamp(
0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_perspective_ratio=collision_perspective_ratio;v_collision=collision;gl_Position=vec4(clipPos.xyz/clipPos.w,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}`),debug:ii("uniform highp vec4 u_color;uniform sampler2D u_overlay;in vec2 v_uv;void main() {vec4 overlay_color=texture(u_overlay,v_uv);glFragColor=mix(u_color,overlay_color,overlay_color.a);}",`#include "_prelude_terrain.vertex.glsl"
in vec2 a_pos;
#ifdef PROJECTION_GLOBE_VIEW
in vec3 a_pos_3;
#endif
out vec2 v_uv;uniform mat4 u_matrix;uniform float u_overlay_scale;void main() {float h=elevation(a_pos);v_uv=a_pos/8192.0;
#ifdef PROJECTION_GLOBE_VIEW
gl_Position=u_matrix*vec4(a_pos_3+elevationVector(a_pos)*h,1);
#else
gl_Position=u_matrix*vec4(a_pos*u_overlay_scale,h,1);
#endif
}`),fill:ii(`#include "_prelude_fog.fragment.glsl"
#include "_prelude_lighting.glsl"
#pragma mapbox: define highp vec4 color
#pragma mapbox: define lowp float opacity
uniform float u_emissive_strength;void main() {
#pragma mapbox: initialize highp vec4 color
#pragma mapbox: initialize lowp float opacity
vec4 out_color=color;
#ifdef LIGHTING_3D_MODE
out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);
#endif
#ifdef FOG
out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));
#endif
glFragColor=out_color*opacity;
#ifdef OVERDRAW_INSPECTOR
glFragColor=vec4(1.0);
#endif
HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
in vec2 a_pos;uniform mat4 u_matrix;
#pragma mapbox: define highp vec4 color
#pragma mapbox: define lowp float opacity
void main() {
#pragma mapbox: initialize highp vec4 color
#pragma mapbox: initialize lowp float opacity
gl_Position=u_matrix*vec4(a_pos,0,1);
#ifdef FOG
v_fog_pos=fog_position(a_pos);
#endif
}`),fillOutline:ii(`#include "_prelude_fog.fragment.glsl"
#include "_prelude_lighting.glsl"
in vec2 v_pos;uniform float u_emissive_strength;
#pragma mapbox: define highp vec4 outline_color
#pragma mapbox: define lowp float opacity
void main() {
#pragma mapbox: initialize highp vec4 outline_color
#pragma mapbox: initialize lowp float opacity
float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);vec4 out_color=outline_color;
#ifdef LIGHTING_3D_MODE
out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);
#endif
#ifdef FOG
out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));
#endif
glFragColor=out_color*(alpha*opacity);
#ifdef OVERDRAW_INSPECTOR
glFragColor=vec4(1.0);
#endif
HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
in vec2 a_pos;uniform mat4 u_matrix;uniform vec2 u_world;out vec2 v_pos;
#pragma mapbox: define highp vec4 outline_color
#pragma mapbox: define lowp float opacity
void main() {
#pragma mapbox: initialize highp vec4 outline_color
#pragma mapbox: initialize lowp float opacity
gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;
#ifdef FOG
v_fog_pos=fog_position(a_pos);
#endif
}`),fillOutlinePattern:ii(`#include "_prelude_fog.fragment.glsl"
#include "_prelude_lighting.glsl"
uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_emissive_strength;in vec2 v_pos;in vec2 v_pos_world;
#pragma mapbox: define lowp float opacity
#pragma mapbox: define lowp vec4 pattern
void main() {
#pragma mapbox: initialize lowp float opacity
#pragma mapbox: initialize mediump vec4 pattern
vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 imagecoord=mod(v_pos,1.0);vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);float dist=length(v_pos_world-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);vec4 out_color=texture(u_image,pos);
#ifdef LIGHTING_3D_MODE
out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);
#endif
#ifdef FOG
out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));
#endif
glFragColor=out_color*(alpha*opacity);
#ifdef OVERDRAW_INSPECTOR
glFragColor=vec4(1.0);
#endif
HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
uniform mat4 u_matrix;uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_tile_units_to_pixels;in vec2 a_pos;out vec2 v_pos;out vec2 v_pos_world;
#pragma mapbox: define lowp float opacity
#pragma mapbox: define lowp vec4 pattern
#pragma mapbox: define lowp float pixel_ratio
void main() {
#pragma mapbox: initialize lowp float opacity
#pragma mapbox: initialize mediump vec4 pattern
#pragma mapbox: initialize lowp float pixel_ratio
vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;gl_Position=u_matrix*vec4(a_pos,0,1);vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,a_pos);v_pos_world=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;
#ifdef FOG
v_fog_pos=fog_position(a_pos);
#endif
}`),fillPattern:ii(`#include "_prelude_fog.fragment.glsl"
#include "_prelude_lighting.glsl"
uniform vec2 u_texsize;uniform sampler2D u_image;in vec2 v_pos;uniform float u_emissive_strength;
#pragma mapbox: define lowp float opacity
#pragma mapbox: define lowp vec4 pattern
void main() {
#pragma mapbox: initialize lowp float opacity
#pragma mapbox: initialize mediump vec4 pattern
vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 imagecoord=mod(v_pos,1.0);vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);vec4 out_color=texture(u_image,pos);
#ifdef LIGHTING_3D_MODE
out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);
#endif
#ifdef FOG
out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));
#endif
glFragColor=out_color*opacity;
#ifdef OVERDRAW_INSPECTOR
glFragColor=vec4(1.0);
#endif
HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_tile_units_to_pixels;in vec2 a_pos;out vec2 v_pos;
#pragma mapbox: define lowp float opacity
#pragma mapbox: define lowp vec4 pattern
#pragma mapbox: define lowp float pixel_ratio
void main() {
#pragma mapbox: initialize lowp float opacity
#pragma mapbox: initialize mediump vec4 pattern
#pragma mapbox: initialize lowp float pixel_ratio
vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,a_pos);
#ifdef FOG
v_fog_pos=fog_position(a_pos);
#endif
}`),fillExtrusion:ii(`#include "_prelude_fog.fragment.glsl"
#include "_prelude_shadow.fragment.glsl"
#include "_prelude_lighting.glsl"
in vec4 v_color;in vec4 v_flat;
#ifdef RENDER_SHADOWS
in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in float v_depth;
#endif
uniform lowp float u_opacity;
#ifdef FAUX_AO
uniform lowp vec2 u_ao;in vec2 v_ao;
#endif
#if defined(ZERO_ROOF_RADIUS) &amp;&amp; !defined(LIGHTING_3D_MODE)
in vec4 v_roof_color;
#endif
#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE)
in highp vec3 v_normal;
#endif
uniform vec3 u_flood_light_color;uniform highp float u_vertical_scale;uniform float u_flood_light_intensity;uniform vec3 u_ground_shadow_factor;
#if defined(LIGHTING_3D_MODE) &amp;&amp; defined(FLOOD_LIGHT)
in float v_flood_radius;in float v_has_floodlight;
#endif
uniform float u_emissive_strength;in float v_height;void main() {
#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE)
vec3 normal=normalize(v_normal);
#endif
float z;vec4 color=v_color;
#ifdef ZERO_ROOF_RADIUS
z=float(normal.z &gt; 0.00001);
#ifdef LIGHTING_3D_MODE
normal=mix(normal,vec3(0.0,0.0,1.0),z);
#else
color=mix(v_color,v_roof_color,z);
#endif
#endif
float h=max(0.0,v_height);float ao_shade=1.0;
#ifdef FAUX_AO
float intensity=u_ao[0];float h_floors=h/(u_ao[1]*u_vertical_scale);float y_shade=1.0-0.9*intensity*min(v_ao.y,1.0);ao_shade=(1.0-0.08*intensity)*(y_shade+(1.0-y_shade)*(1.0-pow(1.0-min(h_floors/16.0,1.0),16.0)))+0.08*intensity*min(h_floors/160.0,1.0);float concave=v_ao.x*v_ao.x;
#ifdef ZERO_ROOF_RADIUS
concave*=(1.0-z);
#endif
float x_shade=mix(1.0,mix(0.6,0.75,min(h_floors/30.0,1.0)),intensity)+0.1*intensity*min(h,1.0);ao_shade*=mix(1.0,x_shade*x_shade*x_shade,concave);
#ifdef LIGHTING_3D_MODE
#ifdef FLOOD_LIGHT
color.rgb*=mix(ao_shade,1.0,v_has_floodlight);
#else
color.rgb*=ao_shade;
#endif
#else
color.rgb*=ao_shade;
#endif
#endif
#ifdef LIGHTING_3D_MODE
float flood_radiance=0.0;
#ifdef FLOOD_LIGHT
flood_radiance=(1.0-min(h/v_flood_radius,1.0))*u_flood_light_intensity*v_has_floodlight;
#endif
#ifdef RENDER_SHADOWS
#ifdef FLOOD_LIGHT
float ndotl_unclamped=dot(normal,u_shadow_direction);float ndotl=max(0.0,ndotl_unclamped);float occlusion=ndotl_unclamped &lt; 0.0 ? 1.0 : shadow_occlusion(ndotl,v_pos_light_view_0,v_pos_light_view_1,v_depth);vec3 litColor=apply_lighting(color.rgb,normal,(1.0-u_shadow_intensity*occlusion)*ndotl);vec3 floodLitColor=compute_flood_lighting(u_flood_light_color*u_opacity,1.0-u_shadow_intensity,occlusion,u_ground_shadow_factor);color.rgb=mix(litColor,floodLitColor,flood_radiance);
#else
float shadowed_lighting_factor=shadowed_light_factor_normal(normal,v_pos_light_view_0,v_pos_light_view_1,v_depth);color.rgb=apply_lighting(color.rgb,normal,shadowed_lighting_factor);
#endif
#else
color.rgb=apply_lighting(color.rgb,normal);
#ifdef FLOOD_LIGHT
color.rgb=mix(color.rgb,u_flood_light_color*u_opacity,flood_radiance);
#endif
#endif
color.rgb=mix(color.rgb,v_flat.rgb,u_emissive_strength);color*=u_opacity;
#endif
#ifdef FOG
color=fog_dither(fog_apply_premultiplied(color,v_fog_pos,h));
#endif
#ifdef RENDER_CUTOFF
color*=v_cutoff_opacity;
#endif
#ifdef INDICATOR_CUTOUT
color=applyCutout(color);
#endif
glFragColor=color;
#ifdef OVERDRAW_INSPECTOR
glFragColor=vec4(1.0);
#endif
HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
#include "_prelude_terrain.vertex.glsl"
#include "_prelude_shadow.vertex.glsl"
#include "_prelude_lighting.glsl"
#ifdef RENDER_CUTOFF
invariant gl_Position;
#endif
uniform mat4 u_matrix;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform float u_edge_radius;in vec4 a_pos_normal_ed;in vec2 a_centroid_pos;
#ifdef PROJECTION_GLOBE_VIEW
in vec3 a_pos_3;in vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;uniform float u_height_lift;
#endif
uniform highp float u_vertical_scale;out vec4 v_color;out vec4 v_flat;
#ifdef RENDER_SHADOWS
uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out float v_depth;
#endif
#if defined(ZERO_ROOF_RADIUS) &amp;&amp; !defined(LIGHTING_3D_MODE)
out vec4 v_roof_color;
#endif
#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE)
out highp vec3 v_normal;
#endif
#ifdef FAUX_AO
uniform lowp vec2 u_ao;out vec2 v_ao;
#endif
#if defined(LIGHTING_3D_MODE) &amp;&amp; defined(FLOOD_LIGHT)
out float v_flood_radius;out float v_has_floodlight;
#endif
out float v_height;
#pragma mapbox: define highp float base
#pragma mapbox: define highp float height
#pragma mapbox: define highp vec4 color
#pragma mapbox: define highp float flood_light_wall_radius
void main() {
#pragma mapbox: initialize highp float base
#pragma mapbox: initialize highp float height
#pragma mapbox: initialize highp vec4 color
#pragma mapbox: initialize highp float flood_light_wall_radius
base*=u_vertical_scale;height*=u_vertical_scale;vec4 pos_nx=floor(a_pos_normal_ed*0.5);vec4 top_up_ny_start=a_pos_normal_ed-2.0*pos_nx;vec3 top_up_ny=top_up_ny_start.xyz;float x_normal=pos_nx.z/8192.0;vec3 normal=top_up_ny.y==1.0 ? vec3(0.0,0.0,1.0) : normalize(vec3(x_normal,(2.0*top_up_ny.z-1.0)*(1.0-abs(x_normal)),0.0));
#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE)
v_normal=normal;
#endif
base=max(0.0,base);height=max(0.0,top_up_ny.y==0.0 &amp;&amp; top_up_ny.x==1.0 ? height-u_edge_radius : height);float t=top_up_ny.x;vec2 centroid_pos=vec2(0.0);
#if defined(HAS_CENTROID) || defined(TERRAIN)
centroid_pos=a_centroid_pos;
#endif
float ele=0.0;float h=0.0;float c_ele;vec3 pos;
#ifdef TERRAIN
bool flat_roof=centroid_pos.x !=0.0 &amp;&amp; t &gt; 0.0;ele=elevation(pos_nx.xy);c_ele=flat_roof ? centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos) : ele;h=flat_roof ? max(c_ele+height,ele+base+2.0) : ele+(t &gt; 0.0 ? height : base==0.0 ?-5.0 : base);pos=vec3(pos_nx.xy,h);
#else
h=t &gt; 0.0 ? height : base;pos=vec3(pos_nx.xy,h);
#endif
#ifdef PROJECTION_GLOBE_VIEW
float lift=float((t+base) &gt; 0.0)*u_height_lift;h+=lift;vec3 globe_normal=normalize(mix(a_pos_normal_3/16384.0,u_up_dir,u_zoom_transition));vec3 globe_pos=a_pos_3+globe_normal*(u_tile_up_scale*h);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,pos.xy,u_tile_id,u_merc_center)+u_up_dir*u_tile_up_scale*pos.z;pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);
#endif
float hidden=float(centroid_pos.x==0.0 &amp;&amp; centroid_pos.y==1.0);gl_Position=mix(u_matrix*vec4(pos,1),AWAY,hidden);h=h-ele;v_height=h;
#ifdef RENDER_SHADOWS
vec3 shd_pos0=pos;vec3 shd_pos1=pos;
#ifdef NORMAL_OFFSET
vec3 offset=shadow_normal_offset(normal);shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1();
#endif
v_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w;
#endif
float NdotL=0.0;float colorvalue=0.0;
#ifndef LIGHTING_3D_MODE
colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;NdotL=clamp(dot(normal,u_lightpos),0.0,1.0);NdotL=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),NdotL);if (normal.y !=0.0) {float r=0.84;r=mix(0.7,0.98,1.0-u_lightintensity);NdotL*=(
(1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),r,1.0)));}
#endif
#ifdef FAUX_AO
float concave=pos_nx.w-floor(pos_nx.w*0.5)*2.0;float start=top_up_ny_start.w;float y_ground=1.0-clamp(t+base,0.0,1.0);float top_height=height;
#ifdef TERRAIN
top_height=mix(max(c_ele+height,ele+base+2.0),ele+height,float(centroid_pos.x==0.0))-ele;y_ground+=y_ground*5.0/max(3.0,top_height);
#endif
v_ao=vec2(mix(concave,-concave,start),y_ground);NdotL*=(1.0+0.05*(1.0-top_up_ny.y)*u_ao[0]);
#ifdef PROJECTION_GLOBE_VIEW
top_height+=u_height_lift;
#endif
gl_Position.z-=(0.0000006*(min(top_height,500.)+2.0*min(base,500.0)+60.0*concave+3.0*start))*gl_Position.w;
#endif
#ifdef LIGHTING_3D_MODE
#ifdef FLOOD_LIGHT
float is_wall=1.0-float(t &gt; 0.0 &amp;&amp; top_up_ny.y &gt; 0.0);v_has_floodlight=float(flood_light_wall_radius &gt; 0.0 &amp;&amp; is_wall &gt; 0.0);v_flood_radius=flood_light_wall_radius*u_vertical_scale;
#endif
v_color=vec4(color.rgb,1.0);v_flat=vec4(linearProduct(color.rgb,vec3(calculate_NdotL(normal))),1.0);
#else
v_color=vec4(0.0,0.0,0.0,1.0);v_color.rgb+=clamp(color.rgb*NdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_color*=u_opacity;
#endif
#if defined(ZERO_ROOF_RADIUS) &amp;&amp; !defined(LIGHTING_3D_MODE)
float roofNdotL=clamp(u_lightpos.z,0.0,1.0);roofNdotL=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),roofNdotL);v_roof_color=vec4(0.0,0.0,0.0,1.0);v_roof_color.rgb+=clamp(color.rgb*roofNdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_roof_color*=u_opacity;
#endif
#ifdef FOG
v_fog_pos=fog_position(pos);
#endif
#ifdef RENDER_CUTOFF
v_cutoff_opacity=cutoff_opacity(u_cutoff_params,gl_Position.z);
#endif
}`),fillExtrusionDepth:ii(`in highp float v_depth;void main() {
#ifndef DEPTH_TEXTURE
glFragColor=pack_depth(v_depth);
#endif
}`,`#include "_prelude_terrain.vertex.glsl"
uniform mat4 u_matrix;uniform float u_edge_radius;uniform float u_vertical_scale;in vec4 a_pos_normal_ed;in vec2 a_centroid_pos;
#pragma mapbox: define highp float base
#pragma mapbox: define highp float height
out highp float v_depth;void main() {
#pragma mapbox: initialize highp float base
#pragma mapbox: initialize highp float height
base*=u_vertical_scale;height*=u_vertical_scale;vec3 pos_nx=floor(a_pos_normal_ed.xyz*0.5);mediump vec3 top_up_ny=a_pos_normal_ed.xyz-2.0*pos_nx;base=max(0.0,base);height=max(0.0,top_up_ny.y==0.0 &amp;&amp; top_up_ny.x==1.0 ? height-u_edge_radius : height);float t=top_up_ny.x;vec2 centroid_pos=vec2(0.0);
#if defined(HAS_CENTROID) || defined(TERRAIN)
centroid_pos=a_centroid_pos;
#endif
vec3 pos;
#ifdef TERRAIN
bool flat_roof=centroid_pos.x !=0.0 &amp;&amp; t &gt; 0.0;float ele=elevation(pos_nx.xy);float c_ele=flat_roof ? centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos) : ele;float h=flat_roof ? max(c_ele+height,ele+base+2.0) : ele+(t &gt; 0.0 ? height : base);pos=vec3(pos_nx.xy,h);
#else
pos=vec3(pos_nx.xy,t &gt; 0.0 ? height : base);
#endif
float hidden=float(centroid_pos.x==0.0 &amp;&amp; centroid_pos.y==1.0);gl_Position=mix(u_matrix*vec4(pos,1),AWAY,hidden);v_depth=gl_Position.z/gl_Position.w;}`),fillExtrusionPattern:ii(`#include "_prelude_fog.fragment.glsl"
#include "_prelude_lighting.glsl"
uniform vec2 u_texsize;uniform sampler2D u_image;
#ifdef FAUX_AO
uniform lowp vec2 u_ao;in vec3 v_ao;
#endif
#ifdef LIGHTING_3D_MODE
in vec3 v_normal;
#endif
in vec2 v_pos;in vec4 v_lighting;uniform lowp float u_opacity;
#pragma mapbox: define highp float base
#pragma mapbox: define highp float height
#pragma mapbox: define mediump vec4 pattern
#pragma mapbox: define highp float pixel_ratio
void main() {
#pragma mapbox: initialize highp float base
#pragma mapbox: initialize highp float height
#pragma mapbox: initialize mediump vec4 pattern
#pragma mapbox: initialize highp float pixel_ratio
vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 imagecoord=mod(v_pos,1.0);vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);vec4 out_color=texture(u_image,pos);
#ifdef LIGHTING_3D_MODE
out_color=apply_lighting(out_color,normalize(v_normal))*u_opacity;
#else
out_color=out_color*v_lighting;
#endif
#ifdef FAUX_AO
float intensity=u_ao[0];float h=max(0.0,v_ao.z);float h_floors=h/u_ao[1];float y_shade=1.0-0.9*intensity*min(v_ao.y,1.0);float shade=(1.0-0.08*intensity)*(y_shade+(1.0-y_shade)*(1.0-pow(1.0-min(h_floors/16.0,1.0),16.0)))+0.08*intensity*min(h_floors/160.0,1.0);float concave=v_ao.x*v_ao.x;float x_shade=mix(1.0,mix(0.6,0.75,min(h_floors/30.0,1.0)),intensity)+0.1*intensity*min(h,1.0);shade*=mix(1.0,x_shade*x_shade*x_shade,concave);out_color.rgb=out_color.rgb*shade;
#endif
#ifdef FOG
out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));
#endif
#ifdef INDICATOR_CUTOUT
out_color=applyCutout(out_color);
#endif
glFragColor=out_color;
#ifdef OVERDRAW_INSPECTOR
glFragColor=vec4(1.0);
#endif
HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
#include "_prelude_terrain.vertex.glsl"
#include "_prelude_lighting.glsl"
uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform float u_tile_units_to_pixels;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;in vec4 a_pos_normal_ed;in vec2 a_centroid_pos;
#ifdef PROJECTION_GLOBE_VIEW
in vec3 a_pos_3;in vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;uniform float u_height_lift;
#endif
out vec2 v_pos;out vec4 v_lighting;
#ifdef FAUX_AO
uniform lowp vec2 u_ao;out vec3 v_ao;
#endif
#ifdef LIGHTING_3D_MODE
out vec3 v_normal;
#endif
#pragma mapbox: define highp float base
#pragma mapbox: define highp float height
#pragma mapbox: define mediump vec4 pattern
#pragma mapbox: define highp float pixel_ratio
void main() {
#pragma mapbox: initialize highp float base
#pragma mapbox: initialize highp float height
#pragma mapbox: initialize mediump vec4 pattern
#pragma mapbox: initialize highp float pixel_ratio
vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec4 pos_nx=floor(a_pos_normal_ed*0.5);mediump vec4 top_up_ny_start=a_pos_normal_ed-2.0*pos_nx;mediump vec3 top_up_ny=top_up_ny_start.xyz;float x_normal=pos_nx.z/8192.0;vec3 normal=top_up_ny.y==1.0 ? vec3(0.0,0.0,1.0) : normalize(vec3(x_normal,(2.0*top_up_ny.z-1.0)*(1.0-abs(x_normal)),0.0));float edgedistance=a_pos_normal_ed.w;vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;base=max(0.0,base);height=max(0.0,height);float t=top_up_ny.x;float z=t &gt; 0.0 ? height : base;vec2 centroid_pos=vec2(0.0);
#if defined(HAS_CENTROID) || defined(TERRAIN)
centroid_pos=a_centroid_pos;
#endif
float ele=0.0;float h=z;vec3 p;float c_ele;
#ifdef TERRAIN
bool flat_roof=centroid_pos.x !=0.0 &amp;&amp; t &gt; 0.0;ele=elevation(pos_nx.xy);c_ele=flat_roof ? centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos) : ele;h=flat_roof ? max(c_ele+height,ele+base+2.0) : ele+(t &gt; 0.0 ? height : base==0.0 ?-5.0 : base);p=vec3(pos_nx.xy,h);
#else
p=vec3(pos_nx.xy,z);
#endif
#ifdef PROJECTION_GLOBE_VIEW
float lift=float((t+base) &gt; 0.0)*u_height_lift;h+=lift;vec3 globe_normal=normalize(mix(a_pos_normal_3/16384.0,u_up_dir,u_zoom_transition));vec3 globe_pos=a_pos_3+globe_normal*(u_tile_up_scale*(p.z+lift));vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,p.xy,u_tile_id,u_merc_center)+u_up_dir*u_tile_up_scale*p.z;p=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);
#endif
float hidden=float(centroid_pos.x==0.0 &amp;&amp; centroid_pos.y==1.0);gl_Position=mix(u_matrix*vec4(p,1),AWAY,hidden);vec2 pos=normal.z==1.0
? pos_nx.xy
: vec2(edgedistance,z*u_height_factor);v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float NdotL=0.0;
#ifdef LIGHTING_3D_MODE
NdotL=calculate_NdotL(normal);
#else
NdotL=clamp(dot(normal,u_lightpos),0.0,1.0);NdotL=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),NdotL);
#endif
if (normal.y !=0.0) {float r=0.84;
#ifndef LIGHTING_3D_MODE
r=mix(0.7,0.98,1.0-u_lightintensity);
#endif
NdotL*=(
(1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),r,1.0)));}
#ifdef FAUX_AO
float concave=pos_nx.w-floor(pos_nx.w*0.5)*2.0;float start=top_up_ny_start.w;float y_ground=1.0-clamp(t+base,0.0,1.0);float top_height=height;
#ifdef TERRAIN
top_height=mix(max(c_ele+height,ele+base+2.0),ele+height,float(centroid_pos.x==0.0))-ele;y_ground+=y_ground*5.0/max(3.0,top_height);
#endif
v_ao=vec3(mix(concave,-concave,start),y_ground,h-ele);NdotL*=(1.0+0.05*(1.0-top_up_ny.y)*u_ao[0]);
#ifdef PROJECTION_GLOBE_VIEW
top_height+=u_height_lift;
#endif
gl_Position.z-=(0.0000006*(min(top_height,500.)+2.0*min(base,500.0)+60.0*concave+3.0*start))*gl_Position.w;
#endif
#ifdef LIGHTING_3D_MODE
v_normal=normal;
#else
v_lighting.rgb+=clamp(NdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;
#endif 
#ifdef FOG
v_fog_pos=fog_position(p);
#endif
}`),groundShadow:ii(`#include "_prelude_shadow.fragment.glsl"
precision highp float;uniform vec3 u_ground_shadow_factor;in vec4 v_pos_light_view_0;in vec4 v_pos_light_view_1;in float v_depth;
#ifdef FOG
in float v_fog_opacity;
#endif
void main() {float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);vec3 shadow=mix(u_ground_shadow_factor,vec3(1.0),light);
#ifdef RENDER_CUTOFF
shadow=mix(vec3(1.0),shadow,cutoff_opacity(u_cutoff_params,v_depth));
#endif
#ifdef FOG
shadow=mix(shadow,vec3(1.0),v_fog_opacity);
#endif
#ifdef INDICATOR_CUTOUT
shadow=mix(shadow,vec3(1.0),1.0-applyCutout(vec4(1.0)).r);
#endif
glFragColor=vec4(shadow,1.0);}`,`#include "_prelude_fog.vertex.glsl"
uniform mat4 u_matrix;uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;in vec2 a_pos;out vec4 v_pos_light_view_0;out vec4 v_pos_light_view_1;out float v_depth;
#ifdef FOG
out float v_fog_opacity;
#endif
void main() {gl_Position=u_matrix*vec4(a_pos,0.0,1.0);v_pos_light_view_0=u_light_matrix_0*vec4(a_pos,0.0,1.0);v_pos_light_view_1=u_light_matrix_1*vec4(a_pos,0.0,1.0);v_depth=gl_Position.w;
#ifdef FOG
v_fog_pos=fog_position(a_pos);v_fog_opacity=fog(v_fog_pos);
#endif
}`),fillExtrusionGroundEffect:ii(`uniform highp float u_ao_pass;uniform highp float u_opacity;uniform highp float u_flood_light_intensity;uniform highp vec3 u_flood_light_color;uniform highp float u_attenuation;uniform sampler2D u_fb;uniform float u_fb_size;
#ifdef SDF_SUBPASS
in highp vec2 v_pos;in highp vec4 v_line_segment;in highp float v_flood_light_radius_tile;in highp vec2 v_ao;float line_df(highp vec2 a,highp vec2 b,highp vec2 p) {highp vec2 ba=b-a;highp vec2 pa=p-a;highp float r=clamp(dot(pa,ba)/dot(ba,ba),0.0,1.0);return length(pa-r*ba);}
#ifdef FOG
in highp float v_fog;
#endif
#endif
void main() {
#ifdef CLEAR_SUBPASS
vec4 color=vec4(1.0);
#ifdef CLEAR_FROM_TEXTURE
color=texture(u_fb,gl_FragCoord.xy/vec2(u_fb_size));
#endif
glFragColor=color;
#else
#ifdef SDF_SUBPASS
highp float d=line_df(v_line_segment.xy,v_line_segment.zw,v_pos);highp float effect_radius=mix(v_flood_light_radius_tile,v_ao.y,u_ao_pass);d/=effect_radius;d=min(d,1.0);d=1.0-pow(1.0-d,u_attenuation);highp float effect_intensity=mix(u_flood_light_intensity,v_ao.x,u_ao_pass);highp float fog=1.0;
#ifdef FOG
fog=v_fog;
#endif
#ifdef RENDER_CUTOFF
fog*=v_cutoff_opacity;
#endif
glFragColor=vec4(vec3(0.0),mix(1.0,d,effect_intensity*u_opacity*fog));
#else
vec4 color=mix(vec4(u_flood_light_color,1.0),vec4(vec3(0.0),1.0),u_ao_pass);
#ifdef OVERDRAW_INSPECTOR
color=vec4(1.0);
#endif
glFragColor=color;HANDLE_WIREFRAME_DEBUG;
#endif
#endif
}`,`#include "_prelude_fog.vertex.glsl"
in highp vec4 a_pos_end;in highp float a_angular_offset_factor;in highp float a_hidden_by_landmark;
#ifdef SDF_SUBPASS
out highp vec2 v_pos;out highp vec4 v_line_segment;out highp float v_flood_light_radius_tile;out highp vec2 v_ao;
#ifdef FOG
out highp float v_fog;
#endif
#endif
uniform highp float u_flood_light_intensity;uniform highp mat4 u_matrix;uniform highp float u_ao_pass;uniform highp float u_meter_to_tile;uniform highp float u_edge_radius;uniform highp vec2 u_ao;
#pragma mapbox: define highp float flood_light_ground_radius
const float TANGENT_CUTOFF=4.0;const float NORM=32767.0;void main() {
#pragma mapbox: initialize highp float flood_light_ground_radius
vec2 p=a_pos_end.xy;vec2 q=floor(a_pos_end.zw*0.5);vec2 start_bottom=a_pos_end.zw-q*2.0;float fl_ground_radius=flood_light_ground_radius;
#ifdef FORCE_ABS_FL_GROUND_RADIUS
fl_ground_radius=abs(flood_light_ground_radius);
#endif
float flood_radius_tile=fl_ground_radius*u_meter_to_tile;vec2 v=normalize(q-p);float ao_radius=u_ao.y/3.5;float effect_radius=mix(flood_radius_tile,ao_radius,u_ao_pass)+u_edge_radius;float angular_offset_factor=a_angular_offset_factor/NORM*TANGENT_CUTOFF;float angular_offset=angular_offset_factor*effect_radius;float top=1.0-start_bottom.y;float side=(0.5-start_bottom.x)*2.0;vec2 extrusion_parallel=v*side*mix(1.0,angular_offset,top);vec2 perp=vec2(v.y,-v.x);vec2 extrusion_perp=perp*effect_radius*top;vec3 pos=vec3(mix(q,p,start_bottom.x),0.0);pos.xy+=extrusion_parallel+extrusion_perp;
#ifdef SDF_SUBPASS
v_pos=pos.xy;v_line_segment=vec4(p,q)+perp.xyxy*u_edge_radius;v_flood_light_radius_tile=flood_radius_tile;v_ao=vec2(u_ao.x,ao_radius);
#ifdef FOG
v_fog_pos=fog_position(pos);v_fog=1.0-fog(v_fog_pos);
#endif
#endif
float hidden_by_landmark=0.0;
#ifdef HAS_CENTROID
hidden_by_landmark=a_hidden_by_landmark;
#endif
float isFloodlit=float(fl_ground_radius &gt; 0.0 &amp;&amp; u_flood_light_intensity &gt; 0.0);float hidden=mix(1.0-isFloodlit,isFloodlit,u_ao_pass);hidden+=hidden_by_landmark;gl_Position=mix(u_matrix*vec4(pos,1.0),AWAY,float(hidden &gt; 0.0));
#ifdef RENDER_CUTOFF
v_cutoff_opacity=cutoff_opacity(u_cutoff_params,gl_Position.z);
#endif
}`),hillshadePrepare:ii(`precision highp float;uniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;float getElevation(vec2 coord) {return texture(u_image,coord).r/4.0;}void main() {vec2 epsilon=1.0/u_dimension;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y));float b=getElevation(v_pos+vec2(0,-epsilon.y));float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y));float d=getElevation(v_pos+vec2(-epsilon.x,0));float e=getElevation(v_pos+vec2(epsilon.x,0));float f=getElevation(v_pos+vec2(-epsilon.x,epsilon.y));float g=getElevation(v_pos+vec2(0,epsilon.y));float h=getElevation(v_pos+vec2(epsilon.x,epsilon.y));float exaggerationFactor=u_zoom &lt; 2.0 ? 0.4 : u_zoom &lt; 4.5 ? 0.35 : 0.3;float exaggeration=u_zoom &lt; 15.0 ? (u_zoom-15.0)*exaggerationFactor : 0.0;vec2 deriv=vec2(
(c+e+e+h)-(a+d+d+f),(f+g+g+h)-(a+b+b+c)
)/pow(2.0,exaggeration+(19.2562-u_zoom));glFragColor=clamp(vec4(
deriv.x/2.0+0.5,deriv.y/2.0+0.5,1.0,1.0),0.0,1.0);}`,"uniform mat4 u_matrix;uniform vec2 u_dimension;in vec2 a_pos;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:ii(`#include "_prelude_fog.fragment.glsl"
#include "_prelude_lighting.glsl"
uniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_latrange;uniform vec2 u_light;uniform vec4 u_shadow;uniform vec4 u_highlight;uniform vec4 u_accent;uniform float u_emissive_strength;void main() {vec4 pixel=texture(u_image,v_pos);vec2 deriv=((pixel.rg*2.0)-1.0);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));float slope=atan(1.25*length(deriv)/scaleFactor);float aspect=deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y &gt; 0.0 ? 1.0 :-1.0);float intensity=u_light.x;float azimuth=u_light.y+PI;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_shadow,u_highlight,shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);glFragColor=accent_color*(1.0-shade_color.a)+shade_color;
#ifdef LIGHTING_3D_MODE
glFragColor=apply_lighting_with_emission_ground(glFragColor,u_emissive_strength);
#endif
#ifdef FOG
glFragColor=fog_dither(fog_apply_premultiplied(glFragColor,v_fog_pos));
#endif
#ifdef OVERDRAW_INSPECTOR
glFragColor=vec4(1.0);
#endif
HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
uniform mat4 u_matrix;in vec2 a_pos;in vec2 a_texture_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=a_texture_pos/8192.0;
#ifdef FOG
v_fog_pos=fog_position(a_pos);
#endif
}`),line:ii(`#include "_prelude_fog.fragment.glsl"
#include "_prelude_lighting.glsl"
uniform lowp float u_device_pixel_ratio;uniform float u_alpha_discard_threshold;uniform highp vec2 u_trim_offset;in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale;in highp vec4 v_uv;
#ifdef RENDER_LINE_DASH
uniform sampler2D u_dash_image;in vec2 v_tex;
#endif
#ifdef RENDER_LINE_GRADIENT
uniform sampler2D u_gradient_image;
#endif
float luminance(vec3 c) {return (c.r+c.r+c.b+c.g+c.g+c.g)*0.1667;}uniform float u_emissive_strength;
#pragma mapbox: define highp vec4 color
#pragma mapbox: define lowp float floorwidth
#pragma mapbox: define lowp vec4 dash
#pragma mapbox: define lowp float blur
#pragma mapbox: define lowp float opacity
#pragma mapbox: define lowp float border_width
#pragma mapbox: define lowp vec4 border_color
float linearstep(float edge0,float edge1,float x) {return  clamp((x-edge0)/(edge1-edge0),0.0,1.0);}void main() {
#pragma mapbox: initialize highp vec4 color
#pragma mapbox: initialize lowp float floorwidth
#pragma mapbox: initialize lowp vec4 dash
#pragma mapbox: initialize lowp float blur
#pragma mapbox: initialize lowp float opacity
#pragma mapbox: initialize lowp float border_width
#pragma mapbox: initialize lowp vec4 border_color
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);
#ifdef RENDER_LINE_DASH
float sdfdist=texture(u_dash_image,v_tex).a;float sdfgamma=1.0/(2.0*u_device_pixel_ratio)/dash.z;alpha*=linearstep(0.5-sdfgamma/floorwidth,0.5+sdfgamma/floorwidth,sdfdist);
#endif
highp vec4 out_color;
#ifdef RENDER_LINE_GRADIENT
out_color=texture(u_gradient_image,v_uv.xy);
#else
out_color=color;
#endif
float trimmed=1.0;
#ifdef RENDER_LINE_TRIM_OFFSET
highp float start=v_uv[2];highp float end=v_uv[3];highp float trim_start=u_trim_offset[0];highp float trim_end=u_trim_offset[1];highp float line_progress=(start+(v_uv.x)*(end-start));if (trim_end &gt; trim_start) {if (line_progress &lt;=trim_end &amp;&amp; line_progress &gt;=trim_start) {out_color=vec4(0,0,0,0);trimmed=0.0;}}
#endif
if (u_alpha_discard_threshold !=0.0) {if (alpha &lt; u_alpha_discard_threshold) {discard;}}
#ifdef RENDER_LINE_BORDER
float edgeBlur=(border_width+1.0/u_device_pixel_ratio);float alpha2=clamp(min(dist-(v_width2.t-edgeBlur),v_width2.s-dist)/edgeBlur,0.0,1.0);if (alpha2 &lt; 1.) {float smoothAlpha=smoothstep(0.6,1.0,alpha2);if (border_color.a==0.0) {    
float Y=(out_color.a &gt; 0.01) ? luminance(out_color.rgb/out_color.a) : 1.;float adjustment=(Y &gt; 0.) ? 0.5/Y : 0.45;if (out_color.a &gt; 0.25 &amp;&amp; Y &lt; 0.25) {vec3 borderColor=(Y &gt; 0.) ? out_color.rgb : vec3(1,1,1)*out_color.a;out_color.rgb=out_color.rgb+borderColor*(adjustment*(1.0-smoothAlpha));} else {out_color.rgb*=(0.6 +0.4*smoothAlpha);}} else {out_color.rgb=mix(border_color.rgb*border_color.a*trimmed,out_color.rgb,smoothAlpha);}}
#endif
#ifdef LIGHTING_3D_MODE
out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);
#endif
#ifdef FOG
out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));
#endif
out_color*=(alpha*opacity);
#ifdef INDICATOR_CUTOUT
out_color=applyCutout(out_color);
#endif
glFragColor=out_color;
#ifdef OVERDRAW_INSPECTOR
glFragColor=vec4(1.0);
#endif
HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
#define EXTRUDE_SCALE 0.015873016
in vec2 a_pos_normal;in vec4 a_data;
#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET)
in highp vec4 a_packed;
#endif
#ifdef RENDER_LINE_DASH
in float a_linesofar;
#endif
uniform mat4 u_matrix;uniform mat2 u_pixels_to_tile_units;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;out vec2 v_normal;out vec2 v_width2;out float v_gamma_scale;out highp vec4 v_uv;
#ifdef RENDER_LINE_DASH
uniform vec2 u_texsize;uniform float u_tile_units_to_pixels;out vec2 v_tex;
#endif
#ifdef RENDER_LINE_GRADIENT
uniform float u_image_height;
#endif
#pragma mapbox: define highp vec4 color
#pragma mapbox: define lowp float floorwidth
#pragma mapbox: define lowp vec4 dash
#pragma mapbox: define lowp float blur
#pragma mapbox: define lowp float opacity
#pragma mapbox: define mediump float gapwidth
#pragma mapbox: define lowp float offset
#pragma mapbox: define mediump float width
#pragma mapbox: define lowp float border_width
#pragma mapbox: define lowp vec4 border_color
void main() {
#pragma mapbox: initialize highp vec4 color
#pragma mapbox: initialize lowp float floorwidth
#pragma mapbox: initialize lowp vec4 dash
#pragma mapbox: initialize lowp float blur
#pragma mapbox: initialize lowp float opacity
#pragma mapbox: initialize mediump float gapwidth
#pragma mapbox: initialize lowp float offset
#pragma mapbox: initialize mediump float width
#pragma mapbox: initialize lowp float border_width
#pragma mapbox: initialize lowp vec4 border_color
float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;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 &gt; 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth &gt; 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*EXTRUDE_SCALE;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*EXTRUDE_SCALE*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist*u_pixels_to_tile_units,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,0.0,1.0)+projected_extrude;
#ifndef RENDER_TO_TEXTURE
float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
#else
v_gamma_scale=1.0;
#endif
#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET)
float a_uv_x=a_packed[0];float a_split_index=a_packed[1];highp float a_clip_start=a_packed[2];highp float a_clip_end=a_packed[3];
#ifdef RENDER_LINE_GRADIENT
highp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec4(a_uv_x,a_split_index*texel_height-half_texel_height,a_clip_start,a_clip_end);
#else
v_uv=vec4(a_uv_x,0.0,a_clip_start,a_clip_end);
#endif
#endif
#ifdef RENDER_LINE_DASH
float scale=dash.z==0.0 ? 0.0 : u_tile_units_to_pixels/dash.z;float height=dash.y;v_tex=vec2(a_linesofar*scale/floorwidth,(-normal.y*height+dash.x+0.5)/u_texsize.y);
#endif
v_width2=vec2(outset,inset);
#ifdef FOG
v_fog_pos=fog_position(pos);
#endif
}`),linePattern:ii(`#include "_prelude_fog.fragment.glsl"
#include "_prelude_lighting.glsl"
uniform lowp float u_device_pixel_ratio;uniform vec2 u_texsize;uniform float u_tile_units_to_pixels;uniform sampler2D u_image;in vec2 v_normal;in vec2 v_width2;in float v_linesofar;in float v_gamma_scale;in float v_width;
#pragma mapbox: define lowp vec4 pattern
#pragma mapbox: define lowp float pixel_ratio
#pragma mapbox: define lowp float blur
#pragma mapbox: define lowp float opacity
void main() {
#pragma mapbox: initialize mediump vec4 pattern
#pragma mapbox: initialize lowp float pixel_ratio
#pragma mapbox: initialize lowp float blur
#pragma mapbox: initialize lowp float opacity
vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;vec2 pattern_size=vec2(display_size.x/u_tile_units_to_pixels,display_size.y);float aspect=display_size.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=mod(v_linesofar/pattern_size.x*aspect,1.0);float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;vec2 pos=mix(pattern_tl*texel_size-texel_size,pattern_br*texel_size+texel_size,vec2(x,y));vec4 color=texture(u_image,pos);
#ifdef LIGHTING_3D_MODE
color=apply_lighting_ground(color);
#endif
#ifdef FOG
color=fog_dither(fog_apply_premultiplied(color,v_fog_pos));
#endif
color*=(alpha*opacity);
#ifdef INDICATOR_CUTOUT
color=applyCutout(color);
#endif
glFragColor=color;
#ifdef OVERDRAW_INSPECTOR
glFragColor=vec4(1.0);
#endif
HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
#define scale 0.015873016
in vec2 a_pos_normal;in vec4 a_data;in float a_linesofar;uniform mat4 u_matrix;uniform vec2 u_units_to_pixels;uniform mat2 u_pixels_to_tile_units;uniform lowp float u_device_pixel_ratio;out vec2 v_normal;out vec2 v_width2;out float v_linesofar;out float v_gamma_scale;out float v_width;
#pragma mapbox: define lowp float blur
#pragma mapbox: define lowp float opacity
#pragma mapbox: define lowp float offset
#pragma mapbox: define mediump float gapwidth
#pragma mapbox: define mediump float width
#pragma mapbox: define lowp float floorwidth
#pragma mapbox: define lowp vec4 pattern
#pragma mapbox: define lowp float pixel_ratio
void main() {
#pragma mapbox: initialize lowp float blur
#pragma mapbox: initialize lowp float opacity
#pragma mapbox: initialize lowp float offset
#pragma mapbox: initialize mediump float gapwidth
#pragma mapbox: initialize mediump float width
#pragma mapbox: initialize lowp float floorwidth
#pragma mapbox: initialize mediump vec4 pattern
#pragma mapbox: initialize lowp float pixel_ratio
float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;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 &gt; 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth &gt; 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);vec4 projected_extrude=u_matrix*vec4(dist*u_pixels_to_tile_units,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,0.0,1.0)+projected_extrude;
#ifndef RENDER_TO_TEXTURE
float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
#else
v_gamma_scale=1.0;
#endif
v_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;
#ifdef FOG
v_fog_pos=fog_position(pos);
#endif
}`),raster:ii(`#include "_prelude_fog.fragment.glsl"
#include "_prelude_lighting.glsl"
#include "_prelude_raster_array.glsl"
uniform float u_fade_t;uniform float u_opacity;uniform highp float u_raster_elevation;in vec2 v_pos0;in vec2 v_pos1;in float v_depth;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;uniform float u_emissive_strength;
#ifndef RASTER_ARRAY
uniform sampler2D u_image0;uniform sampler2D u_image1;
#endif
#ifdef RASTER_COLOR
uniform sampler2D u_color_ramp;uniform highp vec4 u_colorization_mix;uniform highp float u_colorization_offset;uniform vec2 u_texture_res;
#endif
void main() {vec4 color0,color1,color;vec2 value;
#ifdef RASTER_COLOR
#ifdef RASTER_ARRAY
#ifdef RASTER_ARRAY_LINEAR
value=mix(
raTexture2D_image0_linear(v_pos0,u_texture_res,u_colorization_mix,u_colorization_offset),raTexture2D_image1_linear(v_pos1,u_texture_res,u_colorization_mix,u_colorization_offset),u_fade_t
);
#else
value=mix(
raTexture2D_image0_nearest(v_pos0,u_texture_res,u_colorization_mix,u_colorization_offset),raTexture2D_image1_nearest(v_pos1,u_texture_res,u_colorization_mix,u_colorization_offset),u_fade_t
);
#endif
if (value.y &gt; 0.0) value.x/=value.y;
#else
color=mix(texture(u_image0,v_pos0),texture(u_image1,v_pos1),u_fade_t);value=vec2(u_colorization_offset+dot(color.rgb,u_colorization_mix.rgb),color.a);
#endif
color=texture(u_color_ramp,vec2(value.x,0.5));if (color.a &gt; 0.0) color.rgb/=color.a;color.a*=value.y;
#else
color0=texture(u_image0,v_pos0);color1=texture(u_image1,v_pos1);if (color0.a &gt; 0.0) color0.rgb/=color0.a;if (color1.a &gt; 0.0) color1.rgb/=color1.a;color=mix(color0,color1,u_fade_t);
#endif
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);vec3 out_color=mix(u_high_vec,u_low_vec,rgb);
#ifdef LIGHTING_3D_MODE
out_color=apply_lighting_with_emission_ground(vec4(out_color,1.0),u_emissive_strength).rgb;
#endif
#ifdef FOG
highp float fog_limit_high_meters=1000000.0;highp float fog_limit_low_meters=600000.0;float fog_limit=1.0-smoothstep(fog_limit_low_meters,fog_limit_high_meters,u_raster_elevation);out_color=fog_dither(fog_apply(out_color,v_fog_pos,fog_limit));
#endif
glFragColor=vec4(out_color*color.a,color.a);
#ifdef RENDER_CUTOFF
glFragColor=glFragColor*cutoff_opacity(u_cutoff_params,v_depth);
#endif
#ifdef OVERDRAW_INSPECTOR
glFragColor=vec4(1.0);
#endif
HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
uniform mat4 u_matrix;uniform mat4 u_normalize_matrix;uniform mat4 u_globe_matrix;uniform mat4 u_merc_matrix;uniform mat3 u_grid_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform vec2 u_perspective_transform;uniform vec2 u_texture_offset;uniform float u_raster_elevation;uniform vec4 u_tl_br;uniform float u_zoom_transition;uniform vec2 u_merc_center;
#define GLOBE_UPSCALE GLOBE_RADIUS/6371008.8;
#ifdef GLOBE_POLES
in vec3 a_globe_pos;in vec2 a_uv;
#elif defined(PROJECTION_GLOBE_VIEW)
in vec2 a_pos;
#else
in vec2 a_pos;in vec2 a_texture_pos;
#endif
out vec2 v_pos0;out vec2 v_pos1;out float v_depth;void main() {vec2 uv;
#ifdef GLOBE_POLES
vec3 globe_pos=a_globe_pos;globe_pos+=normalize(globe_pos)*u_raster_elevation*GLOBE_UPSCALE;gl_Position=u_matrix*u_globe_matrix*vec4(globe_pos   ,1.0);uv=a_uv;
#ifdef FOG
v_fog_pos=fog_position((u_normalize_matrix*vec4(a_globe_pos,1.0)).xyz);
#endif
#else
#ifdef PROJECTION_GLOBE_VIEW
vec3 decomposed_pos_and_skirt=decomposeToPosAndSkirt(a_pos);vec3 latLng=u_grid_matrix*vec3(decomposed_pos_and_skirt.xy,1.0);vec2 globe_tl=vec2(u_tl_br.x,u_tl_br.y);vec2 globe_br=vec2(u_tl_br.z,u_tl_br.w);float mercatorY=mercatorYfromLat(latLng[0]);float uvY=1.0-((mercatorY-globe_br.y)/(globe_tl.y-globe_br.y));float mercatorX=mercatorXfromLng(latLng[1]);float uvX=(mercatorX-globe_br.x)/(globe_tl.x-globe_br.x);vec3 globe_pos=latLngToECEF(latLng.xy);vec2 merc_pos=vec2(mercatorX,mercatorY);uv=vec2(uvX,uvY);globe_pos+=normalize(globe_pos)*u_raster_elevation*GLOBE_UPSCALE;vec4 globe_world_pos=u_globe_matrix*vec4(globe_pos,1.0);vec4 merc_world_pos=vec4(0.0);if (u_zoom_transition &gt; 0.0) {merc_world_pos=vec4(merc_pos,u_raster_elevation,1.0);merc_world_pos.xy-=u_merc_center;merc_world_pos.x=wrap(merc_world_pos.x,-0.5,0.5);merc_world_pos=u_merc_matrix*merc_world_pos;}vec4 interpolated_pos=vec4(mix(globe_world_pos.xyz,merc_world_pos.xyz,u_zoom_transition),1.0);gl_Position=u_matrix*interpolated_pos;
#ifdef FOG
v_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz);
#endif
#else
float w=1.0+dot(a_texture_pos,u_perspective_transform);gl_Position=u_matrix*vec4(a_pos*w,u_raster_elevation,w);
#ifdef FOG
v_fog_pos=fog_position(a_pos);
#endif
uv=a_texture_pos/8192.0;
#endif
#endif
v_pos0=uv;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;v_pos0=u_texture_offset.x+u_texture_offset.y*v_pos0;v_pos1=u_texture_offset.x+u_texture_offset.y*v_pos1;
#ifdef RENDER_CUTOFF
v_depth=gl_Position.z;
#endif
}`),symbolIcon:ii(`#include "_prelude_lighting.glsl"
uniform sampler2D u_texture;
#ifdef ICON_TRANSITION
uniform float u_icon_transition;
#endif
in float v_fade_opacity;in vec2 v_tex_a;
#ifdef ICON_TRANSITION
in vec2 v_tex_b;
#endif
uniform mediump float u_icon_saturation;
#pragma mapbox: define lowp float opacity
#pragma mapbox: define lowp float emissive_strength
void main() {
#pragma mapbox: initialize lowp float opacity
#pragma mapbox: initialize lowp float emissive_strength
lowp float alpha=opacity*v_fade_opacity;vec4 out_color;
#ifdef ICON_TRANSITION
vec4 a=texture(u_texture,v_tex_a)*(1.0-u_icon_transition);vec4 b=texture(u_texture,v_tex_b)*u_icon_transition;out_color=(a+b)*alpha;
#else
out_color=texture(u_texture,v_tex_a)*alpha;
#endif
#ifdef SATURATION
vec3 luma=vec3(dot(out_color.rgb,vec3(0.2126,0.7152,0.0722)));out_color.rgb=mix(luma,out_color.rgb,u_icon_saturation);
#endif
#ifdef LIGHTING_3D_MODE
out_color=apply_lighting_with_emission_ground(out_color,emissive_strength);
#endif
glFragColor=out_color;
#ifdef OVERDRAW_INSPECTOR
glFragColor=vec4(1.0);
#endif
HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_terrain.vertex.glsl"
in vec4 a_pos_offset;in vec4 a_tex_size;in vec4 a_pixeloffset;in vec4 a_projected_pos;in float a_fade_opacity;
#ifdef Z_OFFSET
in float a_z_offset;
#endif
#ifdef PROJECTION_GLOBE_VIEW
in vec3 a_globe_anchor;in vec3 a_globe_normal;
#endif
#ifdef ICON_TRANSITION
in vec2 a_texb;
#endif
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 bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform float u_fade_change;uniform mat4 u_matrix;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 vec3 u_up_vector;
#ifdef PROJECTION_GLOBE_VIEW
uniform vec3 u_tile_id;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_camera_forward;uniform float u_zoom_transition;uniform vec3 u_ecef_origin;uniform mat4 u_tile_matrix;
#endif
out vec2 v_tex_a;
#ifdef ICON_TRANSITION
out vec2 v_tex_b;
#endif
out float v_fade_opacity;
#pragma mapbox: define lowp float opacity
#pragma mapbox: define lowp float emissive_strength
void main() {
#pragma mapbox: initialize lowp float opacity
#pragma mapbox: initialize lowp float emissive_strength
vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_tex_size.xy;vec2 a_size=a_tex_size.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_min_font_scale=a_pixeloffset.zw/256.0;highp float segment_angle=-a_projected_pos[3];float size;if (!u_is_size_zoom_constant &amp;&amp; !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 &amp;&amp; !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 tile_anchor=a_pos;float e=elevation(tile_anchor);
#ifdef Z_OFFSET
e+=a_z_offset;
#endif
vec3 h=elevationVector(tile_anchor)*e;float globe_occlusion_fade;vec3 world_pos;vec3 mercator_pos;
#ifdef PROJECTION_GLOBE_VIEW
mercator_pos=mercator_tile_position(u_inv_rot_matrix,tile_anchor,u_tile_id,u_merc_center);world_pos=mix_globe_mercator(a_globe_anchor+h,mercator_pos,u_zoom_transition);vec4 ecef_point=u_tile_matrix*vec4(world_pos,1.0);vec3 origin_to_point=ecef_point.xyz-u_ecef_origin;globe_occlusion_fade=dot(origin_to_point,u_camera_forward) &gt;=0.0 ? 0.0 : 1.0;
#else
world_pos=vec3(tile_anchor,0)+h;globe_occlusion_fade=1.0;
#endif
vec4 projected_point=u_matrix*vec4(world_pos,1);highp float camera_to_anchor_distance=projected_point.w;highp float distance_ratio=u_pitch_with_map ?
camera_to_anchor_distance/u_camera_to_center_distance :
u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(
0.5+0.5*distance_ratio,0.0,1.5);size*=perspective_ratio;float font_scale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjected_point;
#ifdef PROJECTION_GLOBE_VIEW
vec3 displacement=vec3(a_globe_normal.z,0,-a_globe_normal.x);offsetProjected_point=u_matrix*vec4(a_globe_anchor+displacement,1);
#else
offsetProjected_point=u_matrix*vec4(tile_anchor+vec2(1,0),0,1);
#endif
vec2 a=projected_point.xy/projected_point.w;vec2 b=offsetProjected_point.xy/offsetProjected_point.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}vec4 projected_pos;
#ifdef PROJECTION_GLOBE_VIEW
vec3 proj_pos=mix_globe_mercator(a_projected_pos.xyz+h,mercator_pos,u_zoom_transition);projected_pos=u_label_plane_matrix*vec4(proj_pos,1.0);
#else
projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,h.z,1.0);
#endif
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);float z=0.0;vec2 offset=rotation_matrix*(a_offset/32.0*max(a_min_font_scale,font_scale)+a_pxoffset/16.0);
#ifdef TERRAIN
#ifdef PITCH_WITH_MAP_TERRAIN
vec4 tile_pos=u_label_plane_matrix_inv*vec4(a_projected_pos.xy+offset,0.0,1.0);z=elevation(tile_pos.xy);
#endif
#endif
float occlusion_fade=occlusionFade(projected_point)*globe_occlusion_fade;float projection_transition_fade=1.0;
#if defined(PROJECTED_POS_ON_VIEWPORT) &amp;&amp; defined(PROJECTION_GLOBE_VIEW)
projection_transition_fade=1.0-step(EPSILON,u_zoom_transition);
#endif
vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] &gt; 0.5 ? u_fade_change :-u_fade_change;float out_fade_opacity=max(0.0,min(occlusion_fade,fade_opacity[0]+fade_change))*projection_transition_fade;float alpha=opacity*out_fade_opacity;float hidden=float(alpha==0.0 || projected_point.w &lt;=0.0 || occlusion_fade==0.0);
#ifdef PROJECTION_GLOBE_VIEW
vec3 xAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,u_up_vector)) : vec3(1,0,0);vec3 yAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,xAxis)) : vec3(0,1,0);gl_Position=mix(u_coord_matrix*vec4(projected_pos.xyz/projected_pos.w+xAxis*offset.x+yAxis*offset.y,1.0),AWAY,hidden);
#else
gl_Position=mix(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+offset,z,1.0),AWAY,hidden);
#endif
v_tex_a=a_tex/u_texsize;
#ifdef ICON_TRANSITION
v_tex_b=a_texb/u_texsize;
#endif
v_fade_opacity=out_fade_opacity;}`),symbolSDF:ii(`#include "_prelude_lighting.glsl"
#define SDF_PX 8.0
uniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;uniform bool u_is_halo;flat in float v_draw_halo;in vec2 v_data0;in vec3 v_data1;
#pragma mapbox: define highp vec4 fill_color
#pragma mapbox: define highp vec4 halo_color
#pragma mapbox: define lowp float opacity
#pragma mapbox: define lowp float halo_width
#pragma mapbox: define lowp float halo_blur
#pragma mapbox: define lowp float emissive_strength
void main() {
#pragma mapbox: initialize highp vec4 fill_color
#pragma mapbox: initialize highp vec4 halo_color
#pragma mapbox: initialize lowp float opacity
#pragma mapbox: initialize lowp float halo_width
#pragma mapbox: initialize lowp float halo_blur
#pragma mapbox: initialize lowp float emissive_strength
float 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 fade_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;bool draw_halo=v_draw_halo &gt; 0.0;if (draw_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);vec4 out_color=color*(alpha*opacity*fade_opacity);
#ifdef LIGHTING_3D_MODE
out_color=apply_lighting_with_emission_ground(out_color,emissive_strength);
#endif
glFragColor=out_color;
#ifdef OVERDRAW_INSPECTOR
glFragColor=vec4(1.0);
#endif
HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_terrain.vertex.glsl"
in vec4 a_pos_offset;in vec4 a_tex_size;in vec4 a_pixeloffset;in vec4 a_projected_pos;in float a_fade_opacity;
#ifdef Z_OFFSET
in float a_z_offset;
#endif
#ifdef PROJECTION_GLOBE_VIEW
in vec3 a_globe_anchor;in vec3 a_globe_normal;
#endif
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_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec3 u_up_vector;uniform bool u_is_halo;
#ifdef PROJECTION_GLOBE_VIEW
uniform vec3 u_tile_id;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_camera_forward;uniform float u_zoom_transition;uniform vec3 u_ecef_origin;uniform mat4 u_tile_matrix;
#endif
flat out float v_draw_halo;out vec2 v_data0;out vec3 v_data1;
#pragma mapbox: define highp vec4 fill_color
#pragma mapbox: define highp vec4 halo_color
#pragma mapbox: define lowp float opacity
#pragma mapbox: define lowp float halo_width
#pragma mapbox: define lowp float halo_blur
#pragma mapbox: define lowp float emissive_strength
void main() {
#pragma mapbox: initialize highp vec4 fill_color
#pragma mapbox: initialize highp vec4 halo_color
#pragma mapbox: initialize lowp float opacity
#pragma mapbox: initialize lowp float halo_width
#pragma mapbox: initialize lowp float halo_blur
#pragma mapbox: initialize lowp float emissive_strength
vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_tex_size.xy;vec2 a_size=a_tex_size.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;highp float segment_angle=-a_projected_pos[3];float size;if (!u_is_size_zoom_constant &amp;&amp; !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 &amp;&amp; !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 tile_anchor=a_pos;float e=elevation(tile_anchor);
#ifdef Z_OFFSET
e+=a_z_offset;
#endif
vec3 h=elevationVector(tile_anchor)*e;float globe_occlusion_fade;vec3 world_pos;vec3 mercator_pos;
#ifdef PROJECTION_GLOBE_VIEW
mercator_pos=mercator_tile_position(u_inv_rot_matrix,tile_anchor,u_tile_id,u_merc_center);world_pos=mix_globe_mercator(a_globe_anchor+h,mercator_pos,u_zoom_transition);vec4 ecef_point=u_tile_matrix*vec4(world_pos,1.0);vec3 origin_to_point=ecef_point.xyz-u_ecef_origin;globe_occlusion_fade=dot(origin_to_point,u_camera_forward) &gt;=0.0 ? 0.0 : 1.0;
#else
world_pos=vec3(tile_anchor,0)+h;globe_occlusion_fade=1.0;
#endif
vec4 projected_point=u_matrix*vec4(world_pos,1);highp float camera_to_anchor_distance=projected_point.w;highp float distance_ratio=u_pitch_with_map ?
camera_to_anchor_distance/u_camera_to_center_distance :
u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(
0.5+0.5*distance_ratio,0.0,1.5);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetprojected_point;
#ifdef PROJECTION_GLOBE_VIEW
vec3 displacement=vec3(a_globe_normal.z,0,-a_globe_normal.x);offsetprojected_point=u_matrix*vec4(a_globe_anchor+displacement,1);
#else
offsetprojected_point=u_matrix*vec4(tile_anchor+vec2(1,0),0,1);
#endif
vec2 a=projected_point.xy/projected_point.w;vec2 b=offsetprojected_point.xy/offsetprojected_point.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}vec4 projected_pos;
#ifdef PROJECTION_GLOBE_VIEW
vec3 proj_pos=mix_globe_mercator(a_projected_pos.xyz+h,mercator_pos,u_zoom_transition);projected_pos=u_label_plane_matrix*vec4(proj_pos,1.0);
#else
projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,h.z,1.0);
#endif
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);float z=0.0;vec2 offset=rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset);
#ifdef TERRAIN
#ifdef PITCH_WITH_MAP_TERRAIN
vec4 tile_pos=u_label_plane_matrix_inv*vec4(a_projected_pos.xy+offset,0.0,1.0);z=elevation(tile_pos.xy);
#endif
#endif
float occlusion_fade=occlusionFade(projected_point)*globe_occlusion_fade;float projection_transition_fade=1.0;
#if defined(PROJECTED_POS_ON_VIEWPORT) &amp;&amp; defined(PROJECTION_GLOBE_VIEW)
projection_transition_fade=1.0-step(EPSILON,u_zoom_transition);
#endif
vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] &gt; 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(occlusion_fade,fade_opacity[0]+fade_change));float out_fade_opacity=interpolated_fade_opacity*projection_transition_fade;float alpha=opacity*out_fade_opacity;float hidden=float(alpha==0.0 || projected_point.w &lt;=0.0 || occlusion_fade==0.0);
#ifdef PROJECTION_GLOBE_VIEW
vec3 xAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,u_up_vector)) : vec3(1,0,0);vec3 yAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,xAxis)) : vec3(0,1,0);gl_Position=mix(u_coord_matrix*vec4(projected_pos.xyz/projected_pos.w+xAxis*offset.x+yAxis*offset.y,1.0),AWAY,hidden);
#else
gl_Position=mix(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+offset,z,1.0),AWAY,hidden);
#endif
float gamma_scale=gl_Position.w;v_draw_halo=(u_is_halo &amp;&amp; float(gl_InstanceID)==0.0) ? 1.0 : 0.0;v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,out_fade_opacity);}`),symbolTextAndIcon:ii(`#include "_prelude_lighting.glsl"
#define SDF_PX 8.0
#define SDF 1.0
#define ICON 0.0
uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_halo;flat in float v_draw_halo;in vec4 v_data0;in vec4 v_data1;
#pragma mapbox: define highp vec4 fill_color
#pragma mapbox: define highp vec4 halo_color
#pragma mapbox: define lowp float opacity
#pragma mapbox: define lowp float halo_width
#pragma mapbox: define lowp float halo_blur
#pragma mapbox: define lowp float emissive_strength
void main() {
#pragma mapbox: initialize highp vec4 fill_color
#pragma mapbox: initialize highp vec4 halo_color
#pragma mapbox: initialize lowp float opacity
#pragma mapbox: initialize lowp float halo_width
#pragma mapbox: initialize lowp float halo_blur
#pragma mapbox: initialize lowp float emissive_strength
float fade_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;lowp float alpha=opacity*fade_opacity;glFragColor=texture(u_texture_icon,tex_icon)*alpha;
#ifdef OVERDRAW_INSPECTOR
glFragColor=vec4(1.0);
#endif
return;}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;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;bool draw_halo=v_draw_halo &gt; 0.0;if (draw_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);vec4 out_color=color*(alpha*opacity*fade_opacity);
#ifdef LIGHTING_3D_MODE
out_color=apply_lighting_with_emission_ground(out_color,emissive_strength);
#endif
glFragColor=out_color;
#ifdef OVERDRAW_INSPECTOR
glFragColor=vec4(1.0);
#endif
HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_terrain.vertex.glsl"
in vec4 a_pos_offset;in vec4 a_tex_size;in vec4 a_projected_pos;in float a_fade_opacity;
#ifdef Z_OFFSET
in float a_z_offset;
#endif
#ifdef PROJECTION_GLOBE_VIEW
in vec3 a_globe_anchor;in vec3 a_globe_normal;
#endif
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_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec3 u_up_vector;uniform vec2 u_texsize_icon;uniform bool u_is_halo;
#ifdef PROJECTION_GLOBE_VIEW
uniform vec3 u_tile_id;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_camera_forward;uniform float u_zoom_transition;uniform vec3 u_ecef_origin;uniform mat4 u_tile_matrix;
#endif
flat out float v_draw_halo;out vec4 v_data0;out vec4 v_data1;
#pragma mapbox: define highp vec4 fill_color
#pragma mapbox: define highp vec4 halo_color
#pragma mapbox: define lowp float opacity
#pragma mapbox: define lowp float halo_width
#pragma mapbox: define lowp float halo_blur
#pragma mapbox: define lowp float emissive_strength
void main() {
#pragma mapbox: initialize highp vec4 fill_color
#pragma mapbox: initialize highp vec4 halo_color
#pragma mapbox: initialize lowp float opacity
#pragma mapbox: initialize lowp float halo_width
#pragma mapbox: initialize lowp float halo_blur
#pragma mapbox: initialize lowp float emissive_strength
vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_tex_size.xy;vec2 a_size=a_tex_size.zw;float a_size_min=floor(a_size[0]*0.5);float is_sdf=a_size[0]-2.0*a_size_min;highp float segment_angle=-a_projected_pos[3];float size;if (!u_is_size_zoom_constant &amp;&amp; !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 &amp;&amp; !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 tile_anchor=a_pos;float e=elevation(tile_anchor);
#ifdef Z_OFFSET
e+=a_z_offset;
#endif
vec3 h=elevationVector(tile_anchor)*e;float globe_occlusion_fade;vec3 world_pos;vec3 mercator_pos;
#ifdef PROJECTION_GLOBE_VIEW
mercator_pos=mercator_tile_position(u_inv_rot_matrix,tile_anchor,u_tile_id,u_merc_center);world_pos=mix_globe_mercator(a_globe_anchor+h,mercator_pos,u_zoom_transition);vec4 ecef_point=u_tile_matrix*vec4(world_pos,1.0);vec3 origin_to_point=ecef_point.xyz-u_ecef_origin;globe_occlusion_fade=dot(origin_to_point,u_camera_forward) &gt;=0.0 ? 0.0 : 1.0;
#else
world_pos=vec3(tile_anchor,0)+h;globe_occlusion_fade=1.0;
#endif
vec4 projected_point=u_matrix*vec4(world_pos,1);highp float camera_to_anchor_distance=projected_point.w;highp float distance_ratio=u_pitch_with_map ?
camera_to_anchor_distance/u_camera_to_center_distance :
u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(
0.5+0.5*distance_ratio,0.0,1.5);size*=perspective_ratio;float font_scale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offset_projected_point=u_matrix*vec4(a_pos+vec2(1,0),0,1);vec2 a=projected_point.xy/projected_point.w;vec2 b=offset_projected_point.xy/offset_projected_point.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}vec4 projected_pos;
#ifdef PROJECTION_GLOBE_VIEW
vec3 proj_pos=mix_globe_mercator(a_projected_pos.xyz+h,mercator_pos,u_zoom_transition);projected_pos=u_label_plane_matrix*vec4(proj_pos,1.0);
#else
projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,h.z,1.0);
#endif
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);float z=0.0;vec2 offset=rotation_matrix*(a_offset/32.0*font_scale);
#ifdef TERRAIN
#ifdef PITCH_WITH_MAP_TERRAIN
vec4 tile_pos=u_label_plane_matrix_inv*vec4(a_projected_pos.xy+offset,0.0,1.0);z=elevation(tile_pos.xy);
#endif
#endif
float occlusion_fade=occlusionFade(projected_point)*globe_occlusion_fade;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] &gt; 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(occlusion_fade,fade_opacity[0]+fade_change));float projection_transition_fade=1.0;
#if defined(PROJECTED_POS_ON_VIEWPORT) &amp;&amp; defined(PROJECTION_GLOBE_VIEW)
projection_transition_fade=1.0-step(EPSILON,u_zoom_transition);
#endif
float out_fade_opacity=interpolated_fade_opacity*projection_transition_fade;float alpha=opacity*out_fade_opacity;float hidden=float(alpha==0.0 || projected_point.w &lt;=0.0 || occlusion_fade==0.0);
#ifdef PROJECTION_GLOBE_VIEW
vec3 xAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,u_up_vector)) : vec3(1,0,0);vec3 yAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,xAxis)) : vec3(0,1,0);gl_Position=mix(u_coord_matrix*vec4(projected_pos.xyz/projected_pos.w+xAxis*offset.x+yAxis*offset.y,1.0),AWAY,hidden);
#else
gl_Position=mix(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+offset,z,1.0),AWAY,hidden);
#endif
float gamma_scale=gl_Position.w;v_draw_halo=(u_is_halo &amp;&amp; float(gl_InstanceID)==0.0) ? 1.0 : 0.0;v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,out_fade_opacity,is_sdf);}`),terrainRaster:ii(`#include "_prelude_fog.fragment.glsl"
#include "_prelude_shadow.fragment.glsl"
#include "_prelude_lighting.glsl"
uniform sampler2D u_image0;in vec2 v_pos0;
#ifdef FOG
in float v_fog_opacity;
#endif
#ifdef RENDER_SHADOWS
in vec4 v_pos_light_view_0;in vec4 v_pos_light_view_1;in float v_depth;
#endif
uniform vec3 u_ground_shadow_factor;void main() {vec4 image_color=texture(u_image0,v_pos0);vec4 color;
#ifdef LIGHTING_3D_MODE
const vec3 normal=vec3(0.0,0.0,1.0);
#ifdef RENDER_SHADOWS
float cutoffOpacity=1.0;
#ifdef RENDER_CUTOFF
cutoffOpacity=cutoff_opacity(u_cutoff_params,v_depth);
#endif
#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS
vec3 unlit_base=image_color.rgb*(1.0-image_color.a);vec3 emissive_base=image_color.rgb*image_color.a;float ndotl=u_shadow_direction.z;float occlusion=ndotl &lt; 0.0 ? 1.0 : shadow_occlusion(v_pos_light_view_0,v_pos_light_view_1,v_depth,0.0);ndotl=max(0.0,ndotl);vec3 lit=apply_lighting(unlit_base,normal,mix(1.0,(1.0-(u_shadow_intensity*occlusion))*ndotl,cutoffOpacity));vec3 emissive=compute_emissive_draped(emissive_base,1.0-u_shadow_intensity,occlusion,u_ground_shadow_factor);color.rgb=lit+emissive;color.a=1.0;
#else
float lighting_factor=shadowed_light_factor_normal_unbiased(normal,v_pos_light_view_0,v_pos_light_view_1,v_depth);color=apply_lighting(image_color,normal,mix(1.0,lighting_factor,cutoffOpacity));
#endif
#else
float lighting_factor=u_lighting_directional_dir.z;color=apply_lighting(image_color,normal,lighting_factor);
#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS
color.rgb=mix(color.rgb,image_color.rgb,image_color.a);color.a=1.0;
#endif
#endif
#else
color=image_color;
#endif
#ifdef FOG
#ifdef ZERO_EXAGGERATION
color=fog_dither(fog_apply_premultiplied(color,v_fog_pos));
#else
color=fog_dither(fog_apply_from_vert(color,v_fog_opacity));
#endif
#endif
glFragColor=color;
#ifdef OVERDRAW_INSPECTOR
glFragColor=vec4(1.0);
#endif
HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
#include "_prelude_terrain.vertex.glsl"
uniform mat4 u_matrix;uniform float u_skirt_height;in vec2 a_pos;out vec2 v_pos0;
#ifdef FOG
out float v_fog_opacity;
#endif
#ifdef RENDER_SHADOWS
uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out vec4 v_pos_light_view_0;out vec4 v_pos_light_view_1;out float v_depth;
#endif
void main() {vec3 decomposedPosAndSkirt=decomposeToPosAndSkirt(a_pos);float skirt=decomposedPosAndSkirt.z;vec2 decodedPos=decomposedPosAndSkirt.xy;float elevation=elevation(decodedPos)-skirt*u_skirt_height;v_pos0=decodedPos/8192.0;gl_Position=u_matrix*vec4(decodedPos,elevation,1.0);
#ifdef FOG
#ifdef ZERO_EXAGGERATION
v_fog_pos=fog_position(decodedPos);
#else
v_fog_opacity=fog(fog_position(vec3(decodedPos,elevation)));
#endif
#endif
#ifdef RENDER_SHADOWS
vec3 pos=vec3(decodedPos,elevation);v_pos_light_view_0=u_light_matrix_0*vec4(pos,1.);v_pos_light_view_1=u_light_matrix_1*vec4(pos,1.);v_depth=gl_Position.w;
#endif
}`),terrainDepth:ii("precision highp float;in float v_depth;void main() {glFragColor=pack_depth(v_depth);}",`#include "_prelude_terrain.vertex.glsl"
uniform mat4 u_matrix;in vec2 a_pos;out float v_depth;void main() {float elevation=elevation(a_pos);gl_Position=u_matrix*vec4(a_pos,elevation,1.0);v_depth=gl_Position.z/gl_Position.w;}`),skybox:ii(`#include "_prelude_fog.fragment.glsl"
in lowp vec3 v_uv;uniform lowp samplerCube u_cubemap;uniform lowp float u_opacity;uniform highp float u_temporal_offset;uniform highp vec3 u_sun_direction;float sun_disk(highp vec3 ray_direction,highp vec3 sun_direction) {highp float cos_angle=dot(normalize(ray_direction),sun_direction);const highp float cos_sun_angular_diameter=0.99996192306;const highp float smoothstep_delta=1e-5;return smoothstep(
cos_sun_angular_diameter-smoothstep_delta,cos_sun_angular_diameter+smoothstep_delta,cos_angle);}float map(float value,float start,float end,float new_start,float new_end) {return ((value-start)*(new_end-new_start))/(end-start)+new_start;}void main() {vec3 uv=v_uv;const float y_bias=0.015;uv.y+=y_bias;uv.y=pow(abs(uv.y),1.0/5.0);uv.y=map(uv.y,0.0,1.0,-1.0,1.0);vec3 sky_color=texture(u_cubemap,uv).rgb;
#ifdef FOG
sky_color=fog_apply_sky_gradient(v_uv.xzy,sky_color);
#endif
sky_color.rgb=dither(sky_color.rgb,gl_FragCoord.xy+u_temporal_offset);sky_color+=0.1*sun_disk(v_uv,u_sun_direction);glFragColor=vec4(sky_color*u_opacity,u_opacity);
#ifdef OVERDRAW_INSPECTOR
glFragColor=vec4(1.0);
#endif
}`,fT),skyboxGradient:ii(`#include "_prelude_fog.fragment.glsl"
in highp vec3 v_uv;uniform lowp sampler2D u_color_ramp;uniform highp vec3 u_center_direction;uniform lowp float u_radius;uniform lowp float u_opacity;uniform highp float u_temporal_offset;void main() {float progress=acos(dot(normalize(v_uv),u_center_direction))/u_radius;vec4 color=texture(u_color_ramp,vec2(progress,0.5));
#ifdef FOG
color.rgb=fog_apply_sky_gradient(v_uv.xzy,color.rgb/color.a)*color.a;
#endif
color*=u_opacity;color.rgb=dither(color.rgb,gl_FragCoord.xy+u_temporal_offset);glFragColor=color;
#ifdef OVERDRAW_INSPECTOR
glFragColor=vec4(1.0);
#endif
}`,fT),skyboxCapture:ii(`
in highp vec3 v_position;uniform highp float u_sun_intensity;uniform highp float u_luminance;uniform lowp vec3 u_sun_direction;uniform highp vec4 u_color_tint_r;uniform highp vec4 u_color_tint_m;precision highp float;
#define BETA_R                  vec3(5.5e-6,13.0e-6,22.4e-6)
#define BETA_M                  vec3(21e-6,21e-6,21e-6)
#define MIE_G                   0.76
#define DENSITY_HEIGHT_SCALE_R  8000.0
#define DENSITY_HEIGHT_SCALE_M  1200.0
#define PLANET_RADIUS           6360e3
#define ATMOSPHERE_RADIUS       6420e3
#define SAMPLE_STEPS            10
#define DENSITY_STEPS           4
float ray_sphere_exit(vec3 orig,vec3 dir,float radius) {float a=dot(dir,dir);float b=2.0*dot(dir,orig);float c=dot(orig,orig)-radius*radius;float d=sqrt(b*b-4.0*a*c);return (-b+d)/(2.0*a);}vec3 extinction(vec2 density) {return exp(-vec3(BETA_R*u_color_tint_r.a*density.x+BETA_M*u_color_tint_m.a*density.y));}vec2 local_density(vec3 point) {float height=max(length(point)-PLANET_RADIUS,0.0);float exp_r=exp(-height/DENSITY_HEIGHT_SCALE_R);float exp_m=exp(-height/DENSITY_HEIGHT_SCALE_M);return vec2(exp_r,exp_m);}float phase_ray(float cos_angle) {return (3.0/(16.0*PI))*(1.0+cos_angle*cos_angle);}float phase_mie(float cos_angle) {return (3.0/(8.0*PI))*((1.0-MIE_G*MIE_G)*(1.0+cos_angle*cos_angle))/((2.0+MIE_G*MIE_G)*pow(1.0+MIE_G*MIE_G-2.0*MIE_G*cos_angle,1.5));}vec2 density_to_atmosphere(vec3 point,vec3 light_dir) {float ray_len=ray_sphere_exit(point,light_dir,ATMOSPHERE_RADIUS);float step_len=ray_len/float(DENSITY_STEPS);vec2 density_point_to_atmosphere=vec2(0.0);for (int i=0; i &lt; DENSITY_STEPS;++i) {vec3 point_on_ray=point+light_dir*((float(i)+0.5)*step_len);density_point_to_atmosphere+=local_density(point_on_ray)*step_len;;}return density_point_to_atmosphere;}vec3 atmosphere(vec3 ray_dir,vec3 sun_direction,float sun_intensity) {vec2 density_orig_to_point=vec2(0.0);vec3 scatter_r=vec3(0.0);vec3 scatter_m=vec3(0.0);vec3 origin=vec3(0.0,PLANET_RADIUS,0.0);float ray_len=ray_sphere_exit(origin,ray_dir,ATMOSPHERE_RADIUS);float step_len=ray_len/float(SAMPLE_STEPS);for (int i=0; i &lt; SAMPLE_STEPS;++i) {vec3 point_on_ray=origin+ray_dir*((float(i)+0.5)*step_len);vec2 density=local_density(point_on_ray)*step_len;density_orig_to_point+=density;vec2 density_point_to_atmosphere=density_to_atmosphere(point_on_ray,sun_direction);vec2 density_orig_to_atmosphere=density_orig_to_point+density_point_to_atmosphere;vec3 extinction=extinction(density_orig_to_atmosphere);scatter_r+=density.x*extinction;scatter_m+=density.y*extinction;}float cos_angle=dot(ray_dir,sun_direction);float phase_r=phase_ray(cos_angle);float phase_m=phase_mie(cos_angle);vec3 beta_r=BETA_R*u_color_tint_r.rgb*u_color_tint_r.a;vec3 beta_m=BETA_M*u_color_tint_m.rgb*u_color_tint_m.a;return (scatter_r*phase_r*beta_r+scatter_m*phase_m*beta_m)*sun_intensity;}const float A=0.15;const float B=0.50;const float C=0.10;const float D=0.20;const float E=0.02;const float F=0.30;vec3 uncharted2_tonemap(vec3 x) {return ((x*(A*x+C*B)+D*E)/(x*(A*x+B)+D*F))-E/F;}void main() {vec3 ray_direction=v_position;ray_direction.y=pow(ray_direction.y,5.0);const float y_bias=0.015;ray_direction.y+=y_bias;vec3 color=atmosphere(normalize(ray_direction),u_sun_direction,u_sun_intensity);float white_scale=1.0748724675633854;color=uncharted2_tonemap((log2(2.0/pow(u_luminance,4.0)))*color)*white_scale;glFragColor=vec4(color,1.0);}`,"in highp vec3 a_pos_3f;uniform mat3 u_matrix_3f;out highp vec3 v_position;float map(float value,float start,float end,float new_start,float new_end) {return ((value-start)*(new_end-new_start))/(end-start)+new_start;}void main() {vec4 pos=vec4(u_matrix_3f*a_pos_3f,1.0);v_position=pos.xyz;v_position.y*=-1.0;v_position.y=map(v_position.y,-1.0,1.0,0.0,1.0);gl_Position=vec4(a_pos_3f.xy,0.0,1.0);}"),globeRaster:ii(`#include "_prelude_fog.fragment.glsl"
#include "_prelude_lighting.glsl"
uniform sampler2D u_image0;in vec2 v_pos0;
#ifndef FOG
uniform highp vec3 u_frustum_tl;uniform highp vec3 u_frustum_tr;uniform highp vec3 u_frustum_br;uniform highp vec3 u_frustum_bl;uniform highp vec3 u_globe_pos;uniform highp float u_globe_radius;uniform vec2 u_viewport;
#endif
void main() {vec4 color;
#ifdef CUSTOM_ANTIALIASING
vec2 uv=gl_FragCoord.xy/u_viewport;highp vec3 ray_dir=mix(
mix(u_frustum_tl,u_frustum_tr,uv.x),mix(u_frustum_bl,u_frustum_br,uv.x),1.0-uv.y);vec3 dir=normalize(ray_dir);vec3 closest_point=dot(u_globe_pos,dir)*dir;float norm_dist_from_center=1.0-length(closest_point-u_globe_pos)/u_globe_radius;const float antialias_pixel=2.0;float antialias_factor=antialias_pixel*fwidth(norm_dist_from_center);float antialias=smoothstep(0.0,antialias_factor,norm_dist_from_center);vec4 raster=texture(u_image0,v_pos0);
#ifdef LIGHTING_3D_MODE
#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS
raster=apply_lighting_with_emission_ground(raster,raster.a);color=vec4(raster.rgb*antialias,antialias);
#else
raster=apply_lighting_ground(raster);color=vec4(raster.rgb*antialias,raster.a*antialias);
#endif
#else
color=vec4(raster.rgb*antialias,raster.a*antialias);
#endif
#else
color=texture(u_image0,v_pos0);
#ifdef LIGHTING_3D_MODE
#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS
color=apply_lighting_with_emission_ground(color,color.a);color.a=1.0;
#else
color=apply_lighting_ground(color);
#endif
#endif
#endif
#ifdef FOG
color=fog_dither(fog_apply_premultiplied(color,v_fog_pos));
#endif
glFragColor=color;
#ifdef OVERDRAW_INSPECTOR
glFragColor=vec4(1.0);
#endif
HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
#include "_prelude_terrain.vertex.glsl"
uniform mat4 u_proj_matrix;uniform mat4 u_normalize_matrix;uniform mat4 u_globe_matrix;uniform mat4 u_merc_matrix;uniform float u_zoom_transition;uniform vec2 u_merc_center;uniform mat3 u_grid_matrix;uniform float u_skirt_height;
#ifdef GLOBE_POLES
in vec3 a_globe_pos;in vec2 a_uv;
#else
in vec2 a_pos;
#endif
out vec2 v_pos0;void main() {
#ifdef GLOBE_POLES
vec3 globe_pos=a_globe_pos;vec2 uv=a_uv;
#else
float tiles=u_grid_matrix[0][2];float idx=u_grid_matrix[1][2];float idy=u_grid_matrix[2][2];vec3 decomposed_pos_and_skirt=decomposeToPosAndSkirt(a_pos);vec3 latLng=u_grid_matrix*vec3(decomposed_pos_and_skirt.xy,1.0);float mercatorY=mercatorYfromLat(latLng[0]);float uvY=mercatorY*tiles-idy;float mercatorX=mercatorXfromLng(latLng[1]);float uvX=mercatorX*tiles-idx;vec3 globe_pos=latLngToECEF(latLng.xy);vec2 merc_pos=vec2(mercatorX,mercatorY);vec2 uv=vec2(uvX,uvY);
#endif
v_pos0=uv;vec2 tile_pos=uv*EXTENT;vec3 globe_derived_up_vector=normalize(globe_pos)*u_tile_up_scale;
#ifdef GLOBE_POLES
vec3 up_vector=globe_derived_up_vector;
#else
vec3 up_vector=elevationVector(tile_pos);
#endif
float height=elevation(tile_pos);globe_pos+=up_vector*height;
#ifndef GLOBE_POLES
globe_pos-=globe_derived_up_vector*u_skirt_height*decomposed_pos_and_skirt.z;
#endif
#ifdef GLOBE_POLES
vec4 interpolated_pos=u_globe_matrix*vec4(globe_pos,1.0);
#else
vec4 globe_world_pos=u_globe_matrix*vec4(globe_pos,1.0);vec4 merc_world_pos=vec4(0.0);if (u_zoom_transition &gt; 0.0) {merc_world_pos=vec4(merc_pos,height-u_skirt_height*decomposed_pos_and_skirt.z,1.0);merc_world_pos.xy-=u_merc_center;merc_world_pos.x=wrap(merc_world_pos.x,-0.5,0.5);merc_world_pos=u_merc_matrix*merc_world_pos;}vec4 interpolated_pos=vec4(mix(globe_world_pos.xyz,merc_world_pos.xyz,u_zoom_transition),1.0);
#endif
gl_Position=u_proj_matrix*interpolated_pos;
#ifdef FOG
v_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz);
#endif
}`),globeAtmosphere:ii(`#include "_prelude_fog.fragment.glsl"
uniform float u_transition;uniform highp float u_fadeout_range;uniform highp float u_temporal_offset;uniform vec4 u_color;uniform vec4 u_high_color;uniform vec4 u_space_color;uniform float u_horizon_angle;in highp vec3 v_ray_dir;in highp vec3 v_horizon_dir;void main() {highp vec3 dir=normalize(v_ray_dir);float globe_pos_dot_dir;
#ifdef PROJECTION_GLOBE_VIEW
globe_pos_dot_dir=dot(u_globe_pos,dir);highp vec3 closest_point_forward=abs(globe_pos_dot_dir)*dir;float norm_dist_from_center=length(closest_point_forward-u_globe_pos)/u_globe_radius;if (norm_dist_from_center &lt; 0.98) {
#ifdef ALPHA_PASS
glFragColor=vec4(0,0,0,0);return;
#else
#ifdef NATIVE
glFragColor=vec4(1,1,1,1);
#else
glFragColor=vec4(0,0,0,1);
#endif
return;
#endif
}
#endif
highp vec3 horizon_dir=normalize(v_horizon_dir);float horizon_angle_mercator=dir.y &lt; horizon_dir.y ?
0.0 : max(acos(clamp(dot(dir,horizon_dir),-1.0,1.0)),0.0);float horizon_angle;
#ifdef PROJECTION_GLOBE_VIEW
highp vec3 closest_point=globe_pos_dot_dir*dir;highp float closest_point_to_center=length(closest_point-u_globe_pos);highp float theta=asin(clamp(closest_point_to_center/length(u_globe_pos),-1.0,1.0));horizon_angle=globe_pos_dot_dir &lt; 0.0 ?
PI-theta-u_horizon_angle : theta-u_horizon_angle;float angle_t=pow(u_transition,10.0);horizon_angle=mix(horizon_angle,horizon_angle_mercator,angle_t);
#else
horizon_angle=horizon_angle_mercator;
#endif
horizon_angle/=PI;float t=exp(-horizon_angle/u_fadeout_range);float alpha_0=u_color.a;float alpha_1=u_high_color.a;float alpha_2=u_space_color.a;vec3 color_stop_0=u_color.rgb;vec3 color_stop_1=u_high_color.rgb;vec3 color_stop_2=u_space_color.rgb;
#ifdef ALPHA_PASS
float a0=mix(alpha_2,1.0,alpha_1);float a1=mix(a0,1.0,alpha_0);float a2=mix(a0,a1,t);float a =mix(alpha_2,a2,t);glFragColor=vec4(1.0,1.0,1.0,a);
#else
vec3 c0=mix(color_stop_2,color_stop_1,alpha_1);vec3 c1=mix(c0,color_stop_0,alpha_0);vec3 c2=mix(c0,c1,t);vec3 c=c2;
#ifndef NATIVE
c=dither(c,gl_FragCoord.xy+u_temporal_offset);
#endif
glFragColor=vec4(c*t,t);
#endif
}`,`in vec3 a_pos;in vec2 a_uv;uniform vec3 u_frustum_tl;uniform vec3 u_frustum_tr;uniform vec3 u_frustum_br;uniform vec3 u_frustum_bl;uniform float u_horizon;out highp vec3 v_ray_dir;out highp vec3 v_horizon_dir;void main() {v_ray_dir=mix(
mix(u_frustum_tl,u_frustum_tr,a_uv.x),mix(u_frustum_bl,u_frustum_br,a_uv.x),a_uv.y);v_horizon_dir=mix(
mix(u_frustum_tl,u_frustum_bl,u_horizon),mix(u_frustum_tr,u_frustum_br,u_horizon),a_uv.x);gl_Position=vec4(a_pos,1.0);}`),model:ii(`#include "_prelude_fog.fragment.glsl"
#include "_prelude_shadow.fragment.glsl"
#include "_prelude_lighting.glsl"
uniform float u_opacity;uniform vec3 u_lightcolor;uniform vec3 u_lightpos;uniform float u_lightintensity;uniform vec4 u_baseColorFactor;uniform vec4 u_emissiveFactor;uniform float u_metallicFactor;uniform float u_roughnessFactor;uniform float u_emissive_strength;in highp vec4 v_position_height;in lowp vec4 v_color_mix;
#ifdef RENDER_SHADOWS
in vec4 v_pos_light_view_0;in vec4 v_pos_light_view_1;in float v_depth_shadows;
#endif
#pragma mapbox: define-attribute highp vec3 normal_3f
#pragma mapbox: define-attribute highp vec3 color_3f
#pragma mapbox: define-attribute highp vec4 color_4f
#pragma mapbox: define-attribute highp vec2 uv_2f
#pragma mapbox: initialize-attribute highp vec3 normal_3f
#pragma mapbox: initialize-attribute highp vec3 color_3f
#pragma mapbox: initialize-attribute highp vec4 color_4f
#pragma mapbox: initialize-attribute highp vec2 uv_2f
#ifdef HAS_ATTRIBUTE_a_pbr
in lowp vec4 v_roughness_metallic_emissive_alpha;in mediump vec4 v_height_based_emission_params;
#endif
#ifdef HAS_TEXTURE_u_baseColorTexture
uniform sampler2D u_baseColorTexture;uniform bool u_baseTextureIsAlpha;uniform bool u_alphaMask;uniform float u_alphaCutoff;
#endif
#ifdef HAS_TEXTURE_u_metallicRoughnessTexture
uniform sampler2D u_metallicRoughnessTexture;
#endif
#ifdef HAS_TEXTURE_u_occlusionTexture
uniform sampler2D u_occlusionTexture;uniform float u_aoIntensity;
#endif
#ifdef HAS_TEXTURE_u_normalTexture
uniform sampler2D u_normalTexture;
#endif
#ifdef HAS_TEXTURE_u_emissionTexture
uniform sampler2D u_emissionTexture;
#endif
#ifdef TERRAIN_FRAGMENT_OCCLUSION
in highp float v_depth;uniform sampler2D u_depthTexture;uniform vec2 u_inv_depth_size;bool isOccluded() {vec2 coord=gl_FragCoord.xy*u_inv_depth_size;highp float depth=unpack_depth(texture(u_depthTexture,coord));return v_depth &gt; depth+0.0005;}
#endif
#define saturate(_x) clamp(_x,0.,1.)
vec3 linearTosRGB(vec3 color) {return pow(color,vec3(1./2.2));}vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}float calculate_NdotL(vec3 normal,vec3 lightDir) {const float ext=0.70710678118;return (clamp(dot(normal,lightDir),-ext,1.0)+ext)/(1.0+ext);}vec3 getDiffuseShadedColor(vec3 albedo,vec3 normal,vec3 lightDir,vec3 lightColor)
{
#ifdef LIGHTING_3D_MODE
vec3 transformed_normal=vec3(-normal.xy,normal.z);float lighting_factor;
#ifdef RENDER_SHADOWS
lighting_factor=shadowed_light_factor_normal(transformed_normal,v_pos_light_view_0,v_pos_light_view_1,v_depth_shadows);
#else
lighting_factor=saturate(dot(transformed_normal,u_lighting_directional_dir));
#endif
return apply_lighting(albedo,transformed_normal,lighting_factor);
#else
vec3 n=normal;float colorvalue=((albedo.x*0.2126)+(albedo.y*0.7152))+(albedo.z*0.0722);vec3 c=vec3(0.03,0.03,0.03);float directional=clamp(dot(n,vec3(lightDir)),0.0,1.0);directional=mix(1.0-u_lightintensity,max((1.0-colorvalue)+u_lightintensity,1.0),directional);vec3 c3=c+clamp((albedo*directional)*lightColor,mix(vec3(0.0),vec3(0.3),vec3(1.0)-lightColor),vec3(1.0));return c3;
#endif
}vec4 getBaseColor() {vec4 albedo=u_baseColorFactor;
#ifdef HAS_ATTRIBUTE_a_color_3f
albedo*=vec4(color_3f,1.0);
#endif
#ifdef HAS_ATTRIBUTE_a_pbr
#else
#ifdef HAS_ATTRIBUTE_a_color_4f
albedo*=color_4f;
#endif
#endif
#if defined (HAS_TEXTURE_u_baseColorTexture) &amp;&amp; defined (HAS_ATTRIBUTE_a_uv_2f)
vec4 texColor=texture(u_baseColorTexture,uv_2f);if(u_alphaMask) {if (texColor.w &lt; u_alphaCutoff) {discard;}}
#ifdef UNPREMULT_TEXTURE_IN_SHADER
if(texColor.w &gt; 0.0) {texColor.rgb/=texColor.w;}texColor.w=1.0;
#endif
texColor.rgb=sRGBToLinear(texColor.rgb);if(u_baseTextureIsAlpha) {if (texColor.w &lt; 0.5) {discard;}albedo*=mix(vec4(texColor.rgb,texColor.a),vec4(texColor.a),float(u_baseTextureIsAlpha));} else {albedo*=texColor;}
#endif
return vec4(mix(albedo.rgb,v_color_mix.rgb,v_color_mix.a),albedo.a);}highp mat3 cotangentFrame(highp vec3 N,highp vec3 p,highp vec2 uv ) {
#ifdef HAS_TEXTURE_u_normalTexture
highp vec3 dp1=vec3(dFdx(p.x),dFdx(p.y),dFdx(p.z));highp vec3 dp2=vec3(dFdy(p.x),dFdy(p.y),dFdy(p.z));highp vec2 duv1=vec2(dFdx(uv.x),dFdx(uv.y));highp vec2 duv2=vec2(dFdy(uv.x),dFdy(uv.y));highp vec3 dp2perp=cross( dp2,N );highp vec3 dp1perp=cross( N,dp1 );highp vec3 T=dp2perp*duv1.x+dp1perp*duv2.x;highp vec3 B=dp2perp*duv1.y+dp1perp*duv2.y;highp float lengthT=dot(T,T);highp float lengthB=dot(B,B);highp float maxLength=max(lengthT,lengthB);highp float invmax=inversesqrt( maxLength );highp mat3 res=mat3( T*invmax,B*invmax,N );return res;
#else
return mat3(1.0);
#endif
}highp vec3 getNormal(){highp vec3 n;
#ifdef HAS_ATTRIBUTE_a_normal_3f
n=normalize(normal_3f);
#else
highp vec3 fdx=vec3(dFdx(v_position_height.x),dFdx(v_position_height.y),dFdx(v_position_height.z));highp vec3 fdy=vec3(dFdy(v_position_height.x),dFdy(v_position_height.y),dFdy(v_position_height.z));n=normalize(cross(fdx,fdy))*-1.0;
#endif
#if defined(HAS_TEXTURE_u_normalTexture) &amp;&amp; defined(HAS_ATTRIBUTE_a_uv_2f)
vec3 nMap=texture( u_normalTexture,uv_2f).xyz;nMap=normalize(2.0*nMap-vec3(1.0));highp vec3 v=normalize(-v_position_height.xyz);highp mat3 TBN=cotangentFrame(n,v,uv_2f);n=normalize(TBN*nMap);
#endif
return n;}struct Material {float perceptualRoughness;float alphaRoughness;float metallic;vec3 f90;vec4 baseColor;vec3 diffuseColor;vec3 specularColor;highp vec3 normal;};Material getPBRMaterial() {Material mat;mat.baseColor=getBaseColor();mat.perceptualRoughness=u_roughnessFactor;mat.metallic=u_metallicFactor;
#ifdef HAS_ATTRIBUTE_a_pbr
mat.perceptualRoughness=v_roughness_metallic_emissive_alpha.x;mat.metallic=v_roughness_metallic_emissive_alpha.y;mat.baseColor.w*=v_roughness_metallic_emissive_alpha.w;
#endif
#if defined(HAS_TEXTURE_u_metallicRoughnessTexture) &amp;&amp; defined(HAS_ATTRIBUTE_a_uv_2f) 
vec4 mrSample=texture(u_metallicRoughnessTexture,uv_2f);mat.perceptualRoughness*=mrSample.g;mat.metallic*=mrSample.b;
#endif
const float c_minRoughness=0.04;mat.perceptualRoughness=clamp(mat.perceptualRoughness,c_minRoughness,1.0);mat.metallic=saturate(mat.metallic);mat.alphaRoughness=mat.perceptualRoughness*mat.perceptualRoughness;const vec3 f0=vec3(0.04);mat.diffuseColor=mat.baseColor.rgb*(vec3(1.0)-f0);mat.diffuseColor*=1.0-mat.metallic;mat.specularColor=mix(f0,mat.baseColor.rgb,mat.metallic);highp float reflectance=max(max(mat.specularColor.r,mat.specularColor.g),mat.specularColor.b);highp float reflectance90=saturate(reflectance*25.0);mat.f90=vec3(reflectance90);mat.normal=getNormal();return mat;}float V_GGX(float NdotL,float NdotV,float roughness)
{float a2=roughness*roughness;float GGXV=NdotL*sqrt(NdotV*NdotV*(1.0-a2)+a2);float GGXL=NdotV*sqrt(NdotL*NdotL*(1.0-a2)+a2);return 0.5/(GGXV+GGXL);}float V_GGXFast(float NdotL,float NdotV,float roughness) {float a=roughness;float GGXV=NdotL*(NdotV*(1.0-a)+a);float GGXL=NdotV*(NdotL*(1.0-a)+a);return 0.5/(GGXV+GGXL);}vec3 F_Schlick(vec3 specularColor,vec3 f90,float VdotH)
{return specularColor+(f90-specularColor)*pow(clamp(1.0-VdotH,0.0,1.0),5.0);}vec3 F_SchlickFast(vec3 specularColor,float VdotH)
{float x=1.0-VdotH;float x4=x*x*x*x;return specularColor+(1.0-specularColor)*x4*x;}float D_GGX(highp float NdotH,float alphaRoughness)
{highp float a4=alphaRoughness*alphaRoughness;highp float f=(NdotH*a4-NdotH)*NdotH+1.0;return a4/(PI*f*f);}vec3 diffuseBurley(Material mat,float LdotH,float NdotL,float NdotV)
{float f90=2.0*LdotH*LdotH*mat.alphaRoughness-0.5;return (mat.diffuseColor/PI)*(1.0+f90*pow((1.0-NdotL),5.0))*(1.0+f90*pow((1.0-NdotV),5.0));}vec3 diffuseLambertian(Material mat)
{
#ifdef LIGHTING_3D_MODE
return mat.diffuseColor;
#else
return mat.diffuseColor/PI;
#endif
}vec3 EnvBRDFApprox(vec3 specularColor,float roughness,highp float NdotV)
{vec4 c0=vec4(-1,-0.0275,-0.572,0.022);vec4 c1=vec4(1,0.0425,1.04,-0.04);highp vec4 r=roughness*c0+c1;highp float a004=min(r.x*r.x,exp2(-9.28*NdotV))*r.x+r.y;vec2 AB=vec2(-1.04,1.04)*a004+r.zw;return specularColor*AB.x+AB.y;}vec3 computeIndirectLightContribution(Material mat,float NdotV,vec3 normal)
{vec3 env_light=vec3(0.65,0.65,0.65);
#ifdef LIGHTING_3D_MODE
float ambient_factor=calculate_ambient_directional_factor(normal);env_light=u_lighting_ambient_color*ambient_factor;
#endif
vec3 envBRDF=EnvBRDFApprox(mat.specularColor,mat.perceptualRoughness,NdotV);vec3 indirectSpecular= envBRDF*env_light;vec3 indirectDiffuse=mat.diffuseColor*env_light;return indirectSpecular+indirectDiffuse;}vec3 computeLightContribution(Material mat,vec3 lightPosition,vec3 lightColor)
{highp vec3 n=mat.normal;highp vec3 v=normalize(-v_position_height.xyz);highp vec3 l=normalize(lightPosition);highp vec3 h=normalize(v+l);float NdotV=clamp(abs(dot(n,v)),0.001,1.0);float NdotL=saturate(dot(n,l));highp float NdotH=saturate(dot(n,h));float VdotH=saturate(dot(v,h));vec3 f=F_SchlickFast(mat.specularColor,VdotH);float g=V_GGXFast(NdotL,NdotV,mat.alphaRoughness);float d=D_GGX(NdotH,mat.alphaRoughness);vec3 diffuseTerm=(1.0-f)*diffuseLambertian(mat);vec3 specularTerm=f*g*d;vec3 transformed_normal=vec3(-n.xy,n.z);float lighting_factor;
#ifdef RENDER_SHADOWS
lighting_factor=shadowed_light_factor_normal(transformed_normal,v_pos_light_view_0,v_pos_light_view_1,v_depth_shadows);
#else
lighting_factor=NdotL;
#endif
vec3 directLightColor=(specularTerm+diffuseTerm)*lighting_factor*lightColor;vec3 indirectLightColor=computeIndirectLightContribution(mat,NdotV,transformed_normal);vec3 color=(saturate(directLightColor)+indirectLightColor);float intensityFactor=1.0;
#if !defined(LIGHTING_3D_MODE)
const vec3 luminosityFactor=vec3(0.2126,0.7152,0.0722);float luminance=dot(diffuseTerm,luminosityFactor);intensityFactor=mix((1.0-u_lightintensity),max((1.0-luminance+u_lightintensity),1.0),NdotL);
#endif
color*=intensityFactor;return color;}void main() {
#ifdef TERRAIN_FRAGMENT_OCCLUSION
if (isOccluded()) {discard;}
#endif
vec3 lightDir=u_lightpos;vec3 lightColor=u_lightcolor;
#ifdef LIGHTING_3D_MODE
lightDir=u_lighting_directional_dir;lightDir.xy=-lightDir.xy;lightColor=u_lighting_directional_color;
#endif
vec4 finalColor;
#ifdef DIFFUSE_SHADED
vec3 N=getNormal();vec3 diffuse=getDiffuseShadedColor(getBaseColor().rgb,N,lightDir,lightColor);
#ifdef HAS_TEXTURE_u_occlusionTexture
float ao=(texture(u_occlusionTexture,uv_2f).r-1.0)*u_aoIntensity+1.0;diffuse*=ao;
#endif
finalColor=vec4(diffuse,1.0)*u_opacity;
#else
Material mat=getPBRMaterial();vec3 color=computeLightContribution(mat,lightDir,lightColor);float ao=1.0;
#if defined (HAS_TEXTURE_u_occlusionTexture) &amp;&amp; defined(HAS_ATTRIBUTE_a_uv_2f)
ao=(texture(u_occlusionTexture,uv_2f).x-1.0)*u_aoIntensity+1.0;color*=ao;
#endif
vec4 emissive=u_emissiveFactor;
#if defined(HAS_TEXTURE_u_emissionTexture) &amp;&amp; defined(HAS_ATTRIBUTE_a_uv_2f)
emissive.rgb*=sRGBToLinear(texture(u_emissionTexture,uv_2f).rgb);
#endif
color+=emissive.rgb;float opacity=mat.baseColor.w*u_opacity;
#ifdef HAS_ATTRIBUTE_a_pbr
float resEmission=v_roughness_metallic_emissive_alpha.z;resEmission*=v_height_based_emission_params.z+v_height_based_emission_params.w*pow(clamp(v_height_based_emission_params.x,0.0,1.0),v_height_based_emission_params.y);color=mix(color,v_color_mix.rgb,min(1.0,resEmission));
#ifdef HAS_ATTRIBUTE_a_color_4f
float distance=length(vec2(1.3*max(0.0,abs(color_4f.x)-color_4f.z),color_4f.y));distance+= mix(0.5,0.0,clamp(resEmission-1.0,0.0,1.0));opacity*=v_roughness_metallic_emissive_alpha.w*saturate(1.0-distance*distance);
#endif
#endif
vec3 unlitColor=mat.baseColor.rgb*ao+emissive.rgb;color=mix(color,unlitColor,u_emissive_strength);color=linearTosRGB(color);color*=opacity;finalColor=vec4(color,opacity);
#endif
#ifdef FOG
finalColor=fog_dither(fog_apply_premultiplied(finalColor,v_fog_pos,v_position_height.w));
#endif
#ifdef RENDER_CUTOFF
finalColor*=v_cutoff_opacity;
#endif
#ifdef INDICATOR_CUTOUT
finalColor=applyCutout(finalColor);
#endif
glFragColor=finalColor;
#ifdef OVERDRAW_INSPECTOR
glFragColor=vec4(1.0);
#endif
HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
#include "_prelude_shadow.vertex.glsl"
in vec3 a_pos_3f;
#pragma mapbox: define-attribute highp vec3 normal_3f
#pragma mapbox: define-attribute highp vec2 uv_2f
#pragma mapbox: define-attribute highp vec3 color_3f
#pragma mapbox: define-attribute highp vec4 color_4f
#pragma mapbox: define-attribute-vertex-shader-only highp vec4 pbr
#pragma mapbox: define-attribute-vertex-shader-only highp vec3 heightBasedEmissiveStrength
uniform mat4 u_matrix;uniform mat4 u_lighting_matrix;uniform vec3 u_camera_pos;uniform vec4 u_color_mix;
#ifdef INSTANCED_ARRAYS
in vec4 a_normal_matrix0;in vec4 a_normal_matrix1;in vec4 a_normal_matrix2;in vec4 a_normal_matrix3;
#else
uniform highp mat4 u_normal_matrix;
#endif
#ifdef RENDER_SHADOWS
uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out vec4 v_pos_light_view_0;out vec4 v_pos_light_view_1;out float v_depth_shadows;
#endif
out vec4 v_position_height;out lowp vec4 v_color_mix;
#ifdef TERRAIN_FRAGMENT_OCCLUSION
out highp float v_depth;
#endif
#ifdef HAS_ATTRIBUTE_a_pbr
out lowp vec4 v_roughness_metallic_emissive_alpha;out mediump vec4 v_height_based_emission_params;
#endif
vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}void main() {
#pragma mapbox: initialize-attribute highp vec3 normal_3f
#pragma mapbox: initialize-attribute highp vec2 uv_2f
#pragma mapbox: initialize-attribute highp vec3 color_3f
#pragma mapbox: initialize-attribute highp vec4 color_4f
#pragma mapbox: initialize-attribute-custom highp vec4 pbr
#pragma mapbox: initialize-attribute-custom highp vec3 heightBasedEmissiveStrength
highp mat4 normal_matrix;
#ifdef INSTANCED_ARRAYS
normal_matrix=mat4(a_normal_matrix0,a_normal_matrix1,a_normal_matrix2,a_normal_matrix3);
#else
normal_matrix=u_normal_matrix;
#endif
vec3 local_pos;mat3 rs;
#ifdef MODEL_POSITION_ON_GPU
vec3 pos_color=normal_matrix[0].xyz;vec4 translate=normal_matrix[1];vec3 pos_a=floor(pos_color);vec3 rgb=1.05*(pos_color-pos_a);float color_mix=pos_a.z/100.0;v_color_mix=vec4(sRGBToLinear(rgb),color_mix);float meter_to_tile=normal_matrix[0].w;vec4 pos=vec4(pos_a.xy,translate.z,1.0);rs[0].x=normal_matrix[1].w;rs[0].yz=normal_matrix[2].xy;rs[1].xy=normal_matrix[2].zw;rs[1].z=normal_matrix[3].x;rs[2].xyz=normal_matrix[3].yzw;vec4 pos_node=u_lighting_matrix*vec4(a_pos_3f,1.0);vec3 rotated_pos_node=rs*pos_node.xyz;vec3 pos_model_tile=(rotated_pos_node+vec3(translate.xy,0.0))*vec3(meter_to_tile,meter_to_tile,1.0);pos.xyz+=pos_model_tile;local_pos=pos.xyz;gl_Position=u_matrix*pos;pos.z*=meter_to_tile;v_position_height.xyz=pos.xyz-u_camera_pos;
#else
local_pos=a_pos_3f;gl_Position=u_matrix*vec4(a_pos_3f,1);v_position_height.xyz=vec3(u_lighting_matrix*vec4(a_pos_3f,1));v_color_mix=vec4(sRGBToLinear(u_color_mix.rgb),u_color_mix.a);
#endif
v_position_height.w=a_pos_3f.z;
#ifdef HAS_ATTRIBUTE_a_pbr
vec4 albedo_c=decode_color(pbr.xy);vec2 e_r_m=unpack_float(pbr.z);vec2 r_m= unpack_float(e_r_m.y*16.0);r_m.r=r_m.r*16.0;v_color_mix=vec4(albedo_c.rgb,1.0);v_roughness_metallic_emissive_alpha=vec4(vec3(r_m,e_r_m.x)/255.0,albedo_c.a);v_roughness_metallic_emissive_alpha.z*=2.0;float heightBasedRelativeIntepolation=a_pos_3f.z*heightBasedEmissiveStrength.x+heightBasedEmissiveStrength.y;v_height_based_emission_params.x=heightBasedRelativeIntepolation;v_height_based_emission_params.y=heightBasedEmissiveStrength.z;vec2 emissionMultiplierValues=unpack_float(pbr.w)/256.0;v_height_based_emission_params.z=emissionMultiplierValues.x;v_height_based_emission_params.w=emissionMultiplierValues.y-emissionMultiplierValues.x;
#endif
#ifdef FOG
v_fog_pos=fog_position(local_pos);
#endif
#ifdef RENDER_CUTOFF
v_cutoff_opacity=cutoff_opacity(u_cutoff_params,gl_Position.z);
#endif
#ifdef TERRAIN_FRAGMENT_OCCLUSION
v_depth=gl_Position.z/gl_Position.w;
#endif
#ifdef HAS_ATTRIBUTE_a_normal_3f
#ifdef MODEL_POSITION_ON_GPU
float x_squared_scale=dot(rs[0],rs[0]);float y_squared_scale=dot(rs[1],rs[1]);float z_squared_scale=dot(rs[2],rs[2]);vec3 squared_scale=vec3(x_squared_scale,y_squared_scale,z_squared_scale);normal_3f=rs*((u_lighting_matrix*vec4(normal_3f,0.0)).xyz/squared_scale);normal_3f=normalize(normal_3f);
#else
normal_3f=vec3(normal_matrix*vec4(normal_3f,0));
#endif
#endif
#ifdef HAS_ATTRIBUTE_a_pbr
#ifdef HAS_ATTRIBUTE_a_color_4f
v_roughness_metallic_emissive_alpha.w=clamp(color_4f.a*v_roughness_metallic_emissive_alpha.w*(v_roughness_metallic_emissive_alpha.z-1.0),0.0,1.0);
#endif
#endif
#ifdef RENDER_SHADOWS
vec3 shadow_pos=local_pos;
#ifdef NORMAL_OFFSET
#ifdef HAS_ATTRIBUTE_a_normal_3f
#ifdef MODEL_POSITION_ON_GPU
vec3 offset=shadow_normal_offset(vec3(-normal_3f.xy,normal_3f.z));shadow_pos+=offset*shadow_normal_offset_multiplier0();
#else
vec3 offset=shadow_normal_offset_model(normalize(normal_3f));shadow_pos+=offset*shadow_normal_offset_multiplier0();
#endif
#endif
#endif
v_pos_light_view_0=u_light_matrix_0*vec4(shadow_pos,1);v_pos_light_view_1=u_light_matrix_1*vec4(shadow_pos,1);v_depth_shadows=gl_Position.w;
#endif
}`),modelDepth:ii(`in highp float v_depth;void main() {
#ifndef DEPTH_TEXTURE
glFragColor=pack_depth(v_depth);
#endif
}`,`in vec3 a_pos_3f;uniform mat4 u_matrix;out highp float v_depth;
#ifdef MODEL_POSITION_ON_GPU
#ifdef INSTANCED_ARRAYS
in vec4 a_normal_matrix0;in vec4 a_normal_matrix1;in vec4 a_normal_matrix2;in vec4 a_normal_matrix3;
#else
uniform highp mat4 u_instance;
#endif
uniform highp mat4 u_node_matrix;
#endif
void main() {
#ifdef MODEL_POSITION_ON_GPU
highp mat4 instance;
#ifdef INSTANCED_ARRAYS
instance=mat4(a_normal_matrix0,a_normal_matrix1,a_normal_matrix2,a_normal_matrix3);
#else
instance=u_instance;
#endif
vec3 pos_color=instance[0].xyz;vec4 translate=instance[1];vec3 pos_a=floor(pos_color);float meter_to_tile=instance[0].w;vec4 pos=vec4(pos_a.xy,translate.z,1.0);mat3 rs;rs[0].x=instance[1].w;rs[0].yz=instance[2].xy;rs[1].xy=instance[2].zw;rs[1].z=instance[3].x;rs[2].xyz=instance[3].yzw;vec4 pos_node=u_node_matrix*vec4(a_pos_3f,1.0);vec3 rotated_pos_node=rs*pos_node.xyz;vec3 pos_model_tile=(rotated_pos_node+vec3(translate.xy,0.0))*vec3(meter_to_tile,meter_to_tile,1.0);pos.xyz+=pos_model_tile;gl_Position=u_matrix*pos;
#else
gl_Position=u_matrix*vec4(a_pos_3f,1);
#endif
v_depth=gl_Position.z/gl_Position.w;}`),stars:ii(`in highp vec2 v_uv;in mediump float v_intensity;float shapeCircle(in vec2 uv)
{float beginFade=0.6;float lengthFromCenter=length(v_uv);return 1.0-clamp((lengthFromCenter-beginFade)/(1.0-beginFade),0.0,1.0);}void main() {float alpha=shapeCircle(v_uv);vec3 color=vec3(1.0,1.0,1.0);alpha*=v_intensity;glFragColor=vec4(color*alpha,alpha);HANDLE_WIREFRAME_DEBUG;}`,`
in vec3 a_pos_3f;in vec2 a_uv;in float a_size_scale;in float a_fade_opacity;uniform mat4 u_matrix;uniform vec3 u_up;uniform vec3 u_right;uniform float u_intensity_multiplier;out highp vec2 v_uv;out mediump float v_intensity;void main() {v_uv=a_uv;v_intensity=a_fade_opacity*u_intensity_multiplier;vec3 pos=a_pos_3f;pos+=a_uv.x*u_right*a_size_scale;pos+=a_uv.y*u_up*a_size_scale;gl_Position=u_matrix*vec4(pos,1.0);}`)};function Pd(e,t){const i=e.replace(/\s*\/\/[^\n]*\n/g,`
`).split(`
`);for(let r of i)if(r=r.trim(),r[0]==="#"&amp;&amp;r.includes("if")&amp;&amp;!r.includes("endif")){r=r.replace("#","").replace(/ifdef|ifndef|elif|if/g,"").replace(/!|defined|\(|\)|\|\||&amp;&amp;/g,"").replace(/\s+/g," ").trim();const n=r.split(" ");for(const s of n)t.includes(s)||t.push(s)}}function ii(e,t){const i=/#include\s+"([^"]+)"/g,r=/#pragma mapbox: ([\w\-]+) ([\w]+) ([\w]+) ([\w]+)/g;let n=t.match(/(attribute(\S*)|(^\s*|;)in) (highp |mediump |lowp )?([\w]+) ([\w]+)/gm);n&amp;&amp;(n=n.map(d=&gt;{const f=d.split(" ");return f[f.length-1]}),n=[...new Set(n)]);const s={},a=[],l=[];e=e.replace(i,(d,f)=&gt;(l.push(f),"")),t=t.replace(i,(d,f)=&gt;(a.push(f),""));let h=[...vT];Pd(e,h),Pd(t,h);for(const d of[...a,...l])Md[d]||console.error(`Undefined include: ${d}`),Id[d]||(Id[d]=[],Pd(Md[d],Id[d])),h=[...h,...Id[d]];return{fragmentSource:e=e.replace(r,(d,f,m,_,y)=&gt;(s[y]=!0,f==="define"?`
#ifndef HAS_UNIFORM_u_${y}
in ${m} ${_} ${y};
#else
uniform ${m} ${_} u_${y};
#endif
`:f==="initialize"?`
#ifdef HAS_UNIFORM_u_${y}
    ${m} ${_} ${y} = u_${y};
#endif
`:f==="define-attribute"?`
#ifdef HAS_ATTRIBUTE_a_${y}
    in ${m} ${_} ${y};
#endif
`:f==="initialize-attribute"?"":void 0)),vertexSource:t=t.replace(r,(d,f,m,_,y)=&gt;{const x=_==="float"?"vec2":_,b=y.match(/color/)?"color":x;return f==="define-attribute-vertex-shader-only"?`
#ifdef HAS_ATTRIBUTE_a_${y}
in ${m} ${_} a_${y};
#endif
`:s[y]?f==="define"?`
#ifndef HAS_UNIFORM_u_${y}
uniform lowp float u_${y}_t;
in ${m} ${x} a_${y};
out ${m} ${_} ${y};
#else
uniform ${m} ${_} u_${y};
#endif
`:f==="initialize"?b==="vec4"?`
#ifndef HAS_UNIFORM_u_${y}
    ${y} = a_${y};
#else
    ${m} ${_} ${y} = u_${y};
#endif
`:`
#ifndef HAS_UNIFORM_u_${y}
    ${y} = unpack_mix_${b}(a_${y}, u_${y}_t);
#else
    ${m} ${_} ${y} = u_${y};
#endif
`:f==="define-attribute"?`
#ifdef HAS_ATTRIBUTE_a_${y}
    in ${m} ${_} a_${y};
    out ${m} ${_} ${y};
#endif
`:f==="initialize-attribute"?`
#ifdef HAS_ATTRIBUTE_a_${y}
    ${y} = a_${y};
#endif
`:void 0:f==="define"?`
#ifndef HAS_UNIFORM_u_${y}
uniform lowp float u_${y}_t;
in ${m} ${x} a_${y};
#else
uniform ${m} ${_} u_${y};
#endif
`:f==="define-instanced"?b==="mat4"?`
#ifdef INSTANCED_ARRAYS
in vec4 a_${y}0;
in vec4 a_${y}1;
in vec4 a_${y}2;
in vec4 a_${y}3;
#else
uniform ${m} ${_} u_${y};
#endif
`:`
#ifdef INSTANCED_ARRAYS
in ${m} ${x} a_${y};
#else
uniform ${m} ${_} u_${y};
#endif
`:f==="initialize-attribute-custom"?`
#ifdef HAS_ATTRIBUTE_a_${y}
    ${m} ${_} ${y} = a_${y};
#endif
`:b==="vec4"?`
#ifndef HAS_UNIFORM_u_${y}
    ${m} ${_} ${y} = a_${y};
#else
    ${m} ${_} ${y} = u_${y};
#endif
`:`
#ifndef HAS_UNIFORM_u_${y}
    ${m} ${_} ${y} = unpack_mix_${b}(a_${y}, u_${y}_t);
#else
    ${m} ${_} ${y} = u_${y};
#endif
`}),staticAttributes:n,usedDefines:h,vertexIncludes:a,fragmentIncludes:l}}class _D{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffers=[],this.vao=null}bind(t,i,r,n,s,a,l,h){this.context=t;let d=this.boundPaintVertexBuffers.length!==n.length;for(let m=0;!d&amp;&amp;m&lt;n.length;m++)this.boundPaintVertexBuffers[m]!==n[m]&amp;&amp;(d=!0);let f=this.boundDynamicVertexBuffers.length!==l.length;for(let m=0;!f&amp;&amp;m&lt;l.length;m++)this.boundDynamicVertexBuffers[m]!==l[m]&amp;&amp;(f=!0);if(!this.vao||this.boundProgram!==i||this.boundLayoutVertexBuffer!==r||d||f||this.boundIndexBuffer!==s||this.boundVertexOffset!==a)this.freshBind(i,r,n,s,a,l,h);else{t.bindVertexArrayOES.set(this.vao);for(const m of l)m&amp;&amp;(m.bind(),h&amp;&amp;m.instanceCount&amp;&amp;m.setVertexAttribDivisor(t.gl,i,h));s&amp;&amp;s.dynamicDraw&amp;&amp;s.bind()}}freshBind(t,i,r,n,s,a,l){const h=t.numAttributes,d=this.context,f=d.gl;this.vao&amp;&amp;this.destroy(),this.vao=d.gl.createVertexArray(),d.bindVertexArrayOES.set(this.vao),this.boundProgram=t,this.boundLayoutVertexBuffer=i,this.boundPaintVertexBuffers=r,this.boundIndexBuffer=n,this.boundVertexOffset=s,this.boundDynamicVertexBuffers=a,i.enableAttributes(f,t),i.bind(),i.setVertexAttribPointers(f,t,s);for(const m of r)m.enableAttributes(f,t),m.bind(),m.setVertexAttribPointers(f,t,s);for(const m of a)m&amp;&amp;(m.enableAttributes(f,t),m.bind(),m.setVertexAttribPointers(f,t,s),l&amp;&amp;m.instanceCount&amp;&amp;m.setVertexAttribDivisor(f,t,l));n&amp;&amp;n.bind(),d.currentNumAttributes=h}destroy(){this.vao&amp;&amp;(this.context.gl.deleteVertexArray(this.vao),this.vao=null)}}function gD(e,t){const i=Math.pow(2,t.canonical.z),r=t.canonical.y;return[new Be(0,r/i).toLngLat().lat,new Be(0,(r+1)/i).toLngLat().lat]}function yD(e,t,i,r,n,s,a){const l=e.context,h=l.gl,d=i.hillshadeFBO;if(!d)return;e.prepareDrawTile();const f=e.isTileAffectedByFog(t),m=e.getOrCreateProgram("hillshade",{overrideFog:f});l.activeTexture.set(h.TEXTURE0),h.bindTexture(h.TEXTURE_2D,d.colorAttachment.get());const _=((w,T,S,I)=&gt;{const P=S.paint.get("hillshade-shadow-color"),M=S.paint.get("hillshade-highlight-color"),C=S.paint.get("hillshade-accent-color"),D=S.paint.get("hillshade-emissive-strength");let O=$t(S.paint.get("hillshade-illumination-direction"));if(S.paint.get("hillshade-illumination-anchor")==="viewport")O-=w.transform.angle;else if(w.style&amp;&amp;w.style.enable3dLights()&amp;&amp;w.style.directionalLight){const z=w.style.directionalLight.properties.get("direction");O=$t(te(z.x,z.y,z.z)[1])}const k=!w.options.moving;return{u_matrix:I||w.transform.calculateProjMatrix(T.tileID.toUnwrapped(),k),u_image:0,u_latrange:gD(0,T.tileID),u_light:[S.paint.get("hillshade-exaggeration"),O],u_shadow:P,u_highlight:M,u_emissive_strength:D,u_accent:C}})(e,i,r,e.terrain?t.projMatrix:null);e.uploadCommonUniforms(l,m,t.toUnwrapped());const{tileBoundsBuffer:y,tileBoundsIndexBuffer:x,tileBoundsSegments:b}=e.getTileBoundsBuffers(i);m.draw(e,h.TRIANGLES,n,s,a,Le.disabled,_,r.id,y,x,b)}function ET(e,t,i){if(!t.needsDEMTextureUpload)return;const r=e.context,n=r.gl;r.pixelStoreUnpackPremultiplyAlpha.set(!1),t.demTexture=t.demTexture||e.getTileTexture(i.stride);const s=i.getPixels();t.demTexture?t.demTexture.update(s,{premultiply:!1}):t.demTexture=new Ii(r,s,n.R32F,{premultiply:!1}),t.needsDEMTextureUpload=!1}function xD(e,t,i){const r=e.context,n=r.gl;if(!t.dem)return;const s=t.dem;if(r.activeTexture.set(n.TEXTURE1),ET(e,t,s),!t.demTexture)return;t.demTexture.bind(n.NEAREST,n.CLAMP_TO_EDGE);const a=s.dim;r.activeTexture.set(n.TEXTURE0);let l=t.hillshadeFBO;if(!l){const _=new Ii(r,{width:a,height:a,data:null},n.RGBA);_.bind(n.LINEAR,n.CLAMP_TO_EDGE),l=t.hillshadeFBO=r.createFramebuffer(a,a,!0,"renderbuffer"),l.colorAttachment.set(_.texture)}r.bindFramebuffer.set(l.framebuffer),r.viewport.set([0,0,a,a]);const{tileBoundsBuffer:h,tileBoundsIndexBuffer:d,tileBoundsSegments:f}=e.getMercatorTileBoundsBuffers(),m=[];e.linearFloatFilteringSupported()&amp;&amp;m.push("TERRAIN_DEM_FLOAT_FORMAT"),e.getOrCreateProgram("hillshadePrepare",{defines:m}).draw(e,n.TRIANGLES,de.disabled,Pe.disabled,je.unblended,Le.disabled,((_,y)=&gt;{const x=y.stride,b=nt.create();return nt.ortho(b,0,ut,-ut,0,0,1),nt.translate(b,b,[0,-ut,0]),{u_matrix:b,u_image:1,u_dimension:[x,x],u_zoom:_.overscaledZ}})(t.tileID,s),i.id,h,d,f),t.needsHillshadePrepare=!1}const ST=e=&gt;({u_matrix:new be(e),u_image0:new Re(e),u_skirt_height:new wt(e),u_ground_shadow_factor:new Ee(e)}),AT=(e,t,i)=&gt;({u_matrix:e,u_image0:0,u_skirt_height:t,u_ground_shadow_factor:i}),MT=(e,t,i,r,n,s,a,l,h,d,f,m,_,y,x)=&gt;({u_proj_matrix:Float32Array.from(e),u_globe_matrix:t,u_normalize_matrix:Float32Array.from(r),u_merc_matrix:i,u_zoom_transition:n,u_merc_center:s,u_image0:0,u_frustum_tl:a,u_frustum_tr:l,u_frustum_br:h,u_frustum_bl:d,u_globe_pos:f,u_globe_radius:m,u_viewport:_,u_grid_matrix:x?Float32Array.from(x):new Float32Array(9),u_skirt_height:y}),Tl=(e,t)=&gt;{if(t&gt;0&amp;&amp;e.terrain&amp;&amp;tt("Cutoff is currently disabled on terrain"),t&lt;=0||e.terrain)return{shouldRenderCutoff:!1,uniformValues:{u_cutoff_params:[0,0,0,0]}};const i=e.transform,r=Math.max(Math.abs(i._zoom-(e.minCutoffZoom-1)),1),n=i.isLODDisabled(!1)?xn(60,45,i.pitch):xn(30,15,i.pitch),s=i._farZ-i._nearZ,a=t*i.height,l=((1-(h=n))*(.75*i.cameraToCenterDistance)+h*(i._farZ+a))*r;var h;return{shouldRenderCutoff:n&lt;1,uniformValues:{u_cutoff_params:[i._nearZ,i._farZ,(l-i._nearZ)/s,(l-a-i._nearZ)/s]}}};function IT(e,t){return e!=null&amp;&amp;t!=null&amp;&amp;!(!e.hasData()||!t.hasData())&amp;&amp;e.demTexture!=null&amp;&amp;t.demTexture!=null&amp;&amp;e.tileID.key!==t.tileID.key}const El=new class{constructor(){this.operations={}}newMorphing(e,t,i,r,n){if(e in this.operations){const s=this.operations[e];s.to.tileID.key!==i.tileID.key&amp;&amp;(s.queued=i)}else this.operations[e]={startTime:r,phase:0,duration:n,from:t,to:i,queued:null}}getMorphValuesForProxy(e){if(!(e in this.operations))return null;const t=this.operations[e];return{from:t.from,to:t.to,phase:t.phase}}update(e){for(const t in this.operations){const i=this.operations[t];for(i.phase=(e-i.startTime)/i.duration;i.phase&gt;=1||!this._validOp(i);)if(!this._nextOp(i,e)){delete this.operations[t];break}}}_nextOp(e,t){return!!e.queued&amp;&amp;(e.from=e.to,e.to=e.queued,e.queued=null,e.phase=0,e.startTime=t,!0)}_validOp(e){return e.from.hasData()&amp;&amp;e.to.hasData()}},PT={0:null,1:"TERRAIN_VERTEX_MORPHING"};function CT(e,t,i){if(t===0)return 0;const r=t&lt;1&amp;&amp;i===514?.25/t:1;return 6*Math.pow(1.5,22-e)*Math.max(t,1)*r}function vD(e,t){const i=1&lt;&lt;e.z;return!t&amp;&amp;(e.x===0||e.x===i-1)||e.y===0||e.y===i-1}const $_=e=&gt;({u_matrix:e});function LT(e,t,i,r,n){if(n&gt;0){const s=_e.now(),a=(s-e.timeAdded)/n,l=t?(s-t.timeAdded)/n:-1,h=i.getSource(),d=r.coveringZoomLevel({tileSize:h.tileSize,roundZoom:h.roundZoom}),f=!t||Math.abs(t.tileID.overscaledZ-d)&gt;Math.abs(e.tileID.overscaledZ-d),m=f&amp;&amp;e.refreshedUponExpiration?1:Xt(f?a:1-l,0,1);return e.refreshedUponExpiration&amp;&amp;a&gt;=1&amp;&amp;(e.refreshedUponExpiration=!1),t?{opacity:1,mix:1-m}:{opacity:m,mix:0}}return{opacity:1,mix:0}}class bD extends $n{constructor(t){const i={type:"raster-dem",maxzoom:t.transform.maxZoom},r=new ga(Qc(),null),n=U_("mock-dem",i,r,t.style);super("mock-dem",n,!1),n.setEventedParent(this),this._sourceLoaded=!0}_loadTile(t,i){t.state="loaded",i(null)}}class wD extends $n{constructor(t){const i=U_("proxy",{type:"geojson",maxzoom:t.transform.maxZoom},new ga(Qc(),null),t.style);super("proxy",i,!1),i.setEventedParent(this),this.map=this.getSource().map=t,this.used=this._sourceLoaded=!0,this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={}}update(t,i,r){if(t.freezeTileCoverage)return;this.transform=t;const n=t.coveringTiles({tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled}).reduce((s,a)=&gt;{if(s[a.key]="",!this._tiles[a.key]){const l=new jc(a,this._source.tileSize*a.overscaleFactor(),t.tileZoom);l.state="loaded",this._tiles[a.key]=l}return s},{});for(const s in this._tiles)s in n||(this.freeFBO(s),this._tiles[s].unloadVectorData(),delete this._tiles[s])}freeFBO(t){const i=this.proxyCachedFBO[t];if(i!==void 0){const r=Object.values(i);this.renderCachePool.push(...r),delete this.proxyCachedFBO[t]}}deallocRenderCache(){this.renderCache.forEach(t=&gt;t.fb.destroy()),this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={}}}class RT extends We{constructor(t,i,r){super(t.overscaledZ,t.wrap,t.canonical.z,t.canonical.x,t.canonical.y),this.proxyTileKey=i,this.projMatrix=r}}class TD extends e3{constructor(t,i){super(),this.painter=t,this.terrainTileForTile={},this.prevTerrainTileForTile={};const[r,n,s]=function(h){const d=new Kr,f=new Xi,m=131;d.reserve(17161),f.reserve(33800);const _=ut/128,y=ut+_/2,x=y+_;for(let w=-_;w&lt;x;w+=_)for(let T=-_;T&lt;x;T+=_){const S=T&lt;0||T&gt;y||w&lt;0||w&gt;y?24575:0,I=Xt(Math.round(T),0,ut),P=Xt(Math.round(w),0,ut);d.emplaceBack(I+S,P)}const b=(w,T)=&gt;{const S=T*m+w;f.emplaceBack(S+1,S,S+m),f.emplaceBack(S+m,S+m+1,S+1)};for(let w=1;w&lt;129;w++)for(let T=1;T&lt;129;T++)b(T,w);return[0,129].forEach(w=&gt;{for(let T=0;T&lt;130;T++)b(T,w),b(w,T)}),[d,f,32768]}(),a=t.context;this.gridBuffer=a.createVertexBuffer(r,wo.members),this.gridIndexBuffer=a.createIndexBuffer(n),this.gridSegments=si.simpleSegment(0,0,r.length,n.length),this.gridNoSkirtSegments=si.simpleSegment(0,0,r.length,s),this.proxyCoords=[],this.proxiedCoords={},this._visibleDemTiles=[],this._drapedRenderBatches=[],this._sourceTilesOverlap={},this.proxySourceCache=new wD(i.map),this.orthoMatrix=nt.create(),nt.ortho(this.orthoMatrix,this.painter.transform.projection.name==="globe"?.015:0,ut,0,ut,0,1);const l=a.gl;this._overlapStencilMode=new Pe({func:l.GEQUAL,mask:255},0,255,l.KEEP,l.KEEP,l.REPLACE),this._previousZoom=t.transform.zoom,this.pool=[],this._findCoveringTileCache={},this._tilesDirty={},this.style=i,this._useVertexMorphing=!0,this._exaggeration=1,this._mockSourceCache=new bD(i.map),this._pendingGroundEffectLayers=[]}set style(t){t.on("data",this._onStyleDataEvent.bind(this)),this._style=t,this._style.map.on("moveend",()=&gt;{this._clearLineLayersFromRenderCache()})}update(t,i,r){if(t&amp;&amp;t.terrain){this._style!==t&amp;&amp;(this.style=t,this._evaluationZoom=void 0);const n=t.terrain.properties,s=t.terrain.drapeRenderMode===0,a=t.terrain.isZoomDependent();this._previousUpdateTimestamp=this.enabled?this._updateTimestamp:void 0,this._updateTimestamp=_e.now();const l=t.terrain&amp;&amp;t.terrain.scope,h=n.get("source"),d=s?this._mockSourceCache:t.getSourceCache(h,l);if(!d)return void tt(`Couldn't find terrain source "${h}".`);if(this.sourceCache=d,this._exaggeration=a?this.calculateExaggeration(i):n.get("exaggeration"),!i.projection.requiresDraping&amp;&amp;a&amp;&amp;this._exaggeration===0)return void this._disable();this.enabled=!0;const f=()=&gt;{this.sourceCache.used&amp;&amp;tt(`Raster DEM source '${this.sourceCache.id}' is used both for terrain and as layer source.
This leads to lower resolution of hillshade. For full hillshade resolution but higher memory consumption, define another raster DEM source.`);const m=this.getScaledDemTileSize();this.sourceCache.update(i,m,!0),this.resetTileLookupCache(this.sourceCache.id)};this.sourceCache.usedForTerrain||(this.resetTileLookupCache(this.sourceCache.id),this.sourceCache.usedForTerrain=!0,f(),this._initializing=!0),f(),i.updateElevation(!0,r),this.resetTileLookupCache(this.proxySourceCache.id),this.proxySourceCache.update(i),this._emptyDEMTextureDirty=!0,this._previousZoom=i.zoom}else this._disable()}calculateExaggeration(t){const i=this._previousCameraAltitude,r=t.getFreeCameraOptions().position.z/t.pixelsPerMeter*t.worldSize;this._previousCameraAltitude=r;const n=i!=null?r-i:Number.MAX_VALUE;if(Math.abs(n)&lt;2)return this._exaggeration;const s=t.zoom,a=this._style.terrain;if(!this._previousUpdateTimestamp)return a.getExaggeration(s);let l=s-this._previousZoom;const h=this._previousUpdateTimestamp;let d=s;this._evaluationZoom!=null&amp;&amp;(d=this._evaluationZoom,Math.abs(s-d)&gt;.5&amp;&amp;(l=.5*(s-d+l)),l*n&lt;0&amp;&amp;(d+=l)),this._evaluationZoom=d;const f=a.getExaggeration(d),m=f===a.getExaggeration(Math.max(0,d-.1));if(m&amp;&amp;Math.abs(f-this._exaggeration)&lt;.01)return f;let _=Math.min(.1,.00375*(this._updateTimestamp-h));return(m||f&lt;.1||Math.abs(l)&lt;1e-4)&amp;&amp;(_=Math.min(.2,4*_)),ge(this._exaggeration,f,_)}resetTileLookupCache(t){this._findCoveringTileCache[t]={}}getScaledDemTileSize(){return this.sourceCache.getSource().tileSize/128*this.proxySourceCache.getSource().tileSize}_onStyleDataEvent(t){t.coord&amp;&amp;t.dataType==="source"?this._clearRenderCacheForTile(t.sourceCacheId,t.coord):t.dataType==="style"&amp;&amp;(this.invalidateRenderCache=!0,this._evaluationZoom=void 0,this._previousUpdateTimestamp=void 0,this._previousCameraAltitude=void 0)}_disable(){if(this.enabled&amp;&amp;(this.enabled=!1,this._sharedDepthStencil=void 0,this._evaluationZoom=void 0,this._previousUpdateTimestamp=void 0,this.proxySourceCache.deallocRenderCache(),this._style))for(const t in this._style._mergedSourceCaches)this._style._mergedSourceCaches[t].usedForTerrain=!1}destroy(){this._disable(),this._emptyDEMTexture&amp;&amp;this._emptyDEMTexture.destroy(),this._emptyDepthBufferTexture&amp;&amp;this._emptyDepthBufferTexture.destroy(),this.pool.forEach(t=&gt;t.fb.destroy()),this.pool=[],this._depthFBO&amp;&amp;(this._depthFBO.destroy(),this._depthFBO=void 0,this._depthTexture=void 0),this.framebufferCopyTexture&amp;&amp;this.framebufferCopyTexture.destroy()}_source(){return this.enabled?this.sourceCache:null}isUsingMockSource(){return this.sourceCache===this._mockSourceCache}exaggeration(){return this._exaggeration}get visibleDemTiles(){return this._visibleDemTiles}get drapeBufferSize(){const t=2*this.proxySourceCache.getSource().tileSize;return[t,t]}set useVertexMorphing(t){this._useVertexMorphing=t}updateTileBinding(t){if(!this.enabled)return;this.prevTerrainTileForTile=this.terrainTileForTile;const i=this.proxySourceCache,r=this.painter.transform;this._initializing&amp;&amp;(this._initializing=r._centerAltitude===0&amp;&amp;this.getAtPointOrZero(Be.fromLngLat(r.center),-1)===-1,this._emptyDEMTextureDirty=!this._initializing);const n=this.proxyCoords=i.getIds().map(h=&gt;{const d=i.getTileByID(h).tileID;return d.projMatrix=r.calculateProjMatrix(d.toUnwrapped()),d});(function(h,d){const f=d.transform.pointCoordinate(d.transform.getCameraPoint()),m=new Q(f.x,f.y);h.sort((_,y)=&gt;{if(y.overscaledZ-_.overscaledZ)return y.overscaledZ-_.overscaledZ;const x=new Q(_.canonical.x+(1&lt;&lt;_.canonical.z)*_.wrap,_.canonical.y),b=new Q(y.canonical.x+(1&lt;&lt;y.canonical.z)*y.wrap,y.canonical.y),w=m.mult(1&lt;&lt;_.canonical.z);return w.x-=.5,w.y-=.5,w.distSqr(x)-w.distSqr(b)})})(n,this.painter);const s=this.proxyToSource||{};this.proxyToSource={},n.forEach(h=&gt;{this.proxyToSource[h.key]={}}),this.terrainTileForTile={};const a=this._style._mergedSourceCaches;for(const h in a){const d=a[h];if(!d.used||(d!==this.sourceCache&amp;&amp;this.resetTileLookupCache(d.id),this._setupProxiedCoordsForOrtho(d,t[h],s),d.usedForTerrain))continue;const f=t[h];d.getSource().reparseOverscaled&amp;&amp;this._assignTerrainTiles(f)}this.proxiedCoords[i.id]=n.map(h=&gt;new RT(h,h.key,this.orthoMatrix)),this._assignTerrainTiles(n),this._prepareDEMTextures(),this._setupDrapedRenderBatches(),this._initFBOPool(),this._setupRenderCache(s),this.renderingToTexture=!1;const l={};this._visibleDemTiles=[];for(const h of this.proxyCoords){const d=this.terrainTileForTile[h.key];if(!d)continue;const f=d.tileID.key;f in l||(this._visibleDemTiles.push(d),l[f]=f)}}_assignTerrainTiles(t){this._initializing||t.forEach(i=&gt;{if(this.terrainTileForTile[i.key])return;const r=this._findTileCoveringTileID(i,this.sourceCache);r&amp;&amp;(this.terrainTileForTile[i.key]=r)})}_prepareDEMTextures(){const t=this.painter.context,i=t.gl;for(const r in this.terrainTileForTile){const n=this.terrainTileForTile[r],s=n.dem;!s||n.demTexture&amp;&amp;!n.needsDEMTextureUpload||(t.activeTexture.set(i.TEXTURE1),ET(this.painter,n,s))}}_prepareDemTileUniforms(t,i,r,n){if(!i||i.demTexture==null)return!1;const s=t.tileID.canonical,a=Math.pow(2,i.tileID.canonical.z-s.z),l=n||"";return r[`u_dem_tl${l}`]=[s.x*a%1,s.y*a%1],r[`u_dem_scale${l}`]=a,!0}get emptyDEMTexture(){return!this._emptyDEMTextureDirty&amp;&amp;this._emptyDEMTexture?this._emptyDEMTexture:this._updateEmptyDEMTexture()}get emptyDepthBufferTexture(){const t=this.painter.context,i=t.gl;if(!this._emptyDepthBufferTexture){const r=new Hi({width:1,height:1},Uint8Array.of(255,255,255,255));this._emptyDepthBufferTexture=new Ii(t,r,i.RGBA,{premultiply:!1})}return this._emptyDepthBufferTexture}_getLoadedAreaMinimum(){let t=0;const i=this._visibleDemTiles.reduce((r,n)=&gt;{if(!n.dem)return r;const s=n.dem.tree.minimums[0];return s&gt;0&amp;&amp;t++,r+s},0);return t?i/t:0}_updateEmptyDEMTexture(){const t=this.painter.context,i=t.gl;t.activeTexture.set(i.TEXTURE2);const r=this._getLoadedAreaMinimum(),[n,s]=(()=&gt;{const l=new T1({width:1,height:1},new Float32Array([r]));return[i.R32F,l]})();this._emptyDEMTextureDirty=!1;let a=this._emptyDEMTexture;return a?a.update(s,{premultiply:!1}):a=this._emptyDEMTexture=new Ii(t,s,n,{premultiply:!1}),a}setupElevationDraw(t,i,r){const n=this.painter.context,s=n.gl,a={u_dem:2,u_dem_prev:4,u_dem_tl:[0,0],u_dem_tl_prev:[0,0],u_dem_scale:0,u_dem_scale_prev:0,u_dem_size:0,u_dem_lerp:1,u_depth:3,u_depth_size_inv:[0,0],u_exaggeration:0};a.u_exaggeration=this.exaggeration();let l=null,h=null,d=1;if(r&amp;&amp;r.morphing&amp;&amp;this._useVertexMorphing){const _=r.morphing.srcDemTile,y=r.morphing.dstDemTile;d=r.morphing.phase,_&amp;&amp;y&amp;&amp;(this._prepareDemTileUniforms(t,_,a,"_prev")&amp;&amp;(h=_),this._prepareDemTileUniforms(t,y,a)&amp;&amp;(l=y))}const f=_=&gt;_&amp;&amp;_.demTexture&amp;&amp;this.painter.linearFloatFilteringSupported()?s.LINEAR:s.NEAREST,m=_=&gt;{a.u_dem_size=_.size[0]===1?1:_.size[0]-2};if(h&amp;&amp;l)n.activeTexture.set(s.TEXTURE2),l.demTexture.bind(f(l),s.CLAMP_TO_EDGE),n.activeTexture.set(s.TEXTURE4),h.demTexture.bind(f(h),s.CLAMP_TO_EDGE),l.demTexture&amp;&amp;m(l.demTexture),a.u_dem_lerp=d;else{l=this.terrainTileForTile[t.tileID.key],n.activeTexture.set(s.TEXTURE2);const _=this._prepareDemTileUniforms(t,l,a)?l.demTexture:this.emptyDEMTexture;_.bind(f(l),s.CLAMP_TO_EDGE),m(_)}if(n.activeTexture.set(s.TEXTURE3),r&amp;&amp;r.useDepthForOcclusion?(this._depthTexture&amp;&amp;this._depthTexture.bind(s.NEAREST,s.CLAMP_TO_EDGE),this._depthFBO&amp;&amp;(a.u_depth_size_inv=[1/this._depthFBO.width,1/this._depthFBO.height])):(this.emptyDepthBufferTexture.bind(s.NEAREST,s.CLAMP_TO_EDGE),a.u_depth_size_inv=[1,1]),r&amp;&amp;r.useMeterToDem&amp;&amp;l){const _=(1&lt;&lt;l.tileID.canonical.z)*ui(1,this.painter.transform.center.lat)*this.sourceCache.getSource().tileSize;a.u_meter_to_dem=_}if(r&amp;&amp;r.labelPlaneMatrixInv&amp;&amp;(a.u_label_plane_matrix_inv=r.labelPlaneMatrixInv),i.setTerrainUniformValues(n,a),this.painter.transform.projection.name==="globe"){const _=this.globeUniformValues(this.painter.transform,t.tileID.canonical,r&amp;&amp;r.useDenormalizedUpVectorScale);i.setGlobeUniformValues(n,_)}}globeUniformValues(t,i,r){const n=t.projection;return{u_tile_tl_up:n.upVector(i,0,0),u_tile_tr_up:n.upVector(i,ut,0),u_tile_br_up:n.upVector(i,ut,ut),u_tile_bl_up:n.upVector(i,0,ut),u_tile_up_scale:r?wh(1):n.upVectorScale(i,t.center.lat,t.worldSize).metersToTile}}renderToBackBuffer(t){const i=this.painter,r=this.painter.context;t.length!==0&amp;&amp;(r.bindFramebuffer.set(null),r.viewport.set([0,0,i.width,i.height]),i.gpuTimingDeferredRenderStart(),this.renderingToTexture=!1,function(n,s,a,l,h){if(n.transform.projection.name==="globe")(function(d,f,m,_,y){const x=d.context,b=x.gl;let w,T;const S=d.transform,I=e1(d,x,S),P=(Z,F)=&gt;{if(T===F)return;const Y=[PT[F],"PROJECTION_GLOBE_VIEW"];I&amp;&amp;Y.push("CUSTOM_ANTIALIASING");const J=d.isTileAffectedByFog(Z);w=d.getOrCreateProgram("globeRaster",{defines:Y,overrideFog:J}),T=F},M=d.colorModeForRenderPass(),C=new de(b.LEQUAL,de.ReadWrite,d.depthRangeFor3D);El.update(y);const D=Qv(S),O=[er(S.center.lng),sr(S.center.lat)],k=d.globeSharedBuffers,z=[S.width*_e.devicePixelRatio,S.height*_e.devicePixelRatio],B=Float32Array.from(S.globeMatrix),U={useDenormalizedUpVectorScale:!0};{const Z=d.transform,F=CT(Z.zoom,f.exaggeration(),f.sourceCache._source.tileSize);T=-1;const Y=b.TRIANGLES;for(const J of _){const it=m.getTile(J),X=Pe.disabled,K=f.prevTerrainTileForTile[J.key],ot=f.terrainTileForTile[J.key];IT(K,ot)&amp;&amp;El.newMorphing(J.key,K,ot,y,250),x.activeTexture.set(b.TEXTURE0),it.texture&amp;&amp;it.texture.bind(b.LINEAR,b.CLAMP_TO_EDGE);const lt=El.getMorphValuesForProxy(J.key),at=lt?1:0;lt&amp;&amp;Fs(U,{morphing:{srcDemTile:lt.from,dstDemTile:lt.to,phase:jr(lt.phase)}});const dt=Th(J.canonical),ft=HP(dt.getCenter().lat),_t=i1(J.canonical,dt,ft,Z.worldSize/Z._pixelsPerMercatorPixel),ct=Eo(pn(J.canonical)),bt=MT(Z.expandedFarZProjMatrix,B,D,ct,hr(Z.zoom),O,Z.frustumCorners.TL,Z.frustumCorners.TR,Z.frustumCorners.BR,Z.frustumCorners.BL,Z.globeCenterInViewSpace,Z.globeRadius,z,F,_t);if(P(J,at),w&amp;&amp;(f.setupElevationDraw(it,w,U),d.uploadCommonUniforms(x,w,J.toUnwrapped()),k)){const[Ot,kt,Ht]=k.getGridBuffers(ft,F!==0);w.draw(d,Y,C,X,M,Le.backCCW,bt,"globe_raster",Ot,kt,Ht)}}}if(k&amp;&amp;(d.renderDefaultNorthPole||d.renderDefaultSouthPole)){const Z=["GLOBE_POLES","PROJECTION_GLOBE_VIEW"];I&amp;&amp;Z.push("CUSTOM_ANTIALIASING"),w=d.getOrCreateProgram("globeRaster",{defines:Z});for(const F of _){const{x:Y,y:J,z:it}=F.canonical,X=J===0,K=J===(1&lt;&lt;it)-1,[ot,lt,at,dt]=k.getPoleBuffers(it,!1);if(dt&amp;&amp;(X||K)){const ft=m.getTile(F);x.activeTexture.set(b.TEXTURE0),ft.texture&amp;&amp;ft.texture.bind(b.LINEAR,b.CLAMP_TO_EDGE);let _t=t1(it,Y,S);const ct=Eo(pn(F.canonical)),bt=(Ot,kt)=&gt;Ot.draw(d,b.TRIANGLES,C,Pe.disabled,M,Le.disabled,MT(S.expandedFarZProjMatrix,_t,_t,ct,0,O,S.frustumCorners.TL,S.frustumCorners.TR,S.frustumCorners.BR,S.frustumCorners.BL,S.globeCenterInViewSpace,S.globeRadius,z,0),"globe_pole_raster",kt,at,dt);f.setupElevationDraw(ft,w,U),d.uploadCommonUniforms(x,w,F.toUnwrapped()),X&amp;&amp;d.renderDefaultNorthPole&amp;&amp;bt(w,ot),K&amp;&amp;d.renderDefaultSouthPole&amp;&amp;(_t=nt.scale(nt.create(),_t,[1,-1,1]),bt(w,lt))}}}})(n,s,a,l,h);else{const d=n.context,f=d.gl;let m,_;const y=n.shadowRenderer,x=Tl(n,n.longestCutoffRange),b=M=&gt;{if(_===M)return;const C=[];C.push(PT[M]),x.shouldRenderCutoff&amp;&amp;C.push("RENDER_CUTOFF"),m=n.getOrCreateProgram("terrainRaster",{defines:C}),_=M},w=n.colorModeForRenderPass(),T=new de(f.LEQUAL,de.ReadWrite,n.depthRangeFor3D);El.update(h);const S=n.transform,I=CT(S.zoom,s.exaggeration(),s.sourceCache._source.tileSize);let P=[0,0,0];if(y){const M=n.style.directionalLight,C=n.style.ambientLight;M&amp;&amp;C&amp;&amp;(P=Q_(M,C))}{_=-1;const M=f.TRIANGLES,[C,D]=[s.gridIndexBuffer,s.gridSegments];for(const O of l){const k=a.getTile(O),z=Pe.disabled,B=s.prevTerrainTileForTile[O.key],U=s.terrainTileForTile[O.key];IT(B,U)&amp;&amp;El.newMorphing(O.key,B,U,h,250),d.activeTexture.set(f.TEXTURE0),k.texture&amp;&amp;k.texture.bind(f.LINEAR,f.CLAMP_TO_EDGE);const Z=El.getMorphValuesForProxy(O.key),F=Z?1:0;let Y;Z&amp;&amp;(Y={morphing:{srcDemTile:Z.from,dstDemTile:Z.to,phase:jr(Z.phase)}});const J=AT(O.projMatrix,vD(O.canonical,S.renderWorldCopies)?I/10:I,P);if(b(F),!m)continue;s.setupElevationDraw(k,m,Y);const it=O.toUnwrapped();y&amp;&amp;y.setupShadows(it,m),n.uploadCommonUniforms(d,m,it,null,x),m.draw(n,M,T,z,w,Le.backCCW,J,"terrain_raster",s.gridBuffer,C,D)}}}}(i,this,this.proxySourceCache,t,this._updateTimestamp),this.renderingToTexture=!0,i.gpuTimingDeferredRenderEnd(),t.splice(0,t.length))}renderBatch(t){if(this._drapedRenderBatches.length===0)return t+1;this.renderingToTexture=!0;const i=this.painter,r=this.painter.context,n=this.proxySourceCache,s=this.proxiedCoords[n.id],a=this._drapedRenderBatches.shift(),l=i.style.order,h=[];let d=0;for(const f of s){const m=n.getTileByID(f.proxyTileKey),_=n.proxyCachedFBO[f.key]?n.proxyCachedFBO[f.key][t]:void 0,y=_!==void 0?n.renderCache[_]:this.pool[d++],x=_!==void 0;if(m.texture=y.tex,x&amp;&amp;!y.dirty){h.push(m.tileID);continue}let b;r.bindFramebuffer.set(y.fb.framebuffer),this.renderedToTile=!1,y.dirty&amp;&amp;(r.clear({color:Ie.transparent,stencil:0}),y.dirty=!1);for(let w=a.start;w&lt;=a.end;++w){const T=i.style._mergedLayers[l[w]];if(T.isHidden(i.transform.zoom))continue;const S=i.style.getLayerSourceCache(T),I=S?this.proxyToSource[f.key][S.id]:[f];if(!I)continue;const P=I;r.viewport.set([0,0,y.fb.width,y.fb.height]),b!==(S?S.id:null)&amp;&amp;(this._setupStencil(y,I,T,S),b=S?S.id:null),i.renderLayer(i,S,T,P)}if(this._drapedRenderBatches.length===0)for(const w of this._pendingGroundEffectLayers){const T=i.style._mergedLayers[l[w]];if(T.isHidden(i.transform.zoom))continue;const S=i.style.getLayerSourceCache(T),I=S?this.proxyToSource[f.key][S.id]:[f];if(!I)continue;const P=I;r.viewport.set([0,0,y.fb.width,y.fb.height]),b!==(S?S.id:null)&amp;&amp;(this._setupStencil(y,I,T,S),b=S?S.id:null),i.renderLayer(i,S,T,P)}this.renderedToTile?(y.dirty=!0,h.push(m.tileID)):x||--d,d===5&amp;&amp;(d=0,this.renderToBackBuffer(h))}return this.renderToBackBuffer(h),this.renderingToTexture=!1,r.bindFramebuffer.set(null),r.viewport.set([0,0,i.width,i.height]),a.end+1}postRender(){}isLayerOrderingCorrect(t){const i=t.order.length;let r=-1,n=i;for(let s=0;s&lt;i;++s)this._style.isLayerDraped(t._mergedLayers[t.order[s]])?r=Math.max(r,s):n=Math.min(n,s);return n&gt;r}getMinElevationBelowMSL(){let t=0;return this._visibleDemTiles.filter(i=&gt;i.dem).forEach(i=&gt;{t=Math.min(t,i.dem.tree.minimums[0])}),t===0?t:(t-30)*this._exaggeration}raycast(t,i,r){if(!this._visibleDemTiles)return null;const n=this._visibleDemTiles.filter(s=&gt;s.dem).map(s=&gt;{const a=s.tileID,l=1&lt;&lt;a.overscaledZ,{x:h,y:d}=a.canonical,f=h/l,m=(h+1)/l,_=d/l,y=(d+1)/l;return{minx:f,miny:_,maxx:m,maxy:y,t:s.dem.tree.raycastRoot(f,_,m,y,t,i,r),tile:s}});n.sort((s,a)=&gt;(s.t!==null?s.t:Number.MAX_VALUE)-(a.t!==null?a.t:Number.MAX_VALUE));for(const s of n){if(s.t==null)return null;const a=s.tile.dem.tree.raycast(s.minx,s.miny,s.maxx,s.maxy,t,i,r);if(a!=null)return a}return null}_createFBO(){const t=this.painter.context,i=t.gl,r=this.drapeBufferSize;t.activeTexture.set(i.TEXTURE0);const n=new Ii(t,{width:r[0],height:r[1],data:null},i.RGBA);n.bind(i.LINEAR,i.CLAMP_TO_EDGE);const s=t.createFramebuffer(r[0],r[1],!0,null);return s.colorAttachment.set(n.texture),s.depthAttachment=new CL(t,s.framebuffer),this._sharedDepthStencil===void 0?(this._sharedDepthStencil=t.createRenderbuffer(t.gl.DEPTH_STENCIL,r[0],r[1]),this._stencilRef=0,s.depthAttachment.set(this._sharedDepthStencil),t.clear({stencil:0})):s.depthAttachment.set(this._sharedDepthStencil),t.extTextureFilterAnisotropic&amp;&amp;i.texParameterf(i.TEXTURE_2D,t.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,t.extTextureFilterAnisotropicMax),{fb:s,tex:n,dirty:!1}}_initFBOPool(){for(;this.pool.length&lt;Math.min(5,this.proxyCoords.length);)this.pool.push(this._createFBO())}_shouldDisableRenderCache(){if(this._style.hasLightTransitions())return!0;for(const t in this._style._mergedSourceCaches)if(this._style._mergedSourceCaches[t].hasTransition())return!0;return this._style.order.some(t=&gt;{const i=this._style._mergedLayers[t],r=i.isHidden(this.painter.transform.zoom);return i.type==="custom"?!r&amp;&amp;i.shouldRedrape():!r&amp;&amp;i.hasTransition()})}_clearLineLayersFromRenderCache(){let t=!1;for(const r of this._style.getSources())if(r instanceof Gw){t=!0;break}if(!t)return;const i={};for(let r=0;r&lt;this._style.order.length;++r){const n=this._style._mergedLayers[this._style.order[r]],s=this._style.getLayerSourceCache(n);if(s&amp;&amp;!i[s.id]&amp;&amp;!n.isHidden(this.painter.transform.zoom)&amp;&amp;n.type==="line"&amp;&amp;n.widthExpression()instanceof po){i[s.id]=!0;for(const a of this.proxyCoords){const l=this.proxyToSource[a.key][s.id];if(l)for(const h of l)this._clearRenderCacheForTile(s.id,h)}}}}_clearRasterLayersFromRenderCache(){let t=!1;for(const r in this._style._mergedSourceCaches)if(this._style._mergedSourceCaches[r]._source instanceof P_){t=!0;break}if(!t)return;const i={};for(let r=0;r&lt;this._style.order.length;++r){const n=this._style._mergedLayers[this._style.order[r]],s=this._style.getLayerSourceCache(n);if(!s||i[s.id]||n.isHidden(this.painter.transform.zoom)||n.type!=="raster")continue;const a=n.paint.get("raster-fade-duration");for(const l of this.proxyCoords){const h=this.proxyToSource[l.key][s.id];if(h)for(const d of h){const f=LT(s.getTile(d),s.findLoadedParent(d,0),s,this.painter.transform,a);(f.opacity!==1||f.mix!==0)&amp;&amp;this._clearRenderCacheForTile(s.id,d)}}}}_setupDrapedRenderBatches(){const t=this._style.order,i=t.length;if(i===0)return;const r=[];this._pendingGroundEffectLayers=[];let n,s=0,a=this._style._mergedLayers[t[s]];for(;!this._style.isLayerDraped(a)&amp;&amp;a.isHidden(this.painter.transform.zoom)&amp;&amp;++s&lt;i;)a=this._style._mergedLayers[t[s]];for(;s&lt;i;++s){const l=this._style._mergedLayers[t[s]];l.isHidden(this.painter.transform.zoom)||(this._style.isLayerDraped(l)?n===void 0&amp;&amp;(n=s):(l.type==="fill-extrusion"&amp;&amp;this._pendingGroundEffectLayers.push(s),n!==void 0&amp;&amp;(r.push({start:n,end:s-1}),n=void 0)))}if(n!==void 0&amp;&amp;r.push({start:n,end:s-1}),r.length!==0){const l=r[r.length-1];this._pendingGroundEffectLayers.every(d=&gt;d&gt;l.end)||tt("fill-extrusion with flood lighting and/or ground ambient occlusion should be moved to be on top of all draped layers.")}this._drapedRenderBatches=r}_setupRenderCache(t){const i=this.proxySourceCache;if(this._shouldDisableRenderCache()||this.invalidateRenderCache){if(this.invalidateRenderCache=!1,i.renderCache.length&gt;i.renderCachePool.length){const a=Object.values(i.proxyCachedFBO);i.proxyCachedFBO={};for(let l=0;l&lt;a.length;++l){const h=Object.values(a[l]);i.renderCachePool.push(...h)}}return}this._clearRasterLayersFromRenderCache();const r=this.proxyCoords,n=this._tilesDirty;for(let a=r.length-1;a&gt;=0;a--){const l=r[a];if(i.getTileByID(l.key),i.proxyCachedFBO[l.key]!==void 0){const h=t[l.key],d=this.proxyToSource[l.key];let f=0;for(const m in d){const _=d[m],y=h[m];if(!y||y.length!==_.length||_.some((x,b)=&gt;x!==y[b]||n[m]&amp;&amp;n[m].hasOwnProperty(x.key))){f=-1;break}++f}for(const m in i.proxyCachedFBO[l.key])i.renderCache[i.proxyCachedFBO[l.key][m]].dirty=f&lt;0||f!==Object.values(h).length}}const s=[...this._drapedRenderBatches];s.sort((a,l)=&gt;l.end-l.start-(a.end-a.start));for(const a of s)for(const l of r){if(i.proxyCachedFBO[l.key])continue;let h=i.renderCachePool.pop();h===void 0&amp;&amp;i.renderCache.length&lt;50&amp;&amp;(h=i.renderCache.length,i.renderCache.push(this._createFBO())),h!==void 0&amp;&amp;(i.proxyCachedFBO[l.key]={},i.proxyCachedFBO[l.key][a.start]=h,i.renderCache[h].dirty=!0)}this._tilesDirty={}}_setupStencil(t,i,r,n){if(!n||!this._sourceTilesOverlap[n.id])return void(this._overlapStencilType&amp;&amp;(this._overlapStencilType=!1));const s=this.painter.context,a=s.gl;if(i.length&lt;=1)return void(this._overlapStencilType=!1);let l;if(r.isTileClipped())l=i.length,this._overlapStencilMode.test={func:a.EQUAL,mask:255},this._overlapStencilType="Clip";else{if(!(i[0].overscaledZ&gt;i[i.length-1].overscaledZ))return void(this._overlapStencilType=!1);l=1,this._overlapStencilMode.test={func:a.GREATER,mask:255},this._overlapStencilType="Mask"}this._stencilRef+l&gt;255&amp;&amp;(s.clear({stencil:0}),this._stencilRef=0),this._stencilRef+=l,this._overlapStencilMode.ref=this._stencilRef,r.isTileClipped()&amp;&amp;this._renderTileClippingMasks(i,this._overlapStencilMode.ref)}clipOrMaskOverlapStencilType(){return this._overlapStencilType==="Clip"||this._overlapStencilType==="Mask"}stencilModeForRTTOverlap(t){return this.renderingToTexture&amp;&amp;this._overlapStencilType?(this._overlapStencilType==="Clip"&amp;&amp;(this._overlapStencilMode.ref=this.painter._tileClippingMaskIDs[t.key]),this._overlapStencilMode):Pe.disabled}_renderTileClippingMasks(t,i){const r=this.painter,n=this.painter.context,s=n.gl;r._tileClippingMaskIDs={},n.setColorMode(je.disabled),n.setDepthMode(de.disabled);const a=r.getOrCreateProgram("clippingMask");for(const l of t){const h=r._tileClippingMaskIDs[l.key]=--i;a.draw(r,s.TRIANGLES,de.disabled,new Pe({func:s.ALWAYS,mask:0},h,255,s.KEEP,s.KEEP,s.REPLACE),je.disabled,Le.disabled,$_(l.projMatrix),"$clipping",r.tileExtentBuffer,r.quadTriangleIndexBuffer,r.tileExtentSegments)}}pointCoordinate(t){const i=this.painter.transform;if(t.x&lt;0||t.x&gt;i.width||t.y&lt;0||t.y&gt;i.height)return null;const r=[t.x,t.y,1,1];oi.transformMat4(r,r,i.pixelMatrixInverse),oi.scale(r,r,1/r[3]),r[0]/=i.worldSize,r[1]/=i.worldSize;const n=i._camera.position,s=ui(1,i.center.lat),a=[n[0],n[1],n[2]/s,0],l=W.subtract([],r.slice(0,3),a);W.normalize(l,l);const h=this.raycast(a,l,this._exaggeration);return h!==null&amp;&amp;h?(W.scaleAndAdd(a,a,l,h),a[3]=a[2],a[2]*=s,a):null}drawDepth(){const t=this.painter,i=t.context,r=this.proxySourceCache,n=Math.ceil(t.width),s=Math.ceil(t.height);if(!this._depthFBO||this._depthFBO.width===n&amp;&amp;this._depthFBO.height===s||(this._depthFBO.destroy(),this._depthFBO=void 0,this._depthTexture=void 0),!this._depthFBO){const a=i.gl,l=i.createFramebuffer(n,s,!0,"renderbuffer");i.activeTexture.set(a.TEXTURE0);const h=new Ii(i,{width:n,height:s,data:null},a.RGBA);h.bind(a.NEAREST,a.CLAMP_TO_EDGE),l.colorAttachment.set(h.texture);const d=i.createRenderbuffer(i.gl.DEPTH_COMPONENT16,n,s);l.depthAttachment.set(d),this._depthFBO=l,this._depthTexture=h}i.bindFramebuffer.set(this._depthFBO.framebuffer),i.viewport.set([0,0,n,s]),function(a,l,h,d){if(a.transform.projection.name==="globe")return;const f=a.context,m=f.gl;f.clear({depth:1});const _=a.getOrCreateProgram("terrainDepth"),y=new de(m.LESS,de.ReadWrite,a.depthRangeFor3D);for(const x of d){const b=h.getTile(x),w=AT(x.projMatrix,0,[0,0,0]);l.setupElevationDraw(b,_),_.draw(a,m.TRIANGLES,y,Pe.disabled,je.unblended,Le.backCCW,w,"terrain_depth",l.gridBuffer,l.gridIndexBuffer,l.gridNoSkirtSegments)}}(t,this,r,this.proxyCoords)}_setupProxiedCoordsForOrtho(t,i,r){if(t.getSource()instanceof Rn)return this._setupProxiedCoordsForImageSource(t,i,r);this._findCoveringTileCache[t.id]=this._findCoveringTileCache[t.id]||{};const n=this.proxiedCoords[t.id]=[],s=this.proxyCoords;for(let l=0;l&lt;s.length;l++){const h=s[l],d=this._findTileCoveringTileID(h,t);if(d){const f=this._createProxiedId(h,d,r[h.key]&amp;&amp;r[h.key][t.id]);n.push(f),this.proxyToSource[h.key][t.id]=[f]}}let a=!1;for(let l=0;l&lt;i.length;l++){const h=t.getTile(i[l]);if(!h||!h.hasData())continue;const d=this._findTileCoveringTileID(h.tileID,this.proxySourceCache);if(d&amp;&amp;d.tileID.canonical.z!==h.tileID.canonical.z){const f=this.proxyToSource[d.tileID.key][t.id],m=this._createProxiedId(d.tileID,h,r[d.tileID.key]&amp;&amp;r[d.tileID.key][t.id]);f?f.splice(f.length-1,0,m):this.proxyToSource[d.tileID.key][t.id]=[m],n.push(m),a=!0}}this._sourceTilesOverlap[t.id]=a}_setupProxiedCoordsForImageSource(t,i,r){if(!t.getSource().loaded())return;const n=this.proxiedCoords[t.id]=[],s=this.proxyCoords,a=t.getSource(),l=a.tileID;if(!l)return;const h=new Q(l.x,l.y)._div(1&lt;&lt;l.z),d=a.coordinates.map(Be.fromLngLat).reduce((m,_)=&gt;(m.min.x=Math.min(m.min.x,_.x-h.x),m.min.y=Math.min(m.min.y,_.y-h.y),m.max.x=Math.max(m.max.x,_.x-h.x),m.max.y=Math.max(m.max.y,_.y-h.y),m),{min:new Q(Number.MAX_VALUE,Number.MAX_VALUE),max:new Q(-Number.MAX_VALUE,-Number.MAX_VALUE)}),f=(m,_)=&gt;{const y=m.wrap+m.canonical.x/(1&lt;&lt;m.canonical.z),x=m.canonical.y/(1&lt;&lt;m.canonical.z),b=ut/(1&lt;&lt;m.canonical.z),w=_.wrap+_.canonical.x/(1&lt;&lt;_.canonical.z),T=_.canonical.y/(1&lt;&lt;_.canonical.z);return y+b&lt;w+d.min.x||y&gt;w+d.max.x||x+b&lt;T+d.min.y||x&gt;T+d.max.y};for(let m=0;m&lt;s.length;m++){const _=s[m];for(let y=0;y&lt;i.length;y++){const x=t.getTile(i[y]);if(!x||!x.hasData()||f(_,x.tileID))continue;const b=this._createProxiedId(_,x,r[_.key]&amp;&amp;r[_.key][t.id]),w=this.proxyToSource[_.key][t.id];w?w.push(b):this.proxyToSource[_.key][t.id]=[b],n.push(b)}}}_createProxiedId(t,i,r){let n=this.orthoMatrix;if(r){const s=r.find(a=&gt;a.key===i.tileID.key);if(s)return s}if(i.tileID.key!==t.key){const s=t.canonical.z-i.tileID.canonical.z;let a,l,h;n=nt.create();const d=i.tileID.wrap-t.wrap&lt;&lt;t.overscaledZ;s&gt;0?(a=ut&gt;&gt;s,l=a*((i.tileID.canonical.x&lt;&lt;s)-t.canonical.x+d),h=a*((i.tileID.canonical.y&lt;&lt;s)-t.canonical.y)):(a=ut&lt;&lt;-s,l=ut*(i.tileID.canonical.x-(t.canonical.x+d&lt;&lt;-s)),h=ut*(i.tileID.canonical.y-(t.canonical.y&lt;&lt;-s))),nt.ortho(n,0,a,0,a,0,1),nt.translate(n,n,[l,h,0])}return new RT(i.tileID,t.key,n)}_findTileCoveringTileID(t,i){let r=i.getTile(t);if(r&amp;&amp;r.hasData())return r;const n=this._findCoveringTileCache[i.id],s=n[t.key];if(r=s?i.getTileByID(s):null,r&amp;&amp;r.hasData()||s===null)return r;let a=r?r.tileID:t,l=a.overscaledZ;const h=i.getSource().minzoom,d=[];if(!s){const m=i.getSource().maxzoom;if(t.canonical.z&gt;=m){const _=t.canonical.z-m;i.getSource().reparseOverscaled?(l=Math.max(t.canonical.z+2,i.transform.tileZoom),a=new We(l,t.wrap,m,t.canonical.x&gt;&gt;_,t.canonical.y&gt;&gt;_)):_!==0&amp;&amp;(l=m,a=new We(l,t.wrap,m,t.canonical.x&gt;&gt;_,t.canonical.y&gt;&gt;_))}a.key!==t.key&amp;&amp;(d.push(a.key),r=i.getTile(a))}const f=m=&gt;{d.forEach(_=&gt;{n[_]=m}),d.length=0};for(l-=1;l&gt;=h&amp;&amp;(!r||!r.hasData());l--){r&amp;&amp;f(r.tileID.key);const m=a.calculateScaledKey(l);if(r=i.getTileByID(m),r&amp;&amp;r.hasData())break;const _=n[m];if(_===null)break;_===void 0?d.push(m):r=i.getTileByID(_)}return f(r?r.tileID.key:null),r&amp;&amp;r.hasData()?r:null}findDEMTileFor(t){return this.enabled?this._findTileCoveringTileID(t,this.sourceCache):null}prepareDrawTile(){this.renderedToTile=!0}_clearRenderCacheForTile(t,i){let r=this._tilesDirty[t];r||(r=this._tilesDirty[t]={}),r[i.key]=!0}}function ED(e,t,i){const r=function(l,h,d){const f=W.dot(h,l),m=W.dot(d,[.2126,.7152,.0722]),_=(x,b,w)=&gt;(1-w)*x+w*b,y=_(1-.3*Math.min(m,1),1,Math.min(f+1,1));return _(.92,1,Math.asin(Xt(h[2],-1,1))/Math.PI+.5)*y}(e,[0,0,1],t),n=[0,0,0];W.scale(n,i.slice(0,3),r);const s=[0,0,0];W.scale(s,t.slice(0,3),e[2]);const a=[0,0,0];return W.add(a,n,s),Ri(a)}const SD=["fill","fillOutline","fillPattern","line","linePattern","background","backgroundPattern","hillshade","raster"],AD=["stars","fillExtrusion","fillExtrusionGroundEffect","model","symbolSDF","symbolIcon","symbolTextAndIcon"];class DT{static cacheKey(t,i,r,n){let s=`${i}${n?n.cacheKey:""}`;for(const a of r)t.usedDefines.includes(a)&amp;&amp;(s+=`/${a}`);return s}constructor(t,i,r,n,s,a){const l=t.gl;this.program=l.createProgram(),this.configuration=n,this.name=i,this.fixedDefines=[...a];const h=n?n.getBinderAttributes():[],d=(r.staticAttributes||[]).concat(h);let f=n?n.defines():[];f=f.concat(a.map(w=&gt;`#define ${w}`));const m=`#version 300 es
`;let _=m+f.concat("precision mediump float;",wT,bT.fragmentSource).join(`
`);for(const w of r.fragmentIncludes)_+=`
${Md[w]}`;_+=`
${r.fragmentSource}`;let y=m+f.concat("precision highp float;",wT,bT.vertexSource).join(`
`);for(const w of r.vertexIncludes)y+=`
${Md[w]}`;y+=`
${r.vertexSource}`;const x=l.createShader(l.FRAGMENT_SHADER);if(l.isContextLost())return void(this.failedToCreate=!0);l.shaderSource(x,_),l.compileShader(x),l.attachShader(this.program,x);const b=l.createShader(l.VERTEX_SHADER);if(l.isContextLost())this.failedToCreate=!0;else{l.shaderSource(b,y),l.compileShader(b),l.attachShader(this.program,b),this.attributes={},this.numAttributes=d.length;for(let w=0;w&lt;this.numAttributes;w++)if(d[w]){const T=d[w].startsWith("a_")?d[w]:`a_${d[w]}`;l.bindAttribLocation(this.program,w,T),this.attributes[T]=w}l.linkProgram(this.program),l.deleteShader(b),l.deleteShader(x),this.fixedUniforms=s(t),this.binderUniforms=n?n.getUniforms(t):[],a.includes("TERRAIN")&amp;&amp;(this.terrainUniforms=(w=&gt;({u_dem:new Re(w),u_dem_prev:new Re(w),u_dem_tl:new De(w),u_dem_scale:new wt(w),u_dem_tl_prev:new De(w),u_dem_scale_prev:new wt(w),u_dem_size:new wt(w),u_dem_lerp:new wt(w),u_exaggeration:new wt(w),u_depth:new Re(w),u_depth_size_inv:new De(w),u_meter_to_dem:new wt(w),u_label_plane_matrix_inv:new be(w)}))(t)),a.includes("GLOBE")&amp;&amp;(this.globeUniforms=(w=&gt;({u_tile_tl_up:new Ee(w),u_tile_tr_up:new Ee(w),u_tile_br_up:new Ee(w),u_tile_bl_up:new Ee(w),u_tile_up_scale:new wt(w)}))(t)),a.includes("FOG")&amp;&amp;(this.fogUniforms=(w=&gt;({u_fog_matrix:new be(w),u_fog_range:new De(w),u_fog_color:new Jr(w),u_fog_horizon_blend:new wt(w),u_fog_vertical_limit:new De(w),u_fog_temporal_offset:new wt(w),u_frustum_tl:new Ee(w),u_frustum_tr:new Ee(w),u_frustum_br:new Ee(w),u_frustum_bl:new Ee(w),u_globe_pos:new Ee(w),u_globe_radius:new wt(w),u_globe_transition:new wt(w),u_is_globe:new Re(w),u_viewport:new De(w)}))(t)),a.includes("RENDER_CUTOFF")&amp;&amp;(this.cutoffUniforms=(w=&gt;({u_cutoff_params:new Jr(w)}))(t)),a.includes("LIGHTING_3D_MODE")&amp;&amp;(this.lightsUniforms=(w=&gt;({u_lighting_ambient_color:new Ee(w),u_lighting_directional_dir:new Ee(w),u_lighting_directional_color:new Ee(w),u_ground_radiance:new Ee(w)}))(t)),a.includes("RENDER_SHADOWS")&amp;&amp;(this.shadowUniforms=(w=&gt;({u_light_matrix_0:new be(w),u_light_matrix_1:new be(w),u_fade_range:new De(w),u_shadow_normal_offset:new Ee(w),u_shadow_intensity:new wt(w),u_shadow_texel_size:new wt(w),u_shadow_map_resolution:new wt(w),u_shadow_direction:new Ee(w),u_shadow_bias:new Ee(w),u_shadowmap_0:new Re(w),u_shadowmap_1:new Re(w)}))(t))}}setTerrainUniformValues(t,i){if(!this.terrainUniforms)return;const r=this.terrainUniforms;if(!this.failedToCreate){t.program.set(this.program);for(const n in i)r[n]&amp;&amp;r[n].set(this.program,n,i[n])}}setGlobeUniformValues(t,i){if(!this.globeUniforms)return;const r=this.globeUniforms;if(!this.failedToCreate){t.program.set(this.program);for(const n in i)r[n]&amp;&amp;r[n].set(this.program,n,i[n])}}setFogUniformValues(t,i){if(!this.fogUniforms)return;const r=this.fogUniforms;if(!this.failedToCreate){t.program.set(this.program);for(const n in i)r[n].set(this.program,n,i[n])}}setCutoffUniformValues(t,i){if(!this.cutoffUniforms)return;const r=this.cutoffUniforms;if(!this.failedToCreate){t.program.set(this.program);for(const n in i)r[n].set(this.program,n,i[n])}}setLightsUniformValues(t,i){if(!this.lightsUniforms)return;const r=this.lightsUniforms;if(!this.failedToCreate){t.program.set(this.program);for(const n in i)r[n].set(this.program,n,i[n])}}setShadowUniformValues(t,i){if(this.failedToCreate||!this.shadowUniforms)return;const r=this.shadowUniforms;t.program.set(this.program);for(const n in i)r[n].set(this.program,n,i[n])}_drawDebugWireframe(t,i,r,n,s,a,l,h,d,f){const m=t.options.wireframe;if(m.terrain===!1&amp;&amp;m.layers2D===!1&amp;&amp;m.layers3D===!1)return;const _=t.context;if(!(!(!m.terrain||this.name!=="terrainRaster"&amp;&amp;this.name!=="globeRaster")||!(!m.layers2D||t._terrain&amp;&amp;t._terrain.renderingToTexture||!SD.includes(this.name))||!(!m.layers3D||!AD.includes(this.name))))return;const y=_.gl,x=t.wireframeDebugCache.getLinesFromTrianglesBuffer(t.frameCounter,s,_);if(!x)return;const b=[...this.fixedDefines];b.push("DEBUG_WIREFRAME");const w=t.getOrCreateProgram(this.name,{config:this.configuration,defines:b});_.program.set(w.program);const T=(P,M,C)=&gt;{if(M[P]&amp;&amp;C[P])for(const D in M[P])C[P][D]&amp;&amp;C[P][D].set(C.program,D,M[P][D].current)};d&amp;&amp;d.setUniforms(w.program,_,w.binderUniforms,l,{zoom:h}),T("fixedUniforms",this,w),T("terrainUniforms",this,w),T("globeUniforms",this,w),T("fogUniforms",this,w),T("lightsUniforms",this,w),T("shadowUniforms",this,w),x.bind(),_.setColorMode(new je([y.ONE,y.ONE_MINUS_SRC_ALPHA,y.ZERO,y.ONE],Ie.transparent,[!0,!0,!0,!1])),_.setDepthMode(new de(i.func===y.LESS?y.LEQUAL:i.func,de.ReadOnly,i.range)),_.setStencilMode(Pe.disabled);const S=3*a.primitiveLength*2,I=3*a.primitiveOffset*2*2;f&amp;&amp;f&gt;1?y.drawElementsInstanced(y.LINES,S,y.UNSIGNED_SHORT,I,f):y.drawElements(y.LINES,S,y.UNSIGNED_SHORT,I),s.bind(),_.program.set(this.program),_.setDepthMode(i),_.setStencilMode(r),_.setColorMode(n)}draw(t,i,r,n,s,a,l,h,d,f,m,_,y,x,b,w){const T=t.context,S=T.gl;if(this.failedToCreate)return;T.program.set(this.program),T.setDepthMode(r),T.setStencilMode(n),T.setColorMode(s),T.setCullFace(a);for(const M of Object.keys(this.fixedUniforms))this.fixedUniforms[M].set(this.program,M,l[M]);x&amp;&amp;x.setUniforms(this.program,T,this.binderUniforms,_,{zoom:y});const I={[S.LINES]:2,[S.TRIANGLES]:3,[S.LINE_STRIP]:1}[i],P=w&amp;&amp;w&gt;0?1:void 0;for(const M of m.get()){const C=M.vaos||(M.vaos={});(C[h]||(C[h]=new _D)).bind(T,this,d,x?x.getPaintVertexBuffers():[],f,M.vertexOffset,b||[],P),w&amp;&amp;w&gt;1?S.drawElementsInstanced(i,M.primitiveLength*I,S.UNSIGNED_SHORT,M.primitiveOffset*I*2,w):S.drawElements(i,M.primitiveLength*I,S.UNSIGNED_SHORT,M.primitiveOffset*I*2),i===S.TRIANGLES&amp;&amp;this._drawDebugWireframe(t,r,n,s,f,M,_,y,x,w)}}}function OT(e,t){const i=Math.pow(2,t.tileID.overscaledZ),r=t.tileSize*Math.pow(2,e.transform.tileZoom)/i,n=r*(t.tileID.canonical.x+t.tileID.wrap*i),s=r*t.tileID.canonical.y;return{u_image:0,u_texsize:t.imageAtlasTexture?t.imageAtlasTexture.size:[0,0],u_tile_units_to_pixels:1/fa(t,1,e.transform.tileZoom),u_pixel_coord_upper:[n&gt;&gt;16,s&gt;&gt;16],u_pixel_coord_lower:[65535&amp;n,65535&amp;s]}}const MD=nt.create(),kT=(e,t,i,r,n,s,a,l,h,d,f,m,_,y,x,b)=&gt;{const w=t.style.light,T=w.properties.get("position"),S=[T.x,T.y,T.z],I=Br.create();w.properties.get("anchor")==="viewport"&amp;&amp;(Br.fromRotation(I,-t.transform.angle),W.transformMat3(S,S,I));const P=w.properties.get("color"),M=t.transform,C={u_matrix:e,u_lightpos:S,u_lightintensity:w.properties.get("intensity"),u_lightcolor:[P.r,P.g,P.b],u_vertical_gradient:+i,u_opacity:r,u_tile_id:[0,0,0],u_zoom_transition:0,u_inv_rot_matrix:MD,u_merc_center:[0,0],u_up_dir:[0,0,0],u_height_lift:0,u_ao:n,u_edge_radius:s,u_flood_light_color:m,u_vertical_scale:_,u_flood_light_intensity:y,u_ground_shadow_factor:x,u_emissive_strength:b};return M.projection.name==="globe"&amp;&amp;(C.u_tile_id=[a.canonical.x,a.canonical.y,1&lt;&lt;a.canonical.z],C.u_zoom_transition=h,C.u_inv_rot_matrix=f,C.u_merc_center=d,C.u_up_dir=M.projection.upVector(new In(0,0,0),d[0]*ut,d[1]*ut),C.u_height_lift=l),C},ID=(e,t,i)=&gt;({u_matrix:e,u_edge_radius:t,u_vertical_scale:i}),PD=(e,t,i,r,n,s,a,l,h,d,f,m,_,y)=&gt;{const x=kT(e,t,i,r,n,s,a,h,d,f,m,_,y,1,[0,0,0],0),b={u_height_factor:-Math.pow(2,a.overscaledZ)/l.tileSize/8};return Bt(x,OT(t,l),b)},zT=(e,t)=&gt;({u_matrix:e,u_emissive_strength:t}),FT=(e,t,i,r)=&gt;Bt(zT(e,t),OT(i,r)),CD=(e,t,i)=&gt;({u_matrix:e,u_world:i,u_emissive_strength:t}),LD=(e,t,i,r,n)=&gt;Bt(FT(e,t,i,r),{u_world:n}),RD=(e,t,i,r)=&gt;{const n=ut/i.tileSize;return{u_matrix:e,u_camera_to_center_distance:t.getCameraToCenterDistance(r),u_extrude_scale:[t.pixelsToGLUnits[0]/n,t.pixelsToGLUnits[1]/n]}},BT=(e,t,i=1)=&gt;({u_matrix:e,u_color:t,u_overlay:0,u_overlay_scale:i}),DD=nt.create(),OD=(e,t,i,r,n,s,a)=&gt;{const l=e.transform,h=l.projection.name==="globe",d=h?Kv(l.zoom,t.canonical)*l._pixelsPerMercatorPixel:fa(i,1,s),f={u_matrix:t.projMatrix,u_extrude_scale:d,u_intensity:a,u_inv_rot_matrix:DD,u_merc_center:[0,0],u_tile_id:[0,0,0],u_zoom_transition:0,u_up_dir:[0,0,0]};if(h){f.u_inv_rot_matrix=r,f.u_merc_center=n,f.u_tile_id=[t.canonical.x,t.canonical.y,1&lt;&lt;t.canonical.z],f.u_zoom_transition=hr(l.zoom);const m=n[0]*ut,_=n[1]*ut;f.u_up_dir=l.projection.upVector(new In(0,0,0),m,_)}return f},NT=(e,t,i,r,n,s,a,l,h,d,f,m,_,y,x,b,w,T,S,I,P,M)=&gt;{return{u_matrix:e,u_normalize_matrix:t,u_globe_matrix:i,u_merc_matrix:r,u_grid_matrix:n,u_tl_parent:s,u_scale_parent:f,u_fade_t:m.mix,u_opacity:m.opacity*_.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:_.paint.get("raster-brightness-min"),u_brightness_high:_.paint.get("raster-brightness-max"),u_saturation_factor:(D=_.paint.get("raster-saturation"),D&gt;0?1-1/(1.001-D):-D),u_contrast_factor:(C=_.paint.get("raster-contrast"),C&gt;0?1/(1-C):1+C),u_spin_weights:kD(_.paint.get("raster-hue-rotate")),u_perspective_transform:y,u_raster_elevation:x,u_tl_br:a,u_zoom_transition:l,u_merc_center:h,u_cutoff_params:d,u_colorization_mix:zD(w,S),u_colorization_offset:FD(T,S),u_color_ramp:b,u_texture_offset:[P/(I+2*P),I/(I+2*P)],u_texture_res:[I+2*P,I+2*P],u_emissive_strength:M};var C,D};function kD(e){e*=Math.PI/180;const t=Math.sin(e),i=Math.cos(e);return[(2*i+1)/3,(-Math.sqrt(3)*t-i+1)/3,(Math.sqrt(3)*t-i+1)/3]}function zD([e,t,i,r],[n,s]){if(n===s)return[0,0,0,0];const a=259/257/(s-n);return[e*a,t*a,i*a,r*a]}function FD(e,[t,i]){return t===i?0:((e-t)/(i-t)*259-1)/257}const UT=nt.create(),VT=(e,t,i,r,n,s,a,l,h,d,f,m,_,y,x,b,w,T)=&gt;{const S=n.transform,I={u_is_size_zoom_constant:+(e==="constant"||e==="source"),u_is_size_feature_constant:+(e==="constant"||e==="camera"),u_size_t:t?t.uSizeT:0,u_size:t?t.uSize:0,u_camera_to_center_distance:S.getCameraToCenterDistance(b),u_rotate_symbol:+i,u_aspect_ratio:S.width/S.height,u_fade_change:n.options.fadeDuration?n.symbolFadeChange:1,u_matrix:s,u_label_plane_matrix:a,u_coord_matrix:l,u_is_text:+h,u_pitch_with_map:+r,u_texsize:d,u_texture:0,u_tile_id:[0,0,0],u_zoom_transition:0,u_inv_rot_matrix:UT,u_merc_center:[0,0],u_camera_forward:[0,0,0],u_ecef_origin:[0,0,0],u_tile_matrix:UT,u_up_vector:[0,-1,0],u_icon_transition:T||0,u_icon_saturation:w};return b.name==="globe"&amp;&amp;(I.u_tile_id=[f.canonical.x,f.canonical.y,1&lt;&lt;f.canonical.z],I.u_zoom_transition=m,I.u_inv_rot_matrix=y,I.u_merc_center=_,I.u_camera_forward=S._camera.forward(),I.u_ecef_origin=function(P,M){const C=[0,0,0],D=Eo(pn(M.canonical));return W.transformMat4(C,C,D),W.transformMat4(C,C,P),C}(S.globeMatrix,f.toUnwrapped()),I.u_tile_matrix=Float32Array.from(S.globeMatrix),I.u_up_vector=x),I},jT=(e,t,i,r,n,s,a,l,h,d,f,m,_,y,x,b,w)=&gt;Bt(VT(e,t,i,r,n,s,a,l,h,d,m,_,y,x,b,w,1),{u_gamma_scale:r?n.transform.getCameraToCenterDistance(w)*Math.cos(n.terrain?0:n.transform._pitch):1,u_device_pixel_ratio:_e.devicePixelRatio,u_is_halo:+f,undefined:void 0}),BD=(e,t,i,r,n,s,a,l,h,d,f,m,_,y,x,b)=&gt;Bt(jT(e,t,i,r,n,s,a,l,!0,h,!0,f,m,_,y,x,b),{u_texsize_icon:d,u_texture_icon:1}),ND=(e,t,i,r)=&gt;({u_matrix:e,u_emissive_strength:t,u_opacity:i,u_color:r}),UD=(e,t,i,r,n,s,a)=&gt;Bt(function(l,h,d,f){const m=d.imageManager.getPattern(l.toString(),h),{width:_,height:y}=d.imageManager.getPixelSize(h),x=Math.pow(2,f.tileID.overscaledZ),b=f.tileSize*Math.pow(2,d.transform.tileZoom)/x,w=b*(f.tileID.canonical.x+f.tileID.wrap*x),T=b*f.tileID.canonical.y;return{u_image:0,u_pattern_tl:m.tl,u_pattern_br:m.br,u_texsize:[_,y],u_pattern_size:m.displaySize,u_tile_units_to_pixels:1/fa(f,1,d.transform.tileZoom),u_pixel_coord_upper:[w&gt;&gt;16,T&gt;&gt;16],u_pixel_coord_lower:[65535&amp;w,65535&amp;T]}}(n,s,r,a),{u_matrix:e,u_emissive_strength:t,u_opacity:i}),rn={BaseColor:5,MetallicRoughness:6,Normal:7,Occlusion:8,Emission:9,ShadowMap0:10},X_=(e,t,i,r,n,s,a,l,h,d,f,m,_=[0,0,0])=&gt;{const y=r.style.light,x=y.properties.get("position"),b=[-x.x,-x.y,x.z],w=Br.create();y.properties.get("anchor")==="viewport"&amp;&amp;(Br.fromRotation(w,-r.transform.angle),W.transformMat3(b,b,w));const T=d.alphaMode==="MASK",S=y.properties.get("color"),I=m.paint.get("model-ambient-occlusion-intensity"),P=m.paint.get("model-color").constantOr(Ie.white),M=m.paint.get("model-color-mix-intensity").constantOr(0);return{u_matrix:e,u_lighting_matrix:t,u_normal_matrix:i,u_lightpos:b,u_lightintensity:y.properties.get("intensity"),u_lightcolor:[S.r,S.g,S.b],u_camera_pos:_,u_opacity:n,u_baseTextureIsAlpha:0,u_alphaMask:+T,u_alphaCutoff:d.alphaCutoff,u_baseColorFactor:[s.r,s.g,s.b,s.a],u_emissiveFactor:[a[0],a[1],a[2],1],u_metallicFactor:l,u_roughnessFactor:h,u_baseColorTexture:rn.BaseColor,u_metallicRoughnessTexture:rn.MetallicRoughness,u_normalTexture:rn.Normal,u_occlusionTexture:rn.Occlusion,u_emissionTexture:rn.Emission,u_color_mix:[P.r,P.g,P.b,M],u_aoIntensity:I,u_emissive_strength:f}},GT=new Float32Array(16),HT=(e,t=GT,i=GT)=&gt;({u_matrix:e,u_instance:t,u_node_matrix:i}),VD={fillExtrusion:e=&gt;({u_matrix:new be(e),u_lightpos:new Ee(e),u_lightintensity:new wt(e),u_lightcolor:new Ee(e),u_vertical_gradient:new wt(e),u_opacity:new wt(e),u_edge_radius:new wt(e),u_ao:new De(e),u_tile_id:new Ee(e),u_zoom_transition:new wt(e),u_inv_rot_matrix:new be(e),u_merc_center:new De(e),u_up_dir:new Ee(e),u_height_lift:new wt(e),u_flood_light_color:new Ee(e),u_vertical_scale:new wt(e),u_flood_light_intensity:new wt(e),u_ground_shadow_factor:new Ee(e),u_emissive_strength:new wt(e)}),fillExtrusionDepth:e=&gt;({u_matrix:new be(e),u_edge_radius:new wt(e),u_vertical_scale:new wt(e)}),fillExtrusionPattern:e=&gt;({u_matrix:new be(e),u_lightpos:new Ee(e),u_lightintensity:new wt(e),u_lightcolor:new Ee(e),u_vertical_gradient:new wt(e),u_height_factor:new wt(e),u_edge_radius:new wt(e),u_ao:new De(e),u_tile_id:new Ee(e),u_zoom_transition:new wt(e),u_inv_rot_matrix:new be(e),u_merc_center:new De(e),u_up_dir:new Ee(e),u_height_lift:new wt(e),u_image:new Re(e),u_texsize:new De(e),u_pixel_coord_upper:new De(e),u_pixel_coord_lower:new De(e),u_tile_units_to_pixels:new wt(e),u_opacity:new wt(e)}),fillExtrusionGroundEffect:e=&gt;({u_matrix:new be(e),u_opacity:new wt(e),u_ao_pass:new wt(e),u_meter_to_tile:new wt(e),u_ao:new De(e),u_flood_light_intensity:new wt(e),u_flood_light_color:new Ee(e),u_attenuation:new wt(e),u_edge_radius:new wt(e),u_fb:new Re(e),u_fb_size:new wt(e)}),fill:e=&gt;({u_matrix:new be(e),u_emissive_strength:new wt(e)}),fillPattern:e=&gt;({u_matrix:new be(e),u_emissive_strength:new wt(e),u_image:new Re(e),u_texsize:new De(e),u_pixel_coord_upper:new De(e),u_pixel_coord_lower:new De(e),u_tile_units_to_pixels:new wt(e)}),fillOutline:e=&gt;({u_matrix:new be(e),u_emissive_strength:new wt(e),u_world:new De(e)}),fillOutlinePattern:e=&gt;({u_matrix:new be(e),u_emissive_strength:new wt(e),u_world:new De(e),u_image:new Re(e),u_texsize:new De(e),u_pixel_coord_upper:new De(e),u_pixel_coord_lower:new De(e),u_tile_units_to_pixels:new wt(e)}),circle:e=&gt;({u_camera_to_center_distance:new wt(e),u_extrude_scale:new cm(e),u_device_pixel_ratio:new wt(e),u_matrix:new be(e),u_inv_rot_matrix:new be(e),u_merc_center:new De(e),u_tile_id:new Ee(e),u_zoom_transition:new wt(e),u_up_dir:new Ee(e),u_emissive_strength:new wt(e)}),collisionBox:e=&gt;({u_matrix:new be(e),u_camera_to_center_distance:new wt(e),u_extrude_scale:new De(e)}),collisionCircle:e=&gt;({u_matrix:new be(e),u_inv_matrix:new be(e),u_camera_to_center_distance:new wt(e),u_viewport_size:new De(e)}),debug:e=&gt;({u_color:new tl(e),u_matrix:new be(e),u_overlay:new Re(e),u_overlay_scale:new wt(e)}),clippingMask:e=&gt;({u_matrix:new be(e)}),heatmap:e=&gt;({u_extrude_scale:new wt(e),u_intensity:new wt(e),u_matrix:new be(e),u_inv_rot_matrix:new be(e),u_merc_center:new De(e),u_tile_id:new Ee(e),u_zoom_transition:new wt(e),u_up_dir:new Ee(e)}),heatmapTexture:e=&gt;({u_image:new Re(e),u_color_ramp:new Re(e),u_opacity:new wt(e)}),hillshade:e=&gt;({u_matrix:new be(e),u_image:new Re(e),u_latrange:new De(e),u_light:new De(e),u_shadow:new tl(e),u_highlight:new tl(e),u_emissive_strength:new wt(e),u_accent:new tl(e)}),hillshadePrepare:e=&gt;({u_matrix:new be(e),u_image:new Re(e),u_dimension:new De(e),u_zoom:new wt(e)}),line:e=&gt;({u_matrix:new be(e),u_pixels_to_tile_units:new cm(e),u_device_pixel_ratio:new wt(e),u_units_to_pixels:new De(e),u_dash_image:new Re(e),u_gradient_image:new Re(e),u_image_height:new wt(e),u_texsize:new De(e),u_tile_units_to_pixels:new wt(e),u_alpha_discard_threshold:new wt(e),u_trim_offset:new De(e),u_emissive_strength:new wt(e)}),linePattern:e=&gt;({u_matrix:new be(e),u_texsize:new De(e),u_pixels_to_tile_units:new cm(e),u_device_pixel_ratio:new wt(e),u_image:new Re(e),u_units_to_pixels:new De(e),u_tile_units_to_pixels:new wt(e),u_alpha_discard_threshold:new wt(e)}),raster:e=&gt;({u_matrix:new be(e),u_normalize_matrix:new be(e),u_globe_matrix:new be(e),u_merc_matrix:new be(e),u_grid_matrix:new lm(e),u_tl_parent:new De(e),u_scale_parent:new wt(e),u_fade_t:new wt(e),u_opacity:new wt(e),u_image0:new Re(e),u_image1:new Re(e),u_brightness_low:new wt(e),u_brightness_high:new wt(e),u_saturation_factor:new wt(e),u_contrast_factor:new wt(e),u_spin_weights:new Ee(e),u_perspective_transform:new De(e),u_raster_elevation:new wt(e),u_tl_br:new Jr(e),u_zoom_transition:new wt(e),u_merc_center:new De(e),u_cutoff_params:new Jr(e),u_colorization_mix:new Jr(e),u_colorization_offset:new wt(e),u_color_ramp:new Re(e),u_texture_offset:new De(e),u_texture_res:new De(e),u_emissive_strength:new wt(e)}),symbolIcon:e=&gt;({u_is_size_zoom_constant:new Re(e),u_is_size_feature_constant:new Re(e),u_size_t:new wt(e),u_size:new wt(e),u_camera_to_center_distance:new wt(e),u_rotate_symbol:new Re(e),u_aspect_ratio:new wt(e),u_fade_change:new wt(e),u_matrix:new be(e),u_label_plane_matrix:new be(e),u_coord_matrix:new be(e),u_is_text:new Re(e),u_pitch_with_map:new Re(e),u_texsize:new De(e),u_tile_id:new Ee(e),u_zoom_transition:new wt(e),u_inv_rot_matrix:new be(e),u_merc_center:new De(e),u_camera_forward:new Ee(e),u_tile_matrix:new be(e),u_up_vector:new Ee(e),u_ecef_origin:new Ee(e),u_texture:new Re(e),u_icon_transition:new wt(e),u_icon_saturation:new wt(e)}),symbolSDF:e=&gt;({u_is_size_zoom_constant:new Re(e),u_is_size_feature_constant:new Re(e),u_size_t:new wt(e),u_size:new wt(e),u_camera_to_center_distance:new wt(e),u_rotate_symbol:new Re(e),u_aspect_ratio:new wt(e),u_fade_change:new wt(e),u_matrix:new be(e),u_label_plane_matrix:new be(e),u_coord_matrix:new be(e),u_is_text:new Re(e),u_pitch_with_map:new Re(e),u_texsize:new De(e),u_texture:new Re(e),u_gamma_scale:new wt(e),u_device_pixel_ratio:new wt(e),u_tile_id:new Ee(e),u_zoom_transition:new wt(e),u_inv_rot_matrix:new be(e),u_merc_center:new De(e),u_camera_forward:new Ee(e),u_tile_matrix:new be(e),u_up_vector:new Ee(e),u_ecef_origin:new Ee(e),u_is_halo:new Re(e)}),symbolTextAndIcon:e=&gt;({u_is_size_zoom_constant:new Re(e),u_is_size_feature_constant:new Re(e),u_size_t:new wt(e),u_size:new wt(e),u_camera_to_center_distance:new wt(e),u_rotate_symbol:new Re(e),u_aspect_ratio:new wt(e),u_fade_change:new wt(e),u_matrix:new be(e),u_label_plane_matrix:new be(e),u_coord_matrix:new be(e),u_is_text:new Re(e),u_pitch_with_map:new Re(e),u_texsize:new De(e),u_texsize_icon:new De(e),u_texture:new Re(e),u_texture_icon:new Re(e),u_gamma_scale:new wt(e),u_device_pixel_ratio:new wt(e),u_is_halo:new Re(e)}),background:e=&gt;({u_matrix:new be(e),u_emissive_strength:new wt(e),u_opacity:new wt(e),u_color:new tl(e)}),backgroundPattern:e=&gt;({u_matrix:new be(e),u_emissive_strength:new wt(e),u_opacity:new wt(e),u_image:new Re(e),u_pattern_tl:new De(e),u_pattern_br:new De(e),u_texsize:new De(e),u_pattern_size:new De(e),u_pixel_coord_upper:new De(e),u_pixel_coord_lower:new De(e),u_tile_units_to_pixels:new wt(e)}),terrainRaster:ST,terrainDepth:ST,skybox:e=&gt;({u_matrix:new be(e),u_sun_direction:new Ee(e),u_cubemap:new Re(e),u_opacity:new wt(e),u_temporal_offset:new wt(e)}),skyboxGradient:e=&gt;({u_matrix:new be(e),u_color_ramp:new Re(e),u_center_direction:new Ee(e),u_radius:new wt(e),u_opacity:new wt(e),u_temporal_offset:new wt(e)}),skyboxCapture:e=&gt;({u_matrix_3f:new lm(e),u_sun_direction:new Ee(e),u_sun_intensity:new wt(e),u_color_tint_r:new Jr(e),u_color_tint_m:new Jr(e),u_luminance:new wt(e)}),globeRaster:e=&gt;({u_proj_matrix:new be(e),u_globe_matrix:new be(e),u_normalize_matrix:new be(e),u_merc_matrix:new be(e),u_zoom_transition:new wt(e),u_merc_center:new De(e),u_image0:new Re(e),u_grid_matrix:new lm(e),u_skirt_height:new wt(e),u_frustum_tl:new Ee(e),u_frustum_tr:new Ee(e),u_frustum_br:new Ee(e),u_frustum_bl:new Ee(e),u_globe_pos:new Ee(e),u_globe_radius:new wt(e),u_viewport:new De(e)}),globeAtmosphere:e=&gt;({u_frustum_tl:new Ee(e),u_frustum_tr:new Ee(e),u_frustum_br:new Ee(e),u_frustum_bl:new Ee(e),u_horizon:new wt(e),u_transition:new wt(e),u_fadeout_range:new wt(e),u_color:new Jr(e),u_high_color:new Jr(e),u_space_color:new Jr(e),u_temporal_offset:new wt(e),u_horizon_angle:new wt(e)}),model:e=&gt;({u_matrix:new be(e),u_lighting_matrix:new be(e),u_normal_matrix:new be(e),u_lightpos:new Ee(e),u_lightintensity:new wt(e),u_lightcolor:new Ee(e),u_camera_pos:new Ee(e),u_opacity:new wt(e),u_baseColorFactor:new Jr(e),u_emissiveFactor:new Jr(e),u_metallicFactor:new wt(e),u_roughnessFactor:new wt(e),u_baseTextureIsAlpha:new Re(e),u_alphaMask:new Re(e),u_alphaCutoff:new wt(e),u_baseColorTexture:new Re(e),u_metallicRoughnessTexture:new Re(e),u_normalTexture:new Re(e),u_occlusionTexture:new Re(e),u_emissionTexture:new Re(e),u_color_mix:new Jr(e),u_aoIntensity:new wt(e),u_emissive_strength:new wt(e)}),modelDepth:e=&gt;({u_matrix:new be(e),u_instance:new be(e),u_node_matrix:new be(e)}),groundShadow:e=&gt;({u_matrix:new be(e),u_ground_shadow_factor:new Ee(e)}),stars:e=&gt;({u_matrix:new be(e),u_up:new Ee(e),u_right:new Ee(e),u_intensity_multiplier:new wt(e)})};let Cd;function WT(e,t,i,r,n,s,a){const l=e.context,h=l.gl,d=e.transform,f=e.getOrCreateProgram("collisionBox"),m=[];let _=0,y=0;for(let P=0;P&lt;r.length;P++){const M=r[P],C=t.getTile(M),D=C.getBucket(i);if(!D)continue;const O=JR(M,D,d);let k=O;n[0]===0&amp;&amp;n[1]===0||(k=e.translatePosMatrix(O,C,n,s));const z=a?D.textCollisionBox:D.iconCollisionBox,B=D.collisionCircleArray;if(B.length&gt;0){const U=nt.create(),Z=k;nt.mul(U,D.placementInvProjMatrix,d.glCoordMatrix),nt.mul(U,U,D.placementViewportMatrix),m.push({circleArray:B,circleOffset:y,transform:Z,invTransform:U,projection:D.getProjection()}),_+=B.length/4,y=_}z&amp;&amp;(e.terrain&amp;&amp;e.terrain.setupElevationDraw(C,f),f.draw(e,h.LINES,de.disabled,Pe.disabled,e.colorModeForRenderPass(),Le.disabled,RD(k,d,C,D.getProjection()),i.id,z.layoutVertexBuffer,z.indexBuffer,z.segments,null,d.zoom,null,[z.collisionVertexBuffer,z.collisionVertexBufferExt]))}if(!a||!m.length)return;const x=e.getOrCreateProgram("collisionCircle"),b=new Kp;b.resize(4*_),b._trim();let w=0;for(const P of m)for(let M=0;M&lt;P.circleArray.length/4;M++){const C=4*M,D=P.circleArray[C+0],O=P.circleArray[C+1],k=P.circleArray[C+2],z=P.circleArray[C+3];b.emplace(w++,D,O,k,z,0),b.emplace(w++,D,O,k,z,1),b.emplace(w++,D,O,k,z,2),b.emplace(w++,D,O,k,z,3)}(!Cd||Cd.length&lt;2*_)&amp;&amp;(Cd=function(P){const M=2*P,C=new Xi;C.resize(M),C._trim();for(let D=0;D&lt;M;D++){const O=6*D;C.uint16[O+0]=4*D+0,C.uint16[O+1]=4*D+1,C.uint16[O+2]=4*D+2,C.uint16[O+3]=4*D+2,C.uint16[O+4]=4*D+3,C.uint16[O+5]=4*D+0}return C}(_));const T=l.createIndexBuffer(Cd,!0),S=l.createVertexBuffer(b,u3.members,!0);for(const P of m){const M={u_matrix:P.transform,u_inv_matrix:P.invTransform,u_camera_to_center_distance:(I=d).getCameraToCenterDistance(P.projection),u_viewport_size:[I.width,I.height]};x.draw(e,h.TRIANGLES,de.disabled,Pe.disabled,e.colorModeForRenderPass(),Le.disabled,M,i.id,S,T,si.simpleSegment(0,2*P.circleOffset,P.circleArray.length,P.circleArray.length/2),null,d.zoom)}var I;S.destroy(),T.destroy()}const qT=nt.create();function jD({width:e,height:t,anchor:i,textOffset:r,textScale:n},s){const{horizontalAlign:a,verticalAlign:l}=Wh(i),h=-(a-.5)*e,d=-(l-.5)*t,f=o_(i,r);return new Q((h/n+f[0])*s,(d/n+f[1])*s)}function GD(e,t,i,r,n,s,a,l,h,d,f){const m=e.text.placedSymbolArray,_=e.text.dynamicLayoutVertexArray,y=e.icon.dynamicLayoutVertexArray,x={},b=e.getProjection(),w=j_(l,b,s),T=s.elevation,S=b.upVectorScale(l.canonical,s.center.lat,s.worldSize).metersToTile;_.clear();for(let I=0;I&lt;m.length;I++){const P=m.get(I),{tileAnchorX:M,tileAnchorY:C,numGlyphs:D}=P,O=P.hidden||!P.crossTileID||e.allowVerticalPlacement&amp;&amp;!P.placedOrientation?null:r[P.crossTileID];if(O){let k=0,z=0,B=0;if(T){const ot=T?T.getAtTileOffset(l,M,C):0,[lt,at,dt]=b.upVector(l.canonical,M,C);k=ot*lt*S,z=ot*at*S,B=ot*dt*S}let[U,Z,F,Y]=Xn(P.projectedAnchorX+k,P.projectedAnchorY+z,P.projectedAnchorZ+B,i?w:a);const J=zb(s.getCameraToCenterDistance(b),Y);let it=n.evaluateSizeForFeature(e.textSizeData,d,P)*J/dr;i&amp;&amp;(it*=e.tilePixelRatio/h);const X=jD(O,it);i?({x:U,y:Z,z:F}=b.projectTilePoint(M+X.x,C+X.y,l.canonical),[U,Z,F]=Xn(U+k,Z+z,F+B,a)):(t&amp;&amp;X._rotate(-s.angle),U+=X.x,Z+=X.y,F=0);const K=e.allowVerticalPlacement&amp;&amp;P.placedOrientation===Ti.vertical?Math.PI/2:0;for(let ot=0;ot&lt;D;ot++)yl(_,U,Z,F,K);f&amp;&amp;P.associatedIconIndex&gt;=0&amp;&amp;(x[P.associatedIconIndex]={x:U,y:Z,z:F,angle:K})}else vl(D,_)}if(f){y.clear();const I=e.icon.placedSymbolArray;for(let P=0;P&lt;I.length;P++){const M=I.get(P),{numGlyphs:C}=M,D=x[P];if(M.hidden||!D)vl(C,y);else{const{x:O,y:k,z,angle:B}=D;for(let U=0;U&lt;C;U++)yl(y,O,k,z,B)}}e.icon.dynamicLayoutVertexBuffer.updateData(y)}e.text.dynamicLayoutVertexBuffer.updateData(_)}function HD(e,t,i){return i.iconsInText&amp;&amp;t?"symbolTextAndIcon":e?"symbolSDF":"symbolIcon"}function ZT(e,t,i,r,n,s,a,l,h,d,f,m,_){const y=e.context,x=y.gl,b=e.transform,w=l==="map",T=h==="map",S=w&amp;&amp;i.layout.get("symbol-placement")!=="point",I=w&amp;&amp;!T&amp;&amp;!S,P=i.layout.get("symbol-sort-key").constantOr(1)!==void 0;let M=!1;const C=e.depthModeForSublayer(0,de.ReadOnly),D=[er(b.center.lng),sr(b.center.lat)],O=i.layout.get("text-variable-anchor"),k=b.projection.name==="globe",z=[],B=[0,-1,0];let U=B;!k&amp;&amp;!b.mercatorFromTransition||w||(U=function(Z){const F=Z._camera.getWorldToCamera(Z.worldSize,1),Y=nt.multiply([],F,Z.globeMatrix);nt.invert(Y,Y);const J=[0,0,0],it=[0,1,0,0];return oi.transformMat4(it,it,Y),J[0]=it[0],J[1]=it[1],J[2]=it[2],W.normalize(J,J),J}(b));for(const Z of r){const F=t.getTile(Z),Y=F.getBucket(i);if(!Y||Y.projection.name==="mercator"&amp;&amp;k)continue;const J=n?Y.text:Y.icon;if(!J||Y.fullyClipped||!J.segments.get().length)continue;const it=J.programConfigurations.get(i.id),X=n||Y.sdfIcons,K=n?Y.textSizeData:Y.iconSizeData,ot=T||b.pitch!==0,lt=ps(K,b.zoom);let at,dt,ft,_t,ct=[0,0],bt=null;if(n)dt=F.glyphAtlasTexture?F.glyphAtlasTexture:null,ft=x.LINEAR,at=F.glyphAtlasTexture?F.glyphAtlasTexture.size:[0,0],Y.iconsInText&amp;&amp;(ct=F.imageAtlasTexture?F.imageAtlasTexture.size:[0,0],bt=F.imageAtlasTexture?F.imageAtlasTexture:null,_t=ot||e.options.rotating||e.options.zooming||K.kind==="composite"||K.kind==="camera"?x.LINEAR:x.NEAREST);else{const xi=i.layout.get("icon-size").constantOr(0)!==1||Y.iconsNeedLinear;dt=F.imageAtlasTexture?F.imageAtlasTexture:null,ft=X||e.options.rotating||e.options.zooming||xi||ot?x.LINEAR:x.NEAREST,at=F.imageAtlasTexture?F.imageAtlasTexture.size:[0,0]}const Ot=Y.projection.name==="globe",kt=Ot?U:B,Ht=Ot?hr(b.zoom):0,Zt=j_(Z,Y.getProjection(),b),fe=b.calculatePixelsToTileUnitsMatrix(F),ie=ud(Zt,F.tileID.canonical,T,w,b,Y.getProjection(),fe),Ve=e.terrain&amp;&amp;T&amp;&amp;S?nt.invert(nt.create(),ie):qT,ke=kb(Zt,F.tileID.canonical,T,w,b,Y.getProjection(),fe),pe=O&amp;&amp;Y.hasTextData(),ue=Y.hasIconTextFit()&amp;&amp;pe&amp;&amp;Y.hasIconData();if(S){const xi=b.elevation,ri=xi?xi.getAtTileOffsetFunc(Z,b.center.lat,b.worldSize,Y.getProjection()):null,gr=Ob(Zt,F.tileID.canonical,T,w,b,Y.getProjection(),fe);jL(Y,Zt,e,n,gr,ke,T,d,ri,Z)}const re=S||n&amp;&amp;O||ue,Fe=e.translatePosMatrix(Zt,F,s,a),Ue=re?qT:ie,Me=e.translatePosMatrix(ke,F,s,a,!0),hi=Y.getProjection().createInversionMatrix(b,Z.canonical),Fi=i.paint.get("icon-image-cross-fade").constantOr(0),ai=[];e.terrainRenderModeElevated()&amp;&amp;T&amp;&amp;ai.push("PITCH_WITH_MAP_TERRAIN"),Ot&amp;&amp;(ai.push("PROJECTION_GLOBE_VIEW"),re&amp;&amp;ai.push("PROJECTED_POS_ON_VIEWPORT")),Fi&gt;0&amp;&amp;ai.push("ICON_TRANSITION"),J.zOffsetVertexBuffer&amp;&amp;ai.push("Z_OFFSET");const _i=X&amp;&amp;i.paint.get(n?"text-halo-width":"icon-halo-width").constantOr(1)!==0;let Ui;X?Ui=Y.iconsInText?BD(K.kind,lt,I,T,e,Fe,Ue,Me,at,ct,Z,Ht,D,hi,kt,Y.getProjection()):jT(K.kind,lt,I,T,e,Fe,Ue,Me,n,at,!0,Z,Ht,D,hi,kt,Y.getProjection()):(f&lt;1&amp;&amp;ai.push("SATURATION"),Ui=VT(K.kind,lt,I,T,e,Fe,Ue,Me,n,at,Z,Ht,D,hi,kt,Y.getProjection(),f,Fi));const Bi={program:e.getOrCreateProgram(HD(X,n,Y),{config:it,defines:ai}),buffers:J,uniformValues:Ui,atlasTexture:dt,atlasTextureIcon:bt,atlasInterpolation:ft,atlasInterpolationIcon:_t,isSDF:X,hasHalo:_i,tile:F,labelPlaneMatrixInv:Ve};if(P&amp;&amp;Y.canOverlap){M=!0;const xi=J.segments.get();for(const ri of xi)z.push({segments:new si([ri]),sortKey:ri.sortKey,state:Bi})}else z.push({segments:J.segments,sortKey:0,state:Bi})}M&amp;&amp;z.sort((Z,F)=&gt;Z.sortKey-F.sortKey);for(const Z of z){const F=Z.state;if(e.terrain&amp;&amp;e.terrain.setupElevationDraw(F.tile,F.program,{useDepthForOcclusion:b.depthOcclusionForSymbolsAndCircles,labelPlaneMatrixInv:F.labelPlaneMatrixInv}),y.activeTexture.set(x.TEXTURE0),F.atlasTexture&amp;&amp;F.atlasTexture.bind(F.atlasInterpolation,x.CLAMP_TO_EDGE),F.atlasTextureIcon&amp;&amp;(y.activeTexture.set(x.TEXTURE1),F.atlasTextureIcon&amp;&amp;F.atlasTextureIcon.bind(F.atlasInterpolationIcon,x.CLAMP_TO_EDGE)),e.uploadCommonLightUniforms(e.context,F.program),F.hasHalo){const Y=F.uniformValues;Y.u_is_halo=1,Y_(F.buffers,Z.segments,i,e,F.program,C,m,_,Y,2),Y.u_is_halo=0}else{if(F.isSDF){const Y=F.uniformValues;F.hasHalo&amp;&amp;(Y.u_is_halo=1,Y_(F.buffers,Z.segments,i,e,F.program,C,m,_,Y,1)),Y.u_is_halo=0}Y_(F.buffers,Z.segments,i,e,F.program,C,m,_,F.uniformValues,1)}}}function Y_(e,t,i,r,n,s,a,l,h,d){const f=[e.dynamicLayoutVertexBuffer,e.opacityVertexBuffer,e.iconTransitioningVertexBuffer,e.globeExtVertexBuffer,e.zOffsetVertexBuffer];n.draw(r,r.context.gl.TRIANGLES,s,a,l,Le.disabled,h,i.id,e.layoutVertexBuffer,e.indexBuffer,t,i.paint,r.transform.zoom,e.programConfigurations.get(i.id),f,d)}function $T(e,t,i,r,n,s,a){const l=e.context.gl,h=i.paint.get("fill-pattern"),d=h&amp;&amp;h.constantOr(1);let f,m,_,y,x;a?(m=d&amp;&amp;!i.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",f=l.LINES):(m=d?"fillPattern":"fill",f=l.TRIANGLES);for(const b of r){const w=t.getTile(b);if(d&amp;&amp;!w.patternsLoaded())continue;const T=w.getBucket(i);if(!T)continue;e.prepareDrawTile();const S=T.programConfigurations.get(i.id),I=e.isTileAffectedByFog(b),P=e.getOrCreateProgram(m,{config:S,overrideFog:I});d&amp;&amp;(e.context.activeTexture.set(l.TEXTURE0),w.imageAtlasTexture&amp;&amp;w.imageAtlasTexture.bind(l.LINEAR,l.CLAMP_TO_EDGE),S.updatePaintBuffers());const M=h.constantOr(null);if(M&amp;&amp;w.imageAtlas){const O=w.imageAtlas.patternPositions[M.toString()];O&amp;&amp;S.setConstantPatternPositions(O)}const C=e.translatePosMatrix(b.projMatrix,w,i.paint.get("fill-translate"),i.paint.get("fill-translate-anchor")),D=i.paint.get("fill-emissive-strength");if(a){y=T.indexBuffer2,x=T.segments2;const O=e.terrain&amp;&amp;e.terrain.renderingToTexture?e.terrain.drapeBufferSize:[l.drawingBufferWidth,l.drawingBufferHeight];_=m==="fillOutlinePattern"&amp;&amp;d?LD(C,D,e,w,O):CD(C,D,O)}else y=T.indexBuffer,x=T.segments,_=d?FT(C,D,e,w):zT(C,D);e.uploadCommonUniforms(e.context,P,b.toUnwrapped()),P.draw(e,f,n,e.stencilModeForClipping(b),s,Le.disabled,_,i.id,T.layoutVertexBuffer,y,x,i.paint,e.transform.zoom,S,void 0)}}function Ld(e,t,i,r,n,s,a,l){i.resetLayerRenderingStats();const h=e.context,d=h.gl,f=e.transform,m=i.paint.get("fill-extrusion-pattern"),_=m.constantOr(1),y=i.paint.get("fill-extrusion-opacity"),x=e.style.enable3dLights(),b=i.paint.get(x&amp;&amp;!_?"fill-extrusion-ambient-occlusion-wall-radius":"fill-extrusion-ambient-occlusion-radius"),w=[i.paint.get("fill-extrusion-ambient-occlusion-intensity"),b],T=i.layout.get("fill-extrusion-edge-radius"),S=T&gt;0&amp;&amp;!i.paint.get("fill-extrusion-rounded-roof"),I=S?0:T,P=f.projection.name==="globe"?gw():0,M=f.projection.name==="globe",C=M?hr(f.zoom):0,D=[er(f.center.lng),sr(f.center.lat)],O=i.paint.get("fill-extrusion-flood-light-color").toArray01().slice(0,3),k=i.paint.get("fill-extrusion-flood-light-intensity"),z=i.paint.get("fill-extrusion-vertical-scale"),B=Tl(e,i.paint.get("fill-extrusion-cutoff-fade-range")),U=i.paint.get("fill-extrusion-emissive-strength"),Z=[];let F;M&amp;&amp;Z.push("PROJECTION_GLOBE_VIEW"),w[0]&gt;0&amp;&amp;Z.push("FAUX_AO"),S&amp;&amp;Z.push("ZERO_ROOF_RADIUS"),l&amp;&amp;Z.push("HAS_CENTROID"),k&gt;0&amp;&amp;Z.push("FLOOD_LIGHT"),B.shouldRenderCutoff&amp;&amp;Z.push("RENDER_CUTOFF");const Y=e.renderPass==="shadow",J=e.shadowRenderer,it=Y&amp;&amp;!!J;e.shadowRenderer&amp;&amp;(e.shadowRenderer.useNormalOffset=!0);let X=[0,0,0];if(J){const lt=e.style.directionalLight,at=e.style.ambientLight;lt&amp;&amp;at&amp;&amp;(X=Q_(lt,at)),F=Z.concat(["SHADOWS_SINGLE_CASCADE"])}const K=it?"fillExtrusionDepth":_?"fillExtrusionPattern":"fillExtrusion",ot=i.getLayerRenderingStats();for(const lt of r){const at=t.getTile(lt),dt=at.getBucket(i);if(!dt||dt.projection.name!==f.projection.name)continue;let ft=!1;J&amp;&amp;(ft=J.getMaxCascadeForTile(lt.toUnwrapped())===0);const _t=e.isTileAffectedByFog(lt),ct=dt.programConfigurations.get(i.id),bt=e.getOrCreateProgram(K,{config:ct,defines:ft?F:Z,overrideFog:_t});if(e.terrain&amp;&amp;e.terrain.setupElevationDraw(at,bt,{useMeterToDem:!0}),!dt.centroidVertexBuffer){const ie=bt.attributes.a_centroid_pos;ie!==void 0&amp;&amp;d.vertexAttrib2f(ie,0,0)}!Y&amp;&amp;J&amp;&amp;J.setupShadows(at.tileID.toUnwrapped(),bt,"vector-tile",at.tileID.overscaledZ),_&amp;&amp;(e.context.activeTexture.set(d.TEXTURE0),at.imageAtlasTexture&amp;&amp;at.imageAtlasTexture.bind(d.LINEAR,d.CLAMP_TO_EDGE),ct.updatePaintBuffers());const Ot=m.constantOr(null);if(Ot&amp;&amp;at.imageAtlas){const ie=at.imageAtlas.patternPositions[Ot.toString()];ie&amp;&amp;ct.setConstantPatternPositions(ie)}const kt=i.paint.get("fill-extrusion-vertical-gradient");let Ht;if(Y&amp;&amp;J){if(XD(at.tileID,dt,e))continue;const ie=J.calculateShadowPassMatrixFromTile(at.tileID.toUnwrapped());Ht=ID(ie,I,z)}else{const ie=e.translatePosMatrix(lt.expandedProjMatrix,at,i.paint.get("fill-extrusion-translate"),i.paint.get("fill-extrusion-translate-anchor")),Ve=f.projection.createInversionMatrix(f,lt.canonical);Ht=_?PD(ie,e,kt,y,w,I,lt,at,P,C,D,Ve,O,z):kT(ie,e,kt,y,w,I,lt,P,C,D,Ve,O,z,k,X,U)}e.uploadCommonUniforms(h,bt,lt.toUnwrapped(),null,B);let Zt=dt.segments;if(!M&amp;&amp;!Y&amp;&amp;(Zt=dt.getVisibleSegments(at.tileID,e.terrain,e.transform.getFrustum(0)),!Zt.get().length))continue;if(ot)if(Y)for(const ie of Zt.get())ot.numRenderedVerticesInShadowPass+=ie.primitiveLength;else for(const ie of Zt.get())ot.numRenderedVerticesInTransparentPass+=ie.primitiveLength;const fe=[];(e.terrain||l)&amp;&amp;fe.push(dt.centroidVertexBuffer),M&amp;&amp;fe.push(dt.layoutVertexExtBuffer),bt.draw(e,h.gl.TRIANGLES,n,s,a,Le.backCCW,Ht,i.id,dt.layoutVertexBuffer,dt.indexBuffer,Zt,i.paint,e.transform.zoom,ct,fe)}e.shadowRenderer&amp;&amp;(e.shadowRenderer.useNormalOffset=!1)}function Sl(e,t,i,r,n,s,a,l,h,d,f,m,_,y,x,b,w,T,S){const I=e.context,P=I.gl,M=e.transform,C=e.transform.zoom,D=[],O=Tl(e,i.paint.get("fill-extrusion-cutoff-fade-range"));d==="clear"?(D.push("CLEAR_SUBPASS"),S&amp;&amp;(D.push("CLEAR_FROM_TEXTURE"),I.activeTexture.set(P.TEXTURE0),S.bind(P.LINEAR,P.CLAMP_TO_EDGE))):d==="sdf"&amp;&amp;D.push("SDF_SUBPASS"),w&amp;&amp;D.push("HAS_CENTROID"),O.shouldRenderCutoff&amp;&amp;D.push("RENDER_CUTOFF");const k=i.layout.get("fill-extrusion-edge-radius"),z=(B,U,Z,F,Y)=&gt;{const J=U.programConfigurations.get(i.id),it=e.isTileAffectedByFog(B),X=e.getOrCreateProgram("fillExtrusionGroundEffect",{config:J,defines:D,overrideFog:it}),K=((lt,at,dt,ft,_t,ct,bt,Ot,kt,Ht,Zt)=&gt;({u_matrix:at,u_opacity:dt,u_ao_pass:ft?1:0,u_meter_to_tile:_t,u_ao:ct,u_flood_light_intensity:bt,u_flood_light_color:Ot,u_attenuation:kt,u_edge_radius:Ht,u_fb:0,u_fb_size:Zt}))(0,F,f,h,Y,[m,_*Y],y,x,b,C&gt;=17?0:k*Y,S?S.size[0]:0),ot=[];w&amp;&amp;ot.push(U.hiddenByLandmarkVertexBuffer),e.uploadCommonUniforms(I,X,B.toUnwrapped(),null,O),X.draw(e,I.gl.TRIANGLES,n,s,a,l,K,i.id,U.vertexBuffer,U.indexBuffer,Z,i.paint,C,J,ot)};for(const B of r){const U=t.getTile(B),Z=U.getBucket(i);if(!Z||Z.projection.name!==M.projection.name||!Z.groundEffect||Z.groundEffect&amp;&amp;!Z.groundEffect.hasData())continue;const F=Z.groundEffect,Y=1/Z.tileToMeter;{const J=e.translatePosMatrix(B.projMatrix,U,i.paint.get("fill-extrusion-translate"),i.paint.get("fill-extrusion-translate-anchor")),it=F.getDefaultSegment();z(B,F,it,J,Y)}if(T)for(let J=0;J&lt;4;J++){const it=Gv[J](B),X=t.getTile(it);if(!X)continue;const K=X.getBucket(i);if(!K||K.projection.name!==M.projection.name||!K.groundEffect||K.groundEffect&amp;&amp;!K.groundEffect.hasData())continue;const ot=K.groundEffect;let lt,at;J===0?(lt=[-ut,0,0],at=1):J===1?(lt=[ut,0,0],at=0):J===2?(lt=[0,-ut,0],at=3):(lt=[0,ut,0],at=2);const dt=ot.regionSegments[at];if(!dt)continue;const ft=new Float32Array(16);nt.translate(ft,B.projMatrix,lt),z(B,ot,dt,e.translatePosMatrix(ft,U,i.paint.get("fill-extrusion-translate"),i.paint.get("fill-extrusion-translate-anchor")),Y)}}}function WD(e,t,i,r,n,s,a){r.centroidVertexArray.length===0&amp;&amp;r.createCentroidsBuffer();const l=s?s.findDEMTileFor(i):null;if(!(l&amp;&amp;l.dem||a))return;const h=T=&gt;{const S=t.getSource().minzoom,I=M=&gt;{const C=t.getTileByID(M);if(C&amp;&amp;C.hasData())return C.getBucket(n)},P=[0,-1,1];for(const M of P){if(T.overscaledZ+M&lt;S)continue;const C=I(T.calculateScaledKey(T.overscaledZ+M));if(C)return C}},d=[0,0,0],f=(T,S)=&gt;(d[0]=Math.min(T.min.y,S.min.y),d[1]=Math.max(T.max.y,S.max.y),d[2]=ut-S.min.x&gt;T.max.x?S.min.x-ut:T.max.x,d),m=(T,S)=&gt;(d[0]=Math.min(T.min.x,S.min.x),d[1]=Math.max(T.max.x,S.max.x),d[2]=ut-S.min.y&gt;T.max.y?S.min.y-ut:T.max.y,d),_=[(T,S)=&gt;f(T,S),(T,S)=&gt;f(S,T),(T,S)=&gt;m(T,S),(T,S)=&gt;m(S,T)],y=(T,S,I,P,M,C,D)=&gt;{if(!s)return 0;const O=[[C?I:T,C?T:I,0],[C?I:S,C?S:I,0]],k=D&lt;0?ut+D:D,z=[C?k:(T+S)/2,C?(T+S)/2:k,0];return I===0&amp;&amp;D&lt;0||I!==0&amp;&amp;D&gt;0?s.getForTilePoints(M,[z],!0,P):O.push(z),s.getForTilePoints(i,O,!0,l),Math.max(O[0][2],O[1][2],z[2])/s.exaggeration()};for(let T=0;T&lt;4;T++){const S=r.borderFeatureIndices[T];if(S.length===0)continue;const I=Gv[T](i),P=h(I);if(!(P&amp;&amp;P instanceof Xc)||r.borderDoneWithNeighborZ[T]===P.canonical.z)continue;P.centroidVertexArray.length===0&amp;&amp;P.createCentroidsBuffer();const M=s?s.findDEMTileFor(I):null;if(!(M&amp;&amp;M.dem||a))continue;const C=(T&lt;2?1:5)-T,D=P.borderDoneWithNeighborZ[C]!==r.canonical.z,O=P.borderFeatureIndices[C];let k=0;if(r.canonical.z!==P.canonical.z){for(const z of S)r.showCentroid(r.featuresOnBorder[z]);if(D)for(const z of O)P.showCentroid(P.featuresOnBorder[z]);r.borderDoneWithNeighborZ[T]=P.canonical.z,P.borderDoneWithNeighborZ[C]=r.canonical.z}for(const z of S){const B=r.featuresOnBorder[z],U=r.centroidData[B.centroidDataIndex],Z=B.borders[T];let F;for(;k&lt;O.length;){F=P.featuresOnBorder[O[k]];const Y=F.borders[C];if(Y[1]&gt;Z[0]+3||Y[0]&gt;Z[0]-3)break;P.showCentroid(F),k++}if(F&amp;&amp;k&lt;O.length){const Y=k;let J=0;for(;!(F.borders[C][0]&gt;Z[1]-3)&amp;&amp;(J++,++k!==O.length);)F=P.featuresOnBorder[O[k]];if(F=P.featuresOnBorder[O[Y]],J&gt;1){const K=F.borders[C];Math.abs(Z[0]-K[0])&lt;3&amp;&amp;Math.abs(Z[1]-K[1])&lt;3&amp;&amp;(J=1,k=Y+1)}else if(J===0){r.showCentroid(B);continue}const it=P.centroidData[F.centroidDataIndex];a&amp;&amp;J===1&amp;&amp;(((b=U).flags|(w=it).flags)&amp;gs?(b.flags|=gs,w.flags|=gs):(b.flags&amp;=2147483647,w.flags&amp;=2147483647));let X=new Q(0,0);if(J&gt;1)k=Y;else if(M&amp;&amp;M.dem&amp;&amp;!(B.intersectsCount()&gt;1||F.intersectsCount()&gt;1)){const K=_[T](U,it),ot=T%2?ut-1:0;x=y(K[0],Math.min(ut-1,K[1]),ot,M,I,T&lt;2,K[2]),X=new Q(Math.ceil(7*(x+450)),0)}U.centroidXY=it.centroidXY=X,r.writeCentroidToBuffer(U),P.writeCentroidToBuffer(it)}else r.showCentroid(B)}r.borderDoneWithNeighborZ[T]=P.canonical.z,P.borderDoneWithNeighborZ[C]=r.canonical.z}var x,b,w;(r.needsCentroidUpdate||!r.centroidVertexBuffer&amp;&amp;r.centroidVertexArray.length!==0)&amp;&amp;r.uploadCentroid(e)}const qD=[1,0,0],ZD=[0,1,0],$D=[0,0,1];function XD(e,t,i){const r=i.transform,n=i.shadowRenderer;if(!n)return!0;const s=e.toUnwrapped(),a=r.tileSize*n._cascades[i.currentShadowCascade].scale;let l=t.maxHeight;if(r.elevation){const b=r.elevation.getMinMaxForTile(e);b&amp;&amp;(l+=b.max)}const h=[...n.shadowDirection];h[2]=-h[2];const d=n.computeSimplifiedTileShadowVolume(s,l,a,h);if(!d)return!1;const f=[qD,ZD,$D,h,[h[0],0,h[2]],[0,h[1],h[2]]],m=r.projection.name==="globe",_=r.scaleZoom(a),y=$s.fromInvProjectionMatrix(r.invProjMatrix,r.worldSize,_,!m),x=n.getCurrentCascadeFrustum();return y.intersectsPrecise(d.vertices,d.planes,f)===0||x.intersectsPrecise(d.vertices,d.planes,f)===0}function YD(e){const t=e._nearZ,i=e.projection.farthestPixelDistance(e),r=i-t,n=.2*e.height,s=t+n;return[t,i,(s-n-t)/r,(s-t)/r]}const KD=new Ie(1,0,0,1),JD=new Ie(0,1,0,1),QD=new Ie(0,0,1,1),tO=new Ie(1,0,1,1),eO=new Ie(0,1,1,1);function iO(e,t,i){const r=e.context,n=e.transform,s=r.gl,a=n.projection.name==="globe",l=a?["PROJECTION_GLOBE_VIEW"]:[];let h=i.projMatrix;if(a&amp;&amp;hr(n.zoom)&gt;0){const z=Rm($v(i.canonical,n));h=nt.multiply(new Float32Array(16),n.globeMatrix,z),nt.multiply(h,n.projMatrix,h)}const d=e.getOrCreateProgram("debug",{defines:l}),f=t.getTileByID(i.key);e.terrain&amp;&amp;e.terrain.setupElevationDraw(f,d);const m=de.disabled,_=Pe.disabled,y=e.colorModeForRenderPass(),x="$debug";r.activeTexture.set(s.TEXTURE0),e.emptyTexture.bind(s.LINEAR,s.CLAMP_TO_EDGE),a?f._makeGlobeTileDebugBuffers(e.context,n):f._makeDebugTileBoundsBuffers(e.context,n.projection);const b=f._tileDebugBuffer||e.debugBuffer,w=f._tileDebugIndexBuffer||e.debugIndexBuffer,T=f._tileDebugSegments||e.debugSegments;d.draw(e,s.LINE_STRIP,m,_,y,Le.disabled,BT(h,Ie.red),x,b,w,T,null,null,null,[f._globeTileDebugBorderBuffer]);const S=f.latestRawTileData,I=Math.floor((S&amp;&amp;S.byteLength||0)/1024),P=t.getTile(i).tileSize,M=512/Math.min(P,512)*(i.overscaledZ/n.zoom)*.5;let C=i.canonical.toString();i.overscaledZ!==i.canonical.z&amp;&amp;(C+=` =&gt; ${i.overscaledZ}`),C+=` ${I}kb`,function(z,B){z.initDebugOverlayCanvas();const U=z.debugOverlayCanvas,Z=z.context.gl,F=z.debugOverlayCanvas.getContext("2d");F.clearRect(0,0,U.width,U.height),F.shadowColor="white",F.shadowBlur=2,F.lineWidth=1.5,F.strokeStyle="white",F.textBaseline="top",F.font="bold 36px Open Sans, sans-serif",F.fillText(B,5,5),F.strokeText(B,5,5),z.debugOverlayTexture.update(U),z.debugOverlayTexture.bind(Z.LINEAR,Z.CLAMP_TO_EDGE)}(e,C);const D=f._tileDebugTextBuffer||e.debugBuffer,O=f._tileDebugTextIndexBuffer||e.quadTriangleIndexBuffer,k=f._tileDebugTextSegments||e.debugSegments;d.draw(e,s.TRIANGLES,m,_,je.alphaBlended,Le.disabled,BT(h,Ie.transparent,M),x,D,O,k,null,null,null,[f._globeTileDebugTextBuffer])}function XT(e,t,i,r){Rd(e,0,t+i/2,e.transform.width,i,r)}function YT(e,t,i,r){Rd(e,t-i/2,0,i,e.transform.height,r)}function Rd(e,t,i,r,n,s){const a=e.context,l=a.gl;l.enable(l.SCISSOR_TEST),l.scissor(t*_e.devicePixelRatio,i*_e.devicePixelRatio,r*_e.devicePixelRatio,n*_e.devicePixelRatio),a.clear({color:s}),l.disable(l.SCISSOR_TEST)}const rO=ei([{name:"a_pos_3f",components:3,type:"Float32"}]),{members:nO}=rO;function Bo(e,t,i,r){e.emplaceBack(t,i,r)}class KT{constructor(t){this.vertexArray=new aa,this.indices=new Xi,Bo(this.vertexArray,-1,-1,1),Bo(this.vertexArray,1,-1,1),Bo(this.vertexArray,-1,1,1),Bo(this.vertexArray,1,1,1),Bo(this.vertexArray,-1,-1,-1),Bo(this.vertexArray,1,-1,-1),Bo(this.vertexArray,-1,1,-1),Bo(this.vertexArray,1,1,-1),this.indices.emplaceBack(5,1,3),this.indices.emplaceBack(3,7,5),this.indices.emplaceBack(6,2,0),this.indices.emplaceBack(0,4,6),this.indices.emplaceBack(2,6,7),this.indices.emplaceBack(7,3,2),this.indices.emplaceBack(5,4,0),this.indices.emplaceBack(0,1,5),this.indices.emplaceBack(0,2,3),this.indices.emplaceBack(3,1,0),this.indices.emplaceBack(7,6,4),this.indices.emplaceBack(4,5,7),this.vertexBuffer=t.createVertexBuffer(this.vertexArray,nO),this.indexBuffer=t.createIndexBuffer(this.indices),this.segment=si.simpleSegment(0,0,36,12)}}function Al(e,t,i,r,n,s){const a=e.context.gl,l=t.paint.get("sky-atmosphere-color"),h=t.paint.get("sky-atmosphere-halo-color"),d=t.paint.get("sky-atmosphere-sun-intensity"),f=((m,_,y,x,b)=&gt;({u_matrix_3f:m,u_sun_direction:_,u_sun_intensity:y,u_color_tint_r:[x.r,x.g,x.b,x.a],u_color_tint_m:[b.r,b.g,b.b,b.a],u_luminance:5e-5}))(Br.fromMat4(Br.create(),r),n,d,l,h);a.framebufferTexture2D(a.FRAMEBUFFER,a.COLOR_ATTACHMENT0,a.TEXTURE_CUBE_MAP_POSITIVE_X+s,t.skyboxTexture,0),i.draw(e,a.TRIANGLES,de.disabled,Pe.disabled,je.unblended,Le.frontCW,f,"skyboxCapture",t.skyboxGeometry.vertexBuffer,t.skyboxGeometry.indexBuffer,t.skyboxGeometry.segment)}const sO=ei([{type:"Float32",name:"a_pos",components:3},{type:"Float32",name:"a_uv",components:2}]);class oO{constructor(t){const i=new oa;i.emplaceBack(-1,1,1,0,0),i.emplaceBack(1,1,1,1,0),i.emplaceBack(1,-1,1,1,1),i.emplaceBack(-1,-1,1,0,1);const r=new Xi;r.emplaceBack(0,1,2),r.emplaceBack(2,3,0),this.vertexBuffer=t.createVertexBuffer(i,sO.members),this.indexBuffer=t.createIndexBuffer(r),this.segments=si.simpleSegment(0,0,4,2)}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy()}}const aO=ei([{type:"Float32",name:"a_pos_3f",components:3},{type:"Float32",name:"a_uv",components:2},{type:"Float32",name:"a_size_scale",components:1},{type:"Float32",name:"a_fade_opacity",components:1}]);class lO{constructor(){this.colorModeAlphaBlendedWriteRGB=new je([1,ld,1,ld],Ie.transparent,[!0,!0,!0,!1]),this.colorModeWriteAlpha=new je([1,0,1,0],Ie.transparent,[!1,!1,!1,!0])}update(t){const i=t.context;if(!this.atmosphereBuffer){this.atmosphereBuffer=new oO(i);const r=100,n=200,s=function(f){const m=Ep(30),_=[];for(let y=0;y&lt;16e3;++y){const x=2*Math.PI*m(),b=Math.acos(1-2*m())-.5*Math.PI;_.push(W.fromValues(Math.cos(b)*Math.cos(x),Math.cos(b)*Math.sin(x),Math.sin(b)))}return _}(),a=Ep(300),l=new em,h=new Xi;let d=0;for(let f=0;f&lt;s.length;++f){const m=W.scale([],s[f],200),_=Math.max(0,1+.01*r*(1*a()-.5)),y=Math.max(0,1+.01*n*(1*a()-.5));l.emplaceBack(m[0],m[1],m[2],-1,-1,_,y),l.emplaceBack(m[0],m[1],m[2],1,-1,_,y),l.emplaceBack(m[0],m[1],m[2],1,1,_,y),l.emplaceBack(m[0],m[1],m[2],-1,1,_,y),h.emplaceBack(d+0,d+1,d+2),h.emplaceBack(d+0,d+2,d+3),d+=4}this.starsVx=i.createVertexBuffer(l,aO.members),this.starsIdx=i.createIndexBuffer(h),this.starsSegments=si.simpleSegment(0,0,l.length,h.length)}}destroy(){this.atmosphereBuffer&amp;&amp;this.atmosphereBuffer.destroy(),this.starsVx&amp;&amp;this.starsVx.destroy(),this.starsIdx&amp;&amp;this.starsIdx.destroy()}drawAtmosphereGlow(t,i){const r=t.context,n=r.gl,s=t.transform,a=new de(n.LEQUAL,de.ReadOnly,[0,1]),l=hr(s.zoom),h=i.properties.get("color").toArray01(),d=i.properties.get("high-color").toArray01(),f=i.properties.get("space-color").toArray01PremultipliedAlpha(),m=5e-4,_=Xt((i.properties.get("horizon-blend")-0)/1*.2495+m,5e-4,.25),y=e1(t,r,s)&amp;&amp;_===m?s.worldSize/(2*Math.PI*1.025)-1:s.globeRadius,x=t.frameCounter/1e3%1,b=W.length(s.globeCenterInViewSpace),w=Math.sqrt(Math.pow(b,2)-Math.pow(y,2)),T=Math.acos(w/b),S=I=&gt;{const P=s.projection.name==="globe"?["PROJECTION_GLOBE_VIEW","FOG"]:["FOG"];I&amp;&amp;P.push("ALPHA_PASS");const M=t.getOrCreateProgram("globeAtmosphere",{defines:P}),C=((O,k,z,B,U,Z,F,Y,J,it,X,K)=&gt;({u_frustum_tl:O,u_frustum_tr:k,u_frustum_br:z,u_frustum_bl:B,u_horizon:U,u_transition:Z,u_fadeout_range:F,u_color:Y,u_high_color:J,u_space_color:it,u_temporal_offset:X,u_horizon_angle:K}))(s.frustumCorners.TL,s.frustumCorners.TR,s.frustumCorners.BR,s.frustumCorners.BL,s.frustumCorners.horizon,l,_,h,d,f,x,T);t.uploadCommonUniforms(r,M);const D=this.atmosphereBuffer;D&amp;&amp;M.draw(t,n.TRIANGLES,a,Pe.disabled,I?this.colorModeWriteAlpha:this.colorModeAlphaBlendedWriteRGB,Le.backCW,C,I?"atmosphere_glow_alpha":"atmosphere_glow",D.vertexBuffer,D.indexBuffer,D.segments)};S(!1),S(!0)}drawStars(t,i){const r=Xt(i.properties.get("star-intensity"),0,1);if(r===0)return;const n=t.context,s=n.gl,a=t.transform,l=t.getOrCreateProgram("stars"),h=vr.identity([]);vr.rotateX(h,h,-a._pitch),vr.rotateZ(h,h,-a.angle),vr.rotateX(h,h,$t(a._center.lat)),vr.rotateY(h,h,-$t(a._center.lng));const d=nt.fromQuat(new Float32Array(16),h),f=nt.multiply([],a.starsProjMatrix,d),m=Br.fromMat4([],d),_=Br.invert([],m),y=[0,1,0];W.transformMat3(y,y,_),W.scale(y,y,.15);const x=[1,0,0];W.transformMat3(x,x,_),W.scale(x,x,.15);const b=((w,T,S,I)=&gt;({u_matrix:Float32Array.from(w),u_up:T,u_right:S,u_intensity_multiplier:I}))(f,y,x,r);t.uploadCommonUniforms(n,l),this.starsVx&amp;&amp;this.starsIdx&amp;&amp;l.draw(t,s.TRIANGLES,de.disabled,Pe.disabled,this.colorModeAlphaBlendedWriteRGB,Le.disabled,b,"atmosphere_stars",this.starsVx,this.starsIdx,this.starsSegments)}}function JT(e,t){const i=[...e],r=t.cameraWorldSizeForFog/t.worldSize,n=nt.identity([]);return nt.scale(n,n,[r,r,1]),nt.multiply(i,n,i),nt.multiply(i,t.worldToFogMatrix,i),i}function K_(e,t,i,r){const n=i.material,s=r.context,{baseColorTexture:a,metallicRoughnessTexture:l}=n.pbrMetallicRoughness,{normalTexture:h,occlusionTexture:d,emissionTexture:f}=n;function m(_,y,x){if(_&amp;&amp;(e.push(y),s.activeTexture.set(s.gl.TEXTURE0+x),_.gfxTexture)){const{minFilter:b,magFilter:w,wrapS:T,wrapT:S}=_.sampler;_.gfxTexture.bindExtraParam(b,w,T,S)}}m(a,"HAS_TEXTURE_u_baseColorTexture",rn.BaseColor),m(l,"HAS_TEXTURE_u_metallicRoughnessTexture",rn.MetallicRoughness),m(h,"HAS_TEXTURE_u_normalTexture",rn.Normal),m(d,"HAS_TEXTURE_u_occlusionTexture",rn.Occlusion),m(f,"HAS_TEXTURE_u_emissionTexture",rn.Emission),i.texcoordBuffer&amp;&amp;(e.push("HAS_ATTRIBUTE_a_uv_2f"),t.push(i.texcoordBuffer)),i.colorBuffer&amp;&amp;(e.push(i.colorBuffer.itemSize===12?"HAS_ATTRIBUTE_a_color_3f":"HAS_ATTRIBUTE_a_color_4f"),t.push(i.colorBuffer)),i.normalBuffer&amp;&amp;(e.push("HAS_ATTRIBUTE_a_normal_3f"),t.push(i.normalBuffer)),i.pbrBuffer&amp;&amp;(e.push("HAS_ATTRIBUTE_a_pbr"),e.push("HAS_ATTRIBUTE_a_heightBasedEmissiveStrength"),t.push(i.pbrBuffer)),n.alphaMode!=="OPAQUE"&amp;&amp;n.alphaMode!=="MASK"||e.push("UNPREMULT_TEXTURE_IN_SHADER"),n.defined||e.push("DIFFUSE_SHADED"),e.push("USE_STANDARD_DERIVATIVES")}function Dd(e,t,i,r,n,s){const a=i.paint.get("model-opacity"),l=t.context,h=new de(t.context.gl.LEQUAL,de.ReadWrite,t.depthRangeFor3D),d=t.transform,f=e.mesh,m=f.material,_=m.pbrMetallicRoughness,y=t.style.fog;let x;x=t.transform.projection.zAxisUnit==="pixels"?[...e.nodeModelMatrix]:nt.multiply([],r.zScaleMatrix,e.nodeModelMatrix),nt.multiply(x,r.negCameraPosMatrix,x);const b=nt.invert([],x);nt.transpose(b,b);const w=i.paint.get("model-emissive-strength").constantOr(0),T=X_(new Float32Array(e.worldViewProjection),new Float32Array(x),new Float32Array(b),t,a,_.baseColorFactor,m.emissiveFactor,_.metallicFactor,_.roughnessFactor,m,w,i),S={defines:[]},I=[];K_(S.defines,I,f,t);const P=t.shadowRenderer;P&amp;&amp;(P.useNormalOffset=!1);let M=null;if(y){const O=JT(e.nodeModelMatrix,t.transform);if(M=new Float32Array(O),d.projection.name!=="globe"){const k=f.aabb.min,z=f.aabb.max,[B,U]=y.getOpacityForBounds(O,k[0],k[1],z[0],z[1]);S.overrideFog=B&gt;=_a||U&gt;=_a}}const C=Tl(t,i.paint.get("model-cutoff-fade-range"));C.shouldRenderCutoff&amp;&amp;S.defines.push("RENDER_CUTOFF");const D=t.getOrCreateProgram("model",S);t.uploadCommonUniforms(l,D,null,M,C),t.renderPass!=="shadow"&amp;&amp;P&amp;&amp;P.setupShadowsFromMatrix(e.nodeModelMatrix,D),D.draw(t,l.gl.TRIANGLES,h,n,s,f.material.doubleSided?Le.disabled:Le.backCCW,T,i.id,f.vertexBuffer,f.indexBuffer,f.segments,i.paint,t.transform.zoom,void 0,I)}function QT(e,t,i,r,n,s,a){let l;l=e.projection.name==="globe"?qb(i,e):[...i],nt.multiply(l,l,t.matrix);const h=nt.multiply([],r,l);if(t.meshes)for(const d of t.meshes){if(d.material.alphaMode!=="BLEND"){a.push({mesh:d,depth:0,modelIndex:n,worldViewProjection:h,nodeModelMatrix:l});continue}const f=W.transformMat4([],d.centroid,h);f[2]&gt;0&amp;&amp;s.push({mesh:d,depth:f[2],modelIndex:n,worldViewProjection:h,nodeModelMatrix:l})}if(t.children)for(const d of t.children)QT(e,d,i,r,n,s,a)}function J_(e,t,i,r){const n=i.shadowRenderer;if(!n)return;const s=n.getShadowPassDepthMode(),a=n.getShadowPassColorMode(),l=n.calculateShadowPassMatrixFromMatrix(t),h=HT(l);i.getOrCreateProgram("modelDepth",{defines:["DEPTH_TEXTURE"]}).draw(i,i.context.gl.TRIANGLES,s,Pe.disabled,a,Le.backCCW,h,r.id,e.vertexBuffer,e.indexBuffer,e.segments,r.paint,i.transform.zoom,void 0,void 0)}function cO(e,t,i){const r=t.updateZoomBasedPaintProperties(),n=function(s,a,l){let h,d,f,m=s.terrain?s.terrain.exaggeration():0;if(s.terrain&amp;&amp;m&gt;0){const _=s.terrain,y=_.findDEMTileFor(l);y&amp;&amp;y.dem?h=dl.create(_,l,y):m=0}if(m===0&amp;&amp;(a.terrainElevationMin=0,a.terrainElevationMax=0),m===a.validForExaggeration&amp;&amp;(m===0||h&amp;&amp;h._demTile&amp;&amp;h._demTile.tileID===a.validForDEMTile.id&amp;&amp;h._dem._timestamp===a.validForDEMTile.timestamp))return!1;for(const _ in a.instancesPerModel){const y=a.instancesPerModel[_];for(let x=0;x&lt;y.instancedDataArray.length;++x){const b=(h?m*h.getElevationAt(0|y.instancedDataArray.float32[16*x],0|y.instancedDataArray.float32[16*x+1],!0,!0):0)+y.instancesEvaluatedElevation[x];y.instancedDataArray.float32[16*x+6]=b,d=d?Math.min(a.terrainElevationMin,b):b,f=f?Math.max(a.terrainElevationMax,b):b}}return a.terrainElevationMin=d||0,a.terrainElevationMax=f||0,a.validForExaggeration=m,a.validForDEMTile=h&amp;&amp;h._demTile?{id:h._demTile.tileID,timestamp:h._dem._timestamp}:{id:void 0,timestamp:0},!0}(e,t,i);(r||n)&amp;&amp;(t.uploaded=!1,t.upload(e.context))}const xs={shadowUniformsInitialized:!1,useSingleShadowCascade:!1,tileMatrix:new Float64Array(16),shadowTileMatrix:new Float32Array(16),aabb:new mi([0,0,0],[ut,ut,0])};function uO(e,t){const i=1&lt;&lt;e.canonical.z,r=t.getFreeCameraOptions().position,n=t.elevation,s=e.canonical.x/i,a=(e.canonical.x+1)/i,l=e.canonical.y/i,h=(e.canonical.y+1)/i;let d=t._centerAltitude;if(n){const y=n.getMinMaxForTile(e);y&amp;&amp;y.max&gt;d&amp;&amp;(d=y.max)}const f=Xt(r.x,s,a)-r.x,m=Xt(r.y,l,h)-r.y,_=ui(d,t.center.lat)-r.z;return t._zoomFromMercatorZ(Math.sqrt(f*f+m*m+_*_))}function tE(e,t,i,r,n,s,a){const l=e.context,h=e.renderPass==="shadow",d=e.shadowRenderer,f=h&amp;&amp;d?d.getShadowPassDepthMode():new de(l.gl.LEQUAL,de.ReadWrite,e.depthRangeFor3D),m=e.isTileAffectedByFog(s);if(i.meshes)for(const _ of i.meshes){const y=["MODEL_POSITION_ON_GPU"],x=[];let b,w,T;r.instancedDataArray.length&gt;20&amp;&amp;y.push("INSTANCED_ARRAYS");const S=Tl(e,t.paint.get("model-cutoff-fade-range"));if(S.shouldRenderCutoff&amp;&amp;y.push("RENDER_CUTOFF"),h&amp;&amp;d)b=e.getOrCreateProgram("modelDepth",{defines:y}),w=HT(a.shadowTileMatrix,a.shadowTileMatrix,Float32Array.from(i.matrix)),T=d.getShadowPassColorMode();else{K_(y,x,_,e),b=e.getOrCreateProgram("model",{defines:y,overrideFog:m});const P=_.material,M=P.pbrMetallicRoughness,C=t.paint.get("model-opacity"),D=t.paint.get("model-emissive-strength").constantOr(0);w=X_(s.expandedProjMatrix,Float32Array.from(i.matrix),new Float32Array(16),e,C,M.baseColorFactor,P.emissiveFactor,M.metallicFactor,M.roughnessFactor,P,D,t,n),d&amp;&amp;(a.shadowUniformsInitialized?b.setShadowUniformValues(l,d.getShadowUniformValues()):(d.setupShadows(s.toUnwrapped(),b,"model-tile",s.overscaledZ),a.shadowUniformsInitialized=!0)),T=S.shouldRenderCutoff||C&lt;1||P.alphaMode!=="OPAQUE"?je.alphaBlended:je.unblended}e.uploadCommonUniforms(l,b,s.toUnwrapped(),null,S);const I=_.material.doubleSided?Le.disabled:Le.backCCW;if(r.instancedDataArray.length&gt;20)x.push(r.instancedDataBuffer),b.draw(e,l.gl.TRIANGLES,f,Pe.disabled,T,I,w,t.id,_.vertexBuffer,_.indexBuffer,_.segments,t.paint,e.transform.zoom,void 0,x,r.instancedDataArray.length);else{const P=h?"u_instance":"u_normal_matrix";for(let M=0;M&lt;r.instancedDataArray.length;++M)w[P]=new Float32Array(r.instancedDataArray.arrayBuffer,64*M,16),b.draw(e,l.gl.TRIANGLES,f,Pe.disabled,T,I,w,t.id,_.vertexBuffer,_.indexBuffer,_.segments,t.paint,e.transform.zoom,void 0,x)}}if(i.children)for(const _ of i.children)tE(e,t,_,r,n,s,a)}const hO=[1,-1,1];function dO(e,t,i,r){if(!i.modelManager)return!0;const n=i.modelManager;if(!i.shadowRenderer)return!0;const s=i.shadowRenderer,a=t.aabb;let l=!0,h=e.maxHeight;if(h===0){let f=0;for(const m in e.instancesPerModel){const _=n.getModel(m,r);_?f=Math.max(f,Math.max(Math.max(_.aabb.max[0],_.aabb.max[1]),_.aabb.max[2])):l=!1}h=e.maxScale*f*1.41+e.maxVerticalOffset,l&amp;&amp;(e.maxHeight=h)}a.max[2]=h,a.min[2]+=e.terrainElevationMin,a.max[2]+=e.terrainElevationMax,W.transformMat4(a.min,a.min,t.tileMatrix),W.transformMat4(a.max,a.max,t.tileMatrix);const d=a.intersects(s.getCurrentCascadeFrustum());return i.currentShadowCascade===0&amp;&amp;(e.isInsideFirstShadowMapFrustum=d===2),d===0}class fO{}class pO{constructor(){this._storage=new Map}getLinesFromTrianglesBuffer(t,i,r){{const m=this._storage.get(i.id);if(m)return m.lastUsedFrameIdx=t,m.buf}const n=r.gl,s=n.getBufferParameter(n.ELEMENT_ARRAY_BUFFER,n.BUFFER_SIZE),a=new ArrayBuffer(s),l=new Int16Array(a);n.getBufferSubData(n.ELEMENT_ARRAY_BUFFER,0,new Int16Array(a));const h=new yo;for(let m=0;m&lt;s/2;m+=3){const _=l[m],y=l[m+1],x=l[m+2];h.emplaceBack(_,y),h.emplaceBack(y,x),h.emplaceBack(x,_)}const d=r.bindVertexArrayOES.current,f=new fO;return f.buf=new ko(r,h),f.lastUsedFrameIdx=t,this._storage.set(i.id,f),r.bindVertexArrayOES.set(d),f.buf}update(t){for(const[i,r]of this._storage)t-r.lastUsedFrameIdx&gt;30&amp;&amp;(r.buf.destroy(),this._storage.delete(i))}destroy(){for(const[t,i]of this._storage)i.buf.destroy(),this._storage.delete(t)}}const eE={symbol:function(e,t,i,r,n){if(e.renderPass!=="translucent")return;const s=Pe.disabled,a=e.colorModeForRenderPass();i.layout.get("text-variable-anchor")&amp;&amp;function(l,h,d,f,m,_,y){const x=h.transform,b=m==="map",w=_==="map";for(const T of l){const S=f.getTile(T),I=S.getBucket(d);if(!I||!I.text||!I.text.segments.get().length)continue;const P=ps(I.textSizeData,x.zoom),M=j_(T,I.getProjection(),x),C=x.calculatePixelsToTileUnitsMatrix(S),D=ud(M,S.tileID.canonical,w,b,x,I.getProjection(),C),O=I.hasIconTextFit()&amp;&amp;I.hasIconData();if(P){const k=Math.pow(2,x.zoom-S.tileID.overscaledZ);GD(I,b,w,y,h3,x,D,T,k,P,O)}}}(r,e,i,t,i.layout.get("text-rotation-alignment"),i.layout.get("text-pitch-alignment"),n),i.paint.get("icon-opacity").constantOr(1)!==0&amp;&amp;ZT(e,t,i,r,!1,i.paint.get("icon-translate"),i.paint.get("icon-translate-anchor"),i.layout.get("icon-rotation-alignment"),i.layout.get("icon-pitch-alignment"),i.layout.get("icon-keep-upright"),i.paint.get("icon-color-saturation"),s,a),i.paint.get("text-opacity").constantOr(1)!==0&amp;&amp;ZT(e,t,i,r,!0,i.paint.get("text-translate"),i.paint.get("text-translate-anchor"),i.layout.get("text-rotation-alignment"),i.layout.get("text-pitch-alignment"),i.layout.get("text-keep-upright"),i.paint.get("icon-color-saturation"),s,a),t.map.showCollisionBoxes&amp;&amp;(WT(e,t,i,r,i.paint.get("text-translate"),i.paint.get("text-translate-anchor"),!0),WT(e,t,i,r,i.paint.get("icon-translate"),i.paint.get("icon-translate-anchor"),!1))},circle:function(e,t,i,r){if(e.renderPass!=="translucent")return;const n=i.paint.get("circle-opacity"),s=i.paint.get("circle-stroke-width"),a=i.paint.get("circle-stroke-opacity"),l=i.layout.get("circle-sort-key").constantOr(1)!==void 0,h=i.paint.get("circle-emissive-strength");if(n.constantOr(1)===0&amp;&amp;(s.constantOr(1)===0||a.constantOr(1)===0))return;const d=e.context,f=d.gl,m=e.transform,_=e.depthModeForSublayer(0,de.ReadOnly),y=Pe.disabled,x=e.colorModeForDrapableLayerRenderPass(h),b=m.projection.name==="globe",w=[er(m.center.lng),sr(m.center.lat)],T=[];for(let I=0;I&lt;r.length;I++){const P=r[I],M=t.getTile(P),C=M.getBucket(i);if(!C||C.projection.name!==m.projection.name)continue;const D=C.programConfigurations.get(i.id),O=g1(i),k=e.isTileAffectedByFog(P);b&amp;&amp;O.push("PROJECTION_GLOBE_VIEW");const z=e.getOrCreateProgram("circle",{config:D,defines:O,overrideFog:k}),B=C.layoutVertexBuffer,U=C.globeExtVertexBuffer,Z=C.indexBuffer,F=m.projection.createInversionMatrix(m,P.canonical),Y={programConfiguration:D,program:z,layoutVertexBuffer:B,globeExtVertexBuffer:U,indexBuffer:Z,uniformValues:sC(e,P,M,F,w,i),tile:M};if(l){const J=C.segments.get();for(const it of J)T.push({segments:new si([it]),sortKey:it.sortKey,state:Y})}else T.push({segments:C.segments,sortKey:0,state:Y})}l&amp;&amp;T.sort((I,P)=&gt;I.sortKey-P.sortKey);const S={useDepthForOcclusion:m.depthOcclusionForSymbolsAndCircles};for(const I of T){const{programConfiguration:P,program:M,layoutVertexBuffer:C,globeExtVertexBuffer:D,indexBuffer:O,uniformValues:k,tile:z}=I.state,B=I.segments;e.terrain&amp;&amp;e.terrain.setupElevationDraw(z,M,S),e.uploadCommonUniforms(d,M,z.tileID.toUnwrapped()),M.draw(e,f.TRIANGLES,_,y,x,Le.disabled,k,i.id,C,O,B,i.paint,m.zoom,P,[D])}},heatmap:function(e,t,i,r){if(i.paint.get("heatmap-opacity")!==0)if(e.renderPass==="offscreen"){const n=e.context,s=n.gl,a=Pe.disabled,l=new je([s.ONE,s.ONE,s.ONE,s.ONE],Ie.transparent,[!0,!0,!0,!0]);(function(y,x,b,w){const T=y.gl,S=x.width*w,I=x.height*w;y.activeTexture.set(T.TEXTURE1),y.viewport.set([0,0,S,I]);let P=b.heatmapFbo;if(!P||P&amp;&amp;(P.width!==S||P.height!==I)){P&amp;&amp;P.destroy();const M=T.createTexture();T.bindTexture(T.TEXTURE_2D,M),T.texParameteri(T.TEXTURE_2D,T.TEXTURE_WRAP_S,T.CLAMP_TO_EDGE),T.texParameteri(T.TEXTURE_2D,T.TEXTURE_WRAP_T,T.CLAMP_TO_EDGE),T.texParameteri(T.TEXTURE_2D,T.TEXTURE_MIN_FILTER,T.LINEAR),T.texParameteri(T.TEXTURE_2D,T.TEXTURE_MAG_FILTER,T.LINEAR),P=b.heatmapFbo=y.createFramebuffer(S,I,!0,null),function(C,D,O,k,z,B){const U=C.gl;U.texImage2D(U.TEXTURE_2D,0,C.extRenderToTextureHalfFloat?U.RGBA16F:U.RGBA,z,B,0,U.RGBA,C.extRenderToTextureHalfFloat?U.HALF_FLOAT:U.UNSIGNED_BYTE,null),k.colorAttachment.set(O)}(y,0,M,P,S,I)}else T.bindTexture(T.TEXTURE_2D,P.colorAttachment.get()),y.bindFramebuffer.set(P.framebuffer)})(n,e,i,e.transform.projection.name==="globe"?.5:.25),n.clear({color:Ie.transparent});const h=e.transform,d=h.projection.name==="globe",f=d?["PROJECTION_GLOBE_VIEW"]:[],m=d?Le.frontCCW:Le.disabled,_=[er(h.center.lng),sr(h.center.lat)];for(let y=0;y&lt;r.length;y++){const x=r[y];if(t.hasRenderableParent(x))continue;const b=t.getTile(x),w=b.getBucket(i);if(!w||w.projection.name!==h.projection.name)continue;const T=e.isTileAffectedByFog(x),S=w.programConfigurations.get(i.id),I=e.getOrCreateProgram("heatmap",{config:S,defines:f,overrideFog:T}),{zoom:P}=e.transform;e.terrain&amp;&amp;e.terrain.setupElevationDraw(b,I),e.uploadCommonUniforms(n,I,x.toUnwrapped());const M=h.projection.createInversionMatrix(h,x.canonical);I.draw(e,s.TRIANGLES,de.disabled,a,l,m,OD(e,x,b,M,_,P,i.paint.get("heatmap-intensity")),i.id,w.layoutVertexBuffer,w.indexBuffer,w.segments,i.paint,e.transform.zoom,S,d?[w.globeExtVertexBuffer]:null)}n.viewport.set([0,0,e.width,e.height])}else e.renderPass==="translucent"&amp;&amp;(e.context.setColorMode(e.colorModeForRenderPass()),function(n,s){const a=n.context,l=a.gl,h=s.heatmapFbo;if(!h)return;a.activeTexture.set(l.TEXTURE0),l.bindTexture(l.TEXTURE_2D,h.colorAttachment.get()),a.activeTexture.set(l.TEXTURE1);let d=s.colorRampTexture;d||(d=s.colorRampTexture=new Ii(a,s.colorRamp,l.RGBA)),d.bind(l.LINEAR,l.CLAMP_TO_EDGE),n.getOrCreateProgram("heatmapTexture").draw(n,l.TRIANGLES,de.disabled,Pe.disabled,n.colorModeForRenderPass(),Le.disabled,((f,m,_,y)=&gt;({u_image:0,u_color_ramp:1,u_opacity:m.paint.get("heatmap-opacity")}))(0,s),s.id,n.viewportBuffer,n.quadTriangleIndexBuffer,n.viewportSegments,s.paint,n.transform.zoom)}(e,i))},line:function(e,t,i,r){if(e.renderPass!=="translucent")return;const n=i.paint.get("line-opacity"),s=i.paint.get("line-width");if(n.constantOr(1)===0||s.constantOr(1)===0)return;const a=i.paint.get("line-emissive-strength"),l=e.depthModeForSublayer(0,de.ReadOnly),h=e.colorModeForDrapableLayerRenderPass(a),d=e.terrain&amp;&amp;e.terrain.renderingToTexture?1:_e.devicePixelRatio,f=i.paint.get("line-dasharray"),m=f.constantOr(1),_=i.layout.get("line-cap"),y=i.paint.get("line-pattern"),x=y.constantOr(1),b=i.paint.get("line-pattern").constantOr(1),w=i.paint.get("line-opacity").constantOr(1)!==1;let T=!b&amp;&amp;w;const S=i.paint.get("line-gradient"),I=x?"linePattern":"line",P=e.context,M=P.gl,C=Ew(i);e.terrain&amp;&amp;e.terrain.clipOrMaskOverlapStencilType()&amp;&amp;(T=!1);for(const D of r){const O=t.getTile(D);if(x&amp;&amp;!O.patternsLoaded())continue;const k=O.getBucket(i);if(!k)continue;e.prepareDrawTile();const z=k.programConfigurations.get(i.id),B=e.isTileAffectedByFog(D),U=e.getOrCreateProgram(I,{config:z,defines:C,overrideFog:B}),Z=y.constantOr(null);if(Z&amp;&amp;O.imageAtlas){const lt=O.imageAtlas.patternPositions[Z.toString()];lt&amp;&amp;z.setConstantPatternPositions(lt)}const F=f.constantOr(null),Y=_.constantOr(null);if(!x&amp;&amp;F&amp;&amp;Y&amp;&amp;O.lineAtlas){const lt=O.lineAtlas.getDash(F,Y);lt&amp;&amp;z.setConstantPatternPositions(lt)}let[J,it]=i.paint.get("line-trim-offset");(Y==="round"||Y==="square")&amp;&amp;J!==it&amp;&amp;(J===0&amp;&amp;(J-=1),it===1&amp;&amp;(it+=1));const X=e.terrain?D.projMatrix:null,K=x?uR(e,O,i,X,d):cR(e,O,i,X,k.lineClipsArray.length,d,[J,it]);if(S){const lt=k.gradients[i.id];let at=lt.texture;if(i.gradientVersion!==lt.version){let dt=256;if(i.stepInterpolant){const ft=t.getSource().maxzoom,_t=D.canonical.z===ft?Math.ceil(1&lt;&lt;e.transform.maxZoom-D.canonical.z):1;dt=Xt(is(k.maxLineLength/ut*1024*_t),256,P.maxTextureSize)}lt.gradient=Ch({expression:i.gradientExpression(),evaluationKey:"lineProgress",resolution:dt,image:lt.gradient||void 0,clips:k.lineClipsArray}),lt.texture?lt.texture.update(lt.gradient):lt.texture=new Ii(P,lt.gradient,M.RGBA),lt.version=i.gradientVersion,at=lt.texture}P.activeTexture.set(M.TEXTURE1),at.bind(i.stepInterpolant?M.NEAREST:M.LINEAR,M.CLAMP_TO_EDGE)}m&amp;&amp;(P.activeTexture.set(M.TEXTURE0),O.lineAtlasTexture&amp;&amp;O.lineAtlasTexture.bind(M.LINEAR,M.REPEAT),z.updatePaintBuffers()),x&amp;&amp;(P.activeTexture.set(M.TEXTURE0),O.imageAtlasTexture&amp;&amp;O.imageAtlasTexture.bind(M.LINEAR,M.CLAMP_TO_EDGE),z.updatePaintBuffers()),e.uploadCommonUniforms(P,U,D.toUnwrapped());const ot=lt=&gt;{U.draw(e,M.TRIANGLES,l,lt,h,Le.disabled,K,i.id,k.layoutVertexBuffer,k.indexBuffer,k.segments,i.paint,e.transform.zoom,z,[k.layoutVertexBuffer2])};if(T){const lt=e.stencilModeForClipping(D).ref;lt===0&amp;&amp;e.terrain&amp;&amp;P.clear({stencil:0});const at={func:M.EQUAL,mask:255};K.u_alpha_discard_threshold=.8,ot(new Pe(at,lt,255,M.KEEP,M.KEEP,M.INVERT)),K.u_alpha_discard_threshold=0,ot(new Pe(at,lt,255,M.KEEP,M.KEEP,M.KEEP))}else ot(e.stencilModeForClipping(D))}T&amp;&amp;(e.resetStencilClippingMasks(),e.terrain&amp;&amp;P.clear({stencil:0}))},fill:function(e,t,i,r){const n=i.paint.get("fill-color"),s=i.paint.get("fill-opacity");if(s.constantOr(1)===0)return;const a=i.paint.get("fill-emissive-strength"),l=e.colorModeForDrapableLayerRenderPass(a),h=i.paint.get("fill-pattern"),d=e.opaquePassEnabledForLayer()&amp;&amp;!h.constantOr(1)&amp;&amp;n.constantOr(Ie.transparent).a===1&amp;&amp;s.constantOr(0)===1?"opaque":"translucent";if(e.renderPass===d){const f=e.depthModeForSublayer(1,e.renderPass==="opaque"?de.ReadWrite:de.ReadOnly);$T(e,t,i,r,f,l,!1)}if(e.renderPass==="translucent"&amp;&amp;i.paint.get("fill-antialias")){const f=e.depthModeForSublayer(i.getPaintProperty("fill-outline-color")?2:0,de.ReadOnly);$T(e,t,i,r,f,l,!0)}},"fill-extrusion":function(e,t,i,r){const n=i.paint.get("fill-extrusion-opacity"),s=e.context,a=s.gl,l=e.terrain,h=l&amp;&amp;l.renderingToTexture,d=i.paint.get("fill-extrusion-cutoff-fade-range");if(n===0)return;const f=e.conflationActive&amp;&amp;e.layerUsedInConflation(i,t.getSource());if(f&amp;&amp;function(m,_,y,x){for(const b of x){const w=_.getTile(b).getBucket(y);w&amp;&amp;(w.updateReplacement(b,m.replacementSource),w.uploadCentroid(m.context))}}(e,t,i,r),l||f)for(const m of r){const _=t.getTile(m).getBucket(i);_&amp;&amp;WD(e.context,t,m,_,i,l,f)}if(e.renderPass==="shadow"&amp;&amp;e.shadowRenderer){const m=e.shadowRenderer;if(l&amp;&amp;n&lt;.65&amp;&amp;i._transitionablePaint._values["fill-extrusion-opacity"].value.expression instanceof po)return;const _=m.getShadowPassDepthMode(),y=m.getShadowPassColorMode();Ld(e,t,i,r,_,Pe.disabled,y,f)}else if(e.renderPass==="translucent"){const m=!i.paint.get("fill-extrusion-pattern").constantOr(1);if(!h){const _=new de(e.context.gl.LEQUAL,de.ReadWrite,e.depthRangeFor3D);d===0&amp;&amp;n===1&amp;&amp;m?Ld(e,t,i,r,_,Pe.disabled,je.unblended,f):(Ld(e,t,i,r,_,Pe.disabled,je.disabled,f),Ld(e,t,i,r,_,e.stencilModeFor3D(),e.colorModeForRenderPass(),f),e.resetStencilClippingMasks())}if(e.style.enable3dLights()&amp;&amp;m&amp;&amp;(!l&amp;&amp;e.transform.projection.name!=="globe"||h)){const _=i.paint.get("fill-extrusion-opacity"),y=i.paint.get("fill-extrusion-ambient-occlusion-intensity"),x=i.paint.get("fill-extrusion-ambient-occlusion-ground-radius"),b=i.paint.get("fill-extrusion-flood-light-intensity"),w=i.paint.get("fill-extrusion-flood-light-color").toArray01().slice(0,3),T=y&gt;0&amp;&amp;x&gt;0,S=b&gt;0,I=(M,C,D)=&gt;(1-D)*M+D*C,P=M=&gt;{const C=e.depthModeForSublayer(1,de.ReadOnly,a.LEQUAL,!0),D=i.paint.get(M?"fill-extrusion-ambient-occlusion-ground-attenuation":"fill-extrusion-flood-light-ground-attenuation"),O=I(.1,3,D),k=e._showOverdrawInspector;if(!k){const z=new Pe({func:a.ALWAYS,mask:255},255,255,a.KEEP,a.KEEP,a.REPLACE),B=new je([a.ONE,a.ONE,a.ONE,a.ONE],Ie.transparent,[!1,!1,!1,!0],a.MIN);Sl(e,t,i,r,C,z,B,Le.disabled,M,"sdf",_,y,x,b,w,O,f,!1)}{const z=k?Pe.disabled:new Pe({func:a.EQUAL,mask:255},255,255,a.KEEP,a.DECR,a.DECR),B=k?e.colorModeForRenderPass():new je([a.ONE_MINUS_DST_ALPHA,a.DST_ALPHA,a.ONE,a.ONE],Ie.transparent,[!0,!0,!0,!0]);Sl(e,t,i,r,C,z,B,Le.disabled,M,"color",_,y,x,b,w,O,f,!1)}};if(h){const M=(C,D,O)=&gt;{const k=e.depthModeForSublayer(1,de.ReadOnly,a.LEQUAL,!1),z=i.paint.get(C?"fill-extrusion-ambient-occlusion-ground-attenuation":"fill-extrusion-flood-light-ground-attenuation"),B=I(.1,3,z);{const U=new je([a.ONE,a.ONE,a.ONE,a.ONE],Ie.transparent,[!1,!1,!1,!0]);Sl(e,t,i,r,k,Pe.disabled,U,Le.disabled,C,"clear",_,y,x,b,w,B,f,D)}{const U=new Pe({func:a.ALWAYS,mask:255},255,255,a.KEEP,a.KEEP,a.REPLACE),Z=new je([a.ONE,a.ONE,a.ONE,a.ONE],Ie.transparent,[!1,!1,!1,!0],a.MIN);Sl(e,t,i,r,k,U,Z,Le.disabled,C,"sdf",_,y,x,b,w,B,f,D)}{const U=C?a.ZERO:a.ONE_MINUS_DST_ALPHA,Z=new Pe({func:a.EQUAL,mask:255},255,255,a.KEEP,a.DECR,a.DECR),F=new je([U,a.DST_ALPHA,a.ONE_MINUS_DST_ALPHA,a.ZERO],Ie.transparent,[!0,!0,!0,!0]);Sl(e,t,i,r,k,Z,F,Le.disabled,C,"color",_,y,x,b,w,B,f,D)}{const U=new je([a.ONE,a.ONE,a.ONE,C?a.ZERO:a.ONE],Ie.transparent,[!1,!1,!1,!0],C?a.FUNC_ADD:a.MAX);Sl(e,t,i,r,k,Pe.disabled,U,Le.disabled,C,"clear",_,y,x,b,w,B,f,D,O)}};if(T||S){let C;if(e.prepareDrawTile(),l){const D=l.drapeBufferSize[0],O=l.drapeBufferSize[1];C=l.framebufferCopyTexture,C&amp;&amp;(!C||C.size[0]===D&amp;&amp;C.size[1]===O)||(C&amp;&amp;C.destroy(),C=l.framebufferCopyTexture=new Ii(s,new Hi({width:D,height:O}),a.RGBA)),C.bind(a.LINEAR,a.CLAMP_TO_EDGE),a.copyTexImage2D(a.TEXTURE_2D,0,a.RGBA,0,0,D,O,0)}T&amp;&amp;M(!0,!1,C),S&amp;&amp;M(!1,!0,C)}}else T&amp;&amp;P(!0),S&amp;&amp;P(!1)}}},hillshade:function(e,t,i,r){if(e.renderPass!=="offscreen"&amp;&amp;e.renderPass!=="translucent"||e.style.disableElevatedTerrain)return;const n=e.context,s=e.terrain&amp;&amp;e.terrain.renderingToTexture,[a,l]=e.renderPass!=="translucent"||s?[{},r]:e.stencilConfigForOverlap(r);for(const h of l){const d=t.getTile(h);if(d.needsHillshadePrepare&amp;&amp;e.renderPass==="offscreen")xD(e,d,i);else if(e.renderPass==="translucent"){const f=e.depthModeForSublayer(0,de.ReadOnly),m=i.paint.get("hillshade-emissive-strength"),_=e.colorModeForDrapableLayerRenderPass(m),y=s&amp;&amp;e.terrain?e.terrain.stencilModeForRTTOverlap(h):a[h.overscaledZ];yD(e,h,d,i,f,y,_)}}n.viewport.set([0,0,e.width,e.height]),e.resetStencilClippingMasks()},raster:function(e,t,i,r,n,s){if(e.renderPass!=="translucent"||i.paint.get("raster-opacity")===0)return;const a=e.context,l=a.gl,h=t.getSource(),d=function(D,O,k){const z=D.paint.get("raster-color"),B=[],U=D.paint.get("raster-resampling"),Z=D.paint.get("raster-color-mix"),F=D.paint.get("raster-color-range"),Y=[Z[0],Z[1],Z[2],0],J=Z[3],it=U==="nearest"?k.NEAREST:k.LINEAR;if(z&amp;&amp;B.push("RASTER_COLOR"),z){O.activeTexture.set(k.TEXTURE2);let X=D.colorRampTexture;X||(X=D.colorRampTexture=new Ii(O,D.colorRamp,k.RGBA)),X.bind(k.LINEAR,k.CLAMP_TO_EDGE)}return{mix:Y,range:F,offset:J,defines:B,resampling:it}}(i,a,l),f=d.defines,m=e.transform.projection.name==="globe";let _=!1;if(h instanceof Rn&amp;&amp;!r.length){if(!m)return;if(h.onNorthPole)_=!0,f.push("GLOBE_POLES");else{if(!h.onSouthPole)return;_=!0,f.push("GLOBE_POLES")}}const y=i.paint.get("raster-emissive-strength"),x=e.colorModeForDrapableLayerRenderPass(y),b=e.terrain&amp;&amp;e.terrain.renderingToTexture,w=h instanceof Rn&amp;&amp;i.paint.get("raster-elevation")!==0,T=!e.options.moving,S=i.paint.get("raster-resampling")==="nearest"?l.NEAREST:l.LINEAR;if(_){const D=t.getSource();if(!(D instanceof Rn))return;const O=D.texture;if(!O)return;const k=e.globeSharedBuffers;if(!k)return;const z=new de(l.LEQUAL,de.ReadWrite,e.depthRangeFor3D),B=Float32Array.from(e.transform.expandedFarZProjMatrix);let U=t1(0,0,e.transform);const Z=Float32Array.from(Eo(pn(new In(0,0,0)))),F={opacity:1,mix:0};e.terrain&amp;&amp;e.terrain.prepareDrawTile(),a.activeTexture.set(l.TEXTURE0),O.bind(S,l.CLAMP_TO_EDGE),a.activeTexture.set(l.TEXTURE1),O.bind(S,l.CLAMP_TO_EDGE),O.useMipmap&amp;&amp;a.extTextureFilterAnisotropic&amp;&amp;e.transform.pitch&gt;20&amp;&amp;l.texParameterf(l.TEXTURE_2D,a.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,a.extTextureFilterAnisotropicMax);const[Y,J,it,X]=k.getPoleBuffers(0,!0);let K;D.onNorthPole?(K=Y,e.renderDefaultNorthPole=!1):(U=nt.scale(nt.create(),U,[1,-1,1]),K=J,e.renderDefaultSouthPole=!1);const ot=((at,dt,ft,_t,ct,bt,Ot,kt,Ht,Zt,fe,ie)=&gt;NT(at,dt,ft,new Float32Array(16),new Float32Array(9),[0,0],[0,0,0,0],0,[0,0],[0,0,0,0],1,_t,ct,bt||[0,0],Ot,2,Ht,Zt,fe,1,0,ie))(B,Z,U,F,i,D.perspectiveTransform||[0,0],i.paint.get("raster-elevation"),0,d.mix,d.offset,d.range,y),lt=e.getOrCreateProgram("raster",{defines:d.defines});return e.uploadCommonUniforms(a,lt,null),void lt.draw(e,l.TRIANGLES,z,Pe.disabled,x,Le.disabled,ot,i.id,K,it,X)}if(!r.length)return;const[I,P]=h instanceof Rn||b?[{},r]:e.stencilConfigForOverlap(r),M=P[P.length-1].overscaledZ,C=w&amp;&amp;m;C&amp;&amp;d.defines.push("PROJECTION_GLOBE_VIEW"),w&amp;&amp;d.defines.push("RENDER_CUTOFF");for(const D of P){const O=D.toUnwrapped(),k=t.getTile(D);if(b&amp;&amp;(!k||!k.hasData())||!k.texture)continue;let z,B;b?(z=de.disabled,B=D.projMatrix):w?(z=new de(l.LEQUAL,de.ReadWrite,e.depthRangeFor3D),B=m?Float32Array.from(e.transform.expandedFarZProjMatrix):e.transform.calculateProjMatrix(O,T)):(z=e.depthModeForSublayer(D.overscaledZ-M,i.paint.get("raster-opacity")===1?de.ReadWrite:de.ReadOnly,l.LESS),B=e.transform.calculateProjMatrix(O,T));const U=e.terrain&amp;&amp;b?e.terrain.stencilModeForRTTOverlap(D):I[D.overscaledZ],Z=s?0:i.paint.get("raster-fade-duration");k.registerFadeDuration(Z);const F=t.findLoadedParent(D,0),Y=LT(k,F,t,e.transform,Z);let J,it;e.terrain&amp;&amp;e.terrain.prepareDrawTile(),a.activeTexture.set(l.TEXTURE0),k.texture&amp;&amp;k.texture.bind(S,l.CLAMP_TO_EDGE),a.activeTexture.set(l.TEXTURE1),F?(F.texture&amp;&amp;F.texture.bind(S,l.CLAMP_TO_EDGE),J=Math.pow(2,F.tileID.overscaledZ-k.tileID.overscaledZ),it=[k.tileID.canonical.x*J%1,k.tileID.canonical.y*J%1]):k.texture&amp;&amp;k.texture.bind(S,l.CLAMP_TO_EDGE),k.texture&amp;&amp;k.texture.useMipmap&amp;&amp;a.extTextureFilterAnisotropic&amp;&amp;e.transform.pitch&gt;20&amp;&amp;l.texParameterf(l.TEXTURE_2D,a.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,a.extTextureFilterAnisotropicMax);const X=e.transform,K=h instanceof Rn?h.perspectiveTransform:[0,0],ot=w?YD(X):[0,0,0,0];let lt,at,dt,ft,_t,ct;if(C&amp;&amp;h instanceof Rn&amp;&amp;h.coordinates.length&gt;3){lt=Float32Array.from(Eo(pn(new In(0,0,0)))),at=Float32Array.from(X.globeMatrix),dt=Float32Array.from(Qv(X)),ft=[er(X.center.lng),sr(X.center.lat)],ct=[er(h.coordinates[1][0]),sr(h.coordinates[1][1]),er(h.coordinates[3][0]),sr(h.coordinates[3][1])];const Ht=new Qr(h.coordinates[1],h.coordinates[3]);_t=Float32Array.from(i1(new In(0,0,0),Ht,0,X.worldSize/e.transform._pixelsPerMercatorPixel))}else lt=new Float32Array(16),at=new Float32Array(9),dt=new Float32Array(16),ft=[0,0],_t=new Float32Array(16),ct=[0,0,0,0];const bt=NT(B,lt,at,dt,_t,it||[0,0],ct,hr(e.transform.zoom),ft,ot,J||1,Y,i,K,w?i.paint.get("raster-elevation"):0,2,d.mix,d.offset,d.range,1,0,y),Ot=e.isTileAffectedByFog(D),kt=e.getOrCreateProgram("raster",{defines:d.defines,overrideFog:Ot});if(e.uploadCommonUniforms(a,kt,O),h instanceof Rn){if(b||!m)h.boundsBuffer&amp;&amp;h.boundsSegments&amp;&amp;kt.draw(e,l.TRIANGLES,z,Pe.disabled,x,Le.disabled,bt,i.id,h.boundsBuffer,e.quadTriangleIndexBuffer,h.boundsSegments);else if(e.globeSharedBuffers){const[Ht,Zt,fe]=e.globeSharedBuffers.getGridBuffers(0,!1);kt.draw(e,l.TRIANGLES,z,Pe.disabled,x,Le.frontCCW,bt,i.id,Ht,Zt,fe),kt.draw(e,l.TRIANGLES,z,Pe.disabled,x,Le.backCCW,bt,i.id,Ht,Zt,fe)}}else{const{tileBoundsBuffer:Ht,tileBoundsIndexBuffer:Zt,tileBoundsSegments:fe}=e.getTileBoundsBuffers(k);kt.draw(e,l.TRIANGLES,z,U,x,Le.disabled,bt,i.id,Ht,Zt,fe)}}e.resetStencilClippingMasks()},background:function(e,t,i,r){const n=i.paint.get("background-color"),s=i.paint.get("background-opacity"),a=i.paint.get("background-emissive-strength");if(s===0)return;const l=e.context,h=l.gl,d=e.transform,f=d.tileSize,m=i.paint.get("background-pattern");if(e.isPatternMissing(m,i.scope))return;const _=!m&amp;&amp;n.a===1&amp;&amp;s===1&amp;&amp;e.opaquePassEnabledForLayer()?"opaque":"translucent";if(e.renderPass!==_)return;const y=Pe.disabled,x=e.depthModeForSublayer(0,_==="opaque"?de.ReadWrite:de.ReadOnly),b=e.colorModeForDrapableLayerRenderPass(a),w=m?"backgroundPattern":"background";let T,S=r;S||(T=e.getBackgroundTiles(),S=Object.values(T).map(I=&gt;I.tileID)),m&amp;&amp;(l.activeTexture.set(h.TEXTURE0),e.imageManager.bind(e.context,i.scope));for(const I of S){const P=e.isTileAffectedByFog(I),M=e.getOrCreateProgram(w,{overrideFog:P}),C=I.toUnwrapped(),D=r?I.projMatrix:e.transform.calculateProjMatrix(C);e.prepareDrawTile();const O=t?t.getTile(I):T?T[I.key]:new jc(I,f,d.zoom,e),k=m?UD(D,a,s,e,m,i.scope,{tileID:I,tileSize:f}):ND(D,a,s,n);e.uploadCommonUniforms(l,M,C);const{tileBoundsBuffer:z,tileBoundsIndexBuffer:B,tileBoundsSegments:U}=e.getTileBoundsBuffers(O);M.draw(e,h.TRIANGLES,x,y,b,Le.disabled,k,i.id,z,B,U)}},sky:function(e,t,i){const r=e._atmosphere?hr(e.transform.zoom):1,n=i.paint.get("sky-opacity")*r;if(n===0)return;const s=e.context,a=i.paint.get("sky-type"),l=new de(s.gl.LEQUAL,de.ReadOnly,[0,1]),h=e.frameCounter/1e3%1;a==="atmosphere"?e.renderPass==="offscreen"?i.needsSkyboxCapture(e)&amp;&amp;(function(d,f,m,_){const y=d.context,x=y.gl;let b=f.skyboxFbo;if(!b){b=f.skyboxFbo=y.createFramebuffer(32,32,!0,null),f.skyboxGeometry=new KT(y),f.skyboxTexture=y.gl.createTexture(),x.bindTexture(x.TEXTURE_CUBE_MAP,f.skyboxTexture),x.texParameteri(x.TEXTURE_CUBE_MAP,x.TEXTURE_WRAP_S,x.CLAMP_TO_EDGE),x.texParameteri(x.TEXTURE_CUBE_MAP,x.TEXTURE_WRAP_T,x.CLAMP_TO_EDGE),x.texParameteri(x.TEXTURE_CUBE_MAP,x.TEXTURE_MIN_FILTER,x.LINEAR),x.texParameteri(x.TEXTURE_CUBE_MAP,x.TEXTURE_MAG_FILTER,x.LINEAR);for(let I=0;I&lt;6;++I)x.texImage2D(x.TEXTURE_CUBE_MAP_POSITIVE_X+I,0,x.RGBA,32,32,0,x.RGBA,x.UNSIGNED_BYTE,null)}y.bindFramebuffer.set(b.framebuffer),y.viewport.set([0,0,32,32]);const w=f.getCenter(d,!0),T=d.getOrCreateProgram("skyboxCapture"),S=new Float64Array(16);nt.identity(S),nt.rotateY(S,S,.5*-Math.PI),Al(d,f,T,S,w,0),nt.identity(S),nt.rotateY(S,S,.5*Math.PI),Al(d,f,T,S,w,1),nt.identity(S),nt.rotateX(S,S,.5*-Math.PI),Al(d,f,T,S,w,2),nt.identity(S),nt.rotateX(S,S,.5*Math.PI),Al(d,f,T,S,w,3),nt.identity(S),Al(d,f,T,S,w,4),nt.identity(S),nt.rotateY(S,S,Math.PI),Al(d,f,T,S,w,5),y.viewport.set([0,0,d.width,d.height])}(e,i),i.markSkyboxValid(e)):e.renderPass==="sky"&amp;&amp;function(d,f,m,_,y){const x=d.context,b=x.gl,w=d.transform,T=d.getOrCreateProgram("skybox");x.activeTexture.set(b.TEXTURE0),b.bindTexture(b.TEXTURE_CUBE_MAP,f.skyboxTexture);const S=((I,P,M,C,D)=&gt;({u_matrix:I,u_sun_direction:P,u_cubemap:0,u_opacity:C,u_temporal_offset:D}))(w.skyboxMatrix,f.getCenter(d,!1),0,_,y);d.uploadCommonUniforms(x,T),T.draw(d,b.TRIANGLES,m,Pe.disabled,d.colorModeForRenderPass(),Le.backCW,S,"skybox",f.skyboxGeometry.vertexBuffer,f.skyboxGeometry.indexBuffer,f.skyboxGeometry.segment)}(e,i,l,n,h):a==="gradient"&amp;&amp;e.renderPass==="sky"&amp;&amp;function(d,f,m,_,y){const x=d.context,b=x.gl,w=d.transform,T=d.getOrCreateProgram("skyboxGradient");f.skyboxGeometry||(f.skyboxGeometry=new KT(x)),x.activeTexture.set(b.TEXTURE0);let S=f.colorRampTexture;S||(S=f.colorRampTexture=new Ii(x,f.colorRamp,b.RGBA)),S.bind(b.LINEAR,b.CLAMP_TO_EDGE);const I=((P,M,C,D,O)=&gt;({u_matrix:P,u_color_ramp:0,u_center_direction:M,u_radius:$t(C),u_opacity:D,u_temporal_offset:O}))(w.skyboxMatrix,f.getCenter(d,!1),f.paint.get("sky-gradient-radius"),_,y);d.uploadCommonUniforms(x,T),T.draw(d,b.TRIANGLES,m,Pe.disabled,d.colorModeForRenderPass(),Le.backCW,I,"skyboxGradient",f.skyboxGeometry.vertexBuffer,f.skyboxGeometry.indexBuffer,f.skyboxGeometry.segment)}(e,i,l,n,h)},debug:function(e,t,i){for(let r=0;r&lt;i.length;r++)iO(e,t,i[r])},custom:function(e,t,i,r){const n=e.context,s=i.implementation;if(!e.transform.projection.unsupportedLayers||!e.transform.projection.unsupportedLayers.includes("custom")||e.terrain&amp;&amp;(e.terrain.renderingToTexture||e.renderPass==="offscreen")&amp;&amp;i.isLayerDraped(t)){if(e.renderPass==="offscreen"){const a=s.prerender;if(a){if(e.setCustomLayerDefaults(),n.setColorMode(e.colorModeForRenderPass()),e.transform.projection.name==="globe"){const l=e.transform.pointMerc;a.call(s,n.gl,e.transform.customLayerMatrix(),e.transform.getProjection(),e.transform.globeToMercatorMatrix(),hr(e.transform.zoom),[l.x,l.y],e.transform.pixelsPerMeterRatio)}else a.call(s,n.gl,e.transform.customLayerMatrix());n.setDirty(),e.setBaseState()}}else if(e.renderPass==="translucent"){if(e.terrain&amp;&amp;e.terrain.renderingToTexture){const l=s.renderToTile;if(l){const h=r[0].canonical,d=new Be(h.x+r[0].wrap*(1&lt;&lt;h.z),h.y,h.z);n.setDepthMode(de.disabled),n.setStencilMode(Pe.disabled),n.setColorMode(e.colorModeForRenderPass()),e.setCustomLayerDefaults(),l.call(s,n.gl,d),n.setDirty(),e.setBaseState()}return}e.setCustomLayerDefaults(),n.setColorMode(e.colorModeForRenderPass()),n.setStencilMode(Pe.disabled);const a=s.renderingMode==="3d"?new de(e.context.gl.LEQUAL,de.ReadWrite,e.depthRangeFor3D):e.depthModeForSublayer(0,de.ReadOnly);if(n.setDepthMode(a),e.transform.projection.name==="globe"){const l=e.transform.pointMerc;s.render(n.gl,e.transform.customLayerMatrix(),e.transform.getProjection(),e.transform.globeToMercatorMatrix(),hr(e.transform.zoom),[l.x,l.y],e.transform.pixelsPerMeterRatio)}else s.render(n.gl,e.transform.customLayerMatrix());n.setDirty(),e.setBaseState(),n.bindFramebuffer.set(null)}}else tt("Custom layers are not yet supported with this projection. Use mercator or globe to enable usage of custom layers.")},model:function(e,t,i,r){if(e.renderPass==="opaque")return;const n=i.paint.get("model-opacity");if(n===0)return;const s=i.paint.get("model-cast-shadows");if(e.renderPass==="shadow"&amp;&amp;(!s||e.terrain&amp;&amp;n&lt;.65&amp;&amp;i._transitionablePaint._values["model-opacity"].value.expression instanceof po))return;const a=e.shadowRenderer,l=i.paint.get("model-receive-shadows");a&amp;&amp;(a.useNormalOffset=!0,l||(a.enabled=!1));const h=()=&gt;{a&amp;&amp;(a.useNormalOffset=!0,l||(a.enabled=!0))},d=t.getSource();if(e.renderPass==="light-beam"&amp;&amp;d.type!=="batched-model")return;if(d.type==="vector"||d.type==="geojson")return function(T,S,I,P){const M=T.transform;if(M.projection.name!=="mercator")return void tt(`Drawing 3D models for ${M.projection.name} projection is not yet implemented`);const C=M.getFreeCameraOptions().position;if(!T.modelManager)return;const D=T.modelManager,O=T.shadowRenderer;if(!I._unevaluatedLayout._values.hasOwnProperty("model-id"))return;const k=I._unevaluatedLayout._values["model-id"],z={...I.layout.get("model-id").parameters};for(const B of P){const U=S.getTile(B).getBucket(I);if(!U||U.projection.name!==M.projection.name)continue;const Z=uO(B,M);z.zoom=Z;const F=k.possiblyEvaluate(z);if(cO(T,U,B),xs.shadowUniformsInitialized=!1,xs.useSingleShadowCascade=!!O&amp;&amp;O.getMaxCascadeForTile(B.toUnwrapped())===0,T.renderPass==="shadow"&amp;&amp;O){if(T.currentShadowCascade===1&amp;&amp;U.isInsideFirstShadowMapFrustum)continue;const it=M.calculatePosMatrix(B.toUnwrapped(),M.worldSize);if(xs.tileMatrix.set(it),xs.shadowTileMatrix=Float32Array.from(O.calculateShadowPassMatrixFromMatrix(it)),xs.aabb.min.fill(0),xs.aabb.max[0]=xs.aabb.max[1]=ut,xs.aabb.max[2]=0,dO(U,xs,T,I.scope))continue}const Y=1&lt;&lt;B.canonical.z,J=[((C.x-B.wrap)*Y-B.canonical.x)*ut,(C.y*Y-B.canonical.y)*ut,C.z*Y*ut];for(let it in U.instancesPerModel){const X=U.instancesPerModel[it];X.features.length&gt;0&amp;&amp;(it=F.evaluate(X.features[0].feature,{}));const K=D.getModel(it,I.scope);if(K&amp;&amp;K.uploaded)for(const ot of K.nodes)tE(T,I,ot,X,J,B,xs)}}}(e,t,i,r),void h();if(!d.loaded())return;if(d.type==="batched-model")return function(T,S,I,P){const M=T.context,C=T.transform,D=T.style.fog,O=T.shadowRenderer;if(C.projection.name!=="mercator")return void tt(`Drawing 3D landmark models for ${C.projection.name} projection is not yet implemented`);const k=T.transform.getFreeCameraOptions().position,z=W.scale([],[k.x,k.y,k.z],T.transform.worldSize);W.negate(z,z);const B=nt.identity([]),U=Ao(C.center.lat,C.zoom),Z=nt.fromScaling([],[1,1,1/U]);nt.translate(B,B,z);const F=I.paint.get("model-opacity"),Y=new de(M.gl.LEQUAL,de.ReadWrite,T.depthRangeFor3D),J=new de(M.gl.LEQUAL,de.ReadOnly,T.depthRangeFor3D),it=function(X,K){for(const ot of P){const lt=S.getTile(ot).getBucket(I);if(!lt||!lt.uploaded)continue;let at=!1;O&amp;&amp;(at=O.getMaxCascadeForTile(ot.toUnwrapped())===0);const dt=C.calculatePosMatrix(ot.toUnwrapped(),C.worldSize),ft=lt.modelTraits;for(const _t of lt.getNodesInfo()){if(_t.hiddenByReplacement||!_t.node.meshes)continue;const ct=_t.node,bt=T.renderPass==="light-beam",Ot=[...dt],kt=_t.evaluatedScale;let Ht=0;T.terrain&amp;&amp;ct.elevation&amp;&amp;(Ht=ct.elevation*T.terrain.exaggeration()),nt.translate(Ot,Ot,[(ct.anchor?ct.anchor[0]:0)*(kt[0]-1),(ct.anchor?ct.anchor[1]:0)*(kt[1]-1),Ht]),kt!==GL&amp;&amp;nt.scale(Ot,Ot,kt),nt.multiply(Ot,Ot,ct.matrix);const Zt=nt.multiply([],Z,Ot);nt.multiply(Zt,B,Zt);const fe=nt.invert([],Zt);nt.transpose(fe,fe),nt.scale(fe,fe,hO);const ie=nt.multiply([],C.expandedFarZProjMatrix,Ot);for(let Ve=0;Ve&lt;ct.meshes.length;++Ve){const ke=ct.meshes[Ve],pe=Ve===ct.lightMeshIndex;if(pe){if(!bt&amp;&amp;!T.terrain&amp;&amp;T.shadowRenderer){T.currentLayer&lt;T.firstLightBeamLayer&amp;&amp;(T.firstLightBeamLayer=T.currentLayer);continue}}else if(bt)continue;const ue={defines:[]},re=[];K_(ue.defines,re,ke,T),4&amp;ft||ue.defines.push("DIFFUSE_SHADED"),at&amp;&amp;ue.defines.push("SHADOWS_SINGLE_CASCADE");const Fe=T.renderPass==="shadow";if(Fe){J_(ke,Ot,T,I);continue}let Ue=null;if(D){const Ui=JT(Ot,T.transform);if(Ue=new Float32Array(Ui),C.projection.name!=="globe"){const Bi=ke.aabb.min,xi=ke.aabb.max,[ri,gr]=D.getOpacityForBounds(Ui,Bi[0],Bi[1],xi[0],xi[1]);ue.overrideFog=ri&gt;=_a||gr&gt;=_a}}const Me=T.getOrCreateProgram("model",ue);!Fe&amp;&amp;O&amp;&amp;(O.useNormalOffset=!!ke.normalBuffer,O.setupShadowsFromMatrix(Ot,Me,O.useNormalOffset)),T.uploadCommonUniforms(M,Me,ot.toUnwrapped(),Ue);const hi=ke.material,Fi=hi.pbrMetallicRoughness;Fi.metallicFactor=.9,Fi.roughnessFactor=.5;const ai=0,_i=X_(new Float32Array(ie),new Float32Array(Zt),new Float32Array(fe),T,F,Fi.baseColorFactor,hi.emissiveFactor,Fi.metallicFactor,Fi.roughnessFactor,hi,ai,I);Me.draw(T,M.gl.TRIANGLES,K&amp;&amp;!pe?Y:J,Pe.disabled,X?pe||F&lt;1||_t.hasTranslucentParts?je.alphaBlended:je.unblended:je.disabled,Le.backCCW,_i,I.id,ke.vertexBuffer,ke.indexBuffer,ke.segments,I.paint,T.transform.zoom,void 0,re)}}}};(function(X,K,ot,lt){const at=X.terrain?X.terrain.exaggeration():0,dt=X.transform.zoom;for(const ft of lt){const _t=K.getTile(ft).getBucket(ot);_t&amp;&amp;(X.conflationActive&amp;&amp;_t.updateReplacement(ft,X.replacementSource),_t.evaluateScale(X,ot),X.terrain&amp;&amp;at&gt;0&amp;&amp;_t.elevationUpdate(X.terrain,at,ft,ot.source),_t.needsReEvaluation(X,dt,ot)&amp;&amp;_t.evaluate(ot))}})(T,S,I,P),F===1?it(!0,!0):(it(!1,!0),it(!0,!1))}(e,t,i,r),void h();const f=d.getModels(),m=[],_=e.transform.getFreeCameraOptions().position,y=W.scale([],[_.x,_.y,_.z],e.transform.worldSize);W.negate(y,y);const x=[],b=[];let w=0;for(const T of f){const S=i.paint.get("model-rotation").constantOr(null),I=i.paint.get("model-scale").constantOr(null),P=i.paint.get("model-translation").constantOr(null);T.computeModelMatrix(e,S,I,P,!0,!0,!1);const M=nt.identity([]),C=Ao(T.position.lat,e.transform.zoom),D=nt.fromScaling([],[1,1,1/C]);nt.translate(M,M,y),m.push({zScaleMatrix:D,negCameraPosMatrix:M});for(const O of T.nodes)QT(e.transform,O,T.matrix,e.transform.expandedFarZProjMatrix,w,x,b);w++}if(x.sort((T,S)=&gt;S.depth-T.depth),e.renderPass!=="shadow"){if(n===1)for(const T of b)Dd(T,e,i,m[T.modelIndex],Pe.disabled,e.colorModeForRenderPass());else{for(const T of b)Dd(T,e,i,m[T.modelIndex],Pe.disabled,je.disabled);for(const T of b)Dd(T,e,i,m[T.modelIndex],e.stencilModeFor3D(),e.colorModeForRenderPass());e.resetStencilClippingMasks()}for(const T of x)Dd(T,e,i,m[T.modelIndex],Pe.disabled,e.colorModeForRenderPass());h()}else{for(const T of b)J_(T.mesh,T.nodeModelMatrix,e,i);for(const T of x)J_(T.mesh,T.nodeModelMatrix,e,i);h()}}},iE={modelUpload:function(e,t,i){const r=t.getSource();if(!r.loaded())return;if(r.type==="vector"||r.type==="geojson")return void(e.modelManager&amp;&amp;e.modelManager.upload(e,i));if(r.type==="batched-model")return;const n=r.getModels();for(const s of n)s.upload(e.context)}};class mO{constructor(t,i,r){this.context=new RL(t,i),this.transform=r,this._tileTextures={},this.frameCopies=[],this.loadTimeStamps=[],this.setup(),this.numSublayers=$n.maxUnderzooming+$n.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.deferredRenderGpuTimeQueries=[],this.gpuTimers={},this.frameCounter=0,this._backgroundTiles={},this.conflationActive=!1,this.replacementSource=new XL,this.longestCutoffRange=0,this.minCutoffZoom=0,this._fogVisible=!1,this._cachedTileFogOpacities={},this._shadowRenderer=new yO(this),this._wireframeDebugCache=new pO,this.renderDefaultNorthPole=!0,this.renderDefaultSouthPole=!0}updateTerrain(t,i){const r=!!t&amp;&amp;!!t.terrain&amp;&amp;this.transform.projection.supportsTerrain;if(!(r||this._terrain&amp;&amp;this._terrain.enabled))return;this._terrain||(this._terrain=new TD(this,t));const n=this._terrain;this.transform.elevation=r?n:null,n.update(t,this.transform,i),this.transform.elevation&amp;&amp;!n.enabled&amp;&amp;(this.transform.elevation=null)}_updateFog(t){const i=t.fog;if(!i||this.transform.projection.name==="globe"||i.getOpacity(this.transform.pitch)&lt;1||i.properties.get("horizon-blend")&lt;.03)return void(this.transform.fogCullDistSq=null);const[r,n]=i.getFovAdjustedRange(this.transform._fov);if(r&gt;n)return void(this.transform.fogCullDistSq=null);const s=r+.78*(n-r);this.transform.fogCullDistSq=s*s}get terrain(){return this.transform._terrainEnabled()&amp;&amp;this._terrain&amp;&amp;this._terrain.enabled?this._terrain:null}get shadowRenderer(){return this._shadowRenderer&amp;&amp;this._shadowRenderer.enabled?this._shadowRenderer:null}get wireframeDebugCache(){return this._wireframeDebugCache}resize(t,i){if(this.width=t*_e.devicePixelRatio,this.height=i*_e.devicePixelRatio,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const r of this.style.order)this.style._mergedLayers[r].resize()}setup(){const t=this.context,i=new Kr;i.emplaceBack(0,0),i.emplaceBack(ut,0),i.emplaceBack(0,ut),i.emplaceBack(ut,ut),this.tileExtentBuffer=t.createVertexBuffer(i,wo.members),this.tileExtentSegments=si.simpleSegment(0,0,4,2);const r=new Kr;r.emplaceBack(0,0),r.emplaceBack(ut,0),r.emplaceBack(0,ut),r.emplaceBack(ut,ut),this.debugBuffer=t.createVertexBuffer(r,wo.members),this.debugSegments=si.simpleSegment(0,0,4,5);const n=new Kr;n.emplaceBack(-1,-1),n.emplaceBack(1,-1),n.emplaceBack(-1,1),n.emplaceBack(1,1),this.viewportBuffer=t.createVertexBuffer(n,wo.members),this.viewportSegments=si.simpleSegment(0,0,4,2);const s=new sa;s.emplaceBack(0,0,0,0),s.emplaceBack(ut,0,ut,0),s.emplaceBack(0,ut,0,ut),s.emplaceBack(ut,ut,ut,ut),this.mercatorBoundsBuffer=t.createVertexBuffer(s,d_.members),this.mercatorBoundsSegments=si.simpleSegment(0,0,4,2);const a=new Xi;a.emplaceBack(0,1,2),a.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=t.createIndexBuffer(a);const l=new vc;for(const d of[0,1,3,2,0])l.emplaceBack(d);this.debugIndexBuffer=t.createIndexBuffer(l),this.emptyTexture=new Ii(t,new Hi({width:1,height:1},Uint8Array.of(0,0,0,0)),t.gl.RGBA),this.identityMat=nt.create();const h=this.context.gl;this.stencilClearMode=new Pe({func:h.ALWAYS,mask:0},0,255,h.ZERO,h.ZERO,h.ZERO),this.loadTimeStamps.push(L.performance.now())}getMercatorTileBoundsBuffers(){return{tileBoundsBuffer:this.mercatorBoundsBuffer,tileBoundsIndexBuffer:this.quadTriangleIndexBuffer,tileBoundsSegments:this.mercatorBoundsSegments}}getTileBoundsBuffers(t){return t._makeTileBoundsBuffers(this.context,this.transform.projection),t._tileBoundsBuffer?{tileBoundsBuffer:t._tileBoundsBuffer,tileBoundsIndexBuffer:t._tileBoundsIndexBuffer,tileBoundsSegments:t._tileBoundsSegments}:this.getMercatorTileBoundsBuffers()}clearStencil(){const t=this.context.gl;this.nextStencilID=1,this.currentStencilSource=void 0,this._tileClippingMaskIDs={},this.getOrCreateProgram("clippingMask").draw(this,t.TRIANGLES,de.disabled,this.stencilClearMode,je.disabled,Le.disabled,$_(this.identityMat),"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}resetStencilClippingMasks(){this.terrain||(this.currentStencilSource=void 0,this._tileClippingMaskIDs={})}_renderTileClippingMasks(t,i,r){if(!i||this.currentStencilSource===i.id||!t.isTileClipped()||!r||r.length===0)return;if(this._tileClippingMaskIDs&amp;&amp;!this.terrain){let l=!1;for(const h of r)if(this._tileClippingMaskIDs[h.key]===void 0){l=!0;break}if(!l)return}this.currentStencilSource=i.id;const n=this.context,s=n.gl;this.nextStencilID+r.length&gt;256&amp;&amp;this.clearStencil(),n.setColorMode(je.disabled),n.setDepthMode(de.disabled);const a=this.getOrCreateProgram("clippingMask");this._tileClippingMaskIDs={};for(const l of r){const h=i.getTile(l),d=this._tileClippingMaskIDs[l.key]=this.nextStencilID++,{tileBoundsBuffer:f,tileBoundsIndexBuffer:m,tileBoundsSegments:_}=this.getTileBoundsBuffers(h);a.draw(this,s.TRIANGLES,de.disabled,new Pe({func:s.ALWAYS,mask:0},d,255,s.KEEP,s.KEEP,s.REPLACE),je.disabled,Le.disabled,$_(l.projMatrix),"$clipping",f,m,_)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1&gt;256&amp;&amp;this.clearStencil();const t=this.nextStencilID++,i=this.context.gl;return new Pe({func:i.NOTEQUAL,mask:255},t,255,i.KEEP,i.KEEP,i.REPLACE)}stencilModeForClipping(t){if(this.terrain)return this.terrain.stencilModeForRTTOverlap(t);const i=this.context.gl;return new Pe({func:i.EQUAL,mask:255},this._tileClippingMaskIDs[t.key],0,i.KEEP,i.KEEP,i.REPLACE)}stencilConfigForOverlap(t){const i=this.context.gl,r=t.sort((a,l)=&gt;l.overscaledZ-a.overscaledZ),n=r[r.length-1].overscaledZ,s=r[0].overscaledZ-n+1;if(s&gt;1){this.currentStencilSource=void 0,this.nextStencilID+s&gt;256&amp;&amp;this.clearStencil();const a={};for(let l=0;l&lt;s;l++)a[l+n]=new Pe({func:i.GEQUAL,mask:255},l+this.nextStencilID,255,i.KEEP,i.KEEP,i.REPLACE);return this.nextStencilID+=s,[a,r]}return[{[n]:Pe.disabled},r]}colorModeForRenderPass(){const t=this.context.gl;return this._showOverdrawInspector?new je([t.CONSTANT_COLOR,t.ONE,t.CONSTANT_COLOR,t.ONE],new Ie(.125,.125,.125,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?je.unblended:je.alphaBlended}colorModeForDrapableLayerRenderPass(t){const i=this.context.gl;return this.style&amp;&amp;this.style.enable3dLights()&amp;&amp;this.terrain&amp;&amp;this.terrain.renderingToTexture&amp;&amp;this.renderPass==="translucent"?new je([i.ONE,i.ONE_MINUS_SRC_ALPHA,i.CONSTANT_ALPHA,i.ONE_MINUS_SRC_ALPHA],new Ie(0,0,0,t===void 0?0:t),[!0,!0,!0,!0]):this.colorModeForRenderPass()}depthModeForSublayer(t,i,r,n=!1){if(!this.opaquePassEnabledForLayer()&amp;&amp;!n)return de.disabled;const s=1-((1+this.currentLayer)*this.numSublayers+t)*this.depthEpsilon;return new de(r||this.context.gl.LEQUAL,i,[s,s])}opaquePassEnabledForLayer(){return this.currentLayer&lt;this.opaquePassCutoff}render(t,i){this._wireframeDebugCache.update(this.frameCounter),this.style=t,this.options=i;const r=this.style._mergedLayers,n=this.style.order,s=n.map(M=&gt;r[M]),a=this.style._mergedSourceCaches;this.imageManager=t.imageManager,this.modelManager=t.modelManager,this.symbolFadeChange=t.placement.symbolFadeChange(_e.now()),this.imageManager.beginFrame();let l=0,h=!1;for(const M in a){const C=a[M];C.used&amp;&amp;(C.prepare(this.context),C.getSource().usedInConflation&amp;&amp;++l)}const d={},f={},m={},_={},y={};for(const M in a){const C=a[M];d[M]=C.getVisibleCoordinates(),f[M]=d[M].slice().reverse(),m[M]=C.getVisibleCoordinates(!0).reverse(),_[M]=C.getShadowCasterCoordinates(),y[M]=C.sortCoordinatesByDistance(d[M])}const x=M=&gt;{const C=this.style.getLayerSourceCache(M);return C&amp;&amp;C.used?C.getSource():null};if(l){const M=[];for(const C of s)this.layerUsedInConflation(C,x(C))&amp;&amp;M.push(C);if(M&amp;&amp;M.length&gt;1){const C=[];for(const D of M){const O=this.style.getLayerSourceCache(D);O&amp;&amp;O.used&amp;&amp;O.getSource().usedInConflation&amp;&amp;C.push({layer:D.fqid,cache:O})}this.replacementSource.setSources(C),h=!0}}h||this.replacementSource.clear(),this.conflationActive=h,this.minCutoffZoom=0,this.longestCutoffRange=0;for(const M of s){const C=M.cutoffRange();if(this.longestCutoffRange=Math.max(C,this.longestCutoffRange),C&gt;0){const D=x(M);D&amp;&amp;(this.minCutoffZoom=Math.max(D.minzoom,this.minCutoffZoom)),M.minzoom&amp;&amp;(this.minCutoffZoom=Math.max(M.minzoom,this.minCutoffZoom))}}this.opaquePassCutoff=1/0;for(let M=0;M&lt;s.length;M++)if(s[M].is3D()){this.opaquePassCutoff=M;break}const b=this.style&amp;&amp;this.style.fog;b?(this._fogVisible=b.getOpacity(this.transform.pitch)!==0,this._fogVisible&amp;&amp;this.transform.projection.name!=="globe"&amp;&amp;(this._fogVisible=b.isVisibleOnFrustum(this.transform.cameraFrustum))):this._fogVisible=!1,this._cachedTileFogOpacities={},this.terrain&amp;&amp;(this.terrain.updateTileBinding(m),this.opaquePassCutoff=0);const w=this._shadowRenderer;if(w){w.updateShadowParameters(this.transform,this.style.directionalLight);for(const M in a)for(const C of d[M]){let D={min:0,max:0};this.terrain&amp;&amp;(D=this.terrain.getMinMaxForTile(C)||D),w.addShadowReceiver(C.toUnwrapped(),D.min,D.max)}}this.transform.projection.name!=="globe"||this.globeSharedBuffers||(this.globeSharedBuffers=new ZP(this.context));for(const M of s){if(M.isHidden(this.transform.zoom))continue;const C=t.getLayerSourceCache(M);this.uploadLayer(this,M,C)}if(this.style.fog&amp;&amp;this.transform.projection.supportsFog?(this._atmosphere||(this._atmosphere=new lO),this._atmosphere.update(this)):this._atmosphere&amp;&amp;(this._atmosphere.destroy(),this._atmosphere=void 0),!os.has(this.context.gl))return;this.renderPass="offscreen";for(const M of s){const C=t.getLayerSourceCache(M);if(!M.hasOffscreenPass()||M.isHidden(this.transform.zoom))continue;const D=C?f[C.id]:void 0;(M.type==="custom"||M.type==="raster"||M.isSky()||D&amp;&amp;D.length)&amp;&amp;this.renderLayer(this,C,M,D)}this.depthRangeFor3D=[0,1-(s.length+2)*this.numSublayers*this.depthEpsilon];const T=this.terrain;T&amp;&amp;(this.style.hasSymbolLayers()||this.style.hasCircleLayers())&amp;&amp;!this.transform.isOrthographic&amp;&amp;T.drawDepth(),this._shadowRenderer&amp;&amp;(this.renderPass="shadow",this._shadowRenderer.drawShadowPass(this.style,_)),this.context.bindFramebuffer.set(null),this.context.viewport.set([0,0,this.width,this.height]);const S=this.transform.projection.name==="globe"||this.transform.isHorizonVisible(),I=(()=&gt;{if(i.showOverdrawInspector)return Ie.black;if(this.style.fog&amp;&amp;this.transform.projection.supportsFog&amp;&amp;!S){const M=this.style.fog.properties.get("color").toArray01();return new Ie(...M)}if(this.style.fog&amp;&amp;this.transform.projection.supportsFog&amp;&amp;S){const M=this.style.fog.properties.get("space-color").toArray01();return new Ie(...M)}return Ie.transparent})();if(this.context.clear({color:I,depth:1}),this.clearStencil(),this._showOverdrawInspector=i.showOverdrawInspector,this.renderPass="opaque",this.style.fog&amp;&amp;this.transform.projection.supportsFog&amp;&amp;this._atmosphere&amp;&amp;!this._showOverdrawInspector&amp;&amp;S&amp;&amp;this._atmosphere.drawStars(this,this.style.fog),!this.terrain)for(this.currentLayer=n.length-1;this.currentLayer&gt;=0;this.currentLayer--){const M=s[this.currentLayer],C=t.getLayerSourceCache(M);if(M.isSky())continue;const D=C?(M.is3D()?y:f)[C.id]:void 0;this._renderTileClippingMasks(M,C,D),this.renderLayer(this,C,M,D)}if(this.style.fog&amp;&amp;this.transform.projection.supportsFog&amp;&amp;this._atmosphere&amp;&amp;!this._showOverdrawInspector&amp;&amp;S&amp;&amp;this._atmosphere.drawAtmosphereGlow(this,this.style.fog),this.renderPass="sky",(!this._atmosphere||hr(this.transform.zoom)&gt;0)&amp;&amp;(this.transform.projection.name==="globe"||this.transform.isHorizonVisible()))for(this.currentLayer=0;this.currentLayer&lt;n.length;this.currentLayer++){const M=s[this.currentLayer],C=t.getLayerSourceCache(M);M.isSky()&amp;&amp;this.renderLayer(this,C,M,C?f[C.id]:void 0)}this.renderPass="translucent",this.currentLayer=0,this.firstLightBeamLayer=Number.MAX_SAFE_INTEGER;let P=0;for(w&amp;&amp;(P=w.getShadowCastingLayerCount());this.currentLayer&lt;n.length;){const M=s[this.currentLayer],C=t.getLayerSourceCache(M);if(M.isSky()){++this.currentLayer;continue}if(T&amp;&amp;this.style.isLayerDraped(M)){if(M.isHidden(this.transform.zoom)){++this.currentLayer;continue}this.currentLayer=T.renderBatch(this.currentLayer);continue}let D;if(C&amp;&amp;(D=(M.type==="symbol"?m:M.is3D()?y:f)[C.id]),this._renderTileClippingMasks(M,C,C?d[C.id]:void 0),this.renderLayer(this,C,M,D),!T&amp;&amp;w&amp;&amp;P&gt;0&amp;&amp;M.hasShadowPass()&amp;&amp;--P==0&amp;&amp;(w.drawGroundShadows(),this.firstLightBeamLayer&lt;=this.currentLayer)){const O=this.currentLayer;for(this.renderPass="light-beam",this.currentLayer=this.firstLightBeamLayer;this.currentLayer&lt;=O;this.currentLayer++){const k=s[this.currentLayer];if(!k.hasLightBeamPass())continue;const z=t.getLayerSourceCache(k);this.renderLayer(this,z,k,z?f[z.id]:void 0)}this.currentLayer=O,this.renderPass="translucent"}++this.currentLayer}if(this.terrain&amp;&amp;this.terrain.postRender(),this.options.showTileBoundaries||this.options.showQueryGeometry||this.options.showTileAABBs){let M=null;s.forEach(C=&gt;{const D=t.getLayerSourceCache(C);D&amp;&amp;!C.isHidden(this.transform.zoom)&amp;&amp;D.getVisibleCoordinates().length&amp;&amp;(!M||M.getSource().maxzoom&lt;D.getSource().maxzoom)&amp;&amp;(M=D)}),M&amp;&amp;this.options.showTileBoundaries&amp;&amp;eE.debug(this,M,M.getVisibleCoordinates())}this.options.showPadding&amp;&amp;function(M){const C=M.transform.padding;XT(M,M.transform.height-(C.top||0),3,KD),XT(M,C.bottom||0,3,JD),YT(M,C.left||0,3,QD),YT(M,M.transform.width-(C.right||0),3,tO);const D=M.transform.centerPoint;(function(O,k,z,B){Rd(O,k-1,z-10,2,20,B),Rd(O,k-10,z-1,20,2,B)})(M,D.x,M.transform.height-D.y,eO)}(this),this.context.setDefault(),this.frameCounter=(this.frameCounter+1)%Number.MAX_SAFE_INTEGER,this.tileLoaded&amp;&amp;this.options.speedIndexTiming&amp;&amp;(this.loadTimeStamps.push(L.performance.now()),this.saveCanvasCopy()),h||(this.conflationActive=!1)}uploadLayer(t,i,r){this.gpuTimingStart(i),(!t.transform.projection.unsupportedLayers||!t.transform.projection.unsupportedLayers.includes(i.type)||t.terrain&amp;&amp;i.type==="custom")&amp;&amp;iE[`${i.type}Upload`]&amp;&amp;iE[`${i.type}Upload`](t,r,i.scope),this.gpuTimingEnd()}renderLayer(t,i,r,n){r.isHidden(this.transform.zoom)||(r.type==="background"||r.type==="sky"||r.type==="custom"||r.type==="model"||r.type==="raster"||n&amp;&amp;n.length)&amp;&amp;(this.id=r.id,this.gpuTimingStart(r),(!t.transform.projection.unsupportedLayers||!t.transform.projection.unsupportedLayers.includes(r.type)||t.terrain&amp;&amp;r.type==="custom")&amp;&amp;eE[r.type](t,i,r,n,this.style.placement.variableOffsets,this.options.isInitialLoad),this.gpuTimingEnd())}gpuTimingStart(t){if(!this.options.gpuTiming)return;const i=this.context.extTimerQuery,r=this.context.gl;let n=this.gpuTimers[t.id];n||(n=this.gpuTimers[t.id]={calls:0,cpuTime:0,query:r.createQuery()}),n.calls++,r.beginQuery(i.TIME_ELAPSED_EXT,n.query)}gpuTimingDeferredRenderStart(){if(this.options.gpuTimingDeferredRender){const t=this.context.extTimerQuery,i=this.context.gl,r=i.createQuery();this.deferredRenderGpuTimeQueries.push(r),i.beginQuery(t.TIME_ELAPSED_EXT,r)}}gpuTimingDeferredRenderEnd(){this.options.gpuTimingDeferredRender&amp;&amp;this.context.gl.endQuery(this.context.extTimerQuery.TIME_ELAPSED_EXT)}gpuTimingEnd(){this.options.gpuTiming&amp;&amp;this.context.gl.endQuery(this.context.extTimerQuery.TIME_ELAPSED_EXT)}collectGpuTimers(){const t=this.gpuTimers;return this.gpuTimers={},t}collectDeferredRenderGpuQueries(){const t=this.deferredRenderGpuTimeQueries;return this.deferredRenderGpuTimeQueries=[],t}queryGpuTimers(t){const i={};for(const r in t){const n=t[r],s=this.context.extTimerQuery,a=s.getQueryParameter(n.query,this.context.gl.QUERY_RESULT)/1e6;s.deleteQueryEXT(n.query),i[r]=a}return i}queryGpuTimeDeferredRender(t){if(!this.options.gpuTimingDeferredRender)return 0;const i=this.context.extTimerQuery,r=this.context.gl;let n=0;for(const s of t)n+=i.getQueryParameter(s,r.QUERY_RESULT)/1e6,i.deleteQueryEXT(s);return n}translatePosMatrix(t,i,r,n,s){if(!r[0]&amp;&amp;!r[1])return t;const a=s?n==="map"?this.transform.angle:0:n==="viewport"?-this.transform.angle:0;if(a){const d=Math.sin(a),f=Math.cos(a);r=[r[0]*f-r[1]*d,r[0]*d+r[1]*f]}const l=[s?r[0]:fa(i,r[0],this.transform.zoom),s?r[1]:fa(i,r[1],this.transform.zoom),0],h=new Float32Array(16);return nt.translate(h,t,l),h}saveTileTexture(t){const i=t.size[0],r=this._tileTextures[i];r?r.push(t):this._tileTextures[i]=[t]}getTileTexture(t){const i=this._tileTextures[t];return i&amp;&amp;i.length&gt;0?i.pop():null}isPatternMissing(t,i){return t===null||t!==void 0&amp;&amp;!this.imageManager.getPattern(t.toString(),i)}terrainRenderModeElevated(){return this.style&amp;&amp;!!this.style.getTerrain()&amp;&amp;!!this.terrain&amp;&amp;!this.terrain.renderingToTexture}linearFloatFilteringSupported(){return this.context.extTextureFloatLinear!=null}currentGlobalDefines(t,i,r){const n=r===void 0?this.terrain&amp;&amp;this.terrain.renderingToTexture:r,s=this.terrain&amp;&amp;this.terrain.exaggeration()===0,a=[];return this.style&amp;&amp;this.style.enable3dLights()&amp;&amp;(t==="globeRaster"||t==="terrainRaster"?(a.push("LIGHTING_3D_MODE"),a.push("LIGHTING_3D_ALPHA_EMISSIVENESS")):n||a.push("LIGHTING_3D_MODE")),this.renderPass==="shadow"?this._shadowMapDebug||a.push("DEPTH_TEXTURE"):this.shadowRenderer&amp;&amp;(this.shadowRenderer.useNormalOffset?a.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET"):a.push("RENDER_SHADOWS","DEPTH_TEXTURE")),this.terrainRenderModeElevated()&amp;&amp;(a.push("TERRAIN"),this.linearFloatFilteringSupported()&amp;&amp;a.push("TERRAIN_DEM_FLOAT_FORMAT"),s&amp;&amp;a.push("ZERO_EXAGGERATION")),this.transform.projection.name==="globe"&amp;&amp;a.push("GLOBE"),!this._fogVisible||n||i!==void 0&amp;&amp;!i||a.push("FOG","FOG_DITHERING"),n&amp;&amp;a.push("RENDER_TO_TEXTURE"),this._showOverdrawInspector&amp;&amp;a.push("OVERDRAW_INSPECTOR"),a}getOrCreateProgram(t,i){this.cache=this.cache||{};const r=i&amp;&amp;i.defines||[],n=i&amp;&amp;i.config,s=this.currentGlobalDefines(t,i&amp;&amp;i.overrideFog,i&amp;&amp;i.overrideRtt).concat(r),a=DT.cacheKey(TT[t],t,s,n);return this.cache[a]||(this.cache[a]=new DT(this.context,t,TT[t],n,VD[t],s)),this.cache[a]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.frontFace.setDefault(),this.context.cullFaceSide.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){const 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(){this.debugOverlayCanvas==null&amp;&amp;(this.debugOverlayCanvas=L.document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new Ii(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this._terrain&amp;&amp;this._terrain.destroy(),this._atmosphere&amp;&amp;(this._atmosphere.destroy(),this._atmosphere=void 0),this.globeSharedBuffers&amp;&amp;this.globeSharedBuffers.destroy(),this.emptyTexture.destroy(),this.debugOverlayTexture&amp;&amp;this.debugOverlayTexture.destroy(),this._wireframeDebugCache.destroy()}prepareDrawTile(){this.terrain&amp;&amp;this.terrain.prepareDrawTile()}uploadCommonLightUniforms(t,i){if(this.style.enable3dLights()){const r=this.style.directionalLight,n=this.style.ambientLight;if(r&amp;&amp;n){const s=((a,l)=&gt;{const h=a.properties.get("direction"),d=a.properties.get("color").toArray01(),f=a.properties.get("intensity"),m=l.properties.get("color").toArray01(),_=l.properties.get("intensity"),y=[h.x,h.y,h.z],x=gi(m,_),b=gi(d,f);return{u_lighting_ambient_color:x,u_lighting_directional_dir:y,u_lighting_directional_color:b,u_ground_radiance:ED(y,b,x)}})(r,n);i.setLightsUniformValues(t,s)}}}uploadCommonUniforms(t,i,r,n,s){if(this.uploadCommonLightUniforms(t,i),this.terrain&amp;&amp;this.terrain.renderingToTexture)return;const a=this.style.fog;if(a){const l=a.getOpacity(this.transform.pitch),h=((d,f,m,_,y,x,b,w,T,S,I,P)=&gt;{const M=d.transform,C=f.properties.get("color").toArray01();C[3]=_;const D=d.frameCounter/1e3%1,[O,k]=f.properties.get("vertical-range");return{u_fog_matrix:m?M.calculateFogTileMatrix(m):P||d.identityMat,u_fog_range:f.getFovAdjustedRange(M._fov),u_fog_color:C,u_fog_horizon_blend:f.properties.get("horizon-blend"),u_fog_vertical_limit:[Math.min(O,k),k],u_fog_temporal_offset:D,u_frustum_tl:y,u_frustum_tr:x,u_frustum_br:b,u_frustum_bl:w,u_globe_pos:T,u_globe_radius:S,u_viewport:I,u_globe_transition:hr(M.zoom),u_is_globe:+(M.projection.name==="globe")}})(this,a,r,l,this.transform.frustumCorners.TL,this.transform.frustumCorners.TR,this.transform.frustumCorners.BR,this.transform.frustumCorners.BL,this.transform.globeCenterInViewSpace,this.transform.globeRadius,[this.transform.width*_e.devicePixelRatio,this.transform.height*_e.devicePixelRatio],n);i.setFogUniformValues(t,h)}s&amp;&amp;i.setCutoffUniformValues(t,s.uniformValues)}setTileLoadedFlag(t){this.tileLoaded=t}saveCanvasCopy(){const t=this.canvasCopy();t&amp;&amp;(this.frameCopies.push(t),this.tileLoaded=!1)}canvasCopy(){const t=this.context.gl,i=t.createTexture();return t.bindTexture(t.TEXTURE_2D,i),t.copyTexImage2D(t.TEXTURE_2D,0,t.RGBA,0,0,t.drawingBufferWidth,t.drawingBufferHeight,0),i}getCanvasCopiesAndTimestamps(){return{canvasCopies:this.frameCopies,timeStamps:this.loadTimeStamps}}averageElevationNeedsEasing(){if(!this.transform._elevation)return!1;const t=this.style&amp;&amp;this.style.fog;return!!t&amp;&amp;t.getOpacity(this.transform.pitch)!==0}getBackgroundTiles(){const t=this._backgroundTiles,i=this._backgroundTiles={},r=this.transform.coveringTiles({tileSize:512});for(const n of r)i[n.key]=t[n.key]||new jc(n,512,this.transform.tileZoom,this);return i}clearBackgroundTiles(){this._backgroundTiles={}}layerUsedInConflation(t,i){return!(!t.is3D()||t.minzoom&amp;&amp;t.minzoom&gt;this.transform.zoom||t.sourceLayer!=="building"&amp;&amp;(!i||i.type!=="batched-model"))}isTileAffectedByFog(t){if(!this.style||!this.style.fog)return!1;if(this.transform.projection.name==="globe")return!0;let i=this._cachedTileFogOpacities[t.key];return i||(this._cachedTileFogOpacities[t.key]=i=this.style.fog.getOpacityForTile(t)),i[0]&gt;=_a||i[1]&gt;=_a}}const xa=2048;class _O{constructor(t,i){this.aabb=t,this.lastCascade=i}}class gO{add(t,i){const r=this.receivers[t.key];r!==void 0?(r.aabb.min[0]=Math.min(r.aabb.min[0],i.min[0]),r.aabb.min[1]=Math.min(r.aabb.min[1],i.min[1]),r.aabb.min[2]=Math.min(r.aabb.min[2],i.min[2]),r.aabb.max[0]=Math.max(r.aabb.max[0],i.max[0]),r.aabb.max[1]=Math.max(r.aabb.max[1],i.max[1]),r.aabb.max[2]=Math.max(r.aabb.max[2],i.max[2])):this.receivers[t.key]=new _O(i,null)}clear(){this.receivers={}}get(t){return this.receivers[t.key]}computeRequiredCascades(t,i,r){const n=mi.fromPoints(t.points);let s=0;for(const a in this.receivers){const l=this.receivers[a];if(!l||!n.intersectsAabb(l.aabb))continue;l.aabb.min=n.closestPoint(l.aabb.min),l.aabb.max=n.closestPoint(l.aabb.max);const h=l.aabb.getCorners();for(let d=0;d&lt;r.length;d++){let f=!0;for(const m of h){const _=[m[0]*i,m[1]*i,m[2]];if(W.transformMat4(_,_,r[d].matrix),_[0]&lt;-1||_[0]&gt;1||_[1]&lt;-1||_[1]&gt;1){f=!1;break}}if(l.lastCascade=d,s=Math.max(s,d),f)break}}return s+1}}class yO{constructor(t){this.painter=t,this._enabled=!1,this._shadowLayerCount=0,this._numCascadesToRender=0,this._cascades=[],this._groundShadowTiles=[],this._receivers=new gO,this._depthMode=new de(t.context.gl.LEQUAL,de.ReadWrite,[0,1]),this._uniformValues={u_light_matrix_0:new Float32Array(16),u_light_matrix_1:new Float32Array(16),u_shadow_intensity:0,u_fade_range:[0,0],u_shadow_normal_offset:[1,1,1],u_shadow_texel_size:1,u_shadow_map_resolution:1,u_shadow_direction:[0,0,1],u_shadow_bias:[36e-5,.0012,.012],u_shadowmap_0:0,u_shadowmap_1:0},this.useNormalOffset=!1}destroy(){for(const t of this._cascades)t.texture.destroy(),t.framebuffer.destroy();this._cascades=[]}updateShadowParameters(t,i){const r=this.painter;if(this._enabled=!1,this._shadowLayerCount=0,this._receivers.clear(),!i||!i.properties)return;const n=i.properties.get("shadow-intensity");if(!i.shadowsEnabled()||n&lt;=0||(this._shadowLayerCount=r.style.order.reduce((y,x)=&gt;{const b=r.style._mergedLayers[x];return y+(b.hasShadowPass()&amp;&amp;!b.isHidden(t.zoom)?1:0)},0),this._enabled=this._shadowLayerCount&gt;0,!this._enabled))return;const s=r.context,a=xa,l=xa;if(this._cascades.length===0)for(let y=0;y&lt;2;++y){const x=r._shadowMapDebug,b=s.gl,w=s.createFramebuffer(a,l,x,"texture"),T=new Ii(s,{width:a,height:l,data:null},b.DEPTH_COMPONENT);if(w.depthAttachment.set(T.texture),x){const S=new Ii(s,{width:a,height:l,data:null},b.RGBA);w.colorAttachment.set(S.texture)}this._cascades.push({framebuffer:w,texture:T,matrix:[],far:0,boundingSphereRadius:0,frustum:new $s,scale:0})}this.shadowDirection=rE(i);let h=0;if(t.elevation){const y=t.elevation,x=[1e4,-1e4];y.visibleDemTiles.filter(b=&gt;b.dem).forEach(b=&gt;{const w=b.dem.tree;x[0]=Math.min(x[0],w.minimums[0]),x[1]=Math.max(x[1],w.maximums[0])}),x[0]!==1e4&amp;&amp;(h=(x[1]-x[0])*y.exaggeration())}const d=1.5*t.cameraToCenterDistance,f=3*d,m=new Float64Array(16);for(let y=0;y&lt;2;++y){const x=this._cascades[y];let b=t.height/50,w=1;y===0?w=d:(b=d,w=f);const[T,S]=xO(t,this.shadowDirection,b,w,xa,h);x.scale=t.scale,x.matrix=T,x.boundingSphereRadius=S,nt.invert(m,x.matrix),x.frustum=$s.fromInvProjectionMatrix(m,1,0,!0),x.far=w}this._uniformValues.u_fade_range=[.75*this._cascades[1].far,this._cascades[1].far],this._uniformValues.u_shadow_intensity=n,this._uniformValues.u_shadow_direction=[this.shadowDirection[0],this.shadowDirection[1],this.shadowDirection[2]],this._uniformValues.u_shadow_texel_size=.00048828125,this._uniformValues.u_shadow_map_resolution=xa,this._uniformValues.u_shadowmap_0=rn.ShadowMap0,this._uniformValues.u_shadowmap_1=rn.ShadowMap0+1,this._groundShadowTiles=r.transform.coveringTiles({tileSize:512,renderWorldCopies:!0});const _=r.transform.elevation;for(const y of this._groundShadowTiles){let x={min:0,max:0};if(_){const b=_.getMinMaxForTile(y);b&amp;&amp;(x=b)}this.addShadowReceiver(y.toUnwrapped(),x.min,x.max)}}get enabled(){return this._enabled}set enabled(t){this._enabled=t}drawShadowPass(t,i){if(!this._enabled)return;const r=this.painter,n=r.context;this._numCascadesToRender=this._receivers.computeRequiredCascades(r.transform.getFrustum(0),r.transform.worldSize,this._cascades),n.viewport.set([0,0,xa,xa]);for(let s=0;s&lt;this._numCascadesToRender;++s){r.currentShadowCascade=s,n.bindFramebuffer.set(this._cascades[s].framebuffer.framebuffer),n.clear({color:Ie.white,depth:1});for(const a of t.order){const l=t._mergedLayers[a];if(!l.hasShadowPass()||l.isHidden(r.transform.zoom))continue;const h=t.getLayerSourceCache(l),d=h?i[h.id]:void 0;(l.type==="model"||d&amp;&amp;d.length)&amp;&amp;r.renderLayer(r,h,l,d)}}r.currentShadowCascade=0}drawGroundShadows(){if(!this._enabled)return;const t=this.painter,i=t.style,r=t.context,n=i.directionalLight,s=i.ambientLight;if(!n||!s)return;const a=[],l=Tl(t,t.longestCutoffRange);l.shouldRenderCutoff&amp;&amp;a.push("RENDER_CUTOFF");const h=Q_(n,s),d=new de(r.gl.LEQUAL,de.ReadOnly,t.depthRangeFor3D);for(const f of this._groundShadowTiles){const m=f.toUnwrapped(),_=t.isTileAffectedByFog(f),y=t.getOrCreateProgram("groundShadow",{defines:a,overrideFog:_});this.setupShadows(m,y),t.uploadCommonUniforms(r,y,m,null,l);const x={u_matrix:t.transform.calculateProjMatrix(m),u_ground_shadow_factor:h};y.draw(t,r.gl.TRIANGLES,d,Pe.disabled,je.multiply,Le.disabled,x,"ground_shadow",t.tileExtentBuffer,t.quadTriangleIndexBuffer,t.tileExtentSegments,{},t.transform.zoom,null,null)}}getShadowPassColorMode(){return this.painter._shadowMapDebug?je.unblended:je.disabled}getShadowPassDepthMode(){return this._depthMode}getShadowCastingLayerCount(){return this._shadowLayerCount}calculateShadowPassMatrixFromTile(t){const i=this.painter.transform,r=i.calculatePosMatrix(t,i.worldSize);return nt.multiply(r,this._cascades[this.painter.currentShadowCascade].matrix,r),Float32Array.from(r)}calculateShadowPassMatrixFromMatrix(t){return nt.multiply(t,this._cascades[this.painter.currentShadowCascade].matrix,t),Float32Array.from(t)}setupShadows(t,i,r,n=0){if(!this._enabled)return;const s=this.painter.transform,a=this.painter.context,l=a.gl,h=this._uniformValues,d=new Float64Array(16),f=s.calculatePosMatrix(t,s.worldSize);for(let m=0;m&lt;2;m++)nt.multiply(d,this._cascades[m].matrix,f),h[m===0?"u_light_matrix_0":"u_light_matrix_1"]=Float32Array.from(d),a.activeTexture.set(l.TEXTURE0+rn.ShadowMap0+m),this._cascades[m].texture.bind(l.NEAREST,l.CLAMP_TO_EDGE);if(this.useNormalOffset=!!r,this.useNormalOffset){const m=Ic(t.canonical),_=2/s.tileSize*ut/xa,y=_*this._cascades[0].boundingSphereRadius,x=_*this._cascades[1].boundingSphereRadius,b=(r==="vector-tile"?1:3)/Math.pow(2,n-t.canonical.z-(1-s.zoom+Math.floor(s.zoom)));h.u_shadow_normal_offset=[m,y*b,x*b],h.u_shadow_bias=[6e-5,.0012,.012]}else h.u_shadow_bias=[36e-5,.0012,.012];i.setShadowUniformValues(a,h)}setupShadowsFromMatrix(t,i,r=!1){if(!this._enabled)return;const n=this.painter.context,s=n.gl,a=this._uniformValues,l=new Float64Array(16);for(let h=0;h&lt;2;h++)nt.multiply(l,this._cascades[h].matrix,t),a[h===0?"u_light_matrix_0":"u_light_matrix_1"]=Float32Array.from(l),n.activeTexture.set(s.TEXTURE0+rn.ShadowMap0+h),this._cascades[h].texture.bind(s.NEAREST,s.CLAMP_TO_EDGE);this.useNormalOffset=r,r?(a.u_shadow_normal_offset=[1,5,5],a.u_shadow_bias=[6e-5,.0012,.012]):a.u_shadow_bias=[36e-5,.0012,.012],i.setShadowUniformValues(n,a)}getShadowUniformValues(){return this._uniformValues}getCurrentCascadeFrustum(){return this._cascades[this.painter.currentShadowCascade].frustum}computeSimplifiedTileShadowVolume(t,i,r,n){if(n[2]&gt;=0)return{};const s=function(h,d,f){const m=f/(1&lt;&lt;h.canonical.z);return new mi([h.canonical.x*m+h.wrap*f,h.canonical.y*m+h.wrap*f,0],[(h.canonical.x+1)*m+h.wrap*f,(h.canonical.y+1)*m+h.wrap*f,d])}(t,i,r).getCorners(),a=i/-n[2];n[0]&lt;0?(W.add(s[0],s[0],[n[0]*a,0,0]),W.add(s[3],s[3],[n[0]*a,0,0])):n[0]&gt;0&amp;&amp;(W.add(s[1],s[1],[n[0]*a,0,0]),W.add(s[2],s[2],[n[0]*a,0,0])),n[1]&lt;0?(W.add(s[0],s[0],[0,n[1]*a,0]),W.add(s[1],s[1],[0,n[1]*a,0])):n[1]&gt;0&amp;&amp;(W.add(s[2],s[2],[0,n[1]*a,0]),W.add(s[3],s[3],[0,n[1]*a,0]));const l={};return l.vertices=s,l.planes=[Od(s[1],s[0],s[4]),Od(s[2],s[1],s[5]),Od(s[3],s[2],s[6]),Od(s[0],s[3],s[7])],l}addShadowReceiver(t,i,r){this._receivers.add(t,mi.fromTileIdAndHeight(t,i,r))}getMaxCascadeForTile(t){const i=this._receivers.get(t);return i&amp;&amp;i.lastCascade?i.lastCascade:0}}function Od(e,t,i){const r=W.sub([],i,t),n=W.sub([],e,t),s=W.cross([],r,n),a=W.length(s);return a===0?[0,0,1,0]:(W.scale(s,s,1/a),[s[0],s[1],s[2],-W.dot(s,t)])}function rE(e){const t=e.properties.get("direction"),i=te(t.x,t.y,t.z);i[2]=Xt(i[2],0,75);const r=Wt([i[0],i[1],i[2]]);return W.fromValues(r.x,r.y,r.z)}function Q_(e,t){const i=e.properties.get("color"),r=e.properties.get("intensity"),n=e.properties.get("direction"),s=[n.x,n.y,n.z],a=t.properties.get("color"),l=t.properties.get("intensity"),h=Math.max(W.dot([0,0,1],s),0),d=[0,0,0];W.scale(d,a.toArray01Linear().slice(0,3),l);const f=[0,0,0];return W.scale(f,i.toArray01Linear().slice(0,3),h*r),Ri([d[0]&gt;0?d[0]/(d[0]+f[0]):0,d[1]&gt;0?d[1]/(d[1]+f[1]):0,d[2]&gt;0?d[2]/(d[2]+f[2]):0])}function xO(e,t,i,r,n,s){const a=e.zoom,l=e.scale,h=e.worldSize,d=1/h,f=e.aspect,m=Math.sqrt(1+f*f)*Math.tan(.5*e.fovX),_=m*m,y=r-i,x=r+i;let b,w;_&gt;y/x?(b=r,w=r*m):(b=.5*x*(1+_),w=.5*Math.sqrt(y*y+2*(r*r+i*i)*_+x*x*_*_));const T=e.projection.pixelsPerMeter(e.center.lat,h),S=e._camera.getCameraToWorldMercator(),I=[0,0,-b*d];W.transformMat4(I,I,S);let P=w*d;const M=e._edgeInsets;if(!(M.left===0&amp;&amp;M.top===0&amp;&amp;M.right===0&amp;&amp;M.bottom===0||M.left===M.right&amp;&amp;M.top===M.bottom)){const lt=e._camera.getWorldToCamera(e.worldSize,e.projection.zAxisUnit==="meters"?T:1),at=e._camera.getCameraToClipPerspective(e._fov,e.width/e.height,i,r);at[8]=2*-e.centerOffset.x/e.width,at[9]=2*e.centerOffset.y/e.height;const dt=new Float64Array(16);nt.mul(dt,at,lt);const ft=new Float64Array(16);nt.invert(ft,dt);const _t=$s.fromInvProjectionMatrix(ft,h,a,!0);for(const ct of _t.points){const bt=((C=ct)[0]/=l,C[1]/=l,C[2]=ui(C[2],e._center.lat),C);P=Math.max(P,W.len(W.subtract([],I,bt)))}}var C;P*=n/(n-1);const D=Math.acos(t[2]),O=Math.atan2(-t[0],-t[1]),k=new cd;k.position=I,k.setPitchBearing(D,O);const z=k.getWorldToCamera(h,T),B=P*h,U=Math.min(e._mercatorZfromZoom(17)*h*-2,-2*B),Z=k.getCameraToClipOrthographic(-B,B,-B,B,U,(B+s*T)/t[2]),F=new Float64Array(16);nt.multiply(F,Z,z);const Y=W.fromValues(Math.floor(1e6*I[0])/1e6*h,Math.floor(1e6*I[1])/1e6*h,0),J=.5*n,it=[0,0,0];W.transformMat4(it,Y,F),W.scale(it,it,J);const X=[Math.floor(it[0]),Math.floor(it[1]),Math.floor(it[2])],K=[0,0,0];W.sub(K,it,X),W.scale(K,K,-1/J);const ot=new Float64Array(16);return nt.identity(ot),nt.translate(ot,ot,K),nt.multiply(F,ot,F),[F,B]}class vO extends Zi{constructor(t){super(),this.requestManager=t,this.models={"":{}},this.numModelsLoading={}}loadModel(t,i){return Kw(this.requestManager.transformRequest(i,pt.Model).url).then(r=&gt;{if(!r)return;const n=B_(r),s=new Zb(t,void 0,void 0,n);return s.computeBoundsAndApplyParent(),s}).catch(r=&gt;{this.fire(new xe(new Error(`Could not load model ${t} from ${i}: ${r.message}`)))})}load(t,i){this.models[i]||(this.models[i]={});const r=Object.keys(t);this.numModelsLoading[i]=(this.numModelsLoading[i]||0)+r.length;const n=[];for(const s of r)n.push(this.loadModel(s,t[s]));Promise.allSettled(n).then(s=&gt;{for(let a=0;a&lt;s.length;a++){const{status:l,value:h}=s[a];l==="fulfilled"&amp;&amp;h&amp;&amp;(this.models[i][r[a]]=h)}this.numModelsLoading[i]-=r.length,this.fire(new It("data",{dataType:"style"}))}).catch(s=&gt;{this.fire(new xe(new Error(`Could not load models: ${s.message}`)))})}isLoaded(){for(const t in this.numModelsLoading)if(this.numModelsLoading[t]&gt;0)return!1;return!0}hasModel(t,i){return!!this.getModel(t,i)}getModel(t,i){return this.models[i]||(this.models[i]={}),this.models[i][t]}addModel(t,i,r){this.models[r]||(this.models[r]={}),this.hasModel(t,r)&amp;&amp;this.removeModel(t,r),this.load({[t]:this.requestManager.normalizeModelURL(i)},r)}addModels(t,i){const r={};for(const n in t)r[n]=this.requestManager.normalizeModelURL(t[n]);this.load(r,i)}removeModel(t,i){this.models[i]||(this.models[i]={});const r=this.models[i][t];delete this.models[i][t],r.destroy()}listModels(t){return this.models[t]||(this.models[t]={}),Object.keys(this.models[t])}upload(t,i){this.models[i]||(this.models[i]={});for(const r in this.models[i])this.models[i][r].upload(t.context)}}const iu=(e,t)=&gt;nh(e,t&amp;&amp;t.filter(i=&gt;i.identifier!=="source.canvas")),bO=nr(Xe,["addLayer","removeLayer","setLights","setPaintProperty","setLayoutProperty","setSlot","setFilter","addSource","removeSource","setLayerZoomRange","setLight","setTransition","setGeoJSONSourceData","setTerrain","setFog","setProjection","setCamera","addImport","removeImport","setImportUrl","setImportData","setImportConfig"]),wO=nr(Xe,["setCenter","setZoom","setBearing","setPitch"]),nE={version:8,layers:[],sources:{}},sE={duration:300,delay:0},TO=new Set(["fill","line","background","hillshade","raster"]);class Kn extends Zi{constructor(t,i={}){super(),this.map=t,this.scope=i.scope||"",this.fragments=[],this.importDepth=i.importDepth||0,this.importsCache=i.importsCache||new Map,this.resolvedImports=i.resolvedImports||new Set,this.transition=Bt({},sE),this._buildingIndex=new qR(this),this.crossTileSymbolIndex=new mD,this._mergedOrder=[],this._drapedFirstOrder=[],this._mergedLayers={},this._mergedSourceCaches={},this._mergedOtherSourceCaches={},this._mergedSymbolSourceCaches={},this._has3DLayers=!1,this._hasCircleLayers=!1,this._hasSymbolLayers=!1,this._changes=i.styleChanges||new sP,this.dispatcher=i.dispatcher?i.dispatcher:new ga(Qc(),this),i.imageManager?this.imageManager=i.imageManager:(this.imageManager=new bR,this.imageManager.setEventedParent(this)),this.imageManager.createScope(this.scope),this.glyphManager=i.glyphManager?i.glyphManager:new pl(t._requestManager,i.localFontFamily?2:i.localIdeographFontFamily?1:0,i.localFontFamily||i.localIdeographFontFamily),i.modelManager?this.modelManager=i.modelManager:(this.modelManager=new vO(t._requestManager),this.modelManager.setEventedParent(this)),this._layers={},this._serializedLayers={},this._sourceCaches={},this._otherSourceCaches={},this._symbolSourceCaches={},this._loaded=!1,this._precompileDone=!1,this._shouldPrecompile=!1,this._availableImages=[],this._order=[],this._markersNeedUpdate=!1,this.options=new Map,this._configDependentLayers=new Set,this._config=i.config,this.dispatcher.broadcast("setReferrer",St());const r=this;this._rtlTextPluginCallback=Kn.registerForPluginStateChange(n=&gt;{r.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:n.pluginStatus,pluginURL:n.pluginURL},(s,a)=&gt;{if(sx(s),a&amp;&amp;a.every(l=&gt;l))for(const l in r._sourceCaches){const h=r._sourceCaches[l],d=h.getSource().type;d!=="vector"&amp;&amp;d!=="geojson"||h.reload()}})}),this.on("data",n=&gt;{if(n.dataType!=="source"||n.sourceDataType!=="metadata")return;const s=this.getOwnSource(n.sourceId);if(s&amp;&amp;s.vectorLayerIds)for(const a in this._layers){const l=this._layers[a];l.source===s.id&amp;&amp;this._validateLayer(l)}})}loadURL(t,i={}){this.fire(new It("dataloading",{dataType:"style"}));const r=typeof i.validate=="boolean"?i.validate:!Qe(t);t=this.map._requestManager.normalizeStyleURL(t,i.accessToken),this.resolvedImports.add(t);const n=this.importsCache.get(t);if(n)return this._load(n,r);const s=this.map._requestManager.transformRequest(t,pt.Style);this._request=Rt(s,(a,l)=&gt;{if(this._request=null,a)this.fire(new xe(a));else if(l)return this.importsCache.set(t,l),this._load(l,r)})}loadJSON(t,i={}){this.fire(new It("dataloading",{dataType:"style"})),this._request=_e.frame(()=&gt;{this._request=null,this._load(t,i.validate!==!1)})}loadEmpty(){this.fire(new It("dataloading",{dataType:"style"})),this._load(nE,!1)}_loadImports(t,i){if(this.importDepth&gt;=4)return tt("Style doesn't support nesting deeper than 5"),Promise.resolve();const r=[];for(const n of t){const s=this._createFragmentStyle(n),a=new Promise(h=&gt;{s.once("style.import.load",h),s.once("error",h)}).then(()=&gt;this.mergeAll());if(r.push(a),this.resolvedImports.has(n.url)){s.loadEmpty();continue}const l=n.data||this.importsCache.get(n.url);l?s.loadJSON(l,{validate:i}):n.url?s.loadURL(n.url,{validate:i}):s.loadEmpty(),this.fragments.push({style:s,id:n.id,config:n.config})}return Promise.allSettled(r)}_createFragmentStyle(t){const i=this.scope?Mr(t.id,this.scope):t.id,r=new Kn(this.map,{scope:i,styleChanges:this._changes,importDepth:this.importDepth+1,importsCache:this.importsCache,resolvedImports:new Set(this.resolvedImports),dispatcher:this.dispatcher,imageManager:this.imageManager,glyphManager:this.glyphManager,modelManager:this.modelManager,config:t.config});return r.setEventedParent(this.map,{style:r}),r}_reloadImports(){this.mergeAll(),this._updateMapProjection(),this.map._triggerCameraUpdate(this.camera),this.dispatcher.broadcast("setLayers",{layers:this._serializeLayers(this._order),scope:this.scope,options:this.options});const t=this.isRootStyle();this._shouldPrecompile=t,this.fire(new It(t?"style.load":"style.import.load"))}_load(t,i){const r=t.schema;if(this.isRootStyle()&amp;&amp;(t.fragment||r&amp;&amp;t.fragment!==!1)){const a=Bt({},nE,{imports:[{id:"basemap",data:t,url:""}]});return void this._load(a,i)}if(this.setConfig(this._config,r),i&amp;&amp;iu(this,Xa(t)))return;this._loaded=!0,this.stylesheet=V(t);for(const a in t.sources)this.addSource(a,t.sources[a],{validate:!1,isInitialLoad:!0});t.sprite?this._loadSprite(t.sprite):(this.imageManager.setLoaded(!0,this.scope),this.dispatcher.broadcast("spriteLoaded",{scope:this.scope,isLoaded:!0})),this.glyphManager.setURL(t.glyphs,this.scope);const n=iT(this.stylesheet.layers);if(this._order=n.map(a=&gt;a.id),this.stylesheet.light&amp;&amp;tt("The `light` root property is deprecated, prefer using `lights` with `flat` light type instead."),this.stylesheet.lights)if(this.stylesheet.lights.length===1&amp;&amp;this.stylesheet.lights[0].type==="flat"){const a=this.stylesheet.lights[0];this.light=new Pw(a.properties,a.id)}else this.setLights(this.stylesheet.lights);this.light||(this.light=new Pw(this.stylesheet.light)),this._layers={},this._serializedLayers={};for(const a of n){const l=gd(a,this.options);l.setScope(this.scope),l.isConfigDependent&amp;&amp;this._configDependentLayers.add(l.fqid),l.setEventedParent(this,{layer:{id:l.id}}),this._layers[l.id]=l,this._serializedLayers[l.id]=l.serialize();const h=this.getOwnLayerSourceCache(l),d=!!this.directionalLight&amp;&amp;this.directionalLight.shadowsEnabled();h&amp;&amp;l.canCastShadows()&amp;&amp;d&amp;&amp;(h.castsShadows=!0)}this.stylesheet.models&amp;&amp;this.modelManager.addModels(this.stylesheet.models,this.scope);const s=this.stylesheet.terrain;s&amp;&amp;(this.disableElevatedTerrain===void 0&amp;&amp;(this.disableElevatedTerrain=_e.hasCanvasFingerprintNoise()),this.disableElevatedTerrain?tt("Terrain and hillshade are disabled because of Canvas2D limitations when fingerprinting protection is enabled (e.g. in private browsing mode)."):this.terrainSetForDrapingOnly()||this._createTerrain(s,1)),this.stylesheet.fog&amp;&amp;this._createFog(this.stylesheet.fog),this.stylesheet.transition&amp;&amp;this.setTransition(this.stylesheet.transition),this.fire(new It("data",{dataType:"style"})),t.imports?this._loadImports(t.imports,i).then(()=&gt;this._reloadImports()):this._reloadImports()}isRootStyle(){return this.importDepth===0}mergeAll(){let t,i,r,n,s,a,l,h;this.terrain&amp;&amp;this.terrain.scope!==this.scope&amp;&amp;delete this.terrain,this.forEachFragmentStyle(d=&gt;{if(d.stylesheet){if(d.light!=null&amp;&amp;(t=d.light),d.stylesheet.lights)for(const f of d.stylesheet.lights)f.type==="ambient"&amp;&amp;d.ambientLight!=null&amp;&amp;(i=d.ambientLight),f.type==="directional"&amp;&amp;d.directionalLight!=null&amp;&amp;(r=d.directionalLight);n=this._prioritizeTerrain(n,d.terrain,d.stylesheet.terrain),d.stylesheet.fog&amp;&amp;d.fog!=null&amp;&amp;(s=d.fog),d.stylesheet.camera!=null&amp;&amp;(h=d.stylesheet.camera),d.stylesheet.projection!=null&amp;&amp;(a=d.stylesheet.projection),d.stylesheet.transition!=null&amp;&amp;(l=d.stylesheet.transition)}}),this.light=t,this.ambientLight=i,this.directionalLight=r,this.fog=s,n===null?delete this.terrain:this.terrain=n,this.camera=h||{"camera-projection":"perspective"},this.projection=a||{name:"mercator"},this.transition=Bt({},sE,l),this.mergeSources(),this.mergeLayers()}forEachFragmentStyle(t){const i=r=&gt;{for(const n of r.fragments)i(n.style);t(r)};i(this)}_prioritizeTerrain(t,i,r){const n=t&amp;&amp;t.drapeRenderMode===0;return r===null?i&amp;&amp;i.drapeRenderMode===0?i:n?t:null:i!=null&amp;&amp;(!t||n||i&amp;&amp;i.drapeRenderMode===1)?i:t}mergeTerrain(){let t;this.terrain&amp;&amp;this.terrain.scope!==this.scope&amp;&amp;delete this.terrain,this.forEachFragmentStyle(i=&gt;{t=this._prioritizeTerrain(t,i.terrain,i.stylesheet.terrain)}),t===null?delete this.terrain:this.terrain=t}mergeProjection(){let t;this.forEachFragmentStyle(i=&gt;{i.stylesheet.projection!=null&amp;&amp;(t=i.stylesheet.projection)}),this.projection=t||{name:"mercator"}}mergeSources(){const t={},i={},r={};this.forEachFragmentStyle(n=&gt;{for(const s in n._sourceCaches){const a=Mr(s,n.scope);t[a]=n._sourceCaches[s]}for(const s in n._otherSourceCaches){const a=Mr(s,n.scope);i[a]=n._otherSourceCaches[s]}for(const s in n._symbolSourceCaches){const a=Mr(s,n.scope);r[a]=n._symbolSourceCaches[s]}}),this._mergedSourceCaches=t,this._mergedOtherSourceCaches=i,this._mergedSymbolSourceCaches=r}mergeLayers(){const t={},i=[],r={};this._has3DLayers=!1,this._hasCircleLayers=!1,this._hasSymbolLayers=!1,this.forEachFragmentStyle(s=&gt;{for(const a of s._order){const l=s._layers[a];if(l.type==="slot"){const h=lh(a);if(t[h])continue;t[h]=[]}l.slot&amp;&amp;t[l.slot]?t[l.slot].push(l):i.push(l)}}),this._mergedOrder=[];const n=(s=[])=&gt;{for(const a of s)if(a.type==="slot"){const l=lh(a.id);t[l]&amp;&amp;n(t[l])}else{const l=Mr(a.id,a.scope);this._mergedOrder.push(l),r[l]=a,a.is3D()&amp;&amp;(this._has3DLayers=!0),a.type==="circle"&amp;&amp;(this._hasCircleLayers=!0),a.type==="symbol"&amp;&amp;(this._hasSymbolLayers=!0)}};n(i),this._mergedLayers=r,this.updateDrapeFirstLayers(),this._buildingIndex.processLayersChanged()}terrainSetForDrapingOnly(){return!!this.terrain&amp;&amp;this.terrain.drapeRenderMode===0}getCamera(){return this.stylesheet.camera}setCamera(t){return this.stylesheet.camera=Bt({},this.stylesheet.camera,t),this.camera=this.stylesheet.camera,this}setProjection(t){t?this.stylesheet.projection=t:delete this.stylesheet.projection,this.mergeProjection(),this._updateMapProjection()}applyProjectionUpdate(){this._loaded&amp;&amp;(this.dispatcher.broadcast("setProjection",this.map.transform.projectionOptions),this.map.transform.projection.requiresDraping?this.getTerrain()||this.stylesheet.terrain||this.setTerrainForDraping():this.terrainSetForDrapingOnly()&amp;&amp;this.setTerrain(null))}_updateMapProjection(){this.isRootStyle()&amp;&amp;(this.map._useExplicitProjection?this.applyProjectionUpdate():this.map._prioritizeAndUpdateProjection(null,this.projection))}_loadSprite(t){this._spriteRequest=function(i,r,n){let s,a,l;const h=_e.devicePixelRatio&gt;1?"@2x":"";let d=Rt(r.transformRequest(r.normalizeSpriteURL(i,h,".json"),pt.SpriteJSON),(_,y)=&gt;{d=null,l||(l=_,s=y,m())}),f=Te(r.transformRequest(r.normalizeSpriteURL(i,h,".png"),pt.SpriteImage),(_,y)=&gt;{f=null,l||(l=_,a=y,m())});function m(){if(l)n(l);else if(s&amp;&amp;a){const _=_e.getImageData(a),y={};for(const x in s){const{width:b,height:w,x:T,y:S,sdf:I,pixelRatio:P,stretchX:M,stretchY:C,content:D}=s[x],O=new Hi({width:b,height:w});Hi.copy(_,O,{x:T,y:S},{x:0,y:0},{width:b,height:w}),y[x]={data:O,pixelRatio:P,sdf:I,stretchX:M,stretchY:C,content:D}}n(null,y)}}return{cancel(){d&amp;&amp;(d.cancel(),d=null),f&amp;&amp;(f.cancel(),f=null)}}}(t,this.map._requestManager,(i,r)=&gt;{if(this._spriteRequest=null,i)this.fire(new xe(i));else if(r)for(const n in r)this.imageManager.addImage(n,this.scope,r[n]);this.imageManager.setLoaded(!0,this.scope),this._availableImages=this.imageManager.listImages(this.scope),this.dispatcher.broadcast("setImages",{scope:this.scope,images:this._availableImages}),this.dispatcher.broadcast("spriteLoaded",{scope:this.scope,isLoaded:!0}),this.fire(new It("data",{dataType:"style"}))})}_validateLayer(t){const i=this.getOwnSource(t.source);if(!i)return;const r=t.sourceLayer;r&amp;&amp;(i.type==="geojson"||i.vectorLayerIds&amp;&amp;i.vectorLayerIds.indexOf(r)===-1)&amp;&amp;this.fire(new xe(new Error(`Source layer "${r}" does not exist on source "${i.id}" as specified by style layer "${t.id}"`)))}loaded(){if(!this._loaded||Object.keys(this._changes.getUpdatedSourceCaches()).length)return!1;for(const t in this._sourceCaches)if(!this._sourceCaches[t].loaded())return!1;if(!this.imageManager.isLoaded()||!this.modelManager.isLoaded())return!1;for(const{style:t}of this.fragments)if(!t.loaded())return!1;return!0}_serializeImports(){if(this.stylesheet.imports)return this.stylesheet.imports.map((t,i)=&gt;{const r=this.fragments[i];return r&amp;&amp;r.style&amp;&amp;(t.data=r.style.serialize()),t})}_serializeSources(){const t={};for(const i in this._sourceCaches){const r=this._sourceCaches[i].getSource();t[r.id]||(t[r.id]=r.serialize())}return t}_serializeLayers(t){const i=[];for(const r of t){const n=this._layers[r];n&amp;&amp;n.type!=="custom"&amp;&amp;i.push(n.serialize())}return i}hasLightTransitions(){return!(!this.light||!this.light.hasTransition())||!(!this.ambientLight||!this.ambientLight.hasTransition())||!(!this.directionalLight||!this.directionalLight.hasTransition())}hasFogTransition(){return!!this.fog&amp;&amp;this.fog.hasTransition()}hasTransitions(){if(this.hasLightTransitions()||this.hasFogTransition())return!0;for(const t in this._sourceCaches)if(this._sourceCaches[t].hasTransition())return!0;for(const t in this._layers)if(this._layers[t].hasTransition())return!0;return!1}get order(){return this.terrain?this._drapedFirstOrder:this._mergedOrder}isLayerDraped(t){return!!this.terrain&amp;&amp;(typeof t.isLayerDraped=="function"?t.isLayerDraped(this.getLayerSourceCache(t)):TO.has(t.type))}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading")}_checkLayer(t){const i=this.getOwnLayer(t);if(i)return i;this.fire(new xe(new Error(`The layer '${t}' does not exist in the map's style.`)))}_checkSource(t){const i=this.getOwnSource(t);if(i)return i;this.fire(new xe(new Error(`The source '${t}' does not exist in the map's style.`)))}update(t){if(!this._loaded)return;this.ambientLight&amp;&amp;this.ambientLight.recalculate(t),this.directionalLight&amp;&amp;this.directionalLight.recalculate(t);const i=this.calculateLightsBrightness();t.brightness=i||0,i!==this._brightness&amp;&amp;(this._brightness=i,this.dispatcher.broadcast("setBrightness",i));const r=this._changes.isDirty();if(this._changes.isDirty()){const s=this._changes.getLayerUpdatesByScope();for(const a in s){const{updatedIds:l,removedIds:h}=s[a];(l||h)&amp;&amp;this._updateWorkerLayers(a,l,h)}this.updateSourceCaches(),this._updateTilesForChangedImages(),this.updateLayers(t),this.light&amp;&amp;this.light.updateTransitions(t),this.ambientLight&amp;&amp;this.ambientLight.updateTransitions(t),this.directionalLight&amp;&amp;this.directionalLight.updateTransitions(t),this.fog&amp;&amp;this.fog.updateTransitions(t),this._changes.reset()}const n={};for(const s in this._mergedSourceCaches){const a=this._mergedSourceCaches[s];n[s]=a.used,a.used=!1}for(const s of this._mergedOrder){const a=this._mergedLayers[s];if(a.recalculate(t,this._availableImages),!a.isHidden(t.zoom)){const l=this.getLayerSourceCache(a);l&amp;&amp;(l.used=!0)}if(!this._precompileDone&amp;&amp;this._shouldPrecompile)for(let l=a.minzoom||0;l&lt;(a.maxzoom||25.5);l++){const h=this.map.painter;if(h){const d=a.getProgramIds();if(!d)continue;for(const f of d){const m=a.getDefaultProgramParams(f,t.zoom);m&amp;&amp;(h.style=this,this.fog&amp;&amp;(h._fogVisible=!0,m.overrideFog=!0,h.getOrCreateProgram(f,m)),h._fogVisible=!1,m.overrideFog=!1,h.getOrCreateProgram(f,m),(this.stylesheet.terrain||this.stylesheet.projection&amp;&amp;this.stylesheet.projection.name==="globe")&amp;&amp;(m.overrideRtt=!0,h.getOrCreateProgram(f,m)))}}}}this._shouldPrecompile&amp;&amp;(this._precompileDone=!0);for(const s in n){const a=this._mergedSourceCaches[s];n[s]!==a.used&amp;&amp;a.getSource().fire(new It("data",{sourceDataType:"visibility",dataType:"source",sourceId:a.getSource().id}))}this.light&amp;&amp;this.light.recalculate(t),this.terrain&amp;&amp;this.terrain.recalculate(t),this.fog&amp;&amp;this.fog.recalculate(t),this.z=t.zoom,this._markersNeedUpdate&amp;&amp;(this._updateMarkersOpacity(),this._markersNeedUpdate=!1),r&amp;&amp;this.fire(new It("data",{dataType:"style"}))}_updateTilesForChangedImages(){const t=this._changes.getUpdatedImages();if(t.length){for(const i in this._sourceCaches)this._sourceCaches[i].reloadTilesForDependencies(["icons","patterns"],t);this._changes.resetUpdatedImages()}}_updateWorkerLayers(t,i,r){const n=this.getFragmentStyle(t);n&amp;&amp;this.dispatcher.broadcast("updateLayers",{layers:i?n._serializeLayers(i):[],scope:t,removedIds:r||[],options:n.options})}setState(t){if(this._checkLoaded(),iu(this,Xa(t)))return!1;(t=V(t)).layers=iT(t.layers);const i=function(n,s){if(!n)return[{command:Xe.setStyle,args:[s]}];let a=[];try{if(!Lt(n.version,s.version))return[{command:Xe.setStyle,args:[s]}];Lt(n.center,s.center)||a.push({command:Xe.setCenter,args:[s.center]}),Lt(n.zoom,s.zoom)||a.push({command:Xe.setZoom,args:[s.zoom]}),Lt(n.bearing,s.bearing)||a.push({command:Xe.setBearing,args:[s.bearing]}),Lt(n.pitch,s.pitch)||a.push({command:Xe.setPitch,args:[s.pitch]}),Lt(n.sprite,s.sprite)||a.push({command:Xe.setSprite,args:[s.sprite]}),Lt(n.glyphs,s.glyphs)||a.push({command:Xe.setGlyphs,args:[s.glyphs]}),Lt(n.imports,s.imports)||function(m=[],_=[],y){_=_||[];const x=(m=m||[]).map(wd),b=_.map(wd),w=m.reduce(Td,{}),T=_.reduce(Td,{}),S=x.slice();let I,P,M,C;for(I=0,P=0;I&lt;x.length;I++)M=x[I],T.hasOwnProperty(M)?P++:(y.push({command:Xe.removeImport,args:[M]}),S.splice(S.indexOf(M,P),1));for(I=0,P=0;I&lt;b.length;I++)M=b[b.length-1-I],S[S.length-1-I]!==M&amp;&amp;(w.hasOwnProperty(M)?(y.push({command:Xe.removeImport,args:[M]}),S.splice(S.lastIndexOf(M,S.length-P),1)):P++,C=S[S.length-I],y.push({command:Xe.addImport,args:[T[M],C]}),S.splice(S.length-I,0,M));for(const D of _){const O=w[D.id];if(!O||Lt(O,D))continue;Lt(O.config,D.config)||y.push({command:Xe.setImportConfig,args:[D.id,D.config]}),Lt(O.url,D.url)||y.push({command:Xe.setImportUrl,args:[D.id,D.url]});const k=D.data;Lt(O&amp;&amp;O.data,k)||y.push({command:Xe.setImportData,args:[D.id,k]})}}(n.imports,s.imports,a),Lt(n.transition,s.transition)||a.push({command:Xe.setTransition,args:[s.transition]}),Lt(n.light,s.light)||a.push({command:Xe.setLight,args:[s.light]}),Lt(n.fog,s.fog)||a.push({command:Xe.setFog,args:[s.fog]}),Lt(n.projection,s.projection)||a.push({command:Xe.setProjection,args:[s.projection]}),Lt(n.lights,s.lights)||a.push({command:Xe.setLights,args:[s.lights]}),Lt(n.camera,s.camera)||a.push({command:Xe.setCamera,args:[s.camera]});const l={},h=[];(function(m,_,y,x){let b;for(b in _=_||{},m=m||{})m.hasOwnProperty(b)&amp;&amp;(_.hasOwnProperty(b)||nT(b,y,x));for(b in _){if(!_.hasOwnProperty(b))continue;const w=_[b];m.hasOwnProperty(b)?Lt(m[b],w)||(m[b].type==="geojson"&amp;&amp;w.type==="geojson"&amp;&amp;XR(m,_,b)?y.push({command:Xe.setGeoJSONSourceData,args:[b,w.data]}):$R(b,_,y,x)):rT(b,_,y)}})(n.sources,s.sources,h,l);const d=[];n.layers&amp;&amp;n.layers.forEach(m=&gt;{m.source&amp;&amp;l[m.source]?a.push({command:Xe.removeLayer,args:[m.id]}):d.push(m)});let f=n.terrain;f&amp;&amp;l[f.source]&amp;&amp;(a.push({command:Xe.setTerrain,args:[void 0]}),f=void 0),a=a.concat(h),Lt(f,s.terrain)||a.push({command:Xe.setTerrain,args:[s.terrain]}),function(m,_,y){_=_||[];const x=(m=m||[]).map(wd),b=_.map(wd),w=m.reduce(Td,{}),T=_.reduce(Td,{}),S=x.slice(),I=Object.create(null);let P,M,C,D,O,k,z;for(P=0,M=0;P&lt;x.length;P++)C=x[P],T.hasOwnProperty(C)?M++:(y.push({command:Xe.removeLayer,args:[C]}),S.splice(S.indexOf(C,M),1));for(P=0,M=0;P&lt;b.length;P++)C=b[b.length-1-P],S[S.length-1-P]!==C&amp;&amp;(w.hasOwnProperty(C)?(y.push({command:Xe.removeLayer,args:[C]}),S.splice(S.lastIndexOf(C,S.length-M),1)):M++,k=S[S.length-P],y.push({command:Xe.addLayer,args:[T[C],k]}),S.splice(S.length-P,0,C),I[C]=!0);for(P=0;P&lt;b.length;P++)if(C=b[P],D=w[C],O=T[C],!I[C]&amp;&amp;!Lt(D,O))if(Lt(D.source,O.source)&amp;&amp;Lt(D["source-layer"],O["source-layer"])&amp;&amp;Lt(D.type,O.type)){for(z in bd(D.layout,O.layout,y,C,null,Xe.setLayoutProperty),bd(D.paint,O.paint,y,C,null,Xe.setPaintProperty),Lt(D.slot,O.slot)||y.push({command:Xe.setSlot,args:[C,O.slot]}),Lt(D.filter,O.filter)||y.push({command:Xe.setFilter,args:[C,O.filter]}),Lt(D.minzoom,O.minzoom)&amp;&amp;Lt(D.maxzoom,O.maxzoom)||y.push({command:Xe.setLayerZoomRange,args:[C,O.minzoom,O.maxzoom]}),D)D.hasOwnProperty(z)&amp;&amp;z!=="layout"&amp;&amp;z!=="paint"&amp;&amp;z!=="filter"&amp;&amp;z!=="metadata"&amp;&amp;z!=="minzoom"&amp;&amp;z!=="maxzoom"&amp;&amp;z!=="slot"&amp;&amp;(z.indexOf("paint.")===0?bd(D[z],O[z],y,C,z.slice(6),Xe.setPaintProperty):Lt(D[z],O[z])||y.push({command:Xe.setLayerProperty,args:[C,z,O[z]]}));for(z in O)O.hasOwnProperty(z)&amp;&amp;!D.hasOwnProperty(z)&amp;&amp;z!=="layout"&amp;&amp;z!=="paint"&amp;&amp;z!=="filter"&amp;&amp;z!=="metadata"&amp;&amp;z!=="minzoom"&amp;&amp;z!=="maxzoom"&amp;&amp;z!=="slot"&amp;&amp;(z.indexOf("paint.")===0?bd(D[z],O[z],y,C,z.slice(6),Xe.setPaintProperty):Lt(D[z],O[z])||y.push({command:Xe.setLayerProperty,args:[C,z,O[z]]}))}else y.push({command:Xe.removeLayer,args:[C]}),k=S[S.lastIndexOf(C)+1],y.push({command:Xe.addLayer,args:[O,k]})}(d,s.layers,a)}catch(l){console.warn("Unable to compute style diff:",l),a=[{command:Xe.setStyle,args:[s]}]}return a}(this.serialize(),t).filter(n=&gt;!(n.command in wO));if(i.length===0)return!1;const r=i.filter(n=&gt;!(n.command in bO));if(r.length&gt;0)throw new Error(`Unimplemented: ${r.map(n=&gt;n.command).join(", ")}.`);return i.forEach(n=&gt;{this[n.command].apply(this,n.args)}),this.stylesheet=t,this.mergeAll(),this.dispatcher.broadcast("setLayers",{layers:this._serializeLayers(this._order),scope:this.scope,options:this.options}),!0}addImage(t,i){return this.getImage(t)?this.fire(new xe(new Error("An image with this name already exists."))):(this.imageManager.addImage(t,this.scope,i),this._afterImageUpdated(t),this)}updateImage(t,i){this.imageManager.updateImage(t,this.scope,i)}getImage(t){return this.imageManager.getImage(t,this.scope)}removeImage(t){return this.getImage(t)?(this.imageManager.removeImage(t,this.scope),this._afterImageUpdated(t),this):this.fire(new xe(new Error("No image with this name exists.")))}_afterImageUpdated(t){this._availableImages=this.imageManager.listImages(this.scope),this._changes.updateImage(t),this.dispatcher.broadcast("setImages",{scope:this.scope,images:this._availableImages}),this.fire(new It("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this._availableImages.slice()}addModel(t,i,r={}){return this._checkLoaded(),this._validate(JI,`models.${t}`,i,null,r)||(this.modelManager.addModel(t,i,this.scope),this._changes.setDirty()),this}hasModel(t){return this.modelManager.hasModel(t,this.scope)}removeModel(t){return this.hasModel(t)?(this.modelManager.removeModel(t,this.scope),this):this.fire(new xe(new Error("No model with this ID exists.")))}listModels(){return this._checkLoaded(),this.modelManager.listModels(this.scope)}addSource(t,i,r={}){if(this._checkLoaded(),this.getOwnSource(t)!==void 0)throw new Error(`There is already a source with ID "${t}".`);if(!i.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(i).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(i.type)&gt;=0&amp;&amp;this._validate(HI,`sources.${t}`,i,null,r))return;this.map&amp;&amp;this.map._collectResourceTiming&amp;&amp;(i.collectResourceTiming=!0);const n=U_(t,i,this.dispatcher,this);n.scope=this.scope,n.setEventedParent(this,()=&gt;({isSourceLoaded:this._isSourceCacheLoaded(n.id),source:n.serialize(),sourceId:n.id}));const s=a=&gt;{const l=(a?"symbol:":"other:")+n.id,h=Mr(l,this.scope),d=this._sourceCaches[l]=new $n(h,n,a);(a?this._symbolSourceCaches:this._otherSourceCaches)[n.id]=d,d.onAdd(this.map)};s(!1),i.type!=="vector"&amp;&amp;i.type!=="geojson"||s(!0),n.onAdd&amp;&amp;n.onAdd(this.map),r.isInitialLoad||(this.mergeSources(),this._changes.setDirty())}removeSource(t){this._checkLoaded();const i=this.getOwnSource(t);if(!i)throw new Error("There is no source with this ID");for(const n in this._layers)if(this._layers[n].source===t)return this.fire(new xe(new Error(`Source "${t}" cannot be removed while layer "${n}" is using it.`)));if(this.terrain&amp;&amp;this.terrain.scope===this.scope&amp;&amp;this.terrain.get().source===t)return this.fire(new xe(new Error(`Source "${t}" cannot be removed while terrain is using it.`)));const r=this.getOwnSourceCaches(t);for(const n of r){const s=lh(n.id);delete this._sourceCaches[s],this._changes.discardSourceCacheUpdate(n.id),n.fire(new It("data",{sourceDataType:"metadata",dataType:"source",sourceId:n.getSource().id})),n.setEventedParent(null),n.clearTiles()}return delete this._otherSourceCaches[t],delete this._symbolSourceCaches[t],this.mergeSources(),i.setEventedParent(null),i.onRemove&amp;&amp;i.onRemove(this.map),this._changes.setDirty(),this}setGeoJSONSourceData(t,i){this._checkLoaded(),this.getOwnSource(t).setData(i),this._changes.setDirty()}getOwnSource(t){const i=this.getOwnSourceCache(t);return i&amp;&amp;i.getSource()}getOwnSources(){const t=[];for(const i in this._otherSourceCaches){const r=this.getOwnSourceCache(i);r&amp;&amp;t.push(r.getSource())}return t}setLights(t){if(this._checkLoaded(),!t)return delete this.ambientLight,void delete this.directionalLight;const i=this._getTransitionParameters();for(const n of t){if(this._validate(qI,"lights",n))return;switch(n.type){case"ambient":if(this.ambientLight){const s=this.ambientLight;s.set(n),s.updateTransitions(i)}else this.ambientLight=new zw(n,PR,this.scope,this.options);break;case"directional":if(this.directionalLight){const s=this.directionalLight;s.set(n),s.updateTransitions(i)}else this.directionalLight=new zw(n,CR,this.scope,this.options)}}const r=new Si(this.z||0,i);this.ambientLight&amp;&amp;this.ambientLight.recalculate(r),this.directionalLight&amp;&amp;this.directionalLight.recalculate(r),this._brightness=this.calculateLightsBrightness(),this.dispatcher.broadcast("setBrightness",this._brightness)}calculateLightsBrightness(){const t=this.directionalLight,i=this.ambientLight;if(!t||!i)return;const r=m=&gt;.2126*(m[0]&lt;=.03928?m[0]/12.92:Math.pow((m[0]+.055)/1.055,2.4))+.7152*(m[1]&lt;=.03928?m[1]/12.92:Math.pow((m[1]+.055)/1.055,2.4))+.0722*(m[2]&lt;=.03928?m[2]/12.92:Math.pow((m[2]+.055)/1.055,2.4)),n=t.properties.get("color").toArray01(),s=t.properties.get("intensity"),a=t.properties.get("direction"),l=1-te(a.x,a.y,a.z)[2]/90,h=r(n)*s*l,d=i.properties.get("color").toArray01(),f=i.properties.get("intensity");return(h+r(d)*f)/2}getBrightness(){return this._brightness}getLights(){if(!this.enable3dLights())return null;const t=[];return this.directionalLight&amp;&amp;t.push(this.directionalLight.get()),this.ambientLight&amp;&amp;t.push(this.ambientLight.get()),t}enable3dLights(){return!!this.ambientLight&amp;&amp;!!this.directionalLight}getFragmentStyle(t){if(!t)return this;if(cx(t)){const i=function(s){const a=s.indexOf(ah);return a&gt;=0?s.slice(a+1):""}(t),r=this.fragments.find(({id:s})=&gt;s===i);if(!r)throw new Error(`Style import not found: ${t}`);const n=lh(t);return r.style.getFragmentStyle(n)}{const i=this.fragments.find(({id:r})=&gt;r===t);if(!i)throw new Error(`Style import not found: ${t}`);return i.style}}getConfigProperty(t,i){const r=this.getFragmentStyle(t);if(!r)return null;const n=r.options.get(i),s=n?n.value||n.default:null;return s?s.serialize():null}setConfigProperty(t,i,r){const n=fo(r);if(n.result!=="success")return void iu(this,n.value);const s=n.value.expression,a=this.getFragmentStyle(t);if(!a)return;const l=a.options.get(i);l&amp;&amp;(a.options.set(i,{...l,value:s}),a.updateConfigDependencies())}setConfig(t,i){if(this._config=t,t||i)if(i){this.options.clear();for(const r in i){let n,s;const a=fo(i[r].default);if(a.result==="success"&amp;&amp;(n=a.value.expression),t&amp;&amp;t[r]!==void 0){const _=fo(t[r]);_.result==="success"&amp;&amp;(s=_.value.expression)}const{minValue:l,maxValue:h,stepValue:d,type:f,values:m}=i[r];n?this.options.set(r,{default:n,value:s,minValue:l,maxValue:h,stepValue:d,type:f,values:m}):this.fire(new xe(new Error(`No schema defined for config option "${r}".`)))}}else this.fire(new xe(new Error("Attempting to set config for a style without schema.")))}updateConfigDependencies(){for(const t of this._configDependentLayers){const i=this.getLayer(t);i&amp;&amp;(i.possiblyEvaluateVisibility(),this._updateLayer(i))}this.ambientLight&amp;&amp;this.ambientLight.scope===this.scope&amp;&amp;this.ambientLight.updateConfig(this.options),this.directionalLight&amp;&amp;this.directionalLight.scope===this.scope&amp;&amp;this.directionalLight.updateConfig(this.options),this._changes.setDirty()}addLayer(t,i,r={}){this._checkLoaded();const n=t.id;if(this._layers[n])return void this.fire(new xe(new Error(`Layer with id "${n}" already exists on this map`)));let s;if(t.type==="custom"){if(iu(this,function(f){const m=[],_=f.id;return _===void 0&amp;&amp;m.push({message:`layers.${_}: missing required property "id"`}),f.render===void 0&amp;&amp;m.push({message:`layers.${_}: missing required method "render"`}),f.renderingMode&amp;&amp;f.renderingMode!=="2d"&amp;&amp;f.renderingMode!=="3d"&amp;&amp;m.push({message:`layers.${_}: property "renderingMode" must be either "2d" or "3d"`}),m}(t)))return;s=gd(t,this.options)}else{if(typeof t.source=="object"&amp;&amp;(this.addSource(n,t.source),t=Bt(t=V(t),{source:n})),this._validate(XI,`layers.${n}`,t,{arrayIndex:-1},r))return;s=gd(t,this.options),this._validateLayer(s),s.setEventedParent(this,{layer:{id:n}}),this._serializedLayers[s.id]=s.serialize()}s.isConfigDependent&amp;&amp;this._configDependentLayers.add(s.fqid),s.setScope(this.scope);let a=this._order.length;if(i){const f=this._order.indexOf(i);if(f===-1)return void this.fire(new xe(new Error(`Layer with id "${i}" does not exist on this map.`)));s.slot===this._layers[i].slot?a=f:tt(`Layer with id "${i}" has a different slot. Layers can only be rearranged within the same slot.`)}this._order.splice(a,0,n),this._layerOrderChanged=!0,this._layers[n]=s;const l=this.getOwnLayerSourceCache(s),h=!!this.directionalLight&amp;&amp;this.directionalLight.shadowsEnabled();l&amp;&amp;s.canCastShadows()&amp;&amp;h&amp;&amp;(l.castsShadows=!0);const d=this._changes.getRemovedLayer(s);if(d&amp;&amp;s.source&amp;&amp;l&amp;&amp;s.type!=="custom"){this._changes.discardLayerRemoval(s);const f=Mr(s.source,s.scope);d.type!==s.type?this._changes.updateSourceCache(f,"clear"):(this._changes.updateSourceCache(f,"reload"),l.pause())}this._updateLayer(s),s.onAdd&amp;&amp;s.onAdd(this.map),s.scope=this.scope,this.mergeLayers()}moveLayer(t,i){this._checkLoaded();const r=this._checkLayer(t);if(!r||t===i)return;const n=this._order.indexOf(t);this._order.splice(n,1);let s=this._order.length;if(i){const a=this._order.indexOf(i);if(a===-1)return void this.fire(new xe(new Error(`Layer with id "${i}" does not exist on this map.`)));r.slot===this._layers[i].slot?s=a:tt(`Layer with id "${i}" has a different slot. Layers can only be rearranged within the same slot.`)}this._order.splice(s,0,t),this._changes.setDirty(),this._layerOrderChanged=!0,this.mergeLayers()}removeLayer(t){this._checkLoaded();const i=this._checkLayer(t);if(!i)return;i.setEventedParent(null);const r=this._order.indexOf(t);this._order.splice(r,1),delete this._layers[t],delete this._serializedLayers[t],this._changes.setDirty(),this._layerOrderChanged=!0,this._configDependentLayers.delete(i.fqid),this._changes.removeLayer(i);const n=this.getOwnLayerSourceCache(i);if(n&amp;&amp;n.castsShadows){let s=!1;for(const a in this._layers)if(this._layers[a].source===i.source&amp;&amp;this._layers[a].canCastShadows()){s=!0;break}n.castsShadows=s}i.onRemove&amp;&amp;i.onRemove(this.map),this.mergeLayers()}getOwnLayer(t){return this._layers[t]}hasLayer(t){return t in this._mergedLayers}hasLayerType(t){for(const i in this._layers)if(this._layers[i].type===t)return!0;return!1}setLayerZoomRange(t,i,r){this._checkLoaded();const n=this._checkLayer(t);n&amp;&amp;(n.minzoom===i&amp;&amp;n.maxzoom===r||(i!=null&amp;&amp;(n.minzoom=i),r!=null&amp;&amp;(n.maxzoom=r),this._updateLayer(n)))}setSlot(t,i){this._checkLoaded();const r=this._checkLayer(t);r&amp;&amp;r.slot!==i&amp;&amp;(r.slot=i,this._updateLayer(r))}setFilter(t,i,r={}){this._checkLoaded();const n=this._checkLayer(t);if(n&amp;&amp;!Lt(n.filter,i))return i==null?(n.filter=void 0,void this._updateLayer(n)):void(this._validate(Op,`layers.${n.id}.filter`,i,{layerType:n.type},r)||(n.filter=V(i),this._updateLayer(n)))}getFilter(t){const i=this._checkLayer(t);if(i)return V(i.filter)}setLayoutProperty(t,i,r,n={}){this._checkLoaded();const s=this._checkLayer(t);s&amp;&amp;(Lt(s.getLayoutProperty(i),r)||(s.setLayoutProperty(i,r,n),s.isConfigDependent&amp;&amp;this._configDependentLayers.add(s.fqid),this._updateLayer(s)))}getLayoutProperty(t,i){const r=this._checkLayer(t);if(r)return r.getLayoutProperty(i)}setPaintProperty(t,i,r,n={}){this._checkLoaded();const s=this._checkLayer(t);if(!s||Lt(s.getPaintProperty(i),r))return;const a=s.setPaintProperty(i,r,n);s.isConfigDependent&amp;&amp;this._configDependentLayers.add(s.fqid),a&amp;&amp;this._updateLayer(s),this._changes.updatePaintProperties(s)}getPaintProperty(t,i){const r=this._checkLayer(t);if(r)return r.getPaintProperty(i)}setFeatureState(t,i){this._checkLoaded();const r=t.source,n=t.sourceLayer,s=this._checkSource(r);if(!s)return;const a=s.type;if(a==="geojson"&amp;&amp;n)return void this.fire(new xe(new Error("GeoJSON sources cannot have a sourceLayer parameter.")));if(a==="vector"&amp;&amp;!n)return void this.fire(new xe(new Error("The sourceLayer parameter must be provided for vector source types.")));t.id===void 0&amp;&amp;this.fire(new xe(new Error("The feature id parameter must be provided.")));const l=this.getOwnSourceCaches(r);for(const h of l)h.setFeatureState(n,t.id,i)}removeFeatureState(t,i){this._checkLoaded();const r=t.source,n=this._checkSource(r);if(!n)return;const s=n.type,a=s==="vector"?t.sourceLayer:void 0;if(s==="vector"&amp;&amp;!a)return void this.fire(new xe(new Error("The sourceLayer parameter must be provided for vector source types.")));if(i&amp;&amp;typeof t.id!="string"&amp;&amp;typeof t.id!="number")return void this.fire(new xe(new Error("A feature id is required to remove its specific state property.")));const l=this.getOwnSourceCaches(r);for(const h of l)h.removeFeatureState(a,t.id,i)}getFeatureState(t){this._checkLoaded();const i=t.source,r=t.sourceLayer,n=this._checkSource(i);if(n){if(n.type!=="vector"||r)return t.id===void 0&amp;&amp;this.fire(new xe(new Error("The feature id parameter must be provided."))),this.getOwnSourceCaches(i)[0].getFeatureState(r,t.id);this.fire(new xe(new Error("The sourceLayer parameter must be provided for vector source types.")))}}setTransition(t){return this.stylesheet.transition=Bt({},this.stylesheet.transition,t),this.transition=this.stylesheet.transition,this}getTransition(){return Bt({},this.stylesheet.transition)}serialize(){this._checkLoaded();const t=this.getTerrain(),i=t&amp;&amp;this.terrain&amp;&amp;this.terrain.scope===this.scope?t:this.stylesheet.terrain;return Mt({version:this.stylesheet.version,name:this.stylesheet.name,metadata:this.stylesheet.metadata,imports:this._serializeImports(),schema:this.stylesheet.schema,camera:this.stylesheet.camera,light:this.stylesheet.light,lights:this.stylesheet.lights,terrain:i,fog:this.stylesheet.fog,center:this.stylesheet.center,zoom:this.stylesheet.zoom,bearing:this.stylesheet.bearing,pitch:this.stylesheet.pitch,sprite:this.stylesheet.sprite,glyphs:this.stylesheet.glyphs,transition:this.stylesheet.transition,projection:this.stylesheet.projection,sources:this._serializeSources(),layers:this._serializeLayers(this._order)},r=&gt;r!==void 0)}_updateLayer(t){this._changes.updateLayer(t);const i=this.getLayerSourceCache(t),r=Mr(t.source,t.scope),n=this._changes.getUpdatedSourceCaches();t.source&amp;&amp;!n[r]&amp;&amp;i&amp;&amp;i.getSource().type!=="raster"&amp;&amp;(this._changes.updateSourceCache(r,"reload"),i.pause()),t.invalidateCompiledFilter()}_flattenAndSortRenderedFeatures(t){const i=l=&gt;this._mergedLayers[l].type==="fill-extrusion",r=this.order,n={},s=[];for(let l=r.length-1;l&gt;=0;l--){const h=r[l];if(i(h)){n[h]=l;for(const d of t){const f=d[h];if(f)for(const m of f)s.push(m)}}}s.sort((l,h)=&gt;h.intersectionZ-l.intersectionZ);const a=[];for(let l=r.length-1;l&gt;=0;l--){const h=r[l];if(i(h))for(let d=s.length-1;d&gt;=0;d--){const f=s[d].feature;if(n[f.layer.id]&lt;l)break;a.push(f),s.pop()}else for(const d of t){const f=d[h];if(f)for(const m of f)a.push(m.feature)}}return a}queryRenderedFeatures(t,i,r){i&amp;&amp;i.filter&amp;&amp;this._validate(Op,"queryRenderedFeatures.filter",i.filter,null,i),i.scope=this.scope,i.availableImages=this._availableImages,i.serializedLayers=this._serializedLayers;const n={};if(i&amp;&amp;i.layers){if(!Array.isArray(i.layers))return this.fire(new xe(new Error("parameters.layers must be an Array."))),[];for(const d of i.layers){const f=this._mergedLayers[d];if(!f)return this.fire(new xe(new Error(`The layer '${d}' does not exist in the map's style and cannot be queried for features.`))),[];n[f.source]=!0}}const s=[],a=i.serializedLayers||{},l=i&amp;&amp;i.layers?i.layers.some(d=&gt;{const f=this.getLayer(d);return f&amp;&amp;f.is3D()}):this.has3DLayers(),h=S_.createFromScreenPoints(t,r);for(const d in this._mergedSourceCaches){const f=this._mergedSourceCaches[d].getSource();if(!f||f.scope!==i.scope)continue;const m=this._mergedSourceCaches[d].getSource().id;i.layers&amp;&amp;!n[m]||s.push(HR(this._mergedSourceCaches[d],this._mergedLayers,a,h,i,r,l,!!this.map._showQueryGeometry))}return this.placement&amp;&amp;s.push(function(d,f,m,_,y,x,b){const w={},T=x.queryRenderedSymbols(_),S=[];for(const I of Object.keys(T).map(Number))S.push(b[I]);S.sort(tT);for(const I of S){const P=I.featureIndex.lookupSymbolFeatures(T[I.bucketInstanceId],f,I.bucketIndex,I.sourceLayerIndex,y.filter,y.layers,y.availableImages,d);for(const M in P){const C=w[M]=w[M]||[],D=P[M];D.sort((O,k)=&gt;{const z=I.featureSortOrder;if(z){const B=z.indexOf(O.featureIndex);return z.indexOf(k.featureIndex)-B}return k.featureIndex-O.featureIndex});for(const O of D)C.push(O)}}for(const I in w)w[I].forEach(P=&gt;{const M=P.feature,C=m(d[I]);if(!C)return;const D=C.getFeatureState(M.layer["source-layer"],M.id);M.source=M.layer.source,M.layer["source-layer"]&amp;&amp;(M.sourceLayer=M.layer["source-layer"]),M.state=D});return w}(this._mergedLayers,a,this.getLayerSourceCache.bind(this),h.screenGeometry,i,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(s)}querySourceFeatures(t,i){i&amp;&amp;i.filter&amp;&amp;this._validate(Op,"querySourceFeatures.filter",i.filter,null,i);const r=this.getOwnSourceCaches(t);let n=[];for(const s of r)n=n.concat(WR(s,i));return n}addSourceType(t,i,r){return Kn.getSourceType(t)?r(new Error(`A source type called "${t}" already exists.`)):(Kn.setSourceType(t,i),i.workerSourceURL?void this.dispatcher.broadcast("loadWorkerSource",{name:t,url:i.workerSourceURL},r):r(null,null))}getFlatLight(){return this.light.getLight()}setFlatLight(t,i,r={}){this._checkLoaded();const n=this.light.getLight();let s=!1;for(const l in t)if(!Lt(t[l],n[l])){s=!0;break}if(!s)return;const a=this._getTransitionParameters();this.light.setLight(t,i,r),this.light.updateTransitions(a)}getTerrain(){return this.terrain&amp;&amp;this.terrain.drapeRenderMode===1?this.terrain.get():null}setTerrainForDraping(){this.setTerrain({source:"",exaggeration:0},0)}setTerrain(t,i=1){if(this._checkLoaded(),!t)return delete this.terrain,t===null?this.stylesheet.terrain=null:delete this.stylesheet.terrain,this._force3DLayerUpdate(),void(this._markersNeedUpdate=!0);let r=t;const n=t.source==null;if(i===1){if(typeof r.source=="object"){const l="terrain-dem-src";this.addSource(l,r.source),r=V(r),r=Bt(r,{source:l})}const s=Bt({},r),a={};if(this.terrain&amp;&amp;n){s.source=this.terrain.get().source;const l=this.terrain?this.getFragmentStyle(this.terrain.scope):null;l&amp;&amp;(a.style=l.serialize())}if(this._validate(ZI,"terrain",s,a))return}if(!this.terrain||this.terrain.scope!==this.scope&amp;&amp;!n||this.terrain&amp;&amp;i!==this.terrain.drapeRenderMode){if(!r)return;this._createTerrain(r,i),this.fire(new It("data",{dataType:"style"}))}else{const s=this.terrain,a=s.get();for(const l of Object.keys(st.terrain))!r.hasOwnProperty(l)&amp;&amp;st.terrain[l].default&amp;&amp;(r[l]=st.terrain[l].default);for(const l in t)if(!Lt(t[l],a[l])){s.set(t,this.options),this.stylesheet.terrain=t;const h=this._getTransitionParameters({duration:0});s.updateTransitions(h),this.fire(new It("data",{dataType:"style"}));break}}this.mergeTerrain(),this.updateDrapeFirstLayers(),this._markersNeedUpdate=!0}_createFog(t){const i=this.fog=new AR(t,this.map.transform);this.stylesheet.fog=i.get();const r=this._getTransitionParameters({duration:0});i.updateTransitions(r)}_updateMarkersOpacity(){this.map._markers.length!==0&amp;&amp;this.map._requestDomTask(()=&gt;{for(const t of this.map._markers)t._evaluateOpacity()})}getFog(){return this.fog?this.fog.get():null}setFog(t){if(this._checkLoaded(),!t)return delete this.fog,delete this.stylesheet.fog,void(this._markersNeedUpdate=!0);if(this.fog){const i=this.fog;if(!Lt(i.get(),t)){i.set(t),this.stylesheet.fog=i.get();const r=this._getTransitionParameters({duration:0});i.updateTransitions(r)}}else this._createFog(t);this._markersNeedUpdate=!0}_getTransitionParameters(t){return{now:_e.now(),transition:Bt(this.transition,t)}}updateDrapeFirstLayers(){if(!this.terrain)return;const t=[],i=[];for(const r in this._mergedLayers)this.isLayerDraped(this._mergedLayers[r])?t.push(r):i.push(r);this._drapedFirstOrder=[],this._drapedFirstOrder.push(...t),this._drapedFirstOrder.push(...i)}_createTerrain(t,i){const r=this.terrain=new ER(t,i,this.scope,this.options);i===1&amp;&amp;(this.stylesheet.terrain=t),this.mergeTerrain(),this.updateDrapeFirstLayers(),this._force3DLayerUpdate();const n=this._getTransitionParameters({duration:0});r.updateTransitions(n)}_force3DLayerUpdate(){for(const t in this._layers){const i=this._layers[t];i.type==="fill-extrusion"&amp;&amp;this._updateLayer(i)}}_forceSymbolLayerUpdate(){for(const t in this._layers){const i=this._layers[t];i.type==="symbol"&amp;&amp;this._updateLayer(i)}}_validate(t,i,r,n,s={}){if(s&amp;&amp;s.validate===!1)return!1;const a=Bt({},this.serialize());return iu(this,t.call(Xa,Bt({key:i,style:a,value:r,styleSpec:st},n)))}_remove(){this._request&amp;&amp;(this._request.cancel(),this._request=null),this._spriteRequest&amp;&amp;(this._spriteRequest.cancel(),this._spriteRequest=null),jp.off("pluginStateChange",this._rtlTextPluginCallback);for(const t in this._mergedLayers)this._mergedLayers[t].setEventedParent(null);for(const t in this._mergedSourceCaches)this._mergedSourceCaches[t].clearTiles(),this._mergedSourceCaches[t].setEventedParent(null);this.setEventedParent(null),delete this.fog,delete this.terrain,delete this.ambientLight,delete this.directionalLight,this.isRootStyle()&amp;&amp;(this.imageManager.setEventedParent(null),this.modelManager.setEventedParent(null),this.dispatcher.remove())}clearSource(t){const i=this.getSourceCaches(t);for(const r of i)r.clearTiles()}clearSources(){for(const t in this._mergedSourceCaches)this._mergedSourceCaches[t].clearTiles()}reloadSource(t){const i=this.getSourceCaches(t);for(const r of i)r.resume(),r.reload()}reloadSources(){for(const t of this.getSources())t.reload&amp;&amp;t.reload()}updateSources(t){let i;this.directionalLight&amp;&amp;(i=rE(this.directionalLight));for(const r in this._mergedSourceCaches)this._mergedSourceCaches[r].update(t,void 0,void 0,i)}_generateCollisionBoxes(){for(const t in this._sourceCaches){const i=this._sourceCaches[t];i.resume(),i.reload()}}_updatePlacement(t,i,r,n,s=!1){let a=!1,l=!1;const h={},d={};for(const f of this._mergedOrder){const m=this._mergedLayers[f];if(m.type!=="symbol")continue;const _=Mr(m.source,m.scope);let y=h[_];if(!y){const b=this.getLayerSourceCache(m);if(!b)continue;const w=b.getRenderableIds(!0).map(T=&gt;b.getTileByID(T));d[_]=w.slice(),y=h[_]=w.sort((T,S)=&gt;S.tileID.overscaledZ-T.tileID.overscaledZ||(T.tileID.isLessThan(S.tileID)?-1:1))}const x=this.crossTileSymbolIndex.addLayer(m,y,t.center.lng,t.projection);a=a||x}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._mergedOrder),s=s||this._layerOrderChanged||r===0,this._layerOrderChanged&amp;&amp;this.fire(new It("neworder")),(s||!this.pauseablePlacement||this.pauseablePlacement.isDone()&amp;&amp;!this.placement.stillRecent(_e.now(),t.zoom))&amp;&amp;(this.pauseablePlacement=new hD(t,this._mergedOrder,s,i,r,n,this.placement,this.fog&amp;&amp;t.projection.supportsFog?this.fog.state:null,this._buildingIndex),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._mergedOrder,this._mergedLayers,h,d),this.pauseablePlacement.isDone()&amp;&amp;(this.placement=this.pauseablePlacement.commit(_e.now()),l=!0),a&amp;&amp;this.pauseablePlacement.placement.setStale()),l||a)for(const f of this._mergedOrder){const m=this._mergedLayers[f];m.type==="symbol"&amp;&amp;this.placement.updateLayerOpacities(m,h[Mr(m.source,m.scope)])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(_e.now())}_releaseSymbolFadeTiles(){for(const t in this._sourceCaches)this._sourceCaches[t].releaseSymbolFadeTiles()}addImport(t){this._checkLoaded();const i=this.stylesheet.imports=this.stylesheet.imports||[];return i.findIndex(({id:n})=&gt;n===t.id)!==-1?this.fire(new xe(new Error(`Import with id '${t.id}' already exists in the map's style.`))):(i.push(t),this._loadImports([t],!0),this)}setImportUrl(t,i){this._checkLoaded();const r=this.stylesheet.imports||[],n=this.getImportIndex(t);if(n===-1)return this;r[n].url=i;const s=this.fragments[n];return s.style=this._createFragmentStyle(r[n]),s.style.on("style.import.load",()=&gt;this.mergeAll()),s.style.loadURL(i),this}setImportData(t,i){this._checkLoaded();const r=this.getImportIndex(t),n=this.stylesheet.imports||[];return r===-1?this:i?(this.fragments[r].style.setState(i),this._reloadImports(),this):(delete n[r].data,this.setImportUrl(t,n[r].url))}setImportConfig(t,i){this._checkLoaded();const r=this.getImportIndex(t),n=this.stylesheet.imports||[];if(r===-1)return this;i?n[r].config=i:delete n[r].config;const s=this.fragments[r],a=s.style.stylesheet&amp;&amp;s.style.stylesheet.schema;return s.config=i,s.style.setConfig(i,a),s.style.updateConfigDependencies(),this}removeImport(t){this._checkLoaded();const i=this.stylesheet.imports||[],r=this.getImportIndex(t);return r===-1||(i.splice(r,1),this.fragments[r].style._remove(),this.fragments.splice(r,1),this._reloadImports()),this}getImportIndex(t){const i=(this.stylesheet.imports||[]).findIndex(r=&gt;r.id===t);return i===-1&amp;&amp;this.fire(new xe(new Error(`Import '${t}' does not exist in the map's style and cannot be updated.`))),i}getLayer(t){return this._mergedLayers[t]}getSources(){const t=[];for(const i in this._mergedOtherSourceCaches){const r=this._mergedOtherSourceCaches[i];r&amp;&amp;t.push(r.getSource())}return t}getSource(t,i){const r=this.getSourceCache(t,i);return r&amp;&amp;r.getSource()}getLayerSource(t){const i=this.getLayerSourceCache(t);return i&amp;&amp;i.getSource()}getSourceCache(t,i){const r=Mr(t,i);return this._mergedOtherSourceCaches[r]}getLayerSourceCache(t){const i=Mr(t.source,t.scope);return t.type==="symbol"?this._mergedSymbolSourceCaches[i]:this._mergedOtherSourceCaches[i]}getSourceCaches(t){const i=[];return this._mergedOtherSourceCaches[t]&amp;&amp;i.push(this._mergedOtherSourceCaches[t]),this._mergedSymbolSourceCaches[t]&amp;&amp;i.push(this._mergedSymbolSourceCaches[t]),i}updateSourceCaches(){const t=this._changes.getUpdatedSourceCaches();for(const i in t){const r=t[i];r==="reload"?this.reloadSource(i):r==="clear"&amp;&amp;this.clearSource(i)}}updateLayers(t){const i=this._changes.getUpdatedPaintProperties();for(const r of i){const n=this.getLayer(r);n&amp;&amp;n.updateTransitions(t)}}getImages(t,i,r){this.imageManager.getImages(i.icons,i.scope,r),this._updateTilesForChangedImages();const n=s=&gt;{s&amp;&amp;s.setDependencies(i.tileID.key,i.type,i.icons)};n(this._otherSourceCaches[i.source]),n(this._symbolSourceCaches[i.source])}getGlyphs(t,i,r){this.glyphManager.getGlyphs(i.stacks,i.scope,r)}getResource(t,i,r){return Ct(i,r)}getOwnSourceCache(t){return this._otherSourceCaches[t]}getOwnLayerSourceCache(t){return t.type==="symbol"?this._symbolSourceCaches[t.source]:this._otherSourceCaches[t.source]}getOwnSourceCaches(t){const i=[];return this._otherSourceCaches[t]&amp;&amp;i.push(this._otherSourceCaches[t]),this._symbolSourceCaches[t]&amp;&amp;i.push(this._symbolSourceCaches[t]),i}_isSourceCacheLoaded(t){const i=this.getOwnSourceCaches(t);return i.length===0?(this.fire(new xe(new Error(`There is no source with ID '${t}'`))),!1):i.every(r=&gt;r.loaded())}has3DLayers(){return this._has3DLayers}hasSymbolLayers(){return this._hasSymbolLayers}hasCircleLayers(){return this._hasCircleLayers}_clearWorkerCaches(){this.dispatcher.broadcast("clearCaches")}destroy(){this._clearWorkerCaches(),this.terrainSetForDrapingOnly()&amp;&amp;(delete this.terrain,delete this.stylesheet.terrain)}}function oE(e,t){let i=!1,r=null;const n=()=&gt;{r=null,i&amp;&amp;(e(),r=setTimeout(n,t),i=!1)};return()=&gt;(i=!0,r||n(),r)}Kn.getSourceType=function(e){return N_[e]},Kn.setSourceType=function(e,t){N_[e]=t},Kn.registerForPluginStateChange=function(e){return e({pluginStatus:Yr,pluginURL:_o}),jp.on("pluginStateChange",e),e};class EO{constructor(t){this._hashName=t&amp;&amp;encodeURIComponent(t),Oi(["_getCurrentHash","_onHashChange","_updateHash"],this),this._updateHash=oE(this._updateHashUnthrottled.bind(this),300)}addTo(t){return this._map=t,L.addEventListener("hashchange",this._onHashChange,!1),t.on("moveend",this._updateHash),this}remove(){return this._map?(this._map.off("moveend",this._updateHash),L.removeEventListener("hashchange",this._onHashChange,!1),clearTimeout(this._updateHash()),this._map=void 0,this):this}getHashString(){const t=this._map;if(!t)return"";const i=aE(t);if(this._hashName){const r=this._hashName;let n=!1;const s=L.location.hash.slice(1).split("&amp;").map(a=&gt;{const l=a.split("=")[0];return l===r?(n=!0,`${l}=${i}`):a}).filter(a=&gt;a);return n||s.push(`${r}=${i}`),`#${s.join("&amp;")}`}return`#${i}`}_getCurrentHash(){const t=L.location.hash.replace("#","");if(this._hashName){let i;return t.split("&amp;").map(r=&gt;r.split("=")).forEach(r=&gt;{r[0]===this._hashName&amp;&amp;(i=r)}),(i&amp;&amp;i[1]||"").split("/")}return t.split("/")}_onHashChange(){const t=this._map;if(!t)return!1;const i=this._getCurrentHash();if(i.length&gt;=3&amp;&amp;!i.some(r=&gt;isNaN(r))){const r=t.dragRotate.isEnabled()&amp;&amp;t.touchZoomRotate.isEnabled()?+(i[3]||0):t.getBearing();return t.jumpTo({center:[+i[2],+i[1]],zoom:+i[0],bearing:r,pitch:+(i[4]||0)}),!0}return!1}_updateHashUnthrottled(){const t=L.location.href.replace(/(#.+)?$/,this.getHashString());L.history.replaceState(L.history.state,null,t)}}function aE(e,t){const i=e.getCenter(),r=Math.round(100*e.getZoom())/100,n=Math.ceil((r*Math.LN2+Math.log(512/360/.5))/Math.LN10),s=Math.pow(10,n),a=Math.round(i.lng*s)/s,l=Math.round(i.lat*s)/s,h=e.getBearing(),d=e.getPitch();let f=t?`/${a}/${l}/${r}`:`${r}/${l}/${a}`;return(h||d)&amp;&amp;(f+="/"+Math.round(10*h)/10),d&amp;&amp;(f+=`/${Math.round(d)}`),f}const kd={linearity:.3,easing:Ls(0,0,.3,1)},SO=Bt({deceleration:2500,maxSpeed:1400},kd),AO=Bt({deceleration:20,maxSpeed:1400},kd),MO=Bt({deceleration:1e3,maxSpeed:360},kd),IO=Bt({deceleration:1e3,maxSpeed:90},kd);class PO{constructor(t){this._map=t,this.clear()}clear(){this._inertiaBuffer=[]}record(t){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:_e.now(),settings:t})}_drainInertiaBuffer(){const t=this._inertiaBuffer,i=_e.now();for(;t.length&gt;0&amp;&amp;i-t[0].time&gt;160;)t.shift()}_onMoveEnd(t){if(this._map._prefersReducedMotion()||(this._drainInertiaBuffer(),this._inertiaBuffer.length&lt;2))return;const i={zoom:0,bearing:0,pitch:0,pan:new Q(0,0),pinchAround:void 0,around:void 0};for(const{settings:s}of this._inertiaBuffer)i.zoom+=s.zoomDelta||0,i.bearing+=s.bearingDelta||0,i.pitch+=s.pitchDelta||0,s.panDelta&amp;&amp;i.pan._add(s.panDelta),s.around&amp;&amp;(i.around=s.around),s.pinchAround&amp;&amp;(i.pinchAround=s.pinchAround);const r=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,n={};if(i.pan.mag()){const s=Fd(i.pan.mag(),r,Bt({},SO,t||{}));n.offset=i.pan.mult(s.amount/i.pan.mag()),n.center=this._map.transform.center,zd(n,s)}if(i.zoom){const s=Fd(i.zoom,r,AO);n.zoom=this._map.transform.zoom+s.amount,zd(n,s)}if(i.bearing){const s=Fd(i.bearing,r,MO);n.bearing=this._map.transform.bearing+Xt(s.amount,-179,179),zd(n,s)}if(i.pitch){const s=Fd(i.pitch,r,IO);n.pitch=this._map.transform.pitch+s.amount,zd(n,s)}if(n.zoom||n.bearing){const s=i.pinchAround===void 0?i.around:i.pinchAround;n.around=s?this._map.unproject(s):this._map.getCenter()}return this.clear(),n.noMoveStart=!0,n}}function zd(e,t){(!e.duration||e.duration&lt;t.duration)&amp;&amp;(e.duration=t.duration,e.easing=t.easing)}function Fd(e,t,i){const{maxSpeed:r,linearity:n,deceleration:s}=i,a=Xt(e*n/(t/1e3),-r,r),l=Math.abs(a)/(s*n);return{easing:i.easing,duration:1e3*l,amount:a*(l/2)}}class mn extends It{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,i,r,n={}){const s=$e(i.getCanvasContainer(),r);super(t,Bt({point:s,lngLat:i.unproject(s),originalEvent:r},n)),this._defaultPrevented=!1,this.target=i}}class Bd extends It{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,i,r){const n=t==="touchend"?r.changedTouches:r.touches,s=Qi(i.getCanvasContainer(),n),a=s.map(h=&gt;i.unproject(h)),l=s.reduce((h,d,f,m)=&gt;h.add(d.div(m.length)),new Q(0,0));super(t,{points:s,point:l,lngLats:a,lngLat:i.unproject(l),originalEvent:r}),this._defaultPrevented=!1}}class CO extends It{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,i,r){super(t,{originalEvent:r}),this._defaultPrevented=!1}}class LO{constructor(t,i){this._map=t,this._clickTolerance=i.clickTolerance}reset(){this._mousedownPos=void 0}wheel(t){return this._firePreventable(new CO(t.type,this._map,t))}mousedown(t,i){return this._mousedownPos=i,this._firePreventable(new mn(t.type,this._map,t))}mouseup(t){this._map.fire(new mn(t.type,this._map,t))}preclick(t){const i=Bt({},t);i.type="preclick",this._map.fire(new mn(i.type,this._map,i))}click(t,i){this._mousedownPos&amp;&amp;this._mousedownPos.dist(i)&gt;=this._clickTolerance||(this.preclick(t),this._map.fire(new mn(t.type,this._map,t)))}dblclick(t){return this._firePreventable(new mn(t.type,this._map,t))}mouseover(t){this._map.fire(new mn(t.type,this._map,t))}mouseout(t){this._map.fire(new mn(t.type,this._map,t))}touchstart(t){return this._firePreventable(new Bd(t.type,this._map,t))}touchmove(t){this._map.fire(new Bd(t.type,this._map,t))}touchend(t){this._map.fire(new Bd(t.type,this._map,t))}touchcancel(t){this._map.fire(new Bd(t.type,this._map,t))}_firePreventable(t){if(this._map.fire(t),t.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class RO{constructor(t){this._map=t}reset(){this._delayContextMenu=!1,this._contextMenuEvent=void 0}mousemove(t){this._map.fire(new mn(t.type,this._map,t))}mousedown(){this._delayContextMenu=!0}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&amp;&amp;(this._map.fire(new mn("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(t){this._delayContextMenu?this._contextMenuEvent=t:this._map.fire(new mn(t.type,this._map,t)),this._map.listens("contextmenu")&amp;&amp;t.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class DO{constructor(t,i){this._map=t,this._el=t.getCanvasContainer(),this._container=t.getContainer(),this._clickTolerance=i.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&amp;&amp;(this._enabled=!1)}mousedown(t,i){this.isEnabled()&amp;&amp;t.shiftKey&amp;&amp;t.button===0&amp;&amp;(rt(),this._startPos=this._lastPos=i,this._active=!0)}mousemoveWindow(t,i){if(!this._active)return;const r=i,n=this._startPos,s=this._lastPos;if(!n||!s||s.equals(r)||!this._box&amp;&amp;r.dist(n)&lt;this._clickTolerance)return;this._lastPos=r,this._box||(this._box=ci("div","mapboxgl-boxzoom",this._container),this._container.classList.add("mapboxgl-crosshair"),this._fireEvent("boxzoomstart",t));const a=Math.min(n.x,r.x),l=Math.max(n.x,r.x),h=Math.min(n.y,r.y),d=Math.max(n.y,r.y);this._map._requestDomTask(()=&gt;{this._box&amp;&amp;(this._box.style.transform=`translate(${a}px,${h}px)`,this._box.style.width=l-a+"px",this._box.style.height=d-h+"px")})}mouseupWindow(t,i){if(!this._active)return;const r=this._startPos,n=i;if(r&amp;&amp;t.button===0){if(this.reset(),ce(),r.x!==n.x||r.y!==n.y)return this._map.fire(new It("boxzoomend",{originalEvent:t})),{cameraAnimation:s=&gt;s.fitScreenCoordinates(r,n,this._map.getBearing(),{linear:!1})};this._fireEvent("boxzoomcancel",t)}}keydown(t){this._active&amp;&amp;t.keyCode===27&amp;&amp;(this.reset(),this._fireEvent("boxzoomcancel",t))}blur(){this.reset()}reset(){this._active=!1,this._container.classList.remove("mapboxgl-crosshair"),this._box&amp;&amp;(this._box.remove(),this._box=null),xt(),delete this._startPos,delete this._lastPos}_fireEvent(t,i){return this._map.fire(new It(t,{originalEvent:i}))}}function tg(e,t){const i={};for(let r=0;r&lt;e.length;r++)i[e[r].identifier]=t[r];return i}class OO{constructor(t){this.reset(),this.numTouches=t.numTouches}reset(){this.centroid=void 0,this.startTime=0,this.touches={},this.aborted=!1}touchstart(t,i,r){(this.centroid||r.length&gt;this.numTouches)&amp;&amp;(this.aborted=!0),this.aborted||(this.startTime===0&amp;&amp;(this.startTime=t.timeStamp),r.length===this.numTouches&amp;&amp;(this.centroid=function(n){const s=new Q(0,0);for(const a of n)s._add(a);return s.div(n.length)}(i),this.touches=tg(r,i)))}touchmove(t,i,r){if(this.aborted||!this.centroid)return;const n=tg(r,i);for(const s in this.touches){const a=n[s];(!a||a.dist(this.touches[s])&gt;30)&amp;&amp;(this.aborted=!0)}}touchend(t,i,r){if((!this.centroid||t.timeStamp-this.startTime&gt;500)&amp;&amp;(this.aborted=!0),r.length===0){const n=!this.aborted&amp;&amp;this.centroid;if(this.reset(),n)return n}}}class eg{constructor(t){this.singleTap=new OO(t),this.numTaps=t.numTaps,this.reset()}reset(){this.lastTime=1/0,this.lastTap=void 0,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){const n=this.singleTap.touchend(t,i,r);if(n){const s=t.timeStamp-this.lastTime&lt;500,a=!this.lastTap||this.lastTap.dist(n)&lt;30;if(s&amp;&amp;a||this.reset(),this.count++,this.lastTime=t.timeStamp,this.lastTap=n,this.count===this.numTaps)return this.reset(),n}}}class kO{constructor(){this._zoomIn=new eg({numTouches:1,numTaps:2}),this._zoomOut=new eg({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){const n=this._zoomIn.touchend(t,i,r),s=this._zoomOut.touchend(t,i,r);return n?(this._active=!0,t.preventDefault(),setTimeout(()=&gt;this.reset(),0),{cameraAnimation:a=&gt;a.easeTo({duration:300,zoom:a.getZoom()+1,around:a.unproject(n)},{originalEvent:t})}):s?(this._active=!0,t.preventDefault(),setTimeout(()=&gt;this.reset(),0),{cameraAnimation:a=&gt;a.easeTo({duration:300,zoom:a.getZoom()-1,around:a.unproject(s)},{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}}const zO={0:1,2:2};class ig{constructor(t){this.reset(),this._clickTolerance=t.clickTolerance||1}blur(){this.reset()}reset(){this._active=!1,this._moved=!1,this._lastPoint=void 0,this._eventButton=void 0}_correctButton(t,i){return!1}_move(t,i){return{}}mousedown(t,i){if(this._lastPoint)return;const r=mr(t);this._correctButton(t,r)&amp;&amp;(this._lastPoint=i,this._eventButton=r)}mousemoveWindow(t,i){const r=this._lastPoint;if(r){if(t.preventDefault(),this._eventButton!=null&amp;&amp;function(n,s){const a=zO[s];return n.buttons===void 0||(n.buttons&amp;a)!==a}(t,this._eventButton))this.reset();else if(this._moved||!(i.dist(r)&lt;this._clickTolerance))return this._moved=!0,this._lastPoint=i,this._move(r,i)}}mouseupWindow(t){this._lastPoint&amp;&amp;mr(t)===this._eventButton&amp;&amp;(this._moved&amp;&amp;ce(),this.reset())}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class FO extends ig{mousedown(t,i){super.mousedown(t,i),this._lastPoint&amp;&amp;(this._active=!0)}_correctButton(t,i){return i===0&amp;&amp;!t.ctrlKey}_move(t,i){return{around:i,panDelta:i.sub(t)}}}class lE extends ig{_correctButton(t,i){return i===0&amp;&amp;t.ctrlKey||i===2}_move(t,i){const r=.8*(i.x-t.x);if(r)return this._active=!0,{bearingDelta:r}}contextmenu(t){t.preventDefault()}}class cE extends ig{_correctButton(t,i){return i===0&amp;&amp;t.ctrlKey||i===2}_move(t,i){const r=-.5*(i.y-t.y);if(r)return this._active=!0,{pitchDelta:r}}contextmenu(t){t.preventDefault()}}class BO{constructor(t,i){this._map=t,this._el=t.getCanvasContainer(),this._minTouches=1,this._clickTolerance=i.clickTolerance||1,this.reset(),Oi(["_addTouchPanBlocker","_showTouchPanBlockerAlert"],this)}reset(){this._active=!1,this._touches={},this._sum=new Q(0,0)}touchstart(t,i,r){return this._calculateTransform(t,i,r)}touchmove(t,i,r){if(this._active&amp;&amp;!(r.length&lt;this._minTouches)){if(this._map._cooperativeGestures&amp;&amp;!this._map.isMoving()){if(r.length===1&amp;&amp;!me())return void this._showTouchPanBlockerAlert();this._alertContainer.style.visibility!=="hidden"&amp;&amp;(this._alertContainer.style.visibility="hidden",clearTimeout(this._alertTimer))}return t.cancelable&amp;&amp;t.preventDefault(),this._calculateTransform(t,i,r)}}touchend(t,i,r){this._calculateTransform(t,i,r),this._active&amp;&amp;r.length&lt;this._minTouches&amp;&amp;this.reset()}touchcancel(){this.reset()}_calculateTransform(t,i,r){r.length&gt;0&amp;&amp;(this._active=!0);const n=tg(r,i),s=new Q(0,0),a=new Q(0,0);let l=0;for(const d in n){const f=n[d],m=this._touches[d];m&amp;&amp;(s._add(f),a._add(f.sub(m)),l++,n[d]=f)}if(this._touches=n,l&lt;this._minTouches||!a.mag())return;const h=a.div(l);return this._sum._add(h),this._sum.mag()&lt;this._clickTolerance?void 0:{around:s.div(l),panDelta:h}}enable(){this._enabled=!0,this._map._cooperativeGestures&amp;&amp;(this._addTouchPanBlocker(),this._el.classList.add("mapboxgl-touch-pan-blocker-override","mapboxgl-scrollable-page"))}disable(){this._enabled=!1,this._map._cooperativeGestures&amp;&amp;(clearTimeout(this._alertTimer),this._alertContainer.remove(),this._el.classList.remove("mapboxgl-touch-pan-blocker-override","mapboxgl-scrollable-page")),this.reset()}isEnabled(){return!!this._enabled}isActive(){return!!this._active}_addTouchPanBlocker(){this._map&amp;&amp;!this._alertContainer&amp;&amp;(this._alertContainer=ci("div","mapboxgl-touch-pan-blocker",this._map._container),this._alertContainer.textContent=this._map._getUIString("TouchPanBlocker.Message"),this._alertContainer.style.fontSize=`${Math.max(10,Math.min(24,Math.floor(.05*this._el.clientWidth)))}px`)}_showTouchPanBlockerAlert(){this._alertContainer.style.visibility="visible",this._alertContainer.classList.add("mapboxgl-touch-pan-blocker-show"),this._alertContainer.setAttribute("role","alert"),clearTimeout(this._alertTimer),this._alertTimer=setTimeout(()=&gt;{this._alertContainer.classList.remove("mapboxgl-touch-pan-blocker-show"),this._alertContainer.setAttribute("role","null")},500)}}class rg{constructor(){this.reset()}reset(){this._active=!1,this._firstTwoTouches=void 0}_start(t){}_move(t,i,r){return{}}touchstart(t,i,r){this._firstTwoTouches||r.length&lt;2||(this._firstTwoTouches=[r[0].identifier,r[1].identifier],this._start([i[0],i[1]]))}touchmove(t,i,r){const n=this._firstTwoTouches;if(!n)return;t.preventDefault();const[s,a]=n,l=Nd(r,i,s),h=Nd(r,i,a);if(!l||!h)return;const d=this._aroundCenter?null:l.add(h).div(2);return this._move([l,h],d,t)}touchend(t,i,r){if(!this._firstTwoTouches)return;const[n,s]=this._firstTwoTouches,a=Nd(r,i,n),l=Nd(r,i,s);a&amp;&amp;l||(this._active&amp;&amp;ce(),this.reset())}touchcancel(){this.reset()}enable(t){this._enabled=!0,this._aroundCenter=!!t&amp;&amp;t.around==="center"}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}function Nd(e,t,i){for(let r=0;r&lt;e.length;r++)if(e[r].identifier===i)return t[r]}function uE(e,t){return Math.log(e/t)/Math.LN2}class NO extends rg{reset(){super.reset(),this._distance=0,this._startDistance=0}_start(t){this._startDistance=this._distance=t[0].dist(t[1])}_move(t,i){const r=this._distance;if(this._distance=t[0].dist(t[1]),this._active||!(Math.abs(uE(this._distance,this._startDistance))&lt;.1))return this._active=!0,{zoomDelta:uE(this._distance,r),pinchAround:i}}}function hE(e,t){return 180*e.angleWith(t)/Math.PI}class UO extends rg{reset(){super.reset(),this._minDiameter=0,this._startVector=void 0,this._vector=void 0}_start(t){this._startVector=this._vector=t[0].sub(t[1]),this._minDiameter=t[0].dist(t[1])}_move(t,i){const r=this._vector;if(this._vector=t[0].sub(t[1]),r&amp;&amp;(this._active||!this._isBelowThreshold(this._vector)))return this._active=!0,{bearingDelta:hE(this._vector,r),pinchAround:i}}_isBelowThreshold(t){this._minDiameter=Math.min(this._minDiameter,t.mag());const i=25/(Math.PI*this._minDiameter)*360,r=this._startVector;if(!r)return!1;const n=hE(t,r);return Math.abs(n)&lt;i}}function ng(e){return Math.abs(e.y)&gt;Math.abs(e.x)}class VO extends rg{constructor(t){super(),this._map=t}reset(){super.reset(),this._valid=void 0,this._firstMove=void 0,this._lastPoints=void 0}_start(t){this._lastPoints=t,ng(t[0].sub(t[1]))&amp;&amp;(this._valid=!1)}_move(t,i,r){const n=this._lastPoints;if(!n)return;const s=t[0].sub(n[0]),a=t[1].sub(n[1]);return this._map._cooperativeGestures&amp;&amp;!me()&amp;&amp;r.touches.length&lt;3||(this._valid=this.gestureBeginsVertically(s,a,r.timeStamp),!this._valid)?void 0:(this._lastPoints=t,this._active=!0,{pitchDelta:(s.y+a.y)/2*-.5})}gestureBeginsVertically(t,i,r){if(this._valid!==void 0)return this._valid;const n=t.mag()&gt;=2,s=i.mag()&gt;=2;if(!n&amp;&amp;!s)return;if(!n||!s)return this._firstMove==null&amp;&amp;(this._firstMove=r),r-this._firstMove&lt;100&amp;&amp;void 0;const a=t.y&gt;0==i.y&gt;0;return ng(t)&amp;&amp;ng(i)&amp;&amp;a}}const jO={panStep:100,bearingStep:15,pitchStep:10};class GO{constructor(){const t=jO;this._panStep=t.panStep,this._bearingStep=t.bearingStep,this._pitchStep=t.pitchStep,this._rotationDisabled=!1}blur(){this.reset()}reset(){this._active=!1}keydown(t){if(t.altKey||t.ctrlKey||t.metaKey)return;let i=0,r=0,n=0,s=0,a=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(),s=-1);break;case 39:t.shiftKey?r=1:(t.preventDefault(),s=1);break;case 38:t.shiftKey?n=1:(t.preventDefault(),a=-1);break;case 40:t.shiftKey?n=-1:(t.preventDefault(),a=1);break;default:return}return this._rotationDisabled&amp;&amp;(r=0,n=0),{cameraAnimation:l=&gt;{const h=l.getZoom();l.easeTo({duration:300,easeId:"keyboardHandler",easing:HO,zoom:i?Math.round(h)+i*(t.shiftKey?2:1):h,bearing:l.getBearing()+r*this._bearingStep,pitch:l.getPitch()+n*this._pitchStep,offset:[-s*this._panStep,-a*this._panStep],center:l.getCenter()},{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 HO(e){return e*(2-e)}const dE=4.000244140625;class WO{constructor(t,i){this._map=t,this._el=t.getCanvasContainer(),this._handler=i,this._delta=0,this._lastDelta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222,Oi(["_onTimeout","_addScrollZoomBlocker","_showBlockerAlert"],this)}setZoomRate(t){this._defaultZoomRate=t}setWheelZoomRate(t){this._wheelZoomRate=t}isEnabled(){return!!this._enabled}isActive(){return this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(t){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!t&amp;&amp;t.around==="center",this._map._cooperativeGestures&amp;&amp;this._addScrollZoomBlocker())}disable(){this.isEnabled()&amp;&amp;(this._enabled=!1,this._map._cooperativeGestures&amp;&amp;(clearTimeout(this._alertTimer),this._alertContainer.remove()))}wheel(t){if(!this.isEnabled())return;if(this._map._cooperativeGestures){if(!(t.ctrlKey||t.metaKey||this.isZooming()||me()))return void this._showBlockerAlert();this._alertContainer.style.visibility!=="hidden"&amp;&amp;(this._alertContainer.style.visibility="hidden",clearTimeout(this._alertTimer))}let i=t.deltaMode===L.WheelEvent.DOM_DELTA_LINE?40*t.deltaY:t.deltaY;const r=_e.now(),n=r-(this._lastWheelEventTime||0);this._lastWheelEventTime=r,i!==0&amp;&amp;i%dE==0?this._type="wheel":i!==0&amp;&amp;Math.abs(i)&lt;4?this._type="trackpad":n&gt;400?(this._type=null,this._lastValue=i,this._timeout=setTimeout(this._onTimeout,40,t)):this._type||(this._type=Math.abs(n*i)&lt;200?"trackpad":"wheel",this._timeout&amp;&amp;(clearTimeout(this._timeout),this._timeout=null,i+=this._lastValue)),t.shiftKey&amp;&amp;i&amp;&amp;(i/=4),this._type&amp;&amp;(this._lastWheelEvent=t,this._delta-=i,this._active||this._start(t)),t.preventDefault()}_onTimeout(t){this._type="wheel",this._delta-=this._lastValue,this._active||this._start(t)}_start(t){if(!this._delta)return;this._frameId&amp;&amp;(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&amp;&amp;(clearTimeout(this._finishTimeout),delete this._finishTimeout);const i=$e(this._el,t);this._aroundPoint=this._aroundCenter?this._map.transform.centerPoint:i,this._aroundCoord=this._map.transform.pointCoordinate3D(this._aroundPoint),this._targetZoom=void 0,this._frameId||(this._frameId=!0,this._handler._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;const t=this._map.transform;this._type==="wheel"&amp;&amp;t.projection.wrap&amp;&amp;(t._center.lng&gt;=180||t._center.lng&lt;=-180)&amp;&amp;(this._prevEase=null,this._easing=null,this._lastWheelEvent=null,this._lastWheelEventTime=0);const i=()=&gt;t._terrainEnabled()&amp;&amp;this._aroundCoord?t.computeZoomRelativeTo(this._aroundCoord):t.zoom;if(this._delta!==0){const d=this._type==="wheel"&amp;&amp;Math.abs(this._delta)&gt;dE?this._wheelZoomRate:this._defaultZoomRate;let f=2/(1+Math.exp(-Math.abs(this._delta*d)));this._delta&lt;0&amp;&amp;f!==0&amp;&amp;(f=1/f);const m=i(),_=Math.pow(2,m),y=typeof this._targetZoom=="number"?t.zoomScale(this._targetZoom):_;this._targetZoom=Math.min(t.maxZoom,Math.max(t.minZoom,t.scaleZoom(y*f))),this._type==="wheel"&amp;&amp;(this._startZoom=m,this._easing=this._smoothOutEasing(200)),this._lastDelta=this._delta,this._delta=0}const r=typeof this._targetZoom=="number"?this._targetZoom:i(),n=this._startZoom,s=this._easing;let a,l=!1;if(this._type==="wheel"&amp;&amp;n&amp;&amp;s){const d=Math.min((_e.now()-this._lastWheelEventTime)/200,1);a=ge(n,r,s(d)),d&lt;1?this._frameId||(this._frameId=!0):l=!0}else a=r,l=!0;this._active=!0,l&amp;&amp;(this._active=!1,this._finishTimeout=setTimeout(()=&gt;{this._zooming=!1,this._handler._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200));let h=a-i();return h*this._lastDelta&lt;0&amp;&amp;(h=0),{noInertia:!0,needsRenderFrame:!l,zoomDelta:h,around:this._aroundPoint,aroundCoord:this._aroundCoord,originalEvent:this._lastWheelEvent}}_smoothOutEasing(t){let i=Gr;if(this._prevEase){const r=this._prevEase,n=(_e.now()-r.start)/r.duration,s=r.easing(n+.01)-r.easing(n),a=.27/Math.sqrt(s*s+1e-4)*.01;i=Ls(a,Math.sqrt(.0729-a*a),.25,1)}return this._prevEase={start:_e.now(),duration:t,easing:i},i}blur(){this.reset()}reset(){this._active=!1}_addScrollZoomBlocker(){this._map&amp;&amp;!this._alertContainer&amp;&amp;(this._alertContainer=ci("div","mapboxgl-scroll-zoom-blocker",this._map._container),this._alertContainer.textContent=/(Mac|iPad)/i.test(L.navigator.userAgent)?this._map._getUIString("ScrollZoomBlocker.CmdMessage"):this._map._getUIString("ScrollZoomBlocker.CtrlMessage"),this._alertContainer.style.fontSize=`${Math.max(10,Math.min(24,Math.floor(.05*this._el.clientWidth)))}px`)}_showBlockerAlert(){this._alertContainer.style.visibility="visible",this._alertContainer.classList.add("mapboxgl-scroll-zoom-blocker-show"),this._alertContainer.setAttribute("role","alert"),clearTimeout(this._alertTimer),this._alertTimer=setTimeout(()=&gt;{this._alertContainer.classList.remove("mapboxgl-scroll-zoom-blocker-show"),this._alertContainer.setAttribute("role","null")},200)}}class qO{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()&amp;&amp;this._tapZoom.isEnabled()}isActive(){return this._clickZoom.isActive()||this._tapZoom.isActive()}}class ZO{constructor(){this.reset()}reset(){this._active=!1}blur(){this.reset()}dblclick(t,i){return t.preventDefault(),{cameraAnimation:r=&gt;{r.easeTo({duration:300,zoom:r.getZoom()+(t.shiftKey?-1:1),around:r.unproject(i)},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class $O{constructor(){this._tap=new eg({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,this._swipePoint=void 0,this._swipeTouch=0,this._tapTime=0,this._tap.reset()}touchstart(t,i,r){this._swipePoint||(this._tapTime&amp;&amp;t.timeStamp-this._tapTime&gt;500&amp;&amp;this.reset(),this._tapTime?r.length&gt;0&amp;&amp;(this._swipePoint=i[0],this._swipeTouch=r[0].identifier):this._tap.touchstart(t,i,r))}touchmove(t,i,r){if(this._tapTime){if(this._swipePoint){if(r[0].identifier!==this._swipeTouch)return;const n=i[0],s=n.y-this._swipePoint.y;return this._swipePoint=n,t.preventDefault(),this._active=!0,{zoomDelta:s/128}}}else this._tap.touchmove(t,i,r)}touchend(t,i,r){this._tapTime?this._swipePoint&amp;&amp;r.length===0&amp;&amp;this.reset():this._tap.touchend(t,i,r)&amp;&amp;(this._tapTime=t.timeStamp)}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class XO{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("mapboxgl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("mapboxgl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&amp;&amp;this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class YO{constructor(t,i,r){this._pitchWithRotate=t.pitchWithRotate,this._mouseRotate=i,this._mousePitch=r}enable(){this._mouseRotate.enable(),this._pitchWithRotate&amp;&amp;this._mousePitch.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable()}isEnabled(){return this._mouseRotate.isEnabled()&amp;&amp;(!this._pitchWithRotate||this._mousePitch.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()}}class KO{constructor(t,i,r,n){this._el=t,this._touchZoom=i,this._touchRotate=r,this._tapDragZoom=n,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("mapboxgl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("mapboxgl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&amp;&amp;(this._rotationDisabled||this._touchRotate.isEnabled())&amp;&amp;this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&amp;&amp;this._touchRotate.enable()}}const Ud=e=&gt;e.zoom||e.drag||e.pitch||e.rotate;class JO extends It{}class QO{constructor(){this.constants=[1,1,.01],this.radius=0}setup(t,i){const r=W.sub([],i,t);this.radius=W.length(r[2]&lt;0?W.div([],r,this.constants):[r[0],r[1],0])}projectRay(t){W.div(t,t,this.constants),W.normalize(t,t),W.mul(t,t,this.constants);const i=W.scale([],t,this.radius);if(i[2]&gt;0){const r=W.scale([],[0,0,1],W.dot(i,[0,0,1])),n=W.scale([],W.normalize([],[i[0],i[1],0]),this.radius),s=W.add([],i,W.scale([],W.sub([],W.add([],n,r),i),2));i[0]=s[0],i[1]=s[1]}return i}}function Vd(e){return e.panDelta&amp;&amp;e.panDelta.mag()||e.zoomDelta||e.bearingDelta||e.pitchDelta}class tk{constructor(t,i){this._map=t,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new PO(t),this._bearingSnap=i.bearingSnap,this._previousActiveHandlers={},this._trackingEllipsoid=new QO,this._dragOrigin=null,this._eventsInProgress={},this._addDefaultHandlers(i),Oi(["handleEvent","handleWindowEvent"],this);const r=this._el;this._listeners=[[r,"touchstart",{passive:!0}],[r,"touchmove",{passive:!1}],[r,"touchend",void 0],[r,"touchcancel",void 0],[r,"mousedown",void 0],[r,"mousemove",void 0],[r,"mouseup",void 0],[L.document,"mousemove",{capture:!0}],[L.document,"mouseup",void 0],[r,"mouseover",void 0],[r,"mouseout",void 0],[r,"dblclick",void 0],[r,"click",void 0],[r,"keydown",{capture:!1}],[r,"keyup",void 0],[r,"wheel",{passive:!1}],[r,"contextmenu",void 0],[L,"blur",void 0]];for(const[n,s,a]of this._listeners)n.addEventListener(s,n===L.document?this.handleWindowEvent:this.handleEvent,a)}destroy(){for(const[t,i,r]of this._listeners)t.removeEventListener(i,t===L.document?this.handleWindowEvent:this.handleEvent,r)}_addDefaultHandlers(t){const i=this._map,r=i.getCanvasContainer();this._add("mapEvent",new LO(i,t));const n=i.boxZoom=new DO(i,t);this._add("boxZoom",n);const s=new kO,a=new ZO;i.doubleClickZoom=new qO(a,s),this._add("tapZoom",s),this._add("clickZoom",a);const l=new $O;this._add("tapDragZoom",l);const h=i.touchPitch=new VO(i);this._add("touchPitch",h);const d=new lE(t),f=new cE(t);i.dragRotate=new YO(t,d,f),this._add("mouseRotate",d,["mousePitch"]),this._add("mousePitch",f,["mouseRotate"]);const m=new FO(t),_=new BO(i,t);i.dragPan=new XO(r,m,_),this._add("mousePan",m),this._add("touchPan",_,["touchZoom","touchRotate"]);const y=new UO,x=new NO;i.touchZoomRotate=new KO(r,x,y,l),this._add("touchRotate",y,["touchPan","touchZoom"]),this._add("touchZoom",x,["touchPan","touchRotate"]),this._add("blockableMapEvent",new RO(i));const b=i.scrollZoom=new WO(i,this);this._add("scrollZoom",b,["mousePan"]);const w=i.keyboard=new GO;this._add("keyboard",w);for(const T of["boxZoom","doubleClickZoom","tapDragZoom","touchPitch","dragRotate","dragPan","touchZoomRotate","scrollZoom","keyboard"])t.interactive&amp;&amp;t[T]&amp;&amp;i[T].enable(t[T])}_add(t,i,r){this._handlers.push({handlerName:t,handler:i,allowed:r}),this._handlersById[t]=i}stop(t){if(!this._updatingCamera){for(const{handler:i}of this._handlers)i.reset();this._inertia.clear(),this._fireEvents({},{},t),this._changes=[],this._originalZoom=void 0}}isActive(){for(const{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!!Ud(this._eventsInProgress)||this.isZooming()}_isDragging(){return!!this._eventsInProgress.drag}_blockedByActive(t,i,r){for(const n in t)if(n!==r&amp;&amp;(!i||i.indexOf(n)&lt;0))return!0;return!1}handleWindowEvent(t){this.handleEvent(t,`${t.type}Window`)}_getMapTouches(t){const i=[];for(const r of t)this._el.contains(r.target)&amp;&amp;i.push(r);return i}handleEvent(t,i){this._updatingCamera=!0;const r=t.type==="renderFrame",n=r?void 0:t,s={needsRenderFrame:!1},a={},l={},h=t.touches?this._getMapTouches(t.touches):void 0,d=h?Qi(this._el,h):r?void 0:$e(this._el,t);for(const{handlerName:_,handler:y,allowed:x}of this._handlers){if(!y.isEnabled())continue;let b;this._blockedByActive(l,x,_)?y.reset():y[i||t.type]&amp;&amp;(b=y[i||t.type](t,d,h),this.mergeHandlerResult(s,a,b,_,n),b&amp;&amp;b.needsRenderFrame&amp;&amp;this._triggerRenderFrame()),(b||y.isActive())&amp;&amp;(l[_]=y)}const f={};for(const _ in this._previousActiveHandlers)l[_]||(f[_]=n);this._previousActiveHandlers=l,(Object.keys(f).length||Vd(s))&amp;&amp;(this._changes.push([s,a,f]),this._triggerRenderFrame()),(Object.keys(l).length||Vd(s))&amp;&amp;this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:m}=s;m&amp;&amp;(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],m(this._map))}mergeHandlerResult(t,i,r,n,s){if(!r)return;Bt(t,r);const a={handlerName:n,originalEvent:r.originalEvent||s};r.zoomDelta!==void 0&amp;&amp;(i.zoom=a),r.panDelta!==void 0&amp;&amp;(i.drag=a),r.pitchDelta!==void 0&amp;&amp;(i.pitch=a),r.bearingDelta!==void 0&amp;&amp;(i.rotate=a)}_applyChanges(){const t={},i={},r={};for(const[n,s,a]of this._changes)n.panDelta&amp;&amp;(t.panDelta=(t.panDelta||new Q(0,0))._add(n.panDelta)),n.zoomDelta&amp;&amp;(t.zoomDelta=(t.zoomDelta||0)+n.zoomDelta),n.bearingDelta&amp;&amp;(t.bearingDelta=(t.bearingDelta||0)+n.bearingDelta),n.pitchDelta&amp;&amp;(t.pitchDelta=(t.pitchDelta||0)+n.pitchDelta),n.around!==void 0&amp;&amp;(t.around=n.around),n.aroundCoord!==void 0&amp;&amp;(t.aroundCoord=n.aroundCoord),n.pinchAround!==void 0&amp;&amp;(t.pinchAround=n.pinchAround),n.noInertia&amp;&amp;(t.noInertia=n.noInertia),Bt(i,s),Bt(r,a);this._updateMapTransform(t,i,r),this._changes=[]}_updateMapTransform(t,i,r){const n=this._map,s=n.transform,a=S=&gt;[S.x,S.y,S.z];if((S=&gt;{const I=this._eventsInProgress.drag;return I&amp;&amp;!this._handlersById[I.handlerName].isActive()})()&amp;&amp;!Vd(t)){const S=s.zoom;s.cameraElevationReference="sea",this._originalZoom!=null&amp;&amp;s._orthographicProjectionAtLowPitch&amp;&amp;s.projection.name!=="globe"&amp;&amp;s.pitch===0?(s.cameraElevationReference="ground",s.zoom=this._originalZoom):(s.recenterOnTerrain(),s.cameraElevationReference="ground"),S!==s.zoom&amp;&amp;this._map._update(!0)}if(s._isCameraConstrained&amp;&amp;n._stop(!0),!Vd(t))return void this._fireEvents(i,r,!0);let{panDelta:l,zoomDelta:h,bearingDelta:d,pitchDelta:f,around:m,aroundCoord:_,pinchAround:y}=t;s._isCameraConstrained&amp;&amp;(h&gt;0&amp;&amp;(h=0),s._isCameraConstrained=!1),y!==void 0&amp;&amp;(m=y),(h||(S=&gt;i[S]&amp;&amp;!this._eventsInProgress[S])("drag"))&amp;&amp;m&amp;&amp;(this._dragOrigin=a(s.pointCoordinate3D(m)),this._originalZoom=s.zoom,this._trackingEllipsoid.setup(s._camera.position,this._dragOrigin)),s.cameraElevationReference="sea",n._stop(!0),m=m||n.transform.centerPoint,d&amp;&amp;(s.bearing+=d),f&amp;&amp;(s.pitch+=f),s._updateCameraState();const x=[0,0,0];if(l)if(s.projection.name==="mercator"){const S=this._trackingEllipsoid.projectRay(s.screenPointToMercatorRay(m).dir),I=this._trackingEllipsoid.projectRay(s.screenPointToMercatorRay(m.sub(l)).dir);x[0]=I[0]-S[0],x[1]=I[1]-S[1]}else{const S=s.pointCoordinate(m);if(s.projection.name==="globe"){l=l.rotate(-s.angle);const I=s._pixelsPerMercatorPixel/s.worldSize;x[0]=-l.x*km(Yi(S.y))*I,x[1]=-l.y*km(s.center.lat)*I}else{const I=s.pointCoordinate(m.sub(l));S&amp;&amp;I&amp;&amp;(x[0]=I.x-S.x,x[1]=I.y-S.y)}}const b=s.zoom,w=[0,0,0];if(h){const S=a(_||s.pointCoordinate3D(m)),I={dir:W.normalize([],W.sub([],S,s._camera.position))};if(I.dir[2]&lt;0){const P=s.zoomDeltaToMovement(S,h);W.scale(w,I.dir,P)}}const T=W.add(x,x,w);s._translateCameraConstrained(T),h&amp;&amp;Math.abs(s.zoom-b)&gt;1e-4&amp;&amp;s.recenterOnTerrain(),s.cameraElevationReference="ground",this._map._update(),t.noInertia||this._inertia.record(t),this._fireEvents(i,r,!0)}_fireEvents(t,i,r){const n=Ud(this._eventsInProgress),s=Ud(t),a={};for(const f in t){const{originalEvent:m}=t[f];this._eventsInProgress[f]||(a[`${f}start`]=m),this._eventsInProgress[f]=t[f]}!n&amp;&amp;s&amp;&amp;this._fireEvent("movestart",s.originalEvent);for(const f in a)this._fireEvent(f,a[f]);s&amp;&amp;this._fireEvent("move",s.originalEvent);for(const f in t){const{originalEvent:m}=t[f];this._fireEvent(f,m)}const l={};let h;for(const f in this._eventsInProgress){const{handlerName:m,originalEvent:_}=this._eventsInProgress[f];this._handlersById[m].isActive()||(delete this._eventsInProgress[f],h=i[m]||_,l[`${f}end`]=h)}for(const f in l)this._fireEvent(f,l[f]);const d=Ud(this._eventsInProgress);if(r&amp;&amp;(n||s)&amp;&amp;!d){this._updatingCamera=!0;const f=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),m=_=&gt;_!==0&amp;&amp;-this._bearingSnap&lt;_&amp;&amp;_&lt;this._bearingSnap;f?(m(f.bearing||this._map.getBearing())&amp;&amp;(f.bearing=0),this._map.easeTo(f,{originalEvent:h})):(this._map.fire(new It("moveend",{originalEvent:h})),m(this._map.getBearing())&amp;&amp;this._map.resetNorth()),this._updatingCamera=!1}}_fireEvent(t,i){this._map.fire(new It(t,i?{originalEvent:i}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(t=&gt;{this._frameId=void 0,this.handleEvent(new JO("renderFrame",{timeStamp:t})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&amp;&amp;(this._frameId=this._requestFrame())}}const fE="map.setFreeCameraOptions(...) and map.getFreeCameraOptions() are not yet supported for non-mercator projections.";class ek extends Zi{constructor(t,i){super(),this._moving=!1,this._zooming=!1,this.transform=t,this._bearingSnap=i.bearingSnap,this._respectPrefersReducedMotion=i.respectPrefersReducedMotion!==!1,Oi(["_renderFrameCallback"],this)}getCenter(){return new ye(this.transform.center.lng,this.transform.center.lat)}setCenter(t,i){return this.jumpTo({center:t},i)}panBy(t,i,r){return t=Q.convert(t).mult(-1),this.panTo(this.transform.center,Bt({offset:t},i),r)}panTo(t,i,r){return this.easeTo(Bt({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(Bt({zoom:t},i),r)}zoomIn(t,i){return this.zoomTo(this.getZoom()+1,t,i),this}zoomOut(t,i){return this.zoomTo(this.getZoom()-1,t,i),this}getBearing(){return this.transform.bearing}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(Bt({bearing:t},i),r)}resetNorth(t,i){return this.rotateTo(0,Bt({duration:1e3},t),i),this}resetNorthPitch(t,i){return this.easeTo(Bt({bearing:0,pitch:0,duration:1e3},t),i),this}snapToNorth(t,i){return Math.abs(this.getBearing())&lt;this._bearingSnap?this.resetNorth(t,i):this}getPitch(){return this.transform.pitch}setPitch(t,i){return this.jumpTo({pitch:t},i),this}cameraForBounds(t,i){t=Qr.convert(t);const r=i&amp;&amp;i.bearing||0,n=i&amp;&amp;i.pitch||0,s=t.getNorthWest(),a=t.getSouthEast();return this._cameraForBounds(this.transform,s,a,r,n,i)}_extendCameraOptions(t){const i={top:0,bottom:0,right:0,left:0};if(typeof(t=Bt({padding:i,offset:[0,0],maxZoom:this.transform.maxZoom},t)).padding=="number"){const r=t.padding;t.padding={top:r,bottom:r,right:r,left:r}}return t.padding=Bt(i,t.padding),t}_minimumAABBFrustumDistance(t,i){const r=i.max[0]-i.min[0],n=i.max[1]-i.min[1];return r/n&gt;t.aspect?r/(2*Math.tan(.5*t.fovX)*t.aspect):n/(2*Math.tan(.5*t.fovY)*t.aspect)}_cameraForBoundsOnGlobe(t,i,r,n,s,a){const l=t.clone(),h=this._extendCameraOptions(a);l.bearing=n,l.pitch=s;const d=ye.convert(i),f=ye.convert(r),m=.5*(d.lat+f.lat),_=.5*(d.lng+f.lng),y=Nr(m,_),x=W.normalize([],y),b=W.normalize([],W.cross([],x,[0,1,0])),w=W.cross([],b,x),T=[b[0],b[1],b[2],0,w[0],w[1],w[2],0,x[0],x[1],x[2],0,0,0,0,1],S=[y,Nr(d.lat,d.lng),Nr(f.lat,d.lng),Nr(f.lat,f.lng),Nr(d.lat,f.lng),Nr(m,d.lng),Nr(m,f.lng),Nr(d.lat,_),Nr(f.lat,_)];let I=mi.fromPoints(S.map(K=&gt;[W.dot(b,K),W.dot(w,K),W.dot(x,K)]));const P=W.transformMat4([],I.center,T);W.squaredLength(P)===0&amp;&amp;W.set(P,0,0,1),W.normalize(P,P),W.scale(P,P,Dr),l.center=function([K,ot,lt]){const at=Math.hypot(K,ot,lt),dt=Math.atan2(K,lt),ft=.5*Math.PI-Math.acos(-ot/at);return new ye(vi(dt),vi(ft))}(P);const M=l.getWorldToCameraMatrix(),C=nt.invert(new Float64Array(16),M);I=mi.applyTransform(I,nt.multiply([],M,T)),W.transformMat4(P,P,M);const D=.5*(I.max[2]-I.min[2]),O=this._minimumAABBFrustumDistance(l,I),k=W.scale([],[0,0,1],D),z=W.add(k,P,k),B=O+(l.pitch===0?0:W.distance(P,z)),U=l.globeCenterInViewSpace,Z=W.sub([],P,[U[0],U[1],U[2]]);W.normalize(Z,Z),W.scale(Z,Z,B);const F=W.add([],P,Z);W.transformMat4(F,F,C);const Y=sl/Dr,J=W.length(F),it=ui(Math.max(J*Y-sl,Number.EPSILON),0),X=Math.min(l.zoomFromMercatorZAdjusted(it),h.maxZoom);return X&gt;.5*(Ac+To)?(l.setProjection({name:"mercator"}),l.zoom=X,this._cameraForBounds(l,i,r,n,s,a)):{center:l.center,zoom:X,bearing:n,pitch:s}}queryTerrainElevation(t,i){const r=this.transform.elevation;return r?(i=Bt({},{exaggerated:!0},i),r.getAtPoint(Be.fromLngLat(t),null,i.exaggerated)):null}_cameraForBounds(t,i,r,n,s,a){if(t.projection.name==="globe")return this._cameraForBoundsOnGlobe(t,i,r,n,s,a);const l=t.clone(),h=this._extendCameraOptions(a),d=l.padding;l.bearing=n,l.pitch=s;const f=ye.convert(i),m=ye.convert(r),_=new ye(f.lng,m.lat),y=new ye(m.lng,f.lat),x=l.project(f),b=l.project(m),w=this.queryTerrainElevation(f),T=this.queryTerrainElevation(m),S=this.queryTerrainElevation(_),I=this.queryTerrainElevation(y),P=[[x.x,x.y,Math.min(w||0,T||0,S||0,I||0)],[b.x,b.y,Math.max(w||0,T||0,S||0,I||0)]];let M=mi.fromPoints(P);const C=l.getWorldToCameraMatrix(),D=nt.invert(new Float64Array(16),C);M=mi.applyTransform(M,C);const O=W.sub([],M.max,M.min),k=d.left||0,z=d.right||0,B=d.bottom||0,U=d.top||0,{left:Z,right:F,top:Y,bottom:J}=h.padding,it=.5*(k+z),X=.5*(U+B),K=Math.min(l.scaleZoom(l.scale*Math.min((l.width-(k+z+Z+F))/O[0],(l.height-(B+U+J+Y))/O[1])),h.maxZoom),ot=l.scale/l.zoomScale(K);M=new mi([M.min[0]-(Z+it)*ot,M.min[1]-(J+X)*ot,M.min[2]],[M.max[0]+(F+it)*ot,M.max[1]+(Y+X)*ot,M.max[2]]);const lt=.5*O[2],at=this._minimumAABBFrustumDistance(l,M),dt=[0,0,1,0];oi.transformMat4(dt,dt,C),oi.normalize(dt,dt);const ft=W.scale([],dt,at+lt),_t=W.add([],M.center,ft),ct=(typeof h.offset.x=="number"&amp;&amp;typeof h.offset.y=="number"?new Q(h.offset.x,h.offset.y):Q.convert(h.offset)).rotate(-$t(n));M.center[0]-=ct.x*ot,M.center[1]+=ct.y*ot,W.transformMat4(M.center,M.center,D),W.transformMat4(_t,_t,D);const bt=[M.center[0],M.center[1],_t[2]*l.pixelsPerMeter];W.scale(bt,bt,1/l.worldSize);const Ot=tn(bt[0]),kt=Yi(bt[1]),Ht=Math.min(l._zoomFromMercatorZ(bt[2]),h.maxZoom),Zt=new ye(Ot,kt);return l.mercatorFromTransition&amp;&amp;Ht&lt;.5*(Ac+To)?(l.setProjection({name:"globe"}),l.zoom=Ht,this._cameraForBounds(l,i,r,n,s,a)):{center:Zt,zoom:Ht,bearing:n,pitch:s}}fitBounds(t,i,r){const n=this.cameraForBounds(t,i);return this._fitInternal(n,i,r)}fitScreenCoordinates(t,i,r,n,s){const a=Q.convert(t),l=Q.convert(i),h=new Q(Math.min(a.x,l.x),Math.min(a.y,l.y)),d=new Q(Math.max(a.x,l.x),Math.max(a.y,l.y));if(this.transform.projection.name==="mercator"&amp;&amp;this.transform.anyCornerOffEdge(a,l))return this;const f=this.transform.pointLocation3D(h),m=this.transform.pointLocation3D(d),_=this.transform.pointLocation3D(new Q(h.x,d.y)),y=this.transform.pointLocation3D(new Q(d.x,h.y)),x=[Math.min(f.lng,m.lng,_.lng,y.lng),Math.min(f.lat,m.lat,_.lat,y.lat)],b=[Math.max(f.lng,m.lng,_.lng,y.lng),Math.max(f.lat,m.lat,_.lat,y.lat)],w=n&amp;&amp;n.pitch?n.pitch:this.getPitch(),T=this._cameraForBounds(this.transform,x,b,r,w,n);return this._fitInternal(T,n,s)}_fitInternal(t,i,r){return t?(delete(i=Bt(t,i)).padding,i.linear?this.easeTo(i,r):this.flyTo(i,r)):this}jumpTo(t,i){this.stop();const r=t.preloadOnly?this.transform.clone():this.transform;let n=!1,s=!1,a=!1;return"zoom"in t&amp;&amp;r.zoom!==+t.zoom&amp;&amp;(n=!0,r.zoom=+t.zoom),t.center!==void 0&amp;&amp;(r.center=ye.convert(t.center)),"bearing"in t&amp;&amp;r.bearing!==+t.bearing&amp;&amp;(s=!0,r.bearing=+t.bearing),"pitch"in t&amp;&amp;r.pitch!==+t.pitch&amp;&amp;(a=!0,r.pitch=+t.pitch),t.padding==null||r.isPaddingEqual(t.padding)||(r.padding=t.padding),t.preloadOnly?(this._preloadTiles(r),this):(this.fire(new It("movestart",i)).fire(new It("move",i)),n&amp;&amp;this.fire(new It("zoomstart",i)).fire(new It("zoom",i)).fire(new It("zoomend",i)),s&amp;&amp;this.fire(new It("rotatestart",i)).fire(new It("rotate",i)).fire(new It("rotateend",i)),a&amp;&amp;this.fire(new It("pitchstart",i)).fire(new It("pitch",i)).fire(new It("pitchend",i)),this.fire(new It("moveend",i)))}getFreeCameraOptions(){return this.transform.projection.supportsFreeCamera||tt(fE),this.transform.getFreeCameraOptions()}setFreeCameraOptions(t,i){const r=this.transform;if(!r.projection.supportsFreeCamera)return tt(fE),this;this.stop();const n=r.zoom,s=r.pitch,a=r.bearing;r.setFreeCameraOptions(t);const l=n!==r.zoom,h=s!==r.pitch,d=a!==r.bearing;return this.fire(new It("movestart",i)).fire(new It("move",i)),l&amp;&amp;this.fire(new It("zoomstart",i)).fire(new It("zoom",i)).fire(new It("zoomend",i)),d&amp;&amp;this.fire(new It("rotatestart",i)).fire(new It("rotate",i)).fire(new It("rotateend",i)),h&amp;&amp;this.fire(new It("pitchstart",i)).fire(new It("pitch",i)).fire(new It("pitchend",i)),this.fire(new It("moveend",i)),this}easeTo(t,i){this._stop(!1,t.easeId),((t=Bt({offset:[0,0],duration:500,easing:Gr},t)).animate===!1||this._prefersReducedMotion(t))&amp;&amp;(t.duration=0);const r=this.transform,n=this.getZoom(),s=this.getBearing(),a=this.getPitch(),l=this.getPadding(),h="zoom"in t?+t.zoom:n,d="bearing"in t?this._normalizeBearing(t.bearing,s):s,f="pitch"in t?+t.pitch:a,m="padding"in t?t.padding:r.padding,_=Q.convert(t.offset);let y,x,b;if(r.projection.name==="globe"){const k=Be.fromLngLat(r.center),z=_.rotate(-r.angle);k.x+=z.x/r.worldSize,k.y+=z.y/r.worldSize;const B=k.toLngLat(),U=ye.convert(t.center||B);this._normalizeCenter(U),y=r.centerPoint.add(z),x=new Q(k.x,k.y).mult(r.worldSize),b=new Q(er(U.lng),sr(U.lat)).mult(r.worldSize).sub(x)}else{y=r.centerPoint.add(_);const k=r.pointLocation(y),z=ye.convert(t.center||k);this._normalizeCenter(z),x=r.project(k),b=r.project(z).sub(x)}const w=r.zoomScale(h-n);let T,S;t.around&amp;&amp;(T=ye.convert(t.around),S=r.locationPoint(T));const I=this._zooming||h!==n,P=this._rotating||s!==d,M=this._pitching||f!==a,C=!r.isPaddingEqual(m),D=k=&gt;z=&gt;{if(I&amp;&amp;(k.zoom=ge(n,h,z)),P&amp;&amp;(k.bearing=ge(s,d,z)),M&amp;&amp;(k.pitch=ge(a,f,z)),C&amp;&amp;(k.interpolatePadding(l,m,z),y=k.centerPoint.add(_)),T)k.setLocationAtPoint(T,S);else{const B=k.zoomScale(k.zoom-n),U=h&gt;n?Math.min(2,w):Math.max(.5,w),Z=Math.pow(U,1-z),F=k.unproject(x.add(b.mult(z*Z)).mult(B));k.setLocationAtPoint(k.renderWorldCopies?F.wrap():F,y)}return t.preloadOnly||this._fireMoveEvents(i),k};if(t.preloadOnly){const k=this._emulate(D,t.duration,r);return this._preloadTiles(k),this}const O={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=I,this._rotating=P,this._pitching=M,this._padding=C,this._easeId=t.easeId,this._prepareEase(i,t.noMoveStart,O),this._ease(D(r),k=&gt;{r.cameraElevationReference==="sea"&amp;&amp;r.recenterOnTerrain(),this._afterEase(i,k)},t),this}_prepareEase(t,i,r={}){this._moving=!0,this.transform.cameraElevationReference="sea",this.transform._orthographicProjectionAtLowPitch&amp;&amp;this.transform.pitch===0&amp;&amp;this.transform.projection.name!=="globe"&amp;&amp;(this.transform.cameraElevationReference="ground"),i||r.moving||this.fire(new It("movestart",t)),this._zooming&amp;&amp;!r.zooming&amp;&amp;this.fire(new It("zoomstart",t)),this._rotating&amp;&amp;!r.rotating&amp;&amp;this.fire(new It("rotatestart",t)),this._pitching&amp;&amp;!r.pitching&amp;&amp;this.fire(new It("pitchstart",t))}_fireMoveEvents(t){this.fire(new It("move",t)),this._zooming&amp;&amp;this.fire(new It("zoom",t)),this._rotating&amp;&amp;this.fire(new It("rotate",t)),this._pitching&amp;&amp;this.fire(new It("pitch",t))}_afterEase(t,i){if(this._easeId&amp;&amp;i&amp;&amp;this._easeId===i)return;this._easeId=void 0,this.transform.cameraElevationReference="ground";const r=this._zooming,n=this._rotating,s=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,r&amp;&amp;this.fire(new It("zoomend",t)),n&amp;&amp;this.fire(new It("rotateend",t)),s&amp;&amp;this.fire(new It("pitchend",t)),this.fire(new It("moveend",t))}flyTo(t,i){if(this._prefersReducedMotion(t)){const K=nr(t,["center","zoom","bearing","pitch","around"]);return this.jumpTo(K,i)}this.stop(),t=Bt({offset:[0,0],speed:1.2,curve:1.42,easing:Gr},t);const r=this.transform,n=this.getZoom(),s=this.getBearing(),a=this.getPitch(),l=this.getPadding(),h="zoom"in t?Xt(+t.zoom,r.minZoom,r.maxZoom):n,d="bearing"in t?this._normalizeBearing(t.bearing,s):s,f="pitch"in t?+t.pitch:a,m="padding"in t?t.padding:r.padding,_=r.zoomScale(h-n),y=Q.convert(t.offset);let x=r.centerPoint.add(y);const b=r.pointLocation(x),w=ye.convert(t.center||b);this._normalizeCenter(w);const T=r.project(b),S=r.project(w).sub(T);let I=t.curve;const P=Math.max(r.width,r.height),M=P/_,C=S.mag();if("minZoom"in t){const K=Xt(Math.min(t.minZoom,n,h),r.minZoom,r.maxZoom),ot=P/r.zoomScale(K-n);I=Math.sqrt(ot/C*2)}const D=I*I;function O(K){const ot=(M*M-P*P+(K?-1:1)*D*D*C*C)/(2*(K?M:P)*D*C);return Math.log(Math.sqrt(ot*ot+1)-ot)}function k(K){return(Math.exp(K)-Math.exp(-K))/2}function z(K){return(Math.exp(K)+Math.exp(-K))/2}const B=O(0);let U=function(K){return z(B)/z(B+I*K)},Z=function(K){return P*((z(B)*(k(ot=B+I*K)/z(ot))-k(B))/D)/C;var ot},F=(O(1)-B)/I;if(Math.abs(C)&lt;1e-6||!isFinite(F)){if(Math.abs(P-M)&lt;1e-6)return this.easeTo(t,i);const K=M&lt;P?-1:1;F=Math.abs(Math.log(M/P))/I,Z=function(){return 0},U=function(ot){return Math.exp(K*I*ot)}}t.duration="duration"in t?+t.duration:1e3*F/("screenSpeed"in t?+t.screenSpeed/I:+t.speed),t.maxDuration&amp;&amp;t.duration&gt;t.maxDuration&amp;&amp;(t.duration=0);const Y=s!==d,J=f!==a,it=!r.isPaddingEqual(m),X=K=&gt;ot=&gt;{const lt=ot*F,at=1/U(lt);K.zoom=ot===1?h:n+K.scaleZoom(at),Y&amp;&amp;(K.bearing=ge(s,d,ot)),J&amp;&amp;(K.pitch=ge(a,f,ot)),it&amp;&amp;(K.interpolatePadding(l,m,ot),x=K.centerPoint.add(y));const dt=ot===1?w:K.unproject(T.add(S.mult(Z(lt))).mult(at));return K.setLocationAtPoint(K.renderWorldCopies?dt.wrap():dt,x),K._updateCameraOnTerrain(),t.preloadOnly||this._fireMoveEvents(i),K};if(t.preloadOnly){const K=this._emulate(X,t.duration,r);return this._preloadTiles(K),this}return this._zooming=!0,this._rotating=Y,this._pitching=J,this._padding=it,this._prepareEase(i,!1),this._ease(X(r),()=&gt;this._afterEase(i),t),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(t,i){if(this._easeFrameId&amp;&amp;(this._cancelRenderFrame(this._easeFrameId),this._easeFrameId=void 0,this._onEaseFrame=void 0),this._onEaseEnd){const r=this._onEaseEnd;this._onEaseEnd=void 0,r.call(this,i)}if(!t){const r=this.handlers;r&amp;&amp;r.stop(!1)}return this}_ease(t,i,r){r.animate===!1||r.duration===0?(t(1),i()):(this._easeStart=_e.now(),this._easeOptions=r,this._onEaseFrame=t,this._onEaseEnd=i,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_renderFrameCallback(){const t=Math.min((_e.now()-this._easeStart)/this._easeOptions.duration,1),i=this._onEaseFrame;i&amp;&amp;i(this._easeOptions.easing(t)),t&lt;1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()}_normalizeBearing(t,i){t=Hr(t,-180,180);const r=Math.abs(t-i);return Math.abs(t-360-i)&lt;r&amp;&amp;(t-=360),Math.abs(t+360-i)&lt;r&amp;&amp;(t+=360),t}_normalizeCenter(t){const i=this.transform;if(i.maxBounds||i.projection.name!=="globe"&amp;&amp;!i.renderWorldCopies)return;const r=t.lng-i.center.lng;t.lng+=r&gt;180?-360:r&lt;-180?360:0}_prefersReducedMotion(t){return this._respectPrefersReducedMotion&amp;&amp;_e.prefersReducedMotion&amp;&amp;!(t&amp;&amp;t.essential)}_emulate(t,i,r){const n=Math.ceil(15*i/1e3),s=[],a=t(r.clone());for(let l=0;l&lt;=n;l++){const h=a(l/n);s.push(h.clone())}return s}}class pE{constructor(t={}){this.options=t,Oi(["_toggleAttribution","_updateEditLink","_updateData","_updateCompact"],this)}getDefaultPosition(){return"bottom-right"}onAdd(t){const i=this.options&amp;&amp;this.options.compact;return this._map=t,this._container=ci("div","mapboxgl-ctrl mapboxgl-ctrl-attrib"),this._compactButton=ci("button","mapboxgl-ctrl-attrib-button",this._container),ci("span","mapboxgl-ctrl-icon",this._compactButton).setAttribute("aria-hidden","true"),this._compactButton.type="button",this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=ci("div","mapboxgl-ctrl-attrib-inner",this._container),i&amp;&amp;this._container.classList.add("mapboxgl-compact"),this._updateAttributions(),this._updateEditLink(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("moveend",this._updateEditLink),i===void 0&amp;&amp;(this._map.on("resize",this._updateCompact),this._updateCompact()),this._container}onRemove(){this._container.remove(),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("moveend",this._updateEditLink),this._map.off("resize",this._updateCompact),this._map=void 0,this._attribHTML=void 0}_setElementTitle(t,i){const r=this._map._getUIString(`AttributionControl.${i}`);t.removeAttribute("title"),t.firstElementChild&amp;&amp;t.firstElementChild.setAttribute("title",r)}_toggleAttribution(){this._container.classList.contains("mapboxgl-compact-show")?(this._container.classList.remove("mapboxgl-compact-show"),this._compactButton.setAttribute("aria-expanded","false")):(this._container.classList.add("mapboxgl-compact-show"),this._compactButton.setAttribute("aria-expanded","true"))}_updateEditLink(){let t=this._editLink;t||(t=this._editLink=this._container.querySelector(".mapbox-improve-map"));const i=[{key:"owner",value:this.styleOwner},{key:"id",value:this.styleId},{key:"access_token",value:this._map._requestManager._customAccessToken||H.ACCESS_TOKEN}];if(t){const r=i.reduce((n,s,a)=&gt;(s.value&amp;&amp;(n+=`${s.key}=${s.value}${a&lt;i.length-1?"&amp;":""}`),n),"?");t.href=`${H.FEEDBACK_URL}/${r}#${aE(this._map,!0)}`,t.rel="noopener nofollow",this._setElementTitle(t,"MapFeedback")}}_updateData(t){!t||t.sourceDataType!=="metadata"&amp;&amp;t.sourceDataType!=="visibility"&amp;&amp;t.dataType!=="style"||(this._updateAttributions(),this._updateEditLink())}_updateAttributions(){if(!this._map.style)return;let t=[];if(this._map.style.stylesheet){const n=this._map.style.stylesheet;this.styleOwner=n.owner,this.styleId=n.id}const i=this._map.style._sourceCaches;for(const n in i){const s=i[n];if(s.used){const a=s.getSource();a.attribution&amp;&amp;t.indexOf(a.attribution)&lt;0&amp;&amp;t.push(a.attribution)}}t.sort((n,s)=&gt;n.length-s.length),t=t.filter((n,s)=&gt;{for(let a=s+1;a&lt;t.length;a++)if(t[a].indexOf(n)&gt;=0)return!1;return!0}),this.options.customAttribution&amp;&amp;(Array.isArray(this.options.customAttribution)?t=[...this.options.customAttribution,...t]:t.unshift(this.options.customAttribution));const r=t.join(" | ");r!==this._attribHTML&amp;&amp;(this._attribHTML=r,t.length?(this._innerContainer.innerHTML=r,this._container.classList.remove("mapboxgl-attrib-empty")):this._container.classList.add("mapboxgl-attrib-empty"),this._editLink=null)}_updateCompact(){this._map.getCanvasContainer().offsetWidth&lt;=640?this._container.classList.add("mapboxgl-compact"):this._container.classList.remove("mapboxgl-compact","mapboxgl-compact-show")}}class mE{constructor(){Oi(["_updateLogo","_updateCompact"],this)}onAdd(t){this._map=t,this._container=ci("div","mapboxgl-ctrl");const i=ci("a","mapboxgl-ctrl-logo");return i.target="_blank",i.rel="noopener nofollow",i.href="https://www.mapbox.com/",i.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),i.setAttribute("rel","noopener nofollow"),this._container.appendChild(i),this._container.style.display="none",this._map.on("sourcedata",this._updateLogo),this._updateLogo(),this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){this._container.remove(),this._map.off("sourcedata",this._updateLogo),this._map.off("resize",this._updateCompact)}getDefaultPosition(){return"bottom-left"}_updateLogo(t){t&amp;&amp;t.sourceDataType!=="metadata"||(this._container.style.display=this._logoRequired()?"block":"none")}_logoRequired(){if(!this._map.style)return!0;const t=this._map.style._sourceCaches;if(Object.entries(t).length===0)return!0;for(const i in t){const r=t[i].getSource();if(r.hasOwnProperty("mapbox_logo")&amp;&amp;!r.mapbox_logo)return!1}return!0}_updateCompact(){const t=this._container.children;if(t.length){const i=t[0];this._map.getCanvasContainer().offsetWidth&lt;250?i.classList.add("mapboxgl-compact"):i.classList.remove("mapboxgl-compact")}}}class _E{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(t){const i=++this._id;return this._queue.push({callback:t,id:i,cancelled:!1}),i}remove(t){const i=this._currentlyRunning,r=i?this._queue.concat(i):this._queue;for(const n of r)if(n.id===t)return void(n.cancelled=!0)}run(t=0){const i=this._currentlyRunning=this._queue;this._queue=[];for(const r of i)if(!r.cancelled&amp;&amp;(r.callback(t),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&amp;&amp;(this._cleared=!0),this._queue=[]}}function gE(e,t,i){if(e=new ye(e.lng,e.lat),t){const r=new ye(e.lng-360,e.lat),n=new ye(e.lng+360,e.lat),s=360*Math.ceil(Math.abs(e.lng-i.center.lng)/360),a=i.locationPoint(e).distSqr(t),l=t.x&lt;0||t.y&lt;0||t.x&gt;i.width||t.y&gt;i.height;i.locationPoint(r).distSqr(t)&lt;a&amp;&amp;(l||Math.abs(r.lng-i.center.lng)&lt;s)?e=r:i.locationPoint(n).distSqr(t)&lt;a&amp;&amp;(l||Math.abs(n.lng-i.center.lng)&lt;s)&amp;&amp;(e=n)}for(;Math.abs(e.lng-i.center.lng)&gt;180;){const r=i.locationPoint(e);if(r.x&gt;=0&amp;&amp;r.y&gt;=0&amp;&amp;r.x&lt;=i.width&amp;&amp;r.y&lt;=i.height)break;e.lng&gt;i.center.lng?e.lng-=360:e.lng+=360}return e}const sg={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%)"};class og extends Zi{constructor(t,i){if(super(),(t instanceof L.HTMLElement||i)&amp;&amp;(t=Bt({element:t},i)),Oi(["_update","_onMove","_onUp","_addDragHandler","_onMapClick","_onKeyPress","_clearFadeTimer"],this),this._anchor=t&amp;&amp;t.anchor||"center",this._color=t&amp;&amp;t.color||"#3FB1CE",this._scale=t&amp;&amp;t.scale||1,this._draggable=t&amp;&amp;t.draggable||!1,this._clickTolerance=t&amp;&amp;t.clickTolerance||0,this._isDragging=!1,this._state="inactive",this._rotation=t&amp;&amp;t.rotation||0,this._rotationAlignment=t&amp;&amp;t.rotationAlignment||"auto",this._pitchAlignment=t&amp;&amp;t.pitchAlignment&amp;&amp;t.pitchAlignment||"auto",this._updateMoving=()=&gt;this._update(!0),this._occludedOpacity=t&amp;&amp;t.occludedOpacity||.2,t&amp;&amp;t.element)this._element=t.element,this._offset=Q.convert(t&amp;&amp;t.offset||[0,0]);else{this._defaultMarker=!0,this._element=ci("div");const s=41,a=27,l=Vn("svg",{display:"block",height:s*this._scale+"px",width:a*this._scale+"px",viewBox:`0 0 ${a} ${s}`},this._element),h=Vn("radialGradient",{id:"shadowGradient"},Vn("defs",{},l));Vn("stop",{offset:"10%","stop-opacity":.4},h),Vn("stop",{offset:"100%","stop-opacity":.05},h),Vn("ellipse",{cx:13.5,cy:34.8,rx:10.5,ry:5.25,fill:"url(#shadowGradient)"},l),Vn("path",{fill:this._color,d:"M27,13.5C27,19.07 20.25,27 14.75,34.5C14.02,35.5 12.98,35.5 12.25,34.5C6.75,27 0,19.22 0,13.5C0,6.04 6.04,0 13.5,0C20.96,0 27,6.04 27,13.5Z"},l),Vn("path",{opacity:.25,d:"M13.5,0C6.04,0 0,6.04 0,13.5C0,19.22 6.75,27 12.25,34.5C13,35.52 14.02,35.5 14.75,34.5C20.25,27 27,19.07 27,13.5C27,6.04 20.96,0 13.5,0ZM13.5,1C20.42,1 26,6.58 26,13.5C26,15.9 24.5,19.18 22.22,22.74C19.95,26.3 16.71,30.14 13.94,33.91C13.74,34.18 13.61,34.32 13.5,34.44C13.39,34.32 13.26,34.18 13.06,33.91C10.28,30.13 7.41,26.31 5.02,22.77C2.62,19.23 1,15.95 1,13.5C1,6.58 6.58,1 13.5,1Z"},l),Vn("circle",{fill:"white",cx:13.5,cy:13.5,r:5.5},l),this._offset=Q.convert(t&amp;&amp;t.offset||[0,-14])}this._element.hasAttribute("aria-label")||this._element.setAttribute("aria-label","Map marker"),this._element.hasAttribute("role")||this._element.setAttribute("role","img"),this._element.classList.add("mapboxgl-marker"),this._element.addEventListener("dragstart",s=&gt;{s.preventDefault()}),this._element.addEventListener("mousedown",s=&gt;{s.preventDefault()});const r=this._element.classList;for(const s in sg)r.remove(`mapboxgl-marker-anchor-${s}`);r.add(`mapboxgl-marker-anchor-${this._anchor}`);const n=t&amp;&amp;t.className?t.className.trim().split(/\s+/):[];r.add(...n),this._popup=null}addTo(t){return t===this._map||(this.remove(),this._map=t,t.getCanvasContainer().appendChild(this._element),t.on("move",this._updateMoving),t.on("moveend",this._update),t.on("remove",this._clearFadeTimer),t._addMarker(this),this.setDraggable(this._draggable),this._update(),t.on("click",this._onMapClick)),this}remove(){const t=this._map;return t&amp;&amp;(t.off("click",this._onMapClick),t.off("move",this._updateMoving),t.off("moveend",this._update),t.off("mousedown",this._addDragHandler),t.off("touchstart",this._addDragHandler),t.off("mouseup",this._onUp),t.off("touchend",this._onUp),t.off("mousemove",this._onMove),t.off("touchmove",this._onMove),t.off("remove",this._clearFadeTimer),t._removeMarker(this),this._map=void 0),this._clearFadeTimer(),this._element.remove(),this._popup&amp;&amp;this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(t){return this._lngLat=ye.convert(t),this._pos=null,this._popup&amp;&amp;this._popup.setLngLat(this._lngLat),this._update(!0),this}getElement(){return this._element}setPopup(t){if(this._popup&amp;&amp;(this._popup.remove(),this._popup=null,this._element.removeAttribute("role"),this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),t){if(!("offset"in t.options)){const n=Math.sqrt(Math.pow(13.5,2)/2);t.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[n,-1*(38.1-13.5+n)],"bottom-right":[-n,-1*(38.1-13.5+n)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=t,t._marker=this,this._lngLat&amp;&amp;this._popup.setLngLat(this._lngLat),this._element.setAttribute("role","button"),this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress),this._element.setAttribute("aria-expanded","false")}return this}_onKeyPress(t){const i=t.code,r=t.charCode||t.keyCode;i!=="Space"&amp;&amp;i!=="Enter"&amp;&amp;r!==32&amp;&amp;r!==13||this.togglePopup()}_onMapClick(t){const i=t.originalEvent.target,r=this._element;this._popup&amp;&amp;(i===r||r.contains(i))&amp;&amp;this.togglePopup()}getPopup(){return this._popup}togglePopup(){const t=this._popup;return t?(t.isOpen()?(t.remove(),this._element.setAttribute("aria-expanded","false")):this._map&amp;&amp;(t.addTo(this._map),this._element.setAttribute("aria-expanded","true")),this):this}_behindTerrain(){const t=this._map,i=this._pos;if(!t||!i)return!1;const r=t.unproject(i),n=t.getFreeCameraOptions();if(!n.position)return!1;const s=n.position.toLngLat();return s.distanceTo(r)&lt;.9*s.distanceTo(this._lngLat)}_evaluateOpacity(){const t=this._map;if(!t)return;const i=this._pos;if(!i||i.x&lt;0||i.x&gt;t.transform.width||i.y&lt;0||i.y&gt;t.transform.height)return void this._clearFadeTimer();const r=t.unproject(i);let n;t._showingGlobe()&amp;&amp;Sh(t.transform,this._lngLat)?n=0:(n=1-t._queryFogOpacity(r),t.transform._terrainEnabled()&amp;&amp;t.getTerrain()&amp;&amp;this._behindTerrain()&amp;&amp;(n*=this._occludedOpacity)),this._element.style.opacity=`${n}`,this._element.style.pointerEvents=n&gt;0?"auto":"none",this._popup&amp;&amp;this._popup._setOpacity(n),this._fadeTimer=null}_clearFadeTimer(){this._fadeTimer&amp;&amp;(clearTimeout(this._fadeTimer),this._fadeTimer=null)}_updateDOM(){const t=this._pos;if(!t||!this._map)return;const i=this._offset.mult(this._scale);this._element.style.transform=`
            translate(${t.x}px,${t.y}px)
            ${sg[this._anchor]}
            ${this._calculateXYTransform()} ${this._calculateZTransform()}
            translate(${i.x}px,${i.y}px)
        `}_calculateXYTransform(){const t=this._pos,i=this._map,r=this.getPitchAlignment();if(!i||!t||r!=="map")return"";if(!i._showingGlobe()){const h=i.getPitch();return h?`rotateX(${h}deg)`:""}const n=vi(n1(i.transform,this._lngLat)),s=t.sub(r1(i.transform)),a=Math.abs(s.x)+Math.abs(s.y);if(a===0)return"";const l=n/a;return`rotateX(${-s.y*l}deg) rotateY(${s.x*l}deg)`}_calculateZTransform(){const t=this._pos,i=this._map;if(!i||!t)return"";let r=0;const n=this.getRotationAlignment();if(n==="map")if(i._showingGlobe()){const s=i.project(new ye(this._lngLat.lng,this._lngLat.lat+.001)),a=i.project(new ye(this._lngLat.lng,this._lngLat.lat-.001)).sub(s);r=vi(Math.atan2(a.y,a.x))-90}else r=-i.getBearing();else if(n==="horizon"){const s=xn(4,6,i.getZoom()),a=r1(i.transform);a.y+=s*i.transform.height;const l=t.sub(a),h=vi(Math.atan2(l.y,l.x));r=(h&gt;90?h-270:h+90)*(1-s)}return r+=this._rotation,r?`rotateZ(${r}deg)`:""}_update(t){L.cancelAnimationFrame(this._updateFrameId);const i=this._map;i&amp;&amp;(i.transform.renderWorldCopies&amp;&amp;(this._lngLat=gE(this._lngLat,this._pos,i.transform)),this._pos=i.project(this._lngLat),t===!0?this._updateFrameId=L.requestAnimationFrame(()=&gt;{this._element&amp;&amp;this._pos&amp;&amp;this._anchor&amp;&amp;(this._pos=this._pos.round(),this._updateDOM())}):this._pos=this._pos.round(),i._requestDomTask(()=&gt;{this._map&amp;&amp;(this._element&amp;&amp;this._pos&amp;&amp;this._anchor&amp;&amp;this._updateDOM(),(i._showingGlobe()||i.getTerrain()||i.getFog())&amp;&amp;!this._fadeTimer&amp;&amp;(this._fadeTimer=setTimeout(this._evaluateOpacity.bind(this),60)))}))}getOffset(){return this._offset}setOffset(t){return this._offset=Q.convert(t),this._update(),this}addClassName(t){return this._element.classList.add(t),this}removeClassName(t){return this._element.classList.remove(t),this}toggleClassName(t){return this._element.classList.toggle(t)}_onMove(t){const i=this._map;if(!i)return;const r=this._pointerdownPos,n=this._positionDelta;if(r&amp;&amp;n){if(!this._isDragging){const s=this._clickTolerance||i._clickTolerance;if(t.point.dist(r)&lt;s)return;this._isDragging=!0}this._pos=t.point.sub(n),this._lngLat=i.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none",this._state==="pending"&amp;&amp;(this._state="active",this.fire(new It("dragstart"))),this.fire(new It("drag"))}}_onUp(){this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1;const t=this._map;t&amp;&amp;(t.off("mousemove",this._onMove),t.off("touchmove",this._onMove)),this._state==="active"&amp;&amp;this.fire(new It("dragend")),this._state="inactive"}_addDragHandler(t){const i=this._map,r=this._pos;i&amp;&amp;r&amp;&amp;this._element.contains(t.originalEvent.target)&amp;&amp;(t.preventDefault(),this._positionDelta=t.point.sub(r),this._pointerdownPos=t.point,this._state="pending",i.on("mousemove",this._onMove),i.on("touchmove",this._onMove),i.once("mouseup",this._onUp),i.once("touchend",this._onUp))}setDraggable(t){this._draggable=!!t;const i=this._map;return i&amp;&amp;(t?(i.on("mousedown",this._addDragHandler),i.on("touchstart",this._addDragHandler)):(i.off("mousedown",this._addDragHandler),i.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}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==="auto"||this._rotationAlignment==="horizon"&amp;&amp;this._map&amp;&amp;!this._map._showingGlobe()?"viewport":this._rotationAlignment}setPitchAlignment(t){return this._pitchAlignment=t||"auto",this._update(),this}getPitchAlignment(){return this._pitchAlignment==="auto"?this.getRotationAlignment():this._pitchAlignment}setOccludedOpacity(t){return this._occludedOpacity=t||.2,this._update(),this}getOccludedOpacity(){return this._occludedOpacity}}const ik={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px"},rk=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function yE(e=new Q(0,0),t="bottom"){if(typeof e=="number"){const i=Math.round(Math.sqrt(.5*Math.pow(e,2)));switch(t){case"top":return new Q(0,e);case"top-left":return new Q(i,i);case"top-right":return new Q(-i,i);case"bottom":return new Q(0,-e);case"bottom-left":return new Q(i,-i);case"bottom-right":return new Q(-i,-i);case"left":return new Q(e,0);case"right":return new Q(-e,0)}return new Q(0,0)}return e instanceof Q||Array.isArray(e)?Q.convert(e):Q.convert(e[t]||[0,0])}class nk{constructor(t){this.jumpTo(t)}getValue(t){if(t&lt;=this._startTime)return this._start;if(t&gt;=this._endTime)return this._end;const i=jr((t-this._startTime)/(this._endTime-this._startTime));return this._start*(1-i)+this._end*i}isEasing(t){return t&gt;=this._startTime&amp;&amp;t&lt;=this._endTime}jumpTo(t){this._startTime=-1/0,this._endTime=-1/0,this._start=t,this._end=t}easeTo(t,i,r){this._start=this.getValue(i),this._end=t,this._startTime=i,this._endTime=i+r}}const sk={"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":"Mapbox logo","Map.Title":"Map","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","ScrollZoomBlocker.CtrlMessage":"Use ctrl + scroll to zoom the map","ScrollZoomBlocker.CmdMessage":"Use ⌘ + scroll to zoom the map","TouchPanBlocker.Message":"Use two fingers to move the map"},ok={center:[0,0],zoom:0,bearing:0,pitch:0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:85,interactive:!0,scrollZoom:!0,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:!1,performanceMetricsCollection:!0,bearingSnap:7,clickTolerance:3,pitchWithRotate:!0,hash:!1,attributionControl:!0,antialias:!1,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:!1,trackResize:!0,renderWorldCopies:!0,refreshExpiredTiles:!0,minTileCacheSize:null,maxTileCacheSize:null,localIdeographFontFamily:"sans-serif",localFontFamily:null,transformRequest:null,accessToken:null,fadeDuration:300,respectPrefersReducedMotion:!0,crossSourceCollisions:!0,collectResourceTiming:!1,testMode:!1},ak={showCompass:!0,showZoom:!0,visualizePitch:!1};class lk{constructor(t,i,r=!1){this._clickTolerance=10,this.element=i,this.mouseRotate=new lE({clickTolerance:t.dragRotate._mouseRotate._clickTolerance}),this.map=t,r&amp;&amp;(this.mousePitch=new cE({clickTolerance:t.dragRotate._mousePitch._clickTolerance})),Oi(["mousedown","mousemove","mouseup","touchstart","touchmove","touchend","reset"],this),i.addEventListener("mousedown",this.mousedown),i.addEventListener("touchstart",this.touchstart,{passive:!1}),i.addEventListener("touchmove",this.touchmove),i.addEventListener("touchend",this.touchend),i.addEventListener("touchcancel",this.reset)}down(t,i){this.mouseRotate.mousedown(t,i),this.mousePitch&amp;&amp;this.mousePitch.mousedown(t,i),rt()}move(t,i){const r=this.map,n=this.mouseRotate.mousemoveWindow(t,i),s=n&amp;&amp;n.bearingDelta;if(s&amp;&amp;r.setBearing(r.getBearing()+s),this.mousePitch){const a=this.mousePitch.mousemoveWindow(t,i),l=a&amp;&amp;a.pitchDelta;l&amp;&amp;r.setPitch(r.getPitch()+l)}}off(){const t=this.element;t.removeEventListener("mousedown",this.mousedown),t.removeEventListener("touchstart",this.touchstart,{passive:!1}),t.removeEventListener("touchmove",this.touchmove),t.removeEventListener("touchend",this.touchend),t.removeEventListener("touchcancel",this.reset),this.offTemp()}offTemp(){xt(),L.removeEventListener("mousemove",this.mousemove),L.removeEventListener("mouseup",this.mouseup)}mousedown(t){this.down(Bt({},t,{ctrlKey:!0,preventDefault:()=&gt;t.preventDefault()}),$e(this.element,t)),L.addEventListener("mousemove",this.mousemove),L.addEventListener("mouseup",this.mouseup)}mousemove(t){this.move(t,$e(this.element,t))}mouseup(t){this.mouseRotate.mouseupWindow(t),this.mousePitch&amp;&amp;this.mousePitch.mouseupWindow(t),this.offTemp()}touchstart(t){t.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=Qi(this.element,t.targetTouches)[0],this.down({type:"mousedown",button:0,ctrlKey:!0,preventDefault:()=&gt;t.preventDefault()},this._startPos))}touchmove(t){t.targetTouches.length!==1?this.reset():(this._lastPos=Qi(this.element,t.targetTouches)[0],this.move({preventDefault:()=&gt;t.preventDefault()},this._lastPos))}touchend(t){t.targetTouches.length===0&amp;&amp;this._startPos&amp;&amp;this._lastPos&amp;&amp;this._startPos.dist(this._lastPos)&lt;this._clickTolerance&amp;&amp;this.element.click(),this.reset()}reset(){this.mouseRotate.reset(),this.mousePitch&amp;&amp;this.mousePitch.reset(),delete this._startPos,delete this._lastPos,this.offTemp()}}const ck={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0,showUserHeading:!1},uk={maxWidth:100,unit:"metric"},hk={kilometer:"km",meter:"m",mile:"mi",foot:"ft","nautical-mile":"nm"},jd={version:G,supported:Zo,setRTLTextPlugin:function(e,t,i=!1){if(Yr===Fp||Yr===Bp||Yr===Np)throw new Error("setRTLTextPlugin cannot be called multiple times.");_o=_e.resolveURL(e),Yr=Fp,Up=t,Vp(),i||ox()},getRTLTextPluginStatus:Gp,Map:class extends ek{constructor(e){Kl.mark(Wr.create);const t=e;if((e=Bt({},ok,e)).minZoom!=null&amp;&amp;e.maxZoom!=null&amp;&amp;e.minZoom&gt;e.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(e.minPitch!=null&amp;&amp;e.maxPitch!=null&amp;&amp;e.minPitch&gt;e.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(e.minPitch!=null&amp;&amp;e.minPitch&lt;0)throw new Error("minPitch must be greater than or equal to 0");if(e.maxPitch!=null&amp;&amp;e.maxPitch&gt;85)throw new Error("maxPitch must be less than or equal to 85");if(e.antialias&amp;&amp;function(i){const r=i.navigator?i.navigator.userAgent:null;return!!function(n){if(he==null){const s=n.navigator?n.navigator.userAgent:null;he=!!n.safari||!(!s||!(/\b(iPad|iPhone|iPod)\b/.test(s)||s.match("Safari")&amp;&amp;!s.match("Chrome")))}return he}(i)&amp;&amp;r&amp;&amp;(r.match("Version/15.4")||r.match("Version/15.5")||r.match(/CPU (OS|iPhone OS) (15_4|15_5) like Mac OS X/))}(L)&amp;&amp;(e.antialias=!1,tt("Antialiasing is disabled for this WebGL context to avoid browser bug: https://github.com/mapbox/mapbox-gl-js/issues/11609")),super(new v_(e.minZoom,e.maxZoom,e.minPitch,e.maxPitch,e.renderWorldCopies),e),this._interactive=e.interactive,this._minTileCacheSize=e.minTileCacheSize,this._maxTileCacheSize=e.maxTileCacheSize,this._failIfMajorPerformanceCaveat=e.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=e.preserveDrawingBuffer,this._antialias=e.antialias,this._trackResize=e.trackResize,this._bearingSnap=e.bearingSnap,this._refreshExpiredTiles=e.refreshExpiredTiles,this._fadeDuration=e.fadeDuration,this._isInitialLoad=!0,this._crossSourceCollisions=e.crossSourceCollisions,this._collectResourceTiming=e.collectResourceTiming,this._language=this._parseLanguage(e.language),this._worldview=e.worldview,this._renderTaskQueue=new _E,this._domRenderTaskQueue=new _E,this._controls=[],this._markers=[],this._popups=[],this._mapId=ar(),this._locale=Bt({},sk,e.locale),this._clickTolerance=e.clickTolerance,this._cooperativeGestures=e.cooperativeGestures,this._performanceMetricsCollection=e.performanceMetricsCollection,this._containerWidth=0,this._containerHeight=0,this._averageElevationLastSampledAt=-1/0,this._averageElevationExaggeration=0,this._averageElevation=new nk(0),this._interactionRange=[1/0,-1/0],this._visibilityHidden=0,this._useExplicitProjection=!1,this._requestManager=new oe(e.transformRequest,e.accessToken,e.testMode),this._silenceAuthErrors=!!e.testMode,this._contextCreateOptions=e.contextCreateOptions?{...e.contextCreateOptions}:{},typeof e.container=="string"){if(this._container=L.document.getElementById(e.container),!this._container)throw new Error(`Container '${e.container.toString()}' not found.`)}else{if(!(e.container instanceof L.HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=e.container}if(this._container.childNodes.length&gt;0&amp;&amp;tt("The map container element should be empty, otherwise the map's interactivity will be negatively impacted. If you want to display a message when WebGL is not supported, use the Mapbox GL Supported plugin instead."),e.maxBounds&amp;&amp;this.setMaxBounds(e.maxBounds),Oi(["_onWindowOnline","_onWindowResize","_onVisibilityChange","_onMapScroll","_contextLost","_contextRestored"],this),this._setupContainer(),this._setupPainter(),this.painter===void 0)throw new Error("Failed to initialize WebGL.");if(this.on("move",()=&gt;this._update(!1)),this.on("moveend",()=&gt;this._update(!1)),this.on("zoom",()=&gt;this._update(!0)),L!==void 0&amp;&amp;(this._fullscreenchangeEvent="onfullscreenchange"in L.document?"fullscreenchange":"webkitfullscreenchange",L.addEventListener("online",this._onWindowOnline,!1),L.addEventListener("resize",this._onWindowResize,!1),L.addEventListener("orientationchange",this._onWindowResize,!1),L.addEventListener(this._fullscreenchangeEvent,this._onWindowResize,!1),L.addEventListener("visibilitychange",this._onVisibilityChange,!1)),this.handlers=new tk(this,e),this._localFontFamily=e.localFontFamily,this._localIdeographFontFamily=e.localIdeographFontFamily,(e.style||!e.testMode)&amp;&amp;this.setStyle(e.style||H.DEFAULT_STYLE,{localFontFamily:this._localFontFamily,localIdeographFontFamily:this._localIdeographFontFamily}),e.projection&amp;&amp;this.setProjection(e.projection),e.hash&amp;&amp;(this._hash=new EO(typeof e.hash=="string"&amp;&amp;e.hash||void 0).addTo(this)),!this._hash||!this._hash._onHashChange()){t.center==null&amp;&amp;t.zoom==null||(this.transform._unmodified=!1),this.jumpTo({center:e.center,zoom:e.zoom,bearing:e.bearing,pitch:e.pitch});const i=e.bounds;i&amp;&amp;(this.resize(),this.fitBounds(i,Bt({},e.fitBoundsOptions,{duration:0})))}this.resize(),e.attributionControl&amp;&amp;this.addControl(new pE({customAttribution:e.customAttribution})),this._logoControl=new mE,this.addControl(this._logoControl,e.logoPosition),this.on("style.load",()=&gt;{this.transform.unmodified&amp;&amp;this.jumpTo(this.style.stylesheet)}),this.on("data",i=&gt;{this._update(i.dataType==="style"),this.fire(new It(`${i.dataType}data`,i))}),this.on("dataloading",i=&gt;{this.fire(new It(`${i.dataType}dataloading`,i))})}_getMapId(){return this._mapId}addControl(e,t){if(t===void 0&amp;&amp;(t=e.getDefaultPosition?e.getDefaultPosition():"top-right"),!e||!e.onAdd)return this.fire(new xe(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const i=e.onAdd(this);this._controls.push(e);const r=this._controlPositions[t];return t.indexOf("bottom")!==-1?r.insertBefore(i,r.firstChild):r.appendChild(i),this}removeControl(e){if(!e||!e.onRemove)return this.fire(new xe(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const t=this._controls.indexOf(e);return t&gt;-1&amp;&amp;this._controls.splice(t,1),e.onRemove(this),this}hasControl(e){return this._controls.indexOf(e)&gt;-1}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}resize(e){if(this._updateContainerDimensions(),this._containerWidth===this.transform.width&amp;&amp;this._containerHeight===this.transform.height)return this;this._resizeCanvas(this._containerWidth,this._containerHeight),this.transform.resize(this._containerWidth,this._containerHeight),this.painter.resize(Math.ceil(this._containerWidth),Math.ceil(this._containerHeight));const t=!this._moving;return t&amp;&amp;this.fire(new It("movestart",e)).fire(new It("move",e)),this.fire(new It("resize",e)),t&amp;&amp;this.fire(new It("moveend",e)),this}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()||null}setMaxBounds(e){return this.transform.setMaxBounds(Qr.convert(e)),this._update()}setMinZoom(e){if((e=e??-2)&gt;=-2&amp;&amp;e&lt;=this.transform.maxZoom)return this.transform.minZoom=e,this._update(),this.getZoom()&lt;e?this.setZoom(e):this.fire(new It("zoomstart")).fire(new It("zoom")).fire(new It("zoomend")),this;throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(e){if((e=e??22)&gt;=this.transform.minZoom)return this.transform.maxZoom=e,this._update(),this.getZoom()&gt;e?this.setZoom(e):this.fire(new It("zoomstart")).fire(new It("zoom")).fire(new It("zoomend")),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(e){if((e=e??0)&lt;0)throw new Error("minPitch must be greater than or equal to 0");if(e&gt;=0&amp;&amp;e&lt;=this.transform.maxPitch)return this.transform.minPitch=e,this._update(),this.getPitch()&lt;e?this.setPitch(e):this.fire(new It("pitchstart")).fire(new It("pitch")).fire(new It("pitchend")),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(e){if((e=e??85)&gt;85)throw new Error("maxPitch must be less than or equal to 85");if(e&gt;=this.transform.minPitch)return this.transform.maxPitch=e,this._update(),this.getPitch()&gt;e?this.setPitch(e):this.fire(new It("pitchstart")).fire(new It("pitch")).fire(new It("pitchend")),this;throw new Error("maxPitch must be greater than or equal to minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(e){return this.transform.renderWorldCopies=e,this.transform.renderWorldCopies||this._forceMarkerAndPopupUpdate(!0),this._update()}getLanguage(){return this._language}_parseLanguage(e){return e==="auto"?L.navigator.language:Array.isArray(e)?e.length===0?void 0:e.map(t=&gt;t==="auto"?L.navigator.language:t):e}setLanguage(e){const t=this._parseLanguage(e);if(!this.style||t===this._language)return this;this._language=t,this.style.reloadSources();for(const i of this._controls)i._setLanguage&amp;&amp;i._setLanguage(this._language);return this}getWorldview(){return this._worldview}setWorldview(e){return this.style&amp;&amp;e!==this._worldview?(this._worldview=e,this.style.reloadSources(),this):this}getProjection(){return this.transform.mercatorFromTransition?{name:"globe",center:[0,0]}:this.transform.getProjection()}_showingGlobe(){return this.transform.projection.name==="globe"}setProjection(e){return this._lazyInitEmptyStyle(),e?typeof e=="string"&amp;&amp;(e={name:e}):e=null,this._useExplicitProjection=!!e,this._prioritizeAndUpdateProjection(e,this.style.projection)}_updateProjectionTransition(){if(this.getProjection().name!=="globe")return;const e=this.transform,t=e.projection.name;let i;t==="globe"&amp;&amp;e.zoom&gt;=To?(e.setMercatorFromTransition(),i=!0):t==="mercator"&amp;&amp;e.zoom&lt;To&amp;&amp;(e.setProjection({name:"globe"}),i=!0),i&amp;&amp;(this.style.applyProjectionUpdate(),this.style._forceSymbolLayerUpdate())}_prioritizeAndUpdateProjection(e,t){return this._updateProjection(e||t||{name:"mercator"})}_updateProjection(e){let t;return t=e.name==="globe"&amp;&amp;this.transform.zoom&gt;=To?this.transform.setMercatorFromTransition():this.transform.setProjection(e),this.style.applyProjectionUpdate(),t&amp;&amp;(this.painter.clearBackgroundTiles(),this.style.clearSources(),this._update(!0),this._forceMarkerAndPopupUpdate(!0)),this}project(e){return this.transform.locationPoint3D(ye.convert(e))}unproject(e){return this.transform.pointLocation3D(Q.convert(e))}isMoving(){return this._moving||this.handlers&amp;&amp;this.handlers.isMoving()||!1}isZooming(){return this._zooming||this.handlers&amp;&amp;this.handlers.isZooming()||!1}isRotating(){return this._rotating||this.handlers&amp;&amp;this.handlers.isRotating()||!1}_isDragging(){return this.handlers&amp;&amp;this.handlers._isDragging()||!1}_createDelegatedListener(e,t,i){if(e==="mouseenter"||e==="mouseover"){let r=!1;const n=a=&gt;{const l=t.filter(d=&gt;this.getLayer(d)),h=l.length?this.queryRenderedFeatures(a.point,{layers:l}):[];h.length?r||(r=!0,i.call(this,new mn(e,this,a.originalEvent,{features:h}))):r=!1},s=()=&gt;{r=!1};return{layers:new Set(t),listener:i,delegates:{mousemove:n,mouseout:s}}}if(e==="mouseleave"||e==="mouseout"){let r=!1;const n=a=&gt;{const l=t.filter(h=&gt;this.getLayer(h));(l.length?this.queryRenderedFeatures(a.point,{layers:l}):[]).length?r=!0:r&amp;&amp;(r=!1,i.call(this,new mn(e,this,a.originalEvent)))},s=a=&gt;{r&amp;&amp;(r=!1,i.call(this,new mn(e,this,a.originalEvent)))};return{layers:new Set(t),listener:i,delegates:{mousemove:n,mouseout:s}}}{const r=n=&gt;{const s=t.filter(l=&gt;this.getLayer(l)),a=s.length?this.queryRenderedFeatures(n.point,{layers:s}):[];a.length&amp;&amp;(n.features=a,i.call(this,n),delete n.features)};return{layers:new Set(t),listener:i,delegates:{[e]:r}}}}on(e,t,i){if(i===void 0)return super.on(e,t);if(Array.isArray(t)||(t=[t]),t){for(const n of t)if(!this._isValidId(n))return this}const r=this._createDelegatedListener(e,t,i);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[e]=this._delegatedListeners[e]||[],this._delegatedListeners[e].push(r);for(const n in r.delegates)this.on(n,r.delegates[n]);return this}once(e,t,i){if(i===void 0)return super.once(e,t);if(Array.isArray(t)||(t=[t]),t){for(const n of t)if(!this._isValidId(n))return this}const r=this._createDelegatedListener(e,t,i);for(const n in r.delegates)this.once(n,r.delegates[n]);return this}off(e,t,i){if(i===void 0)return super.off(e,t);t=new Set(Array.isArray(t)?t:[t]);for(const s of t)if(!this._isValidId(s))return this;const r=(s,a)=&gt;{if(s.size!==a.size)return!1;for(const l of s)if(!a.has(l))return!1;return!0},n=this._delegatedListeners?this._delegatedListeners[e]:void 0;return n&amp;&amp;(s=&gt;{for(let a=0;a&lt;s.length;a++){const l=s[a];if(l.listener===i&amp;&amp;r(l.layers,t)){for(const h in l.delegates)this.off(h,l.delegates[h]);return s.splice(a,1),this}}})(n),this}queryRenderedFeatures(e,t){if(!this.style)return[];if(t!==void 0||e===void 0||e instanceof Q||Array.isArray(e)||(t=e,e=void 0),e=e||[[0,0],[this.transform.width,this.transform.height]],(t=t||{}).layers&amp;&amp;Array.isArray(t.layers)){for(const i of t.layers)if(!this._isValidId(i))return[]}return this.style.queryRenderedFeatures(e,t,this.transform)}querySourceFeatures(e,t){return this._isValidId(e)?this.style.querySourceFeatures(e,t):[]}isPointOnSurface(e){const{name:t}=this.transform.projection;return t!=="globe"&amp;&amp;t!=="mercator"&amp;&amp;tt(`${t} projection does not support isPointOnSurface, this API may behave unexpectedly.`),this.transform.isPointOnSurface(Q.convert(e))}setStyle(e,t){return(t=Bt({},{localIdeographFontFamily:this._localIdeographFontFamily,localFontFamily:this._localFontFamily},t)).diff!==!1&amp;&amp;t.localIdeographFontFamily===this._localIdeographFontFamily&amp;&amp;t.localFontFamily===this._localFontFamily&amp;&amp;this.style&amp;&amp;e?(this._diffStyle(e,t),this):(this._localIdeographFontFamily=t.localIdeographFontFamily,this._localFontFamily=t.localFontFamily,this._updateStyle(e,t))}_getUIString(e){const t=this._locale[e];if(t==null)throw new Error(`Missing UI string '${e}'`);return t}_updateStyle(e,t){return this.style&amp;&amp;(this.style.setEventedParent(null),this.style._remove(),this.style=void 0),e&amp;&amp;(this.style=new Kn(this,t||{}),this.style.setEventedParent(this,{style:this.style}),typeof e=="string"?this.style.loadURL(e):this.style.loadJSON(e)),this._updateTerrain(),this}_lazyInitEmptyStyle(){this.style||(this.style=new Kn(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(e,t){if(typeof e=="string"){const i=this._requestManager.normalizeStyleURL(e),r=this._requestManager.transformRequest(i,pt.Style);Rt(r,(n,s)=&gt;{n?this.fire(new xe(n)):s&amp;&amp;this._updateDiff(s,t)})}else typeof e=="object"&amp;&amp;this._updateDiff(e,t)}_updateDiff(e,t){try{this.style.setState(e)&amp;&amp;this._update(!0)}catch(i){tt(`Unable to perform style diff: ${i.message||i.error||i}.  Rebuilding the style from scratch.`),this._updateStyle(e,t)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():(tt("There is no style added to the map."),!1)}_isValidId(e){return e==null?(this.fire(new xe(new Error("IDs can't be empty."))),!1):!cx(e)||(this.fire(new xe(new Error(`IDs can't contain special symbols: "${e}".`))),!1)}addSource(e,t){return this._isValidId(e)?(this._lazyInitEmptyStyle(),this.style.addSource(e,t),this._update(!0)):this}isSourceLoaded(e){return!!this._isValidId(e)&amp;&amp;!!this.style&amp;&amp;this.style._isSourceCacheLoaded(e)}areTilesLoaded(){const e=this.style&amp;&amp;this.style._sourceCaches;for(const t in e){const i=e[t]._tiles;for(const r in i){const n=i[r];if(n.state!=="loaded"&amp;&amp;n.state!=="errored")return!1}}return!0}addSourceType(e,t,i){this._lazyInitEmptyStyle(),this.style.addSourceType(e,t,i)}removeSource(e){return this._isValidId(e)?(this.style.removeSource(e),this._updateTerrain(),this._update(!0)):this}getSource(e){return this._isValidId(e)?this.style.getOwnSource(e):null}addImage(e,t,{pixelRatio:i=1,sdf:r=!1,stretchX:n,stretchY:s,content:a}={}){if(this._lazyInitEmptyStyle(),t instanceof L.HTMLImageElement||L.ImageBitmap&amp;&amp;t instanceof L.ImageBitmap){const{width:l,height:h,data:d}=_e.getImageData(t);this.style.addImage(e,{data:new Hi({width:l,height:h},d),pixelRatio:i,stretchX:n,stretchY:s,content:a,sdf:r,version:0})}else if(t.width===void 0||t.height===void 0)this.fire(new xe(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));else{const{width:l,height:h}=t,d=t;this.style.addImage(e,{data:new Hi({width:l,height:h},new Uint8Array(d.data)),pixelRatio:i,stretchX:n,stretchY:s,content:a,sdf:r,version:0,userImage:d}),d.onAdd&amp;&amp;d.onAdd(this,e)}}updateImage(e,t){this._lazyInitEmptyStyle();const i=this.style.getImage(e);if(!i)return void this.fire(new xe(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const r=t instanceof L.HTMLImageElement||L.ImageBitmap&amp;&amp;t instanceof L.ImageBitmap?_e.getImageData(t):t,{width:n,height:s}=r;n!==void 0&amp;&amp;s!==void 0?n===i.data.width&amp;&amp;s===i.data.height?(i.data.replace(r.data,!(t instanceof L.HTMLImageElement||L.ImageBitmap&amp;&amp;t instanceof L.ImageBitmap)),this.style.updateImage(e,i)):this.fire(new xe(new Error(`The width and height of the updated image (${n}, ${s})
                must be that same as the previous version of the image
                (${i.data.width}, ${i.data.height})`))):this.fire(new xe(new Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")))}hasImage(e){return e?!!this.style&amp;&amp;!!this.style.getImage(e):(this.fire(new xe(new Error("Missing required image id"))),!1)}removeImage(e){this.style.removeImage(e)}loadImage(e,t){Te(this._requestManager.transformRequest(e,pt.Image),(i,r)=&gt;{t(i,r instanceof L.HTMLImageElement?_e.getImageData(r):r)})}listImages(){return this.style.listImages()}addModel(e,t){this._lazyInitEmptyStyle(),this.style.addModel(e,t)}hasModel(e){return e?this.style.hasModel(e):(this.fire(new xe(new Error("Missing required model id"))),!1)}removeModel(e){this.style.removeModel(e)}listModels(){return this.style.listModels()}addLayer(e,t){return this._isValidId(e.id)?(this._lazyInitEmptyStyle(),this.style.addLayer(e,t),this._update(!0)):this}moveLayer(e,t){return this._isValidId(e)?(this.style.moveLayer(e,t),this._update(!0)):this}removeLayer(e){return this._isValidId(e)?(this.style.removeLayer(e),this._update(!0)):this}getLayer(e){return this._isValidId(e)?this.style.getOwnLayer(e):null}setLayerZoomRange(e,t,i){return this._isValidId(e)?(this.style.setLayerZoomRange(e,t,i),this._update(!0)):this}setFilter(e,t,i={}){return this._isValidId(e)?(this.style.setFilter(e,t,i),this._update(!0)):this}getFilter(e){return this._isValidId(e)?this.style.getFilter(e):null}setPaintProperty(e,t,i,r={}){return this._isValidId(e)?(this.style.setPaintProperty(e,t,i,r),this._update(!0)):this}getPaintProperty(e,t){return this._isValidId(e)?this.style.getPaintProperty(e,t):null}setLayoutProperty(e,t,i,r={}){return this._isValidId(e)?(this.style.setLayoutProperty(e,t,i,r),this._update(!0)):this}getLayoutProperty(e,t){return this._isValidId(e)?this.style.getLayoutProperty(e,t):null}getConfigProperty(e,t){return this.style.getConfigProperty(e,t)}setConfigProperty(e,t,i){return this.style.setConfigProperty(e,t,i),this._update(!0)}setLights(e){if(this._lazyInitEmptyStyle(),e&amp;&amp;e.length===1&amp;&amp;e[0].type==="flat"){const t=e[0];t.properties?this.style.setFlatLight(t.properties,t.id,{}):this.style.setFlatLight({},"flat")}else this.style.setLights(e),this.painter.terrain&amp;&amp;(this.painter.terrain.invalidateRenderCache=!0);return this._update(!0)}getLights(){const e=this.style.getLights()||[];return e.length===0&amp;&amp;e.push({id:this.style.light.id,type:"flat",properties:this.style.getFlatLight()}),e}setLight(e,t={}){return console.log("The `map.setLight` function is deprecated, prefer using `map.setLights` with `flat` light type instead."),this.setLights([{id:"flat",type:"flat",properties:e}])}getLight(){return console.log("The `map.getLight` function is deprecated, prefer using `map.getLights` instead."),this.style.getFlatLight()}setTerrain(e){return this._lazyInitEmptyStyle(),!e&amp;&amp;this.transform.projection.requiresDraping?this.style.setTerrainForDraping():this.style.setTerrain(e),this._averageElevationLastSampledAt=-1/0,this._update(!0)}getTerrain(){return this.style?this.style.getTerrain():null}setFog(e){return this._lazyInitEmptyStyle(),this.style.setFog(e),this._update(!0)}getFog(){return this.style?this.style.getFog():null}setCamera(e){return this.style.setCamera(e),this._triggerCameraUpdate(e)}_triggerCameraUpdate(e){return this._update(this.transform.setOrthographicProjectionAtLowPitch(e["camera-projection"]==="orthographic"))}getCamera(){return this.style.camera}_queryFogOpacity(e){return this.style&amp;&amp;this.style.fog?this.style.fog.getOpacityAtLatLng(ye.convert(e),this.transform):0}setFeatureState(e,t){return this._isValidId(e.source)?(this.style.setFeatureState(e,t),this._update()):this}removeFeatureState(e,t){return this._isValidId(e.source)?(this.style.removeFeatureState(e,t),this._update()):this}getFeatureState(e){return this._isValidId(e.source)?this.style.getFeatureState(e):null}_updateContainerDimensions(){if(!this._container)return;const e=this._container.getBoundingClientRect().width||400,t=this._container.getBoundingClientRect().height||300;let i,r,n,s=this._container;for(;s&amp;&amp;(!r||!n);){const a=L.getComputedStyle(s).transform;a&amp;&amp;a!=="none"&amp;&amp;(i=a.match(/matrix.*\((.+)\)/)[1].split(", "),i[0]&amp;&amp;i[0]!=="0"&amp;&amp;i[0]!=="1"&amp;&amp;(r=i[0]),i[3]&amp;&amp;i[3]!=="0"&amp;&amp;i[3]!=="1"&amp;&amp;(n=i[3])),s=s.parentElement}this._containerWidth=r?Math.abs(e/r):e,this._containerHeight=n?Math.abs(t/n):t}_detectMissingCSS(){L.getComputedStyle(this._missingCSSCanary).getPropertyValue("background-color")!=="rgb(250, 128, 114)"&amp;&amp;tt("This page appears to be missing CSS declarations for Mapbox GL JS, which may cause the map to display incorrectly. Please ensure your page includes mapbox-gl.css, as described in https://www.mapbox.com/mapbox-gl-js/api/.")}_setupContainer(){const e=this._container;e.classList.add("mapboxgl-map"),(this._missingCSSCanary=ci("div","mapboxgl-canary",e)).style.visibility="hidden",this._detectMissingCSS();const t=this._canvasContainer=ci("div","mapboxgl-canvas-container",e);this._canvas=ci("canvas","mapboxgl-canvas",t),this._interactive&amp;&amp;(t.classList.add("mapboxgl-interactive"),this._canvas.setAttribute("tabindex","0")),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("aria-label",this._getUIString("Map.Title")),this._canvas.setAttribute("role","region"),this._updateContainerDimensions(),this._resizeCanvas(this._containerWidth,this._containerHeight);const i=this._controlContainer=ci("div","mapboxgl-control-container",e),r=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(n=&gt;{r[n]=ci("div",`mapboxgl-ctrl-${n}`,i)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(e,t){const i=_e.devicePixelRatio||1;this._canvas.width=i*Math.ceil(e),this._canvas.height=i*Math.ceil(t),this._canvas.style.width=`${e}px`,this._canvas.style.height=`${t}px`}_addMarker(e){this._markers.push(e)}_removeMarker(e){const t=this._markers.indexOf(e);t!==-1&amp;&amp;this._markers.splice(t,1)}_addPopup(e){this._popups.push(e)}_removePopup(e){const t=this._popups.indexOf(e);t!==-1&amp;&amp;this._popups.splice(t,1)}_setupPainter(){const e=Bt({},Zo.webGLContextAttributes,{failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1}),t=this._canvas.getContext("webgl2",e);t?(ln(t,!0),this.painter=new mO(t,this._contextCreateOptions,this.transform),this.on("data",i=&gt;{i.dataType==="source"&amp;&amp;this.painter.setTileLoadedFlag(!0)}),ht.testSupport(t)):this.fire(new xe(new Error("Failed to initialize WebGL")))}_contextLost(e){e.preventDefault(),this._frame&amp;&amp;(this._frame.cancel(),this._frame=null),this.fire(new It("webglcontextlost",{originalEvent:e}))}_contextRestored(e){this._setupPainter(),this.resize(),this._update(),this.fire(new It("webglcontextrestored",{originalEvent:e}))}_onMapScroll(e){if(e.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1}loaded(){return!this._styleDirty&amp;&amp;!this._sourcesDirty&amp;&amp;!!this.style&amp;&amp;this.style.loaded()}_update(e){return this.style?(this._styleDirty=this._styleDirty||e,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(e){return this._update(),this._renderTaskQueue.add(e)}_cancelRenderFrame(e){this._renderTaskQueue.remove(e)}_requestDomTask(e){!this.loaded()||this.loaded()&amp;&amp;!this.isMoving()?e():this._domRenderTaskQueue.add(e)}_render(e){let t;this.fire(new It("renderstart"));const i=this.painter.context.extTimerQuery,r=_e.now(),n=this.painter.context.gl;if(this.listens("gpu-timing-frame")&amp;&amp;(t=n.createQuery(),n.beginQuery(i.TIME_ELAPSED_EXT,t)),this.painter.context.setDirty(),this.painter.setBaseState(),(this.isMoving()||this.isRotating()||this.isZooming())&amp;&amp;(this._interactionRange[0]=Math.min(this._interactionRange[0],L.performance.now()),this._interactionRange[1]=Math.max(this._interactionRange[1],L.performance.now())),this._renderTaskQueue.run(e),this._domRenderTaskQueue.run(e),this._removed)return;this._updateProjectionTransition();const s=this._isInitialLoad?0:this._fadeDuration;if(this.style&amp;&amp;this._styleDirty){this._styleDirty=!1;const h=this.transform.zoom,d=this.transform.pitch,f=_e.now(),m=new Si(h,{now:f,fadeDuration:s,pitch:d,transition:this.style.transition});this.style.update(m)}this.style&amp;&amp;this.style.hasFogTransition()&amp;&amp;(this.style._markersNeedUpdate=!0,this._sourcesDirty=!0);let a=!1;if(this.style&amp;&amp;this._sourcesDirty?(this._sourcesDirty=!1,this.painter._updateFog(this.style),this._updateTerrain(),a=this._updateAverageElevation(r),this.style.updateSources(this.transform),this._forceMarkerAndPopupUpdate()):a=this._updateAverageElevation(r),this._placementDirty=this.style&amp;&amp;this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,s,this._crossSourceCollisions),this.style&amp;&amp;this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,wireframe:{terrain:this.showTerrainWireframe,layers2D:this.showLayers2DWireframe,layers3D:this.showLayers3DWireframe},showOverdrawInspector:this._showOverdrawInspector,showQueryGeometry:!!this._showQueryGeometry,showTileAABBs:this.showTileAABBs,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:s,isInitialLoad:this._isInitialLoad,showPadding:this.showPadding,gpuTiming:!!this.listens("gpu-timing-layer"),gpuTimingDeferredRender:!!this.listens("gpu-timing-deferred-render"),speedIndexTiming:this.speedIndexTiming}),this.fire(new It("render")),this.loaded()&amp;&amp;!this._loaded&amp;&amp;(this._loaded=!0,this.fire(new It("load"))),this.style&amp;&amp;this.style.hasTransitions()&amp;&amp;(this._styleDirty=!0),this.style&amp;&amp;!this._placementDirty&amp;&amp;this.style._releaseSymbolFadeTiles(),t){const h=_e.now()-r;n.endQuery(i.TIME_ELAPSED_EXT),setTimeout(()=&gt;{const d=n.getQueryParameter(t,n.QUERY_RESULT)/1e6;n.deleteQuery(t),this.fire(new It("gpu-timing-frame",{cpuTime:h,gpuTime:d})),L.performance.mark("frame-gpu",{startTime:r,detail:{gpuTime:d}})},50)}if(this.listens("gpu-timing-layer")){const h=this.painter.collectGpuTimers();setTimeout(()=&gt;{const d=this.painter.queryGpuTimers(h);this.fire(new It("gpu-timing-layer",{layerTimes:d}))},50)}if(this.listens("gpu-timing-deferred-render")){const h=this.painter.collectDeferredRenderGpuQueries();setTimeout(()=&gt;{const d=this.painter.queryGpuTimeDeferredRender(h);this.fire(new It("gpu-timing-deferred-render",{gpuTime:d}))},50)}const l=this._sourcesDirty||this._styleDirty||this._placementDirty||a;if(l||this._repaint)this.triggerRepaint();else{const h=!this.isMoving()&amp;&amp;this.loaded();if(h&amp;&amp;(a=this._updateAverageElevation(r,!0)),a)this.triggerRepaint();else if(this._triggerFrame(!1),h&amp;&amp;(this.fire(new It("idle")),this._isInitialLoad=!1,this.speedIndexTiming)){const d=this._calculateSpeedIndex();this.fire(new It("speedindexcompleted",{speedIndex:d})),this.speedIndexTiming=!1}}!this._loaded||this._fullyLoaded||l||(this._fullyLoaded=!0,Kl.mark(Wr.fullLoad),this._performanceMetricsCollection&amp;&amp;lo(this._requestManager._customAccessToken,{width:this.painter.width,height:this.painter.height,interactionRange:this._interactionRange,visibilityHidden:this._visibilityHidden,terrainEnabled:!!this.painter.style.getTerrain(),fogEnabled:!!this.painter.style.getFog(),projection:this.getProjection().name,zoom:this.transform.zoom,renderer:this.painter.context.renderer,vendor:this.painter.context.vendor}),this._authenticate())}_forceMarkerAndPopupUpdate(e){for(const t of this._markers)e&amp;&amp;!this.getRenderWorldCopies()&amp;&amp;(t._lngLat=t._lngLat.wrap()),t._update();for(const t of this._popups)!e||this.getRenderWorldCopies()||t._trackPointer||(t._lngLat=t._lngLat.wrap()),t._update()}_updateAverageElevation(e,t=!1){const i=n=&gt;(this.transform.averageElevation=n,this._update(!1),!0);if(!this.painter.averageElevationNeedsEasing())return this.transform.averageElevation!==0&amp;&amp;i(0);const r=this.transform.elevation&amp;&amp;this.transform.elevation.exaggeration()!==this._averageElevationExaggeration;if(r||(t||e-this._averageElevationLastSampledAt&gt;500)&amp;&amp;!this._averageElevation.isEasing(e)){const n=this.transform.averageElevation;let s=this.transform.sampleAverageElevation();this.transform.elevation&amp;&amp;(this._averageElevationExaggeration=this.transform.elevation.exaggeration()),isNaN(s)?s=0:this._averageElevationLastSampledAt=e;const a=Math.abs(n-s);if(a&gt;1){if(this._isInitialLoad||r)return this._averageElevation.jumpTo(s),i(s);this._averageElevation.easeTo(s,e,300)}else if(a&gt;1e-4)return this._averageElevation.jumpTo(s),i(s)}return!!this._averageElevation.isEasing(e)&amp;&amp;i(this._averageElevation.getValue(e))}_authenticate(){Un(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,e=&gt;{if(e&amp;&amp;(e.message===Je||e.status===401)){const t=this.painter.context.gl;ln(t,!1),this._logoControl instanceof mE&amp;&amp;this._logoControl._updateLogo(),t&amp;&amp;t.clear(t.DEPTH_BUFFER_BIT|t.COLOR_BUFFER_BIT|t.STENCIL_BUFFER_BIT),this._silenceAuthErrors||this.fire(new xe(new Error("A valid Mapbox access token is required to use Mapbox GL JS. To create an account or a new access token, visit https://account.mapbox.com/")))}}),za(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,()=&gt;{})}_updateTerrain(){const e=this._isDragging();this.painter.updateTerrain(this.style,e)}_calculateSpeedIndex(){const e=this.painter.canvasCopy(),t=this.painter.getCanvasCopiesAndTimestamps();t.timeStamps.push(performance.now());const i=this.painter.context.gl,r=i.createFramebuffer();function n(s){i.framebufferTexture2D(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,s,0);const a=new Uint8Array(i.drawingBufferWidth*i.drawingBufferHeight*4);return i.readPixels(0,0,i.drawingBufferWidth,i.drawingBufferHeight,i.RGBA,i.UNSIGNED_BYTE,a),a}return i.bindFramebuffer(i.FRAMEBUFFER,r),this._canvasPixelComparison(n(e),t.canvasCopies.map(n),t.timeStamps)}_canvasPixelComparison(e,t,i){let r=i[1]-i[0];const n=e.length/4;for(let s=0;s&lt;t.length;s++){const a=t[s];let l=0;for(let h=0;h&lt;a.length;h+=4)a[h]===e[h]&amp;&amp;a[h+1]===e[h+1]&amp;&amp;a[h+2]===e[h+2]&amp;&amp;a[h+3]===e[h+3]&amp;&amp;(l+=1);r+=(i[s+2]-i[s+1])*(1-l/n)}return r}remove(){this._hash&amp;&amp;this._hash.remove();for(const t of this._controls)t.onRemove(this);this._controls=[],this._frame&amp;&amp;(this._frame.cancel(),this._frame=null),this._renderTaskQueue.clear(),this._domRenderTaskQueue.clear(),this.style&amp;&amp;this.style.destroy(),this.painter.destroy(),this.handlers&amp;&amp;this.handlers.destroy(),this.handlers=void 0,this.setStyle(null),L!==void 0&amp;&amp;(L.removeEventListener("resize",this._onWindowResize,!1),L.removeEventListener("orientationchange",this._onWindowResize,!1),L.removeEventListener(this._fullscreenchangeEvent,this._onWindowResize,!1),L.removeEventListener("online",this._onWindowOnline,!1),L.removeEventListener("visibilitychange",this._onVisibilityChange,!1));const e=this.painter.context.gl.getExtension("WEBGL_lose_context");e&amp;&amp;e.loseContext(),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvasContainer.remove(),this._controlContainer.remove(),this._missingCSSCanary.remove(),this._canvas=void 0,this._canvasContainer=void 0,this._controlContainer=void 0,this._missingCSSCanary=void 0,this._container.classList.remove("mapboxgl-map"),this._container.removeEventListener("scroll",this._onMapScroll,!1),os.delete(this.painter.context.gl),this._removed=!0,this.fire(new It("remove"))}triggerRepaint(){this._triggerFrame(!0)}_triggerFrame(e){this._renderNextFrame=this._renderNextFrame||e,this.style&amp;&amp;!this._frame&amp;&amp;(this._frame=_e.frame(t=&gt;{const i=!!this._renderNextFrame;this._frame=null,this._renderNextFrame=null,i&amp;&amp;this._render(t)}))}_preloadTiles(e){return Rs(this.style?Object.values(this.style._sourceCaches):[],(t,i)=&gt;t._preloadTiles(e,i),()=&gt;{this.triggerRepaint()}),this}_onWindowOnline(){this._update()}_onWindowResize(e){this._trackResize&amp;&amp;this.resize({originalEvent:e})._update()}_onVisibilityChange(){L.document.visibilityState==="hidden"&amp;&amp;this._visibilityHidden++}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(e){this._showTileBoundaries!==e&amp;&amp;(this._showTileBoundaries=e,this._update())}get showTerrainWireframe(){return!!this._showTerrainWireframe}set showTerrainWireframe(e){this._showTerrainWireframe!==e&amp;&amp;(this._showTerrainWireframe=e,this._update())}get showLayers2DWireframe(){return!!this._showLayers2DWireframe}set showLayers2DWireframe(e){this._showLayers2DWireframe!==e&amp;&amp;(this._showLayers2DWireframe=e,this._update())}get showLayers3DWireframe(){return!!this._showLayers3DWireframe}set showLayers3DWireframe(e){this._showLayers3DWireframe!==e&amp;&amp;(this._showLayers3DWireframe=e,this._update())}get speedIndexTiming(){return!!this._speedIndexTiming}set speedIndexTiming(e){this._speedIndexTiming!==e&amp;&amp;(this._speedIndexTiming=e,this._update())}get showPadding(){return!!this._showPadding}set showPadding(e){this._showPadding!==e&amp;&amp;(this._showPadding=e,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(e){this._showCollisionBoxes!==e&amp;&amp;(this._showCollisionBoxes=e,e?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(e){this._showOverdrawInspector!==e&amp;&amp;(this._showOverdrawInspector=e,this._update())}get repaint(){return!!this._repaint}set repaint(e){this._repaint!==e&amp;&amp;(this._repaint=e,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(e){this._vertices=e,this._update()}get showTileAABBs(){return!!this._showTileAABBs}set showTileAABBs(e){this._showTileAABBs!==e&amp;&amp;(this._showTileAABBs=e,e&amp;&amp;this._update())}_setCacheLimits(e,t){(function(i,r){yr=i,Sr=r})(e,t)}get version(){return G}},NavigationControl:class{constructor(e){this.options=Bt({},ak,e),this._container=ci("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._container.addEventListener("contextmenu",t=&gt;t.preventDefault()),this.options.showZoom&amp;&amp;(Oi(["_setButtonTitle","_updateZoomButtons"],this),this._zoomInButton=this._createButton("mapboxgl-ctrl-zoom-in",t=&gt;{this._map&amp;&amp;this._map.zoomIn({},{originalEvent:t})}),ci("span","mapboxgl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("mapboxgl-ctrl-zoom-out",t=&gt;{this._map&amp;&amp;this._map.zoomOut({},{originalEvent:t})}),ci("span","mapboxgl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&amp;&amp;(Oi(["_rotateCompassArrow"],this),this._compass=this._createButton("mapboxgl-ctrl-compass",t=&gt;{const i=this._map;i&amp;&amp;(this.options.visualizePitch?i.resetNorthPitch({},{originalEvent:t}):i.resetNorth({},{originalEvent:t}))}),this._compassIcon=ci("span","mapboxgl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}_updateZoomButtons(){const e=this._map;if(!e)return;const t=e.getZoom(),i=t===e.getMaxZoom(),r=t===e.getMinZoom();this._zoomInButton.disabled=i,this._zoomOutButton.disabled=r,this._zoomInButton.setAttribute("aria-disabled",i.toString()),this._zoomOutButton.setAttribute("aria-disabled",r.toString())}_rotateCompassArrow(){const e=this._map;if(!e)return;const t=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(e.transform.pitch*(Math.PI/180)),.5)}) rotateX(${e.transform.pitch}deg) rotateZ(${e.transform.angle*(180/Math.PI)}deg)`:`rotate(${e.transform.angle*(180/Math.PI)}deg)`;e._requestDomTask(()=&gt;{this._compassIcon&amp;&amp;(this._compassIcon.style.transform=t)})}onAdd(e){return this._map=e,this.options.showZoom&amp;&amp;(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),e.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&amp;&amp;(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&amp;&amp;e.on("pitch",this._rotateCompassArrow),e.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new lk(e,this._compass,this.options.visualizePitch)),this._container}onRemove(){const e=this._map;e&amp;&amp;(this._container.remove(),this.options.showZoom&amp;&amp;e.off("zoom",this._updateZoomButtons),this.options.showCompass&amp;&amp;(this.options.visualizePitch&amp;&amp;e.off("pitch",this._rotateCompassArrow),e.off("rotate",this._rotateCompassArrow),this._handler&amp;&amp;this._handler.off(),this._handler=void 0),this._map=void 0)}_createButton(e,t){const i=ci("button",e,this._container);return i.type="button",i.addEventListener("click",t),i}_setButtonTitle(e,t){if(!this._map)return;const i=this._map._getUIString(`NavigationControl.${t}`);e.setAttribute("aria-label",i),e.firstElementChild&amp;&amp;e.firstElementChild.setAttribute("title",i)}},GeolocateControl:class extends Zi{constructor(e){super(),this.options=Bt({geolocation:L.navigator.geolocation},ck,e),Oi(["_onSuccess","_onError","_onZoom","_finish","_setupUI","_updateCamera","_updateMarker","_updateMarkerRotation","_onDeviceOrientation"],this),this._updateMarkerRotationThrottled=oE(this._updateMarkerRotation,20),this._numberOfWatches=0}onAdd(e){return this._map=e,this._container=ci("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkGeolocationSupport(this._setupUI),this._container}onRemove(){this._geolocationWatchID!==void 0&amp;&amp;(this.options.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&amp;&amp;this._userLocationDotMarker&amp;&amp;this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&amp;&amp;this._accuracyCircleMarker&amp;&amp;this._accuracyCircleMarker.remove(),this._container.remove(),this._map.off("zoom",this._onZoom),this._map=void 0,this._numberOfWatches=0,this._noTimeout=!1}_checkGeolocationSupport(e){const t=(i=!!this.options.geolocation)=&gt;{this._supportsGeolocation=i,e(i)};this._supportsGeolocation!==void 0?e(this._supportsGeolocation):L.navigator.permissions!==void 0?L.navigator.permissions.query({name:"geolocation"}).then(i=&gt;t(i.state!=="denied")).catch(()=&gt;t()):t()}_isOutOfMapMaxBounds(e){const t=this._map.getMaxBounds(),i=e.coords;return!!t&amp;&amp;(i.longitude&lt;t.getWest()||i.longitude&gt;t.getEast()||i.latitude&lt;t.getSouth()||i.latitude&gt;t.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting")}}_onSuccess(e){if(this._map){if(this._isOutOfMapMaxBounds(e))return this._setErrorState(),this.fire(new It("outofmaxbounds",e)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=e,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background")}this.options.showUserLocation&amp;&amp;this._watchState!=="OFF"&amp;&amp;this._updateMarker(e),this.options.trackUserLocation&amp;&amp;this._watchState!=="ACTIVE_LOCK"||this._updateCamera(e),this.options.showUserLocation&amp;&amp;this._userLocationDotMarker.removeClassName("mapboxgl-user-location-dot-stale"),this.fire(new It("geolocate",e)),this._finish()}}_updateCamera(e){const t=new ye(e.coords.longitude,e.coords.latitude),i=e.coords.accuracy,r=Bt({bearing:this._map.getBearing()},this.options.fitBoundsOptions);this._map.fitBounds(t.toBounds(i),r,{geolocateSource:!0})}_updateMarker(e){if(e){const t=new ye(e.coords.longitude,e.coords.latitude);this._accuracyCircleMarker.setLngLat(t).addTo(this._map),this._userLocationDotMarker.setLngLat(t).addTo(this._map),this._accuracy=e.coords.accuracy,this.options.showUserLocation&amp;&amp;this.options.showAccuracyCircle&amp;&amp;this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()}_updateCircleRadius(){const e=this._map.transform,t=ui(1,e._center.lat)*e.worldSize,i=Math.ceil(2*this._accuracy*t);this._circleElement.style.width=`${i}px`,this._circleElement.style.height=`${i}px`}_onZoom(){this.options.showUserLocation&amp;&amp;this.options.showAccuracyCircle&amp;&amp;this._updateCircleRadius()}_updateMarkerRotation(){this._userLocationDotMarker&amp;&amp;typeof this._heading=="number"?(this._userLocationDotMarker.setRotation(this._heading),this._userLocationDotMarker.addClassName("mapboxgl-user-location-show-heading")):(this._userLocationDotMarker.removeClassName("mapboxgl-user-location-show-heading"),this._userLocationDotMarker.setRotation(0))}_onError(e){if(this._map){if(this.options.trackUserLocation)if(e.code===1){this._watchState="OFF",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;const t=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.setAttribute("aria-label",t),this._geolocateButton.firstElementChild&amp;&amp;this._geolocateButton.firstElementChild.setAttribute("title",t),this._geolocationWatchID!==void 0&amp;&amp;this._clearWatch()}else{if(e.code===3&amp;&amp;this._noTimeout)return;this._setErrorState()}this._watchState!=="OFF"&amp;&amp;this.options.showUserLocation&amp;&amp;this._userLocationDotMarker.addClassName("mapboxgl-user-location-dot-stale"),this.fire(new It("error",e)),this._finish()}}_finish(){this._timeoutId&amp;&amp;clearTimeout(this._timeoutId),this._timeoutId=void 0}_setupUI(e){if(this._map!==void 0){if(this._container.addEventListener("contextmenu",t=&gt;t.preventDefault()),this._geolocateButton=ci("button","mapboxgl-ctrl-geolocate",this._container),ci("span","mapboxgl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",e===!1){tt("Geolocation support is not available so the GeolocateControl will be disabled.");const t=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.setAttribute("aria-label",t),this._geolocateButton.firstElementChild&amp;&amp;this._geolocateButton.firstElementChild.setAttribute("title",t)}else{const t=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.setAttribute("aria-label",t),this._geolocateButton.firstElementChild&amp;&amp;this._geolocateButton.firstElementChild.setAttribute("title",t)}this.options.trackUserLocation&amp;&amp;(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&amp;&amp;(this._dotElement=ci("div","mapboxgl-user-location"),this._dotElement.appendChild(ci("div","mapboxgl-user-location-dot")),this._dotElement.appendChild(ci("div","mapboxgl-user-location-heading")),this._userLocationDotMarker=new og({element:this._dotElement,rotationAlignment:"map",pitchAlignment:"map"}),this._circleElement=ci("div","mapboxgl-user-location-accuracy-circle"),this._accuracyCircleMarker=new og({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&amp;&amp;(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",this.trigger.bind(this)),this._setup=!0,this.options.trackUserLocation&amp;&amp;this._map.on("movestart",t=&gt;{t.geolocateSource||this._watchState!=="ACTIVE_LOCK"||t.originalEvent&amp;&amp;t.originalEvent.type==="resize"||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this.fire(new It("trackuserlocationend")))})}}_onDeviceOrientation(e){this._userLocationDotMarker&amp;&amp;(e.webkitCompassHeading?this._heading=e.webkitCompassHeading:e.absolute===!0&amp;&amp;(this._heading=-1*e.alpha),this._updateMarkerRotationThrottled())}trigger(){if(!this._setup)return tt("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new It("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":this._numberOfWatches--,this._noTimeout=!1,this._watchState="OFF",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this.fire(new It("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._lastKnownPosition&amp;&amp;this._updateCamera(this._lastKnownPosition),this.fire(new It("trackuserlocationstart"))}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_ERROR":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error");break;case"BACKGROUND":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background");break;case"BACKGROUND_ERROR":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background-error")}if(this._watchState==="OFF"&amp;&amp;this._geolocationWatchID!==void 0)this._clearWatch();else if(this._geolocationWatchID===void 0){let e;this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),this._numberOfWatches++,this._numberOfWatches&gt;1?(e={maximumAge:6e5,timeout:0},this._noTimeout=!0):(e=this.options.positionOptions,this._noTimeout=!1),this._geolocationWatchID=this.options.geolocation.watchPosition(this._onSuccess,this._onError,e),this.options.showUserHeading&amp;&amp;this._addDeviceOrientationListener()}}else this.options.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0}_addDeviceOrientationListener(){const e=()=&gt;{L.addEventListener("ondeviceorientationabsolute"in L?"deviceorientationabsolute":"deviceorientation",this._onDeviceOrientation)};L.DeviceMotionEvent!==void 0&amp;&amp;typeof L.DeviceMotionEvent.requestPermission=="function"?DeviceOrientationEvent.requestPermission().then(t=&gt;{t==="granted"&amp;&amp;e()}).catch(console.error):e()}_clearWatch(){this.options.geolocation.clearWatch(this._geolocationWatchID),L.removeEventListener("deviceorientation",this._onDeviceOrientation),L.removeEventListener("deviceorientationabsolute",this._onDeviceOrientation),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&amp;&amp;this._updateMarker(null)}},AttributionControl:pE,ScaleControl:class{constructor(e){this.options=Bt({},uk,e),this._isNumberFormatSupported=function(){try{return new Intl.NumberFormat("en",{style:"unit",unitDisplay:"short",unit:"meter"}),!0}catch{return!1}}(),Oi(["_update","_setScale","setUnit"],this)}getDefaultPosition(){return"bottom-left"}_update(){const e=this.options.maxWidth||100,t=this._map,i=t._containerHeight/2,r=t._containerWidth/2-e/2,n=t.unproject([r,i]),s=t.unproject([r+e,i]),a=n.distanceTo(s);if(this.options.unit==="imperial"){const l=3.2808*a;l&gt;5280?this._setScale(e,l/5280,"mile"):this._setScale(e,l,"foot")}else this.options.unit==="nautical"?this._setScale(e,a/1852,"nautical-mile"):a&gt;=1e3?this._setScale(e,a/1e3,"kilometer"):this._setScale(e,a,"meter")}_setScale(e,t,i){this._map._requestDomTask(()=&gt;{const r=function(s){const a=Math.pow(10,`${Math.floor(s)}`.length-1);let l=s/a;return l=l&gt;=10?10:l&gt;=5?5:l&gt;=3?3:l&gt;=2?2:l&gt;=1?1:function(h){const d=Math.pow(10,Math.ceil(-Math.log(h)/Math.LN10));return Math.round(h*d)/d}(l),a*l}(t),n=r/t;this._container.innerHTML=this._isNumberFormatSupported&amp;&amp;i!=="nautical-mile"?new Intl.NumberFormat(this._language,{style:"unit",unitDisplay:"short",unit:i}).format(r):`${r}&amp;nbsp;${hk[i]}`,this._container.style.width=e*n+"px"})}onAdd(e){return this._map=e,this._language=e.getLanguage(),this._container=ci("div","mapboxgl-ctrl mapboxgl-ctrl-scale",e.getContainer()),this._container.dir="auto",this._map.on("move",this._update),this._update(),this._container}onRemove(){this._container.remove(),this._map.off("move",this._update),this._map=void 0}_setLanguage(e){this._language=e,this._update()}setUnit(e){this.options.unit=e,this._update()}},FullscreenControl:class{constructor(e){this._fullscreen=!1,e&amp;&amp;e.container&amp;&amp;(e.container instanceof L.HTMLElement?this._container=e.container:tt("Full screen control 'container' must be a DOM element.")),Oi(["_onClickFullscreen","_changeIcon"],this),"onfullscreenchange"in L.document?this._fullscreenchange="fullscreenchange":"onwebkitfullscreenchange"in L.document&amp;&amp;(this._fullscreenchange="webkitfullscreenchange")}onAdd(e){return this._map=e,this._container||(this._container=this._map.getContainer()),this._controlContainer=ci("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkFullscreenSupport()?this._setupUI():(this._controlContainer.style.display="none",tt("This device does not support fullscreen mode.")),this._controlContainer}onRemove(){this._controlContainer.remove(),this._map=null,L.document.removeEventListener(this._fullscreenchange,this._changeIcon)}_checkFullscreenSupport(){return!(!L.document.fullscreenEnabled&amp;&amp;!L.document.webkitFullscreenEnabled)}_setupUI(){const e=this._fullscreenButton=ci("button","mapboxgl-ctrl-fullscreen",this._controlContainer);ci("span","mapboxgl-ctrl-icon",e).setAttribute("aria-hidden","true"),e.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),L.document.addEventListener(this._fullscreenchange,this._changeIcon)}_updateTitle(){const e=this._getTitle();this._fullscreenButton.setAttribute("aria-label",e),this._fullscreenButton.firstElementChild&amp;&amp;this._fullscreenButton.firstElementChild.setAttribute("title",e)}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_changeIcon(){(L.document.fullscreenElement||L.document.webkitFullscreenElement)===this._container!==this._fullscreen&amp;&amp;(this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("mapboxgl-ctrl-shrink"),this._fullscreenButton.classList.toggle("mapboxgl-ctrl-fullscreen"),this._updateTitle())}_onClickFullscreen(){this._isFullscreen()?L.document.exitFullscreen?L.document.exitFullscreen():L.document.webkitCancelFullScreen&amp;&amp;L.document.webkitCancelFullScreen():this._container.requestFullscreen?this._container.requestFullscreen():this._container.webkitRequestFullscreen&amp;&amp;this._container.webkitRequestFullscreen()}},Popup:class extends Zi{constructor(e){super(),this.options=Bt(Object.create(ik),e),Oi(["_update","_onClose","remove","_onMouseEvent"],this),this._classList=new Set(e&amp;&amp;e.className?e.className.trim().split(/\s+/):[])}addTo(e){return this._map&amp;&amp;this.remove(),this._map=e,this.options.closeOnClick&amp;&amp;e.on("preclick",this._onClose),this.options.closeOnMove&amp;&amp;e.on("move",this._onClose),e.on("remove",this.remove),this._update(),e._addPopup(this),this._focusFirstElement(),this._trackPointer?(e.on("mousemove",this._onMouseEvent),e.on("mouseup",this._onMouseEvent),e._canvasContainer.classList.add("mapboxgl-track-pointer")):e.on("move",this._update),this.fire(new It("open")),this}isOpen(){return!!this._map}remove(){this._content&amp;&amp;this._content.remove(),this._container&amp;&amp;(this._container.remove(),this._container=void 0);const e=this._map;return e&amp;&amp;(e.off("move",this._update),e.off("move",this._onClose),e.off("preclick",this._onClose),e.off("click",this._onClose),e.off("remove",this.remove),e.off("mousemove",this._onMouseEvent),e.off("mouseup",this._onMouseEvent),e.off("drag",this._onMouseEvent),e._canvasContainer&amp;&amp;e._canvasContainer.classList.remove("mapboxgl-track-pointer"),e._removePopup(this),this._map=void 0),this.fire(new It("close")),this}getLngLat(){return this._lngLat}setLngLat(e){this._lngLat=ye.convert(e),this._pos=null,this._trackPointer=!1,this._update();const t=this._map;return t&amp;&amp;(t.on("move",this._update),t.off("mousemove",this._onMouseEvent),t._canvasContainer.classList.remove("mapboxgl-track-pointer")),this}trackPointer(){this._trackPointer=!0,this._pos=null,this._update();const e=this._map;return e&amp;&amp;(e.off("move",this._update),e.on("mousemove",this._onMouseEvent),e.on("drag",this._onMouseEvent),e._canvasContainer.classList.add("mapboxgl-track-pointer")),this}getElement(){return this._container}setText(e){return this.setDOMContent(L.document.createTextNode(e))}setHTML(e){const t=L.document.createDocumentFragment(),i=L.document.createElement("body");let r;for(i.innerHTML=e;r=i.firstChild,r;)t.appendChild(r);return this.setDOMContent(t)}getMaxWidth(){return this._container&amp;&amp;this._container.style.maxWidth}setMaxWidth(e){return this.options.maxWidth=e,this._update(),this}setDOMContent(e){let t=this._content;if(t)for(;t.hasChildNodes();)t.firstChild&amp;&amp;t.removeChild(t.firstChild);else t=this._content=ci("div","mapboxgl-popup-content",this._container||void 0);if(t.appendChild(e),this.options.closeButton){const i=this._closeButton=ci("button","mapboxgl-popup-close-button",t);i.type="button",i.setAttribute("aria-label","Close popup"),i.setAttribute("aria-hidden","true"),i.innerHTML="&amp;#215;",i.addEventListener("click",this._onClose)}return this._update(),this._focusFirstElement(),this}addClassName(e){return this._classList.add(e),this._updateClassList(),this}removeClassName(e){return this._classList.delete(e),this._updateClassList(),this}setOffset(e){return this.options.offset=e,this._update(),this}toggleClassName(e){let t;return this._classList.delete(e)?t=!1:(this._classList.add(e),t=!0),this._updateClassList(),t}_onMouseEvent(e){this._update(e.point)}_getAnchor(e){if(this.options.anchor)return this.options.anchor;const t=this._map,i=this._container,r=this._pos;if(!t||!i||!r)return"bottom";const n=i.offsetWidth,s=i.offsetHeight,a=r.x&lt;n/2,l=r.x&gt;t.transform.width-n/2;if(r.y+e&lt;s)return a?"top-left":l?"top-right":"top";if(r.y&gt;t.transform.height-s){if(a)return"bottom-left";if(l)return"bottom-right"}return a?"left":l?"right":"bottom"}_updateClassList(){const e=this._container;if(!e)return;const t=[...this._classList];t.push("mapboxgl-popup"),this._anchor&amp;&amp;t.push(`mapboxgl-popup-anchor-${this._anchor}`),this._trackPointer&amp;&amp;t.push("mapboxgl-popup-track-pointer"),e.className=t.join(" ")}_update(e){const t=this._map,i=this._content;if(!t||!this._lngLat&amp;&amp;!this._trackPointer||!i)return;let r=this._container;if(r||(r=this._container=ci("div","mapboxgl-popup",t.getContainer()),this._tip=ci("div","mapboxgl-popup-tip",r),r.appendChild(i)),this.options.maxWidth&amp;&amp;r.style.maxWidth!==this.options.maxWidth&amp;&amp;(r.style.maxWidth=this.options.maxWidth),t.transform.renderWorldCopies&amp;&amp;!this._trackPointer&amp;&amp;(this._lngLat=gE(this._lngLat,this._pos,t.transform)),!this._trackPointer||e){const n=this._pos=this._trackPointer&amp;&amp;e?e:t.project(this._lngLat),s=yE(this.options.offset),a=this._anchor=this._getAnchor(s.y),l=yE(this.options.offset,a),h=n.add(l).round();t._requestDomTask(()=&gt;{this._container&amp;&amp;a&amp;&amp;(this._container.style.transform=`${sg[a]} translate(${h.x}px,${h.y}px)`)})}if(!this._marker&amp;&amp;t._showingGlobe()){const n=Sh(t.transform,this._lngLat)?0:1;this._setOpacity(n)}this._updateClassList()}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const e=this._container.querySelector(rk);e&amp;&amp;e.focus()}_onClose(){this.remove()}_setOpacity(e){this._container&amp;&amp;(this._container.style.opacity=`${e}`),this._content&amp;&amp;(this._content.style.pointerEvents=e?"auto":"none")}},Marker:og,Style:Kn,LngLat:ye,LngLatBounds:Qr,Point:Q,MercatorCoordinate:Be,FreeCameraOptions:Pb,Evented:Zi,config:H,prewarm:function(){Qc().acquire(C_)},clearPrewarmedResources:function(){const e=Jc;e&amp;&amp;(e.isPreloaded()&amp;&amp;e.numActive()===1?(e.release(C_),Jc=null):console.warn("Could not clear WebWorkers since there are active Map instances that still reference it. The pre-warmed WebWorker pool can only be cleared when all map instances have been removed with map.remove()"))},get accessToken(){return H.ACCESS_TOKEN},set accessToken(e){H.ACCESS_TOKEN=e},get baseApiUrl(){return H.API_URL},set baseApiUrl(e){H.API_URL=e},get workerCount(){return wl.workerCount},set workerCount(e){wl.workerCount=e},get maxParallelImageRequests(){return H.MAX_PARALLEL_IMAGE_REQUESTS},set maxParallelImageRequests(e){H.MAX_PARALLEL_IMAGE_REQUESTS=e},clearStorage(e){(function(t){if(!ao())return;const i=L.caches.delete(pi);t&amp;&amp;i.catch(t).then(()=&gt;t())})(e)},workerUrl:"",workerClass:null,get dracoUrl(){return Hw()},set dracoUrl(e){(function(t){L_=_e.resolveURL(t),R_||(R_=new ga(Qc(),new Zi)),R_.broadcast("setDracoUrl",L_)})(e)},setNow:_e.setNow,restoreNow:_e.restoreNow};R.A=kw,R.D=Gh,R.E=ut,R.F=Qm,R.K=Ad,R.O=We,R.P=Q,R.T=tw,R.V=Bh,R.a=Fh,R.b=R1,R.c=gd,R.d=class extends Zi{constructor(e,t,i,r,n,s){super(),this.actor=e,this.layerIndex=t,this.availableImages=i,this.loadVectorData=n||jw,this.loading={},this.loaded={},this.deduped=new Vw(e.scheduler),this.isSpriteLoaded=r,this.scheduler=e.scheduler,this.brightness=s}loadTile(e,t){const i=e.uid,r=e&amp;&amp;e.request,n=r&amp;&amp;r.collectResourceTiming,s=this.loading[i]=new LR(e);s.abort=this.loadVectorData(e,(a,l)=&gt;{const h=!this.loading[i];if(delete this.loading[i],h||a||!l)return s.status="done",h||(this.loaded[i]=s),t(a);const d=l.rawData,f={};l.expires&amp;&amp;(f.expires=l.expires),l.cacheControl&amp;&amp;(f.cacheControl=l.cacheControl),s.vectorTile=l.vectorTile||new Km(new jh(d));const m=()=&gt;{s.parse(s.vectorTile,this.layerIndex,this.availableImages,this.actor,(_,y)=&gt;{if(_||!y)return t(_);const x={};if(n){const b=qr(r);b.length&gt;0&amp;&amp;(x.resourceTiming=JSON.parse(JSON.stringify(b)))}t(null,Bt({rawTileData:d.slice(0)},y,f,x))})};this.isSpriteLoaded?m():this.once("isSpriteLoaded",()=&gt;{this.scheduler?this.scheduler.add(m,{type:"parseTile",isSymbolTile:e.isSymbolTile,zoom:e.tileZoom}):m()}),this.loaded=this.loaded||{},this.loaded[i]=s})}reloadTile(e,t){const i=this.loaded,r=e.uid,n=this;if(i&amp;&amp;i[r]){const s=i[r];s.showCollisionBoxes=e.showCollisionBoxes,s.projection=e.projection,s.brightness=e.brightness,s.tileTransform=da(e.tileID.canonical,e.projection),s.extraShadowCaster=e.extraShadowCaster;const a=(l,h)=&gt;{const d=s.reloadCallback;d&amp;&amp;(delete s.reloadCallback,s.parse(s.vectorTile,n.layerIndex,this.availableImages,n.actor,d)),t(l,h)};s.status==="parsing"?s.reloadCallback=a:s.status==="done"&amp;&amp;(s.vectorTile?s.parse(s.vectorTile,this.layerIndex,this.availableImages,this.actor,a):a())}else t(null,void 0)}abortTile(e,t){const i=e.uid,r=this.loading[i];r&amp;&amp;(r.abort&amp;&amp;r.abort(),delete this.loading[i]),t()}removeTile(e,t){const i=this.loaded,r=e.uid;i&amp;&amp;i[r]&amp;&amp;delete i[r],t()}},R.e=fo,R.f=qr,R.g=Qt,R.h=Rt,R.i=zt,R.j=function(e,t){const i=B_(e);for(const r of i){for(const n of r.meshes)VR(n);r.lights&amp;&amp;(r.lightMeshIndex=r.meshes.length,r.meshes.push(jR(r.lights,t)))}return i},R.k=Si,R.l=function(e){let t=0;if(new Uint32Array(e,0,1)[0]!==qw){const i=new Uint32Array(e,0,7),[,,r,n,s,a]=i;t=i.byteLength+n+s+a+s,(r!==e.byteLength||t&gt;=e.byteLength)&amp;&amp;tt("Invalid b3dm header information.")}return Yw(e,t)},R.m=Jh,R.n=An,R.o=It,R.p=Ge,R.q=function(e){Rr(),Ar&amp;&amp;Ar.then(t=&gt;{t.keys().then(i=&gt;{for(let r=0;r&lt;i.length-e;r++)t.delete(i[r])})})},R.r=eT,R.s=jd,R.t=Ic,R.v=Ds,R.w=L}),E(["./shared"],function(R){function L(Mt){if(typeof Mt=="number"||typeof Mt=="boolean"||typeof Mt=="string"||Mt==null)return JSON.stringify(Mt);if(Array.isArray(Mt)){let $="[";for(const tt of Mt)$+=`${L(tt)},`;return`${$}]`}let V="{";for(const $ of Object.keys(Mt).sort())V+=`${$}:${L(Mt[$])},`;return`${V}}`}function G(Mt){let V="";for(const $ of R.r)V+=`/${L(Mt[$])}`;return V}class j{constructor(V){this.keyCache={},this._layers={},this._layerConfigs={},V&amp;&amp;this.replace(V)}replace(V,$){this._layerConfigs={},this._layers={},this.update(V,[],$)}update(V,$,tt){this._options=tt;for(const Tt of V){this._layerConfigs[Tt.id]=Tt;const Wt=this._layers[Tt.id]=R.c(Tt,this._options);Wt.setScope(this.scope),Wt.compileFilter(),this.keyCache[Tt.id]&amp;&amp;delete this.keyCache[Tt.id]}for(const Tt of $)delete this.keyCache[Tt],delete this._layerConfigs[Tt],delete this._layers[Tt];this.familiesBySource={};const vt=function(Tt,Wt){const te={};for(let se=0;se&lt;Tt.length;se++){const he=Wt&amp;&amp;Wt[Tt[se].id]||G(Tt[se]);Wt&amp;&amp;(Wt[Tt[se].id]=he);let me=te[he];me||(me=te[he]=[]),me.push(Tt[se])}const Et=[];for(const se in te)Et.push(te[se]);return Et}(R.v(this._layerConfigs),this.keyCache);for(const Tt of vt){const Wt=Tt.map(di=&gt;this._layers[di.id]),te=Wt[0];if(te.visibility==="none")continue;const Et=te.source||"";let se=this.familiesBySource[Et];se||(se=this.familiesBySource[Et]={});const he=te.sourceLayer||"_geojsonTileLayer";let me=se[he];me||(me=se[he]=[]),me.push(Wt)}}}class H{loadTile(V,$){const{uid:tt,encoding:vt,rawImageData:Tt,padding:Wt}=V,te=R.w.ImageBitmap&amp;&amp;Tt instanceof R.w.ImageBitmap?this.getImageData(Tt,Wt):Tt;$(null,new R.D(tt,te,vt,Wt&lt;1))}getImageData(V,$){this.offscreenCanvas&amp;&amp;this.offscreenCanvasContext||(this.offscreenCanvas=new OffscreenCanvas(V.width,V.height),this.offscreenCanvasContext=this.offscreenCanvas.getContext("2d",{willReadFrequently:!0})),this.offscreenCanvas.width=V.width,this.offscreenCanvas.height=V.height,this.offscreenCanvasContext.drawImage(V,0,0,V.width,V.height);const tt=this.offscreenCanvasContext.getImageData(-$,-$,V.width+2*$,V.height+2*$);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),tt}}function ht(Mt,V){if(Mt.length!==0){mt(Mt[0],V);for(var $=1;$&lt;Mt.length;$++)mt(Mt[$],!V)}}function mt(Mt,V){for(var $=0,tt=0,vt=0,Tt=Mt.length,Wt=Tt-1;vt&lt;Tt;Wt=vt++){var te=(Mt[vt][0]-Mt[Wt][0])*(Mt[Wt][1]+Mt[vt][1]),Et=$+te;tt+=Math.abs($)&gt;=Math.abs(te)?$-Et+te:te-Et+$,$=Et}$+tt&gt;=0!=!!V&amp;&amp;Mt.reverse()}var gt=R.g(function Mt(V,$){var tt,vt=V&amp;&amp;V.type;if(vt==="FeatureCollection")for(tt=0;tt&lt;V.features.length;tt++)Mt(V.features[tt],$);else if(vt==="GeometryCollection")for(tt=0;tt&lt;V.geometries.length;tt++)Mt(V.geometries[tt],$);else if(vt==="Feature")Mt(V.geometry,$);else if(vt==="Polygon")ht(V.coordinates,$);else if(vt==="MultiPolygon")for(tt=0;tt&lt;V.coordinates.length;tt++)ht(V.coordinates[tt],$);return V});const Pt=R.V.prototype.toGeoJSON;var Vt={exports:{}},Nt=R.p,jt=R.a.VectorTileFeature,Qt=ae;function ae(Mt,V){this.options=V||{},this.features=Mt,this.length=Mt.length}function le(Mt,V){this.id=typeof Mt.id=="number"?Mt.id:void 0,this.type=Mt.type,this.rawGeometry=Mt.type===1?[Mt.geometry]:Mt.geometry,this.properties=Mt.tags,this.extent=V||4096}ae.prototype.feature=function(Mt){return new le(this.features[Mt],this.options.extent)},le.prototype.loadGeometry=function(){var Mt=this.rawGeometry;this.geometry=[];for(var V=0;V&lt;Mt.length;V++){for(var $=Mt[V],tt=[],vt=0;vt&lt;$.length;vt++)tt.push(new Nt($[vt][0],$[vt][1]));this.geometry.push(tt)}return this.geometry},le.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var Mt=this.geometry,V=1/0,$=-1/0,tt=1/0,vt=-1/0,Tt=0;Tt&lt;Mt.length;Tt++)for(var Wt=Mt[Tt],te=0;te&lt;Wt.length;te++){var Et=Wt[te];V=Math.min(V,Et.x),$=Math.max($,Et.x),tt=Math.min(tt,Et.y),vt=Math.max(vt,Et.y)}return[V,tt,$,vt]},le.prototype.toGeoJSON=jt.prototype.toGeoJSON;var Oe=R.b,Ge=Qt;function ve(Mt){var V=new Oe;return function($,tt){for(var vt in $.layers)tt.writeMessage(3,Q,$.layers[vt])}(Mt,V),V.finish()}function Q(Mt,V){var $;V.writeVarintField(15,Mt.version||1),V.writeStringField(1,Mt.name||""),V.writeVarintField(5,Mt.extent||4096);var tt={keys:[],values:[],keycache:{},valuecache:{}};for($=0;$&lt;Mt.length;$++)tt.feature=Mt.feature($),V.writeMessage(2,Lt,tt);var vt=tt.keys;for($=0;$&lt;vt.length;$++)V.writeStringField(3,vt[$]);var Tt=tt.values;for($=0;$&lt;Tt.length;$++)V.writeMessage(4,ts,Tt[$])}function Lt(Mt,V){var $=Mt.feature;$.id!==void 0&amp;&amp;V.writeVarintField(1,$.id),V.writeMessage(2,li,Mt),V.writeVarintField(3,$.type),V.writeMessage(4,vi,$)}function li(Mt,V){var $=Mt.feature,tt=Mt.keys,vt=Mt.values,Tt=Mt.keycache,Wt=Mt.valuecache;for(var te in $.properties){var Et=$.properties[te],se=Tt[te];if(Et!==null){se===void 0&amp;&amp;(tt.push(te),Tt[te]=se=tt.length-1),V.writeVarint(se);var he=typeof Et;he!=="string"&amp;&amp;he!=="boolean"&amp;&amp;he!=="number"&amp;&amp;(Et=JSON.stringify(Et));var me=he+":"+Et,di=Wt[me];di===void 0&amp;&amp;(vt.push(Et),Wt[me]=di=vt.length-1),V.writeVarint(di)}}}function Ke(Mt,V){return(V&lt;&lt;3)+(7&amp;Mt)}function $t(Mt){return Mt&lt;&lt;1^Mt&gt;&gt;31}function vi(Mt,V){for(var $=Mt.loadGeometry(),tt=Mt.type,vt=0,Tt=0,Wt=$.length,te=0;te&lt;Wt;te++){var Et=$[te],se=1;tt===1&amp;&amp;(se=Et.length),V.writeVarint(Ke(1,se));for(var he=tt===3?Et.length-1:Et.length,me=0;me&lt;he;me++){me===1&amp;&amp;tt!==1&amp;&amp;V.writeVarint(Ke(2,he-1));var di=Et[me].x-vt,bi=Et[me].y-Tt;V.writeVarint($t(di)),V.writeVarint($t(bi)),vt+=di,Tt+=bi}tt===3&amp;&amp;V.writeVarint(Ke(7,1))}}function ts(Mt,V){var $=typeof Mt;$==="string"?V.writeStringField(1,Mt):$==="boolean"?V.writeBooleanField(7,Mt):$==="number"&amp;&amp;(Mt%1!=0?V.writeDoubleField(3,Mt):Mt&lt;0?V.writeSVarintField(6,Mt):V.writeVarintField(5,Mt))}Vt.exports=ve,Vt.exports.fromVectorTileJs=ve,Vt.exports.fromGeojsonVt=function(Mt,V){V=V||{};var $={};for(var tt in Mt)$[tt]=new Ge(Mt[tt].features,V),$[tt].name=tt,$[tt].version=V.version,$[tt].extent=V.extent;return ve({layers:$})},Vt.exports.GeoJSONWrapper=Ge;var jr=R.g(Vt.exports);const es={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:Mt=&gt;Mt},fr=Math.fround||(Ls=new Float32Array(1),Mt=&gt;(Ls[0]=+Mt,Ls[0]));var Ls;const Gr=3,Xt=5,xn=6;class Hr{constructor(V){this.options=Object.assign(Object.create(es),V),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(V){const{log:$,minZoom:tt,maxZoom:vt}=this.options;$&amp;&amp;console.time("total time");const Tt=`prepare ${V.length} points`;$&amp;&amp;console.time(Tt),this.points=V;const Wt=[];for(let Et=0;Et&lt;V.length;Et++){const se=V[Et];if(!se.geometry)continue;const[he,me]=se.geometry.coordinates,di=fr(Bt(he)),bi=fr(nr(me));Wt.push(di,bi,1/0,Et,-1,1),this.options.reduce&amp;&amp;Wt.push(0)}let te=this.trees[vt+1]=this._createTree(Wt);$&amp;&amp;console.timeEnd(Tt);for(let Et=vt;Et&gt;=tt;Et--){const se=+Date.now();te=this.trees[Et]=this._createTree(this._cluster(te,Et)),$&amp;&amp;console.log("z%d: %d clusters in %dms",Et,te.numItems,+Date.now()-se)}return $&amp;&amp;console.timeEnd("total time"),this}getClusters(V,$){let tt=((V[0]+180)%360+360)%360-180;const vt=Math.max(-90,Math.min(90,V[1]));let Tt=V[2]===180?180:((V[2]+180)%360+360)%360-180;const Wt=Math.max(-90,Math.min(90,V[3]));if(V[2]-V[0]&gt;=360)tt=-180,Tt=180;else if(tt&gt;Tt){const me=this.getClusters([tt,vt,180,Wt],$),di=this.getClusters([-180,vt,Tt,Wt],$);return me.concat(di)}const te=this.trees[this._limitZoom($)],Et=te.range(Bt(tt),nr(Wt),Bt(Tt),nr(vt)),se=te.data,he=[];for(const me of Et){const di=this.stride*me;he.push(se[di+Xt]&gt;1?Rs(se,di,this.clusterProps):this.points[se[di+Gr]])}return he}getChildren(V){const $=this._getOriginId(V),tt=this._getOriginZoom(V),vt="No cluster with the specified id.",Tt=this.trees[tt];if(!Tt)throw new Error(vt);const Wt=Tt.data;if($*this.stride&gt;=Wt.length)throw new Error(vt);const te=this.options.radius/(this.options.extent*Math.pow(2,tt-1)),Et=Tt.within(Wt[$*this.stride],Wt[$*this.stride+1],te),se=[];for(const he of Et){const me=he*this.stride;Wt[me+4]===V&amp;&amp;se.push(Wt[me+Xt]&gt;1?Rs(Wt,me,this.clusterProps):this.points[Wt[me+Gr]])}if(se.length===0)throw new Error(vt);return se}getLeaves(V,$,tt){const vt=[];return this._appendLeaves(vt,V,$=$||10,tt=tt||0,0),vt}getTile(V,$,tt){const vt=this.trees[this._limitZoom(V)],Tt=Math.pow(2,V),{extent:Wt,radius:te}=this.options,Et=te/Wt,se=(tt-Et)/Tt,he=(tt+1+Et)/Tt,me={features:[]};return this._addTileFeatures(vt.range(($-Et)/Tt,se,($+1+Et)/Tt,he),vt.data,$,tt,Tt,me),$===0&amp;&amp;this._addTileFeatures(vt.range(1-Et/Tt,se,1,he),vt.data,Tt,tt,Tt,me),$===Tt-1&amp;&amp;this._addTileFeatures(vt.range(0,se,Et/Tt,he),vt.data,-1,tt,Tt,me),me.features.length?me:null}getClusterExpansionZoom(V){let $=this._getOriginZoom(V)-1;for(;$&lt;=this.options.maxZoom;){const tt=this.getChildren(V);if($++,tt.length!==1)break;V=tt[0].properties.cluster_id}return $}_appendLeaves(V,$,tt,vt,Tt){const Wt=this.getChildren($);for(const te of Wt){const Et=te.properties;if(Et&amp;&amp;Et.cluster?Tt+Et.point_count&lt;=vt?Tt+=Et.point_count:Tt=this._appendLeaves(V,Et.cluster_id,tt,vt,Tt):Tt&lt;vt?Tt++:V.push(te),V.length===tt)break}return Tt}_createTree(V){const $=new R.K(V.length/this.stride|0,this.options.nodeSize,Float32Array);for(let tt=0;tt&lt;V.length;tt+=this.stride)$.add(V[tt],V[tt+1]);return $.finish(),$.data=V,$}_addTileFeatures(V,$,tt,vt,Tt,Wt){for(const te of V){const Et=te*this.stride,se=$[Et+Xt]&gt;1;let he,me,di;if(se)he=Ds($,Et,this.clusterProps),me=$[Et],di=$[Et+1];else{const gi=this.points[$[Et+Gr]];he=gi.properties;const[Ri,pi]=gi.geometry.coordinates;me=Bt(Ri),di=nr(pi)}const bi={type:1,geometry:[[Math.round(this.options.extent*(me*Tt-tt)),Math.round(this.options.extent*(di*Tt-vt))]],tags:he};let ji;ji=se||this.options.generateId?$[Et+Gr]:this.points[$[Et+Gr]].id,ji!==void 0&amp;&amp;(bi.id=ji),Wt.features.push(bi)}}_limitZoom(V){return Math.max(this.options.minZoom,Math.min(Math.floor(+V),this.options.maxZoom+1))}_cluster(V,$){const{radius:tt,extent:vt,reduce:Tt,minPoints:Wt}=this.options,te=tt/(vt*Math.pow(2,$)),Et=V.data,se=[],he=this.stride;for(let me=0;me&lt;Et.length;me+=he){if(Et[me+2]&lt;=$)continue;Et[me+2]=$;const di=Et[me],bi=Et[me+1],ji=V.within(Et[me],Et[me+1],te),gi=Et[me+Xt];let Ri=gi;for(const pi of ji){const yr=pi*he;Et[yr+2]&gt;$&amp;&amp;(Ri+=Et[yr+Xt])}if(Ri&gt;gi&amp;&amp;Ri&gt;=Wt){let pi,yr=di*gi,Sr=bi*gi,Ar=-1;const Lr=((me/he|0)&lt;&lt;5)+($+1)+this.points.length;for(const ao of ji){const Rr=ao*he;if(Et[Rr+2]&lt;=$)continue;Et[Rr+2]=$;const bn=Et[Rr+Xt];yr+=Et[Rr]*bn,Sr+=Et[Rr+1]*bn,Et[Rr+4]=Lr,Tt&amp;&amp;(pi||(pi=this._map(Et,me,!0),Ar=this.clusterProps.length,this.clusterProps.push(pi)),Tt(pi,this._map(Et,Rr)))}Et[me+4]=Lr,se.push(yr/Ri,Sr/Ri,1/0,Lr,-1,Ri),Tt&amp;&amp;se.push(Ar)}else{for(let pi=0;pi&lt;he;pi++)se.push(Et[me+pi]);if(Ri&gt;1)for(const pi of ji){const yr=pi*he;if(!(Et[yr+2]&lt;=$)){Et[yr+2]=$;for(let Sr=0;Sr&lt;he;Sr++)se.push(Et[yr+Sr])}}}}return se}_getOriginId(V){return V-this.points.length&gt;&gt;5}_getOriginZoom(V){return(V-this.points.length)%32}_map(V,$,tt){if(V[$+Xt]&gt;1){const Wt=this.clusterProps[V[$+xn]];return tt?Object.assign({},Wt):Wt}const vt=this.points[V[$+Gr]].properties,Tt=this.options.map(vt);return tt&amp;&amp;Tt===vt?Object.assign({},Tt):Tt}}function Rs(Mt,V,$){return{type:"Feature",id:Mt[V+Gr],properties:Ds(Mt,V,$),geometry:{type:"Point",coordinates:[(tt=Mt[V],360*(tt-.5)),qi(Mt[V+1])]}};var tt}function Ds(Mt,V,$){const tt=Mt[V+Xt],vt=tt&gt;=1e4?`${Math.round(tt/1e3)}k`:tt&gt;=1e3?Math.round(tt/100)/10+"k":tt,Tt=Mt[V+xn],Wt=Tt===-1?{}:Object.assign({},$[Tt]);return Object.assign(Wt,{cluster:!0,cluster_id:Mt[V+Gr],point_count:tt,point_count_abbreviated:vt})}function Bt(Mt){return Mt/360+.5}function nr(Mt){const V=Math.sin(Mt*Math.PI/180),$=.5-.25*Math.log((1+V)/(1-V))/Math.PI;return $&lt;0?0:$&gt;1?1:$}function qi(Mt){const V=(180-360*Mt)*Math.PI/180;return 360*Math.atan(Math.exp(V))/Math.PI-90}var ar={exports:{}};ar.exports=function(){function Mt(pt,yt,St,Ct){for(var Rt,zt=Ct,Ut=St-yt&gt;&gt;1,Dt=St-yt,Kt=pt[yt],Ft=pt[yt+1],Te=pt[St],Je=pt[St+1],oe=yt+3;oe&lt;St;oe+=3){var Qe=V(pt[oe],pt[oe+1],Kt,Ft,Te,Je);if(Qe&gt;zt)Rt=oe,zt=Qe;else if(Qe===zt){var Ei=Math.abs(oe-Ut);Ei&lt;Dt&amp;&amp;(Rt=oe,Dt=Ei)}}zt&gt;Ct&amp;&amp;(Rt-yt&gt;3&amp;&amp;Mt(pt,yt,Rt,Ct),pt[Rt+2]=zt,St-Rt&gt;3&amp;&amp;Mt(pt,Rt,St,Ct))}function V(pt,yt,St,Ct,Rt,zt){var Ut=Rt-St,Dt=zt-Ct;if(Ut!==0||Dt!==0){var Kt=((pt-St)*Ut+(yt-Ct)*Dt)/(Ut*Ut+Dt*Dt);Kt&gt;1?(St=Rt,Ct=zt):Kt&gt;0&amp;&amp;(St+=Ut*Kt,Ct+=Dt*Kt)}return(Ut=pt-St)*Ut+(Dt=yt-Ct)*Dt}function $(pt,yt,St,Ct){var Rt={id:pt===void 0?null:pt,type:yt,geometry:St,tags:Ct,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(zt){var Ut=zt.geometry,Dt=zt.type;if(Dt==="Point"||Dt==="MultiPoint"||Dt==="LineString")tt(zt,Ut);else if(Dt==="Polygon"||Dt==="MultiLineString")for(var Kt=0;Kt&lt;Ut.length;Kt++)tt(zt,Ut[Kt]);else if(Dt==="MultiPolygon")for(Kt=0;Kt&lt;Ut.length;Kt++)for(var Ft=0;Ft&lt;Ut[Kt].length;Ft++)tt(zt,Ut[Kt][Ft])}(Rt),Rt}function tt(pt,yt){for(var St=0;St&lt;yt.length;St+=3)pt.minX=Math.min(pt.minX,yt[St]),pt.minY=Math.min(pt.minY,yt[St+1]),pt.maxX=Math.max(pt.maxX,yt[St]),pt.maxY=Math.max(pt.maxY,yt[St+1])}function vt(pt,yt,St,Ct){if(yt.geometry){var Rt=yt.geometry.coordinates,zt=yt.geometry.type,Ut=Math.pow(St.tolerance/((1&lt;&lt;St.maxZoom)*St.extent),2),Dt=[],Kt=yt.id;if(St.promoteId?Kt=yt.properties[St.promoteId]:St.generateId&amp;&amp;(Kt=Ct||0),zt==="Point")Tt(Rt,Dt);else if(zt==="MultiPoint")for(var Ft=0;Ft&lt;Rt.length;Ft++)Tt(Rt[Ft],Dt);else if(zt==="LineString")Wt(Rt,Dt,Ut,!1);else if(zt==="MultiLineString"){if(St.lineMetrics){for(Ft=0;Ft&lt;Rt.length;Ft++)Wt(Rt[Ft],Dt=[],Ut,!1),pt.push($(Kt,"LineString",Dt,yt.properties));return}te(Rt,Dt,Ut,!1)}else if(zt==="Polygon")te(Rt,Dt,Ut,!0);else{if(zt!=="MultiPolygon"){if(zt==="GeometryCollection"){for(Ft=0;Ft&lt;yt.geometry.geometries.length;Ft++)vt(pt,{id:Kt,geometry:yt.geometry.geometries[Ft],properties:yt.properties},St,Ct);return}throw new Error("Input data is not a valid GeoJSON object.")}for(Ft=0;Ft&lt;Rt.length;Ft++){var Te=[];te(Rt[Ft],Te,Ut,!0),Dt.push(Te)}}pt.push($(Kt,zt,Dt,yt.properties))}}function Tt(pt,yt){yt.push(Et(pt[0])),yt.push(se(pt[1])),yt.push(0)}function Wt(pt,yt,St,Ct){for(var Rt,zt,Ut=0,Dt=0;Dt&lt;pt.length;Dt++){var Kt=Et(pt[Dt][0]),Ft=se(pt[Dt][1]);yt.push(Kt),yt.push(Ft),yt.push(0),Dt&gt;0&amp;&amp;(Ut+=Ct?(Rt*Ft-Kt*zt)/2:Math.sqrt(Math.pow(Kt-Rt,2)+Math.pow(Ft-zt,2))),Rt=Kt,zt=Ft}var Te=yt.length-3;yt[2]=1,Mt(yt,0,Te,St),yt[Te+2]=1,yt.size=Math.abs(Ut),yt.start=0,yt.end=yt.size}function te(pt,yt,St,Ct){for(var Rt=0;Rt&lt;pt.length;Rt++){var zt=[];Wt(pt[Rt],zt,St,Ct),yt.push(zt)}}function Et(pt){return pt/360+.5}function se(pt){var yt=Math.sin(pt*Math.PI/180),St=.5-.25*Math.log((1+yt)/(1-yt))/Math.PI;return St&lt;0?0:St&gt;1?1:St}function he(pt,yt,St,Ct,Rt,zt,Ut,Dt){if(Ct/=yt,zt&gt;=(St/=yt)&amp;&amp;Ut&lt;Ct)return pt;if(Ut&lt;St||zt&gt;=Ct)return null;for(var Kt=[],Ft=0;Ft&lt;pt.length;Ft++){var Te=pt[Ft],Je=Te.geometry,oe=Te.type,Qe=Rt===0?Te.minX:Te.minY,Ei=Rt===0?Te.maxX:Te.maxY;if(Qe&gt;=St&amp;&amp;Ei&lt;Ct)Kt.push(Te);else if(!(Ei&lt;St||Qe&gt;=Ct)){var Pi=[];if(oe==="Point"||oe==="MultiPoint")me(Je,Pi,St,Ct,Rt);else if(oe==="LineString")di(Je,Pi,St,Ct,Rt,!1,Dt.lineMetrics);else if(oe==="MultiLineString")ji(Je,Pi,St,Ct,Rt,!1);else if(oe==="Polygon")ji(Je,Pi,St,Ct,Rt,!0);else if(oe==="MultiPolygon")for(var Ni=0;Ni&lt;Je.length;Ni++){var pr=[];ji(Je[Ni],pr,St,Ct,Rt,!0),pr.length&amp;&amp;Pi.push(pr)}if(Pi.length){if(Dt.lineMetrics&amp;&amp;oe==="LineString"){for(Ni=0;Ni&lt;Pi.length;Ni++)Kt.push($(Te.id,oe,Pi[Ni],Te.tags));continue}oe!=="LineString"&amp;&amp;oe!=="MultiLineString"||(Pi.length===1?(oe="LineString",Pi=Pi[0]):oe="MultiLineString"),oe!=="Point"&amp;&amp;oe!=="MultiPoint"||(oe=Pi.length===3?"Point":"MultiPoint"),Kt.push($(Te.id,oe,Pi,Te.tags))}}}return Kt.length?Kt:null}function me(pt,yt,St,Ct,Rt){for(var zt=0;zt&lt;pt.length;zt+=3){var Ut=pt[zt+Rt];Ut&gt;=St&amp;&amp;Ut&lt;=Ct&amp;&amp;(yt.push(pt[zt]),yt.push(pt[zt+1]),yt.push(pt[zt+2]))}}function di(pt,yt,St,Ct,Rt,zt,Ut){for(var Dt,Kt,Ft=bi(pt),Te=Rt===0?Ri:pi,Je=pt.start,oe=0;oe&lt;pt.length-3;oe+=3){var Qe=pt[oe],Ei=pt[oe+1],Pi=pt[oe+2],Ni=pt[oe+3],pr=pt[oe+4],kr=Rt===0?Qe:Ei,Gi=Rt===0?Ni:pr,Ki=!1;Ut&amp;&amp;(Dt=Math.sqrt(Math.pow(Qe-Ni,2)+Math.pow(Ei-pr,2))),kr&lt;St?Gi&gt;St&amp;&amp;(Kt=Te(Ft,Qe,Ei,Ni,pr,St),Ut&amp;&amp;(Ft.start=Je+Dt*Kt)):kr&gt;Ct?Gi&lt;Ct&amp;&amp;(Kt=Te(Ft,Qe,Ei,Ni,pr,Ct),Ut&amp;&amp;(Ft.start=Je+Dt*Kt)):gi(Ft,Qe,Ei,Pi),Gi&lt;St&amp;&amp;kr&gt;=St&amp;&amp;(Kt=Te(Ft,Qe,Ei,Ni,pr,St),Ki=!0),Gi&gt;Ct&amp;&amp;kr&lt;=Ct&amp;&amp;(Kt=Te(Ft,Qe,Ei,Ni,pr,Ct),Ki=!0),!zt&amp;&amp;Ki&amp;&amp;(Ut&amp;&amp;(Ft.end=Je+Dt*Kt),yt.push(Ft),Ft=bi(pt)),Ut&amp;&amp;(Je+=Dt)}var Ji=pt.length-3;Qe=pt[Ji],Ei=pt[Ji+1],Pi=pt[Ji+2],(kr=Rt===0?Qe:Ei)&gt;=St&amp;&amp;kr&lt;=Ct&amp;&amp;gi(Ft,Qe,Ei,Pi),Ji=Ft.length-3,zt&amp;&amp;Ji&gt;=3&amp;&amp;(Ft[Ji]!==Ft[0]||Ft[Ji+1]!==Ft[1])&amp;&amp;gi(Ft,Ft[0],Ft[1],Ft[2]),Ft.length&amp;&amp;yt.push(Ft)}function bi(pt){var yt=[];return yt.size=pt.size,yt.start=pt.start,yt.end=pt.end,yt}function ji(pt,yt,St,Ct,Rt,zt){for(var Ut=0;Ut&lt;pt.length;Ut++)di(pt[Ut],yt,St,Ct,Rt,zt,!1)}function gi(pt,yt,St,Ct){pt.push(yt),pt.push(St),pt.push(Ct)}function Ri(pt,yt,St,Ct,Rt,zt){var Ut=(zt-yt)/(Ct-yt);return pt.push(zt),pt.push(St+(Rt-St)*Ut),pt.push(1),Ut}function pi(pt,yt,St,Ct,Rt,zt){var Ut=(zt-St)/(Rt-St);return pt.push(yt+(Ct-yt)*Ut),pt.push(zt),pt.push(1),Ut}function yr(pt,yt){for(var St=[],Ct=0;Ct&lt;pt.length;Ct++){var Rt,zt=pt[Ct],Ut=zt.type;if(Ut==="Point"||Ut==="MultiPoint"||Ut==="LineString")Rt=Sr(zt.geometry,yt);else if(Ut==="MultiLineString"||Ut==="Polygon"){Rt=[];for(var Dt=0;Dt&lt;zt.geometry.length;Dt++)Rt.push(Sr(zt.geometry[Dt],yt))}else if(Ut==="MultiPolygon")for(Rt=[],Dt=0;Dt&lt;zt.geometry.length;Dt++){for(var Kt=[],Ft=0;Ft&lt;zt.geometry[Dt].length;Ft++)Kt.push(Sr(zt.geometry[Dt][Ft],yt));Rt.push(Kt)}St.push($(zt.id,Ut,Rt,zt.tags))}return St}function Sr(pt,yt){var St=[];St.size=pt.size,pt.start!==void 0&amp;&amp;(St.start=pt.start,St.end=pt.end);for(var Ct=0;Ct&lt;pt.length;Ct+=3)St.push(pt[Ct]+yt,pt[Ct+1],pt[Ct+2]);return St}function Ar(pt,yt){if(pt.transformed)return pt;var St,Ct,Rt,zt=1&lt;&lt;pt.z,Ut=pt.x,Dt=pt.y;for(St=0;St&lt;pt.features.length;St++){var Kt=pt.features[St],Ft=Kt.geometry,Te=Kt.type;if(Kt.geometry=[],Te===1)for(Ct=0;Ct&lt;Ft.length;Ct+=2)Kt.geometry.push(Lr(Ft[Ct],Ft[Ct+1],yt,zt,Ut,Dt));else for(Ct=0;Ct&lt;Ft.length;Ct++){var Je=[];for(Rt=0;Rt&lt;Ft[Ct].length;Rt+=2)Je.push(Lr(Ft[Ct][Rt],Ft[Ct][Rt+1],yt,zt,Ut,Dt));Kt.geometry.push(Je)}}return pt.transformed=!0,pt}function Lr(pt,yt,St,Ct,Rt,zt){return[Math.round(St*(pt*Ct-Rt)),Math.round(St*(yt*Ct-zt))]}function ao(pt,yt,St,Ct,Rt){for(var zt=yt===Rt.maxZoom?0:Rt.tolerance/((1&lt;&lt;yt)*Rt.extent),Ut={features:[],numPoints:0,numSimplified:0,numFeatures:0,source:null,x:St,y:Ct,z:yt,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0},Dt=0;Dt&lt;pt.length;Dt++){Ut.numFeatures++,Rr(Ut,pt[Dt],zt,Rt);var Kt=pt[Dt].minX,Ft=pt[Dt].minY,Te=pt[Dt].maxX,Je=pt[Dt].maxY;Kt&lt;Ut.minX&amp;&amp;(Ut.minX=Kt),Ft&lt;Ut.minY&amp;&amp;(Ut.minY=Ft),Te&gt;Ut.maxX&amp;&amp;(Ut.maxX=Te),Je&gt;Ut.maxY&amp;&amp;(Ut.maxY=Je)}return Ut}function Rr(pt,yt,St,Ct){var Rt=yt.geometry,zt=yt.type,Ut=[];if(zt==="Point"||zt==="MultiPoint")for(var Dt=0;Dt&lt;Rt.length;Dt+=3)Ut.push(Rt[Dt]),Ut.push(Rt[Dt+1]),pt.numPoints++,pt.numSimplified++;else if(zt==="LineString")bn(Ut,Rt,pt,St,!1,!1);else if(zt==="MultiLineString"||zt==="Polygon")for(Dt=0;Dt&lt;Rt.length;Dt++)bn(Ut,Rt[Dt],pt,St,zt==="Polygon",Dt===0);else if(zt==="MultiPolygon")for(var Kt=0;Kt&lt;Rt.length;Kt++){var Ft=Rt[Kt];for(Dt=0;Dt&lt;Ft.length;Dt++)bn(Ut,Ft[Dt],pt,St,!0,Dt===0)}if(Ut.length){var Te=yt.tags||null;if(zt==="LineString"&amp;&amp;Ct.lineMetrics){for(var Je in Te={},yt.tags)Te[Je]=yt.tags[Je];Te.mapbox_clip_start=Rt.start/Rt.size,Te.mapbox_clip_end=Rt.end/Rt.size}var oe={geometry:Ut,type:zt==="Polygon"||zt==="MultiPolygon"?3:zt==="LineString"||zt==="MultiLineString"?2:1,tags:Te};yt.id!==null&amp;&amp;(oe.id=yt.id),pt.features.push(oe)}}function bn(pt,yt,St,Ct,Rt,zt){var Ut=Ct*Ct;if(Ct&gt;0&amp;&amp;yt.size&lt;(Rt?Ut:Ct))St.numPoints+=yt.length/3;else{for(var Dt=[],Kt=0;Kt&lt;yt.length;Kt+=3)(Ct===0||yt[Kt+2]&gt;Ut)&amp;&amp;(St.numSimplified++,Dt.push(yt[Kt]),Dt.push(yt[Kt+1])),St.numPoints++;Rt&amp;&amp;function(Ft,Te){for(var Je=0,oe=0,Qe=Ft.length,Ei=Qe-2;oe&lt;Qe;Ei=oe,oe+=2)Je+=(Ft[oe]-Ft[Ei])*(Ft[oe+1]+Ft[Ei+1]);if(Je&gt;0===Te)for(oe=0,Qe=Ft.length;oe&lt;Qe/2;oe+=2){var Pi=Ft[oe],Ni=Ft[oe+1];Ft[oe]=Ft[Qe-2-oe],Ft[oe+1]=Ft[Qe-1-oe],Ft[Qe-2-oe]=Pi,Ft[Qe-1-oe]=Ni}}(Dt,zt),pt.push(Dt)}}function Bn(pt,yt){var St=(yt=this.options=function(Rt,zt){for(var Ut in zt)Rt[Ut]=zt[Ut];return Rt}(Object.create(this.options),yt)).debug;if(St&amp;&amp;console.time("preprocess data"),yt.maxZoom&lt;0||yt.maxZoom&gt;24)throw new Error("maxZoom should be in the 0-24 range");if(yt.promoteId&amp;&amp;yt.generateId)throw new Error("promoteId and generateId cannot be used together.");var Ct=function(Rt,zt){var Ut=[];if(Rt.type==="FeatureCollection")for(var Dt=0;Dt&lt;Rt.features.length;Dt++)vt(Ut,Rt.features[Dt],zt,Dt);else vt(Ut,Rt.type==="Feature"?Rt:{geometry:Rt},zt);return Ut}(pt,yt);this.tiles={},this.tileCoords=[],St&amp;&amp;(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",yt.indexMaxZoom,yt.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),(Ct=function(Rt,zt){var Ut=zt.buffer/zt.extent,Dt=Rt,Kt=he(Rt,1,-1-Ut,Ut,0,-1,2,zt),Ft=he(Rt,1,1-Ut,2+Ut,0,-1,2,zt);return(Kt||Ft)&amp;&amp;(Dt=he(Rt,1,-Ut,1+Ut,0,-1,2,zt)||[],Kt&amp;&amp;(Dt=yr(Kt,1).concat(Dt)),Ft&amp;&amp;(Dt=Dt.concat(yr(Ft,-1)))),Dt}(Ct,yt)).length&amp;&amp;this.splitTile(Ct,0,0,0),St&amp;&amp;(Ct.length&amp;&amp;console.log("features: %d, points: %d",this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd("generate tiles"),console.log("tiles generated:",this.total,JSON.stringify(this.stats)))}function ns(pt,yt,St){return 32*((1&lt;&lt;pt)*St+yt)+pt}return Bn.prototype.options={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0},Bn.prototype.splitTile=function(pt,yt,St,Ct,Rt,zt,Ut){for(var Dt=[pt,yt,St,Ct],Kt=this.options,Ft=Kt.debug;Dt.length;){Ct=Dt.pop(),St=Dt.pop(),yt=Dt.pop(),pt=Dt.pop();var Te=1&lt;&lt;yt,Je=ns(yt,St,Ct),oe=this.tiles[Je];if(!oe&amp;&amp;(Ft&gt;1&amp;&amp;console.time("creation"),oe=this.tiles[Je]=ao(pt,yt,St,Ct,Kt),this.tileCoords.push({z:yt,x:St,y:Ct}),Ft)){Ft&gt;1&amp;&amp;(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",yt,St,Ct,oe.numFeatures,oe.numPoints,oe.numSimplified),console.timeEnd("creation"));var Qe="z"+yt;this.stats[Qe]=(this.stats[Qe]||0)+1,this.total++}if(oe.source=pt,Rt){if(yt===Kt.maxZoom||yt===Rt)continue;var Ei=1&lt;&lt;Rt-yt;if(St!==Math.floor(zt/Ei)||Ct!==Math.floor(Ut/Ei))continue}else if(yt===Kt.indexMaxZoom||oe.numPoints&lt;=Kt.indexMaxPoints)continue;if(oe.source=null,pt.length!==0){Ft&gt;1&amp;&amp;console.time("clipping");var Pi,Ni,pr,kr,Gi,Ki,Ji=.5*Kt.buffer/Kt.extent,wn=.5-Ji,an=.5+Ji,ss=1+Ji;Pi=Ni=pr=kr=null,Gi=he(pt,Te,St-Ji,St+an,0,oe.minX,oe.maxX,Kt),Ki=he(pt,Te,St+wn,St+ss,0,oe.minX,oe.maxX,Kt),pt=null,Gi&amp;&amp;(Pi=he(Gi,Te,Ct-Ji,Ct+an,1,oe.minY,oe.maxY,Kt),Ni=he(Gi,Te,Ct+wn,Ct+ss,1,oe.minY,oe.maxY,Kt),Gi=null),Ki&amp;&amp;(pr=he(Ki,Te,Ct-Ji,Ct+an,1,oe.minY,oe.maxY,Kt),kr=he(Ki,Te,Ct+wn,Ct+ss,1,oe.minY,oe.maxY,Kt),Ki=null),Ft&gt;1&amp;&amp;console.timeEnd("clipping"),Dt.push(Pi||[],yt+1,2*St,2*Ct),Dt.push(Ni||[],yt+1,2*St,2*Ct+1),Dt.push(pr||[],yt+1,2*St+1,2*Ct),Dt.push(kr||[],yt+1,2*St+1,2*Ct+1)}}},Bn.prototype.getTile=function(pt,yt,St){var Ct=this.options,Rt=Ct.extent,zt=Ct.debug;if(pt&lt;0||pt&gt;24)return null;var Ut=1&lt;&lt;pt,Dt=ns(pt,yt=(yt%Ut+Ut)%Ut,St);if(this.tiles[Dt])return Ar(this.tiles[Dt],Rt);zt&gt;1&amp;&amp;console.log("drilling down to z%d-%d-%d",pt,yt,St);for(var Kt,Ft=pt,Te=yt,Je=St;!Kt&amp;&amp;Ft&gt;0;)Ft--,Te=Math.floor(Te/2),Je=Math.floor(Je/2),Kt=this.tiles[ns(Ft,Te,Je)];return Kt&amp;&amp;Kt.source?(zt&gt;1&amp;&amp;console.log("found parent tile z%d-%d-%d",Ft,Te,Je),zt&gt;1&amp;&amp;console.time("drilling down"),this.splitTile(Kt.source,Ft,Te,Je,pt,yt,St),zt&gt;1&amp;&amp;console.timeEnd("drilling down"),this.tiles[Dt]?Ar(this.tiles[Dt],Rt):null):null},function(pt,yt){return new Bn(pt,yt)}}();var Os=R.g(ar.exports);function is(Mt,V){const $=Mt.tileID.canonical;if(!this._geoJSONIndex)return V(null,null);const tt=this._geoJSONIndex.getTile($.z,$.x,$.y);if(!tt)return V(null,null);const vt=new class{constructor(Wt){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=R.E,this.length=Wt.length,this._features=Wt}feature(Wt){return new class{constructor(te){this._feature=te,this.extent=R.E,this.type=te.type,this.properties=te.tags,"id"in te&amp;&amp;!isNaN(te.id)&amp;&amp;(this.id=parseInt(te.id,10))}loadGeometry(){if(this._feature.type===1){const te=[];for(const Et of this._feature.geometry)te.push([new R.P(Et[0],Et[1])]);return te}{const te=[];for(const Et of this._feature.geometry){const se=[];for(const he of Et)se.push(new R.P(he[0],he[1]));te.push(se)}return te}}toGeoJSON(te,Et,se){return Pt.call(this,te,Et,se)}}(this._features[Wt])}}(tt.features);let Tt=jr(vt);Tt.byteOffset===0&amp;&amp;Tt.byteLength===Tt.buffer.byteLength||(Tt=new Uint8Array(Tt)),V(null,{vectorTile:vt,rawData:Tt.buffer})}class rs extends R.d{constructor(V,$,tt,vt,Tt,Wt){super(V,$,tt,vt,is,Wt),Tt&amp;&amp;(this.loadGeoJSON=Tt)}loadData(V,$){const tt=V&amp;&amp;V.request,vt=tt&amp;&amp;tt.collectResourceTiming;this.loadGeoJSON(V,(Tt,Wt)=&gt;{if(Tt||!Wt)return $(Tt);if(typeof Wt!="object")return $(new Error(`Input data given to '${V.source}' is not a valid GeoJSON object.`));{gt(Wt,!0);try{if(V.filter){const Et=R.e(V.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(Et.result==="error")throw new Error(Et.value.map(he=&gt;`${he.key}: ${he.message}`).join(", "));Wt={type:"FeatureCollection",features:Wt.features.filter(he=&gt;Et.value.evaluate({zoom:0},he))}}this._geoJSONIndex=V.cluster?new Hr(function({superclusterOptions:Et,clusterProperties:se}){if(!se||!Et)return Et;const he={},me={},di={accumulated:null,zoom:0},bi={properties:null},ji=Object.keys(se);for(const gi of ji){const[Ri,pi]=se[gi],yr=R.e(pi),Sr=R.e(typeof Ri=="string"?[Ri,["accumulated"],["get",gi]]:Ri);he[gi]=yr.value,me[gi]=Sr.value}return Et.map=gi=&gt;{bi.properties=gi;const Ri={};for(const pi of ji)Ri[pi]=he[pi].evaluate(di,bi);return Ri},Et.reduce=(gi,Ri)=&gt;{bi.properties=Ri;for(const pi of ji)di.accumulated=gi[pi],gi[pi]=me[pi].evaluate(di,bi)},Et}(V)).load(Wt.features):Os(Wt,V.geojsonVtOptions)}catch(Et){return $(Et)}this.loaded={};const te={};if(vt){const Et=R.f(tt);Et&amp;&amp;(te.resourceTiming={},te.resourceTiming[V.source]=JSON.parse(JSON.stringify(Et)))}$(null,te)}})}reloadTile(V,$){const tt=this.loaded;return tt&amp;&amp;tt[V.uid]?super.reloadTile(V,$):this.loadTile(V,$)}loadGeoJSON(V,$){if(V.request)R.h(V.request,$);else{if(typeof V.data!="string")return $(new Error(`Input data given to '${V.source}' is not a valid GeoJSON object.`));try{return $(null,JSON.parse(V.data))}catch{return $(new Error(`Input data given to '${V.source}' is not a valid GeoJSON object.`))}}}getClusterExpansionZoom(V,$){try{$(null,this._geoJSONIndex.getClusterExpansionZoom(V.clusterId))}catch(tt){$(tt)}}getClusterChildren(V,$){try{$(null,this._geoJSONIndex.getChildren(V.clusterId))}catch(tt){$(tt)}}getClusterLeaves(V,$){try{$(null,this._geoJSONIndex.getLeaves(V.clusterId,V.limit,V.offset))}catch(tt){$(tt)}}}class Oi{constructor(V,$){this.tileID=new R.O(V.tileID.overscaledZ,V.tileID.wrap,V.tileID.canonical.z,V.tileID.canonical.x,V.tileID.canonical.y),this.tileZoom=V.tileZoom,this.uid=V.uid,this.zoom=V.zoom,this.canonical=V.tileID.canonical,this.pixelRatio=V.pixelRatio,this.tileSize=V.tileSize,this.source=V.source,this.overscaling=this.tileID.overscaleFactor(),this.projection=V.projection,this.brightness=$}parse(V,$,tt,vt){this.status="parsing";const Tt=new R.O(tt.tileID.overscaledZ,tt.tileID.wrap,tt.tileID.canonical.z,tt.tileID.canonical.x,tt.tileID.canonical.y),Wt={},te=$.familiesBySource[tt.source],Et=new R.F(Tt,tt.promoteId);return Et.bucketLayerIDs=[],R.l(V).then(se=&gt;{if(!se)return vt(new Error("Could not parse tile"));const he=R.j(se,1/R.t(tt.tileID.canonical)),me=se.json.extensionsUsed&amp;&amp;se.json.extensionsUsed.includes("MAPBOX_mesh_features"),di=new R.k(this.zoom,{brightness:this.brightness});for(const bi in te)for(const ji of te[bi]){const gi=ji[0],Ri=se.json.extensionsUsed;gi.recalculate(di,[]);const pi=new R.T(he,Tt,Ri&amp;&amp;Ri.includes("MAPBOX_mesh_features"),this.brightness);me||(pi.needsUpload=!0),Wt[gi.fqid]=pi,pi.evaluate(gi)}this.status="done",vt(null,{buckets:Wt,featureIndex:Et})}).catch(se=&gt;vt(new Error(se.message)))}}class vn{constructor(V,$,tt,vt,Tt,Wt){this.actor=V,this.layerIndex=$,this.brightness=Wt,this.loading={},this.loaded={}}loadTile(V,$){const tt=V.uid,vt=this.loading[tt]=new Oi(V,this.brightness);R.i(V.request,(Tt,Wt)=&gt;{const te=!this.loading[tt];return delete this.loading[tt],te||Tt?(vt.status="done",te||(this.loaded[tt]=vt),$(Tt)):Wt&amp;&amp;Wt.byteLength!==0?void vt.parse(Wt,this.layerIndex,V,(Et,se)=&gt;{vt.status="done",this.loaded=this.loaded||{},this.loaded[tt]=vt,Et||!se?$(Et):$(null,se)}):(vt.status="done",this.loaded[tt]=vt,$())})}reloadTile(V,$){const tt=this.loaded,vt=V.uid;if(tt&amp;&amp;tt[vt]){const Tt=tt[vt];Tt.projection=V.projection,Tt.brightness=V.brightness;const Wt=(te,Et)=&gt;{Tt.reloadCallback&amp;&amp;(delete Tt.reloadCallback,this.loadTile(V,$)),$(te,Et)};Tt.status==="parsing"?Tt.reloadCallback=Wt:Tt.status==="done"&amp;&amp;this.loadTile(V,$)}}abortTile(V,$){const tt=V.uid;this.loading[tt]&amp;&amp;delete this.loading[tt],$()}removeTile(V,$){const tt=this.loaded,vt=V.uid;tt&amp;&amp;tt[vt]&amp;&amp;delete tt[vt],$()}}class Er{constructor(V){this.self=V,this.actor=new R.A(V,this),this.layerIndexes={},this.availableImages={},this.isSpriteLoaded={},this.projections={},this.defaultProjection=R.m({name:"mercator"}),this.workerSourceTypes={vector:R.d,geojson:rs,"batched-model":vn},this.workerSources={},this.demWorkerSources={},this.self.registerWorkerSource=($,tt)=&gt;{if(this.workerSourceTypes[$])throw new Error(`Worker source with name "${$}" already registered.`);this.workerSourceTypes[$]=tt},this.self.registerRTLTextPlugin=$=&gt;{if(R.n.isParsed())throw new Error("RTL text plugin already registered.");R.n.applyArabicShaping=$.applyArabicShaping,R.n.processBidirectionalText=$.processBidirectionalText,R.n.processStyledBidirectionalText=$.processStyledBidirectionalText}}clearCaches(V,$,tt){delete this.layerIndexes[V],delete this.availableImages[V],delete this.workerSources[V],delete this.demWorkerSources[V],tt()}checkIfReady(V,$,tt){tt()}setReferrer(V,$){this.referrer=$}spriteLoaded(V,{scope:$,isLoaded:tt}){if(this.isSpriteLoaded[V]||(this.isSpriteLoaded[V]={}),this.isSpriteLoaded[V][$]=tt,this.workerSources[V]&amp;&amp;this.workerSources[V][$])for(const vt in this.workerSources[V][$]){const Tt=this.workerSources[V][$][vt];for(const Wt in Tt)Tt[Wt]instanceof R.d&amp;&amp;(Tt[Wt].isSpriteLoaded=tt,Tt[Wt].fire(new R.o("isSpriteLoaded")))}}setImages(V,{scope:$,images:tt},vt){if(this.availableImages[V]||(this.availableImages[V]={}),this.availableImages[V][$]=tt,this.workerSources[V]&amp;&amp;this.workerSources[V][$]){for(const Tt in this.workerSources[V][$]){const Wt=this.workerSources[V][$][Tt];for(const te in Wt)Wt[te].availableImages=tt}vt()}else vt()}setProjection(V,$){this.projections[V]=R.m($)}setBrightness(V,$,tt){this.brightness=$,tt()}setLayers(V,$,tt){this.getLayerIndex(V,$.scope).replace($.layers,$.options),tt()}updateLayers(V,$,tt){this.getLayerIndex(V,$.scope).update($.layers,$.removedIds,$.options),tt()}loadTile(V,$,tt){$.projection=this.projections[V]||this.defaultProjection,this.getWorkerSource(V,$.type,$.source,$.scope).loadTile($,tt)}loadDEMTile(V,$,tt){this.getDEMWorkerSource(V,$.source,$.scope).loadTile($,tt)}reloadTile(V,$,tt){$.projection=this.projections[V]||this.defaultProjection,this.getWorkerSource(V,$.type,$.source,$.scope).reloadTile($,tt)}abortTile(V,$,tt){this.getWorkerSource(V,$.type,$.source,$.scope).abortTile($,tt)}removeTile(V,$,tt){this.getWorkerSource(V,$.type,$.source,$.scope).removeTile($,tt)}removeSource(V,$,tt){if(!(this.workerSources[V]&amp;&amp;this.workerSources[V][$.scope]&amp;&amp;this.workerSources[V][$.scope][$.type]&amp;&amp;this.workerSources[V][$.scope][$.type][$.source]))return;const vt=this.workerSources[V][$.scope][$.type][$.source];delete this.workerSources[V][$.scope][$.type][$.source],vt.removeSource!==void 0?vt.removeSource($,tt):tt()}loadWorkerSource(V,$,tt){try{this.self.importScripts($.url),tt()}catch(vt){tt(vt.toString())}}syncRTLPluginState(V,$,tt){try{R.n.setState($);const vt=R.n.getPluginURL();if(R.n.isLoaded()&amp;&amp;!R.n.isParsed()&amp;&amp;vt!=null){this.self.importScripts(vt);const Tt=R.n.isParsed();tt(Tt?void 0:new Error(`RTL Text Plugin failed to import scripts from ${vt}`),Tt)}}catch(vt){tt(vt.toString())}}setDracoUrl(V,$){this.dracoUrl=$}getAvailableImages(V,$){this.availableImages[V]||(this.availableImages[V]={});let tt=this.availableImages[V][$];return tt||(tt=[]),tt}getLayerIndex(V,$){this.layerIndexes[V]||(this.layerIndexes[V]={});let tt=this.layerIndexes[V][$];return tt||(tt=this.layerIndexes[V][$]=new j,tt.scope=$),tt}getWorkerSource(V,$,tt,vt){if(this.workerSources[V]||(this.workerSources[V]={}),this.workerSources[V][vt]||(this.workerSources[V][vt]={}),this.workerSources[V][vt][$]||(this.workerSources[V][vt][$]={}),this.isSpriteLoaded[V]||(this.isSpriteLoaded[V]={}),!this.workerSources[V][vt][$][tt]){const Tt={send:(Wt,te,Et,se,he,me)=&gt;{this.actor.send(Wt,te,Et,V,he,me)},scheduler:this.actor.scheduler};this.workerSources[V][vt][$][tt]=new this.workerSourceTypes[$](Tt,this.getLayerIndex(V,vt),this.getAvailableImages(V,vt),this.isSpriteLoaded[V][vt],void 0,this.brightness)}return this.workerSources[V][vt][$][tt]}getDEMWorkerSource(V,$,tt){return this.demWorkerSources[V]||(this.demWorkerSources[V]={}),this.demWorkerSources[V][tt]||(this.demWorkerSources[V][tt]={}),this.demWorkerSources[V][tt][$]||(this.demWorkerSources[V][tt][$]=new H),this.demWorkerSources[V][tt][$]}enforceCacheSizeLimit(V,$){R.q($)}getWorkerPerformanceMetrics(V,$,tt){tt(void 0,void 0)}}return typeof WorkerGlobalScope&lt;"u"&amp;&amp;typeof self&lt;"u"&amp;&amp;self instanceof WorkerGlobalScope&amp;&amp;(self.worker=new Er(self)),Er}),E(["./shared"],function(R){return R.s});var A=v;return A})})(HM);var UV=HM.exports;const lA=NM(UV),VV=[{source:[-95.98905217449477,36.15529542380874],destination:[-95.9026216711986,36.33465987049138]},{source:[-95.9026216711986,36.33465987049138],destination:[-120.00030527300487,38.90670208758823]},{source:[-120.00030527300487,38.90670208758823],destination:[-120.80917457689065,44.30267804208938]},{source:[-120.80917457689065,44.30267804208938],destination:[-120.84803802147638,44.30442172121437]}];function uf(c,o){return c==null||o==null?NaN:c&lt;o?-1:c&gt;o?1:c&gt;=o?0:NaN}function jV(c,o){return c==null||o==null?NaN:o&lt;c?-1:o&gt;c?1:o&gt;=c?0:NaN}function qM(c){let o,u,p;c.length!==2?(o=uf,u=(A,R)=&gt;uf(c(A),R),p=(A,R)=&gt;c(A)-R):(o=c===uf||c===jV?c:GV,u=c,p=c);function g(A,R,L=0,G=A.length){if(L&lt;G){if(o(R,R)!==0)return G;do{const j=L+G&gt;&gt;&gt;1;u(A[j],R)&lt;0?L=j+1:G=j}while(L&lt;G)}return L}function v(A,R,L=0,G=A.length){if(L&lt;G){if(o(R,R)!==0)return G;do{const j=L+G&gt;&gt;&gt;1;u(A[j],R)&lt;=0?L=j+1:G=j}while(L&lt;G)}return L}function E(A,R,L=0,G=A.length){const j=g(A,R,L,G-1);return j&gt;L&amp;&amp;p(A[j-1],R)&gt;-p(A[j],R)?j-1:j}return{left:g,center:E,right:v}}function GV(){return 0}function HV(c){return c===null?NaN:+c}const WV=qM(uf),qV=WV.right;qM(HV).center;const ZV=Math.sqrt(50),$V=Math.sqrt(10),XV=Math.sqrt(2);function Tf(c,o,u){const p=(o-c)/Math.max(0,u),g=Math.floor(Math.log10(p)),v=p/Math.pow(10,g),E=v&gt;=ZV?10:v&gt;=$V?5:v&gt;=XV?2:1;let A,R,L;return g&lt;0?(L=Math.pow(10,-g)/E,A=Math.round(c*L),R=Math.round(o*L),A/L&lt;c&amp;&amp;++A,R/L&gt;o&amp;&amp;--R,L=-L):(L=Math.pow(10,g)*E,A=Math.round(c/L),R=Math.round(o/L),A*L&lt;c&amp;&amp;++A,R*L&gt;o&amp;&amp;--R),R&lt;A&amp;&amp;.5&lt;=u&amp;&amp;u&lt;2?Tf(c,o,u*2):[A,R,L]}function YV(c,o,u){if(o=+o,c=+c,u=+u,!(u&gt;0))return[];if(c===o)return[c];const p=o&lt;c,[g,v,E]=p?Tf(o,c,u):Tf(c,o,u);if(!(v&gt;=g))return[];const A=v-g+1,R=new Array(A);if(p)if(E&lt;0)for(let L=0;L&lt;A;++L)R[L]=(v-L)/-E;else for(let L=0;L&lt;A;++L)R[L]=(v-L)*E;else if(E&lt;0)for(let L=0;L&lt;A;++L)R[L]=(g+L)/-E;else for(let L=0;L&lt;A;++L)R[L]=(g+L)*E;return R}function cy(c,o,u){return o=+o,c=+c,u=+u,Tf(c,o,u)[2]}function KV(c,o,u){o=+o,c=+c,u=+u;const p=o&lt;c,g=p?cy(o,c,u):cy(c,o,u);return(p?-1:1)*(g&lt;0?1/-g:g)}function By(c,o,u){c.prototype=o.prototype=u,u.constructor=c}function ZM(c,o){var u=Object.create(c.prototype);for(var p in o)u[p]=o[p];return u}function Du(){}var Eu=.7,Ef=1/Eu,Nl="\\s*([+-]?\\d+)\\s*",Su="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Is="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",JV=/^#([0-9a-f]{3,8})$/,QV=new RegExp(`^rgb\\(${Nl},${Nl},${Nl}\\)$`),tj=new RegExp(`^rgb\\(${Is},${Is},${Is}\\)$`),ej=new RegExp(`^rgba\\(${Nl},${Nl},${Nl},${Su}\\)$`),ij=new RegExp(`^rgba\\(${Is},${Is},${Is},${Su}\\)$`),rj=new RegExp(`^hsl\\(${Su},${Is},${Is}\\)$`),nj=new RegExp(`^hsla\\(${Su},${Is},${Is},${Su}\\)$`),cA={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};By(Du,Au,{copy(c){return Object.assign(new this.constructor,this,c)},displayable(){return this.rgb().displayable()},hex:uA,formatHex:uA,formatHex8:sj,formatHsl:oj,formatRgb:hA,toString:hA});function uA(){return this.rgb().formatHex()}function sj(){return this.rgb().formatHex8()}function oj(){return $M(this).formatHsl()}function hA(){return this.rgb().formatRgb()}function Au(c){var o,u;return c=(c+"").trim().toLowerCase(),(o=JV.exec(c))?(u=o[1].length,o=parseInt(o[1],16),u===6?dA(o):u===3?new on(o&gt;&gt;8&amp;15|o&gt;&gt;4&amp;240,o&gt;&gt;4&amp;15|o&amp;240,(o&amp;15)&lt;&lt;4|o&amp;15,1):u===8?ef(o&gt;&gt;24&amp;255,o&gt;&gt;16&amp;255,o&gt;&gt;8&amp;255,(o&amp;255)/255):u===4?ef(o&gt;&gt;12&amp;15|o&gt;&gt;8&amp;240,o&gt;&gt;8&amp;15|o&gt;&gt;4&amp;240,o&gt;&gt;4&amp;15|o&amp;240,((o&amp;15)&lt;&lt;4|o&amp;15)/255):null):(o=QV.exec(c))?new on(o[1],o[2],o[3],1):(o=tj.exec(c))?new on(o[1]*255/100,o[2]*255/100,o[3]*255/100,1):(o=ej.exec(c))?ef(o[1],o[2],o[3],o[4]):(o=ij.exec(c))?ef(o[1]*255/100,o[2]*255/100,o[3]*255/100,o[4]):(o=rj.exec(c))?mA(o[1],o[2]/100,o[3]/100,1):(o=nj.exec(c))?mA(o[1],o[2]/100,o[3]/100,o[4]):cA.hasOwnProperty(c)?dA(cA[c]):c==="transparent"?new on(NaN,NaN,NaN,0):null}function dA(c){return new on(c&gt;&gt;16&amp;255,c&gt;&gt;8&amp;255,c&amp;255,1)}function ef(c,o,u,p){return p&lt;=0&amp;&amp;(c=o=u=NaN),new on(c,o,u,p)}function aj(c){return c instanceof Du||(c=Au(c)),c?(c=c.rgb(),new on(c.r,c.g,c.b,c.opacity)):new on}function Sf(c,o,u,p){return arguments.length===1?aj(c):new on(c,o,u,p??1)}function on(c,o,u,p){this.r=+c,this.g=+o,this.b=+u,this.opacity=+p}By(on,Sf,ZM(Du,{brighter(c){return c=c==null?Ef:Math.pow(Ef,c),new on(this.r*c,this.g*c,this.b*c,this.opacity)},darker(c){return c=c==null?Eu:Math.pow(Eu,c),new on(this.r*c,this.g*c,this.b*c,this.opacity)},rgb(){return this},clamp(){return new on(Ca(this.r),Ca(this.g),Ca(this.b),Af(this.opacity))},displayable(){return-.5&lt;=this.r&amp;&amp;this.r&lt;255.5&amp;&amp;-.5&lt;=this.g&amp;&amp;this.g&lt;255.5&amp;&amp;-.5&lt;=this.b&amp;&amp;this.b&lt;255.5&amp;&amp;0&lt;=this.opacity&amp;&amp;this.opacity&lt;=1},hex:fA,formatHex:fA,formatHex8:lj,formatRgb:pA,toString:pA}));function fA(){return`#${Ma(this.r)}${Ma(this.g)}${Ma(this.b)}`}function lj(){return`#${Ma(this.r)}${Ma(this.g)}${Ma(this.b)}${Ma((isNaN(this.opacity)?1:this.opacity)*255)}`}function pA(){const c=Af(this.opacity);return`${c===1?"rgb(":"rgba("}${Ca(this.r)}, ${Ca(this.g)}, ${Ca(this.b)}${c===1?")":`, ${c})`}`}function Af(c){return isNaN(c)?1:Math.max(0,Math.min(1,c))}function Ca(c){return Math.max(0,Math.min(255,Math.round(c)||0))}function Ma(c){return c=Ca(c),(c&lt;16?"0":"")+c.toString(16)}function mA(c,o,u,p){return p&lt;=0?c=o=u=NaN:u&lt;=0||u&gt;=1?c=o=NaN:o&lt;=0&amp;&amp;(c=NaN),new Jn(c,o,u,p)}function $M(c){if(c instanceof Jn)return new Jn(c.h,c.s,c.l,c.opacity);if(c instanceof Du||(c=Au(c)),!c)return new Jn;if(c instanceof Jn)return c;c=c.rgb();var o=c.r/255,u=c.g/255,p=c.b/255,g=Math.min(o,u,p),v=Math.max(o,u,p),E=NaN,A=v-g,R=(v+g)/2;return A?(o===v?E=(u-p)/A+(u&lt;p)*6:u===v?E=(p-o)/A+2:E=(o-u)/A+4,A/=R&lt;.5?v+g:2-v-g,E*=60):A=R&gt;0&amp;&amp;R&lt;1?0:E,new Jn(E,A,R,c.opacity)}function cj(c,o,u,p){return arguments.length===1?$M(c):new Jn(c,o,u,p??1)}function Jn(c,o,u,p){this.h=+c,this.s=+o,this.l=+u,this.opacity=+p}By(Jn,cj,ZM(Du,{brighter(c){return c=c==null?Ef:Math.pow(Ef,c),new Jn(this.h,this.s,this.l*c,this.opacity)},darker(c){return c=c==null?Eu:Math.pow(Eu,c),new Jn(this.h,this.s,this.l*c,this.opacity)},rgb(){var c=this.h%360+(this.h&lt;0)*360,o=isNaN(c)||isNaN(this.s)?0:this.s,u=this.l,p=u+(u&lt;.5?u:1-u)*o,g=2*u-p;return new on(zg(c&gt;=240?c-240:c+120,g,p),zg(c,g,p),zg(c&lt;120?c+240:c-120,g,p),this.opacity)},clamp(){return new Jn(_A(this.h),rf(this.s),rf(this.l),Af(this.opacity))},displayable(){return(0&lt;=this.s&amp;&amp;this.s&lt;=1||isNaN(this.s))&amp;&amp;0&lt;=this.l&amp;&amp;this.l&lt;=1&amp;&amp;0&lt;=this.opacity&amp;&amp;this.opacity&lt;=1},formatHsl(){const c=Af(this.opacity);return`${c===1?"hsl(":"hsla("}${_A(this.h)}, ${rf(this.s)*100}%, ${rf(this.l)*100}%${c===1?")":`, ${c})`}`}}));function _A(c){return c=(c||0)%360,c&lt;0?c+360:c}function rf(c){return Math.max(0,Math.min(1,c||0))}function zg(c,o,u){return(c&lt;60?o+(u-o)*c/60:c&lt;180?u:c&lt;240?o+(u-o)*(240-c)/60:o)*255}const Ny=c=&gt;()=&gt;c;function uj(c,o){return function(u){return c+u*o}}function hj(c,o,u){return c=Math.pow(c,u),o=Math.pow(o,u)-c,u=1/u,function(p){return Math.pow(c+p*o,u)}}function dj(c){return(c=+c)==1?XM:function(o,u){return u-o?hj(o,u,c):Ny(isNaN(o)?u:o)}}function XM(c,o){var u=o-c;return u?uj(c,u):Ny(isNaN(c)?o:c)}const uy=function c(o){var u=dj(o);function p(g,v){var E=u((g=Sf(g)).r,(v=Sf(v)).r),A=u(g.g,v.g),R=u(g.b,v.b),L=XM(g.opacity,v.opacity);return function(G){return g.r=E(G),g.g=A(G),g.b=R(G),g.opacity=L(G),g+""}}return p.gamma=c,p}(1);function fj(c,o){o||(o=[]);var u=c?Math.min(o.length,c.length):0,p=o.slice(),g;return function(v){for(g=0;g&lt;u;++g)p[g]=c[g]*(1-v)+o[g]*v;return p}}function pj(c){return ArrayBuffer.isView(c)&amp;&amp;!(c instanceof DataView)}function mj(c,o){var u=o?o.length:0,p=c?Math.min(u,c.length):0,g=new Array(p),v=new Array(u),E;for(E=0;E&lt;p;++E)g[E]=Uy(c[E],o[E]);for(;E&lt;u;++E)v[E]=o[E];return function(A){for(E=0;E&lt;p;++E)v[E]=g[E](A);return v}}function _j(c,o){var u=new Date;return c=+c,o=+o,function(p){return u.setTime(c*(1-p)+o*p),u}}function Mf(c,o){return c=+c,o=+o,function(u){return c*(1-u)+o*u}}function gj(c,o){var u={},p={},g;(c===null||typeof c!="object")&amp;&amp;(c={}),(o===null||typeof o!="object")&amp;&amp;(o={});for(g in o)g in c?u[g]=Uy(c[g],o[g]):p[g]=o[g];return function(v){for(g in u)p[g]=u[g](v);return p}}var hy=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Fg=new RegExp(hy.source,"g");function yj(c){return function(){return c}}function xj(c){return function(o){return c(o)+""}}function vj(c,o){var u=hy.lastIndex=Fg.lastIndex=0,p,g,v,E=-1,A=[],R=[];for(c=c+"",o=o+"";(p=hy.exec(c))&amp;&amp;(g=Fg.exec(o));)(v=g.index)&gt;u&amp;&amp;(v=o.slice(u,v),A[E]?A[E]+=v:A[++E]=v),(p=p[0])===(g=g[0])?A[E]?A[E]+=g:A[++E]=g:(A[++E]=null,R.push({i:E,x:Mf(p,g)})),u=Fg.lastIndex;return u&lt;o.length&amp;&amp;(v=o.slice(u),A[E]?A[E]+=v:A[++E]=v),A.length&lt;2?R[0]?xj(R[0].x):yj(o):(o=R.length,function(L){for(var G=0,j;G&lt;o;++G)A[(j=R[G]).i]=j.x(L);return A.join("")})}function Uy(c,o){var u=typeof o,p;return o==null||u==="boolean"?Ny(o):(u==="number"?Mf:u==="string"?(p=Au(o))?(o=p,uy):vj:o instanceof Au?uy:o instanceof Date?_j:pj(o)?fj:Array.isArray(o)?mj:typeof o.valueOf!="function"&amp;&amp;typeof o.toString!="function"||isNaN(o)?gj:Mf)(c,o)}function bj(c,o){return c=+c,o=+o,function(u){return Math.round(c*(1-u)+o*u)}}function wj(c){return Math.abs(c=Math.round(c))&gt;=1e21?c.toLocaleString("en").replace(/,/g,""):c.toString(10)}function If(c,o){if((u=(c=o?c.toExponential(o-1):c.toExponential()).indexOf("e"))&lt;0)return null;var u,p=c.slice(0,u);return[p.length&gt;1?p[0]+p.slice(2):p,+c.slice(u+1)]}function Zl(c){return c=If(Math.abs(c)),c?c[1]:NaN}function Tj(c,o){return function(u,p){for(var g=u.length,v=[],E=0,A=c[0],R=0;g&gt;0&amp;&amp;A&gt;0&amp;&amp;(R+A+1&gt;p&amp;&amp;(A=Math.max(1,p-R)),v.push(u.substring(g-=A,g+A)),!((R+=A+1)&gt;p));)A=c[E=(E+1)%c.length];return v.reverse().join(o)}}function Ej(c){return function(o){return o.replace(/[0-9]/g,function(u){return c[+u]})}}var Sj=/^(?:(.)?([&lt;&gt;=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Pf(c){if(!(o=Sj.exec(c)))throw new Error("invalid format: "+c);var o;return new Vy({fill:o[1],align:o[2],sign:o[3],symbol:o[4],zero:o[5],width:o[6],comma:o[7],precision:o[8]&amp;&amp;o[8].slice(1),trim:o[9],type:o[10]})}Pf.prototype=Vy.prototype;function Vy(c){this.fill=c.fill===void 0?" ":c.fill+"",this.align=c.align===void 0?"&gt;":c.align+"",this.sign=c.sign===void 0?"-":c.sign+"",this.symbol=c.symbol===void 0?"":c.symbol+"",this.zero=!!c.zero,this.width=c.width===void 0?void 0:+c.width,this.comma=!!c.comma,this.precision=c.precision===void 0?void 0:+c.precision,this.trim=!!c.trim,this.type=c.type===void 0?"":c.type+""}Vy.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function Aj(c){t:for(var o=c.length,u=1,p=-1,g;u&lt;o;++u)switch(c[u]){case".":p=g=u;break;case"0":p===0&amp;&amp;(p=u),g=u;break;default:if(!+c[u])break t;p&gt;0&amp;&amp;(p=0);break}return p&gt;0?c.slice(0,p)+c.slice(g+1):c}var YM;function Mj(c,o){var u=If(c,o);if(!u)return c+"";var p=u[0],g=u[1],v=g-(YM=Math.max(-8,Math.min(8,Math.floor(g/3)))*3)+1,E=p.length;return v===E?p:v&gt;E?p+new Array(v-E+1).join("0"):v&gt;0?p.slice(0,v)+"."+p.slice(v):"0."+new Array(1-v).join("0")+If(c,Math.max(0,o+v-1))[0]}function gA(c,o){var u=If(c,o);if(!u)return c+"";var p=u[0],g=u[1];return g&lt;0?"0."+new Array(-g).join("0")+p:p.length&gt;g+1?p.slice(0,g+1)+"."+p.slice(g+1):p+new Array(g-p.length+2).join("0")}const yA={"%":(c,o)=&gt;(c*100).toFixed(o),b:c=&gt;Math.round(c).toString(2),c:c=&gt;c+"",d:wj,e:(c,o)=&gt;c.toExponential(o),f:(c,o)=&gt;c.toFixed(o),g:(c,o)=&gt;c.toPrecision(o),o:c=&gt;Math.round(c).toString(8),p:(c,o)=&gt;gA(c*100,o),r:gA,s:Mj,X:c=&gt;Math.round(c).toString(16).toUpperCase(),x:c=&gt;Math.round(c).toString(16)};function xA(c){return c}var vA=Array.prototype.map,bA=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function Ij(c){var o=c.grouping===void 0||c.thousands===void 0?xA:Tj(vA.call(c.grouping,Number),c.thousands+""),u=c.currency===void 0?"":c.currency[0]+"",p=c.currency===void 0?"":c.currency[1]+"",g=c.decimal===void 0?".":c.decimal+"",v=c.numerals===void 0?xA:Ej(vA.call(c.numerals,String)),E=c.percent===void 0?"%":c.percent+"",A=c.minus===void 0?"−":c.minus+"",R=c.nan===void 0?"NaN":c.nan+"";function L(j){j=Pf(j);var H=j.fill,ht=j.align,mt=j.sign,gt=j.symbol,Pt=j.zero,Vt=j.width,Nt=j.comma,jt=j.precision,Qt=j.trim,ae=j.type;ae==="n"?(Nt=!0,ae="g"):yA[ae]||(jt===void 0&amp;&amp;(jt=12),Qt=!0,ae="g"),(Pt||H==="0"&amp;&amp;ht==="=")&amp;&amp;(Pt=!0,H="0",ht="=");var le=gt==="$"?u:gt==="#"&amp;&amp;/[boxX]/.test(ae)?"0"+ae.toLowerCase():"",Oe=gt==="$"?p:/[%p]/.test(ae)?E:"",Ge=yA[ae],ve=/[defgprs%]/.test(ae);jt=jt===void 0?6:/[gprs]/.test(ae)?Math.max(1,Math.min(21,jt)):Math.max(0,Math.min(20,jt));function Q(Lt){var li=le,Ke=Oe,$t,vi,ts;if(ae==="c")Ke=Ge(Lt)+Ke,Lt="";else{Lt=+Lt;var jr=Lt&lt;0||1/Lt&lt;0;if(Lt=isNaN(Lt)?R:Ge(Math.abs(Lt),jt),Qt&amp;&amp;(Lt=Aj(Lt)),jr&amp;&amp;+Lt==0&amp;&amp;mt!=="+"&amp;&amp;(jr=!1),li=(jr?mt==="("?mt:A:mt==="-"||mt==="("?"":mt)+li,Ke=(ae==="s"?bA[8+YM/3]:"")+Ke+(jr&amp;&amp;mt==="("?")":""),ve){for($t=-1,vi=Lt.length;++$t&lt;vi;)if(ts=Lt.charCodeAt($t),48&gt;ts||ts&gt;57){Ke=(ts===46?g+Lt.slice($t+1):Lt.slice($t))+Ke,Lt=Lt.slice(0,$t);break}}}Nt&amp;&amp;!Pt&amp;&amp;(Lt=o(Lt,1/0));var es=li.length+Lt.length+Ke.length,fr=es&lt;Vt?new Array(Vt-es+1).join(H):"";switch(Nt&amp;&amp;Pt&amp;&amp;(Lt=o(fr+Lt,fr.length?Vt-Ke.length:1/0),fr=""),ht){case"&lt;":Lt=li+Lt+Ke+fr;break;case"=":Lt=li+fr+Lt+Ke;break;case"^":Lt=fr.slice(0,es=fr.length&gt;&gt;1)+li+Lt+Ke+fr.slice(es);break;default:Lt=fr+li+Lt+Ke;break}return v(Lt)}return Q.toString=function(){return j+""},Q}function G(j,H){var ht=L((j=Pf(j),j.type="f",j)),mt=Math.max(-8,Math.min(8,Math.floor(Zl(H)/3)))*3,gt=Math.pow(10,-mt),Pt=bA[8+mt/3];return function(Vt){return ht(gt*Vt)+Pt}}return{format:L,formatPrefix:G}}var nf,KM,JM;Pj({thousands:",",grouping:[3],currency:["$",""]});function Pj(c){return nf=Ij(c),KM=nf.format,JM=nf.formatPrefix,nf}function Cj(c){return Math.max(0,-Zl(Math.abs(c)))}function Lj(c,o){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(Zl(o)/3)))*3-Zl(Math.abs(c)))}function Rj(c,o){return c=Math.abs(c),o=Math.abs(o)-c,Math.max(0,Zl(o)-Zl(c))+1}function Dj(c,o){switch(arguments.length){case 0:break;case 1:this.range(c);break;default:this.range(o).domain(c);break}return this}function Oj(c){return function(){return c}}function kj(c){return+c}var wA=[0,1];function Fl(c){return c}function dy(c,o){return(o-=c=+c)?function(u){return(u-c)/o}:Oj(isNaN(o)?NaN:.5)}function zj(c,o){var u;return c&gt;o&amp;&amp;(u=c,c=o,o=u),function(p){return Math.max(c,Math.min(o,p))}}function Fj(c,o,u){var p=c[0],g=c[1],v=o[0],E=o[1];return g&lt;p?(p=dy(g,p),v=u(E,v)):(p=dy(p,g),v=u(v,E)),function(A){return v(p(A))}}function Bj(c,o,u){var p=Math.min(c.length,o.length)-1,g=new Array(p),v=new Array(p),E=-1;for(c[p]&lt;c[0]&amp;&amp;(c=c.slice().reverse(),o=o.slice().reverse());++E&lt;p;)g[E]=dy(c[E],c[E+1]),v[E]=u(o[E],o[E+1]);return function(A){var R=qV(c,A,1,p)-1;return v[R](g[R](A))}}function Nj(c,o){return o.domain(c.domain()).range(c.range()).interpolate(c.interpolate()).clamp(c.clamp()).unknown(c.unknown())}function Uj(){var c=wA,o=wA,u=Uy,p,g,v,E=Fl,A,R,L;function G(){var H=Math.min(c.length,o.length);return E!==Fl&amp;&amp;(E=zj(c[0],c[H-1])),A=H&gt;2?Bj:Fj,R=L=null,j}function j(H){return H==null||isNaN(H=+H)?v:(R||(R=A(c.map(p),o,u)))(p(E(H)))}return j.invert=function(H){return E(g((L||(L=A(o,c.map(p),Mf)))(H)))},j.domain=function(H){return arguments.length?(c=Array.from(H,kj),G()):c.slice()},j.range=function(H){return arguments.length?(o=Array.from(H),G()):o.slice()},j.rangeRound=function(H){return o=Array.from(H),u=bj,G()},j.clamp=function(H){return arguments.length?(E=H?!0:Fl,G()):E!==Fl},j.interpolate=function(H){return arguments.length?(u=H,G()):u},j.unknown=function(H){return arguments.length?(v=H,j):v},function(H,ht){return p=H,g=ht,G()}}function Vj(){return Uj()(Fl,Fl)}function jj(c,o,u,p){var g=KV(c,o,u),v;switch(p=Pf(p??",f"),p.type){case"s":{var E=Math.max(Math.abs(c),Math.abs(o));return p.precision==null&amp;&amp;!isNaN(v=Lj(g,E))&amp;&amp;(p.precision=v),JM(p,E)}case"":case"e":case"g":case"p":case"r":{p.precision==null&amp;&amp;!isNaN(v=Rj(g,Math.max(Math.abs(c),Math.abs(o))))&amp;&amp;(p.precision=v-(p.type==="e"));break}case"f":case"%":{p.precision==null&amp;&amp;!isNaN(v=Cj(g))&amp;&amp;(p.precision=v-(p.type==="%")*2);break}}return KM(p)}function Gj(c){var o=c.domain;return c.ticks=function(u){var p=o();return YV(p[0],p[p.length-1],u??10)},c.tickFormat=function(u,p){var g=o();return jj(g[0],g[g.length-1],u??10,p)},c.nice=function(u){u==null&amp;&amp;(u=10);var p=o(),g=0,v=p.length-1,E=p[g],A=p[v],R,L,G=10;for(A&lt;E&amp;&amp;(L=E,E=A,A=L,L=g,g=v,v=L);G-- &gt;0;){if(L=cy(E,A,u),L===R)return p[g]=E,p[v]=A,o(p);if(L&gt;0)E=Math.floor(E/L)*L,A=Math.ceil(A/L)*L;else if(L&lt;0)E=Math.ceil(E*L)/L,A=Math.floor(A*L)/L;else break;R=L}return c},c}function QM(){var c=Vj();return c.copy=function(){return Nj(c,QM())},Dj.apply(c,arguments),Gj(c)}function pu(c,o,u){this.k=c,this.x=o,this.y=u}pu.prototype={constructor:pu,scale:function(c){return c===1?this:new pu(this.k*c,this.x,this.y)},translate:function(c,o){return c===0&amp;o===0?this:new pu(this.k,this.x+this.k*c,this.y+this.k*o)},apply:function(c){return[c[0]*this.k+this.x,c[1]*this.k+this.y]},applyX:function(c){return c*this.k+this.x},applyY:function(c){return c*this.k+this.y},invert:function(c){return[(c[0]-this.x)/this.k,(c[1]-this.y)/this.k]},invertX:function(c){return(c-this.x)/this.k},invertY:function(c){return(c-this.y)/this.k},rescaleX:function(c){return c.copy().domain(c.range().map(this.invertX,this).map(c.invert,c))},rescaleY:function(c){return c.copy().domain(c.range().map(this.invertY,this).map(c.invert,c))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};pu.prototype;const Hj={id:"map",ref:"map",class:"map"},Wj=-45,qj=3,Zj=30,$j=2013,Xj=2024,Yj={__name:"Map",setup(c){const o=[-104.9903,39.7392];lA.accessToken="pk.eyJ1IjoidGZqYWNrYyIsImEiOiJjbGhhd3VsZHAwbHV1M3RudGt0bWFhNHl0In0.5qDpeYjN5r-rBh-SYA9Qgw";const u=IE(null),p=IE(null),g=QM().domain([$j,Xj]).range(["white","blue"]).interpolate(uy),v={latitude:o[1],longitude:o[0],zoom:qj,bearing:Wj,pitch:Zj,transitionDuration:"auto"};return pk(()=&gt;{mk(()=&gt;import("./C22pZ_c0.js"),__vite__mapDeps([0,1,2]),import.meta.url).then(async({ArcLayer:E,GeoJsonLayer:A})=&gt;{await _k(),p.value=v;const R=await new E({id:"arc-layer",data:VV,getSourcePosition:j=&gt;j.source,getTargetPosition:j=&gt;j.destination,getSourceColor:[0,255,255],getTargetColor:[255,0,255],getWidth:2}),L=await new A({id:"career-arc-layer",data:"./career_arc.geojson",pickable:!0,stroked:!1,filled:!0,extruded:!0,pointType:"circle",getFillColor:j=&gt;{const H=Sf(g(j.properties.Year));return[H.r,H.g,H.b,255]},getPointRadius:1,pointRadiusScale:10,pointRadiusUnits:"pixels"});let G=new lA.Map({container:"map",style:"mapbox://styles/mapbox/dark-v11",projection:"mercator",interactive:!1,center:[v.longitude,v.latitude],zoom:v.zoom,bearing:v.bearing,pitch:v.pitch});u.value=new Fy({parent:document.getElementById("map"),layers:[L,R],getTooltip:({object:j})=&gt;j&amp;&amp;{html:`&lt;div class="text-lg"&gt;${j.properties.Title}&lt;/div&gt;
               &lt;div class="text-md"&gt;${j.properties.Location}&lt;/div&gt;
               &lt;div class="text-md"&gt;${j.properties.Company}&lt;/div&gt;
               &lt;div class="text-md"&gt;${j.properties.Industry}&lt;/div&gt;`,style:{backgroundColor:"#000",fontColor:"#fff",fontSize:"0.8em"}},viewState:p.value,onViewStateChange:({viewState:j})=&gt;{p.value=j,u.value.setProps({viewState:p.value}),G.jumpTo({center:[j.longitude,j.latitude],zoom:j.zoom,bearing:j.bearing,pitch:j.pitch})},controller:!0})})}),(E,A)=&gt;(gk(),yk("div",Hj,null,512))}},y8=fk(Yj,[["__scopeId","data-v-e72a14ca"]]);export{qo as $,kn as A,Zg as B,Tr as C,Pr as D,rr as E,Cr as F,ro as G,g8 as H,PU as I,Dy as J,u8 as K,Hg as L,Jg as M,d8 as N,ql as O,Df as P,h8 as Q,ka as R,m8 as S,$l as T,_8 as U,f8 as V,Tu as W,p8 as X,hu as Y,W6 as Z,y8 as _,Vr as a,As as a0,Kz as a1,DM as a2,KE as a3,vf as a4,r8 as a5,NM as a6,lM as a7,e8 as b,qe as c,Ia as d,o8 as e,Ms as f,RF as g,wy as h,Li as i,nM as j,v5 as k,Ye as l,a8 as m,s8 as n,j6 as o,L6 as p,l8 as q,sM as r,YB as s,Rf as t,xu as u,MM as v,et as w,n8 as x,LM as y,c8 as z};
</pre></body></html>